forked from CIT/Vmeda.Online
101 lines
3.6 KiB
TypeScript
101 lines
3.6 KiB
TypeScript
// (C) Copyright 2015 Martin Dougiamas
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
import { Injectable } from '@angular/core';
|
|
import { AddonModDataFieldHandler } from './fields-delegate';
|
|
|
|
/**
|
|
* Default handler used when a field plugin doesn't have a specific implementation.
|
|
*/
|
|
@Injectable()
|
|
export class AddonModDataDefaultFieldHandler implements AddonModDataFieldHandler {
|
|
name = 'AddonModDataDefaultFieldHandler';
|
|
type = 'default';
|
|
|
|
/**
|
|
* Get field search data in the input data.
|
|
*
|
|
* @param {any} field Defines the field to be rendered.
|
|
* @param {any} inputData Data entered in the search form.
|
|
* @return {any} With name and value of the data to be sent.
|
|
*/
|
|
getFieldSearchData(field: any, inputData: any): any {
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Get field edit data in the input data.
|
|
*
|
|
* @param {any} field Defines the field to be rendered.
|
|
* @param {any} inputData Data entered in the edit form.
|
|
* @return {any} With name and value of the data to be sent.
|
|
*/
|
|
getFieldEditData(field: any, inputData: any, originalFieldData: any): any {
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Get field data in changed.
|
|
*
|
|
* @param {any} field Defines the field to be rendered.
|
|
* @param {any} inputData Data entered in the edit form.
|
|
* @param {any} originalFieldData Original field entered data.
|
|
* @return {Promise<boolean> | boolean} If the field has changes.
|
|
*/
|
|
hasFieldDataChanged(field: any, inputData: any, originalFieldData: any): Promise<boolean> | boolean {
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Get field edit files in the input data.
|
|
*
|
|
* @param {any} field Defines the field..
|
|
* @return {any} With name and value of the data to be sent.
|
|
*/
|
|
getFieldEditFiles(field: any, inputData: any, originalFieldData: any): any {
|
|
return [];
|
|
}
|
|
|
|
/**
|
|
* Check and get field requeriments.
|
|
*
|
|
* @param {any} field Defines the field to be rendered.
|
|
* @param {any} inputData Data entered in the edit form.
|
|
* @return {string | false} String with the notification or false.
|
|
*/
|
|
getFieldsNotifications(field: any, inputData: any): string | false {
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Override field content data with offline submission.
|
|
*
|
|
* @param {any} originalContent Original data to be overriden.
|
|
* @param {any} offlineContent Array with all the offline data to override.
|
|
* @param {any} [offlineFiles] Array with all the offline files in the field.
|
|
* @return {any} Data overriden
|
|
*/
|
|
overrideData(originalContent: any, offlineContent: any, offlineFiles?: any): any {
|
|
return originalContent;
|
|
}
|
|
|
|
/**
|
|
* Whether or not the handler is enabled on a site level.
|
|
*
|
|
* @return {boolean|Promise<boolean>} True or promise resolved with true if enabled.
|
|
*/
|
|
isEnabled(): boolean | Promise<boolean> {
|
|
return true;
|
|
}
|
|
}
|