From 50b1b5eea1d07871ea2a0bb235b657a4f83f70af Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Wed, 6 Nov 2024 20:24:54 +0000 Subject: [PATCH] MDL-83648 javascript dialogues: fix responsive behaviour visibilityChanged in the dialogue base class does important things. Therefore if ajaxException and exception also want to do something else in response to the visibleChange event, it should use a different method name, rather than a name that collides with the base class method. --- .../moodle-core-notification-ajaxexception-debug.js | 4 ++-- .../moodle-core-notification-ajaxexception-min.js | 2 +- .../moodle-core-notification-ajaxexception.js | 4 ++-- .../moodle-core-notification-exception-debug.js | 4 ++-- .../moodle-core-notification-exception-min.js | 2 +- .../moodle-core-notification-exception.js | 4 ++-- lib/yui/src/notification/js/ajaxexception.js | 4 ++-- lib/yui/src/notification/js/exception.js | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception-debug.js b/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception-debug.js index c4eef374006..a3ffe537364 100644 --- a/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception-debug.js +++ b/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception-debug.js @@ -85,11 +85,11 @@ Y.extend(AJAXEXCEPTION, M.core.notification.info, { self.hide(); }, delay); } - this.after('visibleChange', this.visibilityChanged, this); + this.after('visibleChange', this.errorVisibilityChanged, this); this._keypress = Y.on('key', this.hide, window, 'down:13, 27', this); this.centerDialogue(); }, - visibilityChanged: function(e) { + errorVisibilityChanged: function(e) { if (e.attrName === 'visible' && e.prevVal && !e.newVal) { var self = this; this._keypress.detach(); diff --git a/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception-min.js b/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception-min.js index 212f1e03c30..75c63307996 100644 --- a/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception-min.js +++ b/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception-min.js @@ -1 +1 @@ -YUI.add("moodle-core-notification-ajaxexception",function(a,e){var t;M.core=M.core||{},a.extend(t=function(e){e.name=e.name||M.util.get_string("error","moodle"),e.closeButton=!0,t.superclass.constructor.apply(this,[e])},M.core.notification.info,{_keypress:null,initializer:function(e){var t=this,i=this.get("hideTimeoutDelay"),o=M.util.get_string("labelsep","langconfig");this.get("notificationBase").addClass("moodle-dialogue-exception"),this.setStdModContent(a.WidgetStdMod.HEADER,'
'+a.Escape.html(e.name)+"
",a.WidgetStdMod.REPLACE),e=a.Node.create('
').append(a.Node.create('
'+a.Escape.html(this.get("error"))+"
")).append(a.Node.create('")).append(a.Node.create('")).append(a.Node.create('")),M.cfg.developerdebug&&e.all(".moodle-exception-param").removeClass("hidden"),this.setStdModContent(a.WidgetStdMod.BODY,e,a.WidgetStdMod.REPLACE),i&&(this._hideTimeout=setTimeout(function(){t.hide()},i)),this.after("visibleChange",this.visibilityChanged,this),this._keypress=a.on("key",this.hide,window,"down:13, 27",this),this.centerDialogue()},visibilityChanged:function(e){var t;"visible"===e.attrName&&e.prevVal&&!e.newVal&&((t=this)._keypress.detach(),setTimeout(function(){t.destroy()},1e3))}},{NAME:"Moodle AJAX exception",CSS_PREFIX:"moodle-dialogue",ATTRS:{error:{validator:a.Lang.isString,value:M.util.get_string("unknownerror","moodle")},debuginfo:{value:null},stacktrace:{value:null},reproductionlink:{setter:function(e){return e=null!==e?''+e.replace(M.cfg.wwwroot,"")+"":e},value:null},hideTimeoutDelay:{validator:a.Lang.isNumber,value:null}}}),M.core.ajaxException=t},"@VERSION@",{requires:["moodle-core-notification-dialogue"]}); \ No newline at end of file +YUI.add("moodle-core-notification-ajaxexception",function(a,e){var t;M.core=M.core||{},a.extend(t=function(e){e.name=e.name||M.util.get_string("error","moodle"),e.closeButton=!0,t.superclass.constructor.apply(this,[e])},M.core.notification.info,{_keypress:null,initializer:function(e){var t=this,i=this.get("hideTimeoutDelay"),o=M.util.get_string("labelsep","langconfig");this.get("notificationBase").addClass("moodle-dialogue-exception"),this.setStdModContent(a.WidgetStdMod.HEADER,'
'+a.Escape.html(e.name)+"
",a.WidgetStdMod.REPLACE),e=a.Node.create('
').append(a.Node.create('
'+a.Escape.html(this.get("error"))+"
")).append(a.Node.create('")).append(a.Node.create('")).append(a.Node.create('")),M.cfg.developerdebug&&e.all(".moodle-exception-param").removeClass("hidden"),this.setStdModContent(a.WidgetStdMod.BODY,e,a.WidgetStdMod.REPLACE),i&&(this._hideTimeout=setTimeout(function(){t.hide()},i)),this.after("visibleChange",this.errorVisibilityChanged,this),this._keypress=a.on("key",this.hide,window,"down:13, 27",this),this.centerDialogue()},errorVisibilityChanged:function(e){var t;"visible"===e.attrName&&e.prevVal&&!e.newVal&&((t=this)._keypress.detach(),setTimeout(function(){t.destroy()},1e3))}},{NAME:"Moodle AJAX exception",CSS_PREFIX:"moodle-dialogue",ATTRS:{error:{validator:a.Lang.isString,value:M.util.get_string("unknownerror","moodle")},debuginfo:{value:null},stacktrace:{value:null},reproductionlink:{setter:function(e){return e=null!==e?''+e.replace(M.cfg.wwwroot,"")+"":e},value:null},hideTimeoutDelay:{validator:a.Lang.isNumber,value:null}}}),M.core.ajaxException=t},"@VERSION@",{requires:["moodle-core-notification-dialogue"]}); \ No newline at end of file diff --git a/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception.js b/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception.js index c4eef374006..a3ffe537364 100644 --- a/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception.js +++ b/lib/yui/build/moodle-core-notification-ajaxexception/moodle-core-notification-ajaxexception.js @@ -85,11 +85,11 @@ Y.extend(AJAXEXCEPTION, M.core.notification.info, { self.hide(); }, delay); } - this.after('visibleChange', this.visibilityChanged, this); + this.after('visibleChange', this.errorVisibilityChanged, this); this._keypress = Y.on('key', this.hide, window, 'down:13, 27', this); this.centerDialogue(); }, - visibilityChanged: function(e) { + errorVisibilityChanged: function(e) { if (e.attrName === 'visible' && e.prevVal && !e.newVal) { var self = this; this._keypress.detach(); diff --git a/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception-debug.js b/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception-debug.js index 22d883728ec..288f7b5ba3e 100644 --- a/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception-debug.js +++ b/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception-debug.js @@ -100,11 +100,11 @@ Y.extend(EXCEPTION, M.core.notification.info, { self.hide(); }, delay); } - this.after('visibleChange', this.visibilityChanged, this); + this.after('visibleChange', this.errorVisibilityChanged, this); this._keypress = Y.on('key', this.hide, window, 'down:13,27', this); this.centerDialogue(); }, - visibilityChanged: function(e) { + errorVisibilityChanged: function(e) { if (e.attrName === 'visible' && e.prevVal && !e.newVal) { if (this._keypress) { this._keypress.detach(); diff --git a/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception-min.js b/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception-min.js index 753915b3fb9..bcc84ec5d5b 100644 --- a/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception-min.js +++ b/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception-min.js @@ -1 +1 @@ -YUI.add("moodle-core-notification-exception",function(o,e){var a;M.core=M.core||{},o.extend(a=function(i){var t=o.mix({},i);t.width=t.width||M.cfg.developerdebug?Math.floor(o.one(document.body).get("winWidth")/3)+"px":null,t.closeButton=!0,o.Array.each(["message","name","fileName","lineNumber","stack"],function(e){t[e]=i[e]}),a.superclass.constructor.apply(this,[t])},M.core.notification.info,{_hideTimeout:null,_keypress:null,initializer:function(e){var i=this,t=this.get("hideTimeoutDelay"),a=M.util.get_string("labelsep","langconfig");this.get("notificationBase").addClass("moodle-dialogue-exception"),this.setStdModContent(o.WidgetStdMod.HEADER,'
'+o.Escape.html(e.name)+"
",o.WidgetStdMod.REPLACE),e=o.Node.create('
').append(o.Node.create('
'+o.Escape.html(this.get("message"))+"
")).append(o.Node.create('")).append(o.Node.create('")).append(o.Node.create('")),M.cfg.developerdebug&&e.all(".moodle-exception-param").removeClass("hidden"),this.setStdModContent(o.WidgetStdMod.BODY,e,o.WidgetStdMod.REPLACE),t&&(this._hideTimeout=setTimeout(function(){i.hide()},t)),this.after("visibleChange",this.visibilityChanged,this),this._keypress=o.on("key",this.hide,window,"down:13,27",this),this.centerDialogue()},visibilityChanged:function(e){var i;"visible"===e.attrName&&e.prevVal&&!e.newVal&&(this._keypress&&this._keypress.detach(),i=this,setTimeout(function(){i.destroy()},1e3))}},{NAME:"Moodle exception",CSS_PREFIX:"moodle-dialogue",ATTRS:{message:{value:""},name:{value:""},fileName:{value:""},lineNumber:{value:""},stack:{setter:function(e){var i,t=o.Escape.html(e).split("\n"),a=new RegExp("^(.+)@("+M.cfg.wwwroot+")?(.{0,75}).*:(\\d+)$");for(i in t)t[i]=t[i].replace(a,"
ln: $4
$3
$1
");return t.join("\n")},value:""},hideTimeoutDelay:{validator:o.Lang.isNumber,value:null}}}),M.core.exception=a},"@VERSION@",{requires:["moodle-core-notification-dialogue"]}); \ No newline at end of file +YUI.add("moodle-core-notification-exception",function(o,e){var a;M.core=M.core||{},o.extend(a=function(i){var t=o.mix({},i);t.width=t.width||M.cfg.developerdebug?Math.floor(o.one(document.body).get("winWidth")/3)+"px":null,t.closeButton=!0,o.Array.each(["message","name","fileName","lineNumber","stack"],function(e){t[e]=i[e]}),a.superclass.constructor.apply(this,[t])},M.core.notification.info,{_hideTimeout:null,_keypress:null,initializer:function(e){var i=this,t=this.get("hideTimeoutDelay"),a=M.util.get_string("labelsep","langconfig");this.get("notificationBase").addClass("moodle-dialogue-exception"),this.setStdModContent(o.WidgetStdMod.HEADER,'
'+o.Escape.html(e.name)+"
",o.WidgetStdMod.REPLACE),e=o.Node.create('
').append(o.Node.create('
'+o.Escape.html(this.get("message"))+"
")).append(o.Node.create('")).append(o.Node.create('")).append(o.Node.create('")),M.cfg.developerdebug&&e.all(".moodle-exception-param").removeClass("hidden"),this.setStdModContent(o.WidgetStdMod.BODY,e,o.WidgetStdMod.REPLACE),t&&(this._hideTimeout=setTimeout(function(){i.hide()},t)),this.after("visibleChange",this.errorVisibilityChanged,this),this._keypress=o.on("key",this.hide,window,"down:13,27",this),this.centerDialogue()},errorVisibilityChanged:function(e){var i;"visible"===e.attrName&&e.prevVal&&!e.newVal&&(this._keypress&&this._keypress.detach(),i=this,setTimeout(function(){i.destroy()},1e3))}},{NAME:"Moodle exception",CSS_PREFIX:"moodle-dialogue",ATTRS:{message:{value:""},name:{value:""},fileName:{value:""},lineNumber:{value:""},stack:{setter:function(e){var i,t=o.Escape.html(e).split("\n"),a=new RegExp("^(.+)@("+M.cfg.wwwroot+")?(.{0,75}).*:(\\d+)$");for(i in t)t[i]=t[i].replace(a,"
ln: $4
$3
$1
");return t.join("\n")},value:""},hideTimeoutDelay:{validator:o.Lang.isNumber,value:null}}}),M.core.exception=a},"@VERSION@",{requires:["moodle-core-notification-dialogue"]}); \ No newline at end of file diff --git a/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception.js b/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception.js index 22d883728ec..288f7b5ba3e 100644 --- a/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception.js +++ b/lib/yui/build/moodle-core-notification-exception/moodle-core-notification-exception.js @@ -100,11 +100,11 @@ Y.extend(EXCEPTION, M.core.notification.info, { self.hide(); }, delay); } - this.after('visibleChange', this.visibilityChanged, this); + this.after('visibleChange', this.errorVisibilityChanged, this); this._keypress = Y.on('key', this.hide, window, 'down:13,27', this); this.centerDialogue(); }, - visibilityChanged: function(e) { + errorVisibilityChanged: function(e) { if (e.attrName === 'visible' && e.prevVal && !e.newVal) { if (this._keypress) { this._keypress.detach(); diff --git a/lib/yui/src/notification/js/ajaxexception.js b/lib/yui/src/notification/js/ajaxexception.js index c6eeb3d2eec..75cad02d567 100644 --- a/lib/yui/src/notification/js/ajaxexception.js +++ b/lib/yui/src/notification/js/ajaxexception.js @@ -55,11 +55,11 @@ Y.extend(AJAXEXCEPTION, M.core.notification.info, { self.hide(); }, delay); } - this.after('visibleChange', this.visibilityChanged, this); + this.after('visibleChange', this.errorVisibilityChanged, this); this._keypress = Y.on('key', this.hide, window, 'down:13, 27', this); this.centerDialogue(); }, - visibilityChanged: function(e) { + errorVisibilityChanged: function(e) { if (e.attrName === 'visible' && e.prevVal && !e.newVal) { var self = this; this._keypress.detach(); diff --git a/lib/yui/src/notification/js/exception.js b/lib/yui/src/notification/js/exception.js index e346c38524e..07329579b81 100644 --- a/lib/yui/src/notification/js/exception.js +++ b/lib/yui/src/notification/js/exception.js @@ -70,11 +70,11 @@ Y.extend(EXCEPTION, M.core.notification.info, { self.hide(); }, delay); } - this.after('visibleChange', this.visibilityChanged, this); + this.after('visibleChange', this.errorVisibilityChanged, this); this._keypress = Y.on('key', this.hide, window, 'down:13,27', this); this.centerDialogue(); }, - visibilityChanged: function(e) { + errorVisibilityChanged: function(e) { if (e.attrName === 'visible' && e.prevVal && !e.newVal) { if (this._keypress) { this._keypress.detach();