Initial version of wiki page delete scripts. Added delete button to toolbar.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9637 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Simon Buckle
2008-07-03 14:26:12 +00:00
parent 330e9022ee
commit 1aa32e5638
3 changed files with 59 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
<webscript>
<shortname>wikidelete</shortname>
<description>Wiki - Deletes page</description>
<url>/slingshot/wiki/page/{siteId}/{pageTitle}</url>
<format default="json">argument</format>
<authentication>user</authentication>
<transaction>required</transaction>
</webscript>

View File

@@ -0,0 +1,51 @@
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/wiki/lib/wiki.lib.js">
/**
* Deletes le page.
*
* @method DELETE
* @param uri {string} /slingshot/wiki/page/{siteid}/{pageTitle}
*/
deleteEvent();
function deleteEvent()
{
var params = getTemplateArgs(["siteId", "pageTitle"]);
if (params === null)
{
status.setCode(status.STATUS_BAD_REQUEST, "Correct parameters not supplied.");
return ;
}
var site = siteService.getSite(params.siteId);
if (site === null)
{
status.setCode(status.STATUS_NOT_FOUND, "Could not find site.");
return;
}
var wiki = site.getContainer("wiki");
if (wiki === null)
{
status.setCode(status.STATUS_NOT_FOUND, "Could not find wiki container.");
return;
}
var page = wiki.childByNamePath(params.pageTitle);
if (page === null)
{
status.setCode(status.STATUS_NOT_FOUND, "Could not find specified page.");
return;
}
var whatPage = page.name;
if (!page.remove())
{
status.setCode(status.STATUS_INTERNAL_SERVER_ERROR, "Failed to delete page");
return;
}
// Success
status.setCode(status.STATUS_NO_CONTENT); // Nothing to do here yet
return;
}