From 4281fd5b2d3f419addd818acacdf9ea517e5a302 Mon Sep 17 00:00:00 2001 From: Debjit Chattopadhyay Date: Thu, 9 Oct 2025 18:14:50 +0530 Subject: [PATCH] Revert "MNT-24776 adding if-else conditionals to avoid null values" This reverts commit 393b06491884a2c16320a17cea6602f852fa250c. --- .../repository/forms/pickerresults.lib.ftl | 173 +++++++++--------- 1 file changed, 82 insertions(+), 91 deletions(-) diff --git a/remote-api/src/main/resources/alfresco/templates/webscripts/org/alfresco/repository/forms/pickerresults.lib.ftl b/remote-api/src/main/resources/alfresco/templates/webscripts/org/alfresco/repository/forms/pickerresults.lib.ftl index 5ef1202896..d8b195dcd6 100644 --- a/remote-api/src/main/resources/alfresco/templates/webscripts/org/alfresco/repository/forms/pickerresults.lib.ftl +++ b/remote-api/src/main/resources/alfresco/templates/webscripts/org/alfresco/repository/forms/pickerresults.lib.ftl @@ -1,92 +1,83 @@ -<#macro renderParent node indent=" "> - <#escape x as jsonUtils.encodeJSONString(x)> - ${indent}"parent": - ${indent}{ - <#if (node != rootNode) && node.parent??> - <@renderParent node.parent indent+" " /> - - ${indent}"type": "${node.typeShort}", - ${indent}"isContainer": ${node.isContainer?string}, - ${indent}"name": "${node.properties.name!""}", - ${indent}"title": "${node.properties.title!""}", - ${indent}"description": "${node.properties.description!""}", - <#if node.properties.modified??>${indent}"modified": "${xmldate(node.properties.modified)}", - <#if node.properties.modifier??>${indent}"modifier": "${node.properties.modifier}", - ${indent}"displayPath": "${node.displayPath!""}", - ${indent}"qnamePath": "${node.qnamePath!""}", - <#if node.aspects??> - ${indent}"aspects": - ${indent}[ - <#list node.aspects as aspect> - "${shortQName(aspect)}" - <#if aspect_has_next>, - - - ${indent}], - - ${indent}"nodeRef": "${node.nodeRef}" - ${indent}}, - - - -<#macro pickerResultsJSON results> - <#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { -<#if parent??> - <@renderParent parent /> - - "items": - [ - <#list results as row> - { - "type": "${row.item.typeShort}", - "parentType": "${row.item.parentTypeShort!""}", - "isContainer": ${row.item.isContainer?string}, - <#if row.container??>"container": "${row.container!""}", - <#if row.item.properties?? && row.item.properties.name??> - "name": "${row.item.properties.name!""}", - <#else> - "name": "${(row.item.name)!row.item?string!""}", - - <#if row.item.aspects??> - "aspects": [ - <#list row.item.aspects as aspect> - "${shortQName(aspect)}" - <#if aspect_has_next>, - - ], - - <#if row.item.properties??> - "title":<#if row.item.properties["lnk:title"]??>"${row.item.properties["lnk:title"]}", - <#elseif row.item.properties["ia:whatEvent"]??>"${row.item.properties["ia:whatEvent"]}", - <#else>"${row.item.properties.title!""}", - "description": "${row.item.properties.description!""}", - <#else> - "title": "${(row.item.name)!row.item?string!""}", - "description": "", - - <#if row.item.properties.modified??>"modified": "${xmldate(row.item.properties.modified)}", - <#if row.item.properties.modifier??>"modifier": "${row.item.properties.modifier}", - <#if row.item.siteShortName??>"site": "${row.item.siteShortName}", - <#if row.item.properties["ia:fromDate"]??>"fromDate": "${xmldate(row.item.properties["ia:fromDate"])}", - "displayPath": "${row.item.displayPath!""}", - "qnamePath": "${row.item.qnamePath!""}", - <#if row.item.typeShort != "cm:person" && row.item.typeShort != "cm:authorityContainer"> - "userAccess": - { - "create": ${row.item.hasPermission("CreateChildren")?string}, - "edit": ${row.item.hasPermission("Write")?string}, - "delete": ${row.item.hasPermission("Delete")?string} - }, - - "nodeRef": "${row.item.nodeRef}"<#if row.selectable?exists>, - "selectable" : ${row.selectable?string} - }<#if row_has_next>, - - ] - } -} - +<#macro renderParent node indent=" "> + <#escape x as jsonUtils.encodeJSONString(x)> + ${indent}"parent": + ${indent}{ + <#if (node != rootNode) && node.parent??> + <@renderParent node.parent indent+" " /> + + ${indent}"type": "${node.typeShort}", + ${indent}"isContainer": ${node.isContainer?string}, + ${indent}"name": "${node.properties.name!""}", + ${indent}"title": "${node.properties.title!""}", + ${indent}"description": "${node.properties.description!""}", + <#if node.properties.modified??>${indent}"modified": "${xmldate(node.properties.modified)}", + <#if node.properties.modifier??>${indent}"modifier": "${node.properties.modifier}", + ${indent}"displayPath": "${node.displayPath!""}", + ${indent}"qnamePath": "${node.qnamePath!""}", + <#if node.aspects??> + ${indent}"aspects": + ${indent}[ + <#list node.aspects as aspect> + "${shortQName(aspect)}" + <#if aspect_has_next>, + + + ${indent}], + + ${indent}"nodeRef": "${node.nodeRef}" + ${indent}}, + + + +<#macro pickerResultsJSON results> + <#escape x as jsonUtils.encodeJSONString(x)> +{ + "data": + { +<#if parent??> + <@renderParent parent /> + + "items": + [ + <#list results as row> + { + "type": "${row.item.typeShort}", + "parentType": "${row.item.parentTypeShort!""}", + "isContainer": ${row.item.isContainer?string}, + <#if row.container??>"container": "${row.container!""}", + "name": "${row.item.properties.name!""}", + <#if row.item.aspects??> + "aspects": [ + <#list row.item.aspects as aspect> + "${shortQName(aspect)}" + <#if aspect_has_next>, + + ], + + "title":<#if row.item.properties["lnk:title"]??>"${row.item.properties["lnk:title"]}", + <#elseif row.item.properties["ia:whatEvent"]??>"${row.item.properties["ia:whatEvent"]}", + <#else>"${row.item.properties.title!""}", + "description": "${row.item.properties.description!""}", + <#if row.item.properties.modified??>"modified": "${xmldate(row.item.properties.modified)}", + <#if row.item.properties.modifier??>"modifier": "${row.item.properties.modifier}", + <#if row.item.siteShortName??>"site": "${row.item.siteShortName}", + <#if row.item.properties["ia:fromDate"]??>"fromDate": "${xmldate(row.item.properties["ia:fromDate"])}", + "displayPath": "${row.item.displayPath!""}", + "qnamePath": "${row.item.qnamePath!""}", + <#if row.item.typeShort != "cm:person" && row.item.typeShort != "cm:authorityContainer"> + "userAccess": + { + "create": ${row.item.hasPermission("CreateChildren")?string}, + "edit": ${row.item.hasPermission("Write")?string}, + "delete": ${row.item.hasPermission("Delete")?string} + }, + + "nodeRef": "${row.item.nodeRef}"<#if row.selectable?exists>, + "selectable" : ${row.selectable?string} + }<#if row_has_next>, + + ] + } +} + \ No newline at end of file