Tags:
create new tag
view all tags

Question

Hello

I am trying to put in place an easy method for users to clone a topic. The new topic (Topic2) should have the same parent as Topic1 and have the same contents.

This is quite handy for large, repetative documents of the same style.

Ideally this could be an option inside more topic actions , and the user just has to type in the name of the new Twiki page.

It seems that WebTopicCreator or the TopicCreatorPlugin could do the job but I would appreciate any advice

Environment

TWiki version: TWikiRelease04x01x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: RH linux
Web server: apache
Perl version: 5.8
Client OS: Windows XP Linux
Web Browser: Firefox IE Safari
Categories: Forms

-- PeterJones - 02 Jul 2007

Answer

ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

Just cloning a topic is pretty easy. Both the edit and save scripts support a parameter templatetopic which allows to define the topic you want to clone. Look at TWiki.TWikiScripts for the parameters you can pass in your form, and at the source of WebTopicCreator (the raw view, not the HTML source): it should be possible to replace the topicparent parameter there with your templatetopic. Look how the WebTopicCreator pulls in the list of topics using the %TOPICLIST{"..."}% variable, you'll want to do the same for the source you want to clone.

-- HaraldJoerg - 02 Jul 2007

Is there a way to copy a topic or clone a topic from the user interface? I don't have access to the server and the scripts where our twiki is running.

It would be nice to do it in the same way you rename or move a topic, but it would copy the topic and underlying topics.

-- DanielKnightly - 24 Jul 2007

The way Harald has described it requires no server access. You just need to create a web form in a topic.

-- ArthurClemens - 24 Jul 2007

I was able to implement this as suggested by creating a topic in the TWiki area with the contents

---+Clone the Topic %URLPARAM{"myparam"}%

<!-- Add an introduction here, describing the purpose of this topic. !--> 
The purpose of this form is to create a new topic based on the template of the referenced topic 

%URLPARAM{"myparam"}%

*The name of the new topic  must include the !WebName (example !Sandbox.MyClonedFile)*

You may change the name but make sure its in !WikiNotation .

<!--Add the main topic here. i.e. create some new headings as follows:!-->

<form action='%SCRIPTURLPATH{"edit"}%/%WEB%/'> 
%ICON{"newtopic"}% %MAKETEXT{"Clone this topic:"}% %MAKETEXT{"(Use a topic name in WikiNotation)"}% <br /> 
<input class="twikiInputField" type="text" name="topic" size="32" value="%URLPARAM{"myparam"}%Clone"  />&nbsp;<input type="submit" class="twikiSubmit" value='%MAKETEXT{"Clone"}%' />
<input type="hidden" name="onlywikiname" value="on" />
<input type="hidden" name="onlynewtopic" value="on" />
<input type="hidden" name="templatetopic" value="%URLPARAM{"myparam"}%" />
</form>

I added a link Clone on the More topic actions line so that it appears on each page and the link takes the full name of the current page. It seems to work well and the users like it.

-- PeterJones - 31 Jul 2007

Excellent! All which remains to do now is to take your solution as an example into either a tip of the day or a TWiki supplemental document. Your solution is how I should have done it from the beginning, instead of hacking the complete edit URL including the templatetopic parameter into his browser's "Location" field smile

-- HaraldJoerg - 31 Jul 2007

The Clone does not handle attachments well as they are not copied to the new topics area. Any ideas for how this can be handled?

-- PeterJones - 06 Nov 2007

Is there a way to have the included topics expanded in the Cloned topic ? As alternative : how to clone also all included topics recursively ?

-- GiuseppeBonanno - 15 Jan 2008

Closing this question after more than 30 days of inactivity. Please open a new support question.

-- PeterThoeny - 03 Jun 2008

See feature proposal at CloneTopicLinkUnderMore.

-- PeterThoeny - 2009-09-28

Im sysadmin so I new with twiki, im try use the scripts, but is not work for me I see symbols and do not clone the topic

-- PauloEspinosa - 2011-04-28

only show: 20feature%20name%20below%20to%20use%20it%20in%20the%20document%3A%0A%20

-- PauloEspinosa - 2011-04-28

Best to open a new support question.

-- PeterThoeny - 2011-05-08

Change status to:
Edit | Attach | Watch | Print version | History: r14 < r13 < r12 < r11 < r10 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r14 - 2011-05-08 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.