diff --git a/entity/TopicTree_entity/TopicTree_entity.aod b/entity/TopicTree_entity/TopicTree_entity.aod index a1f57a287242fa31a59c821b2ea0f24869d45e27..7c8c12832377b99735c6b18438212dc1edd74412 100644 --- a/entity/TopicTree_entity/TopicTree_entity.aod +++ b/entity/TopicTree_entity/TopicTree_entity.aod @@ -7,6 +7,7 @@ <grantDeleteProcess>%aditoprj%/entity/TopicTree_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/TopicTree_entity/contentTitleProcess.js</contentTitleProcess> <iconId>VAADIN:TREE_TABLE</iconId> + <recordsRecipeSupported v="true" /> <recordContainer>jdito</recordContainer> <entityFields> <entityProvider> @@ -104,6 +105,7 @@ <title>First</title> <onActionProcess>%aditoprj%/entity/TopicTree_entity/entityfields/more/children/first/onActionProcess.js</onActionProcess> <isObjectAction v="false" /> + <selectionType>MULTI</selectionType> <iconId>VAADIN:ANGLE_DOUBLE_UP</iconId> <stateProcess>%aditoprj%/entity/TopicTree_entity/entityfields/more/children/first/stateProcess.js</stateProcess> </entityActionField> @@ -112,6 +114,7 @@ <title>Move Up</title> <onActionProcess>%aditoprj%/entity/TopicTree_entity/entityfields/more/children/moveup/onActionProcess.js</onActionProcess> <isObjectAction v="false" /> + <selectionType>MULTI</selectionType> <iconId>VAADIN:ANGLE_UP</iconId> <stateProcess>%aditoprj%/entity/TopicTree_entity/entityfields/more/children/moveup/stateProcess.js</stateProcess> </entityActionField> @@ -120,6 +123,7 @@ <title>Move Down</title> <onActionProcess>%aditoprj%/entity/TopicTree_entity/entityfields/more/children/movedown/onActionProcess.js</onActionProcess> <isObjectAction v="false" /> + <selectionType>MULTI</selectionType> <iconId>VAADIN:ANGLE_DOWN</iconId> <stateProcess>%aditoprj%/entity/TopicTree_entity/entityfields/more/children/movedown/stateProcess.js</stateProcess> </entityActionField> @@ -128,6 +132,7 @@ <title>Last</title> <onActionProcess>%aditoprj%/entity/TopicTree_entity/entityfields/more/children/last/onActionProcess.js</onActionProcess> <isObjectAction v="false" /> + <selectionType>MULTI</selectionType> <iconId>VAADIN:ANGLE_DOUBLE_DOWN</iconId> <stateProcess>%aditoprj%/entity/TopicTree_entity/entityfields/more/children/last/stateProcess.js</stateProcess> </entityActionField> @@ -135,13 +140,14 @@ <name>copy</name> <title>Copy</title> <onActionProcess>%aditoprj%/entity/TopicTree_entity/entityfields/more/children/copy/onActionProcess.js</onActionProcess> + <selectionType>MULTI</selectionType> <iconId>VAADIN:COPY</iconId> - <stateProcess>%aditoprj%/entity/TopicTree_entity/entityfields/more/children/copy/stateProcess.js</stateProcess> </entityActionField> <entityActionField> <name>paste</name> <title>Paste</title> <onActionProcess>%aditoprj%/entity/TopicTree_entity/entityfields/more/children/paste/onActionProcess.js</onActionProcess> + <selectionType>MULTI</selectionType> <iconId>VAADIN:PASTE</iconId> <stateProcess>%aditoprj%/entity/TopicTree_entity/entityfields/more/children/paste/stateProcess.js</stateProcess> </entityActionField> @@ -149,6 +155,7 @@ <name>pasteAsTopTopic</name> <title>Paste as Top Topic</title> <onActionProcess>%aditoprj%/entity/TopicTree_entity/entityfields/more/children/pasteastoptopic/onActionProcess.js</onActionProcess> + <selectionType>MULTI</selectionType> <iconId>VAADIN:PASTE</iconId> <stateProcess>%aditoprj%/entity/TopicTree_entity/entityfields/more/children/pasteastoptopic/stateProcess.js</stateProcess> </entityActionField> @@ -156,6 +163,7 @@ <name>cut</name> <title>Cut</title> <onActionProcess>%aditoprj%/entity/TopicTree_entity/entityfields/more/children/cut/onActionProcess.js</onActionProcess> + <selectionType>MULTI</selectionType> <iconId>VAADIN:SCISSORS</iconId> <stateProcess>%aditoprj%/entity/TopicTree_entity/entityfields/more/children/cut/stateProcess.js</stateProcess> </entityActionField> diff --git a/entity/TopicTree_entity/entityfields/createexpand/children/createchildtopic/onActionProcess.js b/entity/TopicTree_entity/entityfields/createexpand/children/createchildtopic/onActionProcess.js index 6e11443e9dda8a886c5a8585b8fd195a78c058d5..8412c62f4711a775f8ddb22f4750656da64256d6 100644 --- a/entity/TopicTree_entity/entityfields/createexpand/children/createchildtopic/onActionProcess.js +++ b/entity/TopicTree_entity/entityfields/createexpand/children/createchildtopic/onActionProcess.js @@ -6,8 +6,7 @@ import("Attribute_lib"); var params = {}; if (vars.exists("$sys.selection")) { - var row = vars.get("$sys.selection"); - var topicTreeId = row[0]; + var topicTreeId = vars.get("$field.TOPICTREEID"); params["AssignedToId_param"] = topicTreeId; } neon.openContextWithRecipe("TopicTree", "TopicTreeEdit_view", neonFilter.createEntityRecordsRecipeBuilder().parameters(params).toString(), neon.OPERATINGSTATE_NEW); \ No newline at end of file diff --git a/entity/TopicTree_entity/entityfields/createexpand/children/createchildtopic/stateProcess.js b/entity/TopicTree_entity/entityfields/createexpand/children/createchildtopic/stateProcess.js index 0e259b3b846e565b0793a70b3fb37cd1a53515d4..2a720a7a63ae74539c9ea4f907fbc6ab53973b75 100644 --- a/entity/TopicTree_entity/entityfields/createexpand/children/createchildtopic/stateProcess.js +++ b/entity/TopicTree_entity/entityfields/createexpand/children/createchildtopic/stateProcess.js @@ -1,3 +1,4 @@ +import("Util_lib"); import("system.result"); import("system.eMath"); import("system.neon"); @@ -8,10 +9,10 @@ var state = neon.COMPONENTSTATE_DISABLED; if(operatingState != neon.OPERATINGSTATE_NEW && operatingState != neon.OPERATINGSTATE_EDIT) { - var selection = vars.get("$sys.selectionRows")[0]; - if(selection && selection.sortingHelper != "") + var selection = vars.get("$sys.selectionsRecordsRecipe"); + if(selection && JSON.parse(selection)["uidsIncludelist"][0] && Utils.isNotNullOrEmptyString(vars.get("$field.sortingHelper"))) { - var sortingObj = JSON.parse(selection.sortingHelper); + var sortingObj = JSON.parse(vars.get("$field.sortingHelper")); var layer = sortingObj.sortingLayer; if(layer != "SORTING_LAYER_6") { diff --git a/entity/TopicTree_entity/entityfields/more/children/copy/onActionProcess.js b/entity/TopicTree_entity/entityfields/more/children/copy/onActionProcess.js index 04b811522dd2345d2ed9a5804b39af8e1eed7479..e52ea430b4aeed3d00ad9faaa70fc53e8e07edbc 100644 --- a/entity/TopicTree_entity/entityfields/more/children/copy/onActionProcess.js +++ b/entity/TopicTree_entity/entityfields/more/children/copy/onActionProcess.js @@ -1,7 +1,24 @@ import("TopicTree_lib"); import("system.vars"); -var topicDatSet = vars.get("$sys.selectionRows")[0]; +var topicDatSet = {}; +topicDatSet["ACTIVE"] = vars.get("$field.ACTIVE"); +topicDatSet["ASSIGNEDTO"] = vars.get("$field.ASSIGNEDTO"); +topicDatSet["DATE_EDIT"] = vars.get("$field.DATE_EDIT"); +topicDatSet["DATE_NEW"] = vars.get("$field.DATE_NEW"); +topicDatSet["SORTING_LAYER_1"] = vars.get("$field.SORTING_LAYER_1"); +topicDatSet["SORTING_LAYER_2"] = vars.get("$field.SORTING_LAYER_2"); +topicDatSet["SORTING_LAYER_3"] = vars.get("$field.SORTING_LAYER_3"); +topicDatSet["SORTING_LAYER_4"] = vars.get("$field.SORTING_LAYER_4"); +topicDatSet["SORTING_LAYER_5"] = vars.get("$field.SORTING_LAYER_5"); +topicDatSet["SORTING_LAYER_6"] = vars.get("$field.SORTING_LAYER_6"); +topicDatSet["TOPIC"] = vars.get("$field.TOPIC"); +topicDatSet["DESCRIPTION"] = vars.get("$field.DESCRIPTION"); +topicDatSet["TOPICTREEID"] = vars.get("$field.TOPICTREEID"); +topicDatSet["#UID"] = vars.get("$field.UID"); +topicDatSet["USER_EDIT"] = vars.get("$field.USER_EDIT"); +topicDatSet["USER_NEW"] = vars.get("$field.USER_NEW"); +topicDatSet["sortingHelper"] = vars.get("$field.sortingHelper"); vars.set("$context.HasToBeCut", false); vars.set("$context.Copied", JSON.stringify({dataset: topicDatSet diff --git a/entity/TopicTree_entity/entityfields/more/children/copy/stateProcess.js b/entity/TopicTree_entity/entityfields/more/children/copy/stateProcess.js deleted file mode 100644 index 3f81b4f375b84c14050bdfc7577055d5b20216e8..0000000000000000000000000000000000000000 --- a/entity/TopicTree_entity/entityfields/more/children/copy/stateProcess.js +++ /dev/null @@ -1,12 +0,0 @@ -import("system.db"); -import("system.neon"); -import("system.result"); -import("system.vars"); - -var selection = vars.get("$sys.selectionRows")[0]; -var state = neon.COMPONENTSTATE_DISABLED; -if(selection) -{ - state = neon.COMPONENTSTATE_EDITABLE; -} -result.string(state); \ No newline at end of file diff --git a/entity/TopicTree_entity/entityfields/more/children/cut/onActionProcess.js b/entity/TopicTree_entity/entityfields/more/children/cut/onActionProcess.js index 0de3d45cd47a69ec2c21c7667178f5540f52ae6f..aa044d1eed03eb687910f30234bfc54636fc741e 100644 --- a/entity/TopicTree_entity/entityfields/more/children/cut/onActionProcess.js +++ b/entity/TopicTree_entity/entityfields/more/children/cut/onActionProcess.js @@ -1,7 +1,23 @@ import("TopicTree_lib"); import("system.vars"); -var topicDatSet = vars.get("$sys.selectionRows")[0]; +var topicDatSet = {}; +topicDatSet["ACTIVE"] = vars.get("$field.ACTIVE"); +topicDatSet["ASSIGNEDTO"] = vars.get("$field.ASSIGNEDTO"); +topicDatSet["DATE_EDIT"] = vars.get("$field.DATE_EDIT"); +topicDatSet["DATE_NEW"] = vars.get("$field.DATE_NEW"); +topicDatSet["SORTING_LAYER_1"] = vars.get("$field.SORTING_LAYER_1"); +topicDatSet["SORTING_LAYER_2"] = vars.get("$field.SORTING_LAYER_2"); +topicDatSet["SORTING_LAYER_3"] = vars.get("$field.SORTING_LAYER_3"); +topicDatSet["SORTING_LAYER_4"] = vars.get("$field.SORTING_LAYER_4"); +topicDatSet["SORTING_LAYER_5"] = vars.get("$field.SORTING_LAYER_5"); +topicDatSet["SORTING_LAYER_6"] = vars.get("$field.SORTING_LAYER_6"); +topicDatSet["TOPIC"] = vars.get("$field.TOPIC"); +topicDatSet["TOPICTREEID"] = vars.get("$field.TOPICTREEID"); +topicDatSet["#UID"] = vars.get("$field.UID"); +topicDatSet["USER_EDIT"] = vars.get("$field.USER_EDIT"); +topicDatSet["USER_NEW"] = vars.get("$field.USER_NEW"); +topicDatSet["sortingHelper"] = vars.get("$field.sortingHelper"); vars.set("$context.Copied", JSON.stringify({dataset: topicDatSet , amountOfLayers: TopicTreeUtils.getAmountOfLayers(topicDatSet)})); diff --git a/entity/TopicTree_entity/entityfields/more/children/cut/stateProcess.js b/entity/TopicTree_entity/entityfields/more/children/cut/stateProcess.js index da1b7324b98030e890d11a91b7cfc7a470ae77de..89f86e7d116f89b87b1801a56c981ff7f8e88786 100644 --- a/entity/TopicTree_entity/entityfields/more/children/cut/stateProcess.js +++ b/entity/TopicTree_entity/entityfields/more/children/cut/stateProcess.js @@ -1,14 +1,32 @@ +import("Util_lib"); import("system.neon"); import("system.result"); import("Sql_lib"); import("TopicTree_lib"); import("system.vars"); -var selection = vars.get("$sys.selectionRows"); +var selection = vars.get("$sys.selectionsRecordsRecipe"); var state = neon.COMPONENTSTATE_DISABLED; -if(selection && selection.length > 0) +if(selection && !Utils.isNullOrEmpty(selection[0])) { - var topicDatSet = selection[0]; + var topicDatSet = {}; + topicDatSet["ACTIVE"] = vars.get("$field.ACTIVE"); + topicDatSet["ASSIGNEDTO"] = vars.get("$field.ASSIGNEDTO"); + topicDatSet["DATE_EDIT"] = vars.get("$field.DATE_EDIT"); + topicDatSet["DATE_NEW"] = vars.get("$field.DATE_NEW"); + topicDatSet["SORTING_LAYER_1"] = vars.get("$field.SORTING_LAYER_1"); + topicDatSet["SORTING_LAYER_2"] = vars.get("$field.SORTING_LAYER_2"); + topicDatSet["SORTING_LAYER_3"] = vars.get("$field.SORTING_LAYER_3"); + topicDatSet["SORTING_LAYER_4"] = vars.get("$field.SORTING_LAYER_4"); + topicDatSet["SORTING_LAYER_5"] = vars.get("$field.SORTING_LAYER_5"); + topicDatSet["SORTING_LAYER_6"] = vars.get("$field.SORTING_LAYER_6"); + topicDatSet["TOPIC"] = vars.get("$field.TOPIC"); + topicDatSet["TOPICTREEID"] = vars.get("$field.TOPICTREEID"); + topicDatSet["#UID"] = vars.get("$field.UID"); + topicDatSet["USER_EDIT"] = vars.get("$field.USER_EDIT"); + topicDatSet["USER_NEW"] = vars.get("$field.USER_NEW"); + topicDatSet["sortingHelper"] = vars.get("$field.sortingHelper"); + var topicIds = TopicTreeUtils.getSubTopicIds(topicDatSet); var count = 0; diff --git a/entity/TopicTree_entity/entityfields/more/children/first/onActionProcess.js b/entity/TopicTree_entity/entityfields/more/children/first/onActionProcess.js index 328ca8c9be6d35e44604c2cecfc8c137d4f331a0..ea59797c078d3c393fd4deafa427de37a46bc68c 100644 --- a/entity/TopicTree_entity/entityfields/more/children/first/onActionProcess.js +++ b/entity/TopicTree_entity/entityfields/more/children/first/onActionProcess.js @@ -2,11 +2,10 @@ import("system.neon"); import("TopicTree_lib"); import("system.vars"); -var selection = vars.get("$sys.selectionRows")[0]; -var topicTreeid = selection["#UID"]; -var sortingHelper = JSON.parse(selection.sortingHelper); -var currentLayer = TopicTreeUtils.getLayer(selection.SORTING_LAYER_1, selection.SORTING_LAYER_2, selection.SORTING_LAYER_3, selection.SORTING_LAYER_4, selection.SORTING_LAYER_5, selection.SORTING_LAYER_6); -var assignedTo = selection.ASSIGNEDTO == "" ? $TopicTreeConstants.TOPTOPIC() : selection.ASSIGNEDTO; +var topicTreeid = vars.get("$field.UID"); +var sortingHelper = JSON.parse(vars.get("$field.sortingHelper")); +var currentLayer = TopicTreeUtils.getLayer(vars.get("$field.SORTING_LAYER_1"), vars.get("$field.SORTING_LAYER_2"), vars.get("$field.SORTING_LAYER_3"), vars.get("$field.SORTING_LAYER_4"), vars.get("$field.SORTING_LAYER_5"), vars.get("$field.SORTING_LAYER_6")); +var assignedTo = vars.get("$field.ASSIGNEDTO") == "" ? $TopicTreeConstants.TOPTOPIC() : vars.get("$field.ASSIGNEDTO"); TopicTreeUtils.movePosition(topicTreeid, $TopicTreeMoveDirections.TOP(), sortingHelper.maxSortingValue, assignedTo, sortingHelper.ownSortingValue, currentLayer); neon.refreshAll(); \ No newline at end of file diff --git a/entity/TopicTree_entity/entityfields/more/children/first/stateProcess.js b/entity/TopicTree_entity/entityfields/more/children/first/stateProcess.js index 1a90e3c289a1d561f6959c35adef58380815ab50..ba9a2d08fdd217b67f5b8d2f79edb435537ae527 100644 --- a/entity/TopicTree_entity/entityfields/more/children/first/stateProcess.js +++ b/entity/TopicTree_entity/entityfields/more/children/first/stateProcess.js @@ -1,3 +1,4 @@ +import("Util_lib"); import("system.result"); import("system.eMath"); import("system.neon"); @@ -7,10 +8,10 @@ var operatingState = vars.get("$sys.operatingstate"); var state = neon.COMPONENTSTATE_DISABLED; if(operatingState != neon.OPERATINGSTATE_NEW && operatingState != neon.OPERATINGSTATE_EDIT) { - var selection = vars.get("$sys.selectionRows")[0]; - if(selection && selection.sortingHelper != "") + var selection = vars.get("$sys.selectionsRecordsRecipe"); + if(selection && JSON.parse(selection)["uidsIncludelist"][0] && Utils.isNotNullOrEmptyString(vars.get("$field.sortingHelper"))) { - var sortingObj = JSON.parse(selection.sortingHelper); + var sortingObj = JSON.parse(vars.get("$field.sortingHelper")); var ownSortingValue = sortingObj.ownSortingValue; if(ownSortingValue != 1) { diff --git a/entity/TopicTree_entity/entityfields/more/children/last/onActionProcess.js b/entity/TopicTree_entity/entityfields/more/children/last/onActionProcess.js index bb26a0d1dc66b815e53da2d5b26d61755918f8c7..44691e40d5fc7201f895ba168b4de99e5e7bf43c 100644 --- a/entity/TopicTree_entity/entityfields/more/children/last/onActionProcess.js +++ b/entity/TopicTree_entity/entityfields/more/children/last/onActionProcess.js @@ -2,11 +2,10 @@ import("system.neon"); import("TopicTree_lib"); import("system.vars"); -var selection = vars.get("$sys.selectionRows")[0]; -var topicTreeid = selection["#UID"]; -var sortingHelper = JSON.parse(selection.sortingHelper); -var currentLayer = TopicTreeUtils.getLayer(selection.SORTING_LAYER_1, selection.SORTING_LAYER_2, selection.SORTING_LAYER_3, selection.SORTING_LAYER_4, selection.SORTING_LAYER_5, selection.SORTING_LAYER_6); -var assignedTo = selection.ASSIGNEDTO == "" ? $TopicTreeConstants.TOPTOPIC() : selection.ASSIGNEDTO; +var topicTreeid = vars.get("$field.UID"); +var sortingHelper = JSON.parse(vars.get("$field.sortingHelper")); +var currentLayer = TopicTreeUtils.getLayer(vars.get("$field.SORTING_LAYER_1"), vars.get("$field.SORTING_LAYER_2"), vars.get("$field.SORTING_LAYER_3"), vars.get("$field.SORTING_LAYER_4"), vars.get("$field.SORTING_LAYER_5"), vars.get("$field.SORTING_LAYER_6")); +var assignedTo = vars.get("$field.ASSIGNEDTO") == "" ? $TopicTreeConstants.TOPTOPIC() : vars.get("$field.ASSIGNEDTO"); TopicTreeUtils.movePosition(topicTreeid, $TopicTreeMoveDirections.BOTTOM(), sortingHelper.maxSortingValue, assignedTo, sortingHelper.ownSortingValue, currentLayer); neon.refreshAll(); \ No newline at end of file diff --git a/entity/TopicTree_entity/entityfields/more/children/last/stateProcess.js b/entity/TopicTree_entity/entityfields/more/children/last/stateProcess.js index b0e5ad3ee6202c8d7ff8d87f57046373570a60c6..8ce0611a7677702383f48477565fd8a8508ac73d 100644 --- a/entity/TopicTree_entity/entityfields/more/children/last/stateProcess.js +++ b/entity/TopicTree_entity/entityfields/more/children/last/stateProcess.js @@ -1,3 +1,4 @@ +import("Util_lib"); import("system.result"); import("system.eMath"); import("system.neon"); @@ -8,10 +9,10 @@ var state = neon.COMPONENTSTATE_DISABLED; if(operatingState != neon.OPERATINGSTATE_NEW && operatingState != neon.OPERATINGSTATE_EDIT) { - var selection = vars.get("$sys.selectionRows")[0]; - if(selection && selection.sortingHelper != "") + var selection = vars.get("$sys.selectionsRecordsRecipe"); + if(selection && JSON.parse(selection)["uidsIncludelist"][0] && Utils.isNotNullOrEmptyString(vars.get("$field.sortingHelper"))) { - var sortingObj = JSON.parse(selection.sortingHelper); + var sortingObj = JSON.parse(vars.get("$field.sortingHelper")); var maxSorting = sortingObj.maxSortingValue; var ownSortingValue = sortingObj.ownSortingValue; if(eMath.addInt(ownSortingValue, 1) <= maxSorting) diff --git a/entity/TopicTree_entity/entityfields/more/children/movedown/onActionProcess.js b/entity/TopicTree_entity/entityfields/more/children/movedown/onActionProcess.js index cf3eac3f952dd7fd3aeeb3f9602680e61789caad..ce04d4afde09e23cc7e2cb793ab0f57294623270 100644 --- a/entity/TopicTree_entity/entityfields/more/children/movedown/onActionProcess.js +++ b/entity/TopicTree_entity/entityfields/more/children/movedown/onActionProcess.js @@ -2,11 +2,10 @@ import("system.neon"); import("TopicTree_lib"); import("system.vars"); -var selection = vars.get("$sys.selectionRows")[0]; -var topicTreeid = selection["#UID"]; -var sortingHelper = JSON.parse(selection.sortingHelper); -var currentLayer = TopicTreeUtils.getLayer(selection.SORTING_LAYER_1, selection.SORTING_LAYER_2, selection.SORTING_LAYER_3, selection.SORTING_LAYER_4, selection.SORTING_LAYER_5, selection.SORTING_LAYER_6); -var assignedTo = selection.ASSIGNEDTO == "" ? $TopicTreeConstants.TOPTOPIC() : selection.ASSIGNEDTO; +var topicTreeid = vars.get("$field.UID"); +var sortingHelper = JSON.parse(vars.get("$field.sortingHelper")); +var currentLayer = TopicTreeUtils.getLayer(vars.get("$field.SORTING_LAYER_1"), vars.get("$field.SORTING_LAYER_2"), vars.get("$field.SORTING_LAYER_3"), vars.get("$field.SORTING_LAYER_4"), vars.get("$field.SORTING_LAYER_5"), vars.get("$field.SORTING_LAYER_6")); +var assignedTo = vars.get("$field.ASSIGNEDTO") == "" ? $TopicTreeConstants.TOPTOPIC() : vars.get("$field.ASSIGNEDTO"); TopicTreeUtils.movePosition(topicTreeid, $TopicTreeMoveDirections.DOWN(), sortingHelper.maxSortingValue, assignedTo, sortingHelper.ownSortingValue, currentLayer); neon.refreshAll(); \ No newline at end of file diff --git a/entity/TopicTree_entity/entityfields/more/children/movedown/stateProcess.js b/entity/TopicTree_entity/entityfields/more/children/movedown/stateProcess.js index b0e5ad3ee6202c8d7ff8d87f57046373570a60c6..8ce0611a7677702383f48477565fd8a8508ac73d 100644 --- a/entity/TopicTree_entity/entityfields/more/children/movedown/stateProcess.js +++ b/entity/TopicTree_entity/entityfields/more/children/movedown/stateProcess.js @@ -1,3 +1,4 @@ +import("Util_lib"); import("system.result"); import("system.eMath"); import("system.neon"); @@ -8,10 +9,10 @@ var state = neon.COMPONENTSTATE_DISABLED; if(operatingState != neon.OPERATINGSTATE_NEW && operatingState != neon.OPERATINGSTATE_EDIT) { - var selection = vars.get("$sys.selectionRows")[0]; - if(selection && selection.sortingHelper != "") + var selection = vars.get("$sys.selectionsRecordsRecipe"); + if(selection && JSON.parse(selection)["uidsIncludelist"][0] && Utils.isNotNullOrEmptyString(vars.get("$field.sortingHelper"))) { - var sortingObj = JSON.parse(selection.sortingHelper); + var sortingObj = JSON.parse(vars.get("$field.sortingHelper")); var maxSorting = sortingObj.maxSortingValue; var ownSortingValue = sortingObj.ownSortingValue; if(eMath.addInt(ownSortingValue, 1) <= maxSorting) diff --git a/entity/TopicTree_entity/entityfields/more/children/moveup/onActionProcess.js b/entity/TopicTree_entity/entityfields/more/children/moveup/onActionProcess.js index 681a3bf3fc485a4acc07910702c796b4243736e7..cb36836948f3b8d586981cb1ec26fee53ee3e995 100644 --- a/entity/TopicTree_entity/entityfields/more/children/moveup/onActionProcess.js +++ b/entity/TopicTree_entity/entityfields/more/children/moveup/onActionProcess.js @@ -2,11 +2,10 @@ import("system.neon"); import("TopicTree_lib"); import("system.vars"); -var selection = vars.get("$sys.selectionRows")[0]; -var topicTreeid = selection["#UID"]; -var sortingHelper = JSON.parse(selection.sortingHelper); -var currentLayer = TopicTreeUtils.getLayer(selection.SORTING_LAYER_1, selection.SORTING_LAYER_2, selection.SORTING_LAYER_3, selection.SORTING_LAYER_4, selection.SORTING_LAYER_5, selection.SORTING_LAYER_6); -var assignedTo = selection.ASSIGNEDTO == "" ? $TopicTreeConstants.TOPTOPIC() : selection.ASSIGNEDTO; +var topicTreeid = vars.get("$field.UID"); +var sortingHelper = JSON.parse(vars.get("$field.sortingHelper")); +var currentLayer = TopicTreeUtils.getLayer(vars.get("$field.SORTING_LAYER_1"), vars.get("$field.SORTING_LAYER_2"), vars.get("$field.SORTING_LAYER_3"), vars.get("$field.SORTING_LAYER_4"), vars.get("$field.SORTING_LAYER_5"), vars.get("$field.SORTING_LAYER_6")); +var assignedTo = vars.get("$field.ASSIGNEDTO") == "" ? $TopicTreeConstants.TOPTOPIC() : vars.get("$field.ASSIGNEDTO"); TopicTreeUtils.movePosition(topicTreeid, $TopicTreeMoveDirections.UP(), sortingHelper.maxSortingValue, assignedTo, sortingHelper.ownSortingValue, currentLayer); neon.refreshAll(); \ No newline at end of file diff --git a/entity/TopicTree_entity/entityfields/more/children/moveup/stateProcess.js b/entity/TopicTree_entity/entityfields/more/children/moveup/stateProcess.js index c9a5b7f7c30ab18ec91fcb66f666b578229cbeba..6bdcb5e368813e12533d9375511d67ba6c0a18f8 100644 --- a/entity/TopicTree_entity/entityfields/more/children/moveup/stateProcess.js +++ b/entity/TopicTree_entity/entityfields/more/children/moveup/stateProcess.js @@ -1,3 +1,4 @@ +import("Util_lib"); import("system.result"); import("system.eMath"); import("system.neon"); @@ -8,10 +9,10 @@ var state = neon.COMPONENTSTATE_DISABLED; if(operatingState != neon.OPERATINGSTATE_NEW && operatingState != neon.OPERATINGSTATE_EDIT) { - var selection = vars.get("$sys.selectionRows")[0]; - if(selection && selection.sortingHelper != "") + var selection = vars.get("$sys.selectionsRecordsRecipe"); + if(selection && JSON.parse(selection)["uidsIncludelist"][0] && Utils.isNotNullOrEmptyString(vars.get("$field.sortingHelper"))) { - var sortingObj = JSON.parse(selection.sortingHelper); + var sortingObj = JSON.parse(vars.get("$field.sortingHelper")); var ownSortingValue = sortingObj.ownSortingValue; if(ownSortingValue != 1) { diff --git a/entity/TopicTree_entity/entityfields/more/children/paste/stateProcess.js b/entity/TopicTree_entity/entityfields/more/children/paste/stateProcess.js index b3d1749a90e97dfa9eb17f2796232285e65dd2b6..e08bc5a1e1ca539141ac55e80792846a7fa3bef7 100644 --- a/entity/TopicTree_entity/entityfields/more/children/paste/stateProcess.js +++ b/entity/TopicTree_entity/entityfields/more/children/paste/stateProcess.js @@ -1,3 +1,4 @@ +import("Sql_lib"); import("system.eMath"); import("TopicTree_lib"); import("system.db"); @@ -7,9 +8,9 @@ import("system.vars"); var selection = vars.get("$sys.selectionRows")[0]; var state = neon.COMPONENTSTATE_DISABLED; -if(selection && vars.exists("$context.Copied")) +if(vars.get("$sys.selectionsRecordsRecipe") && JSON.parse(vars.get("$sys.selectionsRecordsRecipe")) && vars.exists("$context.Copied")) { - var layer = TopicTreeUtils.returnNumberOfLayerName(JSON.parse(selection["sortingHelper"])["sortingLayer"]); + var layer = TopicTreeUtils.returnNumberOfLayerName(JSON.parse(vars.get("$field.sortingHelper"))["sortingLayer"]); var amountOfLayers = JSON.parse(vars.get("$context.Copied"))["amountOfLayers"]; if(eMath.addInt(amountOfLayers, layer) <= TopicTreeUtils.getArrayLayers().length)//this tree doesn't work endlessly, so we can*t allow the user to create more layers than we allow @@ -19,7 +20,7 @@ if(selection && vars.exists("$context.Copied")) var copiedTopicTreeId = JSON.parse(vars.get("$context.Copied"))["dataset"]; var topicTreeIds = TopicTreeUtils.getSubTopicIds(copiedTopicTreeId); topicTreeIds.push(copiedTopicTreeId); - var pasteTopicTreeId = selection["#UID"]; + var pasteTopicTreeId = vars.get("$field.UID"); if(!topicTreeIds.includes(pasteTopicTreeId)) { state = neon.COMPONENTSTATE_EDITABLE; diff --git a/process/TopicTree_lib/process.js b/process/TopicTree_lib/process.js index cc46b867ed55675a04cafacd39721b2ce6ab962b..3c0d5cb685a64d25c69369fd4c884e12ebb93cdb 100644 --- a/process/TopicTree_lib/process.js +++ b/process/TopicTree_lib/process.js @@ -421,7 +421,7 @@ TopicTreeUtils.returnNumberOfLayerName = function(pLayerName) /* * Returns the amount of layers<br> * So basically how deep this topic is from pTopicTreeDataset to the deepest one - * @param {String} pTopicTreeDataset as returned by vars.get("$sys.selectionRows")[0]; + * @param {Object} pTopicTreeDataset; * * @return {Number} Number of layers (e.g: when topLayer = SORTING_LAYER_2 and the deepest subtopic is SORTING_LAYER_5 --> "4" (4layers: 2, 3, 4, 5) */ @@ -818,15 +818,14 @@ TopicTreeUtils.paste = function (pIsTopTopic) var pLayerDeeper = "SORTING_LAYER_2"; var cond = newWhere("TOPICTREE.ASSIGNEDTO is null"); if(!pIsTopTopic) - { - var paste = vars.get("$sys.selectionRows")[0]; //paste data - var pTopicTreeId = paste["#UID"]; - var pSorting_Layer_1 = paste.SORTING_LAYER_1; - var pSorting_Layer_2 = paste.SORTING_LAYER_2; - var pSorting_Layer_3 = paste.SORTING_LAYER_3; - var pSorting_Layer_4 = paste.SORTING_LAYER_4; - var pSorting_Layer_5 = paste.SORTING_LAYER_5; - var pSorting_Layer_6 = paste.SORTING_LAYER_6; + { + var pTopicTreeId = vars.get("$field.UID"); + var pSorting_Layer_1 = vars.get("$field.SORTING_LAYER_1"); + var pSorting_Layer_2 = vars.get("$field.SORTING_LAYER_2"); + var pSorting_Layer_3 = vars.get("$field.SORTING_LAYER_3"); + var pSorting_Layer_4 = vars.get("$field.SORTING_LAYER_4"); + var pSorting_Layer_5 = vars.get("$field.SORTING_LAYER_5"); + var pSorting_Layer_6 = vars.get("$field.SORTING_LAYER_6"); pLayer = TopicTreeUtils.getLayer(pSorting_Layer_1, pSorting_Layer_2, pSorting_Layer_3, pSorting_Layer_4, pSorting_Layer_5, pSorting_Layer_6); pLayerDeeper = TopicTreeUtils.getDeeperLayer(pSorting_Layer_1, pSorting_Layer_2, pSorting_Layer_3, pSorting_Layer_4, pSorting_Layer_5, pSorting_Layer_6); cond = newWhere("TOPICTREE.ASSIGNEDTO", pTopicTreeId); @@ -853,8 +852,7 @@ TopicTreeUtils.paste = function (pIsTopTopic) , "ACTIVE" , pLayer , "USER_NEW" - , "DATE_NEW" - , "ASSIGNEDTO"]; + , "DATE_NEW"]; var uid = isCut == true ? cTopicTreeId : util.getNewUUID();//new uuid is old uuid if cut, since we "move" the topic instead of copying var values = [uid @@ -863,10 +861,14 @@ TopicTreeUtils.paste = function (pIsTopTopic) , cActive , eMath.addInt(maxSortingOneLayerDeeper, 1) , vars.get("$sys.user") - , vars.get("$sys.date") - , pTopicTreeId]; - + , vars.get("$sys.date")]; + + if(!pIsTopTopic) + { + columns.push("ASSIGNEDTO"); + values.push(pTopicTreeId); + } if(isCut) { _updateSortingValuesOfOtherTopics(cLayer, cOwnSortingValue, cAssignedTo); @@ -886,7 +888,7 @@ TopicTreeUtils.paste = function (pIsTopTopic) //update child topics accordingly while(stop == false) { - topicTreeDatasets = newSelect(["TOPICTREE.TOPICTREEID" + var topicTreeDatasets = newSelect(["TOPICTREE.TOPICTREEID" , TopicTreeUtils.relevantSortingValueCaseWhen() + " as sortingValue" , TopicTreeUtils.layerNameCaseWhen() , "TOPICTREE.TOPIC" @@ -911,13 +913,12 @@ TopicTreeUtils.paste = function (pIsTopTopic) topicTreeIds.push(subTopicId); topicTreeIdsToUpdate.push(subTopicId); - subColumns = ["TOPICTREEID" + var subColumns = ["TOPICTREEID" , "TOPIC" , "DESCRIPTION" , "ACTIVE" , "USER_NEW" , "DATE_NEW" - , "ASSIGNEDTO" , subTopicRelevantSortingLayer];//relevant sorting value var newSubUid if(isCut == true) @@ -930,15 +931,20 @@ TopicTreeUtils.paste = function (pIsTopTopic) newSubUid = util.getNewUUID(); } oldToNewIdHelperObj[subTopicId] = newSubUid; - - subValues = [newSubUid + + var subValues = [newSubUid , subTopic , subDescription , subActive , vars.get("$sys.user") , vars.get("$sys.date") - , oldToNewIdHelperObj[subAssignedTo] , subTopicRelevantSortingValue]; + + if(Utils.isNotNullOrEmptyString(oldToNewIdHelperObj[subAssignedTo])) + { + subValues.push(oldToNewIdHelperObj[subAssignedTo]); + subColumns.push("ASSIGNEDTO"); + } var previousLayer = subTopicRelevantSortingLayer; var stopper = false;