Your IP : 192.168.165.1


Current Path : C:/xampp/htdocs/moodle/mod/assign/amd/build/
Upload File :
Current File : C:/xampp/htdocs/moodle/mod/assign/amd/build/grading_navigation.min.js

define ("mod_assign/grading_navigation",["jquery","core/notification","core/str","core/form-autocomplete","core/ajax","mod_assign/grading_form_change_checker"],function(a,b,c,d,e,f){var g=function(e){this._regionSelector=e;this._region=a(e);this._filters=[];this._users=[];this._filteredUsers=[];this._lastXofYUpdate=0;this._firstLoadUsers=!0;this._loadAllUsers();this._region.find("[data-action=\"previous-user\"]").on("click",this._handlePreviousUser.bind(this));this._region.find("[data-action=\"next-user\"]").on("click",this._handleNextUser.bind(this));this._region.find("[data-action=\"change-user\"]").on("change",this._handleChangeUser.bind(this));this._region.find("[data-region=\"user-filters\"]").on("click",this._toggleExpandFilters.bind(this));a(document).on("user-changed",this._refreshSelector.bind(this));a(document).on("done-saving-show-next",this._handleNextUser.bind(this));var f=this._region.find("[data-region=\"user-filters\"]"),g=a(document.getElementById(f.attr("aria-controls")));g.on("change","select",this._filterChanged.bind(this));var h=a("[data-region=\"grading-navigation-panel\"]").data("first-userid");if(h){this._selectUserById(h)}c.get_string("changeuser","mod_assign").done(function(a){d.enhance("[data-action=change-user]",!1,"mod_assign/participant_selector",a)}).fail(b.exception);a(document).bind("start-loading-user",function(){this._isLoading=!0}.bind(this));a(document).bind("finish-loading-user",function(){this._isLoading=!1}.bind(this))};g.prototype._isLoading=!1;g.prototype._regionSelector=null;g.prototype._filters=null;g.prototype._users=null;g.prototype._region=null;g.prototype._lastFilters="";g.prototype._loadAllUsers=function(){var a=this._region.find("[data-action=change-user]"),c=a.attr("data-assignmentid"),d=a.attr("data-groupid"),f=this._region.find("[data-region=\"configure-filters\"]"),g=f.find("select[name=\"filter\"]").val(),h=f.find("select[name=\"workflowfilter\"]");if(h){g+=","+h.val()}var i=f.find("select[name=\"markerfilter\"]");if(i){g+=","+i.val()}if(this._lastFilters==g){return!1}this._lastFilters=g;e.call([{methodname:"mod_assign_list_participants",args:{assignid:c,groupid:d,filter:"",onlyids:!0,tablesort:!0},done:this._usersLoaded.bind(this),fail:b.exception}]);return!0};g.prototype._usersLoaded=function(b){this._firstLoadUsers=!1;this._filteredUsers=this._users=b;if(this._users.length){var c=this._region.find("[data-region=\"user-filters\"]"),d=a(document.getElementById(c.attr("aria-controls")));d.find("select[name=\"filter\"]").trigger("change")}else{this._selectNoUser()}this._triggerNextUserEvent()};g.prototype._checkClickOutsideConfigureFilters=function(b){var c=this._region.find("[data-region=\"configure-filters\"]");if(!c.is(b.target)&&0===c.has(b.target).length){var d=this._region.find("[data-region=\"user-filters\"]");c.hide();c.attr("aria-hidden","true");d.attr("aria-expanded","false");a(document).unbind("click.mod_assign_grading_navigation")}};g.prototype._updateFilterPreferences=function(b,c,d){var f=[],g=0;if(0==c.length||this._firstLoadUsers){var h=a.Deferred();h.resolve();return h}for(g=0;g<c.length;g++){var j=c[g];if("none"==j){j=""}f.push({userid:b,name:d[g],value:j})}return e.call([{methodname:"core_user_set_user_preferences",args:{preferences:f}}])[0]};g.prototype._filterChanged=function(){var d=this._region.find("[data-region=\"configure-filters\"]"),e=d.find("select"),f=[];this._filters=[];e.each(function(b,c){var d=a(c);this._filters.push(d.val());f.push("assign_"+d.prop("name"))}.bind(this));var g=[];d.find("option:checked").each(function(b,c){g[g.length]=a(c).text()});if(g.length){this._region.find("[data-region=\"user-filters\"] span").text(g.join(", "))}else{c.get_string("nofilters","mod_assign").done(function(a){this._region.find("[data-region=\"user-filters\"] span").text(a)}.bind(this)).fail(b.exception)}var h=this._region.find("[data-action=change-user]"),i=h.data("currentuserid");this._updateFilterPreferences(i,this._filters,f).done(function(){if(!this._loadAllUsers()){var b=parseInt(h.attr("data-selected")),c=0;a.each(this._filteredUsers,function(a,d){if(b==d.id){c=a}});if(this._filteredUsers.length){this._selectUserById(this._filteredUsers[c].id)}else{this._selectNoUser()}}}.bind(this)).fail(b.exception);this._refreshCount()};g.prototype._selectNoUser=function(){if(this._isLoading){return}if(f.checkFormForChanges("[data-region=\"grade-panel\"] .gradeform")){c.get_strings([{key:"unsavedchanges",component:"mod_assign"},{key:"unsavedchangesquestion",component:"mod_assign"},{key:"saveandcontinue",component:"mod_assign"},{key:"cancel",component:"core"}]).done(function(c){b.confirm(c[0],c[1],c[2],c[3],function(){a(document).trigger("save-changes",-1)})})}else{a(document).trigger("user-changed",-1)}};g.prototype._selectUserById=function(d){var e=this._region.find("[data-action=change-user]"),g=parseInt(d,10);if(this._isLoading){return}if(f.checkFormForChanges("[data-region=\"grade-panel\"] .gradeform")){c.get_strings([{key:"unsavedchanges",component:"mod_assign"},{key:"unsavedchangesquestion",component:"mod_assign"},{key:"saveandcontinue",component:"mod_assign"},{key:"cancel",component:"core"}]).done(function(c){b.confirm(c[0],c[1],c[2],c[3],function(){a(document).trigger("save-changes",g)})})}else{e.attr("data-selected",d);if(!isNaN(g)&&0<g){a(document).trigger("user-changed",d)}}};g.prototype._toggleExpandFilters=function(b){b.preventDefault();var c=a(b.target).closest("[data-region=\"user-filters\"]"),d="true"==c.attr("aria-expanded"),e=a(document.getElementById(c.attr("aria-controls")));if(d){e.hide();e.attr("aria-hidden","true");c.attr("aria-expanded","false");a(document).unbind("click.mod_assign_grading_navigation")}else{e.css("display","inline-block");e.attr("aria-hidden","false");c.attr("aria-expanded","true");b.stopPropagation();a(document).on("click.mod_assign_grading_navigation",this._checkClickOutsideConfigureFilters.bind(this))}};g.prototype._handlePreviousUser=function(a){a.preventDefault();var b=this._region.find("[data-action=change-user]"),c=b.attr("data-selected"),d=0,e=0;for(d=0;d<this._filteredUsers.length;d++){if(this._filteredUsers[d].id==c){e=d;break}}var f=this._filteredUsers.length,g=e-1;if(0>g){g=f-1}if(f){this._selectUserById(this._filteredUsers[g].id)}};g.prototype._handleNextUser=function(b,c){b.preventDefault();var d=this._region.find("[data-action=change-user]"),e=d.attr("data-selected"),f=0,g=0;for(f=0;f<this._filteredUsers.length;f++){if(this._filteredUsers[f].id==e){g=f;break}}var h=this._filteredUsers.length,j=(g+1)%h;if(c&&h){var k=this._filteredUsers[j].id,l=parseInt(k,10);d.attr("data-selected",k);if(!isNaN(l)&&0<l){a(document).trigger("user-changed",k)}}else if(h){this._selectUserById(this._filteredUsers[j].id)}};g.prototype._setCountString=function(a,d){var e=0;this._lastXofYUpdate++;e=this._lastXofYUpdate;c.get_string("xofy","mod_assign",{x:a,y:d}).done(function(a){if(e==this._lastXofYUpdate){this._region.find("[data-region=\"user-count-summary\"]").text(a)}}.bind(this)).fail(b.exception)};g.prototype._refreshCount=function(){var a=this._region.find("[data-action=change-user]"),b=a.attr("data-selected"),c=0,d=0;if(isNaN(b)||0>=b){this._region.find("[data-region=\"user-count\"]").hide()}else{this._region.find("[data-region=\"user-count\"]").show();for(c=0;c<this._filteredUsers.length;c++){if(this._filteredUsers[c].id==b){d=c;break}}var e=this._filteredUsers.length;if(e){d+=1}this._setCountString(d,e);if(0<d){var f=new URL(window.location);if(0<parseInt(f.searchParams.get("blindid"))){var g=this._filteredUsers[d-1].recordid;f.searchParams.set("blindid",g)}else{f.searchParams.set("userid",b)}window.history.replaceState({},"",f)}}};g.prototype._refreshSelector=function(a,b){var c=this._region.find("[data-action=change-user]");b=parseInt(b,10);if(!isNaN(b)&&0<b){c.attr("data-selected",b)}this._refreshCount()};g.prototype._triggerNextUserEvent=function(){if(1<this._filteredUsers.length){a(document).trigger("next-user",{nextUserId:null,nextUser:!0})}else{a(document).trigger("next-user",{nextUser:!1})}};g.prototype._handleChangeUser=function(){var d=this._region.find("[data-action=change-user]"),e=parseInt(d.val(),10);if(this._isLoading){return}if(f.checkFormForChanges("[data-region=\"grade-panel\"] .gradeform")){c.get_strings([{key:"unsavedchanges",component:"mod_assign"},{key:"unsavedchangesquestion",component:"mod_assign"},{key:"saveandcontinue",component:"mod_assign"},{key:"cancel",component:"core"}]).done(function(c){b.confirm(c[0],c[1],c[2],c[3],function(){a(document).trigger("save-changes",e)})})}else{if(!isNaN(e)&&0<e){d.attr("data-selected",e);a(document).trigger("user-changed",e)}}};return g});
//# sourceMappingURL=grading_navigation.min.js.map