Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/addons/badges/badges.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ const mobileRoutes: Routes = [
path: '',
pathMatch: 'full',
loadComponent: () => import('./pages/user-badges/user-badges'),
data: { checkForcedLanguage: 'course' },
},
{
path: ':badgeHash',
loadComponent: () => import('./pages/issued-badge/issued-badge'),
data: { usesSwipeNavigation: true },
data: { usesSwipeNavigation: true, checkForcedLanguage: 'course' },
},
];

Expand All @@ -66,6 +67,7 @@ const tabletRoutes: Routes = [
data: { usesSwipeNavigation: true },
},
],
data: { checkForcedLanguage: 'course' },
},
];

Expand Down
1 change: 1 addition & 0 deletions src/addons/blog/blog.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const routes: Routes = [
{
path: ADDON_BLOG_MAINMENU_PAGE_NAME,
loadChildren: () => import('@addons/blog/blog-lazy.module'),
data: { checkForcedLanguage: 'course' },
},
];

Expand Down
2 changes: 2 additions & 0 deletions src/addons/competency/competency.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,12 @@ const mainMenuChildrenRoutes: Routes = [
{
path: `${CORE_COURSE_PAGE_NAME}/:courseId/${ADDON_COMPETENCY_COMPETENCIES_PAGE}`,
loadChildren: () => getCompetencyCourseDetailsRoutes(),
data: { checkForcedLanguage: 'course' },
},
{
path: `${CORE_COURSE_PAGE_NAME}/:courseId/${PARTICIPANTS_PAGE_NAME}/:userId/${ADDON_COMPETENCY_COMPETENCIES_PAGE}`,
loadChildren: () => getCompetencyCourseDetailsRoutes(),
data: { checkForcedLanguage: 'course' },
},
];

Expand Down
1 change: 1 addition & 0 deletions src/addons/coursecompletion/coursecompletion.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const routes: Routes = [
{
path: 'coursecompletion',
loadComponent: () => import('./pages/report/report'),
data: { checkForcedLanguage: 'course' },
},
];

Expand Down
1 change: 1 addition & 0 deletions src/addons/mod/assign/assign.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ const routes: Routes = [
...conditionalRoutes(mobileRoutes, () => CoreScreen.isMobile),
...conditionalRoutes(tabletRoutes, () => CoreScreen.isTablet),
],
data: { checkForcedLanguage: 'module' },
},
];

Expand Down
13 changes: 5 additions & 8 deletions src/addons/mod/assign/services/assign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import {
AddonModAssignSubmissionStatusValues,
} from '../constants';
import { CoreTextFormat } from '@singletons/text';
import { CoreCourseModuleHelper } from '@features/course/services/course-module-helper';
import { CoreCourseModuleHelper, CoreCourseModuleStandardElements } from '@features/course/services/course-module-helper';
import { CoreUserDescriptionExporter } from '@features/user/services/user';

declare module '@singletons/events' {
Expand Down Expand Up @@ -1460,12 +1460,12 @@ export type AddonModAssignSubmissionStatusOptions = CoreCourseCommonModWSOptions

/**
* Assign data returned by mod_assign_get_assignments.
* We're using Omit to exclude properties because type is not consistent with the rest of the WS but
* it should be.
*/
export type AddonModAssignAssign = {
id: number; // Assignment id.
export type AddonModAssignAssign =
Omit<CoreCourseModuleStandardElements, 'coursemodule'|'section'|'visible'|'groupmode'|'groupingid'|'lang'> & {
cmid: number; // Course module id.
course: number; // Course id.
name: string; // Assignment name.
nosubmissions: number; // No submissions.
submissiondrafts: number; // Submissions drafts.
sendnotifications: number; // Send notifications.
Expand Down Expand Up @@ -1493,9 +1493,6 @@ export type AddonModAssignAssign = {
submissionstatement?: string; // Submission statement formatted.
submissionstatementformat?: CoreTextFormat; // Submissionstatement format (1 = HTML, 0 = MOODLE, 2 = PLAIN or 4 = MARKDOWN).
configs: AddonModAssignConfig[]; // Configuration settings.
intro?: string; // Assignment intro, not allways returned because it deppends on the activity configuration.
introformat?: CoreTextFormat; // Intro format (1 = HTML, 0 = MOODLE, 2 = PLAIN or 4 = MARKDOWN).
introfiles?: CoreWSExternalFile[];
introattachments?: CoreWSExternalFile[];
activity?: string; // @since 4.0. Description of activity.
activityformat?: CoreTextFormat; // @since 4.0. Format of activity.
Expand Down
2 changes: 1 addition & 1 deletion src/addons/mod/assign/services/handlers/prefetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export class AddonModAssignPrefetchHandlerService extends CoreCourseActivityPref

promises.push(CoreCourse.getModuleBasicInfoByInstance(assign.id, ADDON_MOD_ASSIGN_MODNAME, { siteId }));
// Get course data, needed to determine upload max size if it's configured to be course limit.
promises.push(CorePromiseUtils.ignoreErrors(CoreCourses.getCourseByField('id', courseId, siteId)));
promises.push(CorePromiseUtils.ignoreErrors(CoreCourses.getCourseByField('id', courseId, { siteId })));

// Download intro files and attachments. Do not call getFiles because it'd call some WS twice.
let files: CoreWSFile[] = assign.introattachments || [];
Expand Down
1 change: 1 addition & 0 deletions src/addons/mod/bigbluebuttonbn/bigbluebuttonbn.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const routes: Routes = [
{
path: `${ADDON_MOD_BBB_PAGE_NAME}/:courseId/:cmId`,
loadComponent: () => import('./pages/index/index'),
data: { checkForcedLanguage: 'module' },
},
];

Expand Down
14 changes: 14 additions & 0 deletions src/addons/mod/bigbluebuttonbn/services/handlers/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { makeSingleton } from '@singletons';
import { AddonModBBB } from '../bigbluebuttonbn';
import { ADDON_MOD_BBB_COMPONENT, ADDON_MOD_BBB_MODNAME, ADDON_MOD_BBB_PAGE_NAME } from '../../constants';
import { ModFeature, ModPurpose } from '@addons/mod/constants';
import { CoreSitesReadingStrategy } from '@services/sites';

/**
* Handler to support Big Blue Button activities.
Expand Down Expand Up @@ -103,6 +104,19 @@ export class AddonModBBBModuleHandlerService extends CoreModuleHandlerBase imple
return AddonModBBBIndexComponent;
}

/**
* @inheritdoc
*/
async getModuleForcedLang(module: CoreCourseModuleData): Promise<string | undefined> {
const mod = await AddonModBBB.getBBB(
module.course,
module.id,
{ readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE },
);

return mod?.lang;
}

}

export const AddonModBBBModuleHandler = makeSingleton(AddonModBBBModuleHandlerService);
1 change: 1 addition & 0 deletions src/addons/mod/book/book.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const routes: Routes = [
loadComponent: () => import('./pages/contents/contents'),
},
],
data: { checkForcedLanguage: 'module' },
},
];

Expand Down
15 changes: 15 additions & 0 deletions src/addons/mod/book/services/handlers/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import { makeSingleton } from '@singletons';
import { CoreModuleHandlerBase } from '@features/course/classes/module-base-handler';
import { ADDON_MOD_BOOK_COMPONENT, ADDON_MOD_BOOK_MODNAME, ADDON_MOD_BOOK_PAGE_NAME } from '../../constants';
import { ModFeature, ModArchetype, ModPurpose } from '@addons/mod/constants';
import { CoreCourseModuleData } from '@features/course/services/course-helper';
import { CoreSitesReadingStrategy } from '@services/sites';

/**
* Handler to support book modules.
Expand Down Expand Up @@ -59,5 +61,18 @@ export class AddonModBookModuleHandlerService extends CoreModuleHandlerBase impl
return AddonModBookIndexComponent;
}

/**
* @inheritdoc
*/
async getModuleForcedLang(module: CoreCourseModuleData): Promise<string | undefined> {
const mod = await AddonModBook.getBook(
module.course,
module.id,
{ readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE },
);

return mod?.lang;
}

}
export const AddonModBookModuleHandler = makeSingleton(AddonModBookModuleHandlerService);
1 change: 1 addition & 0 deletions src/addons/mod/chat/chat.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const routes: Routes = [
...conditionalRoutes(mobileRoutes, () => CoreScreen.isMobile),
...conditionalRoutes(tabletRoutes, () => CoreScreen.isTablet),
],
data: { checkForcedLanguage: 'module' },
},
];

Expand Down
16 changes: 16 additions & 0 deletions src/addons/mod/chat/services/handlers/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import { CoreCourseModuleHandler } from '@features/course/services/module-delega
import { makeSingleton } from '@singletons';
import { ADDON_MOD_CHAT_MODNAME, ADDON_MOD_CHAT_PAGE_NAME } from '../../constants';
import { ModFeature, ModPurpose } from '@addons/mod/constants';
import { AddonModChat } from '../chat';
import { CoreCourseModuleData } from '@features/course/services/course-helper';
import { CoreSitesReadingStrategy } from '@services/sites';

/**
* Handler to support chat modules.
Expand Down Expand Up @@ -50,6 +53,19 @@ export class AddonModChatModuleHandlerService extends CoreModuleHandlerBase impl
return AddonModChatIndexComponent;
}

/**
* @inheritdoc
*/
async getModuleForcedLang(module: CoreCourseModuleData): Promise<string | undefined> {
const mod = await AddonModChat.getChat(
module.course,
module.id,
{ readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE },
);

return mod?.lang;
}

}

export const AddonModChatModuleHandler = makeSingleton(AddonModChatModuleHandlerService);
1 change: 1 addition & 0 deletions src/addons/mod/choice/choice.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const routes: Routes = [
{
path: `${ADDON_MOD_CHOICE_PAGE_NAME}/:courseId/:cmId`,
loadComponent: () => import('./pages/index/index'),
data: { checkForcedLanguage: 'module' },
},
];

Expand Down
16 changes: 16 additions & 0 deletions src/addons/mod/choice/services/handlers/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import { CoreCourseModuleHandler } from '@features/course/services/module-delega
import { makeSingleton } from '@singletons';
import { ADDON_MOD_CHOICE_MODNAME, ADDON_MOD_CHOICE_PAGE_NAME } from '../../constants';
import { ModFeature, ModPurpose } from '@addons/mod/constants';
import { AddonModChoice } from '../choice';
import { CoreCourseModuleData } from '@features/course/services/course-helper';
import { CoreSitesReadingStrategy } from '@services/sites';

/**
* Handler to support choice modules.
Expand Down Expand Up @@ -51,6 +54,19 @@ export class AddonModChoiceModuleHandlerService extends CoreModuleHandlerBase im
return AddonModChoiceIndexComponent;
}

/**
* @inheritdoc
*/
async getModuleForcedLang(module: CoreCourseModuleData): Promise<string | undefined> {
const mod = await AddonModChoice.getChoice(
module.course,
module.id,
{ readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE },
);

return mod?.lang;
}

}

export const AddonModChoiceModuleHandler = makeSingleton(AddonModChoiceModuleHandlerService);
1 change: 1 addition & 0 deletions src/addons/mod/data/data.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const routes: Routes = [
loadComponent: () => import('./pages/entry/entry'),
},
],
data: { checkForcedLanguage: 'module' },
},
];

Expand Down
16 changes: 16 additions & 0 deletions src/addons/mod/data/services/handlers/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import { CoreCourseModuleHandler } from '@features/course/services/module-delega
import { makeSingleton } from '@singletons';
import { ADDON_MOD_DATA_COMPONENT, ADDON_MOD_DATA_MODNAME, ADDON_MOD_DATA_PAGE_NAME } from '../../constants';
import { ModFeature, ModPurpose } from '@addons/mod/constants';
import { AddonModData } from '../data';
import { CoreCourseModuleData } from '@features/course/services/course-helper';
import { CoreSitesReadingStrategy } from '@services/sites';

/**
* Handler to support data modules.
Expand Down Expand Up @@ -53,5 +56,18 @@ export class AddonModDataModuleHandlerService extends CoreModuleHandlerBase impl
return AddonModDataIndexComponent;
}

/**
* @inheritdoc
*/
async getModuleForcedLang(module: CoreCourseModuleData): Promise<string | undefined> {
const mod = await AddonModData.getDatabase(
module.course,
module.id,
{ readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE },
);

return mod?.lang;
}

}
export const AddonModDataModuleHandler = makeSingleton(AddonModDataModuleHandlerService);
2 changes: 1 addition & 1 deletion src/addons/mod/data/services/handlers/prefetch-lazy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ export class AddonModDataPrefetchHandlerLazyService extends AddonModDataPrefetch
promises.push(CoreCourse.getModuleBasicInfoByInstance(database.id, ADDON_MOD_DATA_MODNAME, { siteId }));

// Get course data, needed to determine upload max size if it's configured to be course limit.
promises.push(CorePromiseUtils.ignoreErrors(CoreCourses.getCourseByField('id', courseId, siteId)));
promises.push(CorePromiseUtils.ignoreErrors(CoreCourses.getCourseByField('id', courseId, { siteId })));

await Promise.all(promises);
}
Expand Down
1 change: 1 addition & 0 deletions src/addons/mod/feedback/feedback.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const tabletRoutes: Routes = [
loadComponent: () => import('./pages/attempt/attempt'),
},
],
data: { checkForcedLanguage: 'module' },
},
];

Expand Down
16 changes: 16 additions & 0 deletions src/addons/mod/feedback/services/handlers/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import { makeSingleton } from '@singletons';
import { CoreModuleHandlerBase } from '@features/course/classes/module-base-handler';
import { ADDON_MOD_FEEDBACK_MODNAME, ADDON_MOD_FEEDBACK_PAGE_NAME } from '../../constants';
import { ModFeature, ModPurpose } from '@addons/mod/constants';
import { AddonModFeedback } from '../feedback';
import { CoreCourseModuleData } from '@features/course/services/course-helper';
import { CoreSitesReadingStrategy } from '@services/sites';

/**
* Handler to support feedback modules.
Expand Down Expand Up @@ -51,6 +54,19 @@ export class AddonModFeedbackModuleHandlerService extends CoreModuleHandlerBase
return AddonModFeedbackIndexComponent;
}

/**
* @inheritdoc
*/
async getModuleForcedLang(module: CoreCourseModuleData): Promise<string | undefined> {
const mod = await AddonModFeedback.getFeedback(
module.course,
module.id,
{ readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE },
);

return mod?.lang;
}

}

export const AddonModFeedbackModuleHandler = makeSingleton(AddonModFeedbackModuleHandlerService);
1 change: 1 addition & 0 deletions src/addons/mod/folder/folder.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const routes: Routes = [
pathMatch: 'full',
},
],
data: { checkForcedLanguage: 'module' },
},
];

Expand Down
15 changes: 15 additions & 0 deletions src/addons/mod/folder/services/handlers/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import { convertTextToHTMLElement } from '@/core/utils/create-html-element';
import { makeSingleton } from '@singletons';
import { ADDON_MOD_FOLDER_MODNAME, ADDON_MOD_FOLDER_PAGE_NAME } from '../../constants';
import { ModFeature, ModArchetype, ModPurpose } from '@addons/mod/constants';
import { AddonModFolder } from '../folder';
import { CoreSitesReadingStrategy } from '@services/sites';

/**
* Handler to support folder modules.
Expand Down Expand Up @@ -89,5 +91,18 @@ export class AddonModFolderModuleHandlerService extends CoreModuleHandlerBase im
return AddonModFolderIndexComponent;
}

/**
* @inheritdoc
*/
async getModuleForcedLang(module: CoreCourseModuleData): Promise<string | undefined> {
const mod = await AddonModFolder.getFolder(
module.course,
module.id,
{ readingStrategy: CoreSitesReadingStrategy.PREFER_CACHE },
);

return mod?.lang;
}

}
export const AddonModFolderModuleHandler = makeSingleton(AddonModFolderModuleHandlerService);
1 change: 1 addition & 0 deletions src/addons/mod/forum/forum.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const mainMenuRoutes: Routes = [
...conditionalRoutes(mobileRoutes, () => CoreScreen.isMobile),
...conditionalRoutes(tabletRoutes, () => CoreScreen.isTablet),
],
data: { checkForcedLanguage: 'module' },
},
...conditionalRoutes(
[
Expand Down
Loading
Loading