2010-05-08 04:45:05 +02:00
|
|
|
/**
|
|
|
|
* File: CMSMain.Tree.js
|
|
|
|
*/
|
2007-07-19 12:40:05 +02:00
|
|
|
if(typeof SiteTreeHandlers == 'undefined') SiteTreeHandlers = {};
|
|
|
|
SiteTreeHandlers.parentChanged_url = 'admin/ajaxupdateparent';
|
|
|
|
SiteTreeHandlers.orderChanged_url = 'admin/ajaxupdatesort';
|
|
|
|
SiteTreeHandlers.loadPage_url = 'admin/getitem';
|
|
|
|
SiteTreeHandlers.loadTree_url = 'admin/getsubtree';
|
|
|
|
|
|
|
|
TreeContextMenu = {
|
|
|
|
'Edit this page' : function(treeNode) {
|
|
|
|
treeNode.selectTreeNode();
|
|
|
|
},
|
2008-02-25 03:10:37 +01:00
|
|
|
'Duplicate page and children' : function(treeNode) {
|
|
|
|
// First save the page silently (without confirmation) and then duplicate the page.
|
2010-04-13 07:55:56 +02:00
|
|
|
jQuery('#Form_EditForm').entwine('ss').ajaxSubmit(null, treeNode.duplicatePageWithChildren.bind(treeNode));
|
2008-02-25 03:10:37 +01:00
|
|
|
},
|
|
|
|
'Duplicate just this page' : function(treeNode) {
|
2007-09-15 23:56:40 +02:00
|
|
|
// First save the page silently (without confirmation) and then duplicate the page.
|
2010-04-13 07:55:56 +02:00
|
|
|
jQuery('#Form_EditForm').entwine('ss').ajaxSubmit(null, treeNode.duplicatePageWithChildren.bind(treeNode));
|
2007-07-19 12:40:05 +02:00
|
|
|
},
|
|
|
|
'Sort sub-pages' : function(treeNode) {
|
|
|
|
var children = treeNode.treeNodeHolder().childTreeNodes();
|
|
|
|
var sortedChildren = children.sort(function(a, b) {
|
|
|
|
var titleA = a.aTag.innerHTML.replace(/<[^>]*>/g,'');
|
|
|
|
var titleB = b.aTag.innerHTML.replace(/<[^>]*>/g,'');
|
|
|
|
return titleA < titleB ? -1 : (titleA > titleB ? 1 : 0);
|
|
|
|
});
|
|
|
|
|
|
|
|
var i,child;
|
|
|
|
for(i=0;child=sortedChildren[i];i++) {
|
|
|
|
treeNode.appendTreeNode(child);
|
|
|
|
}
|
|
|
|
|
2007-10-02 07:10:35 +02:00
|
|
|
treeNode.onOrderChanged(sortedChildren,treeNode);
|
2007-07-19 12:40:05 +02:00
|
|
|
}
|
2009-05-14 08:11:18 +02:00
|
|
|
};
|