Item11767: The Copy topic feature on More topic actions doesn't take over an existing parent/child setting.
Priority: Normal
Current State: Closed
Released In: 1.1.6
Target Release: patch
Applies To: Engine
Component: FoswikiUIEdit, templates/more.tmpl
Branches: Release01x01 trunk
Shouldn't the
Copy feature on
More also copy an existing parent/child setting?
And are there possibly other META-data that aren't taken over to the copy?
Alternatively maybe it could be made possible to also specify a new parent for a topic copy along/together with a new name by taking advantage of the value of the input field or a selected value in the pick list of the area
Set new topic parent on the
More page. --> This would be a new feature.
--
FranzJosefGigler - 17 Apr 2012
I think it should copy the topic parent, so that it's easy to clone a number of similar children to a topic; however the children of a topic are a property of the respective child topic (the child topic's "parent" property) and cannot be copied.
I see two ways to achieve this:
- add code to Foswiki::UI::Edit that clones the TOPICPARENT property when the topic to be edited is new, like so:
--- a/lib/Foswiki/UI/Edit.pm
+++ b/lib/Foswiki/UI/Edit.pm
@@ -291,6 +291,9 @@ sub init_edit {
# Copy preference values
$topicObject->copyFrom( $ttom, 'PREFERENCE' );
+ # Copy topic parent value
+ $topicObject->copyFrom( $ttom, 'TOPICPARENT' );
+
# Copy the text
$topicObject->text( $ttom->text() );
- or add a hidden input field named "topicparent" to templates/more.tmpl, like so:
--- a/templates/more.tmpl
+++ b/templates/more.tmpl
@@ -42,6 +42,7 @@
<input type="hidden" name="nowysiwyg" value="1" />
<input type="hidden" name="notemplateexpansion" value="on" />
<input type="hidden" name="action_save" value="1" />
+<input type="hidden" name="topicparent" value="%META{"parent" dontrecurse="on" format="$web.$topic"}%" />
</form>
%TMPL:END%
Before daring to commit anything, though, I'd like to hear comments from people more experienced with the code, particularly regarding possible side effects of the first solution...
--
FlorianSchlichting - 24 Jul 2012