Tags:
stale_content1Add my vote for this tag create new tag
, view all tags

Implemented: Setting Parent Topic to None

Summary: New feature in the More screen to set the topic parent to none, e.g. to remove the current topic parent

When created from a custom form, it is possible to get topics without any parent. When creating a new topic by clicking on the questionmark link the parent is set automatically. Sometimes it is useful to have topics with no parent, for example when using the TreePlugin. The new feature allows you to set the parent property of a topic to none.

User interface:

  • Click on the more link
  • In the "Set New Topic Parent" section, select "none (remove topic parent)" from the list of topics
  • Click on Edit, preview and save the topic

Enhancement is in TWikiAlphaRelease and at TWiki.org as of 24 Nov 2003.

Changes:

*** ../../templates/oopsmore.tmpl  2003-10-26 08:55:00.000000000 -0800
--- oopsmore.tmpl                  2003-11-24 21:44:11.000000000 -0800
***************
*** 21,29 ****
--- 21,31 ----
     * *Set new topic parent:*
        * Step 1: Select topic parent: %BR%
          <select name="topicparent" size="10">
+         <option value="none">none (remove topic parent)</option>
          %TOPICLIST{"<option value=$qname>$name</option>" separator=" "}%
          </select>
        * Step 2: Continue to <input type="submit" value="Edit" /> and save <nop>%TOPIC% to activate the new parent
+         <input type="hidden" name="t" value="%SERVERTIME{$hour$min$sec}%">
  </form>

  <form name="main" action="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/%INTURLENCODE{"%WEB%/%TOPIC%"}%">


*** ../../bin/edit  2003-11-23 09:06:19.000000000 -0800
--- edit            2003-11-23 20:19:04.000000000 -0800
***************
*** 176,185 ****
          $text =~ s/%NOP{.*?}%//gos;  # Remove filler: Use it to remove access control at time of
          $text =~ s/%NOP%//go;        # topic instantiation or to prevent search from hitting a template
      }
!
      # parent setting
      my $theParent = $query->param( 'topicparent' ) || "";
!     if( $theParent ) {
          if( $theParent =~ /^([^.]+)\.([^.]+)$/ ) {
              my $parentWeb = $1;
              if( $1 eq $webName ) {
--- 176,187 ----
          $text =~ s/%NOP{.*?}%//gos;  # Remove filler: Use it to remove access control at time of
          $text =~ s/%NOP%//go;        # topic instantiation or to prevent search from hitting a template
      }
!
      # parent setting
      my $theParent = $query->param( 'topicparent' ) || "";
!     if( $theParent eq "none" ) {
!         $meta->remove( "TOPICPARENT" );
!     } elsif( $theParent ) {
          if( $theParent =~ /^([^.]+)\.([^.]+)$/ ) {
              my $parentWeb = $1;
              if( $1 eq $webName ) {


*** ../../bin/preview       2003-11-23 09:06:32.000000000 -0800
--- preview                 2003-11-23 20:22:24.000000000 -0800
***************
*** 98,111 ****
      if( $saveCmd ne "repRev" ) {
          my $dummy = "";
          ( $meta, $dummy ) = &TWiki::Store::readTopic( $webName, $topic );
!
        # parent setting
        my $theParent = $query->param( 'topicparent' ) || "";
!       if( $theParent ) {
!           $tmpl =~ s/%TOPICPARENT%/$theParent/go;
!           $meta->put( "TOPICPARENT", ( "name" => $theParent ) );
!       }
!       $tmpl =~ s/%TOPICPARENT%/$theParent/;

        my $formTemplate = $query->param( "formtemplate" );
        if( $formTemplate ) {
--- 98,112 ----
      if( $saveCmd ne "repRev" ) {
          my $dummy = "";
          ( $meta, $dummy ) = &TWiki::Store::readTopic( $webName, $topic );
!
        # parent setting
        my $theParent = $query->param( 'topicparent' ) || "";
!         if( $theParent eq "none" ) {
!             $meta->remove( "TOPICPARENT" );
!         } elsif( $theParent ) {
!             $meta->put( "TOPICPARENT", ( "name" => $theParent ) );
!         }
!       $tmpl =~ s/%TOPICPARENT%/$theParent/go;

        my $formTemplate = $query->param( "formtemplate" );
        if( $formTemplate ) {


*** ../../bin/save  2003-11-23 21:58:45.000000000 -0800
--- save            2003-11-23 20:23:14.000000000 -0800
***************
*** 115,127 ****
          # normal case: Get latest attachment from file for preview
          my $tmp;
          ( $meta, $tmp ) = &TWiki::Store::readTopic( $webName, $topic );
!
        # parent setting
        my $theParent = $query->param( 'topicparent' ) || "";
!       if( $theParent ) {
!           $meta->put( "TOPICPARENT", ( "name" => $theParent ) );
!       }
!
        my $formTemplate = $query->param( "formtemplate" );
        if( $formTemplate ) {
           $meta->remove( "FORM" );
--- 115,129 ----
          # normal case: Get latest attachment from file for preview
          my $tmp;
          ( $meta, $tmp ) = &TWiki::Store::readTopic( $webName, $topic );
!
        # parent setting
        my $theParent = $query->param( 'topicparent' ) || "";
!         if( $theParent eq "none" ) {
!             $meta->remove( "TOPICPARENT" );
!         } elsif( $theParent ) {
!             $meta->put( "TOPICPARENT", ( "name" => $theParent ) );
!         }
!
        my $formTemplate = $query->param( "formtemplate" );
        if( $formTemplate ) {
           $meta->remove( "FORM" );

Contributors:
-- JeromeBouvattier - 28 Mar 2002
-- PeterThoeny - 24 Nov 2003

Discussion and Feedback

Click more at the bottom of the view screen - 3rd item lets you re-parent.

-- JohnTalintyre - 28 Mar 2002

But it won't let you clear the TOPICPARENT field. What I need is a <None> item in the combo list.

Did I miss something ?

-- JeromeBouvattier - 28 Mar 2002

Another easy way to get no parent is to create the page by typing the new name on the browser's address bar. (I do it in view, when it doesn't find the page, it offers to create one for you, and there is no parent for the new page.)

-- RandyKramer - 01 Oct 2002

There's actually a really simple way to clear the parent topic. I can't remember the specifics off the top of my head, but I'll tell you what I do remember and I (or you) can look the rest up later.

The raw topic files begin with some metadata, and the parent topic is one of these. If you edit a topic and as the very first line, put the parent topic metadata with topic = "" then it will effectively clear the parent topic.

I have no idea if this actually messes up the raw data; adding to rather than replacing the original parent topic meta data. I'm just a user, not an admin (anymore, sigh).

-- TorbenGB - 26 Oct 2002

Seems there is still no easy way to remove the meta parent data if you don't have root access.

-- ArthurClemens - 08 Sep 2003

I added the proposed spec on top

-- PeterThoeny - 24 Nov 2003

Why is it necessary to edit the topic to change the parent? It is a great hassle. If you can use something like direct save of the topic and then quickly return to the more screen, you can save a lot of work.

-- ArthurClemens - 24 Nov 2003

I was considering this. This will be possible once SaveContentWithoutEdit is in place.

-- PeterThoeny - 24 Nov 2003

This enhancement is now in TWikiAlphaRelease and at TWiki.org.

-- PeterThoeny - 24 Nov 2003


Diversion: don't show WebHome as parent (solved)

I also miss this feature sometimes. A path like

Mysite > Mygroup > Myweb > WebHome > ThreadGroup > SmallThread > BlaTopic

looks odd. The WebHome just does not belong in there. It's implied by Myweb. My wish: IF parent == WebHome -> display as empty

-- PeterKlausner - 19 Jul 2002

There is a new nowebhome="on" switch for the parent meta variable that does that. For example, this is the breadcrumb in the latest twiki.tmpl template:

   <a href="%SCRIPTURL%/view%SCRIPTSUFFIX%/%MAINWEB%/%HOMETOPIC%">%WIKITOOLNAME%</a>
   &amp;gt; <a href="%SCRIPTURL%/view%SCRIPTSUFFIX%/%WEB%/%HOMETOPIC%">%WEB%</a>
   &amp;gt; %META{"parent" nowebhome="on" suffix=" &amp;gt;"}%
   <font size="+1"><b>%TOPIC%</b> %TMPL:P{"titleaction"}%</font>

Setting parent to none: This is not implemented but you get the same effect if you set the parent to the web's WebHome.

-- PeterThoeny - 23 Jul 2002

I made a patch to get this functionality on the Dec 2001 release, attached:

-- ColasNahaboo - 30 Sep 2002

In addition, you should also apply this patch that adds a fix for ancestor topics in non-WikiWord syntax:

-- ColasNahaboo - 25 Oct 2002

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatpatch NoWebHome.patch r1 manage 1.4 K 2002-09-30 - 15:15 ColasNahaboo patch to get nowebhome for Dec2001 release
Unknown file formatpatch NoWebHome2.patch r1 manage 0.6 K 2002-10-25 - 15:34 ColasNahaboo second patch to work with non-wiki-word topics
Edit | Attach | Watch | Print version | History: r18 < r17 < r16 < r15 < r14 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r18 - 2004-08-16 - 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-2015 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.