Delete
Table of Contents
Introduction
The delete operation corresponds to a move operation from the authoring area to the trash
Implementation
Similar to the operation move
Parameters
Required parameters:
- the area for the source document
- the document id for the source document
- the task id
usecase
Delete screen
URL :
{document-URL}?lenya.usecase=delete&lenya.step=showscreen
usecase sitemap:
<map:match pattern="delete" type="usecase"> <map:match pattern="showscreen" type="step"> <map:generate src="content/info/delete.xsp" type="serverpages"/> <map:transform src="xslt/info/delete.xsl"> <map:parameter name="use-request-parameters" value="true"/> </map:transform> <map:call resource="style-cms-page"/> </map:match> </map:match>
The parameters for the source are get with the serverpage through the page envelope input module. The destination area is set to trash in the stylesheet. A form (build with the xslt transformation) sends then the parameters as request parameters with the new URL.
Delete confirmation
URL :
{document-URL}?lenya.usecase=delete&lenya.step=delete&...{source parameters}
usecase sitemap:
<map:match pattern="delete" type="usecase"> <map:match pattern="delete" type="step"> <map:act type="task"> <map:redirect-to session="true" uri="{request-param:parenturl}"/> </map:act> </map:match> </map:match>
The action org.apache.lenya.cms.cocoon.acting.TaskAction calls the execution of the ant task.
Ant Task
The ant target deleteDocument
is in the publication :
{publication}/config/tasks/targets.xml
and depends on the different targets
-
firstareaproperties
, to set the needed properties dependent of the source area -
secareaproperties
, to set the needed properties dependent of the destination area -
newarchivedocumentid
, to compute the unique destination id from the source document id (Same logic like for the archive) -
firstdocumentpath
, to compute the directory of the contents for the source (Needed for the revisions and the rcml files) -
secdocumentpath
, to compute the directory of the contents for the destination (Needed for the revisions and the rcml files) -
setIdentifier
, to save the source document id (in the dc:identifier). Necessary to be able to restore later the document -
move
, to execute the different move operations
For more information about the Ant task, see the documentation Ant Task and the Javadocs.