From 41840281a86b6511d938adccba3d2fde5e7c6c20 Mon Sep 17 00:00:00 2001 From: "S.Leipold" <S.Leipold@sleipold.aditosoftware.local> Date: Wed, 4 Dec 2019 14:02:15 +0100 Subject: [PATCH] =?UTF-8?q?#1048336=20Sortieren=20in=20Permission=20Tabell?= =?UTF-8?q?en=20nicht=20m=C3=B6glich=20-=20fixed,=20sorting=20is=20now=20w?= =?UTF-8?q?orking?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PermissionMetaData_entity.aod | 1 + .../recordcontainers/jdito/contentProcess.js | 22 +++++++++++++++- .../PermissionOverview_entity.aod | 1 + .../recordcontainers/jdito/contentProcess.js | 25 +++++++++++++++++++ entity/Role_entity/Role_entity.aod | 1 + .../recordcontainers/jdito/contentProcess.js | 24 +++++++++++++++++- 6 files changed, 72 insertions(+), 2 deletions(-) diff --git a/entity/PermissionMetaData_entity/PermissionMetaData_entity.aod b/entity/PermissionMetaData_entity/PermissionMetaData_entity.aod index fe089ed550..22665a7651 100644 --- a/entity/PermissionMetaData_entity/PermissionMetaData_entity.aod +++ b/entity/PermissionMetaData_entity/PermissionMetaData_entity.aod @@ -92,6 +92,7 @@ <jDitoRecordAlias>_____SYSTEMALIAS</jDitoRecordAlias> <isPageable v="false" /> <isFilterable v="true" /> + <isSortable v="true" /> <contentProcess>%aditoprj%/entity/PermissionMetaData_entity/recordcontainers/jdito/contentProcess.js</contentProcess> <recordFieldMappings> <jDitoRecordFieldMapping> diff --git a/entity/PermissionMetaData_entity/recordcontainers/jdito/contentProcess.js b/entity/PermissionMetaData_entity/recordcontainers/jdito/contentProcess.js index 88ebe71913..0b415b767e 100644 --- a/entity/PermissionMetaData_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/PermissionMetaData_entity/recordcontainers/jdito/contentProcess.js @@ -1,3 +1,4 @@ +import("Util_lib"); import("system.vars"); import("system.result"); import("system.project"); @@ -17,4 +18,23 @@ if (selectedEntity == null) { res.push([entity[0], entity[1], entity[2], entity[6]]); } -result.object(res.sort()); \ No newline at end of file +var order = vars.get("$local.order"); +var columnOrder = { + "UID.value" : 1, + "TITLE.value" : 2 +}; +var sortOrder = []; +for (let field in order) +{ + if (field in columnOrder) + { + sortOrder.push(columnOrder[field]); + sortOrder.push(order[field] == "DOWN"); + } +} +if (!sortOrder.length) //sort by entity name by default + sortOrder = [1, false]; + +ArrayUtils.sortMulti(res, sortOrder); + +result.object(res); \ No newline at end of file diff --git a/entity/PermissionOverview_entity/PermissionOverview_entity.aod b/entity/PermissionOverview_entity/PermissionOverview_entity.aod index 58ab47b997..fd6fc59650 100644 --- a/entity/PermissionOverview_entity/PermissionOverview_entity.aod +++ b/entity/PermissionOverview_entity/PermissionOverview_entity.aod @@ -86,6 +86,7 @@ <name>jDito</name> <jDitoRecordAlias>_____SYSTEMALIAS</jDitoRecordAlias> <isFilterable v="false" /> + <isSortable v="true" /> <contentProcess>%aditoprj%/entity/PermissionOverview_entity/recordcontainers/jdito/contentProcess.js</contentProcess> <recordFieldMappings> <jDitoRecordFieldMapping> diff --git a/entity/PermissionOverview_entity/recordcontainers/jdito/contentProcess.js b/entity/PermissionOverview_entity/recordcontainers/jdito/contentProcess.js index c99614f12f..91b3572085 100644 --- a/entity/PermissionOverview_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/PermissionOverview_entity/recordcontainers/jdito/contentProcess.js @@ -1,3 +1,4 @@ +import("Util_lib"); import("Sql_lib"); import("system.project"); import("system.vars"); @@ -80,6 +81,30 @@ for each (var entry in rolesOrEntities) { // entry contains either a role or an res.push(currOverview); } + +var order = vars.get("$local.order"); +var columnOrder = { + "ENTITY.value" : 1, + "ACTION_VIEW.value" : 2, + "ACTION_CREATE.value" : 3, + "ACTION_READ.value" : 4, + "ACTION_UPDATE.value" : 5, + "ACTION_DELETE.value" : 6 +}; +var sortOrder = []; +for (let field in order) +{ + if (field in columnOrder) + { + sortOrder.push(columnOrder[field]); + sortOrder.push(order[field] == "DOWN"); + } +} +if (!sortOrder.length) //sort by entity or role by default + sortOrder = [1, false]; + +ArrayUtils.sortMulti(res, sortOrder); + result.object(res); function prepareOverview(pPermSetId, pCurrOverview, pMode) { diff --git a/entity/Role_entity/Role_entity.aod b/entity/Role_entity/Role_entity.aod index ee8b103c8d..6e7e708085 100644 --- a/entity/Role_entity/Role_entity.aod +++ b/entity/Role_entity/Role_entity.aod @@ -142,6 +142,7 @@ <name>jDito</name> <jDitoRecordAlias>_____SYSTEMALIAS</jDitoRecordAlias> <isFilterable v="true" /> + <isSortable v="true" /> <contentProcess>%aditoprj%/entity/Role_entity/recordcontainers/jdito/contentProcess.js</contentProcess> <onInsert>%aditoprj%/entity/Role_entity/recordcontainers/jdito/onInsert.js</onInsert> <onUpdate>%aditoprj%/entity/Role_entity/recordcontainers/jdito/onUpdate.js</onUpdate> diff --git a/entity/Role_entity/recordcontainers/jdito/contentProcess.js b/entity/Role_entity/recordcontainers/jdito/contentProcess.js index 0c6c46b70b..58a9778135 100644 --- a/entity/Role_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Role_entity/recordcontainers/jdito/contentProcess.js @@ -1,3 +1,4 @@ +import("Util_lib"); import("system.translate"); import("system.vars"); import("system.result"); @@ -41,4 +42,25 @@ if (ids != null) }); } -result.object(res.sort()); \ No newline at end of file +var order = vars.get("$local.order"); +var columnOrder = { + "ROLENAME.value" : 1, + "ROLETITLE.value" : 2, + "ROLETYPE.value" : 3, + "USERCOUNT.value" : 5 +}; +var sortOrder = []; +for (let field in order) +{ + if (field in columnOrder) + { + sortOrder.push(columnOrder[field]); + sortOrder.push(order[field] == "DOWN"); + } +} +if (!sortOrder.length) //sort by role name by default + sortOrder = [1, false]; + +ArrayUtils.sortMulti(res, sortOrder); + +result.object(res); \ No newline at end of file -- GitLab