Tags:
create new tag
view all tags

Bug: (title)

"PARENTS" LIST NOT CORRECTLY LINKED WHEN JUMPING WEBS

Test case

If there is a "chain" of topics longer than two, and after the immediate parent there is jump between webs and there is no web-specific information in the meta header then it won't be properly linked. For example:

TOPIC		 IN WEB	 CHILD'S META  OK
=========== ========= ============= ==
CURRENT	  BUGS		...			  Y
QA			 DEVEL	  "DEVEL.QA"	 Y
ORGCHART	 DEVEL	  "ORGCHART"	 N

...this is because, from the perspective of "QA," the "ORGCHART" parent is in the same web and never has the "DEVEL" scoping. Thus, in the "renderParent" code in "lib/TWiki.pm," it assumes that anything that's missing a web scoping "WEB.TOPIC" is in the same web as the starting topic, etc.

Plus, the "$text" assignment was in the wrong place in that function's "while()" loop.

Fix record

I have altered "renderParent" slightly to carry over the last web as it traverses upward and moved the "$text" assignment.

The new code is:

# ========================
sub renderParent
{
	 my( $web, $topic, $meta, $args ) = @_;

	 my $text = "";

	 my $dontRecurse;
	 my $prefix;
	 my $usesep;

	 if( $args ) {
		 $dontRecurse = extractNameValuePair( $args, "dontrecurse" );
		 $prefix = extractNameValuePair( $args, "prefix" );
		 $usesep = extractNameValuePair( $args, "seperator" );
	 }

	 if( ! $usesep ) {
		 $usesep = " > ";
	 }

	 my %visited = ();
	 $visited{"$web.$topic"} = 1;

	 my $sep = "";
	 my $cWeb = $web;

	 while( 1 ) {

		  my %parent = $meta->findOne( "TOPICPARENT" );

		  if( %parent ) {

				my $name = $parent{"name"};

				if( $dontRecurse || ! $name ) {

					last;

				} else {

					my $dummy;
					my $pWeb = $cWeb;
					my $pTopic = $name;

					if( $name =~ /^(.*)\.(.*)$/ ) {
						$pWeb = $1;
						$pTopic = $2;
					}

					$text = "$pWeb.$pTopic$sep$text";
					$sep = $usesep;

					if( $visited{"$pWeb.$pTopic"} ) {
						last;
					} else {
						$visited{"$pWeb.$pTopic"} = 1;
					}

					if( TWiki::Store::topicExists( $pWeb, $pTopic ) ) {
						 ( $meta, $dummy ) = TWiki::Store::readTopMeta( $pWeb, $pTopic );
					} else {
						 last;
					}

					$cWeb = $pWeb;

				}

		  } else {

				last;

		  }

	 }

	 if( $prefix ) {
		 $text = "$prefix$text";
	 }

	 $text = handleCommonTags( $text, $topic, $web );
	 $text = getRenderedVersion( $text, $web );

	 return $text;

}

Environment

TWiki version: 8/01 (beta3)
TWiki plugins: none (std)
Server OS: Linux/x86 (Mandrake 6)
Web server: Apache
Perl version: 5.x
Client OS: Win2k, OS X
Web Browser: IE5

-- MichaelKitchin - 17 Aug 2001


I belive you are refering to recursion through a topics parents - well spotted and thanks for the fix. I've done an update, this is a slighly modified fix as the above would fail if recursion was turned off.

I've also corrected code so prefix to parent isn't displayed if there are no parents.

Please try the code from CVS to check the fix.

-- JohnTalintyre - 17 Aug 2001

TopicClassification:
BugResolved
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2001-08-18 - RandyKramer
 
  • 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-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.