From dd21c18f0354f2fa2fdf0428f0f121dc75290a6e Mon Sep 17 00:00:00 2001 From: "m.wachsmuth" <m.wachsmuth@MWACHSMUTH.aditosoftware.local> Date: Fri, 15 Jan 2021 11:50:56 +0100 Subject: [PATCH] html editor for doc templates added (only Text Modular) --- .../DocumentTemplate_entity.aod | 2 ++ .../entityfields/htmleditor/stateProcess.js | 10 ++++++++++ .../recordcontainers/db/onDBUpdate.js | 4 ++++ 3 files changed, 16 insertions(+) create mode 100644 entity/DocumentTemplate_entity/entityfields/htmleditor/stateProcess.js diff --git a/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod b/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod index 5893b3f206..7df6fd04c0 100644 --- a/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod +++ b/entity/DocumentTemplate_entity/DocumentTemplate_entity.aod @@ -358,6 +358,8 @@ <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> diff --git a/entity/DocumentTemplate_entity/entityfields/htmleditor/stateProcess.js b/entity/DocumentTemplate_entity/entityfields/htmleditor/stateProcess.js new file mode 100644 index 0000000000..e067a0a7fe --- /dev/null +++ b/entity/DocumentTemplate_entity/entityfields/htmleditor/stateProcess.js @@ -0,0 +1,10 @@ +import("KeywordRegistry_basic"); +import("system.result"); +import("system.vars"); +import("DocumentTemplate_lib"); +import("system.neon"); + +var template = DocumentTemplateUtils.getTemplate(vars.get("$field.DOCUMENTTEMPLATEID"), false) + +if(template.type == DocumentTemplate.types.HTML && vars.get("$field.KIND") == $KeywordRegistry.documentTemplateType$textModular()) + result.string(neon.COMPONENTSTATE_EDITABLE); diff --git a/entity/DocumentTemplate_entity/recordcontainers/db/onDBUpdate.js b/entity/DocumentTemplate_entity/recordcontainers/db/onDBUpdate.js index a3311749b1..3f68f4ee7c 100644 --- a/entity/DocumentTemplate_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/DocumentTemplate_entity/recordcontainers/db/onDBUpdate.js @@ -1,3 +1,4 @@ +import("system.logging"); import("Workflow_lib"); import("DocumentTemplate_lib"); import("system.vars"); @@ -10,4 +11,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 -- GitLab