Tags:
create new tag
, view all tags
-- AndyGlew - 25 Mar 2006

Discussion extracted from EditTopicTreeStructure

Over in ThumbnailsPluginDev, the subject of simpler re-parenting had come up (Feb 2006) using visual topic drag-and-drop. Your solution seems to be much easier to implement in the short term.

-- PankajPant - 20 Mar 2006

Q: in the reparenting form obtained via "More", e.g. http://twiki.org/cgi-bin/oops/Plugins/EditTopicTreeStructure?template=oopsmore&param1=1.3&param2=1.3

we are asked to set change the parent via

    Set new topic parent:
    • Step 1: Select topic parent:
    • Step 2: Continue to EDIT and save to activate the new parent
Q: does anyone know why step 2 is necessary, or how to avoid Step 2?

If I can avoid the need to edit and save, I can create a very simple plugin to reparent a whole slew of pages at the same time:

  • dump the files in a list (or a tree list)
  • place a pulldown with the parent beside eah file
  • change parenthood for a whole slew of files via a pulldown on each of their lines
  • use a single button to commit all of the reparenting
Having to edit/save each page individually would be too annoying.

-- AndyGlew - 23 Mar 2006

legacy is the only reason. the save script is now powerful enough to do this without going through edit and preview. i noted this on UseLessStepsToReparentATopic, but no one (including myself) has got around to it.

-- WillNorris - 23 Mar 2006

Thanks, Will. Do I understand you correctly - SaveContentWithoutEdit is now implemented, so the reparenting change would be just a change to the form, arranging different parameters?

Cool. I've got to figure out how to do this.

-- AndyGlew - 23 Mar 2006

well, i can't comment on the huge topic that is SaveContentWithoutEdit; however, i can point you at TWikiScripts#save

-- WillNorris - 23 Mar 2006

Andy, could you post what you find here? I would like to implement this on our TWiki too.

Thanks.

-- PankajPant - 23 Mar 2006

Thank-you, WillNorris, a light finally came on in my dim skull:

doing something like

https://twiki.pdx.intel.com/archfut/bin/save/Test/TestPage?topicparent=foo

sets the parent to foo.

Now all I have to do is generate forms that creates the appropriate URL... multiple such forms in a file.

-- AndyGlew - 24 Mar 2006

Here is a TestPage that I created in my Test web that gets most of the way there:

   * TestPage <form name="main" action="%SCRIPTURLPATH{"save"}%/%WEB%/TestPage"><input type="hidden" name="t" value="%GMTIME{"$epoch"}%" /><select name="topicparent" size="1">        <option value="none">none (remove topic parent)</option>        %TOPICLIST{"<option value=$qname>$name</option>" separator=" "}%        </select>      <input type="submit" class="twikiSubmit" value="Reparent" />      <input type="hidden" name="t" value="%SERVERTIME{$year$mo$day$hour$min$sec}%" /></form>

   * TestPage2 <form name="main" action="%SCRIPTURLPATH{"save"}%/%WEB%/TestPage2"><input type="hidden" name="t" value="%GMTIME{"$epoch"}%" />        <select name="topicparent" size="1">        <option value="none">none (remove topic parent)</option>        %TOPICLIST{"<option value=$qname>$name</option>" separator=" "}%        </select>      <input type="submit" class="twikiSubmit" value="Reparent" />      <input type="hidden" name="t" value="%SERVERTIME{$year$mo$day$hour$min$sec}%" /></form>

%TREEVIEW%

TestPage renames itself nicely.

TestPage2 renames itself, but switches to viewing that page. I want to remain at the page that has the renaming widgets.

Cool!

I have to run, but maybe tonight... posting this to share with PankajPant

-- AndyGlew - 24 Mar 2006

I haven't gotten the ability to reparent a page other than the current page, returning to the current page, working - it always returns to viewing the page that was reparented - but adding the following to WebLeftBar is a nice first step. It makes it a lot easier to reparent the current page.

   * <form name="main" action="%SCRIPTURLPATH{"save"}%/%WEB%/%TOPIC%">     <input type="submit" class="twikiSubmit" value="Reparent" />      <input type="hidden" name="t" value="%GMTIME{"$epoch"}%" /><select name="topicparent" size="1">        <option value="none">none (remove topic parent)</option>        %TOPICLIST{"<option value=$qname>$name</option>" separator=" "}%        </select> <input type="hidden" name="t" value="%SERVERTIME{$year$mo$day$hour$min$sec}%" /></form>

Try it... although it will not work here on twiki.org, unless you have privileges I do not.

-- AndyGlew - 24 Mar 2006

Adding a trivial bit of JavaScript allows us to submit the form to accomplish the renaming, AND view the original page again.


   * TestPage2 <form name="reparent2" action="%SCRIPTURLPATH{"save"}%/%WEB%/TestPage2"><input type="hidden" name="t" value="%GMTIME{"$epoch"}%" />        <select name="topicparent" size="1">        <option value="none">none (remove topic parent)</option>        %TOPICLIST{"<option value=$qname>$name</option>" separator=" "}%        </select>       <input type="hidden" name="t" value="%SERVERTIME{$year$mo$day$hour$min$sec}%" />  <INPUT TYPE="button" VALUE="Reparent" ONCLICK="document.reparent2.submit();window.location='%SCRIPTURLPATH{"view"}%/%WEB%/TestPage'"> </form>

  • TestPage2

This is a bit annoying because you have to click on each reparent button one-at-a-time, waiting while the reparent is done. It would be nicer to be able to specify all of the reparents via the pulldowns, and then submit all together.

But, anyway, even without the above it is useful. Next step is to get it generated by some TREEVIEW or TOPICLIST.

-- AndyGlew - 24 Mar 2006

In theory, the form above could be passed as a parameter to TreePlugin:

   %TREEVIEW{format="outline",formatting="...the form..."}%

Unfortunately, I have not been able to get that to work; probably, I suspect, because of quote problems.

-- AndyGlew - 24 Mar 2006

Topic revision: r1 - 2006-03-25 - AndyGlew
 
  • 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-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.