From 4e6c3798106e146b84f0d41be05dd5de6b4104f6 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Fri, 17 May 2024 23:18:16 +0800 Subject: [PATCH] MDL-81961 core_question: Final deprecation of moodle-question-chooser Also includes removal of qbank_chooser template which was deprecated alongside it. --- .upgradenotes/MDL-81961-2026020605441060.yml | 12 +++ .../question/templates/qbank_chooser.mustache | 29 ------- .../moodle-question-chooser-debug.js | 81 ------------------- .../moodle-question-chooser-min.js | 1 - .../moodle-question-chooser.js | 79 ------------------ public/question/yui/src/chooser/build.json | 10 --- public/question/yui/src/chooser/js/chooser.js | 76 ----------------- .../yui/src/chooser/meta/chooser.json | 7 -- 8 files changed, 12 insertions(+), 283 deletions(-) create mode 100644 .upgradenotes/MDL-81961-2026020605441060.yml delete mode 100644 public/question/templates/qbank_chooser.mustache delete mode 100644 public/question/yui/build/moodle-question-chooser/moodle-question-chooser-debug.js delete mode 100644 public/question/yui/build/moodle-question-chooser/moodle-question-chooser-min.js delete mode 100644 public/question/yui/build/moodle-question-chooser/moodle-question-chooser.js delete mode 100644 public/question/yui/src/chooser/build.json delete mode 100644 public/question/yui/src/chooser/js/chooser.js delete mode 100644 public/question/yui/src/chooser/meta/chooser.json diff --git a/.upgradenotes/MDL-81961-2026020605441060.yml b/.upgradenotes/MDL-81961-2026020605441060.yml new file mode 100644 index 00000000000..2cb96e51926 --- /dev/null +++ b/.upgradenotes/MDL-81961-2026020605441060.yml @@ -0,0 +1,12 @@ +issueNumber: MDL-81961 +notes: + core_question: + - message: | + core_question: + - message: | + Final deprecation of `moodle-question-chooser` YUI module. + type: removed + - message: | + Final deprecation of `core_question/qbank_chooser` template. + type: removed + type: removed diff --git a/public/question/templates/qbank_chooser.mustache b/public/question/templates/qbank_chooser.mustache deleted file mode 100644 index 2343d89b0fe..00000000000 --- a/public/question/templates/qbank_chooser.mustache +++ /dev/null @@ -1,29 +0,0 @@ -{{! - This file is part of Moodle - http://moodle.org/ - - Moodle is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Moodle is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Moodle. If not, see . -}} -{{! - Question bank chooser. -}} -{{> core/chooser }} -{{#js}} -require([ - 'core/yui' -], function(Y) { - Y.use('moodle-question-chooser', function() { - M.question.init_chooser(); - }); -}); -{{/js}} diff --git a/public/question/yui/build/moodle-question-chooser/moodle-question-chooser-debug.js b/public/question/yui/build/moodle-question-chooser/moodle-question-chooser-debug.js deleted file mode 100644 index 8ae50df8904..00000000000 --- a/public/question/yui/build/moodle-question-chooser/moodle-question-chooser-debug.js +++ /dev/null @@ -1,81 +0,0 @@ -YUI.add('moodle-question-chooser', function (Y, NAME) { - -// This file is part of Moodle - http://moodle.org/ -// -// Moodle is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Moodle is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Moodle. If not, see . - -/** - * JavaScript required by the question type chooser pop-up. - * - * @module moodle-question-chooser - */ - -Y.log("The moodle-question-chooser module has been deprecated. " + - "Please use moodle-qbank_editquestion-chooser instead.", 'moodle-core-notification', 'warn'); - -var SELECTORS = { - CREATENEWQUESTION: 'div.createnewquestion', - CREATENEWQUESTIONFORM: 'div.createnewquestion form', - CHOOSERDIALOGUE: 'div.chooserdialoguebody', - CHOOSERHEADER: 'div.choosertitle' -}; - -function Chooser() { - Chooser.superclass.constructor.apply(this, arguments); -} - -Y.extend(Chooser, M.core.chooserdialogue, { - initializer: function() { - Y.all('form').each(function(node) { - if (/question\/addquestion\.php/.test(node.getAttribute('action'))) { - node.on('submit', this.displayQuestionChooser, this); - } - }, this); - }, - displayQuestionChooser: function(e) { - var dialogue = Y.one(SELECTORS.CREATENEWQUESTION + ' ' + SELECTORS.CHOOSERDIALOGUE), - header = Y.one(SELECTORS.CREATENEWQUESTION + ' ' + SELECTORS.CHOOSERHEADER); - - if (this.container === null) { - // Setup the dialogue, and then prepare the chooser if it's not already been set up. - this.setup_chooser_dialogue(dialogue, header, {}); - this.prepare_chooser(); - } - - // Update all of the hidden fields within the questionbank form. - var originForm = e.target.ancestor('form', true), - targetForm = this.container.one('form'), - hiddenElements = originForm.all('input[type="hidden"]'); - - targetForm.all('input.customfield').remove(); - hiddenElements.each(function(field) { - targetForm.appendChild(field.cloneNode()) - .removeAttribute('id') - .addClass('customfield'); - }); - - // Display the chooser dialogue. - this.display_chooser(e); - } -}, { - NAME: 'questionChooser' -}); - -M.question = M.question || {}; -M.question.init_chooser = function(config) { - return new Chooser(config); -}; - - -}, '@VERSION@', {"requires": ["moodle-core-chooserdialogue"]}); diff --git a/public/question/yui/build/moodle-question-chooser/moodle-question-chooser-min.js b/public/question/yui/build/moodle-question-chooser/moodle-question-chooser-min.js deleted file mode 100644 index 869c2716281..00000000000 --- a/public/question/yui/build/moodle-question-chooser/moodle-question-chooser-min.js +++ /dev/null @@ -1 +0,0 @@ -YUI.add("moodle-question-chooser",function(n,o){var s="div.createnewquestion",r="div.chooserdialoguebody",u="div.choosertitle";function e(){e.superclass.constructor.apply(this,arguments)}n.extend(e,M.core.chooserdialogue,{initializer:function(){n.all("form").each(function(o){/question\/addquestion\.php/.test(o.getAttribute("action"))&&o.on("submit",this.displayQuestionChooser,this)},this)},displayQuestionChooser:function(o){var e,i=n.one(s+" "+r),t=n.one(s+" "+u);null===this.container&&(this.setup_chooser_dialogue(i,t,{}),this.prepare_chooser()),i=o.target.ancestor("form",!0),e=this.container.one("form"),t=i.all('input[type="hidden"]'),e.all("input.customfield").remove(),t.each(function(o){e.appendChild(o.cloneNode()).removeAttribute("id").addClass("customfield")}),this.display_chooser(o)}},{NAME:"questionChooser"}),M.question=M.question||{},M.question.init_chooser=function(o){return new e(o)}},"@VERSION@",{requires:["moodle-core-chooserdialogue"]}); \ No newline at end of file diff --git a/public/question/yui/build/moodle-question-chooser/moodle-question-chooser.js b/public/question/yui/build/moodle-question-chooser/moodle-question-chooser.js deleted file mode 100644 index cfeecae9b4e..00000000000 --- a/public/question/yui/build/moodle-question-chooser/moodle-question-chooser.js +++ /dev/null @@ -1,79 +0,0 @@ -YUI.add('moodle-question-chooser', function (Y, NAME) { - -// This file is part of Moodle - http://moodle.org/ -// -// Moodle is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Moodle is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Moodle. If not, see . - -/** - * JavaScript required by the question type chooser pop-up. - * - * @module moodle-question-chooser - */ - - -var SELECTORS = { - CREATENEWQUESTION: 'div.createnewquestion', - CREATENEWQUESTIONFORM: 'div.createnewquestion form', - CHOOSERDIALOGUE: 'div.chooserdialoguebody', - CHOOSERHEADER: 'div.choosertitle' -}; - -function Chooser() { - Chooser.superclass.constructor.apply(this, arguments); -} - -Y.extend(Chooser, M.core.chooserdialogue, { - initializer: function() { - Y.all('form').each(function(node) { - if (/question\/addquestion\.php/.test(node.getAttribute('action'))) { - node.on('submit', this.displayQuestionChooser, this); - } - }, this); - }, - displayQuestionChooser: function(e) { - var dialogue = Y.one(SELECTORS.CREATENEWQUESTION + ' ' + SELECTORS.CHOOSERDIALOGUE), - header = Y.one(SELECTORS.CREATENEWQUESTION + ' ' + SELECTORS.CHOOSERHEADER); - - if (this.container === null) { - // Setup the dialogue, and then prepare the chooser if it's not already been set up. - this.setup_chooser_dialogue(dialogue, header, {}); - this.prepare_chooser(); - } - - // Update all of the hidden fields within the questionbank form. - var originForm = e.target.ancestor('form', true), - targetForm = this.container.one('form'), - hiddenElements = originForm.all('input[type="hidden"]'); - - targetForm.all('input.customfield').remove(); - hiddenElements.each(function(field) { - targetForm.appendChild(field.cloneNode()) - .removeAttribute('id') - .addClass('customfield'); - }); - - // Display the chooser dialogue. - this.display_chooser(e); - } -}, { - NAME: 'questionChooser' -}); - -M.question = M.question || {}; -M.question.init_chooser = function(config) { - return new Chooser(config); -}; - - -}, '@VERSION@', {"requires": ["moodle-core-chooserdialogue"]}); diff --git a/public/question/yui/src/chooser/build.json b/public/question/yui/src/chooser/build.json deleted file mode 100644 index cd112fe4c10..00000000000 --- a/public/question/yui/src/chooser/build.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "moodle-question-chooser", - "builds": { - "moodle-question-chooser": { - "jsfiles": [ - "chooser.js" - ] - } - } -} diff --git a/public/question/yui/src/chooser/js/chooser.js b/public/question/yui/src/chooser/js/chooser.js deleted file mode 100644 index e839a961ae7..00000000000 --- a/public/question/yui/src/chooser/js/chooser.js +++ /dev/null @@ -1,76 +0,0 @@ -// This file is part of Moodle - http://moodle.org/ -// -// Moodle is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Moodle is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Moodle. If not, see . - -/** - * JavaScript required by the question type chooser pop-up. - * - * @module moodle-question-chooser - */ - -Y.log("The moodle-question-chooser module has been deprecated. " + - "Please use moodle-qbank_editquestion-chooser instead.", 'moodle-core-notification', 'warn'); - -var SELECTORS = { - CREATENEWQUESTION: 'div.createnewquestion', - CREATENEWQUESTIONFORM: 'div.createnewquestion form', - CHOOSERDIALOGUE: 'div.chooserdialoguebody', - CHOOSERHEADER: 'div.choosertitle' -}; - -function Chooser() { - Chooser.superclass.constructor.apply(this, arguments); -} - -Y.extend(Chooser, M.core.chooserdialogue, { - initializer: function() { - Y.all('form').each(function(node) { - if (/question\/addquestion\.php/.test(node.getAttribute('action'))) { - node.on('submit', this.displayQuestionChooser, this); - } - }, this); - }, - displayQuestionChooser: function(e) { - var dialogue = Y.one(SELECTORS.CREATENEWQUESTION + ' ' + SELECTORS.CHOOSERDIALOGUE), - header = Y.one(SELECTORS.CREATENEWQUESTION + ' ' + SELECTORS.CHOOSERHEADER); - - if (this.container === null) { - // Setup the dialogue, and then prepare the chooser if it's not already been set up. - this.setup_chooser_dialogue(dialogue, header, {}); - this.prepare_chooser(); - } - - // Update all of the hidden fields within the questionbank form. - var originForm = e.target.ancestor('form', true), - targetForm = this.container.one('form'), - hiddenElements = originForm.all('input[type="hidden"]'); - - targetForm.all('input.customfield').remove(); - hiddenElements.each(function(field) { - targetForm.appendChild(field.cloneNode()) - .removeAttribute('id') - .addClass('customfield'); - }); - - // Display the chooser dialogue. - this.display_chooser(e); - } -}, { - NAME: 'questionChooser' -}); - -M.question = M.question || {}; -M.question.init_chooser = function(config) { - return new Chooser(config); -}; diff --git a/public/question/yui/src/chooser/meta/chooser.json b/public/question/yui/src/chooser/meta/chooser.json deleted file mode 100644 index 3bdb85e4c7b..00000000000 --- a/public/question/yui/src/chooser/meta/chooser.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "moodle-question-chooser": { - "requires": [ - "moodle-core-chooserdialogue" - ] - } -}