MDL-78091 core: Fix deprecated version
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@
|
||||
* @module mod_quiz/add_random_form
|
||||
* @copyright 2018 Ryan Wyllie <ryan@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @deprecated since 5.0 MDL-78091.
|
||||
* @deprecated since 5.1 MDL-78091.
|
||||
* @todo Final deprecation in Moodle 6.0. See MDL-84777.
|
||||
*/
|
||||
define("mod_quiz/add_random_form",["jquery","mod_quiz/random_question_form_preview"],(function($,RandomQuestionFormPreview){var SELECTORS_PREVIEW_CONTAINER='[data-region="random-question-preview-container"]',SELECTORS_CATEGORY_FORM_ELEMENT='[name="category"]',SELECTORS_SUBCATEGORY_FORM_ELEMENT='[name="includesubcategories"]',SELECTORS_TAG_IDS_FORM_ELEMENT='[name="fromtags[]"]',getCategorySelectValue=function(form){return form.find(SELECTORS_CATEGORY_FORM_ELEMENT).val()},shouldIncludeSubcategories=function(form,topCategories){return!!function(form,topCategories){var selectedValue=getCategorySelectValue(form);return topCategories.indexOf(selectedValue)>-1}(form,topCategories)||form.find(SELECTORS_SUBCATEGORY_FORM_ELEMENT).is(":checked")},reloadQuestionPreview=function(form,contextId,topCategories){var previewContainer=form.find(SELECTORS_PREVIEW_CONTAINER);RandomQuestionFormPreview.reload(previewContainer,function(form){return getCategorySelectValue(form).split(",")[0]}(form),shouldIncludeSubcategories(form,topCategories),function(form){return form.find(SELECTORS_TAG_IDS_FORM_ELEMENT).val().map((function(value){return value.split(",")[0]}))}(form),contextId)},addEventListeners=function(form,contextId,topCategories){var reloadTimerId=null;const tagsFilter=form.find(SELECTORS_TAG_IDS_FORM_ELEMENT);form.add(tagsFilter).on("change",(function(e){var element;((element=$(e.target)).closest(SELECTORS_CATEGORY_FORM_ELEMENT).length>0||element.closest(SELECTORS_SUBCATEGORY_FORM_ELEMENT).length>0||element.closest(SELECTORS_TAG_IDS_FORM_ELEMENT).length>0)&&(RandomQuestionFormPreview.showLoadingIcon(form),reloadTimerId&&clearTimeout(reloadTimerId),reloadTimerId=setTimeout((function(){reloadQuestionPreview(form,contextId,topCategories)}),2e3))}))};return{init:function(formId,contextId,topCategories,isTagsEnabled){if(1==isTagsEnabled){var form=$("#"+formId);reloadQuestionPreview(form,contextId,topCategories),addEventListeners(form,contextId,topCategories)}}}}));
|
||||
|
||||
File diff suppressed because one or more lines are too long
+1
-1
@@ -5,7 +5,7 @@
|
||||
* @module mod_quiz/random_question_form_preview
|
||||
* @copyright 2018 Ryan Wyllie <ryan@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @deprecated since 5.0 MDL-78091.
|
||||
* @deprecated since 5.1 MDL-78091.
|
||||
* @todo Final deprecation in Moodle 6.0. See MDL-84777.
|
||||
*/
|
||||
define("mod_quiz/random_question_form_preview",["jquery","core/ajax","core/str","core/notification","core/templates","core/paged_content_factory"],(function($,Ajax,Str,Notification,Templates,PagedContentFactory){var TEMPLATE_NAME="mod_quiz/random_question_form_preview_question_list",SELECTORS_LOADING_ICON_CONTAINER='[data-region="overlay-icon-container"]',SELECTORS_QUESTION_COUNT_CONTAINER='[data-region="question-count-container"]',SELECTORS_QUESTION_LIST_CONTAINER='[data-region="question-list-container"]',showLoadingIcon=function(root){root.find(SELECTORS_LOADING_ICON_CONTAINER).removeClass("hidden")},hideLoadingIcon=function(root){root.find(SELECTORS_LOADING_ICON_CONTAINER).addClass("hidden")},requestQuestions=function(categoryId,includeSubcategories,tagIds,contextId,limit,offset){var request={methodname:"core_question_get_random_question_summaries",args:{categoryid:categoryId,includesubcategories:includeSubcategories,tagids:tagIds,contextid:contextId,limit:limit,offset:offset}};return Ajax.call([request])[0]};return{reload:function(root,categoryId,includeSubcategories,tagIds,contextId){return showLoadingIcon(root),requestQuestions(categoryId,includeSubcategories,tagIds,contextId,5,0).then((function(response){var totalCount=response.totalcount;return function(root,questionCount){Str.get_string("questionsmatchingfilter","mod_quiz",questionCount).then((function(string){root.find(SELECTORS_QUESTION_COUNT_CONTAINER).html(string)})).fail(Notification.exception)}(root,totalCount),response})).then((function(response){var totalQuestionCount=response.totalcount,questions=response.questions;return questions.length?function(categoryId,includeSubcategories,tagIds,contextId,totalQuestionCount,firstPageQuestions){return PagedContentFactory.createFromAjax(totalQuestionCount,5,(function(pagesData){return pagesData.map((function(pageData){var limit=pageData.limit,offset=pageData.offset;return 0==offset?Templates.render(TEMPLATE_NAME,{questions:firstPageQuestions}):requestQuestions(categoryId,includeSubcategories,tagIds,contextId,limit,offset).then((function(response){var questions=response.questions;return Templates.render(TEMPLATE_NAME,{questions:questions})})).fail(Notification.exception)}))}))}(categoryId,includeSubcategories,tagIds,contextId,totalQuestionCount,questions):$.Deferred().resolve("","")})).then((function(html,js){var container=root.find(SELECTORS_QUESTION_LIST_CONTAINER);Templates.replaceNodeContents(container,html,js)})).always((function(){hideLoadingIcon(root)})).fail(Notification.exception)},showLoadingIcon:showLoadingIcon,hideLoadingIcon:hideLoadingIcon}}));
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -19,7 +19,7 @@
|
||||
* @module mod_quiz/add_random_form
|
||||
* @copyright 2018 Ryan Wyllie <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @deprecated since 5.0 MDL-78091.
|
||||
* @deprecated since 5.1 MDL-78091.
|
||||
* @todo Final deprecation in Moodle 6.0. See MDL-84777.
|
||||
*/
|
||||
define(
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* @module mod_quiz/random_question_form_preview
|
||||
* @copyright 2018 Ryan Wyllie <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @deprecated since 5.0 MDL-78091.
|
||||
* @deprecated since 5.1 MDL-78091.
|
||||
* @todo Final deprecation in Moodle 6.0. See MDL-84777.
|
||||
*/
|
||||
define(
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
{{!
|
||||
@template mod_quiz/random_question_form_preview_question_list
|
||||
|
||||
@deprecated since Moodle 5.0
|
||||
@deprecated since Moodle 5.1
|
||||
@todo MDL-84777 Final deprecation on Moodle 6.0
|
||||
|
||||
A preview section for the list of questions that match the random
|
||||
|
||||
@@ -130,10 +130,10 @@ class core_question_bank_renderer extends plugin_renderer_base {
|
||||
*
|
||||
* @param array $displaydata
|
||||
* @return bool|string
|
||||
* @deprecated since Moodle 5.0 MDL-78091
|
||||
* @deprecated since Moodle 5.1 MDL-78091
|
||||
* @todo MDL-84648 Final deprecation on Moodle 6.0
|
||||
*/
|
||||
#[\core\attribute\deprecated(null, since: '5.0', mdl: 'MDL-78091')]
|
||||
#[\core\attribute\deprecated(null, since: '5.1', mdl: 'MDL-78091')]
|
||||
public function render_question_pagination($displaydata) {
|
||||
\core\deprecation::emit_deprecation_if_present([$this, __FUNCTION__]);
|
||||
// The template question_pagination should also be deleted with this function.
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
{{!
|
||||
@template core_question/question_pagination
|
||||
|
||||
@deprecated since Moodle 5.0
|
||||
@deprecated since Moodle 5.1
|
||||
@todo MDL-84648 Final deprecation on Moodle 6.0
|
||||
|
||||
Example context (json):
|
||||
|
||||
Reference in New Issue
Block a user