MOBILE-4538 assign: Inheritdocs from handlers
parent
4fd1276817
commit
dc1b9e9575
|
@ -60,11 +60,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss
|
|||
}
|
||||
|
||||
/**
|
||||
* Discard the draft data of the feedback plugin.
|
||||
*
|
||||
* @param assignId The assignment ID.
|
||||
* @param userId User ID.
|
||||
* @param siteId Site ID. If not defined, current site.
|
||||
* @inheritdoc
|
||||
*/
|
||||
discardDraft(assignId: number, userId: number, siteId?: string): void {
|
||||
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.
|
||||
* 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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
getComponent(): Type<IAddonModAssignFeedbackPluginComponent> {
|
||||
return AddonModAssignFeedbackCommentsComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the draft saved data of the feedback plugin.
|
||||
*
|
||||
* @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).
|
||||
* @inheritdoc
|
||||
*/
|
||||
getDraft(assignId: number, userId: number, siteId?: string): AddonModAssignFeedbackCommentsDraftData | undefined {
|
||||
const id = this.getDraftId(assignId, userId, siteId);
|
||||
|
@ -114,13 +102,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss
|
|||
}
|
||||
|
||||
/**
|
||||
* Get files used by this plugin.
|
||||
* 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).
|
||||
* @inheritdoc
|
||||
*/
|
||||
getPluginFiles(
|
||||
assign: AddonModAssignAssign,
|
||||
|
@ -131,14 +113,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss
|
|||
}
|
||||
|
||||
/**
|
||||
* Check if the feedback data has changed for this plugin.
|
||||
*
|
||||
* @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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
async hasDataChanged(
|
||||
assign: AddonModAssignAssign,
|
||||
|
@ -172,12 +147,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss
|
|||
}
|
||||
|
||||
/**
|
||||
* Check whether the plugin has draft data stored.
|
||||
*
|
||||
* @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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
hasDraftData(assignId: number, userId: number, siteId?: string): boolean | Promise<boolean> {
|
||||
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.
|
||||
*
|
||||
* @returns True or promise resolved with true if enabled.
|
||||
* @inheritdoc
|
||||
*/
|
||||
async isEnabled(): Promise<boolean> {
|
||||
// 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.
|
||||
*
|
||||
* @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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
prepareFeedbackData(
|
||||
assignId: number,
|
||||
|
@ -225,13 +187,7 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss
|
|||
}
|
||||
|
||||
/**
|
||||
* Save draft data of the feedback plugin.
|
||||
*
|
||||
* @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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
saveDraft(
|
||||
assignId: number,
|
||||
|
|
|
@ -35,23 +35,14 @@ export class AddonModAssignFeedbackEditPdfHandlerService implements AddonModAssi
|
|||
type = 'editpdf';
|
||||
|
||||
/**
|
||||
* Return the Component to use to display the plugin data.
|
||||
* 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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
getComponent(): Type<IAddonModAssignFeedbackPluginComponent> {
|
||||
return AddonModAssignFeedbackEditPdfComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get files used by this plugin.
|
||||
* 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).
|
||||
* @inheritdoc
|
||||
*/
|
||||
getPluginFiles(
|
||||
assign: AddonModAssignAssign,
|
||||
|
@ -62,9 +53,7 @@ export class AddonModAssignFeedbackEditPdfHandlerService implements AddonModAssi
|
|||
}
|
||||
|
||||
/**
|
||||
* Whether or not the handler is enabled on a site level.
|
||||
*
|
||||
* @returns True or promise resolved with true if enabled.
|
||||
* @inheritdoc
|
||||
*/
|
||||
async isEnabled(): Promise<boolean> {
|
||||
return true;
|
||||
|
|
|
@ -35,23 +35,14 @@ export class AddonModAssignFeedbackFileHandlerService implements AddonModAssignF
|
|||
type = 'file';
|
||||
|
||||
/**
|
||||
* Return the Component to use to display the plugin data.
|
||||
* 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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
getComponent(): Type<IAddonModAssignFeedbackPluginComponent> {
|
||||
return AddonModAssignFeedbackFileComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get files used by this plugin.
|
||||
* 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).
|
||||
* @inheritdoc
|
||||
*/
|
||||
getPluginFiles(
|
||||
assign: AddonModAssignAssign,
|
||||
|
@ -62,9 +53,7 @@ export class AddonModAssignFeedbackFileHandlerService implements AddonModAssignF
|
|||
}
|
||||
|
||||
/**
|
||||
* Whether or not the handler is enabled on a site level.
|
||||
*
|
||||
* @returns True or promise resolved with true if enabled.
|
||||
* @inheritdoc
|
||||
*/
|
||||
async isEnabled(): Promise<boolean> {
|
||||
return true;
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { CoreWSFile } from '@services/ws';
|
||||
import { Translate } from '@singletons';
|
||||
import { AddonModAssignPlugin } from '../assign';
|
||||
import { AddonModAssignAssign, AddonModAssignPlugin, AddonModAssignSavePluginData, AddonModAssignSubmission } from '../assign';
|
||||
import { AddonModAssignFeedbackHandler } from '../feedback-delegate';
|
||||
import { CoreFormFields } from '@singletons/form';
|
||||
|
||||
/**
|
||||
* Default handler used when a feedback plugin doesn't have a specific implementation.
|
||||
|
@ -30,14 +31,19 @@ export class AddonModAssignDefaultFeedbackHandler implements AddonModAssignFeedb
|
|||
/**
|
||||
* @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.
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.
|
||||
return;
|
||||
}
|
||||
|
@ -45,7 +51,12 @@ export class AddonModAssignDefaultFeedbackHandler implements AddonModAssignFeedb
|
|||
/**
|
||||
* @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 [];
|
||||
}
|
||||
|
||||
|
@ -73,14 +84,21 @@ export class AddonModAssignDefaultFeedbackHandler implements AddonModAssignFeedb
|
|||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
hasDraftData(): boolean {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
hasDraftData(assignId: number, userId: number, siteId?: string): boolean | Promise<boolean> {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -94,21 +112,38 @@ export class AddonModAssignDefaultFeedbackHandler implements AddonModAssignFeedb
|
|||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,10 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { CoreWSFile } from '@services/ws';
|
||||
import { Translate } from '@singletons';
|
||||
import { AddonModAssignPlugin } from '../assign';
|
||||
import { AddonModAssignAssign, AddonModAssignPlugin, AddonModAssignSavePluginData, AddonModAssignSubmission } from '../assign';
|
||||
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.
|
||||
|
@ -30,42 +32,71 @@ export class AddonModAssignDefaultSubmissionHandler implements AddonModAssignSub
|
|||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 [];
|
||||
}
|
||||
|
||||
|
@ -93,21 +124,34 @@ export class AddonModAssignDefaultSubmissionHandler implements AddonModAssignSub
|
|||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
|
@ -121,28 +165,49 @@ export class AddonModAssignDefaultSubmissionHandler implements AddonModAssignSub
|
|||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
isEnabledForEdit(): boolean {
|
||||
isEnabledForEdit(): boolean | Promise<boolean> {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.
|
||||
}
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler {
|
|||
submission: AddonModAssignSubmission,
|
||||
plugin: AddonModAssignPlugin,
|
||||
inputData: CoreFormFields,
|
||||
): boolean | Promise<boolean>;
|
||||
): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Whether or not the handler is enabled for edit on a site level.
|
||||
|
|
|
@ -30,11 +30,7 @@ export class AddonModAssignSubmissionCommentsHandlerService implements AddonModA
|
|||
type = 'comments';
|
||||
|
||||
/**
|
||||
* Whether the plugin can be edited in offline for existing submissions. In general, this should return false if the
|
||||
* 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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
canEditOffline(): boolean {
|
||||
// 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.
|
||||
* 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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
getComponent(plugin: AddonModAssignPlugin, edit = false): Type<AddonModAssignSubmissionPluginBaseComponent> | undefined {
|
||||
return edit ? undefined : AddonModAssignSubmissionCommentsComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not the handler is enabled on a site level.
|
||||
*
|
||||
* @returns True or promise resolved with true if enabled.
|
||||
* @inheritdoc
|
||||
*/
|
||||
async isEnabled(): Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not the handler is enabled for edit on a site level.
|
||||
*
|
||||
* @returns Whether or not the handler is enabled for edit on a site level.
|
||||
* @inheritdoc
|
||||
*/
|
||||
isEnabledForEdit(): boolean{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prefetch any required data for the plugin.
|
||||
* 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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
async prefetch(
|
||||
assign: AddonModAssignAssign,
|
||||
|
|
|
@ -45,11 +45,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
|||
type = 'file';
|
||||
|
||||
/**
|
||||
* Whether the plugin can be edited in offline for existing submissions. In general, this should return false if the
|
||||
* 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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
canEditOffline(): boolean {
|
||||
// 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.
|
||||
*
|
||||
* @param assign The assignment.
|
||||
* @param plugin The plugin object.
|
||||
* @returns Whether the plugin is empty.
|
||||
* @inheritdoc
|
||||
*/
|
||||
isEmpty(assign: AddonModAssignAssign, plugin: AddonModAssignPlugin): boolean {
|
||||
const files = AddonModAssign.getSubmissionPluginAttachments(plugin);
|
||||
|
@ -70,9 +62,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
|||
}
|
||||
|
||||
/**
|
||||
* Should clear temporary data for a cancelled submission.
|
||||
*
|
||||
* @param assign The assignment.
|
||||
* @inheritdoc
|
||||
*/
|
||||
clearTmpData(assign: AddonModAssignAssign): void {
|
||||
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.
|
||||
* 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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
async copySubmissionData(
|
||||
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.
|
||||
* 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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
getComponent(): Type<AddonModAssignSubmissionPluginBaseComponent> {
|
||||
return AddonModAssignSubmissionFileComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete any stored data for the plugin and submission.
|
||||
*
|
||||
* @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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
async deleteOfflineData(
|
||||
assign: AddonModAssignAssign,
|
||||
|
@ -144,13 +118,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
|||
}
|
||||
|
||||
/**
|
||||
* Get files used by this plugin.
|
||||
* 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).
|
||||
* @inheritdoc
|
||||
*/
|
||||
getPluginFiles(
|
||||
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.
|
||||
*
|
||||
* @param assign The assignment.
|
||||
* @param plugin The plugin object.
|
||||
* @returns The size (or promise resolved with size).
|
||||
* @inheritdoc
|
||||
*/
|
||||
async getSizeForCopy(assign: AddonModAssignAssign, plugin: AddonModAssignPlugin): Promise<number> {
|
||||
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.
|
||||
*
|
||||
* @param assign The assignment.
|
||||
* @param submission The submission.
|
||||
* @param plugin The plugin object.
|
||||
* @returns The size (or promise resolved with size).
|
||||
* @inheritdoc
|
||||
*/
|
||||
async getSizeForEdit(
|
||||
assign: AddonModAssignAssign,
|
||||
|
@ -199,12 +158,7 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
|||
}
|
||||
|
||||
/**
|
||||
* Check if the submission data has changed for this plugin.
|
||||
*
|
||||
* @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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
async hasDataChanged(
|
||||
assign: AddonModAssignAssign,
|
||||
|
@ -243,35 +197,21 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig
|
|||
}
|
||||
|
||||
/**
|
||||
* Whether or not the handler is enabled on a site level.
|
||||
*
|
||||
* @returns True or promise resolved with true if enabled.
|
||||
* @inheritdoc
|
||||
*/
|
||||
async isEnabled(): Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not the handler is enabled for edit on a site level.
|
||||
*
|
||||
* @returns Whether or not the handler is enabled for edit on a site level.
|
||||
* @inheritdoc
|
||||
*/
|
||||
isEnabledForEdit(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare and add to pluginData the data to send to the server based on the input data.
|
||||
*
|
||||
* @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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
async prepareSubmissionData(
|
||||
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.
|
||||
* 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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
async prepareSyncData(
|
||||
assign: AddonModAssignAssign,
|
||||
|
|
|
@ -41,11 +41,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo
|
|||
type = 'onlinetext';
|
||||
|
||||
/**
|
||||
* Whether the plugin can be edited in offline for existing submissions. In general, this should return false if the
|
||||
* 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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
canEditOffline(): boolean {
|
||||
// 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.
|
||||
*
|
||||
* @param assign The assignment.
|
||||
* @param plugin The plugin object.
|
||||
* @returns Whether the plugin is empty.
|
||||
* @inheritdoc
|
||||
*/
|
||||
isEmpty(assign: AddonModAssignAssign, plugin: AddonModAssignPlugin): boolean {
|
||||
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.
|
||||
* 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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
async copySubmissionData(
|
||||
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.
|
||||
* 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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
getComponent(): Type<AddonModAssignSubmissionPluginBaseComponent> {
|
||||
return AddonModAssignSubmissionOnlineTextComponent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get files used by this plugin.
|
||||
* 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).
|
||||
* @inheritdoc
|
||||
*/
|
||||
getPluginFiles(
|
||||
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.
|
||||
*
|
||||
* @param assign The assignment.
|
||||
* @param plugin The plugin object.
|
||||
* @returns The size (or promise resolved with size).
|
||||
* @inheritdoc
|
||||
*/
|
||||
async getSizeForCopy(assign: AddonModAssignAssign, plugin: AddonModAssignPlugin): Promise<number> {
|
||||
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.
|
||||
*
|
||||
* @param assign The assignment.
|
||||
* @param submission The submission.
|
||||
* @param plugin The plugin object.
|
||||
* @returns The size (or promise resolved with size).
|
||||
* @inheritdoc
|
||||
*/
|
||||
getSizeForEdit(
|
||||
assign: AddonModAssignAssign,
|
||||
|
@ -177,13 +143,7 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo
|
|||
}
|
||||
|
||||
/**
|
||||
* Check if the submission data has changed for this plugin.
|
||||
*
|
||||
* @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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
async hasDataChanged(
|
||||
assign: AddonModAssignAssign,
|
||||
|
@ -209,31 +169,21 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo
|
|||
}
|
||||
|
||||
/**
|
||||
* Whether or not the handler is enabled on a site level.
|
||||
*
|
||||
* @returns True or promise resolved with true if enabled.
|
||||
* @inheritdoc
|
||||
*/
|
||||
async isEnabled(): Promise<boolean> {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not the handler is enabled for edit on a site level.
|
||||
*
|
||||
* @returns Whether or not the handler is enabled for edit on a site level.
|
||||
* @inheritdoc
|
||||
*/
|
||||
isEnabledForEdit(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare and add to pluginData the data to send to the server based on the input data.
|
||||
*
|
||||
* @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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
prepareSubmissionData(
|
||||
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.
|
||||
* 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.
|
||||
* @inheritdoc
|
||||
*/
|
||||
prepareSyncData(
|
||||
assign: AddonModAssignAssign,
|
||||
|
|
Loading…
Reference in New Issue