diff --git a/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod b/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod index 91281b4cfaa6c8b14ac125c4d9dda3ecb4825d64..af8a859b1fe1bb8e09375e64529b9a98a2e2be89 100644 --- a/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod +++ b/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod @@ -94,11 +94,6 @@ </entityField> <entityConsumer> <name>Documents</name> - <dependency> - <name>dependency</name> - <entityName>Document_entity</entityName> - <fieldName>Documents</fieldName> - </dependency> <children> <entityParameter> <name>AssignmentTable_param</name> @@ -109,6 +104,11 @@ <valueProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/documents/children/assignmentrowid_param/valueProcess.js</valueProcess> </entityParameter> </children> + <dependency> + <name>dependency</name> + <entityName>Document_entity</entityName> + <fieldName>Documents</fieldName> + </dependency> </entityConsumer> <entityConsumer> <name>Languages</name> @@ -120,27 +120,22 @@ </entityConsumer> <entityConsumer> <name>KeywordDocumentTemplateType</name> - <dependency> - <name>dependency</name> - <entityName>KeywordEntry_entity</entityName> - <fieldName>SpecificContainerKeywords</fieldName> - </dependency> <children> <entityParameter> <name>ContainerName_param</name> <valueProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/keyworddocumenttemplatetype/children/containername_param/valueProcess.js</valueProcess> </entityParameter> </children> + <dependency> + <name>dependency</name> + <entityName>KeywordEntry_entity</entityName> + <fieldName>SpecificContainerKeywords</fieldName> + </dependency> </entityConsumer> <entityConsumer> <name>Attributes</name> <stateProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/attributes/stateProcess.js</stateProcess> <onValidation>%aditoprj%/entity/DocumentTemplate_entity/entityfields/attributes/onValidation.js</onValidation> - <dependency> - <name>dependency</name> - <entityName>AttributeRelation_entity</entityName> - <fieldName>AttributeRelations</fieldName> - </dependency> <children> <entityParameter> <name>ObjectRowId_param</name> @@ -151,6 +146,11 @@ <valueProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/attributes/children/objecttype_param/valueProcess.js</valueProcess> </entityParameter> </children> + <dependency> + <name>dependency</name> + <entityName>AttributeRelation_entity</entityName> + <fieldName>AttributeRelations</fieldName> + </dependency> </entityConsumer> <entityField> <name>Content</name> @@ -176,11 +176,6 @@ </entityField> <entityConsumer> <name>DocumentTemplateTypeCategory</name> - <dependency> - <name>dependency</name> - <entityName>DocumentTemplateTypeCategory_entity</entityName> - <fieldName>ByCategory</fieldName> - </dependency> <children> <entityParameter> <name>usageFilter_param</name> @@ -188,6 +183,11 @@ <expose v="true" /> </entityParameter> </children> + <dependency> + <name>dependency</name> + <entityName>DocumentTemplateTypeCategory_entity</entityName> + <fieldName>ByCategory</fieldName> + </dependency> </entityConsumer> <entityProvider> <name>Attachments</name> @@ -208,11 +208,6 @@ <entityConsumer> <name>Links</name> <stateProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/links/stateProcess.js</stateProcess> - <dependency> - <name>dependency</name> - <entityName>DocumentTemplateLink_entity</entityName> - <fieldName>Links</fieldName> - </dependency> <children> <entityParameter> <name>DocumentId_param</name> @@ -225,6 +220,11 @@ <expose v="true" /> </entityParameter> </children> + <dependency> + <name>dependency</name> + <entityName>DocumentTemplateLink_entity</entityName> + <fieldName>Links</fieldName> + </dependency> </entityConsumer> <entityParameter> <name>DocumentTemplateTypeClassification_param</name> @@ -234,6 +234,12 @@ <entityProvider> <name>DocumentTemplateProvider</name> <documentation>%aditoprj%/entity/DocumentTemplate_entity/entityfields/documenttemplateprovider/documentation.adoc</documentation> + <children> + <entityParameter> + <name>ComingFrom_param</name> + <expose v="true" /> + </entityParameter> + </children> <dependencies> <entityDependency> <name>9c10883d-eb73-4587-b758-693a66367a4c</name> @@ -278,12 +284,6 @@ <isConsumer v="false" /> </entityDependency> </dependencies> - <children> - <entityParameter> - <name>ComingFrom_param</name> - <expose v="true" /> - </entityParameter> - </children> </entityProvider> <entityParameter> <name>DocumentTemplateType_param</name> @@ -322,11 +322,6 @@ <name>DocumentTemplatePlaceOfUse</name> <stateProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/documenttemplateplaceofuse/stateProcess.js</stateProcess> <onValidation>%aditoprj%/entity/DocumentTemplate_entity/entityfields/documenttemplateplaceofuse/onValidation.js</onValidation> - <dependency> - <name>dependency</name> - <entityName>DocumentTemplatePlaceOfUse_entity</entityName> - <fieldName>DocumentTemplatePlaceOfUse</fieldName> - </dependency> <children> <entityParameter> <name>DocumentTemplatePlaceOfUse_param</name> @@ -334,6 +329,11 @@ <expose v="true" /> </entityParameter> </children> + <dependency> + <name>dependency</name> + <entityName>DocumentTemplatePlaceOfUse_entity</entityName> + <fieldName>DocumentTemplatePlaceOfUse</fieldName> + </dependency> </entityConsumer> <entityParameter> <name>ComingFrom_param</name> @@ -347,6 +347,20 @@ <name>#PROVIDER_AGGREGATES</name> <useAggregates v="true" /> </entityProvider> + <entityField> + <name>HtmlEdit</name> + <title>HTML Editor</title> + <contentType>HTML</contentType> + <valueProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/htmledit/valueProcess.js</valueProcess> + </entityField> + <entityActionField> + <name>HtmlEditor</name> + <title>Edit HTML file</title> + <onActionProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/htmleditor/onActionProcess.js</onActionProcess> + <iconId>NEON:PENCIL</iconId> + <state>INVISIBLE</state> + <stateProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/htmleditor/stateProcess.js</stateProcess> + </entityActionField> </entityFields> <recordContainers> <dbRecordContainer> diff --git a/entity/DocumentTemplate_entity/entityfields/htmledit/valueProcess.js b/entity/DocumentTemplate_entity/entityfields/htmledit/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..36a9c17e2705fcba467c4a8ac938bd4459876cf4 --- /dev/null +++ b/entity/DocumentTemplate_entity/entityfields/htmledit/valueProcess.js @@ -0,0 +1,10 @@ +import("system.result"); +import("system.neon"); +import("DocumentTemplate_lib"); +import("system.vars"); + +if((vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT || vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW) && vars.get("$this.value") == null) +{ + var [content, type] = DocumentTemplateUtils.getTemplateContent(vars.get("$field.DOCUMENTTEMPLATEID"), new FileUpload(vars.get("$field.BINDATA"))); + result.string(content); +} \ No newline at end of file diff --git a/entity/DocumentTemplate_entity/entityfields/htmleditor/onActionProcess.js b/entity/DocumentTemplate_entity/entityfields/htmleditor/onActionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..fffffbec7b3c32bd321a33286a6db7cbd07dc13a --- /dev/null +++ b/entity/DocumentTemplate_entity/entityfields/htmleditor/onActionProcess.js @@ -0,0 +1,6 @@ +import("system.logging"); +import("system.vars"); +import("DocumentTemplate_lib"); +import("system.neon"); + +neon.openContext("DocumentTemplate", "DocumentTemplateHtmlEdit_view", [vars.get("$field.DOCUMENTTEMPLATEID")], neon.OPERATINGSTATE_EDIT, null) diff --git a/entity/DocumentTemplate_entity/entityfields/htmleditor/stateProcess.js b/entity/DocumentTemplate_entity/entityfields/htmleditor/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..c0824ad21cb8d86f3e4cd4b0729d393cb7db7870 --- /dev/null +++ b/entity/DocumentTemplate_entity/entityfields/htmleditor/stateProcess.js @@ -0,0 +1,11 @@ +import("KeywordRegistry_basic"); +import("system.result"); +import("system.vars"); +import("DocumentTemplate_lib"); +import("system.neon"); + +var template = DocumentTemplateUtils.getTemplate(vars.get("$field.DOCUMENTTEMPLATEID"), false); +var kind = vars.get("$field.KIND"); + +if(template.type == DocumentTemplate.types.HTML && kind == $KeywordRegistry.documentTemplateType$textModular() || kind == $KeywordRegistry.documentTemplateType$mail()) + result.string(neon.COMPONENTSTATE_EDITABLE); diff --git a/entity/DocumentTemplate_entity/recordcontainers/db/onDBInsert.js b/entity/DocumentTemplate_entity/recordcontainers/db/onDBInsert.js index 3fcb0bfdea5a7b87a043d458315bcde4a77dd59b..f26e45f82fa837f71d0e36e77a96dc713b49eaa0 100644 --- a/entity/DocumentTemplate_entity/recordcontainers/db/onDBInsert.js +++ b/entity/DocumentTemplate_entity/recordcontainers/db/onDBInsert.js @@ -1,3 +1,4 @@ +import("system.logging"); import("Workflow_lib"); import("DocumentTemplate_lib"); import("system.vars"); @@ -8,5 +9,4 @@ var upload = new FileUpload(vars.get("$field.BINDATA")); var rowId = vars.get("$local.uid"); DocumentTemplateUtils.insertTemplateData(rowId, upload, rowdata["DOCUMENTTEMPLATE.KIND"], vars.get("$field.Content"), rowdata["DOCUMENTTEMPLATE.CLASSIFICATION"], rowdata["DOCUMENTTEMPLATE.NAME"]); - WorkflowSignalSender.inserted(); \ No newline at end of file diff --git a/entity/DocumentTemplate_entity/recordcontainers/db/onDBUpdate.js b/entity/DocumentTemplate_entity/recordcontainers/db/onDBUpdate.js index a3311749b10574b4ab7133c69b685d571d80f204..dee24321b4a3655b4a253742be82b7ca9c25d66e 100644 --- a/entity/DocumentTemplate_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/DocumentTemplate_entity/recordcontainers/db/onDBUpdate.js @@ -10,4 +10,7 @@ var rowId = vars.get("$local.uid"); DocumentTemplateUtils.updateTemplateData(rowId, upload, rowdata["DOCUMENTTEMPLATE.KIND"], content, rowdata["DOCUMENTTEMPLATE.CLASSIFICATION"], rowdata["DOCUMENTTEMPLATE.NAME"]); +if(vars.get("$field.HtmlEdit") != null) + DocumentTemplateUtils.updateTemplateData(rowId, upload, rowdata["DOCUMENTTEMPLATE.KIND"], vars.get("$field.HtmlEdit"), rowdata["DOCUMENTTEMPLATE.CLASSIFICATION"], rowdata["DOCUMENTTEMPLATE.NAME"]) + WorkflowSignalSender.updated(); \ No newline at end of file diff --git a/neonContext/Document/Document.aod b/neonContext/Document/Document.aod index cfb02a7f2b32b641b632905df49b01ef560bd62c..625b588c0d26638db8e8001004ea6d6d8a12f3c1 100644 --- a/neonContext/Document/Document.aod +++ b/neonContext/Document/Document.aod @@ -37,5 +37,8 @@ <name>434ed60c-8219-4ef5-b795-6d72b9ae48c9</name> <view>DocumentWithIdFilter_view</view> </neonViewReference> + <neonViewReference> + <name>0dfe06a2-7a32-40b4-bac7-3b408956deba</name> + </neonViewReference> </references> </neonContext> diff --git a/neonContext/DocumentTemplate/DocumentTemplate.aod b/neonContext/DocumentTemplate/DocumentTemplate.aod index 93bb494e4a2b1a7850ba0ec770c28e4ae4466216..106a7ab18eba8cfb0186d7ab15594326becb77e3 100644 --- a/neonContext/DocumentTemplate/DocumentTemplate.aod +++ b/neonContext/DocumentTemplate/DocumentTemplate.aod @@ -26,5 +26,9 @@ <name>df9dab28-502c-41c2-8a8f-1c0745ca14dd</name> <view>DocumentTemplateFilterSmall_view</view> </neonViewReference> + <neonViewReference> + <name>9a7692da-4374-4fd8-a65f-aea4100bedca</name> + <view>DocumentTemplateHtmlEdit_view</view> + </neonViewReference> </references> </neonContext> diff --git a/neonView/DocumentTemplateHtmlEdit_view/DocumentTemplateHtmlEdit_view.aod b/neonView/DocumentTemplateHtmlEdit_view/DocumentTemplateHtmlEdit_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..dc8ce3a6bca41c87352a6d596c6ddca6d6f6c29c --- /dev/null +++ b/neonView/DocumentTemplateHtmlEdit_view/DocumentTemplateHtmlEdit_view.aod @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.6" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.6"> + <name>DocumentTemplateHtmlEdit_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <noneLayout> + <name>layout</name> + </noneLayout> + </layout> + <children> + <genericViewTemplate> + <name>Edit</name> + <editMode v="true" /> + <fields> + <entityFieldLink> + <name>30901b23-7bad-42d6-aa14-ebc11268d407</name> + <entityField>HtmlEdit</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> +</neonView> diff --git a/process/DocumentTemplate_lib/process.js b/process/DocumentTemplate_lib/process.js index 3c074ffd23098632fde158cbebaa1bfad78e50f1..5fef12bb28f9133080c716a9f542a528103792ec 100644 --- a/process/DocumentTemplate_lib/process.js +++ b/process/DocumentTemplate_lib/process.js @@ -913,7 +913,7 @@ DocumentTemplateUtils.chooseSuppliedTemplate = function (pFileUpload, pKind, pTe // use fileUpload but use the custom text as bindata pFileUpload.bindata = util.encodeBase64String(pText); } - else if (!pFileUpload.isFilled() && pText != "" && pKind == $KeywordRegistry.documentTemplateType$textModular()) // edit is only allowed in modular templates + else if (!pFileUpload.isFilled() && pText != "" && pKind == $KeywordRegistry.documentTemplateType$textModular() || pKind == $KeywordRegistry.documentTemplateType$mail()) // edit is only allowed in modular templates { pFileUpload.filename = pTemplateName;