commit
162a618780
|
@ -75,7 +75,7 @@ export class AddonMessageOutputDelegateService extends CoreDelegate<AddonMessage
|
||||||
protected handlerNameProperty = 'processorName';
|
protected handlerNameProperty = 'processorName';
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super('AddonMessageOutputDelegate', true);
|
super('AddonMessageOutputDelegate');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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';
|
|
@ -60,11 +60,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Discard the draft data of the feedback plugin.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @param assignId The assignment ID.
|
|
||||||
* @param userId User ID.
|
|
||||||
* @param siteId Site ID. If not defined, current site.
|
|
||||||
*/
|
*/
|
||||||
discardDraft(assignId: number, userId: number, siteId?: string): void {
|
discardDraft(assignId: number, userId: number, siteId?: string): void {
|
||||||
const id = this.getDraftId(assignId, userId, siteId);
|
const id = this.getDraftId(assignId, userId, siteId);
|
||||||
|
@ -74,22 +70,14 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Component to use to display the plugin data.
|
* @inheritdoc
|
||||||
* It's recommended to return the class of the component, but you can also return an instance of the component.
|
|
||||||
*
|
|
||||||
* @returns The component (or promise resolved with component) to use, undefined if not found.
|
|
||||||
*/
|
*/
|
||||||
getComponent(): Type<IAddonModAssignFeedbackPluginComponent> {
|
getComponent(): Type<IAddonModAssignFeedbackPluginComponent> {
|
||||||
return AddonModAssignFeedbackCommentsComponent;
|
return AddonModAssignFeedbackCommentsComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the draft saved data of the feedback plugin.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @param assignId The assignment ID.
|
|
||||||
* @param userId User ID.
|
|
||||||
* @param siteId Site ID. If not defined, current site.
|
|
||||||
* @returns Data (or promise resolved with the data).
|
|
||||||
*/
|
*/
|
||||||
getDraft(assignId: number, userId: number, siteId?: string): AddonModAssignFeedbackCommentsDraftData | undefined {
|
getDraft(assignId: number, userId: number, siteId?: string): AddonModAssignFeedbackCommentsDraftData | undefined {
|
||||||
const id = this.getDraftId(assignId, userId, siteId);
|
const id = this.getDraftId(assignId, userId, siteId);
|
||||||
|
@ -114,13 +102,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get files used by this plugin.
|
* @inheritdoc
|
||||||
* The files returned by this function will be prefetched when the user prefetches the assign.
|
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
* @param submission The submission.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @returns The files (or promise resolved with the files).
|
|
||||||
*/
|
*/
|
||||||
getPluginFiles(
|
getPluginFiles(
|
||||||
assign: AddonModAssignAssign,
|
assign: AddonModAssignAssign,
|
||||||
|
@ -131,14 +113,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the feedback data has changed for this plugin.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
* @param submission The submission.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @param inputData Data entered by the user for the feedback.
|
|
||||||
* @param userId User ID of the submission.
|
|
||||||
* @returns Boolean (or promise resolved with boolean): whether the data has changed.
|
|
||||||
*/
|
*/
|
||||||
async hasDataChanged(
|
async hasDataChanged(
|
||||||
assign: AddonModAssignAssign,
|
assign: AddonModAssignAssign,
|
||||||
|
@ -172,12 +147,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the plugin has draft data stored.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @param assignId The assignment ID.
|
|
||||||
* @param userId User ID.
|
|
||||||
* @param siteId Site ID. If not defined, current site.
|
|
||||||
* @returns Boolean or promise resolved with boolean: whether the plugin has draft data.
|
|
||||||
*/
|
*/
|
||||||
hasDraftData(assignId: number, userId: number, siteId?: string): boolean | Promise<boolean> {
|
hasDraftData(assignId: number, userId: number, siteId?: string): boolean | Promise<boolean> {
|
||||||
const draft = this.getDraft(assignId, userId, siteId);
|
const draft = this.getDraft(assignId, userId, siteId);
|
||||||
|
@ -186,9 +156,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the handler is enabled on a site level.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @returns True or promise resolved with true if enabled.
|
|
||||||
*/
|
*/
|
||||||
async isEnabled(): Promise<boolean> {
|
async isEnabled(): Promise<boolean> {
|
||||||
// In here we should check if comments is not disabled in site.
|
// In here we should check if comments is not disabled in site.
|
||||||
|
@ -198,13 +166,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare and add to pluginData the data to send to the server based on the draft data saved.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @param assignId The assignment ID.
|
|
||||||
* @param userId User ID.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @param pluginData Object where to store the data to send.
|
|
||||||
* @param siteId Site ID. If not defined, current site.
|
|
||||||
*/
|
*/
|
||||||
prepareFeedbackData(
|
prepareFeedbackData(
|
||||||
assignId: number,
|
assignId: number,
|
||||||
|
@ -225,13 +187,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save draft data of the feedback plugin.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @param assignId The assignment ID.
|
|
||||||
* @param userId User ID.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @param data The data to save.
|
|
||||||
* @param siteId Site ID. If not defined, current site.
|
|
||||||
*/
|
*/
|
||||||
saveDraft(
|
saveDraft(
|
||||||
assignId: number,
|
assignId: number,
|
||||||
|
|
|
@ -35,23 +35,14 @@ export class AddonModAssignFeedbackEditPdfHandlerService implements AddonModAssi
|
||||||
type = 'editpdf';
|
type = 'editpdf';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Component to use to display the plugin data.
|
* @inheritdoc
|
||||||
* It's recommended to return the class of the component, but you can also return an instance of the component.
|
|
||||||
*
|
|
||||||
* @returns The component (or promise resolved with component) to use, undefined if not found.
|
|
||||||
*/
|
*/
|
||||||
getComponent(): Type<IAddonModAssignFeedbackPluginComponent> {
|
getComponent(): Type<IAddonModAssignFeedbackPluginComponent> {
|
||||||
return AddonModAssignFeedbackEditPdfComponent;
|
return AddonModAssignFeedbackEditPdfComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get files used by this plugin.
|
* @inheritdoc
|
||||||
* The files returned by this function will be prefetched when the user prefetches the assign.
|
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
* @param submission The submission.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @returns The files (or promise resolved with the files).
|
|
||||||
*/
|
*/
|
||||||
getPluginFiles(
|
getPluginFiles(
|
||||||
assign: AddonModAssignAssign,
|
assign: AddonModAssignAssign,
|
||||||
|
@ -62,9 +53,7 @@ export class AddonModAssignFeedbackEditPdfHandlerService implements AddonModAssi
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the handler is enabled on a site level.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @returns True or promise resolved with true if enabled.
|
|
||||||
*/
|
*/
|
||||||
async isEnabled(): Promise<boolean> {
|
async isEnabled(): Promise<boolean> {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -35,23 +35,14 @@ export class AddonModAssignFeedbackFileHandlerService implements AddonModAssignF
|
||||||
type = 'file';
|
type = 'file';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Component to use to display the plugin data.
|
* @inheritdoc
|
||||||
* It's recommended to return the class of the component, but you can also return an instance of the component.
|
|
||||||
*
|
|
||||||
* @returns The component (or promise resolved with component) to use, undefined if not found.
|
|
||||||
*/
|
*/
|
||||||
getComponent(): Type<IAddonModAssignFeedbackPluginComponent> {
|
getComponent(): Type<IAddonModAssignFeedbackPluginComponent> {
|
||||||
return AddonModAssignFeedbackFileComponent;
|
return AddonModAssignFeedbackFileComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get files used by this plugin.
|
* @inheritdoc
|
||||||
* The files returned by this function will be prefetched when the user prefetches the assign.
|
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
* @param submission The submission.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @returns The files (or promise resolved with the files).
|
|
||||||
*/
|
*/
|
||||||
getPluginFiles(
|
getPluginFiles(
|
||||||
assign: AddonModAssignAssign,
|
assign: AddonModAssignAssign,
|
||||||
|
@ -62,9 +53,7 @@ export class AddonModAssignFeedbackFileHandlerService implements AddonModAssignF
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the handler is enabled on a site level.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @returns True or promise resolved with true if enabled.
|
|
||||||
*/
|
*/
|
||||||
async isEnabled(): Promise<boolean> {
|
async isEnabled(): Promise<boolean> {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -21,6 +21,8 @@ import { CoreWSFile } from '@services/ws';
|
||||||
import { AddonModAssignSubmissionFormatted } from './assign-helper';
|
import { AddonModAssignSubmissionFormatted } from './assign-helper';
|
||||||
import { CoreFormFields } from '@singletons/form';
|
import { CoreFormFields } from '@singletons/form';
|
||||||
import type { IAddonModAssignFeedbackPluginComponent } from '@addons/mod/assign/classes/base-feedback-plugin-component';
|
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.
|
* Interface that all feedback handlers must implement.
|
||||||
|
@ -185,7 +187,14 @@ export class AddonModAssignFeedbackDelegateService extends CoreDelegate<AddonMod
|
||||||
constructor(
|
constructor(
|
||||||
protected defaultHandler: AddonModAssignDefaultFeedbackHandler,
|
protected defaultHandler: AddonModAssignDefaultFeedbackHandler,
|
||||||
) {
|
) {
|
||||||
super('AddonModAssignFeedbackDelegate', true);
|
super('AddonModAssignFeedbackDelegate');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
async isEnabled(): Promise<boolean> {
|
||||||
|
return !(await CoreSites.isFeatureDisabled(ADDON_MOD_ASSIGN_FEATURE_NAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -15,8 +15,9 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { CoreWSFile } from '@services/ws';
|
import { CoreWSFile } from '@services/ws';
|
||||||
import { Translate } from '@singletons';
|
import { Translate } from '@singletons';
|
||||||
import { AddonModAssignPlugin } from '../assign';
|
import { AddonModAssignAssign, AddonModAssignPlugin, AddonModAssignSavePluginData, AddonModAssignSubmission } from '../assign';
|
||||||
import { AddonModAssignFeedbackHandler } from '../feedback-delegate';
|
import { AddonModAssignFeedbackHandler } from '../feedback-delegate';
|
||||||
|
import { CoreFormFields } from '@singletons/form';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default handler used when a feedback plugin doesn't have a specific implementation.
|
* Default handler used when a feedback plugin doesn't have a specific implementation.
|
||||||
|
@ -30,14 +31,19 @@ export class AddonModAssignDefaultFeedbackHandler implements AddonModAssignFeedb
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
discardDraft(): void {
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
discardDraft(assignId: number, userId: number, siteId?: string): void | Promise<void> {
|
||||||
// Nothing to do.
|
// Nothing to do.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
getDraft(): undefined {
|
getDraft(
|
||||||
|
assignId: number, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
userId: number, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
): CoreFormFields | Promise<CoreFormFields | undefined> | undefined {
|
||||||
// Nothing to do.
|
// Nothing to do.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +51,12 @@ export class AddonModAssignDefaultFeedbackHandler implements AddonModAssignFeedb
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
getPluginFiles(): CoreWSFile[] {
|
getPluginFiles(
|
||||||
|
assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
): CoreWSFile[] | Promise<CoreWSFile[]> {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,14 +84,21 @@ export class AddonModAssignDefaultFeedbackHandler implements AddonModAssignFeedb
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
hasDataChanged(): boolean {
|
async hasDataChanged(
|
||||||
|
assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
inputData: CoreFormFields, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
userId: number, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
): Promise<boolean> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
hasDraftData(): boolean {
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
hasDraftData(assignId: number, userId: number, siteId?: string): boolean | Promise<boolean> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,21 +112,38 @@ export class AddonModAssignDefaultFeedbackHandler implements AddonModAssignFeedb
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
async prefetch(): Promise<void> {
|
async prefetch(
|
||||||
|
assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
): Promise<void> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
prepareFeedbackData(): void {
|
prepareFeedbackData(
|
||||||
|
assignId: number, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
userId: number, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
pluginData: AddonModAssignSavePluginData, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
): void | Promise<void> {
|
||||||
// Nothing to do.
|
// Nothing to do.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
saveDraft(): void {
|
saveDraft(
|
||||||
|
assignId: number, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
userId: number, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
data: CoreFormFields, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
): void | Promise<void> {
|
||||||
// Nothing to do.
|
// Nothing to do.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,10 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { CoreWSFile } from '@services/ws';
|
import { CoreWSFile } from '@services/ws';
|
||||||
import { Translate } from '@singletons';
|
import { Translate } from '@singletons';
|
||||||
import { AddonModAssignPlugin } from '../assign';
|
import { AddonModAssignAssign, AddonModAssignPlugin, AddonModAssignSavePluginData, AddonModAssignSubmission } from '../assign';
|
||||||
import { AddonModAssignSubmissionHandler } from '../submission-delegate';
|
import { AddonModAssignSubmissionHandler } from '../submission-delegate';
|
||||||
|
import { CoreFormFields } from '@singletons/form';
|
||||||
|
import { AddonModAssignSubmissionsDBRecordFormatted } from '../assign-offline';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default handler used when a submission plugin doesn't have a specific implementation.
|
* Default handler used when a submission plugin doesn't have a specific implementation.
|
||||||
|
@ -30,42 +32,71 @@ export class AddonModAssignDefaultSubmissionHandler implements AddonModAssignSub
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
canEditOffline(): boolean | Promise<boolean> {
|
canEditOffline(
|
||||||
|
assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
): boolean | Promise<boolean> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
isEmpty(): boolean {
|
isEmpty(
|
||||||
|
assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
): boolean {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
clearTmpData(): void {
|
clearTmpData(
|
||||||
|
assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
inputData: CoreFormFields, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
): void {
|
||||||
// Nothing to do.
|
// Nothing to do.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
copySubmissionData(): void {
|
copySubmissionData(
|
||||||
|
assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
pluginData: AddonModAssignSavePluginData, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
userId?: number, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
): void | Promise<void> {
|
||||||
// Nothing to do.
|
// Nothing to do.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
deleteOfflineData(): void {
|
deleteOfflineData(
|
||||||
|
assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
offlineData: AddonModAssignSubmissionsDBRecordFormatted, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
): void | Promise<void> {
|
||||||
// Nothing to do.
|
// Nothing to do.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
getPluginFiles(): CoreWSFile[] {
|
getPluginFiles(
|
||||||
|
assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
): CoreWSFile[] | Promise<CoreWSFile[]> {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,21 +124,34 @@ export class AddonModAssignDefaultSubmissionHandler implements AddonModAssignSub
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
getSizeForCopy(): number {
|
getSizeForCopy(
|
||||||
|
assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
): number | Promise<number> {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
getSizeForEdit(): number {
|
getSizeForEdit(
|
||||||
|
assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
inputData: CoreFormFields, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
): number | Promise<number> {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
hasDataChanged(): boolean {
|
async hasDataChanged(
|
||||||
|
assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
inputData: CoreFormFields, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
): Promise<boolean> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,28 +165,49 @@ export class AddonModAssignDefaultSubmissionHandler implements AddonModAssignSub
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
isEnabledForEdit(): boolean {
|
isEnabledForEdit(): boolean | Promise<boolean> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
async prefetch(): Promise<void> {
|
async prefetch(
|
||||||
|
assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
): Promise<void> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
prepareSubmissionData(): void {
|
prepareSubmissionData(
|
||||||
|
assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
inputData: CoreFormFields, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
pluginData: AddonModAssignSavePluginData, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
offline?: boolean, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
userId?: number, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
): void | Promise<void> {
|
||||||
// Nothing to do.
|
// Nothing to do.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
prepareSyncData(): void {
|
prepareSyncData(
|
||||||
|
assign: AddonModAssignAssign, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
submission: AddonModAssignSubmission, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
plugin: AddonModAssignPlugin, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
offlineData: AddonModAssignSubmissionsDBRecordFormatted, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
pluginData: AddonModAssignSavePluginData, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
siteId?: string, // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||||
|
): void | Promise<void> {
|
||||||
// Nothing to do.
|
// Nothing to do.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ import { CoreUrlUtils } from '@services/utils/url';
|
||||||
import { CoreUtils } from '@services/utils/utils';
|
import { CoreUtils } from '@services/utils/utils';
|
||||||
import { makeSingleton } from '@singletons';
|
import { makeSingleton } from '@singletons';
|
||||||
import { AddonModAssign } from '../assign';
|
import { AddonModAssign } from '../assign';
|
||||||
|
import { ADDON_MOD_ASSIGN_FEATURE_NAME } from '../../constants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler for assign push notifications clicks.
|
* Handler for assign push notifications clicks.
|
||||||
|
@ -29,7 +30,7 @@ export class AddonModAssignPushClickHandlerService implements CorePushNotificati
|
||||||
|
|
||||||
name = 'AddonModAssignPushClickHandler';
|
name = 'AddonModAssignPushClickHandler';
|
||||||
priority = 200;
|
priority = 200;
|
||||||
featureName = 'CoreCourseModuleDelegate_AddonModAssign';
|
featureName = ADDON_MOD_ASSIGN_FEATURE_NAME;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a notification click is handled by this handler.
|
* 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 { AddonModAssignSubmissionsDBRecordFormatted } from './assign-offline';
|
||||||
import { CoreFormFields } from '@singletons/form';
|
import { CoreFormFields } from '@singletons/form';
|
||||||
import type { AddonModAssignSubmissionPluginBaseComponent } from '@addons/mod/assign/classes/base-submission-plugin-component';
|
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.
|
* Interface that all submission handlers must implement.
|
||||||
|
@ -194,7 +196,7 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler {
|
||||||
submission: AddonModAssignSubmission,
|
submission: AddonModAssignSubmission,
|
||||||
plugin: AddonModAssignPlugin,
|
plugin: AddonModAssignPlugin,
|
||||||
inputData: CoreFormFields,
|
inputData: CoreFormFields,
|
||||||
): boolean | Promise<boolean>;
|
): Promise<boolean>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the handler is enabled for edit on a site level.
|
* Whether or not the handler is enabled for edit on a site level.
|
||||||
|
@ -277,7 +279,14 @@ export class AddonModAssignSubmissionDelegateService extends CoreDelegate<AddonM
|
||||||
constructor(
|
constructor(
|
||||||
protected defaultHandler: AddonModAssignDefaultSubmissionHandler,
|
protected defaultHandler: AddonModAssignDefaultSubmissionHandler,
|
||||||
) {
|
) {
|
||||||
super('AddonModAssignSubmissionDelegate', true);
|
super('AddonModAssignSubmissionDelegate');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
async isEnabled(): Promise<boolean> {
|
||||||
|
return !(await CoreSites.isFeatureDisabled(ADDON_MOD_ASSIGN_FEATURE_NAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,11 +30,7 @@ export class AddonModAssignSubmissionCommentsHandlerService implements AddonModA
|
||||||
type = 'comments';
|
type = 'comments';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the plugin can be edited in offline for existing submissions. In general, this should return false if the
|
* @inheritdoc
|
||||||
* plugin uses Moodle filters. The reason is that the app only prefetches filtered data, and the user should edit
|
|
||||||
* unfiltered data.
|
|
||||||
*
|
|
||||||
* @returns Boolean or promise resolved with boolean: whether it can be edited in offline.
|
|
||||||
*/
|
*/
|
||||||
canEditOffline(): boolean {
|
canEditOffline(): boolean {
|
||||||
// This plugin is read only, but return true to prevent blocking the edition.
|
// This plugin is read only, but return true to prevent blocking the edition.
|
||||||
|
@ -42,44 +38,28 @@ export class AddonModAssignSubmissionCommentsHandlerService implements AddonModA
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Component to use to display the plugin data, either in read or in edit mode.
|
* @inheritdoc
|
||||||
* It's recommended to return the class of the component, but you can also return an instance of the component.
|
|
||||||
*
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @param edit Whether the user is editing.
|
|
||||||
* @returns The component (or promise resolved with component) to use, undefined if not found.
|
|
||||||
*/
|
*/
|
||||||
getComponent(plugin: AddonModAssignPlugin, edit = false): Type<AddonModAssignSubmissionPluginBaseComponent> | undefined {
|
getComponent(plugin: AddonModAssignPlugin, edit = false): Type<AddonModAssignSubmissionPluginBaseComponent> | undefined {
|
||||||
return edit ? undefined : AddonModAssignSubmissionCommentsComponent;
|
return edit ? undefined : AddonModAssignSubmissionCommentsComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the handler is enabled on a site level.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @returns True or promise resolved with true if enabled.
|
|
||||||
*/
|
*/
|
||||||
async isEnabled(): Promise<boolean> {
|
async isEnabled(): Promise<boolean> {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the handler is enabled for edit on a site level.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @returns Whether or not the handler is enabled for edit on a site level.
|
|
||||||
*/
|
*/
|
||||||
isEnabledForEdit(): boolean{
|
isEnabledForEdit(): boolean{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prefetch any required data for the plugin.
|
* @inheritdoc
|
||||||
* This should NOT prefetch files. Files to be prefetched should be returned by the getPluginFiles function.
|
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
* @param submission The submission.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @param siteId Site ID. If not defined, current site.
|
|
||||||
* @returns Promise resolved when done.
|
|
||||||
*/
|
*/
|
||||||
async prefetch(
|
async prefetch(
|
||||||
assign: AddonModAssignAssign,
|
assign: AddonModAssignAssign,
|
||||||
|
|
|
@ -45,11 +45,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
||||||
type = 'file';
|
type = 'file';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the plugin can be edited in offline for existing submissions. In general, this should return false if the
|
* @inheritdoc
|
||||||
* plugin uses Moodle filters. The reason is that the app only prefetches filtered data, and the user should edit
|
|
||||||
* unfiltered data.
|
|
||||||
*
|
|
||||||
* @returns Boolean or promise resolved with boolean: whether it can be edited in offline.
|
|
||||||
*/
|
*/
|
||||||
canEditOffline(): boolean {
|
canEditOffline(): boolean {
|
||||||
// This plugin doesn't use Moodle filters, it can be edited in offline.
|
// This plugin doesn't use Moodle filters, it can be edited in offline.
|
||||||
|
@ -57,11 +53,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a plugin has no data.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @returns Whether the plugin is empty.
|
|
||||||
*/
|
*/
|
||||||
isEmpty(assign: AddonModAssignAssign, plugin: AddonModAssignPlugin): boolean {
|
isEmpty(assign: AddonModAssignAssign, plugin: AddonModAssignPlugin): boolean {
|
||||||
const files = AddonModAssign.getSubmissionPluginAttachments(plugin);
|
const files = AddonModAssign.getSubmissionPluginAttachments(plugin);
|
||||||
|
@ -70,9 +62,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should clear temporary data for a cancelled submission.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
*/
|
*/
|
||||||
clearTmpData(assign: AddonModAssignAssign): void {
|
clearTmpData(assign: AddonModAssignAssign): void {
|
||||||
const files = CoreFileSession.getFiles(AddonModAssignProvider.COMPONENT, assign.id);
|
const files = CoreFileSession.getFiles(AddonModAssignProvider.COMPONENT, assign.id);
|
||||||
|
@ -85,13 +75,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function will be called when the user wants to create a new submission based on the previous one.
|
* @inheritdoc
|
||||||
* It should add to pluginData the data to send to server based in the data in plugin (previous attempt).
|
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @param pluginData Object where to store the data to send.
|
|
||||||
* @returns If the function is async, it should return a Promise resolved when done.
|
|
||||||
*/
|
*/
|
||||||
async copySubmissionData(
|
async copySubmissionData(
|
||||||
assign: AddonModAssignAssign,
|
assign: AddonModAssignAssign,
|
||||||
|
@ -106,24 +90,14 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Component to use to display the plugin data, either in read or in edit mode.
|
* @inheritdoc
|
||||||
* It's recommended to return the class of the component, but you can also return an instance of the component.
|
|
||||||
*
|
|
||||||
* @returns The component (or promise resolved with component) to use, undefined if not found.
|
|
||||||
*/
|
*/
|
||||||
getComponent(): Type<AddonModAssignSubmissionPluginBaseComponent> {
|
getComponent(): Type<AddonModAssignSubmissionPluginBaseComponent> {
|
||||||
return AddonModAssignSubmissionFileComponent;
|
return AddonModAssignSubmissionFileComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete any stored data for the plugin and submission.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
* @param submission The submission.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @param offlineData Offline data stored.
|
|
||||||
* @param siteId Site ID. If not defined, current site.
|
|
||||||
* @returns If the function is async, it should return a Promise resolved when done.
|
|
||||||
*/
|
*/
|
||||||
async deleteOfflineData(
|
async deleteOfflineData(
|
||||||
assign: AddonModAssignAssign,
|
assign: AddonModAssignAssign,
|
||||||
|
@ -144,13 +118,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get files used by this plugin.
|
* @inheritdoc
|
||||||
* The files returned by this function will be prefetched when the user prefetches the assign.
|
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
* @param submission The submission.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @returns The files (or promise resolved with the files).
|
|
||||||
*/
|
*/
|
||||||
getPluginFiles(
|
getPluginFiles(
|
||||||
assign: AddonModAssignAssign,
|
assign: AddonModAssignAssign,
|
||||||
|
@ -161,11 +129,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the size of data (in bytes) this plugin will send to copy a previous submission.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @returns The size (or promise resolved with size).
|
|
||||||
*/
|
*/
|
||||||
async getSizeForCopy(assign: AddonModAssignAssign, plugin: AddonModAssignPlugin): Promise<number> {
|
async getSizeForCopy(assign: AddonModAssignAssign, plugin: AddonModAssignPlugin): Promise<number> {
|
||||||
const files = AddonModAssign.getSubmissionPluginAttachments(plugin);
|
const files = AddonModAssign.getSubmissionPluginAttachments(plugin);
|
||||||
|
@ -174,12 +138,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the size of data (in bytes) this plugin will send to add or edit a submission.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
* @param submission The submission.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @returns The size (or promise resolved with size).
|
|
||||||
*/
|
*/
|
||||||
async getSizeForEdit(
|
async getSizeForEdit(
|
||||||
assign: AddonModAssignAssign,
|
assign: AddonModAssignAssign,
|
||||||
|
@ -199,12 +158,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the submission data has changed for this plugin.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
* @param submission The submission.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @returns Boolean (or promise resolved with boolean): whether the data has changed.
|
|
||||||
*/
|
*/
|
||||||
async hasDataChanged(
|
async hasDataChanged(
|
||||||
assign: AddonModAssignAssign,
|
assign: AddonModAssignAssign,
|
||||||
|
@ -243,35 +197,21 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the handler is enabled on a site level.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @returns True or promise resolved with true if enabled.
|
|
||||||
*/
|
*/
|
||||||
async isEnabled(): Promise<boolean> {
|
async isEnabled(): Promise<boolean> {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the handler is enabled for edit on a site level.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @returns Whether or not the handler is enabled for edit on a site level.
|
|
||||||
*/
|
*/
|
||||||
isEnabledForEdit(): boolean {
|
isEnabledForEdit(): boolean {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare and add to pluginData the data to send to the server based on the input data.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
* @param submission The submission.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @param inputData Data entered by the user for the submission.
|
|
||||||
* @param pluginData Object where to store the data to send.
|
|
||||||
* @param offline Whether the user is editing in offline.
|
|
||||||
* @param userId User ID. If not defined, site's current user.
|
|
||||||
* @param siteId Site ID. If not defined, current site.
|
|
||||||
* @returns If the function is async, it should return a Promise resolved when done.
|
|
||||||
*/
|
*/
|
||||||
async prepareSubmissionData(
|
async prepareSubmissionData(
|
||||||
assign: AddonModAssignAssign,
|
assign: AddonModAssignAssign,
|
||||||
|
@ -308,16 +248,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare and add to pluginData the data to send to the server based on the offline data stored.
|
* @inheritdoc
|
||||||
* This will be used when performing a synchronization.
|
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
* @param submission The submission.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @param offlineData Offline data stored.
|
|
||||||
* @param pluginData Object where to store the data to send.
|
|
||||||
* @param siteId Site ID. If not defined, current site.
|
|
||||||
* @returns If the function is async, it should return a Promise resolved when done.
|
|
||||||
*/
|
*/
|
||||||
async prepareSyncData(
|
async prepareSyncData(
|
||||||
assign: AddonModAssignAssign,
|
assign: AddonModAssignAssign,
|
||||||
|
|
|
@ -41,11 +41,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo
|
||||||
type = 'onlinetext';
|
type = 'onlinetext';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the plugin can be edited in offline for existing submissions. In general, this should return false if the
|
* @inheritdoc
|
||||||
* plugin uses Moodle filters. The reason is that the app only prefetches filtered data, and the user should edit
|
|
||||||
* unfiltered data.
|
|
||||||
*
|
|
||||||
* @returns Boolean or promise resolved with boolean: whether it can be edited in offline.
|
|
||||||
*/
|
*/
|
||||||
canEditOffline(): boolean {
|
canEditOffline(): boolean {
|
||||||
// This plugin uses Moodle filters, it cannot be edited in offline.
|
// This plugin uses Moodle filters, it cannot be edited in offline.
|
||||||
|
@ -53,11 +49,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a plugin has no data.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @returns Whether the plugin is empty.
|
|
||||||
*/
|
*/
|
||||||
isEmpty(assign: AddonModAssignAssign, plugin: AddonModAssignPlugin): boolean {
|
isEmpty(assign: AddonModAssignAssign, plugin: AddonModAssignPlugin): boolean {
|
||||||
const text = AddonModAssign.getSubmissionPluginText(plugin, true);
|
const text = AddonModAssign.getSubmissionPluginText(plugin, true);
|
||||||
|
@ -67,15 +59,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function will be called when the user wants to create a new submission based on the previous one.
|
* @inheritdoc
|
||||||
* It should add to pluginData the data to send to server based in the data in plugin (previous attempt).
|
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @param pluginData Object where to store the data to send.
|
|
||||||
* @param userId User ID. If not defined, site's current user.
|
|
||||||
* @param siteId Site ID. If not defined, current site.
|
|
||||||
* @returns If the function is async, it should return a Promise resolved when done.
|
|
||||||
*/
|
*/
|
||||||
async copySubmissionData(
|
async copySubmissionData(
|
||||||
assign: AddonModAssignAssign,
|
assign: AddonModAssignAssign,
|
||||||
|
@ -102,23 +86,14 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Component to use to display the plugin data, either in read or in edit mode.
|
* @inheritdoc
|
||||||
* It's recommended to return the class of the component, but you can also return an instance of the component.
|
|
||||||
*
|
|
||||||
* @returns The component (or promise resolved with component) to use, undefined if not found.
|
|
||||||
*/
|
*/
|
||||||
getComponent(): Type<AddonModAssignSubmissionPluginBaseComponent> {
|
getComponent(): Type<AddonModAssignSubmissionPluginBaseComponent> {
|
||||||
return AddonModAssignSubmissionOnlineTextComponent;
|
return AddonModAssignSubmissionOnlineTextComponent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get files used by this plugin.
|
* @inheritdoc
|
||||||
* The files returned by this function will be prefetched when the user prefetches the assign.
|
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
* @param submission The submission.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @returns The files (or promise resolved with the files).
|
|
||||||
*/
|
*/
|
||||||
getPluginFiles(
|
getPluginFiles(
|
||||||
assign: AddonModAssignAssign,
|
assign: AddonModAssignAssign,
|
||||||
|
@ -129,11 +104,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the size of data (in bytes) this plugin will send to copy a previous submission.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @returns The size (or promise resolved with size).
|
|
||||||
*/
|
*/
|
||||||
async getSizeForCopy(assign: AddonModAssignAssign, plugin: AddonModAssignPlugin): Promise<number> {
|
async getSizeForCopy(assign: AddonModAssignAssign, plugin: AddonModAssignPlugin): Promise<number> {
|
||||||
const text = AddonModAssign.getSubmissionPluginText(plugin, true);
|
const text = AddonModAssign.getSubmissionPluginText(plugin, true);
|
||||||
|
@ -145,12 +116,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the size of data (in bytes) this plugin will send to add or edit a submission.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
* @param submission The submission.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @returns The size (or promise resolved with size).
|
|
||||||
*/
|
*/
|
||||||
getSizeForEdit(
|
getSizeForEdit(
|
||||||
assign: AddonModAssignAssign,
|
assign: AddonModAssignAssign,
|
||||||
|
@ -177,13 +143,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the submission data has changed for this plugin.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
* @param submission The submission.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @param inputData Data entered by the user for the submission.
|
|
||||||
* @returns Boolean (or promise resolved with boolean): whether the data has changed.
|
|
||||||
*/
|
*/
|
||||||
async hasDataChanged(
|
async hasDataChanged(
|
||||||
assign: AddonModAssignAssign,
|
assign: AddonModAssignAssign,
|
||||||
|
@ -209,31 +169,21 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the handler is enabled on a site level.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @returns True or promise resolved with true if enabled.
|
|
||||||
*/
|
*/
|
||||||
async isEnabled(): Promise<boolean> {
|
async isEnabled(): Promise<boolean> {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether or not the handler is enabled for edit on a site level.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @returns Whether or not the handler is enabled for edit on a site level.
|
|
||||||
*/
|
*/
|
||||||
isEnabledForEdit(): boolean {
|
isEnabledForEdit(): boolean {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare and add to pluginData the data to send to the server based on the input data.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
* @param submission The submission.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @param inputData Data entered by the user for the submission.
|
|
||||||
* @param pluginData Object where to store the data to send.
|
|
||||||
*/
|
*/
|
||||||
prepareSubmissionData(
|
prepareSubmissionData(
|
||||||
assign: AddonModAssignAssign,
|
assign: AddonModAssignAssign,
|
||||||
|
@ -269,14 +219,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare and add to pluginData the data to send to the server based on the offline data stored.
|
* @inheritdoc
|
||||||
* This will be used when performing a synchronization.
|
|
||||||
*
|
|
||||||
* @param assign The assignment.
|
|
||||||
* @param submission The submission.
|
|
||||||
* @param plugin The plugin object.
|
|
||||||
* @param offlineData Offline data stored.
|
|
||||||
* @param pluginData Object where to store the data to send.
|
|
||||||
*/
|
*/
|
||||||
prepareSyncData(
|
prepareSyncData(
|
||||||
assign: AddonModAssignAssign,
|
assign: AddonModAssignAssign,
|
||||||
|
|
|
@ -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 { FileEntry } from '@awesome-cordova-plugins/file/ngx';
|
||||||
import { CoreFileEntry } from '@services/file-helper';
|
import { CoreFileEntry } from '@services/file-helper';
|
||||||
import type { AddonModDataFieldPluginBaseComponent } from '@addons/mod/data/classes/base-field-plugin-component';
|
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.
|
* Interface that all fields handlers must implement.
|
||||||
|
@ -132,7 +134,14 @@ export class AddonModDataFieldsDelegateService extends CoreDelegate<AddonModData
|
||||||
constructor(
|
constructor(
|
||||||
protected defaultHandler: AddonModDataDefaultFieldHandler,
|
protected defaultHandler: AddonModDataDefaultFieldHandler,
|
||||||
) {
|
) {
|
||||||
super('AddonModDataFieldsDelegate', true);
|
super('AddonModDataFieldsDelegate');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
async isEnabled(): Promise<boolean> {
|
||||||
|
return !(await CoreSites.isFeatureDisabled(ADDON_MOD_DATA_FEATURE_NAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,6 +17,7 @@ import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base
|
||||||
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
|
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
|
||||||
import { makeSingleton } from '@singletons';
|
import { makeSingleton } from '@singletons';
|
||||||
import { AddonModDataHelper } from '../data-helper';
|
import { AddonModDataHelper } from '../data-helper';
|
||||||
|
import { ADDON_MOD_DATA_FEATURE_NAME } from '../../constants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content links handler for database approve/disapprove entry.
|
* Content links handler for database approve/disapprove entry.
|
||||||
|
@ -26,7 +27,7 @@ import { AddonModDataHelper } from '../data-helper';
|
||||||
export class AddonModDataApproveLinkHandlerService extends CoreContentLinksHandlerBase {
|
export class AddonModDataApproveLinkHandlerService extends CoreContentLinksHandlerBase {
|
||||||
|
|
||||||
name = 'AddonModDataApproveLinkHandler';
|
name = 'AddonModDataApproveLinkHandler';
|
||||||
featureName = 'CoreCourseModuleDelegate_AddonModData';
|
featureName = ADDON_MOD_DATA_FEATURE_NAME;
|
||||||
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.
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ import { CoreContentLinksHandlerBase } from '@features/contentlinks/classes/base
|
||||||
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
|
import { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
|
||||||
import { makeSingleton } from '@singletons';
|
import { makeSingleton } from '@singletons';
|
||||||
import { AddonModDataHelper } from '../data-helper';
|
import { AddonModDataHelper } from '../data-helper';
|
||||||
|
import { ADDON_MOD_DATA_FEATURE_NAME } from '../../constants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content links handler for database delete entry.
|
* Content links handler for database delete entry.
|
||||||
|
@ -26,7 +27,7 @@ import { AddonModDataHelper } from '../data-helper';
|
||||||
export class AddonModDataDeleteLinkHandlerService extends CoreContentLinksHandlerBase {
|
export class AddonModDataDeleteLinkHandlerService extends CoreContentLinksHandlerBase {
|
||||||
|
|
||||||
name = 'AddonModDataDeleteLinkHandler';
|
name = 'AddonModDataDeleteLinkHandler';
|
||||||
featureName = 'CoreCourseModuleDelegate_AddonModData';
|
featureName = ADDON_MOD_DATA_FEATURE_NAME;
|
||||||
pattern = /\/mod\/data\/view\.php.*([?&](d|delete)=\d+)/;
|
pattern = /\/mod\/data\/view\.php.*([?&](d|delete)=\d+)/;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,6 +22,7 @@ import { CoreSitesReadingStrategy } from '@services/sites';
|
||||||
import { CoreDomUtils } from '@services/utils/dom';
|
import { CoreDomUtils } from '@services/utils/dom';
|
||||||
import { makeSingleton } from '@singletons';
|
import { makeSingleton } from '@singletons';
|
||||||
import { AddonModDataModuleHandlerService } from './module';
|
import { AddonModDataModuleHandlerService } from './module';
|
||||||
|
import { ADDON_MOD_DATA_FEATURE_NAME } from '../../constants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content links handler for database add or edit entry.
|
* Content links handler for database add or edit entry.
|
||||||
|
@ -31,7 +32,7 @@ import { AddonModDataModuleHandlerService } from './module';
|
||||||
export class AddonModDataEditLinkHandlerService extends CoreContentLinksHandlerBase {
|
export class AddonModDataEditLinkHandlerService extends CoreContentLinksHandlerBase {
|
||||||
|
|
||||||
name = 'AddonModDataEditLinkHandler';
|
name = 'AddonModDataEditLinkHandler';
|
||||||
featureName = 'CoreCourseModuleDelegate_AddonModData';
|
featureName = ADDON_MOD_DATA_FEATURE_NAME;
|
||||||
pattern = /\/mod\/data\/edit\.php.*([?&](d|rid)=\d+)/;
|
pattern = /\/mod\/data\/edit\.php.*([?&](d|rid)=\d+)/;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,6 +22,7 @@ import { CoreSitesReadingStrategy } from '@services/sites';
|
||||||
import { CoreDomUtils } from '@services/utils/dom';
|
import { CoreDomUtils } from '@services/utils/dom';
|
||||||
import { makeSingleton } from '@singletons';
|
import { makeSingleton } from '@singletons';
|
||||||
import { AddonModDataModuleHandlerService } from './module';
|
import { AddonModDataModuleHandlerService } from './module';
|
||||||
|
import { ADDON_MOD_DATA_FEATURE_NAME } from '../../constants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content links handler for database show entry.
|
* Content links handler for database show entry.
|
||||||
|
@ -31,7 +32,7 @@ import { AddonModDataModuleHandlerService } from './module';
|
||||||
export class AddonModDataShowLinkHandlerService extends CoreContentLinksHandlerBase {
|
export class AddonModDataShowLinkHandlerService extends CoreContentLinksHandlerBase {
|
||||||
|
|
||||||
name = 'AddonModDataShowLinkHandler';
|
name = 'AddonModDataShowLinkHandler';
|
||||||
featureName = 'CoreCourseModuleDelegate_AddonModData';
|
featureName = ADDON_MOD_DATA_FEATURE_NAME;
|
||||||
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.
|
||||||
|
|
||||||
|
|
|
@ -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 { CoreUtils } from '@services/utils/utils';
|
||||||
import { makeSingleton } from '@singletons';
|
import { makeSingleton } from '@singletons';
|
||||||
import { AddonModQuizAttemptWSData, AddonModQuizQuizWSData } from './quiz';
|
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.
|
* Interface that all access rules handlers must implement.
|
||||||
|
@ -128,7 +130,14 @@ export class AddonModQuizAccessRuleDelegateService extends CoreDelegate<AddonMod
|
||||||
protected handlerNameProperty = 'ruleName';
|
protected handlerNameProperty = 'ruleName';
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super('AddonModQuizAccessRulesDelegate', true);
|
super('AddonModQuizAccessRulesDelegate');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
async isEnabled(): Promise<boolean> {
|
||||||
|
return !(await CoreSites.isFeatureDisabled(ADDON_MOD_QUIZ_FEATURE_NAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,6 +23,7 @@ import { makeSingleton } from '@singletons';
|
||||||
import { AddonModQuiz } from '../quiz';
|
import { AddonModQuiz } from '../quiz';
|
||||||
import { AddonModQuizHelper } from '../quiz-helper';
|
import { AddonModQuizHelper } from '../quiz-helper';
|
||||||
import { isSafeNumber } from '@/core/utils/types';
|
import { isSafeNumber } from '@/core/utils/types';
|
||||||
|
import { ADDON_MOD_QUIZ_FEATURE_NAME } from '../../constants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler for quiz push notifications clicks.
|
* Handler for quiz push notifications clicks.
|
||||||
|
@ -32,7 +33,7 @@ export class AddonModQuizPushClickHandlerService implements CorePushNotification
|
||||||
|
|
||||||
name = 'AddonModQuizPushClickHandler';
|
name = 'AddonModQuizPushClickHandler';
|
||||||
priority = 200;
|
priority = 200;
|
||||||
featureName = 'CoreCourseModuleDelegate_AddonModQuiz';
|
featureName = ADDON_MOD_QUIZ_FEATURE_NAME;
|
||||||
|
|
||||||
protected readonly SUPPORTED_NAMES = ['submission', 'confirmation', 'attempt_overdue'];
|
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 { CoreContentLinksAction } from '@features/contentlinks/services/contentlinks-delegate';
|
||||||
import { makeSingleton } from '@singletons';
|
import { makeSingleton } from '@singletons';
|
||||||
import { AddonModQuizHelper } from '../quiz-helper';
|
import { AddonModQuizHelper } from '../quiz-helper';
|
||||||
|
import { ADDON_MOD_QUIZ_FEATURE_NAME } from '../../constants';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler to treat links to quiz review.
|
* Handler to treat links to quiz review.
|
||||||
|
@ -25,7 +26,7 @@ import { AddonModQuizHelper } from '../quiz-helper';
|
||||||
export class AddonModQuizReviewLinkHandlerService extends CoreContentLinksHandlerBase {
|
export class AddonModQuizReviewLinkHandlerService extends CoreContentLinksHandlerBase {
|
||||||
|
|
||||||
name = 'AddonModQuizReviewLinkHandler';
|
name = 'AddonModQuizReviewLinkHandler';
|
||||||
featureName = 'CoreCourseModuleDelegate_AddonModQuiz';
|
featureName = ADDON_MOD_QUIZ_FEATURE_NAME;
|
||||||
pattern = /\/mod\/quiz\/review\.php.*([&?]attempt=\d+)/;
|
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_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 { makeSingleton } from '@singletons';
|
||||||
import { CoreFormFields } from '@singletons/form';
|
import { CoreFormFields } from '@singletons/form';
|
||||||
import { AddonModWorkshopGetAssessmentFormDefinitionData, AddonModWorkshopGetAssessmentFormFieldsParsedData } from './workshop';
|
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.
|
* Interface that all assessment strategy handlers must implement.
|
||||||
|
@ -83,7 +85,14 @@ export class AddonWorkshopAssessmentStrategyDelegateService extends CoreDelegate
|
||||||
protected handlerNameProperty = 'strategyName';
|
protected handlerNameProperty = 'strategyName';
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super('AddonWorkshopAssessmentStrategyDelegate', true);
|
super('AddonWorkshopAssessmentStrategyDelegate');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
async isEnabled(): Promise<boolean> {
|
||||||
|
return !(await CoreSites.isFeatureDisabled(ADDON_MOD_WORKSHOP_FEATURE_NAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -34,7 +34,7 @@ export class CoreSortedDelegate<
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
constructor(delegateName: string) {
|
constructor(delegateName: string) {
|
||||||
super(delegateName, true);
|
super(delegateName);
|
||||||
|
|
||||||
CoreEvents.on(CoreEvents.LOGOUT, () => this.clearSortedHandlers());
|
CoreEvents.on(CoreEvents.LOGOUT, () => this.clearSortedHandlers());
|
||||||
CoreEvents.on(CoreEvents.SITE_POLICY_AGREED, (data) => {
|
CoreEvents.on(CoreEvents.SITE_POLICY_AGREED, (data) => {
|
||||||
|
|
|
@ -72,43 +72,42 @@ export class CoreDelegate<HandlerType extends CoreDelegateHandler> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Promise to wait for handlers to be initialized.
|
* Promise to wait for handlers to be initialized.
|
||||||
|
*
|
||||||
|
* @returns Promise resolved when handlers are enabled.
|
||||||
*/
|
*/
|
||||||
protected handlersInitPromise: Promise<void>;
|
protected handlersInitPromise: Promise<boolean>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to resolve the handlers init promise.
|
* Function to resolve the handlers init promise.
|
||||||
*/
|
*/
|
||||||
protected handlersInitResolve!: () => void;
|
protected handlersInitResolve!: (enabled: boolean) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor of the Delegate.
|
* Constructor of the Delegate.
|
||||||
*
|
*
|
||||||
* @param delegateName Delegate name used for logging purposes.
|
* @param delegateName Delegate name used for logging purposes.
|
||||||
* @param listenSiteEvents Whether to update the handler when a site event occurs (login, site updated, ...).
|
|
||||||
*/
|
*/
|
||||||
constructor(delegateName: string, listenSiteEvents: boolean = true) {
|
constructor(delegateName: string) {
|
||||||
this.logger = CoreLogger.getInstance(delegateName);
|
this.logger = CoreLogger.getInstance(delegateName);
|
||||||
|
|
||||||
this.handlersInitPromise = new Promise((resolve): void => {
|
this.handlersInitPromise = new Promise((resolve): void => {
|
||||||
this.handlersInitResolve = resolve;
|
this.handlersInitResolve = resolve;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (listenSiteEvents) {
|
// Update handlers on this cases.
|
||||||
// Update handlers on this cases.
|
CoreEvents.on(CoreEvents.LOGIN, () => this.updateHandlers());
|
||||||
CoreEvents.on(CoreEvents.LOGIN, () => this.updateHandlers());
|
CoreEvents.on(CoreEvents.SITE_UPDATED, () => this.updateHandlers());
|
||||||
CoreEvents.on(CoreEvents.SITE_UPDATED, () => this.updateHandlers());
|
CoreEvents.on(CoreEvents.SITE_PLUGINS_LOADED, () => this.updateHandlers());
|
||||||
CoreEvents.on(CoreEvents.SITE_PLUGINS_LOADED, () => this.updateHandlers());
|
CoreEvents.on(CoreEvents.SITE_POLICY_AGREED, (data) => {
|
||||||
CoreEvents.on(CoreEvents.SITE_POLICY_AGREED, (data) => {
|
if (data.siteId === CoreSites.getCurrentSiteId()) {
|
||||||
if (data.siteId === CoreSites.getCurrentSiteId()) {
|
this.updateHandlers();
|
||||||
this.updateHandlers();
|
}
|
||||||
}
|
});
|
||||||
});
|
CoreEvents.on(CoreEvents.COMPLETE_REQUIRED_PROFILE_DATA_FINISHED, (data) => {
|
||||||
CoreEvents.on(CoreEvents.COMPLETE_REQUIRED_PROFILE_DATA_FINISHED, (data) => {
|
if (data.siteId === CoreSites.getCurrentSiteId()) {
|
||||||
if (data.siteId === CoreSites.getCurrentSiteId()) {
|
this.updateHandlers();
|
||||||
this.updateHandlers();
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -286,16 +285,18 @@ export class CoreDelegate<HandlerType extends CoreDelegateHandler> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks if the handler is enabled.
|
// Checks if the handler is enabled.
|
||||||
this.updatePromises[siteId][handler.name] = promise.then((enabled: boolean) => {
|
this.updatePromises[siteId][handler.name] = promise.then((enabled) => {
|
||||||
// Check that site hasn't changed since the check started.
|
// Check that site hasn't changed since the check started.
|
||||||
if (CoreSites.getCurrentSiteId() === siteId) {
|
if (CoreSites.getCurrentSiteId() !== siteId) {
|
||||||
const key = handler[this.handlerNameProperty] || handler.name;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (enabled) {
|
const key = handler[this.handlerNameProperty] || handler.name;
|
||||||
this.enabledHandlers[key] = handler;
|
|
||||||
} else {
|
if (enabled) {
|
||||||
delete this.enabledHandlers[key];
|
this.enabledHandlers[key] = handler;
|
||||||
}
|
} else {
|
||||||
|
delete this.enabledHandlers[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -327,6 +328,10 @@ export class CoreDelegate<HandlerType extends CoreDelegateHandler> {
|
||||||
const enabled = await this.isEnabled();
|
const enabled = await this.isEnabled();
|
||||||
|
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
|
this.logger.debug('Delegate not enabled.');
|
||||||
|
|
||||||
|
this.handlersInitResolve(false);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +356,7 @@ export class CoreDelegate<HandlerType extends CoreDelegateHandler> {
|
||||||
// Verify that this call is the last one that was started.
|
// Verify that this call is the last one that was started.
|
||||||
if (this.isLastUpdateCall(now)) {
|
if (this.isLastUpdateCall(now)) {
|
||||||
this.handlersInitialized = true;
|
this.handlersInitialized = true;
|
||||||
this.handlersInitResolve();
|
this.handlersInitResolve(true);
|
||||||
|
|
||||||
this.updateData();
|
this.updateData();
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ export class CoreBlockDelegateService extends CoreDelegate<CoreBlockHandler> {
|
||||||
constructor(
|
constructor(
|
||||||
protected defaultHandler: CoreBlockDefaultHandler,
|
protected defaultHandler: CoreBlockDefaultHandler,
|
||||||
) {
|
) {
|
||||||
super('CoreBlockDelegate', true);
|
super('CoreBlockDelegate');
|
||||||
|
|
||||||
this.blocksUpdateObservable = new Subject<void>();
|
this.blocksUpdateObservable = new Subject<void>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ export class CoreCourseFormatDelegateService extends CoreDelegate<CoreCourseForm
|
||||||
protected handlerNameProperty = 'format';
|
protected handlerNameProperty = 'format';
|
||||||
|
|
||||||
constructor(protected defaultHandler: CoreCourseFormatDefaultHandler) {
|
constructor(protected defaultHandler: CoreCourseFormatDefaultHandler) {
|
||||||
super('CoreCoursesCourseFormatDelegate', true);
|
super('CoreCoursesCourseFormatDelegate');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -286,7 +286,7 @@ export class CoreCourseModuleDelegateService extends CoreDelegate<CoreCourseModu
|
||||||
protected handlerNameProperty = 'modName';
|
protected handlerNameProperty = 'modName';
|
||||||
|
|
||||||
constructor(protected defaultHandler: CoreCourseModuleDefaultHandler) {
|
constructor(protected defaultHandler: CoreCourseModuleDefaultHandler) {
|
||||||
super('CoreCourseModuleDelegate', true);
|
super('CoreCourseModuleDelegate');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -54,7 +54,7 @@ export class CoreCourseModulePrefetchDelegateService extends CoreDelegate<CoreCo
|
||||||
protected prefetchData: Record<string, Record<string, OngoingPrefetch>> = {};
|
protected prefetchData: Record<string, Record<string, OngoingPrefetch>> = {};
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super('CoreCourseModulePrefetchDelegate', true);
|
super('CoreCourseModulePrefetchDelegate');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -129,7 +129,7 @@ export class CoreEnrolDelegateService extends CoreDelegate<CoreEnrolHandler> {
|
||||||
protected featurePrefix = 'CoreEnrolDelegate_';
|
protected featurePrefix = 'CoreEnrolDelegate_';
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super('CoreEnrolDelegate', true);
|
super('CoreEnrolDelegate');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -143,7 +143,7 @@ export interface CoreFileUploaderHandlerDataToReturn extends CoreFileUploaderHan
|
||||||
export class CoreFileUploaderDelegateService extends CoreDelegate<CoreFileUploaderHandler> {
|
export class CoreFileUploaderDelegateService extends CoreDelegate<CoreFileUploaderHandler> {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super('CoreFileUploaderDelegate', true);
|
super('CoreFileUploaderDelegate');
|
||||||
|
|
||||||
CoreEvents.on(CoreEvents.LOGOUT, () => this.clearSiteHandlers());
|
CoreEvents.on(CoreEvents.LOGOUT, () => this.clearSiteHandlers());
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
import { Injectable, ViewContainerRef } from '@angular/core';
|
import { Injectable, ViewContainerRef } from '@angular/core';
|
||||||
|
|
||||||
import { CoreSites } from '@services/sites';
|
import { CoreSites } from '@services/sites';
|
||||||
import { CoreFilterFilter, CoreFilterFormatTextOptions } from './filter';
|
import { CoreFilter, CoreFilterFilter, CoreFilterFormatTextOptions } from './filter';
|
||||||
import { CoreFilterDefaultHandler } from './handlers/default-filter';
|
import { CoreFilterDefaultHandler } from './handlers/default-filter';
|
||||||
import { CoreDelegate, CoreDelegateHandler } from '@classes/delegate';
|
import { CoreDelegate, CoreDelegateHandler } from '@classes/delegate';
|
||||||
import { CoreSite } from '@classes/sites/site';
|
import { CoreSite } from '@classes/sites/site';
|
||||||
|
@ -84,7 +84,14 @@ export class CoreFilterDelegateService extends CoreDelegate<CoreFilterHandler> {
|
||||||
protected handlerNameProperty = 'filterName';
|
protected handlerNameProperty = 'filterName';
|
||||||
|
|
||||||
constructor(protected defaultHandler: CoreFilterDefaultHandler) {
|
constructor(protected defaultHandler: CoreFilterDefaultHandler) {
|
||||||
super('CoreFilterDelegate', true);
|
super('CoreFilterDelegate');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
async isEnabled(): Promise<boolean> {
|
||||||
|
return CoreFilter.canGetFiltersInSite();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -106,7 +113,11 @@ export class CoreFilterDelegateService extends CoreDelegate<CoreFilterHandler> {
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
|
|
||||||
// Wait for filters to be initialized.
|
// Wait for filters to be initialized.
|
||||||
await this.handlersInitPromise;
|
const enabled = await this.handlersInitPromise;
|
||||||
|
if (!enabled) {
|
||||||
|
// No enabled filters, return the text.
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
const site = await CoreSites.getSite(siteId);
|
const site = await CoreSites.getSite(siteId);
|
||||||
|
|
||||||
|
@ -189,7 +200,10 @@ export class CoreFilterDelegateService extends CoreDelegate<CoreFilterHandler> {
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
|
||||||
// Wait for filters to be initialized.
|
// Wait for filters to be initialized.
|
||||||
await this.handlersInitPromise;
|
const enabled = await this.handlersInitPromise;
|
||||||
|
if (!enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const site = await CoreSites.getSite(siteId);
|
const site = await CoreSites.getSite(siteId);
|
||||||
|
|
||||||
|
@ -258,15 +272,12 @@ export class CoreFilterDelegateService extends CoreDelegate<CoreFilterHandler> {
|
||||||
*/
|
*/
|
||||||
async shouldBeApplied(filters: CoreFilterFilter[], options: CoreFilterFormatTextOptions, site?: CoreSite): Promise<boolean> {
|
async shouldBeApplied(filters: CoreFilterFilter[], options: CoreFilterFormatTextOptions, site?: CoreSite): Promise<boolean> {
|
||||||
// Wait for filters to be initialized.
|
// Wait for filters to be initialized.
|
||||||
await this.handlersInitPromise;
|
const enabled = await this.handlersInitPromise;
|
||||||
|
if (!enabled) {
|
||||||
for (let i = 0; i < filters.length; i++) {
|
return false;
|
||||||
if (this.shouldFilterBeApplied(filters[i], options, site)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return filters.some((filter) => this.shouldFilterBeApplied(filter, options, site));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -80,7 +80,7 @@ export class CoreFilterProvider {
|
||||||
* @returns Promise resolved with boolean: whethe can get filters.
|
* @returns Promise resolved with boolean: whethe can get filters.
|
||||||
*/
|
*/
|
||||||
canGetFiltersInSite(site?: CoreSite): boolean {
|
canGetFiltersInSite(site?: CoreSite): boolean {
|
||||||
return this.checkFiltersDisabledInSite(site);
|
return !this.checkFiltersDisabledInSite(site);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -68,7 +68,7 @@ export class CoreQuestionBehaviourDelegateService extends CoreDelegate<CoreQuest
|
||||||
protected handlerNameProperty = 'type';
|
protected handlerNameProperty = 'type';
|
||||||
|
|
||||||
constructor(protected defaultHandler: CoreQuestionBehaviourDefaultHandler) {
|
constructor(protected defaultHandler: CoreQuestionBehaviourDefaultHandler) {
|
||||||
super('CoreQuestionBehaviourDelegate', true);
|
super('CoreQuestionBehaviourDelegate');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -217,7 +217,7 @@ export class CoreQuestionDelegateService extends CoreDelegate<CoreQuestionHandle
|
||||||
protected handlerNameProperty = 'type';
|
protected handlerNameProperty = 'type';
|
||||||
|
|
||||||
constructor(protected defaultHandler: CoreQuestionDefaultHandler) {
|
constructor(protected defaultHandler: CoreQuestionDefaultHandler) {
|
||||||
super('CoreQuestionDelegate', true);
|
super('CoreQuestionDelegate');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -51,7 +51,7 @@ export class CoreTagAreaDelegateService extends CoreDelegate<CoreTagAreaHandler>
|
||||||
protected handlerNameProperty = 'type';
|
protected handlerNameProperty = 'type';
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super('CoreTagAreaDelegate', true);
|
super('CoreTagAreaDelegate');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -229,7 +229,7 @@ export class CoreUserDelegateService extends CoreDelegate<CoreUserProfileHandler
|
||||||
protected userHandlers: Record<number, Record<string, CoreUserDelegateHandlersData>> = {};
|
protected userHandlers: Record<number, Record<string, CoreUserDelegateHandlersData>> = {};
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super('CoreUserDelegate', true);
|
super('CoreUserDelegate');
|
||||||
|
|
||||||
CoreEvents.on(USER_DELEGATE_UPDATE_HANDLER_EVENT, (data) => {
|
CoreEvents.on(USER_DELEGATE_UPDATE_HANDLER_EVENT, (data) => {
|
||||||
const handlersData = this.getHandlersData(data.userId, data.context, data.contextId);
|
const handlersData = this.getHandlersData(data.userId, data.context, data.contextId);
|
||||||
|
|
|
@ -80,7 +80,7 @@ export class CoreUserProfileFieldDelegateService extends CoreDelegate<CoreUserPr
|
||||||
protected handlerNameProperty = 'type';
|
protected handlerNameProperty = 'type';
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super('CoreUserProfileFieldDelegate', true);
|
super('CoreUserProfileFieldDelegate');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,7 +30,7 @@ import { CoreTextUtils } from '@services/utils/text';
|
||||||
export class CoreAnalyticsService extends CoreDelegate<CoreAnalyticsHandler> {
|
export class CoreAnalyticsService extends CoreDelegate<CoreAnalyticsHandler> {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super('CoreAnalyticsService', true);
|
super('CoreAnalyticsService');
|
||||||
|
|
||||||
CoreEvents.on(CoreConfigProvider.ENVIRONMENT_UPDATED, () => this.updateHandlers());
|
CoreEvents.on(CoreConfigProvider.ENVIRONMENT_UPDATED, () => this.updateHandlers());
|
||||||
CoreEvents.on(CoreEvents.LOGOUT, () => this.clearSiteHandlers());
|
CoreEvents.on(CoreEvents.LOGOUT, () => this.clearSiteHandlers());
|
||||||
|
|
|
@ -30,7 +30,7 @@ import { CoreFileHelper } from './file-helper';
|
||||||
export class CorePluginFileDelegateService extends CoreDelegate<CorePluginFileHandler> {
|
export class CorePluginFileDelegateService extends CoreDelegate<CorePluginFileHandler> {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super('CorePluginFileDelegate', true);
|
super('CorePluginFileDelegate');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue