(function($) { $.entwine('ss', function($){ /** * @class Simple form with a page type dropdown * which creates a new page through #Form_EditForm and adds a new tree node. * @name ss.Form_AddForm * @requires ss.i18n * @requires ss.Form_EditForm */ $('#Form_AddForm').entwine(/** @lends ss.Form_AddForm */{ /** * @type DOMElement */ Tree: null, /** * @type Array Map of ')); } } else { // No tree node selected, reset to original elements $.each(origOptions, function(i, optProps) { if(optProps) dropdown.append($('')); }); } // TODO Re-select the currently selected element // Disable dropdown if no elements are selectable if(allowed) dropdown.removeAttr('disabled'); else dropdown.attr('disabled', 'disabled'); // Set default child (optional) if(selectedNode.hints && selectedNode.hints.defaultChild) { dropdown.val(selectedNode.hints.defaultChild); } // Set parent node (fallback to root) var parentID = tree.getIdxOf(selectedNode); this.find(':input[name=ParentID]').val(parentID ? parentID : 0); } }); }); }(jQuery));