From 0f4117ba3c58b581dc492cd12ca720d868c533a4 Mon Sep 17 00:00:00 2001 From: "d.buechler" <d.buechler@adito.de> Date: Fri, 31 May 2019 16:57:37 +0200 Subject: [PATCH] =?UTF-8?q?Umbau=20des=20CampaignPlanning=5Fentity.aod=20a?= =?UTF-8?q?uf=20einen=20JditoRecordContainer=20Anpassung=20des=20CampaignP?= =?UTF-8?q?lanning=5Fentity.aod=20darauf,=20dass=20die=20korrekten=20Previ?= =?UTF-8?q?es=20angezeigt=20werden=20Anpassung,=20dass=20beim=20neuen=20Er?= =?UTF-8?q?stellen=20einer=20Stufe=20in=20der=20KampagnenPlanung=20die=20K?= =?UTF-8?q?ampagnenId=20immer=20mitgegeben=20wird=20Einf=C3=BCgen=20eines?= =?UTF-8?q?=20Flags=20das=20steuert,=20ob=20Root-Elemente=20im=20Gantt=20a?= =?UTF-8?q?ls=20normaler=20Step=20oder=20als=20Gruppierungselement=20behan?= =?UTF-8?q?delt=20werden=20sollen=20Vorbereitung=20auf=20L=C3=B6schen=20vo?= =?UTF-8?q?n=20Kampagne=20und=20Stufe=20im=20CampaignPlanning=5Fentity.aod?= =?UTF-8?q?,=20Funktionen=20in=20der=20Campaign=5Flib=20m=C3=BCssen=20noch?= =?UTF-8?q?=20erstellt=20werden.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CampaignPlanning_entity.aod | 43 +++++++++++----- .../onActionProcess.js | 3 +- .../onActionProcess.js | 1 - .../jditorecordcontainer/contentProcess.js | 50 +++++++++++++++++++ .../jditorecordcontainer/onDelete.js | 14 ++++++ .../CampaignStep_entity.aod | 5 ++ .../CampaignPlanning_view.aod | 9 ++-- .../CampaignStepsGantt_view.aod | 1 + process/Campaign_lib/process.js | 30 +++++++++++ 9 files changed, 136 insertions(+), 20 deletions(-) create mode 100644 entity/CampaignPlanning_entity/recordcontainers/jditorecordcontainer/contentProcess.js create mode 100644 entity/CampaignPlanning_entity/recordcontainers/jditorecordcontainer/onDelete.js diff --git a/entity/CampaignPlanning_entity/CampaignPlanning_entity.aod b/entity/CampaignPlanning_entity/CampaignPlanning_entity.aod index 0624c47031..52fbf465a3 100644 --- a/entity/CampaignPlanning_entity/CampaignPlanning_entity.aod +++ b/entity/CampaignPlanning_entity/CampaignPlanning_entity.aod @@ -1,13 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> -<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.5" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.5"> +<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.6" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.6"> <name>CampaignPlanning_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> <icon>NEON:GROUP_APPOINTMENT</icon> <title>Campaign planning</title> - <recordContainer>recordContainer</recordContainer> + <recordContainer>jditoRecordContainer</recordContainer> <entityFields> <entityProvider> <name>#PROVIDER</name> + <targetContextField>targetContext</targetContextField> + <targetIdField>UID</targetIdField> </entityProvider> <entityField> <name>DATE_START</name> @@ -19,10 +21,6 @@ <title>End date</title> <contentType>DATE</contentType> </entityField> - <entityField> - <name>STEP_NAME</name> - <title>Step name</title> - </entityField> <entityField> <name>STEP_DESCRIPTION</name> <searchable v="false" /> @@ -41,10 +39,6 @@ <title>Campaign</title> <searchable v="false" /> </entityField> - <entityField> - <name>CAMPAIGN_NAME</name> - <title>Campaign name</title> - </entityField> <entityActionGroup> <name>NewGanttEntries</name> <title>New module</title> @@ -52,20 +46,29 @@ <children> <entityActionField> <name>CreateNewCampaign_action</name> - <fieldType>ACTION</fieldType> <title>New campaign</title> <onActionProcess>%aditoprj%/entity/CampaignPlanning_entity/entityfields/newganttentries/children/createnewcampaign_action/onActionProcess.js</onActionProcess> <iconId>NEON:GROUP_APPOINTMENT</iconId> </entityActionField> <entityActionField> <name>CreateNewCampaignStep_action</name> - <fieldType>ACTION</fieldType> <title>New campaign step</title> <onActionProcess>%aditoprj%/entity/CampaignPlanning_entity/entityfields/newganttentries/children/createnewcampaignstep_action/onActionProcess.js</onActionProcess> <iconId>NEON:GROUP_APPOINTMENT</iconId> </entityActionField> </children> </entityActionGroup> + <entityField> + <name>targetContext</name> + <valueProcess>%aditoprj%/entity/CampaignPlanning_entity/entityfields/targetcontext/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>UID</name> + <title>UID</title> + </entityField> + <entityField> + <name>NAME</name> + </entityField> </entityFields> <recordContainers> <dbRecordContainer> @@ -124,5 +127,21 @@ </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> + <jDitoRecordContainer> + <name>jditoRecordContainer</name> + <jDitoRecordAlias>Data_alias</jDitoRecordAlias> + <contentProcess>%aditoprj%/entity/CampaignPlanning_entity/recordcontainers/jditorecordcontainer/contentProcess.js</contentProcess> + <onDelete>%aditoprj%/entity/CampaignPlanning_entity/recordcontainers/jditorecordcontainer/onDelete.js</onDelete> + <recordFields> + <element>UID.value</element> + <element>NAME.value</element> + <element>PREDECESSOR_STEP_ID.value</element> + <element>STEP_DESCRIPTION.value</element> + <element>DATE_START.value</element> + <element>DATE_END.value</element> + <element>CAMPAIGN_ID.value</element> + <element>targetContext.value</element> + </recordFields> + </jDitoRecordContainer> </recordContainers> </entity> diff --git a/entity/CampaignPlanning_entity/entityfields/newganttentries/children/createnewcampaign_action/onActionProcess.js b/entity/CampaignPlanning_entity/entityfields/newganttentries/children/createnewcampaign_action/onActionProcess.js index c86624e8f1..1d729c6ebc 100644 --- a/entity/CampaignPlanning_entity/entityfields/newganttentries/children/createnewcampaign_action/onActionProcess.js +++ b/entity/CampaignPlanning_entity/entityfields/newganttentries/children/createnewcampaign_action/onActionProcess.js @@ -2,5 +2,4 @@ import("system.neon"); import("system.vars"); import("Campaign_lib"); -CampaignUtils.openNewCampaignView(); -neon.refreshAll(); \ No newline at end of file +CampaignUtils.openNewCampaignView(); \ No newline at end of file diff --git a/entity/CampaignPlanning_entity/entityfields/newganttentries/children/createnewcampaignstep_action/onActionProcess.js b/entity/CampaignPlanning_entity/entityfields/newganttentries/children/createnewcampaignstep_action/onActionProcess.js index 5dd446c499..0d0e9d95f8 100644 --- a/entity/CampaignPlanning_entity/entityfields/newganttentries/children/createnewcampaignstep_action/onActionProcess.js +++ b/entity/CampaignPlanning_entity/entityfields/newganttentries/children/createnewcampaignstep_action/onActionProcess.js @@ -1,6 +1,5 @@ import("Campaign_lib"); import("system.vars"); -import("system.logging"); var campaignId = ""; var selectedElement = vars.get("$sys.selectionRows"); diff --git a/entity/CampaignPlanning_entity/recordcontainers/jditorecordcontainer/contentProcess.js b/entity/CampaignPlanning_entity/recordcontainers/jditorecordcontainer/contentProcess.js new file mode 100644 index 0000000000..737946e069 --- /dev/null +++ b/entity/CampaignPlanning_entity/recordcontainers/jditorecordcontainer/contentProcess.js @@ -0,0 +1,50 @@ +import("system.util"); +import("system.db"); +import("system.result"); +import("system.vars"); + +var UID = 0; +var CAMPAIGNNAME = 1; +var PREDECESSORSTEP_ID = 2; +var CAMPAIGNID = 6; +var TARGET_CONTEXT_ROOT_ELEMENT = "Campaign"; +var TARGET_CONTEXT_ELEMENT = "CampaignStep"; + +var resultRay = []; + +var campaignsQuery = "select CAMPAIGNID, CAMPAIGN.\"NAME\"" + + "from CAMPAIGN "; +var stepsQuery = "select CAMPAIGNSTEPID, CAMPAIGNSTEP.\"NAME\", CAMPAIGNSTEP.PREDECESSORSTEP_ID," + + " CAMPAIGNSTEP.DESCRIPTION, CAMPAIGNSTEP.DATE_START, CAMPAIGNSTEP.DATE_END, CAMPAIGNID" + + " from CAMPAIGN" + + " join CAMPAIGNSTEP on CAMPAIGN.CAMPAIGNID = CAMPAIGNSTEP.CAMPAIGN_ID order by SORTING" + +var campaignsRows = db.table(campaignsQuery); +var stepsRows = db.table(stepsQuery); + +//First add all Campaign Rows to the resultRay. These are the Root Rows in the Treetable +for (var campaignRowIndex in campaignsRows) +{ + let campaignRow = campaignsRows[campaignRowIndex]; + + resultRay.push([campaignRow[UID], campaignRow[CAMPAIGNNAME], null, null, null, null, campaignRow[UID], TARGET_CONTEXT_ROOT_ELEMENT]); +} + +/* + * Then, add all CampaignStep Rows. If a StepRow has no Predecessor it has to be connected to the + * respective CampaignRow which is at the Root Level. The target context gets added at the end of + * the array. + */ +for (var currentRowIndex in stepsRows) +{ + let currentRow = stepsRows[currentRowIndex]; + + if(currentRow[PREDECESSORSTEP_ID] == "") + currentRow[PREDECESSORSTEP_ID] = currentRow[CAMPAIGNID]; + + //Add the TargetContext + currentRow.splice(currentRow.length, 0, TARGET_CONTEXT_ELEMENT); + resultRay.push(currentRow); +} + +result.object(resultRay); \ No newline at end of file diff --git a/entity/CampaignPlanning_entity/recordcontainers/jditorecordcontainer/onDelete.js b/entity/CampaignPlanning_entity/recordcontainers/jditorecordcontainer/onDelete.js new file mode 100644 index 0000000000..46044ffba2 --- /dev/null +++ b/entity/CampaignPlanning_entity/recordcontainers/jditorecordcontainer/onDelete.js @@ -0,0 +1,14 @@ +import("system.vars"); +import("system.logging"); +import("Campaign_lib"); + +logging.log(" in onDelete -> "); +var selectedRows = vars.get("$sys.selectionRows"); + +if(selectedElement.length > 0) +{ + if(selectedElement[0].targetContext == "CampaignStep") + CampaignUtils.deleteCampaignStepData(selectedElement[0].UID); + else + CampaignUtils.deleteCampaignData(selectedElement[0].UID); +} \ No newline at end of file diff --git a/entity/CampaignStep_entity/CampaignStep_entity.aod b/entity/CampaignStep_entity/CampaignStep_entity.aod index 14b05a45e0..4f8be6f71c 100644 --- a/entity/CampaignStep_entity/CampaignStep_entity.aod +++ b/entity/CampaignStep_entity/CampaignStep_entity.aod @@ -316,6 +316,11 @@ <textInputAllowed v="true" /> <stateProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/predecessorstep_id/stateProcess.js</stateProcess> <displayValueProcess>%aditoprj%/entity/CampaignStep_entity/entityfields/predecessorstep_id/displayValueProcess.js</displayValueProcess> + <onValueChangeTypes> + <element>MASK</element> + <element>PROCESS</element> + <element>PROCESS_SETVALUE</element> + </onValueChangeTypes> </entityField> <entityConsumer> <name>CampaignStepsConsumer</name> diff --git a/neonView/CampaignPlanning_view/CampaignPlanning_view.aod b/neonView/CampaignPlanning_view/CampaignPlanning_view.aod index 43ae6ca764..966eb76f9c 100644 --- a/neonView/CampaignPlanning_view/CampaignPlanning_view.aod +++ b/neonView/CampaignPlanning_view/CampaignPlanning_view.aod @@ -14,16 +14,15 @@ <name>CampaignPlanningGantt</name> <beginDateField>DATE_START</beginDateField> <endDateField>DATE_END</endDateField> - <titleField>STEP_NAME</titleField> + <titleField>NAME</titleField> <descriptionField>STEP_DESCRIPTION</descriptionField> - <uidField>STEP_ID</uidField> + <uidField>UID</uidField> <stepPredecessorIdField>PREDECESSOR_STEP_ID</stepPredecessorIdField> - <groupedProjectIdField>CAMPAIGN_ID</groupedProjectIdField> - <groupedProjectNameField>CAMPAIGN_NAME</groupedProjectNameField> + <displayRootElementsAsGroupHeaders v="true" /> <favoriteActionGroup2>NewGanttEntries</favoriteActionGroup2> <entityField>#ENTITY</entityField> <isCreatable v="true" /> - <isEditable v="true" /> + <isEditable v="false" /> <isDeletable v="true" /> <title></title> </ganttViewTemplate> diff --git a/neonView/CampaignStepsGantt_view/CampaignStepsGantt_view.aod b/neonView/CampaignStepsGantt_view/CampaignStepsGantt_view.aod index b6e103d92b..d544715e4d 100644 --- a/neonView/CampaignStepsGantt_view/CampaignStepsGantt_view.aod +++ b/neonView/CampaignStepsGantt_view/CampaignStepsGantt_view.aod @@ -17,6 +17,7 @@ <descriptionField>DESCRIPTION</descriptionField> <uidField>CAMPAIGNSTEPID</uidField> <stepPredecessorIdField>PREDECESSORSTEP_ID</stepPredecessorIdField> + <displayRootElementsAsGroupHeaders v="false" /> <entityField>#ENTITY</entityField> <isCreatable v="true" /> <isEditable v="true" /> diff --git a/process/Campaign_lib/process.js b/process/Campaign_lib/process.js index f8766e7d75..8d8530ede4 100644 --- a/process/Campaign_lib/process.js +++ b/process/Campaign_lib/process.js @@ -226,6 +226,36 @@ CampaignUtils.getMaxParticipantsValidationMessage = function() return translate.text("The max participants count has to be equal or greater than the count of the current participants!"); } +/** + * todo + */ +CampaignUtils.deleteCampaignStepData = function(pCampaignStepId) +{ + //todo + /* + * delete: + * step + * reference to step in other steps + * all log entries regarding this step + * all participants in this step + * all costs in this step + */ +} + +/** + * todo + */ +CampaignUtils.deleteCampaignData = function(pCampaignId) +{ + //todo + /* + * delete: + * steps with function deleteCampaignStepData + * all members + * campaign itself + */ +} + /** * Methods for campaignmanagement. * Do not create an instance of this! -- GitLab