- 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
This commit is contained in:
Michael Ru
2008-08-27 16:00:21 +00:00
parent 8b71ac4400
commit b7a8c5fac8
3 changed files with 18 additions and 9 deletions

View File

@@ -14,26 +14,29 @@
<#-- <#--
This template renders a comment. This template renders a comment.
--> -->
<#macro commentJSON item> <#macro commentJSON item>
<#escape x as jsonUtils.encodeJSONString(x)> <#escape x as jsonUtils.encodeJSONString(x)>
{ {
"url" : "api/comment/node/${item.node.nodeRef?replace('://','/')}", "url" : "api/comment/node/${item.node.nodeRef?replace('://','/')}",
"nodeRef" : "${item.node.nodeRef}", "nodeRef" : "${item.node.nodeRef}",
"name" : "${item.node.properties.name!''}", "name" : "${item.node.properties.name!''}",
"title" : "${item.node.properties.title!''}", "title" : "${item.node.properties.title!''}",
"content" : "${stringUtils.stripUnsafeHTML(item.node.content)}", "content" : "${stringUtils.stripUnsafeHTML(item.node.content)}",
<#if item.author??> <#if item.author??>
<@renderPerson person=item.author fieldName="author" /> <@renderPerson person=item.author fieldName="author" />
<#else> <#else>
"author" : { "username" : "${item.node.properties.creator}" }, "author" : { "username" : "${item.node.properties.creator}" },
</#if> </#if>
"createdOn" : "${item.node.properties.created?string("MMM dd yyyy HH:mm:ss 'GMT'Z '('zzz')'")}", "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')'")}", "modifiedOn" : "${item.node.properties.modified?string("MMM dd yyyy HH:mm:ss 'GMT'Z '('zzz')'")}",
"isUpdated" : ${item.isUpdated?string}, "isUpdated" : ${item.isUpdated?string},
"permissions" : {"edit" : true, "delete" : true} "permissions" : {
"edit" : ${item.node.hasPermission("Write")?string},
"delete" : ${item.node.hasPermission("Delete")?string}
}
} }
</#escape> </#escape>
</#macro> </#macro>

View File

@@ -26,6 +26,7 @@ function main()
var count = args["pageSize"] != undefined ? parseInt(args["pageSize"]) : 10; var count = args["pageSize"] != undefined ? parseInt(args["pageSize"]) : 10;
model.data = getCommentsList(node, index, count); model.data = getCommentsList(node, index, count);
model.node = node;
} }
main(); main();

View File

@@ -1,6 +1,11 @@
<#import "comment.lib.ftl" as commentLib/> <#import "comment.lib.ftl" as commentLib/>
<#import "../generic-paged-results.lib.ftl" as gen/> <#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> <@gen.pagedResults data=data ; item>
<@commentLib.commentJSON item=item /> <@commentLib.commentJSON item=item />
</@gen.pagedResults> </@gen.pagedResults>