mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
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:
@@ -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>
|
||||
|
@@ -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>
|
@@ -0,0 +1 @@
|
||||
${content}
|
@@ -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();
|
@@ -0,0 +1 @@
|
||||
${content}
|
Reference in New Issue
Block a user