MOBILE-4538 mod: Check module is enabled in related delegates
parent
dc1b9e9575
commit
ae4c1ce28a
|
@ -0,0 +1,15 @@
|
|||
// (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.
|
||||
|
||||
export const ADDON_MOD_ASSIGN_FEATURE_NAME = 'CoreCourseModuleDelegate_AddonModAssign';
|
|
@ -21,6 +21,8 @@ import { CoreWSFile } from '@services/ws';
|
|||
import { AddonModAssignSubmissionFormatted } from './assign-helper';
|
||||
import { CoreFormFields } from '@singletons/form';
|
||||
import type { IAddonModAssignFeedbackPluginComponent } from '@addons/mod/assign/classes/base-feedback-plugin-component';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { ADDON_MOD_ASSIGN_FEATURE_NAME } from '../constants';
|
||||
|
||||
/**
|
||||
* Interface that all feedback handlers must implement.
|
||||
|
@ -188,6 +190,13 @@ export class AddonModAssignFeedbackDelegateService extends CoreDelegate<AddonMod
|
|||
super('AddonModAssignFeedbackDelegate');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
async isEnabled(): Promise<boolean> {
|
||||
return !(await CoreSites.isFeatureDisabled(ADDON_MOD_ASSIGN_FEATURE_NAME));
|
||||
}
|
||||
|
||||
/**
|
||||
* Discard the draft data of the feedback plugin.
|
||||
*
|
||||
|
|
|
@ -20,6 +20,7 @@ import { CoreUrlUtils } from '@services/utils/url';
|
|||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { AddonModAssign } from '../assign';
|
||||
import { ADDON_MOD_ASSIGN_FEATURE_NAME } from '../../constants';
|
||||
|
||||
/**
|
||||
* Handler for assign push notifications clicks.
|
||||
|
@ -29,7 +30,7 @@ export class AddonModAssignPushClickHandlerService implements CorePushNotificati
|
|||
|
||||
name = 'AddonModAssignPushClickHandler';
|
||||
priority = 200;
|
||||
featureName = 'CoreCourseModuleDelegate_AddonModAssign';
|
||||
featureName = ADDON_MOD_ASSIGN_FEATURE_NAME;
|
||||
|
||||
/**
|
||||
* Check if a notification click is handled by this handler.
|
||||
|
|
|
@ -21,6 +21,8 @@ import { CoreWSFile } from '@services/ws';
|
|||
import { AddonModAssignSubmissionsDBRecordFormatted } from './assign-offline';
|
||||
import { CoreFormFields } from '@singletons/form';
|
||||
import type { AddonModAssignSubmissionPluginBaseComponent } from '@addons/mod/assign/classes/base-submission-plugin-component';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { ADDON_MOD_ASSIGN_FEATURE_NAME } from '../constants';
|
||||
|
||||
/**
|
||||
* Interface that all submission handlers must implement.
|
||||
|
@ -280,6 +282,13 @@ export class AddonModAssignSubmissionDelegateService extends CoreDelegate<AddonM
|
|||
super('AddonModAssignSubmissionDelegate');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
async isEnabled(): Promise<boolean> {
|
||||
return !(await CoreSites.isFeatureDisabled(ADDON_MOD_ASSIGN_FEATURE_NAME));
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the plugin can be edited in offline for existing submissions.
|
||||
*
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
// (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.
|
||||
|
||||
export const ADDON_MOD_DATA_FEATURE_NAME = 'CoreCourseModuleDelegate_AddonModData';
|
|
@ -25,6 +25,8 @@ import { CoreFormFields } from '@singletons/form';
|
|||
import { FileEntry } from '@awesome-cordova-plugins/file/ngx';
|
||||
import { CoreFileEntry } from '@services/file-helper';
|
||||
import type { AddonModDataFieldPluginBaseComponent } from '@addons/mod/data/classes/base-field-plugin-component';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { ADDON_MOD_DATA_FEATURE_NAME } from '../constants';
|
||||
|
||||
/**
|
||||
* Interface that all fields handlers must implement.
|
||||
|
@ -135,6 +137,13 @@ export class AddonModDataFieldsDelegateService extends CoreDelegate<AddonModData
|
|||
super('AddonModDataFieldsDelegate');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
async isEnabled(): Promise<boolean> {
|
||||
return !(await CoreSites.isFeatureDisabled(ADDON_MOD_DATA_FEATURE_NAME));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the component to use for a certain field field.
|
||||
*
|
||||
|
|
|
@ -17,6 +17,7 @@ import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base
|
|||
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { AddonModDataHelper } from '../data-helper';
|
||||
import { ADDON_MOD_DATA_FEATURE_NAME } from '../../constants';
|
||||
|
||||
/**
|
||||
* Content links handler for database approve/disapprove entry.
|
||||
|
@ -26,7 +27,7 @@ import { AddonModDataHelper } from '../data-helper';
|
|||
export class AddonModDataApproveLinkHandlerService extends CoreContentLinksHandlerBase {
|
||||
|
||||
name = 'AddonModDataApproveLinkHandler';
|
||||
featureName = 'CoreCourseModuleDelegate_AddonModData';
|
||||
featureName = ADDON_MOD_DATA_FEATURE_NAME;
|
||||
pattern = /\/mod\/data\/view\.php.*([?&](d|approve|disapprove)=\d+)/;
|
||||
priority = 50; // Higher priority than the default link handler for view.php.
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base
|
|||
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { AddonModDataHelper } from '../data-helper';
|
||||
import { ADDON_MOD_DATA_FEATURE_NAME } from '../../constants';
|
||||
|
||||
/**
|
||||
* Content links handler for database delete entry.
|
||||
|
@ -26,7 +27,7 @@ import { AddonModDataHelper } from '../data-helper';
|
|||
export class AddonModDataDeleteLinkHandlerService extends CoreContentLinksHandlerBase {
|
||||
|
||||
name = 'AddonModDataDeleteLinkHandler';
|
||||
featureName = 'CoreCourseModuleDelegate_AddonModData';
|
||||
featureName = ADDON_MOD_DATA_FEATURE_NAME;
|
||||
pattern = /\/mod\/data\/view\.php.*([?&](d|delete)=\d+)/;
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,6 +22,7 @@ import { CoreSitesReadingStrategy } from '@services/sites';
|
|||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { AddonModDataModuleHandlerService } from './module';
|
||||
import { ADDON_MOD_DATA_FEATURE_NAME } from '../../constants';
|
||||
|
||||
/**
|
||||
* Content links handler for database add or edit entry.
|
||||
|
@ -31,7 +32,7 @@ import { AddonModDataModuleHandlerService } from './module';
|
|||
export class AddonModDataEditLinkHandlerService extends CoreContentLinksHandlerBase {
|
||||
|
||||
name = 'AddonModDataEditLinkHandler';
|
||||
featureName = 'CoreCourseModuleDelegate_AddonModData';
|
||||
featureName = ADDON_MOD_DATA_FEATURE_NAME;
|
||||
pattern = /\/mod\/data\/edit\.php.*([?&](d|rid)=\d+)/;
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,6 +22,7 @@ import { CoreSitesReadingStrategy } from '@services/sites';
|
|||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { AddonModDataModuleHandlerService } from './module';
|
||||
import { ADDON_MOD_DATA_FEATURE_NAME } from '../../constants';
|
||||
|
||||
/**
|
||||
* Content links handler for database show entry.
|
||||
|
@ -31,7 +32,7 @@ import { AddonModDataModuleHandlerService } from './module';
|
|||
export class AddonModDataShowLinkHandlerService extends CoreContentLinksHandlerBase {
|
||||
|
||||
name = 'AddonModDataShowLinkHandler';
|
||||
featureName = 'CoreCourseModuleDelegate_AddonModData';
|
||||
featureName = ADDON_MOD_DATA_FEATURE_NAME;
|
||||
pattern = /\/mod\/data\/view\.php.*([?&](d|rid|page|group|mode)=\d+)/;
|
||||
priority = 50; // Higher priority than the default link handler for view.php.
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
// (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.
|
||||
|
||||
export const ADDON_MOD_QUIZ_FEATURE_NAME = 'CoreCourseModuleDelegate_AddonModQuiz';
|
|
@ -18,6 +18,8 @@ import { CoreDelegate, CoreDelegateHandler } from '@classes/delegate';
|
|||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { AddonModQuizAttemptWSData, AddonModQuizQuizWSData } from './quiz';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { ADDON_MOD_QUIZ_FEATURE_NAME } from '../constants';
|
||||
|
||||
/**
|
||||
* Interface that all access rules handlers must implement.
|
||||
|
@ -131,6 +133,13 @@ export class AddonModQuizAccessRuleDelegateService extends CoreDelegate<AddonMod
|
|||
super('AddonModQuizAccessRulesDelegate');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
async isEnabled(): Promise<boolean> {
|
||||
return !(await CoreSites.isFeatureDisabled(ADDON_MOD_QUIZ_FEATURE_NAME));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the handler for a certain rule.
|
||||
*
|
||||
|
|
|
@ -23,6 +23,7 @@ import { makeSingleton } from '@singletons';
|
|||
import { AddonModQuiz } from '../quiz';
|
||||
import { AddonModQuizHelper } from '../quiz-helper';
|
||||
import { isSafeNumber } from '@/core/utils/types';
|
||||
import { ADDON_MOD_QUIZ_FEATURE_NAME } from '../../constants';
|
||||
|
||||
/**
|
||||
* Handler for quiz push notifications clicks.
|
||||
|
@ -32,7 +33,7 @@ export class AddonModQuizPushClickHandlerService implements CorePushNotification
|
|||
|
||||
name = 'AddonModQuizPushClickHandler';
|
||||
priority = 200;
|
||||
featureName = 'CoreCourseModuleDelegate_AddonModQuiz';
|
||||
featureName = ADDON_MOD_QUIZ_FEATURE_NAME;
|
||||
|
||||
protected readonly SUPPORTED_NAMES = ['submission', 'confirmation', 'attempt_overdue'];
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base
|
|||
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { AddonModQuizHelper } from '../quiz-helper';
|
||||
import { ADDON_MOD_QUIZ_FEATURE_NAME } from '../../constants';
|
||||
|
||||
/**
|
||||
* Handler to treat links to quiz review.
|
||||
|
@ -25,7 +26,7 @@ import { AddonModQuizHelper } from '../quiz-helper';
|
|||
export class AddonModQuizReviewLinkHandlerService extends CoreContentLinksHandlerBase {
|
||||
|
||||
name = 'AddonModQuizReviewLinkHandler';
|
||||
featureName = 'CoreCourseModuleDelegate_AddonModQuiz';
|
||||
featureName = ADDON_MOD_QUIZ_FEATURE_NAME;
|
||||
pattern = /\/mod\/quiz\/review\.php.*([&?]attempt=\d+)/;
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,3 +39,5 @@ export const ADDON_MOD_WORKSHOP_PREFETCH_UPDATE_NAMES = new RegExp(
|
|||
);
|
||||
|
||||
export const ADDON_MOD_WORKSHOP_SYNC_CRON_NAME = 'AddonModWorkshopSyncCronHandler';
|
||||
|
||||
export const ADDON_MOD_WORKSHOP_FEATURE_NAME = 'CoreCourseModuleDelegate_AddonModWorkshop';
|
||||
|
|
|
@ -17,6 +17,8 @@ import { CoreDelegateHandler, CoreDelegate } from '@classes/delegate';
|
|||
import { makeSingleton } from '@singletons';
|
||||
import { CoreFormFields } from '@singletons/form';
|
||||
import { AddonModWorkshopGetAssessmentFormDefinitionData, AddonModWorkshopGetAssessmentFormFieldsParsedData } from './workshop';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { ADDON_MOD_WORKSHOP_FEATURE_NAME } from '../constants';
|
||||
|
||||
/**
|
||||
* Interface that all assessment strategy handlers must implement.
|
||||
|
@ -86,6 +88,13 @@ export class AddonWorkshopAssessmentStrategyDelegateService extends CoreDelegate
|
|||
super('AddonWorkshopAssessmentStrategyDelegate');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
async isEnabled(): Promise<boolean> {
|
||||
return !(await CoreSites.isFeatureDisabled(ADDON_MOD_WORKSHOP_FEATURE_NAME));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an assessment strategy plugin is supported.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue