This question about Not sure...: Answered
I have extracted the "Copy topic" function from the "More"-page. It automatically makes a copy from a page, but this also copies the used form, probably because it's visible in the META-field and part of the topic.
There IS a code in there which copies the contents from a file, i.e.
<input type="hidden" name="templatetopic" value="%WEB%.%TOPIC%" />
So it would be great to have something like this:
<input type="hidden" name="templateform" value="%WEB%.MyForm" />
Is that possible?
--
LieVen - 02 Jul 2015
You are correct that if you use the standard "copy topic" function, it will automatically copy the topic's form as well as the content. However, along the lines of what you describe, you could define your own html form using two hidden inputs for
templatetopic
and
templateform
.
If you wanted to have this as the default action for the
More > Copy topic
feature, you'd need to modify or over-ride the
copy
template definition in the
templates/more.tmpl
file. It's generally not a good practice to modify a distributed file because your changes would be over-written and lost the next time you update your installation or skins. You can avoid this by defining your own skin and just over-ride the particular elements you want to customize. To do this, start by making a copy of the
more.tmpl
file as
more.myskin.tmpl
. You could remove everything in the copied file except the section that starts with
%TMPL:DEF{"copy"}%
. You'll also want to add
%TMPL:INCLUDE{"more"}%
to the first line of your file. This will pull in all template elements you don't define from the default "more" template. Then set you skin preference (in
Main.SitePreferences
) to
myskin, pattern
. Once this is complete, your customized version of the
Copy topic
form will load rather than the standard version. (This description assumes you're using the default
PatternSkin.
NatSkin implements topic-copying in a fairly different manner which includes the option to
not inlcude the dataform in the new topic.)
This little example shows how easy it is to override only select skin template elements from one of distributed skins with your own customized versions — which is one of the great features of Foswiki, imho.
Hope this helps.
--
LynnwoodBrown - 17 Jul 2015