diff --git a/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form-debug.js b/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form-debug.js index 803f5653c2c..6d7ad52ad9f 100644 --- a/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form-debug.js +++ b/availability/condition/completion/yui/build/moodle-availability_completion-form/moodle-availability_completion-form-debug.js @@ -34,7 +34,8 @@ M.availability_completion.form.getNode = function(json) { // String has already been escaped using format_string. html += ''; } - html += ' "+''+M.util.get_string("listheader_single","availability")+""+''+M.util.get_string("listheader_multi_before","availability")+' "+M.util.get_string("listheader_multi_after","availability")+""+'
'+'
'+M.util.get_string("none","moodle")+"
"+'
'),n||this.node.addClass("availability-childlist"),this.inner=this.node.one("> .availability-inner");var i=!0;n?(t&&t.show!==undefined&&(i=t.show),this.eyeIcon=new M.core_availability.EyeIcon(!1,i),this.node.one(".availability-header").get("firstChild").insert(this.eyeIcon.span,"before")):r&&(t&&t.showc!==undefined&&(i=t.showc),this.eyeIcon=new M.core_availability.EyeIcon(!1,i),this.inner.insert(this.eyeIcon.span,"before"));if(!n){var s=new M.core_availability.DeleteIcon(this),o=this.node.one(".availability-none");o.appendChild(document.createTextNode(" ")),o.appendChild(s.span),o.appendChild(e.Node.create(''+M.util.get_string("invalid","availability")+""))}var u=e.Node.create('");u.on("click",function(){this.clickAdd()},this),this.node.one("div.availability-button").appendChild(u);if(t){switch(t.op){case"&":case"|":this.node.one(".availability-neg").set("value","");break;case"!&":case"!|":this.node.one(".availability-neg").set("value","!")}switch(t.op){case"&":case"!&":this.node.one(".availability-op").set("value","&");break;case"|":case"!|":this.node.one(".availability-op").set("value","|")}for(var a=0;a0&&this.inner.one(".availability-children").appendChild(e.Node.create('
')),this.children.push(t),this.inner.one(".availability-children").appendChild(t.node)},M.core_availability.List.prototype.focusAfterAdd=function(){this.inner.one("button").focus()},M.core_availability.List.prototype.isIndividualShowIcons=function(){if(!this.root)throw"Can only call this on root list";var e=this.node.one(".availability-neg").get("value")==="!",t=this.node.one(".availability-op").get("value")==="|";return!e&&!t||e&&t},M.core_availability.List.prototype.renumber=function(e){var t={count:this.children.length},n;e===undefined?(t.number="",n=""):(t.number=e+":",n=e+".");var r=M.util.get_string("setheading","availability",t);this.node.one("> h3").set("innerHTML",r);for(var i=0;i0?(this.inner.one("> .availability-children").removeAttribute("aria-hidden"),this.inner.one("> .availability-none").setAttribute("aria-hidden","true"),this.inner.one("> .availability-header").removeAttribute("aria-hidden"),this.children.length>1?(this.inner.one(".availability-single").setAttribute("aria-hidden","true"),this.inner.one(".availability-multi").removeAttribute("aria-hidden")):(this.inner.one(".availability-single").removeAttribute("aria-hidden"),this.inner.one(".availability-multi").setAttribute("aria-hidden","true"))):(this.inner.one("> .availability-children").setAttribute("aria-hidden","true"),this.inner.one("> .availability-none").removeAttribute("aria-hidden"),this.inner.one("> .availability-header").setAttribute("aria-hidden","true"));if(this.root){var e=this.isIndividualShowIcons();for(var t=0;t .availability-children > .availability-connector span.label").each(function(e){e.set("innerHTML",r)})},M.core_availability.List.prototype.deleteDescendant=function(e){for(var t=0;t0&&(r.previous(".availability-connector")?r.previous(".availability-connector").remove():r.next(".availability-connector").remove()),this.inner.one("> .availability-children").removeChild(r),M.core_availability.form.update(),this.updateHtml(),this.inner.one("> .availability-button").one("button").focus(),!0}if(n instanceof M.core_availability.List){var i=n.deleteDescendant(e);if(i)return!0}}return!1},M.core_availability.List.prototype.clickAdd=function(){var t=e.Node.create('
    "),n=t.one("button"),r={dialog:null},i=t.one("ul"),s,o,u,a;for(var f in M.core_availability.form.plugins){if(!M.core_availability.form.plugins[f].allowAdd)continue;s=e.Node.create('
  • '),o="availability_addrestriction_"+f,u=e.Node.create('"),u.on("click",this.getAddHandler(f,r),this),s.appendChild(u),a=e.Node.create('"),s.appendChild(a),i.appendChild(s)}s=e.Node.create('
  • '),o="availability_addrestriction_list_",u=e.Node.create('"),u.on("click",this.getAddHandler(null,r),this),s.appendChild(u),a=e.Node.create('"),s.appendChild(a),i.appendChild(s);var l={headerContent:M.util.get_string("addrestriction","availability"),bodyContent:t,additionalBaseClass:"availability-dialogue",draggable:!0,modal:!0,closeButton:!1,width:"450px"};r.dialog=new M.core.dialogue(l),r.dialog.show(),n.on("click",function(){r.dialog.destroy(),this.inner.one("> .availability-button").one("button").focus()},this)},M.core_availability.List.prototype.getAddHandler=function(e,t){return function(){e?newItem=new M.core_availability.Item({type:e,creating:!0},this.root):newItem=new M.core_availability.List({c:[],showc:!0},!1,this.root),this.addChild(newItem),M.core_availability.form.update(),M.core_availability.form.rootList.renumber(),this.updateHtml(),t.dialog.destroy(),newItem.focusAfterAdd()}},M.core_availability.List.prototype.getValue=function(){var e={};e.op=this.node.one(".availability-neg").get("value")+this.node.one(".availability-op").get("value"),e.c=[];var t;for(t=0;t'+M.util.get_string("missingplugin","availability")+"")):(this.plugin=M.core_availability.form.plugins[t.type],this.pluginNode=this.plugin.getNode(t),this.pluginNode.addClass("availability_"+t.type)),this.node=e.Node.create('

    ');if(n){var r=!0;t.showc!==undefined&&(r=t.showc),this.eyeIcon=new M.core_availability.EyeIcon(!0,r),this.node.appendChild(this.eyeIcon.span)}this.pluginNode.addClass("availability-plugincontrols"),this.node.appendChild(this.pluginNode);var i=new M.core_availability.DeleteIcon(this);this.node.appendChild(i.span),this.node.appendChild(document.createTextNode(" ")),this.node.appendChild(e.Node.create(''))},M.core_availability.Item.prototype.getValue=function(){return value={type:this.pluginType},this.plugin&&this.plugin.fillValue(value,this.pluginNode),value},M.core_availability.Item.prototype.fillErrors=function(e){var t=e.length;this.plugin?this.plugin.fillErrors(e,this.pluginNode):e.push("core_availability:item_unknowntype");var n=this.node.one("> .label-warning");e.length!==t&&!n.get("firstChild")?n.appendChild(document.createTextNode(M.util.get_string("invalid","availability"))):e.length===t&&n.get("firstChild")&&n.get("firstChild").remove()},M.core_availability.Item.prototype.renumber=function(e){var t={number:e};this.plugin?t.type=M.util.get_string("title","availability_"+this.pluginType):t.type="["+this.pluginType+"]",t.number=e+":";var n=M.util.get_string("itemheading","availability",t);this.node.one("> h3").set("innerHTML",n)},M.core_availability.Item.prototype.focusAfterAdd=function(){this.plugin.focusAfterAdd(this.pluginNode)},M.core_availability.Item.prototype.pluginType=null,M.core_availability.Item.prototype.plugin=null,M.core_availability.Item.prototype.eyeIcon=null,M.core_availability.Item.prototype.node=null,M.core_availability.Item.prototype.pluginNode=null,M.core_availability.EyeIcon=function(t,n){this.individual=t,this.span=e.Node.create('');var r=e.Node.create("");this.span.appendChild(r);var i=t?"_individual":"_all",s=function(){var e=M.util.get_string("hidden"+i,"availability");r.set("src",M.util.image_url("i/show","core")),r.set("alt",e),this.span.set("title",e+" \u2022 "+M.util.get_string("show_verb","availability"))},o=function(){var e=M.util.get_string("shown"+i,"availability");r.set("src",M.util.image_url("i/hide","core")),r.set("alt",e),this.span.set("title",e+" \u2022 "+M.util.get_string("hide_verb","availability"))};n?o.call(this):s.call(this);var u=function(e){e.preventDefault(),this.isHidden()?o.call(this):s.call(this),M.core_availability.form.update()};this.span.on("click",u,this),this.span.on("key",u,"up:32",this),this.span.on("key",function(e){e.preventDefault()},"down:32",this)},M.core_availability.EyeIcon.prototype.individual=!1,M.core_availability.EyeIcon.prototype.span=null,M.core_availability.EyeIcon.prototype.isHidden=function(){var e=this.individual?"_individual":"_all",t=M.util.get_string("hidden"+e,"availability");return this.span.one("img").get("alt")===t},M.core_availability.DeleteIcon=function(t){this.span=e.Node.create('');var n=e.Node.create(''+M.util.get_string(');this.span.appendChild(n);var r=function(e){e.preventDefault(),M.core_availability.form.rootList.deleteDescendant(t),M.core_availability.form.rootList.renumber()};this.span.on("click",r,this),this.span.on("key",r,"up:32",this),this.span.on("key",function(e){e.preventDefault()},"down:32",this)},M.core_availability.DeleteIcon.prototype.span=null},"@VERSION@",{requires:["base","node","event","panel","moodle-core-notification-dialogue","json"]}); +.length>0&&this.inner.one(".availability-children").appendChild(e.Node.create('
    ')),this.children.push(t),this.inner.one(".availability-children").appendChild(t.node)},M.core_availability.List.prototype.focusAfterAdd=function(){this.inner.one("button").focus()},M.core_availability.List.prototype.isIndividualShowIcons=function(){if(!this.root)throw"Can only call this on root list";var e=this.node.one(".availability-neg").get("value")==="!",t=this.node.one(".availability-op").get("value")==="|";return!e&&!t||e&&t},M.core_availability.List.prototype.renumber=function(e){var t={count:this.children.length},n;e===undefined?(t.number="",n=""):(t.number=e+":",n=e+".");var r=M.util.get_string("setheading","availability",t);this.node.one("> h3").set("innerHTML",r);for(var i=0;i0?(this.inner.one("> .availability-children").removeAttribute("aria-hidden"),this.inner.one("> .availability-none").setAttribute("aria-hidden","true"),this.inner.one("> .availability-header").removeAttribute("aria-hidden"),this.children.length>1?(this.inner.one(".availability-single").setAttribute("aria-hidden","true"),this.inner.one(".availability-multi").removeAttribute("aria-hidden")):(this.inner.one(".availability-single").removeAttribute("aria-hidden"),this.inner.one(".availability-multi").setAttribute("aria-hidden","true"))):(this.inner.one("> .availability-children").setAttribute("aria-hidden","true"),this.inner.one("> .availability-none").removeAttribute("aria-hidden"),this.inner.one("> .availability-header").setAttribute("aria-hidden","true"));if(this.root){var e=this.isIndividualShowIcons();for(var t=0;t .availability-children > .availability-connector span.label").each(function(e){e.set("innerHTML",r)})},M.core_availability.List.prototype.deleteDescendant=function(e){for(var t=0;t0&&(r.previous(".availability-connector")?r.previous(".availability-connector").remove():r.next(".availability-connector").remove()),this.inner.one("> .availability-children").removeChild(r),M.core_availability.form.update(),this.updateHtml(),this.inner.one("> .availability-button").one("button").focus(),!0}if(n instanceof M.core_availability.List){var i=n.deleteDescendant(e);if(i)return!0}}return!1},M.core_availability.List.prototype.clickAdd=function(){var t=e.Node.create('
      "),n=t.one("button"),r={dialog:null},i=t.one("ul"),s,o,u,a;for(var f in M.core_availability.form.plugins){if(!M.core_availability.form.plugins[f].allowAdd)continue;s=e.Node.create('
    • '),o="availability_addrestriction_"+f,u=e.Node.create('"),u.on("click",this.getAddHandler(f,r),this),s.appendChild(u),a=e.Node.create('"),s.appendChild(a),i.appendChild(s)}s=e.Node.create('
    • '),o="availability_addrestriction_list_",u=e.Node.create('"),u.on("click",this.getAddHandler(null,r),this),s.appendChild(u),a=e.Node.create('"),s.appendChild(a),i.appendChild(s);var l={headerContent:M.util.get_string("addrestriction","availability"),bodyContent:t,additionalBaseClass:"availability-dialogue",draggable:!0,modal:!0,closeButton:!1,width:"450px"};r.dialog=new M.core.dialogue(l),r.dialog.show(),n.on("click",function(){r.dialog.destroy(),this.inner.one("> .availability-button").one("button").focus()},this)},M.core_availability.List.prototype.getAddHandler=function(e,t){return function(){var n;e?n=new M.core_availability.Item({type:e,creating:!0},this.root):n=new M.core_availability.List({c:[],showc:!0},!1,this.root),this.addChild(n),M.core_availability.form.update(),M.core_availability.form.rootList.renumber(),this.updateHtml(),t.dialog.destroy(),n.focusAfterAdd()}},M.core_availability.List.prototype.getValue=function(){var e={};e.op=this.node.one(".availability-neg").get("value")+this.node.one(".availability-op").get("value"),e.c=[];var t;for(t=0;t'+M.util.get_string("missingplugin","availability")+"")):(this.plugin=M.core_availability.form.plugins[t.type],this.pluginNode=this.plugin.getNode(t),this.pluginNode.addClass("availability_"+t.type)),this.node=e.Node.create('

      ');if(n){var r=!0;t.showc!==undefined&&(r=t.showc),this.eyeIcon=new M.core_availability.EyeIcon(!0,r),this.node.appendChild(this.eyeIcon.span)}this.pluginNode.addClass("availability-plugincontrols"),this.node.appendChild(this.pluginNode);var i=new M.core_availability.DeleteIcon(this);this.node.appendChild(i.span),this.node.appendChild(document.createTextNode(" ")),this.node.appendChild(e.Node.create(''))},M.core_availability.Item.prototype.getValue=function(){var e={type:this.pluginType};return this.plugin&&this.plugin.fillValue(e,this.pluginNode),e},M.core_availability.Item.prototype.fillErrors=function(e){var t=e.length;this.plugin?this.plugin.fillErrors(e,this.pluginNode):e.push("core_availability:item_unknowntype");var n=this.node.one("> .label-warning");e.length!==t&&!n.get("firstChild")?n.appendChild(document.createTextNode(M.util.get_string("invalid","availability"))):e.length===t&&n.get("firstChild")&&n.get("firstChild").remove()},M.core_availability.Item.prototype.renumber=function(e){var t={number:e};this.plugin?t.type=M.util.get_string("title","availability_"+this.pluginType):t.type="["+this.pluginType+"]",t.number=e+":";var n=M.util.get_string("itemheading","availability",t);this.node.one("> h3").set("innerHTML",n)},M.core_availability.Item.prototype.focusAfterAdd=function(){this.plugin.focusAfterAdd(this.pluginNode)},M.core_availability.Item.prototype.pluginType=null,M.core_availability.Item.prototype.plugin=null,M.core_availability.Item.prototype.eyeIcon=null,M.core_availability.Item.prototype.node=null,M.core_availability.Item.prototype.pluginNode=null,M.core_availability.EyeIcon=function(t,n){this.individual=t,this.span=e.Node.create('
      ');var r=e.Node.create("");this.span.appendChild(r);var i=t?"_individual":"_all",s=function(){var e=M.util.get_string("hidden"+i,"availability");r.set("src",M.util.image_url("i/show","core")),r.set("alt",e),this.span.set("title",e+" \u2022 "+M.util.get_string("show_verb","availability"))},o=function(){var e=M.util.get_string("shown"+i,"availability");r.set("src",M.util.image_url("i/hide","core")),r.set("alt",e),this.span.set("title",e+" \u2022 "+M.util.get_string("hide_verb","availability"))};n?o.call(this):s.call(this);var u=function(e){e.preventDefault(),this.isHidden()?o.call(this):s.call(this),M.core_availability.form.update()};this.span.on("click",u,this),this.span.on("key",u,"up:32",this),this.span.on("key",function(e){e.preventDefault()},"down:32",this)},M.core_availability.EyeIcon.prototype.individual=!1,M.core_availability.EyeIcon.prototype.span=null,M.core_availability.EyeIcon.prototype.isHidden=function(){var e=this.individual?"_individual":"_all",t=M.util.get_string("hidden"+e,"availability");return this.span.one("img").get("alt")===t},M.core_availability.DeleteIcon=function(t){this.span=e.Node.create('');var n=e.Node.create(''+M.util.get_string(');this.span.appendChild(n);var r=function(e){e.preventDefault(),M.core_availability.form.rootList.deleteDescendant(t),M.core_availability.form.rootList.renumber()};this.span.on("click",r,this),this.span.on("key",r,"up:32",this),this.span.on("key",function(e){e.preventDefault()},"down:32",this)},M.core_availability.DeleteIcon.prototype.span=null},"@VERSION@",{requires:["base","node","event","panel","moodle-core-notification-dialogue","json"]}); diff --git a/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form.js b/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form.js index 61b4781bad6..2c83b2bc2a3 100644 --- a/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form.js +++ b/availability/yui/build/moodle-core_availability-form/moodle-core_availability-form.js @@ -731,6 +731,7 @@ M.core_availability.List.prototype.clickAdd = function() { */ M.core_availability.List.prototype.getAddHandler = function(type, dialogRef) { return function() { + var newItem; if (type) { // Create an Item object to represent the child. newItem = new M.core_availability.Item({ type: type, creating: true }, this.root); @@ -926,7 +927,7 @@ M.core_availability.Item = function(json, root) { * @return {Object} JavaScript object containing value of this item */ M.core_availability.Item.prototype.getValue = function() { - value = { 'type' : this.pluginType }; + var value = { 'type' : this.pluginType }; if (this.plugin) { this.plugin.fillValue(value, this.pluginNode); } diff --git a/availability/yui/src/form/js/form.js b/availability/yui/src/form/js/form.js index c2474410dae..4edbbca1c47 100644 --- a/availability/yui/src/form/js/form.js +++ b/availability/yui/src/form/js/form.js @@ -729,6 +729,7 @@ M.core_availability.List.prototype.clickAdd = function() { */ M.core_availability.List.prototype.getAddHandler = function(type, dialogRef) { return function() { + var newItem; if (type) { // Create an Item object to represent the child. newItem = new M.core_availability.Item({ type: type, creating: true }, this.root); @@ -924,7 +925,7 @@ M.core_availability.Item = function(json, root) { * @return {Object} JavaScript object containing value of this item */ M.core_availability.Item.prototype.getValue = function() { - value = { 'type' : this.pluginType }; + var value = { 'type' : this.pluginType }; if (this.plugin) { this.plugin.fillValue(value, this.pluginNode); } diff --git a/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-debug.js b/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-debug.js index b483ee28112..20737009573 100644 --- a/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-debug.js +++ b/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-debug.js @@ -435,7 +435,7 @@ Y.extend(TREE, Y.Base, TREE.prototype, { * @constructor * @extends Base */ -BRANCH = function() { +var BRANCH = function() { BRANCH.superclass.constructor.apply(this, arguments); }; BRANCH.prototype = { @@ -634,7 +634,7 @@ BRANCH.prototype = { Y.io(M.cfg.wwwroot + ajaxfile, { method:'POST', - data: build_querystring(params), + data: params, on: { complete: this.ajaxProcessResponse }, @@ -672,8 +672,10 @@ BRANCH.prototype = { this.addChild(object.children[i]); } } - if ((this.get('type') === NODETYPE.CATEGORY || this.get('type') === NODETYPE.ROOTNODE || this.get('type') === NODETYPE.MYCATEGORY) - && coursecount >= M.block_navigation.courselimit) { + if ((this.get('type') === NODETYPE.CATEGORY || + this.get('type') === NODETYPE.ROOTNODE || + this.get('type') === NODETYPE.MYCATEGORY) + && coursecount >= M.block_navigation.courselimit) { this.addViewAllCoursesChild(this); } Y.log('AJAX loading complete.', 'note', 'moodle-block_navigation'); diff --git a/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-min.js b/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-min.js index 463c78cbab4..962ebaa85f8 100644 --- a/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-min.js +++ b/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-min.js @@ -1,2 +1,2 @@ -YUI.add("moodle-block_navigation-navigation",function(e,t){M.block_navigation=M.block_navigation||{},M.block_navigation.expandablebranchcount=1,M.block_navigation.courselimit=20,M.block_navigation.init_add_tree=function(e){e.courselimit&&(this.courselimit=e.courselimit),new u(e)},e.Event.define("actionkey",{_event:e.UA.webkit||e.UA.ie?"keydown":"keypress",_keys:{37:"collapse",39:"expand",32:"toggle",13:"enter"},_keyHandler:function(e,t,n){var r;n.actions?r=n.actions:r={collapse:!0,expand:!0,toggle:!0,enter:!0},this._keys[e.keyCode]&&r[this._keys[e.keyCode]]&&(e.action=this._keys[e.keyCode],t.fire(e))},on:function(e,t,n){t.args===null?t._detacher=e.on(this._event,this._keyHandler,this,n,{actions:!1}):t._detacher=e.on(this._event,this._keyHandler,this,n,t.args[0])},detach:function(e,t){t._detacher.detach()},delegate:function(e,t,n,r){t.args===null?t._delegateDetacher=e.delegate(this._event,this._keyHandler,r,this,n,{actions:!1}):t._delegateDetacher=e.delegate(this._event,this._keyHandler,r,this,n,t.args[0])},detachDelegate:function(e,t){t._delegateDetacher.detach()}});var n=0,r=20,i=30,s=40,o={ROOTNODE:0,SYSTEM:1,CATEGORY:10,MYCATEGORY:11,COURSE:20,SECTION:30,ACTIVITY:40,RESOURCE:50,CUSTOM:60,SETTING:70,SITEADMIN:71,USER:80,CONTAINER:90},u=function(){u.superclass.constructor.apply(this,arguments)};u.prototype={id:null,branches:[],initializer:function(t){this.id=parseInt(t.id,10);var n=e.one("#inst"+t.id);if(n===null)return;e.delegate("click",this.toggleExpansion,n.one(".block_tree"),".tree_item.branch",this),e.delegate("actionkey",this.toggleExpansion,n.one(".block_tree"),".tree_item.branch",this);var r=[];t.expansions?r=t.expansions:window["navtreeexpansions"+t.id]&&(r=window["navtreeexpansions"+t.id]);for(var i in r){var s=(new BRANCH({tree:this,branchobj:r[i],overrides:{expandable:!0,children:[],haschildren:!0}})).wire();M.block_navigation.expandablebranchcount++,this.branches[s.get("id")]=s}if(window.siteadminexpansion){var o=(new BRANCH({tree:this,branchobj:window.siteadminexpansion,overrides:{expandable:!0,children:[],haschildren:!0}})).wire();M.block_navigation.expandablebranchcount++,this.branches[o.get("id")]=o;if(o.node){var u=o.node.get("childNodes").item(0);if(u){var a=e.Node.create(''+u.get("innerHTML")+"");o.node.replaceChild(a,u)}}}M.block_navigation.expandablebranchcount>0&&(e.delegate("click",this.fire_branch_action,n.one(".block_tree"),".tree_item.branch[data-expandable]",this),e.delegate("actionkey",this.fire_branch_action,n.one(".block_tree"),".tree_item.branch[data-expandable]",this))},fire_branch_action:function(e){var t=e.currentTarget.getAttribute("id"),n=this.branches[t];n.ajaxLoad(e)},toggleExpansion:function(e){if(!e.target.test("a")||e.keyCode!==0&&e.keyCode!==13){var t=e.target;t.test("li")||(t=t.ancestor("li"));if(!t)return;if(!t.hasClass("depth_1"))if(e.type==="actionkey"){switch(e.action){case"expand":t.removeClass("collapsed"),t.set("aria-expanded",!0);break;case"collapse":t.addClass("collapsed"),t.set("aria-expanded",!1);break;default:t.toggleClass("collapsed"),t.set("aria-expanded",!t.hasClass("collapsed"))}e.halt()}else t.toggleClass("collapsed"),t.set("aria-expanded",!t.hasClass("collapsed"));return this.get("accordian")&&t.siblings("li").each(function(){this.get("id")!==t.get("id")&&!this.hasClass("collapsed")&&(this.addClass("collapsed"),this.set("aria-expanded",!1))}),this.get("candock")&&M.core.dock.notifyBlockChange&&M.core.dock.notifyBlockChange(this.id),!0}e.stopPropagation();return}},e.extend(u,e.Base,u.prototype,{NAME:"navigation-tree",ATTRS:{candock:{validator:e.Lang.isBool,value:!1},accordian:{validator:e.Lang.isBool,value:!1},expansionlimit:{value:0,setter:function(e){return e=parseInt(e,10),e!==n&&e!==r&&e!==i&&e!==s&&(e=n),e}},instance:{value:!1,setter:function(e){return parseInt(e,10)}}}}),BRANCH=function(){BRANCH.superclass.constructor.apply(this,arguments)},BRANCH.prototype={node:null,initializer:function(t){var r,i;if(t.branchobj!==null){for(r in t.branchobj)this.set(r,t.branchobj[r]);i=this.get("children"),this.set("haschildren",i.length>0)}if(t.overrides!==null)for(r in t.overrides)this.set(r,t.overrides[r]);this.node=e.one("#"+this.get("id"));var o=this.get("tree").get("expansionlimit"),u=this.get("type");o!==n&&u>=o&&u<=s&&(this.set("expandable",!1),this.set("haschildren",!1))},draw:function(t){var n=this.get("expandable")||this.get("haschildren"),r=e.Node.create("
    • "),i=this.get("link"),s=e.Node.create('

      ').setAttribute("id",this.get("id"));i||s.setAttribute("tabindex","0"),n&&(r.addClass("collapsed").addClass("contains_branch"),r.set("aria-expanded",!1),s.addClass("branch"));var u=!1,a=this.get("icon");if(a&&(!n||this.get("type")===o.ACTIVITY)){u=e.Node.create(''),u.setAttribute("src",M.util.image_url(a.pix,a.component)),r.addClass("item_with_icon"),a.alt&&u.setAttribute("alt",a.alt),a.title&&u.setAttribute("title",a.title);if(a.classes)for(var f in a.classes)u.addClass(a.classes[f])}if(!i){var l=e.Node.create("");u&&l.appendChild(u),l.append(this.get("name")),this.get("hidden")&&l.addClass("dimmed_text"),s.appendChild(l)}else{var c=e.Node.create('
      ');u&&c.appendChild(u),c.append(this.get("name")),this.get("hidden")&&c.addClass("dimmed"),s.appendChild(c)}return r.appendChild(s),t.appendChild(r),this.node=s,this},wire:function(){return this.node=this.node||e.one("#"+this.get("id")),this.node?(this.get("expandable")&&(this.node.setAttribute("data-expandable","1"),this.node.setAttribute("data-loaded","0")),this):this},getChildrenUL:function(){var t=this.node.next("ul");return t||(t=e.Node.create("
        "),this.node.ancestor().append(t)),t},ajaxLoad:function(t){t.type==="actionkey"&&t.action!=="enter"?t.halt():t.stopPropagation();if(t.type==="actionkey"&&t.action==="enter"||t.target.test("a"))return this.node.setAttribute("data-expandable","0"),this.node.setAttribute("data-loaded","1"),!0;if(this.node -.hasClass("loadingbranch"))return!0;if(this.node.getAttribute("data-loaded")==="1")return!0;this.node.addClass("loadingbranch");var n={elementid:this.get("id"),id:this.get("key"),type:this.get("type"),sesskey:M.cfg.sesskey,instance:this.get("tree").get("instance")},r="/lib/ajax/getnavbranch.php";return this.get("type")===o.SITEADMIN&&(r="/lib/ajax/getsiteadminbranch.php"),e.io(M.cfg.wwwroot+r,{method:"POST",data:build_querystring(n),on:{complete:this.ajaxProcessResponse},context:this}),!0},ajaxProcessResponse:function(t,n){this.node.removeClass("loadingbranch"),this.node.setAttribute("data-loaded","1");try{var r=e.JSON.parse(n.responseText);if(r.error)return e.use("moodle-core-notification-ajaxexception",function(){return(new M.core.ajaxException(r)).show()}),!1;if(r.children&&r.children.length>0){var i=0;for(var s in r.children)typeof r.children[s]=="object"&&(r.children[s].type===o.COURSE&&i++,this.addChild(r.children[s]));return(this.get("type")===o.CATEGORY||this.get("type")===o.ROOTNODE||this.get("type")===o.MYCATEGORY)&&i>=M.block_navigation.courselimit&&this.addViewAllCoursesChild(this),this.get("tree").get("candock")&&M.core.dock.notifyBlockChange&&M.core.dock.notifyBlockChange(this.get("tree").id),!0}}catch(u){return n&&n.status&&n.status>0&&e.use("moodle-core-notification-exception",function(){return(new M.core.exception(u)).show()}),!1}return this.node.replaceClass("branch","emptybranch"),!0},addChild:function(e){var t=new BRANCH({tree:this.get("tree"),branchobj:e});if(t.draw(this.getChildrenUL())){this.get("tree").branches[t.get("id")]=t,t.wire();var n=0,r,i=t.get("children");for(r in i)i[r].type===o.COURSE&&n++,typeof i[r]=="object"&&t.addChild(i[r]);(t.get("type")===o.CATEGORY||t.get("type")===o.MYCATEGORY)&&n>=M.block_navigation.courselimit&&this.addViewAllCoursesChild(t)}return!0},addViewAllCoursesChild:function(e){var t=null;e.get("type")===o.ROOTNODE?e.get("key")==="mycourses"?t=M.cfg.wwwroot+"/my":t=M.cfg.wwwroot+"/course/index.php":t=M.cfg.wwwroot+"/course/index.php?categoryid="+e.get("key"),e.addChild({name:M.util.get_string("viewallcourses","moodle"),title:M.util.get_string("viewallcourses","moodle"),link:t,haschildren:!1,icon:{pix:"i/navigationitem",component:"moodle"}})}},e.extend(BRANCH,e.Base,BRANCH.prototype,{NAME:"navigation-branch",ATTRS:{tree:{writeOnce:"initOnly",validator:e.Lang.isObject},name:{value:"",validator:e.Lang.isString,setter:function(e){return e.replace(/\n/g,"
        ")}},title:{value:"",validator:e.Lang.isString},id:{value:"",validator:e.Lang.isString,getter:function(e){return e===""&&(e="expandable_branch_"+M.block_navigation.expandablebranchcount,M.block_navigation.expandablebranchcount++),e}},key:{value:null},type:{value:null,setter:function(e){return parseInt(e,10)}},link:{value:!1},icon:{value:!1,validator:e.Lang.isObject},expandable:{value:!1,validator:e.Lang.isBool},hidden:{value:!1,validator:e.Lang.isBool},haschildren:{value:!1,validator:e.Lang.isBool},children:{value:[],validator:e.Lang.isArray}}})},"@VERSION@",{requires:["base","io-base","node","event-synthetic","event-delegate","json-parse"]}); +YUI.add("moodle-block_navigation-navigation",function(e,t){M.block_navigation=M.block_navigation||{},M.block_navigation.expandablebranchcount=1,M.block_navigation.courselimit=20,M.block_navigation.init_add_tree=function(e){e.courselimit&&(this.courselimit=e.courselimit),new u(e)},e.Event.define("actionkey",{_event:e.UA.webkit||e.UA.ie?"keydown":"keypress",_keys:{37:"collapse",39:"expand",32:"toggle",13:"enter"},_keyHandler:function(e,t,n){var r;n.actions?r=n.actions:r={collapse:!0,expand:!0,toggle:!0,enter:!0},this._keys[e.keyCode]&&r[this._keys[e.keyCode]]&&(e.action=this._keys[e.keyCode],t.fire(e))},on:function(e,t,n){t.args===null?t._detacher=e.on(this._event,this._keyHandler,this,n,{actions:!1}):t._detacher=e.on(this._event,this._keyHandler,this,n,t.args[0])},detach:function(e,t){t._detacher.detach()},delegate:function(e,t,n,r){t.args===null?t._delegateDetacher=e.delegate(this._event,this._keyHandler,r,this,n,{actions:!1}):t._delegateDetacher=e.delegate(this._event,this._keyHandler,r,this,n,t.args[0])},detachDelegate:function(e,t){t._delegateDetacher.detach()}});var n=0,r=20,i=30,s=40,o={ROOTNODE:0,SYSTEM:1,CATEGORY:10,MYCATEGORY:11,COURSE:20,SECTION:30,ACTIVITY:40,RESOURCE:50,CUSTOM:60,SETTING:70,SITEADMIN:71,USER:80,CONTAINER:90},u=function(){u.superclass.constructor.apply(this,arguments)};u.prototype={id:null,branches:[],initializer:function(t){this.id=parseInt(t.id,10);var n=e.one("#inst"+t.id);if(n===null)return;e.delegate("click",this.toggleExpansion,n.one(".block_tree"),".tree_item.branch",this),e.delegate("actionkey",this.toggleExpansion,n.one(".block_tree"),".tree_item.branch",this);var r=[];t.expansions?r=t.expansions:window["navtreeexpansions"+t.id]&&(r=window["navtreeexpansions"+t.id]);for(var i in r){var s=(new a({tree:this,branchobj:r[i],overrides:{expandable:!0,children:[],haschildren:!0}})).wire();M.block_navigation.expandablebranchcount++,this.branches[s.get("id")]=s}if(window.siteadminexpansion){var o=(new a({tree:this,branchobj:window.siteadminexpansion,overrides:{expandable:!0,children:[],haschildren:!0}})).wire();M.block_navigation.expandablebranchcount++,this.branches[o.get("id")]=o;if(o.node){var u=o.node.get("childNodes").item(0);if(u){var f=e.Node.create(''+u.get("innerHTML")+"");o.node.replaceChild(f,u)}}}M.block_navigation.expandablebranchcount>0&&(e.delegate("click",this.fire_branch_action,n.one(".block_tree"),".tree_item.branch[data-expandable]",this),e.delegate("actionkey",this.fire_branch_action,n.one(".block_tree"),".tree_item.branch[data-expandable]",this))},fire_branch_action:function(e){var t=e.currentTarget.getAttribute("id"),n=this.branches[t];n.ajaxLoad(e)},toggleExpansion:function(e){if(!e.target.test("a")||e.keyCode!==0&&e.keyCode!==13){var t=e.target;t.test("li")||(t=t.ancestor("li"));if(!t)return;if(!t.hasClass("depth_1"))if(e.type==="actionkey"){switch(e.action){case"expand":t.removeClass("collapsed"),t.set("aria-expanded",!0);break;case"collapse":t.addClass("collapsed"),t.set("aria-expanded",!1);break;default:t.toggleClass("collapsed"),t.set("aria-expanded",!t.hasClass("collapsed"))}e.halt()}else t.toggleClass("collapsed"),t.set("aria-expanded",!t.hasClass("collapsed"));return this.get("accordian")&&t.siblings("li").each(function(){this.get("id")!==t.get("id")&&!this.hasClass("collapsed")&&(this.addClass("collapsed"),this.set("aria-expanded",!1))}),this.get("candock")&&M.core.dock.notifyBlockChange&&M.core.dock.notifyBlockChange(this.id),!0}e.stopPropagation();return}},e.extend(u,e.Base,u.prototype,{NAME:"navigation-tree",ATTRS:{candock:{validator:e.Lang.isBool,value:!1},accordian:{validator:e.Lang.isBool,value:!1},expansionlimit:{value:0,setter:function(e){return e=parseInt(e,10),e!==n&&e!==r&&e!==i&&e!==s&&(e=n),e}},instance:{value:!1,setter:function(e){return parseInt(e,10)}}}});var a=function(){a.superclass.constructor.apply(this,arguments)};a.prototype={node:null,initializer:function(t){var r,i;if(t.branchobj!==null){for(r in t.branchobj)this.set(r,t.branchobj[r]);i=this.get("children"),this.set("haschildren",i.length>0)}if(t.overrides!==null)for(r in t.overrides)this.set(r,t.overrides[r]);this.node=e.one("#"+this.get("id"));var o=this.get("tree").get("expansionlimit"),u=this.get("type");o!==n&&u>=o&&u<=s&&(this.set("expandable",!1),this.set("haschildren",!1))},draw:function(t){var n=this.get("expandable")||this.get("haschildren"),r=e.Node.create("
      • "),i=this.get("link"),s=e.Node.create('

        ').setAttribute("id",this.get("id"));i||s.setAttribute("tabindex","0"),n&&(r.addClass("collapsed").addClass("contains_branch"),r.set("aria-expanded",!1),s.addClass("branch"));var u=!1,a=this.get("icon");if(a&&(!n||this.get("type")===o.ACTIVITY)){u=e.Node.create(''),u.setAttribute("src",M.util.image_url(a.pix,a.component)),r.addClass("item_with_icon"),a.alt&&u.setAttribute("alt",a.alt),a.title&&u.setAttribute("title",a.title);if(a.classes)for(var f in a.classes)u.addClass(a.classes[f])}if(!i){var l=e.Node.create("");u&&l.appendChild(u),l.append(this.get("name")),this.get("hidden")&&l.addClass("dimmed_text"),s.appendChild(l)}else{var c=e.Node.create('');u&&c.appendChild(u),c.append(this.get("name")),this.get("hidden")&&c.addClass("dimmed"),s.appendChild(c)}return r.appendChild(s),t.appendChild(r),this.node=s,this},wire:function(){return this.node=this.node||e.one("#"+this.get("id")),this.node?(this.get("expandable")&&(this.node.setAttribute("data-expandable","1"),this.node.setAttribute("data-loaded","0")),this):this},getChildrenUL:function(){var t=this.node.next("ul");return t||(t=e.Node.create("
          "),this.node.ancestor().append(t)),t},ajaxLoad:function(t){t.type==="actionkey"&&t.action!=="enter"?t.halt():t.stopPropagation();if(t.type==="actionkey"&&t.action==="enter"||t.target.test("a"))return this.node.setAttribute("data-expandable","0"),this.node.setAttribute("data-loaded","1"),!0;if(this.node.hasClass("loadingbranch" +))return!0;if(this.node.getAttribute("data-loaded")==="1")return!0;this.node.addClass("loadingbranch");var n={elementid:this.get("id"),id:this.get("key"),type:this.get("type"),sesskey:M.cfg.sesskey,instance:this.get("tree").get("instance")},r="/lib/ajax/getnavbranch.php";return this.get("type")===o.SITEADMIN&&(r="/lib/ajax/getsiteadminbranch.php"),e.io(M.cfg.wwwroot+r,{method:"POST",data:n,on:{complete:this.ajaxProcessResponse},context:this}),!0},ajaxProcessResponse:function(t,n){this.node.removeClass("loadingbranch"),this.node.setAttribute("data-loaded","1");try{var r=e.JSON.parse(n.responseText);if(r.error)return e.use("moodle-core-notification-ajaxexception",function(){return(new M.core.ajaxException(r)).show()}),!1;if(r.children&&r.children.length>0){var i=0;for(var s in r.children)typeof r.children[s]=="object"&&(r.children[s].type===o.COURSE&&i++,this.addChild(r.children[s]));return(this.get("type")===o.CATEGORY||this.get("type")===o.ROOTNODE||this.get("type")===o.MYCATEGORY)&&i>=M.block_navigation.courselimit&&this.addViewAllCoursesChild(this),this.get("tree").get("candock")&&M.core.dock.notifyBlockChange&&M.core.dock.notifyBlockChange(this.get("tree").id),!0}}catch(u){return n&&n.status&&n.status>0&&e.use("moodle-core-notification-exception",function(){return(new M.core.exception(u)).show()}),!1}return this.node.replaceClass("branch","emptybranch"),!0},addChild:function(e){var t=new a({tree:this.get("tree"),branchobj:e});if(t.draw(this.getChildrenUL())){this.get("tree").branches[t.get("id")]=t,t.wire();var n=0,r,i=t.get("children");for(r in i)i[r].type===o.COURSE&&n++,typeof i[r]=="object"&&t.addChild(i[r]);(t.get("type")===o.CATEGORY||t.get("type")===o.MYCATEGORY)&&n>=M.block_navigation.courselimit&&this.addViewAllCoursesChild(t)}return!0},addViewAllCoursesChild:function(e){var t=null;e.get("type")===o.ROOTNODE?e.get("key")==="mycourses"?t=M.cfg.wwwroot+"/my":t=M.cfg.wwwroot+"/course/index.php":t=M.cfg.wwwroot+"/course/index.php?categoryid="+e.get("key"),e.addChild({name:M.util.get_string("viewallcourses","moodle"),title:M.util.get_string("viewallcourses","moodle"),link:t,haschildren:!1,icon:{pix:"i/navigationitem",component:"moodle"}})}},e.extend(a,e.Base,a.prototype,{NAME:"navigation-branch",ATTRS:{tree:{writeOnce:"initOnly",validator:e.Lang.isObject},name:{value:"",validator:e.Lang.isString,setter:function(e){return e.replace(/\n/g,"
          ")}},title:{value:"",validator:e.Lang.isString},id:{value:"",validator:e.Lang.isString,getter:function(e){return e===""&&(e="expandable_branch_"+M.block_navigation.expandablebranchcount,M.block_navigation.expandablebranchcount++),e}},key:{value:null},type:{value:null,setter:function(e){return parseInt(e,10)}},link:{value:!1},icon:{value:!1,validator:e.Lang.isObject},expandable:{value:!1,validator:e.Lang.isBool},hidden:{value:!1,validator:e.Lang.isBool},haschildren:{value:!1,validator:e.Lang.isBool},children:{value:[],validator:e.Lang.isArray}}})},"@VERSION@",{requires:["base","io-base","node","event-synthetic","event-delegate","json-parse"]}); diff --git a/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation.js b/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation.js index 37b4dd9e8c6..0f46ccda6ec 100644 --- a/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation.js +++ b/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation.js @@ -434,7 +434,7 @@ Y.extend(TREE, Y.Base, TREE.prototype, { * @constructor * @extends Base */ -BRANCH = function() { +var BRANCH = function() { BRANCH.superclass.constructor.apply(this, arguments); }; BRANCH.prototype = { @@ -632,7 +632,7 @@ BRANCH.prototype = { Y.io(M.cfg.wwwroot + ajaxfile, { method:'POST', - data: build_querystring(params), + data: params, on: { complete: this.ajaxProcessResponse }, @@ -670,8 +670,10 @@ BRANCH.prototype = { this.addChild(object.children[i]); } } - if ((this.get('type') === NODETYPE.CATEGORY || this.get('type') === NODETYPE.ROOTNODE || this.get('type') === NODETYPE.MYCATEGORY) - && coursecount >= M.block_navigation.courselimit) { + if ((this.get('type') === NODETYPE.CATEGORY || + this.get('type') === NODETYPE.ROOTNODE || + this.get('type') === NODETYPE.MYCATEGORY) + && coursecount >= M.block_navigation.courselimit) { this.addViewAllCoursesChild(this); } // If this block can dock tell the dock to resize if required and check diff --git a/blocks/navigation/yui/src/navigation/js/navigation.js b/blocks/navigation/yui/src/navigation/js/navigation.js index 9544816dfd7..e237023cab4 100644 --- a/blocks/navigation/yui/src/navigation/js/navigation.js +++ b/blocks/navigation/yui/src/navigation/js/navigation.js @@ -433,7 +433,7 @@ Y.extend(TREE, Y.Base, TREE.prototype, { * @constructor * @extends Base */ -BRANCH = function() { +var BRANCH = function() { BRANCH.superclass.constructor.apply(this, arguments); }; BRANCH.prototype = { @@ -632,7 +632,7 @@ BRANCH.prototype = { Y.io(M.cfg.wwwroot + ajaxfile, { method:'POST', - data: build_querystring(params), + data: params, on: { complete: this.ajaxProcessResponse }, @@ -670,8 +670,10 @@ BRANCH.prototype = { this.addChild(object.children[i]); } } - if ((this.get('type') === NODETYPE.CATEGORY || this.get('type') === NODETYPE.ROOTNODE || this.get('type') === NODETYPE.MYCATEGORY) - && coursecount >= M.block_navigation.courselimit) { + if ((this.get('type') === NODETYPE.CATEGORY || + this.get('type') === NODETYPE.ROOTNODE || + this.get('type') === NODETYPE.MYCATEGORY) + && coursecount >= M.block_navigation.courselimit) { this.addViewAllCoursesChild(this); } Y.log('AJAX loading complete.', 'note', 'moodle-block_navigation'); diff --git a/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander-debug.js b/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander-debug.js index c6b9726aa2f..92f0c020fd7 100644 --- a/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander-debug.js +++ b/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander-debug.js @@ -194,6 +194,7 @@ NS._toggle_category_expansion = function(e) { * @param {Object} config */ NS._toggle_generic_expansion = function(config) { + var spinner; if (config.spinnerhandle) { // Add a spinner to give some feedback to the user. spinner = M.util.add_spinner(Y, config.parentnode.one(config.spinnerhandle)).show(); diff --git a/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander-min.js b/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander-min.js index e85d702816a..49f5138141a 100644 --- a/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander-min.js +++ b/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander-min.js @@ -1 +1 @@ -YUI.add("moodle-course-categoryexpander",function(e,t){var n={CONTENTNODE:"content",COLLAPSEALL:"collapse-all",DISABLED:"disabled",LOADED:"loaded",NOTLOADED:"notloaded",SECTIONCOLLAPSED:"collapsed",HASCHILDREN:"with_children"},r={LOADEDTREES:".with_children.loaded",CONTENTNODE:".content",CATEGORYLISTENLINK:".category .info .categoryname",CATEGORYSPINNERLOCATION:".categoryname",CATEGORYWITHCOLLAPSEDLOADEDCHILDREN:".category.with_children.loaded.collapsed",CATEGORYWITHMAXIMISEDLOADEDCHILDREN:".category.with_children.loaded:not(.collapsed)",COLLAPSEEXPAND:".collapseexpand",COURSEBOX:".coursebox",COURSEBOXLISTENLINK:".coursebox .moreinfo",COURSEBOXSPINNERLOCATION:".coursename a",COURSECATEGORYTREE:".course_category_tree",PARENTWITHCHILDREN:".category"},i=e.namespace("Moodle.course.categoryexpander"),s=0,o=1,u=M.cfg.wwwroot+"/course/category.ajax.php";i.init=function(){var t=e.one(e.config.doc);t.delegate("click",this.toggle_category_expansion,r.CATEGORYLISTENLINK,this),t.delegate("click",this.toggle_coursebox_expansion,r.COURSEBOXLISTENLINK,this),t.delegate("click",this.collapse_expand_all,r.COLLAPSEEXPAND,this),t.once("key",this.setup_keyboard_listeners,"tab",this)},i.setup_keyboard_listeners=function(){var t=e.one(e.config.doc);t.all(r.CATEGORYLISTENLINK,r.COURSEBOXLISTENLINK,r.COLLAPSEEXPAND).setAttribute("tabindex","0"),e.one(e.config.doc).delegate("key",this.toggle_category_expansion,"enter",r.CATEGORYLISTENLINK,this),e.one(e.config.doc).delegate("key",this.toggle_coursebox_expansion,"enter",r.COURSEBOXLISTENLINK,this),e.one(e.config.doc).delegate("key",this.collapse_expand_all,"enter",r.COLLAPSEEXPAND,this)},i.toggle_category_expansion=function(t){e.use("io-base","json-parse","moodle-core-notification","anim-node-plugin",function(){i.toggle_category_expansion=i._toggle_category_expansion,i.toggle_category_expansion(t)})},i.toggle_coursebox_expansion=function(t){e.use("io-base","json-parse","moodle-core-notification","anim-node-plugin",function(){i.toggle_coursebox_expansion=i._toggle_coursebox_expansion,i.toggle_coursebox_expansion(t)}),t.preventDefault()},i._toggle_coursebox_expansion=function(e){var t;t=e.target.ancestor(r.COURSEBOX,!0),e.preventDefault();if(t.hasClass(n.LOADED)){this.run_expansion(t);return}this._toggle_generic_expansion({parentnode:t,childnode:t.one(r.CONTENTNODE),spinnerhandle:r.COURSEBOXSPINNERLOCATION,data:{courseid:t.getData("courseid"),type:o}})},i._toggle_category_expansion=function(e){var t,i,o;if(e.target.test("a")||e.target.test("img"))return;t=e.target.ancestor(r.PARENTWITHCHILDREN,!0);if(!t.hasClass(n.HASCHILDREN))return;if(t.hasClass(n.LOADED)){this.run_expansion(t);return}i=t.getData("categoryid"),o=t.getData("depth");if(typeof i=="undefined"||typeof o=="undefined")return;this._toggle_generic_expansion({parentnode:t,childnode:t.one(r.CONTENTNODE),spinnerhandle:r.CATEGORYSPINNERLOCATION,data:{categoryid:i,depth:o,showcourses:t.getData("showcourses"),type:s}})},i._toggle_generic_expansion=function(t){t.spinnerhandle&&(spinner=M.util.add_spinner(e,t.parentnode.one(t.spinnerhandle)).show()),e.io(u,{method:"POST",context:this,on:{complete:this.process_results},data:t.data,arguments:{parentnode:t.parentnode,childnode:t.childnode,spinner:spinner}})},i.run_expansion=function(e){var t=e.one(r.CONTENTNODE),i=this,s=e.ancestor(r.COURSECATEGORYTREE);this.add_animation(t),e.hasClass(n.SECTIONCOLLAPSED)?(t.setStyle("height","0"),e.removeClass(n.SECTIONCOLLAPSED),e.setAttribute("aria-expanded","true"),t.fx.set("reverse",!1)):(t.fx.set("reverse",!0),t.fx.once("end",function(e,t){t.addClass(n.SECTIONCOLLAPSED),t.setAttribute("aria-expanded","false")},this,e)),t.fx.once("end",function(e,t){t.setStyles({height:"",opacity:""}),this.destroy(),i.update_collapsible_actions(s)},t.fx,t),t.fx.run()},i.collapse_expand_all=function(t){e.use("io-base","json-parse","moodle-core-notification","anim-node-plugin",function(){i.collapse_expand_all=i._collapse_expand_all,i.collapse_expand_all(t)}),t.preventDefault()},i._collapse_expand_all=function(e){e.preventDefault();if(e.currentTarget.hasClass(n.DISABLED))return;var t=e.currentTarget.ancestor(r.COURSECATEGORYTREE);if(!t)return;var i=t.one(r.COLLAPSEEXPAND);i.hasClass(n.COLLAPSEALL)?this.collapse_all(t):this.expand_all(t),this.update_collapsible_actions(t)},i.expand_all=function(t){var i=[];t.all(r.CATEGORYWITHCOLLAPSEDLOADEDCHILDREN).each(function(e){e.ancestor(r.CATEGORYWITHCOLLAPSEDLOADEDCHILDREN)?(e.removeClass(n.SECTIONCOLLAPSED),e.all(r.LOADEDTREES).removeClass(n.SECTIONCOLLAPSED)):i.push(e)},this),e.all(i).each(function(e){this.run_expansion(e)},this)},i.collapse_all=function(t){var i=[];t.all(r.CATEGORYWITHMAXIMISEDLOADEDCHILDREN).each(function(e){e.ancestor(r.CATEGORYWITHMAXIMISEDLOADEDCHILDREN)?i.push(e):this.run_expansion(e)},this),e.all(i).each(function(e){e.addClass(n.SECTIONCOLLAPSED),e.all(r.LOADEDTREES).addClass(n.SECTIONCOLLAPSED)},this)},i.update_collapsible_actions=function(e){var t=!1,i=e.one(r.COLLAPSEEXPAND);if(!i)return;e.all(r.CATEGORYWITHMAXIMISEDLOADEDCHILDREN).each(function(e){return e.ancestor(r.CATEGORYWITHCOLLAPSEDLOADEDCHILDREN)?!1:(t=!0,!0)}),t?i.setHTML(M.util.get_string("collapseall","moodle")).addClass(n.COLLAPSEALL).removeClass(n.DISABLED):i.setHTML(M.util.get_string("expandall","moodle")).removeClass(n.COLLAPSEALL).removeClass(n.DISABLED)},i.process_results=function(t,r,i){var s,o;try{o=e.JSON.parse(r.responseText);if(o.error)return new M.core.ajaxException(o)}catch(u){return new M.core.exception(u)}s=e.Node.create(o),i.childnode.appendChild(s),i.parentnode.addClass(n.LOADED).removeClass(n.NOTLOADED),this.run_expansion(i.parentnode),i.spinner&&i.spinner.hide().destroy()},i.add_animation=function(t){return typeof t.fx!="undefined"?t:(t.plug(e.Plugin.NodeFX,{from:{height:0,opacity:0},to:{height:function(e){return e.get("scrollHeight")},opacity:1},duration:.2}),t)}},"@VERSION@",{requires:["node","event-key"]}); +YUI.add("moodle-course-categoryexpander",function(e,t){var n={CONTENTNODE:"content",COLLAPSEALL:"collapse-all",DISABLED:"disabled",LOADED:"loaded",NOTLOADED:"notloaded",SECTIONCOLLAPSED:"collapsed",HASCHILDREN:"with_children"},r={LOADEDTREES:".with_children.loaded",CONTENTNODE:".content",CATEGORYLISTENLINK:".category .info .categoryname",CATEGORYSPINNERLOCATION:".categoryname",CATEGORYWITHCOLLAPSEDLOADEDCHILDREN:".category.with_children.loaded.collapsed",CATEGORYWITHMAXIMISEDLOADEDCHILDREN:".category.with_children.loaded:not(.collapsed)",COLLAPSEEXPAND:".collapseexpand",COURSEBOX:".coursebox",COURSEBOXLISTENLINK:".coursebox .moreinfo",COURSEBOXSPINNERLOCATION:".coursename a",COURSECATEGORYTREE:".course_category_tree",PARENTWITHCHILDREN:".category"},i=e.namespace("Moodle.course.categoryexpander"),s=0,o=1,u=M.cfg.wwwroot+"/course/category.ajax.php";i.init=function(){var t=e.one(e.config.doc);t.delegate("click",this.toggle_category_expansion,r.CATEGORYLISTENLINK,this),t.delegate("click",this.toggle_coursebox_expansion,r.COURSEBOXLISTENLINK,this),t.delegate("click",this.collapse_expand_all,r.COLLAPSEEXPAND,this),t.once("key",this.setup_keyboard_listeners,"tab",this)},i.setup_keyboard_listeners=function(){var t=e.one(e.config.doc);t.all(r.CATEGORYLISTENLINK,r.COURSEBOXLISTENLINK,r.COLLAPSEEXPAND).setAttribute("tabindex","0"),e.one(e.config.doc).delegate("key",this.toggle_category_expansion,"enter",r.CATEGORYLISTENLINK,this),e.one(e.config.doc).delegate("key",this.toggle_coursebox_expansion,"enter",r.COURSEBOXLISTENLINK,this),e.one(e.config.doc).delegate("key",this.collapse_expand_all,"enter",r.COLLAPSEEXPAND,this)},i.toggle_category_expansion=function(t){e.use("io-base","json-parse","moodle-core-notification","anim-node-plugin",function(){i.toggle_category_expansion=i._toggle_category_expansion,i.toggle_category_expansion(t)})},i.toggle_coursebox_expansion=function(t){e.use("io-base","json-parse","moodle-core-notification","anim-node-plugin",function(){i.toggle_coursebox_expansion=i._toggle_coursebox_expansion,i.toggle_coursebox_expansion(t)}),t.preventDefault()},i._toggle_coursebox_expansion=function(e){var t;t=e.target.ancestor(r.COURSEBOX,!0),e.preventDefault();if(t.hasClass(n.LOADED)){this.run_expansion(t);return}this._toggle_generic_expansion({parentnode:t,childnode:t.one(r.CONTENTNODE),spinnerhandle:r.COURSEBOXSPINNERLOCATION,data:{courseid:t.getData("courseid"),type:o}})},i._toggle_category_expansion=function(e){var t,i,o;if(e.target.test("a")||e.target.test("img"))return;t=e.target.ancestor(r.PARENTWITHCHILDREN,!0);if(!t.hasClass(n.HASCHILDREN))return;if(t.hasClass(n.LOADED)){this.run_expansion(t);return}i=t.getData("categoryid"),o=t.getData("depth");if(typeof i=="undefined"||typeof o=="undefined")return;this._toggle_generic_expansion({parentnode:t,childnode:t.one(r.CONTENTNODE),spinnerhandle:r.CATEGORYSPINNERLOCATION,data:{categoryid:i,depth:o,showcourses:t.getData("showcourses"),type:s}})},i._toggle_generic_expansion=function(t){var n;t.spinnerhandle&&(n=M.util.add_spinner(e,t.parentnode.one(t.spinnerhandle)).show()),e.io(u,{method:"POST",context:this,on:{complete:this.process_results},data:t.data,arguments:{parentnode:t.parentnode,childnode:t.childnode,spinner:n}})},i.run_expansion=function(e){var t=e.one(r.CONTENTNODE),i=this,s=e.ancestor(r.COURSECATEGORYTREE);this.add_animation(t),e.hasClass(n.SECTIONCOLLAPSED)?(t.setStyle("height","0"),e.removeClass(n.SECTIONCOLLAPSED),e.setAttribute("aria-expanded","true"),t.fx.set("reverse",!1)):(t.fx.set("reverse",!0),t.fx.once("end",function(e,t){t.addClass(n.SECTIONCOLLAPSED),t.setAttribute("aria-expanded","false")},this,e)),t.fx.once("end",function(e,t){t.setStyles({height:"",opacity:""}),this.destroy(),i.update_collapsible_actions(s)},t.fx,t),t.fx.run()},i.collapse_expand_all=function(t){e.use("io-base","json-parse","moodle-core-notification","anim-node-plugin",function(){i.collapse_expand_all=i._collapse_expand_all,i.collapse_expand_all(t)}),t.preventDefault()},i._collapse_expand_all=function(e){e.preventDefault();if(e.currentTarget.hasClass(n.DISABLED))return;var t=e.currentTarget.ancestor(r.COURSECATEGORYTREE);if(!t)return;var i=t.one(r.COLLAPSEEXPAND);i.hasClass(n.COLLAPSEALL)?this.collapse_all(t):this.expand_all(t),this.update_collapsible_actions(t)},i.expand_all=function(t){var i=[];t.all(r.CATEGORYWITHCOLLAPSEDLOADEDCHILDREN).each(function(e){e.ancestor(r.CATEGORYWITHCOLLAPSEDLOADEDCHILDREN)?(e.removeClass(n.SECTIONCOLLAPSED),e.all(r.LOADEDTREES).removeClass(n.SECTIONCOLLAPSED)):i.push(e)},this),e.all(i).each(function(e){this.run_expansion(e)},this)},i.collapse_all=function(t){var i=[];t.all(r.CATEGORYWITHMAXIMISEDLOADEDCHILDREN).each(function(e){e.ancestor(r.CATEGORYWITHMAXIMISEDLOADEDCHILDREN)?i.push(e):this.run_expansion(e)},this),e.all(i).each(function(e){e.addClass(n.SECTIONCOLLAPSED),e.all(r.LOADEDTREES).addClass(n.SECTIONCOLLAPSED)},this)},i.update_collapsible_actions=function(e){var t=!1,i=e.one(r.COLLAPSEEXPAND);if(!i)return;e.all(r.CATEGORYWITHMAXIMISEDLOADEDCHILDREN).each(function(e){return e.ancestor(r.CATEGORYWITHCOLLAPSEDLOADEDCHILDREN)?!1:(t=!0,!0)}),t?i.setHTML(M.util.get_string("collapseall","moodle")).addClass(n.COLLAPSEALL).removeClass(n.DISABLED):i.setHTML(M.util.get_string("expandall","moodle")).removeClass(n.COLLAPSEALL).removeClass(n.DISABLED)},i.process_results=function(t,r,i){var s,o;try{o=e.JSON.parse(r.responseText);if(o.error)return new M.core.ajaxException(o)}catch(u){return new M.core.exception(u)}s=e.Node.create(o),i.childnode.appendChild(s),i.parentnode.addClass(n.LOADED).removeClass(n.NOTLOADED),this.run_expansion(i.parentnode),i.spinner&&i.spinner.hide().destroy()},i.add_animation=function(t){return typeof t.fx!="undefined"?t:(t.plug(e.Plugin.NodeFX,{from:{height:0,opacity:0},to:{height:function(e){return e.get("scrollHeight")},opacity:1},duration:.2}),t)}},"@VERSION@",{requires:["node","event-key"]}); diff --git a/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander.js b/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander.js index e58f308dade..b7e1e9bdb99 100644 --- a/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander.js +++ b/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander.js @@ -193,6 +193,7 @@ NS._toggle_category_expansion = function(e) { * @param {Object} config */ NS._toggle_generic_expansion = function(config) { + var spinner; if (config.spinnerhandle) { // Add a spinner to give some feedback to the user. spinner = M.util.add_spinner(Y, config.parentnode.one(config.spinnerhandle)).show(); diff --git a/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop-debug.js b/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop-debug.js index d7c5e0e6986..17db276cec5 100644 --- a/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop-debug.js +++ b/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop-debug.js @@ -126,9 +126,11 @@ Y.extend(DRAGSECTION, M.core.dragdrop, { // Get our drag object var drag = e.target; // Creat a dummy structure of the outer elemnents for clean styles application - var containernode = Y.Node.create('<' + M.course.format.get_containernode() + '>'); + var containernode = Y.Node.create('<' + M.course.format.get_containernode() + + '>'); containernode.addClass(M.course.format.get_containerclass()); - var sectionnode = Y.Node.create('<' + M.course.format.get_sectionwrappernode() + '>'); + var sectionnode = Y.Node.create('<' + M.course.format.get_sectionwrappernode() + + '>'); sectionnode.addClass( M.course.format.get_sectionwrapperclass()); sectionnode.setStyle('margin', 0); sectionnode.setContent(drag.get('node').get('innerHTML')); @@ -303,7 +305,8 @@ Y.extend(DRAGRESOURCE, M.core.dragdrop, { this.groups = ['resource']; this.samenodeclass = CSS.ACTIVITY; this.parentnodeclass = CSS.SECTION; - this.resourcedraghandle = this.get_drag_handle(M.util.get_string('movecoursemodule', 'moodle'), CSS.EDITINGMOVE, CSS.ICONCLASS, true); + this.resourcedraghandle = this.get_drag_handle(M.util.get_string('movecoursemodule', 'moodle'), + CSS.EDITINGMOVE, CSS.ICONCLASS, true); this.samenodelabel = { identifier: 'afterresource', diff --git a/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop.js b/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop.js index 3dae51c84f8..df6d54be517 100644 --- a/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop.js +++ b/course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop.js @@ -126,9 +126,11 @@ Y.extend(DRAGSECTION, M.core.dragdrop, { // Get our drag object var drag = e.target; // Creat a dummy structure of the outer elemnents for clean styles application - var containernode = Y.Node.create('<' + M.course.format.get_containernode() + '>'); + var containernode = Y.Node.create('<' + M.course.format.get_containernode() + + '>'); containernode.addClass(M.course.format.get_containerclass()); - var sectionnode = Y.Node.create('<' + M.course.format.get_sectionwrappernode() + '>'); + var sectionnode = Y.Node.create('<' + M.course.format.get_sectionwrappernode() + + '>'); sectionnode.addClass( M.course.format.get_sectionwrapperclass()); sectionnode.setStyle('margin', 0); sectionnode.setContent(drag.get('node').get('innerHTML')); @@ -299,7 +301,8 @@ Y.extend(DRAGRESOURCE, M.core.dragdrop, { this.groups = ['resource']; this.samenodeclass = CSS.ACTIVITY; this.parentnodeclass = CSS.SECTION; - this.resourcedraghandle = this.get_drag_handle(M.util.get_string('movecoursemodule', 'moodle'), CSS.EDITINGMOVE, CSS.ICONCLASS, true); + this.resourcedraghandle = this.get_drag_handle(M.util.get_string('movecoursemodule', 'moodle'), + CSS.EDITINGMOVE, CSS.ICONCLASS, true); this.samenodelabel = { identifier: 'afterresource', diff --git a/course/yui/build/moodle-course-management/moodle-course-management-debug.js b/course/yui/build/moodle-course-management/moodle-course-management-debug.js index 04c1e9d9212..0b3587a327f 100644 --- a/course/yui/build/moodle-course-management/moodle-course-management-debug.js +++ b/course/yui/build/moodle-course-management/moodle-course-management-debug.js @@ -439,7 +439,7 @@ Console.prototype = { handleBulkSortByaction : function(e) { var sortcategoryby = this.get('categorylisting').one('#menuresortcategoriesby'), sortcourseby = this.get('categorylisting').one('#menuresortcoursesby'), - sortbybutton = this.get('categorylisting').one('input[name="bulksort"]'); + sortbybutton = this.get('categorylisting').one('input[name="bulksort"]'), sortby = e; if (!sortby) { @@ -567,7 +567,7 @@ Console.prototype = { complete : callback }, context : context, - data : build_querystring(args), + data : args, 'arguments' : args }); } @@ -997,7 +997,8 @@ Item.prototype = { } else { // Aha it succeeded but this is the top item in the list. Pagination is in play! // Refresh to update the state of things. - Y.log(this.get('itemname')+' cannot be moved up as its the top item on this page.', 'info', 'moodle-course-management'); + Y.log(this.get('itemname') + ' cannot be moved up as its the top item on this page.', + 'info', 'moodle-course-management'); window.location.reload(); } }, @@ -1065,7 +1066,8 @@ Item.prototype = { } else { // Aha it succeeded but this is the bottom item in the list. Pagination is in play! // Refresh to update the state of things. - Y.log(this.get('itemname')+' cannot be moved down as its the top item on this page.', 'info', 'moodle-course-management'); + Y.log(this.get('itemname') + ' cannot be moved down as its the top item on this page.', + 'info', 'moodle-course-management'); window.location.reload(); } }, @@ -1459,7 +1461,8 @@ Category.prototype = { Y.log('Course was moved but the course listing could not be found to reflect this', 'warn', 'moodle-course-management'); return false; } - Y.log('Moved the course ('+course.getName()+') into this category ('+this.getName()+')', 'info', 'moodle-course-management'); + Y.log('Moved the course (' + course.getName() + ') into this category (' + this.getName() + ')', + 'debug', 'moodle-course-management'); this.highlight(); if (course) { if (outcome.paginationtotals) { diff --git a/course/yui/build/moodle-course-management/moodle-course-management-min.js b/course/yui/build/moodle-course-management/moodle-course-management-min.js index 3db2a2995f8..6c1575a4317 100644 --- a/course/yui/build/moodle-course-management/moodle-course-management-min.js +++ b/course/yui/build/moodle-course-management/moodle-course-management-min.js @@ -1,4 +1,4 @@ -YUI.add("moodle-course-management",function(e,t){function n(){n.superclass.constructor.apply(this,arguments)}function r(e){n.superclass.constructor.apply(this,[e])}function i(){i.superclass.constructor.apply(this,arguments)}function s(){s.superclass.constructor.apply(this,arguments)}function o(){o.superclass.constructor.apply(this,arguments)}n.NAME="moodle-course-management",n.CSS_PREFIX="management",n.ATTRS={element:{setter:function(t){return typeof t=="string"&&(t=e.one("#"+t)),t}},categorylisting:{value:null},courselisting:{value:null},coursedetails:{value:null},activecategoryid:{value:null},activecourseid:{value:null},categories:{setter:function(t,n){if(e.Lang.isArray(t))return t;var r=this.get(n);return r.push(t),r},value:[]},courses:{validator:function(t){return e.Lang.isArray(t)},value:[]},page:{getter:function(e,t){return e===null&&(e=this.get("element").getData(t),this.set(t,e)),e},value:null},totalpages:{getter:function(e,t){return e===null&&(e=this.get("element").getData(t),this.set(t,e)),e},value:null},totalcourses:{getter:function(e,t){return e===null&&(e=this.get("element").getData(t),this.set(t,e)),e},value:null},ajaxurl:{getter:function(e){return e===null&&(e=M.cfg.wwwroot+"/course/ajax/management.php"),e},value:null},dragdrop:{value:null}},n.prototype={categoriesinit:!1,initializer:function(){this.set("element","coursecat-management");var e=this.get("element"),t=e.one("#category-listing"),n=e.one("#course-listing"),i=null,s=null;t&&(i=t.one('.listitem[data-selected="1"]')),n&&(s=n.one('.listitem[data-selected="1"]')),this.set("categorylisting",t),this.set("courselisting",n),this.set("coursedetails",e.one("#course-detail")),i&&this.set("activecategoryid",i.getData("id")),s&&this.set("activecourseid",s.getData("id")),this.initialiseCategories(t),this.initialiseCourses(),n&&this.set("dragdrop",new r({console:this}))},initialiseCategories:function(e){var t=0;if(!e)return!1;var n=e.one("#menumovecategoriesto");n&&n.setAttribute("disabled",!0);var r=e.one("#menuresortcategoriesby");r&&r.setAttribute("disabled",!0);var i=e.one("#menuresortcoursesby");i&&i.setAttribute("disabled",!0),e.all(".listitem[data-id]").each(function(e){this.set("categories",new s({node:e,console:this})),t++},this),this.categoriesinit||(this.get("categorylisting").delegate("click",this.handleCategoryDelegation,"a[data-action]",this),this.get("categorylisting").delegate("click",this.handleCategoryDelegation,'input[name="bcat[]"]',this),this.get("categorylisting").delegate("click",this.handleBulkSortByaction,"#menuselectsortby",this),this.categoriesinit=!0)},initialiseCourses:function(){var e=this.getCategoryById(this.get("activecategoryid")),t=this.get("courselisting"),n=0;if(!t)return!1;var r=t.one("#menumovecoursesto");r&&r.setAttribute("disabled",!0),t.all(".listitem[data-id]").each(function(t){this.registerCourse(new o({node:t,console:this,category:e})),n++},this),t.delegate("click",this.handleCourseDelegation,"a[data-action]",this),t.delegate("click",this.handleCourseDelegation,'input[name="bc[]"]',this)},registerCourse:function(e){var t=this.get("courses");t.push(e),this.set("courses",t)},handleCourseDelegation:function(e){var t=e.currentTarget,n=t.getData("action"),r=t.ancestor(".listitem").getData("id"),i=this.getCourseById(r);i&&i.handle(n,e)},handleCategoryDelegation:function(e){var t=e.currentTarget,n=t.getData("action"),r=t.ancestor(".listitem").getData("id"),i=this.getCategoryById(r);i&&i.handle(n,e)},isCourseSelected:function(e){var t=!1;if(e&&e.get("checked"))t=!0;else{var n,r,i=this.get("courses"),s=i.length;for(n=0;n .course-listing"),s=r?r.one("ul.ml"):null,o=i?i.one("ul.ml"):null,u=i?i.getData("canmoveoutof"):!1,a=u?n:o;if(!o)return!1;o.all("> li").each -(function(e){this.initCourseListing(e,a)},this),o.setData("dd",new e.DD.Drop({node:o})),u&&s&&s.all("li > div").each(function(e){this.initCategoryListitem(e)},this),e.DD.DDM.on("drag:start",this.dragStart,this),e.DD.DDM.on("drag:end",this.dragEnd,this),e.DD.DDM.on("drag:drag",this.dragDrag,this),e.DD.DDM.on("drop:over",this.dropOver,this),e.DD.DDM.on("drop:enter",this.dropEnter,this),e.DD.DDM.on("drop:exit",this.dropExit,this),e.DD.DDM.on("drop:hit",this.dropHit,this)},initCourseListing:function(t,n){t.setData("dd",(new e.DD.Drag({node:t,target:{padding:"0 0 0 20"}})).addHandle(".drag-handle").plug(e.Plugin.DDProxy,{moveOnEnd:!1,borderStyle:!1}).plug(e.Plugin.DDConstrained,{constrain2node:n}))},initCategoryListitem:function(t){t.setData("dd",new e.DD.Drop({node:t}))},dragStart:function(e){var t=e.target,n=t.get("node"),r=t.get("dragNode");n.addClass("course-being-dragged"),r.addClass("course-being-dragged-proxy").set("innerHTML",n.one("a.coursename").get("innerHTML")),this.previoussibling=n.get("previousSibling")},dragEnd:function(e){var t=e.target,n=t.get("node");n.removeClass("course-being-dragged"),this.get("console").get("element").all("#category-listing li.highlight").removeClass("highlight")},dragDrag:function(e){var t=e.target.lastXY[1];t div a.action-moveup"),o=i.one(" > div a.action-movedown");if(!a||!o)s=i.one(" > div a.action-moveup"),f=u.one(" > div a.action-movedown"),!a&&!o?(l=e.Node.create(' '),f.replace(l),s.replace(f),l.replace(s),l.destroy()):o||s.insert(f,"after");s=i.one(" > div a.action-moveup"),s?s.focus():(o=i.one(" > div a.action-movedown"),o&&o.focus()),this.updated(!0)}else window.location.reload()},movedown:function(t,n,r){var i,s,o,u,a,f,l,c=this.checkAjaxResponse(t,n,r);if(c===!1)return!1;i=this.get("node"),s=i.next(".listitem");if(s){i.insert(s,"before"),f=s.one(" > div a.action-movedown"),o=i.one(" > div a.action-moveup");if(!f||!o)a=s.one(" > div a.action-moveup"),u=i.one(" > div a.action-movedown"),!f&&!o?(l=e.Node.create(' '),a.replace(l),u.replace(a),l.replace(u),l.destroy()):o||u.insert(a,"before");u=i.one(" > div a.action-movedown"),u?u.focus():(o=i.one(" > div a.action-moveup"),o&&o.focus()),this.updated(!0)}else window.location.reload()},show:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i;if(r===!1)return!1;this.markVisible(),i=this.get("node").one("a[data-action=hide]"),i&&i.focus(),this.updated()},markVisible:function(){return this.get("node").setAttribute("data-visible","1"),!0},hide:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i;if(r===!1)return!1;this.markHidden(),i=this.get("node").one("a[data-action=show]"),i&&i.focus(),this.updated()},markHidden:function(){return this.get("node").setAttribute("data-visible","0"),!0},updated:function(e){e&&this.highlight()},highlight:function(){var e=this.get("node");e.siblings(".highlight").removeClass("highlight"),e.addClass("highlight"),this.highlighttimeout&&window.clearTimeout(this.highlighttimeout),this.highlighttimeout=window.setTimeout(function(){e.removeClass("highlight")},2500)}},e.extend(i,e.Base,i.prototype),s.NAME="moodle-course-management-category",s.CSS_PREFIX="management-category",s.ATTRS={categoryid:{getter:function(e,t){return e===null&&(e=this.get("node").getData("id"),this.set(t,e)),e},value:null,writeOnce:!0},selected:{getter:function(e,t){return e===null&&(e=this.get("node").getData(t),e===null&&(e=!1),this.set(t,e)),e},value:null},courses:{validator:function(t){return e.Lang.isArray(t)},value:[]}},s.prototype={initializer:function(){this.set("itemname","category")},getName:function(){return this.get("node").one("a.categoryname").get("innerHTML")},registerCourse:function(e){var t=this.get("courses");t.push(e),this.set("courses",t)},handle:function(e,t){var n={categoryid:this.get("categoryid")},r=this.get("console").get("activecategoryid");r&&r!==n.categoryid&&(n.selectedcategory=r);switch(e){case"moveup":t.preventDefault(),this.get("console").performAjaxAction("movecategoryup",n,this.moveup,this);break;case"movedown":t.preventDefault(),this.get("console").performAjaxAction("movecategorydown",n,this.movedown,this);break;case"show":t.preventDefault(), -this.get("console").performAjaxAction("showcategory",n,this.show,this);break;case"hide":t.preventDefault(),this.get("console").performAjaxAction("hidecategory",n,this.hide,this);break;case"expand":t.preventDefault(),this.get("node").getData("expanded")==="0"&&(this.get("node").setAttribute("data-expanded","1").setData("expanded","true"),this.get("console").performAjaxAction("getsubcategorieshtml",n,this.loadSubcategories,this)),this.expand();break;case"collapse":t.preventDefault(),this.collapse();break;case"select":var i=this.get("console"),s=i.get("categorylisting").one("#menumovecategoriesto");s&&(i.isCategorySelected(t.currentTarget)&&i.get("categories").length>1?s.removeAttribute("disabled"):s.setAttribute("disabled",!0),i.handleBulkSortByaction());break;default:return!1}},expand:function(){var e=this.get("node"),t=e.one("a[data-action=expand]"),n=e.one("ul[role=group]");e.removeClass("collapsed").setAttribute("aria-expanded","true"),t.setAttribute("data-action","collapse").setAttrs({title:M.util.get_string("collapsecategory","moodle",this.getName())}).one("img").setAttrs({src:M.util.image_url("t/switch_minus","moodle"),alt:M.util.get_string("collapse","moodle")}),n&&n.setAttribute("aria-hidden","false"),this.get("console").performAjaxAction("expandcategory",{categoryid:this.get("categoryid")},null,this)},collapse:function(){var e=this.get("node"),t=e.one("a[data-action=collapse]"),n=e.one("ul[role=group]");e.addClass("collapsed").setAttribute("aria-expanded","false"),t.setAttribute("data-action","expand").setAttrs({title:M.util.get_string("expandcategory","moodle",this.getName())}).one("img").setAttrs({src:M.util.image_url("t/switch_plus","moodle"),alt:M.util.get_string("expand","moodle")}),n&&n.setAttribute("aria-hidden","true"),this.get("console").performAjaxAction("collapsecategory",{categoryid:this.get("categoryid")},null,this)},loadSubcategories:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i=this.get("node"),s=this.get("console"),o,u;return r===!1?!1:(i.append(r.html),s.initialiseCategories(i),M.core&&M.core.actionmenu&&M.core.actionmenu.newDOMNode&&M.core.actionmenu.newDOMNode(i),o=i.one("ul[role=group]"),u=i.one("a[data-action=collapse]"),o&&u&&u.setAttribute("aria-controls",o.generateID()),!0)},moveCourseTo:function(t){var n=this;e.use("moodle-core-notification-confirm",function(){var e=new M.core.confirm({title:M.util.get_string("confirm","moodle"),question:M.util.get_string("confirmcoursemove","moodle",{course:t.getName(),category:n.getName()}),yesLabel:M.util.get_string("move","moodle"),noLabel:M.util.get_string("cancel","moodle")});e.on("complete-yes",function(){e.hide(),e.destroy(),this.get("console").performAjaxAction("movecourseintocategory",{categoryid:this.get("categoryid"),courseid:t.get("courseid")},this.completeMoveCourse,this)},n),e.show()})},completeMoveCourse:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i=this.get("console"),s,o,u;return r===!1?!1:(o=i.getCourseById(n.courseid),o?(this.highlight(),o&&(r.paginationtotals&&(u=i.get("courselisting").one(".listing-pagination-totals"),u&&u.set("innerHTML",r.paginationtotals)),r.totalcatcourses!=="undefined"&&(u=this.get("node").one(".course-count span"),u&&u.set("innerHTML",u.get("innerHTML").replace(/^\d+/,r.totalcatcourses))),typeof r.fromcatcoursecount!="undefined"&&(s=i.get("activecategoryid"),s=i.getCategoryById(s),s&&(u=s.get("node").one(".course-count span"),u&&u.set("innerHTML",u.get("innerHTML").replace(/^\d+/,r.fromcatcoursecount)))),o.remove()),!0):!1)},show:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i;if(r===!1)return!1;this.markVisible(),i=this.get("node").one("a[data-action=hide]"),i&&i.focus(),r.categoryvisibility&&this.updateChildVisibility(r.categoryvisibility),r.coursevisibility&&this.updateCourseVisiblity(r.coursevisibility),this.updated()},hide:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i;if(r===!1)return!1;this.markHidden(),i=this.get("node").one("a[data-action=show]"),i&&i.focus(),r.categoryvisibility&&this.updateChildVisibility(r.categoryvisibility),r.coursevisibility&&this.updateCourseVisiblity(r.coursevisibility),this.updated()},updateCourseVisiblity:function(e){var t=this.get("console"),n,r;try{for(n in e)typeof e[n]=="object"&&(r=t.getCourseById(e[n].id),r&&(e[n].visible==="1"?r.markVisible():r.markHidden()))}catch(i){}return this},updateChildVisibility:function(e){var t=this.get("console"),n,r;try{for(n in e)typeof e[n]=="object"&&(r=t.getCategoryById(e[n].id),r&&(e[n].visible==="1"?r.markVisible():r.markHidden()))}catch(i){}return this}},e.extend(s,i,s.prototype),o.NAME="moodle-course-management-course",o.CSS_PREFIX="management-course",o.ATTRS={courseid:{},selected:{getter:function(e,t){return e===null&&(e=this.get("node").getData(t),this.set(t,e)),e},value:null},node:{},console:{writeOnce:"initOnly"},category:{writeOnce:"initOnly"}},o.prototype={initializer:function(){var e=this.get("node"),t=this.get("category");this.set("courseid",e.getData("id")),t&&t.registerCourse&&t.registerCourse(this),this.set("itemname","course")},getName:function(){return this.get("node").one("a.coursename").get("innerHTML")},handle:function(e,t){var n=this.get("console"),r={courseid:this.get("courseid")};switch(e){case"moveup":t.halt(),n.performAjaxAction("movecourseup",r,this.moveup,this);break;case"movedown":t.halt(),n.performAjaxAction("movecoursedown",r,this.movedown,this);break;case"show":t.halt(),n.performAjaxAction("showcourse",r,this.show,this);break;case"hide":t.halt(),n.performAjaxAction("hidecourse",r,this.hide,this);break;case"select":var i=this.get("console"),s=i.get("courselisting").one("#menumovecoursesto");s&&(i.isCourseSelected(t.currentTarget)?s.removeAttribute("disabled"):s.setAttribute("disabled",!0));break;default:return!1}},remove:function(){this.get("console").removeCourseById(this.get("courseid")),this.get("node").remove()},moveAfter:function(e,t){var n=this.get("console"),r={courseid:this.get("courseid"),moveafter:e,previous:t};n.performAjaxAction("movecourseafter" -,r,this.moveAfterResponse,this)},moveAfterResponse:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i=this.get("node"),s;if(r===!1)return s=i.ancestor("ul").one("li[data-id="+n.previous+"]"),s?s.insertAfter(i,"after"):i.ancestor("ul").one("li").insert(i,"before"),!1;this.highlight()}},e.extend(o,i,o.prototype)},"@VERSION@",{requires:["base","node","io-base","moodle-core-notification-exception","json-parse","dd-constrain","dd-proxy","dd-drop","dd-delegate","node-event-delegate"]}); +YUI.add("moodle-course-management",function(e,t){function n(){n.superclass.constructor.apply(this,arguments)}function r(e){n.superclass.constructor.apply(this,[e])}function i(){i.superclass.constructor.apply(this,arguments)}function s(){s.superclass.constructor.apply(this,arguments)}function o(){o.superclass.constructor.apply(this,arguments)}n.NAME="moodle-course-management",n.CSS_PREFIX="management",n.ATTRS={element:{setter:function(t){return typeof t=="string"&&(t=e.one("#"+t)),t}},categorylisting:{value:null},courselisting:{value:null},coursedetails:{value:null},activecategoryid:{value:null},activecourseid:{value:null},categories:{setter:function(t,n){if(e.Lang.isArray(t))return t;var r=this.get(n);return r.push(t),r},value:[]},courses:{validator:function(t){return e.Lang.isArray(t)},value:[]},page:{getter:function(e,t){return e===null&&(e=this.get("element").getData(t),this.set(t,e)),e},value:null},totalpages:{getter:function(e,t){return e===null&&(e=this.get("element").getData(t),this.set(t,e)),e},value:null},totalcourses:{getter:function(e,t){return e===null&&(e=this.get("element").getData(t),this.set(t,e)),e},value:null},ajaxurl:{getter:function(e){return e===null&&(e=M.cfg.wwwroot+"/course/ajax/management.php"),e},value:null},dragdrop:{value:null}},n.prototype={categoriesinit:!1,initializer:function(){this.set("element","coursecat-management");var e=this.get("element"),t=e.one("#category-listing"),n=e.one("#course-listing"),i=null,s=null;t&&(i=t.one('.listitem[data-selected="1"]')),n&&(s=n.one('.listitem[data-selected="1"]')),this.set("categorylisting",t),this.set("courselisting",n),this.set("coursedetails",e.one("#course-detail")),i&&this.set("activecategoryid",i.getData("id")),s&&this.set("activecourseid",s.getData("id")),this.initialiseCategories(t),this.initialiseCourses(),n&&this.set("dragdrop",new r({console:this}))},initialiseCategories:function(e){var t=0;if(!e)return!1;var n=e.one("#menumovecategoriesto");n&&n.setAttribute("disabled",!0);var r=e.one("#menuresortcategoriesby");r&&r.setAttribute("disabled",!0);var i=e.one("#menuresortcoursesby");i&&i.setAttribute("disabled",!0),e.all(".listitem[data-id]").each(function(e){this.set("categories",new s({node:e,console:this})),t++},this),this.categoriesinit||(this.get("categorylisting").delegate("click",this.handleCategoryDelegation,"a[data-action]",this),this.get("categorylisting").delegate("click",this.handleCategoryDelegation,'input[name="bcat[]"]',this),this.get("categorylisting").delegate("click",this.handleBulkSortByaction,"#menuselectsortby",this),this.categoriesinit=!0)},initialiseCourses:function(){var e=this.getCategoryById(this.get("activecategoryid")),t=this.get("courselisting"),n=0;if(!t)return!1;var r=t.one("#menumovecoursesto");r&&r.setAttribute("disabled",!0),t.all(".listitem[data-id]").each(function(t){this.registerCourse(new o({node:t,console:this,category:e})),n++},this),t.delegate("click",this.handleCourseDelegation,"a[data-action]",this),t.delegate("click",this.handleCourseDelegation,'input[name="bc[]"]',this)},registerCourse:function(e){var t=this.get("courses");t.push(e),this.set("courses",t)},handleCourseDelegation:function(e){var t=e.currentTarget,n=t.getData("action"),r=t.ancestor(".listitem").getData("id"),i=this.getCourseById(r);i&&i.handle(n,e)},handleCategoryDelegation:function(e){var t=e.currentTarget,n=t.getData("action"),r=t.ancestor(".listitem").getData("id"),i=this.getCategoryById(r);i&&i.handle(n,e)},isCourseSelected:function(e){var t=!1;if(e&&e.get("checked"))t=!0;else{var n,r,i=this.get("courses"),s=i.length;for(n=0;n .course-listing"),s=r?r.one("ul.ml"):null,o=i?i.one("ul.ml"):null,u=i?i.getData("canmoveoutof"):!1,a=u?n:o;if(!o)return!1;o.all("> li").each(function(e){this.initCourseListing(e,a)},this),o.setData +("dd",new e.DD.Drop({node:o})),u&&s&&s.all("li > div").each(function(e){this.initCategoryListitem(e)},this),e.DD.DDM.on("drag:start",this.dragStart,this),e.DD.DDM.on("drag:end",this.dragEnd,this),e.DD.DDM.on("drag:drag",this.dragDrag,this),e.DD.DDM.on("drop:over",this.dropOver,this),e.DD.DDM.on("drop:enter",this.dropEnter,this),e.DD.DDM.on("drop:exit",this.dropExit,this),e.DD.DDM.on("drop:hit",this.dropHit,this)},initCourseListing:function(t,n){t.setData("dd",(new e.DD.Drag({node:t,target:{padding:"0 0 0 20"}})).addHandle(".drag-handle").plug(e.Plugin.DDProxy,{moveOnEnd:!1,borderStyle:!1}).plug(e.Plugin.DDConstrained,{constrain2node:n}))},initCategoryListitem:function(t){t.setData("dd",new e.DD.Drop({node:t}))},dragStart:function(e){var t=e.target,n=t.get("node"),r=t.get("dragNode");n.addClass("course-being-dragged"),r.addClass("course-being-dragged-proxy").set("innerHTML",n.one("a.coursename").get("innerHTML")),this.previoussibling=n.get("previousSibling")},dragEnd:function(e){var t=e.target,n=t.get("node");n.removeClass("course-being-dragged"),this.get("console").get("element").all("#category-listing li.highlight").removeClass("highlight")},dragDrag:function(e){var t=e.target.lastXY[1];t div a.action-moveup"),o=i.one(" > div a.action-movedown");if(!a||!o)s=i.one(" > div a.action-moveup"),f=u.one(" > div a.action-movedown"),!a&&!o?(l=e.Node.create(' '),f.replace(l),s.replace(f),l.replace(s),l.destroy()):o||s.insert(f,"after");s=i.one(" > div a.action-moveup"),s?s.focus():(o=i.one(" > div a.action-movedown"),o&&o.focus()),this.updated(!0)}else window.location.reload()},movedown:function(t,n,r){var i,s,o,u,a,f,l,c=this.checkAjaxResponse(t,n,r);if(c===!1)return!1;i=this.get("node"),s=i.next(".listitem");if(s){i.insert(s,"before"),f=s.one(" > div a.action-movedown"),o=i.one(" > div a.action-moveup");if(!f||!o)a=s.one(" > div a.action-moveup"),u=i.one(" > div a.action-movedown"),!f&&!o?(l=e.Node.create(' '),a.replace(l),u.replace(a),l.replace(u),l.destroy()):o||u.insert(a,"before");u=i.one(" > div a.action-movedown"),u?u.focus():(o=i.one(" > div a.action-moveup"),o&&o.focus()),this.updated(!0)}else window.location.reload()},show:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i;if(r===!1)return!1;this.markVisible(),i=this.get("node").one("a[data-action=hide]"),i&&i.focus(),this.updated()},markVisible:function(){return this.get("node").setAttribute("data-visible","1"),!0},hide:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i;if(r===!1)return!1;this.markHidden(),i=this.get("node").one("a[data-action=show]"),i&&i.focus(),this.updated()},markHidden:function(){return this.get("node").setAttribute("data-visible","0"),!0},updated:function(e){e&&this.highlight()},highlight:function(){var e=this.get("node");e.siblings(".highlight").removeClass("highlight"),e.addClass("highlight"),this.highlighttimeout&&window.clearTimeout(this.highlighttimeout),this.highlighttimeout=window.setTimeout(function(){e.removeClass("highlight")},2500)}},e.extend(i,e.Base,i.prototype),s.NAME="moodle-course-management-category",s.CSS_PREFIX="management-category",s.ATTRS={categoryid:{getter:function(e,t){return e===null&&(e=this.get("node").getData("id"),this.set(t,e)),e},value:null,writeOnce:!0},selected:{getter:function(e,t){return e===null&&(e=this.get("node").getData(t),e===null&&(e=!1),this.set(t,e)),e},value:null},courses:{validator:function(t){return e.Lang.isArray(t)},value:[]}},s.prototype={initializer:function(){this.set("itemname","category")},getName:function(){return this.get("node").one("a.categoryname").get("innerHTML")},registerCourse:function(e){var t=this.get("courses");t.push(e),this.set("courses",t)},handle:function(e,t){var n={categoryid:this.get("categoryid")},r=this.get("console").get("activecategoryid");r&&r!==n.categoryid&&(n.selectedcategory=r);switch(e){case"moveup":t.preventDefault(),this.get("console").performAjaxAction("movecategoryup",n,this.moveup,this);break;case"movedown":t.preventDefault(),this.get("console").performAjaxAction("movecategorydown",n,this.movedown,this);break;case"show":t.preventDefault(),this.get("console").performAjaxAction("showcategory",n,this +.show,this);break;case"hide":t.preventDefault(),this.get("console").performAjaxAction("hidecategory",n,this.hide,this);break;case"expand":t.preventDefault(),this.get("node").getData("expanded")==="0"&&(this.get("node").setAttribute("data-expanded","1").setData("expanded","true"),this.get("console").performAjaxAction("getsubcategorieshtml",n,this.loadSubcategories,this)),this.expand();break;case"collapse":t.preventDefault(),this.collapse();break;case"select":var i=this.get("console"),s=i.get("categorylisting").one("#menumovecategoriesto");s&&(i.isCategorySelected(t.currentTarget)&&i.get("categories").length>1?s.removeAttribute("disabled"):s.setAttribute("disabled",!0),i.handleBulkSortByaction());break;default:return!1}},expand:function(){var e=this.get("node"),t=e.one("a[data-action=expand]"),n=e.one("ul[role=group]");e.removeClass("collapsed").setAttribute("aria-expanded","true"),t.setAttribute("data-action","collapse").setAttrs({title:M.util.get_string("collapsecategory","moodle",this.getName())}).one("img").setAttrs({src:M.util.image_url("t/switch_minus","moodle"),alt:M.util.get_string("collapse","moodle")}),n&&n.setAttribute("aria-hidden","false"),this.get("console").performAjaxAction("expandcategory",{categoryid:this.get("categoryid")},null,this)},collapse:function(){var e=this.get("node"),t=e.one("a[data-action=collapse]"),n=e.one("ul[role=group]");e.addClass("collapsed").setAttribute("aria-expanded","false"),t.setAttribute("data-action","expand").setAttrs({title:M.util.get_string("expandcategory","moodle",this.getName())}).one("img").setAttrs({src:M.util.image_url("t/switch_plus","moodle"),alt:M.util.get_string("expand","moodle")}),n&&n.setAttribute("aria-hidden","true"),this.get("console").performAjaxAction("collapsecategory",{categoryid:this.get("categoryid")},null,this)},loadSubcategories:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i=this.get("node"),s=this.get("console"),o,u;return r===!1?!1:(i.append(r.html),s.initialiseCategories(i),M.core&&M.core.actionmenu&&M.core.actionmenu.newDOMNode&&M.core.actionmenu.newDOMNode(i),o=i.one("ul[role=group]"),u=i.one("a[data-action=collapse]"),o&&u&&u.setAttribute("aria-controls",o.generateID()),!0)},moveCourseTo:function(t){var n=this;e.use("moodle-core-notification-confirm",function(){var e=new M.core.confirm({title:M.util.get_string("confirm","moodle"),question:M.util.get_string("confirmcoursemove","moodle",{course:t.getName(),category:n.getName()}),yesLabel:M.util.get_string("move","moodle"),noLabel:M.util.get_string("cancel","moodle")});e.on("complete-yes",function(){e.hide(),e.destroy(),this.get("console").performAjaxAction("movecourseintocategory",{categoryid:this.get("categoryid"),courseid:t.get("courseid")},this.completeMoveCourse,this)},n),e.show()})},completeMoveCourse:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i=this.get("console"),s,o,u;return r===!1?!1:(o=i.getCourseById(n.courseid),o?(this.highlight(),o&&(r.paginationtotals&&(u=i.get("courselisting").one(".listing-pagination-totals"),u&&u.set("innerHTML",r.paginationtotals)),r.totalcatcourses!=="undefined"&&(u=this.get("node").one(".course-count span"),u&&u.set("innerHTML",u.get("innerHTML").replace(/^\d+/,r.totalcatcourses))),typeof r.fromcatcoursecount!="undefined"&&(s=i.get("activecategoryid"),s=i.getCategoryById(s),s&&(u=s.get("node").one(".course-count span"),u&&u.set("innerHTML",u.get("innerHTML").replace(/^\d+/,r.fromcatcoursecount)))),o.remove()),!0):!1)},show:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i;if(r===!1)return!1;this.markVisible(),i=this.get("node").one("a[data-action=hide]"),i&&i.focus(),r.categoryvisibility&&this.updateChildVisibility(r.categoryvisibility),r.coursevisibility&&this.updateCourseVisiblity(r.coursevisibility),this.updated()},hide:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i;if(r===!1)return!1;this.markHidden(),i=this.get("node").one("a[data-action=show]"),i&&i.focus(),r.categoryvisibility&&this.updateChildVisibility(r.categoryvisibility),r.coursevisibility&&this.updateCourseVisiblity(r.coursevisibility),this.updated()},updateCourseVisiblity:function(e){var t=this.get("console"),n,r;try{for(n in e)typeof e[n]=="object"&&(r=t.getCourseById(e[n].id),r&&(e[n].visible==="1"?r.markVisible():r.markHidden()))}catch(i){}return this},updateChildVisibility:function(e){var t=this.get("console"),n,r;try{for(n in e)typeof e[n]=="object"&&(r=t.getCategoryById(e[n].id),r&&(e[n].visible==="1"?r.markVisible():r.markHidden()))}catch(i){}return this}},e.extend(s,i,s.prototype),o.NAME="moodle-course-management-course",o.CSS_PREFIX="management-course",o.ATTRS={courseid:{},selected:{getter:function(e,t){return e===null&&(e=this.get("node").getData(t),this.set(t,e)),e},value:null},node:{},console:{writeOnce:"initOnly"},category:{writeOnce:"initOnly"}},o.prototype={initializer:function(){var e=this.get("node"),t=this.get("category");this.set("courseid",e.getData("id")),t&&t.registerCourse&&t.registerCourse(this),this.set("itemname","course")},getName:function(){return this.get("node").one("a.coursename").get("innerHTML")},handle:function(e,t){var n=this.get("console"),r={courseid:this.get("courseid")};switch(e){case"moveup":t.halt(),n.performAjaxAction("movecourseup",r,this.moveup,this);break;case"movedown":t.halt(),n.performAjaxAction("movecoursedown",r,this.movedown,this);break;case"show":t.halt(),n.performAjaxAction("showcourse",r,this.show,this);break;case"hide":t.halt(),n.performAjaxAction("hidecourse",r,this.hide,this);break;case"select":var i=this.get("console"),s=i.get("courselisting").one("#menumovecoursesto");s&&(i.isCourseSelected(t.currentTarget)?s.removeAttribute("disabled"):s.setAttribute("disabled",!0));break;default:return!1}},remove:function(){this.get("console").removeCourseById(this.get("courseid")),this.get("node").remove()},moveAfter:function(e,t){var n=this.get("console"),r={courseid:this.get("courseid"),moveafter:e,previous:t};n.performAjaxAction("movecourseafter",r,this.moveAfterResponse,this)},moveAfterResponse +:function(e,t,n){var r=this.checkAjaxResponse(e,t,n),i=this.get("node"),s;if(r===!1)return s=i.ancestor("ul").one("li[data-id="+n.previous+"]"),s?s.insertAfter(i,"after"):i.ancestor("ul").one("li").insert(i,"before"),!1;this.highlight()}},e.extend(o,i,o.prototype)},"@VERSION@",{requires:["base","node","io-base","moodle-core-notification-exception","json-parse","dd-constrain","dd-proxy","dd-drop","dd-delegate","node-event-delegate"]}); diff --git a/course/yui/build/moodle-course-management/moodle-course-management.js b/course/yui/build/moodle-course-management/moodle-course-management.js index 9a002f9290f..883b96495a2 100644 --- a/course/yui/build/moodle-course-management/moodle-course-management.js +++ b/course/yui/build/moodle-course-management/moodle-course-management.js @@ -433,7 +433,7 @@ Console.prototype = { handleBulkSortByaction : function(e) { var sortcategoryby = this.get('categorylisting').one('#menuresortcategoriesby'), sortcourseby = this.get('categorylisting').one('#menuresortcoursesby'), - sortbybutton = this.get('categorylisting').one('input[name="bulksort"]'); + sortbybutton = this.get('categorylisting').one('input[name="bulksort"]'), sortby = e; if (!sortby) { @@ -560,7 +560,7 @@ Console.prototype = { complete : callback }, context : context, - data : build_querystring(args), + data : args, 'arguments' : args }); } diff --git a/course/yui/build/moodle-course-toolboxes/moodle-course-toolboxes-debug.js b/course/yui/build/moodle-course-toolboxes/moodle-course-toolboxes-debug.js index 9796fc375e2..66da159f2a3 100644 --- a/course/yui/build/moodle-course-toolboxes/moodle-course-toolboxes-debug.js +++ b/course/yui/build/moodle-course-toolboxes/moodle-course-toolboxes-debug.js @@ -343,7 +343,6 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, { case 'groupsvisible': case 'groupsnone': // The user is changing the group mode. - callback = 'change_groupmode'; this.change_groupmode(ev, node, activity, action); break; case 'move': @@ -773,7 +772,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, { // Force the editing instruction to match the mod-indent position. var padside = 'left'; - if (right_to_left()) { + if (window.right_to_left()) { padside = 'right'; } diff --git a/course/yui/build/moodle-course-toolboxes/moodle-course-toolboxes-min.js b/course/yui/build/moodle-course-toolboxes/moodle-course-toolboxes-min.js index c83366c468d..a9928117a56 100644 --- a/course/yui/build/moodle-course-toolboxes/moodle-course-toolboxes-min.js +++ b/course/yui/build/moodle-course-toolboxes/moodle-course-toolboxes-min.js @@ -1,2 +1,2 @@ -YUI.add("moodle-course-toolboxes",function(e,t){var n={ACTIVITYINSTANCE:"activityinstance",AVAILABILITYINFODIV:"div.availabilityinfo",CONTENTWITHOUTLINK:"contentwithoutlink",CONDITIONALHIDDEN:"conditionalhidden",DIMCLASS:"dimmed",DIMMEDTEXT:"dimmed_text",EDITINSTRUCTIONS:"editinstructions",EDITINGTITLE:"editor_displayed",HIDE:"hide",MODINDENTCOUNT:"mod-indent-",MODINDENTHUGE:"mod-indent-huge",MODULEIDPREFIX:"module-",SECTIONHIDDENCLASS:"hidden",SECTIONIDPREFIX:"section-",SHOW:"editing_show",TITLEEDITOR:"titleeditor"},r={ACTIONAREA:".actions",ACTIONLINKTEXT:".actionlinktext",ACTIVITYACTION:"a.cm-edit-action[data-action], a.editing_title",ACTIVITYFORM:"."+n.ACTIVITYINSTANCE+" form",ACTIVITYICON:"img.activityicon",ACTIVITYINSTANCE:"."+n.ACTIVITYINSTANCE,ACTIVITYLINK:"."+n.ACTIVITYINSTANCE+" > a",ACTIVITYLI:"li.activity",ACTIVITYTITLE:"input[name=title]",COMMANDSPAN:".commands",CONTENTAFTERLINK:"div.contentafterlink",CONTENTWITHOUTLINK:"div.contentwithoutlink",EDITTITLE:"a.editing_title",HIDE:"a.editing_hide",HIGHLIGHT:"a.editing_highlight",INSTANCENAME:"span.instancename",MODINDENTDIV:".mod-indent",MODINDENTOUTER:".mod-indent-outer",PAGECONTENT:"body",SECTIONLI:"li.section",SHOW:"a."+n.SHOW,SHOWHIDE:"a.editing_showhide"},i={MIN:0,MAX:16},s=e.one(document.body);M.course=M.course||{};var o=function(){o.superclass.constructor.apply(this,arguments)};e.extend(o,e.Base,{send_request:function(t,n,r,i){t||(t={});var s=this.get("config").pageparams,o;for(o in s)t[o]=s[o];t.sesskey=M.cfg.sesskey,t.courseId=this.get("courseid");var u=M.cfg.wwwroot+this.get("ajaxurl"),a=[],f={method:"POST",data:t,on:{success:function(t,i){try{a=e.JSON.parse(i.responseText),a.error&&new M.core.ajaxException(a)}catch(s){}r&&e.bind(r,this,a)(),n&&window.setTimeout(function(){n.hide()},400)},failure:function(e,t){n&&n.hide(),new M.core.ajaxException(t)}},context:this};if(i)for(o in i)f[o]=i[o];return n&&n.show(),e.io(u,f),this}},{NAME:"course-toolbox",ATTRS:{courseid:{value:0},format:{value:"topics"},ajaxurl:{value:null},config:{value:{}}}});var u=function(){u.superclass.constructor.apply(this,arguments)};e.extend(u,o,{GROUPS_NONE:0,GROUPS_SEPARATE:1,GROUPS_VISIBLE:2,edittitleevents:[],initializer:function(){M.course.coursebase.register_module(this),s.delegate("key",this.handle_data_action,"down:enter",r.ACTIVITYACTION,this),e.delegate("click",this.handle_data_action,s,r.ACTIVITYACTION,this)},handle_data_action:function(e){var t=e.target;t.test("a")||(t=t.ancestor(r.ACTIVITYACTION));var n=t.getData("action"),i=t.ancestor(r.ACTIVITYLI);if(!t.test("a")||!n||!i)return;switch(n){case"edittitle":this.edit_title(e,t,i,n);break;case"moveleft":case"moveright":this.change_indent(e,t,i,n);break;case"delete":this.delete_with_confirmation(e,t,i,n);break;case"duplicate":this.duplicate(e,t,i,n);break;case"hide":case"show":this.change_visibility(e,t,i,n);break;case"groupsseparate":case"groupsvisible":case"groupsnone":callback="change_groupmode",this.change_groupmode(e,t,i,n);break;case"move":case"update":case"duplicate":case"assignroles":break;default:}},add_spinner:function(t){var n=t.one(r.ACTIONAREA);return n?M.util.add_spinner(e,n):null},change_indent:function(t,s,o,u){t.preventDefault();var a=u==="moveleft"?-1:1,f=o.one(r.MODINDENTDIV),l=f.getAttribute("class").match(/mod-indent-(\d{1,})/),c=0,h;l&&(c=parseInt(l[1],10)),h=c+parseInt(a,10);if(hi.MAX)return;l&&f.removeClass(l[0]),f.addClass(n.MODINDENTCOUNT+h);var p={"class":"resource",field:"indent",value:h,id:e.Moodle.core_course.util.cm.getId(o)},d=this.add_spinner(o);this.send_request(p,d);var v;h===i.MIN?(s.addClass("hidden"),v=o.one(".editing_moveright")):h>i.MIN&&c===i.MIN&&s.ancestor(".menu").one("[data-action=moveleft]").removeClass("hidden"),h===i.MAX?(s.addClass("hidden"),v=o.one(".editing_moveleft")):h15&&!m?f.addClass(n.MODINDENTHUGE):h<=15&&m&&f.removeClass(n.MODINDENTHUGE),t.type&&t.type==="key"&&v&&v.focus()},delete_with_confirmation:function(t,n,r){t.preventDefault();var i=r,s="",o={type:M.util.get_string("pluginname",i.getAttribute("class").match(/modtype_([^\s]*)/)[1])};e.Moodle.core_course.util.cm.getName(i)!==null?(o.name=e.Moodle.core_course.util.cm.getName(i),s=M.util.get_string("deletechecktypename","moodle",o)):s=M.util.get_string("deletechecktype","moodle",o);var u=new M.core.confirm({question:s,modal:!0,visible:!1});return u.show(),u.on("complete-yes",function(){i.remove();var t={"class":"resource",action:"DELETE",id:e.Moodle.core_course.util.cm.getId(i)};this.send_request(t),M.core.actionmenu&&M.core.actionmenu.instance&&M.core.actionmenu.instance.hideMenu()},this),this},duplicate:function(t,n,r){t.preventDefault();var i=r,s=r.ancestor(M.course.format.get_section_selector(e)),o=M.util.add_lightbox(e,s).show(),u={"class":"resource",field:"duplicate",id:e.Moodle.core_course.util.cm.getId(i),sr:n.getData("sr")};return this.send_request(u,o,function(t){var n=e.Node.create(t.fullcontent);r.insert(n,"after"),e.use("moodle-course-coursebase",function(){M.course.coursebase.invoke_function("setup_for_resource",n)}),M.core.actionmenu&&M.core.actionmenu.newDOMNode&&M.core.actionmenu.newDOMNode(n)}),this},change_visibility:function(t,n,r,i){t.preventDefault();var s=r,o=this.handle_resource_dim(n,r,i),u={"class":"resource",field:"visible",value:o,id:e.Moodle.core_course.util.cm.getId(s)},a=this.add_spinner(s);return this.send_request(u,a),this},handle_resource_dim:function(t,i,s){var o=n.DIMCLASS,u=i.one([r.ACTIVITYLINK,r.CONTENTWITHOUTLINK].join(", ")),a=i.one(n.AVAILABILITYINFODIV),f=s==="hide"?"show":"hide",l=t.one("span"),c=M.util.get_string(f,"moodle"),h=t.one("img");return h.setAttrs({src:M.util.image_url("t/"+f)}),e.Lang.trim(t.getAttribute("title"))&&t.setAttribute("title",c),e.Lang.trim(h.getAttribute("alt"))&&h.setAttribute("alt",c),t.replaceClass("editing_"+s,"editing_"+f),t.setData("action",f),l&&l.set("text",c),i.one(r.CONTENTWITHOUTLINK -)&&(u=i.one(r.CONTENTWITHOUTLINK),o=n.DIMMEDTEXT),u.hasClass(n.CONDITIONALHIDDEN)||(s==="hide"?(u.addClass(o),i.all(r.CONTENTAFTERLINK).addClass(n.DIMMEDTEXT)):(u.removeClass(o),i.all(r.CONTENTAFTERLINK).removeClass(n.DIMMEDTEXT))),a&&a.toggleClass(n.HIDE),s==="hide"?0:1},change_groupmode:function(t,n,r){t.preventDefault();var i=parseInt(n.getData("nextgroupmode"),10),s="",o="",u,a,f,l=i+1,c=n.one("img");return l>2&&(l=0),i===this.GROUPS_NONE?(s="groupsnone",o=M.util.image_url("i/groupn","moodle")):i===this.GROUPS_SEPARATE?(s="groupsseparate",o=M.util.image_url("i/groups","moodle")):i===this.GROUPS_VISIBLE&&(s="groupsvisible",o=M.util.image_url("i/groupv","moodle")),u=M.util.get_string("clicktochangeinbrackets","moodle",M.util.get_string(s,"moodle")),c.setAttrs({src:o}),e.Lang.trim(n.getAttribute("title"))&&n.setAttribute("title",u).setData("action",s).setData("nextgroupmode",l),e.Lang.trim(c.getAttribute("alt"))&&c.setAttribute("alt",u),a={"class":"resource",field:"groupmode",value:i,id:e.Moodle.core_course.util.cm.getId(r)},f=this.add_spinner(r),this.send_request(a,f),this},edit_title:function(t,i,s){var o=e.Moodle.core_course.util.cm.getId(s),u=s.one(r.INSTANCENAME),a=s.one(r.ACTIVITYINSTANCE),f=u.get("firstChild"),l=f.get("data"),c=l,h,p=u.ancestor("a"),d={"class":"resource",field:"gettitle",id:o};return t.preventDefault(),this.send_request(d,null,function(t){M.core.actionmenu&&M.core.actionmenu.instance&&M.core.actionmenu.instance.hideMenu(),t.instancename&&(c=t.instancename);var i=e.Node.create('
          '),o=e.Node.create('').set("innerHTML",M.util.get_string("edittitleinstructions","moodle")),u=e.Node.create('').setAttrs({value:c,autocomplete:"off","aria-describedby":"id_editinstructions",maxLength:"255"});i.appendChild(s.one(r.ACTIVITYICON).cloneNode()),i.appendChild(u),i.setData("anchor",p),a.insert(o,"before"),p.replace(i);var f="left";right_to_left()&&(f="right"),s.addClass(n.EDITINGTITLE),u.focus().select(),h=u.on("blur",this.edit_title_cancel,this,s,!1),this.edittitleevents.push(h),h=u.on("key",this.edit_title_cancel,"esc",this,s,!0),this.edittitleevents.push(h),h=i.on("submit",this.edit_title_submit,this,s,l),this.edittitleevents.push(h)}),this},edit_title_submit:function(t,n,i){t.preventDefault();var s=e.Lang.trim(n.one(r.ACTIVITYFORM+" "+r.ACTIVITYTITLE).get("value"));this.edit_title_clear(n);var o=this.add_spinner(n);if(s!==null&&s!==""&&s!==i){var u={"class":"resource",field:"updatetitle",title:s,id:e.Moodle.core_course.util.cm.getId(n)};this.send_request(u,o,function(e){e.instancename&&n.one(r.INSTANCENAME).setContent(e.instancename)})}},edit_title_cancel:function(e,t,n){n&&e.preventDefault(),this.edit_title_clear(t)},edit_title_clear:function(t){(new e.EventHandle(this.edittitleevents)).detach();var i=t.one(r.ACTIVITYFORM),s=t.one("#id_editinstructions");i&&i.replace(i.getData("anchor")),s&&s.remove(),t.removeClass(n.EDITINGTITLE),e.later(100,this,function(){t.one(r.EDITTITLE).focus()})},set_visibility_resource_ui:function(e){var t=e.element,n=t.one(r.HIDE),i=!0,s=!1;n||(n=t.one(r.SHOW),i=!1,s=!0),typeof e.visible!="undefined"&&(s=e.visible);if(i!==s){var o="hide";s&&(o="show"),this.handle_resource_dim(n,t,o)}}},{NAME:"course-resource-toolbox",ATTRS:{}}),M.course.resource_toolbox=null,M.course.init_resource_toolbox=function(e){return M.course.resource_toolbox=new u(e),M.course.resource_toolbox};var a=function(){a.superclass.constructor.apply(this,arguments)};e.extend(a,o,{initializer:function(){M.course.coursebase.register_module(this),e.delegate("click",this.toggle_highlight,r.PAGECONTENT,r.SECTIONLI+" "+r.HIGHLIGHT,this),e.delegate("click",this.toggle_hide_section,r.PAGECONTENT,r.SECTIONLI+" "+r.SHOWHIDE,this)},toggle_hide_section:function(t){t.preventDefault();var i=t.target.ancestor(M.course.format.get_section_selector(e)),s=t.target.ancestor("a",!0),o=s.one("img"),u,a,f;i.hasClass(n.SECTIONHIDDENCLASS)?(i.removeClass(n.SECTIONHIDDENCLASS),u=1,a="show",f="hide"):(i.addClass(n.SECTIONHIDDENCLASS),u=0,a="hide",f="show");var l=M.util.get_string(f+"fromothers","format_"+this.get("format"));o.setAttrs({alt:l,src:M.util.image_url("i/"+f)}),s.set("title",l);var c={"class":"section",field:"visible",id:e.Moodle.core_course.util.section.getId(i.ancestor(M.course.format.get_section_wrapper(e),!0)),value:u},h=M.util.add_lightbox(e,i);h.show(),this.send_request(c,h,function(t){var n=i.all(r.ACTIVITYLI);n.each(function(n){var i;n.one(r.SHOW)?i=n.one(r.SHOW):i=n.one(r.HIDE);var s=e.Moodle.core_course.util.cm.getId(n);e.Array.indexOf(t.resourcestotoggle,""+s)!==-1&&M.course.resource_toolbox.handle_resource_dim(i,n,a)},this)})},toggle_highlight:function(t){t.preventDefault();var n=t.target.ancestor(M.course.format.get_section_selector(e)),i=t.target.ancestor("a",!0),s=i.one("img"),o=n.hasClass("current"),u=0,a=M.util.get_string("markthistopic","moodle");e.one(r.PAGECONTENT).all(M.course.format.get_section_selector(e)+".current "+r.HIGHLIGHT).set("title",a),e.one(r.PAGECONTENT).all(M.course.format.get_section_selector(e)+".current "+r.HIGHLIGHT+" img").set("alt",a).set("src",M.util.image_url("i/marker")),e.one(r.PAGECONTENT).all(M.course.format.get_section_selector(e)).removeClass("current");if(!o){n.addClass("current"),u=e.Moodle.core_course.util.section.getId(n.ancestor(M.course.format.get_section_wrapper(e),!0));var f=M.util.get_string("markedthistopic","moodle");i.set("title",f),s.set("alt",f).set("src",M.util.image_url("i/marked"))}var l={"class":"course",field:"marker",value:u},c=M.util.add_lightbox(e,n);c.show(),this.send_request(l,c)}},{NAME:"course-section-toolbox",ATTRS:{}}),M.course.init_section_toolbox=function(e){return new a(e)}},"@VERSION@",{requires:["node","base","event-key","node","io","moodle-course-coursebase","moodle-course-util"]}); +YUI.add("moodle-course-toolboxes",function(e,t){var n={ACTIVITYINSTANCE:"activityinstance",AVAILABILITYINFODIV:"div.availabilityinfo",CONTENTWITHOUTLINK:"contentwithoutlink",CONDITIONALHIDDEN:"conditionalhidden",DIMCLASS:"dimmed",DIMMEDTEXT:"dimmed_text",EDITINSTRUCTIONS:"editinstructions",EDITINGTITLE:"editor_displayed",HIDE:"hide",MODINDENTCOUNT:"mod-indent-",MODINDENTHUGE:"mod-indent-huge",MODULEIDPREFIX:"module-",SECTIONHIDDENCLASS:"hidden",SECTIONIDPREFIX:"section-",SHOW:"editing_show",TITLEEDITOR:"titleeditor"},r={ACTIONAREA:".actions",ACTIONLINKTEXT:".actionlinktext",ACTIVITYACTION:"a.cm-edit-action[data-action], a.editing_title",ACTIVITYFORM:"."+n.ACTIVITYINSTANCE+" form",ACTIVITYICON:"img.activityicon",ACTIVITYINSTANCE:"."+n.ACTIVITYINSTANCE,ACTIVITYLINK:"."+n.ACTIVITYINSTANCE+" > a",ACTIVITYLI:"li.activity",ACTIVITYTITLE:"input[name=title]",COMMANDSPAN:".commands",CONTENTAFTERLINK:"div.contentafterlink",CONTENTWITHOUTLINK:"div.contentwithoutlink",EDITTITLE:"a.editing_title",HIDE:"a.editing_hide",HIGHLIGHT:"a.editing_highlight",INSTANCENAME:"span.instancename",MODINDENTDIV:".mod-indent",MODINDENTOUTER:".mod-indent-outer",PAGECONTENT:"body",SECTIONLI:"li.section",SHOW:"a."+n.SHOW,SHOWHIDE:"a.editing_showhide"},i={MIN:0,MAX:16},s=e.one(document.body);M.course=M.course||{};var o=function(){o.superclass.constructor.apply(this,arguments)};e.extend(o,e.Base,{send_request:function(t,n,r,i){t||(t={});var s=this.get("config").pageparams,o;for(o in s)t[o]=s[o];t.sesskey=M.cfg.sesskey,t.courseId=this.get("courseid");var u=M.cfg.wwwroot+this.get("ajaxurl"),a=[],f={method:"POST",data:t,on:{success:function(t,i){try{a=e.JSON.parse(i.responseText),a.error&&new M.core.ajaxException(a)}catch(s){}r&&e.bind(r,this,a)(),n&&window.setTimeout(function(){n.hide()},400)},failure:function(e,t){n&&n.hide(),new M.core.ajaxException(t)}},context:this};if(i)for(o in i)f[o]=i[o];return n&&n.show(),e.io(u,f),this}},{NAME:"course-toolbox",ATTRS:{courseid:{value:0},format:{value:"topics"},ajaxurl:{value:null},config:{value:{}}}});var u=function(){u.superclass.constructor.apply(this,arguments)};e.extend(u,o,{GROUPS_NONE:0,GROUPS_SEPARATE:1,GROUPS_VISIBLE:2,edittitleevents:[],initializer:function(){M.course.coursebase.register_module(this),s.delegate("key",this.handle_data_action,"down:enter",r.ACTIVITYACTION,this),e.delegate("click",this.handle_data_action,s,r.ACTIVITYACTION,this)},handle_data_action:function(e){var t=e.target;t.test("a")||(t=t.ancestor(r.ACTIVITYACTION));var n=t.getData("action"),i=t.ancestor(r.ACTIVITYLI);if(!t.test("a")||!n||!i)return;switch(n){case"edittitle":this.edit_title(e,t,i,n);break;case"moveleft":case"moveright":this.change_indent(e,t,i,n);break;case"delete":this.delete_with_confirmation(e,t,i,n);break;case"duplicate":this.duplicate(e,t,i,n);break;case"hide":case"show":this.change_visibility(e,t,i,n);break;case"groupsseparate":case"groupsvisible":case"groupsnone":this.change_groupmode(e,t,i,n);break;case"move":case"update":case"duplicate":case"assignroles":break;default:}},add_spinner:function(t){var n=t.one(r.ACTIONAREA);return n?M.util.add_spinner(e,n):null},change_indent:function(t,s,o,u){t.preventDefault();var a=u==="moveleft"?-1:1,f=o.one(r.MODINDENTDIV),l=f.getAttribute("class").match(/mod-indent-(\d{1,})/),c=0,h;l&&(c=parseInt(l[1],10)),h=c+parseInt(a,10);if(hi.MAX)return;l&&f.removeClass(l[0]),f.addClass(n.MODINDENTCOUNT+h);var p={"class":"resource",field:"indent",value:h,id:e.Moodle.core_course.util.cm.getId(o)},d=this.add_spinner(o);this.send_request(p,d);var v;h===i.MIN?(s.addClass("hidden"),v=o.one(".editing_moveright")):h>i.MIN&&c===i.MIN&&s.ancestor(".menu").one("[data-action=moveleft]").removeClass("hidden"),h===i.MAX?(s.addClass("hidden"),v=o.one(".editing_moveleft")):h15&&!m?f.addClass(n.MODINDENTHUGE):h<=15&&m&&f.removeClass(n.MODINDENTHUGE),t.type&&t.type==="key"&&v&&v.focus()},delete_with_confirmation:function(t,n,r){t.preventDefault();var i=r,s="",o={type:M.util.get_string("pluginname",i.getAttribute("class").match(/modtype_([^\s]*)/)[1])};e.Moodle.core_course.util.cm.getName(i)!==null?(o.name=e.Moodle.core_course.util.cm.getName(i),s=M.util.get_string("deletechecktypename","moodle",o)):s=M.util.get_string("deletechecktype","moodle",o);var u=new M.core.confirm({question:s,modal:!0,visible:!1});return u.show(),u.on("complete-yes",function(){i.remove();var t={"class":"resource",action:"DELETE",id:e.Moodle.core_course.util.cm.getId(i)};this.send_request(t),M.core.actionmenu&&M.core.actionmenu.instance&&M.core.actionmenu.instance.hideMenu()},this),this},duplicate:function(t,n,r){t.preventDefault();var i=r,s=r.ancestor(M.course.format.get_section_selector(e)),o=M.util.add_lightbox(e,s).show(),u={"class":"resource",field:"duplicate",id:e.Moodle.core_course.util.cm.getId(i),sr:n.getData("sr")};return this.send_request(u,o,function(t){var n=e.Node.create(t.fullcontent);r.insert(n,"after"),e.use("moodle-course-coursebase",function(){M.course.coursebase.invoke_function("setup_for_resource",n)}),M.core.actionmenu&&M.core.actionmenu.newDOMNode&&M.core.actionmenu.newDOMNode(n)}),this},change_visibility:function(t,n,r,i){t.preventDefault();var s=r,o=this.handle_resource_dim(n,r,i),u={"class":"resource",field:"visible",value:o,id:e.Moodle.core_course.util.cm.getId(s)},a=this.add_spinner(s);return this.send_request(u,a),this},handle_resource_dim:function(t,i,s){var o=n.DIMCLASS,u=i.one([r.ACTIVITYLINK,r.CONTENTWITHOUTLINK].join(", ")),a=i.one(n.AVAILABILITYINFODIV),f=s==="hide"?"show":"hide",l=t.one("span"),c=M.util.get_string(f,"moodle"),h=t.one("img");return h.setAttrs({src:M.util.image_url("t/"+f)}),e.Lang.trim(t.getAttribute("title"))&&t.setAttribute("title",c),e.Lang.trim(h.getAttribute("alt"))&&h.setAttribute("alt",c),t.replaceClass("editing_"+s,"editing_"+f),t.setData("action",f),l&&l.set("text",c),i.one(r.CONTENTWITHOUTLINK)&&(u=i.one(r +.CONTENTWITHOUTLINK),o=n.DIMMEDTEXT),u.hasClass(n.CONDITIONALHIDDEN)||(s==="hide"?(u.addClass(o),i.all(r.CONTENTAFTERLINK).addClass(n.DIMMEDTEXT)):(u.removeClass(o),i.all(r.CONTENTAFTERLINK).removeClass(n.DIMMEDTEXT))),a&&a.toggleClass(n.HIDE),s==="hide"?0:1},change_groupmode:function(t,n,r){t.preventDefault();var i=parseInt(n.getData("nextgroupmode"),10),s="",o="",u,a,f,l=i+1,c=n.one("img");return l>2&&(l=0),i===this.GROUPS_NONE?(s="groupsnone",o=M.util.image_url("i/groupn","moodle")):i===this.GROUPS_SEPARATE?(s="groupsseparate",o=M.util.image_url("i/groups","moodle")):i===this.GROUPS_VISIBLE&&(s="groupsvisible",o=M.util.image_url("i/groupv","moodle")),u=M.util.get_string("clicktochangeinbrackets","moodle",M.util.get_string(s,"moodle")),c.setAttrs({src:o}),e.Lang.trim(n.getAttribute("title"))&&n.setAttribute("title",u).setData("action",s).setData("nextgroupmode",l),e.Lang.trim(c.getAttribute("alt"))&&c.setAttribute("alt",u),a={"class":"resource",field:"groupmode",value:i,id:e.Moodle.core_course.util.cm.getId(r)},f=this.add_spinner(r),this.send_request(a,f),this},edit_title:function(t,i,s){var o=e.Moodle.core_course.util.cm.getId(s),u=s.one(r.INSTANCENAME),a=s.one(r.ACTIVITYINSTANCE),f=u.get("firstChild"),l=f.get("data"),c=l,h,p=u.ancestor("a"),d={"class":"resource",field:"gettitle",id:o};return t.preventDefault(),this.send_request(d,null,function(t){M.core.actionmenu&&M.core.actionmenu.instance&&M.core.actionmenu.instance.hideMenu(),t.instancename&&(c=t.instancename);var i=e.Node.create(''),o=e.Node.create('').set("innerHTML",M.util.get_string("edittitleinstructions","moodle")),u=e.Node.create('').setAttrs({value:c,autocomplete:"off","aria-describedby":"id_editinstructions",maxLength:"255"});i.appendChild(s.one(r.ACTIVITYICON).cloneNode()),i.appendChild(u),i.setData("anchor",p),a.insert(o,"before"),p.replace(i);var f="left";window.right_to_left()&&(f="right"),s.addClass(n.EDITINGTITLE),u.focus().select(),h=u.on("blur",this.edit_title_cancel,this,s,!1),this.edittitleevents.push(h),h=u.on("key",this.edit_title_cancel,"esc",this,s,!0),this.edittitleevents.push(h),h=i.on("submit",this.edit_title_submit,this,s,l),this.edittitleevents.push(h)}),this},edit_title_submit:function(t,n,i){t.preventDefault();var s=e.Lang.trim(n.one(r.ACTIVITYFORM+" "+r.ACTIVITYTITLE).get("value"));this.edit_title_clear(n);var o=this.add_spinner(n);if(s!==null&&s!==""&&s!==i){var u={"class":"resource",field:"updatetitle",title:s,id:e.Moodle.core_course.util.cm.getId(n)};this.send_request(u,o,function(e){e.instancename&&n.one(r.INSTANCENAME).setContent(e.instancename)})}},edit_title_cancel:function(e,t,n){n&&e.preventDefault(),this.edit_title_clear(t)},edit_title_clear:function(t){(new e.EventHandle(this.edittitleevents)).detach();var i=t.one(r.ACTIVITYFORM),s=t.one("#id_editinstructions");i&&i.replace(i.getData("anchor")),s&&s.remove(),t.removeClass(n.EDITINGTITLE),e.later(100,this,function(){t.one(r.EDITTITLE).focus()})},set_visibility_resource_ui:function(e){var t=e.element,n=t.one(r.HIDE),i=!0,s=!1;n||(n=t.one(r.SHOW),i=!1,s=!0),typeof e.visible!="undefined"&&(s=e.visible);if(i!==s){var o="hide";s&&(o="show"),this.handle_resource_dim(n,t,o)}}},{NAME:"course-resource-toolbox",ATTRS:{}}),M.course.resource_toolbox=null,M.course.init_resource_toolbox=function(e){return M.course.resource_toolbox=new u(e),M.course.resource_toolbox};var a=function(){a.superclass.constructor.apply(this,arguments)};e.extend(a,o,{initializer:function(){M.course.coursebase.register_module(this),e.delegate("click",this.toggle_highlight,r.PAGECONTENT,r.SECTIONLI+" "+r.HIGHLIGHT,this),e.delegate("click",this.toggle_hide_section,r.PAGECONTENT,r.SECTIONLI+" "+r.SHOWHIDE,this)},toggle_hide_section:function(t){t.preventDefault();var i=t.target.ancestor(M.course.format.get_section_selector(e)),s=t.target.ancestor("a",!0),o=s.one("img"),u,a,f;i.hasClass(n.SECTIONHIDDENCLASS)?(i.removeClass(n.SECTIONHIDDENCLASS),u=1,a="show",f="hide"):(i.addClass(n.SECTIONHIDDENCLASS),u=0,a="hide",f="show");var l=M.util.get_string(f+"fromothers","format_"+this.get("format"));o.setAttrs({alt:l,src:M.util.image_url("i/"+f)}),s.set("title",l);var c={"class":"section",field:"visible",id:e.Moodle.core_course.util.section.getId(i.ancestor(M.course.format.get_section_wrapper(e),!0)),value:u},h=M.util.add_lightbox(e,i);h.show(),this.send_request(c,h,function(t){var n=i.all(r.ACTIVITYLI);n.each(function(n){var i;n.one(r.SHOW)?i=n.one(r.SHOW):i=n.one(r.HIDE);var s=e.Moodle.core_course.util.cm.getId(n);e.Array.indexOf(t.resourcestotoggle,""+s)!==-1&&M.course.resource_toolbox.handle_resource_dim(i,n,a)},this)})},toggle_highlight:function(t){t.preventDefault();var n=t.target.ancestor(M.course.format.get_section_selector(e)),i=t.target.ancestor("a",!0),s=i.one("img"),o=n.hasClass("current"),u=0,a=M.util.get_string("markthistopic","moodle");e.one(r.PAGECONTENT).all(M.course.format.get_section_selector(e)+".current "+r.HIGHLIGHT).set("title",a),e.one(r.PAGECONTENT).all(M.course.format.get_section_selector(e)+".current "+r.HIGHLIGHT+" img").set("alt",a).set("src",M.util.image_url("i/marker")),e.one(r.PAGECONTENT).all(M.course.format.get_section_selector(e)).removeClass("current");if(!o){n.addClass("current"),u=e.Moodle.core_course.util.section.getId(n.ancestor(M.course.format.get_section_wrapper(e),!0));var f=M.util.get_string("markedthistopic","moodle");i.set("title",f),s.set("alt",f).set("src",M.util.image_url("i/marked"))}var l={"class":"course",field:"marker",value:u},c=M.util.add_lightbox(e,n);c.show(),this.send_request(l,c)}},{NAME:"course-section-toolbox",ATTRS:{}}),M.course.init_section_toolbox=function(e){return new a(e)}},"@VERSION@",{requires:["node","base","event-key","node","io","moodle-course-coursebase","moodle-course-util"]}); diff --git a/course/yui/build/moodle-course-toolboxes/moodle-course-toolboxes.js b/course/yui/build/moodle-course-toolboxes/moodle-course-toolboxes.js index 9796fc375e2..66da159f2a3 100644 --- a/course/yui/build/moodle-course-toolboxes/moodle-course-toolboxes.js +++ b/course/yui/build/moodle-course-toolboxes/moodle-course-toolboxes.js @@ -343,7 +343,6 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, { case 'groupsvisible': case 'groupsnone': // The user is changing the group mode. - callback = 'change_groupmode'; this.change_groupmode(ev, node, activity, action); break; case 'move': @@ -773,7 +772,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, { // Force the editing instruction to match the mod-indent position. var padside = 'left'; - if (right_to_left()) { + if (window.right_to_left()) { padside = 'right'; } diff --git a/course/yui/src/categoryexpander/js/categoryexpander.js b/course/yui/src/categoryexpander/js/categoryexpander.js index b3c76f40174..a679c796088 100644 --- a/course/yui/src/categoryexpander/js/categoryexpander.js +++ b/course/yui/src/categoryexpander/js/categoryexpander.js @@ -192,6 +192,7 @@ NS._toggle_category_expansion = function(e) { * @param {Object} config */ NS._toggle_generic_expansion = function(config) { + var spinner; if (config.spinnerhandle) { // Add a spinner to give some feedback to the user. spinner = M.util.add_spinner(Y, config.parentnode.one(config.spinnerhandle)).show(); diff --git a/course/yui/src/dragdrop/js/resource.js b/course/yui/src/dragdrop/js/resource.js index d1ff0db7c46..14f9129d5fa 100644 --- a/course/yui/src/dragdrop/js/resource.js +++ b/course/yui/src/dragdrop/js/resource.js @@ -14,7 +14,8 @@ Y.extend(DRAGRESOURCE, M.core.dragdrop, { this.groups = ['resource']; this.samenodeclass = CSS.ACTIVITY; this.parentnodeclass = CSS.SECTION; - this.resourcedraghandle = this.get_drag_handle(M.util.get_string('movecoursemodule', 'moodle'), CSS.EDITINGMOVE, CSS.ICONCLASS, true); + this.resourcedraghandle = this.get_drag_handle(M.util.get_string('movecoursemodule', 'moodle'), + CSS.EDITINGMOVE, CSS.ICONCLASS, true); this.samenodelabel = { identifier: 'afterresource', diff --git a/course/yui/src/dragdrop/js/section.js b/course/yui/src/dragdrop/js/section.js index d1380306f1d..3799bb50883 100644 --- a/course/yui/src/dragdrop/js/section.js +++ b/course/yui/src/dragdrop/js/section.js @@ -95,9 +95,11 @@ Y.extend(DRAGSECTION, M.core.dragdrop, { // Get our drag object var drag = e.target; // Creat a dummy structure of the outer elemnents for clean styles application - var containernode = Y.Node.create('<' + M.course.format.get_containernode() + '>'); + var containernode = Y.Node.create('<' + M.course.format.get_containernode() + + '>'); containernode.addClass(M.course.format.get_containerclass()); - var sectionnode = Y.Node.create('<' + M.course.format.get_sectionwrappernode() + '>'); + var sectionnode = Y.Node.create('<' + M.course.format.get_sectionwrappernode() + + '>'); sectionnode.addClass( M.course.format.get_sectionwrapperclass()); sectionnode.setStyle('margin', 0); sectionnode.setContent(drag.get('node').get('innerHTML')); diff --git a/course/yui/src/management/js/category.js b/course/yui/src/management/js/category.js index 21a33bb8f26..b7fac22f31a 100644 --- a/course/yui/src/management/js/category.js +++ b/course/yui/src/management/js/category.js @@ -286,7 +286,8 @@ Category.prototype = { Y.log('Course was moved but the course listing could not be found to reflect this', 'warn', 'moodle-course-management'); return false; } - Y.log('Moved the course ('+course.getName()+') into this category ('+this.getName()+')', 'info', 'moodle-course-management'); + Y.log('Moved the course (' + course.getName() + ') into this category (' + this.getName() + ')', + 'debug', 'moodle-course-management'); this.highlight(); if (course) { if (outcome.paginationtotals) { diff --git a/course/yui/src/management/js/console.js b/course/yui/src/management/js/console.js index 8f195f8f248..0a00ab195f1 100644 --- a/course/yui/src/management/js/console.js +++ b/course/yui/src/management/js/console.js @@ -437,7 +437,7 @@ Console.prototype = { handleBulkSortByaction : function(e) { var sortcategoryby = this.get('categorylisting').one('#menuresortcategoriesby'), sortcourseby = this.get('categorylisting').one('#menuresortcoursesby'), - sortbybutton = this.get('categorylisting').one('input[name="bulksort"]'); + sortbybutton = this.get('categorylisting').one('input[name="bulksort"]'), sortby = e; if (!sortby) { @@ -565,7 +565,7 @@ Console.prototype = { complete : callback }, context : context, - data : build_querystring(args), + data : args, 'arguments' : args }); } diff --git a/course/yui/src/management/js/item.js b/course/yui/src/management/js/item.js index 97b75f2fa78..998baab0161 100644 --- a/course/yui/src/management/js/item.js +++ b/course/yui/src/management/js/item.js @@ -138,7 +138,8 @@ Item.prototype = { } else { // Aha it succeeded but this is the top item in the list. Pagination is in play! // Refresh to update the state of things. - Y.log(this.get('itemname')+' cannot be moved up as its the top item on this page.', 'info', 'moodle-course-management'); + Y.log(this.get('itemname') + ' cannot be moved up as its the top item on this page.', + 'info', 'moodle-course-management'); window.location.reload(); } }, @@ -206,7 +207,8 @@ Item.prototype = { } else { // Aha it succeeded but this is the bottom item in the list. Pagination is in play! // Refresh to update the state of things. - Y.log(this.get('itemname')+' cannot be moved down as its the top item on this page.', 'info', 'moodle-course-management'); + Y.log(this.get('itemname') + ' cannot be moved down as its the top item on this page.', + 'info', 'moodle-course-management'); window.location.reload(); } }, diff --git a/course/yui/src/toolboxes/js/resource.js b/course/yui/src/toolboxes/js/resource.js index c527178a221..11ed3f95658 100644 --- a/course/yui/src/toolboxes/js/resource.js +++ b/course/yui/src/toolboxes/js/resource.js @@ -139,7 +139,6 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, { case 'groupsvisible': case 'groupsnone': // The user is changing the group mode. - callback = 'change_groupmode'; this.change_groupmode(ev, node, activity, action); break; case 'move': @@ -569,7 +568,7 @@ Y.extend(RESOURCETOOLBOX, TOOLBOX, { // Force the editing instruction to match the mod-indent position. var padside = 'left'; - if (right_to_left()) { + if (window.right_to_left()) { padside = 'right'; } diff --git a/filter/glossary/yui/build/moodle-filter_glossary-autolinker/moodle-filter_glossary-autolinker-debug.js b/filter/glossary/yui/build/moodle-filter_glossary-autolinker/moodle-filter_glossary-autolinker-debug.js index 92b7fe50f2c..b317ae303bc 100644 --- a/filter/glossary/yui/build/moodle-filter_glossary-autolinker/moodle-filter_glossary-autolinker-debug.js +++ b/filter/glossary/yui/build/moodle-filter_glossary-autolinker/moodle-filter_glossary-autolinker-debug.js @@ -26,7 +26,9 @@ Y.extend(AUTOLINKER, Y.Base, { //display a progress indicator var title = '', - content = Y.Node.create('
          '), + content = Y.Node.create('
          ' + + '' + + '
          '), o = new Y.Overlay({ headerContent : title, bodyContent : content @@ -61,7 +63,8 @@ Y.extend(AUTOLINKER, Y.Base, { display_callback : function(content) { var data, key, - alertpanel; + alertpanel, + definition; try { data = Y.JSON.parse(content); if (data.success){ diff --git a/filter/glossary/yui/build/moodle-filter_glossary-autolinker/moodle-filter_glossary-autolinker-min.js b/filter/glossary/yui/build/moodle-filter_glossary-autolinker/moodle-filter_glossary-autolinker-min.js index a895bd0664e..0eae00d059a 100644 --- a/filter/glossary/yui/build/moodle-filter_glossary-autolinker/moodle-filter_glossary-autolinker-min.js +++ b/filter/glossary/yui/build/moodle-filter_glossary-autolinker/moodle-filter_glossary-autolinker-min.js @@ -1 +1 @@ -YUI.add("moodle-filter_glossary-autolinker",function(e,t){var n="Glossary filter autolinker",r="width",i="height",s="menubar",o="location",u="scrollbars",a="resizable",f="toolbar",l="status",c="directories",h="fullscreen",p="dependent",d;d=function(){d.superclass.constructor.apply(this,arguments)},e.extend(d,e.Base,{overlay:null,initializer:function(){var t=this;e.delegate("click",function(n){n.preventDefault();var r="",i=e.Node.create('
          '),s=new e.Overlay({headerContent:r,bodyContent:i}),o,u;t.overlay=s,s.render(e.one(document.body)),o=this.getAttribute("href").replace("showentry.php","showentry_ajax.php"),u={method:"get",context:t,on:{success:function(e,t){this.display_callback(t.responseText)},failure:function(e,t){var n=t.statusText;M.cfg.developerdebug&&(t.statusText+=" ("+o+")"),this.display_callback("bodyContent",n)}}},e.io(o,u)},e.one(document.body),"a.glossary.autolink.concept")},display_callback:function(t){var n,r,i;try{n=e.JSON.parse(t);if(n.success){this.overlay.hide();for(r in n.entries)definition=n.entries[r].definition+n.entries[r].attachments,i=new M.core.alert({title:n.entries[r].concept,message:definition,modal:!1,yesLabel:M.util.get_string("ok","moodle")}),i.show(),e.fire(M.core.event.FILTER_CONTENT_UPDATED,{nodes:new e.NodeList(i.get("boundingBox"))}),e.Node.one("#id_yuialertconfirm-"+i.get("COUNT")).focus();return!0}n.error&&new M.core.ajaxException(n)}catch(s){new M.core.exception(s)}return!1}},{NAME:n,ATTRS:{url:{validator:e.Lang.isString,value:M.cfg.wwwroot+"/mod/glossary/showentry.php"},name:{validator:e.Lang.isString,value:"glossaryconcept"},options:{getter:function(){return{width:this.get(r),height:this.get(i),menubar:this.get(s),location:this.get(o),scrollbars:this.get(u),resizable:this.get(a),toolbar:this.get(f),status:this.get(l),directories:this.get(c),fullscreen:this.get(h),dependent:this.get(p)}},readOnly:!0},width:{value:600},height:{value:450},menubar:{value:!1},location:{value:!1},scrollbars:{value:!0},resizable:{value:!0},toolbar:{value:!0},status:{value:!0},directories:{value:!1},fullscreen:{value:!1},dependent:{value:!0}}}),M.filter_glossary=M.filter_glossary||{},M.filter_glossary.init_filter_autolinking=function(e){return new d(e)}},"@VERSION@",{requires:["base","node","io-base","json-parse","event-delegate","overlay","moodle-core-event","moodle-core-notification-alert"]}); +YUI.add("moodle-filter_glossary-autolinker",function(e,t){var n="Glossary filter autolinker",r="width",i="height",s="menubar",o="location",u="scrollbars",a="resizable",f="toolbar",l="status",c="directories",h="fullscreen",p="dependent",d;d=function(){d.superclass.constructor.apply(this,arguments)},e.extend(d,e.Base,{overlay:null,initializer:function(){var t=this;e.delegate("click",function(n){n.preventDefault();var r="",i=e.Node.create('
          '+"
          "),s=new e.Overlay({headerContent:r,bodyContent:i}),o,u;t.overlay=s,s.render(e.one(document.body)),o=this.getAttribute("href").replace("showentry.php","showentry_ajax.php"),u={method:"get",context:t,on:{success:function(e,t){this.display_callback(t.responseText)},failure:function(e,t){var n=t.statusText;M.cfg.developerdebug&&(t.statusText+=" ("+o+")"),this.display_callback("bodyContent",n)}}},e.io(o,u)},e.one(document.body),"a.glossary.autolink.concept")},display_callback:function(t){var n,r,i,s;try{n=e.JSON.parse(t);if(n.success){this.overlay.hide();for(r in n.entries)s=n.entries[r].definition+n.entries[r].attachments,i=new M.core.alert({title:n.entries[r].concept,message:s,modal:!1,yesLabel:M.util.get_string("ok","moodle")}),i.show(),e.fire(M.core.event.FILTER_CONTENT_UPDATED,{nodes:new e.NodeList(i.get("boundingBox"))}),e.Node.one("#id_yuialertconfirm-"+i.get("COUNT")).focus();return!0}n.error&&new M.core.ajaxException(n)}catch(o){new M.core.exception(o)}return!1}},{NAME:n,ATTRS:{url:{validator:e.Lang.isString,value:M.cfg.wwwroot+"/mod/glossary/showentry.php"},name:{validator:e.Lang.isString,value:"glossaryconcept"},options:{getter:function(){return{width:this.get(r),height:this.get(i),menubar:this.get(s),location:this.get(o),scrollbars:this.get(u),resizable:this.get(a),toolbar:this.get(f),status:this.get(l),directories:this.get(c),fullscreen:this.get(h),dependent:this.get(p)}},readOnly:!0},width:{value:600},height:{value:450},menubar:{value:!1},location:{value:!1},scrollbars:{value:!0},resizable:{value:!0},toolbar:{value:!0},status:{value:!0},directories:{value:!1},fullscreen:{value:!1},dependent:{value:!0}}}),M.filter_glossary=M.filter_glossary||{},M.filter_glossary.init_filter_autolinking=function(e){return new d(e)}},"@VERSION@",{requires:["base","node","io-base","json-parse","event-delegate","overlay","moodle-core-event","moodle-core-notification-alert"]}); diff --git a/filter/glossary/yui/build/moodle-filter_glossary-autolinker/moodle-filter_glossary-autolinker.js b/filter/glossary/yui/build/moodle-filter_glossary-autolinker/moodle-filter_glossary-autolinker.js index 92b7fe50f2c..b317ae303bc 100644 --- a/filter/glossary/yui/build/moodle-filter_glossary-autolinker/moodle-filter_glossary-autolinker.js +++ b/filter/glossary/yui/build/moodle-filter_glossary-autolinker/moodle-filter_glossary-autolinker.js @@ -26,7 +26,9 @@ Y.extend(AUTOLINKER, Y.Base, { //display a progress indicator var title = '', - content = Y.Node.create('
          '), + content = Y.Node.create('
          ' + + '' + + '
          '), o = new Y.Overlay({ headerContent : title, bodyContent : content @@ -61,7 +63,8 @@ Y.extend(AUTOLINKER, Y.Base, { display_callback : function(content) { var data, key, - alertpanel; + alertpanel, + definition; try { data = Y.JSON.parse(content); if (data.success){ diff --git a/filter/glossary/yui/src/autolinker/js/autolinker.js b/filter/glossary/yui/src/autolinker/js/autolinker.js index 8879603b88c..322bdce7439 100644 --- a/filter/glossary/yui/src/autolinker/js/autolinker.js +++ b/filter/glossary/yui/src/autolinker/js/autolinker.js @@ -24,7 +24,9 @@ Y.extend(AUTOLINKER, Y.Base, { //display a progress indicator var title = '', - content = Y.Node.create('
          '), + content = Y.Node.create('
          ' + + '' + + '
          '), o = new Y.Overlay({ headerContent : title, bodyContent : content @@ -59,7 +61,8 @@ Y.extend(AUTOLINKER, Y.Base, { display_callback : function(content) { var data, key, - alertpanel; + alertpanel, + definition; try { data = Y.JSON.parse(content); if (data.success){ diff --git a/filter/mathjaxloader/yui/build/moodle-filter_mathjaxloader-loader/moodle-filter_mathjaxloader-loader-debug.js b/filter/mathjaxloader/yui/build/moodle-filter_mathjaxloader-loader/moodle-filter_mathjaxloader-loader-debug.js index 1ab45afb087..11b4a9de0fa 100644 --- a/filter/mathjaxloader/yui/build/moodle-filter_mathjaxloader-loader/moodle-filter_mathjaxloader-loader-debug.js +++ b/filter/mathjaxloader/yui/build/moodle-filter_mathjaxloader-loader/moodle-filter_mathjaxloader-loader-debug.js @@ -76,11 +76,11 @@ M.filter_mathjaxloader = M.filter_mathjaxloader || { _setLocale: function() { if (!this._configured) { var lang = this._lang; - if (typeof MathJax !== "undefined") { - MathJax.Hub.Queue(function () { - MathJax.Localization.setLocale(lang); + if (typeof window.MathJax !== "undefined") { + window.MathJax.Hub.Queue(function () { + window.MathJax.Localization.setLocale(lang); }); - MathJax.Hub.Configured(); + window.MathJax.Hub.Configured(); this._configured = true; } } @@ -97,8 +97,8 @@ M.filter_mathjaxloader = M.filter_mathjaxloader || { Y.use('mathjax', function() { self._setLocale(); Y.all('.filter_mathjaxloader_equation').each(function(node) { - if (typeof MathJax !== "undefined") { - MathJax.Hub.Queue(["Typeset", MathJax.Hub, node.getDOMNode()]); + if (typeof window.MathJax !== "undefined") { + window.MathJax.Hub.Queue(["Typeset", window.MathJax.Hub, node.getDOMNode()]); } }); }); @@ -116,8 +116,8 @@ M.filter_mathjaxloader = M.filter_mathjaxloader || { self._setLocale(); event.nodes.each(function (node) { node.all('.filter_mathjaxloader_equation').each(function(node) { - if (typeof MathJax !== "undefined") { - MathJax.Hub.Queue(["Typeset", MathJax.Hub, node.getDOMNode()]); + if (typeof window.MathJax !== "undefined") { + window.MathJax.Hub.Queue(["Typeset", window.MathJax.Hub, node.getDOMNode()]); } }); }); diff --git a/filter/mathjaxloader/yui/build/moodle-filter_mathjaxloader-loader/moodle-filter_mathjaxloader-loader-min.js b/filter/mathjaxloader/yui/build/moodle-filter_mathjaxloader-loader/moodle-filter_mathjaxloader-loader-min.js index b125c401128..ccebf0c665d 100644 --- a/filter/mathjaxloader/yui/build/moodle-filter_mathjaxloader-loader/moodle-filter_mathjaxloader-loader-min.js +++ b/filter/mathjaxloader/yui/build/moodle-filter_mathjaxloader-loader/moodle-filter_mathjaxloader-loader-min.js @@ -1 +1 @@ -YUI.add("moodle-filter_mathjaxloader-loader",function(e,t){M.filter_mathjaxloader=M.filter_mathjaxloader||{_lang:"",_configured:!1,configure:function(t){var n=document.createElement("script");n.type="text/x-mathjax-config",n[window.opera?"innerHTML":"text"]=t.mathjaxconfig,document.getElementsByTagName("head")[0].appendChild(n),this._lang=t.lang,e.on(M.core.event.FILTER_CONTENT_UPDATED,this.contentUpdated,this)},_setLocale:function(){if(!this._configured){var e=this._lang;typeof MathJax!="undefined"&&(MathJax.Hub.Queue(function(){MathJax.Localization.setLocale(e)}),MathJax.Hub.Configured(),this._configured=!0)}},typeset:function(){if(!this._configured){var t=this;e.use("mathjax",function(){t._setLocale(),e.all(".filter_mathjaxloader_equation").each(function(e){typeof MathJax!="undefined"&&MathJax.Hub.Queue(["Typeset",MathJax.Hub,e.getDOMNode()])})})}},contentUpdated:function(t){var n=this;e.use("mathjax",function(){n._setLocale(),t.nodes.each(function(e){e.all(".filter_mathjaxloader_equation").each(function(e){typeof MathJax!="undefined"&&MathJax.Hub.Queue(["Typeset",MathJax.Hub,e.getDOMNode()])})})})}}},"@VERSION@",{requires:["moodle-core-event"]}); +YUI.add("moodle-filter_mathjaxloader-loader",function(e,t){M.filter_mathjaxloader=M.filter_mathjaxloader||{_lang:"",_configured:!1,configure:function(t){var n=document.createElement("script");n.type="text/x-mathjax-config",n[window.opera?"innerHTML":"text"]=t.mathjaxconfig,document.getElementsByTagName("head")[0].appendChild(n),this._lang=t.lang,e.on(M.core.event.FILTER_CONTENT_UPDATED,this.contentUpdated,this)},_setLocale:function(){if(!this._configured){var e=this._lang;typeof window.MathJax!="undefined"&&(window.MathJax.Hub.Queue(function(){window.MathJax.Localization.setLocale(e)}),window.MathJax.Hub.Configured(),this._configured=!0)}},typeset:function(){if(!this._configured){var t=this;e.use("mathjax",function(){t._setLocale(),e.all(".filter_mathjaxloader_equation").each(function(e){typeof window.MathJax!="undefined"&&window.MathJax.Hub.Queue(["Typeset",window.MathJax.Hub,e.getDOMNode()])})})}},contentUpdated:function(t){var n=this;e.use("mathjax",function(){n._setLocale(),t.nodes.each(function(e){e.all(".filter_mathjaxloader_equation").each(function(e){typeof window.MathJax!="undefined"&&window.MathJax.Hub.Queue(["Typeset",window.MathJax.Hub,e.getDOMNode()])})})})}}},"@VERSION@",{requires:["moodle-core-event"]}); diff --git a/filter/mathjaxloader/yui/build/moodle-filter_mathjaxloader-loader/moodle-filter_mathjaxloader-loader.js b/filter/mathjaxloader/yui/build/moodle-filter_mathjaxloader-loader/moodle-filter_mathjaxloader-loader.js index 1ab45afb087..11b4a9de0fa 100644 --- a/filter/mathjaxloader/yui/build/moodle-filter_mathjaxloader-loader/moodle-filter_mathjaxloader-loader.js +++ b/filter/mathjaxloader/yui/build/moodle-filter_mathjaxloader-loader/moodle-filter_mathjaxloader-loader.js @@ -76,11 +76,11 @@ M.filter_mathjaxloader = M.filter_mathjaxloader || { _setLocale: function() { if (!this._configured) { var lang = this._lang; - if (typeof MathJax !== "undefined") { - MathJax.Hub.Queue(function () { - MathJax.Localization.setLocale(lang); + if (typeof window.MathJax !== "undefined") { + window.MathJax.Hub.Queue(function () { + window.MathJax.Localization.setLocale(lang); }); - MathJax.Hub.Configured(); + window.MathJax.Hub.Configured(); this._configured = true; } } @@ -97,8 +97,8 @@ M.filter_mathjaxloader = M.filter_mathjaxloader || { Y.use('mathjax', function() { self._setLocale(); Y.all('.filter_mathjaxloader_equation').each(function(node) { - if (typeof MathJax !== "undefined") { - MathJax.Hub.Queue(["Typeset", MathJax.Hub, node.getDOMNode()]); + if (typeof window.MathJax !== "undefined") { + window.MathJax.Hub.Queue(["Typeset", window.MathJax.Hub, node.getDOMNode()]); } }); }); @@ -116,8 +116,8 @@ M.filter_mathjaxloader = M.filter_mathjaxloader || { self._setLocale(); event.nodes.each(function (node) { node.all('.filter_mathjaxloader_equation').each(function(node) { - if (typeof MathJax !== "undefined") { - MathJax.Hub.Queue(["Typeset", MathJax.Hub, node.getDOMNode()]); + if (typeof window.MathJax !== "undefined") { + window.MathJax.Hub.Queue(["Typeset", window.MathJax.Hub, node.getDOMNode()]); } }); }); diff --git a/filter/mathjaxloader/yui/src/loader/js/loader.js b/filter/mathjaxloader/yui/src/loader/js/loader.js index 0181304253b..aad01b32f58 100644 --- a/filter/mathjaxloader/yui/src/loader/js/loader.js +++ b/filter/mathjaxloader/yui/src/loader/js/loader.js @@ -74,11 +74,11 @@ M.filter_mathjaxloader = M.filter_mathjaxloader || { _setLocale: function() { if (!this._configured) { var lang = this._lang; - if (typeof MathJax !== "undefined") { - MathJax.Hub.Queue(function () { - MathJax.Localization.setLocale(lang); + if (typeof window.MathJax !== "undefined") { + window.MathJax.Hub.Queue(function () { + window.MathJax.Localization.setLocale(lang); }); - MathJax.Hub.Configured(); + window.MathJax.Hub.Configured(); this._configured = true; } } @@ -95,8 +95,8 @@ M.filter_mathjaxloader = M.filter_mathjaxloader || { Y.use('mathjax', function() { self._setLocale(); Y.all('.filter_mathjaxloader_equation').each(function(node) { - if (typeof MathJax !== "undefined") { - MathJax.Hub.Queue(["Typeset", MathJax.Hub, node.getDOMNode()]); + if (typeof window.MathJax !== "undefined") { + window.MathJax.Hub.Queue(["Typeset", window.MathJax.Hub, node.getDOMNode()]); } }); }); @@ -114,8 +114,8 @@ M.filter_mathjaxloader = M.filter_mathjaxloader || { self._setLocale(); event.nodes.each(function (node) { node.all('.filter_mathjaxloader_equation').each(function(node) { - if (typeof MathJax !== "undefined") { - MathJax.Hub.Queue(["Typeset", MathJax.Hub, node.getDOMNode()]); + if (typeof window.MathJax !== "undefined") { + window.MathJax.Hub.Queue(["Typeset", window.MathJax.Hub, node.getDOMNode()]); } }); }); diff --git a/grade/report/grader/yui/build/moodle-gradereport_grader-gradereporttable/moodle-gradereport_grader-gradereporttable-debug.js b/grade/report/grader/yui/build/moodle-gradereport_grader-gradereporttable/moodle-gradereport_grader-gradereporttable-debug.js index 45a4d9502de..e8f4481b579 100644 --- a/grade/report/grader/yui/build/moodle-gradereport_grader-gradereporttable/moodle-gradereport_grader-gradereporttable-debug.js +++ b/grade/report/grader/yui/build/moodle-gradereport_grader-gradereporttable/moodle-gradereport_grader-gradereporttable-debug.js @@ -660,7 +660,8 @@ FloatingHeaders.prototype = { this.headerCell = Y.one(SELECTORS.STUDENTHEADER); // Create the floating row and cell. - var floatingUserHeaderRow = Y.Node.create(''), + var floatingUserHeaderRow = Y.Node.create(''), floatingUserHeaderCell = Y.Node.create('
          '), nodepos = this._getRelativeXY(this.headerCell)[0], coordinates = this._getRelativeXY(this.headerRow), @@ -922,7 +923,7 @@ FloatingHeaders.prototype = { } // User column position. - if (right_to_left()) { + if (window.right_to_left()) { floatingUserTriggerPoint = Y.config.win.innerWidth + Y.config.win.pageXOffset - this.dockWidth; floatingUserRelativePoint = floatingUserTriggerPoint - this.firstUserCellWidth; userFloats = floatingUserTriggerPoint < (this.firstUserCellLeft + this.firstUserCellWidth); diff --git a/grade/report/grader/yui/build/moodle-gradereport_grader-gradereporttable/moodle-gradereport_grader-gradereporttable-min.js b/grade/report/grader/yui/build/moodle-gradereport_grader-gradereporttable/moodle-gradereport_grader-gradereporttable-min.js index 05c85d426b7..f8ada66d3e4 100644 --- a/grade/report/grader/yui/build/moodle-gradereport_grader-gradereporttable/moodle-gradereport_grader-gradereporttable-min.js +++ b/grade/report/grader/yui/build/moodle-gradereport_grader-gradereporttable/moodle-gradereport_grader-gradereporttable-min.js @@ -1,2 +1,2 @@ YUI.add("moodle-gradereport_grader-gradereporttable",function(e,t){function i(){i.superclass.constructor.apply(this,arguments)}function l(){}var n={FOOTERTITLE:".avg .header",FOOTERCELLS:"#user-grades .avg .cell",FOOTERROW:"#user-grades .avg",GRADECELL:"td.grade",GRADERTABLE:".gradeparent table",GRADEPARENT:".gradeparent",HEADERCELLS:"#user-grades .heading .cell",HEADERCELL:".gradebook-header-cell",HEADERROW:"#user-grades tr.heading",STUDENTHEADER:"#studentheader",USERCELL:"#user-grades .user.cell",USERMAIL:"#user-grades .useremail"},r={OVERRIDDEN:"overridden",TOOLTIPACTIVE:"tooltipactive"};e.extend(i,e.Base,{_eventHandles:[],graderTable:null,initializer:function(){this.graderRegion=e.one(n.GRADEPARENT),this.graderTable=e.one(n.GRADERTABLE),this.setupFloatingHeaders()},getGradeUserName:function(e){var t=e.ancestor("tr"),n=t.one("th.user .username");return n?n.get("text"):""},getGradeItemName:function(t){var n=e.one("th.item[data-itemid='"+t.getData("itemid")+"']");return n?n.get("text"):""},getGradeFeedback:function(e){return e.getData("feedback")}}),e.namespace("M.gradereport_grader").ReportTable=i,e.namespace("M.gradereport_grader").init=function(t){return new e.M.gradereport_grader.ReportTable(t)};var s="height",o="width",u="offsetWidth",a="offsetHeight",f="moodle-core-grade-report-grader";r.FLOATING="floating",l.ATTRS={},l.prototype={pageHeaderHeight:0,container:null,headerCell:null,headerRow:null,firstUserCell:null,firstNonUserCell:null,firstNonUserCellLeft:0,firstNonUserCellWidth:0,tableFooterRow:null,footerRow:null,gradeItemHeadingContainer:null,userColumnHeader:null,userColumn:null,firstUserCellBottom:0,firstUserCellLeft:0,firstUserCellWidth:0,dockWidth:0,lastUserCellTop:0,floatingHeaderRow:null,_eventHandles:[],setupFloatingHeaders:function(){return this.firstUserCell=e.one(n.USERCELL),this.container=e.one(n.GRADEPARENT),this.firstNonUserCell=e.one(n.GRADECELL),this.firstUserCell?(this._setupFloatingUserColumn(),this._setupFloatingUserHeader(),this._setupFloatingAssignmentHeaders(),this._setupFloatingAssignmentFooter(),this.floatingHeaderRow={},this._setupFloatingLeftHeaders(".controls .controls"),this._setupFloatingLeftHeaders(".range .range"),this._setupFloatingLeftHeaders(n.FOOTERTITLE),this._setupFloatingAssignmentFooterTitle(),this._calculateCellPositions(),this._handleScrollEvent(),this._setupEventHandlers(),e.Global.on("moodle-gradereport_grader:resized",this._handleResizeEvent,this),this):this},_calculateCellPositions:function(){this.headerRowTop=this.headerRow.getY(),this.tableFooterRow&&(this.footerRowPosition=this.tableFooterRow.getY()),this.dockWidth=0;var t=e.one(".has_dock #dock");t&&(this.dockWidth=t.get(u));var r=e.all(n.USERCELL);this.firstUserCellLeft=this.firstUserCell.getX(),this.firstUserCellWidth=this.firstUserCell.get(u),this.firstNonUserCellLeft=this.firstNonUserCell.getX(),this.firstNonUserCellWidth=this.firstNonUserCell.get(u);if(r.size()>1){var i=r.item(1);this.firstUserCellBottom=i.getY()+parseInt(i.getComputedStyle(s),10),this.lastUserCellTop=r.item(r.size()-2).getY()}else{var o=r.item(0);this.lastUserCellTop=o.getY(),this.tableFooterRow?this.firstUserCellBottom=this.footerRowPosition+parseInt(this.tableFooterRow.getComputedStyle(s),10):this.firstUserCellBottom=o.getY()+o.get("offsetHeight")}var f=e.one("header");this.pageHeaderHeight=0;if(f)if(f.getComputedStyle("position")==="fixed")this.pageHeaderHeight=f.get(a);else{var l=e.one(".navbar");l&&l.getComputedStyle("position")==="fixed"&&(this.pageHeaderHeight=l.get(a))}},_getRelativeXY:function(e){return this._getRelativeXYFromXY(e.getX(),e.getY())},_getRelativeXYFromXY:function(e,t){var n=this.container.getXY();return[e-n[0],t-n[1]]},_getRelativeXFromX:function(e){return this._getRelativeXYFromXY(e,0)[0]},_getRelativeYFromY:function(e){return this._getRelativeXYFromXY(0,e)[1]},_getScrollBarHeight:function(){return e.UA.ie&&e.UA.ie>=10?0:e.config.doc.body.scrollWidth>e.config.doc.body.clientWidth?e.DOM.getScrollbarWidth():0},_setupEventHandlers:function(){this._eventHandles.push(e.one(e.config.win).on("scroll",this._handleScrollEvent,this),e.one(e.config.win).on("resize",this._handleResizeEvent,this),e.one(e.config.win).on("orientationchange",this._handleResizeEvent,this),e.Global.on("dock:shown",this._handleResizeEvent,this),e.Global.on("dock:hidden",this._handleResizeEvent,this))},_setupFloatingUserColumn:function(){var t=e.all(n.USERCELL),r=e.Node.create(''),i=this._getRelativeXY(this.firstUserCell);t.each(function(t){var n=e.Node.create("
          ");n.set("innerHTML",t.get("innerHTML")).setAttribute("class",t.getAttribute("class")).setAttribute("data-uid",t.ancestor("tr").getData("uid")).setStyles({height:t.getComputedStyle(s),width:t.getComputedStyle(o)}),r.appendChild(n)},this),r.setStyles({left:i[0]+"px",position:"absolute",top:i[1]+"px"}),this.graderRegion.append(r),this.userColumn=r},_setupFloatingUserHeader:function(){this.headerRow=e.one(n.HEADERROW),this.headerCell=e.one(n.STUDENTHEADER);var t=e.Node.create(''),r=e.Node.create("
          "),i=this._getRelativeXY(this.headerCell)[0],s=this._getRelativeXY(this.headerRow),u=s[0];r.set("innerHTML",this.headerCell.getHTML()).setAttribute("class",this.headerCell.getAttribute("class")).setStyles({width:this.firstUserCell.getComputedStyle(o),left:i-u+"px"}),t.setStyles({left:s[0]+"px",position:"absolute",top:s[1]+"px"}),t.append(r),this.graderRegion.append(t),this.userColumnHeader=t},_setupFloatingAssignmentHeaders:function(){this.headerRow=e.one("#user-grades tr.heading");var t=e.all("#user-grades tr.heading .cell"),n=e.Node.create(''),r=this._getRelativeXY(this.headerRow),i=0,f=0,l=r[0];t.each(function(t){var r=this._getRelativeXY(t)[0],c=e.Node.create("
          ");c.append(t.getHTML()).setAttribute("class",t.getAttribute -("class")).setData("itemid",t.getData("itemid")).setStyles({height:t.getComputedStyle(s),left:r-l+"px",position:"absolute",width:t.getComputedStyle(o)}),i+=parseInt(t.get(u),10),f=t.get(a),n.appendChild(c)},this),n.setStyles({height:f+"px",left:r[0]+"px",position:"absolute",top:r[1]+"px",width:i+"px"}),this.userColumnHeader.insert(n,"before"),this.gradeItemHeadingContainer=n},_setupFloatingAssignmentFooter:function(){this.tableFooterRow=e.one("#user-grades .avg");if(!this.tableFooterRow)return;var t=this.tableFooterRow.all(".cell"),n=e.Node.create(''),r=0,i=this._getRelativeXY(this.tableFooterRow),f=i[0],l=0;t.each(function(t){var i=e.Node.create("
          "),c=this._getRelativeXY(t)[0];i.set("innerHTML",t.getHTML()).setAttribute("class",t.getAttribute("class")).setStyles({height:t.getComputedStyle(s),left:c-f+"px",position:"absolute",width:t.getComputedStyle(o)}),n.append(i),l=t.get(a),r+=parseInt(t.get(u),10)},this),n.setStyles({position:"absolute",left:i[0]+"px",bottom:"1px",height:l+"px",width:r+"px"}),this.graderRegion.append(n),this.footerRow=n},_setupFloatingAssignmentFooterTitle:function(){var e=this.floatingHeaderRow[n.FOOTERTITLE];e&&e.setStyles({bottom:"1px"})},_setupFloatingLeftHeaders:function(t){var n=e.one(t);if(!n)return;var r=e.Node.create(''),i=e.Node.create("
          "),s=this._getRelativeXY(n),u=this.firstUserCell.getComputedStyle(o),f=n.get(a);i.set("innerHTML",n.getHTML()).setAttribute("class",n.getAttribute("class")).setStyles({width:u}),r.setStyles({position:"absolute",top:s[1]+"px",left:s[0]+"px",height:f+"px"}).addClass(n.get("parentNode").get("className")),r.append(i),this.graderRegion.append(r),this.floatingHeaderRow[t]=r},_handleScrollEvent:function(){var t={},i={},o={},u={},a=0,f=0,l=0,c=!1,h=!1,p=!1,d=!1,v={},m={},g=!1;t.left=this._getRelativeXFromX(this.headerRow.getX()),e.config.win.pageYOffset+this.pageHeaderHeight>this.headerRowTop?(c=!0,e.config.win.pageYOffset+this.pageHeaderHeightthis.firstUserCellLeft,d=f>this.firstNonUserCellLeft-this.firstUserCellWidth),h?(a=this._getRelativeXFromX(l),o.left=a+"px",i.left=a+"px"):(a=this._getRelativeXFromX(this.firstUserCellLeft),o.left=a+"px",i.left=a+"px"),e.Object.each(this.floatingHeaderRow,function(e,t){v[t]={left:o.left}},this);if(this.footerRow){u.left=this._getRelativeXFromX(this.headerRow.getX());var y=e.config.win.innerHeight,b=e.config.win.pageYOffset,w=y-this._getScrollBarHeight()+b,E=parseInt(this.footerRow.getComputedStyle(s),10),S=E+this.footerRowPosition;m=v[n.FOOTERTITLE],g=this.floatingHeaderRow[n.FOOTERTITLE],wthis.firstUserCellBottom?(u.bottom=Math.ceil(S-w)+"px",p=!0):(u.bottom="1px",p=!1),m&&(m.bottom=u.bottom,m.top=null),v[n.FOOTERTITLE]=m}this.gradeItemHeadingContainer&&(this.gradeItemHeadingContainer.setStyles(t),c?this.gradeItemHeadingContainer.addClass(r.FLOATING):this.gradeItemHeadingContainer.removeClass(r.FLOATING)),this.userColumnHeader&&(this.userColumnHeader.setStyles(i),h?this.userColumnHeader.addClass(r.FLOATING):this.userColumnHeader.removeClass(r.FLOATING)),this.userColumn&&(this.userColumn.setStyles(o),h?this.userColumn.addClass(r.FLOATING):this.userColumn.removeClass(r.FLOATING)),this.footerRow&&(this.footerRow.setStyles(u),p?this.footerRow.addClass(r.FLOATING):this.footerRow.removeClass(r.FLOATING)),e.Object.each(v,function(e,t){this.floatingHeaderRow[t]&&this.floatingHeaderRow[t].setStyles(e)},this),e.Object.each(this.floatingHeaderRow,function(e,t){this.floatingHeaderRow[t]&&(d?this.floatingHeaderRow[t].addClass(r.FLOATING):this.floatingHeaderRow[t].removeClass(r.FLOATING))},this),g&&(d?g.addClass(r.FLOATING):g.removeClass(r.FLOATING))},_handleResizeEvent:function(){this._calculateCellPositions(),this._handleScrollEvent();var t=this.firstUserCell.getComputedStyle(o),r=e.all(n.USERCELL);this.userColumnHeader.one(".cell").setStyle("width",t),this.userColumn.all(".cell").each(function(e,n){e.setStyles({width:t,height:r.item(n).getComputedStyle(s)})},this);var i=this.gradeItemHeadingContainer.all(".cell"),a=e.all(n.HEADERCELLS),f=this.headerRow.getX(),l=0;a.each(function(e,t){var n=i.item(t);l+=e.get(u);var r={width:e.getComputedStyle(o),left:e.getX()-f+"px"};n.setStyles(r)});if(this.footerRow){var c=this.footerRow.all(".cell");if(c.size()!==0){var h=e.all(n.FOOTERCELLS);h.each(function(e,t){var n=c.item(t),r={width:e.getComputedStyle(o),left:e.getX()-f+"px"};n.setStyles(r)})}}e.Object.each(this.floatingHeaderRow,function(e){e.one("div").setStyle("width",t)},this),this.gradeItemHeadingContainer.setStyle("width",l)}},e.Base.mix(e.M.gradereport_grader.ReportTable,[l])},"@VERSION@",{requires:["base","node","event","handlebars","overlay","event-hover"]}); +("class")).setData("itemid",t.getData("itemid")).setStyles({height:t.getComputedStyle(s),left:r-l+"px",position:"absolute",width:t.getComputedStyle(o)}),i+=parseInt(t.get(u),10),f=t.get(a),n.appendChild(c)},this),n.setStyles({height:f+"px",left:r[0]+"px",position:"absolute",top:r[1]+"px",width:i+"px"}),this.userColumnHeader.insert(n,"before"),this.gradeItemHeadingContainer=n},_setupFloatingAssignmentFooter:function(){this.tableFooterRow=e.one("#user-grades .avg");if(!this.tableFooterRow)return;var t=this.tableFooterRow.all(".cell"),n=e.Node.create(''),r=0,i=this._getRelativeXY(this.tableFooterRow),f=i[0],l=0;t.each(function(t){var i=e.Node.create("
          "),c=this._getRelativeXY(t)[0];i.set("innerHTML",t.getHTML()).setAttribute("class",t.getAttribute("class")).setStyles({height:t.getComputedStyle(s),left:c-f+"px",position:"absolute",width:t.getComputedStyle(o)}),n.append(i),l=t.get(a),r+=parseInt(t.get(u),10)},this),n.setStyles({position:"absolute",left:i[0]+"px",bottom:"1px",height:l+"px",width:r+"px"}),this.graderRegion.append(n),this.footerRow=n},_setupFloatingAssignmentFooterTitle:function(){var e=this.floatingHeaderRow[n.FOOTERTITLE];e&&e.setStyles({bottom:"1px"})},_setupFloatingLeftHeaders:function(t){var n=e.one(t);if(!n)return;var r=e.Node.create(''),i=e.Node.create("
          "),s=this._getRelativeXY(n),u=this.firstUserCell.getComputedStyle(o),f=n.get(a);i.set("innerHTML",n.getHTML()).setAttribute("class",n.getAttribute("class")).setStyles({width:u}),r.setStyles({position:"absolute",top:s[1]+"px",left:s[0]+"px",height:f+"px"}).addClass(n.get("parentNode").get("className")),r.append(i),this.graderRegion.append(r),this.floatingHeaderRow[t]=r},_handleScrollEvent:function(){var t={},i={},o={},u={},a=0,f=0,l=0,c=!1,h=!1,p=!1,d=!1,v={},m={},g=!1;t.left=this._getRelativeXFromX(this.headerRow.getX()),e.config.win.pageYOffset+this.pageHeaderHeight>this.headerRowTop?(c=!0,e.config.win.pageYOffset+this.pageHeaderHeightthis.firstUserCellLeft,d=f>this.firstNonUserCellLeft-this.firstUserCellWidth),h?(a=this._getRelativeXFromX(l),o.left=a+"px",i.left=a+"px"):(a=this._getRelativeXFromX(this.firstUserCellLeft),o.left=a+"px",i.left=a+"px"),e.Object.each(this.floatingHeaderRow,function(e,t){v[t]={left:o.left}},this);if(this.footerRow){u.left=this._getRelativeXFromX(this.headerRow.getX());var y=e.config.win.innerHeight,b=e.config.win.pageYOffset,w=y-this._getScrollBarHeight()+b,E=parseInt(this.footerRow.getComputedStyle(s),10),S=E+this.footerRowPosition;m=v[n.FOOTERTITLE],g=this.floatingHeaderRow[n.FOOTERTITLE],wthis.firstUserCellBottom?(u.bottom=Math.ceil(S-w)+"px",p=!0):(u.bottom="1px",p=!1),m&&(m.bottom=u.bottom,m.top=null),v[n.FOOTERTITLE]=m}this.gradeItemHeadingContainer&&(this.gradeItemHeadingContainer.setStyles(t),c?this.gradeItemHeadingContainer.addClass(r.FLOATING):this.gradeItemHeadingContainer.removeClass(r.FLOATING)),this.userColumnHeader&&(this.userColumnHeader.setStyles(i),h?this.userColumnHeader.addClass(r.FLOATING):this.userColumnHeader.removeClass(r.FLOATING)),this.userColumn&&(this.userColumn.setStyles(o),h?this.userColumn.addClass(r.FLOATING):this.userColumn.removeClass(r.FLOATING)),this.footerRow&&(this.footerRow.setStyles(u),p?this.footerRow.addClass(r.FLOATING):this.footerRow.removeClass(r.FLOATING)),e.Object.each(v,function(e,t){this.floatingHeaderRow[t]&&this.floatingHeaderRow[t].setStyles(e)},this),e.Object.each(this.floatingHeaderRow,function(e,t){this.floatingHeaderRow[t]&&(d?this.floatingHeaderRow[t].addClass(r.FLOATING):this.floatingHeaderRow[t].removeClass(r.FLOATING))},this),g&&(d?g.addClass(r.FLOATING):g.removeClass(r.FLOATING))},_handleResizeEvent:function(){this._calculateCellPositions(),this._handleScrollEvent();var t=this.firstUserCell.getComputedStyle(o),r=e.all(n.USERCELL);this.userColumnHeader.one(".cell").setStyle("width",t),this.userColumn.all(".cell").each(function(e,n){e.setStyles({width:t,height:r.item(n).getComputedStyle(s)})},this);var i=this.gradeItemHeadingContainer.all(".cell"),a=e.all(n.HEADERCELLS),f=this.headerRow.getX(),l=0;a.each(function(e,t){var n=i.item(t);l+=e.get(u);var r={width:e.getComputedStyle(o),left:e.getX()-f+"px"};n.setStyles(r)});if(this.footerRow){var c=this.footerRow.all(".cell");if(c.size()!==0){var h=e.all(n.FOOTERCELLS);h.each(function(e,t){var n=c.item(t),r={width:e.getComputedStyle(o),left:e.getX()-f+"px"};n.setStyles(r)})}}e.Object.each(this.floatingHeaderRow,function(e){e.one("div").setStyle("width",t)},this),this.gradeItemHeadingContainer.setStyle("width",l)}},e.Base.mix(e.M.gradereport_grader.ReportTable,[l])},"@VERSION@",{requires:["base","node","event","handlebars","overlay","event-hover"]}); diff --git a/grade/report/grader/yui/build/moodle-gradereport_grader-gradereporttable/moodle-gradereport_grader-gradereporttable.js b/grade/report/grader/yui/build/moodle-gradereport_grader-gradereporttable/moodle-gradereport_grader-gradereporttable.js index 13bceacecce..c37dbf59d56 100644 --- a/grade/report/grader/yui/build/moodle-gradereport_grader-gradereporttable/moodle-gradereport_grader-gradereporttable.js +++ b/grade/report/grader/yui/build/moodle-gradereport_grader-gradereporttable/moodle-gradereport_grader-gradereporttable.js @@ -660,7 +660,8 @@ FloatingHeaders.prototype = { this.headerCell = Y.one(SELECTORS.STUDENTHEADER); // Create the floating row and cell. - var floatingUserHeaderRow = Y.Node.create(''), + var floatingUserHeaderRow = Y.Node.create(''), floatingUserHeaderCell = Y.Node.create('
          '), nodepos = this._getRelativeXY(this.headerCell)[0], coordinates = this._getRelativeXY(this.headerRow), @@ -921,7 +922,7 @@ FloatingHeaders.prototype = { } // User column position. - if (right_to_left()) { + if (window.right_to_left()) { floatingUserTriggerPoint = Y.config.win.innerWidth + Y.config.win.pageXOffset - this.dockWidth; floatingUserRelativePoint = floatingUserTriggerPoint - this.firstUserCellWidth; userFloats = floatingUserTriggerPoint < (this.firstUserCellLeft + this.firstUserCellWidth); diff --git a/grade/report/grader/yui/src/gradereporttable/js/floatingheaders.js b/grade/report/grader/yui/src/gradereporttable/js/floatingheaders.js index 9f5d2e7e5ef..c01f454abf2 100644 --- a/grade/report/grader/yui/src/gradereporttable/js/floatingheaders.js +++ b/grade/report/grader/yui/src/gradereporttable/js/floatingheaders.js @@ -517,7 +517,8 @@ FloatingHeaders.prototype = { this.headerCell = Y.one(SELECTORS.STUDENTHEADER); // Create the floating row and cell. - var floatingUserHeaderRow = Y.Node.create(''), + var floatingUserHeaderRow = Y.Node.create(''), floatingUserHeaderCell = Y.Node.create('
          '), nodepos = this._getRelativeXY(this.headerCell)[0], coordinates = this._getRelativeXY(this.headerRow), @@ -779,7 +780,7 @@ FloatingHeaders.prototype = { } // User column position. - if (right_to_left()) { + if (window.right_to_left()) { floatingUserTriggerPoint = Y.config.win.innerWidth + Y.config.win.pageXOffset - this.dockWidth; floatingUserRelativePoint = floatingUserTriggerPoint - this.firstUserCellWidth; userFloats = floatingUserTriggerPoint < (this.firstUserCellLeft + this.firstUserCellWidth); diff --git a/grade/report/history/yui/build/moodle-gradereport_history-userselector/moodle-gradereport_history-userselector-debug.js b/grade/report/history/yui/build/moodle-gradereport_history-userselector/moodle-gradereport_history-userselector-debug.js index a53eb2a1e1d..2b805de2cd9 100644 --- a/grade/report/history/yui/build/moodle-gradereport_history-userselector/moodle-gradereport_history-userselector-debug.js +++ b/grade/report/history/yui/build/moodle-gradereport_history-userselector/moodle-gradereport_history-userselector-debug.js @@ -274,7 +274,7 @@ Y.namespace('M.gradereport_history').UserSelector = Y.extend(USERSELECTOR, M.cor Y.io(M.cfg.wwwroot + this.get(USP.AJAXURL), { method:'POST', - data:build_querystring(params), + data: window.build_querystring(params), on: { start: this.preSearch, complete: this.processSearchResults, @@ -376,7 +376,9 @@ Y.namespace('M.gradereport_history').UserSelector = Y.extend(USERSELECTOR, M.cor // Create the div containing the users when it is a fresh search. if (!args.append) { - users = Y.Node.create('
          '); + users = Y.Node.create('
          '); } else { users = bb.one(SELECTORS.RESULTSUSERS); } @@ -405,6 +407,7 @@ Y.namespace('M.gradereport_history').UserSelector = Y.extend(USERSELECTOR, M.cor // Append the users one by one. count = this.get(USP.USERCOUNT); selected = ''; + var user; for (i in result.response.users) { count++; user = result.response.users[i]; diff --git a/grade/report/history/yui/build/moodle-gradereport_history-userselector/moodle-gradereport_history-userselector-min.js b/grade/report/history/yui/build/moodle-gradereport_history-userselector/moodle-gradereport_history-userselector-min.js index 8d69f0de564..d2fa0b05e4e 100644 --- a/grade/report/history/yui/build/moodle-gradereport_history-userselector/moodle-gradereport_history-userselector-min.js +++ b/grade/report/history/yui/build/moodle-gradereport_history-userselector/moodle-gradereport_history-userselector-min.js @@ -1,2 +1,2 @@ -YUI.add("moodle-gradereport_history-userselector",function(e,t){var n="gradereport_history",r={AJAXURL:"ajaxurl",BASE:"base",CHECKBOX_NAME_PREFIX:"usp-u",COURSEID:"courseid",DIALOGUE_PREFIX:"moodle-dialogue",NAME:"gradereport_history_usp",PAGE:"page",PARAMS:"params",PERPAGE:"perPage",SEARCH:"search",SEARCHBTN:"searchbtn",SELECTEDUSERS:"selectedUsers",URL:"url",USERCOUNT:"userCount"},i={ACCESSHIDE:"accesshide",AJAXCONTENT:"usp-ajax-content",CHECKBOX:"usp-checkbox",CLOSE:"close",CLOSEBTN:"usp-finish",CONTENT:"usp-content",DETAILS:"details",EXTRAFIELDS:"extrafields",FIRSTADDED:"usp-first-added",FULLNAME:"fullname",HEADER:"usp-header",HIDDEN:"hidden",LIGHTBOX:"usp-loading-lightbox",LOADINGICON:"loading-icon",MORERESULTS:"usp-more-results",OPTIONS:"options",PICTURE:"usp-picture",RESULTSCOUNT:"usp-results-count",SEARCH:"usp-search",SEARCHBTN:"usp-search-btn",SEARCHFIELD:"usp-search-field",SEARCHRESULTS:"usp-search-results",SELECTED:"selected",USER:"usp-user",USERS:"usp-users",WRAP:"usp-wrap"},s={AJAXCONTENT:"."+i.AJAXCONTENT,FINISHBTN:"."+i.CLOSEBTN+" input",FIRSTADDED:"."+i.FIRSTADDED,FULLNAME:"."+i.FULLNAME+" label",LIGHTBOX:"."+i.LIGHTBOX,MORERESULTS:"."+i.MORERESULTS,OPTIONS:"."+i.OPTIONS,PICTURE:"."+i.USER+" .userpicture",RESULTSCOUNT:"."+i.RESULTSCOUNT,RESULTSUSERS:"."+i.SEARCHRESULTS+" ."+i.USERS,SEARCHBTN:"."+i.SEARCHBTN,SEARCHFIELD:"."+i.SEARCHFIELD,SELECTEDNAMES:".felement .selectednames",TRIGGER:".gradereport_history_plugin input.selectortrigger",USER:"."+i.USER,USERFULLNAMES:'input[name="userfullnames"]',USERIDS:'input[name="userids"]',USERSELECT:"."+i.CHECKBOX+" input[type=checkbox]"},o=function(){o.superclass.constructor.apply(this,arguments)};e.namespace("M.gradereport_history").UserSelector=e.extend(o,M.core.dialogue,{_firstDisplay:!0,_usersBufferList:null,_userTabFocus:null,_userTemplate:null,initializer:function(){var t=this.get("boundingBox"),o,u,a;a=e.Handlebars.compile('
          {{get_string
          '),o=e.Node.create(a({COMPONENT:n,CSS:i,loadingIcon:M.util.image_url("i/loading","moodle")})),this.getStdModNode(e.WidgetStdMod.HEADER).prepend(e.Node.create("

          "+this.get("title")+"

          ")),this.setStdModContent(e.WidgetStdMod.BODY,o,e.WidgetStdMod.REPLACE),this.get("boundingBox").one(".moodle-dialogue-wrap").addClass("moodle-dialogue-content"),e.one(s.TRIGGER).on("click",this.show,this),t.one(s.FINISHBTN).on("click",this.finishSelectingUsers,this),t.delegate("key",this.userKeyboardNavigation,"down:38,40",s.AJAXCONTENT,this),e.delegate("click",this.selectUser,s.AJAXCONTENT,s.USERSELECT,this),e.delegate("click",this.selectUser,s.AJAXCONTENT,s.PICTURE,this),u=this.get(r.PARAMS),u.id=this.get(r.COURSEID),this.set(r.PARAMS,u),t.one(s.SEARCHBTN).on("click",this.search,this,!1)},show:function(t){var n;return this._usersBufferList=e.clone(this.get(r.SELECTEDUSERS)),this._firstDisplay?(this._firstDisplay=!1,this.search(t,!1)):(n=this.get("boundingBox"),n.all(s.USER).each(function(e){this.markUserNode(e,!1)},this),e.Object.each(this._usersBufferList,function(e,t){var r=n.one(s.USER+'[data-userid="'+t+'"]');r&&this.markUserNode(r,!0)},this),this.setUserTabFocus(n.one(s.USER))),e.namespace("M.gradereport_history.UserSelector").superclass.show.call(this)},search:function(t,n){t&&t.preventDefault();var i;n?this.set(r.PAGE,this.get(r.PAGE)+1):(this.set(r.USERCOUNT,0),this.set(r.PAGE,0)),i=this.get(r.PARAMS),i.sesskey=M.cfg.sesskey,i.action="searchusers",i.search=this.get("boundingBox").one(s.SEARCHFIELD).get("value"),i.page=this.get(r.PAGE),i.perpage=this.get(r.PERPAGE),e.io(M.cfg.wwwroot+this.get(r.AJAXURL),{method:"POST",data:build_querystring(i),on:{start:this.preSearch,complete:this.processSearchResults,end:this.postSearch},context:this,arguments:{append:n}})},preSearch:function(e,t){var n=this.get("boundingBox");n.one(s.LIGHTBOX).removeClass(i.HIDDEN),t.append||n.one(s.RESULTSCOUNT).setHTML(M.util.get_string("loading","admin"))},postSearch:function(e,t){var n=this.get("boundingBox"),r=n.one(s.FIRSTADDED),o;n.one(s.LIGHTBOX).addClass(i.HIDDEN),t.append&&r?(this.setUserTabFocus(r),r.one(s.USERSELECT).focus()):(o=n.one(s.USER),o&&this.setUserTabFocus(o))},processSearchResults:function(t,o,u){var a=!1,f=!1,l=this.get("boundingBox"),c,h,p,d,v,m=!0,g,y,b,w;try{a=e.JSON.parse(o.responseText);if(!a.success||a.error)f=!0}catch(E){f=!0}if(f){this.setContent(""),l.one(s.RESULTSCOUNT).setHTML(M.util.get_string("errajaxsearch",n));return}u.append?c=l.one(s.RESULTSUSERS):c=e.Node.create('
          '),this._userTemplate||(this._userTemplate=e.Handlebars.compile('
          {{{picture}}}
          {{extrafields}}
          ')),h=this._userTemplate,p=this.get(r.USERCOUNT),d="";for(v in a.response.users)p++,user=a.response -.users[v],e.Object.hasKey(this._usersBufferList,user.userid)?d=!0:d=!1,g=e.Node.create(h({checkboxId:e.guid(),COMPONENT:n,count:p,CSS:i,extrafields:user.extrafields,extraFieldsId:e.guid(),fullname:user.fullname,picture:user.picture,userId:user.userid,USP:r})),this.markUserNode(g,d),u.append&&m&&(c.all(s.FIRSTADDED).removeClass(i.FIRSTADDED),g.addClass(i.FIRSTADDED),m=!1),c.append(g);this.set(r.USERCOUNT,p),w=parseInt(a.response.totalusers,10),u.append?w<=(this.get(r.PAGE)+1)*this.get(r.PERPAGE)&&l.one(s.MORERESULTS).remove():(w===0?(l.one(s.RESULTSCOUNT).setHTML(M.util.get_string("noresults","moodle")),y=""):(w===1?l.one(s.RESULTSCOUNT).setHTML(M.util.get_string("foundoneuser",n)):l.one(s.RESULTSCOUNT).setHTML(M.util.get_string("foundnusers",n,w)),y=e.Node.create('
          ').append(c),a.response.totalusers>(this.get(r.PAGE)+1)*this.get(r.PERPAGE)&&(b=e.Node.create('"),b.one("a").on("click",this.search,this,!0),b.one("a").on("key",this.search,"space",this,!0),y.append(b))),this.setContent(y))},finishSelectingUsers:function(e){e.preventDefault(),this.applySelection(),this.hide()},applySelection:function(){var t=e.Object.keys(this._usersBufferList);this.set(r.SELECTEDUSERS,e.clone(this._usersBufferList)).setNameDisplay(),e.one(s.USERIDS).set("value",t.join())},selectUser:function(e){var t=e.currentTarget.ancestor(s.USER),n=t.one(s.USERSELECT),r=t.one(s.FULLNAME).get("innerHTML"),i=n.get("checked"),o=t.getData("userid");e.currentTarget!==n&&(i=!i),i?this._usersBufferList[o]=r:(delete this._usersBufferList[o],delete this._usersBufferList[parseInt(o,10)]),this.markUserNode(t,i)},markUserNode:function(e,t){return t?e.addClass(i.SELECTED).set("aria-selected",!0).one(s.USERSELECT).set("checked",!0):e.removeClass(i.SELECTED).set("aria-selected",!1).one(s.USERSELECT).set("checked",!1),this},setContent:function(e){return this.get("boundingBox").one(s.AJAXCONTENT).setHTML(e),this},setNameDisplay:function(){var t=e.Object.values(this.get(r.SELECTEDUSERS));e.one(s.SELECTEDNAMES).set("innerHTML",t.join(", ")),e.one(s.USERFULLNAMES).set("value",t.join())},userKeyboardNavigation:function(e){var t=this.get("boundingBox"),n=t.all(s.USER),r=1,i,o=e.target.ancestor(s.USER,!0);e.keyCode===38&&(r=-1),i=this.findFocusableUser(n,o,r),i&&(e.preventDefault(),i.one(s.USERSELECT).focus(),this.setUserTabFocus(i))},findFocusableUser:function(e,t,n){var r=e.indexOf(t);return e.size()<1?null:r<0?e.item(0):(r+=n,r<0?r=e.size()-1:r>=e.size()&&(r=0),e.item(r))},setUserTabFocus:function(e){this._userTabFocus&&this._userTabFocus.setAttribute("tabindex","-1");if(!e)return;this._userTabFocus=e.one(s.USERSELECT),this._userTabFocus.setAttribute("tabindex","0"),this.get("boundingBox").one(s.RESULTSUSERS).setAttribute("aria-activedescendant",this._userTabFocus.generateID())}},{NAME:r.NAME,CSS_PREFIX:r.CSS_PREFIX,ATTRS:{title:{validator:e.Lang.isString,valueFn:function(){return M.util.get_string("selectusers",n)}},url:{validator:e.Lang.isString,value:null},ajaxurl:{validator:e.Lang.isString,value:null},selectedUsers:{validator:e.Lang.isObject,value:null,getter:function(e){return e===null?{}:e}},courseid:{value:null},params:{validator:e.Lang.isArray,value:[]},page:{validator:e.Lang.isNumber,value:0},userCount:{value:0,validator:e.Lang.isNumber},perPage:{value:25,Validator:e.Lang.isNumber}}}),e.Base.modifyAttrs(e.namespace("M.gradereport_history.UserSelector"),{extraClasses:{value:["gradereport_history_usp"]},focusOnPreviousTargetAfterHide:{value:!0},width:{value:"500px"},visible:{value:!1},modal:{value:!0},draggable:{value:!0}}),e.namespace("M.gradereport_history.UserSelector").init=function(e){return new o(e)}},"@VERSION@",{requires:["escape","event-delegate","event-key","handlebars","io-base","json-parse","moodle-core-notification-dialogue"]}); +YUI.add("moodle-gradereport_history-userselector",function(e,t){var n="gradereport_history",r={AJAXURL:"ajaxurl",BASE:"base",CHECKBOX_NAME_PREFIX:"usp-u",COURSEID:"courseid",DIALOGUE_PREFIX:"moodle-dialogue",NAME:"gradereport_history_usp",PAGE:"page",PARAMS:"params",PERPAGE:"perPage",SEARCH:"search",SEARCHBTN:"searchbtn",SELECTEDUSERS:"selectedUsers",URL:"url",USERCOUNT:"userCount"},i={ACCESSHIDE:"accesshide",AJAXCONTENT:"usp-ajax-content",CHECKBOX:"usp-checkbox",CLOSE:"close",CLOSEBTN:"usp-finish",CONTENT:"usp-content",DETAILS:"details",EXTRAFIELDS:"extrafields",FIRSTADDED:"usp-first-added",FULLNAME:"fullname",HEADER:"usp-header",HIDDEN:"hidden",LIGHTBOX:"usp-loading-lightbox",LOADINGICON:"loading-icon",MORERESULTS:"usp-more-results",OPTIONS:"options",PICTURE:"usp-picture",RESULTSCOUNT:"usp-results-count",SEARCH:"usp-search",SEARCHBTN:"usp-search-btn",SEARCHFIELD:"usp-search-field",SEARCHRESULTS:"usp-search-results",SELECTED:"selected",USER:"usp-user",USERS:"usp-users",WRAP:"usp-wrap"},s={AJAXCONTENT:"."+i.AJAXCONTENT,FINISHBTN:"."+i.CLOSEBTN+" input",FIRSTADDED:"."+i.FIRSTADDED,FULLNAME:"."+i.FULLNAME+" label",LIGHTBOX:"."+i.LIGHTBOX,MORERESULTS:"."+i.MORERESULTS,OPTIONS:"."+i.OPTIONS,PICTURE:"."+i.USER+" .userpicture",RESULTSCOUNT:"."+i.RESULTSCOUNT,RESULTSUSERS:"."+i.SEARCHRESULTS+" ."+i.USERS,SEARCHBTN:"."+i.SEARCHBTN,SEARCHFIELD:"."+i.SEARCHFIELD,SELECTEDNAMES:".felement .selectednames",TRIGGER:".gradereport_history_plugin input.selectortrigger",USER:"."+i.USER,USERFULLNAMES:'input[name="userfullnames"]',USERIDS:'input[name="userids"]',USERSELECT:"."+i.CHECKBOX+" input[type=checkbox]"},o=function(){o.superclass.constructor.apply(this,arguments)};e.namespace("M.gradereport_history").UserSelector=e.extend(o,M.core.dialogue,{_firstDisplay:!0,_usersBufferList:null,_userTabFocus:null,_userTemplate:null,initializer:function(){var t=this.get("boundingBox"),o,u,a;a=e.Handlebars.compile('
          {{get_string
          '),o=e.Node.create(a({COMPONENT:n,CSS:i,loadingIcon:M.util.image_url("i/loading","moodle")})),this.getStdModNode(e.WidgetStdMod.HEADER).prepend(e.Node.create("

          "+this.get("title")+"

          ")),this.setStdModContent(e.WidgetStdMod.BODY,o,e.WidgetStdMod.REPLACE),this.get("boundingBox").one(".moodle-dialogue-wrap").addClass("moodle-dialogue-content"),e.one(s.TRIGGER).on("click",this.show,this),t.one(s.FINISHBTN).on("click",this.finishSelectingUsers,this),t.delegate("key",this.userKeyboardNavigation,"down:38,40",s.AJAXCONTENT,this),e.delegate("click",this.selectUser,s.AJAXCONTENT,s.USERSELECT,this),e.delegate("click",this.selectUser,s.AJAXCONTENT,s.PICTURE,this),u=this.get(r.PARAMS),u.id=this.get(r.COURSEID),this.set(r.PARAMS,u),t.one(s.SEARCHBTN).on("click",this.search,this,!1)},show:function(t){var n;return this._usersBufferList=e.clone(this.get(r.SELECTEDUSERS)),this._firstDisplay?(this._firstDisplay=!1,this.search(t,!1)):(n=this.get("boundingBox"),n.all(s.USER).each(function(e){this.markUserNode(e,!1)},this),e.Object.each(this._usersBufferList,function(e,t){var r=n.one(s.USER+'[data-userid="'+t+'"]');r&&this.markUserNode(r,!0)},this),this.setUserTabFocus(n.one(s.USER))),e.namespace("M.gradereport_history.UserSelector").superclass.show.call(this)},search:function(t,n){t&&t.preventDefault();var i;n?this.set(r.PAGE,this.get(r.PAGE)+1):(this.set(r.USERCOUNT,0),this.set(r.PAGE,0)),i=this.get(r.PARAMS),i.sesskey=M.cfg.sesskey,i.action="searchusers",i.search=this.get("boundingBox").one(s.SEARCHFIELD).get("value"),i.page=this.get(r.PAGE),i.perpage=this.get(r.PERPAGE),e.io(M.cfg.wwwroot+this.get(r.AJAXURL),{method:"POST",data:window.build_querystring(i),on:{start:this.preSearch,complete:this.processSearchResults,end:this.postSearch},context:this,arguments:{append:n}})},preSearch:function(e,t){var n=this.get("boundingBox");n.one(s.LIGHTBOX).removeClass(i.HIDDEN),t.append||n.one(s.RESULTSCOUNT).setHTML(M.util.get_string("loading","admin"))},postSearch:function(e,t){var n=this.get("boundingBox"),r=n.one(s.FIRSTADDED),o;n.one(s.LIGHTBOX).addClass(i.HIDDEN),t.append&&r?(this.setUserTabFocus(r),r.one(s.USERSELECT).focus()):(o=n.one(s.USER),o&&this.setUserTabFocus(o))},processSearchResults:function(t,o,u){var a=!1,f=!1,l=this.get("boundingBox"),c,h,p,d,v,m=!0,g,y,b,w;try{a=e.JSON.parse(o.responseText);if(!a.success||a.error)f=!0}catch(E){f=!0}if(f){this.setContent(""),l.one(s.RESULTSCOUNT).setHTML(M.util.get_string("errajaxsearch",n));return}u.append?c=l.one(s.RESULTSUSERS):c=e.Node.create('
          '),this._userTemplate||(this._userTemplate=e.Handlebars.compile('
          {{{picture}}}
          {{extrafields}}
          ')),h=this._userTemplate,p=this.get(r.USERCOUNT),d="";var S;for(v in a.response.users)p++ +,S=a.response.users[v],e.Object.hasKey(this._usersBufferList,S.userid)?d=!0:d=!1,g=e.Node.create(h({checkboxId:e.guid(),COMPONENT:n,count:p,CSS:i,extrafields:S.extrafields,extraFieldsId:e.guid(),fullname:S.fullname,picture:S.picture,userId:S.userid,USP:r})),this.markUserNode(g,d),u.append&&m&&(c.all(s.FIRSTADDED).removeClass(i.FIRSTADDED),g.addClass(i.FIRSTADDED),m=!1),c.append(g);this.set(r.USERCOUNT,p),w=parseInt(a.response.totalusers,10),u.append?w<=(this.get(r.PAGE)+1)*this.get(r.PERPAGE)&&l.one(s.MORERESULTS).remove():(w===0?(l.one(s.RESULTSCOUNT).setHTML(M.util.get_string("noresults","moodle")),y=""):(w===1?l.one(s.RESULTSCOUNT).setHTML(M.util.get_string("foundoneuser",n)):l.one(s.RESULTSCOUNT).setHTML(M.util.get_string("foundnusers",n,w)),y=e.Node.create('
          ').append(c),a.response.totalusers>(this.get(r.PAGE)+1)*this.get(r.PERPAGE)&&(b=e.Node.create('"),b.one("a").on("click",this.search,this,!0),b.one("a").on("key",this.search,"space",this,!0),y.append(b))),this.setContent(y))},finishSelectingUsers:function(e){e.preventDefault(),this.applySelection(),this.hide()},applySelection:function(){var t=e.Object.keys(this._usersBufferList);this.set(r.SELECTEDUSERS,e.clone(this._usersBufferList)).setNameDisplay(),e.one(s.USERIDS).set("value",t.join())},selectUser:function(e){var t=e.currentTarget.ancestor(s.USER),n=t.one(s.USERSELECT),r=t.one(s.FULLNAME).get("innerHTML"),i=n.get("checked"),o=t.getData("userid");e.currentTarget!==n&&(i=!i),i?this._usersBufferList[o]=r:(delete this._usersBufferList[o],delete this._usersBufferList[parseInt(o,10)]),this.markUserNode(t,i)},markUserNode:function(e,t){return t?e.addClass(i.SELECTED).set("aria-selected",!0).one(s.USERSELECT).set("checked",!0):e.removeClass(i.SELECTED).set("aria-selected",!1).one(s.USERSELECT).set("checked",!1),this},setContent:function(e){return this.get("boundingBox").one(s.AJAXCONTENT).setHTML(e),this},setNameDisplay:function(){var t=e.Object.values(this.get(r.SELECTEDUSERS));e.one(s.SELECTEDNAMES).set("innerHTML",t.join(", ")),e.one(s.USERFULLNAMES).set("value",t.join())},userKeyboardNavigation:function(e){var t=this.get("boundingBox"),n=t.all(s.USER),r=1,i,o=e.target.ancestor(s.USER,!0);e.keyCode===38&&(r=-1),i=this.findFocusableUser(n,o,r),i&&(e.preventDefault(),i.one(s.USERSELECT).focus(),this.setUserTabFocus(i))},findFocusableUser:function(e,t,n){var r=e.indexOf(t);return e.size()<1?null:r<0?e.item(0):(r+=n,r<0?r=e.size()-1:r>=e.size()&&(r=0),e.item(r))},setUserTabFocus:function(e){this._userTabFocus&&this._userTabFocus.setAttribute("tabindex","-1");if(!e)return;this._userTabFocus=e.one(s.USERSELECT),this._userTabFocus.setAttribute("tabindex","0"),this.get("boundingBox").one(s.RESULTSUSERS).setAttribute("aria-activedescendant",this._userTabFocus.generateID())}},{NAME:r.NAME,CSS_PREFIX:r.CSS_PREFIX,ATTRS:{title:{validator:e.Lang.isString,valueFn:function(){return M.util.get_string("selectusers",n)}},url:{validator:e.Lang.isString,value:null},ajaxurl:{validator:e.Lang.isString,value:null},selectedUsers:{validator:e.Lang.isObject,value:null,getter:function(e){return e===null?{}:e}},courseid:{value:null},params:{validator:e.Lang.isArray,value:[]},page:{validator:e.Lang.isNumber,value:0},userCount:{value:0,validator:e.Lang.isNumber},perPage:{value:25,Validator:e.Lang.isNumber}}}),e.Base.modifyAttrs(e.namespace("M.gradereport_history.UserSelector"),{extraClasses:{value:["gradereport_history_usp"]},focusOnPreviousTargetAfterHide:{value:!0},width:{value:"500px"},visible:{value:!1},modal:{value:!0},draggable:{value:!0}}),e.namespace("M.gradereport_history.UserSelector").init=function(e){return new o(e)}},"@VERSION@",{requires:["escape","event-delegate","event-key","handlebars","io-base","json-parse","moodle-core-notification-dialogue"]}); diff --git a/grade/report/history/yui/build/moodle-gradereport_history-userselector/moodle-gradereport_history-userselector.js b/grade/report/history/yui/build/moodle-gradereport_history-userselector/moodle-gradereport_history-userselector.js index 390997d1ae3..7824fc2d0ef 100644 --- a/grade/report/history/yui/build/moodle-gradereport_history-userselector/moodle-gradereport_history-userselector.js +++ b/grade/report/history/yui/build/moodle-gradereport_history-userselector/moodle-gradereport_history-userselector.js @@ -274,7 +274,7 @@ Y.namespace('M.gradereport_history').UserSelector = Y.extend(USERSELECTOR, M.cor Y.io(M.cfg.wwwroot + this.get(USP.AJAXURL), { method:'POST', - data:build_querystring(params), + data: window.build_querystring(params), on: { start: this.preSearch, complete: this.processSearchResults, @@ -376,7 +376,9 @@ Y.namespace('M.gradereport_history').UserSelector = Y.extend(USERSELECTOR, M.cor // Create the div containing the users when it is a fresh search. if (!args.append) { - users = Y.Node.create('
          '); + users = Y.Node.create('
          '); } else { users = bb.one(SELECTORS.RESULTSUSERS); } @@ -405,6 +407,7 @@ Y.namespace('M.gradereport_history').UserSelector = Y.extend(USERSELECTOR, M.cor // Append the users one by one. count = this.get(USP.USERCOUNT); selected = ''; + var user; for (i in result.response.users) { count++; user = result.response.users[i]; diff --git a/grade/report/history/yui/src/userselector/js/userselector.js b/grade/report/history/yui/src/userselector/js/userselector.js index 0622cb9bf90..fc5445a3c57 100644 --- a/grade/report/history/yui/src/userselector/js/userselector.js +++ b/grade/report/history/yui/src/userselector/js/userselector.js @@ -272,7 +272,7 @@ Y.namespace('M.gradereport_history').UserSelector = Y.extend(USERSELECTOR, M.cor Y.io(M.cfg.wwwroot + this.get(USP.AJAXURL), { method:'POST', - data:build_querystring(params), + data: window.build_querystring(params), on: { start: this.preSearch, complete: this.processSearchResults, @@ -374,7 +374,9 @@ Y.namespace('M.gradereport_history').UserSelector = Y.extend(USERSELECTOR, M.cor // Create the div containing the users when it is a fresh search. if (!args.append) { - users = Y.Node.create('
          '); + users = Y.Node.create('
          '); } else { users = bb.one(SELECTORS.RESULTSUSERS); } @@ -403,6 +405,7 @@ Y.namespace('M.gradereport_history').UserSelector = Y.extend(USERSELECTOR, M.cor // Append the users one by one. count = this.get(USP.USERCOUNT); selected = ''; + var user; for (i in result.response.users) { count++; user = result.response.users[i]; diff --git a/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button-debug.js b/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button-debug.js index 84699a1952b..947a7fe5f17 100644 --- a/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button-debug.js +++ b/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button-debug.js @@ -110,7 +110,7 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M. // Images with no alt text or dodgy alt text. problemNodes = []; this.editor.all('img').each(function (img) { - alt = img.getAttribute('alt'); + var alt = img.getAttribute('alt'); if (typeof alt === 'undefined' || alt === '') { if (img.getAttribute('role') !== 'presentation') { problemNodes.push(img); @@ -178,7 +178,7 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M. // Check for tables with no captions. problemNodes = []; this.editor.all('table').each(function (table) { - caption = table.one('caption'); + var caption = table.one('caption'); if (caption === null || caption.get('text').trim() === '') { problemNodes.push(table); } @@ -188,7 +188,7 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M. // Check for tables with merged cells. problemNodes = []; this.editor.all('table').each(function (table) { - caption = table.one('[colspan],[rowspan]'); + var caption = table.one('[colspan],[rowspan]'); if (caption !== null) { problemNodes.push(table); } diff --git a/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button-min.js b/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button-min.js index 59a10f7315d..294089029df 100644 --- a/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button-min.js +++ b/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button-min.js @@ -1 +1 @@ -YUI.add("moodle-atto_accessibilitychecker-button",function(e,t){var n="atto_accessibilitychecker";e.namespace("M.atto_accessibilitychecker").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{initializer:function(){this.addButton({icon:"e/accessibility_checker",callback:this._displayDialogue})},_displayDialogue:function(){var e=this.getDialogue({headerContent:M.util.get_string("pluginname",n),width:"500px",focusAfterHide:!0});e.set("bodyContent",this._getDialogueContent()).show()},_getDialogueContent:function(){var t=e.Node.create('
          ');return t.append(this._getWarnings()),t.delegate("click",function(e){e.preventDefault();var t=this.get("host"),n=e.currentTarget.getData("sourceNode"),r=this.getDialogue();n?(r.set("focusAfterHide",this.editor).hide(),t.setSelection(t.getSelectionFromNode(n))):r.hide()},"a",this),t},_getWarnings:function(){var t,r=e.Node.create("
          ");return t=[],this.editor.all("img").each(function(e){alt=e.getAttribute("alt"),(typeof alt=="undefined"||alt==="")&&e.getAttribute("role")!=="presentation"&&t.push(e)},this),this._addWarnings(r,M.util.get_string("imagesmissingalt",n),t,!0),t=[],this.editor.all("*").each(function(n){var r,i,s,o,u;if(e.Lang.trim(n.get("text"))!==""){r=n.getComputedStyle("color"),i=n.getComputedStyle("backgroundColor"),o=this._getLuminanceFromCssColor(r),u=this._getLuminanceFromCssColor(i),o>u?s=(o+.05)/(u+.05):s=(u+.05)/(o+.05);if(s<=4.5){var a=0,f=!1;for(a=0;a1e3&&!this.editor.one("h3, h4, h5")&&this._addWarnings(r,M.util.get_string("needsmoreheadings",n),[this.editor],!1),t=[],this.editor.all("table").each(function(e){caption=e.one("caption"),(caption===null||caption.get("text").trim()==="")&&t.push(e)},this),this._addWarnings(r,M.util.get_string("tablesmissingcaption",n),t,!1),t=[],this.editor.all("table").each(function(e){caption=e.one("[colspan],[rowspan]"),caption!==null&&t.push(e)},this),this._addWarnings(r,M.util.get_string("tableswithmergedcells",n),t,!1),t=[],this.editor.all("table").each(function(e){if(e.one("tr").one("td"))e.all("tr").some(function(n){var r=n.one("th");return!r||r.get("text").trim()===""?(t.push(e),!0):!1},this);else{var n=!1;e.one("tr").all("th").some(function(r){return n=!0,r.get("text").trim()===""?(t.push(e),!0):!1}),n||t.push(e)}},this),this._addWarnings(r,M.util.get_string("tablesmissingheaders",n),t,!1),r.hasChildNodes()||r.append("

          "+M.util.get_string("nowarnings",n)+"

          "),r},_addWarnings:function(t,r,i,s){var o,u,a,f,l,c,h,p;if(i.length>0){o=e.Node.create("

          "+r+"

          "),u=e.Node.create('
            '),a=0;for(a=0;a"),s?(f=i[a].getAttribute("src"),h=e.Node.create(' '+f+"")):(l="innerText"in i[a]?"innerText":"textContent",p=i[a].get(l).trim(),p===""&&(p=M.util.get_string("emptytext",n)),i[a]===this.editor&&(p=M.util.get_string("entiredocument",n)),h=e.Node.create(''+p+"")),h.setData("sourceNode",i[a]),c.append(h),u.append(c);o.append(u),t.append(o)}},_getLuminanceFromCssColor:function(t){var n;t==="transparent"&&(t="#ffffff"),n=e.Color.toArray(e.Color.toRGB(t));var r=function(e){return e=parseInt(e,10)/255,e<=.03928?e/=12.92:e=Math.pow((e+.055)/1.055,2.4),e},i=r(n[0]),s=r(n[1]),o=r(n[2]);return.2126*i+.7152*s+.0722*o}})},"@VERSION@",{requires:["color-base","moodle-editor_atto-plugin"]}); +YUI.add("moodle-atto_accessibilitychecker-button",function(e,t){var n="atto_accessibilitychecker";e.namespace("M.atto_accessibilitychecker").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{initializer:function(){this.addButton({icon:"e/accessibility_checker",callback:this._displayDialogue})},_displayDialogue:function(){var e=this.getDialogue({headerContent:M.util.get_string("pluginname",n),width:"500px",focusAfterHide:!0});e.set("bodyContent",this._getDialogueContent()).show()},_getDialogueContent:function(){var t=e.Node.create('
            ');return t.append(this._getWarnings()),t.delegate("click",function(e){e.preventDefault();var t=this.get("host"),n=e.currentTarget.getData("sourceNode"),r=this.getDialogue();n?(r.set("focusAfterHide",this.editor).hide(),t.setSelection(t.getSelectionFromNode(n))):r.hide()},"a",this),t},_getWarnings:function(){var t,r=e.Node.create("
            ");return t=[],this.editor.all("img").each(function(e){var n=e.getAttribute("alt");(typeof n=="undefined"||n==="")&&e.getAttribute("role")!=="presentation"&&t.push(e)},this),this._addWarnings(r,M.util.get_string("imagesmissingalt",n),t,!0),t=[],this.editor.all("*").each(function(n){var r,i,s,o,u;if(e.Lang.trim(n.get("text"))!==""){r=n.getComputedStyle("color"),i=n.getComputedStyle("backgroundColor"),o=this._getLuminanceFromCssColor(r),u=this._getLuminanceFromCssColor(i),o>u?s=(o+.05)/(u+.05):s=(u+.05)/(o+.05);if(s<=4.5){var a=0,f=!1;for(a=0;a1e3&&!this.editor.one("h3, h4, h5")&&this._addWarnings(r,M.util.get_string("needsmoreheadings",n),[this.editor],!1),t=[],this.editor.all("table").each(function(e){var n=e.one("caption");(n===null||n.get("text").trim()==="")&&t.push(e)},this),this._addWarnings(r,M.util.get_string("tablesmissingcaption",n),t,!1),t=[],this.editor.all("table").each(function(e){var n=e.one("[colspan],[rowspan]");n!==null&&t.push(e)},this),this._addWarnings(r,M.util.get_string("tableswithmergedcells",n),t,!1),t=[],this.editor.all("table").each(function(e){if(e.one("tr").one("td"))e.all("tr").some(function(n){var r=n.one("th");return!r||r.get("text").trim()===""?(t.push(e),!0):!1},this);else{var n=!1;e.one("tr").all("th").some(function(r){return n=!0,r.get("text").trim()===""?(t.push(e),!0):!1}),n||t.push(e)}},this),this._addWarnings(r,M.util.get_string("tablesmissingheaders",n),t,!1),r.hasChildNodes()||r.append("

            "+M.util.get_string("nowarnings",n)+"

            "),r},_addWarnings:function(t,r,i,s){var o,u,a,f,l,c,h,p;if(i.length>0){o=e.Node.create("

            "+r+"

            "),u=e.Node.create('
              '),a=0;for(a=0;a"),s?(f=i[a].getAttribute("src"),h=e.Node.create(' '+f+"")):(l="innerText"in i[a]?"innerText":"textContent",p=i[a].get(l).trim(),p===""&&(p=M.util.get_string("emptytext",n)),i[a]===this.editor&&(p=M.util.get_string("entiredocument",n)),h=e.Node.create(''+p+"")),h.setData("sourceNode",i[a]),c.append(h),u.append(c);o.append(u),t.append(o)}},_getLuminanceFromCssColor:function(t){var n;t==="transparent"&&(t="#ffffff"),n=e.Color.toArray(e.Color.toRGB(t));var r=function(e){return e=parseInt(e,10)/255,e<=.03928?e/=12.92:e=Math.pow((e+.055)/1.055,2.4),e},i=r(n[0]),s=r(n[1]),o=r(n[2]);return.2126*i+.7152*s+.0722*o}})},"@VERSION@",{requires:["color-base","moodle-editor_atto-plugin"]}); diff --git a/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button.js b/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button.js index bf346bb767e..1f894cfc929 100644 --- a/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button.js +++ b/lib/editor/atto/plugins/accessibilitychecker/yui/build/moodle-atto_accessibilitychecker-button/moodle-atto_accessibilitychecker-button.js @@ -110,7 +110,7 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M. // Images with no alt text or dodgy alt text. problemNodes = []; this.editor.all('img').each(function (img) { - alt = img.getAttribute('alt'); + var alt = img.getAttribute('alt'); if (typeof alt === 'undefined' || alt === '') { if (img.getAttribute('role') !== 'presentation') { problemNodes.push(img); @@ -173,7 +173,7 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M. // Check for tables with no captions. problemNodes = []; this.editor.all('table').each(function (table) { - caption = table.one('caption'); + var caption = table.one('caption'); if (caption === null || caption.get('text').trim() === '') { problemNodes.push(table); } @@ -183,7 +183,7 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M. // Check for tables with merged cells. problemNodes = []; this.editor.all('table').each(function (table) { - caption = table.one('[colspan],[rowspan]'); + var caption = table.one('[colspan],[rowspan]'); if (caption !== null) { problemNodes.push(table); } diff --git a/lib/editor/atto/plugins/accessibilitychecker/yui/src/button/js/button.js b/lib/editor/atto/plugins/accessibilitychecker/yui/src/button/js/button.js index 67b3878bc59..9f72fe4717d 100644 --- a/lib/editor/atto/plugins/accessibilitychecker/yui/src/button/js/button.js +++ b/lib/editor/atto/plugins/accessibilitychecker/yui/src/button/js/button.js @@ -108,7 +108,7 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M. // Images with no alt text or dodgy alt text. problemNodes = []; this.editor.all('img').each(function (img) { - alt = img.getAttribute('alt'); + var alt = img.getAttribute('alt'); if (typeof alt === 'undefined' || alt === '') { if (img.getAttribute('role') !== 'presentation') { problemNodes.push(img); @@ -176,7 +176,7 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M. // Check for tables with no captions. problemNodes = []; this.editor.all('table').each(function (table) { - caption = table.one('caption'); + var caption = table.one('caption'); if (caption === null || caption.get('text').trim() === '') { problemNodes.push(table); } @@ -186,7 +186,7 @@ Y.namespace('M.atto_accessibilitychecker').Button = Y.Base.create('button', Y.M. // Check for tables with merged cells. problemNodes = []; this.editor.all('table').each(function (table) { - caption = table.one('[colspan],[rowspan]'); + var caption = table.one('[colspan],[rowspan]'); if (caption !== null) { problemNodes.push(table); } diff --git a/lib/editor/atto/plugins/equation/yui/build/moodle-atto_equation-button/moodle-atto_equation-button-debug.js b/lib/editor/atto/plugins/equation/yui/build/moodle-atto_equation-button/moodle-atto_equation-button-debug.js index 8595032d14c..628f2ce9bad 100644 --- a/lib/editor/atto/plugins/equation/yui/build/moodle-atto_equation-button/moodle-atto_equation-button-debug.js +++ b/lib/editor/atto/plugins/equation/yui/build/moodle-atto_equation-button/moodle-atto_equation-button-debug.js @@ -60,9 +60,11 @@ var COMPONENTNAME = 'atto_equation', '
              ' + '{{{library}}}' + '' + - '
              ' + + '
              ' + '' + - '
              ' + + '
              ' + '
              {{get_string "cursorinfo" component}}
              ' + '
              ' + '
              ' + @@ -186,7 +188,9 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto. // We need to convert these to a non dom node based format. this.editor.all('tex').each(function (texNode) { - var replacement = Y.Node.create('' + DELIMITERS.START + ' ' + texNode.get('text') + ' ' + DELIMITERS.END + ''); + var replacement = Y.Node.create('' + + DELIMITERS.START + ' ' + texNode.get('text') + ' ' + DELIMITERS.END + + ''); texNode.replace(replacement); }); } @@ -273,7 +277,8 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto. text = Y.one(selectedNode).get('text'); - // For each of these patterns we have a RegExp which captures the inner component of the equation but also includes the delimiters. + // For each of these patterns we have a RegExp which captures the inner component of the equation but also + // includes the delimiters. // We first run the RegExp adding the global flag ("g"). This ignores the capture, instead matching the entire // equation including delimiters and returning one entry per match of the whole equation. // We have to deal with multiple occurences of the same equation in a String so must be able to loop on the @@ -353,7 +358,8 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto. selectedNode, text, value, - host; + host, + newText; host = this.get('host'); @@ -446,7 +452,9 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto. isChar = /[a-zA-Z\{\}]/; if (currentPos !== 0) { // Now match to the end of the line. - while (isChar.test(equation.charAt(currentPos)) && currentPos < equation.length && isChar.test(equation.charAt(currentPos-1))) { + while (isChar.test(equation.charAt(currentPos)) && + currentPos < equation.length && + isChar.test(equation.charAt(currentPos-1))) { currentPos += 1; } } @@ -688,7 +696,7 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto. text: content }; - preview = Y.io(url, { + var preview = Y.io(url, { sync: true, data: params, method: 'POST' diff --git a/lib/editor/atto/plugins/equation/yui/build/moodle-atto_equation-button/moodle-atto_equation-button-min.js b/lib/editor/atto/plugins/equation/yui/build/moodle-atto_equation-button/moodle-atto_equation-button-min.js index e82600d3e89..05522fd4fc7 100644 --- a/lib/editor/atto/plugins/equation/yui/build/moodle-atto_equation-button/moodle-atto_equation-button-min.js +++ b/lib/editor/atto/plugins/equation/yui/build/moodle-atto_equation-button/moodle-atto_equation-button-min.js @@ -1,2 +1,2 @@ -YUI.add("moodle-atto_equation-button",function(e,t){var n="atto_equation",r="atto_equation",i={EQUATION_TEXT:"atto_equation_equation",EQUATION_PREVIEW:"atto_equation_preview",SUBMIT:"atto_equation_submit",LIBRARY:"atto_equation_library",LIBRARY_GROUPS:"atto_equation_groups",LIBRARY_GROUP_PREFIX:"atto_equation_group"},s={LIBRARY:"."+i.LIBRARY,LIBRARY_GROUP:"."+i.LIBRARY_GROUPS+" > div > div",EQUATION_TEXT:"."+i.EQUATION_TEXT,EQUATION_PREVIEW:"."+i.EQUATION_PREVIEW,SUBMIT:"."+i.SUBMIT,LIBRARY_BUTTON:"."+i.LIBRARY+" button"},o={START:"\\(",END:"\\)"},u={FORM:'{{{library}}}
              {{get_string "cursorinfo" component}}

              ',LIBRARY:'
              {{#each library}}
              {{#split "\n" elements}}{{/split}}
              {{/each}}
              '};e.namespace("M.atto_equation").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_lastCursorPos:0,_content:null,_sourceEquation:null,_groupFocus:null,_equationPatterns:[/\$\$([\S\s]+?)\$\$/,/\\\(([\S\s]+?)\\\)/,/\\\[([\S\s]+?)\\\]/,/\[tex\]([\S\s]+?)\[\/tex\]/],initializer:function(){this._groupFocus={},this.get("texfilteractive")&&(this.addButton({icon:"e/math",callback:this._displayDialogue}),this.get("host").on("atto:selectionchanged",function(){this._resolveEquation()?this.highlightButtons():this.unHighlightButtons()},this),this.editor.all("tex").each(function(t){var n=e.Node.create(""+o.START+" "+t.get("text")+" "+o.END+"");t.replace(n)}))},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection===!1)return;var t=this._resolveEquation(),r=this.getDialogue({headerContent:M.util.get_string("pluginname",n),focusAfterHide:!0,width:600,focusOnShowSelector:s.EQUATION_TEXT}),i=this._getDialogueContent();r.set("bodyContent",i);var o=i.one(s.LIBRARY),u=new e.TabView({srcNode:o});u.render(),r.show(),e.fire(M.core.event.FILTER_CONTENT_UPDATED,{nodes:new e.NodeList(r.get("boundingBox"))}),t&&i.one(s.EQUATION_TEXT).set("text",t),this._updatePreview(!1)},_resolveEquation:function(){var t=this.get("host").getSelectionParentNode(),n=this.get("host").getSelection(),r,i=!1;return this.get("host").isActive()?t?!n||n.length===0?!1:(this.sourceEquation=null,n=n[0],r=e.one(t).get("text"),e.Array.find(this._equationPatterns,function(t){var s=r.match(new RegExp(t.source,"g"));if(s&&s.length)return e.Array.find(s,function(e){var s=0;while(r.indexOf(e,s)!==-1){var o=r.indexOf(e,s),u=o+e.length,a=n.startOffset>=o&&n.startOffseto;if(a&&f){var l=e.match(t);if(l&&l.length){var c=r.indexOf(l[1],o),h=c+l[1].length;return i=l[1],this.sourceEquation={startOuterPosition:o,endOuterPosition:u,outerMatch:e,startInnerPosition:c,endInnerPosition:h,innerMatch:l},!0}}s=u}},this)},this),i!==!1&&(i=i.trim()),i):!1:!1},_setEquation:function(t){var n,r,i,s,u;u=this.get("host"),t.preventDefault(),this.getDialogue({focusAfterHide:null}).hide(),n=t.currentTarget.ancestor(".atto_form").one("textarea"),s=n.get("value"),s!==""&&(u.setSelection(this._currentSelection),this.sourceEquation?(r=e.one(u.getSelectionParentNode()),i=r.get("text"),s=" "+s+" ",newText=i.slice(0,this.sourceEquation.startInnerPosition)+s+i.slice(this.sourceEquation.endInnerPosition),r.set("text",newText)):(s=o.START+" "+s+" "+o.END,u.insertContentAtFocusPoint(s)),this.markUpdated())},_throttle:function(e,t){var n=null;return function(){var r=this,i=arguments;clearTimeout(n),n=setTimeout(function(){e.apply(r,i)},t)}},_updatePreview:function(t){var n=this._content.one(s.EQUATION_TEXT),r=n.get("value"),i,u=n.get("selectionStart"),a="",f="\\Downarrow ",l,c;t&&t.preventDefault(),u||(u=0);while(r.charAt(u)==="\\"&&u>=0)u-=1;l=/[a-zA-Z\{\}]/;if(u!==0)while(l.test(r.charAt(u))&&u=r.size()&&(s=0),o=r.item(s),this._setGroupTabFocus(n,o),o.focus()},_setGroupTabFocus:function(e,t){var n=e.generateID();typeof this._groupFocus[n]!="undefined"&&this._groupFocus[n].setAttribute("tabindex","-1"),this._groupFocus[n]=t,t.setAttribute("tabindex",0),e.setAttribute("aria-activedescendant",t.generateID())},_selectLibraryItem:function(e){var t=e.currentTarget.getAttribute("data-tex"),n,r,i,s=0;e.preventDefault(),this._setGroupTabFocus(e.currentTarget.get("parentNode"),e.currentTarget),i=e.currentTarget.ancestor(".atto_form").one("textarea"),n=i.get("value"),r=n.substring(0,this._lastCursorPos),r.charAt(r.length-1)!==" "&&(r+=" "),r+=t,s=r.length,n.charAt(this._lastCursorPos)!==" "&&(r+=" "),r+=n.substring(this._lastCursorPos,n.length),i.set("value",r),i.focus();var o=i.getDOMNode();if(typeof o.selectionStart=="number")o.selectionStart=o.selectionEnd=s;else if(typeof o.createTextRange!="undefined"){var u=o.createTextRange();u.moveToPoint(s),u.select()}this._updatePreview(!1)},_getLibraryContent:function(){var t=e.Handlebars.compile(u.LIBRARY),r=this.get("library"),s="";e.Handlebars.registerHelper("split",function(e,t,n){var r,i,s;if(typeof e=="undefined"||typeof t=="undefined")return"";s="",r=t.trim().split(e);while(r.length>0)i=r.shift().trim(),s+=n.fn(i);return s}),s=t({elementid:this.get("host").get("elementid"),component:n,library:r,CSS:i,DELIMITERS:o});var a=M.cfg.wwwroot+"/lib/editor/atto/plugins/equation/ajax.php",f={sesskey:M.cfg.sesskey,contextid:this.get("contextid"),action:"filtertext",text:s};return preview=e.io(a,{sync:!0,data:f,method:"POST"}),preview.status===200&&(s=preview.responseText),s}},{ATTRS:{texfilteractive:{value:!1},contextid:{value:null},library:{value:{}},texdocsurl:{value:null}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin","moodle-core-event","io","event-valuechange","tabview","array-extras"]}); +YUI.add("moodle-atto_equation-button",function(e,t){var n="atto_equation",r="atto_equation",i={EQUATION_TEXT:"atto_equation_equation",EQUATION_PREVIEW:"atto_equation_preview",SUBMIT:"atto_equation_submit",LIBRARY:"atto_equation_library",LIBRARY_GROUPS:"atto_equation_groups",LIBRARY_GROUP_PREFIX:"atto_equation_group"},s={LIBRARY:"."+i.LIBRARY,LIBRARY_GROUP:"."+i.LIBRARY_GROUPS+" > div > div",EQUATION_TEXT:"."+i.EQUATION_TEXT,EQUATION_PREVIEW:"."+i.EQUATION_PREVIEW,SUBMIT:"."+i.SUBMIT,LIBRARY_BUTTON:"."+i.LIBRARY+" button"},o={START:"\\(",END:"\\)"},u={FORM:'
              {{{library}}}
              {{get_string "cursorinfo" component}}

              ',LIBRARY:'
              {{#each library}}
              {{#split "\n" elements}}{{/split}}
              {{/each}}
              '};e.namespace("M.atto_equation").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_lastCursorPos:0,_content:null,_sourceEquation:null,_groupFocus:null,_equationPatterns:[/\$\$([\S\s]+?)\$\$/,/\\\(([\S\s]+?)\\\)/,/\\\[([\S\s]+?)\\\]/,/\[tex\]([\S\s]+?)\[\/tex\]/],initializer:function(){this._groupFocus={},this.get("texfilteractive")&&(this.addButton({icon:"e/math",callback:this._displayDialogue}),this.get("host").on("atto:selectionchanged",function(){this._resolveEquation()?this.highlightButtons():this.unHighlightButtons()},this),this.editor.all("tex").each(function(t){var n=e.Node.create(""+o.START+" "+t.get("text")+" "+o.END+"");t.replace(n)}))},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection===!1)return;var t=this._resolveEquation(),r=this.getDialogue({headerContent:M.util.get_string("pluginname",n),focusAfterHide:!0,width:600,focusOnShowSelector:s.EQUATION_TEXT}),i=this._getDialogueContent();r.set("bodyContent",i);var o=i.one(s.LIBRARY),u=new e.TabView({srcNode:o});u.render(),r.show(),e.fire(M.core.event.FILTER_CONTENT_UPDATED,{nodes:new e.NodeList(r.get("boundingBox"))}),t&&i.one(s.EQUATION_TEXT).set("text",t),this._updatePreview(!1)},_resolveEquation:function(){var t=this.get("host").getSelectionParentNode(),n=this.get("host").getSelection(),r,i=!1;return this.get("host").isActive()?t?!n||n.length===0?!1:(this.sourceEquation=null,n=n[0],r=e.one(t).get("text"),e.Array.find(this._equationPatterns,function(t){var s=r.match(new RegExp(t.source,"g"));if(s&&s.length)return e.Array.find(s,function(e){var s=0;while(r.indexOf(e,s)!==-1){var o=r.indexOf(e,s),u=o+e.length,a=n.startOffset>=o&&n.startOffseto;if(a&&f){var l=e.match(t);if(l&&l.length){var c=r.indexOf(l[1],o),h=c+l[1].length;return i=l[1],this.sourceEquation={startOuterPosition:o,endOuterPosition:u,outerMatch:e,startInnerPosition:c,endInnerPosition:h,innerMatch:l},!0}}s=u}},this)},this),i!==!1&&(i=i.trim()),i):!1:!1},_setEquation:function(t){var n,r,i,s,u,a;u=this.get("host"),t.preventDefault(),this.getDialogue({focusAfterHide:null}).hide(),n=t.currentTarget.ancestor(".atto_form").one("textarea"),s=n.get("value"),s!==""&&(u.setSelection(this._currentSelection),this.sourceEquation?(r=e.one(u.getSelectionParentNode()),i=r.get("text"),s=" "+s+" ",a=i.slice(0,this.sourceEquation.startInnerPosition)+s+i.slice(this.sourceEquation.endInnerPosition),r.set("text",a)):(s=o.START+" "+s+" "+o.END,u.insertContentAtFocusPoint(s)),this.markUpdated())},_throttle:function(e,t){var n=null;return function(){var r=this,i=arguments;clearTimeout(n),n=setTimeout(function(){e.apply(r,i)},t)}},_updatePreview:function(t){var n=this._content.one(s.EQUATION_TEXT),r=n.get("value"),i,u=n.get("selectionStart"),a="",f="\\Downarrow ",l,c;t&&t.preventDefault(),u||(u=0);while(r.charAt(u)==="\\"&&u>=0)u-=1;l=/[a-zA-Z\{\}]/;if(u!==0)while(l.test(r.charAt(u))&&u=r.size()&&(s=0),o=r.item(s),this._setGroupTabFocus(n,o),o.focus()},_setGroupTabFocus:function(e,t){var n=e.generateID();typeof this._groupFocus[n]!="undefined"&&this._groupFocus[n].setAttribute("tabindex","-1"),this._groupFocus[n]=t,t.setAttribute("tabindex",0),e.setAttribute("aria-activedescendant",t.generateID())},_selectLibraryItem:function(e){var t=e.currentTarget.getAttribute("data-tex"),n,r,i,s=0;e.preventDefault(),this._setGroupTabFocus(e.currentTarget.get("parentNode"),e.currentTarget),i=e.currentTarget.ancestor(".atto_form").one("textarea"),n=i.get("value"),r=n.substring(0,this._lastCursorPos),r.charAt(r.length-1)!==" "&&(r+=" "),r+=t,s=r.length,n.charAt(this._lastCursorPos)!==" "&&(r+=" "),r+=n.substring(this._lastCursorPos,n.length),i.set("value",r),i.focus();var o=i.getDOMNode();if(typeof o.selectionStart=="number")o.selectionStart=o.selectionEnd=s;else if(typeof o.createTextRange!="undefined"){var u=o.createTextRange();u.moveToPoint(s),u.select()}this._updatePreview(!1)},_getLibraryContent:function(){var t=e.Handlebars.compile(u.LIBRARY),r=this.get("library"),s="";e.Handlebars.registerHelper("split",function(e,t,n){var r,i,s;if(typeof e=="undefined"||typeof t=="undefined")return"";s="",r=t.trim().split(e);while(r.length>0)i=r.shift().trim(),s+=n.fn(i);return s}),s=t({elementid:this.get("host").get("elementid"),component:n,library:r,CSS:i,DELIMITERS:o});var a=M.cfg.wwwroot+"/lib/editor/atto/plugins/equation/ajax.php",f={sesskey:M.cfg.sesskey,contextid:this.get("contextid"),action:"filtertext",text:s},l=e.io(a,{sync:!0,data:f,method:"POST"});return l.status===200&&(s=l.responseText),s}},{ATTRS:{texfilteractive:{value:!1},contextid:{value:null},library:{value:{}},texdocsurl:{value:null}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin","moodle-core-event","io","event-valuechange","tabview","array-extras"]}); diff --git a/lib/editor/atto/plugins/equation/yui/build/moodle-atto_equation-button/moodle-atto_equation-button.js b/lib/editor/atto/plugins/equation/yui/build/moodle-atto_equation-button/moodle-atto_equation-button.js index 26334a11d2f..0350ece5cb9 100644 --- a/lib/editor/atto/plugins/equation/yui/build/moodle-atto_equation-button/moodle-atto_equation-button.js +++ b/lib/editor/atto/plugins/equation/yui/build/moodle-atto_equation-button/moodle-atto_equation-button.js @@ -60,9 +60,11 @@ var COMPONENTNAME = 'atto_equation', '
              ' + '{{{library}}}' + '' + - '
              ' + + '
              ' + '' + - '
              ' + + '
              ' + '
              {{get_string "cursorinfo" component}}
              ' + '
              ' + '
              ' + @@ -186,7 +188,9 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto. // We need to convert these to a non dom node based format. this.editor.all('tex').each(function (texNode) { - var replacement = Y.Node.create('' + DELIMITERS.START + ' ' + texNode.get('text') + ' ' + DELIMITERS.END + ''); + var replacement = Y.Node.create('' + + DELIMITERS.START + ' ' + texNode.get('text') + ' ' + DELIMITERS.END + + ''); texNode.replace(replacement); }); } @@ -273,7 +277,8 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto. text = Y.one(selectedNode).get('text'); - // For each of these patterns we have a RegExp which captures the inner component of the equation but also includes the delimiters. + // For each of these patterns we have a RegExp which captures the inner component of the equation but also + // includes the delimiters. // We first run the RegExp adding the global flag ("g"). This ignores the capture, instead matching the entire // equation including delimiters and returning one entry per match of the whole equation. // We have to deal with multiple occurences of the same equation in a String so must be able to loop on the @@ -353,7 +358,8 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto. selectedNode, text, value, - host; + host, + newText; host = this.get('host'); @@ -446,7 +452,9 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto. isChar = /[a-zA-Z\{\}]/; if (currentPos !== 0) { // Now match to the end of the line. - while (isChar.test(equation.charAt(currentPos)) && currentPos < equation.length && isChar.test(equation.charAt(currentPos-1))) { + while (isChar.test(equation.charAt(currentPos)) && + currentPos < equation.length && + isChar.test(equation.charAt(currentPos-1))) { currentPos += 1; } } @@ -686,7 +694,7 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto. text: content }; - preview = Y.io(url, { + var preview = Y.io(url, { sync: true, data: params, method: 'POST' diff --git a/lib/editor/atto/plugins/equation/yui/src/button/js/button.js b/lib/editor/atto/plugins/equation/yui/src/button/js/button.js index 3ad02e955ed..864f4213391 100644 --- a/lib/editor/atto/plugins/equation/yui/src/button/js/button.js +++ b/lib/editor/atto/plugins/equation/yui/src/button/js/button.js @@ -58,9 +58,11 @@ var COMPONENTNAME = 'atto_equation', '' + '{{{library}}}' + '' + - '
              ' + + '
              ' + '' + - '
              ' + + '
              ' + '
              {{get_string "cursorinfo" component}}
              ' + '
              ' + '
              ' + @@ -184,7 +186,9 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto. // We need to convert these to a non dom node based format. this.editor.all('tex').each(function (texNode) { - var replacement = Y.Node.create('' + DELIMITERS.START + ' ' + texNode.get('text') + ' ' + DELIMITERS.END + ''); + var replacement = Y.Node.create('' + + DELIMITERS.START + ' ' + texNode.get('text') + ' ' + DELIMITERS.END + + ''); texNode.replace(replacement); }); } @@ -271,7 +275,8 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto. text = Y.one(selectedNode).get('text'); - // For each of these patterns we have a RegExp which captures the inner component of the equation but also includes the delimiters. + // For each of these patterns we have a RegExp which captures the inner component of the equation but also + // includes the delimiters. // We first run the RegExp adding the global flag ("g"). This ignores the capture, instead matching the entire // equation including delimiters and returning one entry per match of the whole equation. // We have to deal with multiple occurences of the same equation in a String so must be able to loop on the @@ -351,7 +356,8 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto. selectedNode, text, value, - host; + host, + newText; host = this.get('host'); @@ -444,7 +450,9 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto. isChar = /[a-zA-Z\{\}]/; if (currentPos !== 0) { // Now match to the end of the line. - while (isChar.test(equation.charAt(currentPos)) && currentPos < equation.length && isChar.test(equation.charAt(currentPos-1))) { + while (isChar.test(equation.charAt(currentPos)) && + currentPos < equation.length && + isChar.test(equation.charAt(currentPos-1))) { currentPos += 1; } } @@ -686,7 +694,7 @@ Y.namespace('M.atto_equation').Button = Y.Base.create('button', Y.M.editor_atto. text: content }; - preview = Y.io(url, { + var preview = Y.io(url, { sync: true, data: params, method: 'POST' diff --git a/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-debug.js b/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-debug.js index dc3a0256bb5..3ecc45ef926 100644 --- a/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-debug.js +++ b/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-debug.js @@ -118,7 +118,9 @@ var CSS = { // Add the presentation select box. '' + - '' + + '' + '
              ' + // Add the size entry boxes. @@ -236,7 +238,8 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi e = e._event; // Only handle the event if an image file was dropped in. - if (e.dataTransfer && e.dataTransfer.files && e.dataTransfer.files.length && /^image\//.test(e.dataTransfer.files[0].type)) { + var handlesDataTransfer = (e.dataTransfer && e.dataTransfer.files && e.dataTransfer.files.length); + if (handlesDataTransfer && /^image\//.test(e.dataTransfer.files[0].type)) { var options = host.get('filepickeroptions').image, savepath = (options.savepath === undefined) ? '/' : options.savepath, @@ -319,7 +322,9 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi self.markUpdated(); } } else { - alert(M.util.get_string('servererror', 'moodle')); + Y.use('moodle-core-notification-alert', function() { + new M.core.alert({message: M.util.get_string('servererror', 'moodle')}); + }); if (placeholder) { placeholder.remove(true); } @@ -634,7 +639,8 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi _applyImageProperties: function(form) { var properties = this._getSelectedImageProperties(), img = form.one('.' + CSS.IMAGEPREVIEW), - i; + i, + css; if (properties === false) { img.setStyle('display', 'none'); @@ -702,7 +708,13 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi // Get the current selection. images = this.get('host').getSelectedNodes(), - i, width, height, style, css; + i, + width, + height, + style, + css, + image, + margin; if (images) { images = images.filter('img'); @@ -790,6 +802,7 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi imagehtml, customstyle = '', i, + css, classlist = [], host = this.get('host'); @@ -834,7 +847,7 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi return; } - template = Y.Handlebars.compile(IMAGETEMPLATE); + var template = Y.Handlebars.compile(IMAGETEMPLATE); imagehtml = template({ url: url, alt: alt, diff --git a/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-min.js b/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-min.js index 0c40a566538..76f927331d6 100644 --- a/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-min.js +++ b/lib/editor/atto/plugins/image/yui/build/moodle-atto_image-button/moodle-atto_image-button-min.js @@ -1,3 +1,3 @@ -YUI.add("moodle-atto_image-button",function(e,t){var n={RESPONSIVE:"img-responsive",INPUTALIGNMENT:"atto_image_alignment",INPUTALT:"atto_image_altentry",INPUTHEIGHT:"atto_image_heightentry",INPUTSUBMIT:"atto_image_urlentrysubmit",INPUTURL:"atto_image_urlentry",INPUTSIZE:"atto_image_size",INPUTWIDTH:"atto_image_widthentry",IMAGEALTWARNING:"atto_image_altwarning",IMAGEBROWSER:"openimagebrowser",IMAGEPRESENTATION:"atto_image_presentation",INPUTCONSTRAIN:"atto_image_constrain",INPUTCUSTOMSTYLE:"atto_image_customstyle",IMAGEPREVIEW:"atto_image_preview",IMAGEPREVIEWBOX:"atto_image_preview_box"},r={INPUTURL:"."+n.INPUTURL},i=[{name:"text-top",str:"alignment_top",value:"vertical-align",margin:"0 .5em"},{name:"middle",str:"alignment_middle",value:"vertical-align",margin:"0 .5em"},{name:"text-bottom",str:"alignment_bottom",value:"vertical-align",margin:"0 .5em",isDefault:!0},{name:"left",str:"alignment_left",value:"float",margin:"0 .5em 0 0"},{name:"right",str:"alignment_right",value:"float",margin:"0 0 0 .5em"},{name:"customstyle",str:"customstyle",value:"style"}],s={ISPERCENT:/\d+%/},o="atto_image",u='
              {{#if showFilepicker}}{{/if}}

              x

              ',a='{{alt}}';e.namespace("M.atto_image").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_selectedImage:null,_form:null,_rawImageDimensions:null,initializer:function(){this.addButton({icon:"e/insert_edit_image",callback:this._displayDialogue,tags:"img",tagMatchRequiresAll:!1}),this.editor.delegate("dblclick",this._displayDialogue,"img",this),this.editor.delegate("click",this._handleClick,"img",this),this.editor.on("drop",this._handleDragDrop,this)},_handleDragDrop:function(t){var n=this,r=this.get("host"),i=e.Handlebars.compile(a);r.saveSelection(),t=t._event;if(t.dataTransfer&&t.dataTransfer.files&&t.dataTransfer.files.length&&/^image\//.test(t.dataTransfer.files[0].type)){var s=r.get("filepickeroptions").image,u=s.savepath===undefined?"/":s.savepath,f=new FormData,l=0,c="",h=new XMLHttpRequest,p="",d=Object.keys(s.repositories);t.preventDefault(),t.stopPropagation(),f.append("repo_upload_file",t.dataTransfer.files[0]),f.append("itemid",s.itemid);for(var v=0;v
              {{#if showFilepicker}}{{/if}}

              x

              ',a='{{alt}}';e.namespace("M.atto_image").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_selectedImage:null,_form:null,_rawImageDimensions:null,initializer:function(){this.addButton({icon:"e/insert_edit_image",callback:this._displayDialogue,tags:"img",tagMatchRequiresAll:!1}),this.editor.delegate("dblclick",this._displayDialogue,"img",this),this.editor.delegate("click",this._handleClick,"img",this),this.editor.on("drop",this._handleDragDrop,this)},_handleDragDrop:function(t){var n=this,r=this.get("host"),i=e.Handlebars.compile(a);r.saveSelection(),t=t._event;var s=t.dataTransfer&&t.dataTransfer.files&&t.dataTransfer.files.length;if(s&&/^image\//.test(t.dataTransfer.files[0].type)){var u=r.get("filepickeroptions").image,f=u.savepath===undefined?"/":u.savepath,l=new FormData,c=0,h="",p=new XMLHttpRequest,d="",v=Object.keys(u.repositories);t.preventDefault(),t.stopPropagation(),l.append("repo_upload_file",t.dataTransfer.files[0]),l.append("itemid",u.itemid);for(var m=0;m' + - '' + + '' + '
              ' + // Add the size entry boxes. @@ -236,7 +238,8 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi e = e._event; // Only handle the event if an image file was dropped in. - if (e.dataTransfer && e.dataTransfer.files && e.dataTransfer.files.length && /^image\//.test(e.dataTransfer.files[0].type)) { + var handlesDataTransfer = (e.dataTransfer && e.dataTransfer.files && e.dataTransfer.files.length); + if (handlesDataTransfer && /^image\//.test(e.dataTransfer.files[0].type)) { var options = host.get('filepickeroptions').image, savepath = (options.savepath === undefined) ? '/' : options.savepath, @@ -319,7 +322,9 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi self.markUpdated(); } } else { - alert(M.util.get_string('servererror', 'moodle')); + Y.use('moodle-core-notification-alert', function() { + new M.core.alert({message: M.util.get_string('servererror', 'moodle')}); + }); if (placeholder) { placeholder.remove(true); } @@ -634,7 +639,8 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi _applyImageProperties: function(form) { var properties = this._getSelectedImageProperties(), img = form.one('.' + CSS.IMAGEPREVIEW), - i; + i, + css; if (properties === false) { img.setStyle('display', 'none'); @@ -702,7 +708,13 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi // Get the current selection. images = this.get('host').getSelectedNodes(), - i, width, height, style, css; + i, + width, + height, + style, + css, + image, + margin; if (images) { images = images.filter('img'); @@ -790,6 +802,7 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi imagehtml, customstyle = '', i, + css, classlist = [], host = this.get('host'); @@ -834,7 +847,7 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi return; } - template = Y.Handlebars.compile(IMAGETEMPLATE); + var template = Y.Handlebars.compile(IMAGETEMPLATE); imagehtml = template({ url: url, alt: alt, diff --git a/lib/editor/atto/plugins/image/yui/src/button/js/button.js b/lib/editor/atto/plugins/image/yui/src/button/js/button.js index 3f0b620ccc2..379c26d4049 100644 --- a/lib/editor/atto/plugins/image/yui/src/button/js/button.js +++ b/lib/editor/atto/plugins/image/yui/src/button/js/button.js @@ -116,7 +116,9 @@ var CSS = { // Add the presentation select box. '' + - '' + + '' + '
              ' + // Add the size entry boxes. @@ -234,7 +236,8 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi e = e._event; // Only handle the event if an image file was dropped in. - if (e.dataTransfer && e.dataTransfer.files && e.dataTransfer.files.length && /^image\//.test(e.dataTransfer.files[0].type)) { + var handlesDataTransfer = (e.dataTransfer && e.dataTransfer.files && e.dataTransfer.files.length); + if (handlesDataTransfer && /^image\//.test(e.dataTransfer.files[0].type)) { var options = host.get('filepickeroptions').image, savepath = (options.savepath === undefined) ? '/' : options.savepath, @@ -317,7 +320,9 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi self.markUpdated(); } } else { - alert(M.util.get_string('servererror', 'moodle')); + Y.use('moodle-core-notification-alert', function() { + new M.core.alert({message: M.util.get_string('servererror', 'moodle')}); + }); if (placeholder) { placeholder.remove(true); } @@ -632,7 +637,8 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi _applyImageProperties: function(form) { var properties = this._getSelectedImageProperties(), img = form.one('.' + CSS.IMAGEPREVIEW), - i; + i, + css; if (properties === false) { img.setStyle('display', 'none'); @@ -700,7 +706,13 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi // Get the current selection. images = this.get('host').getSelectedNodes(), - i, width, height, style, css; + i, + width, + height, + style, + css, + image, + margin; if (images) { images = images.filter('img'); @@ -788,6 +800,7 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi imagehtml, customstyle = '', i, + css, classlist = [], host = this.get('host'); @@ -832,7 +845,7 @@ Y.namespace('M.atto_image').Button = Y.Base.create('button', Y.M.editor_atto.Edi return; } - template = Y.Handlebars.compile(IMAGETEMPLATE); + var template = Y.Handlebars.compile(IMAGETEMPLATE); imagehtml = template({ url: url, alt: alt, diff --git a/lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button-debug.js b/lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button-debug.js index dee99ad72a9..2b494ec2265 100644 --- a/lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button-debug.js +++ b/lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button-debug.js @@ -58,7 +58,7 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed */ indent: function() { // Save the current selection - we want to restore this. - var selection = rangy.saveSelection(), + var selection = window.rangy.saveSelection(), blockquotes = this.editor.all('blockquote'), count = blockquotes.size(); @@ -80,14 +80,14 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed // We don't want blockquotes, we're going to convert them to divs. this.replaceBlockquote(this.editor); // Finally restore the seelction. The content has changed - sometimes this works - but not always :( - rangy.restoreSelection(selection); + window.rangy.restoreSelection(selection); } else if (blockquotes.size() > 0) { // There were no new blockquotes, this happens if the user is indenting/outdenting a list. blockquotes.removeClass('pre-existing'); } // Remove the selection markers - a clean up really. - rangy.removeMarkers(selection); + window.rangy.removeMarkers(selection); // Mark the text as having been updated. this.markUpdated(); @@ -100,7 +100,7 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed */ outdent: function() { // Save the selection we will want to restore it. - var selection = rangy.saveSelection(), + var selection = window.rangy.saveSelection(), blockquotes = this.editor.all('blockquote'), count = blockquotes.size(); @@ -111,9 +111,9 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed this.replaceEditorIndents(this.editor); // Restore the users selection - otherwise the next outdent operation won't work! - rangy.restoreSelection(selection); + window.rangy.restoreSelection(selection); // And save it once more. - selection = rangy.saveSelection(); + selection = window.rangy.saveSelection(); // Outdent. document.execCommand('outdent', false, null); @@ -125,7 +125,7 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed // The number of blockquotes hasn't changed. // This occurs when the user has outdented a list item. this.replaceBlockquote(this.editor); - rangy.restoreSelection(selection); + window.rangy.restoreSelection(selection); } else if (blockquotes.size() > 0) { // The number of blockquotes is the same and is more than 0 we just need to clean up the class // we added to mark pre-existing blockquotes. @@ -133,7 +133,7 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed } // Clean up any left over selection markers. - rangy.removeMarkers(selection); + window.rangy.removeMarkers(selection); // Mark the text as having been updated. this.markUpdated(); @@ -153,7 +153,10 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed if (blockquote.hasClass('pre-existing')) { blockquote.removeClass('pre-existing'); } else { - var clone = Y.Node.create('
              ').setAttrs(blockquote.getAttrs()).setStyle(margindir, '30px').addClass('editor-indent'); + var clone = Y.Node.create('
              ') + .setAttrs(blockquote.getAttrs()) + .setStyle(margindir, '30px') + .addClass('editor-indent'); // We use childNodes here because we are interested in both type 1 and 3 child nodes. var children = blockquote.getDOMNode().childNodes, child; child = children[0]; @@ -176,7 +179,10 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed // We use the editor-indent class because it is preserved between saves. var indent = editor.one('.editor-indent'); while (indent) { - var clone = Y.Node.create('
              ').setAttrs(indent.getAttrs()).removeClass('editor-indent'); + var clone = Y.Node.create('
              ') + .setAttrs(indent + .getAttrs()) + .removeClass('editor-indent'); // We use childNodes here because we are interested in both type 1 and 3 child nodes. var children = indent.getDOMNode().childNodes, child; child = children[0]; diff --git a/lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button-min.js b/lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button-min.js index 1ac739b9655..74a343f9396 100644 --- a/lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button-min.js +++ b/lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button-min.js @@ -1 +1 @@ -YUI.add("moodle-atto_indent-button",function(e,t){e.namespace("M.atto_indent").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{initializer:function(){this.addButton({icon:"e/decrease_indent",title:"outdent",buttonName:"outdent",callback:this.outdent}),this.addButton({icon:"e/increase_indent",title:"indent",buttonName:"indent",callback:this.indent})},indent:function(){var e=rangy.saveSelection(),t=this.editor.all("blockquote"),n=t.size();this.editor.all(".rangySelectionBoundary").setStyle("display",null),t.addClass("pre-existing"),document.execCommand("indent",!1,null),t=this.editor.all("blockquote"),t.size()!==n?(this.replaceBlockquote(this.editor),rangy.restoreSelection(e)):t.size()>0&&t.removeClass("pre-existing"),rangy.removeMarkers(e),this.markUpdated()},outdent:function(){var e=rangy.saveSelection(),t=this.editor.all("blockquote"),n=t.size();t.addClass("pre-existing"),this.replaceEditorIndents(this.editor),rangy.restoreSelection(e),e=rangy.saveSelection(),document.execCommand("outdent",!1,null),t=this.editor.all("blockquote"),t.size()!==n?(this.replaceBlockquote(this.editor),rangy.restoreSelection(e)):t.size()>0&&t.removeClass("pre-existing"),rangy.removeMarkers(e),this.markUpdated()},replaceBlockquote:function(t){t.all("blockquote").setAttribute("data-iterate",!0);var n=t.one("blockquote"),r=e.one("body.dir-ltr")?"marginLeft":"marginRight";while(n){n.removeAttribute("data-iterate");if(n.hasClass("pre-existing"))n.removeClass("pre-existing");else{var i=e.Node.create("
              ").setAttrs(n.getAttrs()).setStyle(r,"30px").addClass("editor-indent"),s=n.getDOMNode().childNodes,o;o=s[0];while(typeof o!="undefined")i.append(o),o=s[0];n.replace(i)}n=t.one("blockquote[data-iterate]")}},replaceEditorIndents:function(t){var n=t.one(".editor-indent");while(n){var r=e.Node.create("
              ").setAttrs(n.getAttrs()).removeClass("editor-indent"),i=n.getDOMNode().childNodes,s;s=i[0];while(typeof s!="undefined")r.append(s),s=i[0];n.replace(r),n=t.one(".editor-indent")}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]}); +YUI.add("moodle-atto_indent-button",function(e,t){e.namespace("M.atto_indent").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{initializer:function(){this.addButton({icon:"e/decrease_indent",title:"outdent",buttonName:"outdent",callback:this.outdent}),this.addButton({icon:"e/increase_indent",title:"indent",buttonName:"indent",callback:this.indent})},indent:function(){var e=window.rangy.saveSelection(),t=this.editor.all("blockquote"),n=t.size();this.editor.all(".rangySelectionBoundary").setStyle("display",null),t.addClass("pre-existing"),document.execCommand("indent",!1,null),t=this.editor.all("blockquote"),t.size()!==n?(this.replaceBlockquote(this.editor),window.rangy.restoreSelection(e)):t.size()>0&&t.removeClass("pre-existing"),window.rangy.removeMarkers(e),this.markUpdated()},outdent:function(){var e=window.rangy.saveSelection(),t=this.editor.all("blockquote"),n=t.size();t.addClass("pre-existing"),this.replaceEditorIndents(this.editor),window.rangy.restoreSelection(e),e=window.rangy.saveSelection(),document.execCommand("outdent",!1,null),t=this.editor.all("blockquote"),t.size()!==n?(this.replaceBlockquote(this.editor),window.rangy.restoreSelection(e)):t.size()>0&&t.removeClass("pre-existing"),window.rangy.removeMarkers(e),this.markUpdated()},replaceBlockquote:function(t){t.all("blockquote").setAttribute("data-iterate",!0);var n=t.one("blockquote"),r=e.one("body.dir-ltr")?"marginLeft":"marginRight";while(n){n.removeAttribute("data-iterate");if(n.hasClass("pre-existing"))n.removeClass("pre-existing");else{var i=e.Node.create("
              ").setAttrs(n.getAttrs()).setStyle(r,"30px").addClass("editor-indent"),s=n.getDOMNode().childNodes,o;o=s[0];while(typeof o!="undefined")i.append(o),o=s[0];n.replace(i)}n=t.one("blockquote[data-iterate]")}},replaceEditorIndents:function(t){var n=t.one(".editor-indent");while(n){var r=e.Node.create("
              ").setAttrs(n.getAttrs()).removeClass("editor-indent"),i=n.getDOMNode().childNodes,s;s=i[0];while(typeof s!="undefined")r.append(s),s=i[0];n.replace(r),n=t.one(".editor-indent")}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]}); diff --git a/lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button.js b/lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button.js index dee99ad72a9..2b494ec2265 100644 --- a/lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button.js +++ b/lib/editor/atto/plugins/indent/yui/build/moodle-atto_indent-button/moodle-atto_indent-button.js @@ -58,7 +58,7 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed */ indent: function() { // Save the current selection - we want to restore this. - var selection = rangy.saveSelection(), + var selection = window.rangy.saveSelection(), blockquotes = this.editor.all('blockquote'), count = blockquotes.size(); @@ -80,14 +80,14 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed // We don't want blockquotes, we're going to convert them to divs. this.replaceBlockquote(this.editor); // Finally restore the seelction. The content has changed - sometimes this works - but not always :( - rangy.restoreSelection(selection); + window.rangy.restoreSelection(selection); } else if (blockquotes.size() > 0) { // There were no new blockquotes, this happens if the user is indenting/outdenting a list. blockquotes.removeClass('pre-existing'); } // Remove the selection markers - a clean up really. - rangy.removeMarkers(selection); + window.rangy.removeMarkers(selection); // Mark the text as having been updated. this.markUpdated(); @@ -100,7 +100,7 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed */ outdent: function() { // Save the selection we will want to restore it. - var selection = rangy.saveSelection(), + var selection = window.rangy.saveSelection(), blockquotes = this.editor.all('blockquote'), count = blockquotes.size(); @@ -111,9 +111,9 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed this.replaceEditorIndents(this.editor); // Restore the users selection - otherwise the next outdent operation won't work! - rangy.restoreSelection(selection); + window.rangy.restoreSelection(selection); // And save it once more. - selection = rangy.saveSelection(); + selection = window.rangy.saveSelection(); // Outdent. document.execCommand('outdent', false, null); @@ -125,7 +125,7 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed // The number of blockquotes hasn't changed. // This occurs when the user has outdented a list item. this.replaceBlockquote(this.editor); - rangy.restoreSelection(selection); + window.rangy.restoreSelection(selection); } else if (blockquotes.size() > 0) { // The number of blockquotes is the same and is more than 0 we just need to clean up the class // we added to mark pre-existing blockquotes. @@ -133,7 +133,7 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed } // Clean up any left over selection markers. - rangy.removeMarkers(selection); + window.rangy.removeMarkers(selection); // Mark the text as having been updated. this.markUpdated(); @@ -153,7 +153,10 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed if (blockquote.hasClass('pre-existing')) { blockquote.removeClass('pre-existing'); } else { - var clone = Y.Node.create('
              ').setAttrs(blockquote.getAttrs()).setStyle(margindir, '30px').addClass('editor-indent'); + var clone = Y.Node.create('
              ') + .setAttrs(blockquote.getAttrs()) + .setStyle(margindir, '30px') + .addClass('editor-indent'); // We use childNodes here because we are interested in both type 1 and 3 child nodes. var children = blockquote.getDOMNode().childNodes, child; child = children[0]; @@ -176,7 +179,10 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed // We use the editor-indent class because it is preserved between saves. var indent = editor.one('.editor-indent'); while (indent) { - var clone = Y.Node.create('
              ').setAttrs(indent.getAttrs()).removeClass('editor-indent'); + var clone = Y.Node.create('
              ') + .setAttrs(indent + .getAttrs()) + .removeClass('editor-indent'); // We use childNodes here because we are interested in both type 1 and 3 child nodes. var children = indent.getDOMNode().childNodes, child; child = children[0]; diff --git a/lib/editor/atto/plugins/indent/yui/src/button/js/button.js b/lib/editor/atto/plugins/indent/yui/src/button/js/button.js index fefc615f73d..ee49a6a7c09 100644 --- a/lib/editor/atto/plugins/indent/yui/src/button/js/button.js +++ b/lib/editor/atto/plugins/indent/yui/src/button/js/button.js @@ -56,7 +56,7 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed */ indent: function() { // Save the current selection - we want to restore this. - var selection = rangy.saveSelection(), + var selection = window.rangy.saveSelection(), blockquotes = this.editor.all('blockquote'), count = blockquotes.size(); @@ -78,14 +78,14 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed // We don't want blockquotes, we're going to convert them to divs. this.replaceBlockquote(this.editor); // Finally restore the seelction. The content has changed - sometimes this works - but not always :( - rangy.restoreSelection(selection); + window.rangy.restoreSelection(selection); } else if (blockquotes.size() > 0) { // There were no new blockquotes, this happens if the user is indenting/outdenting a list. blockquotes.removeClass('pre-existing'); } // Remove the selection markers - a clean up really. - rangy.removeMarkers(selection); + window.rangy.removeMarkers(selection); // Mark the text as having been updated. this.markUpdated(); @@ -98,7 +98,7 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed */ outdent: function() { // Save the selection we will want to restore it. - var selection = rangy.saveSelection(), + var selection = window.rangy.saveSelection(), blockquotes = this.editor.all('blockquote'), count = blockquotes.size(); @@ -109,9 +109,9 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed this.replaceEditorIndents(this.editor); // Restore the users selection - otherwise the next outdent operation won't work! - rangy.restoreSelection(selection); + window.rangy.restoreSelection(selection); // And save it once more. - selection = rangy.saveSelection(); + selection = window.rangy.saveSelection(); // Outdent. document.execCommand('outdent', false, null); @@ -123,7 +123,7 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed // The number of blockquotes hasn't changed. // This occurs when the user has outdented a list item. this.replaceBlockquote(this.editor); - rangy.restoreSelection(selection); + window.rangy.restoreSelection(selection); } else if (blockquotes.size() > 0) { // The number of blockquotes is the same and is more than 0 we just need to clean up the class // we added to mark pre-existing blockquotes. @@ -131,7 +131,7 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed } // Clean up any left over selection markers. - rangy.removeMarkers(selection); + window.rangy.removeMarkers(selection); // Mark the text as having been updated. this.markUpdated(); @@ -151,7 +151,10 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed if (blockquote.hasClass('pre-existing')) { blockquote.removeClass('pre-existing'); } else { - var clone = Y.Node.create('
              ').setAttrs(blockquote.getAttrs()).setStyle(margindir, '30px').addClass('editor-indent'); + var clone = Y.Node.create('
              ') + .setAttrs(blockquote.getAttrs()) + .setStyle(margindir, '30px') + .addClass('editor-indent'); // We use childNodes here because we are interested in both type 1 and 3 child nodes. var children = blockquote.getDOMNode().childNodes, child; child = children[0]; @@ -174,7 +177,10 @@ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.Ed // We use the editor-indent class because it is preserved between saves. var indent = editor.one('.editor-indent'); while (indent) { - var clone = Y.Node.create('
              ').setAttrs(indent.getAttrs()).removeClass('editor-indent'); + var clone = Y.Node.create('
              ') + .setAttrs(indent + .getAttrs()) + .removeClass('editor-indent'); // We use childNodes here because we are interested in both type 1 and 3 child nodes. var children = indent.getDOMNode().childNodes, child; child = children[0]; diff --git a/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-usedfiles/moodle-atto_managefiles-usedfiles-debug.js b/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-usedfiles/moodle-atto_managefiles-usedfiles-debug.js index 91cdb172420..3aa81be7e28 100644 --- a/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-usedfiles/moodle-atto_managefiles-usedfiles-debug.js +++ b/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-usedfiles/moodle-atto_managefiles-usedfiles-debug.js @@ -98,6 +98,8 @@ M.atto_managefiles.usedfiles = M.atto_managefiles.usedfiles || { var allFiles = config.files; var form = Y.one(SELECTORS.FORM), usedFiles, + unusedFiles, + missingFiles, missingFilesTxt, i; diff --git a/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-usedfiles/moodle-atto_managefiles-usedfiles-min.js b/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-usedfiles/moodle-atto_managefiles-usedfiles-min.js index 016fc2ce8a6..0fd70332765 100644 --- a/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-usedfiles/moodle-atto_managefiles-usedfiles-min.js +++ b/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-usedfiles/moodle-atto_managefiles-usedfiles-min.js @@ -1 +1 @@ -YUI.add("moodle-atto_managefiles-usedfiles",function(e,t){var n={HASMISSINGFILES:"has-missing-files",HASUNUSEDFILES:"has-unused-files"},r={FILEANCESTOR:".fitem_fcheckbox",FORM:"#atto_managefiles_manageform",MISSINGFILES:".missing-files"};M.atto_managefiles=M.atto_managefiles||{},M.atto_managefiles.usedfiles=M.atto_managefiles.usedfiles||{_usercontext:null,_itemid:null,_elementid:null,init:function(t){this._usercontext=t.usercontext,this._itemid=t.itemid,this._elementid=t.elementid;var i=t.files,s=e.one(r.FORM),o,u,a;if(!s||!window.parent)return;o=this._getUsedFiles(),unusedFiles=this.findUnusedFiles(i,o),missingFiles=this.findMissingFiles(i,o),unusedFiles.length>0?(s.all('input[type=checkbox][name^="deletefile"]').each(function(t){e.Array.indexOf(unusedFiles,t.getData("filename"))===-1&&t.ancestor(r.FILEANCESTOR).remove()}),s.addClass(n.HASUNUSEDFILES)):s.removeClass(n.HASUNUSEDFILES);if(missingFiles.length>0){u="
                ";for(a=0;a"+e.Escape.html(missingFiles[a])+"";u+="
              ",s.one(r.MISSINGFILES).setHTML("").append(u),s.addClass(n.HASMISSINGFILES)}else s.removeClass(n.HASMISSINGFILES)},_getUsedFiles:function(){var t=e.one(window.parent.document.getElementById(this._elementid+"editable")),n=M.cfg.wwwroot+"/draftfile.php/"+this._usercontext+"/user/draft/"+this._itemid+"/",r=new RegExp(n.replace(/[\-\/\\\^$*+?.()|\[\]{}]/g,"\\$&")+"(.+?)[\\?\"']","gm"),i="",s="",o={};while((s=r.exec(t.get("innerHTML")))!==null)i=decodeURI(s[1]),o[i]=!0;return o},findUnusedFiles:function(e,t){var n,r=[];for(n in e)t[n]||r.push(n);return r},findMissingFiles:function(e,t){var n,r=[];for(n in t)e[n]||r.push(n);return r}}},"@VERSION@",{requires:["node","escape"]}); +YUI.add("moodle-atto_managefiles-usedfiles",function(e,t){var n={HASMISSINGFILES:"has-missing-files",HASUNUSEDFILES:"has-unused-files"},r={FILEANCESTOR:".fitem_fcheckbox",FORM:"#atto_managefiles_manageform",MISSINGFILES:".missing-files"};M.atto_managefiles=M.atto_managefiles||{},M.atto_managefiles.usedfiles=M.atto_managefiles.usedfiles||{_usercontext:null,_itemid:null,_elementid:null,init:function(t){this._usercontext=t.usercontext,this._itemid=t.itemid,this._elementid=t.elementid;var i=t.files,s=e.one(r.FORM),o,u,a,f,l;if(!s||!window.parent)return;o=this._getUsedFiles(),u=this.findUnusedFiles(i,o),a=this.findMissingFiles(i,o),u.length>0?(s.all('input[type=checkbox][name^="deletefile"]').each(function(t){e.Array.indexOf(u,t.getData("filename"))===-1&&t.ancestor(r.FILEANCESTOR).remove()}),s.addClass(n.HASUNUSEDFILES)):s.removeClass(n.HASUNUSEDFILES);if(a.length>0){f="
                ";for(l=0;l"+e.Escape.html(a[l])+"";f+="
              ",s.one(r.MISSINGFILES).setHTML("").append(f),s.addClass(n.HASMISSINGFILES)}else s.removeClass(n.HASMISSINGFILES)},_getUsedFiles:function(){var t=e.one(window.parent.document.getElementById(this._elementid+"editable")),n=M.cfg.wwwroot+"/draftfile.php/"+this._usercontext+"/user/draft/"+this._itemid+"/",r=new RegExp(n.replace(/[\-\/\\\^$*+?.()|\[\]{}]/g,"\\$&")+"(.+?)[\\?\"']","gm"),i="",s="",o={};while((s=r.exec(t.get("innerHTML")))!==null)i=decodeURI(s[1]),o[i]=!0;return o},findUnusedFiles:function(e,t){var n,r=[];for(n in e)t[n]||r.push(n);return r},findMissingFiles:function(e,t){var n,r=[];for(n in t)e[n]||r.push(n);return r}}},"@VERSION@",{requires:["node","escape"]}); diff --git a/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-usedfiles/moodle-atto_managefiles-usedfiles.js b/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-usedfiles/moodle-atto_managefiles-usedfiles.js index ed1b8dbf02e..639fe7afcea 100644 --- a/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-usedfiles/moodle-atto_managefiles-usedfiles.js +++ b/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-usedfiles/moodle-atto_managefiles-usedfiles.js @@ -98,6 +98,8 @@ M.atto_managefiles.usedfiles = M.atto_managefiles.usedfiles || { var allFiles = config.files; var form = Y.one(SELECTORS.FORM), usedFiles, + unusedFiles, + missingFiles, missingFilesTxt, i; diff --git a/lib/editor/atto/plugins/managefiles/yui/src/usedfiles/js/usedfiles.js b/lib/editor/atto/plugins/managefiles/yui/src/usedfiles/js/usedfiles.js index 92778d0f5d4..fe8db5783c3 100644 --- a/lib/editor/atto/plugins/managefiles/yui/src/usedfiles/js/usedfiles.js +++ b/lib/editor/atto/plugins/managefiles/yui/src/usedfiles/js/usedfiles.js @@ -96,6 +96,8 @@ M.atto_managefiles.usedfiles = M.atto_managefiles.usedfiles || { var allFiles = config.files; var form = Y.one(SELECTORS.FORM), usedFiles, + unusedFiles, + missingFiles, missingFilesTxt, i; diff --git a/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-debug.js b/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-debug.js index e04cfb0d94a..ed3048a6398 100644 --- a/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-debug.js +++ b/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-debug.js @@ -48,7 +48,8 @@ var COMPONENTNAME = 'atto_media', '
              ' + '' + '' + - '' + + '' + '
              ' + '
              ' + '' + diff --git a/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-min.js b/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-min.js index f619e297fb6..d84c7a96751 100644 --- a/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-min.js +++ b/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-min.js @@ -1 +1 @@ -YUI.add("moodle-atto_media-button",function(e,t){var n="atto_media",r={URLINPUT:"atto_media_urlentry",NAMEINPUT:"atto_media_nameentry"},i={URLINPUT:"."+r.URLINPUT,NAMEINPUT:"."+r.NAMEINPUT},s='


              ';e.namespace("M.atto_media").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_content:null,initializer:function(){this.get("host").canShowFilepicker("media")&&this.addButton({icon:"e/insert_edit_video",callback:this._displayDialogue})},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection===!1)return;var e=this.getDialogue({headerContent:M.util.get_string("createmedia",n),focusAfterHide:!0,focusOnShowSelector:i.URLINPUT});e.set("bodyContent",this._getDialogueContent()).show()},_getDialogueContent:function(){var t=e.Handlebars.compile(s);return this._content=e.Node.create(t({component:n,elementid:this.get("host").get("elementid"),CSS:r})),this._content.one(".submit").on("click",this._setMedia,this),this._content.one(".openmediabrowser").on("click",function(e){e.preventDefault(),this.get("host").showFilepicker("media",this._filepickerCallback,this)},this),this._content},_filepickerCallback:function(e){e.url!==""&&(this._content.one(i.URLINPUT).set("value",e.url),this._content.one(i.NAMEINPUT).set("value",e.file))},_setMedia:function(t){t.preventDefault(),this.getDialogue({focusAfterHide:null}).hide();var n=t.currentTarget.ancestor(".atto_form"),r=n.one(i.URLINPUT).get("value"),s=n.one(i.NAMEINPUT).get("value"),o=this.get("host");if(r!==""&&s!==""){o.setSelection(this._currentSelection);var u=''+s+"";o.insertContentAtFocusPoint(u),this.markUpdated()}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]}); +YUI.add("moodle-atto_media-button",function(e,t){var n="atto_media",r={URLINPUT:"atto_media_urlentry",NAMEINPUT:"atto_media_nameentry"},i={URLINPUT:"."+r.URLINPUT,NAMEINPUT:"."+r.NAMEINPUT},s='


              ';e.namespace("M.atto_media").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_content:null,initializer:function(){this.get("host").canShowFilepicker("media")&&this.addButton({icon:"e/insert_edit_video",callback:this._displayDialogue})},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection===!1)return;var e=this.getDialogue({headerContent:M.util.get_string("createmedia",n),focusAfterHide:!0,focusOnShowSelector:i.URLINPUT});e.set("bodyContent",this._getDialogueContent()).show()},_getDialogueContent:function(){var t=e.Handlebars.compile(s);return this._content=e.Node.create(t({component:n,elementid:this.get("host").get("elementid"),CSS:r})),this._content.one(".submit").on("click",this._setMedia,this),this._content.one(".openmediabrowser").on("click",function(e){e.preventDefault(),this.get("host").showFilepicker("media",this._filepickerCallback,this)},this),this._content},_filepickerCallback:function(e){e.url!==""&&(this._content.one(i.URLINPUT).set("value",e.url),this._content.one(i.NAMEINPUT).set("value",e.file))},_setMedia:function(t){t.preventDefault(),this.getDialogue({focusAfterHide:null}).hide();var n=t.currentTarget.ancestor(".atto_form"),r=n.one(i.URLINPUT).get("value"),s=n.one(i.NAMEINPUT).get("value"),o=this.get("host");if(r!==""&&s!==""){o.setSelection(this._currentSelection);var u=''+s+"";o.insertContentAtFocusPoint(u),this.markUpdated()}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]}); diff --git a/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button.js b/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button.js index e04cfb0d94a..ed3048a6398 100644 --- a/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button.js +++ b/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button.js @@ -48,7 +48,8 @@ var COMPONENTNAME = 'atto_media', '
              ' + '' + '' + - '' + + '' + '
              ' + '
              ' + '' + diff --git a/lib/editor/atto/plugins/media/yui/src/button/js/button.js b/lib/editor/atto/plugins/media/yui/src/button/js/button.js index 0ea937d9d31..b9f43b0f265 100644 --- a/lib/editor/atto/plugins/media/yui/src/button/js/button.js +++ b/lib/editor/atto/plugins/media/yui/src/button/js/button.js @@ -46,7 +46,8 @@ var COMPONENTNAME = 'atto_media', '
              ' + '' + '' + - '' + + '' + '
              ' + '
              ' + '' + diff --git a/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-debug.js b/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-debug.js index cd32dee7fee..09642b56bf7 100644 --- a/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-debug.js +++ b/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-debug.js @@ -69,7 +69,8 @@ var COMPONENT = 'atto_table', '' + '
              ' + '' + - '' + + '' + '
              ' + '
              ' + '
              ' + @@ -966,7 +967,7 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi // Table has no rows. Boo. return; } - newrow = firstrow.cloneNode(true); + var newrow = firstrow.cloneNode(true); newrow.all('th, td').each(function (tablecell) { if (tablecell.get('tagName') === 'TH') { if (tablecell.getAttribute('scope') !== 'row') { diff --git a/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-min.js b/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-min.js index 42b55786277..7e9ddae5580 100644 --- a/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-min.js +++ b/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button-min.js @@ -1,3 +1,3 @@ YUI.add("moodle-atto_table-button",function(e,t){var n="atto_table",r='




              ',i='






              ',s={CAPTION:"caption",HEADERS:"headers",ROWS:"rows",COLUMNS:"columns",SUBMIT:"submit",FORM:"atto_form"},o={CAPTION:"."+s.CAPTION,HEADERS:"."+s.HEADERS,ROWS:"."+s.ROWS,COLUMNS:"."+s.COLUMNS,SUBMIT:"."+s.SUBMIT,FORM:".atto_form"};e.namespace("M.atto_table").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,_contextMenu:null,_lastTarget:null,_menuOptions:null,initializer:function(){this.addButton({icon:"e/table",callback:this._displayTableEditor,tags:"table"}),e.UA.gecko&&(document.execCommand("enableInlineTableEditing",!1,!1),document.execCommand("enableObjectResizing",!1,!1))},_displayDialogue:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection!==!1&&!this._currentSelection.collapsed){var e=this.getDialogue({headerContent:M.util.get_string("createtable",n),focusAfterHide:!0,focusOnShowSelector:o.CAPTION});e.set("bodyContent",this._getDialogueContent()).show()}},_displayTableEditor:function(e){var t=this._getSuitableTableCell();return t?(e.tableCell=t,this._showTableMenu(e)):this._displayDialogue(e)},_stopAtContentEditableFilter:function(e){this.editor.contains(e)},_getEditDialogueContent:function(){var t=e.Handlebars.compile(r);return this._content=e.Node.create(t({CSS:s,elementid:this.get("host").get("elementid"),component:n})),this._content.one(".submit").on("click",this._updateTable,this),this._content},_getDialogueContent:function(){var t=e.Handlebars.compile(i);return this._content=e.Node.create(t({CSS:s,elementid:this.get("host").get("elementid"),component:n})),this._content.one(".submit").on("click",this._setTable,this),this._content},_getSuitableTableCell:function(){var e=null,t=this.get("host");t.getSelectedNodes().some(function(t){if(t.ancestor("td, th, caption",!0,this._stopAtContentEditableFilter)){e=t;var n=t.ancestor("caption",!0,this._stopAtContentEditableFilter);if(n){var r=n.get("parentNode");r&&(e=r.one("td, th"))}return!0}});if(e){var n=t.getSelectionFromNode(e);t.setSelection(n)}return e},_changeNodeType:function(t,n){var r=e.Node.create("<"+n+">");return r.setAttrs(t.getAttrs()),t.get("childNodes").each(function(e){r.append(e.remove())}),t.replace(r),r},_updateTable:function(t){var n,r,i,s;t.preventDefault(),this.getDialogue({focusAfterHide:null}).hide(),n=t.currentTarget.ancestor(o.FORM).one(o.CAPTION),r=t.currentTarget.ancestor(o.FORM).one(o.HEADERS),i=this._lastTarget.ancestor("table"),s=i.one("caption"),s||(s=e.Node.create(""+l,u+=""+e.Escape.html(n.get("value"))+""+l,a=0;if(s.get("value")==="columns"||s.get("value")==="both"){a=1,u+=""+l+""+l;for(f=0;f'+l;u+=""+l+""+l}u+=""+l;for(;a"+l:u+=''+l;u+=""+l}u+=""+l,u+=""+l+"
              ",this.get("host").insertContentAtFocusPoint(u),this.markUpdated()},_findColumnCells:function(){var t=this._getColumnIndex(this._lastTarget),n=this._lastTarget.ancestor("table").all("tr"),r=new e.NodeList,i=new e.NodeList,s=new e.NodeList;return n.each(function(e){var n=e.all("td, th"),o=n.item(t),u=n.item(t-1),a=n.item(t+1);r.push(o),u&&i.push(u),a&&s.push(a)}),{current:r,prev:i,next:s}},_hideInvalidEntries:function(e){var t=this._lastTarget.ancestor("table"),n=this._lastTarget.ancestor("tr"),r=t.all("tr"),i=r.indexOf(n),s=r.item(i-1),o=s?s.one("td"):null;!n||!o?e.one('[data-change="moverowup"]').hide():e.one('[data-change="moverowup"]').show();var u=r.item(i+1),a=n?n.one("td"):!1;!n||!u||!a?e.one('[data-change="moverowdown"]').hide():e.one('[data-change="moverowdown"]').show();var f=this._findColumnCells();f.prev.filter("td").size()>0?e.one('[data-change="movecolumnleft"]').show():e.one('[data-change="movecolumnleft"]').hide();var l=f.current.filter("td").size()>0;f.next.size()>0&&l?e.one('[data-change="movecolumnright"]').show():e.one('[data-change="movecolumnright"]').hide(),f.current.filter("td").size()>0?e.one('[data-change="deletecolumn"]').show():e.one('[data-change="deletecolumn"]').hide(),!n||!n.one("td")?e.one('[data-change="deleterow"]').hide():e.one('[data-change="deleterow"]').show()},_showTableMenu:function(t){t.preventDefault();var r;this._contextMenu||(this._menuOptions=[{text:M.util.get_string("addcolumnafter",n),data:{change:"addcolumnafter"}},{text:M.util.get_string("addrowafter",n),data:{change:"addrowafter"}},{text:M.util.get_string("moverowup",n),data:{change:"moverowup"}},{text:M.util.get_string("moverowdown",n),data:{change:"moverowdown"}},{text:M.util.get_string("movecolumnleft",n),data:{change:"movecolumnleft"}},{text:M.util.get_string("movecolumnright",n),data:{change:"movecolumnright"}},{text:M.util.get_string("deleterow",n),data:{change:"deleterow"}},{text:M.util.get_string("deletecolumn",n),data:{change:"deletecolumn"}},{text:M.util.get_string("edittable",n),data:{change:"edittable"}}],this._contextMenu=new e.M.editor_atto.Menu({items:this._menuOptions}),r=this._contextMenu.get("boundingBox"),r.delegate("click",this._handleTableChange,"a",this)),r=this._contextMenu.get("boundingBox"),this._lastTarget=t.tableCell.ancestor(".editor_atto_content td, .editor_atto_content th",!0),this._hideInvalidEntries(r),e.Array.each(this.get("host").openMenus,function(e){e.set("focusAfterHide",null)});var i=this.buttons[this.name];this.get("host")._setTabFocus(i),this._contextMenu.show(),this._contextMenu.align(this.buttons.table,[e.WidgetPositionAlign.TL,e.WidgetPositionAlign.BL]),this._contextMenu.set("focusAfterHide",i),r.one("a")&&r.one("a").focus(),this.get("host").openMenus=[this._contextMenu]},_handleTableChange:function(e){e.preventDefault(),this._contextMenu.set("focusAfterHide",this.get("host").editor),this._contextMenu.hide(e);switch(e.target.getData("change")){case"addcolumnafter":this._addColumnAfter();break;case"addrowafter":this._addRowAfter();break;case"deleterow":this._deleteRow();break;case"deletecolumn":this._deleteColumn();break;case"edittable":this._editTable();break;case"moverowdown":this._moveRowDown();break;case"moverowup":this._moveRowUp();break;case"movecolumnleft":this._moveColumnLeft();break;case"movecolumnright":this._moveColumnRight()}},_getRowIndex:function(e){var t=e.ancestor("table"),n=e.ancestor("tr");if(!t||!n)return;var r=t.all("tr");return r.indexOf(n)},_getColumnIndex:function(e){var t=e.ancestor("tr");if(!t)return;var n=t.all("td, th");return n.indexOf(e)},_deleteRow:function(){var e=this._lastTarget.ancestor("tr");e&&e.one("td")&&e.remove(!0),this.markUpdated()},_moveRowUp:function(){var e=this._lastTarget.ancestor("tr"),t=e.previous("tr");if(!e||!t)return;e.swap(t),this.markUpdated()},_moveColumnLeft:function(){var e=this._findColumnCells();if(e.current.size()>0&&e.prev.size()>0&&e.current.size()===e.prev.size()){var t=0;for(t=0;t "),1)},_removeCaption:function(){var e=this._lastTarget.ancestor("table"),t=e.one("caption");t&&t.remove(!0)},_moveColumnRight:function(){var e=this._findColumnCells();if(e.next.size()>0&&e.current.size()===e.next.size()&&e.current.filter("td").size()>0){var t=0;for(t=0;t");t.replace(n),t=n}t.setHTML(" ")}),n.insert(newrow,t),this.markUpdated()},_addColumnAfter:function(){var t=this._findColumnCells(),n=!0,r=t.next;t.next.size()<=0&&(n=!1,r=t.current),e.each(r,function(e){var t=e.cloneNode();t.setHTML(" "),n?e.get("parentNode").insert(t,e):(e.get("parentNode").insert(t,e),e.swap(t))},this),this.markUpdated()}})},"@VERSION@",{requires:["moodle-editor_atto-plugin","moodle-editor_atto-menu","event","event-valuechange"]}); +.get("value"),10);a++){u+=""+l;for(f=0;f"+l:u+=''+l;u+=""+l}u+=""+l,u+=""+l+"
              ",this.get("host").insertContentAtFocusPoint(u),this.markUpdated()},_findColumnCells:function(){var t=this._getColumnIndex(this._lastTarget),n=this._lastTarget.ancestor("table").all("tr"),r=new e.NodeList,i=new e.NodeList,s=new e.NodeList;return n.each(function(e){var n=e.all("td, th"),o=n.item(t),u=n.item(t-1),a=n.item(t+1);r.push(o),u&&i.push(u),a&&s.push(a)}),{current:r,prev:i,next:s}},_hideInvalidEntries:function(e){var t=this._lastTarget.ancestor("table"),n=this._lastTarget.ancestor("tr"),r=t.all("tr"),i=r.indexOf(n),s=r.item(i-1),o=s?s.one("td"):null;!n||!o?e.one('[data-change="moverowup"]').hide():e.one('[data-change="moverowup"]').show();var u=r.item(i+1),a=n?n.one("td"):!1;!n||!u||!a?e.one('[data-change="moverowdown"]').hide():e.one('[data-change="moverowdown"]').show();var f=this._findColumnCells();f.prev.filter("td").size()>0?e.one('[data-change="movecolumnleft"]').show():e.one('[data-change="movecolumnleft"]').hide();var l=f.current.filter("td").size()>0;f.next.size()>0&&l?e.one('[data-change="movecolumnright"]').show():e.one('[data-change="movecolumnright"]').hide(),f.current.filter("td").size()>0?e.one('[data-change="deletecolumn"]').show():e.one('[data-change="deletecolumn"]').hide(),!n||!n.one("td")?e.one('[data-change="deleterow"]').hide():e.one('[data-change="deleterow"]').show()},_showTableMenu:function(t){t.preventDefault();var r;this._contextMenu||(this._menuOptions=[{text:M.util.get_string("addcolumnafter",n),data:{change:"addcolumnafter"}},{text:M.util.get_string("addrowafter",n),data:{change:"addrowafter"}},{text:M.util.get_string("moverowup",n),data:{change:"moverowup"}},{text:M.util.get_string("moverowdown",n),data:{change:"moverowdown"}},{text:M.util.get_string("movecolumnleft",n),data:{change:"movecolumnleft"}},{text:M.util.get_string("movecolumnright",n),data:{change:"movecolumnright"}},{text:M.util.get_string("deleterow",n),data:{change:"deleterow"}},{text:M.util.get_string("deletecolumn",n),data:{change:"deletecolumn"}},{text:M.util.get_string("edittable",n),data:{change:"edittable"}}],this._contextMenu=new e.M.editor_atto.Menu({items:this._menuOptions}),r=this._contextMenu.get("boundingBox"),r.delegate("click",this._handleTableChange,"a",this)),r=this._contextMenu.get("boundingBox"),this._lastTarget=t.tableCell.ancestor(".editor_atto_content td, .editor_atto_content th",!0),this._hideInvalidEntries(r),e.Array.each(this.get("host").openMenus,function(e){e.set("focusAfterHide",null)});var i=this.buttons[this.name];this.get("host")._setTabFocus(i),this._contextMenu.show(),this._contextMenu.align(this.buttons.table,[e.WidgetPositionAlign.TL,e.WidgetPositionAlign.BL]),this._contextMenu.set("focusAfterHide",i),r.one("a")&&r.one("a").focus(),this.get("host").openMenus=[this._contextMenu]},_handleTableChange:function(e){e.preventDefault(),this._contextMenu.set("focusAfterHide",this.get("host").editor),this._contextMenu.hide(e);switch(e.target.getData("change")){case"addcolumnafter":this._addColumnAfter();break;case"addrowafter":this._addRowAfter();break;case"deleterow":this._deleteRow();break;case"deletecolumn":this._deleteColumn();break;case"edittable":this._editTable();break;case"moverowdown":this._moveRowDown();break;case"moverowup":this._moveRowUp();break;case"movecolumnleft":this._moveColumnLeft();break;case"movecolumnright":this._moveColumnRight()}},_getRowIndex:function(e){var t=e.ancestor("table"),n=e.ancestor("tr");if(!t||!n)return;var r=t.all("tr");return r.indexOf(n)},_getColumnIndex:function(e){var t=e.ancestor("tr");if(!t)return;var n=t.all("td, th");return n.indexOf(e)},_deleteRow:function(){var e=this._lastTarget.ancestor("tr");e&&e.one("td")&&e.remove(!0),this.markUpdated()},_moveRowUp:function(){var e=this._lastTarget.ancestor("tr"),t=e.previous("tr");if(!e||!t)return;e.swap(t),this.markUpdated()},_moveColumnLeft:function(){var e=this._findColumnCells();if(e.current.size()>0&&e.prev.size()>0&&e.current.size()===e.prev.size()){var t=0;for(t=0;t "),1)},_removeCaption:function(){var e=this._lastTarget.ancestor("table"),t=e.one("caption");t&&t.remove(!0)},_moveColumnRight:function(){var e=this._findColumnCells();if(e.next.size()>0&&e.current.size()===e.next.size()&&e.current.filter("td").size()>0){var t=0;for(t=0;t");t.replace(n),t=n}t.setHTML(" ")}),n.insert(i,t),this.markUpdated()},_addColumnAfter:function(){var t=this._findColumnCells(),n=!0,r=t.next;t.next.size()<=0&&(n=!1,r=t.current),e.each(r,function(e){var t=e.cloneNode();t.setHTML(" "),n?e.get("parentNode").insert(t,e):(e.get("parentNode").insert(t,e),e.swap(t))},this),this.markUpdated()}})},"@VERSION@",{requires:["moodle-editor_atto-plugin","moodle-editor_atto-menu","event","event-valuechange"]}); diff --git a/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button.js b/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button.js index cd32dee7fee..09642b56bf7 100644 --- a/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button.js +++ b/lib/editor/atto/plugins/table/yui/build/moodle-atto_table-button/moodle-atto_table-button.js @@ -69,7 +69,8 @@ var COMPONENT = 'atto_table', '' + '
              ' + '' + - '' + + '' + '
              ' + '
              ' + '
              ' + @@ -966,7 +967,7 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi // Table has no rows. Boo. return; } - newrow = firstrow.cloneNode(true); + var newrow = firstrow.cloneNode(true); newrow.all('th, td').each(function (tablecell) { if (tablecell.get('tagName') === 'TH') { if (tablecell.getAttribute('scope') !== 'row') { diff --git a/lib/editor/atto/plugins/table/yui/src/button/js/button.js b/lib/editor/atto/plugins/table/yui/src/button/js/button.js index 6c1389adf72..6e27f814a51 100644 --- a/lib/editor/atto/plugins/table/yui/src/button/js/button.js +++ b/lib/editor/atto/plugins/table/yui/src/button/js/button.js @@ -67,7 +67,8 @@ var COMPONENT = 'atto_table', '' + '
              ' + '' + - '' + + '' + '
              ' + '
              ' + '
              ' + @@ -964,7 +965,7 @@ Y.namespace('M.atto_table').Button = Y.Base.create('button', Y.M.editor_atto.Edi // Table has no rows. Boo. return; } - newrow = firstrow.cloneNode(true); + var newrow = firstrow.cloneNode(true); newrow.all('th, td').each(function (tablecell) { if (tablecell.get('tagName') === 'TH') { if (tablecell.getAttribute('scope') !== 'row') { diff --git a/lib/editor/atto/plugins/undo/yui/build/moodle-atto_undo-button/moodle-atto_undo-button-debug.js b/lib/editor/atto/plugins/undo/yui/build/moodle-atto_undo-button/moodle-atto_undo-button-debug.js index 6fd8654890b..25494d425b5 100644 --- a/lib/editor/atto/plugins/undo/yui/build/moodle-atto_undo-button/moodle-atto_undo-button-debug.js +++ b/lib/editor/atto/plugins/undo/yui/build/moodle-atto_undo-button/moodle-atto_undo-button-debug.js @@ -25,8 +25,6 @@ YUI.add('moodle-atto_undo-button', function (Y, NAME) { * @module moodle-atto_undo-button */ -var LOGNAME = 'moodle-atto_undo-button'; - /** * Atto text editor undo plugin. * @@ -171,7 +169,7 @@ Y.namespace('M.atto_undo').Button = Y.Base.create('button', Y.M.editor_atto.Edit return this._undoStack[0]; } - last = this._undoStack.pop(); + var last = this._undoStack.pop(); if (last === current) { // Oops, the latest undo step is the current content, we should unstack once more. // There is no need to do that in a loop as the same stack should never contain duplicates. diff --git a/lib/editor/atto/plugins/undo/yui/build/moodle-atto_undo-button/moodle-atto_undo-button-min.js b/lib/editor/atto/plugins/undo/yui/build/moodle-atto_undo-button/moodle-atto_undo-button-min.js index 95c2b3ed02b..7b0e9eb7878 100644 --- a/lib/editor/atto/plugins/undo/yui/build/moodle-atto_undo-button/moodle-atto_undo-button-min.js +++ b/lib/editor/atto/plugins/undo/yui/build/moodle-atto_undo-button/moodle-atto_undo-button-min.js @@ -1 +1 @@ -YUI.add("moodle-atto_undo-button",function(e,t){var n="moodle-atto_undo-button";e.namespace("M.atto_undo").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_maxUndos:40,_undoStack:null,_redoStack:null,initializer:function(){this._undoStack=[],this._redoStack=[],this.addButton({icon:"e/undo",callback:this._undoHandler,buttonName:"undo",keys:90}),this.addButton({icon:"e/redo",callback:this._redoHandler,buttonName:"redo",keys:89}),this.get("host").on("pluginsloaded",function(){this._addToUndo(this._getHTML()),this.get("host").on("atto:selectionchanged",this._changeListener,this)},this),this._updateButtonsStates()},_addToRedo:function(e){this._redoStack.push(e)},_addToUndo:function(e,t){var n=this._undoStack[this._undoStack.length-1];typeof t=="undefined"&&(t=!1),n!==e&&(this._undoStack.push(e),t&&(this._redoStack=[]));while(this._undoStack.length>this._maxUndos)this._undoStack.shift()},_getHTML:function(){return this.get("host").getCleanHTML()},_getRedo:function(){return this._redoStack.pop()},_getUndo:function(e){return this._undoStack.length===1?this._undoStack[0]:(last=this._undoStack.pop(),last===e&&(last=this._undoStack.pop()),this._undoStack.length===0&&this._addToUndo(last),last)},_restoreValue:function(e){this.editor.setHTML(e),this._addToUndo(e)},_updateButtonsStates:function(){this._undoStack.length>1?this.enableButtons("undo"):this.disableButtons("undo"),this._redoStack.length>0?this.enableButtons("redo"):this.disableButtons("redo")},_undoHandler:function(e){e.preventDefault();var t=this._getHTML(),n=this._getUndo(t);if(t===n){this._updateButtonsStates();return}this._restoreValue(n),this._addToRedo(t),this._updateButtonsStates()},_redoHandler:function(e){e.preventDefault();var t=this._getHTML(),n=this._getRedo();if(t===n){this._updateButtonsStates();return}this._restoreValue(n),this._updateButtonsStates()},_changeListener:function(e){if(e.event&&e.event.type.indexOf("key")!==-1&&e.event.keyCode!==39&&e.event.keyCode!==37&&e.event.keyCode!==40&&e.event.keyCode!==38)return;this._addToUndo(this._getHTML(),!0),this._updateButtonsStates()}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]}); +YUI.add("moodle-atto_undo-button",function(e,t){e.namespace("M.atto_undo").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_maxUndos:40,_undoStack:null,_redoStack:null,initializer:function(){this._undoStack=[],this._redoStack=[],this.addButton({icon:"e/undo",callback:this._undoHandler,buttonName:"undo",keys:90}),this.addButton({icon:"e/redo",callback:this._redoHandler,buttonName:"redo",keys:89}),this.get("host").on("pluginsloaded",function(){this._addToUndo(this._getHTML()),this.get("host").on("atto:selectionchanged",this._changeListener,this)},this),this._updateButtonsStates()},_addToRedo:function(e){this._redoStack.push(e)},_addToUndo:function(e,t){var n=this._undoStack[this._undoStack.length-1];typeof t=="undefined"&&(t=!1),n!==e&&(this._undoStack.push(e),t&&(this._redoStack=[]));while(this._undoStack.length>this._maxUndos)this._undoStack.shift()},_getHTML:function(){return this.get("host").getCleanHTML()},_getRedo:function(){return this._redoStack.pop()},_getUndo:function(e){if(this._undoStack.length===1)return this._undoStack[0];var t=this._undoStack.pop();return t===e&&(t=this._undoStack.pop()),this._undoStack.length===0&&this._addToUndo(t),t},_restoreValue:function(e){this.editor.setHTML(e),this._addToUndo(e)},_updateButtonsStates:function(){this._undoStack.length>1?this.enableButtons("undo"):this.disableButtons("undo"),this._redoStack.length>0?this.enableButtons("redo"):this.disableButtons("redo")},_undoHandler:function(e){e.preventDefault();var t=this._getHTML(),n=this._getUndo(t);if(t===n){this._updateButtonsStates();return}this._restoreValue(n),this._addToRedo(t),this._updateButtonsStates()},_redoHandler:function(e){e.preventDefault();var t=this._getHTML(),n=this._getRedo();if(t===n){this._updateButtonsStates();return}this._restoreValue(n),this._updateButtonsStates()},_changeListener:function(e){if(e.event&&e.event.type.indexOf("key")!==-1&&e.event.keyCode!==39&&e.event.keyCode!==37&&e.event.keyCode!==40&&e.event.keyCode!==38)return;this._addToUndo(this._getHTML(),!0),this._updateButtonsStates()}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]}); diff --git a/lib/editor/atto/plugins/undo/yui/build/moodle-atto_undo-button/moodle-atto_undo-button.js b/lib/editor/atto/plugins/undo/yui/build/moodle-atto_undo-button/moodle-atto_undo-button.js index 6fd8654890b..25494d425b5 100644 --- a/lib/editor/atto/plugins/undo/yui/build/moodle-atto_undo-button/moodle-atto_undo-button.js +++ b/lib/editor/atto/plugins/undo/yui/build/moodle-atto_undo-button/moodle-atto_undo-button.js @@ -25,8 +25,6 @@ YUI.add('moodle-atto_undo-button', function (Y, NAME) { * @module moodle-atto_undo-button */ -var LOGNAME = 'moodle-atto_undo-button'; - /** * Atto text editor undo plugin. * @@ -171,7 +169,7 @@ Y.namespace('M.atto_undo').Button = Y.Base.create('button', Y.M.editor_atto.Edit return this._undoStack[0]; } - last = this._undoStack.pop(); + var last = this._undoStack.pop(); if (last === current) { // Oops, the latest undo step is the current content, we should unstack once more. // There is no need to do that in a loop as the same stack should never contain duplicates. diff --git a/lib/editor/atto/plugins/undo/yui/src/button/js/button.js b/lib/editor/atto/plugins/undo/yui/src/button/js/button.js index 983d746b2e4..8a326f1ab88 100644 --- a/lib/editor/atto/plugins/undo/yui/src/button/js/button.js +++ b/lib/editor/atto/plugins/undo/yui/src/button/js/button.js @@ -23,8 +23,6 @@ * @module moodle-atto_undo-button */ -var LOGNAME = 'moodle-atto_undo-button'; - /** * Atto text editor undo plugin. * @@ -169,7 +167,7 @@ Y.namespace('M.atto_undo').Button = Y.Base.create('button', Y.M.editor_atto.Edit return this._undoStack[0]; } - last = this._undoStack.pop(); + var last = this._undoStack.pop(); if (last === current) { // Oops, the latest undo step is the current content, we should unstack once more. // There is no need to do that in a loop as the same stack should never contain duplicates. diff --git a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js index c5c8f9be2dd..5306249485f 100644 --- a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js +++ b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js @@ -37,7 +37,8 @@ var CSS = { TOOLBAR: 'editor_atto_toolbar', WRAPPER: 'editor_atto', HIGHLIGHT: 'highlight' - }; + }, + rangy = window.rangy; /** * The Atto editor for Moodle. @@ -813,7 +814,9 @@ EditorAutosave.prototype = { setupAutosave: function() { var draftid = -1, optiontype = null, - options = this.get('filepickeroptions'); + options = this.get('filepickeroptions'), + params, + url; if (!this.get('autosaveEnabled')) { // Autosave disabled for this instance. @@ -847,6 +850,7 @@ EditorAutosave.prototype = { context: this, on: { success: function(id,o) { + var response_json; if (typeof o.responseText !== "undefined" && o.responseText !== "") { response_json = JSON.parse(o.responseText); @@ -864,7 +868,8 @@ EditorAutosave.prototype = { if (response_json.error || typeof response_json.result === 'undefined') { Y.log('Error occurred recovering draft text: ' + response_json.error, 'debug', LOGNAME_AUTOSAVE); - this.showMessage(M.util.get_string('errortextrecovery', 'editor_atto'), NOTIFY_WARNING, RECOVER_MESSAGE_TIMEOUT); + this.showMessage(M.util.get_string('errortextrecovery', 'editor_atto'), + NOTIFY_WARNING, RECOVER_MESSAGE_TIMEOUT); } else if (response_json.result !== this.textarea.get('value') && response_json.result !== '') { Y.log('Autosave text found - recover it.', 'debug', LOGNAME_AUTOSAVE); @@ -874,7 +879,8 @@ EditorAutosave.prototype = { } }, failure: function() { - this.showMessage(M.util.get_string('errortextrecovery', 'editor_atto'), NOTIFY_WARNING, RECOVER_MESSAGE_TIMEOUT); + this.showMessage(M.util.get_string('errortextrecovery', 'editor_atto'), + NOTIFY_WARNING, RECOVER_MESSAGE_TIMEOUT); } } }); @@ -897,8 +903,8 @@ EditorAutosave.prototype = { */ resetAutosave: function() { // Make an ajax request to reset the autosaved text. - url = M.cfg.wwwroot + this.get('autosaveAjaxScript'); - params = { + var url = M.cfg.wwwroot + this.get('autosaveAjaxScript'); + var params = { sesskey: M.cfg.sesskey, contextid: this.get('contextid'), action: 'reset', @@ -929,7 +935,8 @@ EditorAutosave.prototype = { this.updateOriginal(); this.lastText = text; - this.showMessage(M.util.get_string('textrecovered', 'editor_atto'), NOTIFY_INFO, RECOVER_MESSAGE_TIMEOUT); + this.showMessage(M.util.get_string('textrecovered', 'editor_atto'), + NOTIFY_INFO, RECOVER_MESSAGE_TIMEOUT); return this; }, @@ -941,6 +948,7 @@ EditorAutosave.prototype = { * @chainable */ saveDraft: function() { + var url, params; // Only copy the text from the div to the textarea if the textarea is not currently visible. if (!this.editor.get('hidden')) { this.updateOriginal(); @@ -983,7 +991,8 @@ EditorAutosave.prototype = { } else { // All working. this.lastText = newText; - this.showMessage(M.util.get_string('autosavesucceeded', 'editor_atto'), NOTIFY_INFO, SUCCESS_MESSAGE_TIMEOUT); + this.showMessage(M.util.get_string('autosavesucceeded', 'editor_atto'), + NOTIFY_INFO, SUCCESS_MESSAGE_TIMEOUT); } } } @@ -1374,7 +1383,7 @@ EditorToolbarNav.prototype = { if (this._tabFocus.hasAttribute('disabled') || this._tabFocus.hasAttribute('hidden') || this._tabFocus.ancestor('.atto_group').hasAttribute('hidden')) { // Find first available button. - button = this._findFirstFocusable(this.toolbar.all('button'), this._tabFocus, -1); + var button = this._findFirstFocusable(this.toolbar.all('button'), this._tabFocus, -1); if (button) { if (this._tabFocus.compareTo(document.activeElement)) { // We should also move the focus, because the inaccessible button also has the focus. diff --git a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js index a9171e85464..12f01972370 100644 --- a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js +++ b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js @@ -1,3 +1,3 @@ -YUI.add("moodle-editor_atto-editor",function(e,t){function i(){i.superclass.constructor.apply(this,arguments)}function a(){}function f(){}function p(){}function d(){}function v(){}function m(){}function g(){}function y(){}function b(){}var n="moodle-editor_atto-editor",r={CONTENT:"editor_atto_content",CONTENTWRAPPER:"editor_atto_content_wrap",TOOLBAR:"editor_atto_toolbar",WRAPPER:"editor_atto",HIGHLIGHT:"highlight"};e.extend(i,e.Base,{BLOCK_TAGS:["address","article","aside","audio","blockquote","canvas","dd","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","noscript","ol","output","p","pre","section","table","tfoot","ul","video"],PLACEHOLDER_CLASS:"atto-tmp-class",ALL_NODES_SELECTOR:"[style],font[face]",FONT_FAMILY:"fontFamily",_wrapper:null,editor:null,textarea:null,textareaLabel:null,plugins:null,_eventHandles:null,initializer:function(){var t;this.textarea=e.one(document.getElementById(this.get("elementid")));if(!this.textarea)return;this._eventHandles=[],this._wrapper=e.Node.create('
              '),t=e.Handlebars.compile('
              '),this.editor=e.Node.create(t({elementid:this.get("elementid"),CSS:r})),this.textareaLabel=e.one('[for="'+this.get("elementid")+'"]'),this.textareaLabel&&(this.textareaLabel.generateID(),this.editor.setAttribute("aria-labelledby",this.textareaLabel.get("id"))),this.setupToolbar();var n=e.Node.create('
              ');n.appendChild(this.editor),this._wrapper.appendChild(n),this.editor.setStyle("minHeight",20*this.textarea.getAttribute("rows")+8+"px"),e.UA.ie===0&&this.editor.setStyle("height",20*this.textarea.getAttribute("rows")+8+"px"),this.disableCssStyling(),document.queryCommandSupported("DefaultParagraphSeparator")&&document.execCommand("DefaultParagraphSeparator",!1,"p"),this.textarea.get("parentNode").insert(this._wrapper,this.textarea).setAttribute("class","editor_atto_wrap"),this.textarea.hide(),this.updateFromTextArea(),this.publishEvents(),this.setupSelectionWatchers(),this.setupAutomaticPolling(),this.setupPlugins(),this.setupAutosave(),this.setupNotifications()},focus:function(){return this.editor.focus(),this},publishEvents:function(){return this.publish("change",{broadcast:!0,preventable:!0}),this.publish("pluginsloaded",{fireOnce:!0}),this.publish("atto:selectionchanged",{prefix:"atto"}),this},setupAutomaticPolling:function(){return this._registerEventHandle(this.editor.on(["keyup","paste","cut"],this.updateOriginal,this)),this},setupPlugins:function(){this.plugins={};var t=this.get("plugins"),n,r,i,s,o;for(n in t){r=t[n];if(!r.plugins)continue;for(i in r.plugins){s=r.plugins[i],o=e.mix({name:s.name,group:r.group,editor:this.editor,toolbar:this.toolbar,host:this},s);if(typeof e.M["atto_"+s.name]=="undefined")continue;this.plugins[s.name]=new e.M["atto_"+s.name].Button(o)}}return this.fire("pluginsloaded"),this},enablePlugins:function(e){this._setPluginState(!0,e)},disablePlugins:function(e){this._setPluginState(!1,e)},_setPluginState:function(t,n){var r="disableButtons";t&&(r="enableButtons"),n?this.plugins[n][r]():e.Object.each(this.plugins,function(e){e[r]()},this)},_registerEventHandle:function(e){this._eventHandles.push(e)}},{NS:"editor_atto",ATTRS:{elementid:{value:null,writeOnce:!0},contextid:{value:null,writeOnce:!0},plugins:{value:{},writeOnce:!0}}}),e.augment(i,e.EventTarget),e.namespace("M.editor_atto").Editor=i,e.namespace("M.editor_atto.Editor").init=function(t){return new e.M.editor_atto.Editor(t)};var s="moodle-editor_atto-editor-notify",o="info",u="warning";a.ATTRS={},a.prototype={messageOverlay:null,hideTimer:null,setupNotifications:function(){var e=new Image,t=new Image;return e.src=M.util.image_url("i/warning","moodle"),t.src=M.util.image_url("i/info","moodle"),this},showMessage:function(t,n,r){var i="",s,a;return this.messageOverlay===null&&(this.messageOverlay=e.Node.create('
              '),this.messageOverlay.hide(!0),this.textarea.get("parentNode").append(this.messageOverlay),this.messageOverlay.on("click",function(){this.messageOverlay.hide(!0)},this)),this.hideTimer!==null&&this.hideTimer.cancel(),n===u?i=''+M.util.get_string(':n===o&&(i=''+M.util.get_string('),s=parseInt(r,10),s<=0&&(s=6e4),n="atto_"+n,a=e.Node.create('"),this.messageOverlay.empty(),this.messageOverlay.append(a),this.messageOverlay.show(!0),this.hideTimer=e.later(s,this,function(){this.hideTimer=null,this.messageOverlay.hide(!0)}),this}},e.Base.mix(e.M.editor_atto.Editor,[a]),f.ATTRS={},f.prototype={_getEmptyContent:function(){return e.UA.ie&&e.UA.ie<10?"

              ":"


              "},updateFromTextArea:function(){this.editor.setHTML(""),this.editor.append(this.textarea.get("value")),this.cleanEditorHTML(),this.editor.getHTML()===""&&this.editor.setHTML(this._getEmptyContent())},updateOriginal:function(){var e=this.textarea.get("value"),t=this.getCleanHTML();return t===""&&this.isActive()&&(t=this._getEmptyContent()),e!==t&&(this.textarea.set("value",t),this.textarea.simulate("change"),this.fire("change")),this}},e.Base.mix(e.M.editor_atto.Editor,[f]);var l=5e3,c=6e4,h="moodle-editor_atto-editor-autosave";p.ATTRS={autosaveEnabled:{value:!0,writeOnce:!0},autosaveFrequency:{value:60,writeOnce:!0},pageHash:{value:"",writeOnce:!0},autosaveAjaxScript:{value:"/lib/editor/atto/autosave-ajax.php",readOnly:!0}},p.prototype={lastText:"",autosaveInstance:null,setupAutosave:function(){var t=-1,n=null,r=this.get("filepickeroptions");if(!this.get("autosaveEnabled"))return;this.autosaveInstance=e.stamp(this);for(n in r)typeof r[n].itemid!="undefined"&&(t=r[n].itemid);url=M.cfg.wwwroot+ -this.get("autosaveAjaxScript"),params={sesskey:M.cfg.sesskey,contextid:this.get("contextid"),action:"resume",drafttext:"",draftid:t,elementid:this.get("elementid"),pageinstance:this.autosaveInstance,pagehash:this.get("pageHash")},e.io(url,{method:"POST",data:params,context:this,on:{success:function(e,t){if(typeof t.responseText!="undefined"&&t.responseText!==""){response_json=JSON.parse(t.responseText);if(response_json.result==="

              "||response_json.result==="


              "||response_json.result==="
              ")response_json.result="";if(response_json.result==="

               

              "||response_json.result==="


               

              ")response_json.result="";response_json.error||typeof response_json.result=="undefined"?this.showMessage(M.util.get_string("errortextrecovery","editor_atto"),u,c):response_json.result!==this.textarea.get("value")&&response_json.result!==""&&this.recoverText(response_json.result),this._fireSelectionChanged()}},failure:function(){this.showMessage(M.util.get_string("errortextrecovery","editor_atto"),u,c)}}});var i=parseInt(this.get("autosaveFrequency"),10)*1e3;return e.later(i,this,this.saveDraft,!1,!0),this.textarea.ancestor("form").on("submit",this.resetAutosave,this),this},resetAutosave:function(){return url=M.cfg.wwwroot+this.get("autosaveAjaxScript"),params={sesskey:M.cfg.sesskey,contextid:this.get("contextid"),action:"reset",elementid:this.get("elementid"),pageinstance:this.autosaveInstance,pagehash:this.get("pageHash")},e.io(url,{method:"POST",data:params,sync:!0}),this},recoverText:function(e){return this.editor.setHTML(e),this.saveSelection(),this.updateOriginal(),this.lastText=e,this.showMessage(M.util.get_string("textrecovered","editor_atto"),o,c),this},saveDraft:function(){this.editor.get("hidden")||this.updateOriginal();var t=this.textarea.get("value");if(t!==this.lastText){url=M.cfg.wwwroot+this.get("autosaveAjaxScript"),params={sesskey:M.cfg.sesskey,contextid:this.get("contextid"),action:"save",drafttext:t,elementid:this.get("elementid"),pagehash:this.get("pageHash"),pageinstance:this.autosaveInstance};var n=function(e,t){var n=parseInt(this.get("autosaveFrequency"),10)*1e3;this.showMessage(M.util.get_string("autosavefailed","editor_atto"),u,n)};e.io(url,{method:"POST",data:params,context:this,on:{error:n,failure:n,success:function(r,i){i.responseText!==""?e.soon(e.bind(n,this,[r,i])):(this.lastText=t,this.showMessage(M.util.get_string("autosavesucceeded","editor_atto"),o,l))}}})}return this}},e.Base.mix(e.M.editor_atto.Editor,[p]),d.ATTRS={},d.prototype={getCleanHTML:function(){var t=this.editor.cloneNode(!0),n;return e.each(t.all('[id^="yui"]'),function(e){e.removeAttribute("id")}),t.all(".atto_control").remove(!0),n=t.get("innerHTML"),n==="

              "||n==="


              "?"":this._cleanHTML(n)},cleanEditorHTML:function(){var e=this.editor.get("innerHTML");return this.editor.set("innerHTML",this._cleanHTML(e)),this},_cleanHTML:function(e){var t=[{regex://gi,replace:""},{regex:/<\\?\?xml[^>]*>/gi,replace:""},{regex:/<\/?\w+:[^>]*>/gi,replace:""},{regex:/\s*MSO[-:][^;"']*;?/gi,replace:""},{regex:/]*>( |\s)*<\/span>/gi,replace:""},{regex:/class="Mso[^"]*"/gi,replace:""},{regex:/<(\/?title|\/?meta|\/?style|\/?st\d|\/?head|\/?font|\/?html|\/?body|!\[)[^>]*?>/gi,replace:""},{regex:new RegExp(String.fromCharCode(8220),"gi"),replace:'"'},{regex:new RegExp(String.fromCharCode(8216),"gi"),replace:"'"},{regex:new RegExp(String.fromCharCode(8217),"gi"),replace:"'"},{regex:new RegExp(String.fromCharCode(8211),"gi"),replace:"-"},{regex:new RegExp(String.fromCharCode(8212),"gi"),replace:"--"},{regex:new RegExp(String.fromCharCode(189),"gi"),replace:"1/2"},{regex:new RegExp(String.fromCharCode(188),"gi"),replace:"1/4"},{regex:new RegExp(String.fromCharCode(190),"gi"),replace:"3/4"},{regex:new RegExp(String.fromCharCode(169),"gi"),replace:"(c)"},{regex:new RegExp(String.fromCharCode(174),"gi"),replace:"(r)"},{regex:new RegExp(String.fromCharCode(8230),"gi"),replace:"..."}],n=0;for(n=0;n'),this.openMenus=[],this._wrapper.appendChild(this.toolbar),this.textareaLabel&&this.toolbar.setAttribute("aria-labelledby",this.textareaLabel.get("id")),this.setupToolbarNavigation(),this}},e.Base.mix(e.M.editor_atto.Editor,[v]),m.ATTRS={},m.prototype={_tabFocus:null,setupToolbarNavigation:function(){return this._wrapper.delegate("key",this.toolbarKeyboardNavigation,"down:37,39","."+r.TOOLBAR,this),this._wrapper.delegate("focus",function(e){this._setTabFocus(e.currentTarget)},"."+r.TOOLBAR+" button",this),this},toolbarKeyboardNavigation:function(e){e.preventDefault();var t=this.toolbar.all("button"),n=1,r,i=e.target.ancestor("button",!0);e.keyCode===37&&(n=-1),r=this._findFirstFocusable(t,i,n),r&&(r.focus(),this._setTabFocus(r))},_findFirstFocusable:function(e,t,n){var r=0,i,s,o,u;u=e.indexOf(t),u<-1&&(u=0);while(r=e.size()&&(u=0),s=e.item(u),r++;if(s.hasAttribute("hidden")||s.hasAttribute("disabled"))continue;i=s.ancestor(".atto_group");if(i.hasAttribute("hidden"))continue;o=s;break}return o},checkTabFocus:function(){return this._tabFocus&&(this._tabFocus.hasAttribute("disabled")||this._tabFocus.hasAttribute("hidden")||this._tabFocus.ancestor(".atto_group").hasAttribute("hidden"))&&(button=this._findFirstFocusable(this.toolbar.all("button"),this._tabFocus,-1),button&&(this._tabFocus.compareTo(document.activeElement)&&button.focus(),this._setTabFocus(button))),this},_setTabFocus:function(e){return this._tabFocus&&this._tabFocus.setAttribute("tabindex","-1"),this._tabFocus=e,this._tabFocus.setAttribute("tabindex",0),this.toolbar.setAttribute("aria-activedescendant",this._tabFocus.generateID()),this}},e.Base.mix(e.M.editor_atto.Editor,[m]),g.ATTRS={},g.prototype={_selections:null, -_lastSelection:null,_focusFromClick:!1,setupSelectionWatchers:function(){return this.on("atto:selectionchanged",this.saveSelection,this),this.editor.on("focus",this.restoreSelection,this),this.editor.on("mousedown",function(){this._focusFromClick=!0},this),this.editor.on("blur",function(){this._focusFromClick=!1,this.updateOriginal()},this),this.editor.on(["keyup","focus"],function(t){e.soon(e.bind(this._hasSelectionChanged,this,t))},this),this.editor.on("gesturemoveend",function(t){e.soon(e.bind(this._hasSelectionChanged,this,t))},{standAlone:!0},this),this},isActive:function(){var e=rangy.createRange(),t=rangy.getSelection();return t.rangeCount?!document.activeElement||!this.editor.compareTo(document.activeElement)&&!this.editor.contains(document.activeElement)?!1:(e.selectNode(this.editor.getDOMNode()),e.intersectsRange(t.getRangeAt(0))):!1},getSelectionFromNode:function(e){var t=rangy.createRange();return t.selectNode(e.getDOMNode()),[t]},saveSelection:function(){this.isActive()&&(this._selections=this.getSelection())},restoreSelection:function(){this._focusFromClick||this._selections&&this.setSelection(this._selections),this._focusFromClick=!1},getSelection:function(){return rangy.getSelection().getAllRanges()},selectionContainsNode:function(e){return rangy.getSelection().containsNode(e.getDOMNode(),!0)},selectionFilterMatches:function(e,t,n){typeof n=="undefined"&&(n=!0),t||(t=this.getSelectedNodes());var r=t.size()>0,i=!1,s=this.editor,o=function(e){return e===s};return s.one(e)?(t.each(function(t){if(n){if(!r||!t.ancestor(e,!0,o))r=!1}else!i&&t.ancestor(e,!0,o)&&(i=!0)},this),n?r:i):!1},getSelectedNodes:function(){var t=new e.NodeList,n,r,i,s,o;r=rangy.getSelection(),r.rangeCount?i=r.getRangeAt(0):i=rangy.createRange(),i.collapsed&&i.commonAncestorContainer!==this.editor.getDOMNode()&&i.commonAncestorContainer!==e.config.doc&&(i=i.cloneRange(),i.selectNode(i.commonAncestorContainer)),n=i.getNodes();for(o=0;o

              "),i.get("childNodes").each(function(e){u.append(e.remove())}),i.append(u),o=u),t&&t!==""&&(f=e.Node.create("<"+t+">"),f.setAttrs(o.getAttrs()),o.get("childNodes").each(function(e){e.remove(),f.append(e)}),o.replace(f),o=f),n&&o.setAttrs(n);var l=this.getSelectionFromNode(o);return this.setSelection(l),o}},e.Base.mix(e.M.editor_atto.Editor,[y]),b.ATTRS={filepickeroptions:{value:{}}},b.prototype={canShowFilepicker:function(e){return typeof this.get("filepickeroptions")[e]!="undefined"},showFilepicker:function(t,n,r){var i=this;e.use("core_filepicker",function(e){var s=e.clone(i.get("filepickeroptions")[t],!0);s.formcallback=n,r&&(s.magicscope=r),M.core_filepicker.show(e,s)})}},e.Base.mix(e.M.editor_atto.Editor,[b])},"@VERSION@",{requires:["node","transition","io","overlay","escape","event","event-simulate","event-custom","yui-throttle","moodle-core-notification-dialogue","moodle-core-notification-confirm","moodle-editor_atto-rangy","handlebars","timers"]}); +YUI.add("moodle-editor_atto-editor",function(e,t){function s(){s.superclass.constructor.apply(this,arguments)}function f(){}function l(){}function d(){}function v(){}function m(){}function g(){}function y(){}function b(){}function w(){}var n="moodle-editor_atto-editor",r={CONTENT:"editor_atto_content",CONTENTWRAPPER:"editor_atto_content_wrap",TOOLBAR:"editor_atto_toolbar",WRAPPER:"editor_atto",HIGHLIGHT:"highlight"},i=window.rangy;e.extend(s,e.Base,{BLOCK_TAGS:["address","article","aside","audio","blockquote","canvas","dd","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","noscript","ol","output","p","pre","section","table","tfoot","ul","video"],PLACEHOLDER_CLASS:"atto-tmp-class",ALL_NODES_SELECTOR:"[style],font[face]",FONT_FAMILY:"fontFamily",_wrapper:null,editor:null,textarea:null,textareaLabel:null,plugins:null,_eventHandles:null,initializer:function(){var t;this.textarea=e.one(document.getElementById(this.get("elementid")));if(!this.textarea)return;this._eventHandles=[],this._wrapper=e.Node.create('
              '),t=e.Handlebars.compile('
              '),this.editor=e.Node.create(t({elementid:this.get("elementid"),CSS:r})),this.textareaLabel=e.one('[for="'+this.get("elementid")+'"]'),this.textareaLabel&&(this.textareaLabel.generateID(),this.editor.setAttribute("aria-labelledby",this.textareaLabel.get("id"))),this.setupToolbar();var n=e.Node.create('
              ');n.appendChild(this.editor),this._wrapper.appendChild(n),this.editor.setStyle("minHeight",20*this.textarea.getAttribute("rows")+8+"px"),e.UA.ie===0&&this.editor.setStyle("height",20*this.textarea.getAttribute("rows")+8+"px"),this.disableCssStyling(),document.queryCommandSupported("DefaultParagraphSeparator")&&document.execCommand("DefaultParagraphSeparator",!1,"p"),this.textarea.get("parentNode").insert(this._wrapper,this.textarea).setAttribute("class","editor_atto_wrap"),this.textarea.hide(),this.updateFromTextArea(),this.publishEvents(),this.setupSelectionWatchers(),this.setupAutomaticPolling(),this.setupPlugins(),this.setupAutosave(),this.setupNotifications()},focus:function(){return this.editor.focus(),this},publishEvents:function(){return this.publish("change",{broadcast:!0,preventable:!0}),this.publish("pluginsloaded",{fireOnce:!0}),this.publish("atto:selectionchanged",{prefix:"atto"}),this},setupAutomaticPolling:function(){return this._registerEventHandle(this.editor.on(["keyup","paste","cut"],this.updateOriginal,this)),this},setupPlugins:function(){this.plugins={};var t=this.get("plugins"),n,r,i,s,o;for(n in t){r=t[n];if(!r.plugins)continue;for(i in r.plugins){s=r.plugins[i],o=e.mix({name:s.name,group:r.group,editor:this.editor,toolbar:this.toolbar,host:this},s);if(typeof e.M["atto_"+s.name]=="undefined")continue;this.plugins[s.name]=new e.M["atto_"+s.name].Button(o)}}return this.fire("pluginsloaded"),this},enablePlugins:function(e){this._setPluginState(!0,e)},disablePlugins:function(e){this._setPluginState(!1,e)},_setPluginState:function(t,n){var r="disableButtons";t&&(r="enableButtons"),n?this.plugins[n][r]():e.Object.each(this.plugins,function(e){e[r]()},this)},_registerEventHandle:function(e){this._eventHandles.push(e)}},{NS:"editor_atto",ATTRS:{elementid:{value:null,writeOnce:!0},contextid:{value:null,writeOnce:!0},plugins:{value:{},writeOnce:!0}}}),e.augment(s,e.EventTarget),e.namespace("M.editor_atto").Editor=s,e.namespace("M.editor_atto.Editor").init=function(t){return new e.M.editor_atto.Editor(t)};var o="moodle-editor_atto-editor-notify",u="info",a="warning";f.ATTRS={},f.prototype={messageOverlay:null,hideTimer:null,setupNotifications:function(){var e=new Image,t=new Image;return e.src=M.util.image_url("i/warning","moodle"),t.src=M.util.image_url("i/info","moodle"),this},showMessage:function(t,n,r){var i="",s,o;return this.messageOverlay===null&&(this.messageOverlay=e.Node.create('
              '),this.messageOverlay.hide(!0),this.textarea.get("parentNode").append(this.messageOverlay),this.messageOverlay.on("click",function(){this.messageOverlay.hide(!0)},this)),this.hideTimer!==null&&this.hideTimer.cancel(),n===a?i=''+M.util.get_string(':n===u&&(i=''+M.util.get_string('),s=parseInt(r,10),s<=0&&(s=6e4),n="atto_"+n,o=e.Node.create('"),this.messageOverlay.empty(),this.messageOverlay.append(o),this.messageOverlay.show(!0),this.hideTimer=e.later(s,this,function(){this.hideTimer=null,this.messageOverlay.hide(!0)}),this}},e.Base.mix(e.M.editor_atto.Editor,[f]),l.ATTRS={},l.prototype={_getEmptyContent:function(){return e.UA.ie&&e.UA.ie<10?"

              ":"


              "},updateFromTextArea:function(){this.editor.setHTML(""),this.editor.append(this.textarea.get("value")),this.cleanEditorHTML(),this.editor.getHTML()===""&&this.editor.setHTML(this._getEmptyContent())},updateOriginal:function(){var e=this.textarea.get("value"),t=this.getCleanHTML();return t===""&&this.isActive()&&(t=this._getEmptyContent()),e!==t&&(this.textarea.set("value",t),this.textarea.simulate("change"),this.fire("change")),this}},e.Base.mix(e.M.editor_atto.Editor,[l]);var c=5e3,h=6e4,p="moodle-editor_atto-editor-autosave";d.ATTRS={autosaveEnabled:{value:!0,writeOnce:!0},autosaveFrequency:{value:60,writeOnce:!0},pageHash:{value:"",writeOnce:!0},autosaveAjaxScript:{value:"/lib/editor/atto/autosave-ajax.php",readOnly:!0}},d.prototype={lastText:"",autosaveInstance:null,setupAutosave:function(){var t=-1,n=null,r=this.get("filepickeroptions"),i,s;if(!this.get("autosaveEnabled"))return;this.autosaveInstance=e.stamp(this);for(n in r)typeof r[n].itemid!="undefined"&&(t=r[n].itemid +);s=M.cfg.wwwroot+this.get("autosaveAjaxScript"),i={sesskey:M.cfg.sesskey,contextid:this.get("contextid"),action:"resume",drafttext:"",draftid:t,elementid:this.get("elementid"),pageinstance:this.autosaveInstance,pagehash:this.get("pageHash")},e.io(s,{method:"POST",data:i,context:this,on:{success:function(e,t){var n;if(typeof t.responseText!="undefined"&&t.responseText!==""){n=JSON.parse(t.responseText);if(n.result==="

              "||n.result==="


              "||n.result==="
              ")n.result="";if(n.result==="

               

              "||n.result==="


               

              ")n.result="";n.error||typeof n.result=="undefined"?this.showMessage(M.util.get_string("errortextrecovery","editor_atto"),a,h):n.result!==this.textarea.get("value")&&n.result!==""&&this.recoverText(n.result),this._fireSelectionChanged()}},failure:function(){this.showMessage(M.util.get_string("errortextrecovery","editor_atto"),a,h)}}});var o=parseInt(this.get("autosaveFrequency"),10)*1e3;return e.later(o,this,this.saveDraft,!1,!0),this.textarea.ancestor("form").on("submit",this.resetAutosave,this),this},resetAutosave:function(){var t=M.cfg.wwwroot+this.get("autosaveAjaxScript"),n={sesskey:M.cfg.sesskey,contextid:this.get("contextid"),action:"reset",elementid:this.get("elementid"),pageinstance:this.autosaveInstance,pagehash:this.get("pageHash")};return e.io(t,{method:"POST",data:n,sync:!0}),this},recoverText:function(e){return this.editor.setHTML(e),this.saveSelection(),this.updateOriginal(),this.lastText=e,this.showMessage(M.util.get_string("textrecovered","editor_atto"),u,h),this},saveDraft:function(){var t,n;this.editor.get("hidden")||this.updateOriginal();var r=this.textarea.get("value");if(r!==this.lastText){t=M.cfg.wwwroot+this.get("autosaveAjaxScript"),n={sesskey:M.cfg.sesskey,contextid:this.get("contextid"),action:"save",drafttext:r,elementid:this.get("elementid"),pagehash:this.get("pageHash"),pageinstance:this.autosaveInstance};var i=function(e,t){var n=parseInt(this.get("autosaveFrequency"),10)*1e3;this.showMessage(M.util.get_string("autosavefailed","editor_atto"),a,n)};e.io(t,{method:"POST",data:n,context:this,on:{error:i,failure:i,success:function(t,n){n.responseText!==""?e.soon(e.bind(i,this,[t,n])):(this.lastText=r,this.showMessage(M.util.get_string("autosavesucceeded","editor_atto"),u,c))}}})}return this}},e.Base.mix(e.M.editor_atto.Editor,[d]),v.ATTRS={},v.prototype={getCleanHTML:function(){var t=this.editor.cloneNode(!0),n;return e.each(t.all('[id^="yui"]'),function(e){e.removeAttribute("id")}),t.all(".atto_control").remove(!0),n=t.get("innerHTML"),n==="

              "||n==="


              "?"":this._cleanHTML(n)},cleanEditorHTML:function(){var e=this.editor.get("innerHTML");return this.editor.set("innerHTML",this._cleanHTML(e)),this},_cleanHTML:function(e){var t=[{regex://gi,replace:""},{regex:/<\\?\?xml[^>]*>/gi,replace:""},{regex:/<\/?\w+:[^>]*>/gi,replace:""},{regex:/\s*MSO[-:][^;"']*;?/gi,replace:""},{regex:/]*>( |\s)*<\/span>/gi,replace:""},{regex:/class="Mso[^"]*"/gi,replace:""},{regex:/<(\/?title|\/?meta|\/?style|\/?st\d|\/?head|\/?font|\/?html|\/?body|!\[)[^>]*?>/gi,replace:""},{regex:new RegExp(String.fromCharCode(8220),"gi"),replace:'"'},{regex:new RegExp(String.fromCharCode(8216),"gi"),replace:"'"},{regex:new RegExp(String.fromCharCode(8217),"gi"),replace:"'"},{regex:new RegExp(String.fromCharCode(8211),"gi"),replace:"-"},{regex:new RegExp(String.fromCharCode(8212),"gi"),replace:"--"},{regex:new RegExp(String.fromCharCode(189),"gi"),replace:"1/2"},{regex:new RegExp(String.fromCharCode(188),"gi"),replace:"1/4"},{regex:new RegExp(String.fromCharCode(190),"gi"),replace:"3/4"},{regex:new RegExp(String.fromCharCode(169),"gi"),replace:"(c)"},{regex:new RegExp(String.fromCharCode(174),"gi"),replace:"(r)"},{regex:new RegExp(String.fromCharCode(8230),"gi"),replace:"..."}],n=0;for(n=0;n'),this.openMenus=[],this._wrapper.appendChild(this.toolbar),this.textareaLabel&&this.toolbar.setAttribute("aria-labelledby",this.textareaLabel.get("id")),this.setupToolbarNavigation(),this}},e.Base.mix(e.M.editor_atto.Editor,[m]),g.ATTRS={},g.prototype={_tabFocus:null,setupToolbarNavigation:function(){return this._wrapper.delegate("key",this.toolbarKeyboardNavigation,"down:37,39","."+r.TOOLBAR,this),this._wrapper.delegate("focus",function(e){this._setTabFocus(e.currentTarget)},"."+r.TOOLBAR+" button",this),this},toolbarKeyboardNavigation:function(e){e.preventDefault();var t=this.toolbar.all("button"),n=1,r,i=e.target.ancestor("button",!0);e.keyCode===37&&(n=-1),r=this._findFirstFocusable(t,i,n),r&&(r.focus(),this._setTabFocus(r))},_findFirstFocusable:function(e,t,n){var r=0,i,s,o,u;u=e.indexOf(t),u<-1&&(u=0);while(r=e.size()&&(u=0),s=e.item(u),r++;if(s.hasAttribute("hidden")||s.hasAttribute("disabled"))continue;i=s.ancestor(".atto_group");if(i.hasAttribute("hidden"))continue;o=s;break}return o},checkTabFocus:function(){if(this._tabFocus)if(this._tabFocus.hasAttribute("disabled")||this._tabFocus.hasAttribute("hidden")||this._tabFocus.ancestor(".atto_group").hasAttribute("hidden")){var e=this._findFirstFocusable(this.toolbar.all("button"),this._tabFocus,-1);e&&(this._tabFocus.compareTo(document.activeElement)&&e.focus(),this._setTabFocus(e))}return this},_setTabFocus:function(e){return this._tabFocus&&this._tabFocus.setAttribute("tabindex","-1"),this._tabFocus=e,this._tabFocus.setAttribute("tabindex",0),this.toolbar.setAttribute("aria-activedescendant",this._tabFocus.generateID()),this}},e.Base.mix(e.M.editor_atto.Editor,[g]),y.ATTRS={},y.prototype={_selections:null,_lastSelection:null,_focusFromClick:!1,setupSelectionWatchers:function(){return this.on("atto:selectionchanged",this.saveSelection,this),this.editor.on("focus",this.restoreSelection +,this),this.editor.on("mousedown",function(){this._focusFromClick=!0},this),this.editor.on("blur",function(){this._focusFromClick=!1,this.updateOriginal()},this),this.editor.on(["keyup","focus"],function(t){e.soon(e.bind(this._hasSelectionChanged,this,t))},this),this.editor.on("gesturemoveend",function(t){e.soon(e.bind(this._hasSelectionChanged,this,t))},{standAlone:!0},this),this},isActive:function(){var e=i.createRange(),t=i.getSelection();return t.rangeCount?!document.activeElement||!this.editor.compareTo(document.activeElement)&&!this.editor.contains(document.activeElement)?!1:(e.selectNode(this.editor.getDOMNode()),e.intersectsRange(t.getRangeAt(0))):!1},getSelectionFromNode:function(e){var t=i.createRange();return t.selectNode(e.getDOMNode()),[t]},saveSelection:function(){this.isActive()&&(this._selections=this.getSelection())},restoreSelection:function(){this._focusFromClick||this._selections&&this.setSelection(this._selections),this._focusFromClick=!1},getSelection:function(){return i.getSelection().getAllRanges()},selectionContainsNode:function(e){return i.getSelection().containsNode(e.getDOMNode(),!0)},selectionFilterMatches:function(e,t,n){typeof n=="undefined"&&(n=!0),t||(t=this.getSelectedNodes());var r=t.size()>0,i=!1,s=this.editor,o=function(e){return e===s};return s.one(e)?(t.each(function(t){if(n){if(!r||!t.ancestor(e,!0,o))r=!1}else!i&&t.ancestor(e,!0,o)&&(i=!0)},this),n?r:i):!1},getSelectedNodes:function(){var t=new e.NodeList,n,r,s,o,u;r=i.getSelection(),r.rangeCount?s=r.getRangeAt(0):s=i.createRange(),s.collapsed&&s.commonAncestorContainer!==this.editor.getDOMNode()&&s.commonAncestorContainer!==e.config.doc&&(s=s.cloneRange(),s.selectNode(s.commonAncestorContainer)),n=s.getNodes();for(u=0;u

              "),i.get("childNodes").each(function(e){u.append(e.remove())}),i.append(u),o=u),t&&t!==""&&(f=e.Node.create("<"+t+">"),f.setAttrs(o.getAttrs()),o.get("childNodes").each(function(e){e.remove(),f.append(e)}),o.replace(f),o=f),n&&o.setAttrs(n);var l=this.getSelectionFromNode(o);return this.setSelection(l),o}},e.Base.mix(e.M.editor_atto.Editor,[b]),w.ATTRS={filepickeroptions:{value:{}}},w.prototype={canShowFilepicker:function(e){return typeof this.get("filepickeroptions")[e]!="undefined"},showFilepicker:function(t,n,r){var i=this;e.use("core_filepicker",function(e){var s=e.clone(i.get("filepickeroptions")[t],!0);s.formcallback=n,r&&(s.magicscope=r),M.core_filepicker.show(e,s)})}},e.Base.mix(e.M.editor_atto.Editor,[w])},"@VERSION@",{requires:["node","transition","io","overlay","escape","event","event-simulate","event-custom","yui-throttle","moodle-core-notification-dialogue","moodle-core-notification-confirm","moodle-editor_atto-rangy","handlebars","timers"]}); diff --git a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor.js b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor.js index a187a9f7f8d..c4a9cdb407f 100644 --- a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor.js +++ b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor.js @@ -37,7 +37,8 @@ var CSS = { TOOLBAR: 'editor_atto_toolbar', WRAPPER: 'editor_atto', HIGHLIGHT: 'highlight' - }; + }, + rangy = window.rangy; /** * The Atto editor for Moodle. @@ -808,7 +809,9 @@ EditorAutosave.prototype = { setupAutosave: function() { var draftid = -1, optiontype = null, - options = this.get('filepickeroptions'); + options = this.get('filepickeroptions'), + params, + url; if (!this.get('autosaveEnabled')) { // Autosave disabled for this instance. @@ -842,6 +845,7 @@ EditorAutosave.prototype = { context: this, on: { success: function(id,o) { + var response_json; if (typeof o.responseText !== "undefined" && o.responseText !== "") { response_json = JSON.parse(o.responseText); @@ -858,7 +862,8 @@ EditorAutosave.prototype = { } if (response_json.error || typeof response_json.result === 'undefined') { - this.showMessage(M.util.get_string('errortextrecovery', 'editor_atto'), NOTIFY_WARNING, RECOVER_MESSAGE_TIMEOUT); + this.showMessage(M.util.get_string('errortextrecovery', 'editor_atto'), + NOTIFY_WARNING, RECOVER_MESSAGE_TIMEOUT); } else if (response_json.result !== this.textarea.get('value') && response_json.result !== '') { this.recoverText(response_json.result); @@ -867,7 +872,8 @@ EditorAutosave.prototype = { } }, failure: function() { - this.showMessage(M.util.get_string('errortextrecovery', 'editor_atto'), NOTIFY_WARNING, RECOVER_MESSAGE_TIMEOUT); + this.showMessage(M.util.get_string('errortextrecovery', 'editor_atto'), + NOTIFY_WARNING, RECOVER_MESSAGE_TIMEOUT); } } }); @@ -890,8 +896,8 @@ EditorAutosave.prototype = { */ resetAutosave: function() { // Make an ajax request to reset the autosaved text. - url = M.cfg.wwwroot + this.get('autosaveAjaxScript'); - params = { + var url = M.cfg.wwwroot + this.get('autosaveAjaxScript'); + var params = { sesskey: M.cfg.sesskey, contextid: this.get('contextid'), action: 'reset', @@ -922,7 +928,8 @@ EditorAutosave.prototype = { this.updateOriginal(); this.lastText = text; - this.showMessage(M.util.get_string('textrecovered', 'editor_atto'), NOTIFY_INFO, RECOVER_MESSAGE_TIMEOUT); + this.showMessage(M.util.get_string('textrecovered', 'editor_atto'), + NOTIFY_INFO, RECOVER_MESSAGE_TIMEOUT); return this; }, @@ -934,6 +941,7 @@ EditorAutosave.prototype = { * @chainable */ saveDraft: function() { + var url, params; // Only copy the text from the div to the textarea if the textarea is not currently visible. if (!this.editor.get('hidden')) { this.updateOriginal(); @@ -973,7 +981,8 @@ EditorAutosave.prototype = { } else { // All working. this.lastText = newText; - this.showMessage(M.util.get_string('autosavesucceeded', 'editor_atto'), NOTIFY_INFO, SUCCESS_MESSAGE_TIMEOUT); + this.showMessage(M.util.get_string('autosavesucceeded', 'editor_atto'), + NOTIFY_INFO, SUCCESS_MESSAGE_TIMEOUT); } } } @@ -1362,7 +1371,7 @@ EditorToolbarNav.prototype = { if (this._tabFocus.hasAttribute('disabled') || this._tabFocus.hasAttribute('hidden') || this._tabFocus.ancestor('.atto_group').hasAttribute('hidden')) { // Find first available button. - button = this._findFirstFocusable(this.toolbar.all('button'), this._tabFocus, -1); + var button = this._findFirstFocusable(this.toolbar.all('button'), this._tabFocus, -1); if (button) { if (this._tabFocus.compareTo(document.activeElement)) { // We should also move the focus, because the inaccessible button also has the focus. diff --git a/lib/editor/atto/yui/build/moodle-editor_atto-menu/moodle-editor_atto-menu-debug.js b/lib/editor/atto/yui/build/moodle-editor_atto-menu/moodle-editor_atto-menu-debug.js index 89f6576d2eb..e0d9cdbbf23 100644 --- a/lib/editor/atto/yui/build/moodle-editor_atto-menu/moodle-editor_atto-menu-debug.js +++ b/lib/editor/atto/yui/build/moodle-editor_atto-menu/moodle-editor_atto-menu-debug.js @@ -25,6 +25,7 @@ YUI.add('moodle-editor_atto-menu', function (Y, NAME) { * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +var LOGNAME = 'moodle-editor_atto-menu'; var MENUDIALOGUE = '' + '
              ' + @@ -51,7 +52,7 @@ var MENUDIALOGUE = '' + * @constructor * @extends M.core.dialogue */ -Menu = function() { +var Menu = function() { Menu.superclass.constructor.apply(this, arguments); }; @@ -173,7 +174,8 @@ Y.extend(Menu, M.core.dialogue, { index = 0, direction = 1, checkCount = 0, - current = e.target.ancestor('a[role="menuitem"]', true); + current = e.target.ancestor('a[role="menuitem"]', true), + next; // Determine which button is currently selected. while (!found && index < buttons.size()) { diff --git a/lib/editor/atto/yui/build/moodle-editor_atto-menu/moodle-editor_atto-menu-min.js b/lib/editor/atto/yui/build/moodle-editor_atto-menu/moodle-editor_atto-menu-min.js index d1b89010bc6..aadc4abf490 100644 --- a/lib/editor/atto/yui/build/moodle-editor_atto-menu/moodle-editor_atto-menu-min.js +++ b/lib/editor/atto/yui/build/moodle-editor_atto-menu/moodle-editor_atto-menu-min.js @@ -1 +1 @@ -YUI.add("moodle-editor_atto-menu",function(e,t){var n='
              ';Menu=function(){Menu.superclass.constructor.apply(this,arguments)},e.extend(Menu,M.core.dialogue,{_menuHandlers:null,initializer:function(t){var r,i;this._menuHandlers=[];var s=e.Handlebars.compile(n),o=e.Node.create(s({config:t}));this.set("bodyContent",o),i=this.get("boundingBox"),i.addClass("editor_atto_controlmenu"),i.addClass("editor_atto_menu"),i.one(".moodle-dialogue-wrap").removeClass("moodle-dialogue-wrap").addClass("moodle-dialogue-content"),r=e.Node.create("

              ").addClass("accesshide").setHTML(this.get("headerText")),this.get("bodyContent").prepend(r),this.headerNode.hide(),this.footerNode.hide(),this._setupHandlers()},_setupHandlers:function(){var e=this.get("contentBox");this._menuHandlers.push(e.delegate("key",this._chooseMenuItem,"32, enter",".atto_menuentry",this),e.delegate("key",this._handleKeyboardEvent,"down:38,40",".dropdown-menu",this),e.on("focusoutside",this.hide,this),e.delegate("key",this.hide,"down:37,39,esc",".dropdown-menu",this))},_chooseMenuItem:function(e){e.target.simulate("click"),e.preventDefault()},hide:function(e){if(this.get("preventHideMenu")===!0)return;return e&&e.preventDefault(),Menu.superclass.hide.call(this,arguments)},_handleKeyboardEvent:function(e){e.preventDefault();var t=e.currentTarget.all('a[role="menuitem"]'),n=!1,r=0,i=1,s=0,o=e.target.ancestor('a[role="menuitem"]',!0);while(!n&&r=t.size()&&(r=0),next=t.item(r),s++;while(s").addClass("accesshide").setHTML(this.get("headerText")),this.get("bodyContent").prepend(n),this.headerNode.hide(),this.footerNode.hide(),this._setupHandlers()},_setupHandlers:function(){var e=this.get("contentBox");this._menuHandlers.push(e.delegate("key",this._chooseMenuItem,"32, enter",".atto_menuentry",this),e.delegate("key",this._handleKeyboardEvent,"down:38,40",".dropdown-menu",this),e.on("focusoutside",this.hide,this),e.delegate("key",this.hide,"down:37,39,esc",".dropdown-menu",this))},_chooseMenuItem:function(e){e.target.simulate("click"),e.preventDefault()},hide:function(e){if(this.get("preventHideMenu")===!0)return;return e&&e.preventDefault(),i.superclass.hide.call(this,arguments)},_handleKeyboardEvent:function(e){e.preventDefault();var t=e.currentTarget.all('a[role="menuitem"]'),n=!1,r=0,i=1,s=0,o=e.target.ancestor('a[role="menuitem"]',!0),u;while(!n&&r=t.size()&&(r=0),u=t.item(r),s++;while(s' + @@ -51,7 +52,7 @@ var MENUDIALOGUE = '' + * @constructor * @extends M.core.dialogue */ -Menu = function() { +var Menu = function() { Menu.superclass.constructor.apply(this, arguments); }; @@ -173,7 +174,8 @@ Y.extend(Menu, M.core.dialogue, { index = 0, direction = 1, checkCount = 0, - current = e.target.ancestor('a[role="menuitem"]', true); + current = e.target.ancestor('a[role="menuitem"]', true), + next; // Determine which button is currently selected. while (!found && index < buttons.size()) { diff --git a/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-debug.js b/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-debug.js index a378090f1b1..3bbe5425b0b 100644 --- a/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-debug.js +++ b/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-debug.js @@ -92,7 +92,8 @@ Y.extend(EditorPlugin, Y.Base, { /** * Mark the content ediable content as having been changed. * - * This is a convenience function and passes through to {{#crossLink "M.editor_atto.EditorTextArea/updateOriginal"}}updateOriginal{{/crossLink}}. + * This is a convenience function and passes through to + * {{#crossLink "M.editor_atto.EditorTextArea/updateOriginal"}}updateOriginal{{/crossLink}}. * * @method markUpdated */ @@ -183,7 +184,8 @@ var MENUTEMPLATE = '' + 'title="{{title}}">' + '' + - '' + + '' + ''; var DISABLED = 'disabled', @@ -357,7 +359,8 @@ EditorPluginButtons.prototype = { // Create the actual button. button = Y.Node.create(''); button.setAttribute('title', title); @@ -430,7 +433,8 @@ EditorPluginButtons.prototype = { /** * Add a basic button which ties into the execCommand. * - * See {{#crossLink "M.editor_atto.EditorPluginButtons/addButton:method"}}addButton{{/crossLink}} for full details of the optional parameters. + * See {{#crossLink "M.editor_atto.EditorPluginButtons/addButton:method"}}addButton{{/crossLink}} + * for full details of the optional parameters. * * @method addBasicButton * @param {object} config The button configuration @@ -659,7 +663,6 @@ EditorPluginButtons.prototype = { // Cancel the hide menu prevention. menuDialogue.set('preventHideMenu', false); - console.log('Menu item chosen'); // Set the focus after hide so that focus is returned to the editor and changes are made correctly. menuDialogue.set('focusAfterHide', this.get('host').editor); menuDialogue.hide(e); diff --git a/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-min.js b/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-min.js index 72e69db54c0..8f5f3ca60df 100644 --- a/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-min.js +++ b/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-min.js @@ -1,2 +1,2 @@ -YUI.add("moodle-editor_atto-plugin",function(e,t){function n(){n.superclass.constructor.apply(this,arguments)}function l(){}function c(){}var r=".atto_group.",i="_group";e.extend(n,e.Base,{name:null,editor:null,toolbar:null,initializer:function(e){this.name=e.name,this.toolbar=e.toolbar,this.editor=e.editor,this.buttons={},this.buttonNames=[],this.buttonStates={},this.menus={},this._primaryKeyboardShortcut=[],this._buttonHandlers=[],this._menuHideHandlers=[],this._highlightQueue={}},markUpdated:function(){return this.get("host").saveSelection(),this.get("host").updateOriginal()}},{NAME:"editorPlugin",ATTRS:{host:{writeOnce:!0},group:{writeOnce:!0,getter:function(t){var n=this.toolbar.one(r+t+i);return n||(n=e.Node.create('
              '),this.toolbar.append(n)),n}}}}),e.namespace("M.editor_atto").EditorPlugin=n;var s='',o="disabled",u="highlight",a="moodle-editor_atto-editor-plugin",f={EDITORWRAPPER:".editor_atto_content"};l.ATTRS={},l.prototype={buttons:null,buttonNames:null,buttonStates:null,menus:null,DISABLED:0,ENABLED:1,_buttonHandlers:null,_menuHideHandlers:null,_primaryKeyboardShortcut:null,_highlightQueue:null,addButton:function(t){var n=this.get("group"),r=this.name,i="atto_"+r+"_button",s,o=this.get("host");t.exec&&(i=i+"_"+t.exec),t.buttonName?i=i+"_"+t.buttonName:t.buttonName=t.exec||r,t.buttonClass=i,t=this._normalizeIcon(t),t.title||(t.title="pluginname");var u=M.util.get_string(t.title,"atto_"+r);s=e.Node.create('"),s.setAttribute("title",u),n.append(s);var a=this.toolbar.getAttribute("aria-activedescendant");a||(s.setAttribute("tabindex","0"),this.toolbar.setAttribute("aria-activedescendant",s.generateID()),this.get("host")._tabFocus=s),t=this._normalizeCallback(t),this._buttonHandlers.push(this.toolbar.delegate("click",t.callback,"."+i,this)),t.keys&&(typeof t.keyDescription!="undefined"&&(this._primaryKeyboardShortcut[i]=t.keyDescription),this._addKeyboardListener(t.callback,t.keys,i),this._primaryKeyboardShortcut[i]&&s.setAttribute("title",M.util.get_string("plugin_title_shortcut","editor_atto",{title:u,shortcut:this._primaryKeyboardShortcut[i]})));if(t.tags){var f=!0;typeof t.tagMatchRequiresAll=="boolean"&&(f=t.tagMatchRequiresAll),this._buttonHandlers.push(o.on(["atto:selectionchanged","change"],function(n){typeof this._highlightQueue[t.buttonName]!="undefined"&&this._highlightQueue[t.buttonName].cancel(),this._highlightQueue[t.buttonName]=e.soon(e.bind(function(e){o.selectionFilterMatches(t.tags,e.selectedNodes,f)?this.highlightButtons(t.buttonName):this.unHighlightButtons(t.buttonName)},this,n))},this))}return this.buttonNames.push(t.buttonName),this.buttons[t.buttonName]=s,this.buttonStates[t.buttonName]=this.ENABLED,s},addBasicButton:function(e){return e.exec?(e.icon||(e.icon="e/"+e.exec),e.callback=function(){document.execCommand(e.exec,!1,null),this.markUpdated()},this.addButton(e)):null},addToolbarMenu:function(t){var n=this.get("group"),r=this.name,i="atto_"+r+"_button",o,u;t.buttonName?i=i+"_"+t.buttonName:t.buttonName=r,t.buttonClass=i,t=this._normalizeIcon(t),t.title||(t.title="pluginname");var a=M.util.get_string(t.title,"atto_"+r);t.menuColor||(t.menuColor="transparent");var f=e.Handlebars.compile(s);return o=e.Node.create(f({buttonClass:i,config:t,title:a})),n.append(o),u=this.toolbar.getAttribute("aria-activedescendant"),u||(o.setAttribute("tabindex","0"),this.toolbar.setAttribute("aria-activedescendant",o.generateID())),this._buttonHandlers.push(this.toolbar.delegate("click",this._showToolbarMenu,"."+i,this,t),this.toolbar.delegate("key",this._showToolbarMenuAndFocus,"40, 32, enter","."+i,this,t)),this.buttonNames.push(t.buttonName),this.buttons[t.buttonName]=o,this.buttonStates[t.buttonName]=this.ENABLED,o},_showToolbarMenu:function(t,n){t.preventDefault();if(!this.isEnabled())return;if(t.currentTarget.ancestor("button",!0).hasAttribute(o))return;var r;this.menus[n.buttonClass]||(n.overlayWidth||(n.overlayWidth="14"),n.innerOverlayWidth||(n.innerOverlayWidth=parseInt(n.overlayWidth,10)-2+"em"),n.overlayWidth=parseInt(n.overlayWidth,10)+"em",this.menus[n.buttonClass]=new e.M.editor_atto.Menu(n),this.menus[n.buttonClass].get("contentBox").delegate("click",this._chooseMenuItem,".atto_menuentry a",this,n)),e.Array.each(this.get("host").openMenus,function(e){e.set("focusAfterHide",null)});var i=this.buttons[n.buttonName];i.focus(),this.get("host")._setTabFocus(i),r=this.menus[n.buttonClass],r.set("focusAfterHide",i),r.show(),r.align(this.buttons[n.buttonName],[e.WidgetPositionAlign.TL,e.WidgetPositionAlign.BL]),this.get("host").openMenus=[r]},_showToolbarMenuAndFocus:function(e,t){this._showToolbarMenu(e,t),this.menus[t.buttonClass].get("boundingBox").one("a").focus()},_chooseMenuItem:function(e,t,n){var r=e.target.ancestor("a",!0).getData("index"),i=this._normalizeCallback(t.items[r],t.globalItemConfig);n=this.menus[t.buttonClass],n.set("preventHideMenu",!0),i.callback(e,i._callback,i.callbackArgs),n.set("preventHideMenu",!1),console.log("Menu item chosen"),n.set("focusAfterHide",this.get("host").editor),n.hide(e)},_normalizeCallback:function(t,n){return t._callbackNormalized?t:(n||(n={}),t._callback=t.callback||n.callback,t.callback=e.rbind(this._callbackWrapper,this,t._callback,t.callbackArgs),t._callbackNormalized=!0,t)},_normalizeIcon:function(e){return e.iconurl||(e.iconComponent||(e.iconComponent="core"),e.iconurl=M.util.image_url(e.icon,e.iconComponent)),e},_callbackWrapper:function(e,t,n -){e.preventDefault();if(!this.isEnabled())return;var r=e.currentTarget.ancestor("button",!0);if(r&&r.hasAttribute(o))return;!YUI.Env.UA.android&&!this.get("host").isActive()&&this.get("host").focus(),this.get("host").saveSelection(),r&&this.get("host")._setTabFocus(r);var i=[e,n];return this.get("host").restoreSelection(),t.apply(this,i)},_addKeyboardListener:function(t,n,r){var i="key",s=f.EDITORWRAPPER,o,u,a;if(e.Lang.isArray(n))return e.Array.each(n,function(e){this._addKeyboardListener(t,e)},this),this;typeof n=="object"?(n.eventtype&&(i=n.eventtype),n.container&&(s=n.container),o=n.keyCodes,u=t):(a=this._getDefaultMetaKey(),o=this._getKeyEvent()+n+"+"+a,typeof this._primaryKeyboardShortcut[r]=="undefined"&&(this._primaryKeyboardShortcut[r]=this._getDefaultMetaKeyDescription(n)),u=e.bind(function(e,n){this._eventUsesExactKeyModifiers(e,n)&&t.apply(this,[n])},this,[a])),this._buttonHandlers.push(this.editor.delegate(i,u,o,s,this))},_eventUsesExactKeyModifiers:function(t,n){var r=!0,i;return n.type!=="key"?!1:(i=e.Array.indexOf(t,"alt")>-1,r=r&&(n.altKey&&i||!n.altKey&&!i),i=e.Array.indexOf(t,"ctrl")>-1,r=r&&(n.ctrlKey&&i||!n.ctrlKey&&!i),i=e.Array.indexOf(t,"meta")>-1,r=r&&(n.metaKey&&i||!n.metaKey&&!i),i=e.Array.indexOf(t,"shift")>-1,r=r&&(n.shiftKey&&i||!n.shiftKey&&!i),r)},isEnabled:function(){var t=e.Object.some(this.buttonStates,function(e){return e===this.ENABLED},this);return t},disableButtons:function(e){return this._setButtonState(!1,e)},enableButtons:function(e){return this._setButtonState(!0,e)},_setButtonState:function(t,n){var r="setAttribute";return t&&(r="removeAttribute"),n?this.buttons[n]&&(this.buttons[n][r](o,o),this.buttonStates[n]=t?this.ENABLED:this.DISABLED):e.Array.each(this.buttonNames,function(e){this.buttons[e][r](o,o),this.buttonStates[e]=t?this.ENABLED:this.DISABLED},this),this.get("host").checkTabFocus(),this},highlightButtons:function(e){return this._changeButtonHighlight(!0,e)},unHighlightButtons:function(e){return this._changeButtonHighlight(!1,e)},_changeButtonHighlight:function(t,n){var r="addClass";return t||(r="removeClass"),n?this.buttons[n]&&this.buttons[n][r](u):e.Object.each(this.buttons,function(e){e[r](u)},this),this},_getDefaultMetaKey:function(){return e.UA.os==="macintosh"?"meta":"ctrl"},_getDefaultMetaKeyDescription:function(t){return e.UA.os==="macintosh"?M.util.get_string("editor_command_keycode","editor_atto",String.fromCharCode(t).toLowerCase()):M.util.get_string("editor_control_keycode","editor_atto",String.fromCharCode(t).toLowerCase())},_getKeyEvent:function(){return"down:"}},e.Base.mix(e.M.editor_atto.EditorPlugin,[l]),c.ATTRS={},c.prototype={_dialogue:null,getDialogue:function(t){t=t||{};var n=!1;t.focusAfterHide&&(n=t.focusAfterHide,delete t.focusAfterHide);if(!this._dialogue){var r=e.merge({visible:!1,modal:!0,close:!0,draggable:!0},t);this._dialogue=new M.core.dialogue(r)}return n!==!1&&(n===!0?this._dialogue.set("focusAfterHide",this.buttons[this.buttonNames[0]]):typeof n=="string"?this._dialogue.set("focusAfterHide",this.buttons[n]):this._dialogue.set("focusAfterHide",n)),this._dialogue}},e.Base.mix(e.M.editor_atto.EditorPlugin,[c])},"@VERSION@",{requires:["node","base","escape","event","event-outside","handlebars","event-custom","timers"]}); +YUI.add("moodle-editor_atto-plugin",function(e,t){function n(){n.superclass.constructor.apply(this,arguments)}function l(){}function c(){}var r=".atto_group.",i="_group";e.extend(n,e.Base,{name:null,editor:null,toolbar:null,initializer:function(e){this.name=e.name,this.toolbar=e.toolbar,this.editor=e.editor,this.buttons={},this.buttonNames=[],this.buttonStates={},this.menus={},this._primaryKeyboardShortcut=[],this._buttonHandlers=[],this._menuHideHandlers=[],this._highlightQueue={}},markUpdated:function(){return this.get("host").saveSelection(),this.get("host").updateOriginal()}},{NAME:"editorPlugin",ATTRS:{host:{writeOnce:!0},group:{writeOnce:!0,getter:function(t){var n=this.toolbar.one(r+t+i);return n||(n=e.Node.create('
              '),this.toolbar.append(n)),n}}}}),e.namespace("M.editor_atto").EditorPlugin=n;var s='',o="disabled",u="highlight",a="moodle-editor_atto-editor-plugin",f={EDITORWRAPPER:".editor_atto_content"};l.ATTRS={},l.prototype={buttons:null,buttonNames:null,buttonStates:null,menus:null,DISABLED:0,ENABLED:1,_buttonHandlers:null,_menuHideHandlers:null,_primaryKeyboardShortcut:null,_highlightQueue:null,addButton:function(t){var n=this.get("group"),r=this.name,i="atto_"+r+"_button",s,o=this.get("host");t.exec&&(i=i+"_"+t.exec),t.buttonName?i=i+"_"+t.buttonName:t.buttonName=t.exec||r,t.buttonClass=i,t=this._normalizeIcon(t),t.title||(t.title="pluginname");var u=M.util.get_string(t.title,"atto_"+r);s=e.Node.create('"),s.setAttribute("title",u),n.append(s);var a=this.toolbar.getAttribute("aria-activedescendant");a||(s.setAttribute("tabindex","0"),this.toolbar.setAttribute("aria-activedescendant",s.generateID()),this.get("host")._tabFocus=s),t=this._normalizeCallback(t),this._buttonHandlers.push(this.toolbar.delegate("click",t.callback,"."+i,this)),t.keys&&(typeof t.keyDescription!="undefined"&&(this._primaryKeyboardShortcut[i]=t.keyDescription),this._addKeyboardListener(t.callback,t.keys,i),this._primaryKeyboardShortcut[i]&&s.setAttribute("title",M.util.get_string("plugin_title_shortcut","editor_atto",{title:u,shortcut:this._primaryKeyboardShortcut[i]})));if(t.tags){var f=!0;typeof t.tagMatchRequiresAll=="boolean"&&(f=t.tagMatchRequiresAll),this._buttonHandlers.push(o.on(["atto:selectionchanged","change"],function(n){typeof this._highlightQueue[t.buttonName]!="undefined"&&this._highlightQueue[t.buttonName].cancel(),this._highlightQueue[t.buttonName]=e.soon(e.bind(function(e){o.selectionFilterMatches(t.tags,e.selectedNodes,f)?this.highlightButtons(t.buttonName):this.unHighlightButtons(t.buttonName)},this,n))},this))}return this.buttonNames.push(t.buttonName),this.buttons[t.buttonName]=s,this.buttonStates[t.buttonName]=this.ENABLED,s},addBasicButton:function(e){return e.exec?(e.icon||(e.icon="e/"+e.exec),e.callback=function(){document.execCommand(e.exec,!1,null),this.markUpdated()},this.addButton(e)):null},addToolbarMenu:function(t){var n=this.get("group"),r=this.name,i="atto_"+r+"_button",o,u;t.buttonName?i=i+"_"+t.buttonName:t.buttonName=r,t.buttonClass=i,t=this._normalizeIcon(t),t.title||(t.title="pluginname");var a=M.util.get_string(t.title,"atto_"+r);t.menuColor||(t.menuColor="transparent");var f=e.Handlebars.compile(s);return o=e.Node.create(f({buttonClass:i,config:t,title:a})),n.append(o),u=this.toolbar.getAttribute("aria-activedescendant"),u||(o.setAttribute("tabindex","0"),this.toolbar.setAttribute("aria-activedescendant",o.generateID())),this._buttonHandlers.push(this.toolbar.delegate("click",this._showToolbarMenu,"."+i,this,t),this.toolbar.delegate("key",this._showToolbarMenuAndFocus,"40, 32, enter","."+i,this,t)),this.buttonNames.push(t.buttonName),this.buttons[t.buttonName]=o,this.buttonStates[t.buttonName]=this.ENABLED,o},_showToolbarMenu:function(t,n){t.preventDefault();if(!this.isEnabled())return;if(t.currentTarget.ancestor("button",!0).hasAttribute(o))return;var r;this.menus[n.buttonClass]||(n.overlayWidth||(n.overlayWidth="14"),n.innerOverlayWidth||(n.innerOverlayWidth=parseInt(n.overlayWidth,10)-2+"em"),n.overlayWidth=parseInt(n.overlayWidth,10)+"em",this.menus[n.buttonClass]=new e.M.editor_atto.Menu(n),this.menus[n.buttonClass].get("contentBox").delegate("click",this._chooseMenuItem,".atto_menuentry a",this,n)),e.Array.each(this.get("host").openMenus,function(e){e.set("focusAfterHide",null)});var i=this.buttons[n.buttonName];i.focus(),this.get("host")._setTabFocus(i),r=this.menus[n.buttonClass],r.set("focusAfterHide",i),r.show(),r.align(this.buttons[n.buttonName],[e.WidgetPositionAlign.TL,e.WidgetPositionAlign.BL]),this.get("host").openMenus=[r]},_showToolbarMenuAndFocus:function(e,t){this._showToolbarMenu(e,t),this.menus[t.buttonClass].get("boundingBox").one("a").focus()},_chooseMenuItem:function(e,t,n){var r=e.target.ancestor("a",!0).getData("index"),i=this._normalizeCallback(t.items[r],t.globalItemConfig);n=this.menus[t.buttonClass],n.set("preventHideMenu",!0),i.callback(e,i._callback,i.callbackArgs),n.set("preventHideMenu",!1),n.set("focusAfterHide",this.get("host").editor),n.hide(e)},_normalizeCallback:function(t,n){return t._callbackNormalized?t:(n||(n={}),t._callback=t.callback||n.callback,t.callback=e.rbind(this._callbackWrapper,this,t._callback,t.callbackArgs),t._callbackNormalized=!0,t)},_normalizeIcon:function(e){return e.iconurl||(e.iconComponent||(e.iconComponent="core"),e.iconurl=M.util.image_url(e.icon,e.iconComponent)),e},_callbackWrapper:function(e,t,n){e.preventDefault();if(!this.isEnabled +())return;var r=e.currentTarget.ancestor("button",!0);if(r&&r.hasAttribute(o))return;!YUI.Env.UA.android&&!this.get("host").isActive()&&this.get("host").focus(),this.get("host").saveSelection(),r&&this.get("host")._setTabFocus(r);var i=[e,n];return this.get("host").restoreSelection(),t.apply(this,i)},_addKeyboardListener:function(t,n,r){var i="key",s=f.EDITORWRAPPER,o,u,a;if(e.Lang.isArray(n))return e.Array.each(n,function(e){this._addKeyboardListener(t,e)},this),this;typeof n=="object"?(n.eventtype&&(i=n.eventtype),n.container&&(s=n.container),o=n.keyCodes,u=t):(a=this._getDefaultMetaKey(),o=this._getKeyEvent()+n+"+"+a,typeof this._primaryKeyboardShortcut[r]=="undefined"&&(this._primaryKeyboardShortcut[r]=this._getDefaultMetaKeyDescription(n)),u=e.bind(function(e,n){this._eventUsesExactKeyModifiers(e,n)&&t.apply(this,[n])},this,[a])),this._buttonHandlers.push(this.editor.delegate(i,u,o,s,this))},_eventUsesExactKeyModifiers:function(t,n){var r=!0,i;return n.type!=="key"?!1:(i=e.Array.indexOf(t,"alt")>-1,r=r&&(n.altKey&&i||!n.altKey&&!i),i=e.Array.indexOf(t,"ctrl")>-1,r=r&&(n.ctrlKey&&i||!n.ctrlKey&&!i),i=e.Array.indexOf(t,"meta")>-1,r=r&&(n.metaKey&&i||!n.metaKey&&!i),i=e.Array.indexOf(t,"shift")>-1,r=r&&(n.shiftKey&&i||!n.shiftKey&&!i),r)},isEnabled:function(){var t=e.Object.some(this.buttonStates,function(e){return e===this.ENABLED},this);return t},disableButtons:function(e){return this._setButtonState(!1,e)},enableButtons:function(e){return this._setButtonState(!0,e)},_setButtonState:function(t,n){var r="setAttribute";return t&&(r="removeAttribute"),n?this.buttons[n]&&(this.buttons[n][r](o,o),this.buttonStates[n]=t?this.ENABLED:this.DISABLED):e.Array.each(this.buttonNames,function(e){this.buttons[e][r](o,o),this.buttonStates[e]=t?this.ENABLED:this.DISABLED},this),this.get("host").checkTabFocus(),this},highlightButtons:function(e){return this._changeButtonHighlight(!0,e)},unHighlightButtons:function(e){return this._changeButtonHighlight(!1,e)},_changeButtonHighlight:function(t,n){var r="addClass";return t||(r="removeClass"),n?this.buttons[n]&&this.buttons[n][r](u):e.Object.each(this.buttons,function(e){e[r](u)},this),this},_getDefaultMetaKey:function(){return e.UA.os==="macintosh"?"meta":"ctrl"},_getDefaultMetaKeyDescription:function(t){return e.UA.os==="macintosh"?M.util.get_string("editor_command_keycode","editor_atto",String.fromCharCode(t).toLowerCase()):M.util.get_string("editor_control_keycode","editor_atto",String.fromCharCode(t).toLowerCase())},_getKeyEvent:function(){return"down:"}},e.Base.mix(e.M.editor_atto.EditorPlugin,[l]),c.ATTRS={},c.prototype={_dialogue:null,getDialogue:function(t){t=t||{};var n=!1;t.focusAfterHide&&(n=t.focusAfterHide,delete t.focusAfterHide);if(!this._dialogue){var r=e.merge({visible:!1,modal:!0,close:!0,draggable:!0},t);this._dialogue=new M.core.dialogue(r)}return n!==!1&&(n===!0?this._dialogue.set("focusAfterHide",this.buttons[this.buttonNames[0]]):typeof n=="string"?this._dialogue.set("focusAfterHide",this.buttons[n]):this._dialogue.set("focusAfterHide",n)),this._dialogue}},e.Base.mix(e.M.editor_atto.EditorPlugin,[c])},"@VERSION@",{requires:["node","base","escape","event","event-outside","handlebars","event-custom","timers"]}); diff --git a/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin.js b/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin.js index eaf01d04140..a7abfe690be 100644 --- a/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin.js +++ b/lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin.js @@ -92,7 +92,8 @@ Y.extend(EditorPlugin, Y.Base, { /** * Mark the content ediable content as having been changed. * - * This is a convenience function and passes through to {{#crossLink "M.editor_atto.EditorTextArea/updateOriginal"}}updateOriginal{{/crossLink}}. + * This is a convenience function and passes through to + * {{#crossLink "M.editor_atto.EditorTextArea/updateOriginal"}}updateOriginal{{/crossLink}}. * * @method markUpdated */ @@ -183,7 +184,8 @@ var MENUTEMPLATE = '' + 'title="{{title}}">' + '' + - '' + + '' + ''; var DISABLED = 'disabled', @@ -357,7 +359,8 @@ EditorPluginButtons.prototype = { // Create the actual button. button = Y.Node.create(''); button.setAttribute('title', title); @@ -430,7 +433,8 @@ EditorPluginButtons.prototype = { /** * Add a basic button which ties into the execCommand. * - * See {{#crossLink "M.editor_atto.EditorPluginButtons/addButton:method"}}addButton{{/crossLink}} for full details of the optional parameters. + * See {{#crossLink "M.editor_atto.EditorPluginButtons/addButton:method"}}addButton{{/crossLink}} + * for full details of the optional parameters. * * @method addBasicButton * @param {object} config The button configuration @@ -657,7 +661,6 @@ EditorPluginButtons.prototype = { // Cancel the hide menu prevention. menuDialogue.set('preventHideMenu', false); - console.log('Menu item chosen'); // Set the focus after hide so that focus is returned to the editor and changes are made correctly. menuDialogue.set('focusAfterHide', this.get('host').editor); menuDialogue.hide(e); diff --git a/lib/editor/atto/yui/src/editor/js/autosave.js b/lib/editor/atto/yui/src/editor/js/autosave.js index 4876a26fc48..600cf12d5c1 100644 --- a/lib/editor/atto/yui/src/editor/js/autosave.js +++ b/lib/editor/atto/yui/src/editor/js/autosave.js @@ -108,7 +108,9 @@ EditorAutosave.prototype = { setupAutosave: function() { var draftid = -1, optiontype = null, - options = this.get('filepickeroptions'); + options = this.get('filepickeroptions'), + params, + url; if (!this.get('autosaveEnabled')) { // Autosave disabled for this instance. @@ -142,6 +144,7 @@ EditorAutosave.prototype = { context: this, on: { success: function(id,o) { + var response_json; if (typeof o.responseText !== "undefined" && o.responseText !== "") { response_json = JSON.parse(o.responseText); @@ -159,7 +162,8 @@ EditorAutosave.prototype = { if (response_json.error || typeof response_json.result === 'undefined') { Y.log('Error occurred recovering draft text: ' + response_json.error, 'debug', LOGNAME_AUTOSAVE); - this.showMessage(M.util.get_string('errortextrecovery', 'editor_atto'), NOTIFY_WARNING, RECOVER_MESSAGE_TIMEOUT); + this.showMessage(M.util.get_string('errortextrecovery', 'editor_atto'), + NOTIFY_WARNING, RECOVER_MESSAGE_TIMEOUT); } else if (response_json.result !== this.textarea.get('value') && response_json.result !== '') { Y.log('Autosave text found - recover it.', 'debug', LOGNAME_AUTOSAVE); @@ -169,7 +173,8 @@ EditorAutosave.prototype = { } }, failure: function() { - this.showMessage(M.util.get_string('errortextrecovery', 'editor_atto'), NOTIFY_WARNING, RECOVER_MESSAGE_TIMEOUT); + this.showMessage(M.util.get_string('errortextrecovery', 'editor_atto'), + NOTIFY_WARNING, RECOVER_MESSAGE_TIMEOUT); } } }); @@ -192,8 +197,8 @@ EditorAutosave.prototype = { */ resetAutosave: function() { // Make an ajax request to reset the autosaved text. - url = M.cfg.wwwroot + this.get('autosaveAjaxScript'); - params = { + var url = M.cfg.wwwroot + this.get('autosaveAjaxScript'); + var params = { sesskey: M.cfg.sesskey, contextid: this.get('contextid'), action: 'reset', @@ -224,7 +229,8 @@ EditorAutosave.prototype = { this.updateOriginal(); this.lastText = text; - this.showMessage(M.util.get_string('textrecovered', 'editor_atto'), NOTIFY_INFO, RECOVER_MESSAGE_TIMEOUT); + this.showMessage(M.util.get_string('textrecovered', 'editor_atto'), + NOTIFY_INFO, RECOVER_MESSAGE_TIMEOUT); return this; }, @@ -236,6 +242,7 @@ EditorAutosave.prototype = { * @chainable */ saveDraft: function() { + var url, params; // Only copy the text from the div to the textarea if the textarea is not currently visible. if (!this.editor.get('hidden')) { this.updateOriginal(); @@ -278,7 +285,8 @@ EditorAutosave.prototype = { } else { // All working. this.lastText = newText; - this.showMessage(M.util.get_string('autosavesucceeded', 'editor_atto'), NOTIFY_INFO, SUCCESS_MESSAGE_TIMEOUT); + this.showMessage(M.util.get_string('autosavesucceeded', 'editor_atto'), + NOTIFY_INFO, SUCCESS_MESSAGE_TIMEOUT); } } } diff --git a/lib/editor/atto/yui/src/editor/js/editor-plugin-buttons.js b/lib/editor/atto/yui/src/editor/js/editor-plugin-buttons.js index 13cdd8f25c2..cdd6a8de37a 100644 --- a/lib/editor/atto/yui/src/editor/js/editor-plugin-buttons.js +++ b/lib/editor/atto/yui/src/editor/js/editor-plugin-buttons.js @@ -34,7 +34,8 @@ var MENUTEMPLATE = '' + 'title="{{title}}">' + '' + - '' + + '' + ''; var DISABLED = 'disabled', @@ -208,7 +209,8 @@ EditorPluginButtons.prototype = { // Create the actual button. button = Y.Node.create(''); button.setAttribute('title', title); @@ -281,7 +283,8 @@ EditorPluginButtons.prototype = { /** * Add a basic button which ties into the execCommand. * - * See {{#crossLink "M.editor_atto.EditorPluginButtons/addButton:method"}}addButton{{/crossLink}} for full details of the optional parameters. + * See {{#crossLink "M.editor_atto.EditorPluginButtons/addButton:method"}}addButton{{/crossLink}} + * for full details of the optional parameters. * * @method addBasicButton * @param {object} config The button configuration @@ -510,7 +513,6 @@ EditorPluginButtons.prototype = { // Cancel the hide menu prevention. menuDialogue.set('preventHideMenu', false); - console.log('Menu item chosen'); // Set the focus after hide so that focus is returned to the editor and changes are made correctly. menuDialogue.set('focusAfterHide', this.get('host').editor); menuDialogue.hide(e); diff --git a/lib/editor/atto/yui/src/editor/js/editor-plugin.js b/lib/editor/atto/yui/src/editor/js/editor-plugin.js index 2b47c4d607d..1eb69826eba 100644 --- a/lib/editor/atto/yui/src/editor/js/editor-plugin.js +++ b/lib/editor/atto/yui/src/editor/js/editor-plugin.js @@ -90,7 +90,8 @@ Y.extend(EditorPlugin, Y.Base, { /** * Mark the content ediable content as having been changed. * - * This is a convenience function and passes through to {{#crossLink "M.editor_atto.EditorTextArea/updateOriginal"}}updateOriginal{{/crossLink}}. + * This is a convenience function and passes through to + * {{#crossLink "M.editor_atto.EditorTextArea/updateOriginal"}}updateOriginal{{/crossLink}}. * * @method markUpdated */ diff --git a/lib/editor/atto/yui/src/editor/js/editor.js b/lib/editor/atto/yui/src/editor/js/editor.js index 8b74e2400fc..7bf8f2bb495 100644 --- a/lib/editor/atto/yui/src/editor/js/editor.js +++ b/lib/editor/atto/yui/src/editor/js/editor.js @@ -35,7 +35,8 @@ var CSS = { TOOLBAR: 'editor_atto_toolbar', WRAPPER: 'editor_atto', HIGHLIGHT: 'highlight' - }; + }, + rangy = window.rangy; /** * The Atto editor for Moodle. diff --git a/lib/editor/atto/yui/src/editor/js/lintconfig.js b/lib/editor/atto/yui/src/editor/js/lintconfig.js new file mode 100644 index 00000000000..9291d3b23e8 --- /dev/null +++ b/lib/editor/atto/yui/src/editor/js/lintconfig.js @@ -0,0 +1 @@ +/* globals rangy */ diff --git a/lib/editor/atto/yui/src/editor/js/menu.js b/lib/editor/atto/yui/src/editor/js/menu.js index d0558683ace..bbe2e9d6f2f 100644 --- a/lib/editor/atto/yui/src/editor/js/menu.js +++ b/lib/editor/atto/yui/src/editor/js/menu.js @@ -23,6 +23,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +var LOGNAME = 'moodle-editor_atto-menu'; var MENUDIALOGUE = '' + '
              ' + @@ -49,7 +50,7 @@ var MENUDIALOGUE = '' + * @constructor * @extends M.core.dialogue */ -Menu = function() { +var Menu = function() { Menu.superclass.constructor.apply(this, arguments); }; @@ -171,7 +172,8 @@ Y.extend(Menu, M.core.dialogue, { index = 0, direction = 1, checkCount = 0, - current = e.target.ancestor('a[role="menuitem"]', true); + current = e.target.ancestor('a[role="menuitem"]', true), + next; // Determine which button is currently selected. while (!found && index < buttons.size()) { diff --git a/lib/editor/atto/yui/src/editor/js/toolbar-keyboardnav.js b/lib/editor/atto/yui/src/editor/js/toolbar-keyboardnav.js index 4f4e630f6b0..3c056a3d4f0 100644 --- a/lib/editor/atto/yui/src/editor/js/toolbar-keyboardnav.js +++ b/lib/editor/atto/yui/src/editor/js/toolbar-keyboardnav.js @@ -167,7 +167,7 @@ EditorToolbarNav.prototype = { if (this._tabFocus.hasAttribute('disabled') || this._tabFocus.hasAttribute('hidden') || this._tabFocus.ancestor('.atto_group').hasAttribute('hidden')) { // Find first available button. - button = this._findFirstFocusable(this.toolbar.all('button'), this._tabFocus, -1); + var button = this._findFirstFocusable(this.toolbar.all('button'), this._tabFocus, -1); if (button) { if (this._tabFocus.compareTo(document.activeElement)) { // We should also move the focus, because the inaccessible button also has the focus. diff --git a/lib/form/yui/build/moodle-form-dateselector/moodle-form-dateselector-debug.js b/lib/form/yui/build/moodle-form-dateselector/moodle-form-dateselector-debug.js index 6b4db96084a..9777cdc4fec 100644 --- a/lib/form/yui/build/moodle-form-dateselector/moodle-form-dateselector-debug.js +++ b/lib/form/yui/build/moodle-form-dateselector/moodle-form-dateselector-debug.js @@ -120,7 +120,7 @@ M.form.dateselector = { ]; // Change the alignment if this is an RTL language. - if (right_to_left()) { + if (window.right_to_left()) { alignpoints = [ Y.WidgetPositionAlign.BR, Y.WidgetPositionAlign.TR diff --git a/lib/form/yui/build/moodle-form-dateselector/moodle-form-dateselector-min.js b/lib/form/yui/build/moodle-form-dateselector/moodle-form-dateselector-min.js index 158ee42899e..555bcf1b52a 100644 --- a/lib/form/yui/build/moodle-form-dateselector/moodle-form-dateselector-min.js +++ b/lib/form/yui/build/moodle-form-dateselector/moodle-form-dateselector-min.js @@ -1,2 +1,2 @@ -YUI.add("moodle-form-dateselector",function(e,t){e.mix(e.Node.prototype,{firstOptionValue:function(){return this.get("nodeName").toLowerCase()!=="select"?!1:this.one("option").get("value")},lastOptionValue:function(){return this.get("nodeName").toLowerCase()!=="select"?!1:this.all("option").item(this.optionSize()-1).get("value")},optionSize:function(){return this.get("nodeName").toLowerCase()!=="select"?!1:parseInt(this.all("option").size(),10)},selectedOptionValue:function(){return this.get("nodeName").toLowerCase()!=="select"?!1:this.all("option").item(this.get("selectedIndex")).get("value")}}),M.form=M.form||{},M.form.dateselector={panel:null,calendar:null,currentowner:null,hidetimeout:null,repositiontimeout:null,init_date_selectors:function(t){this.panel===null&&this.initPanel(t),e.all(".fdate_time_selector").each(function(){t.node=this,new r(t)}),e.all(".fdate_selector").each(function(){t.node=this,new r(t)})},initPanel:function(t){this.panel=new e.Overlay({visible:!1,bodyContent:e.Node.create('
              '),id:"dateselector-calendar-panel"}),this.panel.render(document.body),e.one("#dateselector-calendar-panel").setStyle("zIndex",null),this.panel.on("heightChange",this.fix_position,this),e.one("#dateselector-calendar-panel").on("click",function(e){e.halt()}),e.one(document.body).on("click",this.document_click,this),this.calendar=new n({contentBox:"#dateselector-calendar-content",width:"300px",showPrevMonth:!0,showNextMonth:!0,firstdayofweek:t.firstdayofweek,WEEKDAYS_MEDIUM:[t.sun,t.mon,t.tue,t.wed,t.thu,t.fri,t.sat]})},cancel_any_timeout:function(){this.hidetimeout&&(clearTimeout(this.hidetimeout),this.hidetimeout=null),this.repositiontimeout&&(clearTimeout(this.repositiontimeout),this.repositiontimeout=null)},delayed_reposition:function(){this.repositiontimeout&&(clearTimeout(this.repositiontimeout),this.repositiontimeout=null),this.repositiontimeout=setTimeout(this.fix_position,500)},fix_position:function(){if(this.currentowner){var t=[e.WidgetPositionAlign.BL,e.WidgetPositionAlign.TL];right_to_left()&&(t=[e.WidgetPositionAlign.BR,e.WidgetPositionAlign.TR]),this.panel.set("align",{node:this.currentowner.get("node").one("select"),points:t})}},document_click:function(e){this.currentowner&&(this.currentowner.get("node").ancestor("div").contains(e.target)?setTimeout(function(){M.form.dateselector.cancel_any_timeout()},100):this.currentowner.release_calendar(e))}};var n=function(){n.superclass.constructor.apply(this,arguments)};e.extend(n,e.Calendar,{initializer:function(e){this.set("strings.very_short_weekdays",e.WEEKDAYS_MEDIUM),this.set("strings.first_weekday",e.firstdayofweek)}},{NAME:"Calendar",ATTRS:{}}),M.form_moodlecalendar=M.form_moodlecalendar||{},M.form_moodlecalendar.initializer=function(e){return new n(e)};var r=function(){r.superclass.constructor.apply(this,arguments)};r.prototype={panel:null,yearselect:null,monthselect:null,dayselect:null,calendarimage:null,enablecheckbox:null,closepopup:!0,initializer:function(){var e=this.get("node").all("select");e.each(function(e){e.get("name").match(/\[year\]/)?this.yearselect=e:e.get("name").match(/\[month\]/)?this.monthselect=e:e.get("name").match(/\[day\]/)&&(this.dayselect=e),e.after("change",this.handle_select_change,this)},this);var t=this.get("node").all("input, a");t.each(function(e){e.get("name").match(/\[calendar\]/)?(e.on("click",this.focus_event,this),this.calendarimage=e):(e.on("click",this.toggle_calendar_image,this),this.enablecheckbox=e),this.calendarimage&&this.enablecheckbox&&this.toggle_calendar_image()},this)},focus_event:function(e){M.form.dateselector.cancel_any_timeout(),M.form.dateselector.currentowner===this?this.release_calendar():(this.enablecheckbox===null||this.enablecheckbox.get("checked"))&&this.claim_calendar(),e.preventDefault()},handle_select_change:function(){this.closepopup=!1,this.set_date_from_selects(),this.closepopup=!0},claim_calendar:function(){M.form.dateselector.cancel_any_timeout();if(M.form.dateselector.currentowner===this)return;M.form.dateselector.currentowner&&M.form.dateselector.currentowner.release_calendar(),M.form.dateselector.currentowner!==this&&(this.connect_handlers(),this.set_date_from_selects()),M.form.dateselector.currentowner=this,M.form.dateselector.calendar.set("mindate",new Date(this.yearselect.firstOptionValue(),0,1)),M.form.dateselector.calendar.set("maxdate",new Date(this.yearselect.lastOptionValue(),11,31)),M.form.dateselector.panel.show(),M.form.dateselector.calendar.show(),M.form.dateselector.fix_position(),setTimeout(function(){M.form.dateselector.cancel_any_timeout()},100),M.form.dateselector.calendar.focus(),e.one(document.body).on("keyup",function(e){if(M.form.dateselector.currentowner===this&&!M.form.dateselector.calendar.get("focused")||e.keyCode===27&&M.form.dateselector.calendar.get("focused"))this.calendarimage.focus(),this.release_calendar()},this)},set_date_from_selects:function(){var e=parseInt(this.yearselect.get("value"),10),t=parseInt(this.monthselect.get("value"),10)-1,n=parseInt(this.dayselect.get("value"),10),r=new Date(e,t,n);M.form.dateselector.calendar.deselectDates(),M.form.dateselector.calendar.selectDates([r]),M.form.dateselector.calendar.set("date",r),M.form.dateselector.calendar.render(),r.getDate()!==n&&(this.dayselect.set("value",r.getDate()),this.monthselect.set("value",r.getMonth()+1))},set_selects_from_date:function(t){var n=t.newSelection[0],r=e.DataType.Date.format(n,{format:"%Y"}),i=r-this.yearselect.firstOptionValue();this.yearselect.set("selectedIndex",i),this.monthselect.set("selectedIndex",e.DataType.Date.format(n,{format:"%m"})-this.monthselect.firstOptionValue()),this.dayselect.set("selectedIndex",e.DataType.Date.format(n,{format:"%d"})-this.dayselect.firstOptionValue()),M.form.dateselector.currentowner&&this.closepopup&&this.release_calendar()},connect_handlers:function(){M.form.dateselector.calendar.on("selectionChange",this.set_selects_from_date,this,!0)},release_calendar:function(e){var t= -M.form.dateselector.currentowner===this;M.form.dateselector.panel.hide(),M.form.dateselector.calendar.detach("selectionChange",this.set_selects_from_date),M.form.dateselector.calendar.hide(),M.form.dateselector.currentowner=null,t&&(e===null||typeof e=="undefined"||e.type!=="click")&&this.calendarimage.focus()},toggle_calendar_image:function(){this.enablecheckbox.get("checked")?(this.calendarimage.set("disabled",!1),this.calendarimage.setStyle("cursor",null)):(this.calendarimage.set("disabled","disabled"),this.calendarimage.setStyle("cursor","default"),this.release_calendar())}},e.extend(r,e.Base,r.prototype,{NAME:"Date Selector",ATTRS:{firstdayofweek:{validator:e.Lang.isString},node:{setter:function(t){return e.one(t)}}}})},"@VERSION@",{requires:["base","node","overlay","calendar"]}); +YUI.add("moodle-form-dateselector",function(e,t){e.mix(e.Node.prototype,{firstOptionValue:function(){return this.get("nodeName").toLowerCase()!=="select"?!1:this.one("option").get("value")},lastOptionValue:function(){return this.get("nodeName").toLowerCase()!=="select"?!1:this.all("option").item(this.optionSize()-1).get("value")},optionSize:function(){return this.get("nodeName").toLowerCase()!=="select"?!1:parseInt(this.all("option").size(),10)},selectedOptionValue:function(){return this.get("nodeName").toLowerCase()!=="select"?!1:this.all("option").item(this.get("selectedIndex")).get("value")}}),M.form=M.form||{},M.form.dateselector={panel:null,calendar:null,currentowner:null,hidetimeout:null,repositiontimeout:null,init_date_selectors:function(t){this.panel===null&&this.initPanel(t),e.all(".fdate_time_selector").each(function(){t.node=this,new r(t)}),e.all(".fdate_selector").each(function(){t.node=this,new r(t)})},initPanel:function(t){this.panel=new e.Overlay({visible:!1,bodyContent:e.Node.create('
              '),id:"dateselector-calendar-panel"}),this.panel.render(document.body),e.one("#dateselector-calendar-panel").setStyle("zIndex",null),this.panel.on("heightChange",this.fix_position,this),e.one("#dateselector-calendar-panel").on("click",function(e){e.halt()}),e.one(document.body).on("click",this.document_click,this),this.calendar=new n({contentBox:"#dateselector-calendar-content",width:"300px",showPrevMonth:!0,showNextMonth:!0,firstdayofweek:t.firstdayofweek,WEEKDAYS_MEDIUM:[t.sun,t.mon,t.tue,t.wed,t.thu,t.fri,t.sat]})},cancel_any_timeout:function(){this.hidetimeout&&(clearTimeout(this.hidetimeout),this.hidetimeout=null),this.repositiontimeout&&(clearTimeout(this.repositiontimeout),this.repositiontimeout=null)},delayed_reposition:function(){this.repositiontimeout&&(clearTimeout(this.repositiontimeout),this.repositiontimeout=null),this.repositiontimeout=setTimeout(this.fix_position,500)},fix_position:function(){if(this.currentowner){var t=[e.WidgetPositionAlign.BL,e.WidgetPositionAlign.TL];window.right_to_left()&&(t=[e.WidgetPositionAlign.BR,e.WidgetPositionAlign.TR]),this.panel.set("align",{node:this.currentowner.get("node").one("select"),points:t})}},document_click:function(e){this.currentowner&&(this.currentowner.get("node").ancestor("div").contains(e.target)?setTimeout(function(){M.form.dateselector.cancel_any_timeout()},100):this.currentowner.release_calendar(e))}};var n=function(){n.superclass.constructor.apply(this,arguments)};e.extend(n,e.Calendar,{initializer:function(e){this.set("strings.very_short_weekdays",e.WEEKDAYS_MEDIUM),this.set("strings.first_weekday",e.firstdayofweek)}},{NAME:"Calendar",ATTRS:{}}),M.form_moodlecalendar=M.form_moodlecalendar||{},M.form_moodlecalendar.initializer=function(e){return new n(e)};var r=function(){r.superclass.constructor.apply(this,arguments)};r.prototype={panel:null,yearselect:null,monthselect:null,dayselect:null,calendarimage:null,enablecheckbox:null,closepopup:!0,initializer:function(){var e=this.get("node").all("select");e.each(function(e){e.get("name").match(/\[year\]/)?this.yearselect=e:e.get("name").match(/\[month\]/)?this.monthselect=e:e.get("name").match(/\[day\]/)&&(this.dayselect=e),e.after("change",this.handle_select_change,this)},this);var t=this.get("node").all("input, a");t.each(function(e){e.get("name").match(/\[calendar\]/)?(e.on("click",this.focus_event,this),this.calendarimage=e):(e.on("click",this.toggle_calendar_image,this),this.enablecheckbox=e),this.calendarimage&&this.enablecheckbox&&this.toggle_calendar_image()},this)},focus_event:function(e){M.form.dateselector.cancel_any_timeout(),M.form.dateselector.currentowner===this?this.release_calendar():(this.enablecheckbox===null||this.enablecheckbox.get("checked"))&&this.claim_calendar(),e.preventDefault()},handle_select_change:function(){this.closepopup=!1,this.set_date_from_selects(),this.closepopup=!0},claim_calendar:function(){M.form.dateselector.cancel_any_timeout();if(M.form.dateselector.currentowner===this)return;M.form.dateselector.currentowner&&M.form.dateselector.currentowner.release_calendar(),M.form.dateselector.currentowner!==this&&(this.connect_handlers(),this.set_date_from_selects()),M.form.dateselector.currentowner=this,M.form.dateselector.calendar.set("mindate",new Date(this.yearselect.firstOptionValue(),0,1)),M.form.dateselector.calendar.set("maxdate",new Date(this.yearselect.lastOptionValue(),11,31)),M.form.dateselector.panel.show(),M.form.dateselector.calendar.show(),M.form.dateselector.fix_position(),setTimeout(function(){M.form.dateselector.cancel_any_timeout()},100),M.form.dateselector.calendar.focus(),e.one(document.body).on("keyup",function(e){if(M.form.dateselector.currentowner===this&&!M.form.dateselector.calendar.get("focused")||e.keyCode===27&&M.form.dateselector.calendar.get("focused"))this.calendarimage.focus(),this.release_calendar()},this)},set_date_from_selects:function(){var e=parseInt(this.yearselect.get("value"),10),t=parseInt(this.monthselect.get("value"),10)-1,n=parseInt(this.dayselect.get("value"),10),r=new Date(e,t,n);M.form.dateselector.calendar.deselectDates(),M.form.dateselector.calendar.selectDates([r]),M.form.dateselector.calendar.set("date",r),M.form.dateselector.calendar.render(),r.getDate()!==n&&(this.dayselect.set("value",r.getDate()),this.monthselect.set("value",r.getMonth()+1))},set_selects_from_date:function(t){var n=t.newSelection[0],r=e.DataType.Date.format(n,{format:"%Y"}),i=r-this.yearselect.firstOptionValue();this.yearselect.set("selectedIndex",i),this.monthselect.set("selectedIndex",e.DataType.Date.format(n,{format:"%m"})-this.monthselect.firstOptionValue()),this.dayselect.set("selectedIndex",e.DataType.Date.format(n,{format:"%d"})-this.dayselect.firstOptionValue()),M.form.dateselector.currentowner&&this.closepopup&&this.release_calendar()},connect_handlers:function(){M.form.dateselector.calendar.on("selectionChange",this.set_selects_from_date,this,!0)},release_calendar:function( +e){var t=M.form.dateselector.currentowner===this;M.form.dateselector.panel.hide(),M.form.dateselector.calendar.detach("selectionChange",this.set_selects_from_date),M.form.dateselector.calendar.hide(),M.form.dateselector.currentowner=null,t&&(e===null||typeof e=="undefined"||e.type!=="click")&&this.calendarimage.focus()},toggle_calendar_image:function(){this.enablecheckbox.get("checked")?(this.calendarimage.set("disabled",!1),this.calendarimage.setStyle("cursor",null)):(this.calendarimage.set("disabled","disabled"),this.calendarimage.setStyle("cursor","default"),this.release_calendar())}},e.extend(r,e.Base,r.prototype,{NAME:"Date Selector",ATTRS:{firstdayofweek:{validator:e.Lang.isString},node:{setter:function(t){return e.one(t)}}}})},"@VERSION@",{requires:["base","node","overlay","calendar"]}); diff --git a/lib/form/yui/build/moodle-form-dateselector/moodle-form-dateselector.js b/lib/form/yui/build/moodle-form-dateselector/moodle-form-dateselector.js index 6b4db96084a..9777cdc4fec 100644 --- a/lib/form/yui/build/moodle-form-dateselector/moodle-form-dateselector.js +++ b/lib/form/yui/build/moodle-form-dateselector/moodle-form-dateselector.js @@ -120,7 +120,7 @@ M.form.dateselector = { ]; // Change the alignment if this is an RTL language. - if (right_to_left()) { + if (window.right_to_left()) { alignpoints = [ Y.WidgetPositionAlign.BR, Y.WidgetPositionAlign.TR diff --git a/lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask-debug.js b/lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask-debug.js index 8ec50a7c553..3eebdf8588f 100644 --- a/lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask-debug.js +++ b/lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask-debug.js @@ -24,7 +24,7 @@ Y.extend(PASSWORDUNMASK, Y.Base, { checkboxname+'unmask">'); unmaskdiv.appendChild(unmaskchb); // Attach event using static javascript function for unmasking password. - unmaskchb.on('click', function() {unmaskPassword(elementid);}); + unmaskchb.on('click', function() {window.unmaskPassword(elementid);}); // Add label for checkbox to unmaskdiv. var unmasklabel = Y.Node.create(''); diff --git a/lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask-min.js b/lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask-min.js index 6c426ff0b05..1c79dd42ba0 100644 --- a/lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask-min.js +++ b/lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask-min.js @@ -1 +1 @@ -YUI.add("moodle-form-passwordunmask",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)};e.extend(n,e.Base,{initializer:function(e){e&&e.formid&&this.add_checkbox(e.formid,e.checkboxlabel,e.checkboxname)},add_checkbox:function(t,n,r){var i=e.one("#"+t),s=e.Node.create('
              '),o=e.Node.create('');s.appendChild(o),o.on("click",function(){unmaskPassword(t)});var u=e.Node.create('");s.appendChild(u),i.get("parentNode").insert(s,i.get("lastNode"))}}),M.form=M.form||{},M.form.passwordunmask=function(e){return new n(e)}},"@VERSION@",{requires:["node","base"]}); +YUI.add("moodle-form-passwordunmask",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)};e.extend(n,e.Base,{initializer:function(e){e&&e.formid&&this.add_checkbox(e.formid,e.checkboxlabel,e.checkboxname)},add_checkbox:function(t,n,r){var i=e.one("#"+t),s=e.Node.create('
              '),o=e.Node.create('');s.appendChild(o),o.on("click",function(){window.unmaskPassword(t)});var u=e.Node.create('");s.appendChild(u),i.get("parentNode").insert(s,i.get("lastNode"))}}),M.form=M.form||{},M.form.passwordunmask=function(e){return new n(e)}},"@VERSION@",{requires:["node","base"]}); diff --git a/lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask.js b/lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask.js index 8ec50a7c553..3eebdf8588f 100644 --- a/lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask.js +++ b/lib/form/yui/build/moodle-form-passwordunmask/moodle-form-passwordunmask.js @@ -24,7 +24,7 @@ Y.extend(PASSWORDUNMASK, Y.Base, { checkboxname+'unmask">'); unmaskdiv.appendChild(unmaskchb); // Attach event using static javascript function for unmasking password. - unmaskchb.on('click', function() {unmaskPassword(elementid);}); + unmaskchb.on('click', function() {window.unmaskPassword(elementid);}); // Add label for checkbox to unmaskdiv. var unmasklabel = Y.Node.create(''); diff --git a/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms-debug.js b/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms-debug.js index b2bda07ae9e..ec41c73bb3c 100644 --- a/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms-debug.js +++ b/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms-debug.js @@ -141,7 +141,7 @@ Y.extend(SHORTFORMS, Y.Base, { * @chainable */ set_state: function(fieldset, collapsed) { - headerlink = fieldset.one(SELECTORS.FHEADER); + var headerlink = fieldset.one(SELECTORS.FHEADER); if (collapsed) { fieldset.addClass(CSS.COLLAPSED); if (headerlink) { diff --git a/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms-min.js b/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms-min.js index 3c3331e7dd2..b7d0861331e 100644 --- a/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms-min.js +++ b/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms-min.js @@ -1 +1 @@ -YUI.add("moodle-form-shortforms",function(e,t){function n(){n.superclass.constructor.apply(this,arguments)}var r={COLLAPSEEXPAND:".collapsible-actions .collapseexpand",COLLAPSED:".collapsed",FIELDSETCOLLAPSIBLE:"fieldset.collapsible",FIELDSETLEGENDLINK:"fieldset.collapsible .fheader",FHEADER:".fheader",LEGENDFTOGGLER:"legend.ftoggler"},i={COLLAPSEALL:"collapse-all",COLLAPSED:"collapsed",FHEADER:"fheader"},s={};s.formid={value:null},e.extend(n,e.Base,{form:null,initializer:function(){var t=e.one("#"+this.get("formid")),n,i,s,o;if(!t)return;this.form=t,n=t.all(r.FIELDSETCOLLAPSIBLE),n.each(this.process_fieldset,this),t.delegate("click",this.switch_state,r.FIELDSETLEGENDLINK,this),t.delegate("key",this.switch_state,"down:enter,32",r.FIELDSETLEGENDLINK,this),i=t.one(r.COLLAPSEEXPAND),i&&(s=e.Node.create(''),s.setHTML(i.getHTML()),s.setAttribute("class",i.getAttribute("class")),s.setAttribute("role","button"),o=[],t.all(r.FIELDSETLEGENDLINK).each(function(e){o[o.length]=e.generateID()}),s.setAttribute("aria-controls",o.join(" ")),s.on("click",this.set_state_all,this,!0),s.on("key",this.set_state_all,"down:enter,32",this,!0),i.replace(s),this.update_btns(t))},process_fieldset:function(t){var n=t.one(r.LEGENDFTOGGLER),s=e.Node.create('');return s.addClass(i.FHEADER),s.appendChild(n.get("firstChild")),s.setAttribute("role","button"),s.setAttribute("aria-controls",t.generateID()),n.ancestor(r.COLLAPSED)?s.setAttribute("aria-expanded","false"):s.setAttribute("aria-expanded","true"),n.prepend(s),this},set_state:function(e,t){headerlink=e.one(r.FHEADER),t?(e.addClass(i.COLLAPSED),headerlink&&headerlink.setAttribute("aria-expanded","false")):(e.removeClass(i.COLLAPSED),headerlink&&headerlink.setAttribute("aria-expanded","true"));var n=this.form.one("input[name=mform_isexpanded_"+e.get("id")+"]");return n?(n.set("value",t?0:1),this):this},set_state_all:function(e){e.preventDefault();var t=e.target.hasClass(i.COLLAPSEALL),n=this.form.all(r.FIELDSETCOLLAPSIBLE);n.each(function(e){this.set_state(e,t)},this),this.update_btns()},switch_state:function(e){e.preventDefault();var t=e.target.ancestor(r.FIELDSETCOLLAPSIBLE);this.set_state(t,!t.hasClass(i.COLLAPSED)),this.update_btns()},update_btns:function(){var e,t=0,n=!1,s;return e=this.form.one(r.COLLAPSEEXPAND),e?(s=this.form.all(r.FIELDSETCOLLAPSIBLE),s.each(function(e){e.hasClass(i.COLLAPSED)&&t++}),t!==0&&(n=!0),n?(e.removeClass(i.COLLAPSEALL),e.setHTML(M.util.get_string("expandall","moodle"))):(e.addClass(i.COLLAPSEALL),e.setHTML(M.util.get_string("collapseall","moodle"))),this):this}},{NAME:"moodle-form-shortforms",ATTRS:s}),M.form=M.form||{},M.form.shortforms=M.form.shortforms||function(e){return new n(e)}},"@VERSION@",{requires:["node","base","selector-css3"]}); +YUI.add("moodle-form-shortforms",function(e,t){function n(){n.superclass.constructor.apply(this,arguments)}var r={COLLAPSEEXPAND:".collapsible-actions .collapseexpand",COLLAPSED:".collapsed",FIELDSETCOLLAPSIBLE:"fieldset.collapsible",FIELDSETLEGENDLINK:"fieldset.collapsible .fheader",FHEADER:".fheader",LEGENDFTOGGLER:"legend.ftoggler"},i={COLLAPSEALL:"collapse-all",COLLAPSED:"collapsed",FHEADER:"fheader"},s={};s.formid={value:null},e.extend(n,e.Base,{form:null,initializer:function(){var t=e.one("#"+this.get("formid")),n,i,s,o;if(!t)return;this.form=t,n=t.all(r.FIELDSETCOLLAPSIBLE),n.each(this.process_fieldset,this),t.delegate("click",this.switch_state,r.FIELDSETLEGENDLINK,this),t.delegate("key",this.switch_state,"down:enter,32",r.FIELDSETLEGENDLINK,this),i=t.one(r.COLLAPSEEXPAND),i&&(s=e.Node.create(''),s.setHTML(i.getHTML()),s.setAttribute("class",i.getAttribute("class")),s.setAttribute("role","button"),o=[],t.all(r.FIELDSETLEGENDLINK).each(function(e){o[o.length]=e.generateID()}),s.setAttribute("aria-controls",o.join(" ")),s.on("click",this.set_state_all,this,!0),s.on("key",this.set_state_all,"down:enter,32",this,!0),i.replace(s),this.update_btns(t))},process_fieldset:function(t){var n=t.one(r.LEGENDFTOGGLER),s=e.Node.create('');return s.addClass(i.FHEADER),s.appendChild(n.get("firstChild")),s.setAttribute("role","button"),s.setAttribute("aria-controls",t.generateID()),n.ancestor(r.COLLAPSED)?s.setAttribute("aria-expanded","false"):s.setAttribute("aria-expanded","true"),n.prepend(s),this},set_state:function(e,t){var n=e.one(r.FHEADER);t?(e.addClass(i.COLLAPSED),n&&n.setAttribute("aria-expanded","false")):(e.removeClass(i.COLLAPSED),n&&n.setAttribute("aria-expanded","true"));var s=this.form.one("input[name=mform_isexpanded_"+e.get("id")+"]");return s?(s.set("value",t?0:1),this):this},set_state_all:function(e){e.preventDefault();var t=e.target.hasClass(i.COLLAPSEALL),n=this.form.all(r.FIELDSETCOLLAPSIBLE);n.each(function(e){this.set_state(e,t)},this),this.update_btns()},switch_state:function(e){e.preventDefault();var t=e.target.ancestor(r.FIELDSETCOLLAPSIBLE);this.set_state(t,!t.hasClass(i.COLLAPSED)),this.update_btns()},update_btns:function(){var e,t=0,n=!1,s;return e=this.form.one(r.COLLAPSEEXPAND),e?(s=this.form.all(r.FIELDSETCOLLAPSIBLE),s.each(function(e){e.hasClass(i.COLLAPSED)&&t++}),t!==0&&(n=!0),n?(e.removeClass(i.COLLAPSEALL),e.setHTML(M.util.get_string("expandall","moodle"))):(e.addClass(i.COLLAPSEALL),e.setHTML(M.util.get_string("collapseall","moodle"))),this):this}},{NAME:"moodle-form-shortforms",ATTRS:s}),M.form=M.form||{},M.form.shortforms=M.form.shortforms||function(e){return new n(e)}},"@VERSION@",{requires:["node","base","selector-css3"]}); diff --git a/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms.js b/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms.js index 87e51993029..e7e138f7229 100644 --- a/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms.js +++ b/lib/form/yui/build/moodle-form-shortforms/moodle-form-shortforms.js @@ -140,7 +140,7 @@ Y.extend(SHORTFORMS, Y.Base, { * @chainable */ set_state: function(fieldset, collapsed) { - headerlink = fieldset.one(SELECTORS.FHEADER); + var headerlink = fieldset.one(SELECTORS.FHEADER); if (collapsed) { fieldset.addClass(CSS.COLLAPSED); if (headerlink) { diff --git a/lib/form/yui/src/dateselector/js/dateselector.js b/lib/form/yui/src/dateselector/js/dateselector.js index 3a44e40f5a5..684f27f58cc 100644 --- a/lib/form/yui/src/dateselector/js/dateselector.js +++ b/lib/form/yui/src/dateselector/js/dateselector.js @@ -118,7 +118,7 @@ M.form.dateselector = { ]; // Change the alignment if this is an RTL language. - if (right_to_left()) { + if (window.right_to_left()) { alignpoints = [ Y.WidgetPositionAlign.BR, Y.WidgetPositionAlign.TR diff --git a/lib/form/yui/src/passwordunmask/js/passwordunmask.js b/lib/form/yui/src/passwordunmask/js/passwordunmask.js index 63b47481241..f2b4a68c3dd 100644 --- a/lib/form/yui/src/passwordunmask/js/passwordunmask.js +++ b/lib/form/yui/src/passwordunmask/js/passwordunmask.js @@ -22,7 +22,7 @@ Y.extend(PASSWORDUNMASK, Y.Base, { checkboxname+'unmask">'); unmaskdiv.appendChild(unmaskchb); // Attach event using static javascript function for unmasking password. - unmaskchb.on('click', function() {unmaskPassword(elementid);}); + unmaskchb.on('click', function() {window.unmaskPassword(elementid);}); // Add label for checkbox to unmaskdiv. var unmasklabel = Y.Node.create(''); diff --git a/lib/form/yui/src/shortforms/js/shortforms.js b/lib/form/yui/src/shortforms/js/shortforms.js index 98e4035df8c..14181caf187 100644 --- a/lib/form/yui/src/shortforms/js/shortforms.js +++ b/lib/form/yui/src/shortforms/js/shortforms.js @@ -139,7 +139,7 @@ Y.extend(SHORTFORMS, Y.Base, { * @chainable */ set_state: function(fieldset, collapsed) { - headerlink = fieldset.one(SELECTORS.FHEADER); + var headerlink = fieldset.one(SELECTORS.FHEADER); if (collapsed) { fieldset.addClass(CSS.COLLAPSED); if (headerlink) { diff --git a/lib/yui/build/moodle-core-actionmenu/moodle-core-actionmenu-debug.js b/lib/yui/build/moodle-core-actionmenu/moodle-core-actionmenu-debug.js index 3627925630a..d66601214de 100644 --- a/lib/yui/build/moodle-core-actionmenu/moodle-core-actionmenu-debug.js +++ b/lib/yui/build/moodle-core-actionmenu/moodle-core-actionmenu-debug.js @@ -190,7 +190,8 @@ ACTIONMENU.prototype = { */ getMenuItem: function(currentItem, previous) { var menubar = currentItem.ancestor(SELECTOR.MENUBAR), - menuitems; + menuitems, + next; if (!menubar) { return null; @@ -340,7 +341,8 @@ ACTIONMENU.prototype = { e.currentTarget.simulate('click'); } else if (e.keyCode === 9) { // The tab key was pressed. Tab moves forwards, Shift + Tab moves backwards through the menu options. - // We only override the Shift + Tab on the first option, and Tab on the last option to change where the focus is moved to. + // We only override the Shift + Tab on the first option, and Tab on the last option to change where the + // focus is moved to. if (e.target === this.firstMenuChild && e.shiftKey) { this.hideMenu(); e.preventDefault(); @@ -457,7 +459,10 @@ ACTIONMENU.prototype = { this.events.push(BODY.delegate('focus', this.hideIfOutside, '*', this)); // Check keyboard changes. - this.events.push(menu.delegate('key', this.handleKeyboardEvent, 'down:9, 27, 38, 40, 32', SELECTOR.MENUCHILD + ', ' + SELECTOR.TOGGLE, this)); + this.events.push( + menu.delegate('key', this.handleKeyboardEvent, + 'down:9, 27, 38, 40, 32', SELECTOR.MENUCHILD + ', ' + SELECTOR.TOGGLE, this) + ); // Close the menu after a button was pushed. this.events.push(menu.delegate('click', function(e) { diff --git a/lib/yui/build/moodle-core-actionmenu/moodle-core-actionmenu-min.js b/lib/yui/build/moodle-core-actionmenu/moodle-core-actionmenu-min.js index 38f3d5e2592..cf33cb38d78 100644 --- a/lib/yui/build/moodle-core-actionmenu/moodle-core-actionmenu-min.js +++ b/lib/yui/build/moodle-core-actionmenu/moodle-core-actionmenu-min.js @@ -1,2 +1,2 @@ -YUI.add("moodle-core-actionmenu",function(e,t){var n=e.one(e.config.doc.body),r={MENUSHOWN:"action-menu-shown"},i={CAN_RECEIVE_FOCUS_SELECTOR:'input:not([type="hidden"]), a[href], button, textarea, select, [tabindex]',MENU:".moodle-actionmenu[data-enhance=moodle-core-actionmenu]",MENUBAR:'[role="menubar"]',MENUITEM:'[role="menuitem"]',MENUCONTENT:".menu[data-rel=menu-content]",MENUCONTENTCHILD:"li a",MENUCHILD:".menu li a",TOGGLE:".toggle-display",KEEPOPEN:'[data-keepopen="1"]',MENUBARITEMS:['[role="menubar"] > [role="menuitem"]','[role="menubar"] > [role="presentation"] > [role="menuitem"]'],MENUITEMS:['> [role="menuitem"]','> [role="presentation"] > [role="menuitem"]']},s,o={TL:"tl",TR:"tr",BL:"bl",BR:"br"};s=function(){s.superclass.constructor.apply(this,arguments)},s.prototype={dialogue:null,events:[],owner:null,menulink:null,menuChildren:null,firstMenuChild:null,lastMenuChild:null,initializer:function(){e.all(i.MENU).each(this.enhance,this),n.delegate("key",this.moveMenuItem,"down:37,39",i.MENUBARITEMS.join(","),this),n.delegate("click",this.toggleMenu,i.MENU+" "+i.TOGGLE,this),n.delegate("key",this.showIfHidden,"down:enter,38,40",i.MENU+" "+i.TOGGLE,this),n.delegate("key",function(e){e.currentTarget.simulate("click"),e.preventDefault()},"down:32",i.MENUBARITEMS.join(","))},enhance:function(e){var t=e.one(i.MENUCONTENT),n;if(!t)return!1;n=t.getData("align")||this.get("align").join("-"),e.one(i.TOGGLE).set("aria-haspopup",!0),t.set("aria-hidden",!0),t.hasClass("align-"+n)||t.addClass("align-"+n),t.hasChildNodes()&&e.setAttribute("data-enhanced","1")},moveMenuItem:function(e){var t,n=e.target.ancestor(i.MENUITEM,!0);return e.keyCode===37?t=this.getMenuItem(n,!0):e.keyCode===39&&(t=this.getMenuItem(n)),t&&t.focus(),this},getMenuItem:function(e,t){var n=e.ancestor(i.MENUBAR),r;if(!n)return null;r=n.all(i.MENUITEMS.join(","));if(!r)return null;var s=r.size();if(s===1)return null;var o=0,u=1,a=0;for(o=0;o=this.menuChildren.size()&&(r=0),t=this.menuChildren.item(r),o++;while(oa?(c=i=a,p=n=o):n=o+a&&(p=o+a-i),s>f&&l.toLowerCase()==="hidden"&&(h=s=f,e.setStyle("overflow","auto"));if(r>=u&&r+s>u+f){d=u+f-s;try{v=e.getStyle("boxShadow").replace(/.*? (\d+)px \d+px$/,"$1"),(new RegExp(/^\d+$/)).test(v)&&d-u>v&&(d-=v)}catch(m){}}p!==null&&e.setX(p),d!==null&&e.setY(d),c!==null&&e.setStyle("width",c.toString()+"px"),h!==null&&e.setStyle("height",h.toString()+"px")}},e.extend(s,e.Base,s.prototype,{NAME:"moodle-core-actionmenu",ATTRS:{align:{value:[o.TR,o.BR]}}}),M.core=M.core||{},M.core.actionmenu=M.core.actionmenu||{},M.core.actionmenu.instance=null,M.core.actionmenu.init=M.core.actionmenu.init||function(e){M.core.actionmenu.instance=M.core.actionmenu.instance||new s(e)},M.core.actionmenu.newDOMNode=function(e){if(M.core.actionmenu.instance===null -)return!0;e.all(i.MENU).each(M.core.actionmenu.instance.enhance,M.core.actionmenu.instance)}},"@VERSION@",{requires:["base","event","node-event-simulate"]}); +YUI.add("moodle-core-actionmenu",function(e,t){var n=e.one(e.config.doc.body),r={MENUSHOWN:"action-menu-shown"},i={CAN_RECEIVE_FOCUS_SELECTOR:'input:not([type="hidden"]), a[href], button, textarea, select, [tabindex]',MENU:".moodle-actionmenu[data-enhance=moodle-core-actionmenu]",MENUBAR:'[role="menubar"]',MENUITEM:'[role="menuitem"]',MENUCONTENT:".menu[data-rel=menu-content]",MENUCONTENTCHILD:"li a",MENUCHILD:".menu li a",TOGGLE:".toggle-display",KEEPOPEN:'[data-keepopen="1"]',MENUBARITEMS:['[role="menubar"] > [role="menuitem"]','[role="menubar"] > [role="presentation"] > [role="menuitem"]'],MENUITEMS:['> [role="menuitem"]','> [role="presentation"] > [role="menuitem"]']},s,o={TL:"tl",TR:"tr",BL:"bl",BR:"br"};s=function(){s.superclass.constructor.apply(this,arguments)},s.prototype={dialogue:null,events:[],owner:null,menulink:null,menuChildren:null,firstMenuChild:null,lastMenuChild:null,initializer:function(){e.all(i.MENU).each(this.enhance,this),n.delegate("key",this.moveMenuItem,"down:37,39",i.MENUBARITEMS.join(","),this),n.delegate("click",this.toggleMenu,i.MENU+" "+i.TOGGLE,this),n.delegate("key",this.showIfHidden,"down:enter,38,40",i.MENU+" "+i.TOGGLE,this),n.delegate("key",function(e){e.currentTarget.simulate("click"),e.preventDefault()},"down:32",i.MENUBARITEMS.join(","))},enhance:function(e){var t=e.one(i.MENUCONTENT),n;if(!t)return!1;n=t.getData("align")||this.get("align").join("-"),e.one(i.TOGGLE).set("aria-haspopup",!0),t.set("aria-hidden",!0),t.hasClass("align-"+n)||t.addClass("align-"+n),t.hasChildNodes()&&e.setAttribute("data-enhanced","1")},moveMenuItem:function(e){var t,n=e.target.ancestor(i.MENUITEM,!0);return e.keyCode===37?t=this.getMenuItem(n,!0):e.keyCode===39&&(t=this.getMenuItem(n)),t&&t.focus(),this},getMenuItem:function(e,t){var n=e.ancestor(i.MENUBAR),r,s;if(!n)return null;r=n.all(i.MENUITEMS.join(","));if(!r)return null;var o=r.size();if(o===1)return null;var u=0,a=1,f=0;for(u=0;u=this.menuChildren.size()&&(r=0),t=this.menuChildren.item(r),o++;while(oa?(c=i=a,p=n=o):n=o+a&&(p=o+a-i),s>f&&l.toLowerCase()==="hidden"&&(h=s=f,e.setStyle("overflow","auto"));if(r>=u&&r+s>u+f){d=u+f-s;try{v=e.getStyle("boxShadow").replace(/.*? (\d+)px \d+px$/,"$1"),(new RegExp(/^\d+$/)).test(v)&&d-u>v&&(d-=v)}catch(m){}}p!==null&&e.setX(p),d!==null&&e.setY(d),c!==null&&e.setStyle("width",c.toString()+"px"),h!==null&&e.setStyle("height",h.toString()+"px")}},e.extend(s,e.Base,s.prototype,{NAME:"moodle-core-actionmenu",ATTRS:{align:{value:[o.TR,o.BR]}}}),M.core=M.core||{},M.core.actionmenu=M.core.actionmenu||{},M.core.actionmenu.instance=null,M.core.actionmenu.init=M.core.actionmenu.init||function(e){M.core.actionmenu.instance=M.core.actionmenu.instance||new s(e)},M.core.actionmenu.newDOMNode=function(e){if(M.core.actionmenu.instance===null)return!0 +;e.all(i.MENU).each(M.core.actionmenu.instance.enhance,M.core.actionmenu.instance)}},"@VERSION@",{requires:["base","event","node-event-simulate"]}); diff --git a/lib/yui/build/moodle-core-actionmenu/moodle-core-actionmenu.js b/lib/yui/build/moodle-core-actionmenu/moodle-core-actionmenu.js index ebfa02f2edb..922a730358d 100644 --- a/lib/yui/build/moodle-core-actionmenu/moodle-core-actionmenu.js +++ b/lib/yui/build/moodle-core-actionmenu/moodle-core-actionmenu.js @@ -189,7 +189,8 @@ ACTIONMENU.prototype = { */ getMenuItem: function(currentItem, previous) { var menubar = currentItem.ancestor(SELECTOR.MENUBAR), - menuitems; + menuitems, + next; if (!menubar) { return null; @@ -338,7 +339,8 @@ ACTIONMENU.prototype = { e.currentTarget.simulate('click'); } else if (e.keyCode === 9) { // The tab key was pressed. Tab moves forwards, Shift + Tab moves backwards through the menu options. - // We only override the Shift + Tab on the first option, and Tab on the last option to change where the focus is moved to. + // We only override the Shift + Tab on the first option, and Tab on the last option to change where the + // focus is moved to. if (e.target === this.firstMenuChild && e.shiftKey) { this.hideMenu(); e.preventDefault(); @@ -453,7 +455,10 @@ ACTIONMENU.prototype = { this.events.push(BODY.delegate('focus', this.hideIfOutside, '*', this)); // Check keyboard changes. - this.events.push(menu.delegate('key', this.handleKeyboardEvent, 'down:9, 27, 38, 40, 32', SELECTOR.MENUCHILD + ', ' + SELECTOR.TOGGLE, this)); + this.events.push( + menu.delegate('key', this.handleKeyboardEvent, + 'down:9, 27, 38, 40, 32', SELECTOR.MENUCHILD + ', ' + SELECTOR.TOGGLE, this) + ); // Close the menu after a button was pushed. this.events.push(menu.delegate('click', function(e) { diff --git a/lib/yui/build/moodle-core-blocks/moodle-core-blocks-debug.js b/lib/yui/build/moodle-core-blocks/moodle-core-blocks-debug.js index 9f5d80df39e..a3f25d42cac 100644 --- a/lib/yui/build/moodle-core-blocks/moodle-core-blocks-debug.js +++ b/lib/yui/build/moodle-core-blocks/moodle-core-blocks-debug.js @@ -135,7 +135,7 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, { var region = node.ancestor('div.'+CSS.BLOCKREGION).get('id').replace(/region-/i, ''); if (Y.Array.indexOf(this.get('regions'), region) === -1) { // Must be standard side-X - if (right_to_left()) { + if (window.right_to_left()) { if (region === 'post') { region = 'pre'; } else if (region === 'pre') { @@ -179,7 +179,9 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, { // We need to fix the case when parent drop over event has determined // 'goingup' and appended the drag node after admin-block. - if (drop.hasClass(this.parentnodeclass) && drop.one('.'+CSS.BLOCKADMINBLOCK) && drop.one('.'+CSS.BLOCKADMINBLOCK).next('.'+CSS.BLOCK)) { + if (drop.hasClass(this.parentnodeclass) && + drop.one('.'+CSS.BLOCKADMINBLOCK) && + drop.one('.'+CSS.BLOCKADMINBLOCK).next('.'+CSS.BLOCK)) { drop.prepend(drag); } @@ -207,7 +209,8 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, { // Moving from empty region-content towards the opposite one, // hide empty one (only for region-pre, region-post areas at the moment). regionname = this.get_region_id(drop.ancestor('div.'+CSS.BLOCKREGION)); - if (this.dragsourceregion.all('.'+CSS.BLOCK).size() === 0 && this.dragsourceregion.get('id').match(/(region-pre|region-post)/i)) { + if (this.dragsourceregion.all('.'+CSS.BLOCK).size() === 0 && + this.dragsourceregion.get('id').match(/(region-pre|region-post)/i)) { if (!documentbody.hasClass('side-'+regionname+'-only')) { documentbody.addClass('side-'+regionname+'-only'); } @@ -602,7 +605,9 @@ MANAGER.prototype = { // We need to fix the case when parent drop over event has determined // 'goingup' and appended the drag node after admin-block. - if (drop.hasClass(CSS.REGIONCONTENT) && drop.one('.'+CSS.BLOCKADMINBLOCK) && drop.one('.'+CSS.BLOCKADMINBLOCK).next('.'+CSS.BLOCK)) { + if (drop.hasClass(CSS.REGIONCONTENT) && + drop.one('.'+CSS.BLOCKADMINBLOCK) && + drop.one('.'+CSS.BLOCKADMINBLOCK).next('.'+CSS.BLOCK)) { drop.prepend(drag); } }, @@ -619,7 +624,9 @@ MANAGER.prototype = { }, /** - * Called by M.core.dragdrop.global_drag_dropmiss when something has been dropped on a node that isn't contained by a drop target. + * Called by M.core.dragdrop.global_drag_dropmiss when something has been dropped on a node that isn't contained by + * a drop target. + * * @method drag_dropmiss * @param {Event} e */ diff --git a/lib/yui/build/moodle-core-blocks/moodle-core-blocks-min.js b/lib/yui/build/moodle-core-blocks/moodle-core-blocks-min.js index abb0a9292b0..0f25b616d45 100644 --- a/lib/yui/build/moodle-core-blocks/moodle-core-blocks-min.js +++ b/lib/yui/build/moodle-core-blocks/moodle-core-blocks-min.js @@ -1,2 +1,2 @@ -YUI.add("moodle-core-blocks",function(e,t){var n="/lib/ajax/blocks.php",r={BLOCK:"block",BLOCKREGION:"block-region",BLOCKADMINBLOCK:"block_adminblock",EDITINGMOVE:"editing_move",HEADER:"header",LIGHTBOX:"lightbox",REGIONCONTENT:"region-content",SKIPBLOCK:"skip-block",SKIPBLOCKTO:"skip-block-to",MYINDEX:"page-my-index",REGIONMAIN:"region-main",BLOCKSMOVING:"blocks-moving"},i={DRAGHANDLE:"."+r.HEADER+" .commands .moodle-core-dragdrop-draghandle"},s=function(){s.superclass.constructor.apply(this,arguments)};e.extend(s,M.core.dragdrop,{skipnodetop:null,skipnodebottom:null,dragsourceregion:null,initializer:function(){this.groups=["block"],this.samenodeclass=r.BLOCK,this.parentnodeclass=r.REGIONCONTENT;var t=e.Node.all("body#"+r.MYINDEX+" #"+r.REGIONMAIN+" > ."+r.REGIONCONTENT);if(t.size()>0){var n=t.item(0);n.addClass(r.BLOCKREGION),n.set("id",r.REGIONCONTENT),n.one("div").addClass(r.REGIONCONTENT)}var s=e.Node.all("div."+r.BLOCKREGION);if(s.size()===0)return!1;if(s.size()!==this.get("regions").length){var o=e.Node.create("
              ").addClass(r.BLOCKREGION),u=e.Node.create("
              ").addClass(r.REGIONCONTENT);o.appendChild(u);var a=s.filter("#region-pre"),f=s.filter("#region-post");a.size()===0&&f.size()===1?(o.setAttrs({id:"region-pre"}),f.item(0).insert(o,"before"),s.unshift(o)):f.size()===0&&a.size()===1&&(o.setAttrs({id:"region-post"}),a.item(0).insert(o,"after"),s.push(o))}s.each(function(t){new e.DD.Drop({node:t.one("div."+r.REGIONCONTENT),groups:this.groups,padding:"40 240 40 240"});var n=new e.DD.Delegate({container:t,nodes:"."+r.BLOCK,target:!0,handles:[i.DRAGHANDLE],invalid:".block-hider-hide, .block-hider-show, .moveto",dragConfig:{groups:this.groups}});n.dd.plug(e.Plugin.DDProxy,{moveOnEnd:!1}),n.dd.plug(e.Plugin.DDWinScroll);var s=t.all("."+r.BLOCK);s.each(function(e){var t=e.one("a."+r.EDITINGMOVE);t&&(t.replace(this.get_drag_handle(t.getAttribute("title"),"","iconsmall",!0)),e.one(i.DRAGHANDLE).setStyle("cursor","move"))},this)},this)},get_block_id:function(e){return Number(e.get("id").replace(/inst/i,""))},get_block_region:function(t){var n=t.ancestor("div."+r.BLOCKREGION).get("id").replace(/region-/i,"");return e.Array.indexOf(this.get("regions"),n)===-1?(right_to_left()&&(n==="post"?n="pre":n==="pre"&&(n="post")),"side-"+n):n},get_region_id:function(e){return e.get("id").replace(/region-/i,"")},drag_start:function(t){var n=t.target;this.dragsourceregion=n.get("node").ancestor("div."+r.BLOCKREGION),n.get("node").previous()&&n.get("node").previous().hasClass(r.SKIPBLOCK)&&(this.skipnodetop=n.get("node").previous()),n.get("node").next()&&n.get("node").next().hasClass(r.SKIPBLOCKTO)&&(this.skipnodebottom=n.get("node").next()),e.one("body").addClass(r.BLOCKSMOVING)},drop_over:function(t){var n=t.drag.get("node"),i=t.drop.get("node");i.hasClass(this.parentnodeclass)&&i.one("."+r.BLOCKADMINBLOCK)&&i.one("."+r.BLOCKADMINBLOCK).next("."+r.BLOCK)&&i.prepend(n);if(this.dragsourceregion.contains(i))return!1;var s=e.one("body"),o=this.get_region_id(this.dragsourceregion);s.hasClass("side-"+o+"-only")&&s.removeClass("side-"+o+"-only"),o=this.get_region_id(i.ancestor("div."+r.BLOCKREGION)),this.dragsourceregion.all("."+r.BLOCK).size()===0&&this.dragsourceregion.get("id").match(/(region-pre|region-post)/i)&&(s.hasClass("side-"+o+"-only")||s.addClass("side-"+o+"-only"))},drag_end:function(){this.skipnodetop=null,this.skipnodebottom=null,this.dragsourceregion=null,e.one("body").removeClass(r.BLOCKSMOVING)},drag_dropmiss:function(e){this.drop_hit(e)},drop_hit:function(t){var i=t.drag,s=i.get("node"),o=t.drop.get("node");s.previous()&&s.previous().hasClass(r.SKIPBLOCK)&&s.insert(s.previous(),"after"),this.skipnodetop&&s.insert(this.skipnodetop,"before"),this.skipnodebottom&&s.insert(this.skipnodebottom,"after");var u=M.util.add_lightbox(e,s),a={sesskey:M.cfg.sesskey,courseid:this.get("courseid"),pagelayout:this.get("pagelayout"),pagetype:this.get("pagetype"),subpage:this.get("subpage"),contextid:this.get("contextid"),action:"move",bui_moveid:this.get_block_id(s),bui_newregion:this.get_block_region(o)};this.get("cmid")&&(a.cmid=this.get("cmid")),s.next("."+this.samenodeclass)&&!s.next("."+this.samenodeclass).hasClass(r.BLOCKADMINBLOCK)&&(a.bui_beforeid=this.get_block_id(s.next("."+this.samenodeclass))),e.io(M.cfg.wwwroot+n,{method:"POST",data:a,on:{start:function(){u.show()},success:function(t,n){window.setTimeout(function(){u.hide()},250);try{var r=e.JSON.parse(n.responseText);r.error&&new M.core.ajaxException(r)}catch(i){}},failure:function(e,t){this.ajax_failure(t),u.hide()}},context:this})}},{NAME:"core-blocks-dragdrop",ATTRS:{courseid:{value:null},cmid:{value:null},contextid:{value:null},pagelayout:{value:null},pagetype:{value:null},subpage:{value:null},regions:{value:null}}}),M.core=M.core||{},M.core.blockdraganddrop=M.core.blockdraganddrop||{},M.core.blockdraganddrop._isusingnewblocksmethod=null,M.core.blockdraganddrop.is_using_blocks_render_method=function(){if(this._isusingnewblocksmethod===null){var t=e.all(".block-region[data-blockregion]").size(),n=e.all(".block-region").size();this._isusingnewblocksmethod=n===t,t>0&&n>0&&t!==n}return this._isusingnewblocksmethod},M.core.blockdraganddrop.init=function(e){this.is_using_blocks_render_method()?new o(e):new s(e)},M.core_blocks=M.core_blocks||{},M.core_blocks.init_dragdrop=function(e){M.core.blockdraganddrop.init(e)};var o=function(){o.superclass.constructor.apply(this,arguments)};o.prototype={skipnodetop:null,skipnodebottom:null,regionobjects:{},initializer:function(){var t=this.get("regions"),n=0,s,o,a;this.groups=["block"],this.samenodeclass=r.BLOCK,this.parentnodeclass=r.BLOCKREGION;var f=e.Node.all("body#"+r.MYINDEX+" #"+r.REGIONMAIN+" > ."+r.REGIONCONTENT);if(f.size()>0){var l=f.item(0);l.addClass(r.BLOCKREGION),l.set("id",r.REGIONCONTENT),l.one("div").addClass(r.REGIONCONTENT)}for(n in t)o=t[n],s=new u({manager:this,region:o,node:e.one("#block-region-"+o)}),this.regionobjects[o]=s,new e.DD.Drop({node:s.get_droptarget(),groups -:this.groups,padding:"40 240 40 240"}),a=new e.DD.Delegate({container:s.get_droptarget(),nodes:"."+r.BLOCK,target:!0,handles:[i.DRAGHANDLE],invalid:".block-hider-hide, .block-hider-show, .moveto, .block_fake",dragConfig:{groups:this.groups}}),a.dd.plug(e.Plugin.DDProxy,{moveOnEnd:!1}),a.dd.plug(e.Plugin.DDWinScroll),e.DD.DDM.on("ddm:start",this.enable_all_regions,this),s.change_block_move_icons(this)},get_block_id:function(e){return Number(e.get("id").replace(/inst/i,""))},get_block_region:function(e){return e.test("[data-blockregion]")||(e=e.ancestor("[data-blockregion]")),e.getData("blockregion")},get_region_object:function(e){return this.regionobjects[this.get_block_region(e)]},enable_all_regions:function(){var t=e.DD.DDM.activeDrag.get("groups");if(!t||e.Array.indexOf(t,"block")===-1)return;var n;for(n in this.regionobjects){if(!this.regionobjects.hasOwnProperty(n))continue;this.regionobjects[n].enable()}},disable_regions_if_required:function(){var e=0;for(e in this.regionobjects)this.regionobjects[e].disable_if_required()},drag_start:function(e){var t=e.target;t.get("node").previous()&&t.get("node").previous().hasClass(r.SKIPBLOCK)&&(this.skipnodetop=t.get("node").previous()),t.get("node").next()&&t.get("node").next().hasClass(r.SKIPBLOCKTO)&&(this.skipnodebottom=t.get("node").next())},drop_over:function(e){var t=e.drag.get("node"),n=e.drop.get("node");n.hasClass(r.REGIONCONTENT)&&n.one("."+r.BLOCKADMINBLOCK)&&n.one("."+r.BLOCKADMINBLOCK).next("."+r.BLOCK)&&n.prepend(t)},drop_end:function(){this.skipnodetop=null,this.skipnodebottom=null,this.disable_regions_if_required()},drag_dropmiss:function(e){this.drop_hit(e)},drop_hit:function(t){var i=t.drag.get("node"),s=t.drop.get("node");i.previous()&&i.previous().hasClass(r.SKIPBLOCK)&&i.insert(i.previous(),"after"),this.skipnodetop&&i.insert(this.skipnodetop,"before"),this.skipnodebottom&&i.insert(this.skipnodebottom,"after");var o=M.util.add_lightbox(e,i),u={sesskey:M.cfg.sesskey,courseid:this.get("courseid"),pagelayout:this.get("pagelayout"),pagetype:this.get("pagetype"),subpage:this.get("subpage"),contextid:this.get("contextid"),action:"move",bui_moveid:this.get_block_id(i),bui_newregion:this.get_block_region(s)};this.get("cmid")&&(u.cmid=this.get("cmid")),i.next("."+r.BLOCK)&&!i.next("."+r.BLOCK).hasClass(r.BLOCKADMINBLOCK)&&(u.bui_beforeid=this.get_block_id(i.next("."+r.BLOCK))),e.io(M.cfg.wwwroot+n,{method:"POST",data:u,on:{start:function(){o.show()},success:function(t,n){window.setTimeout(function(){o.hide()},250);try{var r=e.JSON.parse(n.responseText);r.error&&new M.core.ajaxException(r)}catch(i){}},failure:function(e,t){this.ajax_failure(t),o.hide()},complete:function(){this.disable_regions_if_required()}},context:this})}},e.extend(o,M.core.dragdrop,o.prototype,{NAME:"core-blocks-dragdrop-manager",ATTRS:{courseid:{value:null},cmid:{value:null},contextid:{value:null},pagelayout:{value:null},pagetype:{value:null},subpage:{value:null},regions:{value:[]}}});var u=function(){u.superclass.constructor.apply(this,arguments)};u.prototype={initializer:function(){var t=this.get("node");t||(t=this.create_and_add_node());var n=e.one("body"),i=t.all("."+r.BLOCK).size()>0,s=this.get_has_region_class();this.set("hasblocks",i),n.hasClass(s)||n.addClass(s),n.addClass(i?this.get_used_region_class():this.get_empty_region_class()),n.removeClass(i?this.get_empty_region_class():this.get_used_region_class())},create_and_add_node:function(){var t=e.Node.create,n=this.get("region"),i=t('
              ').addClass(r.BLOCKREGION).setData("blockregion",n),s=this.get("manager").get("regions"),o,u=!1,a=!1,f=!1,l,c;for(o in s)s[o].match(/(pre|left)/)?u=s[o]:s[o].match(/(post|right)/)&&(a=s[o]);return u!==!1&&a!==!1&&(n===u?(c=e.one("#block-region-"+a),c&&(c.insert(i,"before"),f=!0)):(l=e.one("#block-region-"+u),l&&(l.insert(i,"after"),f=!0))),f===!1&&e.one("body").append(i),this.set("node",i),i},change_block_move_icons:function(e){var t,n;this.get("node").all("."+r.BLOCK+" a."+r.EDITINGMOVE).each(function(r){r.setStyle("cursor","move"),t=e.get_drag_handle(r.getAttribute("title"),"","icon",!0),n=t.one("img"),n.addClass("iconsmall"),n.removeClass("icon"),r.replace(t)})},get_has_region_class:function(){return"has-region-"+this.get("region")},get_empty_region_class:function(){return"empty-region-"+this.get("region")},get_used_region_class:function(){return"used-region-"+this.get("region")},get_droptarget:function(){var e=this.get("node");return e.test('[data-droptarget="1"]')?e:e.one('[data-droptarget="1"]')},enable:function(){e.one("body").addClass(this.get_used_region_class()).removeClass(this.get_empty_region_class())},disable_if_required:function(){this.get("node").all("."+r.BLOCK).size()===0&&e.one("body").addClass(this.get_empty_region_class()).removeClass(this.get_used_region_class())}},e.extend(u,e.Base,u.prototype,{NAME:"core-blocks-dragdrop-blockregion",ATTRS:{manager:{writeOnce:"initOnly",validator:function(t){return e.Lang.isObject(t)&&t instanceof o}},region:{writeOnce:"initOnly",validator:function(t){return e.Lang.isString(t)}},node:{validator:function(t){return e.Lang.isObject(t)||e.Lang.isNull(t)}},hasblocks:{value:!1,validator:function(t){return e.Lang.isBoolean(t)}}}})},"@VERSION@",{requires:["base","node","io","dom","dd","dd-scroll","moodle-core-dragdrop","moodle-core-notification"]}); +YUI.add("moodle-core-blocks",function(e,t){var n="/lib/ajax/blocks.php",r={BLOCK:"block",BLOCKREGION:"block-region",BLOCKADMINBLOCK:"block_adminblock",EDITINGMOVE:"editing_move",HEADER:"header",LIGHTBOX:"lightbox",REGIONCONTENT:"region-content",SKIPBLOCK:"skip-block",SKIPBLOCKTO:"skip-block-to",MYINDEX:"page-my-index",REGIONMAIN:"region-main",BLOCKSMOVING:"blocks-moving"},i={DRAGHANDLE:"."+r.HEADER+" .commands .moodle-core-dragdrop-draghandle"},s=function(){s.superclass.constructor.apply(this,arguments)};e.extend(s,M.core.dragdrop,{skipnodetop:null,skipnodebottom:null,dragsourceregion:null,initializer:function(){this.groups=["block"],this.samenodeclass=r.BLOCK,this.parentnodeclass=r.REGIONCONTENT;var t=e.Node.all("body#"+r.MYINDEX+" #"+r.REGIONMAIN+" > ."+r.REGIONCONTENT);if(t.size()>0){var n=t.item(0);n.addClass(r.BLOCKREGION),n.set("id",r.REGIONCONTENT),n.one("div").addClass(r.REGIONCONTENT)}var s=e.Node.all("div."+r.BLOCKREGION);if(s.size()===0)return!1;if(s.size()!==this.get("regions").length){var o=e.Node.create("
              ").addClass(r.BLOCKREGION),u=e.Node.create("
              ").addClass(r.REGIONCONTENT);o.appendChild(u);var a=s.filter("#region-pre"),f=s.filter("#region-post");a.size()===0&&f.size()===1?(o.setAttrs({id:"region-pre"}),f.item(0).insert(o,"before"),s.unshift(o)):f.size()===0&&a.size()===1&&(o.setAttrs({id:"region-post"}),a.item(0).insert(o,"after"),s.push(o))}s.each(function(t){new e.DD.Drop({node:t.one("div."+r.REGIONCONTENT),groups:this.groups,padding:"40 240 40 240"});var n=new e.DD.Delegate({container:t,nodes:"."+r.BLOCK,target:!0,handles:[i.DRAGHANDLE],invalid:".block-hider-hide, .block-hider-show, .moveto",dragConfig:{groups:this.groups}});n.dd.plug(e.Plugin.DDProxy,{moveOnEnd:!1}),n.dd.plug(e.Plugin.DDWinScroll);var s=t.all("."+r.BLOCK);s.each(function(e){var t=e.one("a."+r.EDITINGMOVE);t&&(t.replace(this.get_drag_handle(t.getAttribute("title"),"","iconsmall",!0)),e.one(i.DRAGHANDLE).setStyle("cursor","move"))},this)},this)},get_block_id:function(e){return Number(e.get("id").replace(/inst/i,""))},get_block_region:function(t){var n=t.ancestor("div."+r.BLOCKREGION).get("id").replace(/region-/i,"");return e.Array.indexOf(this.get("regions"),n)===-1?(window.right_to_left()&&(n==="post"?n="pre":n==="pre"&&(n="post")),"side-"+n):n},get_region_id:function(e){return e.get("id").replace(/region-/i,"")},drag_start:function(t){var n=t.target;this.dragsourceregion=n.get("node").ancestor("div."+r.BLOCKREGION),n.get("node").previous()&&n.get("node").previous().hasClass(r.SKIPBLOCK)&&(this.skipnodetop=n.get("node").previous()),n.get("node").next()&&n.get("node").next().hasClass(r.SKIPBLOCKTO)&&(this.skipnodebottom=n.get("node").next()),e.one("body").addClass(r.BLOCKSMOVING)},drop_over:function(t){var n=t.drag.get("node"),i=t.drop.get("node");i.hasClass(this.parentnodeclass)&&i.one("."+r.BLOCKADMINBLOCK)&&i.one("."+r.BLOCKADMINBLOCK).next("."+r.BLOCK)&&i.prepend(n);if(this.dragsourceregion.contains(i))return!1;var s=e.one("body"),o=this.get_region_id(this.dragsourceregion);s.hasClass("side-"+o+"-only")&&s.removeClass("side-"+o+"-only"),o=this.get_region_id(i.ancestor("div."+r.BLOCKREGION)),this.dragsourceregion.all("."+r.BLOCK).size()===0&&this.dragsourceregion.get("id").match(/(region-pre|region-post)/i)&&(s.hasClass("side-"+o+"-only")||s.addClass("side-"+o+"-only"))},drag_end:function(){this.skipnodetop=null,this.skipnodebottom=null,this.dragsourceregion=null,e.one("body").removeClass(r.BLOCKSMOVING)},drag_dropmiss:function(e){this.drop_hit(e)},drop_hit:function(t){var i=t.drag,s=i.get("node"),o=t.drop.get("node");s.previous()&&s.previous().hasClass(r.SKIPBLOCK)&&s.insert(s.previous(),"after"),this.skipnodetop&&s.insert(this.skipnodetop,"before"),this.skipnodebottom&&s.insert(this.skipnodebottom,"after");var u=M.util.add_lightbox(e,s),a={sesskey:M.cfg.sesskey,courseid:this.get("courseid"),pagelayout:this.get("pagelayout"),pagetype:this.get("pagetype"),subpage:this.get("subpage"),contextid:this.get("contextid"),action:"move",bui_moveid:this.get_block_id(s),bui_newregion:this.get_block_region(o)};this.get("cmid")&&(a.cmid=this.get("cmid")),s.next("."+this.samenodeclass)&&!s.next("."+this.samenodeclass).hasClass(r.BLOCKADMINBLOCK)&&(a.bui_beforeid=this.get_block_id(s.next("."+this.samenodeclass))),e.io(M.cfg.wwwroot+n,{method:"POST",data:a,on:{start:function(){u.show()},success:function(t,n){window.setTimeout(function(){u.hide()},250);try{var r=e.JSON.parse(n.responseText);r.error&&new M.core.ajaxException(r)}catch(i){}},failure:function(e,t){this.ajax_failure(t),u.hide()}},context:this})}},{NAME:"core-blocks-dragdrop",ATTRS:{courseid:{value:null},cmid:{value:null},contextid:{value:null},pagelayout:{value:null},pagetype:{value:null},subpage:{value:null},regions:{value:null}}}),M.core=M.core||{},M.core.blockdraganddrop=M.core.blockdraganddrop||{},M.core.blockdraganddrop._isusingnewblocksmethod=null,M.core.blockdraganddrop.is_using_blocks_render_method=function(){if(this._isusingnewblocksmethod===null){var t=e.all(".block-region[data-blockregion]").size(),n=e.all(".block-region").size();this._isusingnewblocksmethod=n===t,t>0&&n>0&&t!==n}return this._isusingnewblocksmethod},M.core.blockdraganddrop.init=function(e){this.is_using_blocks_render_method()?new o(e):new s(e)},M.core_blocks=M.core_blocks||{},M.core_blocks.init_dragdrop=function(e){M.core.blockdraganddrop.init(e)};var o=function(){o.superclass.constructor.apply(this,arguments)};o.prototype={skipnodetop:null,skipnodebottom:null,regionobjects:{},initializer:function(){var t=this.get("regions"),n=0,s,o,a;this.groups=["block"],this.samenodeclass=r.BLOCK,this.parentnodeclass=r.BLOCKREGION;var f=e.Node.all("body#"+r.MYINDEX+" #"+r.REGIONMAIN+" > ."+r.REGIONCONTENT);if(f.size()>0){var l=f.item(0);l.addClass(r.BLOCKREGION),l.set("id",r.REGIONCONTENT),l.one("div").addClass(r.REGIONCONTENT)}for(n in t)o=t[n],s=new u({manager:this,region:o,node:e.one("#block-region-"+o)}),this.regionobjects[o]=s,new e.DD.Drop({node:s.get_droptarget() +,groups:this.groups,padding:"40 240 40 240"}),a=new e.DD.Delegate({container:s.get_droptarget(),nodes:"."+r.BLOCK,target:!0,handles:[i.DRAGHANDLE],invalid:".block-hider-hide, .block-hider-show, .moveto, .block_fake",dragConfig:{groups:this.groups}}),a.dd.plug(e.Plugin.DDProxy,{moveOnEnd:!1}),a.dd.plug(e.Plugin.DDWinScroll),e.DD.DDM.on("ddm:start",this.enable_all_regions,this),s.change_block_move_icons(this)},get_block_id:function(e){return Number(e.get("id").replace(/inst/i,""))},get_block_region:function(e){return e.test("[data-blockregion]")||(e=e.ancestor("[data-blockregion]")),e.getData("blockregion")},get_region_object:function(e){return this.regionobjects[this.get_block_region(e)]},enable_all_regions:function(){var t=e.DD.DDM.activeDrag.get("groups");if(!t||e.Array.indexOf(t,"block")===-1)return;var n;for(n in this.regionobjects){if(!this.regionobjects.hasOwnProperty(n))continue;this.regionobjects[n].enable()}},disable_regions_if_required:function(){var e=0;for(e in this.regionobjects)this.regionobjects[e].disable_if_required()},drag_start:function(e){var t=e.target;t.get("node").previous()&&t.get("node").previous().hasClass(r.SKIPBLOCK)&&(this.skipnodetop=t.get("node").previous()),t.get("node").next()&&t.get("node").next().hasClass(r.SKIPBLOCKTO)&&(this.skipnodebottom=t.get("node").next())},drop_over:function(e){var t=e.drag.get("node"),n=e.drop.get("node");n.hasClass(r.REGIONCONTENT)&&n.one("."+r.BLOCKADMINBLOCK)&&n.one("."+r.BLOCKADMINBLOCK).next("."+r.BLOCK)&&n.prepend(t)},drop_end:function(){this.skipnodetop=null,this.skipnodebottom=null,this.disable_regions_if_required()},drag_dropmiss:function(e){this.drop_hit(e)},drop_hit:function(t){var i=t.drag.get("node"),s=t.drop.get("node");i.previous()&&i.previous().hasClass(r.SKIPBLOCK)&&i.insert(i.previous(),"after"),this.skipnodetop&&i.insert(this.skipnodetop,"before"),this.skipnodebottom&&i.insert(this.skipnodebottom,"after");var o=M.util.add_lightbox(e,i),u={sesskey:M.cfg.sesskey,courseid:this.get("courseid"),pagelayout:this.get("pagelayout"),pagetype:this.get("pagetype"),subpage:this.get("subpage"),contextid:this.get("contextid"),action:"move",bui_moveid:this.get_block_id(i),bui_newregion:this.get_block_region(s)};this.get("cmid")&&(u.cmid=this.get("cmid")),i.next("."+r.BLOCK)&&!i.next("."+r.BLOCK).hasClass(r.BLOCKADMINBLOCK)&&(u.bui_beforeid=this.get_block_id(i.next("."+r.BLOCK))),e.io(M.cfg.wwwroot+n,{method:"POST",data:u,on:{start:function(){o.show()},success:function(t,n){window.setTimeout(function(){o.hide()},250);try{var r=e.JSON.parse(n.responseText);r.error&&new M.core.ajaxException(r)}catch(i){}},failure:function(e,t){this.ajax_failure(t),o.hide()},complete:function(){this.disable_regions_if_required()}},context:this})}},e.extend(o,M.core.dragdrop,o.prototype,{NAME:"core-blocks-dragdrop-manager",ATTRS:{courseid:{value:null},cmid:{value:null},contextid:{value:null},pagelayout:{value:null},pagetype:{value:null},subpage:{value:null},regions:{value:[]}}});var u=function(){u.superclass.constructor.apply(this,arguments)};u.prototype={initializer:function(){var t=this.get("node");t||(t=this.create_and_add_node());var n=e.one("body"),i=t.all("."+r.BLOCK).size()>0,s=this.get_has_region_class();this.set("hasblocks",i),n.hasClass(s)||n.addClass(s),n.addClass(i?this.get_used_region_class():this.get_empty_region_class()),n.removeClass(i?this.get_empty_region_class():this.get_used_region_class())},create_and_add_node:function(){var t=e.Node.create,n=this.get("region"),i=t('
              ').addClass(r.BLOCKREGION).setData("blockregion",n),s=this.get("manager").get("regions"),o,u=!1,a=!1,f=!1,l,c;for(o in s)s[o].match(/(pre|left)/)?u=s[o]:s[o].match(/(post|right)/)&&(a=s[o]);return u!==!1&&a!==!1&&(n===u?(c=e.one("#block-region-"+a),c&&(c.insert(i,"before"),f=!0)):(l=e.one("#block-region-"+u),l&&(l.insert(i,"after"),f=!0))),f===!1&&e.one("body").append(i),this.set("node",i),i},change_block_move_icons:function(e){var t,n;this.get("node").all("."+r.BLOCK+" a."+r.EDITINGMOVE).each(function(r){r.setStyle("cursor","move"),t=e.get_drag_handle(r.getAttribute("title"),"","icon",!0),n=t.one("img"),n.addClass("iconsmall"),n.removeClass("icon"),r.replace(t)})},get_has_region_class:function(){return"has-region-"+this.get("region")},get_empty_region_class:function(){return"empty-region-"+this.get("region")},get_used_region_class:function(){return"used-region-"+this.get("region")},get_droptarget:function(){var e=this.get("node");return e.test('[data-droptarget="1"]')?e:e.one('[data-droptarget="1"]')},enable:function(){e.one("body").addClass(this.get_used_region_class()).removeClass(this.get_empty_region_class())},disable_if_required:function(){this.get("node").all("."+r.BLOCK).size()===0&&e.one("body").addClass(this.get_empty_region_class()).removeClass(this.get_used_region_class())}},e.extend(u,e.Base,u.prototype,{NAME:"core-blocks-dragdrop-blockregion",ATTRS:{manager:{writeOnce:"initOnly",validator:function(t){return e.Lang.isObject(t)&&t instanceof o}},region:{writeOnce:"initOnly",validator:function(t){return e.Lang.isString(t)}},node:{validator:function(t){return e.Lang.isObject(t)||e.Lang.isNull(t)}},hasblocks:{value:!1,validator:function(t){return e.Lang.isBoolean(t)}}}})},"@VERSION@",{requires:["base","node","io","dom","dd","dd-scroll","moodle-core-dragdrop","moodle-core-notification"]}); diff --git a/lib/yui/build/moodle-core-blocks/moodle-core-blocks.js b/lib/yui/build/moodle-core-blocks/moodle-core-blocks.js index a73b5849ff6..fbedc54ac04 100644 --- a/lib/yui/build/moodle-core-blocks/moodle-core-blocks.js +++ b/lib/yui/build/moodle-core-blocks/moodle-core-blocks.js @@ -135,7 +135,7 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, { var region = node.ancestor('div.'+CSS.BLOCKREGION).get('id').replace(/region-/i, ''); if (Y.Array.indexOf(this.get('regions'), region) === -1) { // Must be standard side-X - if (right_to_left()) { + if (window.right_to_left()) { if (region === 'post') { region = 'pre'; } else if (region === 'pre') { @@ -179,7 +179,9 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, { // We need to fix the case when parent drop over event has determined // 'goingup' and appended the drag node after admin-block. - if (drop.hasClass(this.parentnodeclass) && drop.one('.'+CSS.BLOCKADMINBLOCK) && drop.one('.'+CSS.BLOCKADMINBLOCK).next('.'+CSS.BLOCK)) { + if (drop.hasClass(this.parentnodeclass) && + drop.one('.'+CSS.BLOCKADMINBLOCK) && + drop.one('.'+CSS.BLOCKADMINBLOCK).next('.'+CSS.BLOCK)) { drop.prepend(drag); } @@ -207,7 +209,8 @@ Y.extend(DRAGBLOCK, M.core.dragdrop, { // Moving from empty region-content towards the opposite one, // hide empty one (only for region-pre, region-post areas at the moment). regionname = this.get_region_id(drop.ancestor('div.'+CSS.BLOCKREGION)); - if (this.dragsourceregion.all('.'+CSS.BLOCK).size() === 0 && this.dragsourceregion.get('id').match(/(region-pre|region-post)/i)) { + if (this.dragsourceregion.all('.'+CSS.BLOCK).size() === 0 && + this.dragsourceregion.get('id').match(/(region-pre|region-post)/i)) { if (!documentbody.hasClass('side-'+regionname+'-only')) { documentbody.addClass('side-'+regionname+'-only'); } @@ -597,7 +600,9 @@ MANAGER.prototype = { // We need to fix the case when parent drop over event has determined // 'goingup' and appended the drag node after admin-block. - if (drop.hasClass(CSS.REGIONCONTENT) && drop.one('.'+CSS.BLOCKADMINBLOCK) && drop.one('.'+CSS.BLOCKADMINBLOCK).next('.'+CSS.BLOCK)) { + if (drop.hasClass(CSS.REGIONCONTENT) && + drop.one('.'+CSS.BLOCKADMINBLOCK) && + drop.one('.'+CSS.BLOCKADMINBLOCK).next('.'+CSS.BLOCK)) { drop.prepend(drag); } }, @@ -614,7 +619,9 @@ MANAGER.prototype = { }, /** - * Called by M.core.dragdrop.global_drag_dropmiss when something has been dropped on a node that isn't contained by a drop target. + * Called by M.core.dragdrop.global_drag_dropmiss when something has been dropped on a node that isn't contained by + * a drop target. + * * @method drag_dropmiss * @param {Event} e */ diff --git a/lib/yui/build/moodle-core-chooserdialogue/moodle-core-chooserdialogue-debug.js b/lib/yui/build/moodle-core-chooserdialogue/moodle-core-chooserdialogue-debug.js index ac1d068972e..532e692504e 100644 --- a/lib/yui/build/moodle-core-chooserdialogue/moodle-core-chooserdialogue-debug.js +++ b/lib/yui/build/moodle-core-chooserdialogue/moodle-core-chooserdialogue-debug.js @@ -252,7 +252,7 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, { newheight = newheight - (15 + 15 + 40 + 40); dialogue.setStyle('maxHeight', newheight + 'px'); - dialogueheight = bb.getStyle('height'); + var dialogueheight = bb.getStyle('height'); if (dialogueheight.match(/.*px$/)) { dialogueheight = dialogueheight.replace(/px$/, ''); } else { diff --git a/lib/yui/build/moodle-core-chooserdialogue/moodle-core-chooserdialogue-min.js b/lib/yui/build/moodle-core-chooserdialogue/moodle-core-chooserdialogue-min.js index e0f3b2ee10d..b07b22353c0 100644 --- a/lib/yui/build/moodle-core-chooserdialogue/moodle-core-chooserdialogue-min.js +++ b/lib/yui/build/moodle-core-chooserdialogue/moodle-core-chooserdialogue-min.js @@ -1 +1 @@ -YUI.add("moodle-core-chooserdialogue",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)};e.extend(n,e.Base,{panel:null,submitbutton:null,container:null,listenevents:[],bodycontent:null,headercontent:null,instanceconfig:null,hiddenRadioValue:null,setup_chooser_dialogue:function(e,t,n){this.bodycontent=e,this.headercontent=t,this.instanceconfig=n},prepare_chooser:function(){if(this.panel)return;e.one(e.config.doc.body).addClass("jschooser");var t,n={bodyContent:this.bodycontent.get("innerHTML"),headerContent:this.headercontent.get("innerHTML"),width:"540px",draggable:!0,visible:!1,zindex:100,modal:!0,shim:!0,closeButtonTitle:this.get("closeButtonTitle"),focusOnPreviousTargetAfterHide:!0,render:!1,extraClasses:this._getClassNames()};for(t in this.instanceconfig)n[t]=this.instanceconfig[t];this.panel=new M.core.dialogue(n),this.bodycontent.remove(),this.headercontent.remove(),this.panel.hide(),this.panel.render(),this.container=this.panel.get("boundingBox").one(".choosercontainer"),this.options=this.container.all(".option input[type=radio]"),this.hiddenRadioValue=e.Node.create(''),this.container.one("form").appendChild(this.hiddenRadioValue),this.panel.get("boundingBox").addClass("chooserdialogue")},display_chooser:function(t){var n,r,i;this.prepare_chooser(),t.preventDefault(),n=this.panel.get("boundingBox"),r=this.container.one(".alloptions"),i=e.one("document").on("orientationchange",function(){this.center_dialogue(r)},this),this.listenevents.push(i),i=e.one("window").on("resize",function(){this.center_dialogue(r)},this),this.listenevents.push(i),i=this.container.on("click",this.check_options,this),this.listenevents.push(i),i=this.container.on("key_up",this.check_options,this),this.listenevents.push(i),i=this.container.on("dblclick",function(e){e.target.ancestor("div.option")&&(this.check_options(),this.submitbutton.setAttribute("disabled","disabled"),this.options.setAttribute("disabled","disabled"),this.cancel_listenevents(),this.container.one("form").submit())},this),this.listenevents.push(i),this.container.one("form").on("submit",function(){this.submitbutton.setAttribute("disabled","disabled"),this.options.setAttribute("disabled","disabled"),this.cancel_listenevents()},this),i=this.container.one(".addcancel").on("click",this.cancel_popup,this),this.listenevents.push(i),i=n.one("button.closebutton").on("click",this.cancel_popup,this),this.listenevents.push(i),i=e.one("document").on("keydown",this.handle_key_press,this),this.listenevents.push(i),this.submitbutton=this.container.one(".submitbutton"),this.submitbutton.set("disabled","true"),this.options.removeAttribute("disabled"),this.panel.show(t),this.center_dialogue(r),this.container.one(".option input[type=radio]").focus(),this.check_options()},cancel_listenevents:function(){var e;while(this.listenevents.length)e=this.listenevents.shift(),e.detach()},center_dialogue:function(e){var t=this.panel.get("boundingBox"),n=t.get("winHeight"),r,i;if(this.panel.shouldResizeFullscreen())return;r=this.get("maxheight"),n<=r&&(n<=this.get("minheight")?r=this.get("minheight"):r=n),r>this.get("minheight")?this.panel.lockScroll&&!this.panel.lockScroll.isActive()&&this.panel.lockScroll.enableScrollLock(!0):this.panel.lockScroll&&this.panel.lockScroll.isActive()&&this.panel.lockScroll.disableScrollLock(),i=r,r-=110,e.setStyle("maxHeight",r+"px"),dialogueheight=t.getStyle("height"),dialogueheight.match(/.*px$/)?dialogueheight=dialogueheight.replace(/px$/,""):dialogueheight=i,dialogueheight'),this.container.one("form").appendChild(this.hiddenRadioValue),this.panel.get("boundingBox").addClass("chooserdialogue")},display_chooser:function(t){var n,r,i;this.prepare_chooser(),t.preventDefault(),n=this.panel.get("boundingBox"),r=this.container.one(".alloptions"),i=e.one("document").on("orientationchange",function(){this.center_dialogue(r)},this),this.listenevents.push(i),i=e.one("window").on("resize",function(){this.center_dialogue(r)},this),this.listenevents.push(i),i=this.container.on("click",this.check_options,this),this.listenevents.push(i),i=this.container.on("key_up",this.check_options,this),this.listenevents.push(i),i=this.container.on("dblclick",function(e){e.target.ancestor("div.option")&&(this.check_options(),this.submitbutton.setAttribute("disabled","disabled"),this.options.setAttribute("disabled","disabled"),this.cancel_listenevents(),this.container.one("form").submit())},this),this.listenevents.push(i),this.container.one("form").on("submit",function(){this.submitbutton.setAttribute("disabled","disabled"),this.options.setAttribute("disabled","disabled"),this.cancel_listenevents()},this),i=this.container.one(".addcancel").on("click",this.cancel_popup,this),this.listenevents.push(i),i=n.one("button.closebutton").on("click",this.cancel_popup,this),this.listenevents.push(i),i=e.one("document").on("keydown",this.handle_key_press,this),this.listenevents.push(i),this.submitbutton=this.container.one(".submitbutton"),this.submitbutton.set("disabled","true"),this.options.removeAttribute("disabled"),this.panel.show(t),this.center_dialogue(r),this.container.one(".option input[type=radio]").focus(),this.check_options()},cancel_listenevents:function(){var e;while(this.listenevents.length)e=this.listenevents.shift(),e.detach()},center_dialogue:function(e){var t=this.panel.get("boundingBox"),n=t.get("winHeight"),r,i;if(this.panel.shouldResizeFullscreen())return;r=this.get("maxheight"),n<=r&&(n<=this.get("minheight")?r=this.get("minheight"):r=n),r>this.get("minheight")?this.panel.lockScroll&&!this.panel.lockScroll.isActive()&&this.panel.lockScroll.enableScrollLock(!0):this.panel.lockScroll&&this.panel.lockScroll.isActive()&&this.panel.lockScroll.disableScrollLock(),i=r,r-=110,e.setStyle("maxHeight",r+"px");var s=t.getStyle("height");s.match(/.*px$/)?s=s.replace(/px$/,""):s=i,s'+text+'

              '); + test = Y.Node.create('

              ' + text + '

              '); BODY.insert(test, 0); width = test.one('span').get('offsetWidth') * 1.2; height = test.one('span').get('offsetHeight'); @@ -197,7 +198,7 @@ M.core.dock.fixTitleOrientation = function(title, text) { }); // Positioning is different when in RTL mode. - if (right_to_left()) { + if (window.right_to_left()) { title.setStyle('left', width/2 - height); } else { title.setStyle('right', width/2 - height); @@ -490,7 +491,7 @@ DOCK.prototype = { }; try { // Run the customisation function - customise_dock_for_theme(this); + window.customise_dock_for_theme(this); } catch (exception) { // Do nothing at the moment. Y.log('Exception while attempting to apply theme customisations.', 'error', LOGNS); @@ -517,7 +518,9 @@ DOCK.prototype = { warned = true; } // Damn, the've set something. - Y.log('Note for customise_dock_for_theme code: M.core_dock.cfg.'+key+' is now dock.set(\''+key+'\', value)', 'debug', LOGNS); + Y.log('Note for customise_dock_for_theme code: M.core_dock.cfg.' + key + + ' is now dock.set(\'' + key + '\', value)', + 'debug', LOGNS); this.set(cfgmap[key], value); } } @@ -533,7 +536,8 @@ DOCK.prototype = { warned = true; } // Damn, they've set something. - Y.log('Note for customise_dock_for_theme code: M.core_dock.css.'+key+' is now CSS.'+key+' = value', 'debug', LOGNS); + Y.log('Note for customise_dock_for_theme code: M.core_dock.css.' + key + ' is now CSS.' + key + ' = value', + 'debug', LOGNS); CSS[key] = value; } } @@ -1099,8 +1103,8 @@ Y.extend(DOCK, Y.Base, DOCK.prototype, { * @type String * @default t/dock_to_block */ - undockAllIconUrl : { - value : M.util.image_url((right_to_left()) ? 't/dock_to_block_rtl' : 't/dock_to_block', 'moodle'), + undockAllIconUrl: { + value : M.util.image_url((window.right_to_left()) ? 't/dock_to_block_rtl' : 't/dock_to_block', 'moodle'), validator : Y.Lang.isString } } @@ -1702,7 +1706,7 @@ BLOCK.prototype = { var dock = M.core.dock.get(), id = this.get('id'), blockcontent = Y.one('#inst'+id).one('.content'), - icon = (right_to_left()) ? 't/dock_to_block_rtl' : 't/dock_to_block', + icon = (window.right_to_left()) ? 't/dock_to_block_rtl' : 't/dock_to_block', breakchar = (location.href.match(/\?/)) ? '&' : '?', blocktitle, blockcommands, @@ -1945,7 +1949,8 @@ DOCKEDITEM.prototype = { dockitem.append(docktitle); dock.append(dockitem); - closeiconimg = create(''+M.util.get_string('hidepanel', 'block')+''); + closeiconimg = create('' + M.util.get_string('hidepanel', 'block') +
+                ''); closeiconimg.setAttribute('src', M.util.image_url('t/dockclose', 'moodle')); closeicon = create('').append(closeiconimg); closeicon.on('forceclose|click', this.hide, this); @@ -1972,7 +1977,8 @@ DOCKEDITEM.prototype = { this.fire('dockeditem:showstart'); Y.log('Showing '+this._getLogDescription(), 'debug', LOGNS); panel.setHeader(this.get('titlestring'), this.get('commands')); - panel.setBody(Y.Node.create('
              ').append(this.get('contents'))); + panel.setBody(Y.Node.create('
              ') + .append(this.get('contents'))); if (M.core.actionmenu !== undefined) { M.core.actionmenu.newDOMNode(panel.get('node')); } diff --git a/lib/yui/build/moodle-core-dock/moodle-core-dock-min.js b/lib/yui/build/moodle-core-dock/moodle-core-dock-min.js index a83b4f4cb0e..1adf9f6cf40 100644 --- a/lib/yui/build/moodle-core-dock/moodle-core-dock-min.js +++ b/lib/yui/build/moodle-core-dock/moodle-core-dock-min.js @@ -1,4 +1,4 @@ -YUI.add("moodle-core-dock",function(e,t){var n="moodle-core-dock",r=e.one(e.config.doc.body),i={dock:"dock",dockspacer:"dockspacer",controls:"controls",body:"has_dock",buttonscontainer:"buttons_container",dockeditem:"dockeditem",dockeditemcontainer:"dockeditem_container",dockedtitle:"dockedtitle",activeitem:"activeitem",contentonly:"content-only",dockonload:"dock_on_load"},s={dockableblock:".block[data-instanceid][data-dockable]",blockmoveto:".block[data-instanceid][data-dockable] .moveto",panelmoveto:"#dockeditempanel .commands a.moveto",dockonload:".block."+i.dockonload,blockregion:"[data-blockregion]"},o,u,a,f,l;M.core=M.core||{},M.core.dock=M.core.dock||{},M.core.dock._dock=null,M.core.dock._dockableblocks={},M.core.dock.init=function(){e.all(s.dockableblock).each(M.core.dock.registerDockableBlock),r.delegate("click",M.core.dock.dockBlock,s.blockmoveto),r.delegate("key",M.core.dock.dockBlock,s.blockmoveto,"enter")},M.core.dock.get=function(){return this._dock===null&&(this._dock=new o),this._dock},M.core.dock.registerDockableBlock=function(e){typeof e=="object"&&typeof e.getData=="function"&&(e=e.getData("instanceid")),M.core.dock._dockableblocks[e]=new f({id:e})},M.core.dock.dockBlock=function(e){typeof e=="object"&&e.target!=="undefined"&&(e=e.target);if(typeof e=="object"){e.test(s.dockableblock)||(e=e.ancestor(s.dockableblock));if(typeof e!="object"||typeof e.getData!="function"||!!e.ancestor("."+i.dock))return;e=e.getData("instanceid")}var t=M.core.dock._dockableblocks[e];t&&t.moveToDock()},M.core.dock.fixTitleOrientation=function(t,n){var i=M.core.dock.get(),s="11px",o="rotate(270deg)",u,a,f,l,c=M.util.get_string("thisdirectionvertical","langconfig");t=e.one(t);if(i.get("orientation")!=="vertical")return t.set("innerHTML",n),t;e.UA.ie>0&&e.UA.ie<8&&(c="ver");switch(c){case"ver":return t.set("innerHTML",n.split("").join("
              "));case"ttb":o="rotate(90deg)";break;case"btt":}return e.UA.ie===8?(t.set("innerHTML",n),t.setAttribute("style","writing-mode: tb-rl; filter: flipV flipH;display:inline;"),t.addClass("filterrotate"),t):(u=e.Node.create('

              '+n+"

              "),r.insert(u,0),a=u.one("span").get("offsetWidth")*1.2,f=u.one("span").get("offsetHeight"),u.remove(),t.set("innerHTML",n),t.addClass("css3transform"),t.setStyles({position:"relative",fontSize:s,width:a,top:(a-f)/2}),right_to_left()?t.setStyle("left",a/2-f):t.setStyle("right",a/2-f),t.setStyles({transform:o,"-ms-transform":o,"-moz-transform":o,"-webkit-transform":o,"-o-transform":o}),l=e.Node.create("
              "),l.append(t),l.setStyles({height:a+a/4,position:"relative"}),l)},M.core.dock.notifyBlockChange=function(e){if(this._dock!==null){var t=M.core.dock.get(),n=t.getActiveItem();n&&n.get("blockinstanceid")===parseInt(e,10)&&t.resizePanelIfRequired()}},o=function(){o.superclass.constructor.apply(this,arguments)},o.prototype={tabheightmanager:null,preventevent:null,delayedevent:null,dockeditems:[],dockdrawn:!1,count:0,totalcount:0,holdingareanode:null,initializer:function(){this.publish("dock:starting",{prefix:"dock",broadcast:2,emitFacade:!0,fireOnce:!0}),this.publish("dock:initialised",{prefix:"dock",broadcast:2,emitFacade:!0,fireOnce:!0}),this.publish("dock:beforedraw",{prefix:"dock",fireOnce:!0}),this.publish("dock:beforeshow",{prefix:"dock"}),this.publish("dock:shown",{prefix:"dock",broadcast:2}),this.publish("dock:hidden",{prefix:"dock",broadcast:2}),this.publish("dock:itemadded",{prefix:"dock"}),this.publish("dock:itemremoved",{prefix:"dock"}),this.publish("dock:itemschanged",{prefix:"dock",broadcast:2}),this.publish("dock:panelgenerated",{prefix:"dock",fireOnce:!0}),this.publish("dock:panelresizestart",{prefix:"dock"}),this.publish("dock:resizepanelcomplete",{prefix:"dock"}),this._applyThemeCustomisation(),this.fire("dock:starting"),this._ensureDockDrawn(),this.fire("dock:initialised")},_ensureDockDrawn:function(){if(this.dockdrawn===!0)return!0;var t=this._initialiseDockNode(),n={cssselector:"."+i.dockedtitle,delay:0},o={cssselector:"."+i.dockedtitle,delay:.5,iscontained:!0,preventevent:"click",preventdelay:3};return e.UA.ie>0&&e.UA.ie<7&&t.setStyle("height",t.get("winHeight")+"px"),this.fire("dock:beforedraw"),this._initialiseDockControls(),this.tabheightmanager=new a({dock:this}),e.delegate("click",this.handleEvent,this.get("dockNode"),"."+i.dockedtitle,this,n),e.delegate("mouseenter",this.handleEvent,this.get("dockNode"),"."+i.dockedtitle,this,o),this.get("dockNode").on("mouseleave",this.handleEvent,this,{cssselector:"#dock",delay:.5,iscontained:!1}),e.delegate("click",this.handleReturnToBlock,this.get("dockNode"),s.panelmoveto,this),e.delegate("click",this.handleReturnToBlock,this.get("dockNode"),s.panelmoveto,this),e.delegate("dock:actionkey",this.handleDockedItemEvent,this.get("dockNode"),"."+i.dockeditem,this),r.on("click",this.handleEvent,this,{cssselector:"body",delay:0}),this.on("dock:itemschanged",this.resizeBlockSpace,this),this.on("dock:itemschanged",this.checkDockVisibility,this),this.on("dock:itemschanged",this.resetFirstItem,this),this.dockdrawn=!0,!0},handleDockedItemEvent:function(e){if(e.type!=="dock:actionkey")return!1;var t=e.target,n="."+i.dockeditem;t.test(n)||(t=t.ancestor(n));if(!t)return!1;e.halt(),this.dockeditems[t.getAttribute("rel")].toggle(e.action)},_applyThemeCustomisation:function(){if(typeof customise_dock_for_theme=="function"){M.core_dock=this,M.core_dock.cfg={buffer:null,orientation:null,position:null,spacebeforefirstitem:null,removeallicon:null},M.core_dock.css={dock:null,dockspacer:null,controls:null,body:null,buttonscontainer:null,dockeditem:null,dockeditemcontainer:null,dockedtitle:null,activeitem:null};try{customise_dock_for_theme(this)}catch(t){}var n,r,s=!1,o={buffer:"bufferPanel",orientation:"orientation",position:"position",spacebeforefirstitem:"bufferBeforeFirstItem",removeallicon:"undockAllIconUrl"};for(n in M.core_dock.cfg)if(e.Lang.isString(n)&&o[n]){r=M.core_dock.cfg[n -];if(r===null)continue;s||(s=!0),this.set(o[n],r)}for(n in M.core_dock.css)if(e.Lang.isString(n)){r=M.core_dock.css[n];if(r===null)continue;s||(s=!0),i[n]=r}}},_initialiseDockNode:function(){var t=this.get("dockNode"),n=i.dock+"_"+this.get("position")+"_"+this.get("orientation"),o=e.Node.create("
              ").setStyles({display:"none"}),u=this.get("buttonsNode"),a=this.get("itemContainerNode");return t||(t=e.one("#"+i.dock)),t||(t=e.Node.create('
              '),r.append(t)),t.setAttribute("role","menubar").addClass(n),e.all(s.dockonload).size()===0?t.addClass("nothingdocked"):(n=i.body+"_"+this.get("position")+"_"+this.get("orientation"),r.addClass(i.body).addClass()),u||(u=t.one("."+i.buttonscontainer)),u||(u=e.Node.create('
              '),t.append(u)),a||(a=t.one("."+i.dockeditemcontainer)),a||(a=e.Node.create('
              '),u.append(a)),r.append(o),this.holdingareanode=o,this.set("dockNode",t),this.set("buttonsNode",u),this.set("itemContainerNode",a),t},_initialiseDockControls:function(){var t=e.Node.create(''+M.util.get_string(');t.setAttribute("src",this.get("undockAllIconUrl")),t.on("removeall|click",this.removeAll,this),t.on("dock:actionkey",this.removeAll,this,{actions:{enter:!0}}),this.get("buttonsNode").append(e.Node.create('
              ').append(t))},getPanel:function(){var t=this.get("panel");return t||(t=new u({dock:this}),t.on("panel:visiblechange",this.resize,this),e.on("windowresize",this.resize,this),this.set("panel",t),this.fire("dock:panelgenerated")),t},resizePanelIfRequired:function(){this.resize();var e=this.get("panel");e&&e.correctWidth()},handleEvent:function(e,t){var n=this.getActiveItem(),r,i,s=/^dock_item_(\d+)_title$/,o=this;if(t.cssselector==="body")this.get("dockNode").contains(e.target)||n&&n.hide();else{e.target.test(t.cssselector)?r=e.target:r=e.target.ancestor(t.cssselector);if(!r)return!0;if(this.preventevent!==null&&e.type===this.preventevent)return!0;t.preventevent&&(this.preventevent=t.preventevent,t.preventdelay&&setTimeout(function(){o.preventevent=null},t.preventdelay*1e3)),this.delayedevent&&this.delayedevent.timeout&&(clearTimeout(this.delayedevent.timeout),this.delayedevent.event.detach(),this.delayedevent=null);if(t.delay>0)return this.delayEvent(e,t,r);i=r.get("id"),i.match(s)?(n=this.dockeditems[i.replace(s,"$1")],n.active?n.hide():n.show()):n&&n.hide()}return!0},delayEvent:function(e,t,n){var i=this;return i.delayedevent=function(){return{target:n,event:r.on("mousemove",function(e){i.delayedevent.target=e.target}),timeout:null}}(i),i.delayedevent.timeout=setTimeout(function(){i.delayedevent.timeout=null,i.delayedevent.event.detach(),t.iscontained===i.get("dockNode").contains(i.delayedevent.target)&&i.handleEvent(e,{cssselector:t.cssselector,delay:0,iscontained:t.iscontained})},t.delay*1e3),!0},resizeBlockSpace:function(){if(e.all(s.dockonload).size()>0)return;var t=[],n=0,o=!0,u=!1,a;e.all(s.blockregion).each(function(e){var t=e.getData("blockregion");e.all(".block").size()>0?(n++,r.addClass("used-region-"+t),r.removeClass("empty-region-"+t),r.removeClass("docked-region-"+t)):e.all(".block_dock_placeholder").size()>0&&(r.addClass("empty-region-"+t),r.addClass("docked-region-"+t),r.removeClass("used-region-"+t))}),e.all(".block-region").each(function(e){if(e.test(s.blockregion))return;var r=e.all(".block").size()>0;r&&n++,o=!1,t[e.get("id")]={hasblocks:r,bodyclass:e.get("id").replace(/^region\-/,"side-")+"-only"}}),r.hasClass("blocks-moving")&&(u=!0),n===0&&u===!1?r.addClass(i.contentonly):r.removeClass(i.contentonly);if(!o)if(n===0&&u===!1)for(a in t)t[a].bodyclass&&r.removeClass(t[a].bodyclass);else if(n===1&&u===!1)for(a in t)t[a].bodyclass&&(t[a].hasblocks?r.addClass(t[a].bodyclass):r.removeClass(t[a].bodyclass));else for(a in t)t[a].bodyclass&&r.removeClass(t[a].bodyclass)},add:function(e){e.set("id",this.totalcount),this.count++,this.totalcount++,this.dockeditems[e.get("id")]=e,this.dockeditems[e.get("id")].draw(),this.fire("dock:itemadded",e),this.fire("dock:itemschanged",e)},append:function(e){this.get("itemContainerNode").append(e)},handleReturnToBlock:function(e){e.halt(),this.remove(this.getActiveItem().get("id"))},remove:function(e){return this.dockeditems[e]?(this.dockeditems[e].remove(),delete this.dockeditems[e],this.count--,this.fire("dock:itemremoved",e),this.fire("dock:itemschanged",e),!0):!1},resetFirstItem:function(){this.get("dockNode").all("."+i.dockeditem+".firstdockitem").removeClass("firstdockitem"),this.get("dockNode").one("."+i.dockeditem)&&this.get("dockNode").one("."+i.dockeditem).addClass("firstdockitem")},removeAll:function(){var t;for(t in this.dockeditems)(e.Lang.isNumber(t)||e.Lang.isString(t))&&this.remove(t);return!0},hideActive:function(){var e=this.getActiveItem();e&&e.hide()},checkDockVisibility:function(){var e=i.body+"_"+this.get("position")+"_"+this.get("orientation");this.count?(this.fire("dock:beforeshow"),this.get("dockNode").removeClass("nothingdocked"),r.addClass(i.body).addClass(e),this.fire("dock:shown")):(this.get("dockNode").addClass("nothingdocked"),r.removeClass(i.body).removeClass(),this.fire("dock:hidden"))},resize:function(){var t=this.getPanel(),n=this.getActiveItem(),i,s,o,u,a,f,l,c,h,p;return!t.get("visible")||!n?!0:(this.fire("dock:panelresizestart"),this.get("orientation")==="vertical"&&(i=this.get("bufferPanel"),s=parseInt(r.get("winHeight"),10)-i*2,o=this.get("dockNode").getY(),u=n.get("dockTitleNode").getY()-o-i,a=this.get("itemContainerNode").getY(),f=a-o+this.get("buttonsNode").get("offsetHeight"),l=t.get("bodyNode").get("scrollTop"),t.get("bodyNode").setStyle("height","auto"),t.get("node").removeClass("oversized_content"),c=t.get("node").get("offsetHeight"),e.UA.ie>0&&e.UA.ie<7?t.setTop(n.get("dockTitleNode").getY()):c>s?(t.setTop(i-f),t.get("bodyNode").setStyle("height",s-t.get("headerNode").get("offsetHeight")+"px"),t.get("node" -).addClass("oversized_content")):c>s-(u-i)?t.setTop(u-f-(c-(s-u))+i):t.setTop(u-f+i),l&&t.get("bodyNode").set("scrollTop",l)),this.get("position")==="right"?t.get("node").setStyle("left","-"+t.get("node").get("offsetWidth")+"px"):this.get("position")==="top"&&(h=this.get("dockNode").getX(),p=n.get("dockTitleNode").getX()-h,t.get("node").setStyle("left",p+"px")),this.fire("dock:resizepanelcomplete"),!0)},getActiveItem:function(){var e;for(e in this.dockeditems)if(this.dockeditems[e].active)return this.dockeditems[e];return!1},addToHoldingArea:function(e){this.holdingareanode.append(e)}},e.extend(o,e.Base,o.prototype,{NAME:"moodle-core-dock",ATTRS:{dockNode:{writeOnce:!0},panel:{writeOnce:!0},buttonsNode:{writeOnce:!0},itemContainerNode:{writeOnce:!0},bufferPanel:{value:10,validator:e.Lang.isNumber},position:{value:"left",validator:e.Lang.isString},orientation:{value:"vertical",validator:e.Lang.isString,setter:function(e){return e.match(/^vertical$/i)?"vertical":"horizontal"}},bufferBeforeFirstItem:{value:10,validator:e.Lang.isNumber},undockAllIconUrl:{value:M.util.image_url(right_to_left()?"t/dock_to_block_rtl":"t/dock_to_block","moodle"),validator:e.Lang.isString}}}),e.augment(o,e.EventTarget),u=function(){u.superclass.constructor.apply(this,arguments)},u.prototype={created:!1,initializer:function(){this.publish("dockpanel:beforeshow",{prefix:"dockpanel"}),this.publish("dockpanel:shown",{prefix:"dockpanel"}),this.publish("dockpanel:beforehide",{prefix:"dockpanel"}),this.publish("dockpanel:hidden",{prefix:"dockpanel"}),this.publish("dockpanel:visiblechange",{prefix:"dockpanel"})},create:function(){if(this.created)return!0;this.created=!0;var t=this.get("dock"),n=t.get("dockNode");this.set("node",e.Node.create('
              ')),this.set("contentNode",e.Node.create('
              ')),this.set("headerNode",e.Node.create('
              ')),this.set("bodyNode",e.Node.create('
              ')),n.append(this.get("node").append(this.get("contentNode").append(this.get("headerNode")).append(this.get("bodyNode"))))},show:function(){this.create(),this.fire("dockpanel:beforeshow"),this.set("visible",!0),this.get("node").removeClass("dockitempanel_hidden"),this.fire("dockpanel:shown"),this.fire("dockpanel:visiblechange")},hide:function(){this.fire("dockpanel:beforehide"),this.set("visible",!1),this.get("node").addClass("dockitempanel_hidden"),this.fire("dockpanel:hidden"),this.fire("dockpanel:visiblechange")},setHeader:function(t){this.create();var n=this.get("headerNode"),r;n.setContent(t);if(arguments.length>1)for(r=1;r0&&e.UA.ie<7?this.get("node").setY(t):this.get("node").setStyle("top",t.toString()+"px")},correctWidth:function(){var e=this.get("bodyNode"),t=e.get("clientWidth"),n=e.get("scrollWidth"),r=e.get("offsetWidth"),i=t,s=Math.round(e.get("winWidth")*.8);n>t&&(i=t+(n-t)+(r-t)*2+10),i>s&&(i=s),i>r&&this.get("node").setStyle("width",i+"px")}},e.extend(u,e.Base,u.prototype,{NAME:"moodle-core-dock-panel",ATTRS:{dock:{writeOnce:"initOnly"},node:{value:null},contentNode:{value:null},headerNode:{value:null},bodyNode:{value:null},visible:{value:!1}}}),e.augment(u,e.EventTarget),a=function(){a.superclass.constructor.apply(this,arguments)},a.prototype={initializer:function(){var t=this.get("dock");t.on("dock:itemschanged",this.checkSizing,this),e.on("windowresize",this.checkSizing,this)},checkSizing:function(){var t=this.get("dock"),n=t.get("dockNode"),r=t.dockeditems,s=parseInt(n.one(".dockeditem_container").getStyle("marginTop").replace("/[^0-9]+$/",""),10),o=n.get("offsetHeight")-s,u=n.one(".controls").get("offsetHeight"),a=t.get("bufferPanel")*3,f=o-u-a-r.length*2,l=0,c,h;if(r.length>0){for(c in r)if(e.Lang.isNumber(c)||e.Lang.isString(c))h=e.one(r[c].get("title")).ancestor("."+i.dockedtitle),h&&(this.get("enabled")&&h.setStyle("height","auto"),l+=h.get("offsetHeight")||0);l>f&&this.enable(f)}},enable:function(t){var n=this.get("dock"),r=n.dockeditems,s=n.count,o=0,u=0,a,f,l,c;this.set("enabled",!0);for(a in r)if(e.Lang.isNumber(a)||e.Lang.isString(a)){f=e.one(r[a].get("title")).ancestor("."+i.dockedtitle);if(!f)continue;l=Math.floor((t-u)/(s-o)),c=f.get("offsetHeight"),f.setStyle("overflow","hidden"),c>l?(f.setStyle("height",l+"px"),u+=l):u+=c,o++}}},e.extend(a,e.Base,a.prototype,{NAME:"moodle-core-tabheightmanager",ATTRS:{dock:{writeOnce:"initOnly"},enabled:{value:!1}}}),e.Event.define("dock:actionkey",{_event:e.UA.webkit||e.UA.ie?"keydown":"keypress",_keys:{37:"collapse",39:"expand",32:"toggle",13:"enter"},_keyHandler:function(e,t,n){var r;n.actions?r=n.actions:r={collapse:!0,expand:!0,toggle:!0,enter:!0},this._keys[e.keyCode]&&r[this._keys[e.keyCode]]&&(e.action=this._keys[e.keyCode],t.fire(e))},on:function(e,t,n){t.args===null?t._detacher=e.on(this._event,this._keyHandler,this,n,{actions:!1}):t._detacher=e.on(this._event,this._keyHandler,this,n,t.args[0])},detach:function(e,t){t._detacher.detach()},delegate:function(e,t,n,r){t.args===null?t._delegateDetacher=e.delegate(this._event,this._keyHandler,r,this,n,{actions:!1}):t._delegateDetacher=e.delegate(this._event,this._keyHandler,r,this,n,t.args[0])},detachDelegate:function(e,t){t._delegateDetacher.detach()}}),f=function(){f.superclass.constructor.apply(this,arguments)},f.prototype={contentplaceholder:null,contentskipanchor:null,cachedcontentnode:null,skipsetposition:!0,dockitem:null,initializer:function(){var t=e.one("#inst"+this.get("id")),n;return t?(M.core.dock.ensureMoveToIconExists(t),t.hasClass(i.dockonload)&&(t.removeClass(i.dockonload),n=t.one(".header .title .commands"),n||(n=e.Node.create('
              '),t.one(".header .title")&&t.one(".header .title").append(n)),this.moveToDock(null,n)),this.skipsetposition=!1,!0 -):!1},_getBlockClass:function(t){var n=t.getData("block"),r,i;return e.Lang.isString(n)&&n!==""?n:(r=t.getAttribute("className").toString(),i=/(^| )block_([^ ]+)/.exec(r),i?i[2]:i)},moveToDock:function(t){t&&t.halt(!0);var n=M.core.dock.get(),r=this.get("id"),i=e.one("#inst"+r).one(".content"),s=right_to_left()?"t/dock_to_block_rtl":"t/dock_to_block",o=location.href.match(/\?/)?"&":"?",u,a,f,c;if(!i)return;this.recordBlockState(),u=this.cachedcontentnode.one(".title h2").cloneNode(!0),a=this.cachedcontentnode.one(".title .commands").cloneNode(!0),f=e.Node.create("").setAttrs({alt:e.Escape.html(M.util.get_string("undockitem","block")),title:e.Escape.html(M.util.get_string("undockblock","block",u.get("innerHTML"))),src:M.util.image_url(s,"moodle")}),c=e.Node.create('').setAttrs({href:e.config.win.location.href+o+"dock="+r}),c.append(f),a.append(c.append(f)),this.dockitem=new l({block:this,dock:n,blockinstanceid:r,title:u,contents:i,commands:a,blockclass:this._getBlockClass(e.one("#inst"+r))}),n.add(this.dockitem),this.skipsetposition||M.util.set_user_preference("docked_block_instance_"+r,1),this.set("isDocked",!0)},recordBlockState:function(){var t=this.get("id"),n=M.core.dock.get(),r=e.one("#inst"+t),i=r.previous();i.hasClass("skip-block")&&(this.contentskipanchor=i,this.contentskipanchor.hide()),this.cachedcontentnode=r,this.contentplaceholder=e.Node.create('
              '),r.replace(this.contentplaceholder),n.addToHoldingArea(r),r=null,this.cachedcontentnode.one(".title .commands")||this.cachedcontentnode.one(".title").append(e.Node.create('
              '))},returnToPage:function(){var t=this.get("id"),n;return this.contentskipanchor&&this.contentskipanchor.show(),this.cachedcontentnode.one(".header")?this.cachedcontentnode.one(".header").insert(this.dockitem.get("contents"),"after"):this.cachedcontentnode.insert(this.dockitem.get("contents")),this.contentplaceholder.replace(this.cachedcontentnode),this.cachedcontentnode=e.one("#"+this.cachedcontentnode.get("id")),n=this.dockitem.get("commands"),n&&(n.all(".hidepanelicon").remove(),n.all(".moveto").remove(),n.remove()),this.cachedcontentnode=null,M.util.set_user_preference("docked_block_instance_"+t,0),this.set("isDocked",!1),!0}},e.extend(f,e.Base,f.prototype,{NAME:"moodle-core-dock-block",ATTRS:{id:{writeOnce:"initOnly",setter:function(e){return parseInt(e,10)}},isDocked:{value:!1}}}),l=function(){l.superclass.constructor.apply(this,arguments)},l.prototype={active:!1,initializer:function(){var t=this.get("title"),n,r;this.publish("dockeditem:drawstart",{prefix:"dockeditem"}),this.publish("dockeditem:drawcomplete",{prefix:"dockeditem"}),this.publish("dockeditem:showstart",{prefix:"dockeditem"}),this.publish("dockeditem:showcomplete",{prefix:"dockeditem"}),this.publish("dockeditem:hidestart",{prefix:"dockeditem"}),this.publish("dockeditem:hidecomplete",{prefix:"dockeditem"}),this.publish("dockeditem:itemremoved",{prefix:"dockeditem"}),t&&(r=t.get("nodeName"),n=t.cloneNode(!0),t=e.Node.create("<"+r+">"),t=M.core.dock.fixTitleOrientation(t,n.get("text")),this.set("title",t),this.set("titlestring",n))},draw:function(){var t=e.Node.create,n=this.get("dock"),r=n.count,s,o,u,a,f=this.get("id");return this.fire("dockeditem:drawstart"),s=t(''),s.append(this.get("title")),o=t('
              '),r===1&&o.addClass("firstdockitem"),o.append(s),n.append(o),a=t(''+M.util.get_string('),a.setAttribute("src",M.util.image_url("t/dockclose","moodle")),u=t('').append(a),u.on("forceclose|click",this.hide,this),u.on("dock:actionkey",this.hide,this,{actions:{enter:!0,toggle:!0}}),this.get("commands").append(u),this.set("dockTitleNode",s),this.set("dockItemNode",o),this.fire("dockeditem:drawcomplete"),!0},show:function(){var t=this.get("dock"),n=t.getPanel(),r=this.get("dockTitleNode");return t.hideActive(),this.fire("dockeditem:showstart"),n.setHeader(this.get("titlestring"),this.get("commands")),n.setBody(e.Node.create('
              ').append(this.get("contents"))),M.core.actionmenu!==undefined&&M.core.actionmenu.newDOMNode(n.get("node")),n.show(),n.correctWidth(),this.active=!0,r.addClass(i.activeitem),r.set("aria-expanded","true"),this.fire("dockeditem:showcomplete"),t.resize(),!0},hide:function(){this.fire("dockeditem:hidestart"),this.active&&(this.active=!1,this.get("dock").getPanel().hide()),this.get("dockTitleNode").removeClass(i.activeitem).set("aria-expanded","false"),this.fire("dockeditem:hidecomplete")},toggle:function(e){var t=this.get("dockTitleNode");t.hasClass(i.activeitem)&&e!=="expand"?this.hide():!t.hasClass(i.activeitem)&&e!=="collapse"&&this.show()},remove:function(){this.hide(),this.get("block").returnToPage(),this.get("dockItemNode").remove(),this.fire("dockeditem:itemremoved")},_getLogDescription:function(){return this.get("titlestring").get("innerHTML")+" ("+this.get("blockinstanceid")+")"}},e.extend(l,e.Base,l.prototype,{NAME:"moodle-core-dock-dockeditem",ATTRS:{block:{writeOnce:"initOnly"},dock:{writeOnce:"initOnly"},id:{},blockinstanceid:{writeOnce:"initOnly",setter:function(e){return parseInt(e,10)}},title:{value:null},titlestring:{value:null},contents:{writeOnce:"initOnly"},commands:{writeOnce:"initOnly"},blockclass:{writeOnce:"initOnly"},dockTitleNode:{value:null},dockItemNode:{value:null},dockcontainerNode:{value:null}}}),e.augment(l,e.EventTarget)},"@VERSION@",{requires:["base","node","event-custom","event-mouseenter","event-resize","escape","moodle-core-dock-loader"]}); +YUI.add("moodle-core-dock",function(e,t){var n="moodle-core-dock",r=e.one(e.config.doc.body),i={dock:"dock",dockspacer:"dockspacer",controls:"controls",body:"has_dock",buttonscontainer:"buttons_container",dockeditem:"dockeditem",dockeditemcontainer:"dockeditem_container",dockedtitle:"dockedtitle",activeitem:"activeitem",contentonly:"content-only",dockonload:"dock_on_load"},s={dockableblock:".block[data-instanceid][data-dockable]",blockmoveto:".block[data-instanceid][data-dockable] .moveto",panelmoveto:"#dockeditempanel .commands a.moveto",dockonload:".block."+i.dockonload,blockregion:"[data-blockregion]"},o,u,a,f,l;M.core=M.core||{},M.core.dock=M.core.dock||{},M.core.dock._dock=null,M.core.dock._dockableblocks={},M.core.dock.init=function(){e.all(s.dockableblock).each(M.core.dock.registerDockableBlock),r.delegate("click",M.core.dock.dockBlock,s.blockmoveto),r.delegate("key",M.core.dock.dockBlock,s.blockmoveto,"enter")},M.core.dock.get=function(){return this._dock===null&&(this._dock=new o),this._dock},M.core.dock.registerDockableBlock=function(e){typeof e=="object"&&typeof e.getData=="function"&&(e=e.getData("instanceid")),M.core.dock._dockableblocks[e]=new f({id:e})},M.core.dock.dockBlock=function(e){typeof e=="object"&&e.target!=="undefined"&&(e=e.target);if(typeof e=="object"){e.test(s.dockableblock)||(e=e.ancestor(s.dockableblock));if(typeof e!="object"||typeof e.getData!="function"||!!e.ancestor("."+i.dock))return;e=e.getData("instanceid")}var t=M.core.dock._dockableblocks[e];t&&t.moveToDock()},M.core.dock.fixTitleOrientation=function(t,n){var i=M.core.dock.get(),s="11px",o="rotate(270deg)",u,a,f,l,c=M.util.get_string("thisdirectionvertical","langconfig");t=e.one(t);if(i.get("orientation")!=="vertical")return t.set("innerHTML",n),t;e.UA.ie>0&&e.UA.ie<8&&(c="ver");switch(c){case"ver":return t.set("innerHTML",n.split("").join("
              "));case"ttb":o="rotate(90deg)";break;case"btt":}return e.UA.ie===8?(t.set("innerHTML",n),t.setAttribute("style","writing-mode: tb-rl; filter: flipV flipH;display:inline;"),t.addClass("filterrotate"),t):(u=e.Node.create('

              '+n+"

              "),r.insert(u,0),a=u.one("span").get("offsetWidth")*1.2,f=u.one("span").get("offsetHeight"),u.remove(),t.set("innerHTML",n),t.addClass("css3transform"),t.setStyles({position:"relative",fontSize:s,width:a,top:(a-f)/2}),window.right_to_left()?t.setStyle("left",a/2-f):t.setStyle("right",a/2-f),t.setStyles({transform:o,"-ms-transform":o,"-moz-transform":o,"-webkit-transform":o,"-o-transform":o}),l=e.Node.create("
              "),l.append(t),l.setStyles({height:a+a/4,position:"relative"}),l)},M.core.dock.notifyBlockChange=function(e){if(this._dock!==null){var t=M.core.dock.get(),n=t.getActiveItem();n&&n.get("blockinstanceid")===parseInt(e,10)&&t.resizePanelIfRequired()}},o=function(){o.superclass.constructor.apply(this,arguments)},o.prototype={tabheightmanager:null,preventevent:null,delayedevent:null,dockeditems:[],dockdrawn:!1,count:0,totalcount:0,holdingareanode:null,initializer:function(){this.publish("dock:starting",{prefix:"dock",broadcast:2,emitFacade:!0,fireOnce:!0}),this.publish("dock:initialised",{prefix:"dock",broadcast:2,emitFacade:!0,fireOnce:!0}),this.publish("dock:beforedraw",{prefix:"dock",fireOnce:!0}),this.publish("dock:beforeshow",{prefix:"dock"}),this.publish("dock:shown",{prefix:"dock",broadcast:2}),this.publish("dock:hidden",{prefix:"dock",broadcast:2}),this.publish("dock:itemadded",{prefix:"dock"}),this.publish("dock:itemremoved",{prefix:"dock"}),this.publish("dock:itemschanged",{prefix:"dock",broadcast:2}),this.publish("dock:panelgenerated",{prefix:"dock",fireOnce:!0}),this.publish("dock:panelresizestart",{prefix:"dock"}),this.publish("dock:resizepanelcomplete",{prefix:"dock"}),this._applyThemeCustomisation(),this.fire("dock:starting"),this._ensureDockDrawn(),this.fire("dock:initialised")},_ensureDockDrawn:function(){if(this.dockdrawn===!0)return!0;var t=this._initialiseDockNode(),n={cssselector:"."+i.dockedtitle,delay:0},o={cssselector:"."+i.dockedtitle,delay:.5,iscontained:!0,preventevent:"click",preventdelay:3};return e.UA.ie>0&&e.UA.ie<7&&t.setStyle("height",t.get("winHeight")+"px"),this.fire("dock:beforedraw"),this._initialiseDockControls(),this.tabheightmanager=new a({dock:this}),e.delegate("click",this.handleEvent,this.get("dockNode"),"."+i.dockedtitle,this,n),e.delegate("mouseenter",this.handleEvent,this.get("dockNode"),"."+i.dockedtitle,this,o),this.get("dockNode").on("mouseleave",this.handleEvent,this,{cssselector:"#dock",delay:.5,iscontained:!1}),e.delegate("click",this.handleReturnToBlock,this.get("dockNode"),s.panelmoveto,this),e.delegate("click",this.handleReturnToBlock,this.get("dockNode"),s.panelmoveto,this),e.delegate("dock:actionkey",this.handleDockedItemEvent,this.get("dockNode"),"."+i.dockeditem,this),r.on("click",this.handleEvent,this,{cssselector:"body",delay:0}),this.on("dock:itemschanged",this.resizeBlockSpace,this),this.on("dock:itemschanged",this.checkDockVisibility,this),this.on("dock:itemschanged",this.resetFirstItem,this),this.dockdrawn=!0,!0},handleDockedItemEvent:function(e){if(e.type!=="dock:actionkey")return!1;var t=e.target,n="."+i.dockeditem;t.test(n)||(t=t.ancestor(n));if(!t)return!1;e.halt(),this.dockeditems[t.getAttribute("rel")].toggle(e.action)},_applyThemeCustomisation:function(){if(typeof customise_dock_for_theme=="function"){M.core_dock=this,M.core_dock.cfg={buffer:null,orientation:null,position:null,spacebeforefirstitem:null,removeallicon:null},M.core_dock.css={dock:null,dockspacer:null,controls:null,body:null,buttonscontainer:null,dockeditem:null,dockeditemcontainer:null,dockedtitle:null,activeitem:null};try{window.customise_dock_for_theme(this)}catch(t){}var n,r,s=!1,o={buffer:"bufferPanel",orientation:"orientation",position:"position",spacebeforefirstitem:"bufferBeforeFirstItem",removeallicon:"undockAllIconUrl"};for(n in M.core_dock.cfg)if(e.Lang.isString(n)&&o[n]){r=M.core_dock +.cfg[n];if(r===null)continue;s||(s=!0),this.set(o[n],r)}for(n in M.core_dock.css)if(e.Lang.isString(n)){r=M.core_dock.css[n];if(r===null)continue;s||(s=!0),i[n]=r}}},_initialiseDockNode:function(){var t=this.get("dockNode"),n=i.dock+"_"+this.get("position")+"_"+this.get("orientation"),o=e.Node.create("
              ").setStyles({display:"none"}),u=this.get("buttonsNode"),a=this.get("itemContainerNode");return t||(t=e.one("#"+i.dock)),t||(t=e.Node.create('
              '),r.append(t)),t.setAttribute("role","menubar").addClass(n),e.all(s.dockonload).size()===0?t.addClass("nothingdocked"):(n=i.body+"_"+this.get("position")+"_"+this.get("orientation"),r.addClass(i.body).addClass()),u||(u=t.one("."+i.buttonscontainer)),u||(u=e.Node.create('
              '),t.append(u)),a||(a=t.one("."+i.dockeditemcontainer)),a||(a=e.Node.create('
              '),u.append(a)),r.append(o),this.holdingareanode=o,this.set("dockNode",t),this.set("buttonsNode",u),this.set("itemContainerNode",a),t},_initialiseDockControls:function(){var t=e.Node.create(''+M.util.get_string(');t.setAttribute("src",this.get("undockAllIconUrl")),t.on("removeall|click",this.removeAll,this),t.on("dock:actionkey",this.removeAll,this,{actions:{enter:!0}}),this.get("buttonsNode").append(e.Node.create('
              ').append(t))},getPanel:function(){var t=this.get("panel");return t||(t=new u({dock:this}),t.on("panel:visiblechange",this.resize,this),e.on("windowresize",this.resize,this),this.set("panel",t),this.fire("dock:panelgenerated")),t},resizePanelIfRequired:function(){this.resize();var e=this.get("panel");e&&e.correctWidth()},handleEvent:function(e,t){var n=this.getActiveItem(),r,i,s=/^dock_item_(\d+)_title$/,o=this;if(t.cssselector==="body")this.get("dockNode").contains(e.target)||n&&n.hide();else{e.target.test(t.cssselector)?r=e.target:r=e.target.ancestor(t.cssselector);if(!r)return!0;if(this.preventevent!==null&&e.type===this.preventevent)return!0;t.preventevent&&(this.preventevent=t.preventevent,t.preventdelay&&setTimeout(function(){o.preventevent=null},t.preventdelay*1e3)),this.delayedevent&&this.delayedevent.timeout&&(clearTimeout(this.delayedevent.timeout),this.delayedevent.event.detach(),this.delayedevent=null);if(t.delay>0)return this.delayEvent(e,t,r);i=r.get("id"),i.match(s)?(n=this.dockeditems[i.replace(s,"$1")],n.active?n.hide():n.show()):n&&n.hide()}return!0},delayEvent:function(e,t,n){var i=this;return i.delayedevent=function(){return{target:n,event:r.on("mousemove",function(e){i.delayedevent.target=e.target}),timeout:null}}(i),i.delayedevent.timeout=setTimeout(function(){i.delayedevent.timeout=null,i.delayedevent.event.detach(),t.iscontained===i.get("dockNode").contains(i.delayedevent.target)&&i.handleEvent(e,{cssselector:t.cssselector,delay:0,iscontained:t.iscontained})},t.delay*1e3),!0},resizeBlockSpace:function(){if(e.all(s.dockonload).size()>0)return;var t=[],n=0,o=!0,u=!1,a;e.all(s.blockregion).each(function(e){var t=e.getData("blockregion");e.all(".block").size()>0?(n++,r.addClass("used-region-"+t),r.removeClass("empty-region-"+t),r.removeClass("docked-region-"+t)):e.all(".block_dock_placeholder").size()>0&&(r.addClass("empty-region-"+t),r.addClass("docked-region-"+t),r.removeClass("used-region-"+t))}),e.all(".block-region").each(function(e){if(e.test(s.blockregion))return;var r=e.all(".block").size()>0;r&&n++,o=!1,t[e.get("id")]={hasblocks:r,bodyclass:e.get("id").replace(/^region\-/,"side-")+"-only"}}),r.hasClass("blocks-moving")&&(u=!0),n===0&&u===!1?r.addClass(i.contentonly):r.removeClass(i.contentonly);if(!o)if(n===0&&u===!1)for(a in t)t[a].bodyclass&&r.removeClass(t[a].bodyclass);else if(n===1&&u===!1)for(a in t)t[a].bodyclass&&(t[a].hasblocks?r.addClass(t[a].bodyclass):r.removeClass(t[a].bodyclass));else for(a in t)t[a].bodyclass&&r.removeClass(t[a].bodyclass)},add:function(e){e.set("id",this.totalcount),this.count++,this.totalcount++,this.dockeditems[e.get("id")]=e,this.dockeditems[e.get("id")].draw(),this.fire("dock:itemadded",e),this.fire("dock:itemschanged",e)},append:function(e){this.get("itemContainerNode").append(e)},handleReturnToBlock:function(e){e.halt(),this.remove(this.getActiveItem().get("id"))},remove:function(e){return this.dockeditems[e]?(this.dockeditems[e].remove(),delete this.dockeditems[e],this.count--,this.fire("dock:itemremoved",e),this.fire("dock:itemschanged",e),!0):!1},resetFirstItem:function(){this.get("dockNode").all("."+i.dockeditem+".firstdockitem").removeClass("firstdockitem"),this.get("dockNode").one("."+i.dockeditem)&&this.get("dockNode").one("."+i.dockeditem).addClass("firstdockitem")},removeAll:function(){var t;for(t in this.dockeditems)(e.Lang.isNumber(t)||e.Lang.isString(t))&&this.remove(t);return!0},hideActive:function(){var e=this.getActiveItem();e&&e.hide()},checkDockVisibility:function(){var e=i.body+"_"+this.get("position")+"_"+this.get("orientation");this.count?(this.fire("dock:beforeshow"),this.get("dockNode").removeClass("nothingdocked"),r.addClass(i.body).addClass(e),this.fire("dock:shown")):(this.get("dockNode").addClass("nothingdocked"),r.removeClass(i.body).removeClass(),this.fire("dock:hidden"))},resize:function(){var t=this.getPanel(),n=this.getActiveItem(),i,s,o,u,a,f,l,c,h,p;return!t.get("visible")||!n?!0:(this.fire("dock:panelresizestart"),this.get("orientation")==="vertical"&&(i=this.get("bufferPanel"),s=parseInt(r.get("winHeight"),10)-i*2,o=this.get("dockNode").getY(),u=n.get("dockTitleNode").getY()-o-i,a=this.get("itemContainerNode").getY(),f=a-o+this.get("buttonsNode").get("offsetHeight"),l=t.get("bodyNode").get("scrollTop"),t.get("bodyNode").setStyle("height","auto"),t.get("node").removeClass("oversized_content"),c=t.get("node").get("offsetHeight"),e.UA.ie>0&&e.UA.ie<7?t.setTop(n.get("dockTitleNode").getY()):c>s?(t.setTop(i-f),t.get("bodyNode").setStyle("height",s-t.get("headerNode").get("offsetHeight")+"px"),t.get("node" +).addClass("oversized_content")):c>s-(u-i)?t.setTop(u-f-(c-(s-u))+i):t.setTop(u-f+i),l&&t.get("bodyNode").set("scrollTop",l)),this.get("position")==="right"?t.get("node").setStyle("left","-"+t.get("node").get("offsetWidth")+"px"):this.get("position")==="top"&&(h=this.get("dockNode").getX(),p=n.get("dockTitleNode").getX()-h,t.get("node").setStyle("left",p+"px")),this.fire("dock:resizepanelcomplete"),!0)},getActiveItem:function(){var e;for(e in this.dockeditems)if(this.dockeditems[e].active)return this.dockeditems[e];return!1},addToHoldingArea:function(e){this.holdingareanode.append(e)}},e.extend(o,e.Base,o.prototype,{NAME:"moodle-core-dock",ATTRS:{dockNode:{writeOnce:!0},panel:{writeOnce:!0},buttonsNode:{writeOnce:!0},itemContainerNode:{writeOnce:!0},bufferPanel:{value:10,validator:e.Lang.isNumber},position:{value:"left",validator:e.Lang.isString},orientation:{value:"vertical",validator:e.Lang.isString,setter:function(e){return e.match(/^vertical$/i)?"vertical":"horizontal"}},bufferBeforeFirstItem:{value:10,validator:e.Lang.isNumber},undockAllIconUrl:{value:M.util.image_url(window.right_to_left()?"t/dock_to_block_rtl":"t/dock_to_block","moodle"),validator:e.Lang.isString}}}),e.augment(o,e.EventTarget),u=function(){u.superclass.constructor.apply(this,arguments)},u.prototype={created:!1,initializer:function(){this.publish("dockpanel:beforeshow",{prefix:"dockpanel"}),this.publish("dockpanel:shown",{prefix:"dockpanel"}),this.publish("dockpanel:beforehide",{prefix:"dockpanel"}),this.publish("dockpanel:hidden",{prefix:"dockpanel"}),this.publish("dockpanel:visiblechange",{prefix:"dockpanel"})},create:function(){if(this.created)return!0;this.created=!0;var t=this.get("dock"),n=t.get("dockNode");this.set("node",e.Node.create('
              ')),this.set("contentNode",e.Node.create('
              ')),this.set("headerNode",e.Node.create('
              ')),this.set("bodyNode",e.Node.create('
              ')),n.append(this.get("node").append(this.get("contentNode").append(this.get("headerNode")).append(this.get("bodyNode"))))},show:function(){this.create(),this.fire("dockpanel:beforeshow"),this.set("visible",!0),this.get("node").removeClass("dockitempanel_hidden"),this.fire("dockpanel:shown"),this.fire("dockpanel:visiblechange")},hide:function(){this.fire("dockpanel:beforehide"),this.set("visible",!1),this.get("node").addClass("dockitempanel_hidden"),this.fire("dockpanel:hidden"),this.fire("dockpanel:visiblechange")},setHeader:function(t){this.create();var n=this.get("headerNode"),r;n.setContent(t);if(arguments.length>1)for(r=1;r0&&e.UA.ie<7?this.get("node").setY(t):this.get("node").setStyle("top",t.toString()+"px")},correctWidth:function(){var e=this.get("bodyNode"),t=e.get("clientWidth"),n=e.get("scrollWidth"),r=e.get("offsetWidth"),i=t,s=Math.round(e.get("winWidth")*.8);n>t&&(i=t+(n-t)+(r-t)*2+10),i>s&&(i=s),i>r&&this.get("node").setStyle("width",i+"px")}},e.extend(u,e.Base,u.prototype,{NAME:"moodle-core-dock-panel",ATTRS:{dock:{writeOnce:"initOnly"},node:{value:null},contentNode:{value:null},headerNode:{value:null},bodyNode:{value:null},visible:{value:!1}}}),e.augment(u,e.EventTarget),a=function(){a.superclass.constructor.apply(this,arguments)},a.prototype={initializer:function(){var t=this.get("dock");t.on("dock:itemschanged",this.checkSizing,this),e.on("windowresize",this.checkSizing,this)},checkSizing:function(){var t=this.get("dock"),n=t.get("dockNode"),r=t.dockeditems,s=parseInt(n.one(".dockeditem_container").getStyle("marginTop").replace("/[^0-9]+$/",""),10),o=n.get("offsetHeight")-s,u=n.one(".controls").get("offsetHeight"),a=t.get("bufferPanel")*3,f=o-u-a-r.length*2,l=0,c,h;if(r.length>0){for(c in r)if(e.Lang.isNumber(c)||e.Lang.isString(c))h=e.one(r[c].get("title")).ancestor("."+i.dockedtitle),h&&(this.get("enabled")&&h.setStyle("height","auto"),l+=h.get("offsetHeight")||0);l>f&&this.enable(f)}},enable:function(t){var n=this.get("dock"),r=n.dockeditems,s=n.count,o=0,u=0,a,f,l,c;this.set("enabled",!0);for(a in r)if(e.Lang.isNumber(a)||e.Lang.isString(a)){f=e.one(r[a].get("title")).ancestor("."+i.dockedtitle);if(!f)continue;l=Math.floor((t-u)/(s-o)),c=f.get("offsetHeight"),f.setStyle("overflow","hidden"),c>l?(f.setStyle("height",l+"px"),u+=l):u+=c,o++}}},e.extend(a,e.Base,a.prototype,{NAME:"moodle-core-tabheightmanager",ATTRS:{dock:{writeOnce:"initOnly"},enabled:{value:!1}}}),e.Event.define("dock:actionkey",{_event:e.UA.webkit||e.UA.ie?"keydown":"keypress",_keys:{37:"collapse",39:"expand",32:"toggle",13:"enter"},_keyHandler:function(e,t,n){var r;n.actions?r=n.actions:r={collapse:!0,expand:!0,toggle:!0,enter:!0},this._keys[e.keyCode]&&r[this._keys[e.keyCode]]&&(e.action=this._keys[e.keyCode],t.fire(e))},on:function(e,t,n){t.args===null?t._detacher=e.on(this._event,this._keyHandler,this,n,{actions:!1}):t._detacher=e.on(this._event,this._keyHandler,this,n,t.args[0])},detach:function(e,t){t._detacher.detach()},delegate:function(e,t,n,r){t.args===null?t._delegateDetacher=e.delegate(this._event,this._keyHandler,r,this,n,{actions:!1}):t._delegateDetacher=e.delegate(this._event,this._keyHandler,r,this,n,t.args[0])},detachDelegate:function(e,t){t._delegateDetacher.detach()}}),f=function(){f.superclass.constructor.apply(this,arguments)},f.prototype={contentplaceholder:null,contentskipanchor:null,cachedcontentnode:null,skipsetposition:!0,dockitem:null,initializer:function(){var t=e.one("#inst"+this.get("id")),n;return t?(M.core.dock.ensureMoveToIconExists(t),t.hasClass(i.dockonload)&&(t.removeClass(i.dockonload),n=t.one(".header .title .commands"),n||(n=e.Node.create('
              '),t.one(".header .title")&&t.one(".header .title").append(n)),this.moveToDock(null,n)),this.skipsetposition=!1 +,!0):!1},_getBlockClass:function(t){var n=t.getData("block"),r,i;return e.Lang.isString(n)&&n!==""?n:(r=t.getAttribute("className").toString(),i=/(^| )block_([^ ]+)/.exec(r),i?i[2]:i)},moveToDock:function(t){t&&t.halt(!0);var n=M.core.dock.get(),r=this.get("id"),i=e.one("#inst"+r).one(".content"),s=window.right_to_left()?"t/dock_to_block_rtl":"t/dock_to_block",o=location.href.match(/\?/)?"&":"?",u,a,f,c;if(!i)return;this.recordBlockState(),u=this.cachedcontentnode.one(".title h2").cloneNode(!0),a=this.cachedcontentnode.one(".title .commands").cloneNode(!0),f=e.Node.create("").setAttrs({alt:e.Escape.html(M.util.get_string("undockitem","block")),title:e.Escape.html(M.util.get_string("undockblock","block",u.get("innerHTML"))),src:M.util.image_url(s,"moodle")}),c=e.Node.create('').setAttrs({href:e.config.win.location.href+o+"dock="+r}),c.append(f),a.append(c.append(f)),this.dockitem=new l({block:this,dock:n,blockinstanceid:r,title:u,contents:i,commands:a,blockclass:this._getBlockClass(e.one("#inst"+r))}),n.add(this.dockitem),this.skipsetposition||M.util.set_user_preference("docked_block_instance_"+r,1),this.set("isDocked",!0)},recordBlockState:function(){var t=this.get("id"),n=M.core.dock.get(),r=e.one("#inst"+t),i=r.previous();i.hasClass("skip-block")&&(this.contentskipanchor=i,this.contentskipanchor.hide()),this.cachedcontentnode=r,this.contentplaceholder=e.Node.create('
              '),r.replace(this.contentplaceholder),n.addToHoldingArea(r),r=null,this.cachedcontentnode.one(".title .commands")||this.cachedcontentnode.one(".title").append(e.Node.create('
              '))},returnToPage:function(){var t=this.get("id"),n;return this.contentskipanchor&&this.contentskipanchor.show(),this.cachedcontentnode.one(".header")?this.cachedcontentnode.one(".header").insert(this.dockitem.get("contents"),"after"):this.cachedcontentnode.insert(this.dockitem.get("contents")),this.contentplaceholder.replace(this.cachedcontentnode),this.cachedcontentnode=e.one("#"+this.cachedcontentnode.get("id")),n=this.dockitem.get("commands"),n&&(n.all(".hidepanelicon").remove(),n.all(".moveto").remove(),n.remove()),this.cachedcontentnode=null,M.util.set_user_preference("docked_block_instance_"+t,0),this.set("isDocked",!1),!0}},e.extend(f,e.Base,f.prototype,{NAME:"moodle-core-dock-block",ATTRS:{id:{writeOnce:"initOnly",setter:function(e){return parseInt(e,10)}},isDocked:{value:!1}}}),l=function(){l.superclass.constructor.apply(this,arguments)},l.prototype={active:!1,initializer:function(){var t=this.get("title"),n,r;this.publish("dockeditem:drawstart",{prefix:"dockeditem"}),this.publish("dockeditem:drawcomplete",{prefix:"dockeditem"}),this.publish("dockeditem:showstart",{prefix:"dockeditem"}),this.publish("dockeditem:showcomplete",{prefix:"dockeditem"}),this.publish("dockeditem:hidestart",{prefix:"dockeditem"}),this.publish("dockeditem:hidecomplete",{prefix:"dockeditem"}),this.publish("dockeditem:itemremoved",{prefix:"dockeditem"}),t&&(r=t.get("nodeName"),n=t.cloneNode(!0),t=e.Node.create("<"+r+">"),t=M.core.dock.fixTitleOrientation(t,n.get("text")),this.set("title",t),this.set("titlestring",n))},draw:function(){var t=e.Node.create,n=this.get("dock"),r=n.count,s,o,u,a,f=this.get("id");return this.fire("dockeditem:drawstart"),s=t(''),s.append(this.get("title")),o=t('
              '),r===1&&o.addClass("firstdockitem"),o.append(s),n.append(o),a=t(''+M.util.get_string('),a.setAttribute("src",M.util.image_url("t/dockclose","moodle")),u=t('').append(a),u.on("forceclose|click",this.hide,this),u.on("dock:actionkey",this.hide,this,{actions:{enter:!0,toggle:!0}}),this.get("commands").append(u),this.set("dockTitleNode",s),this.set("dockItemNode",o),this.fire("dockeditem:drawcomplete"),!0},show:function(){var t=this.get("dock"),n=t.getPanel(),r=this.get("dockTitleNode");return t.hideActive(),this.fire("dockeditem:showstart"),n.setHeader(this.get("titlestring"),this.get("commands")),n.setBody(e.Node.create('
              ').append(this.get("contents"))),M.core.actionmenu!==undefined&&M.core.actionmenu.newDOMNode(n.get("node")),n.show(),n.correctWidth(),this.active=!0,r.addClass(i.activeitem),r.set("aria-expanded","true"),this.fire("dockeditem:showcomplete"),t.resize(),!0},hide:function(){this.fire("dockeditem:hidestart"),this.active&&(this.active=!1,this.get("dock").getPanel().hide()),this.get("dockTitleNode").removeClass(i.activeitem).set("aria-expanded","false"),this.fire("dockeditem:hidecomplete")},toggle:function(e){var t=this.get("dockTitleNode");t.hasClass(i.activeitem)&&e!=="expand"?this.hide():!t.hasClass(i.activeitem)&&e!=="collapse"&&this.show()},remove:function(){this.hide(),this.get("block").returnToPage(),this.get("dockItemNode").remove(),this.fire("dockeditem:itemremoved")},_getLogDescription:function(){return this.get("titlestring").get("innerHTML")+" ("+this.get("blockinstanceid")+")"}},e.extend(l,e.Base,l.prototype,{NAME:"moodle-core-dock-dockeditem",ATTRS:{block:{writeOnce:"initOnly"},dock:{writeOnce:"initOnly"},id:{},blockinstanceid:{writeOnce:"initOnly",setter:function(e){return parseInt(e,10)}},title:{value:null},titlestring:{value:null},contents:{writeOnce:"initOnly"},commands:{writeOnce:"initOnly"},blockclass:{writeOnce:"initOnly"},dockTitleNode:{value:null},dockItemNode:{value:null},dockcontainerNode:{value:null}}}),e.augment(l,e.EventTarget)},"@VERSION@",{requires:["base","node","event-custom","event-mouseenter","event-resize","escape","moodle-core-dock-loader"]}); diff --git a/lib/yui/build/moodle-core-dock/moodle-core-dock.js b/lib/yui/build/moodle-core-dock/moodle-core-dock.js index a84d61998bf..14357eb0418 100644 --- a/lib/yui/build/moodle-core-dock/moodle-core-dock.js +++ b/lib/yui/build/moodle-core-dock/moodle-core-dock.js @@ -178,7 +178,8 @@ M.core.dock.fixTitleOrientation = function(title, text) { } // We need to fix a font-size - sorry theme designers. - test = Y.Node.create('

              '+text+'

              '); + test = Y.Node.create('

              ' + text + '

              '); BODY.insert(test, 0); width = test.one('span').get('offsetWidth') * 1.2; height = test.one('span').get('offsetHeight'); @@ -196,7 +197,7 @@ M.core.dock.fixTitleOrientation = function(title, text) { }); // Positioning is different when in RTL mode. - if (right_to_left()) { + if (window.right_to_left()) { title.setStyle('left', width/2 - height); } else { title.setStyle('right', width/2 - height); @@ -488,7 +489,7 @@ DOCK.prototype = { }; try { // Run the customisation function - customise_dock_for_theme(this); + window.customise_dock_for_theme(this); } catch (exception) { // Do nothing at the moment. } @@ -1089,8 +1090,8 @@ Y.extend(DOCK, Y.Base, DOCK.prototype, { * @type String * @default t/dock_to_block */ - undockAllIconUrl : { - value : M.util.image_url((right_to_left()) ? 't/dock_to_block_rtl' : 't/dock_to_block', 'moodle'), + undockAllIconUrl: { + value : M.util.image_url((window.right_to_left()) ? 't/dock_to_block_rtl' : 't/dock_to_block', 'moodle'), validator : Y.Lang.isString } } @@ -1689,7 +1690,7 @@ BLOCK.prototype = { var dock = M.core.dock.get(), id = this.get('id'), blockcontent = Y.one('#inst'+id).one('.content'), - icon = (right_to_left()) ? 't/dock_to_block_rtl' : 't/dock_to_block', + icon = (window.right_to_left()) ? 't/dock_to_block_rtl' : 't/dock_to_block', breakchar = (location.href.match(/\?/)) ? '&' : '?', blocktitle, blockcommands, @@ -1929,7 +1930,8 @@ DOCKEDITEM.prototype = { dockitem.append(docktitle); dock.append(dockitem); - closeiconimg = create(''+M.util.get_string('hidepanel', 'block')+''); + closeiconimg = create('' + M.util.get_string('hidepanel', 'block') +
+                ''); closeiconimg.setAttribute('src', M.util.image_url('t/dockclose', 'moodle')); closeicon = create('').append(closeiconimg); closeicon.on('forceclose|click', this.hide, this); @@ -1955,7 +1957,8 @@ DOCKEDITEM.prototype = { dock.hideActive(); this.fire('dockeditem:showstart'); panel.setHeader(this.get('titlestring'), this.get('commands')); - panel.setBody(Y.Node.create('
              ').append(this.get('contents'))); + panel.setBody(Y.Node.create('
              ') + .append(this.get('contents'))); if (M.core.actionmenu !== undefined) { M.core.actionmenu.newDOMNode(panel.get('node')); } 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 d086ba00ca6..51adebc7248 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 @@ -377,8 +377,9 @@ Y.extend(DRAGDROP, Y.Base, { // Build the list of drop targets. var droplist = Y.Node.create('
                '); droplist.addClass('dragdrop-keyboard-drag'); - var listitem; - var listitemtext; + var listitem, + listlink, + listitemtext; // Search for possible drop targets. var droptargets = Y.all('.' + this.samenodeclass + ', .' + this.parentnodeclass); 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 559fab605b2..bb3367ac2db 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;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").setStyles({visibility:"",opacity:"1"}),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=e.all("."+this.samenodeclass+", ."+this.parentnodeclass);f.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 f=t.getAttribute("data-draggroups").split(" "),l,c;for(l=0;l"),listlink=e.Node.create(""),i=this.find_element_text(s),this.samenodelabel&&t.hasClass(this.samenodeclass)?a=M.util.get_string(this.samenodelabel.identifier,this.samenodelabel.component,i):this.parentnodelabel&&t.hasClass(this.parentnodeclass)?a=M.util.get_string(this.parentnodelabel.identifier,this.parentnodelabel.component,i):a=M.util.get_string("tocontent","moodle",i),listlink.setContent(a),listlink.setAttribute("data-drop-target",t.get("id")),listlink.setAttribute("tabindex","0"),listlink.on("click",this.global_keyboard_drop,this),listlink.on("key",this.global_keyboard_drop,"down:enter,32",this),u.append(listlink),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;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").setStyles({visibility:"",opacity:"1"}),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'); droplist.addClass('dragdrop-keyboard-drag'); - var listitem; - var listitemtext; + var listitem, + listlink, + listitemtext; // Search for possible drop targets. var droptargets = Y.all('.' + this.samenodeclass + ', .' + this.parentnodeclass); diff --git a/lib/yui/build/moodle-core-formchangechecker/moodle-core-formchangechecker-debug.js b/lib/yui/build/moodle-core-formchangechecker/moodle-core-formchangechecker-debug.js index 07db204da12..868751f1160 100644 --- a/lib/yui/build/moodle-core-formchangechecker/moodle-core-formchangechecker-debug.js +++ b/lib/yui/build/moodle-core-formchangechecker/moodle-core-formchangechecker-debug.js @@ -166,9 +166,9 @@ M.core_formchangechecker.get_form_dirty_state = function() { // Handle TinyMCE editor instances // We can't add a listener in the initializer as the editors may not have been created by that point // so we do so here instead - if (typeof tinyMCE !== 'undefined') { - for (editor in tinyMCE.editors) { - if (tinyMCE.editors[editor].isDirty()) { + if (typeof window.tinyMCE !== 'undefined') { + for (editor in window.tinyMCE.editors) { + if (window.tinyMCE.editors[editor].isDirty()) { return 1; } } diff --git a/lib/yui/build/moodle-core-formchangechecker/moodle-core-formchangechecker-min.js b/lib/yui/build/moodle-core-formchangechecker/moodle-core-formchangechecker-min.js index 30444d2d481..505dbe80d20 100644 --- a/lib/yui/build/moodle-core-formchangechecker/moodle-core-formchangechecker-min.js +++ b/lib/yui/build/moodle-core-formchangechecker/moodle-core-formchangechecker-min.js @@ -1 +1 @@ -YUI.add("moodle-core-formchangechecker",function(e,t){var n="core-formchangechecker",r=function(){r.superclass.constructor.apply(this,arguments)};e.extend(r,e.Base,{initialvaluelisteners:[],initializer:function(){var t="form#"+this.get("formid"),n=e.one(t);if(!n)return;n.delegate("change",M.core_formchangechecker.set_form_changed,"input",this),n.delegate("change",M.core_formchangechecker.set_form_changed,"textarea",this),n.delegate("change",M.core_formchangechecker.set_form_changed,"select",this),this.initialvaluelisteners.push(n.delegate("focus",this.store_initial_value,"input",this)),this.initialvaluelisteners.push(n.delegate("focus",this.store_initial_value,"textarea",this)),this.initialvaluelisteners.push(n.delegate("focus",this.store_initial_value,"select",this)),e.one(t).on("submit",M.core_formchangechecker.set_form_submitted,this),window.onbeforeunload=M.core_formchangechecker.report_form_dirty_state},store_initial_value:function(e){var t;if(e.target.hasClass("ignoredirty"))return;if(M.core_formchangechecker.get_form_dirty_state()){while(this.initialvaluelisteners.length)t=this.initialvaluelisteners.shift(),t.detach();return}M.core_formchangechecker.stateinformation.focused_element={element:e.target,initial_value:e.target.get("value")}}},{NAME:n,ATTRS:{formid:{value:""}}}),M.core_formchangechecker=M.core_formchangechecker||{},M.core_formchangechecker.instances=M.core_formchangechecker.instances||[],M.core_formchangechecker.init=function(e){var t=new r(e);return M.core_formchangechecker.instances.push(t),t},M.core_formchangechecker.stateinformation=[],M.core_formchangechecker.set_form_changed=function(e){if(e&&e.target&&e.target.hasClass("ignoredirty"))return;M.core_formchangechecker.stateinformation.formchanged=1,delete M.core_formchangechecker.stateinformation.focused_element},M.core_formchangechecker.set_form_submitted=function(){M.core_formchangechecker.stateinformation.formsubmitted=1},M.core_formchangechecker.get_form_dirty_state=function(){var e=M.core_formchangechecker.stateinformation,t;if(e.formsubmitted)return 0;if(e.formchanged)return 1;if(e.focused_element&&e.focused_element.element.get("value")!==e.focused_element.initial_value)return 1;if(typeof tinyMCE!="undefined")for(t in tinyMCE.editors)if(tinyMCE.editors[t].isDirty())return 1;return 0},M.core_formchangechecker.report_form_dirty_state=function(e){if(!M.core_formchangechecker.get_form_dirty_state())return;var t=M.util.get_string("changesmadereallygoaway","moodle");if(M.cfg.behatsiterunning)return;return e&&(e.returnValue=t),t}},"@VERSION@",{requires:["base","event-focus"]}); +YUI.add("moodle-core-formchangechecker",function(e,t){var n="core-formchangechecker",r=function(){r.superclass.constructor.apply(this,arguments)};e.extend(r,e.Base,{initialvaluelisteners:[],initializer:function(){var t="form#"+this.get("formid"),n=e.one(t);if(!n)return;n.delegate("change",M.core_formchangechecker.set_form_changed,"input",this),n.delegate("change",M.core_formchangechecker.set_form_changed,"textarea",this),n.delegate("change",M.core_formchangechecker.set_form_changed,"select",this),this.initialvaluelisteners.push(n.delegate("focus",this.store_initial_value,"input",this)),this.initialvaluelisteners.push(n.delegate("focus",this.store_initial_value,"textarea",this)),this.initialvaluelisteners.push(n.delegate("focus",this.store_initial_value,"select",this)),e.one(t).on("submit",M.core_formchangechecker.set_form_submitted,this),window.onbeforeunload=M.core_formchangechecker.report_form_dirty_state},store_initial_value:function(e){var t;if(e.target.hasClass("ignoredirty"))return;if(M.core_formchangechecker.get_form_dirty_state()){while(this.initialvaluelisteners.length)t=this.initialvaluelisteners.shift(),t.detach();return}M.core_formchangechecker.stateinformation.focused_element={element:e.target,initial_value:e.target.get("value")}}},{NAME:n,ATTRS:{formid:{value:""}}}),M.core_formchangechecker=M.core_formchangechecker||{},M.core_formchangechecker.instances=M.core_formchangechecker.instances||[],M.core_formchangechecker.init=function(e){var t=new r(e);return M.core_formchangechecker.instances.push(t),t},M.core_formchangechecker.stateinformation=[],M.core_formchangechecker.set_form_changed=function(e){if(e&&e.target&&e.target.hasClass("ignoredirty"))return;M.core_formchangechecker.stateinformation.formchanged=1,delete M.core_formchangechecker.stateinformation.focused_element},M.core_formchangechecker.set_form_submitted=function(){M.core_formchangechecker.stateinformation.formsubmitted=1},M.core_formchangechecker.get_form_dirty_state=function(){var e=M.core_formchangechecker.stateinformation,t;if(e.formsubmitted)return 0;if(e.formchanged)return 1;if(e.focused_element&&e.focused_element.element.get("value")!==e.focused_element.initial_value)return 1;if(typeof window.tinyMCE!="undefined")for(t in window.tinyMCE.editors)if(window.tinyMCE.editors[t].isDirty())return 1;return 0},M.core_formchangechecker.report_form_dirty_state=function(e){if(!M.core_formchangechecker.get_form_dirty_state())return;var t=M.util.get_string("changesmadereallygoaway","moodle");if(M.cfg.behatsiterunning)return;return e&&(e.returnValue=t),t}},"@VERSION@",{requires:["base","event-focus"]}); diff --git a/lib/yui/build/moodle-core-formchangechecker/moodle-core-formchangechecker.js b/lib/yui/build/moodle-core-formchangechecker/moodle-core-formchangechecker.js index 07db204da12..868751f1160 100644 --- a/lib/yui/build/moodle-core-formchangechecker/moodle-core-formchangechecker.js +++ b/lib/yui/build/moodle-core-formchangechecker/moodle-core-formchangechecker.js @@ -166,9 +166,9 @@ M.core_formchangechecker.get_form_dirty_state = function() { // Handle TinyMCE editor instances // We can't add a listener in the initializer as the editors may not have been created by that point // so we do so here instead - if (typeof tinyMCE !== 'undefined') { - for (editor in tinyMCE.editors) { - if (tinyMCE.editors[editor].isDirty()) { + if (typeof window.tinyMCE !== 'undefined') { + for (editor in window.tinyMCE.editors) { + if (window.tinyMCE.editors[editor].isDirty()) { return 1; } } 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 9c79b77db88..bebacc1d174 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 @@ -67,7 +67,8 @@ Y.extend(AJAXEXCEPTION, M.core.notification.info, { this.get('reproductionlink')+'
                    ')) .append(Y.Node.create('')) - .append(Y.Node.create('')) .append(Y.Node.create('')) - .append(Y.Node.create('