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 = []; page.tags = [];
// Set cm:title // Set cm:title
page.properties["cm:title"] = name.replace(/_/g, " "); page.properties["cm:title"] = new String(name).replace(/_/g, " ");
page.save();
// TODO: sort out appropriate permission(s)
page.save();
return page; return page;
} }

View File

@@ -17,8 +17,9 @@ function main()
return jsonError("No new name property specified"); return jsonError("No new name property specified");
} }
// Remove any whitespace and replace with "_" // 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"]); var params = getTemplateArgs(["siteId", "pageTitle"]);
// Get the site // Get the site
@@ -43,19 +44,16 @@ function main()
// Finally, now we can do what we are supposed to do // Finally, now we can do what we are supposed to do
try try
{ {
var currentName = page.name; var currentName = page.name;
page.name = newName;
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]]."
});
page.name = newName;
page.properties["cm:title"] = new String(newName).replace(/_/g, " ");
page.save();
var placeholder = createWikiPage(currentName, wiki, {
content: "This page has been moved [[" + newName + "|here]]."
});
var d = { var d = {
currentName: newName, currentName: newName,
previousName: currentName, previousName: currentName,

View File

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

View File

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