From f18ace08b7081c52a7911756adec3f7deb2039ad Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Mon, 16 Mar 2009 02:59:52 +0000 Subject: [PATCH] BUGFIX #3715: Removed spurious change detection in files and images section BUGFIX: #3715: Show the changes message in a popup instead of a blank confirm box git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@73084 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/LeftAndMain.php | 1 + javascript/LeftAndMain.js | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php index 46f88545..9db36166 100644 --- a/code/LeftAndMain.php +++ b/code/LeftAndMain.php @@ -182,6 +182,7 @@ class LeftAndMain extends Controller { Requirements::javascript(THIRDPARTY_DIR . '/hover.js'); Requirements::javascript(THIRDPARTY_DIR . '/layout_helpers.js'); Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang'); + Requirements::add_i18n_javascript(CMS_DIR . '/javascript/lang'); Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/effects.js'); Requirements::javascript(THIRDPARTY_DIR . '/scriptaculous/dragdrop.js'); diff --git a/javascript/LeftAndMain.js b/javascript/LeftAndMain.js index 9fcfed11..71a79de0 100644 --- a/javascript/LeftAndMain.js +++ b/javascript/LeftAndMain.js @@ -584,7 +584,9 @@ ChangeTracker.prototype = { }, field_changed: function() { - return this.originalSerialized != Form.Element.serialize(this); + // Something a value will go from 'undefined' to ''. Ignore such changes + if((this.originalSerialized+'') == 'undefined') return Form.Element.serialize(this) ? true : false; + else return this.originalSerialized != Form.Element.serialize(this); }, /** @@ -600,8 +602,8 @@ ChangeTracker.prototype = { if(!element.isChanged) element.isChanged = this.field_changed; if(!this.changeDetection_fieldsToIgnore[element.name] && element.isChanged()) { - //if( window.location.href.match( /^https?:\/\/dev/ ) ) - // Debug.log('Changed:'+ element.id + '(' + this.originalSerialized +')->('+Form.Element.serialize(element)+')' ); + //console.log('Changed:'+ element.id + '(' + this.originalSerialized +')->('+Form.Element.serialize(element)+')' ); + //console.log(element) return true; }