From 1b312ae81b0f5cba2e05ab49560ddebad162e23c Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 21 Nov 2009 02:35:57 +0000 Subject: [PATCH] API CHANGE Removed ajaxActionsAtTop() and prepareAjaxActions() javascript methods, to be replaced with new concrete implementation git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92598 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- javascript/LeftAndMain.js | 46 --------------------------------- javascript/LeftAndMain_right.js | 2 -- javascript/ModelAdmin.js | 6 ----- javascript/ReportAdmin_right.js | 1 - 4 files changed, 55 deletions(-) diff --git a/javascript/LeftAndMain.js b/javascript/LeftAndMain.js index 791e1fef..fda9d5ba 100644 --- a/javascript/LeftAndMain.js +++ b/javascript/LeftAndMain.js @@ -62,52 +62,6 @@ function unlockStatusMessage() { } } -/** - * Move form actions to the top and make them ajax - */ -function ajaxActionsAtTop(formName, actionHolderName, tabName) { - var actions = document.getElementsBySelector('#' + formName + ' .Actions')[0]; - var holder; - - if((holder = $(actionHolderName)) && holder != actions) { - holder.parentNode.removeChild(holder); - } - - if(actions) { - actions.id = actionHolderName; - actions.className = 'ajaxActions'; - - $(tabName).appendChild(actions); - prepareAjaxActions(actions, formName, tabName); - } -} - -/** - * Prepare the ajax actions so that the buttons actually do something - */ -function prepareAjaxActions(actions, formName, tabName) { - var i, button, list = actions.getElementsByTagName('input') - for (i=0;button=list[i];i++) { - button.ownerForm = $(formName); - - button.onclick = function(e) { - if(!e) e = window.event; - // tries to call a custom method of the format "action__right" - if(window[this.name + '_' + tabName]) { - window[this.name + '_' + tabName](e); - } else { - statusMessage('...'); - Ajax.SubmitForm(this.ownerForm, this.name, { - onSuccess: Ajax.Evaluator, - onFailure: ajaxErrorHandler - }); - } - return false; - } - // behaveAs(button, StatusTitle); - } -} - /** * Submit the given form and evaluate the Ajax response. * Needs to be bound to an object with the following parameters to work: diff --git a/javascript/LeftAndMain_right.js b/javascript/LeftAndMain_right.js index ab16360a..725ddec8 100755 --- a/javascript/LeftAndMain_right.js +++ b/javascript/LeftAndMain_right.js @@ -22,7 +22,6 @@ CMSForm.prototype = { * Processing called whenever a page is loaded in the right - including the initial one */ prepareForm : function() { - ajaxActionsAtTop(this.id, 'form_actions_' + this.formName, this.formName); }, /** @@ -31,7 +30,6 @@ CMSForm.prototype = { loadActionsFromString : function(actionHTML) { var actionHolder = $('form_actions_' + this.formName); actionHolder.innerHTML = actionHTML; - prepareAjaxActions(actionHolder, this.id, this.formName); }, /** diff --git a/javascript/ModelAdmin.js b/javascript/ModelAdmin.js index 80dedaa4..320a8c92 100644 --- a/javascript/ModelAdmin.js +++ b/javascript/ModelAdmin.js @@ -398,10 +398,4 @@ function fixHeight_left() { //fitToParent('LeftPane'); fitToParent('Search_holder',12); fitToParent('ResultTable_holder',12); -} - -function prepareAjaxActions(actions, formName, tabName) { - // @todo HACK Overwrites LeftAndMain.js version of this method to avoid double form actions - // (by new jQuery and legacy prototype) - return false; } \ No newline at end of file diff --git a/javascript/ReportAdmin_right.js b/javascript/ReportAdmin_right.js index 99bf1172..b5b4eb44 100755 --- a/javascript/ReportAdmin_right.js +++ b/javascript/ReportAdmin_right.js @@ -10,7 +10,6 @@ Behaviour.register({ * Processing called whenever a page is loaded in the right - including the initial one */ prepareForm : function() { - ajaxActionsAtTop('Form_EditForm', 'form_actions', 'right'); }, /**