diff --git a/scripts/langindex.json b/scripts/langindex.json index 1c93939d1..1652f0a84 100644 --- a/scripts/langindex.json +++ b/scripts/langindex.json @@ -204,6 +204,7 @@ "addon.mod_assign.markingworkflowstatereadyforrelease": "assign", "addon.mod_assign.markingworkflowstatereadyforreview": "assign", "addon.mod_assign.markingworkflowstatereleased": "assign", + "addon.mod_assign.modulenameplural": "assign", "addon.mod_assign.multipleteams": "assign", "addon.mod_assign.multipleteams_desc": "assign", "addon.mod_assign.noattempt": "assign", @@ -258,6 +259,7 @@ "addon.mod_assign_submission_file.pluginname": "assignsubmission_file", "addon.mod_assign_submission_onlinetext.pluginname": "assignsubmission_onlinetext", "addon.mod_book.errorchapter": "book", + "addon.mod_book.modulenameplural": "book", "addon.mod_chat.beep": "chat", "addon.mod_chat.currentusers": "chat", "addon.mod_chat.enterchat": "chat", @@ -270,6 +272,7 @@ "addon.mod_chat.messagebeepsyou": "chat", "addon.mod_chat.messageenter": "chat", "addon.mod_chat.messageexit": "chat", + "addon.mod_chat.modulenameplural": "chat", "addon.mod_chat.mustbeonlinetosendmessages": "local_moodlemobileapp", "addon.mod_chat.nomessages": "chat", "addon.mod_chat.send": "chat", @@ -280,6 +283,7 @@ "addon.mod_choice.errorgetchoice": "local_moodlemobileapp", "addon.mod_choice.expired": "choice", "addon.mod_choice.full": "choice", + "addon.mod_choice.modulenameplural": "choice", "addon.mod_choice.noresultsviewable": "choice", "addon.mod_choice.notopenyet": "choice", "addon.mod_choice.numberofuser": "choice", @@ -319,6 +323,7 @@ "addon.mod_data.fields": "data", "addon.mod_data.latlongboth": "data", "addon.mod_data.menuchoose": "data", + "addon.mod_data.modulenameplural": "data", "addon.mod_data.more": "data", "addon.mod_data.nomatch": "data", "addon.mod_data.norecords": "data", @@ -350,6 +355,7 @@ "addon.mod_feedback.feedbackopen": "feedback", "addon.mod_feedback.mapcourses": "feedback", "addon.mod_feedback.mode": "feedback", + "addon.mod_feedback.modulenameplural": "feedback", "addon.mod_feedback.next_page": "feedback", "addon.mod_feedback.non_anonymous": "feedback", "addon.mod_feedback.non_anonymous_entries": "feedback", @@ -370,6 +376,7 @@ "addon.mod_feedback.started": "feedback", "addon.mod_feedback.this_feedback_is_already_submitted": "feedback", "addon.mod_folder.emptyfilelist": "local_moodlemobileapp", + "addon.mod_folder.modulenameplural": "folder", "addon.mod_forum.addanewdiscussion": "forum", "addon.mod_forum.addanewquestion": "forum", "addon.mod_forum.addanewtopic": "forum", @@ -392,6 +399,7 @@ "addon.mod_forum.modeflatnewestfirst": "forum", "addon.mod_forum.modeflatoldestfirst": "forum", "addon.mod_forum.modenested": "forum", + "addon.mod_forum.modulenameplural": "forum", "addon.mod_forum.numdiscussions": "local_moodlemobileapp", "addon.mod_forum.numreplies": "local_moodlemobileapp", "addon.mod_forum.posttoforum": "forum", @@ -427,9 +435,11 @@ "addon.mod_glossary.fillfields": "glossary", "addon.mod_glossary.fullmatch": "glossary", "addon.mod_glossary.linking": "glossary", + "addon.mod_glossary.modulenameplural": "glossary", "addon.mod_glossary.noentriesfound": "local_moodlemobileapp", "addon.mod_glossary.searchquery": "local_moodlemobileapp", "addon.mod_imscp.deploymenterror": "imscp", + "addon.mod_imscp.modulenameplural": "imscp", "addon.mod_imscp.showmoduledescription": "local_moodlemobileapp", "addon.mod_lesson.answer": "lesson", "addon.mod_lesson.attempt": "lesson", @@ -473,6 +483,7 @@ "addon.mod_lesson.lowtime": "lesson", "addon.mod_lesson.maximumnumberofattemptsreached": "lesson", "addon.mod_lesson.modattemptsnoteacher": "lesson", + "addon.mod_lesson.modulenameplural": "lesson", "addon.mod_lesson.noanswer": "lesson", "addon.mod_lesson.nolessonattempts": "lesson", "addon.mod_lesson.nolessonattemptsgroup": "lesson", @@ -517,7 +528,9 @@ "addon.mod_lti.errorgetlti": "local_moodlemobileapp", "addon.mod_lti.errorinvalidlaunchurl": "local_moodlemobileapp", "addon.mod_lti.launchactivity": "local_moodlemobileapp", + "addon.mod_lti.modulenameplural": "lti", "addon.mod_page.errorwhileloadingthepage": "local_moodlemobileapp", + "addon.mod_page.modulenameplural": "page", "addon.mod_quiz.attemptfirst": "quiz", "addon.mod_quiz.attemptlast": "quiz", "addon.mod_quiz.attemptnumber": "quiz", @@ -552,6 +565,7 @@ "addon.mod_quiz.grademethod": "quiz", "addon.mod_quiz.gradesofar": "quiz", "addon.mod_quiz.marks": "quiz", + "addon.mod_quiz.modulenameplural": "quiz", "addon.mod_quiz.mustbesubmittedby": "quiz", "addon.mod_quiz.noquestions": "quiz", "addon.mod_quiz.noreviewattempt": "quiz", @@ -596,6 +610,7 @@ "addon.mod_quiz.yourfinalgradeis": "quiz", "addon.mod_resource.errorwhileloadingthecontent": "local_moodlemobileapp", "addon.mod_resource.modifieddate": "resource", + "addon.mod_resource.modulenameplural": "resource", "addon.mod_resource.openthefile": "local_moodlemobileapp", "addon.mod_resource.uploadeddate": "resource", "addon.mod_scorm.asset": "scorm", @@ -632,6 +647,7 @@ "addon.mod_scorm.incomplete": "scorm", "addon.mod_scorm.lastattempt": "scorm", "addon.mod_scorm.mode": "scorm", + "addon.mod_scorm.modulenameplural": "scorm", "addon.mod_scorm.newattempt": "scorm", "addon.mod_scorm.noattemptsallowed": "scorm", "addon.mod_scorm.noattemptsmade": "scorm", @@ -651,10 +667,12 @@ "addon.mod_survey.errorgetsurvey": "local_moodlemobileapp", "addon.mod_survey.ifoundthat": "survey", "addon.mod_survey.ipreferthat": "survey", + "addon.mod_survey.modulenameplural": "survey", "addon.mod_survey.responses": "survey", "addon.mod_survey.results": "local_moodlemobileapp", "addon.mod_survey.surveycompletednograph": "survey", "addon.mod_url.accessurl": "local_moodlemobileapp", + "addon.mod_url.modulenameplural": "url", "addon.mod_url.pointingtourl": "local_moodlemobileapp", "addon.mod_wiki.cannoteditpage": "wiki", "addon.mod_wiki.createpage": "wiki", @@ -663,6 +681,7 @@ "addon.mod_wiki.errornowikiavailable": "local_moodlemobileapp", "addon.mod_wiki.gowikihome": "local_moodlemobileapp", "addon.mod_wiki.map": "wiki", + "addon.mod_wiki.modulenameplural": "wiki", "addon.mod_wiki.newpagehdr": "wiki", "addon.mod_wiki.newpagetitle": "wiki", "addon.mod_wiki.nocontent": "wiki", @@ -701,6 +720,7 @@ "addon.mod_workshop.gradinggradecalculated": "workshop", "addon.mod_workshop.gradinggradeof": "workshop", "addon.mod_workshop.gradinggradeover": "workshop", + "addon.mod_workshop.modulenameplural": "workshop", "addon.mod_workshop.nogradeyet": "workshop", "addon.mod_workshop.notassessed": "workshop", "addon.mod_workshop.notoverridden": "workshop", diff --git a/src/addon/block/activitymodules/components/activitymodules/addon-block-activitymodules.html b/src/addon/block/activitymodules/components/activitymodules/addon-block-activitymodules.html index 226012314..1692ba8d2 100644 --- a/src/addon/block/activitymodules/components/activitymodules/addon-block-activitymodules.html +++ b/src/addon/block/activitymodules/components/activitymodules/addon-block-activitymodules.html @@ -1,5 +1,5 @@ - + diff --git a/src/addon/mod/assign/assign.module.ts b/src/addon/mod/assign/assign.module.ts index aa4a60739..39a87ad9d 100644 --- a/src/addon/mod/assign/assign.module.ts +++ b/src/addon/mod/assign/assign.module.ts @@ -29,6 +29,7 @@ import { AddonModAssignModuleHandler } from './providers/module-handler'; import { AddonModAssignPrefetchHandler } from './providers/prefetch-handler'; import { AddonModAssignSyncCronHandler } from './providers/sync-cron-handler'; import { AddonModAssignIndexLinkHandler } from './providers/index-link-handler'; +import { AddonModAssignListLinkHandler } from './providers/list-link-handler'; import { AddonModAssignSubmissionModule } from './submission/submission.module'; import { AddonModAssignFeedbackModule } from './feedback/feedback.module'; import { CoreUpdateManagerProvider } from '@providers/update-manager'; @@ -62,18 +63,22 @@ export const ADDON_MOD_ASSIGN_PROVIDERS: any[] = [ AddonModAssignModuleHandler, AddonModAssignPrefetchHandler, AddonModAssignSyncCronHandler, - AddonModAssignIndexLinkHandler + AddonModAssignIndexLinkHandler, + AddonModAssignListLinkHandler ] }) export class AddonModAssignModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModAssignModuleHandler, prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModAssignPrefetchHandler, cronDelegate: CoreCronDelegate, syncHandler: AddonModAssignSyncCronHandler, updateManager: CoreUpdateManagerProvider, - contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModAssignIndexLinkHandler) { + contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModAssignIndexLinkHandler, + listLinkHandler: AddonModAssignListLinkHandler) { + moduleDelegate.registerHandler(moduleHandler); prefetchDelegate.registerHandler(prefetchHandler); cronDelegate.register(syncHandler); contentLinksDelegate.registerHandler(linkHandler); + contentLinksDelegate.registerHandler(listLinkHandler); // Allow migrating the tables from the old app to the new schema. updateManager.registerSiteTablesMigration([ diff --git a/src/addon/mod/assign/lang/en.json b/src/addon/mod/assign/lang/en.json index 606bc2ff8..fbbe9f662 100644 --- a/src/addon/mod/assign/lang/en.json +++ b/src/addon/mod/assign/lang/en.json @@ -50,6 +50,7 @@ "markingworkflowstatereadyforreview": "Marking completed", "markingworkflowstatereadyforrelease": "Ready for release", "markingworkflowstatereleased": "Released", + "modulenameplural": "Assignments", "multipleteams": "Member of more than one group", "multipleteams_desc": "The assignment requires submission in groups. You are a member of more than one group. To be able to submit you must be a member of only one group. Please contact your teacher to change your group membership.", "noattempt": "No attempt", diff --git a/src/addon/mod/assign/providers/list-link-handler.ts b/src/addon/mod/assign/providers/list-link-handler.ts new file mode 100644 index 000000000..9e5315d04 --- /dev/null +++ b/src/addon/mod/assign/providers/list-link-handler.ts @@ -0,0 +1,41 @@ +// (C) Copyright 2015 Martin Dougiamas +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { Injectable } from '@angular/core'; +import { CoreContentLinksModuleListHandler } from '@core/contentlinks/classes/module-list-handler'; +import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; +import { TranslateService } from '@ngx-translate/core'; +import { AddonModAssignProvider } from './assign'; + +/** + * Handler to treat links to assign list page. + */ +@Injectable() +export class AddonModAssignListLinkHandler extends CoreContentLinksModuleListHandler { + name = 'AddonModAssignListLinkHandler'; + + constructor(linkHelper: CoreContentLinksHelperProvider, translate: TranslateService, + protected assignProvider: AddonModAssignProvider) { + super(linkHelper, translate, 'AddonModAssign', 'assign'); + } + + /** + * Check if the handler is enabled on a site level. + * + * @return {boolean} Whether or not the handler is enabled on a site level. + */ + isEnabled(): boolean { + return this.assignProvider.isPluginEnabled(); + } +} diff --git a/src/addon/mod/book/book.module.ts b/src/addon/mod/book/book.module.ts index 8fd036e53..cc06e008d 100644 --- a/src/addon/mod/book/book.module.ts +++ b/src/addon/mod/book/book.module.ts @@ -17,6 +17,7 @@ import { AddonModBookComponentsModule } from './components/components.module'; import { AddonModBookProvider } from './providers/book'; import { AddonModBookModuleHandler } from './providers/module-handler'; import { AddonModBookLinkHandler } from './providers/link-handler'; +import { AddonModBookListLinkHandler } from './providers/list-link-handler'; import { AddonModBookPrefetchHandler } from './providers/prefetch-handler'; import { CoreCourseModuleDelegate } from '@core/course/providers/module-delegate'; import { CoreContentLinksDelegate } from '@core/contentlinks/providers/delegate'; @@ -37,15 +38,19 @@ export const ADDON_MOD_BOOK_PROVIDERS: any[] = [ AddonModBookProvider, AddonModBookModuleHandler, AddonModBookLinkHandler, + AddonModBookListLinkHandler, AddonModBookPrefetchHandler ] }) export class AddonModBookModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModBookModuleHandler, contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModBookLinkHandler, - prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModBookPrefetchHandler) { + prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModBookPrefetchHandler, + listLinkHandler: AddonModBookListLinkHandler) { + moduleDelegate.registerHandler(moduleHandler); contentLinksDelegate.registerHandler(linkHandler); + contentLinksDelegate.registerHandler(listLinkHandler); prefetchDelegate.registerHandler(prefetchHandler); } } diff --git a/src/addon/mod/book/lang/en.json b/src/addon/mod/book/lang/en.json index 5ea91c840..bf58bf921 100644 --- a/src/addon/mod/book/lang/en.json +++ b/src/addon/mod/book/lang/en.json @@ -1,3 +1,4 @@ { - "errorchapter": "Error reading chapter of book." + "errorchapter": "Error reading chapter of book.", + "modulenameplural": "Books" } \ No newline at end of file diff --git a/src/addon/mod/book/providers/list-link-handler.ts b/src/addon/mod/book/providers/list-link-handler.ts new file mode 100644 index 000000000..5351a9ae4 --- /dev/null +++ b/src/addon/mod/book/providers/list-link-handler.ts @@ -0,0 +1,46 @@ +// (C) Copyright 2015 Martin Dougiamas +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { Injectable } from '@angular/core'; +import { CoreContentLinksModuleListHandler } from '@core/contentlinks/classes/module-list-handler'; +import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; +import { TranslateService } from '@ngx-translate/core'; +import { AddonModBookProvider } from './book'; + +/** + * Handler to treat links to book list page. + */ +@Injectable() +export class AddonModBookListLinkHandler extends CoreContentLinksModuleListHandler { + name = 'AddonModBookListLinkHandler'; + + constructor(linkHelper: CoreContentLinksHelperProvider, translate: TranslateService, + protected bookProvider: AddonModBookProvider) { + super(linkHelper, translate, 'AddonModBook', 'book'); + } + + /** + * Check if the handler is enabled for a certain site (site + user) and a URL. + * If not defined, defaults to true. + * + * @param {string} siteId The site ID. + * @param {string} url The URL to treat. + * @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param {number} [courseId] Course ID related to the URL. Optional but recommended. + * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + */ + isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { + return this.bookProvider.isPluginEnabled(); + } +} diff --git a/src/addon/mod/chat/chat.module.ts b/src/addon/mod/chat/chat.module.ts index bcda38f20..62ce5d80b 100644 --- a/src/addon/mod/chat/chat.module.ts +++ b/src/addon/mod/chat/chat.module.ts @@ -18,6 +18,7 @@ import { CoreCourseModuleDelegate } from '@core/course/providers/module-delegate import { AddonModChatComponentsModule } from './components/components.module'; import { AddonModChatProvider } from './providers/chat'; import { AddonModChatLinkHandler } from './providers/link-handler'; +import { AddonModChatListLinkHandler } from './providers/list-link-handler'; import { AddonModChatModuleHandler } from './providers/module-handler'; // List of providers (without handlers). @@ -34,13 +35,17 @@ export const ADDON_MOD_CHAT_PROVIDERS: any[] = [ providers: [ AddonModChatProvider, AddonModChatLinkHandler, + AddonModChatListLinkHandler, AddonModChatModuleHandler, ] }) export class AddonModChatModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModChatModuleHandler, - contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModChatLinkHandler) { + contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModChatLinkHandler, + listLinkHandler: AddonModChatListLinkHandler) { + moduleDelegate.registerHandler(moduleHandler); contentLinksDelegate.registerHandler(linkHandler); + contentLinksDelegate.registerHandler(listLinkHandler); } } diff --git a/src/addon/mod/chat/lang/en.json b/src/addon/mod/chat/lang/en.json index 7fc12c00c..30f9613ca 100644 --- a/src/addon/mod/chat/lang/en.json +++ b/src/addon/mod/chat/lang/en.json @@ -11,6 +11,7 @@ "messagebeepsyou": "{{$a}} has just beeped you!", "messageenter": "{{$a}} has just entered this chat", "messageexit": "{{$a}} has left this chat", + "modulenameplural": "Chats", "mustbeonlinetosendmessages": "You must be online to send messages.", "nomessages": "No messages yet", "send": "Send", diff --git a/src/addon/mod/chat/providers/list-link-handler.ts b/src/addon/mod/chat/providers/list-link-handler.ts new file mode 100644 index 000000000..19a32ed04 --- /dev/null +++ b/src/addon/mod/chat/providers/list-link-handler.ts @@ -0,0 +1,30 @@ +// (C) Copyright 2015 Martin Dougiamas +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { Injectable } from '@angular/core'; +import { CoreContentLinksModuleListHandler } from '@core/contentlinks/classes/module-list-handler'; +import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; +import { TranslateService } from '@ngx-translate/core'; + +/** + * Handler to treat links to chat list page. + */ +@Injectable() +export class AddonModChatListLinkHandler extends CoreContentLinksModuleListHandler { + name = 'AddonModChatListLinkHandler'; + + constructor(linkHelper: CoreContentLinksHelperProvider, translate: TranslateService) { + super(linkHelper, translate, 'AddonModChat', 'chat'); + } +} diff --git a/src/addon/mod/choice/choice.module.ts b/src/addon/mod/choice/choice.module.ts index 501f10bfa..7b08793fb 100644 --- a/src/addon/mod/choice/choice.module.ts +++ b/src/addon/mod/choice/choice.module.ts @@ -21,6 +21,7 @@ import { AddonModChoiceComponentsModule } from './components/components.module'; import { AddonModChoiceModuleHandler } from './providers/module-handler'; import { AddonModChoiceProvider } from './providers/choice'; import { AddonModChoiceLinkHandler } from './providers/link-handler'; +import { AddonModChoiceListLinkHandler } from './providers/list-link-handler'; import { AddonModChoicePrefetchHandler } from './providers/prefetch-handler'; import { AddonModChoiceSyncProvider } from './providers/sync'; import { AddonModChoiceSyncCronHandler } from './providers/sync-cron-handler'; @@ -47,6 +48,7 @@ export const ADDON_MOD_CHOICE_PROVIDERS: any[] = [ AddonModChoiceModuleHandler, AddonModChoicePrefetchHandler, AddonModChoiceLinkHandler, + AddonModChoiceListLinkHandler, AddonModChoiceSyncCronHandler ] }) @@ -54,10 +56,13 @@ export class AddonModChoiceModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModChoiceModuleHandler, prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModChoicePrefetchHandler, contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModChoiceLinkHandler, - cronDelegate: CoreCronDelegate, syncHandler: AddonModChoiceSyncCronHandler, updateManager: CoreUpdateManagerProvider) { + cronDelegate: CoreCronDelegate, syncHandler: AddonModChoiceSyncCronHandler, updateManager: CoreUpdateManagerProvider, + listLinkHandler: AddonModChoiceListLinkHandler) { + moduleDelegate.registerHandler(moduleHandler); prefetchDelegate.registerHandler(prefetchHandler); contentLinksDelegate.registerHandler(linkHandler); + contentLinksDelegate.registerHandler(listLinkHandler); cronDelegate.register(syncHandler); // Allow migrating the tables from the old app to the new schema. diff --git a/src/addon/mod/choice/lang/en.json b/src/addon/mod/choice/lang/en.json index 7a8a95ea6..a0714b34a 100644 --- a/src/addon/mod/choice/lang/en.json +++ b/src/addon/mod/choice/lang/en.json @@ -4,6 +4,7 @@ "errorgetchoice": "Error getting choice data.", "expired": "Sorry, this activity closed on {{$a}} and is no longer available", "full": "(Full)", + "modulenameplural": "Choices", "noresultsviewable": "The results are not currently viewable.", "notopenyet": "Sorry, this activity is not available until {{$a}}", "numberofuser": "Number of responses", diff --git a/src/addon/mod/choice/providers/list-link-handler.ts b/src/addon/mod/choice/providers/list-link-handler.ts new file mode 100644 index 000000000..ad4aec0f6 --- /dev/null +++ b/src/addon/mod/choice/providers/list-link-handler.ts @@ -0,0 +1,30 @@ +// (C) Copyright 2015 Martin Dougiamas +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { Injectable } from '@angular/core'; +import { CoreContentLinksModuleListHandler } from '@core/contentlinks/classes/module-list-handler'; +import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; +import { TranslateService } from '@ngx-translate/core'; + +/** + * Handler to treat links to choice list page. + */ +@Injectable() +export class AddonModChoiceListLinkHandler extends CoreContentLinksModuleListHandler { + name = 'AddonModChoiceListLinkHandler'; + + constructor(linkHelper: CoreContentLinksHelperProvider, translate: TranslateService) { + super(linkHelper, translate, 'AddonModChoice', 'choice'); + } +} diff --git a/src/addon/mod/data/data.module.ts b/src/addon/mod/data/data.module.ts index 6ddb96d55..9babfa364 100644 --- a/src/addon/mod/data/data.module.ts +++ b/src/addon/mod/data/data.module.ts @@ -25,6 +25,7 @@ import { AddonModDataApproveLinkHandler } from './providers/approve-link-handler import { AddonModDataDeleteLinkHandler } from './providers/delete-link-handler'; import { AddonModDataShowLinkHandler } from './providers/show-link-handler'; import { AddonModDataEditLinkHandler } from './providers/edit-link-handler'; +import { AddonModDataListLinkHandler } from './providers/list-link-handler'; import { AddonModDataHelperProvider } from './providers/helper'; import { AddonModDataPrefetchHandler } from './providers/prefetch-handler'; import { AddonModDataSyncProvider } from './providers/sync'; @@ -64,6 +65,7 @@ export const ADDON_MOD_DATA_PROVIDERS: any[] = [ AddonModDataDeleteLinkHandler, AddonModDataShowLinkHandler, AddonModDataEditLinkHandler, + AddonModDataListLinkHandler, AddonModDataSyncCronHandler, AddonModDataDefaultFieldHandler ] @@ -74,7 +76,9 @@ export class AddonModDataModule { contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModDataLinkHandler, cronDelegate: CoreCronDelegate, syncHandler: AddonModDataSyncCronHandler, updateManager: CoreUpdateManagerProvider, approveLinkHandler: AddonModDataApproveLinkHandler, deleteLinkHandler: AddonModDataDeleteLinkHandler, - showLinkHandler: AddonModDataShowLinkHandler, editLinkHandler: AddonModDataEditLinkHandler) { + showLinkHandler: AddonModDataShowLinkHandler, editLinkHandler: AddonModDataEditLinkHandler, + listLinkHandler: AddonModDataListLinkHandler) { + moduleDelegate.registerHandler(moduleHandler); prefetchDelegate.registerHandler(prefetchHandler); contentLinksDelegate.registerHandler(linkHandler); @@ -82,6 +86,7 @@ export class AddonModDataModule { contentLinksDelegate.registerHandler(deleteLinkHandler); contentLinksDelegate.registerHandler(showLinkHandler); contentLinksDelegate.registerHandler(editLinkHandler); + contentLinksDelegate.registerHandler(listLinkHandler); cronDelegate.register(syncHandler); // Allow migrating the tables from the old app to the new schema. diff --git a/src/addon/mod/data/lang/en.json b/src/addon/mod/data/lang/en.json index fdd3f402a..0f38a537f 100644 --- a/src/addon/mod/data/lang/en.json +++ b/src/addon/mod/data/lang/en.json @@ -20,6 +20,7 @@ "fields": "Fields", "latlongboth": "Both latitude and longitude are required.", "menuchoose": "Choose...", + "modulenameplural": "Databases", "more": "More", "nomatch": "No matching entries found!", "norecords": "No entries in database", diff --git a/src/addon/mod/data/providers/list-link-handler.ts b/src/addon/mod/data/providers/list-link-handler.ts new file mode 100644 index 000000000..6ca26006a --- /dev/null +++ b/src/addon/mod/data/providers/list-link-handler.ts @@ -0,0 +1,41 @@ +// (C) Copyright 2015 Martin Dougiamas +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { Injectable } from '@angular/core'; +import { CoreContentLinksModuleListHandler } from '@core/contentlinks/classes/module-list-handler'; +import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; +import { TranslateService } from '@ngx-translate/core'; +import { AddonModDataProvider } from './data'; + +/** + * Handler to treat links to data list page. + */ +@Injectable() +export class AddonModDataListLinkHandler extends CoreContentLinksModuleListHandler { + name = 'AddonModDataListLinkHandler'; + + constructor(linkHelper: CoreContentLinksHelperProvider, translate: TranslateService, + protected dataProvider: AddonModDataProvider) { + super(linkHelper, translate, 'AddonModData', 'data'); + } + + /** + * Check if the handler is enabled on a site level. + * + * @return {Promise} Whether or not the handler is enabled on a site level. + */ + isEnabled(): Promise { + return this.dataProvider.isPluginEnabled(); + } +} diff --git a/src/addon/mod/feedback/feedback.module.ts b/src/addon/mod/feedback/feedback.module.ts index ce5673747..ded66de7e 100644 --- a/src/addon/mod/feedback/feedback.module.ts +++ b/src/addon/mod/feedback/feedback.module.ts @@ -26,6 +26,7 @@ import { AddonModFeedbackShowEntriesLinkHandler } from './providers/show-entries import { AddonModFeedbackShowNonRespondentsLinkHandler } from './providers/show-non-respondents-link-handler'; import { AddonModFeedbackCompleteLinkHandler } from './providers/complete-link-handler'; import { AddonModFeedbackPrintLinkHandler } from './providers/print-link-handler'; +import { AddonModFeedbackListLinkHandler } from './providers/list-link-handler'; import { AddonModFeedbackHelperProvider } from './providers/helper'; import { AddonModFeedbackPrefetchHandler } from './providers/prefetch-handler'; import { AddonModFeedbackSyncProvider } from './providers/sync'; @@ -60,6 +61,7 @@ export const ADDON_MOD_FEEDBACK_PROVIDERS: any[] = [ AddonModFeedbackShowNonRespondentsLinkHandler, AddonModFeedbackCompleteLinkHandler, AddonModFeedbackPrintLinkHandler, + AddonModFeedbackListLinkHandler, AddonModFeedbackSyncCronHandler ] }) @@ -72,7 +74,8 @@ export class AddonModFeedbackModule { showEntriesLinkHandler: AddonModFeedbackShowEntriesLinkHandler, showNonRespondentsLinkHandler: AddonModFeedbackShowNonRespondentsLinkHandler, completeLinkHandler: AddonModFeedbackCompleteLinkHandler, - printLinkHandler: AddonModFeedbackPrintLinkHandler) { + printLinkHandler: AddonModFeedbackPrintLinkHandler, listLinkHandler: AddonModFeedbackListLinkHandler) { + moduleDelegate.registerHandler(moduleHandler); prefetchDelegate.registerHandler(prefetchHandler); contentLinksDelegate.registerHandler(linkHandler); @@ -81,6 +84,7 @@ export class AddonModFeedbackModule { contentLinksDelegate.registerHandler(showNonRespondentsLinkHandler); contentLinksDelegate.registerHandler(completeLinkHandler); contentLinksDelegate.registerHandler(printLinkHandler); + contentLinksDelegate.registerHandler(listLinkHandler); cronDelegate.register(syncHandler); // Allow migrating the tables from the old app to the new schema. diff --git a/src/addon/mod/feedback/lang/en.json b/src/addon/mod/feedback/lang/en.json index 3dab96d98..01eec2c06 100644 --- a/src/addon/mod/feedback/lang/en.json +++ b/src/addon/mod/feedback/lang/en.json @@ -13,6 +13,7 @@ "feedback_submitted_offline": "This feedback has been saved to be submitted later.", "mapcourses": "Map feedback to courses", "mode": "Mode", + "modulenameplural": "Feedback", "next_page": "Next page", "non_anonymous": "User's name will be logged and shown with answers", "non_anonymous_entries": "Non anonymous entries ({{$a}})", diff --git a/src/addon/mod/feedback/providers/list-link-handler.ts b/src/addon/mod/feedback/providers/list-link-handler.ts new file mode 100644 index 000000000..8d6750e0b --- /dev/null +++ b/src/addon/mod/feedback/providers/list-link-handler.ts @@ -0,0 +1,41 @@ +// (C) Copyright 2015 Martin Dougiamas +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { Injectable } from '@angular/core'; +import { CoreContentLinksModuleListHandler } from '@core/contentlinks/classes/module-list-handler'; +import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; +import { TranslateService } from '@ngx-translate/core'; +import { AddonModFeedbackProvider } from './feedback'; + +/** + * Handler to treat links to feedback list page. + */ +@Injectable() +export class AddonModFeedbackListLinkHandler extends CoreContentLinksModuleListHandler { + name = 'AddonModFeedbackListLinkHandler'; + + constructor(linkHelper: CoreContentLinksHelperProvider, translate: TranslateService, + protected feedbackProvider: AddonModFeedbackProvider) { + super(linkHelper, translate, 'AddonModFeedback', 'feedback'); + } + + /** + * Check if the handler is enabled on a site level. + * + * @return {Promise} Whether or not the handler is enabled on a site level. + */ + isEnabled(): Promise { + return this.feedbackProvider.isPluginEnabled(); + } +} diff --git a/src/addon/mod/folder/folder.module.ts b/src/addon/mod/folder/folder.module.ts index d597318f9..72f29d68c 100644 --- a/src/addon/mod/folder/folder.module.ts +++ b/src/addon/mod/folder/folder.module.ts @@ -20,6 +20,7 @@ import { CoreCourseModuleDelegate } from '@core/course/providers/module-delegate import { AddonModFolderComponentsModule } from './components/components.module'; import { AddonModFolderPrefetchHandler } from './providers/prefetch-handler'; import { AddonModFolderLinkHandler } from './providers/link-handler'; +import { AddonModFolderListLinkHandler } from './providers/list-link-handler'; import { AddonModFolderPluginFileHandler } from './providers/pluginfile-handler'; import { CoreContentLinksDelegate } from '@core/contentlinks/providers/delegate'; import { CoreCourseModulePrefetchDelegate } from '@core/course/providers/module-prefetch-delegate'; @@ -43,6 +44,7 @@ export const ADDON_MOD_FOLDER_PROVIDERS: any[] = [ AddonModFolderModuleHandler, AddonModFolderPrefetchHandler, AddonModFolderLinkHandler, + AddonModFolderListLinkHandler, AddonModFolderPluginFileHandler ] }) @@ -50,10 +52,13 @@ export class AddonModFolderModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModFolderModuleHandler, prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModFolderPrefetchHandler, contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModFolderLinkHandler, - pluginfileDelegate: CorePluginFileDelegate, pluginfileHandler: AddonModFolderPluginFileHandler) { + pluginfileDelegate: CorePluginFileDelegate, pluginfileHandler: AddonModFolderPluginFileHandler, + listLinkHandler: AddonModFolderListLinkHandler) { + moduleDelegate.registerHandler(moduleHandler); prefetchDelegate.registerHandler(prefetchHandler); contentLinksDelegate.registerHandler(linkHandler); + contentLinksDelegate.registerHandler(listLinkHandler); pluginfileDelegate.registerHandler(pluginfileHandler); } } diff --git a/src/addon/mod/folder/lang/en.json b/src/addon/mod/folder/lang/en.json index 7b622c58b..40bcdb36a 100644 --- a/src/addon/mod/folder/lang/en.json +++ b/src/addon/mod/folder/lang/en.json @@ -1,3 +1,4 @@ { - "emptyfilelist": "There are no files to show." + "emptyfilelist": "There are no files to show.", + "modulenameplural": "Folders" } \ No newline at end of file diff --git a/src/addon/mod/folder/providers/list-link-handler.ts b/src/addon/mod/folder/providers/list-link-handler.ts new file mode 100644 index 000000000..5f3fe1c82 --- /dev/null +++ b/src/addon/mod/folder/providers/list-link-handler.ts @@ -0,0 +1,30 @@ +// (C) Copyright 2015 Martin Dougiamas +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { Injectable } from '@angular/core'; +import { CoreContentLinksModuleListHandler } from '@core/contentlinks/classes/module-list-handler'; +import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; +import { TranslateService } from '@ngx-translate/core'; + +/** + * Handler to treat links to folder list page. + */ +@Injectable() +export class AddonModFolderListLinkHandler extends CoreContentLinksModuleListHandler { + name = 'AddonModFolderListLinkHandler'; + + constructor(linkHelper: CoreContentLinksHelperProvider, translate: TranslateService) { + super(linkHelper, translate, 'AddonModFolder', 'folder'); + } +} diff --git a/src/addon/mod/forum/forum.module.ts b/src/addon/mod/forum/forum.module.ts index c0455cefd..b925af0b4 100644 --- a/src/addon/mod/forum/forum.module.ts +++ b/src/addon/mod/forum/forum.module.ts @@ -26,6 +26,7 @@ import { AddonModForumPrefetchHandler } from './providers/prefetch-handler'; import { AddonModForumSyncCronHandler } from './providers/sync-cron-handler'; import { AddonModForumIndexLinkHandler } from './providers/index-link-handler'; import { AddonModForumDiscussionLinkHandler } from './providers/discussion-link-handler'; +import { AddonModForumListLinkHandler } from './providers/list-link-handler'; import { AddonModForumComponentsModule } from './components/components.module'; import { CoreUpdateManagerProvider } from '@providers/update-manager'; @@ -52,6 +53,7 @@ export const ADDON_MOD_FORUM_PROVIDERS: any[] = [ AddonModForumPrefetchHandler, AddonModForumSyncCronHandler, AddonModForumIndexLinkHandler, + AddonModForumListLinkHandler, AddonModForumDiscussionLinkHandler ] }) @@ -60,13 +62,14 @@ export class AddonModForumModule { prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModForumPrefetchHandler, cronDelegate: CoreCronDelegate, syncHandler: AddonModForumSyncCronHandler, linksDelegate: CoreContentLinksDelegate, indexHandler: AddonModForumIndexLinkHandler, discussionHandler: AddonModForumDiscussionLinkHandler, - updateManager: CoreUpdateManagerProvider) { + updateManager: CoreUpdateManagerProvider, listLinkHandler: AddonModForumListLinkHandler) { moduleDelegate.registerHandler(moduleHandler); prefetchDelegate.registerHandler(prefetchHandler); cronDelegate.register(syncHandler); linksDelegate.registerHandler(indexHandler); linksDelegate.registerHandler(discussionHandler); + linksDelegate.registerHandler(listLinkHandler); // Allow migrating the tables from the old app to the new schema. updateManager.registerSiteTablesMigration([ diff --git a/src/addon/mod/forum/lang/en.json b/src/addon/mod/forum/lang/en.json index 5a461dcfd..214e828d0 100644 --- a/src/addon/mod/forum/lang/en.json +++ b/src/addon/mod/forum/lang/en.json @@ -21,6 +21,7 @@ "modeflatnewestfirst": "Display replies flat, with newest first", "modeflatoldestfirst": "Display replies flat, with oldest first", "modenested": "Display replies in nested form", + "modulenameplural": "Forums", "numdiscussions": "{{numdiscussions}} discussions", "numreplies": "{{numreplies}} replies", "posttoforum": "Post to forum", diff --git a/src/addon/mod/forum/providers/list-link-handler.ts b/src/addon/mod/forum/providers/list-link-handler.ts new file mode 100644 index 000000000..49923c89b --- /dev/null +++ b/src/addon/mod/forum/providers/list-link-handler.ts @@ -0,0 +1,30 @@ +// (C) Copyright 2015 Martin Dougiamas +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { Injectable } from '@angular/core'; +import { CoreContentLinksModuleListHandler } from '@core/contentlinks/classes/module-list-handler'; +import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; +import { TranslateService } from '@ngx-translate/core'; + +/** + * Handler to treat links to forum list page. + */ +@Injectable() +export class AddonModForumListLinkHandler extends CoreContentLinksModuleListHandler { + name = 'AddonModForumListLinkHandler'; + + constructor(linkHelper: CoreContentLinksHelperProvider, translate: TranslateService) { + super(linkHelper, translate, 'AddonModForum', 'forum'); + } +} diff --git a/src/addon/mod/glossary/glossary.module.ts b/src/addon/mod/glossary/glossary.module.ts index 78da46557..ab114c54b 100644 --- a/src/addon/mod/glossary/glossary.module.ts +++ b/src/addon/mod/glossary/glossary.module.ts @@ -26,6 +26,7 @@ import { AddonModGlossaryPrefetchHandler } from './providers/prefetch-handler'; import { AddonModGlossarySyncCronHandler } from './providers/sync-cron-handler'; import { AddonModGlossaryIndexLinkHandler } from './providers/index-link-handler'; import { AddonModGlossaryEntryLinkHandler } from './providers/entry-link-handler'; +import { AddonModGlossaryListLinkHandler } from './providers/list-link-handler'; import { AddonModGlossaryComponentsModule } from './components/components.module'; import { CoreUpdateManagerProvider } from '@providers/update-manager'; @@ -53,6 +54,7 @@ export const ADDON_MOD_GLOSSARY_PROVIDERS: any[] = [ AddonModGlossarySyncCronHandler, AddonModGlossaryIndexLinkHandler, AddonModGlossaryEntryLinkHandler, + AddonModGlossaryListLinkHandler ] }) export class AddonModGlossaryModule { @@ -60,13 +62,14 @@ export class AddonModGlossaryModule { prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModGlossaryPrefetchHandler, cronDelegate: CoreCronDelegate, syncHandler: AddonModGlossarySyncCronHandler, linksDelegate: CoreContentLinksDelegate, indexHandler: AddonModGlossaryIndexLinkHandler, discussionHandler: AddonModGlossaryEntryLinkHandler, - updateManager: CoreUpdateManagerProvider) { + updateManager: CoreUpdateManagerProvider, listLinkHandler: AddonModGlossaryListLinkHandler) { moduleDelegate.registerHandler(moduleHandler); prefetchDelegate.registerHandler(prefetchHandler); cronDelegate.register(syncHandler); linksDelegate.registerHandler(indexHandler); linksDelegate.registerHandler(discussionHandler); + linksDelegate.registerHandler(listLinkHandler); // Allow migrating the tables from the old app to the new schema. updateManager.registerSiteTableMigration({ diff --git a/src/addon/mod/glossary/lang/en.json b/src/addon/mod/glossary/lang/en.json index 28a0078f5..18e5ff7bc 100644 --- a/src/addon/mod/glossary/lang/en.json +++ b/src/addon/mod/glossary/lang/en.json @@ -24,6 +24,7 @@ "fillfields": "Concept and definition are mandatory fields.", "fullmatch": "Match whole words only", "linking": "Auto-linking", + "modulenameplural": "Glossaries", "noentriesfound": "No entries were found.", "searchquery": "Search query" } diff --git a/src/addon/mod/glossary/providers/list-link-handler.ts b/src/addon/mod/glossary/providers/list-link-handler.ts new file mode 100644 index 000000000..51c6057f6 --- /dev/null +++ b/src/addon/mod/glossary/providers/list-link-handler.ts @@ -0,0 +1,30 @@ +// (C) Copyright 2015 Martin Dougiamas +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { Injectable } from '@angular/core'; +import { CoreContentLinksModuleListHandler } from '@core/contentlinks/classes/module-list-handler'; +import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; +import { TranslateService } from '@ngx-translate/core'; + +/** + * Handler to treat links to glossary list page. + */ +@Injectable() +export class AddonModGlossaryListLinkHandler extends CoreContentLinksModuleListHandler { + name = 'AddonModGlossaryListLinkHandler'; + + constructor(linkHelper: CoreContentLinksHelperProvider, translate: TranslateService) { + super(linkHelper, translate, 'AddonModGlossary', 'glossary'); + } +} diff --git a/src/addon/mod/imscp/imscp.module.ts b/src/addon/mod/imscp/imscp.module.ts index 68ac3865c..825af274f 100644 --- a/src/addon/mod/imscp/imscp.module.ts +++ b/src/addon/mod/imscp/imscp.module.ts @@ -18,6 +18,7 @@ import { AddonModImscpModuleHandler } from './providers/module-handler'; import { AddonModImscpProvider } from './providers/imscp'; import { AddonModImscpPrefetchHandler } from './providers/prefetch-handler'; import { AddonModImscpLinkHandler } from './providers/link-handler'; +import { AddonModImscpListLinkHandler } from './providers/list-link-handler'; import { AddonModImscpPluginFileHandler } from './providers/pluginfile-handler'; import { CoreContentLinksDelegate } from '@core/contentlinks/providers/delegate'; import { CoreCourseModuleDelegate } from '@core/course/providers/module-delegate'; @@ -40,6 +41,7 @@ export const ADDON_MOD_IMSCP_PROVIDERS: any[] = [ AddonModImscpModuleHandler, AddonModImscpPrefetchHandler, AddonModImscpLinkHandler, + AddonModImscpListLinkHandler, AddonModImscpPluginFileHandler ] }) @@ -47,10 +49,13 @@ export class AddonModImscpModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModImscpModuleHandler, prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModImscpPrefetchHandler, contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModImscpLinkHandler, - pluginfileDelegate: CorePluginFileDelegate, pluginfileHandler: AddonModImscpPluginFileHandler) { + pluginfileDelegate: CorePluginFileDelegate, pluginfileHandler: AddonModImscpPluginFileHandler, + listLinkHandler: AddonModImscpListLinkHandler) { + moduleDelegate.registerHandler(moduleHandler); prefetchDelegate.registerHandler(prefetchHandler); contentLinksDelegate.registerHandler(linkHandler); + contentLinksDelegate.registerHandler(listLinkHandler); pluginfileDelegate.registerHandler(pluginfileHandler); } } diff --git a/src/addon/mod/imscp/lang/en.json b/src/addon/mod/imscp/lang/en.json index f2c9c32bd..4abb95089 100644 --- a/src/addon/mod/imscp/lang/en.json +++ b/src/addon/mod/imscp/lang/en.json @@ -1,4 +1,5 @@ { "deploymenterror": "Content package error!", + "modulenameplural": "IMS content packages", "showmoduledescription": "Show description" } \ No newline at end of file diff --git a/src/addon/mod/imscp/providers/list-link-handler.ts b/src/addon/mod/imscp/providers/list-link-handler.ts new file mode 100644 index 000000000..21bb3dbc4 --- /dev/null +++ b/src/addon/mod/imscp/providers/list-link-handler.ts @@ -0,0 +1,41 @@ +// (C) Copyright 2015 Martin Dougiamas +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { Injectable } from '@angular/core'; +import { CoreContentLinksModuleListHandler } from '@core/contentlinks/classes/module-list-handler'; +import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; +import { TranslateService } from '@ngx-translate/core'; +import { AddonModImscpProvider } from './imscp'; + +/** + * Handler to treat links to IMSCP list page. + */ +@Injectable() +export class AddonModImscpListLinkHandler extends CoreContentLinksModuleListHandler { + name = 'AddonModImscpListLinkHandler'; + + constructor(linkHelper: CoreContentLinksHelperProvider, translate: TranslateService, + protected imscpProvider: AddonModImscpProvider) { + super(linkHelper, translate, 'AddonModImscp', 'imscp'); + } + + /** + * Check if the handler is enabled on a site level. + * + * @return {boolean|Promise} Whether or not the handler is enabled on a site level. + */ + isEnabled(): boolean | Promise { + return this.imscpProvider.isPluginEnabled(); + } +} diff --git a/src/addon/mod/lesson/lang/en.json b/src/addon/mod/lesson/lang/en.json index c28b5d952..7a23484cb 100644 --- a/src/addon/mod/lesson/lang/en.json +++ b/src/addon/mod/lesson/lang/en.json @@ -41,6 +41,7 @@ "lowtime": "Low time", "maximumnumberofattemptsreached": "Maximum number of attempts reached - Moving to next page", "modattemptsnoteacher": "Student review only works for students.", + "modulenameplural": "Lessons", "noanswer": "One or more questions have no answer given. Please go back and submit an answer.", "nolessonattempts": "No attempts have been made on this lesson.", "nolessonattemptsgroup": "No attempts have been made by {{$a}} group members on this lesson.", diff --git a/src/addon/mod/lesson/lesson.module.ts b/src/addon/mod/lesson/lesson.module.ts index be991cc50..caad60d06 100644 --- a/src/addon/mod/lesson/lesson.module.ts +++ b/src/addon/mod/lesson/lesson.module.ts @@ -28,6 +28,7 @@ import { AddonModLessonSyncCronHandler } from './providers/sync-cron-handler'; import { AddonModLessonIndexLinkHandler } from './providers/index-link-handler'; import { AddonModLessonGradeLinkHandler } from './providers/grade-link-handler'; import { AddonModLessonReportLinkHandler } from './providers/report-link-handler'; +import { AddonModLessonListLinkHandler } from './providers/list-link-handler'; import { CoreUpdateManagerProvider } from '@providers/update-manager'; // List of providers (without handlers). @@ -54,7 +55,8 @@ export const ADDON_MOD_LESSON_PROVIDERS: any[] = [ AddonModLessonSyncCronHandler, AddonModLessonIndexLinkHandler, AddonModLessonGradeLinkHandler, - AddonModLessonReportLinkHandler + AddonModLessonReportLinkHandler, + AddonModLessonListLinkHandler ] }) export class AddonModLessonModule { @@ -62,7 +64,8 @@ export class AddonModLessonModule { prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModLessonPrefetchHandler, cronDelegate: CoreCronDelegate, syncHandler: AddonModLessonSyncCronHandler, linksDelegate: CoreContentLinksDelegate, indexHandler: AddonModLessonIndexLinkHandler, gradeHandler: AddonModLessonGradeLinkHandler, - reportHandler: AddonModLessonReportLinkHandler, updateManager: CoreUpdateManagerProvider) { + reportHandler: AddonModLessonReportLinkHandler, updateManager: CoreUpdateManagerProvider, + listLinkHandler: AddonModLessonListLinkHandler) { moduleDelegate.registerHandler(moduleHandler); prefetchDelegate.registerHandler(prefetchHandler); @@ -70,6 +73,7 @@ export class AddonModLessonModule { linksDelegate.registerHandler(indexHandler); linksDelegate.registerHandler(gradeHandler); linksDelegate.registerHandler(reportHandler); + linksDelegate.registerHandler(listLinkHandler); // Allow migrating the tables from the old app to the new schema. updateManager.registerSiteTablesMigration([ diff --git a/src/addon/mod/lesson/providers/list-link-handler.ts b/src/addon/mod/lesson/providers/list-link-handler.ts new file mode 100644 index 000000000..d208a3bba --- /dev/null +++ b/src/addon/mod/lesson/providers/list-link-handler.ts @@ -0,0 +1,41 @@ +// (C) Copyright 2015 Martin Dougiamas +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { Injectable } from '@angular/core'; +import { CoreContentLinksModuleListHandler } from '@core/contentlinks/classes/module-list-handler'; +import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; +import { TranslateService } from '@ngx-translate/core'; +import { AddonModLessonProvider } from './lesson'; + +/** + * Handler to treat links to lesson list page. + */ +@Injectable() +export class AddonModLessonListLinkHandler extends CoreContentLinksModuleListHandler { + name = 'AddonModLessonListLinkHandler'; + + constructor(linkHelper: CoreContentLinksHelperProvider, translate: TranslateService, + protected lessonProvider: AddonModLessonProvider) { + super(linkHelper, translate, 'AddonModLesson', 'lesson'); + } + + /** + * Check if the handler is enabled on a site level. + * + * @return {Promise} Promise resolved with boolean: whether or not the handler is enabled on a site level. + */ + isEnabled(): Promise { + return this.lessonProvider.isPluginEnabled(); + } +} diff --git a/src/addon/mod/lti/lang/en.json b/src/addon/mod/lti/lang/en.json index 3dc7ad1a5..7a70ea4e7 100644 --- a/src/addon/mod/lti/lang/en.json +++ b/src/addon/mod/lti/lang/en.json @@ -1,5 +1,6 @@ { "errorgetlti": "Error getting module data.", "errorinvalidlaunchurl": "The launch URL is not valid.", - "launchactivity": "Launch the activity" + "launchactivity": "Launch the activity", + "modulenameplural": "External tools" } \ No newline at end of file diff --git a/src/addon/mod/lti/lti.module.ts b/src/addon/mod/lti/lti.module.ts index 52a5487b5..442a7f7f0 100644 --- a/src/addon/mod/lti/lti.module.ts +++ b/src/addon/mod/lti/lti.module.ts @@ -17,6 +17,7 @@ import { AddonModLtiComponentsModule } from './components/components.module'; import { AddonModLtiModuleHandler } from './providers/module-handler'; import { AddonModLtiProvider } from './providers/lti'; import { AddonModLtiLinkHandler } from './providers/link-handler'; +import { AddonModLtiListLinkHandler } from './providers/list-link-handler'; import { CoreContentLinksDelegate } from '@core/contentlinks/providers/delegate'; import { CoreCourseModuleDelegate } from '@core/course/providers/module-delegate'; @@ -34,13 +35,17 @@ export const ADDON_MOD_LTI_PROVIDERS: any[] = [ providers: [ AddonModLtiProvider, AddonModLtiModuleHandler, - AddonModLtiLinkHandler + AddonModLtiLinkHandler, + AddonModLtiListLinkHandler ] }) export class AddonModLtiModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModLtiModuleHandler, - contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModLtiLinkHandler) { + contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModLtiLinkHandler, + listLinkHandler: AddonModLtiListLinkHandler) { + moduleDelegate.registerHandler(moduleHandler); contentLinksDelegate.registerHandler(linkHandler); + contentLinksDelegate.registerHandler(listLinkHandler); } } diff --git a/src/addon/mod/lti/providers/list-link-handler.ts b/src/addon/mod/lti/providers/list-link-handler.ts new file mode 100644 index 000000000..1915f8430 --- /dev/null +++ b/src/addon/mod/lti/providers/list-link-handler.ts @@ -0,0 +1,30 @@ +// (C) Copyright 2015 Martin Dougiamas +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { Injectable } from '@angular/core'; +import { CoreContentLinksModuleListHandler } from '@core/contentlinks/classes/module-list-handler'; +import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; +import { TranslateService } from '@ngx-translate/core'; + +/** + * Handler to treat links to LTI list page. + */ +@Injectable() +export class AddonModLtiListLinkHandler extends CoreContentLinksModuleListHandler { + name = 'AddonModLtiListLinkHandler'; + + constructor(linkHelper: CoreContentLinksHelperProvider, translate: TranslateService) { + super(linkHelper, translate, 'AddonModLti', 'lti'); + } +} diff --git a/src/addon/mod/page/lang/en.json b/src/addon/mod/page/lang/en.json index 4dd39dc19..34bd9817d 100644 --- a/src/addon/mod/page/lang/en.json +++ b/src/addon/mod/page/lang/en.json @@ -1,3 +1,4 @@ { - "errorwhileloadingthepage": "Error while loading the page content." + "errorwhileloadingthepage": "Error while loading the page content.", + "modulenameplural": "Pages" } \ No newline at end of file diff --git a/src/addon/mod/page/page.module.ts b/src/addon/mod/page/page.module.ts index abdb0889c..5725b0266 100644 --- a/src/addon/mod/page/page.module.ts +++ b/src/addon/mod/page/page.module.ts @@ -18,6 +18,7 @@ import { AddonModPageModuleHandler } from './providers/module-handler'; import { AddonModPageProvider } from './providers/page'; import { AddonModPagePrefetchHandler } from './providers/prefetch-handler'; import { AddonModPageLinkHandler } from './providers/link-handler'; +import { AddonModPageListLinkHandler } from './providers/list-link-handler'; import { AddonModPagePluginFileHandler } from './providers/pluginfile-handler'; import { AddonModPageHelperProvider } from './providers/helper'; import { CoreContentLinksDelegate } from '@core/contentlinks/providers/delegate'; @@ -43,6 +44,7 @@ export const ADDON_MOD_PAGE_PROVIDERS: any[] = [ AddonModPageModuleHandler, AddonModPagePrefetchHandler, AddonModPageLinkHandler, + AddonModPageListLinkHandler, AddonModPagePluginFileHandler ] }) @@ -50,10 +52,13 @@ export class AddonModPageModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModPageModuleHandler, prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModPagePrefetchHandler, contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModPageLinkHandler, - pluginfileDelegate: CorePluginFileDelegate, pluginfileHandler: AddonModPagePluginFileHandler) { + pluginfileDelegate: CorePluginFileDelegate, pluginfileHandler: AddonModPagePluginFileHandler, + listLinkHandler: AddonModPageListLinkHandler) { + moduleDelegate.registerHandler(moduleHandler); prefetchDelegate.registerHandler(prefetchHandler); contentLinksDelegate.registerHandler(linkHandler); + contentLinksDelegate.registerHandler(listLinkHandler); pluginfileDelegate.registerHandler(pluginfileHandler); } } diff --git a/src/addon/mod/page/providers/list-link-handler.ts b/src/addon/mod/page/providers/list-link-handler.ts new file mode 100644 index 000000000..67358bb95 --- /dev/null +++ b/src/addon/mod/page/providers/list-link-handler.ts @@ -0,0 +1,41 @@ +// (C) Copyright 2015 Martin Dougiamas +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { Injectable } from '@angular/core'; +import { CoreContentLinksModuleListHandler } from '@core/contentlinks/classes/module-list-handler'; +import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; +import { TranslateService } from '@ngx-translate/core'; +import { AddonModPageProvider } from './page'; + +/** + * Handler to treat links to page list page. + */ +@Injectable() +export class AddonModPageListLinkHandler extends CoreContentLinksModuleListHandler { + name = 'AddonModPageListLinkHandler'; + + constructor(linkHelper: CoreContentLinksHelperProvider, translate: TranslateService, + protected pageProvider: AddonModPageProvider) { + super(linkHelper, translate, 'AddonModPage', 'page'); + } + + /** + * Check if the handler is enabled on a site level. + * + * @return {boolean|Promise} Whether or not the handler is enabled on a site level. + */ + isEnabled(): boolean | Promise { + return this.pageProvider.isPluginEnabled(); + } +} diff --git a/src/addon/mod/quiz/lang/en.json b/src/addon/mod/quiz/lang/en.json index 3ed3286f9..99887b291 100644 --- a/src/addon/mod/quiz/lang/en.json +++ b/src/addon/mod/quiz/lang/en.json @@ -33,6 +33,7 @@ "grademethod": "Grading method", "gradesofar": "{{$a.method}}: {{$a.mygrade}} / {{$a.quizgrade}}.", "marks": "Marks", + "modulenameplural": "Quizzes", "mustbesubmittedby": "This attempt must be submitted by {{$a}}.", "noquestions": "No questions have been added yet", "noreviewattempt": "You are not allowed to review this attempt.", diff --git a/src/addon/mod/quiz/providers/list-link-handler.ts b/src/addon/mod/quiz/providers/list-link-handler.ts new file mode 100644 index 000000000..1a19d89e2 --- /dev/null +++ b/src/addon/mod/quiz/providers/list-link-handler.ts @@ -0,0 +1,30 @@ +// (C) Copyright 2015 Martin Dougiamas +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { Injectable } from '@angular/core'; +import { CoreContentLinksModuleListHandler } from '@core/contentlinks/classes/module-list-handler'; +import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; +import { TranslateService } from '@ngx-translate/core'; + +/** + * Handler to treat links to quiz list page. + */ +@Injectable() +export class AddonModQuizListLinkHandler extends CoreContentLinksModuleListHandler { + name = 'AddonModQuizListLinkHandler'; + + constructor(linkHelper: CoreContentLinksHelperProvider, translate: TranslateService) { + super(linkHelper, translate, 'AddonModQuiz', 'quiz'); + } +} diff --git a/src/addon/mod/quiz/quiz.module.ts b/src/addon/mod/quiz/quiz.module.ts index e1b652c7e..5f10410cb 100644 --- a/src/addon/mod/quiz/quiz.module.ts +++ b/src/addon/mod/quiz/quiz.module.ts @@ -28,6 +28,7 @@ import { AddonModQuizSyncCronHandler } from './providers/sync-cron-handler'; import { AddonModQuizIndexLinkHandler } from './providers/index-link-handler'; import { AddonModQuizGradeLinkHandler } from './providers/grade-link-handler'; import { AddonModQuizReviewLinkHandler } from './providers/review-link-handler'; +import { AddonModQuizListLinkHandler } from './providers/list-link-handler'; import { AddonModQuizComponentsModule } from './components/components.module'; import { CoreUpdateManagerProvider } from '@providers/update-manager'; @@ -77,7 +78,8 @@ export const ADDON_MOD_QUIZ_PROVIDERS: any[] = [ AddonModQuizSyncCronHandler, AddonModQuizIndexLinkHandler, AddonModQuizGradeLinkHandler, - AddonModQuizReviewLinkHandler + AddonModQuizReviewLinkHandler, + AddonModQuizListLinkHandler ] }) export class AddonModQuizModule { @@ -85,7 +87,8 @@ export class AddonModQuizModule { prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModQuizPrefetchHandler, cronDelegate: CoreCronDelegate, syncHandler: AddonModQuizSyncCronHandler, linksDelegate: CoreContentLinksDelegate, indexHandler: AddonModQuizIndexLinkHandler, gradeHandler: AddonModQuizGradeLinkHandler, - reviewHandler: AddonModQuizReviewLinkHandler, updateManager: CoreUpdateManagerProvider) { + reviewHandler: AddonModQuizReviewLinkHandler, updateManager: CoreUpdateManagerProvider, + listLinkHandler: AddonModQuizListLinkHandler) { moduleDelegate.registerHandler(moduleHandler); prefetchDelegate.registerHandler(prefetchHandler); @@ -93,6 +96,7 @@ export class AddonModQuizModule { linksDelegate.registerHandler(indexHandler); linksDelegate.registerHandler(gradeHandler); linksDelegate.registerHandler(reviewHandler); + linksDelegate.registerHandler(listLinkHandler); // Allow migrating the tables from the old app to the new schema. updateManager.registerSiteTableMigration({ diff --git a/src/addon/mod/resource/lang/en.json b/src/addon/mod/resource/lang/en.json index 54d284bf5..bd7e9cefb 100644 --- a/src/addon/mod/resource/lang/en.json +++ b/src/addon/mod/resource/lang/en.json @@ -1,6 +1,7 @@ { "errorwhileloadingthecontent": "Error while loading the content.", "modifieddate": "Modified {{$a}}", + "modulenameplural": "Files", "openthefile": "Open the file", "uploadeddate": "Uploaded {{$a}}" } \ No newline at end of file diff --git a/src/addon/mod/resource/providers/list-link-handler.ts b/src/addon/mod/resource/providers/list-link-handler.ts new file mode 100644 index 000000000..8acc2d435 --- /dev/null +++ b/src/addon/mod/resource/providers/list-link-handler.ts @@ -0,0 +1,41 @@ +// (C) Copyright 2015 Martin Dougiamas +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { Injectable } from '@angular/core'; +import { CoreContentLinksModuleListHandler } from '@core/contentlinks/classes/module-list-handler'; +import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; +import { TranslateService } from '@ngx-translate/core'; +import { AddonModResourceProvider } from './resource'; + +/** + * Handler to treat links to resource list page. + */ +@Injectable() +export class AddonModResourceListLinkHandler extends CoreContentLinksModuleListHandler { + name = 'AddonModResourceListLinkHandler'; + + constructor(linkHelper: CoreContentLinksHelperProvider, translate: TranslateService, + protected resourceProvider: AddonModResourceProvider) { + super(linkHelper, translate, 'AddonModResource', 'resource'); + } + + /** + * Check if the handler is enabled on a site level. + * + * @return {boolean|Promise} Whether or not the handler is enabled on a site level. + */ + isEnabled(): boolean | Promise { + return this.resourceProvider.isPluginEnabled(); + } +} diff --git a/src/addon/mod/resource/resource.module.ts b/src/addon/mod/resource/resource.module.ts index 528e383e7..7d0726dca 100644 --- a/src/addon/mod/resource/resource.module.ts +++ b/src/addon/mod/resource/resource.module.ts @@ -18,6 +18,7 @@ import { AddonModResourceModuleHandler } from './providers/module-handler'; import { AddonModResourceProvider } from './providers/resource'; import { AddonModResourcePrefetchHandler } from './providers/prefetch-handler'; import { AddonModResourceLinkHandler } from './providers/link-handler'; +import { AddonModResourceListLinkHandler } from './providers/list-link-handler'; import { AddonModResourcePluginFileHandler } from './providers/pluginfile-handler'; import { AddonModResourceHelperProvider } from './providers/helper'; import { CoreContentLinksDelegate } from '@core/contentlinks/providers/delegate'; @@ -42,6 +43,7 @@ export const ADDON_MOD_RESOURCE_PROVIDERS: any[] = [ AddonModResourceHelperProvider, AddonModResourcePrefetchHandler, AddonModResourceLinkHandler, + AddonModResourceListLinkHandler, AddonModResourcePluginFileHandler ] }) @@ -49,10 +51,13 @@ export class AddonModResourceModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModResourceModuleHandler, prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModResourcePrefetchHandler, contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModResourceLinkHandler, - pluginfileDelegate: CorePluginFileDelegate, pluginfileHandler: AddonModResourcePluginFileHandler) { + pluginfileDelegate: CorePluginFileDelegate, pluginfileHandler: AddonModResourcePluginFileHandler, + listLinkHandler: AddonModResourceListLinkHandler) { + moduleDelegate.registerHandler(moduleHandler); prefetchDelegate.registerHandler(prefetchHandler); contentLinksDelegate.registerHandler(linkHandler); + contentLinksDelegate.registerHandler(listLinkHandler); pluginfileDelegate.registerHandler(pluginfileHandler); } } diff --git a/src/addon/mod/scorm/lang/en.json b/src/addon/mod/scorm/lang/en.json index 038f4b33a..cef1c9efe 100644 --- a/src/addon/mod/scorm/lang/en.json +++ b/src/addon/mod/scorm/lang/en.json @@ -33,6 +33,7 @@ "incomplete": "Incomplete", "lastattempt": "Last completed attempt", "mode": "Mode", + "modulenameplural": "SCORM packages", "newattempt": "Start a new attempt", "noattemptsallowed": "Number of attempts allowed", "noattemptsmade": "Number of attempts you have made", diff --git a/src/addon/mod/scorm/providers/list-link-handler.ts b/src/addon/mod/scorm/providers/list-link-handler.ts new file mode 100644 index 000000000..ab366a609 --- /dev/null +++ b/src/addon/mod/scorm/providers/list-link-handler.ts @@ -0,0 +1,30 @@ +// (C) Copyright 2015 Martin Dougiamas +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { Injectable } from '@angular/core'; +import { CoreContentLinksModuleListHandler } from '@core/contentlinks/classes/module-list-handler'; +import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; +import { TranslateService } from '@ngx-translate/core'; + +/** + * Handler to treat links to SCORM list page. + */ +@Injectable() +export class AddonModScormListLinkHandler extends CoreContentLinksModuleListHandler { + name = 'AddonModScormListLinkHandler'; + + constructor(linkHelper: CoreContentLinksHelperProvider, translate: TranslateService) { + super(linkHelper, translate, 'AddonModScorm', 'scorm'); + } +} diff --git a/src/addon/mod/scorm/scorm.module.ts b/src/addon/mod/scorm/scorm.module.ts index eae867ecb..95961aad6 100644 --- a/src/addon/mod/scorm/scorm.module.ts +++ b/src/addon/mod/scorm/scorm.module.ts @@ -25,6 +25,7 @@ import { AddonModScormPrefetchHandler } from './providers/prefetch-handler'; import { AddonModScormSyncCronHandler } from './providers/sync-cron-handler'; import { AddonModScormIndexLinkHandler } from './providers/index-link-handler'; import { AddonModScormGradeLinkHandler } from './providers/grade-link-handler'; +import { AddonModScormListLinkHandler } from './providers/list-link-handler'; import { AddonModScormSyncProvider } from './providers/scorm-sync'; import { AddonModScormComponentsModule } from './components/components.module'; import { CoreUpdateManagerProvider } from '@providers/update-manager'; @@ -52,7 +53,8 @@ export const ADDON_MOD_SCORM_PROVIDERS: any[] = [ AddonModScormPrefetchHandler, AddonModScormSyncCronHandler, AddonModScormIndexLinkHandler, - AddonModScormGradeLinkHandler + AddonModScormGradeLinkHandler, + AddonModScormListLinkHandler ] }) export class AddonModScormModule { @@ -60,13 +62,14 @@ export class AddonModScormModule { prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModScormPrefetchHandler, cronDelegate: CoreCronDelegate, syncHandler: AddonModScormSyncCronHandler, linksDelegate: CoreContentLinksDelegate, indexHandler: AddonModScormIndexLinkHandler, gradeHandler: AddonModScormGradeLinkHandler, - updateManager: CoreUpdateManagerProvider) { + updateManager: CoreUpdateManagerProvider, listLinkHandler: AddonModScormListLinkHandler) { moduleDelegate.registerHandler(moduleHandler); prefetchDelegate.registerHandler(prefetchHandler); cronDelegate.register(syncHandler); linksDelegate.registerHandler(indexHandler); linksDelegate.registerHandler(gradeHandler); + linksDelegate.registerHandler(listLinkHandler); // Allow migrating the tables from the old app to the new schema. updateManager.registerSiteTablesMigration([ diff --git a/src/addon/mod/survey/lang/en.json b/src/addon/mod/survey/lang/en.json index a8769f7cb..9ccaff870 100644 --- a/src/addon/mod/survey/lang/en.json +++ b/src/addon/mod/survey/lang/en.json @@ -3,6 +3,7 @@ "errorgetsurvey": "Error getting survey data.", "ifoundthat": "I found that", "ipreferthat": "I prefer that", + "modulenameplural": "Surveys", "responses": "Responses", "results": "Results", "surveycompletednograph": "You have completed this survey." diff --git a/src/addon/mod/survey/providers/list-link-handler.ts b/src/addon/mod/survey/providers/list-link-handler.ts new file mode 100644 index 000000000..5d856a4c0 --- /dev/null +++ b/src/addon/mod/survey/providers/list-link-handler.ts @@ -0,0 +1,30 @@ +// (C) Copyright 2015 Martin Dougiamas +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { Injectable } from '@angular/core'; +import { CoreContentLinksModuleListHandler } from '@core/contentlinks/classes/module-list-handler'; +import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; +import { TranslateService } from '@ngx-translate/core'; + +/** + * Handler to treat links to survey list page. + */ +@Injectable() +export class AddonModSurveyListLinkHandler extends CoreContentLinksModuleListHandler { + name = 'AddonModSurveyListLinkHandler'; + + constructor(linkHelper: CoreContentLinksHelperProvider, translate: TranslateService) { + super(linkHelper, translate, 'AddonModSurvey', 'survey'); + } +} diff --git a/src/addon/mod/survey/survey.module.ts b/src/addon/mod/survey/survey.module.ts index eba73d4a0..7a53a63a8 100644 --- a/src/addon/mod/survey/survey.module.ts +++ b/src/addon/mod/survey/survey.module.ts @@ -21,6 +21,7 @@ import { AddonModSurveyComponentsModule } from './components/components.module'; import { AddonModSurveyModuleHandler } from './providers/module-handler'; import { AddonModSurveyProvider } from './providers/survey'; import { AddonModSurveyLinkHandler } from './providers/link-handler'; +import { AddonModSurveyListLinkHandler } from './providers/list-link-handler'; import { AddonModSurveyHelperProvider } from './providers/helper'; import { AddonModSurveyPrefetchHandler } from './providers/prefetch-handler'; import { AddonModSurveySyncProvider } from './providers/sync'; @@ -50,6 +51,7 @@ export const ADDON_MOD_SURVEY_PROVIDERS: any[] = [ AddonModSurveyModuleHandler, AddonModSurveyPrefetchHandler, AddonModSurveyLinkHandler, + AddonModSurveyListLinkHandler, AddonModSurveySyncCronHandler ] }) @@ -57,11 +59,13 @@ export class AddonModSurveyModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModSurveyModuleHandler, prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModSurveyPrefetchHandler, contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModSurveyLinkHandler, - cronDelegate: CoreCronDelegate, syncHandler: AddonModSurveySyncCronHandler, updateManager: CoreUpdateManagerProvider) { + cronDelegate: CoreCronDelegate, syncHandler: AddonModSurveySyncCronHandler, updateManager: CoreUpdateManagerProvider, + listLinkHandler: AddonModSurveyListLinkHandler) { moduleDelegate.registerHandler(moduleHandler); prefetchDelegate.registerHandler(prefetchHandler); contentLinksDelegate.registerHandler(linkHandler); + contentLinksDelegate.registerHandler(listLinkHandler); cronDelegate.register(syncHandler); // Allow migrating the tables from the old app to the new schema. diff --git a/src/addon/mod/url/lang/en.json b/src/addon/mod/url/lang/en.json index 7d905f0cf..18eff8be5 100644 --- a/src/addon/mod/url/lang/en.json +++ b/src/addon/mod/url/lang/en.json @@ -1,4 +1,5 @@ { "accessurl": "Access the URL", + "modulenameplural": "URLs", "pointingtourl": "URL that the resource points to." } \ No newline at end of file diff --git a/src/addon/mod/url/providers/list-link-handler.ts b/src/addon/mod/url/providers/list-link-handler.ts new file mode 100644 index 000000000..857bb08fb --- /dev/null +++ b/src/addon/mod/url/providers/list-link-handler.ts @@ -0,0 +1,30 @@ +// (C) Copyright 2015 Martin Dougiamas +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { Injectable } from '@angular/core'; +import { CoreContentLinksModuleListHandler } from '@core/contentlinks/classes/module-list-handler'; +import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; +import { TranslateService } from '@ngx-translate/core'; + +/** + * Handler to treat links to URL list page. + */ +@Injectable() +export class AddonModUrlListLinkHandler extends CoreContentLinksModuleListHandler { + name = 'AddonModUrlListLinkHandler'; + + constructor(linkHelper: CoreContentLinksHelperProvider, translate: TranslateService) { + super(linkHelper, translate, 'AddonModUrl', 'url'); + } +} diff --git a/src/addon/mod/url/url.module.ts b/src/addon/mod/url/url.module.ts index 967025119..868a87d75 100644 --- a/src/addon/mod/url/url.module.ts +++ b/src/addon/mod/url/url.module.ts @@ -17,6 +17,7 @@ import { AddonModUrlComponentsModule } from './components/components.module'; import { AddonModUrlModuleHandler } from './providers/module-handler'; import { AddonModUrlProvider } from './providers/url'; import { AddonModUrlLinkHandler } from './providers/link-handler'; +import { AddonModUrlListLinkHandler } from './providers/list-link-handler'; import { AddonModUrlHelperProvider } from './providers/helper'; import { CoreContentLinksDelegate } from '@core/contentlinks/providers/delegate'; import { CoreCourseModuleDelegate } from '@core/course/providers/module-delegate'; @@ -37,13 +38,17 @@ export const ADDON_MOD_URL_PROVIDERS: any[] = [ AddonModUrlProvider, AddonModUrlHelperProvider, AddonModUrlModuleHandler, - AddonModUrlLinkHandler + AddonModUrlLinkHandler, + AddonModUrlListLinkHandler ] }) export class AddonModUrlModule { constructor(moduleDelegate: CoreCourseModuleDelegate, moduleHandler: AddonModUrlModuleHandler, - contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModUrlLinkHandler) { + contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModUrlLinkHandler, + listLinkHandler: AddonModUrlListLinkHandler) { + moduleDelegate.registerHandler(moduleHandler); contentLinksDelegate.registerHandler(linkHandler); + contentLinksDelegate.registerHandler(listLinkHandler); } } diff --git a/src/addon/mod/wiki/lang/en.json b/src/addon/mod/wiki/lang/en.json index e8d9a0d78..29ed054ce 100644 --- a/src/addon/mod/wiki/lang/en.json +++ b/src/addon/mod/wiki/lang/en.json @@ -6,6 +6,7 @@ "errornowikiavailable": "This wiki does not have any content yet.", "gowikihome": "Go to the wiki first page", "map": "Map", + "modulenameplural": "Wikis", "newpagehdr": "New page", "newpagetitle": "New page title", "nocontent": "There is no content for this page", diff --git a/src/addon/mod/wiki/providers/list-link-handler.ts b/src/addon/mod/wiki/providers/list-link-handler.ts new file mode 100644 index 000000000..1be40c6ea --- /dev/null +++ b/src/addon/mod/wiki/providers/list-link-handler.ts @@ -0,0 +1,30 @@ +// (C) Copyright 2015 Martin Dougiamas +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { Injectable } from '@angular/core'; +import { CoreContentLinksModuleListHandler } from '@core/contentlinks/classes/module-list-handler'; +import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; +import { TranslateService } from '@ngx-translate/core'; + +/** + * Handler to treat links to wiki list page. + */ +@Injectable() +export class AddonModWikiListLinkHandler extends CoreContentLinksModuleListHandler { + name = 'AddonModWikiListLinkHandler'; + + constructor(linkHelper: CoreContentLinksHelperProvider, translate: TranslateService) { + super(linkHelper, translate, 'AddonModWiki', 'wiki'); + } +} diff --git a/src/addon/mod/wiki/wiki.module.ts b/src/addon/mod/wiki/wiki.module.ts index e8a8582c1..539b962dd 100644 --- a/src/addon/mod/wiki/wiki.module.ts +++ b/src/addon/mod/wiki/wiki.module.ts @@ -28,6 +28,7 @@ import { AddonModWikiIndexLinkHandler } from './providers/index-link-handler'; import { AddonModWikiPageOrMapLinkHandler } from './providers/page-or-map-link-handler'; import { AddonModWikiCreateLinkHandler } from './providers/create-link-handler'; import { AddonModWikiEditLinkHandler } from './providers/edit-link-handler'; +import { AddonModWikiListLinkHandler } from './providers/list-link-handler'; import { CoreUpdateManagerProvider } from '@providers/update-manager'; // List of providers (without handlers). @@ -53,7 +54,8 @@ export const ADDON_MOD_WIKI_PROVIDERS: any[] = [ AddonModWikiIndexLinkHandler, AddonModWikiPageOrMapLinkHandler, AddonModWikiCreateLinkHandler, - AddonModWikiEditLinkHandler + AddonModWikiEditLinkHandler, + AddonModWikiListLinkHandler ] }) export class AddonModWikiModule { @@ -62,7 +64,7 @@ export class AddonModWikiModule { cronDelegate: CoreCronDelegate, syncHandler: AddonModWikiSyncCronHandler, linksDelegate: CoreContentLinksDelegate, indexHandler: AddonModWikiIndexLinkHandler, pageOrMapHandler: AddonModWikiPageOrMapLinkHandler, createHandler: AddonModWikiCreateLinkHandler, editHandler: AddonModWikiEditLinkHandler, - updateManager: CoreUpdateManagerProvider) { + updateManager: CoreUpdateManagerProvider, listLinkHandler: AddonModWikiListLinkHandler) { moduleDelegate.registerHandler(moduleHandler); prefetchDelegate.registerHandler(prefetchHandler); @@ -71,6 +73,7 @@ export class AddonModWikiModule { linksDelegate.registerHandler(pageOrMapHandler); linksDelegate.registerHandler(createHandler); linksDelegate.registerHandler(editHandler); + linksDelegate.registerHandler(listLinkHandler); // Allow migrating the tables from the old app to the new schema. updateManager.registerSiteTableMigration({ diff --git a/src/addon/mod/workshop/lang/en.json b/src/addon/mod/workshop/lang/en.json index 4a2056785..72d1d6a0d 100644 --- a/src/addon/mod/workshop/lang/en.json +++ b/src/addon/mod/workshop/lang/en.json @@ -26,6 +26,7 @@ "gradinggradecalculated": "Calculated grade for assessment", "gradinggradeof": "Grade for assessment (of {{$a}})", "gradinggradeover": "Override grade for assessment", + "modulenameplural": "Workshops", "nogradeyet": "No grade yet", "notassessed": "Not assessed yet", "notoverridden": "Not overridden", diff --git a/src/addon/mod/workshop/providers/list-link-handler.ts b/src/addon/mod/workshop/providers/list-link-handler.ts new file mode 100644 index 000000000..db2bfb9cc --- /dev/null +++ b/src/addon/mod/workshop/providers/list-link-handler.ts @@ -0,0 +1,41 @@ +// (C) Copyright 2015 Martin Dougiamas +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { Injectable } from '@angular/core'; +import { CoreContentLinksModuleListHandler } from '@core/contentlinks/classes/module-list-handler'; +import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper'; +import { TranslateService } from '@ngx-translate/core'; +import { AddonModWorkshopProvider } from './workshop'; + +/** + * Handler to treat links to workshop list page. + */ +@Injectable() +export class AddonModWorkshopListLinkHandler extends CoreContentLinksModuleListHandler { + name = 'AddonModWorkshopListLinkHandler'; + + constructor(linkHelper: CoreContentLinksHelperProvider, translate: TranslateService, + protected workshopProvider: AddonModWorkshopProvider) { + super(linkHelper, translate, 'AddonModWorkshop', 'workshop'); + } + + /** + * Check if the handler is enabled on a site level. + * + * @return {Promise} Whether or not the handler is enabled on a site level. + */ + isEnabled(): Promise { + return this.workshopProvider.isPluginEnabled(); + } +} diff --git a/src/addon/mod/workshop/workshop.module.ts b/src/addon/mod/workshop/workshop.module.ts index cff6c9151..3e52d8654 100644 --- a/src/addon/mod/workshop/workshop.module.ts +++ b/src/addon/mod/workshop/workshop.module.ts @@ -22,6 +22,7 @@ import { AddonModWorkshopComponentsModule } from './components/components.module import { AddonModWorkshopModuleHandler } from './providers/module-handler'; import { AddonModWorkshopProvider } from './providers/workshop'; import { AddonModWorkshopLinkHandler } from './providers/link-handler'; +import { AddonModWorkshopListLinkHandler } from './providers/list-link-handler'; import { AddonModWorkshopOfflineProvider } from './providers/offline'; import { AddonModWorkshopSyncProvider } from './providers/sync'; import { AddonModWorkshopHelperProvider } from './providers/helper'; @@ -50,6 +51,7 @@ export const ADDON_MOD_WORKSHOP_PROVIDERS: any[] = [ AddonModWorkshopProvider, AddonModWorkshopModuleHandler, AddonModWorkshopLinkHandler, + AddonModWorkshopListLinkHandler, AddonModWorkshopOfflineProvider, AddonModWorkshopSyncProvider, AddonModWorkshopHelperProvider, @@ -63,10 +65,11 @@ export class AddonModWorkshopModule { contentLinksDelegate: CoreContentLinksDelegate, linkHandler: AddonModWorkshopLinkHandler, prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModWorkshopPrefetchHandler, cronDelegate: CoreCronDelegate, syncHandler: AddonModWorkshopSyncCronHandler, - updateManager: CoreUpdateManagerProvider) { + updateManager: CoreUpdateManagerProvider, listLinkHandler: AddonModWorkshopListLinkHandler) { moduleDelegate.registerHandler(moduleHandler); contentLinksDelegate.registerHandler(linkHandler); + contentLinksDelegate.registerHandler(listLinkHandler); prefetchDelegate.registerHandler(prefetchHandler); cronDelegate.register(syncHandler); diff --git a/src/assets/lang/en.json b/src/assets/lang/en.json index aec95a8ca..18d5a9a9e 100644 --- a/src/assets/lang/en.json +++ b/src/assets/lang/en.json @@ -10,6 +10,7 @@ "addon.badges.issuername": "Issuer name", "addon.badges.nobadges": "There are no badges available.", "addon.badges.recipientdetails": "Recipient details", + "addon.block_activitymodules.pluginname": "Activities", "addon.block_myoverview.all": "All", "addon.block_myoverview.future": "Future", "addon.block_myoverview.inprogress": "In progress", @@ -20,6 +21,7 @@ "addon.block_myoverview.nocoursespast": "No past courses", "addon.block_myoverview.past": "Past", "addon.block_myoverview.title": "Title", + "addon.block_sitemainmenu.pluginname": "Main menu", "addon.block_timeline.duedate": "Due date", "addon.block_timeline.next30days": "Next 30 days", "addon.block_timeline.next3months": "Next 3 months", @@ -202,6 +204,7 @@ "addon.mod_assign.markingworkflowstatereadyforrelease": "Ready for release", "addon.mod_assign.markingworkflowstatereadyforreview": "Marking completed", "addon.mod_assign.markingworkflowstatereleased": "Released", + "addon.mod_assign.modulenameplural": "Assignments", "addon.mod_assign.multipleteams": "Member of more than one group", "addon.mod_assign.multipleteams_desc": "The assignment requires submission in groups. You are a member of more than one group. To be able to submit you must be a member of only one group. Please contact your teacher to change your group membership.", "addon.mod_assign.noattempt": "No attempt", @@ -256,6 +259,7 @@ "addon.mod_assign_submission_file.pluginname": "File submissions", "addon.mod_assign_submission_onlinetext.pluginname": "Online text submissions", "addon.mod_book.errorchapter": "Error reading chapter of book.", + "addon.mod_book.modulenameplural": "Books", "addon.mod_chat.beep": "Beep", "addon.mod_chat.currentusers": "Current users", "addon.mod_chat.enterchat": "Click here to enter the chat now", @@ -268,6 +272,7 @@ "addon.mod_chat.messagebeepsyou": "{{$a}} has just beeped you!", "addon.mod_chat.messageenter": "{{$a}} has just entered this chat", "addon.mod_chat.messageexit": "{{$a}} has left this chat", + "addon.mod_chat.modulenameplural": "Chats", "addon.mod_chat.mustbeonlinetosendmessages": "You must be online to send messages.", "addon.mod_chat.nomessages": "No messages yet", "addon.mod_chat.send": "Send", @@ -278,6 +283,7 @@ "addon.mod_choice.errorgetchoice": "Error getting choice data.", "addon.mod_choice.expired": "Sorry, this activity closed on {{$a}} and is no longer available", "addon.mod_choice.full": "(Full)", + "addon.mod_choice.modulenameplural": "Choices", "addon.mod_choice.noresultsviewable": "The results are not currently viewable.", "addon.mod_choice.notopenyet": "Sorry, this activity is not available until {{$a}}", "addon.mod_choice.numberofuser": "Number of responses", @@ -317,6 +323,7 @@ "addon.mod_data.fields": "Fields", "addon.mod_data.latlongboth": "Both latitude and longitude are required.", "addon.mod_data.menuchoose": "Choose...", + "addon.mod_data.modulenameplural": "Databases", "addon.mod_data.more": "More", "addon.mod_data.nomatch": "No matching entries found!", "addon.mod_data.norecords": "No entries in database", @@ -348,6 +355,7 @@ "addon.mod_feedback.feedbackopen": "Allow answers from", "addon.mod_feedback.mapcourses": "Map feedback to courses", "addon.mod_feedback.mode": "Mode", + "addon.mod_feedback.modulenameplural": "Feedback", "addon.mod_feedback.next_page": "Next page", "addon.mod_feedback.non_anonymous": "User's name will be logged and shown with answers", "addon.mod_feedback.non_anonymous_entries": "Non anonymous entries ({{$a}})", @@ -368,6 +376,7 @@ "addon.mod_feedback.started": "Started", "addon.mod_feedback.this_feedback_is_already_submitted": "You've already completed this activity.", "addon.mod_folder.emptyfilelist": "There are no files to show.", + "addon.mod_folder.modulenameplural": "Folders", "addon.mod_forum.addanewdiscussion": "Add a new discussion topic", "addon.mod_forum.addanewquestion": "Add a new question", "addon.mod_forum.addanewtopic": "Add a new topic", @@ -390,6 +399,7 @@ "addon.mod_forum.modeflatnewestfirst": "Display replies flat, with newest first", "addon.mod_forum.modeflatoldestfirst": "Display replies flat, with oldest first", "addon.mod_forum.modenested": "Display replies in nested form", + "addon.mod_forum.modulenameplural": "Forums", "addon.mod_forum.numdiscussions": "{{numdiscussions}} discussions", "addon.mod_forum.numreplies": "{{numreplies}} replies", "addon.mod_forum.posttoforum": "Post to forum", @@ -425,9 +435,11 @@ "addon.mod_glossary.fillfields": "Concept and definition are mandatory fields.", "addon.mod_glossary.fullmatch": "Match whole words only", "addon.mod_glossary.linking": "Auto-linking", + "addon.mod_glossary.modulenameplural": "Glossaries", "addon.mod_glossary.noentriesfound": "No entries were found.", "addon.mod_glossary.searchquery": "Search query", "addon.mod_imscp.deploymenterror": "Content package error!", + "addon.mod_imscp.modulenameplural": "IMS content packages", "addon.mod_imscp.showmoduledescription": "Show description", "addon.mod_lesson.answer": "Answer", "addon.mod_lesson.attempt": "Attempt: {{$a}}", @@ -471,6 +483,7 @@ "addon.mod_lesson.lowtime": "Low time", "addon.mod_lesson.maximumnumberofattemptsreached": "Maximum number of attempts reached - Moving to next page", "addon.mod_lesson.modattemptsnoteacher": "Student review only works for students.", + "addon.mod_lesson.modulenameplural": "Lessons", "addon.mod_lesson.noanswer": "One or more questions have no answer given. Please go back and submit an answer.", "addon.mod_lesson.nolessonattempts": "No attempts have been made on this lesson.", "addon.mod_lesson.nolessonattemptsgroup": "No attempts have been made by {{$a}} group members on this lesson.", @@ -515,7 +528,9 @@ "addon.mod_lti.errorgetlti": "Error getting module data.", "addon.mod_lti.errorinvalidlaunchurl": "The launch URL is not valid.", "addon.mod_lti.launchactivity": "Launch the activity", + "addon.mod_lti.modulenameplural": "External tools", "addon.mod_page.errorwhileloadingthepage": "Error while loading the page content.", + "addon.mod_page.modulenameplural": "Pages", "addon.mod_quiz.attemptfirst": "First attempt", "addon.mod_quiz.attemptlast": "Last attempt", "addon.mod_quiz.attemptnumber": "Attempt", @@ -550,6 +565,7 @@ "addon.mod_quiz.grademethod": "Grading method", "addon.mod_quiz.gradesofar": "{{$a.method}}: {{$a.mygrade}} / {{$a.quizgrade}}.", "addon.mod_quiz.marks": "Marks", + "addon.mod_quiz.modulenameplural": "Quizzes", "addon.mod_quiz.mustbesubmittedby": "This attempt must be submitted by {{$a}}.", "addon.mod_quiz.noquestions": "No questions have been added yet", "addon.mod_quiz.noreviewattempt": "You are not allowed to review this attempt.", @@ -594,6 +610,7 @@ "addon.mod_quiz.yourfinalgradeis": "Your final grade for this quiz is {{$a}}.", "addon.mod_resource.errorwhileloadingthecontent": "Error while loading the content.", "addon.mod_resource.modifieddate": "Modified {{$a}}", + "addon.mod_resource.modulenameplural": "Files", "addon.mod_resource.openthefile": "Open the file", "addon.mod_resource.uploadeddate": "Uploaded {{$a}}", "addon.mod_scorm.asset": "Asset", @@ -630,6 +647,7 @@ "addon.mod_scorm.incomplete": "Incomplete", "addon.mod_scorm.lastattempt": "Last completed attempt", "addon.mod_scorm.mode": "Mode", + "addon.mod_scorm.modulenameplural": "SCORM packages", "addon.mod_scorm.newattempt": "Start a new attempt", "addon.mod_scorm.noattemptsallowed": "Number of attempts allowed", "addon.mod_scorm.noattemptsmade": "Number of attempts you have made", @@ -649,10 +667,12 @@ "addon.mod_survey.errorgetsurvey": "Error getting survey data.", "addon.mod_survey.ifoundthat": "I found that", "addon.mod_survey.ipreferthat": "I prefer that", + "addon.mod_survey.modulenameplural": "Surveys", "addon.mod_survey.responses": "Responses", "addon.mod_survey.results": "Results", "addon.mod_survey.surveycompletednograph": "You have completed this survey.", "addon.mod_url.accessurl": "Access the URL", + "addon.mod_url.modulenameplural": "URLs", "addon.mod_url.pointingtourl": "URL that the resource points to.", "addon.mod_wiki.cannoteditpage": "You can not edit this page.", "addon.mod_wiki.createpage": "Create page", @@ -661,6 +681,7 @@ "addon.mod_wiki.errornowikiavailable": "This wiki does not have any content yet.", "addon.mod_wiki.gowikihome": "Go to the wiki first page", "addon.mod_wiki.map": "Map", + "addon.mod_wiki.modulenameplural": "Wikis", "addon.mod_wiki.newpagehdr": "New page", "addon.mod_wiki.newpagetitle": "New page title", "addon.mod_wiki.nocontent": "There is no content for this page", @@ -699,6 +720,7 @@ "addon.mod_workshop.gradinggradecalculated": "Calculated grade for assessment", "addon.mod_workshop.gradinggradeof": "Grade for assessment (of {{$a}})", "addon.mod_workshop.gradinggradeover": "Override grade for assessment", + "addon.mod_workshop.modulenameplural": "Workshops", "addon.mod_workshop.nogradeyet": "No grade yet", "addon.mod_workshop.notassessed": "Not assessed yet", "addon.mod_workshop.notoverridden": "Not overridden", @@ -1467,6 +1489,7 @@ "core.refresh": "Refresh", "core.required": "Required", "core.requireduserdatamissing": "This user lacks some required profile data. Please enter the data in your site and try again.
{{$a}}", + "core.resources": "Resources", "core.restore": "Restore", "core.retry": "Retry", "core.save": "Save", diff --git a/src/core/contentlinks/classes/module-list-handler.ts b/src/core/contentlinks/classes/module-list-handler.ts new file mode 100644 index 000000000..5fa6c41a7 --- /dev/null +++ b/src/core/contentlinks/classes/module-list-handler.ts @@ -0,0 +1,71 @@ +// (C) Copyright 2015 Martin Dougiamas +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import { CoreContentLinksAction } from '../providers/delegate'; +import { CoreContentLinksHelperProvider } from '../providers/helper'; +import { CoreContentLinksHandlerBase } from './base-handler'; +import { TranslateService } from '@ngx-translate/core'; + +/** + * Handler to handle URLs pointing to a list of a certain type of modules. + */ +export class CoreContentLinksModuleListHandler extends CoreContentLinksHandlerBase { + + /** + * The title to use in the new page. If not defined, the app will try to calculate it. + * @type {string} + */ + protected title: string; + + /** + * Construct the handler. + * + * @param {CoreContentLinksHelperProvider} linkHelper The CoreContentLinksHelperProvider instance. + * @param {TranslateService} translate The TranslateService instance. + * @param {string} addon Name of the addon as it's registered in course delegate. It'll be used to check if it's disabled. + * @param {string} modName Name of the module (assign, book, ...). + */ + constructor(protected linkHelper: CoreContentLinksHelperProvider, protected translate: TranslateService, public addon: string, + public modName: string) { + super(); + + // Match the view.php URL with an id param. + this.pattern = new RegExp('\/mod\/' + modName + '\/index\.php.*([\&\?]id=\\d+)'); + this.featureName = 'CoreCourseModuleDelegate_' + addon; + } + + /** + * Get the list of actions for a link (url). + * + * @param {string[]} siteIds List of sites the URL belongs to. + * @param {string} url The URL to treat. + * @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + */ + getActions(siteIds: string[], url: string, params: any): CoreContentLinksAction[] | Promise { + + return [{ + action: (siteId, navCtrl?): void => { + const stateParams = { + courseId: params.id, + modName: this.modName, + title: this.title || this.translate.instant('addon.mod_' + this.modName + '.modulenameplural') + }; + + // Always use redirect to make it the new history root (to avoid "loops" in history). + this.linkHelper.goInSite(navCtrl, 'CoreCourseListModTypePage', stateParams, siteId); + } + }]; + } +} diff --git a/src/addon/block/activitymodules/pages/list-type/list-type.html b/src/core/course/pages/list-mod-type/list-mod-type.html similarity index 100% rename from src/addon/block/activitymodules/pages/list-type/list-type.html rename to src/core/course/pages/list-mod-type/list-mod-type.html diff --git a/src/addon/block/activitymodules/pages/list-type/list-type.module.ts b/src/core/course/pages/list-mod-type/list-mod-type.module.ts similarity index 82% rename from src/addon/block/activitymodules/pages/list-type/list-type.module.ts rename to src/core/course/pages/list-mod-type/list-mod-type.module.ts index 1202f9c37..1de8ec959 100644 --- a/src/addon/block/activitymodules/pages/list-type/list-type.module.ts +++ b/src/core/course/pages/list-mod-type/list-mod-type.module.ts @@ -15,21 +15,21 @@ import { NgModule } from '@angular/core'; import { IonicPageModule } from 'ionic-angular'; import { TranslateModule } from '@ngx-translate/core'; -import { AddonBlockActivityModulesListTypePage } from './list-type'; +import { CoreCourseListModTypePage } from './list-mod-type'; import { CoreComponentsModule } from '@components/components.module'; import { CoreDirectivesModule } from '@directives/directives.module'; import { CoreCourseComponentsModule } from '@core/course/components/components.module'; @NgModule({ declarations: [ - AddonBlockActivityModulesListTypePage + CoreCourseListModTypePage ], imports: [ CoreComponentsModule, CoreDirectivesModule, CoreCourseComponentsModule, - IonicPageModule.forChild(AddonBlockActivityModulesListTypePage), + IonicPageModule.forChild(CoreCourseListModTypePage), TranslateModule.forChild() ], }) -export class AddonBlockActivityModulesListTypePageModule {} +export class CoreCourseListModTypePageModule {} diff --git a/src/addon/block/activitymodules/pages/list-type/list-type.ts b/src/core/course/pages/list-mod-type/list-mod-type.ts similarity index 89% rename from src/addon/block/activitymodules/pages/list-type/list-type.ts rename to src/core/course/pages/list-mod-type/list-mod-type.ts index 3e97500a0..2a1694243 100644 --- a/src/addon/block/activitymodules/pages/list-type/list-type.ts +++ b/src/core/course/pages/list-mod-type/list-mod-type.ts @@ -15,20 +15,20 @@ import { Component } from '@angular/core'; import { IonicPage, NavParams } from 'ionic-angular'; import { CoreDomUtilsProvider } from '@providers/utils/dom'; -import { CoreCourseProvider } from '@core/course/providers/course'; -import { CoreCourseModuleDelegate } from '@core/course/providers/module-delegate'; -import { CoreCourseHelperProvider } from '@core/course/providers/helper'; +import { CoreCourseProvider } from '../../providers/course'; +import { CoreCourseModuleDelegate } from '../../providers/module-delegate'; +import { CoreCourseHelperProvider } from '../../providers/helper'; import { CoreConstants } from '@core/constants'; /** * Page that displays comments. */ -@IonicPage({ segment: 'addon-block-activity-modules-list-type' }) +@IonicPage({ segment: 'core-course-list-mod-type' }) @Component({ - selector: 'page-addon-block-activity-modules-list-type', - templateUrl: 'list-type.html', + selector: 'page-core-course-list-mod-type', + templateUrl: 'list-mod-type.html', }) -export class AddonBlockActivityModulesListTypePage { +export class CoreCourseListModTypePage { modules = []; title: string;