Could we set up a page on xwiki.org with links to these useful snipplets? It would be good to have a central place where all these bits of code could be found. Duke
-----Original Message----- From: Ludovic Dubost [mailto:[email protected]] Sent: Wednesday, August 31, 2005 11:48 AM To: [email protected] Subject: Re: [xwiki-users] Changing the space/web of a page
The following script can be adapted to 'copy' documents (you then need to delete them) This script needs to be saved with admin rights and should not be accessible by anybody because it allows to get 'any' page even those for which the user does not have the rights
SNIP 1 Copy a document
#set($sourcewiki = $request.sourcewiki) #set($sourcedoc = $request.sourcedoc) #set($targetdoc = $request.targetdoc) #set($targetwiki = $request.targetwiki) #set($language = $request.language)
#if ($targetdoc=="") #set($targetdoc = $sourcedoc) #end
#if ($targetwiki=="") #set($targetwiki = $sourcewiki) #end
#if ($sourcewiki) Copying document $sourcedoc ($language) from $sourcewiki to $targetwiki: $xwiki.xWiki.copyDocument($sourcedoc, $targetdoc, $sourcewiki, $targetwiki, $language, false, $context.context)
[Source doc>$sourcewiki:$sourcedoc?language=$language] [Target doc>$targetwiki:$targetdoc?language=$language] #end
<form action=""> <table><tr> <td>Source Wiki:</td> <td><input type="text" name="sourcewiki" value="$!request.sourcewiki" size="60"/> </td></tr> </tr><td>Source Document:</td> <td><input type="text" name="sourcedoc" value="$!request.sourcedoc" size="60"/></td></tr> </tr><td>Language:</td> <td><input type="text" name="language" value="$!request.language" size="60" /></td></tr> </tr><td>Target Doc:</td> <td><input type="text" name="targetdoc" value="$!request.targetdoc" size="60" /></td></tr> </tr><td>Target Wiki:</td> <td><input type="text" name="targetwiki" value="$!request.targetwiki" size="60" /></td> <td></td> <td><input type="submit" value="Copy" /> </td></tr> </table> </form> SNIP
Ludovic
Charles Rankin wrote:
Short form of the question: Is there any way to change
which space (or
web) a given page resides in?
Details: I've created a "smart table" (use the class/template/sheet approach). The pages for this appear in a given space/web (let's call it 'X'). However, X's space access rights don't give the community at large access to them -- they do have access to the table page itself. This was a case of not thinking things through clearly. So, my thought was to put the whole table (and the pages that created for it) in a new space that does have appropriate access rights. Thus, I'd like to create it and move all the existing pages into the new space. Hence, my original question. I'm open to other alternatives. My only thought, thus far, is to see if there is a way to dynamically apply access rights to a page as it is created (but that sounds "unclean").
Charles Rankin
----------------------------------------------------------------------
--
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
-- Ludovic Dubost XPertNet: http://www.xpertnet.fr/ Blog: http://www.ludovic.org/blog/ XWiki: http://www.xwiki.com Skype: ldubost AIM: nvludo Yahoo: ludovic