Rename Space

Last modified by Clemens Robbenhaar on 2014/12/18 11:13

cogRename all pages in a space
Developed by

Vincent Massol

LicenseGNU Lesser General Public License 2.1


This script uses the rename feature on page (it just loops over all pages in a space) and thus has the same limitations as the standard rename.
The rights on the renamed space are the default rights. This script does not keep rights on the space

Code in XWiki Syntax 2.0

Works in XWiki versions 2.3 and above.
= Rename space =

#if($request.action == 'rename')
  #if($request.from && $
    #foreach($item in $xwiki.getSpaceDocsName($request.from))
      #set ($fromReference = $services.model.createDocumentReference("", $request.from, $item))
      #set ($toReference = $services.model.createDocumentReference("", $, $item))
      * Renamed [$services.model.serialize($fromReference)] to [$services.model.serialize($toReference)]
      #set($ok = $xwiki.getDocument($fromReference).rename($toReference))

{{html wiki='true'}}
<form action="$doc.getURL()" method="post" class="xform third">
  <input type="hidden" name="action" value="rename" />
  <div class="xform">
    <dt>Source space:</dt>
    <dd><select name="from">
      <option value="">please select</option>
      #foreach($space in $xwiki.getSpaces())
      <option value="$escapetool.xml($space)">$escapetool.xml($space)</option>
   <dt>New space:</dt>
   <dd><input type="text" name="to" value=""/></dd>
  <div class="buttons">
    <input type="submit" value="Rename" class="button" />


Screen copy of the result page with the velocity Code in XWiki Syntax 2.0:


Created by VincentMassol on 2007/09/24 17:09

Download XWiki

My Recent Modifications

Get Connected