diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php index 405b91b1..c5aeaebd 100644 --- a/code/LeftAndMain.php +++ b/code/LeftAndMain.php @@ -214,6 +214,7 @@ class LeftAndMain extends Controller { Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-livequery/jquery.livequery.js'); Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-cookie/jquery.cookie.js'); Requirements::javascript(SAPPHIRE_DIR . '/javascript/jquery-ondemand/jquery.ondemand.js'); + Requirements::javascript(CMS_DIR . '/javascript/jquery-changetracker/lib/jquery.changetracker.js'); Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js'); Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang'); Requirements::add_i18n_javascript(CMS_DIR . '/javascript/lang'); @@ -227,7 +228,6 @@ class LeftAndMain extends Controller { Requirements::javascript(CMS_DIR . '/javascript/LeftAndMain.js'); Requirements::javascript(CMS_DIR . '/javascript/LeftAndMain_left.js'); - Requirements::javascript(CMS_DIR . '/javascript/LeftAndMain_right.js'); Requirements::javascript(CMS_DIR . '/javascript/LeftAndMain.EditForm.js'); Requirements::javascript(CMS_DIR . '/javascript/SideTabs.js'); diff --git a/javascript/CMSMain.js b/javascript/CMSMain.js index d10653ce..2caa41b1 100644 --- a/javascript/CMSMain.js +++ b/javascript/CMSMain.js @@ -124,6 +124,7 @@ var ss_MainLayout; */ $('#Form_EditForm').concrete('ss', function($){ return/** @lends ss.EditForm */{ + /* onmatch: function() { // Alert the user on change of page-type - this might have implications // on the available form fields etc. @@ -132,7 +133,10 @@ var ss_MainLayout; alert('The page type will be updated after the page is saved'); } ); + + $._super(); } + */ }; }); diff --git a/javascript/CMSMain_left.js b/javascript/CMSMain_left.js index 8175094d..f91f2bf7 100755 --- a/javascript/CMSMain_left.js +++ b/javascript/CMSMain_left.js @@ -436,11 +436,11 @@ TreeContextMenu = { }, 'Duplicate page and children' : function(treeNode) { // First save the page silently (without confirmation) and then duplicate the page. - autoSave(false, treeNode.duplicatePageWithChildren.bind(treeNode)); + jQuery('#Form_EditForm').concrete('ss').ajaxSubmit(null, treeNode.duplicatePageWithChildren.bind(treeNode)); }, 'Duplicate just this page' : function(treeNode) { // First save the page silently (without confirmation) and then duplicate the page. - autoSave(false, treeNode.duplicatePage.bind(treeNode)); + jQuery('#Form_EditForm').concrete('ss').ajaxSubmit(null, treeNode.duplicatePageWithChildren.bind(treeNode)); }, 'Sort sub-pages' : function(treeNode) { var children = treeNode.treeNodeHolder().childTreeNodes(); diff --git a/javascript/LeftAndMain.EditForm.js b/javascript/LeftAndMain.EditForm.js index 9b758ce7..6d894d4c 100644 --- a/javascript/LeftAndMain.EditForm.js +++ b/javascript/LeftAndMain.EditForm.js @@ -5,6 +5,7 @@ * and reloading itself through the ajax return values. * Takes care of resizing tabsets within the layout container. * @name ss.Form_EditForm + * @require jquery.changetracker */ $('#Form_EditForm').concrete('ss',function($){ return/** @lends ss.Form_EditForm */{ @@ -15,11 +16,44 @@ */ RemoveText: 'Removed', + /** + * @type Object + */ + ChangeTrackerOptions: {}, + onmatch: function() { + this._setupChangeTracker(); + + $._super(); + }, + + _setupChangeTracker: function() { + var self = this; + // Don't bind any events here, as we dont replace the // full