mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -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>
|
@@ -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;
|
||||
}
|
Reference in New Issue
Block a user