Initialised tags property to an empty array when creating a wiki page. Came up with a workaround to display "tags" property of a page in the Freemarker template.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10220 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Simon Buckle
2008-08-04 10:51:21 +00:00
parent 476267e8f8
commit 24a5b01493
3 changed files with 17 additions and 12 deletions

View File

@@ -48,6 +48,9 @@ function createWikiPage(name, folder, options)
page.content = options.content; page.content = options.content;
} }
} }
// Initialise tags to empty array
page.tags = [];
// TODO: sort out appropriate permission(s) // TODO: sort out appropriate permission(s)
page.save(); page.save();
return page; return page;

View File

@@ -74,15 +74,11 @@ function main()
logger.log(e); logger.log(e);
} }
} }
/** return {
if (page.type == "{http://www.alfresco.org/model/content/1.0}link") "page": page,
{ "tags": page.tags
page = search.findNode(page.properties["cm:destination"].nodeRef); };
}
**/
return page;
} }
var page = main(); model.result = main();
model.page = page;

View File

@@ -1,8 +1,14 @@
{ {
<#if page?exists> <#if result?exists>
<#assign page = result.page>
"title" : "<#if page.properties.title?exists>${page.properties.title}<#else>${page.name?replace("_", " ")}</#if>", "title" : "<#if page.properties.title?exists>${page.properties.title}<#else>${page.name?replace("_", " ")}</#if>",
"pagetext" : '${page.content?js_string}', "pagetext" : '${page.content?js_string}',
"editable" : '<#if page.hasPermission("Write")>true<#else>false</#if>' "editable" : '<#if page.hasPermission("Write")>true<#else>false</#if>',
"tags" : [
<#list result.tags as tag>
"${tag}"<#if tag_has_next>,</#if>
</#list>
]
<#if page.hasAspect("cm:versionable")> <#if page.hasAspect("cm:versionable")>
, "versionhistory" : [ , "versionhistory" : [
<#list page.versionHistory?sort_by("versionLabel")?reverse as record> <#list page.versionHistory?sort_by("versionLabel")?reverse as record>