mirror of
https://github.com/ONLYOFFICE/sdkjs-forms.git
synced 2026-02-10 18:05:42 +08:00
[oform] Add new base class for all format classes
This commit is contained in:
committed by
Ilya Kirillov
parent
0ae117891d
commit
d8628c74c6
@ -10,6 +10,7 @@
|
|||||||
"oform/Role.js",
|
"oform/Role.js",
|
||||||
"oform/xml/XmlPackage.js",
|
"oform/xml/XmlPackage.js",
|
||||||
"oform/xml/XmlContext.js",
|
"oform/xml/XmlContext.js",
|
||||||
|
"oform/format/BaseFormatObject.js",
|
||||||
"oform/format/Document.js",
|
"oform/format/Document.js",
|
||||||
"oform/format/FieldGroup.js",
|
"oform/format/FieldGroup.js",
|
||||||
"oform/format/FieldMaster.js",
|
"oform/format/FieldMaster.js",
|
||||||
|
|||||||
76
oform/format/BaseFormatObject.js
Normal file
76
oform/format/BaseFormatObject.js
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
/*
|
||||||
|
* (c) Copyright Ascensio System SIA 2010-2019
|
||||||
|
*
|
||||||
|
* This program is a free software product. You can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||||
|
* version 3 as published by the Free Software Foundation. In accordance with
|
||||||
|
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||||
|
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||||
|
* of any third-party rights.
|
||||||
|
*
|
||||||
|
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||||
|
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||||
|
*
|
||||||
|
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
|
||||||
|
* street, Riga, Latvia, EU, LV-1050.
|
||||||
|
*
|
||||||
|
* The interactive user interfaces in modified source and object code versions
|
||||||
|
* of the Program must display Appropriate Legal Notices, as required under
|
||||||
|
* Section 5 of the GNU AGPL version 3.
|
||||||
|
*
|
||||||
|
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||||
|
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||||
|
* grant you any rights under trademark law for use of our trademarks.
|
||||||
|
*
|
||||||
|
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||||
|
* well as technical writing content are licensed under the terms of the
|
||||||
|
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||||
|
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
(function(window)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Базовый класс для всех форматных классов в oform
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
function CBaseFormatObject()
|
||||||
|
{
|
||||||
|
this.Id = null;
|
||||||
|
|
||||||
|
if (!AscCommon.g_oIdCounter.m_bLoad && !AscCommon.History.CanAddChanges())
|
||||||
|
return;
|
||||||
|
|
||||||
|
this.Id = AscCommon.g_oIdCounter.GetNewIdForOForm();
|
||||||
|
AscCommon.g_oTableId.Add(this, this.Id);
|
||||||
|
}
|
||||||
|
CBaseFormatObject.prototype.GetId = function()
|
||||||
|
{
|
||||||
|
return this.Id;
|
||||||
|
};
|
||||||
|
CBaseFormatObject.prototype.Get_Id = function()
|
||||||
|
{
|
||||||
|
return this.Id;
|
||||||
|
};
|
||||||
|
CBaseFormatObject.prototype.Write_ToBinary2 = function(writer)
|
||||||
|
{
|
||||||
|
writer.WriteLong(this.classType);
|
||||||
|
writer.WriteString2(this.GetId());
|
||||||
|
};
|
||||||
|
CBaseFormatObject.prototype.Read_FromBinary2 = function(reader)
|
||||||
|
{
|
||||||
|
this.Id = reader.GetString2();
|
||||||
|
};
|
||||||
|
CBaseFormatObject.prototype.Refresh_RecalcData = function(change)
|
||||||
|
{
|
||||||
|
};
|
||||||
|
//--------------------------------------------------------export----------------------------------------------------
|
||||||
|
AscOForm.CBaseFormatObject = CBaseFormatObject;
|
||||||
|
|
||||||
|
})(window);
|
||||||
@ -38,10 +38,11 @@
|
|||||||
* Основной класс для работы с форматом oform
|
* Основной класс для работы с форматом oform
|
||||||
* @param oform {AscOForm.OForm}
|
* @param oform {AscOForm.OForm}
|
||||||
* @constructor
|
* @constructor
|
||||||
|
* @extends AscOForm.CBaseFormatObject
|
||||||
*/
|
*/
|
||||||
function CDocument(oform)
|
function CDocument(oform)
|
||||||
{
|
{
|
||||||
AscFormat.CBaseFormatObject.call(this);
|
AscOForm.CBaseFormatObject.call(this);
|
||||||
|
|
||||||
this.OForm = oform;
|
this.OForm = oform;
|
||||||
|
|
||||||
@ -63,7 +64,7 @@
|
|||||||
this.UserMasters = [];
|
this.UserMasters = [];
|
||||||
this.FieldMasters = [];
|
this.FieldMasters = [];
|
||||||
}
|
}
|
||||||
AscFormat.InitClass(CDocument, AscFormat.CBaseFormatObject, AscDFH.historyitem_type_OForm_Document);
|
AscFormat.InitClass(CDocument, AscOForm.CBaseFormatObject, AscDFH.historyitem_type_OForm_Document);
|
||||||
CDocument.prototype.clear = function()
|
CDocument.prototype.clear = function()
|
||||||
{
|
{
|
||||||
// TODO: fields?
|
// TODO: fields?
|
||||||
|
|||||||
@ -36,10 +36,11 @@
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
|
* @extends AscOForm.CBaseFormatObject
|
||||||
*/
|
*/
|
||||||
function CFieldGroup()
|
function CFieldGroup()
|
||||||
{
|
{
|
||||||
AscFormat.CBaseFormatObject.call(this);
|
AscOForm.CBaseFormatObject.call(this);
|
||||||
|
|
||||||
this.Weight = null;
|
this.Weight = null;
|
||||||
this.Fields = [];
|
this.Fields = [];
|
||||||
@ -47,7 +48,7 @@
|
|||||||
|
|
||||||
this.Parent = null;
|
this.Parent = null;
|
||||||
}
|
}
|
||||||
AscFormat.InitClass(CFieldGroup, AscFormat.CBaseFormatObject, AscDFH.historyitem_type_OForm_FieldGroup);
|
AscFormat.InitClass(CFieldGroup, AscOForm.CBaseFormatObject, AscDFH.historyitem_type_OForm_FieldGroup);
|
||||||
CFieldGroup.prototype.setParent = function(parent)
|
CFieldGroup.prototype.setParent = function(parent)
|
||||||
{
|
{
|
||||||
this.Parent = parent;
|
this.Parent = parent;
|
||||||
|
|||||||
@ -37,10 +37,11 @@
|
|||||||
/**
|
/**
|
||||||
* @param {boolean} [generateId=false]
|
* @param {boolean} [generateId=false]
|
||||||
* @constructor
|
* @constructor
|
||||||
|
* @extends AscOForm.CBaseFormatObject
|
||||||
*/
|
*/
|
||||||
function CFieldMaster(generateId)
|
function CFieldMaster(generateId)
|
||||||
{
|
{
|
||||||
AscFormat.CBaseFormatObject.call(this);
|
AscOForm.CBaseFormatObject.call(this);
|
||||||
|
|
||||||
this.FieldId = null;
|
this.FieldId = null;
|
||||||
this.Field = null;
|
this.Field = null;
|
||||||
@ -50,7 +51,7 @@
|
|||||||
if (true === generateId)
|
if (true === generateId)
|
||||||
this.setFieldId(AscCommon.CreateGUID());
|
this.setFieldId(AscCommon.CreateGUID());
|
||||||
}
|
}
|
||||||
AscFormat.InitClass(CFieldMaster, AscFormat.CBaseFormatObject, AscDFH.historyitem_type_OForm_FieldMaster);
|
AscFormat.InitClass(CFieldMaster, AscOForm.CBaseFormatObject, AscDFH.historyitem_type_OForm_FieldMaster);
|
||||||
CFieldMaster.prototype.setLogicField = function(logicField)
|
CFieldMaster.prototype.setLogicField = function(logicField)
|
||||||
{
|
{
|
||||||
this.Field = logicField;
|
this.Field = logicField;
|
||||||
|
|||||||
@ -37,10 +37,11 @@
|
|||||||
/**
|
/**
|
||||||
* @param {AscOForm.CUserMaster} userMaster
|
* @param {AscOForm.CUserMaster} userMaster
|
||||||
* @constructor
|
* @constructor
|
||||||
|
* @extends AscOForm.CBaseFormatObject
|
||||||
*/
|
*/
|
||||||
function CUser(userMaster)
|
function CUser(userMaster)
|
||||||
{
|
{
|
||||||
AscFormat.CBaseFormatObject.call(this);
|
AscOForm.CBaseFormatObject.call(this);
|
||||||
|
|
||||||
this.Email = undefined;
|
this.Email = undefined;
|
||||||
this.Telephone = undefined;
|
this.Telephone = undefined;
|
||||||
@ -49,7 +50,7 @@
|
|||||||
if (userMaster)
|
if (userMaster)
|
||||||
this.setUserMaster(userMaster);
|
this.setUserMaster(userMaster);
|
||||||
}
|
}
|
||||||
AscFormat.InitClass(CUser, AscFormat.CBaseFormatObject, AscDFH.historyitem_type_OForm_User);
|
AscFormat.InitClass(CUser, AscOForm.CBaseFormatObject, AscDFH.historyitem_type_OForm_User);
|
||||||
CUser.prototype.setUserMaster = function(userMaster)
|
CUser.prototype.setUserMaster = function(userMaster)
|
||||||
{
|
{
|
||||||
if (this.UserMaster === userMaster)
|
if (this.UserMaster === userMaster)
|
||||||
|
|||||||
@ -37,10 +37,11 @@
|
|||||||
/**
|
/**
|
||||||
* @param {boolean} [generateId=false]
|
* @param {boolean} [generateId=false]
|
||||||
* @constructor
|
* @constructor
|
||||||
|
* @extends AscOForm.CBaseFormatObject
|
||||||
*/
|
*/
|
||||||
function CUserMaster(generateId)
|
function CUserMaster(generateId)
|
||||||
{
|
{
|
||||||
AscFormat.CBaseFormatObject.call(this);
|
AscOForm.CBaseFormatObject.call(this);
|
||||||
|
|
||||||
this.UserId = undefined;
|
this.UserId = undefined;
|
||||||
this.Role = undefined;
|
this.Role = undefined;
|
||||||
@ -51,7 +52,7 @@
|
|||||||
|
|
||||||
this.Parent = null;
|
this.Parent = null;
|
||||||
}
|
}
|
||||||
AscFormat.InitClass(CUserMaster, AscFormat.CBaseFormatObject, AscDFH.historyitem_type_OForm_UserMaster);
|
AscFormat.InitClass(CUserMaster, AscOForm.CBaseFormatObject, AscDFH.historyitem_type_OForm_UserMaster);
|
||||||
CUserMaster.prototype.setParent = function(parent)
|
CUserMaster.prototype.setParent = function(parent)
|
||||||
{
|
{
|
||||||
this.Parent = parent;
|
this.Parent = parent;
|
||||||
|
|||||||
Reference in New Issue
Block a user