/**
* File: LeftAndMain.AddForm.js
*/
(function($) {
$.entwine('ss', function($){
/**
* Class: #Form_AddForm
*
* Simple form with a page type dropdown
* which creates a new page through #Form_EditForm and adds a new tree node.
*
* Requires:
* ss.i18n
* #Form_EditForm
*/
$('#Form_AddForm').entwine({
/**
* Variable: Tree
* (DOMElement)
*/
Tree: null,
/**
* Variable: OrigOptions
* (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));