From b7a8c5fac897391115ae52a46340b04ce8c9bc6f Mon Sep 17 00:00:00 2001 From: Michael Ru Date: Wed, 27 Aug 2008 16:00:21 +0000 Subject: [PATCH] - removed highlight for blog/discussions/comments in case no actions are available - some ui improvements for blog/discussions lists - comment components now check for permissions git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10540 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../repository/comments/comment.lib.ftl | 21 +++++++++++-------- .../repository/comments/comments.get.js | 1 + .../repository/comments/comments.get.json.ftl | 5 +++++ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/comments/comment.lib.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/comments/comment.lib.ftl index ddf724b303..3a2b299e60 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/comments/comment.lib.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/comments/comment.lib.ftl @@ -14,26 +14,29 @@ <#-- - This template renders a comment. + This template renders a comment. --> <#macro commentJSON item> <#escape x as jsonUtils.encodeJSONString(x)> { - "url" : "api/comment/node/${item.node.nodeRef?replace('://','/')}", - "nodeRef" : "${item.node.nodeRef}", - "name" : "${item.node.properties.name!''}", + "url" : "api/comment/node/${item.node.nodeRef?replace('://','/')}", + "nodeRef" : "${item.node.nodeRef}", + "name" : "${item.node.properties.name!''}", "title" : "${item.node.properties.title!''}", - "content" : "${stringUtils.stripUnsafeHTML(item.node.content)}", + "content" : "${stringUtils.stripUnsafeHTML(item.node.content)}", <#if item.author??> <@renderPerson person=item.author fieldName="author" /> <#else> "author" : { "username" : "${item.node.properties.creator}" }, - "createdOn" : "${item.node.properties.created?string("MMM dd yyyy HH:mm:ss 'GMT'Z '('zzz')'")}", - "modifiedOn" : "${item.node.properties.modified?string("MMM dd yyyy HH:mm:ss 'GMT'Z '('zzz')'")}", - "isUpdated" : ${item.isUpdated?string}, - "permissions" : {"edit" : true, "delete" : true} + "createdOn" : "${item.node.properties.created?string("MMM dd yyyy HH:mm:ss 'GMT'Z '('zzz')'")}", + "modifiedOn" : "${item.node.properties.modified?string("MMM dd yyyy HH:mm:ss 'GMT'Z '('zzz')'")}", + "isUpdated" : ${item.isUpdated?string}, + "permissions" : { + "edit" : ${item.node.hasPermission("Write")?string}, + "delete" : ${item.node.hasPermission("Delete")?string} + } } diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/comments/comments.get.js b/config/alfresco/templates/webscripts/org/alfresco/repository/comments/comments.get.js index 1250846ab4..57cc287be8 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/comments/comments.get.js +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/comments/comments.get.js @@ -26,6 +26,7 @@ function main() var count = args["pageSize"] != undefined ? parseInt(args["pageSize"]) : 10; model.data = getCommentsList(node, index, count); + model.node = node; } main(); diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/comments/comments.get.json.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/comments/comments.get.json.ftl index 689f5603a3..55496a3d1d 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/comments/comments.get.json.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/comments/comments.get.json.ftl @@ -1,6 +1,11 @@ <#import "comment.lib.ftl" as commentLib/> <#import "../generic-paged-results.lib.ftl" as gen/> { + "nodePermissions" : { + "create" : ${node.hasPermission("CreateChildren")?string}, + "edit" : ${node.hasPermission("Write")?string}, + "delete" : ${node.hasPermission("Delete")?string} + }, <@gen.pagedResults data=data ; item> <@commentLib.commentJSON item=item />