Dynamically modifying parent-child relationships
EditTopicTreeStructure started the conversation of reparenting multiple topics at the same time. The implementation revolved around a twiki topic that defined the topic hierarchy as a bullet list, and backend stuff to read this topic and update the individual META tags (if necessary).
I've always wanted to this to be more user-friendly in order to make this a more frequently user feature. Recently, I came across
dynamic drag-&-drop
of a folder tree over at
http://www.dhtmlgoodies.com
, which seemed to be well suited to the task of topic reparenting.
What does work
I've cooked up a rudimentary
prototype (

semi-functional) to illustrate the basic process. (Note the link can take a while to load.)
- Display of the hierarchy and drag and drop update of the structure.
- Hover over a topic to display additional information (summary, modified on, etc.)
- There can be three roots of the tree:
- WebHome is the root of most of the topics.
- NOPARENT is the root for topics without any parent.
- OTHER_WEB is the root for topics that have parents in another web.
- None of the roots are draggable and nothing can be dragged into a root other than WebHome.
What needs to be done to get this functional
- Speed! Currently, the whole topic tree + information about each topic is downloaded at page load (using a formatted SEARCH). Either the tree needs to be regenerated periodically and stored on the server, or at the very least the topic information needs to be fetched using AJAX (this shouldn't be too difficult).
- The actual update function.
- Needs to handle topic locks gracefully. The way I envision it, each time a topic is moved to a new parent, its color changes (or some other visual indication of a pending move). When the user hits the update button, if the action is successful the color reverts, otherwise it changes to a more glaring indication of a failure.
- Lots more things can be done to make this much more useful. The interface can be extended to actually allow a user to change the topic's information (such as picking a more appropriate name, modifying the summary (this implies a separate Meta field), changing form values, etc. ... but that's for a much later date.
--
PankajPant - 07 Aug 2006
Interesting work!
I always thought that TWiki needs a Plugin that simply returns a list of topics of a web with topics in the proper parent/child relationship. Something like a simple and fast version of the
TreePlugin, for other Plugins to use.
--
PeterThoeny - 08 Aug 2006
Another feature that I'm thinking of adding is on-demand topic information (like summary, version, last edit, tags(?), ref-by, etc.) which would be fetched via AJAX and shown as a tooltip.
This would it much easier to deduce where a topic fits best without having to read the topic (and thus breaking the workflow).
--
PankajPant - 08 Aug 2006
See
DynamicTopicTree for a start of a solution.
--
PankajPant - 27 Aug 2006
DynamicTopicTree has been updated with an actually working version (well almost ... see description above).
--
PankajPant - 26 Sep 2006
Kinda kool I like the idea. I'm a bit scared to play with the prototype not wanting to mess with twiki.org. So I tried to display the sandbox hierarchy but it didn't show anything. I'll try to put it up on my private TWiki and see what I get.
--
StephaneLenclud - 27 Sep 2006
Play with it all you want ... it doesn't really
do anything

ie. you can move topics around but nothing gets saved. That will be the last piece of the puzzle after the interface etc. are finished.
--
PankajPant - 27 Sep 2006
It doesn't seem to work with the Sandbox web and I'm not sure why. There is a JS error being reported which I'll need to look into.
--
PankajPant - 27 Sep 2006
Turned out that topics can declare themselves as their own parent (eg.
AdamRygiolSandbox) which was causing a recursion. Not sure if this is a bug or a "feature", but such topics are now listed under the NO_PARENT node.
--
PankajPant - 27 Sep 2006
As our TWiki is growing in my company it seems obvious too me that such a tool is not "Kinda kool" as I stated above but rather a "must have" to keep the structure of the TWiki consistent and not so painful to maintain. In fact being able to move an entire topic tree from one place to another (even across Webs) would be most useful. Is there other tools doing something like that already?
--
StephaneLenclud - 21 Nov 2006
Not to my knowledge. On moving entire topic tree to another node within the same web: You get this by simply reparenting a parent topic. All its children and grand children will follow.
--
PeterThoeny - 21 Nov 2006
But the moving of entire trees should also work across web as it is a really dumb work moving every single topic of a tree and then reparenting it. It's awful!
--
MarijanaPrusina - 06 Dec 2006
Well, physically, a reparenting across webs means to move the selected topic and all its children to the new web. That is, re-parenting across web is more than simple selecting a new parent for a topic.
--
PeterThoeny - 06 Dec 2006
(I moved the parent discussion to
AvoidParentAcrossWebs)
--
PeterThoeny - 08 Dec 2006
This looks nice already! I tried it on my installation (just pointing to this topic for all the files). The tooltip pops up just above the tree, pushing everything down. Also the contents of the tooltip aren't formatted. Am I missing something?
I'm really looking forward to this one!
--
JosMaccabiani - 05 Jan 2007
Does anybody know how to actually reparent topics with this code? I can´t find any hints on that. thanks
--
CarloJoerges - 02 Feb 2007
I'm sorry. I'm completely swamped and won't have time for this in the near term. I was working on this as a means to learn Java/AJAX programming and produce something useful in the process, and my free time has unfortunately evaporated. The code is available below, so feel free to enhance it. See the "remaining work" section to get an idea of what needs to be done.
--
PankajPant - 02 Feb 2007
Has this been progressed at all?
--
MartinCleaver - 10 Oct 2008
I discuss one option, using
GlobalReplacePlugin, on
MassReparenting
--
MartinCleaver - 10 Oct 2008