From 365622c0c978a94cf0d48c0129d5e1b7590d6642 Mon Sep 17 00:00:00 2001 From: Hayden Smith Date: Thu, 16 Oct 2008 02:09:46 +0000 Subject: [PATCH] Implemented a jQuery based version of documents.getElementsBySelector git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@64339 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/LeftAndMain.php | 1 + javascript/LeftAndMain.js | 2 +- javascript/LeftAndMain_right.js | 9 ++++++--- javascript/ReportAdmin_right.js | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php index 0a5e777c..7e818505 100644 --- a/code/LeftAndMain.php +++ b/code/LeftAndMain.php @@ -121,6 +121,7 @@ class LeftAndMain extends Controller { } Requirements::javascript(THIRDPARTY_DIR . '/prototype.js'); + Requirements::javascript(THIRDPARTY_DIR . '/jquery/jquery.js'); Requirements::javascript(THIRDPARTY_DIR . '/behaviour.js'); Requirements::javascript(THIRDPARTY_DIR . '/prototype_improvements.js'); Requirements::javascript(THIRDPARTY_DIR . '/loader.js'); diff --git a/javascript/LeftAndMain.js b/javascript/LeftAndMain.js index 11c70103..0866599f 100644 --- a/javascript/LeftAndMain.js +++ b/javascript/LeftAndMain.js @@ -252,7 +252,7 @@ function ajaxActionsAtTop(formName, actionHolderName, tabName) { var actions = document.getElementsBySelector('#' + formName + ' .Actions')[0]; var holder; - if((holder = $(actionHolderName)) && holder != actions && holder.className != 'ajaxActions') { + if((holder = $(actionHolderName)) && holder != actions) { holder.parentNode.removeChild(holder); } diff --git a/javascript/LeftAndMain_right.js b/javascript/LeftAndMain_right.js index 66e93e50..e2a2815f 100755 --- a/javascript/LeftAndMain_right.js +++ b/javascript/LeftAndMain_right.js @@ -129,9 +129,12 @@ CMSForm.prototype = { tinyMCE.onLoad(); } - if(this.prepareForm) this.prepareForm(); - - Behaviour.apply(this); + // We assume that an evaluated response is generated by FormResponse + // which takes care of calling these method it + if (!evalResponse) { + if (this.prepareForm) this.prepareForm(); + Behaviour.apply(this); + } if(this.resetElements) this.resetElements(); diff --git a/javascript/ReportAdmin_right.js b/javascript/ReportAdmin_right.js index d13c6c00..60e7ccd6 100755 --- a/javascript/ReportAdmin_right.js +++ b/javascript/ReportAdmin_right.js @@ -2,7 +2,7 @@ Behaviour.register({ '#Form_EditForm' : { initialise : function() { - this.openTab = null; + this.openTab = null; this.prepareForm(); },