diff --git a/admin/tool/lp/amd/build/competencyactions.min.js b/admin/tool/lp/amd/build/competencyactions.min.js index 8c72e5df2e6..ec76bc65fdd 100644 --- a/admin/tool/lp/amd/build/competencyactions.min.js +++ b/admin/tool/lp/amd/build/competencyactions.min.js @@ -1 +1 @@ -define(["jquery","core/url","core/templates","core/notification","core/str","core/ajax","tool_lp/dragdrop-reorder","tool_lp/tree","tool_lp/dialogue","tool_lp/menubar","tool_lp/competencypicker","tool_lp/competency_outcomes","tool_lp/competencyruleconfig"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){var n,o,p,q,r,s,t=null,u=null,v=null,w=function(){var c=a('[data-region="competencyactions"]').data("competency"),d={competencyframeworkid:t.getCompetencyFrameworkId(),pagecontextid:n};null!==c&&(d.parentid=c.id);var e=a.param(d);window.location=b.relativeUrl("/admin/tool/lp/editcompetency.php?"+e)},x=function(){if("undefined"==typeof v&&(v=0),v!=u){var b=a('[data-region="filtercompetencies"]').data("frameworkid"),c=f.call([{methodname:"tool_lp_set_parent_competency",args:{competencyid:u,parentid:v}},{methodname:"tool_lp_data_for_competencies_manage_page",args:{competencyframeworkid:b,search:a('[data-region="filtercompetencies"] input').val()}}]);c[1].done(C).fail(d.exception)}},y=function(b){var c=new h("[data-enhance=movetree]",!1);c.on("selectionchanged",function(b,c){var d=c.selected.first();v=a(d).data("id")});var d=a(b.getContent());d.on("click",'[data-action="move"]',function(){b.close(),x()}),d.on("click",'[data-action="cancel"]',function(){b.close()})},z=function(a,b){var c;for(c=0;c"),h._frameworks=[],h._reset(),h._pageContextId=b,h._pageContextIncludes=d||"children",h._multiSelect="undefined"==typeof e||e===!0,c&&(h._frameworkId=c,h._singleFramework=!0)};return i.prototype._competencies=null,i.prototype._disallowedCompetencyIDs=null,i.prototype._eventNode=null,i.prototype._frameworks=null,i.prototype._frameworkId=null,i.prototype._pageContextId=null,i.prototype._pageContextIncludes=null,i.prototype._popup=null,i.prototype._searchText="",i.prototype._selectedCompetencies=null,i.prototype._singleFramework=!1,i.prototype._multiSelect=!0,i.prototype._afterRender=function(){var b=new g(h._find("[data-enhance=linktree]"),h._multiSelect);b.on("selectionchanged",function(b,c){var d=c.selected;b.preventDefault();var e=[];a.each(d,function(b,c){var d=a(c).data("id"),f=!0;a.each(h._disallowedCompetencyIDs,function(a,b){b==d&&(f=!1)}),f&&e.push(d)}),h._selectedCompetencies=e,h._selectedCompetencies.length?h._find('[data-region="competencylinktree"] [data-action="add"]').removeAttr("disabled"):h._find('[data-region="competencylinktree"] [data-action="add"]').attr("disabled","disabled")}),h._singleFramework||h._find('[data-action="chooseframework"]').change(function(b){h._frameworkId=a(b.target).val(),h._loadCompetencies().then(h._refresh)}),h._find('[data-region="filtercompetencies"] button').click(function(b){return b.preventDefault(),a(b.target).attr("disabled","disabled"),h._searchText=h._find('[data-region="filtercompetencies"] input').val()||"",h._refresh().always(function(){a(b.target).removeAttr("disabled")})}),h._find('[data-region="competencylinktree"] [data-action="cancel"]').click(function(a){a.preventDefault(),h.close()}),h._find('[data-region="competencylinktree"] [data-action="add"]').click(function(a){a.preventDefault(),h._selectedCompetencies.length&&(h._trigger("save",{competencyIds:h._selectedCompetencies}),h.close())});var c=h._selectedCompetencies.slice(0);a.each(c,function(a,c){var d=h._find("[data-id="+c+"]");d.length&&(b.toggleItem(d),b.updateFocus(d))})},i.prototype.close=function(){h._popup.close(),h._reset()},i.prototype.display=function(){return h._render().done(function(a){return f.get_string("competencypicker","tool_lp").done(function(b){h._popup=new e(b,a,h._afterRender.bind(h))})}).fail(b.exception)},i.prototype._fetchCompetencies=function(a,d){return c.call([{methodname:"tool_lp_search_competencies",args:{searchtext:d,competencyframeworkid:a}}])[0].done(function(a){function b(a,c){for(var d=0;d0?a.when():(d=h._singleFramework?c.call([{methodname:"tool_lp_read_competency_framework",args:{id:this._frameworkId}}])[0].then(function(a){return[a]}):c.call([{methodname:"tool_lp_list_competency_frameworks",args:{sort:"shortname",context:{contextid:h._pageContextId},includes:h._pageContextIncludes}}])[0],d.done(function(a){h._frameworks=a}).fail(b.exception))},i.prototype.on=function(a,b){h._eventNode.on(a,b)},i.prototype._preRender=function(){return h._loadFrameworks().then(function(){return!h._frameworkId&&h._frameworks.length>0&&(h._frameworkId=h._frameworks[0].id),h._frameworkId?h._loadCompetencies():(h._frameworks=[],a.when())})},i.prototype._refresh=function(){return h._render().then(function(a){h._find('[data-region="competencylinktree"]').replaceWith(a),h._afterRender()})},i.prototype._render=function(){return h._preRender().then(function(){h._singleFramework||a.each(h._frameworks,function(a,b){b.id==h._frameworkId?b.selected=!0:b.selected=!1});var b={competencies:h._competencies,framework:h._getFramework(h._frameworkId),frameworks:h._frameworks,search:h._searchText,singleFramework:h._singleFramework};return d.render("tool_lp/competency_picker",b)})},i.prototype._reset=function(){h._competencies=[],h._disallowedCompetencyIDs=[],h._popup=null,h._searchText="",h._selectedCompetencies=[]},i.prototype.setDisallowedCompetencyIDs=function(a){h._disallowedCompetencyIDs=a},i.prototype._trigger=function(a,b){h._eventNode.trigger(a,[b])},i}); \ No newline at end of file +define(["jquery","core/notification","core/ajax","core/templates","tool_lp/dialogue","core/str","tool_lp/tree"],function(a,b,c,d,e,f,g){var h,i=function(b,c,d,e){h=this,h._eventNode=a("
"),h._frameworks=[],h._reset(),h._pageContextId=b,h._pageContextIncludes=d||"children",h._multiSelect="undefined"==typeof e||e===!0,c&&(h._frameworkId=c,h._singleFramework=!0)};return i.prototype._competencies=null,i.prototype._disallowedCompetencyIDs=null,i.prototype._eventNode=null,i.prototype._frameworks=null,i.prototype._frameworkId=null,i.prototype._pageContextId=null,i.prototype._pageContextIncludes=null,i.prototype._popup=null,i.prototype._searchText="",i.prototype._selectedCompetencies=null,i.prototype._singleFramework=!1,i.prototype._multiSelect=!0,i.prototype._afterRender=function(){var b=new g(h._find("[data-enhance=linktree]"),h._multiSelect);h._find("[data-enhance=linktree]").show(),b.on("selectionchanged",function(b,c){var d=c.selected;b.preventDefault();var e=[];a.each(d,function(b,c){var d=a(c).data("id"),f=!0;"undefined"==typeof d?f=!1:a.each(h._disallowedCompetencyIDs,function(a,b){b==d&&(f=!1)}),f&&e.push(d)}),h._selectedCompetencies=e,h._selectedCompetencies.length?h._find('[data-region="competencylinktree"] [data-action="add"]').removeAttr("disabled"):h._find('[data-region="competencylinktree"] [data-action="add"]').attr("disabled","disabled")}),h._singleFramework||h._find('[data-action="chooseframework"]').change(function(b){h._frameworkId=a(b.target).val(),h._loadCompetencies().then(h._refresh)}),h._find('[data-region="filtercompetencies"] button').click(function(b){return b.preventDefault(),a(b.target).attr("disabled","disabled"),h._searchText=h._find('[data-region="filtercompetencies"] input').val()||"",h._refresh().always(function(){a(b.target).removeAttr("disabled")})}),h._find('[data-region="competencylinktree"] [data-action="cancel"]').click(function(a){a.preventDefault(),h.close()}),h._find('[data-region="competencylinktree"] [data-action="add"]').click(function(a){a.preventDefault(),h._selectedCompetencies.length&&(h._trigger("save",{competencyIds:h._selectedCompetencies}),h.close())});var c=h._selectedCompetencies.slice(0);a.each(c,function(a,c){var d=h._find("[data-id="+c+"]");d.length&&(b.toggleItem(d),b.updateFocus(d))})},i.prototype.close=function(){h._popup.close(),h._reset()},i.prototype.display=function(){return h._render().done(function(a){return f.get_string("competencypicker","tool_lp").done(function(b){h._popup=new e(b,a,h._afterRender.bind(h))})}).fail(b.exception)},i.prototype._fetchCompetencies=function(a,d){return c.call([{methodname:"tool_lp_search_competencies",args:{searchtext:d,competencyframeworkid:a}}])[0].done(function(a){function b(a,c){for(var d=0;d0?a.when():(d=h._singleFramework?c.call([{methodname:"tool_lp_read_competency_framework",args:{id:this._frameworkId}}])[0].then(function(a){return[a]}):c.call([{methodname:"tool_lp_list_competency_frameworks",args:{sort:"shortname",context:{contextid:h._pageContextId},includes:h._pageContextIncludes}}])[0],d.done(function(a){h._frameworks=a}).fail(b.exception))},i.prototype.on=function(a,b){h._eventNode.on(a,b)},i.prototype._preRender=function(){return h._loadFrameworks().then(function(){return!h._frameworkId&&h._frameworks.length>0&&(h._frameworkId=h._frameworks[0].id),h._frameworkId?h._loadCompetencies():(h._frameworks=[],a.when())})},i.prototype._refresh=function(){return h._render().then(function(a){h._find('[data-region="competencylinktree"]').replaceWith(a),h._afterRender()})},i.prototype._render=function(){return h._preRender().then(function(){h._singleFramework||a.each(h._frameworks,function(a,b){b.id==h._frameworkId?b.selected=!0:b.selected=!1});var b={competencies:h._competencies,framework:h._getFramework(h._frameworkId),frameworks:h._frameworks,search:h._searchText,singleFramework:h._singleFramework};return d.render("tool_lp/competency_picker",b)})},i.prototype._reset=function(){h._competencies=[],h._disallowedCompetencyIDs=[],h._popup=null,h._searchText="",h._selectedCompetencies=[]},i.prototype.setDisallowedCompetencyIDs=function(a){h._disallowedCompetencyIDs=a},i.prototype._trigger=function(a,b){h._eventNode.trigger(a,[b])},i}); \ No newline at end of file diff --git a/admin/tool/lp/amd/build/competencytree.min.js b/admin/tool/lp/amd/build/competencytree.min.js index 71a65bf6837..313fb76d70f 100644 --- a/admin/tool/lp/amd/build/competencytree.min.js +++ b/admin/tool/lp/amd/build/competencytree.min.js @@ -1 +1 @@ -define(["core/ajax","core/notification","core/templates","tool_lp/tree","jquery"],function(a,b,c,d,e){var f={},g=0,h="",i="",j="",k=function(a,b){var c=0,d=!1;for(a.haschildren=!1,a.children=[],c=0;c0},reloadCompetencies:function(){return l("").fail(b.exception)},listCompetencies:function(){return f}}}); \ No newline at end of file +define(["core/ajax","core/notification","core/templates","tool_lp/tree","jquery"],function(a,b,c,d,e){var f={},g=0,h="",i="",j="",k=function(a,b){var c=0,d=!1;for(a.haschildren=!1,a.children=[],c=0;c0},reloadCompetencies:function(){return l("").fail(b.exception)},listCompetencies:function(){return f}}}); \ No newline at end of file diff --git a/admin/tool/lp/amd/build/tree.min.js b/admin/tool/lp/amd/build/tree.min.js index 696ae41263d..caa88f9843b 100644 --- a/admin/tool/lp/amd/build/tree.min.js +++ b/admin/tool/lp/amd/build/tree.min.js @@ -1 +1 @@ -define(["jquery","core/url","core/log"],function(a,b,c){var d=a(''),e=a(''),f=function(b,c){this.treeRoot=a(b),this.multiSelect="undefined"==typeof c||c===!0,this.items=this.treeRoot.find("li"),this.expandAll=this.items.length<20,this.parents=this.treeRoot.find("li:has(ul)"),c&&this.treeRoot.attr("aria-multiselectable","true"),this.items.attr("aria-selected","false"),this.visibleItems=null,this.activeItem=null,this.lastActiveItem=null,this.keys={tab:9,enter:13,space:32,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40,asterisk:106},this.init(),this.bindEventHandlers()};return f.prototype.init=function(){this.parents.attr("aria-expanded","true"),this.parents.prepend(d.clone()),this.items.attr("role","tree-item"),this.items.attr("tabindex","-1"),this.parents.attr("role","group"),this.treeRoot.attr("role","tree"),this.visibleItems=this.treeRoot.find("li");var b=this;this.expandAll||(this.parents.each(function(){b.collapseGroup(a(this))}),this.expandGroup(this.parents.first()))},f.prototype.expandGroup=function(a){var b=a.children("ul");b.show().attr("aria-hidden","false"),a.attr("aria-expanded","true"),a.children("img").attr("src",d.attr("src")),this.visibleItems=this.treeRoot.find("li:visible")},f.prototype.collapseGroup=function(a){var b=a.children("ul");b.hide().attr("aria-hidden","true"),a.attr("aria-expanded","false"),a.children("img").attr("src",e.attr("src")),this.visibleItems=this.treeRoot.find("li:visible")},f.prototype.toggleGroup=function(a){"true"==a.attr("aria-expanded")?this.collapseGroup(a):this.expandGroup(a)},f.prototype.triggerChange=function(){var a=this.items.filter("[aria-selected=true]");this.treeRoot.trigger("selectionchanged",{selected:a})},f.prototype.multiSelectItem=function(b){if(this.multiSelect){if(null!==this.lastActiveItem){for(var c=this.visibleItems.index(this.lastActiveItem),d=this.visibleItems.index(this.activeItem),e=null;d>c;)e=a(this.visibleItems.get(c)),e.attr("aria-selected","true"),c++;for(;c>d;)e=a(this.visibleItems.get(c)),e.attr("aria-selected","true"),c--}}else this.items.attr("aria-selected","false");b.attr("aria-selected","true"),this.triggerChange()},f.prototype.selectItem=function(a){for(var b=a.parent();"tree"!=b.attr("role");)b=b.parent(),"false"==b.attr("aria-expanded")&&this.expandGroup(b),b=b.parent();this.items.attr("aria-selected","false"),a.attr("aria-selected","true"),this.triggerChange()},f.prototype.toggleItem=function(a){if(!this.multiSelect)return this.selectItem(a);var b=a.attr("aria-selected");b="true"===b?"false":"true",a.attr("aria-selected",b),this.triggerChange()},f.prototype.updateFocus=function(a){this.lastActiveItem=this.activeItem,this.activeItem=a;for(var b=a.parent();"tree"!=b.attr("role");)b=b.parent(),"false"==b.attr("aria-expanded")&&this.expandGroup(b),b=b.parent();this.items.attr("tabindex","-1"),a.attr("tabindex",0)},f.prototype.handleKeyDown=function(b,c){var d=this.visibleItems.index(b),e=null;switch(c.keyCode){case this.keys.home:return e=this.parents.first(),e.focus(),c.shiftKey?this.multiSelectItem(e):c.ctrlKey||this.selectItem(e),c.stopPropagation(),!1;case this.keys.end:return e=this.visibleItems.last(),e.focus(),c.shiftKey?this.multiSelectItem(e):c.ctrlKey||this.selectItem(e),c.stopPropagation(),!1;case this.keys.enter:case this.keys.space:return c.shiftKey?this.multiSelectItem(b):c.ctrlKey?this.toggleItem(b):this.selectItem(b),c.stopPropagation(),!1;case this.keys.left:if(b.has("ul")&&"true"==b.attr("aria-expanded"))this.collapseGroup(b);else{var f=b.parent(),g=f.parent();g.focus(),c.shiftKey?this.multiSelectItem(g):c.ctrlKey||this.selectItem(g)}return c.stopPropagation(),!1;case this.keys.right:return b.has("ul")&&"false"==b.attr("aria-expanded")?this.expandGroup(b):(e=b.children("ul").children("li").first(),e.focus(),c.shiftKey?this.multiSelectItem(e):c.ctrlKey||this.selectItem(e)),c.stopPropagation(),!1;case this.keys.up:if(d>0){var h=this.visibleItems.eq(d-1);h.focus(),c.shiftKey?this.multiSelectItem(h):c.ctrlKey||this.selectItem(h)}return c.stopPropagation(),!1;case this.keys.down:if(d'),e=a(''),f=function(b,c){this.treeRoot=a(b),this.multiSelect="undefined"==typeof c||c===!0,this.items=this.treeRoot.find("li"),this.expandAll=this.items.length<20,this.parents=this.treeRoot.find("li:has(ul)"),c&&this.treeRoot.attr("aria-multiselectable","true"),this.items.attr("aria-selected","false"),this.visibleItems=null,this.activeItem=null,this.lastActiveItem=null,this.keys={tab:9,enter:13,space:32,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40,asterisk:106},this.init(),this.bindEventHandlers()};return f.prototype.init=function(){this.parents.attr("aria-expanded","true"),this.parents.prepend(d.clone()),this.items.attr("role","tree-item"),this.items.attr("tabindex","-1"),this.parents.attr("role","group"),this.treeRoot.attr("role","tree"),this.visibleItems=this.treeRoot.find("li");var b=this;this.expandAll||(this.parents.each(function(){b.collapseGroup(a(this))}),this.expandGroup(this.parents.first()))},f.prototype.expandGroup=function(a){var b=a.children("ul");b.show().attr("aria-hidden","false"),a.attr("aria-expanded","true"),a.children("img").attr("src",d.attr("src")),this.visibleItems=this.treeRoot.find("li:visible")},f.prototype.collapseGroup=function(a){var b=a.children("ul");b.hide().attr("aria-hidden","true"),a.attr("aria-expanded","false"),a.children("img").attr("src",e.attr("src")),this.visibleItems=this.treeRoot.find("li:visible")},f.prototype.toggleGroup=function(a){"true"==a.attr("aria-expanded")?this.collapseGroup(a):this.expandGroup(a)},f.prototype.triggerChange=function(){var a=this.items.filter("[aria-selected=true]");this.multiSelect||(a=a.first()),this.treeRoot.trigger("selectionchanged",{selected:a})},f.prototype.multiSelectItem=function(b){if(this.multiSelect){if(null!==this.lastActiveItem){for(var c=this.visibleItems.index(this.lastActiveItem),d=this.visibleItems.index(this.activeItem),e=null;d>c;)e=a(this.visibleItems.get(c)),e.attr("aria-selected","true"),c++;for(;c>d;)e=a(this.visibleItems.get(c)),e.attr("aria-selected","true"),c--}}else this.items.attr("aria-selected","false");b.attr("aria-selected","true"),this.triggerChange()},f.prototype.selectItem=function(a){for(var b=a.parent();"tree"!=b.attr("role");)b=b.parent(),"false"==b.attr("aria-expanded")&&this.expandGroup(b),b=b.parent();this.items.attr("aria-selected","false"),a.attr("aria-selected","true"),this.triggerChange()},f.prototype.toggleItem=function(a){if(!this.multiSelect)return this.selectItem(a);var b=a.attr("aria-selected");b="true"===b?"false":"true",a.attr("aria-selected",b),this.triggerChange()},f.prototype.updateFocus=function(a){this.lastActiveItem=this.activeItem,this.activeItem=a;for(var b=a.parent();"tree"!=b.attr("role");)b=b.parent(),"false"==b.attr("aria-expanded")&&this.expandGroup(b),b=b.parent();this.items.attr("tabindex","-1"),a.attr("tabindex",0)},f.prototype.handleKeyDown=function(b,c){var d=this.visibleItems.index(b),e=null;switch(c.keyCode){case this.keys.home:return e=this.parents.first(),e.focus(),c.shiftKey?this.multiSelectItem(e):c.ctrlKey||this.selectItem(e),c.stopPropagation(),!1;case this.keys.end:return e=this.visibleItems.last(),e.focus(),c.shiftKey?this.multiSelectItem(e):c.ctrlKey||this.selectItem(e),c.stopPropagation(),!1;case this.keys.enter:case this.keys.space:return c.shiftKey?this.multiSelectItem(b):c.ctrlKey?this.toggleItem(b):this.selectItem(b),c.stopPropagation(),!1;case this.keys.left:if(b.has("ul")&&"true"==b.attr("aria-expanded"))this.collapseGroup(b);else{var f=b.parent(),g=f.parent();g.focus(),c.shiftKey?this.multiSelectItem(g):c.ctrlKey||this.selectItem(g)}return c.stopPropagation(),!1;case this.keys.right:return b.has("ul")&&"false"==b.attr("aria-expanded")?this.expandGroup(b):(e=b.children("ul").children("li").first(),e.focus(),c.shiftKey?this.multiSelectItem(e):c.ctrlKey||this.selectItem(e)),c.stopPropagation(),!1;case this.keys.up:if(d>0){var h=this.visibleItems.eq(d-1);h.focus(),c.shiftKey?this.multiSelectItem(h):c.ctrlKey||this.selectItem(h)}return c.stopPropagation(),!1;case this.keys.down:if(d -
    +
    • {{framework.shortname}}
        {{#competencies}} diff --git a/admin/tool/lp/templates/competency_picker.mustache b/admin/tool/lp/templates/competency_picker.mustache index 05f6b06867c..fcb4464c0c2 100644 --- a/admin/tool/lp/templates/competency_picker.mustache +++ b/admin/tool/lp/templates/competency_picker.mustache @@ -14,7 +14,7 @@ -
          +
          • {{framework.shortname}}
              {{#competencies}}