Rename
Table of Contents
Introduction
The rename operation corresponds to a move operation
Implementation
Similar to the operation move
Parameters
The parameters are string-value parameters
Required parameters:
- the area for the source document
- the document id for the source document
- the area for the destination document
- the name for the destination document
- the task id
usecase
They are implemented in the usecase sitmap (core)
Rename screen
URL :
{document-URL}?lenya.usecase=rename&lenya.step=showscreen
usecase sitemap:
<map:match pattern="rename" type="usecase"> <map:match pattern="showscreen" type="step"> <map:generate src="content/info/rename.xsp" type="serverpages"/> <map:transform src="xslt/info/rename.xsl"/> <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. A form (build with the xslt transformation) sends then the parameters as request parameters with the new URL.
Rename confirmation
URL :
{document-URL}?lenya.usecase=rename&lenya.step=rename&...{source parameters}
usecase sitemap:
<map:match pattern="rename" type="usecase"> <map:match pattern="rename" type="step"> <map:act type="task"> <map:redirect-to session="true" uri="{request:contextPath}/{../../../1}/{../../../2}/"/> </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 renameDocument
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 -
newnamdocumentid
, to compute the unique destination id with the new name -
firstdocumentpath
, to compute the directory of the source contents (Needed for the revisions and the rcml files) -
secdocumentpath
, to compute the directory where are the destination contents (Needed for the revisions and the rcml files) -
move
, to execute the different move operations
For more information about the Ant task, see the documentation Ant Task and the Javadocs.