diff --git a/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-debug.js b/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-debug.js index 47fc0f6ee66eb..d979ca0e5c0b9 100644 --- a/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-debug.js +++ b/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-debug.js @@ -339,7 +339,7 @@ Y.extend(DRAGDROP, Y.Base, { */ find_element_text: function(n) { // The valid node types to get text from. - var nodes = n.all('h2, h3, h4, h5, span, p, div.no-overflow, div.dimmed_text'); + var nodes = n.all('h2, h3, h4, h5, span:not(.actions):not(.menu-action-text), p, div.no-overflow, div.dimmed_text'); var text = ''; nodes.each(function () { diff --git a/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-min.js b/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-min.js index 27dec90d6814f..1e7290958a2d7 100644 --- a/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-min.js +++ b/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-min.js @@ -1,2 +1,2 @@ -YUI.add("moodle-core-dragdrop",function(e,t){var n={pix:"i/move_2d",largepix:"i/dragdrop",component:"moodle",cssclass:"moodle-core-dragdrop-draghandle"},r=function(){r.superclass.constructor.apply(this,arguments)};e.extend(r,e.Base,{goingup:null,absgoingup:null,samenodeclass:null,parentnodeclass:null,samenodelabel:null,parentnodelabel:null,groups:[],lastdroptarget:null,initializer:function(){e.DD.DDM.on("drag:start",this.global_drag_start,this),e.DD.DDM.on("drag:end",this.global_drag_end,this),e.DD.DDM.on("drag:drag",this.global_drag_drag,this),e.DD.DDM.on("drop:over",this.global_drop_over,this),e.DD.DDM.on("drop:hit",this.global_drop_hit,this),e.DD.DDM.on("drag:dropmiss",this.global_drag_dropmiss,this),e.one(e.config.doc.body).delegate("key",this.global_keydown,"down:32, enter, esc","."+n.cssclass,this),e.one(e.config.doc.body).delegate("click",this.global_keydown,"."+n.cssclass,this)},get_drag_handle:function(t,r,i,s){var o=n.pix;s&&(o=n.largepix);var u=e.Node.create("").setStyle("cursor","move").setAttrs({src:M.util.image_url(o,n.component),alt:t});i&&u.addClass(i);var a=e.Node.create("").addClass(r).setAttribute("title",t).setAttribute("tabIndex",0).setAttribute("data-draggroups",this.groups).setAttribute("role","button");return a.appendChild(u),a.addClass(n.cssclass),a},lock_drag_handle:function(e,t){e.removeHandle("."+t)},unlock_drag_handle:function(e,t){e.addHandle("."+t),e.get("activeHandle").focus()},ajax_failure:function(e){var t={name:e.status+" "+e.statusText,message:e.responseText};return new M.core.exception(t)},in_group:function(t){var n=!1;return e.each(this.groups,function(e){t._groups[e]&&(n=!0)},this),n},global_drag_start:function(e){var t=e.target;if(!this.in_group(t))return;this.originalstyle=t.get("node").getAttribute("style"),t.get("node").setStyle("opacity",".25"),t.get("dragNode").setStyles({opacity:".75",borderColor:t.get("node").getStyle("borderColor"),backgroundColor:t.get("node").getStyle("backgroundColor")}),t.get("dragNode").empty(),this.drag_start(e)},global_drag_end:function(e){var t=e.target;if(!this.in_group(t))return;t.get("node").setAttribute("style",this.originalstyle),this.drag_end(e)},global_drag_drag:function(e){var t=e.target,n=e.info;if(!this.in_group(t))return;n.start[1]n.xy[1]&&(this.absgoingup=!1),n.delta[1]<0?this.goingup=!0:n.delta[1]>0&&(this.goingup=!1),this.drag_drag(e)},global_drop_over:function(e){if(!e.drop||!e.drop.inGroup(this.groups))return;var t=e.drag.get("node"),n=e.drop.get("node");this.lastdroptarget=e.drop;if(n.hasClass(this.samenodeclass)){var r;this.goingup?r="before":r="after",n.insert(t,r)}else(n.hasClass(this.parentnodeclass)||n.test('[data-droptarget="1"]'))&&!n.contains(t)&&(this.goingup?n.append(t):n.prepend(t));this.drop_over(e)},global_drag_dropmiss:function(e){e.drag=e.target,e.drop=this.lastdroptarget;if(!this.in_group(e.drag))return;if(!e.drop||!e.drop.inGroup(this.groups))return;this.drag_dropmiss(e)},global_drop_hit:function(e){if(!e.drop||!e.drop.inGroup(this.groups))return;this.drop_hit(e)},find_element_text:function(t){var n=t.all("h2, h3, h4, h5, span, p, div.no-overflow, div.dimmed_text"),r="";return n.each(function(){r===""&&e.Lang.trim(this.get("text"))!==""&&(r=this.get("text"))}),r!==""?r:M.util.get_string("emptydragdropregion","moodle")},global_start_keyboard_drag:function(t,n,r){M.core.dragdrop.keydragcontainer=r,M.core.dragdrop.keydraghandle=n;var i=this.find_element_text(r),s=M.util.get_string("movecontent","moodle",i),o=e.Node.create("");o.addClass("dragdrop-keyboard-drag");var u,a,f,l=e.all("."+this.samenodeclass+", ."+this.parentnodeclass);l.each(function(t){var n=!1,s=t;if(t.drop&&t.drop.inGroup(this.groups)&&t.drop.get("node")!==r)n=!0;else{var l=t.getAttribute("data-draggroups").split(" "),c,h;for(c=0;c"),a=e.Node.create(""),i=this.find_element_text(s),this.samenodelabel&&t.hasClass(this.samenodeclass)?f=M.util.get_string(this.samenodelabel.identifier,this.samenodelabel.component,i):this.parentnodelabel&&t.hasClass(this.parentnodeclass)?f=M.util.get_string(this.parentnodelabel.identifier,this.parentnodelabel.component,i):f=M.util.get_string("tocontent","moodle",i),a.setContent(f),a.setAttribute("data-drop-target",t.get("id")),a.setAttribute("tabindex","0"),a.on("click",this.global_keyboard_drop,this),a.on("key",this.global_keyboard_drop,"down:enter,32",this),u.append(a),o.append(u))},this),M.core.dragdrop.dropui=new M.core.dialogue({headerContent:s,bodyContent:o,draggable:!0,visible:!0,center:!0,modal:!0}),M.core.dragdrop.dropui.after("visibleChange",function(e){e.prevVal&&!e.newVal&&this.global_cancel_keyboard_drag()},this),o.one("a")&&o.one("a").focus()},simulated_drag_drop_event:function(e,t){var n=function(e){this.node=e};n.prototype.get=function(e){return e==="node"||e==="dragNode"||e==="dropNode"?this.node:e==="activeHandle"?this.node.one(".editing_move"):null},n.prototype.inGroup=function(){return!0},n.prototype.addHandle=function(){},n.prototype.removeHandle=function(){},this.drop=new n(t),this.drag=new n(e),this.target=this.drop},global_keyboard_drop:function(t){var n=M.core.dragdrop.keydragcontainer,r=e.one("#"+t.target.getAttribute("data-drop-target"));M.core.dragdrop.dropui.hide(),t.preventDefault();var i=new this.simulated_drag_drop_event(n,n),s=new this.simulated_drag_drop_event(n,r);this.drag_start(i),this.global_drop_over(s),r.hasClass(this.parentnodeclass)&&r.contains(n)&&r.prepend(n),this.global_drop_hit(s)},global_cancel_keyboard_drag:function(){M.core.dragdrop.keydragcontainer&&(M.core.dragdrop.keydraghandle.focus(),M.core.dragdrop.keydragcontainer=null),M.core.dragdrop.dropui&&M.core.dragdrop.dropui.destroy()},global_keydown:function(e){var t=e.target.ancestor("."+n.cssclass,!0),r,i;if(t===null)return;if(e.keyCode===27){this.global_cancel_keyboard_drag( -),e.preventDefault();return}if(!t.hasClass(n.cssclass))return;if(e.keyCode!==13&&e.keyCode!==32&&e.type!=="click")return;i=t.getAttribute("data-draggroups").split(" ");var s,o,u=!1;for(s=0;s").setStyle("cursor","move").setAttrs({src:M.util.image_url(o,n.component),alt:t});i&&u.addClass(i);var a=e.Node.create("").addClass(r).setAttribute("title",t).setAttribute("tabIndex",0).setAttribute("data-draggroups",this.groups).setAttribute("role","button");return a.appendChild(u),a.addClass(n.cssclass),a},lock_drag_handle:function(e,t){e.removeHandle("."+t)},unlock_drag_handle:function(e,t){e.addHandle("."+t),e.get("activeHandle").focus()},ajax_failure:function(e){var t={name:e.status+" "+e.statusText,message:e.responseText};return new M.core.exception(t)},in_group:function(t){var n=!1;return e.each(this.groups,function(e){t._groups[e]&&(n=!0)},this),n},global_drag_start:function(e){var t=e.target;if(!this.in_group(t))return;this.originalstyle=t.get("node").getAttribute("style"),t.get("node").setStyle("opacity",".25"),t.get("dragNode").setStyles({opacity:".75",borderColor:t.get("node").getStyle("borderColor"),backgroundColor:t.get("node").getStyle("backgroundColor")}),t.get("dragNode").empty(),this.drag_start(e)},global_drag_end:function(e){var t=e.target;if(!this.in_group(t))return;t.get("node").setAttribute("style",this.originalstyle),this.drag_end(e)},global_drag_drag:function(e){var t=e.target,n=e.info;if(!this.in_group(t))return;n.start[1]n.xy[1]&&(this.absgoingup=!1),n.delta[1]<0?this.goingup=!0:n.delta[1]>0&&(this.goingup=!1),this.drag_drag(e)},global_drop_over:function(e){if(!e.drop||!e.drop.inGroup(this.groups))return;var t=e.drag.get("node"),n=e.drop.get("node");this.lastdroptarget=e.drop;if(n.hasClass(this.samenodeclass)){var r;this.goingup?r="before":r="after",n.insert(t,r)}else(n.hasClass(this.parentnodeclass)||n.test('[data-droptarget="1"]'))&&!n.contains(t)&&(this.goingup?n.append(t):n.prepend(t));this.drop_over(e)},global_drag_dropmiss:function(e){e.drag=e.target,e.drop=this.lastdroptarget;if(!this.in_group(e.drag))return;if(!e.drop||!e.drop.inGroup(this.groups))return;this.drag_dropmiss(e)},global_drop_hit:function(e){if(!e.drop||!e.drop.inGroup(this.groups))return;this.drop_hit(e)},find_element_text:function(t){var n=t.all("h2, h3, h4, h5, span:not(.actions):not(.menu-action-text), p, div.no-overflow, div.dimmed_text"),r="";return n.each(function(){r===""&&e.Lang.trim(this.get("text"))!==""&&(r=this.get("text"))}),r!==""?r:M.util.get_string("emptydragdropregion","moodle")},global_start_keyboard_drag:function(t,n,r){M.core.dragdrop.keydragcontainer=r,M.core.dragdrop.keydraghandle=n;var i=this.find_element_text(r),s=M.util.get_string("movecontent","moodle",i),o=e.Node.create("
    ");o.addClass("dragdrop-keyboard-drag");var u,a,f,l=e.all("."+this.samenodeclass+", ."+this.parentnodeclass);l.each(function(t){var n=!1,s=t;if(t.drop&&t.drop.inGroup(this.groups)&&t.drop.get("node")!==r)n=!0;else{var l=t.getAttribute("data-draggroups").split(" "),c,h;for(c=0;c"),a=e.Node.create(""),i=this.find_element_text(s),this.samenodelabel&&t.hasClass(this.samenodeclass)?f=M.util.get_string(this.samenodelabel.identifier,this.samenodelabel.component,i):this.parentnodelabel&&t.hasClass(this.parentnodeclass)?f=M.util.get_string(this.parentnodelabel.identifier,this.parentnodelabel.component,i):f=M.util.get_string("tocontent","moodle",i),a.setContent(f),a.setAttribute("data-drop-target",t.get("id")),a.setAttribute("tabindex","0"),a.on("click",this.global_keyboard_drop,this),a.on("key",this.global_keyboard_drop,"down:enter,32",this),u.append(a),o.append(u))},this),M.core.dragdrop.dropui=new M.core.dialogue({headerContent:s,bodyContent:o,draggable:!0,visible:!0,center:!0,modal:!0}),M.core.dragdrop.dropui.after("visibleChange",function(e){e.prevVal&&!e.newVal&&this.global_cancel_keyboard_drag()},this),o.one("a")&&o.one("a").focus()},simulated_drag_drop_event:function(e,t){var n=function(e){this.node=e};n.prototype.get=function(e){return e==="node"||e==="dragNode"||e==="dropNode"?this.node:e==="activeHandle"?this.node.one(".editing_move"):null},n.prototype.inGroup=function(){return!0},n.prototype.addHandle=function(){},n.prototype.removeHandle=function(){},this.drop=new n(t),this.drag=new n(e),this.target=this.drop},global_keyboard_drop:function(t){var n=M.core.dragdrop.keydragcontainer,r=e.one("#"+t.target.getAttribute("data-drop-target"));M.core.dragdrop.dropui.hide(),t.preventDefault();var i=new this.simulated_drag_drop_event(n,n),s=new this.simulated_drag_drop_event(n,r);this.drag_start(i),this.global_drop_over(s),r.hasClass(this.parentnodeclass)&&r.contains(n)&&r.prepend(n),this.global_drop_hit(s)},global_cancel_keyboard_drag:function(){M.core.dragdrop.keydragcontainer&&(M.core.dragdrop.keydraghandle.focus(),M.core.dragdrop.keydragcontainer=null),M.core.dragdrop.dropui&&M.core.dragdrop.dropui.destroy()},global_keydown:function(e){var t=e.target.ancestor("."+n.cssclass,!0),r,i;if(t===null)return;if(e.keyCode===27 +){this.global_cancel_keyboard_drag(),e.preventDefault();return}if(!t.hasClass(n.cssclass))return;if(e.keyCode!==13&&e.keyCode!==32&&e.type!=="click")return;i=t.getAttribute("data-draggroups").split(" ");var s,o,u=!1;for(s=0;s