From a5dd1f4fb720545a75b1e7e391a1ec5bbdac4a39 Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Mon, 5 Mar 2012 11:00:14 +1300 Subject: [PATCH] MDL-31660 forms: Added checks for form change detection --- lib/form/filemanager.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/form/filemanager.js b/lib/form/filemanager.js index 10effe45b72..2e02de15617 100644 --- a/lib/form/filemanager.js +++ b/lib/form/filemanager.js @@ -144,7 +144,9 @@ M.form_filemanager.init = function(Y, options) { this.filecount++; this.check_buttons(); this.refresh(this.currentpath); - M.core_formchangechecker.set_form_changed(); + if (typeof M.core_formchangechecker != 'undefined') { + M.core_formchangechecker.set_form_changed(); + } }, check_buttons: function() { var button_addfile = Y.one("#btnadd-"+this.client_id); @@ -214,7 +216,9 @@ M.form_filemanager.init = function(Y, options) { scope.mkdir_dialog.hide(); scope.refresh(filepath); Y.one('#fm-newname').set('value', ''); - M.core_formchangechecker.set_form_changed(); + if (typeof M.core_formchangechecker != 'undefined') { + M.core_formchangechecker.set_form_changed(); + } } }); } @@ -568,7 +572,9 @@ M.form_filemanager.init = function(Y, options) { callback: function(id, obj, args) { scope.filecount--; scope.refresh(obj.filepath); - M.core_formchangechecker.set_form_changed(); + if (typeof M.core_formchangechecker != 'undefined') { + M.core_formchangechecker.set_form_changed(); + } if (scope.filecount < scope.maxfiles && scope.maxfiles!=-1) { var button_addfile = Y.one("#btnadd-"+scope.client_id); button_addfile.setStyle('display', 'inline'); @@ -616,7 +622,9 @@ M.form_filemanager.init = function(Y, options) { alert(M.str.repository.fileexists); } else { scope.refresh(obj.filepath); - M.core_formchangechecker.set_form_changed(); + if (typeof M.core_formchangechecker != 'undefined') { + M.core_formchangechecker.set_form_changed(); + } } Y.one('#fm-rename-input').set('value', ''); scope.rename_dialog.hide(); @@ -694,7 +702,9 @@ M.form_filemanager.init = function(Y, options) { } dialog.cancel(); scope.refresh(p); - M.core_formchangechecker.set_form_changed(); + if (typeof M.core_formchangechecker != 'undefined') { + M.core_formchangechecker.set_form_changed(); + } } }); } -- 2.11.4.GIT