mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 09:26:35 +02:00
MDL-43089 quiz editing: fix some qbank popup JS issues.
This commit is contained in:
parent
ad6a1455a4
commit
aec2a725a8
4 changed files with 49 additions and 4 deletions
|
@ -60,7 +60,8 @@ Y.extend(POPUP, Y.Base, {
|
|||
extraClasses: ['mod_quiz_qbank_dialogue']
|
||||
};
|
||||
this.dialogue = new M.core.dialogue(config);
|
||||
this.dialogue.bodyNode.delegate('click', this.link_clicked, 'a[href]', this);
|
||||
this.dialogue.bodyNode.delegate('click', this.link_clicked,
|
||||
'.paging a[href], thead tr a[href]', this);
|
||||
this.dialogue.hide();
|
||||
|
||||
this.loadingDiv = this.dialogue.bodyNode.getHTML();
|
||||
|
@ -133,6 +134,20 @@ Y.extend(POPUP, Y.Base, {
|
|||
Y.later(0, this.dialogue, this.dialogue.centerDialogue);
|
||||
}
|
||||
M.question.qbankmanager.init();
|
||||
|
||||
if (Y.one('#advancedsearch')) {
|
||||
M.util.init_collapsible_region(Y, "advancedsearch", "question_bank_advanced_search",
|
||||
M.util.get_string('clicktohideshow'));
|
||||
}
|
||||
|
||||
this.dialogue.fire('widget:contentUpdate');
|
||||
// TODO MDL-47602 really, the base class should listen for the even fired
|
||||
// on the previous line, and fix things like makeResponsive.
|
||||
// However, it does not. So the next two lines are a hack to fix up
|
||||
// display issues (e.g. overall scrollbars on the page). Once the base class
|
||||
// is fixed, this comment and the following two lines should be deleted.
|
||||
this.dialogue.hide();
|
||||
this.dialogue.show();
|
||||
},
|
||||
|
||||
load_failed: function() {
|
||||
|
|
|
@ -1 +1 @@
|
|||
YUI.add("moodle-mod_quiz-quizquestionbank",function(e,t){var n={QBANKLOADING:"div.questionbankloading",ADDQUESTIONLINKS:"ul.menu a.questionbank",ADDTOQUIZCONTAINER:"td.addtoquizaction"},r={PAGE:"addonpage",HEADER:"header"},i=function(){i.superclass.constructor.apply(this,arguments)};e.extend(i,e.Base,{loadingDiv:"",dialogue:null,addonpage:0,create_dialogue:function(){config={headerContent:"",bodyContent:e.one(n.QBANKLOADING),draggable:!0,modal:!0,centered:!0,width:null,visible:!1,postmethod:"form",footerContent:null,extraClasses:["mod_quiz_qbank_dialogue"]},this.dialogue=new M.core.dialogue(config),this.dialogue.bodyNode.delegate("click",this.link_clicked,"a[href]",this),this.dialogue.hide(),this.loadingDiv=this.dialogue.bodyNode.getHTML(),e.later(100,this,function(){this.load_content(window.location.search)})},initializer:function(){if(!e.one(n.QBANKLOADING))return;this.create_dialogue(),e.one("body").delegate("click",this.display_dialogue,n.ADDQUESTIONLINKS,this)},display_dialogue:function(e){e.preventDefault(),this.dialogue.set("headerContent",e.currentTarget.getData(r.HEADER)),this.addonpage=e.currentTarget.getData(r.PAGE);var t=this.dialogue.bodyNode.one(".modulespecificbuttonscontainer");if(t){var n=t.one("input[name=addonpage]");n||(n=t.appendChild('<input type="hidden" name="addonpage">')),n.set("value",this.addonpage)}this.dialogue.show()},load_content:function(t){this.dialogue.bodyNode.append(this.loadingDiv),window.history.replaceState&&window.history.replaceState(null,"",M.cfg.wwwroot+"/mod/quiz/edit.php"+t),e.io(M.cfg.wwwroot+"/mod/quiz/questionbank.ajax.php"+t,{method:"GET",on:{success:this.load_done,failure:this.load_failed},context:this})},load_done:function(t,n){var r=JSON.parse(n.responseText);if(!r.status||r.status!=="OK"){this.load_failed(t,n);return}this.dialogue.bodyNode.setHTML(r.contents),e.use("moodle-question-chooser",function(){M.question.init_chooser({})}),this.dialogue.bodyNode.one("form").delegate("change",this.options_changed,".searchoptions",this),this.dialogue.visible&&e.later(0,this.dialogue,this.dialogue.centerDialogue),M.question.qbankmanager.init()},load_failed:function(){},link_clicked:function(e){if(e.currentTarget.ancestor(n.ADDTOQUIZCONTAINER)){e.currentTarget.set("href",e.currentTarget.get("href")+"&addonpage="+this.addonpage);return}e.preventDefault(),this.load_content(e.currentTarget.get("search"))},options_changed:function(t){t.preventDefault(),this.load_content("?"+e.IO.stringify(t.currentTarget.get("form")))}}),M.mod_quiz=M.mod_quiz||{},M.mod_quiz.quizquestionbank=M.mod_quiz.quizquestionbank||{},M.mod_quiz.quizquestionbank.init=function(){return new i}},"@VERSION@",{requires:["base","event","node","io","io-form","yui-later","moodle-question-qbankmanager","moodle-core-notification-dialogue"]});
|
||||
YUI.add("moodle-mod_quiz-quizquestionbank",function(e,t){var n={QBANKLOADING:"div.questionbankloading",ADDQUESTIONLINKS:"ul.menu a.questionbank",ADDTOQUIZCONTAINER:"td.addtoquizaction"},r={PAGE:"addonpage",HEADER:"header"},i=function(){i.superclass.constructor.apply(this,arguments)};e.extend(i,e.Base,{loadingDiv:"",dialogue:null,addonpage:0,create_dialogue:function(){config={headerContent:"",bodyContent:e.one(n.QBANKLOADING),draggable:!0,modal:!0,centered:!0,width:null,visible:!1,postmethod:"form",footerContent:null,extraClasses:["mod_quiz_qbank_dialogue"]},this.dialogue=new M.core.dialogue(config),this.dialogue.bodyNode.delegate("click",this.link_clicked,".paging a[href], thead tr a[href]",this),this.dialogue.hide(),this.loadingDiv=this.dialogue.bodyNode.getHTML(),e.later(100,this,function(){this.load_content(window.location.search)})},initializer:function(){if(!e.one(n.QBANKLOADING))return;this.create_dialogue(),e.one("body").delegate("click",this.display_dialogue,n.ADDQUESTIONLINKS,this)},display_dialogue:function(e){e.preventDefault(),this.dialogue.set("headerContent",e.currentTarget.getData(r.HEADER)),this.addonpage=e.currentTarget.getData(r.PAGE);var t=this.dialogue.bodyNode.one(".modulespecificbuttonscontainer");if(t){var n=t.one("input[name=addonpage]");n||(n=t.appendChild('<input type="hidden" name="addonpage">')),n.set("value",this.addonpage)}this.dialogue.show()},load_content:function(t){this.dialogue.bodyNode.append(this.loadingDiv),window.history.replaceState&&window.history.replaceState(null,"",M.cfg.wwwroot+"/mod/quiz/edit.php"+t),e.io(M.cfg.wwwroot+"/mod/quiz/questionbank.ajax.php"+t,{method:"GET",on:{success:this.load_done,failure:this.load_failed},context:this})},load_done:function(t,n){var r=JSON.parse(n.responseText);if(!r.status||r.status!=="OK"){this.load_failed(t,n);return}this.dialogue.bodyNode.setHTML(r.contents),e.use("moodle-question-chooser",function(){M.question.init_chooser({})}),this.dialogue.bodyNode.one("form").delegate("change",this.options_changed,".searchoptions",this),this.dialogue.visible&&e.later(0,this.dialogue,this.dialogue.centerDialogue),M.question.qbankmanager.init(),e.one("#advancedsearch")&&M.util.init_collapsible_region(e,"advancedsearch","question_bank_advanced_search",M.util.get_string("clicktohideshow")),this.dialogue.fire("widget:contentUpdate"),this.dialogue.hide(),this.dialogue.show()},load_failed:function(){},link_clicked:function(e){if(e.currentTarget.ancestor(n.ADDTOQUIZCONTAINER)){e.currentTarget.set("href",e.currentTarget.get("href")+"&addonpage="+this.addonpage);return}e.preventDefault(),this.load_content(e.currentTarget.get("search"))},options_changed:function(t){t.preventDefault(),this.load_content("?"+e.IO.stringify(t.currentTarget.get("form")))}}),M.mod_quiz=M.mod_quiz||{},M.mod_quiz.quizquestionbank=M.mod_quiz.quizquestionbank||{},M.mod_quiz.quizquestionbank.init=function(){return new i}},"@VERSION@",{requires:["base","event","node","io","io-form","yui-later","moodle-question-qbankmanager","moodle-core-notification-dialogue"]});
|
||||
|
|
|
@ -60,7 +60,8 @@ Y.extend(POPUP, Y.Base, {
|
|||
extraClasses: ['mod_quiz_qbank_dialogue']
|
||||
};
|
||||
this.dialogue = new M.core.dialogue(config);
|
||||
this.dialogue.bodyNode.delegate('click', this.link_clicked, 'a[href]', this);
|
||||
this.dialogue.bodyNode.delegate('click', this.link_clicked,
|
||||
'.paging a[href], thead tr a[href]', this);
|
||||
this.dialogue.hide();
|
||||
|
||||
this.loadingDiv = this.dialogue.bodyNode.getHTML();
|
||||
|
@ -130,6 +131,20 @@ Y.extend(POPUP, Y.Base, {
|
|||
Y.later(0, this.dialogue, this.dialogue.centerDialogue);
|
||||
}
|
||||
M.question.qbankmanager.init();
|
||||
|
||||
if (Y.one('#advancedsearch')) {
|
||||
M.util.init_collapsible_region(Y, "advancedsearch", "question_bank_advanced_search",
|
||||
M.util.get_string('clicktohideshow'));
|
||||
}
|
||||
|
||||
this.dialogue.fire('widget:contentUpdate');
|
||||
// TODO MDL-47602 really, the base class should listen for the even fired
|
||||
// on the previous line, and fix things like makeResponsive.
|
||||
// However, it does not. So the next two lines are a hack to fix up
|
||||
// display issues (e.g. overall scrollbars on the page). Once the base class
|
||||
// is fixed, this comment and the following two lines should be deleted.
|
||||
this.dialogue.hide();
|
||||
this.dialogue.show();
|
||||
},
|
||||
|
||||
load_failed: function() {
|
||||
|
|
|
@ -58,7 +58,8 @@ Y.extend(POPUP, Y.Base, {
|
|||
extraClasses: ['mod_quiz_qbank_dialogue']
|
||||
};
|
||||
this.dialogue = new M.core.dialogue(config);
|
||||
this.dialogue.bodyNode.delegate('click', this.link_clicked, 'a[href]', this);
|
||||
this.dialogue.bodyNode.delegate('click', this.link_clicked,
|
||||
'.paging a[href], thead tr a[href]', this);
|
||||
this.dialogue.hide();
|
||||
|
||||
this.loadingDiv = this.dialogue.bodyNode.getHTML();
|
||||
|
@ -131,6 +132,20 @@ Y.extend(POPUP, Y.Base, {
|
|||
Y.later(0, this.dialogue, this.dialogue.centerDialogue);
|
||||
}
|
||||
M.question.qbankmanager.init();
|
||||
|
||||
if (Y.one('#advancedsearch')) {
|
||||
M.util.init_collapsible_region(Y, "advancedsearch", "question_bank_advanced_search",
|
||||
M.util.get_string('clicktohideshow'));
|
||||
}
|
||||
|
||||
this.dialogue.fire('widget:contentUpdate');
|
||||
// TODO MDL-47602 really, the base class should listen for the even fired
|
||||
// on the previous line, and fix things like makeResponsive.
|
||||
// However, it does not. So the next two lines are a hack to fix up
|
||||
// display issues (e.g. overall scrollbars on the page). Once the base class
|
||||
// is fixed, this comment and the following two lines should be deleted.
|
||||
this.dialogue.hide();
|
||||
this.dialogue.show();
|
||||
},
|
||||
|
||||
load_failed: function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue