Skip to content
Snippets Groups Projects
Commit e3360104 authored by Markus Escher's avatar Markus Escher
Browse files

add content/insert processes for Document_entity

add dummy downloadFilesAction for Document_entity
parent 25802f42
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,10 @@
<fields>
<element>UID</element>
<element>FILENAME</element>
<element>UPLOAD</element>
<element>FILESIZE</element>
<element>EDIT_DATE</element>
<element>PREVIEW</element>
<element>FILETYPE</element>
</fields>
<contentProcess>%aditoprj%/entity/Document_entity/contentProcess.js</contentProcess>
<onInsert>%aditoprj%/entity/Document_entity/onInsert.js</onInsert>
......@@ -27,19 +30,23 @@
<entityField>
<name>TYPE</name>
<title>Dateityp</title>
<fieldName>FILETYPE</fieldName>
</entityField>
<entityField>
<name>SIZE</name>
<title>Dateigröße</title>
<fieldName>FILESIZE</fieldName>
</entityField>
<entityField>
<name>DATE_NEW</name>
<name>DATE_EDIT</name>
<title>Datum</title>
<fieldName>EDIT_DATE</fieldName>
<contentType>DATE</contentType>
</entityField>
<entityField>
<name>PREVIEW</name>
<title>Vorschau</title>
<fieldName>PREVIEW</fieldName>
<contentType>IMAGE</contentType>
<state>READONLY</state>
</entityField>
......@@ -58,16 +65,16 @@
<entityField>
<name>BINDATA_UPLOAD</name>
<title>Datei</title>
<fieldName>UPLOAD</fieldName>
<contentType>FILE</contentType>
<defaultAction>%aditoprj%/entity/Document_entity/entityfields/bindata_upload/defaultAction.js</defaultAction>
</entityField>
<entityActionGroup>
<name>myActions</name>
<name>Document_actions</name>
<children>
<entityActionField>
<name>downloadAction</name>
<name>downloadFilesAction</name>
<fieldType>ACTION</fieldType>
<onActionProcess>%aditoprj%/entity/Document_entity/entityfields/document_actions/children/downloadfilesaction/onActionProcess.js</onActionProcess>
<iconId>VAADIN:DOWNLOAD</iconId>
</entityActionField>
</children>
......
......@@ -12,6 +12,14 @@ if(vars.exists("$param.AssignmentTable_param") &&
var assignmentRowId = vars.get("$param.AssignmentRowId_param");
var alias = db.getCurrentAlias();
//logging.log("contentProcess -> table: " + assignmentTable + " name: " + assignmentName + " id: " + assignmentRowId);
//logging.log(db.getBinaryMetadata(assignmentTable, assignmentName, assignmentRowId, false, alias));
var tab = [];
metadata = db.getBinaryMetadata(assignmentTable, assignmentName, assignmentRowId, false, alias);
// going through the metadata and push the data into the result array. get the bindata via db.getBinaryContent()
for( var i = 0; i < metadata.length; i++)
{
tab.push( [metadata[i].id, metadata[i].filename, metadata[i].size, metadata[i].edit, metadata[i].preview, metadata[i].mimetype]);
}
result.object(tab);
}
import("system.result");
import("system.db");
import("system.logging");
import("system.vars");
//logging.log(db.getBinaryContent(vars.get("$local.idvalue"), null));
\ No newline at end of file
......@@ -9,5 +9,4 @@ var bindata = vars.get("$field.BINDATA_UPLOAD");
var filename = vars.get("$field.NAME");
var alias = db.getCurrentAlias();
//logging.log("onInsert -> table: " + assignmentTable + " name: " + assignmentName + " id: " + assignmentRowId + " filename: " + filename);
//db.insertBinary(assignmentTable, assignmentName, assignmentRowId, "", bindata, filename, "", "", alias);
db.insertBinary(assignmentTable, assignmentName, assignmentRowId, "", bindata, filename, "", "", alias);
......@@ -11,7 +11,7 @@
<children>
<tableViewTemplate>
<name>Table_template</name>
<favoriteActionGroup1>myActions</favoriteActionGroup1>
<favoriteActionGroup1>Document_actions</favoriteActionGroup1>
<entityField>#ENTITY</entityField>
<columns>
<neonTableColumn>
......@@ -34,7 +34,7 @@
</neonTableColumn>
<neonTableColumn>
<name>a533d8a1-ae5e-434d-8254-415586af26ed</name>
<entityField>DATE_NEW</entityField>
<entityField>DATE_EDIT</entityField>
<width v="75" />
<expandRatio v="100" />
</neonTableColumn>
......
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