Fixed encoding issue. Fixed problem with string conversion for page rename function in the wiki.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10565 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Simon Buckle
2008-08-28 14:52:20 +00:00
parent c5e960382c
commit b66fbf5613
4 changed files with 20 additions and 20 deletions

View File

@@ -52,10 +52,9 @@ function createWikiPage(name, folder, options)
page.tags = [];
// Set cm:title
page.properties["cm:title"] = name.replace(/_/g, " ");
// TODO: sort out appropriate permission(s)
page.properties["cm:title"] = new String(name).replace(/_/g, " ");
page.save();
return page;
}

View File

@@ -17,7 +17,8 @@ function main()
return jsonError("No new name property specified");
}
// Remove any whitespace and replace with "_"
var newName = String(json.get("name")).replace(/\\s+/g, "_");
var newName = new String(json.get("name"));
newName = newName.replace(/\s+/g, "_");
var params = getTemplateArgs(["siteId", "pageTitle"]);
@@ -43,18 +44,15 @@ function main()
// Finally, now we can do what we are supposed to do
try
{
var currentName = page.name;
var currentName = page.name;
page.name = newName;
page.properties["cm:title"] = new String(newName).replace(/_/g, " ");
page.save();
/**
var link = wiki.createNode(currentName, "cm:link");
link.properties["cm:destination"] = page.nodeRef;
link.save();
**/
var placeholder = createWikiPage(currentName, wiki, {
content: "This page has been moved [[" + newName + "|here]]."
});
content: "This page has been moved [[" + newName + "|here]]."
});
var d = {
currentName: newName,

View File

@@ -1,8 +1,9 @@
<#escape x as jsonUtils.encodeJSONString(x)>
{
<#if result.error?exists>
"error" : "${result.error}"
<#else>
"name" : "${result.name}"
</#if>
}
</#escape>

View File

@@ -1,3 +1,4 @@
<#escape x as jsonUtils.encodeJSONString(x)>
{
<#if result.page??>
<#assign page = result.page>
@@ -31,3 +32,4 @@
"error" : "${result.error!""}"
</#if>
}
</#escape>