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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion moodle.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,12 @@
}
},
"clearIABSessionWhenAutoLogin": "android",
"collapsibleItemsExpanded": false
"collapsibleItemsExpanded": false,
"overrideMainMenuButtons": [
{
"handler": "CoreSearch",
"icon": "fas-book",
"priority": 2000
}
]
}
20 changes: 20 additions & 0 deletions src/addons/badges/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// (C) Copyright 2015 Moodle Pty Ltd.
//
// 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 { CORE_USER_FEATURE_PREFIX } from '@features/user/constants';

export const ADDONS_BADGES_COMPONENT_NAME = 'AddonBadges';

export const ADDONS_BADGES_USER_MENU_FEATURE_NAME = `${CORE_USER_FEATURE_PREFIX}${ADDONS_BADGES_COMPONENT_NAME}`;
export const ADDONS_BADGES_ACCOUNT_FEATURE_NAME = `${ADDONS_BADGES_USER_MENU_FEATURE_NAME}:account`;
3 changes: 2 additions & 1 deletion src/addons/badges/services/handlers/mybadges-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
import { CoreNavigator } from '@services/navigator';
import { makeSingleton } from '@singletons';
import { AddonBadges } from '../badges';
import { ADDONS_BADGES_USER_MENU_FEATURE_NAME } from '@addons/badges/constants';

/**
* Handler to treat links to user badges page.
Expand All @@ -26,7 +27,7 @@ import { AddonBadges } from '../badges';
export class AddonBadgesMyBadgesLinkHandlerService extends CoreContentLinksHandlerBase {

name = 'AddonBadgesMyBadgesLinkHandler';
featureName = 'CoreUserDelegate_AddonBadges';
featureName = ADDONS_BADGES_USER_MENU_FEATURE_NAME;
pattern = /\/badges\/mybadges\.php/;

/**
Expand Down
3 changes: 2 additions & 1 deletion src/addons/badges/services/handlers/push-click.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { CorePushNotificationsNotificationBasicData } from '@features/pushnotifi
import { CoreNavigator } from '@services/navigator';
import { AddonBadgesHelper } from '../badges-helper';
import { CorePromiseUtils } from '@singletons/promise-utils';
import { ADDONS_BADGES_USER_MENU_FEATURE_NAME } from '@addons/badges/constants';

/**
* Handler for badges push notifications clicks.
Expand All @@ -31,7 +32,7 @@ export class AddonBadgesPushClickHandlerService implements CorePushNotifications

name = 'AddonBadgesPushClickHandler';
priority = 200;
featureName = 'CoreUserDelegate_AddonBadges';
featureName = ADDONS_BADGES_USER_MENU_FEATURE_NAME;

/**
* @inheritdoc
Expand Down
12 changes: 9 additions & 3 deletions src/addons/badges/services/handlers/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,20 @@ import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites';
import { makeSingleton } from '@singletons';
import { AddonBadges } from '../badges';
import {
ADDONS_BADGES_ACCOUNT_FEATURE_NAME,
ADDONS_BADGES_COMPONENT_NAME,
ADDONS_BADGES_USER_MENU_FEATURE_NAME,
} from '@addons/badges/constants';

/**
* Profile badges handler.
*/
@Injectable({ providedIn: 'root' })
export class AddonBadgesUserHandlerService implements CoreUserProfileHandler {

name = 'AddonBadges:fakename'; // This name doesn't match any disabled feature, they'll be checked in isEnabledForContext.
// This name doesn't match any disabled feature, they'll be checked in isEnabledForContext.
name = `${ADDONS_BADGES_COMPONENT_NAME}:fakename`;
priority = 300;
type = CoreUserProfileHandlerType.LIST_ITEM;

Expand All @@ -57,10 +63,10 @@ export class AddonBadgesUserHandlerService implements CoreUserProfileHandler {
}

if (context === CoreUserDelegateContext.USER_MENU) {
if (currentSite.isFeatureDisabled('CoreUserDelegate_AddonBadges:account')) {
if (currentSite.isFeatureDisabled(ADDONS_BADGES_ACCOUNT_FEATURE_NAME)) {
return false;
}
} else if (currentSite.isFeatureDisabled('CoreUserDelegate_AddonBadges')) {
} else if (currentSite.isFeatureDisabled(ADDONS_BADGES_USER_MENU_FEATURE_NAME)) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/addons/block/globalsearch/services/block-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { CoreBlockHandlerData } from '@features/block/services/block-delegate';
import { CoreBlockBaseHandler } from '@features/block/classes/base-block-handler';
import { makeSingleton } from '@singletons';
import { CoreCourseBlock } from '@features/course/services/course';
import { CORE_SEARCH_PAGE_NAME } from '@features/search/services/handlers/mainmenu';
import { CORE_SEARCH_PAGE_NAME } from '@features/search/constants';
import { CoreSearchGlobalSearch } from '@features/search/services/global-search';
import { ContextLevel } from '@/core/constants';

Expand Down
8 changes: 8 additions & 0 deletions src/addons/blog/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,20 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import { CORE_USER_FEATURE_PREFIX } from '@features/user/constants';

export const ADDON_BLOG_MAINMENU_PAGE_NAME = 'blog';
export const ADDON_BLOG_ENTRY_UPDATED = 'blog_entry_updated';
export const ADDON_BLOG_AUTO_SYNCED = 'addon_blog_autom_synced';
export const ADDON_BLOG_MANUAL_SYNCED = 'addon_blog_manual_synced';
export const ADDON_BLOG_SYNC_ID = 'blog';

export const ADDONS_BLOG_COMPONENT_NAME = 'AddonBlog';

const ADDONS_BLOG_GLOBAL_FEATURE_NAME = `${CORE_USER_FEATURE_PREFIX}${ADDONS_BLOG_COMPONENT_NAME}`;
export const ADDONS_BLOG_ACCOUNT_FEATURE_NAME = `${ADDONS_BLOG_GLOBAL_FEATURE_NAME}:account`;
export const ADDONS_BLOG_USER_MENU_FEATURE_NAME = `${ADDONS_BLOG_GLOBAL_FEATURE_NAME}:blogs`;

/**
* Restriction level of user blog visualization.
*/
Expand Down
4 changes: 2 additions & 2 deletions src/addons/blog/services/handlers/course-option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ import { CoreSites } from '@services/sites';
import { CoreWSFile } from '@services/ws';
import { makeSingleton } from '@singletons';
import { AddonBlog } from '../blog';
import { ADDON_BLOG_MAINMENU_PAGE_NAME } from '@addons/blog/constants';
import { ADDON_BLOG_MAINMENU_PAGE_NAME, ADDONS_BLOG_COMPONENT_NAME } from '@addons/blog/constants';

/**
* Course nav handler.
*/
@Injectable({ providedIn: 'root' })
export class AddonBlogCourseOptionHandlerService implements CoreCourseOptionsHandler {

name = 'AddonBlog';
name = ADDONS_BLOG_COMPONENT_NAME;
priority = 100;

/**
Expand Down
3 changes: 2 additions & 1 deletion src/addons/blog/services/handlers/edit-entry-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
import { CoreNavigator } from '@services/navigator';
import { makeSingleton } from '@singletons';
import { AddonBlog } from '../blog';
import { ADDONS_BLOG_USER_MENU_FEATURE_NAME } from '@addons/blog/constants';

/**
* Handler to treat links to edit blog entry page.
Expand All @@ -27,7 +28,7 @@ import { AddonBlog } from '../blog';
export class AddonBlogEditEntryLinkHandlerService extends CoreContentLinksHandlerBase {

name = 'AddonBlogEditEntryLinkHandler';
featureName = 'CoreUserDelegate_AddonBlog:blogs';
featureName = ADDONS_BLOG_USER_MENU_FEATURE_NAME;
pattern = /\/blog\/(add|edit)\.php/;

/**
Expand Down
3 changes: 2 additions & 1 deletion src/addons/blog/services/handlers/index-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { CoreContentLinksAction } from '@features/contentlinks/services/contentl
import { CoreNavigator } from '@services/navigator';
import { makeSingleton } from '@singletons';
import { AddonBlog } from '../blog';
import { ADDONS_BLOG_USER_MENU_FEATURE_NAME } from '@addons/blog/constants';

/**
* Handler to treat links to blog page.
Expand All @@ -27,7 +28,7 @@ import { AddonBlog } from '../blog';
export class AddonBlogIndexLinkHandlerService extends CoreContentLinksHandlerBase {

name = 'AddonBlogIndexLinkHandler';
featureName = 'CoreUserDelegate_AddonBlog:blogs';
featureName = ADDONS_BLOG_USER_MENU_FEATURE_NAME;
pattern = /\/blog\/index\.php/;

/**
Expand Down
4 changes: 2 additions & 2 deletions src/addons/blog/services/handlers/mainmenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ import { Injectable } from '@angular/core';
import { CoreMainMenuHandler, CoreMainMenuHandlerData } from '@features/mainmenu/services/mainmenu-delegate';
import { makeSingleton } from '@singletons';
import { AddonBlog } from '../blog';
import { ADDON_BLOG_MAINMENU_PAGE_NAME } from '@addons/blog/constants';
import { ADDON_BLOG_MAINMENU_PAGE_NAME, ADDONS_BLOG_COMPONENT_NAME } from '@addons/blog/constants';

/**
* Handler to inject an option into main menu.
*/
@Injectable({ providedIn: 'root' })
export class AddonBlogMainMenuHandlerService implements CoreMainMenuHandler {

name = 'AddonBlog';
name = ADDONS_BLOG_COMPONENT_NAME;
priority = 500;

/**
Expand Down
11 changes: 8 additions & 3 deletions src/addons/blog/services/handlers/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,19 @@ import { CoreNavigator } from '@services/navigator';
import { CoreSites } from '@services/sites';
import { makeSingleton } from '@singletons';
import { AddonBlog } from '../blog';
import {
ADDONS_BLOG_ACCOUNT_FEATURE_NAME,
ADDONS_BLOG_USER_MENU_FEATURE_NAME,
ADDONS_BLOG_COMPONENT_NAME,
} from '@addons/blog/constants';

/**
* Profile item handler.
*/
@Injectable({ providedIn: 'root' })
export class AddonBlogUserHandlerService implements CoreUserProfileHandler {

name = 'AddonBlog'; // This name doesn't match any disabled feature, they'll be checked in isEnabledForContext.
name = ADDONS_BLOG_COMPONENT_NAME; // This name doesn't match any disabled feature, they'll be checked in isEnabledForContext.
priority = 200;
type = CoreUserProfileHandlerType.LIST_ITEM;

Expand All @@ -52,10 +57,10 @@ export class AddonBlogUserHandlerService implements CoreUserProfileHandler {
}

if (context === CoreUserDelegateContext.USER_MENU) {
if (currentSite.isFeatureDisabled('CoreUserDelegate_AddonBlog:account')) {
if (currentSite.isFeatureDisabled(ADDONS_BLOG_ACCOUNT_FEATURE_NAME)) {
return false;
}
} else if (currentSite.isFeatureDisabled('CoreUserDelegate_AddonBlog:blogs')) {
} else if (currentSite.isFeatureDisabled(ADDONS_BLOG_USER_MENU_FEATURE_NAME)) {
return false;
}

Expand Down
4 changes: 4 additions & 0 deletions src/addons/calendar/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import { MAIN_MENU_FEATURE_PREFIX } from '@features/mainmenu/constants';
import { CORE_USER_TF_12, CORE_USER_TF_24 } from '@features/user/constants';

export const ADDON_CALENDAR_COMPONENT = 'AddonCalendarEvents';
Expand Down Expand Up @@ -45,6 +46,9 @@ export const ADDON_CALENDAR_DELETED_EVENT_EVENT = 'addon_calendar_deleted_event'
export const ADDON_CALENDAR_UNDELETED_EVENT_EVENT = 'addon_calendar_undeleted_event';
export const ADDON_CALENDAR_FILTER_CHANGED_EVENT = 'addon_calendar_filter_changed_event';

export const ADDONS_CALENDAR_COMPONENT_NAME = 'AddonCalendar';
export const ADDONS_CALENDAR_MENU_FEATURE_NAME = `${MAIN_MENU_FEATURE_PREFIX}${ADDONS_CALENDAR_COMPONENT_NAME}`;

/**
* Context levels enumeration.
*/
Expand Down
3 changes: 2 additions & 1 deletion src/addons/calendar/services/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import {
ADDON_CALENDAR_STARTING_WEEK_DAY,
ADDON_CALENDAR_UNDELETED_EVENT_EVENT,
AddonCalendarEventType,
ADDONS_CALENDAR_MENU_FEATURE_NAME,
} from '../constants';
import { REMINDERS_DEFAULT_REMINDER_TIMEBEFORE } from '@features/reminders/constants';
import { AddonCalendarFilter } from './calendar-helper';
Expand Down Expand Up @@ -1252,7 +1253,7 @@ export class AddonCalendarProvider {
isCalendarDisabledInSite(site?: CoreSite): boolean {
site = site || CoreSites.getCurrentSite();

return !!site?.isFeatureDisabled('CoreMainMenuDelegate_AddonCalendar');
return !!site?.isFeatureDisabled(ADDONS_CALENDAR_MENU_FEATURE_NAME);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/addons/calendar/services/handlers/mainmenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ import { Injectable } from '@angular/core';
import { AddonCalendar } from '../calendar';
import { makeSingleton } from '@singletons';
import { CoreMainMenuHandler, CoreMainMenuHandlerData } from '@features/mainmenu/services/mainmenu-delegate';
import { ADDON_CALENDAR_PAGE_NAME } from '@addons/calendar/constants';
import { ADDON_CALENDAR_PAGE_NAME, ADDONS_CALENDAR_COMPONENT_NAME } from '@addons/calendar/constants';

/**
* Handler to inject an option into main menu.
*/
@Injectable({ providedIn: 'root' })
export class AddonCalendarMainMenuHandlerService implements CoreMainMenuHandler {

name = 'AddonCalendar';
name = ADDONS_CALENDAR_COMPONENT_NAME;
priority = 550;

/**
Expand Down
6 changes: 6 additions & 0 deletions src/addons/competency/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import { CORE_USER_FEATURE_PREFIX } from '@features/user/constants';

export const ADDON_COMPETENCY_LEARNING_PLANS_PAGE = 'learning-plans';
export const ADDON_COMPETENCY_COMPETENCIES_PAGE = 'competencies';
export const ADDON_COMPETENCY_SUMMARY_PAGE = 'summary';

export const ADDONS_COMPETENCY_COMPONENT_NAME = 'AddonCompetency';
export const ADDONS_COMPETENCY_ACCOUNT_FEATURE_NAME = `${CORE_USER_FEATURE_PREFIX}${ADDONS_COMPETENCY_COMPONENT_NAME}`;
export const ADDONS_COMPETENCY_USER_MENU_FEATURE_NAME = `${ADDONS_COMPETENCY_ACCOUNT_FEATURE_NAME}:learningPlan`;

/**
* Learning plan status.
*/
Expand Down
8 changes: 6 additions & 2 deletions src/addons/competency/services/competency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ import { CoreSites } from '@services/sites';
import { CorePromiseUtils } from '@singletons/promise-utils';
import { makeSingleton } from '@singletons';
import { CoreTextFormat } from '@singletons/text';
import { AddonCompetencyLearningPlanStatus, AddonCompetencyReviewStatus } from '../constants';
import {
AddonCompetencyLearningPlanStatus,
AddonCompetencyReviewStatus,
ADDONS_COMPETENCY_ACCOUNT_FEATURE_NAME,
} from '../constants';
import { CoreCourseSummaryExporterData } from '@features/courses/services/courses';

/**
Expand All @@ -47,7 +51,7 @@ export class AddonCompetencyProvider {
}

return site.canUseAdvancedFeature('enablecompetencies') &&
!(site.isFeatureDisabled('CoreUserDelegate_AddonCompetency') &&
!(site.isFeatureDisabled(ADDONS_COMPETENCY_ACCOUNT_FEATURE_NAME) &&
site.isFeatureDisabled('CoreCourseOptionsDelegate_AddonCompetency'));
}

Expand Down
4 changes: 2 additions & 2 deletions src/addons/competency/services/handlers/course-option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ import { AddonCompetency } from '../competency';
import { CoreCourseAnyCourseData, CoreCourseUserAdminOrNavOptionIndexed } from '@features/courses/services/courses';
import { CoreFilterHelper } from '@features/filter/services/filter-helper';
import { ContextLevel } from '@/core/constants';
import { ADDON_COMPETENCY_COMPETENCIES_PAGE } from '@addons/competency/constants';
import { ADDON_COMPETENCY_COMPETENCIES_PAGE, ADDONS_COMPETENCY_COMPONENT_NAME } from '@addons/competency/constants';

/**
* Course nav handler.
*/
@Injectable( { providedIn: 'root' })
export class AddonCompetencyCourseOptionHandlerService implements CoreCourseOptionsHandler {

name = 'AddonCompetency';
name = ADDONS_COMPETENCY_COMPONENT_NAME;
priority = 300;

/**
Expand Down
14 changes: 10 additions & 4 deletions src/addons/competency/services/handlers/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import { ADDON_COMPETENCY_COMPETENCIES_PAGE, ADDON_COMPETENCY_LEARNING_PLANS_PAGE } from '@addons/competency/constants';
import {
ADDON_COMPETENCY_COMPETENCIES_PAGE,
ADDON_COMPETENCY_LEARNING_PLANS_PAGE,
ADDONS_COMPETENCY_COMPONENT_NAME,
ADDONS_COMPETENCY_USER_MENU_FEATURE_NAME,
ADDONS_COMPETENCY_ACCOUNT_FEATURE_NAME,
} from '@addons/competency/constants';
import { Injectable } from '@angular/core';
import { CORE_COURSE_PAGE_NAME } from '@features/course/constants';
import { CoreUserProfile } from '@features/user/services/user';
Expand All @@ -35,7 +41,7 @@ import { AddonCompetency } from '../competency';
export class AddonCompetencyUserHandlerService implements CoreUserProfileHandler {

// This name doesn't match any disabled feature, they'll be checked in isEnabledForContext.
name = 'AddonCompetency:fakename';
name = `${ADDONS_COMPETENCY_COMPONENT_NAME}:fakename`;
priority = 100;
type = CoreUserProfileHandlerType.LIST_ITEM;
cacheEnabled = true;
Expand All @@ -58,10 +64,10 @@ export class AddonCompetencyUserHandlerService implements CoreUserProfileHandler
}

if (context === CoreUserDelegateContext.USER_MENU) {
if (currentSite.isFeatureDisabled('CoreUserDelegate_AddonCompetency')) {
if (currentSite.isFeatureDisabled(ADDONS_COMPETENCY_ACCOUNT_FEATURE_NAME)) {
return false;
}
} else if (currentSite.isFeatureDisabled('CoreUserDelegate_AddonCompetency:learningPlan')) {
} else if (currentSite.isFeatureDisabled(ADDONS_COMPETENCY_USER_MENU_FEATURE_NAME)) {
return false;
}

Expand Down
Loading
Loading