Skip to content
Snippets Groups Projects
Commit 9a30c8d4 authored by S.Listl's avatar S.Listl
Browse files

WorkflowDefinition open after new

parent 2255d875
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,7 @@
</entityProvider>
<entityField>
<name>UID</name>
<valueProcess>%aditoprj%/entity/WorkflowDefinition_entity/entityfields/uid/valueProcess.js</valueProcess>
</entityField>
<entityActionGroup>
<name>tableActions</name>
......@@ -47,6 +48,7 @@
</entityField>
<entityField>
<name>FILEUPLOAD</name>
<title>BPMN</title>
<contentType>FILE</contentType>
<onValidation>%aditoprj%/entity/WorkflowDefinition_entity/entityfields/fileupload/onValidation.js</onValidation>
</entityField>
......@@ -68,7 +70,8 @@
<name>KEY</name>
<title>Key</title>
<mandatory v="true" />
<stateProcess>%aditoprj%/entity/WorkflowDefinition_entity/entityfields/key/stateProcess.js</stateProcess>
<state>READONLY</state>
<valueProcess>%aditoprj%/entity/WorkflowDefinition_entity/entityfields/key/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>VERSION</name>
......
......@@ -4,7 +4,7 @@ import("system.vars");
import("Document_lib");
import("MimeType_lib");
var mimetype = DocumentUtil.getMimeTypeFromUpload(vars.get("$local.value"));
var upload = new FileUpload(vars.get("$local.value"));
if (mimetype != MimeTypes.XML())
if (upload.mimeType != MimeTypes.XML())
result.string(translate.text("The file must be a XML"));
\ No newline at end of file
import("system.neon");
import("system.result");
import("system.vars");
import("Document_lib");
import("MimeType_lib");
import("system.workflow");
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW)
{
var upload = new FileUpload(vars.get("$field.FILEUPLOAD"));
if (upload.isFilled() && upload.mimeType == MimeTypes.XML())
{
var ids = workflow.getProcessIds(upload.getBase64DecodedData());
if (ids != null)
result.string(JSON.parse(ids)[0]);
}
}
\ No newline at end of file
import("system.result");
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
if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$field.KEY"))
result.string(vars.get("$field.KEY"));
\ No newline at end of file
......@@ -8,16 +8,25 @@ import("JditoFilter_lib");
var workflowKey = vars.get("$param.ProcessDefinitionKey_param");
var excludeVersion = vars.get("$param.CurrentVersion_param");
var context = vars.get("$param.Context_param");
var idvalues = vars.get("$local.idvalues");
var loadConfig = workflow.createConfigForLoadingProcessDefinitions();
var workflowDefs;
if (vars.get("$local.idvalues"))
loadConfig.processDefinitionIds(vars.get("$local.idvalues"));
else if (workflowKey)
loadConfig.processDefinitionKey(workflowKey);
var workflowDefs = JSON.parse(workflow.getProcessDefinitions(loadConfig));
if (idvalues)
{
var loadConfig = workflow.createConfigForLoadingProcessDefinitions()
.processDefinitionIds(idvalues);
workflowDefs = JSON.parse(workflow.getProcessDefinitions(loadConfig));
//after new-mode, the given uid is not the actual id, but the key, so if
//no workflow definitions were found, try it again with the key
if (workflowDefs.length === 0)
workflowDefs = _getDefinitionsByKey(idvalues[0]);
}
else
{
workflowDefs = _getDefinitionsByKey(workflowKey);
}
//structure = {processDefinitionKey : highest_version}
var newestVersions = {};
......@@ -71,4 +80,12 @@ workflowDefs = workflowDefs.filter(filterFn);
workflowDefs = JditoFilterUtils.filterRecords(["UID", "NAME", "CATEGORY", "KEY", "VERSION", "ISACTIVE"], workflowDefs, vars.get("$local.filter").filter);
result.object(workflowDefs);
\ No newline at end of file
result.object(workflowDefs);
function _getDefinitionsByKey (pKey)
{
var config = workflow.createConfigForLoadingProcessDefinitions();
if (pKey)
config.processDefinitionKey(pKey);
return JSON.parse(workflow.getProcessDefinitions(config));
}
\ No newline at end of file
import("system.util");
import("system.translate");
import("system.result");
import("system.db");
......@@ -179,4 +180,12 @@ FileUpload.prototype.isFilled = function ()
//this conversion is not really nescessary (e. g. in an if it wouldn't make a difference),
//but it is more logical to return a 'real' boolean here
return Boolean(this.filename || this.bindata);
}
/**
* @return {String} the bindata, base64-decoded
*/
FileUpload.prototype.getBase64DecodedData = function ()
{
return util.decodeBase64String(this.bindata);
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment