Current Path : C:/xampp/htdocs/moodle/mod/quiz/amd/build/ |
Current File : C:/xampp/htdocs/moodle/mod/quiz/amd/build/modal_add_random_question.min.js |
define ("mod_quiz/modal_add_random_question",["jquery","core/yui","core/notification","core/modal","core/modal_events","core/modal_registry","core/fragment","core/templates"],function(a,b,c,d,e,f,g,h){var i=!1,j={EXISTING_CATEGORY_CONTAINER:"[data-region=\"existing-category-container\"]",EXISTING_CATEGORY_FORM_ELEMENT:"#id_existingcategoryheader",NEW_CATEGORY_CONTAINER:"[data-region=\"new-category-container\"]",NEW_CATEGORY_FORM_ELEMENT:"#id_newcategoryheader",TAB_CONTENT:"[data-region=\"tab-content\"]",ADD_ON_PAGE_FORM_ELEMENT:"[name=\"addonpage\"]",SUBMIT_BUTTON_ELEMENT:"input[type=\"submit\"]",CANCEL_BUTTON_ELEMENT:"input[type=\"submit\"][name=\"cancel\"]",FORM_HEADER:"legend",BUTTON_CONTAINER:".fitem"},k=function(a){d.call(this,a);this.contextId=null;this.addOnPageId=null;this.category=null;this.returnUrl=null;this.cmid=null;this.loadedForm=!1};k.TYPE="mod_quiz-quiz-add-random-question";k.prototype=Object.create(d.prototype);k.prototype.constructor=k;k.prototype.setContextId=function(a){this.contextId=a};k.prototype.getContextId=function(){return this.contextId};k.prototype.setAddOnPageId=function(a){this.addOnPageId=a;this.getBody().find(j.ADD_ON_PAGE_FORM_ELEMENT).val(a)};k.prototype.getAddOnPageId=function(){return this.addOnPageId};k.prototype.setCategory=function(a){this.category=a};k.prototype.getCategory=function(){return this.category};k.prototype.setReturnUrl=function(a){this.returnUrl=a};k.prototype.getReturnUrl=function(){return this.returnUrl};k.prototype.setCMID=function(a){this.cmid=a};k.prototype.getCMID=function(){return this.cmid};k.prototype.moveFormElementIntoTab=function(b,c){var d=b.find(j.SUBMIT_BUTTON_ELEMENT),e=a("<div class=\"modal-footer mt-1\" data-region=\"footer\"></div>");b.find(j.FORM_HEADER).addClass("hidden");b.wrap(c);d.closest(j.BUTTON_CONTAINER).remove();d.appendTo(e);e.appendTo(b)};k.prototype.moveTabsIntoTabContent=function(a){var b=this.getBody().find(j.TAB_CONTENT).empty();a.find("[role=\"tabpanel\"]").wrapAll(b)};k.prototype.moveCancelButtonToTabs=function(a){var b=a.find(j.CANCEL_BUTTON_ELEMENT).addClass("ml-1"),c=a.find("[data-region=\"footer\"]");b.closest(j.BUTTON_CONTAINER).remove();b.clone().appendTo(c)};k.prototype.loadForm=function(){return g.loadFragment("mod_quiz","add_random_question_form",this.getContextId(),{addonpage:this.getAddOnPageId(),cat:this.getCategory(),returnurl:this.getReturnUrl(),cmid:this.getCMID()}).then(function(b,c){var d=a(b),e=d.find(j.EXISTING_CATEGORY_FORM_ELEMENT),f=this.getBody().find(j.EXISTING_CATEGORY_CONTAINER),g=d.find(j.NEW_CATEGORY_FORM_ELEMENT),i=this.getBody().find(j.NEW_CATEGORY_CONTAINER);this.moveFormElementIntoTab(e,f);this.moveFormElementIntoTab(g,i);this.moveTabsIntoTabContent(d);this.moveCancelButtonToTabs(d);h.replaceNode(this.getBody().find(j.TAB_CONTENT),d,c)}.bind(this)).then(function(){b.use("moodle-core-formchangechecker",function(){M.core_formchangechecker.reset_form_dirty_state()})}).fail(c.exception)};k.prototype.show=function(){d.prototype.show.call(this);if(!this.loadedForm){this.loadForm();this.loadedForm=!0}};if(!i){f.register(k.TYPE,k,"mod_quiz/modal_add_random_question");i=!0}return k}); //# sourceMappingURL=modal_add_random_question.min.js.map