MDL-85654 course: purpose categories in activity chooser
This commit is contained in:
+1
-1
@@ -6,6 +6,6 @@ define("core_course/local/activitychooser/exporter",["exports","core/str"],(func
|
||||
* @copyright 2025 Ferran Recio <ferran@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
const activityCategories=["activities","resources"];let allStrings=null;loadNecessaryStrings();async function loadNecessaryStrings(){if(null!==allStrings)return allStrings;allStrings={};const stringToLoad=[{key:"all",component:"core"},{key:"favourites",component:"core"},{key:"recommended",component:"core"},{key:"recommended_help",component:"core_course"},...activityCategories.map((key=>({key:key,component:"core"}))),...activityCategories.map((key=>({key:key+"_help",component:"core"})))],loadedStrings=await(0,_str.getStrings)(stringToLoad);return stringToLoad.forEach(((_ref,index)=>{let{key:key}=_ref;allStrings[key]=loadedStrings[index]})),allStrings}return _exports.default=class{getTabData(tabId,filteredModules,tabLabel){let tabHelp=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const result={tabId:tabId,active:arguments.length>4&&void 0!==arguments[4]&&arguments[4],items:filteredModules,displayed:filteredModules.length>0,tabLabel:tabLabel};return tabHelp&&(result.tabHelp=tabHelp),result}normaliseModulesData(modulesData){if(modulesData instanceof Map)modulesData=Array.from(modulesData.values());else if(!Array.isArray(modulesData))throw new Error("Invalid modules data format. Expected an array or a Map.");return modulesData}async getModChooserTemplateData(modulesData){modulesData=this.normaliseModulesData(modulesData);const allStrings=await loadNecessaryStrings(),favouriteTab=await this.getFavouriteTabData(modulesData),tabs=[{...this.getTabData("all",modulesData,allStrings.all,null,!favouriteTab.displayed),hasSearchResults:!0},favouriteTab,{...this.getTabData("recommended",modulesData.filter((mod=>!0===mod.recommended)),allStrings.recommended,allStrings.recommended_help),separator:!0}];return activityCategories.forEach(((category,index)=>{const categoryModules=modulesData.filter((mod=>mod.archetype==index));0!==categoryModules.length&&tabs.push(this.getTabData(category,categoryModules,allStrings[category],allStrings[category+"_help"]))})),{modules:modulesData,tabs:tabs}}async getFavouriteTabData(modulesData){modulesData=this.normaliseModulesData(modulesData);const allStrings=await loadNecessaryStrings(),favouriteModules=modulesData.filter((mod=>!0===mod.favourite));return this.getTabData("favourites",favouriteModules,allStrings.favourites,null,favouriteModules.length>0)}getSearchResultData(resultsModulesData){return{searchresultsnumber:(resultsModulesData=this.normaliseModulesData(resultsModulesData)).length,searchresults:resultsModulesData}}countTabItems(tabData){var _tabData$items$length,_tabData$items;return null!==(_tabData$items$length=null===(_tabData$items=tabData.items)||void 0===_tabData$items?void 0:_tabData$items.length)&&void 0!==_tabData$items$length?_tabData$items$length:0}},_exports.default}));
|
||||
const activityCategories=["administration","assessment","collaboration","communication","content","interactivecontent"];let allStrings=null;loadNecessaryStrings();async function loadNecessaryStrings(){if(null!==allStrings)return allStrings;allStrings={};const stringToLoad=[{key:"all",component:"core"},{key:"favourites",component:"core"},{key:"recommended",component:"core"},{key:"recommended_help",component:"core_course"},...activityCategories.map((key=>({key:"mod_purpose_"+key,component:"core_course"}))),...activityCategories.map((key=>({key:"mod_purpose_"+key+"_help",component:"core_course"})))],loadedStrings=await(0,_str.getStrings)(stringToLoad);return stringToLoad.forEach(((_ref,index)=>{let{key:key}=_ref;allStrings[key]=loadedStrings[index]})),allStrings}return _exports.default=class{getTabData(tabId,filteredModules,tabLabel){let tabHelp=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const result={tabId:tabId,active:arguments.length>4&&void 0!==arguments[4]&&arguments[4],items:filteredModules,displayed:filteredModules.length>0,tabLabel:tabLabel};return tabHelp&&(result.tabHelp=tabHelp),result}normaliseModulesData(modulesData){if(modulesData instanceof Map)modulesData=Array.from(modulesData.values());else if(!Array.isArray(modulesData))throw new Error("Invalid modules data format. Expected an array or a Map.");return modulesData}async getModChooserTemplateData(modulesData){modulesData=this.normaliseModulesData(modulesData);const allStrings=await loadNecessaryStrings(),favouriteTab=await this.getFavouriteTabData(modulesData),tabs=[{...this.getTabData("all",modulesData,allStrings.all,null,!favouriteTab.displayed),hasSearchResults:!0},favouriteTab,{...this.getTabData("recommended",modulesData.filter((mod=>!0===mod.recommended)),allStrings.recommended,allStrings.recommended_help),separator:!0}];return activityCategories.forEach((category=>{const categoryModules=modulesData.filter((mod=>mod.purpose==category));0!==categoryModules.length&&tabs.push(this.getTabData(category,categoryModules,allStrings["mod_purpose_"+category],allStrings["mod_purpose_"+category+"_help"]))})),{modules:modulesData,tabs:tabs}}async getFavouriteTabData(modulesData){modulesData=this.normaliseModulesData(modulesData);const allStrings=await loadNecessaryStrings(),favouriteModules=modulesData.filter((mod=>!0===mod.favourite));return this.getTabData("favourites",favouriteModules,allStrings.favourites,null,favouriteModules.length>0)}getSearchResultData(resultsModulesData){return{searchresultsnumber:(resultsModulesData=this.normaliseModulesData(resultsModulesData)).length,searchresults:resultsModulesData}}countTabItems(tabData){var _tabData$items$length,_tabData$items;return null!==(_tabData$items$length=null===(_tabData$items=tabData.items)||void 0===_tabData$items?void 0:_tabData$items.length)&&void 0!==_tabData$items$length?_tabData$items$length:0}},_exports.default}));
|
||||
|
||||
//# sourceMappingURL=exporter.min.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -23,7 +23,14 @@
|
||||
|
||||
import {getStrings} from 'core/str';
|
||||
|
||||
const activityCategories = ['activities', 'resources'];
|
||||
const activityCategories = [
|
||||
'administration',
|
||||
'assessment',
|
||||
'collaboration',
|
||||
'communication',
|
||||
'content',
|
||||
'interactivecontent',
|
||||
];
|
||||
|
||||
let allStrings = null;
|
||||
|
||||
@@ -119,8 +126,8 @@ export default class {
|
||||
},
|
||||
];
|
||||
|
||||
activityCategories.forEach((category, index) => {
|
||||
const categoryModules = modulesData.filter(mod => mod.archetype == index);
|
||||
activityCategories.forEach((category) => {
|
||||
const categoryModules = modulesData.filter(mod => mod.purpose == category);
|
||||
if (categoryModules.length === 0) {
|
||||
return;
|
||||
}
|
||||
@@ -128,8 +135,8 @@ export default class {
|
||||
this.getTabData(
|
||||
category,
|
||||
categoryModules,
|
||||
allStrings[category],
|
||||
allStrings[category + '_help']
|
||||
allStrings['mod_purpose_' + category],
|
||||
allStrings['mod_purpose_' + category + '_help']
|
||||
)
|
||||
);
|
||||
});
|
||||
@@ -210,14 +217,14 @@ async function loadNecessaryStrings() {
|
||||
{key: 'recommended_help', component: 'core_course'},
|
||||
...activityCategories.map(
|
||||
(key) => ({
|
||||
key: key,
|
||||
component: 'core',
|
||||
key: 'mod_purpose_' + key,
|
||||
component: 'core_course',
|
||||
})
|
||||
),
|
||||
...activityCategories.map(
|
||||
(key) => ({
|
||||
key: key + '_help',
|
||||
component: 'core',
|
||||
key: 'mod_purpose_' + key + '_help',
|
||||
component: 'core_course',
|
||||
})
|
||||
),
|
||||
];
|
||||
|
||||
@@ -214,20 +214,37 @@ Feature: Display and choose from the available activities in course
|
||||
When I click on "Resources" "link" in the "Add an activity or resource" "dialogue"
|
||||
And "Clear search input" "button" should not be visible
|
||||
And the field "search" matches value ""
|
||||
And I should see "Book" in the "resources" "core_course > Activity chooser tab"
|
||||
And I should see "Book" in the "content" "core_course > Activity chooser tab"
|
||||
|
||||
Scenario: Teacher gets the base case for the Activity Chooser tab mode
|
||||
When I open the activity chooser
|
||||
Then I should see "Assignment" in the "all" "core_course > Activity chooser tab"
|
||||
And I should see "Book" in the "all" "core_course > Activity chooser tab"
|
||||
# Activities tab.
|
||||
And I click on "Activities" "link" in the "Add an activity or resource" "dialogue"
|
||||
And I should see "Assignment" in the "activities" "core_course > Activity chooser tab"
|
||||
And I should not see "Book" in the "all" "core_course > Activity chooser tab"
|
||||
# Assessment tab.
|
||||
And I click on "Assessment" "link" in the "Add an activity or resource" "dialogue"
|
||||
And I should see "Activities that allow evaluation and measurement of student" in the "Add an activity or resource" "dialogue"
|
||||
And "Book" "link" should not exist in the "assessment" "core_course > Activity chooser tab"
|
||||
And "Assignment" "link" should exist in the "assessment" "core_course > Activity chooser tab"
|
||||
# Collaboration tab.
|
||||
And I click on "Collaboration" "link" in the "Add an activity or resource" "dialogue"
|
||||
And I should see "Tools for collaborative learning" in the "Add an activity or resource" "dialogue"
|
||||
And "Assignment" "link" should not exist in the "collaboration" "core_course > Activity chooser tab"
|
||||
And "Database" "link" should exist in the "collaboration" "core_course > Activity chooser tab"
|
||||
# Communication tab.
|
||||
And I click on "Communication" "link" in the "Add an activity or resource" "dialogue"
|
||||
And I should see "Activities that facilitate real-time communication" in the "Add an activity or resource" "dialogue"
|
||||
And "Database" "link" should not exist in the "communication" "core_course > Activity chooser tab"
|
||||
And "Choice" "link" should exist in the "communication" "core_course > Activity chooser tab"
|
||||
# Resources tab.
|
||||
And I click on "Resources" "link" in the "Add an activity or resource" "dialogue"
|
||||
And I should see "Book" in the "resources" "core_course > Activity chooser tab"
|
||||
And I should not see "Assignment" in the "resources" "core_course > Activity chooser tab"
|
||||
And I should see "Activities and tools to organise and display course materials" in the "Add an activity or resource" "dialogue"
|
||||
And "Choice" "link" should not exist in the "content" "core_course > Activity chooser tab"
|
||||
And "File" "link" should exist in the "content" "core_course > Activity chooser tab"
|
||||
# Interactive content tab.
|
||||
And I click on "Interactive content" "link" in the "Add an activity or resource" "dialogue"
|
||||
And I should see "Engaging interactive activities" in the "Add an activity or resource" "dialogue"
|
||||
And "File" "link" should not exist in the "interactivecontent" "core_course > Activity chooser tab"
|
||||
And "H5P" "link" should exist in the "interactivecontent" "core_course > Activity chooser tab"
|
||||
|
||||
Scenario: Teacher can navigate through activity chooser in Topics format course
|
||||
When I open the activity chooser
|
||||
|
||||
@@ -96,6 +96,18 @@ $string['filterlastactive'] = 'Last ({$a->last})';
|
||||
$string['gradetopassnotset'] = 'This course does not have a grade to pass set. It may be set in the grade item of the course (Gradebook setup).';
|
||||
$string['hideendedcoursestask'] = 'Hide courses on end date';
|
||||
$string['informationformodule'] = 'Information about the {$a} activity';
|
||||
$string['mod_purpose_administration'] = 'Administration';
|
||||
$string['mod_purpose_administration_help'] = 'Tools to help the teacher in managing the course progress.';
|
||||
$string['mod_purpose_assessment'] = 'Assessment';
|
||||
$string['mod_purpose_assessment_help'] = 'Activities that allow evaluation and measurement of student understanding and performance, including individual and collaborative assessment, and peer assessment.';
|
||||
$string['mod_purpose_collaboration'] = 'Collaboration';
|
||||
$string['mod_purpose_collaboration_help'] = 'Tools for collaborative learning that encourages knowledge sharing, discussion, and teamwork among learners.';
|
||||
$string['mod_purpose_communication'] = 'Communication';
|
||||
$string['mod_purpose_communication_help'] = 'Activities that facilitate real-time communication, asynchronous interactions, and feedback collection.';
|
||||
$string['mod_purpose_content'] = 'Resources';
|
||||
$string['mod_purpose_content_help'] = 'Activities and tools to organise and display course materials like documents, web links, and multimedia.';
|
||||
$string['mod_purpose_interactivecontent'] = 'Interactive content';
|
||||
$string['mod_purpose_interactivecontent_help'] = 'Engaging interactive activities that encourage active learner participation.';
|
||||
$string['module'] = 'Activity';
|
||||
$string['namewithlink'] = 'Category name with link';
|
||||
$string['nocourseactivity'] = 'Not enough course activity between the start and the end of the course';
|
||||
|
||||
@@ -84,3 +84,5 @@ unlockverbose,core_grades
|
||||
aiusagestats,core_hub
|
||||
maxsectionslimit,core
|
||||
maxsectionaddmessage,core_courseformat
|
||||
activities_help,core
|
||||
resources_help,core
|
||||
|
||||
+2
-2
@@ -31,7 +31,6 @@ $string['actionsmenu'] = 'Actions menu';
|
||||
$string['active'] = 'Active';
|
||||
$string['activeusers'] = 'Active users';
|
||||
$string['activities'] = 'Activities';
|
||||
$string['activities_help'] = 'Activities, such as forums, quizzes and wikis, enable interactive content to be added to the course.';
|
||||
$string['activity'] = 'Activity';
|
||||
$string['activityclipboard'] = 'Moving this activity: {$a}';
|
||||
$string['activityicon'] = '{$a} icon';
|
||||
@@ -1875,7 +1874,6 @@ $string['resourcedisplaynew'] = 'New window';
|
||||
$string['resourcedisplayopen'] = 'Open';
|
||||
$string['resourcedisplaypopup'] = 'In pop-up';
|
||||
$string['resources'] = 'Resources';
|
||||
$string['resources_help'] = 'Resource types enable almost any kind of web content to be inserted into the course.';
|
||||
$string['resultsfound'] = '{$a} results found';
|
||||
$string['restore'] = 'Restore';
|
||||
$string['restorecancelled'] = 'Restore cancelled';
|
||||
@@ -2492,4 +2490,6 @@ $string['registrationcontactyes'] = 'Yes, provide a form for other Moodlers to c
|
||||
$string['failedtaskcontexturlname'] = 'Status report';
|
||||
|
||||
// Deprecated since Moodle 5.1.
|
||||
$string['activities_help'] = 'Activities, such as forums, quizzes and wikis, enable interactive content to be added to the course.';
|
||||
$string['maxsectionslimit'] = 'Cannot create new section as it would exceed the maximum number of sections allowed for this course ({$a}).';
|
||||
$string['resources_help'] = 'Resource types enable almost any kind of web content to be inserted into the course.';
|
||||
|
||||
Reference in New Issue
Block a user