From 8d469b66c892111fbf4bff1c6c8c0efb6fcef46f Mon Sep 17 00:00:00 2001 From: Mateusz Uzdowski Date: Mon, 14 May 2012 11:43:36 +1200 Subject: [PATCH] BUGFIX: add missing onunmatches --- admin/javascript/LeftAndMain.AddForm.js | 1 - admin/javascript/LeftAndMain.BatchActions.js | 8 ++++-- admin/javascript/LeftAndMain.EditForm.js | 3 ++ admin/javascript/LeftAndMain.Menu.js | 7 ++++- admin/javascript/LeftAndMain.Panel.js | 6 ++-- admin/javascript/LeftAndMain.Ping.js | 7 +++-- admin/javascript/LeftAndMain.Preview.js | 15 ++++++++-- admin/javascript/LeftAndMain.Tree.js | 3 ++ admin/javascript/LeftAndMain.js | 26 ++++++++++++++++- admin/javascript/MemberImportForm.js | 5 +++- admin/javascript/ModelAdmin.js | 5 +++- admin/javascript/SecurityAdmin.js | 8 +++++- admin/javascript/ssui.core.js | 1 - javascript/AssetUploadField.js | 6 ++-- javascript/GridField.js | 14 +++++++-- javascript/HtmlEditorField.js | 30 +++++++++++++------- javascript/PermissionCheckboxSetField.js | 8 +++++- javascript/TabSet.js | 1 - javascript/TreeDropdownField.js | 8 +++++- javascript/UploadField.js | 7 ++++- javascript/UploadField_select.js | 3 ++ 21 files changed, 138 insertions(+), 34 deletions(-) diff --git a/admin/javascript/LeftAndMain.AddForm.js b/admin/javascript/LeftAndMain.AddForm.js index f55332746..5f32a841a 100644 --- a/admin/javascript/LeftAndMain.AddForm.js +++ b/admin/javascript/LeftAndMain.AddForm.js @@ -59,7 +59,6 @@ onunmatch: function() { this._super(); }, - /** * Function: onsubmit * diff --git a/admin/javascript/LeftAndMain.BatchActions.js b/admin/javascript/LeftAndMain.BatchActions.js index 9a008deb4..a3fe9975a 100644 --- a/admin/javascript/LeftAndMain.BatchActions.js +++ b/admin/javascript/LeftAndMain.BatchActions.js @@ -60,7 +60,9 @@ this._super(); }, - + onunmatch: function() { + this._super(); + }, /** * Updates the select box state according to the current view mode. */ @@ -292,7 +294,9 @@ this.trigger('change'); this._super(); }, - + onunmatch: function() { + this._super(); + }, /** * Function: onchange * diff --git a/admin/javascript/LeftAndMain.EditForm.js b/admin/javascript/LeftAndMain.EditForm.js index a6ddc9c4f..821a79f0f 100644 --- a/admin/javascript/LeftAndMain.EditForm.js +++ b/admin/javascript/LeftAndMain.EditForm.js @@ -209,6 +209,9 @@ var tabs = this.find("ul:first").children('li'); if(tabs.length == 1) this.find('ul:first').hide(); this._super(); + }, + onunmatch: function() { + this._super(); } }); diff --git a/admin/javascript/LeftAndMain.Menu.js b/admin/javascript/LeftAndMain.Menu.js index 5eacfc4b3..5eb7fb30e 100644 --- a/admin/javascript/LeftAndMain.Menu.js +++ b/admin/javascript/LeftAndMain.Menu.js @@ -105,7 +105,9 @@ this._super(); }, - + onunmatch: function() { + this._super(); + }, updateItems: function() { // Hide "edit page" commands unless the section is activated var editPageItem = this.find('#Menu-CMSMain'); @@ -152,6 +154,9 @@ } this._super(); }, + onunmatch: function() { + this._super(); + }, toggle: function() { this[this.hasClass('opened') ? 'close' : 'open'](); }, diff --git a/admin/javascript/LeftAndMain.Panel.js b/admin/javascript/LeftAndMain.Panel.js index 1bca9c67c..50b3f2fe6 100644 --- a/admin/javascript/LeftAndMain.Panel.js +++ b/admin/javascript/LeftAndMain.Panel.js @@ -62,7 +62,9 @@ this._super(); }, - + onunmatch: function() { + this._super(); + }, /** * @param {Boolean} TRUE to expand, FALSE to collapse. * @param {Boolean} TRUE means that events won't be fired, which is useful for the component initialization phase. @@ -138,4 +140,4 @@ } }); }); -}(jQuery)); \ No newline at end of file +}(jQuery)); diff --git a/admin/javascript/LeftAndMain.Ping.js b/admin/javascript/LeftAndMain.Ping.js index 768b00744..1e8b9521e 100644 --- a/admin/javascript/LeftAndMain.Ping.js +++ b/admin/javascript/LeftAndMain.Ping.js @@ -16,7 +16,10 @@ // // this._setupPinging(); // }, - + // onunmatch: function() { + // this._super(); + // } + /** * Function: _setupPinging * @@ -47,4 +50,4 @@ } }); }); -}(jQuery)); \ No newline at end of file +}(jQuery)); diff --git a/admin/javascript/LeftAndMain.Preview.js b/admin/javascript/LeftAndMain.Preview.js index 65c6e14eb..0ca2fba3f 100644 --- a/admin/javascript/LeftAndMain.Preview.js +++ b/admin/javascript/LeftAndMain.Preview.js @@ -89,8 +89,10 @@ this._super(); }, - - loadUrl: function(url) { + onunmatch: function() { + this._super(); + }, + loadUrl: function(url) { this.find('iframe').attr('src', url); }, @@ -201,6 +203,9 @@ onmatch: function() { this.find('a').text('<'); this._super(); + }, + onunmatch: function() { + this._super(); } }); @@ -219,6 +224,9 @@ onmatch: function() { this.find('a').text('>'); this._super(); + }, + onunmatch: function() { + this._super(); } }); @@ -256,6 +264,9 @@ this.find('.cms-preview-watermark').show(); this.find('.active .cms-preview-watermark').hide(); this._super(); + }, + onunmatch: function() { + this._super(); } }); diff --git a/admin/javascript/LeftAndMain.Tree.js b/admin/javascript/LeftAndMain.Tree.js index 619fa2312..97ea54c55 100644 --- a/admin/javascript/LeftAndMain.Tree.js +++ b/admin/javascript/LeftAndMain.Tree.js @@ -332,6 +332,9 @@ this.redraw(); this._super(); }, + onunmatch: function() { + this._super(); + }, onclick: function(e) { this.redraw(); }, diff --git a/admin/javascript/LeftAndMain.js b/admin/javascript/LeftAndMain.js index ce77a87ce..c68bfe28e 100644 --- a/admin/javascript/LeftAndMain.js +++ b/admin/javascript/LeftAndMain.js @@ -120,6 +120,9 @@ jQuery.noConflict(); this._super(); }, + onunmatch: function() { + this._super(); + }, redraw: function() { // Move from inner to outer layouts. Some of the elements might not exist. @@ -313,6 +316,9 @@ jQuery.noConflict(); onmatch: function() { if(!this.hasClass('ss-ui-button')) this.addClass('ss-ui-button'); + this._super(); + }, + onunmatch: function() { this._super(); } }); @@ -321,6 +327,9 @@ jQuery.noConflict(); onmatch: function() { if(!this.data('button')) this.button(); + this._super(); + }, + onunmatch: function() { this._super(); } }); @@ -401,6 +410,9 @@ jQuery.noConflict(); this._super(); this.setUUID(new Date().getTime()); }, + onunmatch: function() { + this._super(); + }, onclick: function() { this._super(); @@ -437,6 +449,9 @@ jQuery.noConflict(); this.redraw(); this._super(); }, + onunmatch: function() { + this._super(); + }, redraw: function() { // Remove whitespace to avoid gaps with inline elements this.contents().filter(function() { @@ -475,6 +490,9 @@ jQuery.noConflict(); // // Unfortunately jQuery UI only allows configuration of icon images, not sprites // this.next('button').button('option', 'icons', {primary : 'ui-icon-calendar'}); + this._super(); + }, + onunmatch: function() { this._super(); } }); @@ -505,9 +523,12 @@ jQuery.noConflict(); // Apply Chosen applyChosen(this); + this._super(); + }, + onunmatch: function() { this._super(); } - }); + }); $(".cms-panel-layout").entwine({ redraw: function() { @@ -573,6 +594,9 @@ jQuery.noConflict(); $(this.attr('href')).hide(); }, + onunmatch: function() { + this._super(); + }, onclick: function(e) { $(this.attr('href')).toggle(); e.preventDefault(); diff --git a/admin/javascript/MemberImportForm.js b/admin/javascript/MemberImportForm.js index 117917486..d5262682a 100644 --- a/admin/javascript/MemberImportForm.js +++ b/admin/javascript/MemberImportForm.js @@ -11,6 +11,9 @@ this._super(); this.hide(); + }, + onunmatch: function() { + this._super(); } }); @@ -29,4 +32,4 @@ }); }); -}(jQuery)); \ No newline at end of file +}(jQuery)); diff --git a/admin/javascript/ModelAdmin.js b/admin/javascript/ModelAdmin.js index c4730eec0..b3a159292 100644 --- a/admin/javascript/ModelAdmin.js +++ b/admin/javascript/ModelAdmin.js @@ -25,8 +25,11 @@ return false; }); + this._super(); + }, + onunmatch: function() { this._super(); } }); }); -})(jQuery); \ No newline at end of file +})(jQuery); diff --git a/admin/javascript/SecurityAdmin.js b/admin/javascript/SecurityAdmin.js index 4493e5b5f..f71e8abc3 100644 --- a/admin/javascript/SecurityAdmin.js +++ b/admin/javascript/SecurityAdmin.js @@ -28,6 +28,9 @@ // TODO entwine can't seem to bind to iframe load events $(this).bind('load', refreshAfterImport); + }, + onunmatch: function() { + this._super(); } }); }); @@ -46,6 +49,9 @@ this._super(); }, + onunmatch: function() { + this._super(); + }, /** * Function: onclick */ @@ -75,4 +81,4 @@ }); }); -}(jQuery)); \ No newline at end of file +}(jQuery)); diff --git a/admin/javascript/ssui.core.js b/admin/javascript/ssui.core.js index ce37e7a5b..588a92a5b 100644 --- a/admin/javascript/ssui.core.js +++ b/admin/javascript/ssui.core.js @@ -13,7 +13,6 @@ onunmatch: function() { this._super(); }, - redraw: function() { this.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-panel ui-corner-bottom'); this.find('ul').addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all'); diff --git a/javascript/AssetUploadField.js b/javascript/AssetUploadField.js index 6877ce67f..93dddde1f 100644 --- a/javascript/AssetUploadField.js +++ b/javascript/AssetUploadField.js @@ -6,12 +6,14 @@ // Hide the "second step" part until we're actually uploading this.find('.ss-uploadfield-editandorganize').hide(); }, + onunmatch: function() { + this._super(); + }, onfileuploadadd: function(e) { this.find('.ss-uploadfield-editandorganize').show(); }, onfileuploadstart: function(e) { this.find('.ss-uploadfield-editandorganize').show(); } - }); -}(jQuery)); \ No newline at end of file +}(jQuery)); diff --git a/javascript/GridField.js b/javascript/GridField.js index 62fea339e..a5d37752a 100644 --- a/javascript/GridField.js +++ b/javascript/GridField.js @@ -152,6 +152,9 @@ this._super(); this.setUUID(new Date().getTime()); }, + onunmatch: function() { + this._super(); + }, onclick: function(e){ var btn = this.closest(':button'), grid = this.getGridField(), form = this.closest('form'), data = form.find(':input').serialize(); @@ -172,12 +175,14 @@ $('.ss-gridfield-print-iframe').entwine({ onmatch: function(){ - this.hide().bind('load', function() - { + this.hide().bind('load', function() { this.focus(); var ifWin = this.contentWindow || this; ifWin.print(); });; + }, + onunmatch: function() { + this._super(); } }); @@ -247,7 +252,7 @@ * rather than the whole form. */ $('.ss-gridfield .filter-header :input').entwine({ - onmatch: function(){ + onmatch: function() { var filterbtn = this.closest('.fieldgroup').find('.ss-gridfield-button-filter'), resetbtn = this.closest('.fieldgroup').find('.ss-gridfield-button-reset'); @@ -257,6 +262,9 @@ } this._super(); }, + onunmatch: function() { + this._super(); + }, onkeydown: function(e) { // Skip reset button events, they should trigger default submission if(this.closest('.ss-gridfield-button-reset').length) return; diff --git a/javascript/HtmlEditorField.js b/javascript/HtmlEditorField.js index c5e2d56fd..84da7e25b 100644 --- a/javascript/HtmlEditorField.js +++ b/javascript/HtmlEditorField.js @@ -230,7 +230,12 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; this._super(); }, - + onunmatch: function() { + // TODO Throws exceptions in Firefox, most likely due to the element being removed from the DOM at this point + // var ed = tinyMCE.get(this.attr('id')); + // if(ed) ed.remove(); + this._super(); + }, redraw: function() { // Using a global config (generated through HTMLEditorConfig PHP logic) var config = ssTinyMceConfig, self = this, ed = this.getEditor(); @@ -274,11 +279,11 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; this.openDialog('link'); }, openMediaDialog: function() { - this.openDialog('media'); + this.openDialog('media'); }, openDialog: function(type) { var capitalize = function(text) { - return text.charAt(0).toUpperCase() + text.slice(1).toLowerCase(); + return text.charAt(0).toUpperCase() + text.slice(1).toLowerCase(); }; var url = $('#cms-editor-dialogs').data('url' + capitalize(type) + 'form'), @@ -298,13 +303,6 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; } }); } - }, - onunmatch: function() { - // TODO Throws exceptions in Firefox, most likely due to the element being removed from the DOM at this point - // var ed = tinyMCE.get(this.attr('id')); - // if(ed) ed.remove(); - - this._super(); } }); @@ -315,6 +313,9 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; this._super(); }, + onunmatch: function() { + this._super(); + }, getForm: function() { return this.find('form'); }, @@ -358,6 +359,9 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; this.redraw(); }, + onunmatch: function() { + this._super(); + }, redraw: function() { }, resetFields: function() { @@ -992,6 +996,9 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; if(this.attr('name') == 'Width') this.closest('.ss-htmleditorfield-file').updateDimensions('Width', 600); }, + onunmatch: function() { + this._super(); + }, onfocusout: function(e) { this.closest('.ss-htmleditorfield-file').updateDimensions(this.attr('name')); } @@ -1021,6 +1028,9 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; fileList.setState('ParentID', self.getValue()); fileList.reload(); }); + }, + onunmatch: function() { + this._super(); } }); diff --git a/javascript/PermissionCheckboxSetField.js b/javascript/PermissionCheckboxSetField.js index 46548d494..73b1eaa4e 100644 --- a/javascript/PermissionCheckboxSetField.js +++ b/javascript/PermissionCheckboxSetField.js @@ -13,6 +13,9 @@ this.toggleCheckboxes(); }, + onunmatch: function() { + this._super(); + }, onclick: function(e) { this.toggleCheckboxes(); }, @@ -62,6 +65,9 @@ this._super(); }, + onunmatch: function() { + this._super(); + }, onclick: function(e) { var checkboxes = this.getCheckboxesExceptThisOne(); if($(this).is(':checked')) { @@ -79,4 +85,4 @@ }); }); -}(jQuery)); \ No newline at end of file +}(jQuery)); diff --git a/javascript/TabSet.js b/javascript/TabSet.js index d9bcb54b9..1882a4439 100644 --- a/javascript/TabSet.js +++ b/javascript/TabSet.js @@ -12,7 +12,6 @@ onunmatch: function() { this._super(); }, - redrawTabs: function() { this.rewriteHashlinks(); this.tabs(); diff --git a/javascript/TreeDropdownField.js b/javascript/TreeDropdownField.js index df1259954..882b22910 100644 --- a/javascript/TreeDropdownField.js +++ b/javascript/TreeDropdownField.js @@ -29,7 +29,7 @@ * @todo Expand title height to fit all elements */ $('.TreeDropdownField').entwine({ - onmatch: function() { + onmatch: function() { this.append( '' + '' + @@ -44,6 +44,9 @@ this.getPanel().hide(); this._super(); }, + onunmatch: function() { + this._super(); + }, getPanel: function() { return this.find('.treedropdownfield-panel'); }, @@ -268,6 +271,9 @@ this.setTitle(title ? title : strings.searchFieldTitle); }, + onunmatch: function() { + this._super(); + }, setTitle: function(title) { if(!title && title !== '') title = strings.fieldTitle; diff --git a/javascript/UploadField.js b/javascript/UploadField.js index e170c8689..6987349f5 100644 --- a/javascript/UploadField.js +++ b/javascript/UploadField.js @@ -160,7 +160,9 @@ this._super(); }, - + onunmatch: function() { + this._super(); + }, openSelectDialog: function() { // Create dialog and load iframe var self = this, config = this.getConfig(), dialogId = 'ss-uploadfield-dialog-' + this.attr('id'), dialog = jQuery('#' + dialogId); @@ -387,6 +389,9 @@ $(this).parent().removeClass('loading'); }); this._super(); + }, + onunmatch: function() { + this._super(); } }); $('div.ss-upload .ss-uploadfield-fromfiles').entwine({ diff --git a/javascript/UploadField_select.js b/javascript/UploadField_select.js index 85a6a6c16..4537ffc99 100644 --- a/javascript/UploadField_select.js +++ b/javascript/UploadField_select.js @@ -12,6 +12,9 @@ fileList.setState('ParentID', self.getValue()); fileList.reload(); }); + }, + onunmatch: function() { + this._super(); } }); });