diff --git a/amd/build/common.min.js b/amd/build/common.min.js index 0b3e30b..e7e983c 100644 --- a/amd/build/common.min.js +++ b/amd/build/common.min.js @@ -1,2 +1,2 @@ -define(["jquery"],function(e){var n={ACTIVITY_TOGGLE:".showactivity",ACTIVITY_TOGGLE_CLASS:"showhideactivity",ACTIVITY_TOGGLE_WRAPPER:".showactivitywrapper",FIRST_SECTION:"#section-0",SHOW:"show",TOGGLE_HIGHLIGHT:".section_action_menu .dropdown-item.editing_highlight",TOGGLE_SHOWHIDE:".section_action_menu .dropdown-item.editing_showhide",BUTTON_HIDE:".cm_action_menu .dropdown-menu .editing_hide",BUTTON_SHOW:".cm_action_menu .dropdown-menu .editing_show",DELETE:'.section_action_menu .dropdown-item[data-action="deleteSection"]'};function t(){e(n.FIRST_SECTION+" .activity").length<=function(){let n=e(window).width();return e(".remui-format-list").length?n>=992?4:n>=768?3:2:n>=768?4:n>=481?2:1}()?(e(n.FIRST_SECTION).removeClass(n.ACTIVITY_TOGGLE_CLASS),e(n.ACTIVITY_TOGGLE_WRAPPER).hide()):(e(n.ACTIVITY_TOGGLE_WRAPPER).show(),e(n.FIRST_SECTION).addClass(n.ACTIVITY_TOGGLE_CLASS))}return{init:function(){e("#page-course-view-remuiformat .section-modchooser-link").addClass("btn btn-primary"),t(),e(window).resize(function(){t()}),"none"==e(".general-section-activities li:last").css("display")?e(".showactivitywrapper").show():e(".showactivitywrapper").hide(),e(n.ACTIVITY_TOGGLE).on("click",function(){e(this).hasClass(n.SHOW)?(e(this).html(M.util.get_string("showless","format_remuiformat")),e(this).toggleClass(n.SHOW)):(e(this).html(M.util.get_string("showmore","format_remuiformat")),e(this).toggleClass(n.SHOW),e("html, body").animate({scrollTop:e(n.FIRST_SECTION+" .activity:first-child").offset().top-66},"slow")),e(n.FIRST_SECTION).toggleClass(n.ACTIVITY_TOGGLE_CLASS)}),e("body").on("click",`${n.TOGGLE_HIGHLIGHT},\n ${n.TOGGLE_SHOWHIDE},\n ${n.BUTTON_HIDE},\n ${n.BUTTON_SHOW}`,function(){setTimeout(function(){location.reload()},400)}),e("body").on("click",`${n.DELETE}`,function(n){return n.preventDefault(),window.location.href=e(this).attr("href"),!0}),e(".read-more-target").height()>300&&(e(".generalsectioninfo").find("#readmorebtn").removeClass("d-none"),e(".read-more-target").addClass("summary-collapsed").removeClass("summary-expanded")),e("#readmorebtn").on("click",function(){e(".read-more-target").addClass("summary-expanded").removeClass("summary-collapsed"),e(".generalsectioninfo").find("#readmorebtn").addClass("d-none"),e(".generalsectioninfo").find("#readlessbtn").removeClass("d-none")}),e("#readlessbtn").on("click",function(){e(".read-more-target").addClass("summary-collapsed").removeClass("summary-expanded"),e(".generalsectioninfo").find("#readmorebtn").removeClass("d-none"),e(".generalsectioninfo").find("#readlessbtn").addClass("d-none")})},adjustGeneralSectionActivities:t}}); +define(["jquery"],function(e){var t={ACTIVITY_TOGGLE:".showactivity",ACTIVITY_TOGGLE_CLASS:"showhideactivity",ACTIVITY_TOGGLE_WRAPPER:".showactivitywrapper",FIRST_SECTION:"#section-0",SHOW:"show",TOGGLE_HIGHLIGHT:".section_action_menu .dropdown-item.editing_highlight",TOGGLE_SHOWHIDE:".section_action_menu .dropdown-item.editing_showhide",DELETE:".section_action_menu .dropdown-item.editing_delete",BUTTON_HIDE:".cm_action_menu .dropdown-menu .editing_hide",BUTTON_SHOW:".cm_action_menu .dropdown-menu .editing_show",ACTIVITYBUTTON_HIDE:'.cm_action_menu .dropdown-menu [data-action="cmHide"]',ACTIVITYBUTTON_SHOW:'.cm_action_menu .dropdown-menu [data-action="cmShow"]',ACTIVITYDUPLICATE:".cm_action_menu .dropdown-item.editing_duplicate",ACTIVITIYDELETE:".cm_action_menu .dropdown-item.editing_delete"};function n(){e(t.FIRST_SECTION+" .activity").length<=function(){let t=e(window).width();return e(".remui-format-list").length?t>=992?4:t>=768?3:2:t>=768?4:t>=481?2:1}()?(e(t.FIRST_SECTION).removeClass(t.ACTIVITY_TOGGLE_CLASS),e(t.ACTIVITY_TOGGLE_WRAPPER).hide()):(e(t.ACTIVITY_TOGGLE_WRAPPER).show(),e(t.FIRST_SECTION).addClass(t.ACTIVITY_TOGGLE_CLASS))}return{init:function(){e("#page-course-view-remuiformat .section-modchooser-link:not(.dropdown-item)").addClass("btn btn-primary"),n(),e(window).resize(function(){n()}),"none"==e(".general-section-activities li:last").css("display")?e(".showactivitywrapper").show():e(".showactivitywrapper").hide(),e(t.ACTIVITY_TOGGLE).on("click",function(){e(this).hasClass(t.SHOW)?(e(this).html(M.util.get_string("showless","format_remuiformat")),e(this).toggleClass(t.SHOW)):(e(this).html(M.util.get_string("showmore","format_remuiformat")),e(this).toggleClass(t.SHOW),e("html, body").animate({scrollTop:e(t.FIRST_SECTION+" .activity:first-child").offset().top-66},"slow")),e(t.FIRST_SECTION).toggleClass(t.ACTIVITY_TOGGLE_CLASS)}),e("body").on("click",`${t.TOGGLE_HIGHLIGHT},\n ${t.TOGGLE_SHOWHIDE},\n ${t.BUTTON_HIDE},\n ${t.BUTTON_SHOW},\n ${t.ACTIVITYBUTTON_HIDE},\n ${t.ACTIVITYBUTTON_SHOW}`,function(){setTimeout(function(){location.reload()},400)}),e("body").on("click",`${t.ACTIVITYDUPLICATE}`,function(){setTimeout(function(){location.reload()},200)}),e("body").on("click",`${t.ACTIVITIYDELETE},${t.DELETE}`,function(t){return t.preventDefault(),"cmDelete"==e(this).attr("data-action")&&(window.location.href=e(this).attr("href")),"deleteSection"==e(this).attr("data-action")&&(moodleversionbranch>="405"?location.reload():window.location.href=e(this).attr("href")),!0}),e("body").on("click",'[data-action="addModule"]',function(e){return setTimeout(()=>{location.reload()},200),!0}),e(".read-more-target").height()>300&&(e(".generalsectioninfo").find("#readmorebtn").removeClass("d-none"),e(".read-more-target").addClass("summary-collapsed").removeClass("summary-expanded")),e("#readmorebtn").on("click",function(){e(".read-more-target").addClass("summary-expanded").removeClass("summary-collapsed"),e(".generalsectioninfo").find("#readmorebtn").addClass("d-none"),e(".generalsectioninfo").find("#readlessbtn").removeClass("d-none")}),e("#readlessbtn").on("click",function(){e(".read-more-target").addClass("summary-collapsed").removeClass("summary-expanded"),e(".generalsectioninfo").find("#readmorebtn").removeClass("d-none"),e(".generalsectioninfo").find("#readlessbtn").addClass("d-none")})},adjustGeneralSectionActivities:n}}); //# sourceMappingURL=common.min.js.map diff --git a/amd/build/common.min.js.map b/amd/build/common.min.js.map index 6aecd5b..65f6d95 100644 --- a/amd/build/common.min.js.map +++ b/amd/build/common.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["common.js"],"names":["define","$","SELECTORS","ACTIVITY_TOGGLE","ACTIVITY_TOGGLE_CLASS","ACTIVITY_TOGGLE_WRAPPER","FIRST_SECTION","SHOW","TOGGLE_HIGHLIGHT","TOGGLE_SHOWHIDE","BUTTON_HIDE","BUTTON_SHOW","DELETE","adjustGeneralSectionActivities","length","width","window","getActivitiesPerRow","removeClass","hide","show","addClass","init","resize","css","on","this","hasClass","html","M","util","get_string","toggleClass","animate","scrollTop","offset","top","setTimeout","location","reload","event","preventDefault","href","attr","height","find"],"mappings":"AAuBAA,OAAO,CAAC,UAAW,SAASC,GAExB,IAAIC,EAAY,CACZC,gBAAiB,gBACjBC,sBAAuB,mBACvBC,wBAAyB,uBACzBC,cAAe,aACfC,KAAM,OACNC,iBAAkB,wDAClBC,gBAAiB,uDACjBC,YAAa,+CACbC,YAAa,+CACbC,OAAQ,oEA+BZ,SAASC,IACDZ,EAAEC,EAAUI,cAAgB,cAAcQ,QAzBlD,WACI,IAAIC,EAAQd,EAAEe,QAAQD,QACtB,OAAId,EAAE,sBAAsBa,OACpBC,GAAS,IACF,EAEPA,GAAS,IACF,EAEJ,EAEHA,GAAS,IACF,EAEPA,GAAS,IACF,EAEJ,EAQ6CE,IACpDhB,EAAEC,EAAUI,eAAeY,YAAYhB,EAAUE,uBACjDH,EAAEC,EAAUG,yBAAyBc,SAErClB,EAAEC,EAAUG,yBAAyBe,OACrCnB,EAAEC,EAAUI,eAAee,SAASnB,EAAUE,wBA0EtD,MAAO,CACHkB,KApEJ,WAEIrB,EAAE,0DAA0DoB,SAAS,mBAErER,IACAZ,EAAEe,QAAQO,OAAO,WACbV,MAG2D,QAA3DZ,EAAE,uCAAuCuB,IAAI,WAC7CvB,EAAE,wBAAwBmB,OAE1BnB,EAAE,wBAAwBkB,OAG9BlB,EAAEC,EAAUC,iBAAiBsB,GAAG,QAAS,WAEjCxB,EAAEyB,MAAMC,SAASzB,EAAUK,OAC3BN,EAAEyB,MAAME,KAAKC,EAAEC,KAAKC,WAAW,WAAY,uBAC3C9B,EAAEyB,MAAMM,YAAY9B,EAAUK,QAE9BN,EAAEyB,MAAME,KAAKC,EAAEC,KAAKC,WAAW,WAAY,uBAC3C9B,EAAEyB,MAAMM,YAAY9B,EAAUK,MAC9BN,EAAE,cAAcgC,QAAQ,CACpBC,UAAWjC,EAAEC,EAAUI,cAAgB,0BAA0B6B,SAASC,IAAM,IACjF,SAEPnC,EAAEC,EAAUI,eAAe0B,YAAY9B,EAAUE,yBAIrDH,EAAE,QAAQwB,GAAG,WAAYvB,EAAUM,qDACVN,EAAUO,oDACVP,EAAUQ,gDACVR,EAAUS,cAAe,WAC9C0B,WAAW,WACPC,SAASC,UACV,OAIPtC,EAAE,QAAQwB,GAAG,WAAYvB,EAAUU,SAAU,SAAS4B,GAGlD,OAFAA,EAAMC,iBACNzB,OAAOsB,SAASI,KAAOzC,EAAEyB,MAAMiB,KAAK,SAC7B,IAIS1C,EAAE,qBAAqB2C,SAEvB,MAChB3C,EAAE,uBAAuB4C,KAAK,gBAAgB3B,YAAY,UAC1DjB,EAAE,qBAAqBoB,SAAS,qBAAqBH,YAAY,qBAErEjB,EAAE,gBAAgBwB,GAAG,QAAS,WAC1BxB,EAAE,qBAAqBoB,SAAS,oBAAoBH,YAAY,qBAChEjB,EAAE,uBAAuB4C,KAAK,gBAAgBxB,SAAS,UACvDpB,EAAE,uBAAuB4C,KAAK,gBAAgB3B,YAAY,YAE9DjB,EAAE,gBAAgBwB,GAAG,QAAS,WAC1BxB,EAAE,qBAAqBoB,SAAS,qBAAqBH,YAAY,oBACjEjB,EAAE,uBAAuB4C,KAAK,gBAAgB3B,YAAY,UAC1DjB,EAAE,uBAAuB4C,KAAK,gBAAgBxB,SAAS,aAO3DR,+BAAgCA","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 * Enhancements to Lists components for easy course accessibility.\n *\n * @module format/remuiformat\n * @copyright WisdmLabs\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery'], function($) {\n\n var SELECTORS = {\n ACTIVITY_TOGGLE: '.showactivity',\n ACTIVITY_TOGGLE_CLASS: 'showhideactivity',\n ACTIVITY_TOGGLE_WRAPPER: '.showactivitywrapper',\n FIRST_SECTION: '#section-0',\n SHOW: 'show',\n TOGGLE_HIGHLIGHT: '.section_action_menu .dropdown-item.editing_highlight',\n TOGGLE_SHOWHIDE: '.section_action_menu .dropdown-item.editing_showhide',\n BUTTON_HIDE: '.cm_action_menu .dropdown-menu .editing_hide',\n BUTTON_SHOW: '.cm_action_menu .dropdown-menu .editing_show',\n DELETE: '.section_action_menu .dropdown-item[data-action=\"deleteSection\"]'\n };\n\n /**\n * Get number activities can be shown in first row and hide rest\n * @return {Integer} Number activities in first row\n */\n function getActivitiesPerRow() {\n let width = $(window).width();\n if ($('.remui-format-list').length) {\n if (width >= 992) {\n return 4;\n }\n if (width >= 768) {\n return 3;\n }\n return 2;\n } else {\n if (width >= 768) {\n return 4;\n }\n if (width >= 481) {\n return 2;\n }\n return 1;\n }\n }\n\n /**\n * Adjust the general section activities visibility after first row\n */\n function adjustGeneralSectionActivities() {\n if ($(SELECTORS.FIRST_SECTION + ' .activity').length <= getActivitiesPerRow()) {\n $(SELECTORS.FIRST_SECTION).removeClass(SELECTORS.ACTIVITY_TOGGLE_CLASS);\n $(SELECTORS.ACTIVITY_TOGGLE_WRAPPER).hide();\n } else {\n $(SELECTORS.ACTIVITY_TOGGLE_WRAPPER).show();\n $(SELECTORS.FIRST_SECTION).addClass(SELECTORS.ACTIVITY_TOGGLE_CLASS);\n }\n }\n /**\n * Init method\n *\n */\n function init() {\n\n $('#page-course-view-remuiformat .section-modchooser-link').addClass(\"btn btn-primary\");\n\n adjustGeneralSectionActivities();\n $(window).resize(function() {\n adjustGeneralSectionActivities();\n });\n\n if ($(\".general-section-activities li:last\").css('display') == 'none') {\n $(\".showactivitywrapper\").show();\n } else {\n $(\".showactivitywrapper\").hide();\n }\n\n $(SELECTORS.ACTIVITY_TOGGLE).on('click', function() {\n\n if ($(this).hasClass(SELECTORS.SHOW)) {\n $(this).html(M.util.get_string('showless', 'format_remuiformat'));\n $(this).toggleClass(SELECTORS.SHOW); // Remove show class\n } else {\n $(this).html(M.util.get_string('showmore', 'format_remuiformat'));\n $(this).toggleClass(SELECTORS.SHOW); // Add show class\n $(\"html, body\").animate({\n scrollTop: $(SELECTORS.FIRST_SECTION + ' .activity:first-child').offset().top - 66\n }, \"slow\");\n }\n $(SELECTORS.FIRST_SECTION).toggleClass(SELECTORS.ACTIVITY_TOGGLE_CLASS);\n });\n\n // Handling highlight and show hide dropdown.\n $('body').on('click', `${SELECTORS.TOGGLE_HIGHLIGHT},\n ${SELECTORS.TOGGLE_SHOWHIDE},\n ${SELECTORS.BUTTON_HIDE},\n ${SELECTORS.BUTTON_SHOW}`, function() {\n setTimeout(function() {\n location.reload();\n }, 400);\n });\n\n // Handling deleteAction\n $('body').on('click', `${SELECTORS.DELETE}`, function(event) {\n event.preventDefault();\n window.location.href = $(this).attr('href');\n return true;\n });\n\n\n var summaryheight = $('.read-more-target').height();\n\n if (summaryheight > 300) {\n $('.generalsectioninfo').find('#readmorebtn').removeClass('d-none');\n $('.read-more-target').addClass('summary-collapsed').removeClass('summary-expanded');\n }\n $('#readmorebtn').on('click', function() {\n $('.read-more-target').addClass('summary-expanded').removeClass('summary-collapsed');\n $('.generalsectioninfo').find('#readmorebtn').addClass('d-none');\n $('.generalsectioninfo').find('#readlessbtn').removeClass('d-none');\n });\n $('#readlessbtn').on('click', function () {\n $('.read-more-target').addClass('summary-collapsed').removeClass('summary-expanded');\n $('.generalsectioninfo').find('#readmorebtn').removeClass('d-none');\n $('.generalsectioninfo').find('#readlessbtn').addClass('d-none');\n });\n\n }\n\n return {\n init: init,\n adjustGeneralSectionActivities: adjustGeneralSectionActivities\n };\n});\n"],"file":"common.min.js"} \ No newline at end of file +{"version":3,"sources":["common.js"],"names":["define","$","SELECTORS","ACTIVITY_TOGGLE","ACTIVITY_TOGGLE_CLASS","ACTIVITY_TOGGLE_WRAPPER","FIRST_SECTION","SHOW","TOGGLE_HIGHLIGHT","TOGGLE_SHOWHIDE","DELETE","BUTTON_HIDE","BUTTON_SHOW","ACTIVITYBUTTON_HIDE","ACTIVITYBUTTON_SHOW","ACTIVITYDUPLICATE","ACTIVITIYDELETE","adjustGeneralSectionActivities","length","width","window","getActivitiesPerRow","removeClass","hide","show","addClass","init","resize","css","on","this","hasClass","html","M","util","get_string","toggleClass","animate","scrollTop","offset","top","setTimeout","location","reload","event","preventDefault","attr","href","moodleversionbranch","height","find"],"mappings":"AAuBAA,OAAO,CAAC,UAAW,SAASC,GAExB,IAAIC,EAAY,CACZC,gBAAiB,gBACjBC,sBAAuB,mBACvBC,wBAAyB,uBACzBC,cAAe,aACfC,KAAM,OACNC,iBAAkB,wDAClBC,gBAAiB,uDACjBC,OAAQ,qDACRC,YAAa,+CACbC,YAAa,+CACbC,oBAAqB,wDACrBC,oBAAqB,wDACrBC,kBAAmB,mDACnBC,gBAAiB,kDA+BrB,SAASC,IACDhB,EAAEC,EAAUI,cAAgB,cAAcY,QAzBlD,WACI,IAAIC,EAAQlB,EAAEmB,QAAQD,QACtB,OAAIlB,EAAE,sBAAsBiB,OACpBC,GAAS,IACF,EAEPA,GAAS,IACF,EAEJ,EAEHA,GAAS,IACF,EAEPA,GAAS,IACF,EAEJ,EAQ6CE,IACpDpB,EAAEC,EAAUI,eAAegB,YAAYpB,EAAUE,uBACjDH,EAAEC,EAAUG,yBAAyBkB,SAErCtB,EAAEC,EAAUG,yBAAyBmB,OACrCvB,EAAEC,EAAUI,eAAemB,SAASvB,EAAUE,wBAwGtD,MAAO,CACHsB,KAlGJ,WAEIzB,EAAE,8EAA8EwB,SAAS,mBAGzFR,IACAhB,EAAEmB,QAAQO,OAAO,WACbV,MAG2D,QAA3DhB,EAAE,uCAAuC2B,IAAI,WAC7C3B,EAAE,wBAAwBuB,OAE1BvB,EAAE,wBAAwBsB,OAG9BtB,EAAEC,EAAUC,iBAAiB0B,GAAG,QAAS,WAEjC5B,EAAE6B,MAAMC,SAAS7B,EAAUK,OAC3BN,EAAE6B,MAAME,KAAKC,EAAEC,KAAKC,WAAW,WAAY,uBAC3ClC,EAAE6B,MAAMM,YAAYlC,EAAUK,QAE9BN,EAAE6B,MAAME,KAAKC,EAAEC,KAAKC,WAAW,WAAY,uBAC3ClC,EAAE6B,MAAMM,YAAYlC,EAAUK,MAC9BN,EAAE,cAAcoC,QAAQ,CACpBC,UAAWrC,EAAEC,EAAUI,cAAgB,0BAA0BiC,SAASC,IAAM,IACjF,SAEPvC,EAAEC,EAAUI,eAAe8B,YAAYlC,EAAUE,yBAIrDH,EAAE,QAAQ4B,GAAG,WAAY3B,EAAUM,qDACVN,EAAUO,oDACVP,EAAUS,gDACVT,EAAUU,gDACVV,EAAUW,wDACVX,EAAUY,sBAAuB,WACtD2B,WAAW,WACPC,SAASC,UACV,OAIP1C,EAAE,QAAQ4B,GAAG,WAAY3B,EAAUa,oBAAqB,WACpD0B,WAAW,WACPC,SAASC,UACV,OAIP1C,EAAE,QAAQ4B,GAAG,WAAY3B,EAAUc,mBAAmBd,EAAUQ,SAAU,SAASkC,GAgB/E,OAfAA,EAAMC,iBAE4B,YAA/B5C,EAAE6B,MAAMgB,KAAK,iBACZ1B,OAAOsB,SAASK,KAAO9C,EAAE6B,MAAMgB,KAAK,SAGN,iBAA/B7C,EAAE6B,MAAMgB,KAAK,iBACTE,qBAAuB,MACtBN,SAASC,SAETvB,OAAOsB,SAASK,KAAO9C,EAAE6B,MAAMgB,KAAK,UAKrC,IAIX7C,EAAE,QAAQ4B,GAAG,QAAS,4BAA6B,SAASe,GAIxD,OAHAH,WAAW,KACPC,SAASC,UACV,MACI,IAGS1C,EAAE,qBAAqBgD,SAEvB,MAChBhD,EAAE,uBAAuBiD,KAAK,gBAAgB5B,YAAY,UAC1DrB,EAAE,qBAAqBwB,SAAS,qBAAqBH,YAAY,qBAErErB,EAAE,gBAAgB4B,GAAG,QAAS,WAC1B5B,EAAE,qBAAqBwB,SAAS,oBAAoBH,YAAY,qBAChErB,EAAE,uBAAuBiD,KAAK,gBAAgBzB,SAAS,UACvDxB,EAAE,uBAAuBiD,KAAK,gBAAgB5B,YAAY,YAE9DrB,EAAE,gBAAgB4B,GAAG,QAAS,WAC1B5B,EAAE,qBAAqBwB,SAAS,qBAAqBH,YAAY,oBACjErB,EAAE,uBAAuBiD,KAAK,gBAAgB5B,YAAY,UAC1DrB,EAAE,uBAAuBiD,KAAK,gBAAgBzB,SAAS,aAO3DR,+BAAgCA","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 * Enhancements to Lists components for easy course accessibility.\n *\n * @module format/remuiformat\n * @copyright WisdmLabs\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery'], function($) {\n\n var SELECTORS = {\n ACTIVITY_TOGGLE: '.showactivity',\n ACTIVITY_TOGGLE_CLASS: 'showhideactivity',\n ACTIVITY_TOGGLE_WRAPPER: '.showactivitywrapper',\n FIRST_SECTION: '#section-0',\n SHOW: 'show',\n TOGGLE_HIGHLIGHT: '.section_action_menu .dropdown-item.editing_highlight',\n TOGGLE_SHOWHIDE: '.section_action_menu .dropdown-item.editing_showhide',\n DELETE: '.section_action_menu .dropdown-item.editing_delete',\n BUTTON_HIDE: '.cm_action_menu .dropdown-menu .editing_hide',\n BUTTON_SHOW: '.cm_action_menu .dropdown-menu .editing_show',\n ACTIVITYBUTTON_HIDE: '.cm_action_menu .dropdown-menu [data-action=\"cmHide\"]',\n ACTIVITYBUTTON_SHOW: '.cm_action_menu .dropdown-menu [data-action=\"cmShow\"]',\n ACTIVITYDUPLICATE: '.cm_action_menu .dropdown-item.editing_duplicate',\n ACTIVITIYDELETE: '.cm_action_menu .dropdown-item.editing_delete'\n };\n\n /**\n * Get number activities can be shown in first row and hide rest\n * @return {Integer} Number activities in first row\n */\n function getActivitiesPerRow() {\n let width = $(window).width();\n if ($('.remui-format-list').length) {\n if (width >= 992) {\n return 4;\n }\n if (width >= 768) {\n return 3;\n }\n return 2;\n } else {\n if (width >= 768) {\n return 4;\n }\n if (width >= 481) {\n return 2;\n }\n return 1;\n }\n }\n\n /**\n * Adjust the general section activities visibility after first row\n */\n function adjustGeneralSectionActivities() {\n if ($(SELECTORS.FIRST_SECTION + ' .activity').length <= getActivitiesPerRow()) {\n $(SELECTORS.FIRST_SECTION).removeClass(SELECTORS.ACTIVITY_TOGGLE_CLASS);\n $(SELECTORS.ACTIVITY_TOGGLE_WRAPPER).hide();\n } else {\n $(SELECTORS.ACTIVITY_TOGGLE_WRAPPER).show();\n $(SELECTORS.FIRST_SECTION).addClass(SELECTORS.ACTIVITY_TOGGLE_CLASS);\n }\n }\n /**\n * Init method\n *\n */\n function init() {\n\n $('#page-course-view-remuiformat .section-modchooser-link:not(.dropdown-item)').addClass(\"btn btn-primary\");\n\n\n adjustGeneralSectionActivities();\n $(window).resize(function() {\n adjustGeneralSectionActivities();\n });\n\n if ($(\".general-section-activities li:last\").css('display') == 'none') {\n $(\".showactivitywrapper\").show();\n } else {\n $(\".showactivitywrapper\").hide();\n }\n\n $(SELECTORS.ACTIVITY_TOGGLE).on('click', function() {\n\n if ($(this).hasClass(SELECTORS.SHOW)) {\n $(this).html(M.util.get_string('showless', 'format_remuiformat'));\n $(this).toggleClass(SELECTORS.SHOW); // Remove show class\n } else {\n $(this).html(M.util.get_string('showmore', 'format_remuiformat'));\n $(this).toggleClass(SELECTORS.SHOW); // Add show class\n $(\"html, body\").animate({\n scrollTop: $(SELECTORS.FIRST_SECTION + ' .activity:first-child').offset().top - 66\n }, \"slow\");\n }\n $(SELECTORS.FIRST_SECTION).toggleClass(SELECTORS.ACTIVITY_TOGGLE_CLASS);\n });\n\n // Handling highlight and show hide dropdown.\n $('body').on('click', `${SELECTORS.TOGGLE_HIGHLIGHT},\n ${SELECTORS.TOGGLE_SHOWHIDE},\n ${SELECTORS.BUTTON_HIDE},\n ${SELECTORS.BUTTON_SHOW},\n ${SELECTORS.ACTIVITYBUTTON_HIDE},\n ${SELECTORS.ACTIVITYBUTTON_SHOW}`, function() {\n setTimeout(function() {\n location.reload();\n }, 400);\n });\n\n // Handling activity duplicate.\n $('body').on('click', `${SELECTORS.ACTIVITYDUPLICATE}`, function() {\n setTimeout(function() {\n location.reload();\n }, 200);\n });\n\n // Handling deleteAction\n $('body').on('click', `${SELECTORS.ACTIVITIYDELETE},${SELECTORS.DELETE}`, function(event) {\n event.preventDefault();\n\n if($(this).attr('data-action') == 'cmDelete' ){\n window.location.href = $(this).attr('href');\n }\n\n if($(this).attr('data-action') == 'deleteSection' ){\n if(moodleversionbranch >= '405'){\n location.reload();\n }else{\n window.location.href = $(this).attr('href');\n }\n }\n\n\n return true;\n });\n\n // Handling addSubsection\n $('body').on('click', '[data-action=\"addModule\"]', function(event) {\n setTimeout(() => {\n location.reload();\n }, 200);\n return true;\n });\n\n var summaryheight = $('.read-more-target').height();\n\n if (summaryheight > 300) {\n $('.generalsectioninfo').find('#readmorebtn').removeClass('d-none');\n $('.read-more-target').addClass('summary-collapsed').removeClass('summary-expanded');\n }\n $('#readmorebtn').on('click', function() {\n $('.read-more-target').addClass('summary-expanded').removeClass('summary-collapsed');\n $('.generalsectioninfo').find('#readmorebtn').addClass('d-none');\n $('.generalsectioninfo').find('#readlessbtn').removeClass('d-none');\n });\n $('#readlessbtn').on('click', function () {\n $('.read-more-target').addClass('summary-collapsed').removeClass('summary-expanded');\n $('.generalsectioninfo').find('#readmorebtn').removeClass('d-none');\n $('.generalsectioninfo').find('#readlessbtn').addClass('d-none');\n });\n\n }\n\n return {\n init: init,\n adjustGeneralSectionActivities: adjustGeneralSectionActivities\n };\n});\n"],"file":"common.min.js"} \ No newline at end of file diff --git a/amd/src/common.js b/amd/src/common.js index fafbd46..de5d292 100644 --- a/amd/src/common.js +++ b/amd/src/common.js @@ -31,9 +31,13 @@ define(['jquery'], function($) { SHOW: 'show', TOGGLE_HIGHLIGHT: '.section_action_menu .dropdown-item.editing_highlight', TOGGLE_SHOWHIDE: '.section_action_menu .dropdown-item.editing_showhide', + DELETE: '.section_action_menu .dropdown-item.editing_delete', BUTTON_HIDE: '.cm_action_menu .dropdown-menu .editing_hide', BUTTON_SHOW: '.cm_action_menu .dropdown-menu .editing_show', - DELETE: '.section_action_menu .dropdown-item[data-action="deleteSection"]' + ACTIVITYBUTTON_HIDE: '.cm_action_menu .dropdown-menu [data-action="cmHide"]', + ACTIVITYBUTTON_SHOW: '.cm_action_menu .dropdown-menu [data-action="cmShow"]', + ACTIVITYDUPLICATE: '.cm_action_menu .dropdown-item.editing_duplicate', + ACTIVITIYDELETE: '.cm_action_menu .dropdown-item.editing_delete' }; /** @@ -79,7 +83,7 @@ define(['jquery'], function($) { */ function init() { - $('#page-course-view-remuiformat .section-modchooser-link').addClass("btn btn-primary"); + $('#page-course-view-remuiformat .section-modchooser-link:not(.dropdown-item)').addClass("btn btn-primary"); adjustGeneralSectionActivities(); $(window).resize(function() { @@ -111,19 +115,44 @@ define(['jquery'], function($) { $('body').on('click', `${SELECTORS.TOGGLE_HIGHLIGHT}, ${SELECTORS.TOGGLE_SHOWHIDE}, ${SELECTORS.BUTTON_HIDE}, - ${SELECTORS.BUTTON_SHOW}`, function() { + ${SELECTORS.BUTTON_SHOW}, + ${SELECTORS.ACTIVITYBUTTON_HIDE}, + ${SELECTORS.ACTIVITYBUTTON_SHOW}`, function() { setTimeout(function() { location.reload(); }, 400); }); + // Handling activity duplicate. + $('body').on('click', `${SELECTORS.ACTIVITYDUPLICATE}`, function() { + setTimeout(function() { + location.reload(); + }, 200); + }); + // Handling deleteAction - $('body').on('click', `${SELECTORS.DELETE}`, function(event) { + $('body').on('click', `${SELECTORS.ACTIVITIYDELETE},${SELECTORS.DELETE}`, function(event) { event.preventDefault(); - window.location.href = $(this).attr('href'); + if($(this).attr('data-action') == 'cmDelete' ){ + window.location.href = $(this).attr('href'); + } + if($(this).attr('data-action') == 'deleteSection' ){ + if(moodleversionbranch >= '405'){ + location.reload(); + }else{ + window.location.href = $(this).attr('href'); + } + } return true; }); + // Handling addSubsection + $('body').on('click', '[data-action="addModule"]', function(event) { + setTimeout(() => { + location.reload(); + }, 200); + return true; + }); var summaryheight = $('.read-more-target').height(); diff --git a/changes.txt b/changes.txt index 2a8822f..b5bea92 100644 --- a/changes.txt +++ b/changes.txt @@ -1,5 +1,9 @@ CHANGES LOG +Version 4.1.10 +============= +Feature - Compatibility with Moodle 4.5. + Version 4.1.9 ============= Tweak - Miner improvement in 'Hide general section when empty' setting. diff --git a/classes/course_format_data_common_trait.php b/classes/course_format_data_common_trait.php index f70e6de..1683f11 100644 --- a/classes/course_format_data_common_trait.php +++ b/classes/course_format_data_common_trait.php @@ -239,164 +239,21 @@ public function get_list_activities_details($section, $course, $courserenderer, public function get_all_section_data($renderer, $editing, $rformat, $settings, $course, $courseformat, $courserenderer) { global $USER , $OUTPUT, $CFG; $modinfo = get_fast_modinfo($course); - $context = context_course::instance($course->id); $startfrom = 1; - $end = $courseformat->get_last_section_number(); + $allsectinswithoutdelegated = $modinfo->get_section_info_all(); + if($CFG->branch >= '405'){ + $allsectinswithoutdelegated = $modinfo->get_listed_section_info_all(); + } + $end = count($allsectinswithoutdelegated)-1; $sections = array(); for ($sectionindex = $startfrom; $sectionindex <= $end; $sectionindex++) { // Get current section info. - $section = $modinfo->get_section_info($sectionindex); - $data = new \stdClass(); - $data->index = $sectionindex; - $data->num = $section->section; - $data->id = $section->id; - $data->sectionreturnid = $this->edw_get_section_num(course_get_format($course)); - $data->insertafter = false; - - // Check if the user has permission to view this section or not. - $showsection = $section->uservisible || - ($section->visible && !$section->available && !empty($section->availableinfo)) || - (!$section->visible && !$course->hiddensections); - if (!$showsection) { - continue; - } - - // Get the title of the section. - if (!$editing) { - $data->title = $courseformat->get_section_name($section); - } else { - $data->title = $renderer->section_title($section, $course); - $data->editsectionurl = new \moodle_url('editsection.php', array('id' => $section->id)); - $data->header = $this->course_section_header($course, $section); - - $data->optionmenu = $this->course_section_controlmenu($course, $section); - $actionsectionurl = new \moodle_url('/course/changenumsections.php', - array('courseid' => $course->id, - 'insertsection' => $section->section + 1, - 'sesskey' => sesskey(), - 'returnurl' => course_get_url($course) - ) - ); - $label = html_writer::span(get_string('addnewsection', 'format_remuiformat'), 'wdmaddsection d-none d-lg-block'); - $label .= html_writer::span( - '', - 'wdmaddsection d-block d-lg-none' - ); - - $data->addnewsection = html_writer::link($actionsectionurl, $label, - array('class' => 'wdm-add-new-section btn btn-inverse') - ); - } - - // Get the section view url. - $singlepageurl = ''; - if ($course->coursedisplay == COURSE_DISPLAY_MULTIPAGE) { - $singlepageurl = $courseformat->get_view_url($sectionindex)->out(true); - } - - $data->singlepageurl = $singlepageurl; - $sectiontitlesummarymaxlength = $settings['sectiontitlesummarymaxlength']; - $remuienablecardbackgroundimg = $settings['remuienablecardbackgroundimg']; - $remuidefaultsectiontheme = 'dark'; - - $data->hiddenmessage = $this->course_section_availability($course, $section); - - if(trim(strip_tags($data->hiddenmessage)) == ""){ - $data->hiddenmessage = false; - } - if ($courseformat->is_section_current($section)) { - $data->iscurrent = true; - $data->highlightedlabel = get_string('highlighted'); - } - - if (!$section->visible) { - $data->ishidden = true; - $data->notavailable = true; - // $visibilityclass = $courseformat->get_output_classname('content\\section\\visibility'); - // $visibility = new $visibilityclass($courseformat, $section); - // $data->visibility = $visibility->export_for_template($OUTPUT); - if (has_capability('moodle/course:viewhiddensections', $context, $USER)) { - $data->hiddenfromstudents = true; - $data->notavailable = false; - } - } - - $extradetails = $this->get_section_module_info($section, $course, null, $singlepageurl); - - if ($rformat == REMUI_CARD_FORMAT) { - // Get the section summary. - $data->summary = $renderer->abstract_html_contents( - $renderer->format_summary_text($section), $sectiontitlesummarymaxlength - ); - - // Check if background image to section card setting is enable and image exists in summary, - // if yes then add background image to context. - $remuidefaultsectionmode = ""; - if ( $remuienablecardbackgroundimg == 1 && $this->get_section_first_image( $section, $section->summary )) { - $remuinewthemecolor = 'dark'; - $remuidefaultsectionmode = true; - $remuinewfontcolor = '#eaeaea'; - - // Get first image from section to set card card background image. - $imgarray = $this->get_section_first_image( $section, $section->summary ); - $data->sectionfirstimage = $imgarray['img']; - $remuidefaultsectionoverlay = "180deg, rgba(255, 255, 255, 0) 0%, #000000 110%"; - $data->remuidefaultsectionmode = $remuidefaultsectionmode; - $data->remuidefaultsectionoverlay = $remuidefaultsectionoverlay; - $data->remuinewfontcolor = $remuinewfontcolor; - $data->remuinewthemecolor = $remuinewthemecolor; - } - - $data->activityinfo = $extradetails['activityinfo']; - $data->progressinfo = $extradetails['progressinfo']; - if(!$course->enablecompletion){ - $data->progressinfo = false; - } - - // Set Marker. - if ($course->marker == $sectionindex) { - $data->iscurrent = true; - $data->highlightedlabel = get_string('highlighted'); - } - $sections[] = $data; - } else if ($rformat == REMUI_LIST_FORMAT) { - if (!empty($section->summary)) { - $data->summary = $renderer->format_summary_text($section); - if ($settings['coursedisplay'] == 1) { - $data->summary = strip_tags($renderer->abstract_html_contents( - $data->summary, $sectiontitlesummarymaxlength - )); - } - } - $data->activityinfostring = implode($extradetails['activityinfo']); - $data->progressinfo = $extradetails['progressinfo']; - $data->checkrightsidecontent = true; - if($CFG->branch > '403'){ - $data->sectionpageurl = $CFG->wwwroot."/course/section.php?id=".$section->id; - $data->showsectionpageurlbtn = true; - } - if(!$course->enablecompletion){ - $data->progressinfo = false; - } - if(!$data->progressinfo && !$editing){ - $data->checkrightsidecontent = false; - } - $data->sectionactivities = $this->course_section_cm_list( - $course, $section - ); - $data->sectionactivities .= $courserenderer->course_section_add_cm_control( - $course, $section->section, 0 - ); + $section = $allsectinswithoutdelegated[$sectionindex]; - // Set Marker. - if ($course->marker == $sectionindex) { - $data->iscurrent = true; - $data->highlightedlabel = get_string('highlighted'); - } - $sections[] = $data; - } + //Generate context for the sectoin + $sections[] = $this->get_single_section_generated_data($course, $section); } // Add new sections button. @@ -601,7 +458,9 @@ public function get_activity_to_resume($course) { $modinfo = get_fast_modinfo($course); // Check if activity record exists. - if (!$mod = $modinfo->cms[$lastviewed->cm]) { + if (isset($modinfo->cms[$lastviewed->cm])) { + $mod = $modinfo->cms[$lastviewed->cm]; + } else { return ''; } @@ -958,6 +817,19 @@ private function get_activities_details($section, $course, $courserenderer, $set $count = 1; foreach ($modinfo->sections[$section->section] as $modnumber) { $mod = $modinfo->cms[$modnumber]; + if($mod->modname == 'subsection') { + $delegatesectiondata = $modinfo->get_section_info_by_id($mod->customdata['sectionid']); + $sectiondata = $this->get_single_section_generated_data($course,$delegatesectiondata); + if ($sectiondata !== null) { + $sectiondata->isdelegatedsection = true; + }else{ + $count++; + continue; + } + $output[] = $sectiondata; + $count++; + continue; + } $context = \context_module::instance($mod->id); if (!$mod->is_visible_on_course_page()) { continue; @@ -1167,4 +1039,180 @@ public function edw_get_section_num($obj){ } } + + /** + * Returns the single section generated data for the given course and section. + * + * @param object $course The course object. + * @param object $section The section object. + * @return object The generated data for the section. + */ + public function get_single_section_generated_data($course, $section){ + global $USER, $CFG, $PAGE; + + $renderer = $PAGE->get_renderer('format_remuiformat'); + $courserenderer = $renderer; + $editing = $PAGE->user_is_editing(); + $courseformat = course_get_format($course); + + $settings = $courseformat->get_settings(); + $rformat = $settings['remuicourseformat']; + + $data = new \stdClass(); + $context = context_course::instance($course->id); + $sectionindex = $section->section; + $data->index = $sectionindex; + $data->num = $section->section; + $data->id = $section->id; + $data->sectionreturnid = $this->edw_get_section_num(course_get_format($course)); + $data->insertafter = false; + + // Check if the user has permission to view this section or not. + $showsection = $section->uservisible || + ($section->visible && !$section->available && !empty($section->availableinfo)) || + (!$section->visible && !$course->hiddensections); + if (!$showsection) { + return; + } + + // Get the title of the section. + if (!$editing) { + $data->title = $courseformat->get_section_name($section); + } else { + $data->title = $renderer->section_title($section, $course); + $data->editsectionurl = new \moodle_url('editsection.php', array('id' => $section->id)); + $data->header = $this->course_section_header($course, $section); + + $data->optionmenu = $this->course_section_controlmenu($course, $section); + $actionsectionurl = new \moodle_url('/course/changenumsections.php', + array('courseid' => $course->id, + 'insertsection' => $section->section + 1, + 'sesskey' => sesskey(), + 'returnurl' => course_get_url($course) + ) + ); + $label = html_writer::span(get_string('addnewsection', 'format_remuiformat'), 'wdmaddsection d-none d-lg-block'); + $label .= html_writer::span( + '', + 'wdmaddsection d-block d-lg-none' + ); + + $data->addnewsection = html_writer::link($actionsectionurl, $label, + array('class' => 'wdm-add-new-section btn btn-inverse') + ); + } + + // Get the section view url. + $singlepageurl = ''; + if ($course->coursedisplay == COURSE_DISPLAY_MULTIPAGE) { + $singlepageurl = $courseformat->get_view_url($sectionindex)->out(true); + } + + $data->singlepageurl = $singlepageurl; + $sectiontitlesummarymaxlength = $settings['sectiontitlesummarymaxlength']; + $remuienablecardbackgroundimg = $settings['remuienablecardbackgroundimg']; + $remuidefaultsectiontheme = 'dark'; + + $data->hiddenmessage = $this->course_section_availability($course, $section); + + if(trim(strip_tags($data->hiddenmessage)) == ""){ + $data->hiddenmessage = false; + } + if ($courseformat->is_section_current($section)) { + $data->iscurrent = true; + $data->highlightedlabel = get_string('highlighted'); + } + + if (!$section->visible) { + $data->ishidden = true; + $data->notavailable = true; + // $visibilityclass = $courseformat->get_output_classname('content\\section\\visibility'); + // $visibility = new $visibilityclass($courseformat, $section); + // $data->visibility = $visibility->export_for_template($OUTPUT); + if (has_capability('moodle/course:viewhiddensections', $context, $USER)) { + $data->hiddenfromstudents = true; + $data->notavailable = false; + } + } + + $extradetails = $this->get_section_module_info($section, $course, null, $singlepageurl); + + if ($rformat == REMUI_CARD_FORMAT) { + // Get the section summary. + $data->summary = $renderer->abstract_html_contents( + $renderer->format_summary_text($section), $sectiontitlesummarymaxlength + ); + + // Check if background image to section card setting is enable and image exists in summary, + // if yes then add background image to context. + $remuidefaultsectionmode = ""; + if ( $remuienablecardbackgroundimg == 1 && $this->get_section_first_image( $section, $section->summary )) { + $remuinewthemecolor = 'dark'; + $remuidefaultsectionmode = true; + $remuinewfontcolor = '#eaeaea'; + + // Get first image from section to set card card background image. + $imgarray = $this->get_section_first_image( $section, $section->summary ); + $data->sectionfirstimage = $imgarray['img']; + $remuidefaultsectionoverlay = "180deg, rgba(255, 255, 255, 0) 0%, #000000 110%"; + $data->remuidefaultsectionmode = $remuidefaultsectionmode; + $data->remuidefaultsectionoverlay = $remuidefaultsectionoverlay; + $data->remuinewfontcolor = $remuinewfontcolor; + $data->remuinewthemecolor = $remuinewthemecolor; + } + + $data->activityinfo = $extradetails['activityinfo']; + $data->progressinfo = $extradetails['progressinfo']; + if(!$course->enablecompletion){ + $data->progressinfo = false; + } + + // Set Marker. + if ($course->marker == $sectionindex) { + $data->iscurrent = true; + $data->highlightedlabel = get_string('highlighted'); + } + $sections[] = $data; + } else if ($rformat == REMUI_LIST_FORMAT) { + if (!empty($section->summary)) { + $data->summary = $renderer->format_summary_text($section); + if ($settings['coursedisplay'] == 1) { + $data->summary = strip_tags($renderer->abstract_html_contents( + $data->summary, $sectiontitlesummarymaxlength + )); + } + } + if ($CFG->branch >= '405' && $section->component == 'mod_subsection') { + $data->summary = $renderer->abstract_html_contents( + $renderer->format_summary_text($section), $sectiontitlesummarymaxlength + ); + } + $data->activityinfostring = implode($extradetails['activityinfo']); + $data->progressinfo = $extradetails['progressinfo']; + $data->checkrightsidecontent = true; + if($CFG->branch > '403'){ + $data->sectionpageurl = $CFG->wwwroot."/course/section.php?id=".$section->id; + $data->showsectionpageurlbtn = true; + } + if(!$course->enablecompletion){ + $data->progressinfo = false; + } + if(!$data->progressinfo && !$editing){ + $data->checkrightsidecontent = false; + } + $data->sectionactivities = $this->course_section_cm_list( + $course, $section + ); + $data->sectionactivities .= $courserenderer->course_section_add_cm_control( + $course, $section->section, 0 + ); + + // Set Marker. + if ($course->marker == $sectionindex) { + $data->iscurrent = true; + $data->highlightedlabel = get_string('highlighted'); + } + } + return $data; + } } diff --git a/classes/output/card_one_section_renderable.php b/classes/output/card_one_section_renderable.php index 6196622..c75794b 100644 --- a/classes/output/card_one_section_renderable.php +++ b/classes/output/card_one_section_renderable.php @@ -110,7 +110,7 @@ public function __construct($course, $displaysection, $renderer) { * @return stdClass|array */ public function export_for_template(renderer_base $output) { - global $PAGE, $USER; + global $PAGE, $USER, $CFG; unset($output); $export = new \stdClass(); $modinfo = get_fast_modinfo($this->course); @@ -159,7 +159,18 @@ public function export_for_template(renderer_base $output) { } // Title with section navigation links. - $sectionnavlinks = $renderer->get_nav_links($this->course, $modinfo->get_section_info_all(), $this->displaysection); + + $allsectinswithoutdelegated = $modinfo->get_section_info_all(); + if ($CFG->branch >= '405') { + $allsectinswithoutdelegated = $modinfo->get_listed_section_info_all(); + } + + if ($CFG->branch >= '405' && $currentsection->component === "mod_subsection") { + $sectionnavlinks = array('previous' => '', 'next' => ''); + } else { + $sectionnavlinks = $renderer->get_nav_links($this->course, $allsectinswithoutdelegated, $this->displaysection); + } + $export->leftnav = $sectionnavlinks['previous']; $export->rightnav = $sectionnavlinks['next']; $export->leftside = $renderer->section_left_content($currentsection, $this->course, false); @@ -219,6 +230,8 @@ public function export_for_template(renderer_base $output) { progress::get_course_progress_percentage($this->course), $imgurl ); + $export->subsectionjs = $export->headerdata['subsectionjs']; + $export->sectionreturn = $export->headerdata['sectionreturn']; $PAGE->requires->js_call_amd('format_remuiformat/format_card', 'init'); return $export; } @@ -239,6 +252,19 @@ private function get_activities_details($section, $displayoptions = array()) { foreach ($modinfo->sections[$section->section] as $modnumber) { $mod = $modinfo->cms[$modnumber]; + if($mod->modname == 'subsection') { + $delegatesectiondata = $modinfo->get_section_info_by_id($mod->customdata['sectionid']); + $sectiondata = $this->courseformatdatacommontrait->get_single_section_generated_data($this->course,$delegatesectiondata); + if ($sectiondata !== null) { + $sectiondata->isdelegatedsection = true; + }else{ + $count++; + continue; + } + $output[] = $sectiondata; + $count++; + continue; + } $context = \context_module::instance($mod->id); if (!$mod->is_visible_on_course_page()) { continue; diff --git a/classes/output/list_one_section_renderable.php b/classes/output/list_one_section_renderable.php index 8daee00..cb729b2 100644 --- a/classes/output/list_one_section_renderable.php +++ b/classes/output/list_one_section_renderable.php @@ -105,7 +105,7 @@ public function __construct($course, $displaysection, $renderer) { * @return stdClass|array */ public function export_for_template(renderer_base $output) { - global $PAGE, $USER; + global $PAGE, $USER, $CFG; unset($output); $export = new \stdClass(); $modinfo = get_fast_modinfo($this->course); @@ -164,7 +164,18 @@ public function export_for_template(renderer_base $output) { $export->progressinfo = $extradetails['progressinfo']; // Title with section navigation links. - $sectionnavlinks = $renderer->get_nav_links($this->course, $modinfo->get_section_info_all(), $this->displaysection); + + $allsectinswithoutdelegated = $modinfo->get_section_info_all(); + if ($CFG->branch >= '405') { + $allsectinswithoutdelegated = $modinfo->get_listed_section_info_all(); + } + + if ($CFG->branch >= '405' && $section->component === "mod_subsection") { + $sectionnavlinks = array('previous' => '', 'next' => ''); + } else { + $sectionnavlinks = $renderer->get_nav_links($this->course, $allsectinswithoutdelegated, $this->displaysection); + } + $export->leftnav = $sectionnavlinks['previous']; $export->rightnav = $sectionnavlinks['next']; $export->leftside = $renderer->section_left_content($section, $this->course, false); diff --git a/format.php b/format.php index 81aeb6e..ba620ac 100644 --- a/format.php +++ b/format.php @@ -118,5 +118,6 @@ 'showless', 'showmore' ], 'format_remuiformat'); +$PAGE->requires->data_for_js('moodleversionbranch', $CFG->branch); // Include course format js module. $PAGE->requires->js('/course/format/remuiformat/format_' . $type . '.js'); diff --git a/lib.php b/lib.php index 7ed5c1a..fd182eb 100644 --- a/lib.php +++ b/lib.php @@ -226,6 +226,15 @@ public function get_view_url($section, $options = array()) { $url->set_anchor('section-'.$sectionno); } } + + if ((!empty($options['navigation']) || array_key_exists('sr', $options)) && $sectionno !== null) { + global $PAGE; + if (strpos($PAGE->url->get_path(), 'course/section.php')) { + // Display section on separate page. + $sectioninfo = $this->get_section($sectionno); + return new moodle_url('/course/section.php', ['id' => $sectioninfo->id]); + } + } return $url; } @@ -598,6 +607,46 @@ public function supports_news() { return true; } + public function supports_components() { + global $CFG; + if($CFG->branch >= "405") { + return true; + } + return false; + } + + /** + * Set the current section number to display. + * Some formats has the hability to swith from one section to multiple sections per page. + * + * @param int|null $sectionnum null for all sections or a sectionid. + */ + // public function set_section_number(int $sectionnum): void { + // global $CFG; + // if ((int)$CFG->branch >= 404) { + // parent::set_sectionnum($sectionnum); + // } else { + // parent::set_section_number($sectionnum); + // } + // } + + /** + * Set if the current format instance will show multiple sections or an individual one. + * + * Some formats has the hability to swith from one section to multiple sections per page, + * output components will use this method to know if the current display is a single or + * multiple sections. + * + * @return int zero for all sections or the sectin number + */ + // public function get_section_number(): int { + // global $CFG; + // if ((int)$CFG->branch >= 404) { + // return (int)parent::get_sectionnum(); + // } else { + // return parent::get_section_number(); + // } + // } /** * Returns the list of blocks to be automatically added for the newly created course * @@ -955,5 +1004,10 @@ function get_extra_header_context(&$export, $course, $percentage, $imgurl) { $export->generalsection['overlayopacity'] = 1; } $export->generalsection['coursecompletionstatus'] = $course->enablecompletion; + $export->generalsection['subsectionjs'] = false; + $export->generalsection['sectionreturn'] = null; + if($CFG->branch >='405'){ + $export->generalsection['subsectionjs'] = true; + } return $export->generalsection; } diff --git a/renderer.php b/renderer.php index fb7286d..4b100be 100644 --- a/renderer.php +++ b/renderer.php @@ -147,6 +147,11 @@ public function get_nav_links($course, $sections, $sectionno) { $links = array('previous' => '', 'next' => ''); $back = $sectionno - 1; + + while (!isset($sections[$back]) && $back > 0) { + $back--; + } + while ($back > 0 and empty($links['previous'])) { if ($canviewhidden || $sections[$back]->uservisible) { $params = array('class' => 'btn btn-inverse btn-sm '); @@ -171,6 +176,9 @@ public function get_nav_links($course, $sections, $sectionno) { $forward = $sectionno + 1; $numsections = course_get_format($course)->get_last_section_number(); + while (!isset($sections[$forward]) && $forward <= $numsections) { + $forward++; + } while ($forward <= $numsections and empty($links['next'])) { if ($canviewhidden || $sections[$forward]->uservisible) { $params = array('class' => 'btn btn-inverse btn-sm'); diff --git a/scss/card-layout.scss b/scss/card-layout.scss index fa185f7..713c3b2 100644 --- a/scss/card-layout.scss +++ b/scss/card-layout.scss @@ -175,7 +175,7 @@ margin-top: 4px; } } - + strong{ @include frmt-font-styling(12px,15px,600); a{ @@ -226,170 +226,7 @@ min-height: 340px; max-width: unset !important; } - .section { - .sectionbadges { - [data-type="highlighted"] { - display: none; - } - } - // Highlighting current section - .highlight { - position: absolute; - top: -1px; - right: 16px; - width: 0; - height: 0; - border-left: 18px solid; - border-right: 18px solid; - border-top: 26px solid; - border-bottom: 16px solid; - border-bottom-color: transparent; - } - .right.side { - display: flex; - margin-left: auto; - margin: 0px; - } - // Hide right side spacer. - .right.side .icon.spacer { - display: none; - } - - .sectionname, - .sectionname a { - color: $heading-color; - @include frmt-font-styling(24px, 32px, 700); - } - - .single-card { - background-color: $white; - // position: relative; - border: $border-height solid $light-border; - border-radius: inherit; - padding: $pad-24; - gap: $gap-16; - - .content { - display: flex; - flex-direction: column; - gap: $gap-16; - .section-activities-summary{ - .item{ - font-size: 0.8rem; - } - } - } - } - // Styling for section cards - .single-card { - min-height: $section-card-min-height; - height: 100%; - width: 100%; - // Dark theme - &.dark { - .left.side, - .sectionname, - .sectionname *, - .wdm-section-summary *, - .section-activities-summary { - color: $white !important; - } - .sectionname{ - .ignoredirty,.ignoredirty.form-control,.editinstructions{ - color:$heading-color !important; - } - - .badge{ - color: $heading-color ; - } - .badge-primary{ - color: white; - } - } - .left.side{ - .section-handle .icon{ - color: $white; - } - } - .progress-bar-warpper{ - .progress-text{ - color: $white; - } - } - .right.side{ - .wdm-add-new-section{ - color: $white; - } - } - } - // Light theme - &.light { - // .left.side, - // .sectionname, - // .sectionname *, - // .wdm-section-summary * - // { - // color: #101010 !important; - // } - } - &:hover .progress-text { - visibility: visible; - } - } - .section-header { - gap: $gap-16; - a { - text-decoration: none; - } - } - // Placing section action container. - .section-action-container { - justify-content: flex-end; - flex-wrap: wrap; - // margin: 0 -15px; - - .progress-text { - align-self: center; - color: $paragraph-color; - @include frmt-font-styling(12px, 15px, 600); - - @media (min-width: 480px) and (max-width: 767px) { - padding: 5px 0 0 13px !important; - } - } - } - // Section activities summary container. - .section-activities-summary { - list-style-type: none; - margin: 0; - padding: 0; - display: flex; - flex-wrap: wrap; - gap: $gap-4; - width: 100%; - color: $paragraph-color; - @include frmt-font-styling(14px, 22px, 600); - - .item { - float: left; - text-decoration: none; - font-size: 0.9rem; - } - } - - .wdm-section-summary { - .no-overflow { - margin: 0; - width: 100%; - color: $paragraph-color; - @include frmt-font-styling(14px, 22px, 400); - - p { - margin: 0px; - } - } - } - } + @include single-card-ui(); } // Styling for single section page &.single-section-format { @@ -672,6 +509,20 @@ } } } + + //common css to .section class + @include single-card-ui(); + // additonal css to .section class + .section{ + background-color: $white; + border-radius: $border-radius-8; + border-color: $light-border; + border-width:$border-height; + border-style: solid; + .single-card{ + border: unset; + } + } } } .contentwithoutlink { @@ -688,17 +539,17 @@ &:not(.limitedwidth) { .remui-format-card.all-section-format { .showhideactivity .general-section-activities { - .activity:nth-child(n+5) { + li:nth-child(n+5) { display: none !important; } @media only screen and (max-width: 1439px) { - .activity:nth-child(n+5) { + li:nth-child(n+5) { display: none !important; } } @media only screen and (max-width: 1199px) { - .activity:nth-child(n+4) { + li:nth-child(n+4) { display: none !important; } } @@ -719,9 +570,9 @@ } } .showhideactivity .general-section-activities { - .activity:nth-child(n+4) { - display: none !important; - } + li:nth-child(n+4) { + display: none !important; + } } } .activity-cards, @@ -733,17 +584,17 @@ .remui-format-card.all-section-format { .showhideactivity .general-section-activities { @media only screen and (max-width: 1023px) { - .activity:nth-child(n+3) { + li:nth-child(n+3) { display: none !important; } } @media only screen and (max-width: 767px) { - .activity:nth-child(n+3) { + li:nth-child(n+3) { display: none !important; } } @media only screen and (max-width: 550px) { - .activity:nth-child(n+2) { + li:nth-child(n+2) { display: none !important; } } diff --git a/scss/list-layout.scss b/scss/list-layout.scss index ab6b578..125a124 100644 --- a/scss/list-layout.scss +++ b/scss/list-layout.scss @@ -512,6 +512,15 @@ &.modtype_label .activity-item > *{ margin-left: unset !important ; } + &.modtype_subsection{ + .activity-altcontent{ + margin-left: 0px !important; + .section{ + border: unset !important; + border-radius: unset !important; + } + } + } } } } diff --git a/scss/mixin.scss b/scss/mixin.scss index 621d9c8..64a45c6 100644 --- a/scss/mixin.scss +++ b/scss/mixin.scss @@ -3,4 +3,171 @@ line-height: $line-height; font-weight: $font-weight; -} \ No newline at end of file +} +@mixin single-card-ui() { + .section { + .sectionbadges { + [data-type="highlighted"] { + display: none; + } + } + // Highlighting current section + .highlight { + position: absolute; + top: -1px; + right: 16px; + width: 0; + height: 0; + border-left: 18px solid; + border-right: 18px solid; + border-top: 26px solid; + border-bottom: 16px solid; + border-bottom-color: transparent; + } + .right.side { + display: flex; + margin-left: auto; + margin: 0px; + } + // Hide right side spacer. + .right.side .icon.spacer { + display: none; + } + + .sectionname, + .sectionname a { + color: $heading-color; + @include frmt-font-styling(24px, 32px, 700); + } + + .single-card { + background-color: $white; + // position: relative; + border: $border-height solid $light-border; + border-radius: inherit; + padding: $pad-24; + gap: $gap-16; + + .content { + display: flex; + flex-direction: column; + gap: $gap-16; + .section-activities-summary{ + .item{ + font-size: 0.8rem; + } + } + } + } + // Styling for section cards + .single-card { + min-height: $section-card-min-height; + height: 100%; + width: 100%; + // Dark theme + &.dark { + .left.side, + .sectionname, + .sectionname *, + .wdm-section-summary *, + .section-activities-summary { + color: $white !important; + } + .sectionname{ + .ignoredirty,.ignoredirty.form-control,.editinstructions{ + color:$heading-color !important; + } + + .badge{ + color: $heading-color ; + } + .badge-primary{ + color: white; + } + } + .left.side{ + .section-handle .icon{ + color: $white; + } + } + .progress-bar-warpper{ + .progress-text{ + color: $white; + } + } + .right.side{ + .wdm-add-new-section{ + color: $white; + } + } + } + // Light theme + &.light { + // .left.side, + // .sectionname, + // .sectionname *, + // .wdm-section-summary * + // { + // color: #101010 !important; + // } + } + &:hover .progress-text { + visibility: visible; + } + } + .section-header { + gap: $gap-16; + a { + text-decoration: none; + } + } + // Placing section action container. + .section-action-container { + justify-content: flex-end; + flex-wrap: wrap; + // margin: 0 -15px; + + .progress-text { + align-self: center; + color: $paragraph-color; + @include frmt-font-styling(12px, 15px, 600); + + @media (min-width: 480px) and (max-width: 767px) { + padding: 5px 0 0 13px !important; + } + } + } + // Section activities summary container. + .section-activities-summary { + list-style-type: none; + margin: 0; + padding: 0; + display: flex; + flex-wrap: wrap; + gap: $gap-4; + width: 100%; + color: $paragraph-color; + @include frmt-font-styling(14px, 22px, 600); + + .item { + float: left; + text-decoration: none; + font-size: 0.9rem; + } + } + + .wdm-section-summary { + .no-overflow { + margin: 0; + width: 100%; + color: $paragraph-color; + @include frmt-font-styling(14px, 22px, 400); + + p { + margin: 0px; + } + } + } + } + +} diff --git a/scss/styles.scss b/scss/styles.scss index f68bc19..46629b8 100644 --- a/scss/styles.scss +++ b/scss/styles.scss @@ -437,6 +437,19 @@ body#page-course-view-remuiformat { background-color: $white; } + &.activity-wrapper { + .activity-item:has(.section.delegated-section) { + padding: 0; + border: 0; + + box-shadow: unset; + + .section-item:hover { + box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075); + } + } + } + .description,.activity-grid { .availabilityinfo{ // width: fit-content; @@ -460,7 +473,7 @@ body#page-course-view-remuiformat { } } } - + } .activity-altcontent, @@ -560,6 +573,9 @@ body#page-course-view-remuiformat { padding: 0px; margin: 0px; max-width: unset; + .section{ + list-style: none; + } .activity { &:not(.modtype_label) { padding: $pad-24; @@ -970,7 +986,7 @@ body#page-course-view-remuiformat { justify-content: space-between; width: 100%; // overflow: auto; - + p { margin: 0; } @@ -1039,9 +1055,44 @@ body#page-course-view-remuiformat { } } } + + .bulkEnable { + display: none; + } } .section{ .dndupload-preview-overlay,.dndupload-preview-wrapper{ display: none; } } + +.single-section ul.remuiformat { + padding-left: 0; +} + +.section.delegated-section { + text-align: start; + border-radius: 8px; + + .wdm-add-new-section { + display: none; + } + + &::after { + content: unset; + } + + .content .section:not(:has(:first-child)) { + display: none !important; + } +} + + +body:not(.editing) #page-content .course-content ul li.section.main.delegated-section { + margin-top: 0.25rem; +} + +// drag and drop icon removed temprarly from moodle4.5 +.edw-m405 #page .editing_move { + display: none !important; +} diff --git a/styles.css b/styles.css index 0e4965b..10b375e 100644 --- a/styles.css +++ b/styles.css @@ -707,6 +707,208 @@ body#page-course-view-remuiformat .remui-format-card.single-section-format .acti width: fit-content; } +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .sectionbadges [data-type="highlighted"], +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .sectionbadges [data-type="highlighted"] { + display: none; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .highlight, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .highlight { + position: absolute; + top: -1px; + right: 16px; + width: 0; + height: 0; + border-left: 18px solid; + border-right: 18px solid; + border-top: 26px solid; + border-bottom: 16px solid; + border-bottom-color: transparent; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .right.side, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .right.side { + display: flex; + margin-left: auto; + margin: 0px; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .right.side .icon.spacer, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .right.side .icon.spacer { + display: none; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .sectionname, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .sectionname a, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .sectionname, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .sectionname a { + color: #313848; + font-size: 24px; + line-height: 32px; + font-weight: 700; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .single-card, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .single-card { + background-color: #fff; + border: 1px solid #EBF0F9; + border-radius: inherit; + padding: 24px; + gap: 16px; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .single-card .content, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .single-card .content { + display: flex; + flex-direction: column; + gap: 16px; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .single-card .content .section-activities-summary .item, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .single-card .content .section-activities-summary .item { + font-size: 0.8rem; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .single-card, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .single-card { + min-height: 120px; + height: 100%; + width: 100%; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .single-card.dark .left.side, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .single-card.dark .sectionname, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .single-card.dark .sectionname *, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .single-card.dark .wdm-section-summary *, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .single-card.dark .section-activities-summary, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .single-card.dark .left.side, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .single-card.dark .sectionname, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .single-card.dark .sectionname *, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .single-card.dark .wdm-section-summary *, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .single-card.dark .section-activities-summary { + color: #fff !important; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .single-card.dark .sectionname .ignoredirty, body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .single-card.dark .sectionname .ignoredirty.form-control, body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .single-card.dark .sectionname .editinstructions, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .single-card.dark .sectionname .ignoredirty, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .single-card.dark .sectionname .ignoredirty.form-control, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .single-card.dark .sectionname .editinstructions { + color: #313848 !important; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .single-card.dark .sectionname .badge, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .single-card.dark .sectionname .badge { + color: #313848; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .single-card.dark .sectionname .badge-primary, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .single-card.dark .sectionname .badge-primary { + color: white; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .single-card.dark .left.side .section-handle .icon, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .single-card.dark .left.side .section-handle .icon { + color: #fff; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .single-card.dark .progress-bar-warpper .progress-text, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .single-card.dark .progress-bar-warpper .progress-text { + color: #fff; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .single-card.dark .right.side .wdm-add-new-section, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .single-card.dark .right.side .wdm-add-new-section { + color: #fff; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .single-card:hover .progress-text, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .single-card:hover .progress-text { + visibility: visible; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .section-header, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .section-header { + gap: 16px; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .section-header a, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .section-header a { + text-decoration: none; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .section-action-container, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .section-action-container { + justify-content: flex-end; + flex-wrap: wrap; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .section-action-container .progress-text, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .section-action-container .progress-text { + align-self: center; + color: #4C5A73; + font-size: 12px; + line-height: 15px; + font-weight: 600; +} + +@media (min-width: 480px) and (max-width: 767px) { + body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .section-action-container .progress-text, + body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .section-action-container .progress-text { + padding: 5px 0 0 13px !important; + } +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .section-activities-summary, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .section-activities-summary { + list-style-type: none; + margin: 0; + padding: 0; + display: flex; + flex-wrap: wrap; + gap: 4px; + width: 100%; + color: #4C5A73; + font-size: 14px; + line-height: 22px; + font-weight: 600; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .section-activities-summary .item, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .section-activities-summary .item { + float: left; + text-decoration: none; + font-size: 0.9rem; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .wdm-section-summary .no-overflow, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .wdm-section-summary .no-overflow { + margin: 0; + width: 100%; + color: #4C5A73; + font-size: 14px; + line-height: 22px; + font-weight: 400; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .wdm-section-summary .no-overflow p, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .wdm-section-summary .no-overflow p { + margin: 0px; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section { + background-color: #fff; + border-radius: 8px; + border-color: #EBF0F9; + border-width: 1px; + border-style: solid; +} + +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .section .single-card, +body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .section .single-card { + border: unset; +} + body#page-course-view-remuiformat .remui-format-card .contentwithoutlink { padding: 0; } @@ -715,18 +917,18 @@ body#page-course-view-remuiformat .remui-format-card .single-card a:hover { text-decoration: none; } -body#page-course-view-remuiformat:not(.limitedwidth) .remui-format-card.all-section-format .showhideactivity .general-section-activities .activity:nth-child(n+5) { +body#page-course-view-remuiformat:not(.limitedwidth) .remui-format-card.all-section-format .showhideactivity .general-section-activities li:nth-child(n+5) { display: none !important; } @media only screen and (max-width: 1439px) { - body#page-course-view-remuiformat:not(.limitedwidth) .remui-format-card.all-section-format .showhideactivity .general-section-activities .activity:nth-child(n+5) { + body#page-course-view-remuiformat:not(.limitedwidth) .remui-format-card.all-section-format .showhideactivity .general-section-activities li:nth-child(n+5) { display: none !important; } } @media only screen and (max-width: 1199px) { - body#page-course-view-remuiformat:not(.limitedwidth) .remui-format-card.all-section-format .showhideactivity .general-section-activities .activity:nth-child(n+4) { + body#page-course-view-remuiformat:not(.limitedwidth) .remui-format-card.all-section-format .showhideactivity .general-section-activities li:nth-child(n+4) { display: none !important; } } @@ -743,7 +945,7 @@ body#page-course-view-remuiformat:not(.limitedwidth) .remui-format-card.all-sect } } -body#page-course-view-remuiformat.limitedwidth .remui-format-card.all-section-format .showhideactivity .general-section-activities .activity:nth-child(n+4) { +body#page-course-view-remuiformat.limitedwidth .remui-format-card.all-section-format .showhideactivity .general-section-activities li:nth-child(n+4) { display: none !important; } @@ -753,19 +955,19 @@ body#page-course-view-remuiformat.limitedwidth .activity-cards.section { } @media only screen and (max-width: 1023px) { - body#page-course-view-remuiformat .remui-format-card.all-section-format .showhideactivity .general-section-activities .activity:nth-child(n+3) { + body#page-course-view-remuiformat .remui-format-card.all-section-format .showhideactivity .general-section-activities li:nth-child(n+3) { display: none !important; } } @media only screen and (max-width: 767px) { - body#page-course-view-remuiformat .remui-format-card.all-section-format .showhideactivity .general-section-activities .activity:nth-child(n+3) { + body#page-course-view-remuiformat .remui-format-card.all-section-format .showhideactivity .general-section-activities li:nth-child(n+3) { display: none !important; } } @media only screen and (max-width: 550px) { - body#page-course-view-remuiformat .remui-format-card.all-section-format .showhideactivity .general-section-activities .activity:nth-child(n+2) { + body#page-course-view-remuiformat .remui-format-card.all-section-format .showhideactivity .general-section-activities li:nth-child(n+2) { display: none !important; } } @@ -1294,6 +1496,17 @@ body#page-course-view-remuiformat .remui-format-list .card-footer ul.section .ac margin-left: unset !important; } +body#page-course-view-remuiformat .remui-format-list .activities-list ul.section .activity.modtype_subsection .activity-altcontent, +body#page-course-view-remuiformat .remui-format-list .card-footer ul.section .activity.modtype_subsection .activity-altcontent { + margin-left: 0px !important; +} + +body#page-course-view-remuiformat .remui-format-list .activities-list ul.section .activity.modtype_subsection .activity-altcontent .section, +body#page-course-view-remuiformat .remui-format-list .card-footer ul.section .activity.modtype_subsection .activity-altcontent .section { + border: unset !important; + border-radius: unset !important; +} + body#page-course-view-remuiformat .remui-format-list.one-section-format.all-section .sections .section:not(#section-0) ul.section { display: none; } @@ -1370,7 +1583,13 @@ body#page-course-view-remuiformat .remui-format-list .section_availability.cours body#page-course-view-remuiformat .remui-format-list .activity-item .activity-grid { grid-template-rows: 1fr repeat(6, -webkit-min-content); grid-template-rows: 1fr repeat(6, min-content); - grid-template-areas: "icon name groupmode completion actions" "icon visibility groupmode completion actions" "icon visibility groupmode completion actions" "dates dates dates dates dates" "altcontent altcontent altcontent altcontent altcontent" "afterlink afterlink afterlink afterlink afterlink" "availability availability availability availability availability"; + grid-template-areas: "icon name groupmode completion actions" + "icon visibility groupmode completion actions" + "icon visibility groupmode completion actions" + "dates dates dates dates dates" + "altcontent altcontent altcontent altcontent altcontent" + "afterlink afterlink afterlink afterlink afterlink" + "availability availability availability availability availability"; } body#page-course-view-remuiformat .remui-format-list .activity-item .activity-grid .activity-dates { @@ -1849,6 +2068,16 @@ body#page-course-view-remuiformat .activity .activity-item:not(.activityinline) background-color: #fff; } +body#page-course-view-remuiformat .activity.activity-wrapper .activity-item:has(.section.delegated-section) { + padding: 0; + border: 0; + box-shadow: unset; +} + +body#page-course-view-remuiformat .activity.activity-wrapper .activity-item:has(.section.delegated-section) .section-item:hover { + box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075); +} + body#page-course-view-remuiformat .activity .description .course-description-item, body#page-course-view-remuiformat .activity .description .activity-dates, body#page-course-view-remuiformat .activity .activity-grid .course-description-item, body#page-course-view-remuiformat .activity .activity-grid .activity-dates { padding: 8px; flex-direction: column; @@ -1987,6 +2216,10 @@ body#page-course-view-remuiformat .course-content .sections #section-0 .general- } } +body#page-course-view-remuiformat .course-content .sections #section-0 .general-section .activities-wrapper .general-section-activities .section { + list-style: none; +} + body#page-course-view-remuiformat .course-content .sections #section-0 .general-section .activities-wrapper .general-section-activities .activity:not(.modtype_label) { padding: 24px; background: #fff; @@ -2428,6 +2661,39 @@ body#page-course-view-remuiformat.limitedwidth header.hasbackground.design-1 .he flex-direction: column; } +body#page-course-view-remuiformat .bulkEnable { + display: none; +} + .section .dndupload-preview-overlay, .section .dndupload-preview-wrapper { display: none; } + +.single-section ul.remuiformat { + padding-left: 0; +} + +.section.delegated-section { + text-align: start; + border-radius: 8px; +} + +.section.delegated-section .wdm-add-new-section { + display: none; +} + +.section.delegated-section::after { + content: unset; +} + +.section.delegated-section .content .section:not(:has(:first-child)) { + display: none !important; +} + +body:not(.editing) #page-content .course-content ul li.section.main.delegated-section { + margin-top: 0.25rem; +} + +.edw-m405 #page .editing_move { + display: none !important; +} diff --git a/templates/card_general_section.mustache b/templates/card_general_section.mustache index 1a2ef0f..73e46bd 100644 --- a/templates/card_general_section.mustache +++ b/templates/card_general_section.mustache @@ -97,63 +97,68 @@ {{#activityexists}}

{{#str}} generalactivities, format_remuiformat{{/str}}

-
    +
      {{#activities}} -
    • -
      - {{#editing}} - {{{leftside}}} - {{/editing}} - {{!
      }} -
      -
      - {{{title}}} -
      - {{#modhiddenfromstudents}} -
      - {{!> core_courseformat/local/content/section/badges }} - {{>format_remuiformat/edwbadges}} -
      - {{/modhiddenfromstudents}} - {{#modstealth}} -
      - {{#str}}hiddenoncoursepage{{/str}} -
      - {{/modstealth}} - {{#summary}} - - {{/summary}} -
      -
      - {{#hasopenduedata}} -
      -
      -
      - {{#opendue}} -
      - {{label}} {{timestamp}} -
      - {{/opendue}} + {{^isdelegatedsection}} +
    • +
      + {{#editing}} + {{{leftside}}} + {{/editing}} + {{!
      }} +
      +
      + {{{title}}} +
      + {{#modhiddenfromstudents}} +
      + {{!> core_courseformat/local/content/section/badges }} + {{>format_remuiformat/edwbadges}} +
      + {{/modhiddenfromstudents}} + {{#modstealth}} +
      + {{#str}}hiddenoncoursepage{{/str}} +
      + {{/modstealth}} + {{#summary}} + + {{/summary}}
      -
      - {{/hasopenduedata}} - {{{availstatus}}} +
      + {{#hasopenduedata}} +
      +
      +
      + {{#opendue}} +
      + {{label}} {{timestamp}} +
      + {{/opendue}} +
      +
      +
      + {{/hasopenduedata}} + {{{availstatus}}} - {{#completion}} -
      - {{{completion}}} -
      - {{/completion}} + {{#completion}} +
      + {{{completion}}} +
      + {{/completion}} +
      + {{! +
      }}
- {{! - }} - - + + {{/isdelegatedsection}} + {{#isdelegatedsection}} + {{>format_remuiformat/card_section_summary}} + {{/isdelegatedsection}} {{/activities}} diff --git a/templates/card_general_section_edit.mustache b/templates/card_general_section_edit.mustache index ddb8bca..764b2ab 100644 --- a/templates/card_general_section_edit.mustache +++ b/templates/card_general_section_edit.mustache @@ -110,60 +110,65 @@

{{#str}} generalactivities, format_remuiformat{{/str}}

-
    {{#activities}} -
  • + {{^isdelegatedsection}} +
  • -
    -
    - {{{title}}} -
    - {{#modhiddenfromstudents}} -
    - {{!> core_courseformat/local/content/section/badges }} - {{>format_remuiformat/edwbadges}} +
    +
    + {{{title}}} +
    + {{#modhiddenfromstudents}} +
    + {{!> core_courseformat/local/content/section/badges }} + {{>format_remuiformat/edwbadges}} +
    + {{/modhiddenfromstudents}} + {{#modstealth}} +
    + {{#str}}hiddenoncoursepage{{/str}} +
    + {{/modstealth}} + {{#summary}} + + {{/summary}} + {{#pix}} i/move_2d,core {{/pix}} +
    - {{/modhiddenfromstudents}} - {{#modstealth}} -
    - {{#str}}hiddenoncoursepage{{/str}} -
    - {{/modstealth}} - {{#summary}} - - {{/summary}} - {{#pix}} i/move_2d,core {{/pix}} - -
    -
    - {{#hasopenduedata}} -
    -
    -
    - {{#opendue}} -
    - {{label}} {{timestamp}} +
    + {{#hasopenduedata}} +
    +
    +
    + {{#opendue}} +
    + {{label}} {{timestamp}} +
    + {{/opendue}} +
    - {{/opendue}} +
    + {{/hasopenduedata}} + {{{availstatus}}} +
    + {{{completion}}} + {{{modicons}}}
    -
    - {{/hasopenduedata}} - {{{availstatus}}} -
    - {{{completion}}} - {{{modicons}}} -
    -
    -
  • + + {{/isdelegatedsection}} + {{#isdelegatedsection}} + {{>format_remuiformat/card_section_summary_edit}} + {{/isdelegatedsection}} {{/activities}}
diff --git a/templates/card_one_section.mustache b/templates/card_one_section.mustache index e539e19..633a22b 100644 --- a/templates/card_one_section.mustache +++ b/templates/card_one_section.mustache @@ -65,9 +65,13 @@

- - {{ section }}. - + {{! sno is shown on section page but now it's hidden because of subsection makes it confusing }} + {{#comment}} + + {{ section }}. + + {{/comment}} + {{{title}}} @@ -129,6 +133,7 @@
    {{#activities}} + {{^isdelegatedsection}}
  • @@ -214,6 +219,17 @@

+ {{/isdelegatedsection}} + {{^editing}} + {{#isdelegatedsection}} + {{>format_remuiformat/card_section_summary}} + {{/isdelegatedsection}} + {{/editing}} + {{#editing}} + {{#isdelegatedsection}} + {{>format_remuiformat/card_section_summary_edit}} + {{/isdelegatedsection}} + {{/editing}} {{/activities}}
diff --git a/templates/card_section_summary.mustache b/templates/card_section_summary.mustache index 9438ba0..d6cb4f1 100644 --- a/templates/card_section_summary.mustache +++ b/templates/card_section_summary.mustache @@ -68,7 +68,7 @@ {{/addsection}} {{^addsection}} -
  • - + {{#percentage}}
    {{/progressinfo}}
    diff --git a/templates/card_section_summary_edit.mustache b/templates/card_section_summary_edit.mustache index f7f8213..13b4b09 100644 --- a/templates/card_section_summary_edit.mustache +++ b/templates/card_section_summary_edit.mustache @@ -68,7 +68,7 @@ {{/addsection}} {{^addsection}} -
  • - - {{ section }}. - + {{! sno is shown on section page but now it's hidden because of subsection makes it confusing }} + {{#comment}} + + {{ section }}. + + {{/comment}} {{{ title }}}
    {{!> core_courseformat/local/content/section/badges }} diff --git a/templates/list_sections_summary.mustache b/templates/list_sections_summary.mustache index 7bcfabe..06eb263 100644 --- a/templates/list_sections_summary.mustache +++ b/templates/list_sections_summary.mustache @@ -66,7 +66,8 @@

    {{#showsectionpageurlbtn}} - + {{! previously it was sectionpageurl changed to singlepageurl }} + {{#pix}}t/right, moodle{{/pix}} diff --git a/templates/optional_secheader.mustache b/templates/optional_secheader.mustache index f526598..df188eb 100644 --- a/templates/optional_secheader.mustache +++ b/templates/optional_secheader.mustache @@ -73,3 +73,12 @@ HEADERREPLACE.init(); }); {{/js}} {{/courseheaderdesign}} +{{#subsectionjs}} +{{#js}} +require(['jquery','core_courseformat/local/content'], function($,component) { + $(document).ready(function() { + component.init('page', {}, {{sectionreturn}}); + }); +}); +{{/js}} +{{/subsectionjs}} diff --git a/version.php b/version.php index b9efb0d..594abac 100644 --- a/version.php +++ b/version.php @@ -23,8 +23,8 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2024100800; // The current plugin version (Date: YYYYMMDDXX). -$plugin->release = '4.1.9'; +$plugin->version = 2024102300; // The current plugin version (Date: YYYYMMDDXX). +$plugin->release = '4.1.10'; $plugin->requires = 2022041900; // Requires this Moodle version (Moodle V4.0). $plugin->maturity = MATURITY_STABLE; $plugin->component = 'format_remuiformat'; // Full name of the plugin (used for diagnostics).