From 7e804d0cb403aa6f2aeac769669afed2f28e20c7 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Wed, 5 Feb 2014 12:14:01 +0800 Subject: [PATCH] MDL-43992 Javascript: Remove key listener for confirmation The listener was previously confirming, even when the cancel or 'No' buttons were selected. However, having the default action as 'Confirm' seems dangerous in this situation, so removing this option entirely. --- .../moodle-core-notification-confirm-debug.js | 1 - .../moodle-core-notification-confirm-min.js | 2 +- .../moodle-core-notification-confirm.js | 1 - lib/yui/src/notification/js/confirm.js | 1 - 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm-debug.js b/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm-debug.js index c34e8673b34..3c6c5471c1f 100644 --- a/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm-debug.js +++ b/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm-debug.js @@ -69,7 +69,6 @@ Y.extend(CONFIRM, M.core.dialogue, { '

' + this.get(TITLE) + '

', Y.WidgetStdMod.REPLACE); this.closeEvents.push( - Y.on('key', this.submit, window, 'down:13', this, true), Y.on('key', this.submit, window, 'down:27', this, false), yes.on('click', this.submit, this, true), no.on('click', this.submit, this, false) diff --git a/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm-min.js b/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm-min.js index 0a7c6364ed4..b3ee827d155 100644 --- a/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm-min.js +++ b/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm-min.js @@ -1 +1 @@ -YUI.add("moodle-core-notification-confirm",function(e,t){var n,r,i,s,o,u,a,f;n="moodle-dialogue",r="notificationBase",i=0,s="yesLabel",o="noLabel",u="title",a="question",f={BASE:"moodle-dialogue-base",WRAP:"moodle-dialogue-wrap",HEADER:"moodle-dialogue-hd",BODY:"moodle-dialogue-bd",CONTENT:"moodle-dialogue-content",FOOTER:"moodle-dialogue-ft",HIDDEN:"hidden",LIGHTBOX:"moodle-dialogue-lightbox"},M.core=M.core||{};var l="Moodle confirmation dialogue",c;c=function(e){c.superclass.constructor.apply(this,[e])},e.extend(c,M.core.dialogue,{closeEvents:[],initializer:function(){this.publish("complete"),this.publish("complete-yes"),this.publish("complete-no");var t=e.Node.create(''),n=e.Node.create(''),i=e.Node.create('
').append(e.Node.create('
'+this.get(a)+"
")).append(e.Node.create('
').append(t).append(n));this.get(r).addClass("moodle-dialogue-confirm"),this.setStdModContent(e.WidgetStdMod.BODY,i,e.WidgetStdMod.REPLACE),this.setStdModContent(e.WidgetStdMod.HEADER,'

'+this.get(u)+"

",e.WidgetStdMod.REPLACE),this.closeEvents.push(e.on("key",this.submit,window,"down:13",this,!0),e.on("key",this.submit,window,"down:27",this,!1),t.on("click",this.submit,this,!0),n.on("click",this.submit,this,!1));var f=this.get("boundingBox").one(".closebutton");f&&this.closeEvents.push(f.on("click",this.submit,this))},submit:function(t,n){(new e.EventHandle(this.closeEvents)).detach(),this.fire("complete",n),n?this.fire("complete-yes"):this.fire("complete-no"),this.hide(),this.destroy()}},{NAME:l,CSS_PREFIX:n,ATTRS:{yesLabel:{validator:e.Lang.isString,value:"Yes"},noLabel:{validator:e.Lang.isString,value:"No"},title:{validator:e.Lang.isString,value:"Confirm"},question:{validator:e.Lang.isString,value:"Are you sure?"}}}),e.augment(c,e.EventTarget),M.core.confirm=c},"@VERSION@",{requires:["moodle-core-notification-dialogue"]}); +YUI.add("moodle-core-notification-confirm",function(e,t){var n,r,i,s,o,u,a,f;n="moodle-dialogue",r="notificationBase",i=0,s="yesLabel",o="noLabel",u="title",a="question",f={BASE:"moodle-dialogue-base",WRAP:"moodle-dialogue-wrap",HEADER:"moodle-dialogue-hd",BODY:"moodle-dialogue-bd",CONTENT:"moodle-dialogue-content",FOOTER:"moodle-dialogue-ft",HIDDEN:"hidden",LIGHTBOX:"moodle-dialogue-lightbox"},M.core=M.core||{};var l="Moodle confirmation dialogue",c;c=function(e){c.superclass.constructor.apply(this,[e])},e.extend(c,M.core.dialogue,{closeEvents:[],initializer:function(){this.publish("complete"),this.publish("complete-yes"),this.publish("complete-no");var t=e.Node.create(''),n=e.Node.create(''),i=e.Node.create('
').append(e.Node.create('
'+this.get(a)+"
")).append(e.Node.create('
').append(t).append(n));this.get(r).addClass("moodle-dialogue-confirm"),this.setStdModContent(e.WidgetStdMod.BODY,i,e.WidgetStdMod.REPLACE),this.setStdModContent(e.WidgetStdMod.HEADER,'

'+this.get(u)+"

",e.WidgetStdMod.REPLACE),this.closeEvents.push(e.on("key",this.submit,window,"down:27",this,!1),t.on("click",this.submit,this,!0),n.on("click",this.submit,this,!1));var f=this.get("boundingBox").one(".closebutton");f&&this.closeEvents.push(f.on("click",this.submit,this))},submit:function(t,n){(new e.EventHandle(this.closeEvents)).detach(),this.fire("complete",n),n?this.fire("complete-yes"):this.fire("complete-no"),this.hide(),this.destroy()}},{NAME:l,CSS_PREFIX:n,ATTRS:{yesLabel:{validator:e.Lang.isString,value:"Yes"},noLabel:{validator:e.Lang.isString,value:"No"},title:{validator:e.Lang.isString,value:"Confirm"},question:{validator:e.Lang.isString,value:"Are you sure?"}}}),e.augment(c,e.EventTarget),M.core.confirm=c},"@VERSION@",{requires:["moodle-core-notification-dialogue"]}); diff --git a/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm.js b/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm.js index c34e8673b34..3c6c5471c1f 100644 --- a/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm.js +++ b/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm.js @@ -69,7 +69,6 @@ Y.extend(CONFIRM, M.core.dialogue, { '

' + this.get(TITLE) + '

', Y.WidgetStdMod.REPLACE); this.closeEvents.push( - Y.on('key', this.submit, window, 'down:13', this, true), Y.on('key', this.submit, window, 'down:27', this, false), yes.on('click', this.submit, this, true), no.on('click', this.submit, this, false) diff --git a/lib/yui/src/notification/js/confirm.js b/lib/yui/src/notification/js/confirm.js index 6c4bfaaaba0..ec6cf7648c7 100644 --- a/lib/yui/src/notification/js/confirm.js +++ b/lib/yui/src/notification/js/confirm.js @@ -38,7 +38,6 @@ Y.extend(CONFIRM, M.core.dialogue, { '

' + this.get(TITLE) + '

', Y.WidgetStdMod.REPLACE); this.closeEvents.push( - Y.on('key', this.submit, window, 'down:13', this, true), Y.on('key', this.submit, window, 'down:27', this, false), yes.on('click', this.submit, this, true), no.on('click', this.submit, this, false)