forked from EVOgeek/Vmeda.Online
		
	MOBILE-3833 core: Add '^' dynamically in link handlers
This commit is contained in:
		
							parent
							
								
									1fc0b9184b
								
							
						
					
					
						commit
						195c8d94e6
					
				| @ -27,7 +27,7 @@ import { AddonBadges } from '../badges'; | |||||||
| export class AddonBadgesBadgeLinkHandlerService extends CoreContentLinksHandlerBase { | export class AddonBadgesBadgeLinkHandlerService extends CoreContentLinksHandlerBase { | ||||||
| 
 | 
 | ||||||
|     name = 'AddonBadgesBadgeLinkHandler'; |     name = 'AddonBadgesBadgeLinkHandler'; | ||||||
|     pattern = /^\/badges\/badge\.php.*([?&]hash=)/; |     pattern = /\/badges\/badge\.php.*([?&]hash=)/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Get the list of actions for a link (url). |      * Get the list of actions for a link (url). | ||||||
|  | |||||||
| @ -27,7 +27,7 @@ export class AddonBadgesMyBadgesLinkHandlerService extends CoreContentLinksHandl | |||||||
| 
 | 
 | ||||||
|     name = 'AddonBadgesMyBadgesLinkHandler'; |     name = 'AddonBadgesMyBadgesLinkHandler'; | ||||||
|     featureName = 'CoreUserDelegate_AddonBadges'; |     featureName = 'CoreUserDelegate_AddonBadges'; | ||||||
|     pattern = /^\/badges\/mybadges\.php/; |     pattern = /\/badges\/mybadges\.php/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Get the list of actions for a link (url). |      * Get the list of actions for a link (url). | ||||||
|  | |||||||
| @ -28,7 +28,7 @@ export class AddonBlogIndexLinkHandlerService extends CoreContentLinksHandlerBas | |||||||
| 
 | 
 | ||||||
|     name = 'AddonBlogIndexLinkHandler'; |     name = 'AddonBlogIndexLinkHandler'; | ||||||
|     featureName = 'CoreUserDelegate_AddonBlog:blogs'; |     featureName = 'CoreUserDelegate_AddonBlog:blogs'; | ||||||
|     pattern = /^\/blog\/index\.php/; |     pattern = /\/blog\/index\.php/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * @inheritdoc | ||||||
|  | |||||||
| @ -30,7 +30,7 @@ const SUPPORTED_VIEWS = ['month', 'mini', 'minithree', 'day', 'upcoming', 'upcom | |||||||
| export class AddonCalendarViewLinkHandlerService extends CoreContentLinksHandlerBase { | export class AddonCalendarViewLinkHandlerService extends CoreContentLinksHandlerBase { | ||||||
| 
 | 
 | ||||||
|     name = 'AddonCalendarViewLinkHandler'; |     name = 'AddonCalendarViewLinkHandler'; | ||||||
|     pattern = /^\/calendar\/view\.php/; |     pattern = /\/calendar\/view\.php/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Get the list of actions for a link (url). |      * Get the list of actions for a link (url). | ||||||
|  | |||||||
| @ -29,6 +29,7 @@ export class AddonCompetencyCompetencyLinkHandlerService extends CoreContentLink | |||||||
| 
 | 
 | ||||||
|     name = 'AddonCompetencyCompetencyLinkHandler'; |     name = 'AddonCompetencyCompetencyLinkHandler'; | ||||||
|     pattern = /\/admin\/tool\/lp\/(user_competency_in_course|user_competency_in_plan)\.php/; |     pattern = /\/admin\/tool\/lp\/(user_competency_in_course|user_competency_in_plan)\.php/; | ||||||
|  |     patternMatchStart = false; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * @inheritdoc | ||||||
|  | |||||||
| @ -28,6 +28,7 @@ export class AddonCompetencyPlanLinkHandlerService extends CoreContentLinksHandl | |||||||
| 
 | 
 | ||||||
|     name = 'AddonCompetencyPlanLinkHandler'; |     name = 'AddonCompetencyPlanLinkHandler'; | ||||||
|     pattern = /\/admin\/tool\/lp\/plan\.php.*([?&]id=\d+)/; |     pattern = /\/admin\/tool\/lp\/plan\.php.*([?&]id=\d+)/; | ||||||
|  |     patternMatchStart = false; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * @inheritdoc | ||||||
|  | |||||||
| @ -28,6 +28,7 @@ export class AddonCompetencyPlansLinkHandlerService extends CoreContentLinksHand | |||||||
| 
 | 
 | ||||||
|     name = 'AddonCompetencyPlansLinkHandler'; |     name = 'AddonCompetencyPlansLinkHandler'; | ||||||
|     pattern = /\/admin\/tool\/lp\/plans\.php/; |     pattern = /\/admin\/tool\/lp\/plans\.php/; | ||||||
|  |     patternMatchStart = false; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * @inheritdoc | ||||||
|  | |||||||
| @ -28,6 +28,7 @@ export class AddonCompetencyUserCompetencyLinkHandlerService extends CoreContent | |||||||
| 
 | 
 | ||||||
|     name = 'AddonCompetencyUserCompetencyLinkHandler'; |     name = 'AddonCompetencyUserCompetencyLinkHandler'; | ||||||
|     pattern = /\/admin\/tool\/lp\/user_competency\.php.*([?&]id=\d+)/; |     pattern = /\/admin\/tool\/lp\/user_competency\.php.*([?&]id=\d+)/; | ||||||
|  |     patternMatchStart = false; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * @inheritdoc | ||||||
|  | |||||||
| @ -26,7 +26,7 @@ import { AddonMessages } from '../messages'; | |||||||
| export class AddonMessagesContactRequestLinkHandlerService extends CoreContentLinksHandlerBase { | export class AddonMessagesContactRequestLinkHandlerService extends CoreContentLinksHandlerBase { | ||||||
| 
 | 
 | ||||||
|     name = 'AddonMessagesContactRequestLinkHandler'; |     name = 'AddonMessagesContactRequestLinkHandler'; | ||||||
|     pattern = /^\/message\/pendingcontactrequests\.php/; |     pattern = /\/message\/pendingcontactrequests\.php/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Get the list of actions for a link (url). |      * Get the list of actions for a link (url). | ||||||
|  | |||||||
| @ -29,7 +29,7 @@ import { AddonMessages } from '../messages'; | |||||||
| export class AddonMessagesDiscussionLinkHandlerService extends CoreContentLinksHandlerBase { | export class AddonMessagesDiscussionLinkHandlerService extends CoreContentLinksHandlerBase { | ||||||
| 
 | 
 | ||||||
|     name = 'AddonMessagesDiscussionLinkHandler'; |     name = 'AddonMessagesDiscussionLinkHandler'; | ||||||
|     pattern = /^\/message\/index\.php.*([?&](id|user1|user2)=\d+)/; |     pattern = /\/message\/index\.php.*([?&](id|user1|user2)=\d+)/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Get the list of actions for a link (url). |      * Get the list of actions for a link (url). | ||||||
|  | |||||||
| @ -28,7 +28,7 @@ import { AddonMessagesMainMenuHandlerService } from './mainmenu'; | |||||||
| export class AddonMessagesIndexLinkHandlerService extends CoreContentLinksHandlerBase { | export class AddonMessagesIndexLinkHandlerService extends CoreContentLinksHandlerBase { | ||||||
| 
 | 
 | ||||||
|     name = 'AddonMessagesIndexLinkHandler'; |     name = 'AddonMessagesIndexLinkHandler'; | ||||||
|     pattern = /^\/message\/index\.php((?=\d+).)*$/; |     pattern = /\/message\/index\.php((?=\d+).)*$/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Get the list of actions for a link (url). |      * Get the list of actions for a link (url). | ||||||
|  | |||||||
| @ -28,7 +28,7 @@ export class AddonModDataApproveLinkHandlerService extends CoreContentLinksHandl | |||||||
| 
 | 
 | ||||||
|     name = 'AddonModDataApproveLinkHandler'; |     name = 'AddonModDataApproveLinkHandler'; | ||||||
|     featureName = 'CoreCourseModuleDelegate_AddonModData'; |     featureName = 'CoreCourseModuleDelegate_AddonModData'; | ||||||
|     pattern = /^\/mod\/data\/view\.php.*([?&](d|approve|disapprove)=\d+)/; |     pattern = /\/mod\/data\/view\.php.*([?&](d|approve|disapprove)=\d+)/; | ||||||
|     priority = 50; // Higher priority than the default link handler for view.php.
 |     priority = 50; // Higher priority than the default link handler for view.php.
 | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | |||||||
| @ -28,7 +28,7 @@ export class AddonModDataDeleteLinkHandlerService extends CoreContentLinksHandle | |||||||
| 
 | 
 | ||||||
|     name = 'AddonModDataDeleteLinkHandler'; |     name = 'AddonModDataDeleteLinkHandler'; | ||||||
|     featureName = 'CoreCourseModuleDelegate_AddonModData'; |     featureName = 'CoreCourseModuleDelegate_AddonModData'; | ||||||
|     pattern = /^\/mod\/data\/view\.php.*([?&](d|delete)=\d+)/; |     pattern = /\/mod\/data\/view\.php.*([?&](d|delete)=\d+)/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * @inheritdoc | ||||||
|  | |||||||
| @ -32,7 +32,7 @@ export class AddonModDataEditLinkHandlerService extends CoreContentLinksHandlerB | |||||||
| 
 | 
 | ||||||
|     name = 'AddonModDataEditLinkHandler'; |     name = 'AddonModDataEditLinkHandler'; | ||||||
|     featureName = 'CoreCourseModuleDelegate_AddonModData'; |     featureName = 'CoreCourseModuleDelegate_AddonModData'; | ||||||
|     pattern = /^\/mod\/data\/edit\.php.*([?&](d|rid)=\d+)/; |     pattern = /\/mod\/data\/edit\.php.*([?&](d|rid)=\d+)/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * @inheritdoc | ||||||
|  | |||||||
| @ -32,7 +32,7 @@ export class AddonModDataShowLinkHandlerService extends CoreContentLinksHandlerB | |||||||
| 
 | 
 | ||||||
|     name = 'AddonModDataShowLinkHandler'; |     name = 'AddonModDataShowLinkHandler'; | ||||||
|     featureName = 'CoreCourseModuleDelegate_AddonModData'; |     featureName = 'CoreCourseModuleDelegate_AddonModData'; | ||||||
|     pattern = /^\/mod\/data\/view\.php.*([?&](d|rid|page|group|mode)=\d+)/; |     pattern = /\/mod\/data\/view\.php.*([?&](d|rid|page|group|mode)=\d+)/; | ||||||
|     priority = 50; // Higher priority than the default link handler for view.php.
 |     priority = 50; // Higher priority than the default link handler for view.php.
 | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | |||||||
| @ -30,7 +30,7 @@ export class AddonModFeedbackAnalysisLinkHandlerService extends CoreContentLinks | |||||||
| 
 | 
 | ||||||
|     name = 'AddonModFeedbackAnalysisLinkHandler'; |     name = 'AddonModFeedbackAnalysisLinkHandler'; | ||||||
|     featureName = 'CoreCourseModuleDelegate_AddonModFeedback'; |     featureName = 'CoreCourseModuleDelegate_AddonModFeedback'; | ||||||
|     pattern = /^\/mod\/feedback\/analysis\.php.*([&?]id=\d+)/; |     pattern = /\/mod\/feedback\/analysis\.php.*([&?]id=\d+)/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * @inheritdoc | ||||||
|  | |||||||
| @ -31,7 +31,7 @@ export class AddonModFeedbackCompleteLinkHandlerService extends CoreContentLinks | |||||||
| 
 | 
 | ||||||
|     name = 'AddonModFeedbackCompleteLinkHandler'; |     name = 'AddonModFeedbackCompleteLinkHandler'; | ||||||
|     featureName = 'CoreCourseModuleDelegate_AddonModFeedback'; |     featureName = 'CoreCourseModuleDelegate_AddonModFeedback'; | ||||||
|     pattern = /^\/mod\/feedback\/complete\.php.*([?&](id|gopage)=\d+)/; |     pattern = /\/mod\/feedback\/complete\.php.*([?&](id|gopage)=\d+)/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * @inheritdoc | ||||||
|  | |||||||
| @ -31,7 +31,7 @@ export class AddonModFeedbackPrintLinkHandlerService extends CoreContentLinksHan | |||||||
| 
 | 
 | ||||||
|     name = 'AddonModFeedbackPrintLinkHandler'; |     name = 'AddonModFeedbackPrintLinkHandler'; | ||||||
|     featureName = 'CoreCourseModuleDelegate_AddonModFeedback'; |     featureName = 'CoreCourseModuleDelegate_AddonModFeedback'; | ||||||
|     pattern = /^\/mod\/feedback\/print\.php.*([?&](id)=\d+)/; |     pattern = /\/mod\/feedback\/print\.php.*([?&](id)=\d+)/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * @inheritdoc | ||||||
|  | |||||||
| @ -27,7 +27,7 @@ export class AddonModFeedbackShowEntriesLinkHandlerService extends CoreContentLi | |||||||
| 
 | 
 | ||||||
|     name = 'AddonModFeedbackShowEntriesLinkHandler'; |     name = 'AddonModFeedbackShowEntriesLinkHandler'; | ||||||
|     featureName = 'CoreCourseModuleDelegate_AddonModFeedback'; |     featureName = 'CoreCourseModuleDelegate_AddonModFeedback'; | ||||||
|     pattern = /^\/mod\/feedback\/show_entries\.php.*([?&](id|showcompleted)=\d+)/; |     pattern = /\/mod\/feedback\/show_entries\.php.*([?&](id|showcompleted)=\d+)/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * @inheritdoc | ||||||
|  | |||||||
| @ -30,7 +30,7 @@ export class AddonModFeedbackShowNonRespondentsLinkHandlerService extends CoreCo | |||||||
| 
 | 
 | ||||||
|     name = 'AddonModFeedbackShowNonRespondentsLinkHandler'; |     name = 'AddonModFeedbackShowNonRespondentsLinkHandler'; | ||||||
|     featureName = 'CoreCourseModuleDelegate_AddonModFeedback'; |     featureName = 'CoreCourseModuleDelegate_AddonModFeedback'; | ||||||
|     pattern = /^\/mod\/feedback\/show_nonrespondents\.php.*([?&](id)=\d+)/; |     pattern = /\/mod\/feedback\/show_nonrespondents\.php.*([?&](id)=\d+)/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * @inheritdoc | ||||||
|  | |||||||
| @ -28,7 +28,7 @@ export class AddonModForumDiscussionLinkHandlerService extends CoreContentLinksH | |||||||
| 
 | 
 | ||||||
|     name = 'AddonModForumDiscussionLinkHandler'; |     name = 'AddonModForumDiscussionLinkHandler'; | ||||||
|     featureName = 'CoreCourseModuleDelegate_AddonModForum'; |     featureName = 'CoreCourseModuleDelegate_AddonModForum'; | ||||||
|     pattern = /^\/mod\/forum\/discuss\.php.*([&?]d=\d+)/; |     pattern = /\/mod\/forum\/discuss\.php.*([&?]d=\d+)/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Get the list of actions for a link (url). |      * Get the list of actions for a link (url). | ||||||
|  | |||||||
| @ -32,7 +32,7 @@ export class AddonModForumPostLinkHandlerService extends CoreContentLinksHandler | |||||||
| 
 | 
 | ||||||
|     name = 'AddonModForumPostLinkHandler'; |     name = 'AddonModForumPostLinkHandler'; | ||||||
|     featureName = 'CoreCourseModuleDelegate_AddonModForum'; |     featureName = 'CoreCourseModuleDelegate_AddonModForum'; | ||||||
|     pattern = /^\/mod\/forum\/post\.php.*([?&](forum)=\d+)/; |     pattern = /\/mod\/forum\/post\.php.*([?&](forum)=\d+)/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Get the list of actions for a link (url). |      * Get the list of actions for a link (url). | ||||||
|  | |||||||
| @ -32,7 +32,7 @@ export class AddonModGlossaryEditLinkHandlerService extends CoreContentLinksHand | |||||||
| 
 | 
 | ||||||
|     name = 'AddonModGlossaryEditLinkHandler'; |     name = 'AddonModGlossaryEditLinkHandler'; | ||||||
|     featureName = 'CoreCourseModuleDelegate_AddonModGlossary'; |     featureName = 'CoreCourseModuleDelegate_AddonModGlossary'; | ||||||
|     pattern = /^\/mod\/glossary\/edit\.php.*([?&](cmid)=\d+)/; |     pattern = /\/mod\/glossary\/edit\.php.*([?&](cmid)=\d+)/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * @inheritdoc | ||||||
|  | |||||||
| @ -31,7 +31,7 @@ export class AddonModGlossaryEntryLinkHandlerService extends CoreContentLinksHan | |||||||
| 
 | 
 | ||||||
|     name = 'AddonModGlossaryEntryLinkHandler'; |     name = 'AddonModGlossaryEntryLinkHandler'; | ||||||
|     featureName = 'CoreCourseModuleDelegate_AddonModGlossary'; |     featureName = 'CoreCourseModuleDelegate_AddonModGlossary'; | ||||||
|     pattern = /^\/mod\/glossary\/(showentry|view)\.php.*([&?](eid|g|mode|hook)=\d+)/; |     pattern = /\/mod\/glossary\/(showentry|view)\.php.*([&?](eid|g|mode|hook)=\d+)/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * @inheritdoc | ||||||
|  | |||||||
| @ -33,7 +33,7 @@ export class AddonModH5PActivityReportLinkHandlerService extends CoreContentLink | |||||||
| 
 | 
 | ||||||
|     name = 'AddonModH5PActivityReportLinkHandler'; |     name = 'AddonModH5PActivityReportLinkHandler'; | ||||||
|     featureName = 'CoreCourseModuleDelegate_AddonModH5PActivity'; |     featureName = 'CoreCourseModuleDelegate_AddonModH5PActivity'; | ||||||
|     pattern = /^\/mod\/h5pactivity\/report\.php.*([&?]a=\d+)/; |     pattern = /\/mod\/h5pactivity\/report\.php.*([&?]a=\d+)/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * @inheritdoc | ||||||
|  | |||||||
| @ -31,7 +31,7 @@ export class AddonModLessonReportLinkHandlerService extends CoreContentLinksHand | |||||||
| 
 | 
 | ||||||
|     name = 'AddonModLessonReportLinkHandler'; |     name = 'AddonModLessonReportLinkHandler'; | ||||||
|     featureName = 'CoreCourseModuleDelegate_AddonModLesson'; |     featureName = 'CoreCourseModuleDelegate_AddonModLesson'; | ||||||
|     pattern = /^\/mod\/lesson\/report\.php.*([&?]id=\d+)/; |     pattern = /\/mod\/lesson\/report\.php.*([&?]id=\d+)/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Get the list of actions for a link (url). |      * Get the list of actions for a link (url). | ||||||
|  | |||||||
| @ -26,7 +26,7 @@ export class AddonModQuizReviewLinkHandlerService extends CoreContentLinksHandle | |||||||
| 
 | 
 | ||||||
|     name = 'AddonModQuizReviewLinkHandler'; |     name = 'AddonModQuizReviewLinkHandler'; | ||||||
|     featureName = 'CoreCourseModuleDelegate_AddonModQuiz'; |     featureName = 'CoreCourseModuleDelegate_AddonModQuiz'; | ||||||
|     pattern = /^\/mod\/quiz\/review\.php.*([&?]attempt=\d+)/; |     pattern = /\/mod\/quiz\/review\.php.*([&?]attempt=\d+)/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Get the list of actions for a link (url). |      * Get the list of actions for a link (url). | ||||||
|  | |||||||
| @ -33,7 +33,7 @@ export class AddonModWikiCreateLinkHandlerService extends CoreContentLinksHandle | |||||||
| 
 | 
 | ||||||
|     name = 'AddonModWikiCreateLinkHandler'; |     name = 'AddonModWikiCreateLinkHandler'; | ||||||
|     featureName = 'CoreCourseModuleDelegate_AddonModWiki'; |     featureName = 'CoreCourseModuleDelegate_AddonModWiki'; | ||||||
|     pattern = /^\/mod\/wiki\/create\.php.*([&?]swid=\d+)/; |     pattern = /\/mod\/wiki\/create\.php.*([&?]swid=\d+)/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Check if the current view is a wiki page of the same wiki. |      * Check if the current view is a wiki page of the same wiki. | ||||||
|  | |||||||
| @ -31,7 +31,7 @@ export class AddonModWikiEditLinkHandlerService extends CoreContentLinksHandlerB | |||||||
| 
 | 
 | ||||||
|     name = 'AddonModWikiEditLinkHandler'; |     name = 'AddonModWikiEditLinkHandler'; | ||||||
|     featureName = 'CoreCourseModuleDelegate_AddonModWiki'; |     featureName = 'CoreCourseModuleDelegate_AddonModWiki'; | ||||||
|     pattern = /^\/mod\/wiki\/edit\.php.*([&?]pageid=\d+)/; |     pattern = /\/mod\/wiki\/edit\.php.*([&?]pageid=\d+)/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * @inheritdoc | ||||||
|  | |||||||
| @ -32,7 +32,7 @@ export class AddonModWikiPageOrMapLinkHandlerService extends CoreContentLinksHan | |||||||
| 
 | 
 | ||||||
|     name = 'AddonModWikiPageOrMapLinkHandler'; |     name = 'AddonModWikiPageOrMapLinkHandler'; | ||||||
|     featureName = 'CoreCourseModuleDelegate_AddonModWiki'; |     featureName = 'CoreCourseModuleDelegate_AddonModWiki'; | ||||||
|     pattern = /^\/mod\/wiki\/(view|map)\.php.*([&?]pageid=\d+)/; |     pattern = /\/mod\/wiki\/(view|map)\.php.*([&?]pageid=\d+)/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * @inheritdoc | ||||||
|  | |||||||
| @ -27,7 +27,7 @@ import { AddonNotificationsMainMenuHandlerService } from './mainmenu'; | |||||||
| export class AddonNotificationsLinkHandlerService extends CoreContentLinksHandlerBase { | export class AddonNotificationsLinkHandlerService extends CoreContentLinksHandlerBase { | ||||||
| 
 | 
 | ||||||
|     name = 'AddonNotificationsLinkHandler'; |     name = 'AddonNotificationsLinkHandler'; | ||||||
|     pattern = /^\/message\/output\/popup\/notifications\.php/; |     pattern = /\/message\/output\/popup\/notifications\.php/; | ||||||
|     featureName = 'CoreMainMenuDelegate_AddonNotifications'; |     featureName = 'CoreMainMenuDelegate_AddonNotifications'; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | |||||||
| @ -28,7 +28,7 @@ import { AddonNotificationsSettingsHandlerService } from './settings'; | |||||||
| export class AddonNotificationsPreferencesLinkHandlerService extends CoreContentLinksHandlerBase { | export class AddonNotificationsPreferencesLinkHandlerService extends CoreContentLinksHandlerBase { | ||||||
| 
 | 
 | ||||||
|     name = 'AddonNotificationsPreferencesLinkHandler'; |     name = 'AddonNotificationsPreferencesLinkHandler'; | ||||||
|     pattern = /^\/message\/notificationpreferences\.php/; |     pattern = /\/message\/notificationpreferences\.php/; | ||||||
|     checkAllUsers = true; |     checkAllUsers = true; | ||||||
|     featureName = 'CoreMainMenuDelegate_AddonNotifications'; |     featureName = 'CoreMainMenuDelegate_AddonNotifications'; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -38,7 +38,7 @@ const BULK_ACTIONS = { | |||||||
| export class AddonReportInsightsActionLinkHandlerService extends CoreContentLinksHandlerBase { | export class AddonReportInsightsActionLinkHandlerService extends CoreContentLinksHandlerBase { | ||||||
| 
 | 
 | ||||||
|     name = 'AddonReportInsightsActionLinkHandler'; |     name = 'AddonReportInsightsActionLinkHandler'; | ||||||
|     pattern = /^\/report\/insights\/action\.php/; |     pattern = /\/report\/insights\/action\.php/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * @inheritdoc | ||||||
|  | |||||||
| @ -50,6 +50,11 @@ export class CoreContentLinksHandlerBase implements CoreContentLinksHandler { | |||||||
|      */ |      */ | ||||||
|     pattern?: RegExp; |     pattern?: RegExp; | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * If true, a "^" will be added to the beginning of the pattern. It's recommended to avoid collisions with other handlers. | ||||||
|  |      */ | ||||||
|  |     patternMatchStart = true; | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * Get the list of actions for a link (url). |      * Get the list of actions for a link (url). | ||||||
|      * |      * | ||||||
| @ -82,7 +87,15 @@ export class CoreContentLinksHandlerBase implements CoreContentLinksHandler { | |||||||
|      * @return Whether the URL is handled by this handler |      * @return Whether the URL is handled by this handler | ||||||
|      */ |      */ | ||||||
|     handles(url: string): boolean { |     handles(url: string): boolean { | ||||||
|         return !!this.pattern && url.search(this.pattern) >= 0; |         let pattern = this.pattern; | ||||||
|  | 
 | ||||||
|  |         if (pattern && this.patternMatchStart) { | ||||||
|  |             let patternString = pattern.toString(); | ||||||
|  |             patternString = patternString.substring(1, patternString.length - 1); // Remove slashes from beginning and end.
 | ||||||
|  |             pattern = new RegExp('^' + patternString); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         return !!pattern && url.search(pattern) >= 0; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|  | |||||||
| @ -47,7 +47,7 @@ export class CoreContentLinksModuleGradeHandler extends CoreContentLinksHandlerB | |||||||
|         super(); |         super(); | ||||||
| 
 | 
 | ||||||
|         // Match the grade.php URL with an id param.
 |         // Match the grade.php URL with an id param.
 | ||||||
|         this.pattern = new RegExp('^/mod/' + modName + '/grade.php.*([&?]id=\\d+)'); |         this.pattern = new RegExp('/mod/' + modName + '/grade.php.*([&?]id=\\d+)'); | ||||||
|         this.featureName = 'CoreCourseModuleDelegate_' + addon; |         this.featureName = 'CoreCourseModuleDelegate_' + addon; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -45,8 +45,8 @@ export class CoreContentLinksModuleIndexHandler extends CoreContentLinksHandlerB | |||||||
| 
 | 
 | ||||||
|         // Match the view.php URL with an id or instance id param.
 |         // Match the view.php URL with an id or instance id param.
 | ||||||
|         const pattern = instanceIdParam ? |         const pattern = instanceIdParam ? | ||||||
|             '^/mod/' + modName + '/view.php.*([&?](' + instanceIdParam + '|id)=\\d+)' : |             '/mod/' + modName + '/view.php.*([&?](' + instanceIdParam + '|id)=\\d+)' : | ||||||
|             '^/mod/' + modName + '/view.php.*([&?]id=\\d+)'; |             '/mod/' + modName + '/view.php.*([&?]id=\\d+)'; | ||||||
| 
 | 
 | ||||||
|         this.pattern = new RegExp(pattern); |         this.pattern = new RegExp(pattern); | ||||||
|         this.featureName = 'CoreCourseModuleDelegate_' + addon; |         this.featureName = 'CoreCourseModuleDelegate_' + addon; | ||||||
|  | |||||||
| @ -41,7 +41,7 @@ export class CoreContentLinksModuleListHandler extends CoreContentLinksHandlerBa | |||||||
|         super(); |         super(); | ||||||
| 
 | 
 | ||||||
|         // Match the index.php URL with an id param.
 |         // Match the index.php URL with an id param.
 | ||||||
|         this.pattern = new RegExp('^/mod/' + modName + '/index.php.*([&?]id=\\d+)'); |         this.pattern = new RegExp('/mod/' + modName + '/index.php.*([&?]id=\\d+)'); | ||||||
|         this.featureName = 'CoreCourseModuleDelegate_' + addon; |         this.featureName = 'CoreCourseModuleDelegate_' + addon; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -35,7 +35,7 @@ import { CoreIonLoadingElement } from '@classes/ion-loading'; | |||||||
| export class CoreCoursesCourseLinkHandlerService extends CoreContentLinksHandlerBase { | export class CoreCoursesCourseLinkHandlerService extends CoreContentLinksHandlerBase { | ||||||
| 
 | 
 | ||||||
|     name = 'CoreCoursesCourseLinkHandler'; |     name = 'CoreCoursesCourseLinkHandler'; | ||||||
|     pattern = /((^\/enrol\/index\.php)|(^\/course\/enrol\.php)|(^\/course\/view\.php)).*([?&]id=\d+)/; |     pattern = /((\/enrol\/index\.php)|(\/course\/enrol\.php)|(\/course\/view\.php)).*([?&]id=\d+)/; | ||||||
| 
 | 
 | ||||||
|     protected waitStart = 0; |     protected waitStart = 0; | ||||||
|     protected logger: CoreLogger; |     protected logger: CoreLogger; | ||||||
|  | |||||||
| @ -28,7 +28,7 @@ export class CoreCoursesIndexLinkHandlerService extends CoreContentLinksHandlerB | |||||||
| 
 | 
 | ||||||
|     name = 'CoreCoursesIndexLinkHandler'; |     name = 'CoreCoursesIndexLinkHandler'; | ||||||
|     featureName = 'CoreMainMenuDelegate_CoreCourses'; |     featureName = 'CoreMainMenuDelegate_CoreCourses'; | ||||||
|     pattern = /^\/course\/?(index\.php.*)?$/; |     pattern = /\/course\/?(index\.php.*)?$/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * @inheritdoc | ||||||
|  | |||||||
| @ -27,7 +27,7 @@ import { CoreDashboardHomeHandler, CoreDashboardHomeHandlerService } from './das | |||||||
| export class CoreCoursesDashboardLinkHandlerService extends CoreContentLinksHandlerBase { | export class CoreCoursesDashboardLinkHandlerService extends CoreContentLinksHandlerBase { | ||||||
| 
 | 
 | ||||||
|     name = 'CoreCoursesDashboardLinkHandler'; |     name = 'CoreCoursesDashboardLinkHandler'; | ||||||
|     pattern = /^\/my\/?$/; |     pattern = /\/my\/?$/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Get the list of actions for a link (url). |      * Get the list of actions for a link (url). | ||||||
|  | |||||||
| @ -27,7 +27,7 @@ import { GRADES_PAGE_NAME } from '../grades-helper'; | |||||||
| export class CoreGradesOverviewLinkHandlerService extends CoreContentLinksHandlerBase { | export class CoreGradesOverviewLinkHandlerService extends CoreContentLinksHandlerBase { | ||||||
| 
 | 
 | ||||||
|     name = 'CoreGradesOverviewLinkHandler'; |     name = 'CoreGradesOverviewLinkHandler'; | ||||||
|     pattern = /^\/grade\/report\/overview\/index.php/; |     pattern = /\/grade\/report\/overview\/index.php/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Get the list of actions for a link (url). |      * Get the list of actions for a link (url). | ||||||
|  | |||||||
| @ -27,7 +27,7 @@ import { makeSingleton } from '@singletons'; | |||||||
| export class CoreGradesReportLinkHandlerService extends CoreContentLinksHandlerBase { | export class CoreGradesReportLinkHandlerService extends CoreContentLinksHandlerBase { | ||||||
| 
 | 
 | ||||||
|     name = 'CoreGradesReportLinkHandler'; |     name = 'CoreGradesReportLinkHandler'; | ||||||
|     pattern = /^\/grade\/report(\/user)?\/index.php/; |     pattern = /\/grade\/report(\/user)?\/index.php/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Get the list of actions for a link (url). |      * Get the list of actions for a link (url). | ||||||
|  | |||||||
| @ -27,7 +27,7 @@ import { makeSingleton } from '@singletons'; | |||||||
| export class CoreGradesUserLinkHandlerService extends CoreContentLinksHandlerBase { | export class CoreGradesUserLinkHandlerService extends CoreContentLinksHandlerBase { | ||||||
| 
 | 
 | ||||||
|     name = 'CoreGradesUserLinkHandler'; |     name = 'CoreGradesUserLinkHandler'; | ||||||
|     pattern = /^\/course\/user\.php.*[?&]mode=grade/; |     pattern = /\/course\/user\.php.*[?&]mode=grade/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Get the list of actions for a link (url). |      * Get the list of actions for a link (url). | ||||||
|  | |||||||
| @ -31,7 +31,7 @@ export class CoreSiteHomeIndexLinkHandlerService extends CoreContentLinksHandler | |||||||
| 
 | 
 | ||||||
|     name = 'CoreSiteHomeIndexLinkHandler'; |     name = 'CoreSiteHomeIndexLinkHandler'; | ||||||
|     featureName = 'CoreMainMenuDelegate_CoreSiteHome'; |     featureName = 'CoreMainMenuDelegate_CoreSiteHome'; | ||||||
|     pattern = /^\/course\/view\.php.*([?&]id=\d+)|^\/index\.php(\?redirect=0)?/; |     pattern = /(\/course\/view\.php.*([?&]id=\d+)|\/index\.php(\?redirect=0)?)/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * @inheritdoc | ||||||
|  | |||||||
| @ -27,7 +27,7 @@ import { CoreTag } from '../tag'; | |||||||
| export class CoreTagIndexLinkHandlerService extends CoreContentLinksHandlerBase { | export class CoreTagIndexLinkHandlerService extends CoreContentLinksHandlerBase { | ||||||
| 
 | 
 | ||||||
|     name = 'CoreTagIndexLinkHandler'; |     name = 'CoreTagIndexLinkHandler'; | ||||||
|     pattern = /^\/tag\/index\.php/; |     pattern = /\/tag\/index\.php/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Get the list of actions for a link (url). |      * Get the list of actions for a link (url). | ||||||
|  | |||||||
| @ -27,7 +27,7 @@ import { CoreTag } from '../tag'; | |||||||
| export class CoreTagSearchLinkHandlerService extends CoreContentLinksHandlerBase { | export class CoreTagSearchLinkHandlerService extends CoreContentLinksHandlerBase { | ||||||
| 
 | 
 | ||||||
|     name = 'CoreTagSearchLinkHandler'; |     name = 'CoreTagSearchLinkHandler'; | ||||||
|     pattern = /^\/tag\/search\.php/; |     pattern = /\/tag\/search\.php/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Get the list of actions for a link (url). |      * Get the list of actions for a link (url). | ||||||
|  | |||||||
| @ -27,7 +27,7 @@ export class CoreUserProfileLinkHandlerService extends CoreContentLinksHandlerBa | |||||||
| 
 | 
 | ||||||
|     name = 'CoreUserProfileLinkHandler'; |     name = 'CoreUserProfileLinkHandler'; | ||||||
|     // Match user/view.php and user/profile.php but NOT grade/report/user/.
 |     // Match user/view.php and user/profile.php but NOT grade/report/user/.
 | ||||||
|     pattern = /((^\/user\/view\.php)|(^\/user\/profile\.php)).*([?&]id=\d+)/; |     pattern = /((\/user\/view\.php)|(\/user\/profile\.php)).*([?&]id=\d+)/; | ||||||
| 
 | 
 | ||||||
|     /** |     /** | ||||||
|      * Get the list of actions for a link (url). |      * Get the list of actions for a link (url). | ||||||
|  | |||||||
| @ -24,7 +24,7 @@ information provided here is intended especially for developers. | |||||||
| - contextMenuPrefetch and fillContextMenu have been removed from CoreCourseHelper. | - contextMenuPrefetch and fillContextMenu have been removed from CoreCourseHelper. | ||||||
| - The variable "loaded" in CoreCourseModuleMainResourceComponent has been changed to "showLoading" to reflect its purpose better. | - The variable "loaded" in CoreCourseModuleMainResourceComponent has been changed to "showLoading" to reflect its purpose better. | ||||||
| - The function getCurrentSection of course formats can now return a forceSelected boolean along with the section (defaults to false if not returned). | - The function getCurrentSection of course formats can now return a forceSelected boolean along with the section (defaults to false if not returned). | ||||||
| - The link handlers functions (CoreContentLinksHandler) will now always receive a relative URL instead of an absolute URL. It's now recommended to use "^" in your regular expressions to avoid false positives. | - The link handlers functions (CoreContentLinksHandler) will now always receive a relative URL instead of an absolute URL. The CoreContentLinksHandlerBase class now adds "^" to the start of the pattern by default to prevent false positives. | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user