mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
60451f7033
MINOR Renaming load() to loadForm() in LeftAndMain.EditForm.js, to avoid overloading jQuery's native methods MINOR Triggering jQuery events on top of prototype's Observable for better handling with concrete, in SecurityAdmin.js git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92719 467b73ca-7a2a-4603-9d3b-597d59a354a9
56 lines
1.2 KiB
JavaScript
Executable File
56 lines
1.2 KiB
JavaScript
Executable File
if(typeof SiteTreeHandlers == 'undefined') SiteTreeHandlers = {};
|
|
|
|
SiteTree.prototype = {
|
|
castAsTreeNode: function(li) {
|
|
behaveAs(li, SiteTreeNode, this.options);
|
|
},
|
|
|
|
getIdxOf : function(treeNode) {
|
|
if(treeNode && treeNode.id)
|
|
return treeNode.id;
|
|
},
|
|
|
|
getTreeNodeByIdx : function(idx) {
|
|
if(!idx) idx = "0";
|
|
return document.getElementById(idx);
|
|
},
|
|
|
|
initialise: function() {
|
|
this.observeMethod('SelectionChanged', this.changeCurrentTo);
|
|
}
|
|
|
|
};
|
|
|
|
SiteTreeNode.prototype.onselect = function() {
|
|
$('sitetree').changeCurrentTo(this);
|
|
jQuery('#sitetree').trigger('selectionchanged');
|
|
if($('sitetree').notify('SelectionChanged', this)) {
|
|
this.getPageFromServer();
|
|
}
|
|
return false;
|
|
};
|
|
|
|
SiteTreeNode.prototype.getPageFromServer = function() {
|
|
if(this.id)
|
|
$('Form_EditForm').getPageFromServer(this.id);
|
|
};
|
|
|
|
function reloadSiteTree() {
|
|
|
|
new Ajax.Request( 'admin/report/getsitetree', {
|
|
method: get,
|
|
onSuccess: function( response ) {
|
|
$('sitetree_holder').innerHTML = response.responseText;
|
|
},
|
|
onFailure: function( response ) {
|
|
|
|
}
|
|
});
|
|
}
|
|
|
|
jQuery(document).ready(function() {
|
|
if($('sitetree')) {
|
|
var selectedNode = $('sitetree').getElementsByTagName('li')[1];
|
|
selectedNode.onselect();
|
|
}
|
|
}); |