diff --git a/entity/BulkMail_entity/BulkMail_entity.aod b/entity/BulkMail_entity/BulkMail_entity.aod index 380476f5e8dd97eb310dae80556407832e8157f7..2bf806ce64f7f02d83b78866932dfde3a72812c7 100644 --- a/entity/BulkMail_entity/BulkMail_entity.aod +++ b/entity/BulkMail_entity/BulkMail_entity.aod @@ -139,7 +139,6 @@ <title>Content</title> <contentType>HTML</contentType> <contentTypeProcess>%aditoprj%/entity/BulkMail_entity/entityfields/content/contentTypeProcess.js</contentTypeProcess> - <state>EDITABLE</state> <stateProcess>%aditoprj%/entity/BulkMail_entity/entityfields/content/stateProcess.js</stateProcess> <valueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/content/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/content/displayValueProcess.js</displayValueProcess> @@ -254,6 +253,13 @@ <contentType>HTML</contentType> <valueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/preview/valueProcess.js</valueProcess> </entityField> + <entityField> + <name>viewmode_preview</name> + <description></description> + <contentType>HTML</contentType> + <stateProcess>%aditoprj%/entity/BulkMail_entity/entityfields/viewmode_preview/stateProcess.js</stateProcess> + <valueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/viewmode_preview/valueProcess.js</valueProcess> + </entityField> </entityFields> <recordContainers> <dbRecordContainer> diff --git a/entity/BulkMail_entity/entityfields/content/contentTypeProcess.js b/entity/BulkMail_entity/entityfields/content/contentTypeProcess.js index be637432e44adb2b27d2769ac4964849439e40b9..49308df2f63a8fe57518af58217c92ea93baac4f 100644 --- a/entity/BulkMail_entity/entityfields/content/contentTypeProcess.js +++ b/entity/BulkMail_entity/entityfields/content/contentTypeProcess.js @@ -5,6 +5,6 @@ import("Document_lib"); import("system.vars"); import("DocumentTemplate_lib"); -result.string(vars.get("$context.currentTemplateType") == DocumentTemplate.types.TXT && (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +result.string(vars.get("$context.currentTemplateType") == DocumentTemplate.types.TXT ? "LONG_TEXT" : "HTML"); \ No newline at end of file diff --git a/entity/BulkMail_entity/entityfields/content/stateProcess.js b/entity/BulkMail_entity/entityfields/content/stateProcess.js index 237d5230c079ee05a93f0912552006defdd2d06b..6a645963978013538e99c39255fbdaa3d23f56bc 100644 --- a/entity/BulkMail_entity/entityfields/content/stateProcess.js +++ b/entity/BulkMail_entity/entityfields/content/stateProcess.js @@ -10,12 +10,12 @@ if (vars.get("$sys.recordstate") != neon.OPERATINGSTATE_VIEW && { result.string(neon.COMPONENTSTATE_INVISIBLE); } -// in view mode disable for eml -else if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_VIEW && - (vars.get("$context.currentTemplateType") == DocumentTemplate.types.EML - // in view mode also disable for html to work around missing image-support for the html-editor - || vars.get("$context.currentTemplateType") == DocumentTemplate.types.HTML)) +// in view mode disable, show preview instead: directly after save (in edit view) the state is changed to OPERATINGSTATE_VIEW and this triggers the initionalisation of the html editor (if it is visible) +// For EML-files or other large files this is very bad, as the editor needs a very long time to initialize +else if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_VIEW) +{ result.string(neon.COMPONENTSTATE_INVISIBLE); +} else { result.string(neon.COMPONENTSTATE_EDITABLE); diff --git a/entity/BulkMail_entity/entityfields/content/valueProcess.js b/entity/BulkMail_entity/entityfields/content/valueProcess.js index ec9c8eda42491c7062914f777ed079808fc1a7c2..90841e809f0b43e8b09c8c0955350da0f7e3a121 100644 --- a/entity/BulkMail_entity/entityfields/content/valueProcess.js +++ b/entity/BulkMail_entity/entityfields/content/valueProcess.js @@ -3,12 +3,15 @@ import("Document_lib"); import("system.result"); import("system.vars"); import("system.db"); +import("system.util"); import("DocumentTemplate_lib"); import("Bulkmail_lib"); if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET && vars.get("$this.value") == null) { - [content, type] = DocumentTemplateUtils.getTemplateContent(vars.get("$field.DOCUMENTTEMPLATE_ID"), new FileUpload(vars.get("$field.bindata"))); + var template = BulkMailUtils.getBulkMailTemplate(vars.get("$field.BULKMAILID"), vars.get("$field.DOCUMENTTEMPLATE_ID"), false, new FileUpload(vars.get("$field.bindata"))) + var content = util.decodeBase64String(template.content); + var type = template.type; vars.set("$context.currentTemplateType", type); result.string(content); } diff --git a/entity/BulkMail_entity/entityfields/downloadtemplate/onActionProcess.js b/entity/BulkMail_entity/entityfields/downloadtemplate/onActionProcess.js index 518d384f3239345ec1115b58dd2afbd42a10d57e..a7f47f75610b7aa2ae551c1cb1c92c94ff220807 100644 --- a/entity/BulkMail_entity/entityfields/downloadtemplate/onActionProcess.js +++ b/entity/BulkMail_entity/entityfields/downloadtemplate/onActionProcess.js @@ -1,7 +1,7 @@ +import("Bulkmail_lib"); import("system.neon"); import("system.vars"); -import("DocumentTemplate_lib"); -var template = DocumentTemplate.loadTemplate(vars.get("$field.DOCUMENTTEMPLATE_ID"), undefined, false); -if (template.type) +var template = BulkMailUtils.getBulkMailTemplate(vars.get("$field.BULKMAILID"), vars.get("$field.DOCUMENTTEMPLATE_ID"), false) +if (template.content) neon.download(template.content, template.filename); \ No newline at end of file diff --git a/entity/BulkMail_entity/entityfields/viewmode_preview/stateProcess.js b/entity/BulkMail_entity/entityfields/viewmode_preview/stateProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7bd814b3e19067118cc2c861ea05b8795a9b6271 --- /dev/null +++ b/entity/BulkMail_entity/entityfields/viewmode_preview/stateProcess.js @@ -0,0 +1,12 @@ +import("system.neon"); +import("system.result"); +import("system.vars"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_VIEW) +{ + result.string(neon.COMPONENTSTATE_EDITABLE); +} +else +{ + result.string(neon.COMPONENTSTATE_INVISIBLE); +} \ No newline at end of file diff --git a/entity/BulkMail_entity/entityfields/viewmode_preview/valueProcess.js b/entity/BulkMail_entity/entityfields/viewmode_preview/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..b6f23f8b682648fedf229c2a3ac7002c5eaf0816 --- /dev/null +++ b/entity/BulkMail_entity/entityfields/viewmode_preview/valueProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string("VIEW" + vars.get("$field.content.displayValue")); \ No newline at end of file diff --git a/neonView/BulkMailContent_view/BulkMailContent_view.aod b/neonView/BulkMailContent_view/BulkMailContent_view.aod index 06a0bc7b789a9e24b71be96c619ef3d9e41445ff..a4aed1aa56551c6f8c7f85a06892e43e3ff5edba 100644 --- a/neonView/BulkMailContent_view/BulkMailContent_view.aod +++ b/neonView/BulkMailContent_view/BulkMailContent_view.aod @@ -36,8 +36,8 @@ <entityField>content</entityField> </entityFieldLink> <entityFieldLink> - <name>5ae4212f-4107-447e-af57-9ab60fb8075a</name> - <entityField>preview</entityField> + <name>3843d183-f2ed-4cc3-9202-e2414e0fb594</name> + <entityField>viewmode_preview</entityField> </entityFieldLink> </fields> </genericViewTemplate> diff --git a/process/DocumentTemplate_lib/process.js b/process/DocumentTemplate_lib/process.js index dc06c40dfbef06c5fe998b81d6ecdc75aed54382..b7f8dcdccc27b29b8523ec87308a3db641fbff33 100644 --- a/process/DocumentTemplate_lib/process.js +++ b/process/DocumentTemplate_lib/process.js @@ -139,7 +139,7 @@ DocumentTemplate.prototype.getAttachments = function () { var attachmentIds = db.array(db.COLUMN, SqlCondition.begin() .andPrepare("DOCUMENTTEMPLATELINK.DOCUMENTTEMPLATE_ID_PARENT", this.templateId) - .buildSql("select DOCUMENTTEMPLATE_ID_CHILD from DOCUMENTTEMPLATELINK")) + .buildSql("select DOCUMENTTEMPLATE_ID_CHILD from DOCUMENTTEMPLATELINK")); this._attachmentCache = attachmentIds.map(function(pAttachmentId) {