Escaped title URL parameter. First cut of allowing users to see the content of the various versions of a wiki page.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9993 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Simon Buckle
2008-07-23 14:27:05 +00:00
parent f11972f381
commit ee66c2217e
5 changed files with 56 additions and 0 deletions

View File

@@ -8,6 +8,7 @@
<#list page.versionHistory?sort_by("versionLabel")?reverse as record>
{
"version": "${record.versionLabel}",
"versionId": "${record.id}",
"date": "${record.createdDate?datetime}",
"author": "${record.creator}"
}<#if record_has_next>,</#if>

View File

@@ -0,0 +1,8 @@
<webscript>
<shortname>wikipage</shortname>
<description>Wiki - Page details</description>
<url>/slingshot/wiki/version/{siteId}/{pageTitle}/{versionId}</url>
<format default="mediawiki">argument</format>
<authentication>user</authentication>
<transaction>required</transaction>
</webscript>

View File

@@ -0,0 +1,45 @@
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/lib/wiki.lib.js">
function main()
{
var params = getTemplateArgs(["siteId", "pageTitle", "versionId"]);
var content = "";
// Get the site
var site = siteService.getSite(params.siteId);
if (site === null)
{
return "";
}
var wiki = getWikiContainer(site);
if (wiki === null)
{
return "";
}
var page = wiki.childByNamePath(params.pageTitle);
if (page === null)
{
return "";
}
var version;
var versions = page.versionHistory;
// NOTE: would it be possible to pass in the noderef and do a search for the specific
// version (directly) against the "lightWeightVersionStore"? This would depend on what
// indexing (if any) there is on the version store.
for (var i=0; i < versions.length; i++)
{
version = versions[i].node;
// If we don't create a string explicitly the comparison fails
if (String(version.id) === params.versionId)
{
content = version.content;
break;
}
}
return content;
}
model.content = main();