diff --git a/entity/WorkflowDefinition_entity/WorkflowDefinition_entity.aod b/entity/WorkflowDefinition_entity/WorkflowDefinition_entity.aod index 3b6b3359efe599531f86467c81b4bae920961e6c..b37be8dac2d596c1adc7b1e025cc76be1f9cbb46 100644 --- a/entity/WorkflowDefinition_entity/WorkflowDefinition_entity.aod +++ b/entity/WorkflowDefinition_entity/WorkflowDefinition_entity.aod @@ -42,6 +42,7 @@ <title>Active</title> <contentType>BOOLEAN</contentType> <dropDownProcess>%aditoprj%/entity/WorkflowDefinition_entity/entityfields/isactive/dropDownProcess.js</dropDownProcess> + <stateProcess>%aditoprj%/entity/WorkflowDefinition_entity/entityfields/isactive/stateProcess.js</stateProcess> </entityField> <entityField> <name>FILEUPLOAD</name> @@ -66,6 +67,7 @@ <name>KEY</name> <title>Key</title> <mandatory v="true" /> + <stateProcess>%aditoprj%/entity/WorkflowDefinition_entity/entityfields/key/stateProcess.js</stateProcess> <valueProcess>%aditoprj%/entity/WorkflowDefinition_entity/entityfields/key/valueProcess.js</valueProcess> </entityField> <entityField> diff --git a/entity/WorkflowDefinition_entity/entityfields/diagram/valueProcess.js b/entity/WorkflowDefinition_entity/entityfields/diagram/valueProcess.js index 4ce7a3f7fca4a214d2bc64f51e25a0d988b57825..732cf42d0b882149fc1e4dad9234383106637c06 100644 --- a/entity/WorkflowDefinition_entity/entityfields/diagram/valueProcess.js +++ b/entity/WorkflowDefinition_entity/entityfields/diagram/valueProcess.js @@ -3,5 +3,5 @@ import("system.result"); import("system.neon"); import("system.workflow"); -if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET && vars.get("$sys.recordstate") == neon.OPERATINGSTATE_VIEW) +if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET && vars.get("$sys.recordstate") == neon.OPERATINGSTATE_VIEW && vars.get("$field.VERSION")) result.string(workflow.getProcessDiagram(vars.get("$field.UID"))); \ No newline at end of file diff --git a/entity/WorkflowDefinition_entity/entityfields/isactive/stateProcess.js b/entity/WorkflowDefinition_entity/entityfields/isactive/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..a107fbe3110e55edc5779cb64799aed9f20afce7 --- /dev/null +++ b/entity/WorkflowDefinition_entity/entityfields/isactive/stateProcess.js @@ -0,0 +1,8 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) + result.string(neon.COMPONENTSTATE_INVISIBLE); +else + result.string(neon.COMPONENTSTATE_AUTO); \ No newline at end of file diff --git a/entity/WorkflowDefinition_entity/entityfields/key/stateProcess.js b/entity/WorkflowDefinition_entity/entityfields/key/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..b24d4beb6d917a46a5b9b0e4187f5b51a79a4768 --- /dev/null +++ b/entity/WorkflowDefinition_entity/entityfields/key/stateProcess.js @@ -0,0 +1,8 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) + result.string(neon.COMPONENTSTATE_AUTO); +else + result.string(neon.COMPONENTSTATE_READONLY); \ No newline at end of file diff --git a/entity/WorkflowDefinition_entity/recordcontainers/jdito/onUpdate.js b/entity/WorkflowDefinition_entity/recordcontainers/jdito/onUpdate.js index 23cf24a9afc3929332e325e886188762ceae6fdd..612fa49109ea606288ad2418e8bb7f9ce9f57316 100644 --- a/entity/WorkflowDefinition_entity/recordcontainers/jdito/onUpdate.js +++ b/entity/WorkflowDefinition_entity/recordcontainers/jdito/onUpdate.js @@ -1,5 +1,10 @@ import("system.vars"); import("system.workflow"); -if (vars.get("$local.changed")) var rowdata = vars.get("$local.rowdata"); + +vars.get("$local.changed").forEach(function (field) +{ + if (field == "ISACTIVE.value") + workflow.setProcessActive(rowdata["UID.value"], rowdata["ISACTIVE.value"] == "true"); +}); \ No newline at end of file diff --git a/neonView/WorkflowDefinitionEdit_view/WorkflowDefinitionEdit_view.aod b/neonView/WorkflowDefinitionEdit_view/WorkflowDefinitionEdit_view.aod index eacb4831a7bd733fc462226aac148bbb17d95cba..a9cdf16d3e37602e0fc821ded4dcdaefc1d01ead 100644 --- a/neonView/WorkflowDefinitionEdit_view/WorkflowDefinitionEdit_view.aod +++ b/neonView/WorkflowDefinitionEdit_view/WorkflowDefinitionEdit_view.aod @@ -2,6 +2,7 @@ <neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.2"> <name>WorkflowDefinitionEdit_view</name> <majorModelMode>DISTRIBUTED</majorModelMode> + <isSmall v="true" /> <layout> <boxLayout> <name>layout</name> @@ -21,6 +22,10 @@ <name>88c2c956-966a-4ad9-b744-ccb729b024bc</name> <entityField>KEY</entityField> </entityFieldLink> + <entityFieldLink> + <name>14bd4671-d876-430e-8574-277118395ff0</name> + <entityField>ISACTIVE</entityField> + </entityFieldLink> </fields> </genericViewTemplate> </children> diff --git a/process/ViewTemplateData_lib/ViewTemplateData_lib.aod b/process/ViewTemplateData_lib/ViewTemplateData_lib.aod new file mode 100644 index 0000000000000000000000000000000000000000..5bb454846588aa47368b0a1b4dcba63e3540fb71 --- /dev/null +++ b/process/ViewTemplateData_lib/ViewTemplateData_lib.aod @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.1"> + <name>ViewTemplateData_lib</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <process>%aditoprj%/process/ViewTemplateData_lib/process.js</process> + <variants> + <element>LIBRARY</element> + </variants> +</process> diff --git a/process/ViewTemplateData_lib/process.js b/process/ViewTemplateData_lib/process.js new file mode 100644 index 0000000000000000000000000000000000000000..0343fcb2078c0b2f52f5ebaf0c73ebb17dfe2f4f --- /dev/null +++ b/process/ViewTemplateData_lib/process.js @@ -0,0 +1,45 @@ + +/** + * Object to make the creation of a JSON for the Dynamic Form component simpler + * + * @param {String} [pFormDefinition] an already existing form JSON as string + */ +function DynamicFormDefinition (pFormDefinition) +{ + if (pFormDefinition) + this.fields = JSON.parse(pFormDefinition) + else + this.fields = []; +} + +DynamicFormDefinition.prototype.addField = function (pId, pName, pContentType, pMandatory, pReadOnly, pIsReadable) +{ + //TODO: check if id is unique + this.fields.push({ + id : pId, + name : pName, + contentType : pContentType || "TEXT", + isReadable : pIsReadable || true, + isWritable : !pReadOnly, + isRequired : pMandatory || false + }); + return this; +} + +DynamicFormDefinition.prototype.removeField = function (pId) +{ + for (let i = 0, l = this.fields.length; i < l; i++) + { + if (this.fields[i].id == pId) + { + this.fields.splice(i, 1); + return this; + } + } + return this; +} + +DynamicFormDefinition.prototype.toString = function () +{ + return JSON.stringify(this.fields); +}