芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/public_html/cepali/admin/tool/lp/amd/build/competencypicker.min.js
define(["jquery","core/notification","core/ajax","core/templates","tool_lp/dialogue","core/str","tool_lp/tree","core/pending"],function(a,b,c,d,e,f,g,h){var i=function(b,c,d,e){var f=this;f._eventNode=a("
"),f._frameworks=[],f._reset(),f._pageContextId=b,f._pageContextIncludes=d||"children",f._multiSelect="undefined"==typeof e||e===!0,c&&(f._frameworkId=c,f._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._onlyVisible=!0,i.prototype._afterRender=function(){var c=this,d=new g(c._find("[data-enhance=linktree]"),c._multiSelect);c._find("[data-enhance=linktree]").show(),d.on("selectionchanged",function(b,d){var e=d.selected;b.preventDefault();var f=[];a.each(e,function(b,d){var e=a(d).data("id"),g=!0;"undefined"==typeof e?g=!1:a.each(c._disallowedCompetencyIDs,function(a,b){b==e&&(g=!1)}),g&&f.push(e)}),c._selectedCompetencies=f,c._selectedCompetencies.length?c._find('[data-region="competencylinktree"] [data-action="add"]').removeAttr("disabled"):c._find('[data-region="competencylinktree"] [data-action="add"]').attr("disabled","disabled")}),c._singleFramework||c._find('[data-action="chooseframework"]').change(function(d){c._frameworkId=a(d.target).val(),c._loadCompetencies().then(c._refresh.bind(c))["catch"](b.exception)}),c._find('[data-region="filtercompetencies"] button').click(function(b){return b.preventDefault(),a(b.target).attr("disabled","disabled"),c._searchText=c._find('[data-region="filtercompetencies"] input').val()||"",c._refresh().always(function(){a(b.target).removeAttr("disabled")})}),c._find('[data-region="competencylinktree"] [data-action="cancel"]').click(function(a){a.preventDefault(),c.close()}),c._find('[data-region="competencylinktree"] [data-action="add"]').click(function(a){a.preventDefault();var b=new h;c._selectedCompetencies.length&&(c._multiSelect?c._trigger("save",{competencyIds:c._selectedCompetencies}):c._trigger("save",{competencyId:c._selectedCompetencies[0]}),c.close(),b.resolve())});var e=c._selectedCompetencies.slice(0);a.each(e,function(a,b){var e=c._find("[data-id="+b+"]");e.length&&(d.toggleItem(e),d.updateFocus(e))})},i.prototype.close=function(){var a=this;a._popup.close(),a._reset()},i.prototype.display=function(){var c=this;return a.when(f.get_string("competencypicker","tool_lp"),c._render()).then(function(a,b){c._popup=new e(a,b[0],c._afterRender.bind(c))})["catch"](b.exception)},i.prototype._fetchCompetencies=function(a,d){var e=this;return c.call([{methodname:"core_competency_search_competencies",args:{searchtext:d,competencyframeworkid:a}}])[0].done(function(a){function b(a,c){for(var d=0;d
0?a.when():(d=e._singleFramework?c.call([{methodname:"core_competency_read_competency_framework",args:{id:this._frameworkId}}])[0].then(function(a){return[a]}):c.call([{methodname:"core_competency_list_competency_frameworks",args:{sort:"shortname",context:{contextid:e._pageContextId},includes:e._pageContextIncludes,onlyvisible:e._onlyVisible}}])[0],d.done(function(a){e._frameworks=a}).fail(b.exception))},i.prototype.on=function(a,b){this._eventNode.on(a,b)},i.prototype._preRender=function(){var b=this;return b._loadFrameworks().then(function(){return!b._frameworkId&&b._frameworks.length>0&&(b._frameworkId=b._frameworks[0].id),b._frameworkId?b._loadCompetencies():(b._frameworks=[],a.when())})},i.prototype._refresh=function(){var a=this;return a._render().then(function(b){a._find('[data-region="competencylinktree"]').replaceWith(b),a._afterRender()})},i.prototype._render=function(){var b=this;return b._preRender().then(function(){b._singleFramework||a.each(b._frameworks,function(a,c){c.id==b._frameworkId?c.selected=!0:c.selected=!1});var c={competencies:b._competencies,framework:b._getFramework(b._frameworkId),frameworks:b._frameworks,search:b._searchText,singleFramework:b._singleFramework};return d.render("tool_lp/competency_picker",c)})},i.prototype._reset=function(){this._competencies=[],this._disallowedCompetencyIDs=[],this._popup=null,this._searchText="",this._selectedCompetencies=[]},i.prototype.setDisallowedCompetencyIDs=function(a){this._disallowedCompetencyIDs=a},i.prototype._trigger=function(a,b){this._eventNode.trigger(a,[b])},i});