From 99ba3fb1d09646c0d3572b3180c388ce255ca79d Mon Sep 17 00:00:00 2001 From: Raja Lmsace Date: Sat, 4 Nov 2023 16:49:56 +0530 Subject: [PATCH 1/5] Flow type alignment issue fixed. Expand / collapse icon issue fixed. --- amd/build/designer_section.min.js | 2 +- amd/build/designer_section.min.js.map | 2 +- lib.php | 1 + styles.css | 8 ++++---- version.php | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/amd/build/designer_section.min.js b/amd/build/designer_section.min.js index b9b6e9c..e21c2b1 100644 --- a/amd/build/designer_section.min.js +++ b/amd/build/designer_section.min.js @@ -5,6 +5,6 @@ * @copyright 2021 bdecent gmbh * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -define("format_designer/designer_section",["jquery","core/fragment","core/templates","core/loadingicon","core/ajax","core_course/actions","core_message/toggle_contact_button","theme_boost/popover"],(function($,Fragment,Templates,Loadingicon,Ajax,Actions,Contact){var SELECTOR={ACTIVITYLI:"li.activity",SECTIONLI:"li.section",ACTIVITYACTION:"a.cm-edit-action",SECTIONACTIONMENU:".section_action_menu.designer-menu"};Y.use("moodle-course-coursebase",(function(){var courseformatselector=M.course.format.get_section_selector();courseformatselector&&(SELECTOR.SECTIONLI=courseformatselector)}));let DesignerSection=function(courseId,contextId,popupActivities,videoTime){var self=this;self.courseId=courseId,self.contextId=contextId,self.popupActivities=popupActivities,self.videoTime=videoTime,$(".course-info-block .carousel .carousel-item:nth-child(1)").addClass("active"),$(".course-info-block #courseStaffinfoControls.carousel").addClass("active"),$("body").delegate(self.SectionController,"click",self.sectionLayoutaction.bind(this)),$("body").delegate(self.RestrictInfo,"click",self.moduleHandler.bind(this)),$("body").delegate(self.sectionRestricted,"click",this.sectionRestrictHandler.bind(this)),$("body").delegate(self.fullDescription,"click",self.fullmodcontentHandler.bind(this)),$("body").delegate(self.trimDescription,"click",self.trimmodcontentHandler.bind(this)),$("body").delegate(self.goToURL,"click",self.redirectToModule.bind(this)),$("body").delegate(self.goToSectionURL,"click",self.redirectToSection.bind(this)),window.onhashchange=function(){self.expandSection()},this.expandSection(),$(".course-type-flow").length>0&&$(".collapse").on("show.bs.collapse",(function(){$(this).parents("li.section").addClass("stack-header-collapsing");var sectionid=$(this).parents("li.section").attr("id"),distance=document.getElementById(sectionid).offsetTop-document.body.scrollTop;setTimeout((()=>window.scroll(0,distance)),50)})).on("shown.bs.collapse",(function(){$(this).parents("li.section").removeClass("stack-header-collapsing")}));var contactModal=document.getElementsByClassName("toggle-contact-button");Array.from(contactModal).forEach((function(element){element.addEventListener("click",(function(e){e.preventDefault(),null!=e.currentTarget.dataset.userid&&Contact.enhance(e.currentTarget)}))})),$('.progress .progress-bar[data-toggle="popover"]').popover()};return DesignerSection.prototype.goToURL='.designer [data-action="go-to-url"]',DesignerSection.prototype.goToSectionURL='.designer [data-action="go-to-section-url"]',DesignerSection.prototype.SectionController=".designer #section-designer-action .dropdown-menu a",DesignerSection.prototype.RestrictInfo=".designer .designer-section-content .call-action-block",DesignerSection.prototype.moduleBlock=".designer .designer-section-content li.activity",DesignerSection.prototype.loadingElement=".icon-loader-block",DesignerSection.prototype.sectionRestricted=".designer .availability-section-block .section-restricted-action",DesignerSection.prototype.fullDescription=".designer-section-content li .fullcontent-summary .mod-description-action",DesignerSection.prototype.trimDescription=".designer-section-content li .trim-summary .mod-description-action",DesignerSection.prototype.modules=null,DesignerSection.prototype.redirectToModule=function(event){let nodeName=event.target.nodeName,iscircle=event.target.closest("li.activity").classList.contains("circle-layout"),isDescription=event.target.classList.contains("mod-description-action"),isPadlock=event.target.classList.contains("fa-lock"),ispopupModule=event.target.closest("li.activity").classList.contains("popmodule");if(nodeName in["a","button","form"]||document.body.classList.contains("editing")||iscircle||isDescription||isPadlock||ispopupModule){if(ispopupModule&&!document.body.classList.contains("editing"))if(null==event.target.closest("button[data-action='toggle-manual-completion']")&&null==event.target.closest(".mod-description-action"))event.target.closest("li.activity").querySelector("a[href]").click();return null}let modurl=event.target.closest("[data-action=go-to-url]").getAttribute("data-url");return window.location.href=modurl,!0},DesignerSection.prototype.redirectToSection=function(event){let isPadlock=event.target.classList.contains("fa-lock");if(document.body.classList.contains("editing")||isPadlock)return null;let sectionurl=event.target.closest("[data-action=go-to-section-url]").getAttribute("data-url");return window.location.href=sectionurl,!0},DesignerSection.prototype.expandSection=()=>{var sectionID=window.location.hash;if(sectionID){var id=sectionID.substring(1),section=document.getElementById(id);if(section){var title=section.querySelector(".section-header-content");title&&(title.classList.remove("collapsed"),title.setAttribute("aria-expanded",!0));var content=section.querySelector(".content");content&&content.classList.add("show"),null!==document.getElementById("section-course-accordion")&&(document.getElementById("section-head-0").classList.add("collapsed"),document.getElementById("section-content-0").classList.remove("show")),section.scrollIntoView()}}},DesignerSection.prototype.fullmodcontentHandler=function(event){var THIS=$(event.currentTarget);let fullContent=$(THIS).closest("li.activity").find(".fullcontent-summary"),trimcontent=$(THIS).closest("li.activity").find(".trim-summary");trimcontent.hasClass("summary-hide")&&(trimcontent.removeClass("summary-hide"),fullContent.addClass("summary-hide"))},DesignerSection.prototype.trimmodcontentHandler=function(event){var THIS=$(event.currentTarget);let fullContent=$(THIS).closest("li.activity").find(".fullcontent-summary"),trimcontent=$(THIS).closest("li.activity").find(".trim-summary");fullContent.hasClass("summary-hide")&&(fullContent.removeClass("summary-hide"),trimcontent.addClass("summary-hide"))},DesignerSection.prototype.sectionRestrictHandler=function(event){var sectionRestrictInfo=$(event.currentTarget).prev();sectionRestrictInfo&&(sectionRestrictInfo.hasClass("show")?sectionRestrictInfo.removeClass("show"):sectionRestrictInfo.addClass("show"))},DesignerSection.prototype.moduleHandler=function(event){event.preventDefault();var restrictBlock=$(event.currentTarget).parents(".restrict-block");restrictBlock.length&&(restrictBlock.hasClass("show")?restrictBlock.removeClass("show"):restrictBlock.addClass("show"))},DesignerSection.prototype.updateVideoTimeInstance=function(sectionId){var sectionVideotimes="body "+("#"+sectionId)+" .activity.videotime";0!=$(sectionVideotimes).length&&$(sectionVideotimes).each(function(index,module){this.CreateInstance(module)}.bind(this))},DesignerSection.prototype.CreateInstance=function(module){if($(module).find(".instancename").length&&($(module).find(".vimeo-embed").length||$(module).find(".video-js").length)){var args={cmid:module.getAttribute("data-id")};Ajax.call([{methodname:"format_designer_get_videotime_instace",args:args}],!0)[0].then((function(data){var template=JSON.parse(data);if("videojs"==template.playertype)var uniqueid=$(module).find(".video-js").first().attr("id").replace("vimeo-embed-","");else uniqueid=$(module).find(".vimeo-embed").first().attr("id").replace("vimeo-embed-","");template.uniqueid=uniqueid,Templates.render(template.templatename,template).then((function(html,js){return Templates.runTemplateJS(js),!0})).fail(Notification.exception)}))}},DesignerSection.prototype.sectionLayoutaction=function(event){var self=this;let sectionId=event.target.closest("li.section").getAttribute("id");var iconBlock="#"+sectionId+" "+self.loadingElement,layout=$(event.currentTarget).data("value"),layouttext=$(event.currentTarget).text();$(event.target).parents(".dropdown").find(".btn").html(layouttext),$(event.target).parents(".dropdown").find(".btn").val(layout),$(event.target).parent().find("a.dropdown-item").each((function(){$(this).removeClass("active")})),$(event.target).addClass("active");let dataid=event.target.closest("li.section").getAttribute("data-id");var args={courseid:self.courseId,sectionid:dataid,options:[{name:$(event.currentTarget).data("option"),value:layout}]},promises=Ajax.call([{methodname:"format_designer_set_section_options",args:args}],!0);$.when.apply($,promises).done((function(){Actions.refreshSection("#"+sectionId,dataid,0).then((()=>"")).catch()})),Loadingicon.addIconToContainerRemoveOnCompletion(iconBlock,promises),setTimeout((function(){self.videoTime&&self.updateVideoTimeInstance(sectionId)}),2e3)},{init:function(courseId,contextId,popupActivities,videoTime){return new DesignerSection(courseId,contextId,popupActivities,videoTime)}}})); +define("format_designer/designer_section",["jquery","core/fragment","core/templates","core/loadingicon","core/ajax","core_course/actions","core_message/toggle_contact_button","theme_boost/popover","core/notification"],(function($,Fragment,Templates,Loadingicon,Ajax,Actions,Contact,Notification){var SELECTOR={ACTIVITYLI:"li.activity",SECTIONLI:"li.section",ACTIVITYACTION:"a.cm-edit-action",SECTIONACTIONMENU:".section_action_menu.designer-menu"};Y.use("moodle-course-coursebase",(function(){var courseformatselector=M.course.format.get_section_selector();courseformatselector&&(SELECTOR.SECTIONLI=courseformatselector)}));let DesignerSection=function(courseId,contextId,popupActivities,videoTime){var self=this;self.courseId=courseId,self.contextId=contextId,self.popupActivities=popupActivities,self.videoTime=videoTime,$(".course-info-block .carousel .carousel-item:nth-child(1)").addClass("active"),$(".course-info-block #courseStaffinfoControls.carousel").addClass("active"),$("body").delegate(self.SectionController,"click",self.sectionLayoutaction.bind(this)),$("body").delegate(self.RestrictInfo,"click",self.moduleHandler.bind(this)),$("body").delegate(self.sectionRestricted,"click",this.sectionRestrictHandler.bind(this)),$("body").delegate(self.fullDescription,"click",self.fullmodcontentHandler.bind(this)),$("body").delegate(self.trimDescription,"click",self.trimmodcontentHandler.bind(this)),$("body").delegate(self.goToURL,"click",self.redirectToModule.bind(this)),$("body").delegate(self.goToSectionURL,"click",self.redirectToSection.bind(this)),window.onhashchange=function(){self.expandSection()},this.expandSection(),$(".course-type-flow").length>0&&$(".collapse").on("show.bs.collapse",(function(){$(this).parents("li.section").addClass("stack-header-collapsing");var sectionid=$(this).parents("li.section").attr("id"),distance=document.getElementById(sectionid).offsetTop-document.body.scrollTop;setTimeout((()=>window.scroll(0,distance)),50)})).on("shown.bs.collapse",(function(){$(this).parents("li.section").removeClass("stack-header-collapsing")}));var contactModal=document.getElementsByClassName("toggle-contact-button");Array.from(contactModal).forEach((function(element){element.addEventListener("click",(function(e){e.preventDefault(),null!=e.currentTarget.dataset.userid&&Contact.enhance(e.currentTarget)}))})),$('.progress .progress-bar[data-toggle="popover"]').popover()};return DesignerSection.prototype.goToURL='.designer [data-action="go-to-url"]',DesignerSection.prototype.goToSectionURL='.designer [data-action="go-to-section-url"]',DesignerSection.prototype.SectionController=".designer #section-designer-action .dropdown-menu a",DesignerSection.prototype.RestrictInfo=".designer .designer-section-content .call-action-block",DesignerSection.prototype.moduleBlock=".designer .designer-section-content li.activity",DesignerSection.prototype.loadingElement=".icon-loader-block",DesignerSection.prototype.sectionRestricted=".designer .availability-section-block .section-restricted-action",DesignerSection.prototype.fullDescription=".designer-section-content li .fullcontent-summary .mod-description-action",DesignerSection.prototype.trimDescription=".designer-section-content li .trim-summary .mod-description-action",DesignerSection.prototype.modules=null,DesignerSection.prototype.redirectToModule=function(event){let nodeName=event.target.nodeName,iscircle=event.target.closest("li.activity").classList.contains("circle-layout"),isDescription=event.target.classList.contains("mod-description-action"),isPadlock=event.target.classList.contains("fa-lock"),ispopupModule=event.target.closest("li.activity").classList.contains("popmodule");if(nodeName in["a","button","form"]||document.body.classList.contains("editing")||iscircle||isDescription||isPadlock||ispopupModule){if(ispopupModule&&!document.body.classList.contains("editing"))if(null===event.target.closest("button[data-action='toggle-manual-completion']")&&null===event.target.closest(".mod-description-action"))event.target.closest("li.activity").querySelector("a[href]").click();return null}let modurl=event.target.closest("[data-action=go-to-url]").getAttribute("data-url");return window.location.href=modurl,!0},DesignerSection.prototype.redirectToSection=function(event){let isPadlock=event.target.classList.contains("fa-lock");if(document.body.classList.contains("editing")||isPadlock)return null;let sectionurl=event.target.closest("[data-action=go-to-section-url]").getAttribute("data-url");return window.location.href=sectionurl,!0},DesignerSection.prototype.expandSection=()=>{var sectionID=window.location.hash;if(sectionID){var id=sectionID.substring(1),section=document.getElementById(id);if(section){var title=section.querySelector(".section-header-content");title&&(title.classList.remove("collapsed"),title.setAttribute("aria-expanded",!0));var content=section.querySelector(".content");content&&content.classList.add("show"),null!==document.getElementById("section-course-accordion")&&(document.getElementById("section-head-0").classList.add("collapsed"),document.getElementById("section-content-0").classList.remove("show")),section.scrollIntoView()}}},DesignerSection.prototype.fullmodcontentHandler=function(event){var THIS=$(event.currentTarget);let fullContent=$(THIS).closest("li.activity").find(".fullcontent-summary"),trimcontent=$(THIS).closest("li.activity").find(".trim-summary");trimcontent.hasClass("summary-hide")&&(trimcontent.removeClass("summary-hide"),fullContent.addClass("summary-hide"))},DesignerSection.prototype.trimmodcontentHandler=function(event){var THIS=$(event.currentTarget);let fullContent=$(THIS).closest("li.activity").find(".fullcontent-summary"),trimcontent=$(THIS).closest("li.activity").find(".trim-summary");fullContent.hasClass("summary-hide")&&(fullContent.removeClass("summary-hide"),trimcontent.addClass("summary-hide"))},DesignerSection.prototype.sectionRestrictHandler=function(event){var sectionRestrictInfo=$(event.currentTarget).prev();sectionRestrictInfo&&(sectionRestrictInfo.hasClass("show")?sectionRestrictInfo.removeClass("show"):sectionRestrictInfo.addClass("show"))},DesignerSection.prototype.moduleHandler=function(event){event.preventDefault();var restrictBlock=$(event.currentTarget).parents(".restrict-block");restrictBlock.length&&(restrictBlock.hasClass("show")?restrictBlock.removeClass("show"):restrictBlock.addClass("show"))},DesignerSection.prototype.updateVideoTimeInstance=function(sectionId){var sectionVideotimes="body "+("#"+sectionId)+" .activity.videotime";0!=$(sectionVideotimes).length&&$(sectionVideotimes).each(function(index,module){this.CreateInstance(module)}.bind(this))},DesignerSection.prototype.CreateInstance=function(module){if($(module).find(".instancename").length&&($(module).find(".vimeo-embed").length||$(module).find(".video-js").length)){var args={cmid:module.getAttribute("data-id")};Ajax.call([{methodname:"format_designer_get_videotime_instace",args:args}],!0)[0].then((function(data){var template=JSON.parse(data);if("videojs"==template.playertype)var uniqueid=$(module).find(".video-js").first().attr("id").replace("vimeo-embed-","");else uniqueid=$(module).find(".vimeo-embed").first().attr("id").replace("vimeo-embed-","");template.uniqueid=uniqueid,Templates.render(template.templatename,template).then((function(html,js){return Templates.runTemplateJS(js),!0})).fail(Notification.exception)}))}},DesignerSection.prototype.sectionLayoutaction=function(event){var self=this;let sectionId=event.target.closest("li.section").getAttribute("id");var iconBlock="#"+sectionId+" "+self.loadingElement,layout=$(event.currentTarget).data("value"),layouttext=$(event.currentTarget).text();$(event.target).parents(".dropdown").find(".btn").html(layouttext),$(event.target).parents(".dropdown").find(".btn").val(layout),$(event.target).parent().find("a.dropdown-item").each((function(){$(this).removeClass("active")})),$(event.target).addClass("active");let dataid=event.target.closest("li.section").getAttribute("data-id");var args={courseid:self.courseId,sectionid:dataid,options:[{name:$(event.currentTarget).data("option"),value:layout}]},promises=Ajax.call([{methodname:"format_designer_set_section_options",args:args}],!0);$.when.apply($,promises).done((function(){Actions.refreshSection("#"+sectionId,dataid,0).then((()=>"")).catch()})),Loadingicon.addIconToContainerRemoveOnCompletion(iconBlock,promises),setTimeout((function(){self.videoTime&&self.updateVideoTimeInstance(sectionId)}),2e3)},{init:function(courseId,contextId,popupActivities,videoTime){return new DesignerSection(courseId,contextId,popupActivities,videoTime)}}})); //# sourceMappingURL=designer_section.min.js.map \ No newline at end of file diff --git a/amd/build/designer_section.min.js.map b/amd/build/designer_section.min.js.map index 1e43c34..8c7c6e0 100644 --- a/amd/build/designer_section.min.js.map +++ b/amd/build/designer_section.min.js.map @@ -1 +1 @@ -{"version":3,"file":"designer_section.min.js","sources":["../src/designer_section.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\r\n//\r\n// Moodle is free software: you can redistribute it and/or modify\r\n// it under the terms of the GNU General Public License as published by\r\n// the Free Software Foundation, either version 3 of the License, or\r\n// (at your option) any later version.\r\n//\r\n// Moodle is distributed in the hope that it will be useful,\r\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r\n// GNU General Public License for more details.\r\n//\r\n// You should have received a copy of the GNU General Public License\r\n// along with Moodle. If not, see .\r\n\r\n\r\n/**\r\n * Implemented designer format js.\r\n *\r\n * @module format_designer/designer_section\r\n * @copyright 2021 bdecent gmbh \r\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\r\n */\r\n define(['jquery', 'core/fragment', 'core/templates', 'core/loadingicon', 'core/ajax',\r\n 'core_course/actions', 'core_message/toggle_contact_button', 'theme_boost/popover'],\r\n function($, Fragment, Templates, Loadingicon, Ajax, Actions, Contact) {\r\n\r\n var SELECTOR = {\r\n ACTIVITYLI: 'li.activity',\r\n SECTIONLI: 'li.section',\r\n ACTIVITYACTION: 'a.cm-edit-action',\r\n SECTIONACTIONMENU: '.section_action_menu.designer-menu',\r\n };\r\n\r\n Y.use('moodle-course-coursebase', function() {\r\n var courseformatselector = M.course.format.get_section_selector();\r\n if (courseformatselector) {\r\n SELECTOR.SECTIONLI = courseformatselector;\r\n }\r\n });\r\n\r\n\r\n /**\r\n * Control designer format action\r\n * @param {int} courseId\r\n * @param {int} contextId\r\n * @param {array} popupActivities\r\n */\r\n let DesignerSection = function(courseId, contextId, popupActivities, videoTime) {\r\n var self = this;\r\n self.courseId = courseId;\r\n self.contextId = contextId;\r\n self.popupActivities = popupActivities;\r\n self.videoTime = videoTime;\r\n\r\n $(\".course-info-block .carousel .carousel-item:nth-child(1)\").addClass('active');\r\n $(\".course-info-block #courseStaffinfoControls.carousel\").addClass('active');\r\n\r\n $('body').delegate(self.SectionController, 'click', self.sectionLayoutaction.bind(this));\r\n $(\"body\").delegate(self.RestrictInfo, \"click\", self.moduleHandler.bind(this));\r\n $(\"body\").delegate(self.sectionRestricted, \"click\", this.sectionRestrictHandler.bind(this));\r\n $('body').delegate(self.fullDescription, \"click\", self.fullmodcontentHandler.bind(this));\r\n $('body').delegate(self.trimDescription, \"click\", self.trimmodcontentHandler.bind(this));\r\n $('body').delegate(self.goToURL, \"click\", self.redirectToModule.bind(this));\r\n $('body').delegate(self.goToSectionURL, \"click\", self.redirectToSection.bind(this));\r\n window.onhashchange = function() {\r\n self.expandSection();\r\n };\r\n this.expandSection();\r\n\r\n if ($('.course-type-flow').length > 0) {\r\n $('.collapse').on('show.bs.collapse', function() {\r\n $(this).parents('li.section').addClass('stack-header-collapsing');\r\n var sectionid = $(this).parents('li.section').attr('id');\r\n var section = document.getElementById(sectionid);\r\n var distance = section.offsetTop - document.body.scrollTop;\r\n setTimeout(() => window.scroll(0, distance), 50);\r\n }).on('shown.bs.collapse', function() {\r\n $(this).parents('li.section').removeClass('stack-header-collapsing');\r\n });\r\n }\r\n\r\n var contactModal = document.getElementsByClassName('toggle-contact-button');\r\n Array.from(contactModal).forEach(function(element) {\r\n element.addEventListener('click', function(e) {\r\n e.preventDefault();\r\n if (e.currentTarget.dataset.userid != undefined) {\r\n Contact.enhance(e.currentTarget);\r\n }\r\n });\r\n });\r\n\r\n $('.progress .progress-bar[data-toggle=\"popover\"]').popover();\r\n\r\n };\r\n\r\n /**\r\n * Selector section controller.\r\n */\r\n DesignerSection.prototype.goToURL = '.designer [data-action=\"go-to-url\"]';\r\n\r\n DesignerSection.prototype.goToSectionURL = '.designer [data-action=\"go-to-section-url\"]';\r\n\r\n DesignerSection.prototype.SectionController = \".designer #section-designer-action .dropdown-menu a\";\r\n\r\n DesignerSection.prototype.RestrictInfo = \".designer .designer-section-content .call-action-block\";\r\n\r\n DesignerSection.prototype.moduleBlock = \".designer .designer-section-content li.activity\";\r\n\r\n DesignerSection.prototype.loadingElement = \".icon-loader-block\";\r\n\r\n DesignerSection.prototype.sectionRestricted = \".designer .availability-section-block .section-restricted-action\";\r\n\r\n DesignerSection.prototype.fullDescription = \".designer-section-content li .fullcontent-summary .mod-description-action\";\r\n\r\n DesignerSection.prototype.trimDescription = \".designer-section-content li .trim-summary .mod-description-action\";\r\n\r\n DesignerSection.prototype.modules = null;\r\n\r\n DesignerSection.prototype.redirectToModule = function(event) {\r\n let nodeName = event.target.nodeName;\r\n let preventionNodes = ['a', 'button', 'form'];\r\n let iscircle = event.target.closest('li.activity').classList.contains('circle-layout');\r\n let isDescription = event.target.classList.contains('mod-description-action');\r\n let isPadlock = event.target.classList.contains('fa-lock');\r\n let ispopupModule = event.target.closest('li.activity').classList.contains('popmodule');\r\n if ((nodeName in preventionNodes)\r\n || document.body.classList.contains('editing') || iscircle || isDescription || isPadlock || ispopupModule) {\r\n if (ispopupModule && !document.body.classList.contains('editing')) {\r\n if (event.target.closest(\"button[data-action='toggle-manual-completion']\") == null && event.target.closest(\".mod-description-action\") == null) {\r\n var li = event.target.closest('li.activity');\r\n li.querySelector('a[href]').click();\r\n }\r\n // event.target.closest('a').click();\r\n }\r\n return null;\r\n }\r\n var card = event.target.closest(\"[data-action=go-to-url]\");\r\n let modurl = card.getAttribute('data-url');\r\n window.location.href = modurl;\r\n return true;\r\n };\r\n\r\n DesignerSection.prototype.redirectToSection = function(event) {\r\n let isPadlock = event.target.classList.contains('fa-lock');\r\n if (document.body.classList.contains('editing') || isPadlock) {\r\n return null;\r\n }\r\n var singlesection = event.target.closest(\"[data-action=go-to-section-url]\")\r\n let sectionurl = singlesection.getAttribute('data-url');\r\n window.location.href = sectionurl;\r\n return true;\r\n }\r\n\r\n DesignerSection.prototype.expandSection = () => {\r\n var sectionID = window.location.hash;\r\n if (sectionID) {\r\n var id = sectionID.substring(1);\r\n var section = document.getElementById(id);\r\n if (section) {\r\n var title = section.querySelector('.section-header-content');\r\n if (title) {\r\n title.classList.remove('collapsed');\r\n title.setAttribute('aria-expanded', true);\r\n }\r\n var content = section.querySelector('.content');\r\n if (content) {\r\n content.classList.add('show');\r\n }\r\n if (document.getElementById('section-course-accordion') !== null) {\r\n document.getElementById('section-head-0').classList.add('collapsed');\r\n document.getElementById('section-content-0').classList.remove('show');\r\n }\r\n section.scrollIntoView();\r\n }\r\n }\r\n };\r\n\r\n DesignerSection.prototype.fullmodcontentHandler = function(event) {\r\n var THIS = $(event.currentTarget);\r\n let fullContent = $(THIS).closest('li.activity').find('.fullcontent-summary');\r\n let trimcontent = $(THIS).closest('li.activity').find('.trim-summary');\r\n if (trimcontent.hasClass('summary-hide')) {\r\n trimcontent.removeClass('summary-hide');\r\n fullContent.addClass('summary-hide');\r\n }\r\n };\r\n\r\n DesignerSection.prototype.trimmodcontentHandler = function(event) {\r\n var THIS = $(event.currentTarget);\r\n let fullContent = $(THIS).closest('li.activity').find('.fullcontent-summary');\r\n let trimcontent = $(THIS).closest('li.activity').find('.trim-summary');\r\n if (fullContent.hasClass('summary-hide')) {\r\n fullContent.removeClass('summary-hide');\r\n trimcontent.addClass('summary-hide');\r\n }\r\n };\r\n\r\n DesignerSection.prototype.sectionRestrictHandler = function(event) {\r\n var sectionRestrictInfo = $(event.currentTarget).prev();\r\n if (sectionRestrictInfo) {\r\n if (!sectionRestrictInfo.hasClass('show')) {\r\n sectionRestrictInfo.addClass('show');\r\n } else {\r\n sectionRestrictInfo.removeClass('show');\r\n }\r\n }\r\n };\r\n\r\n DesignerSection.prototype.moduleHandler = function(event) {\r\n event.preventDefault();\r\n var restrictBlock = $(event.currentTarget).parents('.restrict-block');\r\n if (restrictBlock.length) {\r\n if (!restrictBlock.hasClass('show')) {\r\n restrictBlock.addClass('show');\r\n } else {\r\n restrictBlock.removeClass('show');\r\n }\r\n }\r\n };\r\n\r\n DesignerSection.prototype.updateVideoTimeInstance = function(sectionId) {\r\n var section = \"#\" + sectionId\r\n var sectionVideotimes = \"body \"+ section + \" .activity.videotime\";\r\n if ($(sectionVideotimes).length == 0) {\r\n return;\r\n }\r\n $(sectionVideotimes).each(function(index, module) {\r\n this.CreateInstance(module);\r\n }.bind(this));\r\n };\r\n\r\n DesignerSection.prototype.CreateInstance = function (module) {\r\n if (\r\n $(module).find('.instancename').length\r\n && ($(module).find('.vimeo-embed').length\r\n || $(module).find('.video-js').length)\r\n ) {\r\n var cmId = module.getAttribute(\"data-id\");\r\n var args = {cmid : cmId};\r\n // Get module instance.\r\n var promises = Ajax.call([{\r\n methodname: 'format_designer_get_videotime_instace',\r\n args: args\r\n }], true);\r\n promises[0].then(function(data) {\r\n var template = JSON.parse(data);\r\n if (template.playertype == 'videojs') {\r\n var uniqueid = $(module).find('.video-js').first().attr('id').replace('vimeo-embed-', '');\r\n } else {\r\n var uniqueid = $(module).find('.vimeo-embed').first().attr('id').replace('vimeo-embed-', '');\r\n }\r\n template.uniqueid = uniqueid;\r\n Templates.render(template.templatename, template).then(function(html, js) {\r\n Templates.runTemplateJS(js);\r\n return true;\r\n }).fail(Notification.exception);\r\n });\r\n }\r\n };\r\n\r\n /**\r\n * Implementaion swith the section layout.\r\n * @param {object} event\r\n */\r\n DesignerSection.prototype.sectionLayoutaction = function(event) {\r\n var self = this;\r\n let sectionId = event.target.closest('li.section').getAttribute('id');\r\n var iconBlock = \"#\" + sectionId + \" \" + self.loadingElement;\r\n var layout = $(event.currentTarget).data('value');\r\n var layouttext = $(event.currentTarget).text();\r\n $(event.target).parents(\".dropdown\").find(\".btn\").html(layouttext);\r\n $(event.target).parents(\".dropdown\").find(\".btn\").val(layout);\r\n $(event.target).parent().find(\"a.dropdown-item\").each(function() {\r\n $(this).removeClass('active');\r\n });\r\n $(event.target).addClass('active');\r\n let dataid = event.target.closest('li.section').getAttribute('data-id');\r\n var args = {\r\n courseid: self.courseId,\r\n sectionid: dataid,\r\n options: [{name: $(event.currentTarget).data('option'), value: layout}]\r\n };\r\n var promises = Ajax.call([{\r\n methodname: 'format_designer_set_section_options',\r\n args: args\r\n }], true);\r\n $.when.apply($, promises)\r\n .done(function() {\r\n const sectionpromise = Actions.refreshSection('#' + sectionId, dataid, 0);\r\n sectionpromise.then(() => {\r\n return '';\r\n }).catch();\r\n });\r\n Loadingicon.addIconToContainerRemoveOnCompletion(iconBlock, promises);\r\n // If videotime exist update the module.\r\n setTimeout(function() {\r\n if (self.videoTime) {\r\n self.updateVideoTimeInstance(sectionId);\r\n }\r\n }, 2000);\r\n };\r\n\r\n return {\r\n init: function(courseId, contextId, popupActivities, videoTime) {\r\n return new DesignerSection(courseId, contextId, popupActivities, videoTime);\r\n }\r\n };\r\n});\r\n"],"names":["define","$","Fragment","Templates","Loadingicon","Ajax","Actions","Contact","SELECTOR","ACTIVITYLI","SECTIONLI","ACTIVITYACTION","SECTIONACTIONMENU","Y","use","courseformatselector","M","course","format","get_section_selector","DesignerSection","courseId","contextId","popupActivities","videoTime","self","this","addClass","delegate","SectionController","sectionLayoutaction","bind","RestrictInfo","moduleHandler","sectionRestricted","sectionRestrictHandler","fullDescription","fullmodcontentHandler","trimDescription","trimmodcontentHandler","goToURL","redirectToModule","goToSectionURL","redirectToSection","window","onhashchange","expandSection","length","on","parents","sectionid","attr","distance","document","getElementById","offsetTop","body","scrollTop","setTimeout","scroll","removeClass","contactModal","getElementsByClassName","Array","from","forEach","element","addEventListener","e","preventDefault","undefined","currentTarget","dataset","userid","enhance","popover","prototype","moduleBlock","loadingElement","modules","event","nodeName","target","iscircle","closest","classList","contains","isDescription","isPadlock","ispopupModule","querySelector","click","modurl","getAttribute","location","href","sectionurl","sectionID","hash","id","substring","section","title","remove","setAttribute","content","add","scrollIntoView","THIS","fullContent","find","trimcontent","hasClass","sectionRestrictInfo","prev","restrictBlock","updateVideoTimeInstance","sectionId","sectionVideotimes","each","index","module","CreateInstance","args","cmid","call","methodname","then","data","template","JSON","parse","playertype","uniqueid","first","replace","render","templatename","html","js","runTemplateJS","fail","Notification","exception","iconBlock","layout","layouttext","text","val","parent","dataid","courseid","options","name","value","promises","when","apply","done","refreshSection","catch","addIconToContainerRemoveOnCompletion","init"],"mappings":";;;;;;;AAuBCA,0CAAO,CAAC,SAAU,gBAAiB,iBAAkB,mBAAoB,YACtE,sBAAuB,qCAAsC,wBAChE,SAASC,EAAGC,SAAUC,UAAWC,YAAaC,KAAMC,QAASC,aAEtDC,SAAW,CACXC,WAAY,cACZC,UAAW,aACXC,eAAgB,mBAChBC,kBAAmB,sCAGvBC,EAAEC,IAAI,4BAA4B,eAC1BC,qBAAuBC,EAAEC,OAAOC,OAAOC,uBACvCJ,uBACAP,SAASE,UAAYK,6BAWzBK,gBAAkB,SAASC,SAAUC,UAAWC,gBAAiBC,eAC7DC,KAAOC,KACXD,KAAKJ,SAAWA,SAChBI,KAAKH,UAAYA,UACjBG,KAAKF,gBAAkBA,gBACvBE,KAAKD,UAAYA,UAEjBvB,EAAE,4DAA4D0B,SAAS,UACvE1B,EAAE,wDAAwD0B,SAAS,UAEnE1B,EAAE,QAAQ2B,SAASH,KAAKI,kBAAmB,QAASJ,KAAKK,oBAAoBC,KAAKL,OAClFzB,EAAE,QAAQ2B,SAASH,KAAKO,aAAc,QAASP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S,cACrB2H,OAAStE,MAAME,OAAOE,QAAQ,cAAcS,aAAa,eACzD8B,KAAO,CACP4B,SAAU9H,KAAKJ,SACf6B,UAAWoG,OACXE,QAAS,CAAC,CAACC,KAAMxJ,EAAE+E,MAAMT,eAAeyD,KAAK,UAAW0B,MAAOT,UAE/DU,SAAWtJ,KAAKwH,KAAK,CAAC,CAClBC,WAAY,sCACZH,KAAMA,QACN,GACJ1H,EAAE2J,KAAKC,MAAM5J,EAAG0J,UACfG,MAAK,WACqBxJ,QAAQyJ,eAAe,IAAM1C,UAAWiC,OAAQ,GACxDvB,MAAK,IACV,KACPiC,WAEX5J,YAAY6J,qCAAqCjB,UAAWW,UAE5DjG,YAAW,WACHjC,KAAKD,WACLC,KAAK2F,wBAAwBC,aAElC,MAGA,CACH6C,KAAM,SAAS7I,SAAUC,UAAWC,gBAAiBC,kBAC1C,IAAIJ,gBAAgBC,SAAUC,UAAWC,gBAAiBC"} +{"version":3,"file":"designer_section.min.js","sources":["../src/designer_section.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n\n/**\n * Implemented designer format js.\n *\n * @module format_designer/designer_section\n * @copyright 2021 bdecent gmbh \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n define(['jquery', 'core/fragment', 'core/templates', 'core/loadingicon', 'core/ajax',\n 'core_course/actions', 'core_message/toggle_contact_button', 'theme_boost/popover', 'core/notification',],\n function($, Fragment, Templates, Loadingicon, Ajax, Actions, Contact, Notification) {\n\n var SELECTOR = {\n ACTIVITYLI: 'li.activity',\n SECTIONLI: 'li.section',\n ACTIVITYACTION: 'a.cm-edit-action',\n SECTIONACTIONMENU: '.section_action_menu.designer-menu',\n };\n\n Y.use('moodle-course-coursebase', function() {\n var courseformatselector = M.course.format.get_section_selector();\n if (courseformatselector) {\n SELECTOR.SECTIONLI = courseformatselector;\n }\n });\n\n\n /**\n * Control designer format action\n * @param {int} courseId\n * @param {int} contextId\n * @param {array} popupActivities\n * @param {bool} videoTime\n */\n let DesignerSection = function(courseId, contextId, popupActivities, videoTime) {\n var self = this;\n self.courseId = courseId;\n self.contextId = contextId;\n self.popupActivities = popupActivities;\n self.videoTime = videoTime;\n\n $(\".course-info-block .carousel .carousel-item:nth-child(1)\").addClass('active');\n $(\".course-info-block #courseStaffinfoControls.carousel\").addClass('active');\n\n $('body').delegate(self.SectionController, 'click', self.sectionLayoutaction.bind(this));\n $(\"body\").delegate(self.RestrictInfo, \"click\", self.moduleHandler.bind(this));\n $(\"body\").delegate(self.sectionRestricted, \"click\", this.sectionRestrictHandler.bind(this));\n $('body').delegate(self.fullDescription, \"click\", self.fullmodcontentHandler.bind(this));\n $('body').delegate(self.trimDescription, \"click\", self.trimmodcontentHandler.bind(this));\n $('body').delegate(self.goToURL, \"click\", self.redirectToModule.bind(this));\n $('body').delegate(self.goToSectionURL, \"click\", self.redirectToSection.bind(this));\n window.onhashchange = function() {\n self.expandSection();\n };\n this.expandSection();\n\n if ($('.course-type-flow').length > 0) {\n $('.collapse').on('show.bs.collapse', function() {\n $(this).parents('li.section').addClass('stack-header-collapsing');\n var sectionid = $(this).parents('li.section').attr('id');\n var section = document.getElementById(sectionid);\n var distance = section.offsetTop - document.body.scrollTop;\n setTimeout(() => window.scroll(0, distance), 50);\n }).on('shown.bs.collapse', function() {\n $(this).parents('li.section').removeClass('stack-header-collapsing');\n });\n }\n\n var contactModal = document.getElementsByClassName('toggle-contact-button');\n Array.from(contactModal).forEach(function(element) {\n element.addEventListener('click', function(e) {\n e.preventDefault();\n if (e.currentTarget.dataset.userid != undefined) {\n Contact.enhance(e.currentTarget);\n }\n });\n });\n\n $('.progress .progress-bar[data-toggle=\"popover\"]').popover();\n\n };\n\n /**\n * Selector section controller.\n */\n DesignerSection.prototype.goToURL = '.designer [data-action=\"go-to-url\"]';\n\n DesignerSection.prototype.goToSectionURL = '.designer [data-action=\"go-to-section-url\"]';\n\n DesignerSection.prototype.SectionController = \".designer #section-designer-action .dropdown-menu a\";\n\n DesignerSection.prototype.RestrictInfo = \".designer .designer-section-content .call-action-block\";\n\n DesignerSection.prototype.moduleBlock = \".designer .designer-section-content li.activity\";\n\n DesignerSection.prototype.loadingElement = \".icon-loader-block\";\n\n DesignerSection.prototype.sectionRestricted = \".designer .availability-section-block .section-restricted-action\";\n\n DesignerSection.prototype.fullDescription = \".designer-section-content li .fullcontent-summary .mod-description-action\";\n\n DesignerSection.prototype.trimDescription = \".designer-section-content li .trim-summary .mod-description-action\";\n\n DesignerSection.prototype.modules = null;\n\n DesignerSection.prototype.redirectToModule = function(event) {\n let nodeName = event.target.nodeName;\n let preventionNodes = ['a', 'button', 'form'];\n let iscircle = event.target.closest('li.activity').classList.contains('circle-layout');\n let isDescription = event.target.classList.contains('mod-description-action');\n let isPadlock = event.target.classList.contains('fa-lock');\n let ispopupModule = event.target.closest('li.activity').classList.contains('popmodule');\n if ((nodeName in preventionNodes)\n || document.body.classList.contains('editing') || iscircle || isDescription || isPadlock || ispopupModule) {\n if (ispopupModule && !document.body.classList.contains('editing')) {\n if (event.target.closest(\"button[data-action='toggle-manual-completion']\") === null &&\n event.target.closest(\".mod-description-action\") === null) {\n var li = event.target.closest('li.activity');\n li.querySelector('a[href]').click();\n }\n // event.target.closest('a').click();\n }\n return null;\n }\n var card = event.target.closest(\"[data-action=go-to-url]\");\n let modurl = card.getAttribute('data-url');\n window.location.href = modurl;\n return true;\n };\n\n DesignerSection.prototype.redirectToSection = function(event) {\n let isPadlock = event.target.classList.contains('fa-lock');\n if (document.body.classList.contains('editing') || isPadlock) {\n return null;\n }\n var singlesection = event.target.closest(\"[data-action=go-to-section-url]\");\n let sectionurl = singlesection.getAttribute('data-url');\n window.location.href = sectionurl;\n return true;\n };\n\n DesignerSection.prototype.expandSection = () => {\n var sectionID = window.location.hash;\n if (sectionID) {\n var id = sectionID.substring(1);\n var section = document.getElementById(id);\n if (section) {\n var title = section.querySelector('.section-header-content');\n if (title) {\n title.classList.remove('collapsed');\n title.setAttribute('aria-expanded', true);\n }\n var content = section.querySelector('.content');\n if (content) {\n content.classList.add('show');\n }\n if (document.getElementById('section-course-accordion') !== null) {\n document.getElementById('section-head-0').classList.add('collapsed');\n document.getElementById('section-content-0').classList.remove('show');\n }\n section.scrollIntoView();\n }\n }\n };\n\n DesignerSection.prototype.fullmodcontentHandler = function(event) {\n var THIS = $(event.currentTarget);\n let fullContent = $(THIS).closest('li.activity').find('.fullcontent-summary');\n let trimcontent = $(THIS).closest('li.activity').find('.trim-summary');\n if (trimcontent.hasClass('summary-hide')) {\n trimcontent.removeClass('summary-hide');\n fullContent.addClass('summary-hide');\n }\n };\n\n DesignerSection.prototype.trimmodcontentHandler = function(event) {\n var THIS = $(event.currentTarget);\n let fullContent = $(THIS).closest('li.activity').find('.fullcontent-summary');\n let trimcontent = $(THIS).closest('li.activity').find('.trim-summary');\n if (fullContent.hasClass('summary-hide')) {\n fullContent.removeClass('summary-hide');\n trimcontent.addClass('summary-hide');\n }\n };\n\n DesignerSection.prototype.sectionRestrictHandler = function(event) {\n var sectionRestrictInfo = $(event.currentTarget).prev();\n if (sectionRestrictInfo) {\n if (!sectionRestrictInfo.hasClass('show')) {\n sectionRestrictInfo.addClass('show');\n } else {\n sectionRestrictInfo.removeClass('show');\n }\n }\n };\n\n DesignerSection.prototype.moduleHandler = function(event) {\n event.preventDefault();\n var restrictBlock = $(event.currentTarget).parents('.restrict-block');\n if (restrictBlock.length) {\n if (!restrictBlock.hasClass('show')) {\n restrictBlock.addClass('show');\n } else {\n restrictBlock.removeClass('show');\n }\n }\n };\n\n DesignerSection.prototype.updateVideoTimeInstance = function(sectionId) {\n var section = \"#\" + sectionId;\n var sectionVideotimes = \"body \"+ section + \" .activity.videotime\";\n if ($(sectionVideotimes).length == 0) {\n return;\n }\n $(sectionVideotimes).each(function(index, module) {\n this.CreateInstance(module);\n }.bind(this));\n };\n\n DesignerSection.prototype.CreateInstance = function (module) {\n if (\n $(module).find('.instancename').length\n && ($(module).find('.vimeo-embed').length\n || $(module).find('.video-js').length)\n ) {\n var cmId = module.getAttribute(\"data-id\");\n var args = {cmid : cmId};\n // Get module instance.\n var promises = Ajax.call([{\n methodname: 'format_designer_get_videotime_instace',\n args: args\n }], true);\n promises[0].then(function(data) {\n var template = JSON.parse(data);\n if (template.playertype == 'videojs') {\n var uniqueid = $(module).find('.video-js').first().attr('id').replace('vimeo-embed-', '');\n } else {\n var uniqueid = $(module).find('.vimeo-embed').first().attr('id').replace('vimeo-embed-', '');\n }\n template.uniqueid = uniqueid;\n Templates.render(template.templatename, template).then(function(html, js) {\n Templates.runTemplateJS(js);\n return true;\n }).fail(Notification.exception);\n });\n }\n };\n\n /**\n * Implementaion swith the section layout.\n * @param {object} event\n */\n DesignerSection.prototype.sectionLayoutaction = function(event) {\n var self = this;\n let sectionId = event.target.closest('li.section').getAttribute('id');\n var iconBlock = \"#\" + sectionId + \" \" + self.loadingElement;\n var layout = $(event.currentTarget).data('value');\n var layouttext = $(event.currentTarget).text();\n $(event.target).parents(\".dropdown\").find(\".btn\").html(layouttext);\n $(event.target).parents(\".dropdown\").find(\".btn\").val(layout);\n $(event.target).parent().find(\"a.dropdown-item\").each(function() {\n $(this).removeClass('active');\n });\n $(event.target).addClass('active');\n let dataid = event.target.closest('li.section').getAttribute('data-id');\n var args = {\n courseid: self.courseId,\n sectionid: dataid,\n options: [{name: $(event.currentTarget).data('option'), value: layout}]\n };\n var promises = Ajax.call([{\n methodname: 'format_designer_set_section_options',\n args: args\n }], true);\n $.when.apply($, promises)\n .done(function() {\n const sectionpromise = Actions.refreshSection('#' + sectionId, dataid, 0);\n sectionpromise.then(() => {\n return '';\n }).catch();\n });\n Loadingicon.addIconToContainerRemoveOnCompletion(iconBlock, promises);\n // If videotime exist update the module.\n setTimeout(function() {\n if (self.videoTime) {\n self.updateVideoTimeInstance(sectionId);\n }\n }, 2000);\n };\n\n return {\n init: function(courseId, contextId, popupActivities, videoTime) {\n return new DesignerSection(courseId, contextId, popupActivities, videoTime);\n }\n };\n});\n"],"names":["define","$","Fragment","Templates","Loadingicon","Ajax","Actions","Contact","Notification","SELECTOR","ACTIVITYLI","SECTIONLI","ACTIVITYACTION","SECTIONACTIONMENU","Y","use","courseformatselector","M","course","format","get_section_selector","DesignerSection","courseId","contextId","popupActivities","videoTime","self","this","addClass","delegate","SectionController","sectionLayoutaction","bind","RestrictInfo","moduleHandler","sectionRestricted","sectionRestrictHandler","fullDescription","fullmodcontentHandler","trimDescription","trimmodcontentHandler","goToURL","redirectToModule","goToSectionURL","redirectToSection","window","onhashchange","expandSection","length","on","parents","sectionid","attr","distance","document","getElementById","offsetTop","body","scrollTop","setTimeout","scroll","removeClass","contactModal","getElementsByClassName","Array","from","forEach","element","addEventListener","e","preventDefault","undefined","currentTarget","dataset","userid","enhance","popover","prototype","moduleBlock","loadingElement","modules","event","nodeName","target","iscircle","closest","classList","contains","isDescription","isPadlock","ispopupModule","querySelector","click","modurl","getAttribute","location","href","sectionurl","sectionID","hash","id","substring","section","title","remove","setAttribute","content","add","scrollIntoView","THIS","fullContent","find","trimcontent","hasClass","sectionRestrictInfo","prev","restrictBlock","updateVideoTimeInstance","sectionId","sectionVideotimes","each","index","module","CreateInstance","args","cmid","call","methodname","then","data","template","JSON","parse","playertype","uniqueid","first","replace","render","templatename","html","js","runTemplateJS","fail","exception","iconBlock","layout","layouttext","text","val","parent","dataid","courseid","options","name","value","promises","when","apply","done","refreshSection","catch","addIconToContainerRemoveOnCompletion","init"],"mappings":";;;;;;;AAuBCA,0CAAO,CAAC,SAAU,gBAAiB,iBAAkB,mBAAoB,YACtE,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lib.php +++ b/lib.php @@ -2030,6 +2030,7 @@ function format_designer_extend_navigation_course($navigation, $course, $context $designerpro = 0; $prerequisitebnewtab = 0; + $courseprerequisitepos = 0; if (format_designer_has_pro()) { $course = course_get_format($course->id)->get_course(); $prerequisitebnewtab = $course->prerequisitesnewtab; diff --git a/styles.css b/styles.css index 7fc45ab..b7fe432 100644 --- a/styles.css +++ b/styles.css @@ -518,9 +518,9 @@ body.format-designer.editing ul.designer .section .circles-layout .activity .edi left: 0; z-index: -1; } -.format-designer .course-content ul.designer.course-type-flow li.section.main .section-background-style.section-design-whole { +/* .format-designer .course-content ul.designer.course-type-flow li.section.main .section-background-style.section-design-whole { z-index: 0; -} +} */ .format-designer .course-content ul.designer li.section.main .section-background-style.section-design-whole .mask-inner-section, .format-designer .course-content ul.designer li.section .section-header-content @@ -633,7 +633,7 @@ span.section-collapse-icon:before, span.section-collapse-icon:before { content: '\f107'; width: 20px; - font-family: 'FontAwesome'; + font-family: var(--fa-style-family,"Font Awesome 6 Free"); font-size: 24px; font-weight: bold; line-height: 32px; @@ -2948,7 +2948,7 @@ body.format-designer.editing .designer .section .content .section.card-layout li margin-top: 30px; } .format-designer .course-content ul.course-type-flow.designer .section.main .section-content-wrapper { - /* display: contents; */ + display: contents; position: relative; } .format-designer .course-content ul.designer.course-type-flow li.section ul.section.img-text li.activity { diff --git a/version.php b/version.php index 5070105..54f7f31 100644 --- a/version.php +++ b/version.php @@ -24,7 +24,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2023110300; // The current plugin version (Date: YYYYMMDDXX). +$plugin->version = 2023110400; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2020061500; // Requires this Moodle version. $plugin->component = 'format_designer'; // Full name of the plugin (used for diagnostics). $plugin->release = 'Version 1.5'; From c9356d319bbf22816fb54a1e0363df00fde90983 Mon Sep 17 00:00:00 2001 From: Raja Lmsace Date: Mon, 6 Nov 2023 19:21:03 +0530 Subject: [PATCH 2/5] Moodle plugin CI style issue fixed. --- lib.php | 3 +++ styles.css | 57 +++++++++++++++++++++++++++--------------------------- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/lib.php b/lib.php index e27d960..8237f0b 100644 --- a/lib.php +++ b/lib.php @@ -1785,6 +1785,9 @@ function format_designer_editsetting_style($page) { $style .= '.format-designer .designer .section .activity .actions .menubar .dropdown .dropdown-menu {'; $style .= 'top: -50px !important;left: auto !important;right: 40px !important;transform: none !important;'; $style .= '}'; + $style .= '.format-designer .course-content ul.designer li.section .right .dropdown.designer-menu .dropdown-menu {'; + $style .= 'top: -90px !important;'; + $style .= '}'; echo html_writer::tag('style', $style, []); } } diff --git a/styles.css b/styles.css index b7fe432..a1298e2 100644 --- a/styles.css +++ b/styles.css @@ -63,9 +63,6 @@ .format-designer ul.designer .card.card-list.restricted { border-color: #ccc; } -/* .format-designer ul.designer .card-layout .card.card-list .card-body .mod-indent-outer > div { - position: relative; -} */ .format-designer ul.designer .card.card-list .card-body .mod-indent-outer .completion-info { text-align: center; margin-bottom: 5px; @@ -235,7 +232,8 @@ padding: 15px; margin-bottom: 15px; } -.format-designer .course-content .single-section-layout:not(.section-page-layout) ul.designer.course-type-normal li.section.main .section-content-wrapper { +.format-designer .course-content .single-section-layout:not(.section-page-layout) ul.designer.course-type-normal +li.section.main .section-content-wrapper { height: 100%; border: 1px solid #eee; cursor: pointer; @@ -269,14 +267,6 @@ margin: 0 0 0 10px; float: left; } -/* .format-designer .course-content ul.designer.course-type-normal li.section .section-header-content a.goto-section:after { - content: '\f061'; - font-size: 24px; - font-family: 'FontAwesome'; - text-indent: 0; - margin: 0 0 0 10px; - float: left; -} */ .format-designer #goto-top-link { z-index: 1; } @@ -292,9 +282,11 @@ body.format-designer #page.drawers .main-inner .header-maxwidth { body.format-designer.path-admin #page.drawers .main-inner .header-maxwidth { padding: 0 20px; } -.format-designer .course-content ul.designer li.section .section-content-wrapper.section-progress-info-completed .section-progress-info { +.format-designer .course-content ul.designer li.section .section-content-wrapper.section-progress-info-completed +.section-progress-info { width: auto; } + /* Section activities lists */ .format-designer .course-content ul.designer.course-type-normal li.section .section-header-content .section-summary-activities { width: 80%; @@ -302,7 +294,8 @@ body.format-designer.path-admin #page.drawers .main-inner .header-maxwidth { display: inline-flex; flex-wrap: wrap; } -.format-designer .course-content ul.designer.course-type-normal li.section .section-header-content .section-summary-activities .img-element { +.format-designer .course-content ul.designer.course-type-normal li.section .section-header-content +.section-summary-activities .img-element { width: 40px; height: 40px; line-height: 35px; @@ -313,10 +306,12 @@ body.format-designer.path-admin #page.drawers .main-inner .header-maxwidth { margin-bottom: 10px; position: relative; } -.format-designer .course-content ul.designer.course-type-normal li.section .section-header-content .section-summary-activities .img-element img { +.format-designer .course-content ul.designer.course-type-normal li.section .section-header-content +.section-summary-activities .img-element img { width: 16px; } -.format-designer .course-content ul.designer.course-type-normal li.section .section-header-content .section-summary-activities .img-element .activity-count { +.format-designer .course-content ul.designer.course-type-normal li.section .section-header-content +.section-summary-activities .img-element .activity-count { width: 20px; height: 20px; line-height: 20px; @@ -518,9 +513,6 @@ body.format-designer.editing ul.designer .section .circles-layout .activity .edi left: 0; z-index: -1; } -/* .format-designer .course-content ul.designer.course-type-flow li.section.main .section-background-style.section-design-whole { - z-index: 0; -} */ .format-designer .course-content ul.designer li.section.main .section-background-style.section-design-whole .mask-inner-section, .format-designer .course-content ul.designer li.section .section-header-content @@ -633,7 +625,8 @@ span.section-collapse-icon:before, span.section-collapse-icon:before { content: '\f107'; width: 20px; - font-family: var(--fa-style-family,"Font Awesome 6 Free"); + font-family: var(--fa-style-family, "Font Awesome 6 Free"); + font-weight: var(--fa-style, 900); font-size: 24px; font-weight: bold; line-height: 32px; @@ -1219,7 +1212,8 @@ span.section-collapse-icon:before { .format-designer .designer .section .content .section.link-layout li.activity .mod-indent-outer .activityinstance .activitytitle { z-index: 0; } -.format-designer .designer .section .content .section.link-layout li.activity .mod-indent-outer .activityinstance .activitytitle .img-element { +.format-designer .designer .section .content .section.link-layout li.activity .mod-indent-outer .activityinstance +.activitytitle .img-element { margin-top: 22px; } .format-designer.editing .designer .section .content .section.link-layout li.activity .mod-indent-outer { @@ -2173,7 +2167,8 @@ body.format-designer.editing .designer .section .content .section.card-layout li } .format-designer .course-info-block .carousel .carousel-control:before { content: '\f104'; - font-family: fontawesome; + font-family: var(--fa-style-family, "Font Awesome 6 Free"); + font-weight: var(--fa-style, 900); color: #fff; } .format-designer .course-info-block .carousel .carousel-control-next:before { @@ -2279,7 +2274,7 @@ body.format-designer.editing .designer .section .content .section.card-layout li } } -@media (min-width: 1200px) and (max-width: 1550px){ +@media (min-width: 1200px) and (max-width: 1550px) { .format-designer .course-info-block > div { width: 20%; } @@ -2944,7 +2939,6 @@ body.format-designer.editing .designer .section .content .section.card-layout li height: auto; } .format-designer .course-content ul.designer.course-type-flow { - /* display: contents; */ margin-top: 30px; } .format-designer .course-content ul.course-type-flow.designer .section.main .section-content-wrapper { @@ -2985,7 +2979,8 @@ body.format-designer.editing .designer .section .content .section.card-layout li bottom: 10px; right: 10px; } -.format-designer .course-content ul.designer.course-type-flow li.section .section-header-content .section-progress-info > div:not(.progress-donut) .progress { +.format-designer .course-content ul.designer.course-type-flow li.section .section-header-content +.section-progress-info > div:not(.progress-donut) .progress { height: 12px; background: #fff; } @@ -3157,17 +3152,20 @@ li.section.main.section-background-color:not(.section-header-image) @media (min-width: 992px) { .format-designer .course-content ul.course-type-flow.designer .section.main .section-header-content.flow-card-small, - .format-designer .course-content ul.course-type-flow.designer .section.main .section-header-content.flow-card-small.flow-stack.collapsed { + .format-designer .course-content ul.course-type-flow.designer .section.main + .section-header-content.flow-card-small.flow-stack.collapsed { width: 320px; min-height: 320px; } .format-designer .course-content ul.course-type-flow.designer .section.main .section-header-content.flow-card-medium, - .format-designer .course-content ul.course-type-flow.designer .section.main .section-header-content.flow-card-medium.flow-stack.collapsed { + .format-designer .course-content ul.course-type-flow.designer .section.main + .section-header-content.flow-card-medium.flow-stack.collapsed { width: 360px; min-height: 360px; } .format-designer .course-content ul.course-type-flow.designer .section.main .section-header-content.flow-card-large, - .format-designer .course-content ul.course-type-flow.designer .section.main .section-header-content.flow-card-large.flow-stack.collapsed { + .format-designer .course-content ul.course-type-flow.designer .section.main + .section-header-content.flow-card-large.flow-stack.collapsed { width: 400px; min-height: 400px; } @@ -3183,7 +3181,8 @@ li.section.main.section-background-color:not(.section-header-image) .format-designer .designer.course-type-flow .section .content .section.card-layout li.activity.flow-card-small .card.card-list { min-height: 320px; } - .format-designer .designer.course-type-flow .section .content .section.card-layout li.activity.flow-card-medium .card.card-list { + .format-designer .designer.course-type-flow .section .content .section.card-layout li.activity.flow-card-medium + .card.card-list { min-height: 360px; } .format-designer .designer.course-type-flow .section .content .section.card-layout li.activity.flow-card-large .card.card-list { From f307654e53e4e5943515988b726b97eb58f3fcb9 Mon Sep 17 00:00:00 2001 From: Raja Lmsace Date: Thu, 9 Nov 2023 19:39:08 +0530 Subject: [PATCH 3/5] Video time activity section icon issue fixed. Version Updated. --- classes/output/renderer.php | 4 ++-- styles.css | 12 ++++++++---- version.php | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/classes/output/renderer.php b/classes/output/renderer.php index f292758..07d0bda 100644 --- a/classes/output/renderer.php +++ b/classes/output/renderer.php @@ -849,7 +849,7 @@ public function render_section_data(section_info $section, stdClass $course, $on if ($thismod->uservisible) { if (isset($mods[$thismod->modname])) { $mods[$thismod->modname]['name'] = $thismod->modplural; - if (file_exists($CFG->dirroot.'/mod/'.$thismod->modname.'/pix/monologo.png')) { + if (file_exists($CFG->dirroot.'/mod/'.$thismod->modname.'/pix/monologo.svg')) { $mods[$thismod->modname]['activityimgsvg'] = file_get_contents($CFG->dirroot.'/mod/'.$thismod->modname. '/pix/monologo.svg'); } else if (file_exists($CFG->dirroot.'/mod/'.$thismod->modname.'/pix/icon.png')) { @@ -858,7 +858,7 @@ public function render_section_data(section_info $section, stdClass $course, $on $mods[$thismod->modname]['count']++; } else { $mods[$thismod->modname]['name'] = $thismod->modfullname; - if (file_exists($CFG->dirroot.'/mod/'.$thismod->modname.'/pix/monologo.png')) { + if (file_exists($CFG->dirroot.'/mod/'.$thismod->modname.'/pix/monologo.svg')) { $mods[$thismod->modname]['activityimgsvg'] = file_get_contents($CFG->dirroot.'/mod/'.$thismod->modname. '/pix/monologo.svg'); } else if (file_exists($CFG->dirroot.'/mod/'.$thismod->modname.'/pix/icon.png')) { diff --git a/styles.css b/styles.css index a1298e2..0a39984 100644 --- a/styles.css +++ b/styles.css @@ -311,6 +311,11 @@ body.format-designer.path-admin #page.drawers .main-inner .header-maxwidth { width: 16px; } .format-designer .course-content ul.designer.course-type-normal li.section .section-header-content +.section-summary-activities .img-element svg { + width: 24px; + height: 24px; +} +.format-designer .course-content ul.designer.course-type-normal li.section .section-header-content .section-summary-activities .img-element .activity-count { width: 20px; height: 20px; @@ -625,10 +630,9 @@ span.section-collapse-icon:before, span.section-collapse-icon:before { content: '\f107'; width: 20px; - font-family: var(--fa-style-family, "Font Awesome 6 Free"); + font-family: var(--fa-style-family, "Font Awesome 6 Free", fontawesome); font-weight: var(--fa-style, 900); font-size: 24px; - font-weight: bold; line-height: 32px; text-align: center; margin-right: 10px; @@ -2088,7 +2092,7 @@ body.format-designer.editing .designer .section .content .section.card-layout li } .format-designer .designer .section-design-whole .mod-content .trim-summary a, .format-designer .designer .section-design-header .mod-content .trim-summary a { - color: var(--sectioncolor); + /* color: var(--sectioncolor); */ cursor: zoom-in; } .format-designer .designer .section-design-whole .mod-content .fullcontent-summary a, @@ -2167,7 +2171,7 @@ body.format-designer.editing .designer .section .content .section.card-layout li } .format-designer .course-info-block .carousel .carousel-control:before { content: '\f104'; - font-family: var(--fa-style-family, "Font Awesome 6 Free"); + font-family: var(--fa-style-family, "Font Awesome 6 Free", fontawesome); font-weight: var(--fa-style, 900); color: #fff; } diff --git a/version.php b/version.php index 54f7f31..c967336 100644 --- a/version.php +++ b/version.php @@ -24,9 +24,9 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2023110400; // The current plugin version (Date: YYYYMMDDXX). +$plugin->version = 2023110900; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2020061500; // Requires this Moodle version. $plugin->component = 'format_designer'; // Full name of the plugin (used for diagnostics). $plugin->release = 'Version 1.5'; -$plugin->supported = [400, 401]; +$plugin->supported = [400, 403]; $plugin->maturity = MATURITY_STABLE; From d912abaa6f196fbebc5447f94065ea1a0ce1da93 Mon Sep 17 00:00:00 2001 From: Raja Lmsace Date: Fri, 17 Nov 2023 16:40:41 +0530 Subject: [PATCH 4/5] Version Updated. --- version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.php b/version.php index c967336..e586ab9 100644 --- a/version.php +++ b/version.php @@ -24,7 +24,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2023110900; // The current plugin version (Date: YYYYMMDDXX). +$plugin->version = 2023111700; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2020061500; // Requires this Moodle version. $plugin->component = 'format_designer'; // Full name of the plugin (used for diagnostics). $plugin->release = 'Version 1.5'; From 311ee06af812d6840e32755cfdaa342bd8591e2b Mon Sep 17 00:00:00 2001 From: "raja.lmsace@gmail.com" Date: Mon, 20 Nov 2023 18:43:28 +0530 Subject: [PATCH 5/5] Designer 1.5 plugin CI updated. --- .github/workflows/moodle-ci.yml | 12 ++++---- .../behat/activity_completion_element.feature | 4 +-- tests/behat/behat_format_designer.php | 14 +++++++++ tests/behat/course_types.feature | 2 +- tests/behat/hero_activity.feature | 30 +++++++++---------- tests/lib_test.php | 6 +++- 6 files changed, 43 insertions(+), 25 deletions(-) diff --git a/.github/workflows/moodle-ci.yml b/.github/workflows/moodle-ci.yml index 3bd1c72..92a0ddf 100644 --- a/.github/workflows/moodle-ci.yml +++ b/.github/workflows/moodle-ci.yml @@ -8,7 +8,7 @@ jobs: services: postgres: - image: postgres:12.7 + image: postgres:13 env: POSTGRES_USER: 'postgres' POSTGRES_HOST_AUTH_METHOD: 'trust' @@ -16,7 +16,7 @@ jobs: - 5432:5432 options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3 mariadb: - image: mariadb:10.5 + image: mariadb:10.6.7 env: MYSQL_USER: 'root' MYSQL_ALLOW_EMPTY_PASSWORD: "true" @@ -29,13 +29,13 @@ jobs: matrix: include: - php: '8.0' - moodle-branch: 'MOODLE_400_STABLE' + moodle-branch: 'MOODLE_403_STABLE' database: 'pgsql' - php: '8.0' - moodle-branch: 'MOODLE_400_STABLE' + moodle-branch: 'MOODLE_402_STABLE' database: 'mariadb' - - php: '7.4' - moodle-branch: 'MOODLE_400_STABLE' + - php: '8.0' + moodle-branch: 'MOODLE_401_STABLE' database: 'pgsql' - php: '7.4' moodle-branch: 'MOODLE_400_STABLE' diff --git a/tests/behat/activity_completion_element.feature b/tests/behat/activity_completion_element.feature index 7db85e6..e747f40 100644 --- a/tests/behat/activity_completion_element.feature +++ b/tests/behat/activity_completion_element.feature @@ -40,8 +40,8 @@ Feature: Sections can be check activity completion element in designer format Scenario: Check the manual mark completion the activity Given I am on the "Test assignment name" "assign activity editing" page logged in as teacher1 - And I follow "Expand all" - And I set the field "Completion tracking" to "Students can manually mark the activity as completed" + And I expand all fieldsets + And I set student complete the activity completion condition manually And I press "Save and return to course" And I log out And I log in as "student1" diff --git a/tests/behat/behat_format_designer.php b/tests/behat/behat_format_designer.php index da45118..05992eb 100644 --- a/tests/behat/behat_format_designer.php +++ b/tests/behat/behat_format_designer.php @@ -300,4 +300,18 @@ public function i_turn_block_editing_mode_on() { } } + /** + * Set the manually student complete the activity condition. + * @Given I set student complete the activity completion condition manually + */ + public function i_set_student_complete_the_activity_condition_manually() { + global $CFG; + + if ($CFG->branch == "403") { + $this->execute('behat_forms::i_set_the_field_to', ['id_completion_1', '1']); + } else { + $this->execute('behat_forms::i_set_the_field_to', + ['Completion tracking', 'Students can manually mark the activity as completed']); + } + } } diff --git a/tests/behat/course_types.feature b/tests/behat/course_types.feature index 4230fc6..eff108c 100644 --- a/tests/behat/course_types.feature +++ b/tests/behat/course_types.feature @@ -76,7 +76,7 @@ Feature: Users can choose different course types. Then I should not see "Course" in the ".secondary-navigation" "css_element" And I am on "Course 1" course homepage And I navigate to "Settings" in current page administration - And I follow "Expand all" + And I expand all fieldsets And I set the following fields to these values: | Add course to secondary menu item on all course pages | 1 | And I press "Save and display" diff --git a/tests/behat/hero_activity.feature b/tests/behat/hero_activity.feature index b1e9794..8909d09 100644 --- a/tests/behat/hero_activity.feature +++ b/tests/behat/hero_activity.feature @@ -32,14 +32,14 @@ Feature: Activities can be check hero activity in designer format And I am on "Course 1" course homepage with editing mode on And I press "Add an activity or resource" And I click on "Add a new Forum" "link" in the "Add an activity or resource" "dialogue" - And I follow "Expand all" + And I expand all fieldsets And I set the field "Forum name" to "My forum name" And I set the field "Show as tab" to "Everywhere" And I set the field "Order" to "1" And I press "Save and return to course" And I press "Add an activity or resource" And I click on "Add a new Forum" "link" in the "Add an activity or resource" "dialogue" - And I follow "Expand all" + And I expand all fieldsets And I set the field "Forum name" to "My forum name1" And I set the field "Show as tab" to "Only on course main page" And I set the field "Order" to "-1" @@ -52,7 +52,7 @@ Feature: Activities can be check hero activity in designer format Given I log in as "admin" And I am on "Course 1" course homepage with editing mode on Then I am on the "Demo assign 1" "assign activity editing" page - And I follow "Expand all" + And I expand all fieldsets And I set the following fields to these values: | Show as tab | Everywhere | | Order | 1 | @@ -81,7 +81,7 @@ Feature: Activities can be check hero activity in designer format Given I log in as "admin" And I am on "Course 1" course homepage with editing mode on Then I am on the "Demo assign 1" "assign activity editing" page - And I follow "Expand all" + And I expand all fieldsets And I set the following fields to these values: | Show as tab | Everywhere | | Order | 1 | @@ -91,14 +91,14 @@ Feature: Activities can be check hero activity in designer format Then I am on the "Demo assign 1" "assign activity" page And I should see "Demo assign 1" in the ".secondary-navigation" "css_element" Then I am on the "Demo assign 1" "assign activity editing" page - And I follow "Expand all" + And I expand all fieldsets And I set the following fields to these values: | Secondary menu title | Activity type | And I press "Save and return to course" And I should not see "Demo assign 1" in the ".secondary-navigation" "css_element" And I should see "Assignment" in the ".secondary-navigation" "css_element" Then I am on the "Demo assign 1" "assign activity editing" page - And I follow "Expand all" + And I expand all fieldsets And I set the following fields to these values: | Secondary menu title | Custom | | Custom title | Demo assign custom | @@ -107,14 +107,14 @@ Feature: Activities can be check hero activity in designer format And I should not see "Assignment" in the ".secondary-navigation" "css_element" And I should see "Demo assign custom" in the ".secondary-navigation" "css_element" Then I am on the "Demo assign 1" "assign activity editing" page - And I follow "Expand all" + And I expand all fieldsets And I set the following fields to these values: | Custom title | Demo assign (Modified)| And I press "Save and return to course" And I should not see "Demo assign custom" in the ".secondary-navigation" "css_element" And I should see "Demo assign (Modified)" in the ".secondary-navigation" "css_element" Then I am on the "Demo assign 2" "assign activity editing" page - And I follow "Expand all" + And I expand all fieldsets And I set the following fields to these values: | Show as tab | Everywhere | | Order | 1 | @@ -132,7 +132,7 @@ Feature: Activities can be check hero activity in designer format Given I log in as "admin" And I am on "Course 1" course homepage with editing mode on Then I am on the "Demo assign 1" "assign activity editing" page - And I follow "Expand all" + And I expand all fieldsets And I set the following fields to these values: | Show as tab | Everywhere | | Order | 1 | @@ -144,7 +144,7 @@ Feature: Activities can be check hero activity in designer format Then I click on ".drawer-toggler.drawer-left-toggle" "css_element" And I should not see "Demo Assign Test" in the "#courseindex-content" "css_element" Then I am on the "Demo assign 1" "assign activity editing" page - And I follow "Expand all" + And I expand all fieldsets And I set the following fields to these values: | Use custom name on course/section pages | 1 | And I press "Save and return to course" @@ -153,7 +153,7 @@ Feature: Activities can be check hero activity in designer format Then I click on ".drawer-toggler.drawer-left-toggle" "css_element" And I should not see "Demo Assign Test" in the "#courseindex-content" "css_element" Then I am on the "Demo assign 1" "assign activity editing" page - And I follow "Expand all" + And I expand all fieldsets And I set the following fields to these values: | Use custom name in course index | 1 | And I press "Save and return to course" @@ -177,7 +177,7 @@ Feature: Activities can be check hero activity in designer format And I should not see "Demo assign 3" in the ".secondary-navigation" "css_element" And I should see "General" And I navigate to "Settings" in current page administration - And I follow "Expand all" + And I expand all fieldsets And I set the following fields to these values: | Section 0 activities | Make hero activity and hide section 0 | | Show as tab | Everywhere | @@ -193,7 +193,7 @@ Feature: Activities can be check hero activity in designer format And I should not see "Demo assign 4" in the ".secondary-navigation" "css_element" And I should not see "Demo assign 5" in the ".secondary-navigation" "css_element" And I navigate to "Settings" in current page administration - And I follow "Expand all" + And I expand all fieldsets And I set the following fields to these values: | Section 0 activities | Make hero activity and hide section 0 | | Show as tab | Everywhere | @@ -204,7 +204,7 @@ Feature: Activities can be check hero activity in designer format And I should see "Demo assign 4" in the ".secondary-navigation" "css_element" And I am on "Course 1" course homepage And I navigate to "Settings" in current page administration - And I follow "Expand all" + And I expand all fieldsets And I set the following fields to these values: | Section 0 activities | Make hero activity and keep section 0 visible | Then I press "Save and display" @@ -214,7 +214,7 @@ Feature: Activities can be check hero activity in designer format And I should see "General" Then I turn editing mode on And I navigate to "Settings" in current page administration - And I follow "Expand all" + And I expand all fieldsets And I set the following fields to these values: | Section 0 activities | Disabled | Then I press "Save and display" diff --git a/tests/lib_test.php b/tests/lib_test.php index 2bad754..cb49ed2 100644 --- a/tests/lib_test.php +++ b/tests/lib_test.php @@ -171,7 +171,11 @@ public function test_update_inplace_editable() { $this->getDataGenerator()->enrol_user($user->id, $course->id, $teacherrole->id); $res = \core_external::update_inplace_editable('format_designer', 'sectionname', $section->id, 'New section name'); - $res = \external_api::clean_returnvalue(\core_external::update_inplace_editable_returns(), $res); + if (class_exists('\core_external\external_api')) { + $res = \core_external\external_api::clean_returnvalue(\core_external::update_inplace_editable_returns(), $res); + } else { + $res = \external_api::clean_returnvalue(\core_external::update_inplace_editable_returns(), $res); + } $this->assertEquals('New section name', $res['value']); $this->assertEquals('New section name', $DB->get_field('course_sections', 'name', ['id' => $section->id])); }