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_panel.min.js

define ("mod_assign/grading_panel",["jquery","core/yui","core/notification","core/templates","core/fragment","core/ajax","core/str","mod_assign/grading_form_change_checker","mod_assign/grading_events","core/event"],function(a,b,c,d,e,f,g,h,i,j){var k=function(b){this._regionSelector=b;this._region=a(b);this._userCache=[];this.registerEventListeners()};k.prototype._regionSelector=null;k.prototype._lastUserId=0;k.prototype._lastAttemptNumber=-1;k.prototype._region=null;k.prototype.nextUserId=null;k.prototype.nextUser=!1;k.prototype._niceReplaceNodeContents=function(b,c,e){var f=a.Deferred();b.fadeOut("fast",function(){d.replaceNodeContents(b,c,e);b.fadeIn("fast",function(){f.resolve()})});return f.promise()};k.prototype._saveFormState=function(){var b=a("[data-region=\"grading-actions-form\"] [name=\"sendstudentnotifications\"]").prop("checked");a(".gradeform [name=\"sendstudentnotifications\"]").val(b)};k.prototype._submitForm=function(b,d,e){var g=a(this._region.find("form.gradeform"));a("[data-region=\"overlay\"]").show();g.trigger("save-form-state");j.notifyFormSubmitAjax(g[0]);var h=g.serialize(),i=this._region.attr("data-assignmentid");f.call([{methodname:"mod_assign_submit_grading_form",args:{assignmentid:i,userid:this._lastUserId,jsonformdata:JSON.stringify(h)},done:this._handleFormSubmissionResponse.bind(this,h,d,e),fail:c.exception}])};k.prototype._handleFormSubmissionResponse=function(d,e,f,h){if("undefined"==typeof e){e=this._lastUserId}if(h.length){a(document).trigger("reset",[this._lastUserId,d])}else{g.get_strings([{key:"changessaved",component:"core"},{key:"gradechangessaveddetail",component:"mod_assign"}]).done(function(a){c.alert(a[0],a[1])}).fail(c.exception);b.use("moodle-core-formchangechecker",function(){M.core_formchangechecker.reset_form_dirty_state()});if(e==this._lastUserId){a(document).trigger("reset",e)}else if(f){a(document).trigger("done-saving-show-next",!0)}else{a(document).trigger("user-changed",e)}}a("[data-region=\"overlay\"]").hide()};k.prototype._resetForm=function(b,c,d){var e=a.Event("custom");if("undefined"==typeof c){c=this._lastUserId}this._lastUserId=0;this._refreshGradingPanel(e,c,d)};k.prototype._chooseAttempt=function(b){var d=a(b.target),e=d.data("submissions"),f=a(document.getElementById(e)),h=f.clone(),i=h.wrap(a("<form/>")).html();g.get_strings([{key:"viewadifferentattempt",component:"mod_assign"},{key:"view",component:"core"},{key:"cancel",component:"core"}]).done(function(b){c.confirm(b[0],i,b[1],b[2],function(){var b=a("input:radio[name='select-attemptnumber']:checked").val();this._refreshGradingPanel(null,this._lastUserId,"",b)}.bind(this))}.bind(this)).fail(c.exception)};k.prototype._addPopoutButtons=function(b){var e=a(b);d.render("mod_assign/popout_button",{}).done(function(a){var b=e.find("[data-fieldtype=\"filemanager\"],[data-fieldtype=\"editor\"],[data-fieldtype=\"grading\"]").closest(".fitem");b.addClass("has-popout").find("label").parent().append(a);e.on("click","[data-region=\"popout-button\"]",this._togglePopout.bind(this))}.bind(this)).fail(c.exception)};k.prototype._togglePopout=function(b){b.preventDefault();var c=a(b.target).closest(".fitem");if(c.hasClass("popout")){a(".popout").removeClass("popout")}else{a(".popout").removeClass("popout");c.addClass("popout");c.addClass("moodle-has-zindex")}};k.prototype._refreshGradingPanel=function(b,f,g,i){var j=this._region.attr("data-contextid");if("undefined"==typeof g){g=""}if("undefined"==typeof i){i=-1}if(this._lastUserId==f&&this._lastAttemptNumber==i&&""===g){return}this._lastUserId=f;this._lastAttemptNumber=i;a(document).trigger("start-loading-user");window.M.util.js_pending("mod-assign-loading-user");d.render("mod_assign/loading",{}).done(function(b,d){this._niceReplaceNodeContents(this._region,b,d).done(function(){if(0<f){this._region.show();var b={userid:f,attemptnumber:i,jsonformdata:JSON.stringify(g)};e.loadFragment("mod_assign","gradingpanel",j,b).done(function(b,d){this._niceReplaceNodeContents(this._region,b,d).done(function(){h.saveFormState("[data-region=\"grade-panel\"] .gradeform");a(document).on("editor-content-restored",function(){h.saveFormState("[data-region=\"grade-panel\"] .gradeform")});a("[data-region=\"attempt-chooser\"]").on("click",this._chooseAttempt.bind(this));this._addPopoutButtons("[data-region=\"grade-panel\"] .gradeform");a(document).trigger("finish-loading-user");window.M.util.js_complete("mod-assign-loading-user")}.bind(this)).fail(c.exception)}.bind(this)).fail(c.exception);a("[data-region=\"review-panel\"]").show()}else{this._region.hide();a("[data-region=\"review-panel\"]").hide();a(document).trigger("finish-loading-user");window.M.util.js_complete("mod-assign-loading-user")}}.bind(this))}.bind(this)).fail(c.exception)};k.prototype._getNextUser=function(a,b){this.nextUserId=b.nextUserId;this.nextUser=b.nextUser};k.prototype._handleSaveAndShowNext=function(){this._submitForm(null,this.nextUserId,this.nextUser)};k.prototype.getPanelElement=function(){return a("[data-region=\"grade-panel\"]")};k.prototype.collapsePanel=function(){this.getPanelElement().addClass("collapsed")};k.prototype.expandPanel=function(){this.getPanelElement().removeClass("collapsed")};k.prototype.registerEventListeners=function(){var b=a(document),c=a(this._region);c.on("submit","form",function(a){a.preventDefault()});b.on("next-user",this._getNextUser.bind(this));b.on("user-changed",this._refreshGradingPanel.bind(this));b.on("save-changes",this._submitForm.bind(this));b.on("save-and-show-next",this._handleSaveAndShowNext.bind(this));b.on("reset",this._resetForm.bind(this));b.on("save-form-state",this._saveFormState.bind(this));b.on(i.COLLAPSE_GRADE_PANEL,function(){this.collapsePanel()}.bind(this));b.on(i.COLLAPSE_REVIEW_PANEL,function(){this.expandPanel()}.bind(this));b.on(i.EXPAND_GRADE_PANEL,function(){this.expandPanel()}.bind(this))};return k});
//# sourceMappingURL=grading_panel.min.js.map