diff --git a/entity/CampaignPlanning_entity/CampaignPlanning_entity.aod b/entity/CampaignPlanning_entity/CampaignPlanning_entity.aod index 0624c4703139c9a74f227f381e6ceb8dc36508c1..52fbf465a3cc3069c408cb716e640b734f75185a 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 c86624e8f18617d55f794c599e4050c8974d8762..1d729c6ebc94b4b59d1268207544ab1ea687932f 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 5dd446c4996cc3e40cd9c8d48b4759a8f0e72fd0..0d0e9d95f8d920c9a9bb526af88f45b5a4e65fa4 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 0000000000000000000000000000000000000000..737946e0696b69ba103881e97d54428362a2cfbc --- /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 0000000000000000000000000000000000000000..46044ffba23011130b613d9b6322b619afb041f2 --- /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 14b05a45e02541eb162828018b46eeddb8d4e55a..4f8be6f71cf5d11a019ff93676e643aae4da8afc 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 43ae6ca764c045f2cfe6dcbdc08fa0db4a3026ba..966eb76f9ce2eeaf3aa626da1f5a6fc13adf479c 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 b6e103d92b40352e919ef61a6b41289668caa112..d544715e4d08a2e6e8e8adb4f3b1a021c15a3984 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 f8766e7d75c700a381217e6df0cd572c0becf0f5..8d8530ede44fac3a4a8600d62b24a690e67d90d5 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!