|
diff -uNr TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/doublecall-same.html new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/doublecall-same.html
--- TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/doublecall-same.html Sat Feb 16 10:30:30 2002
+++ new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/doublecall-same.html Thu Jun 19 01:06:06 2003
@@ -1 +1,5 @@
+THIS IS A TEST PATTERN GOLEN OUTPUT FOR TREEPLUGIN
+THAT WAS NOT PASSING AS OF Wed Jun 18 2003;
+EVEN IF FIXED, THE TEST PATTERN NEEDS TO BE UPDATED
+TO HANDLE SUBSEQUENT TESTS ADDED, eg. non-wiki-word-name.
1 TheOne 1.1 OneOne 1.1.1 OneOneOne 1.2 OneTwo 1.2.1 OneTwoOne 1.2.2 OneTwoTwo 1.2.2.1 OneTwoTwoOne 1.2.2.2 OneTwoTwoThree 1.2.2.3 OneTwoTwoTwo diff -uNr TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/doublecall.html new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/doublecall.html --- TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/doublecall.html Sat Feb 16 10:30:30 2002 +++ new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/doublecall.html Thu Jun 19 01:06:06 2003 @@ -1 +1,5 @@ +THIS IS A TEST PATTERN GOLEN OUTPUT FOR TREEPLUGIN +THAT WAS NOT PASSING AS OF Wed Jun 18 2003; +EVEN IF FIXED, THE TEST PATTERN NEEDS TO BE UPDATED +TO HANDLE SUBSEQUENT TESTS ADDED, eg. non-wiki-word-name. 1 TheOne 1.1 OneOne 1.1.1 OneOneOne 1.2 OneTwo 1.2.1 OneTwoOne 1.2.2 OneTwoTwo 1.2.2.1 OneTwoTwoOne 1.2.2.2 OneTwoTwoThree 1.2.2.3 OneTwoTwoTwo diff -uNr TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-author.html new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-author.html --- TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-author.html Sat Feb 16 10:30:30 2002 +++ new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-author.html Thu Jun 19 01:06:06 2003 @@ -16,5 +16,6 @@ Main.SlavaKozlov, Main.SlavaKozlov, Main.SlavaKozlov, +Main.AndyGlew, Main.SlavaKozlov, Main.SlavaKozlov, diff -uNr TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-colorlevel.html new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-colorlevel.html --- TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-colorlevel.html Sat Feb 16 10:30:30 2002 +++ new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-colorlevel.html Thu Jun 19 01:06:06 2003 @@ -16,5 +16,6 @@ yellow yellow pink +pink yellow pink diff -uNr TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-colorlevel_args.html new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-colorlevel_args.html --- TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-colorlevel_args.html Sat Feb 16 10:30:30 2002 +++ new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-colorlevel_args.html Thu Jun 19 01:06:06 2003 @@ -18,3 +18,4 @@ #ffeeff:green:#aabfdc #ffeeff:green:#aabfdc #ffeeff:green:#aabfdc +#ffeeff:green:#aabfdc diff -uNr TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-colorlevel_onearg.html new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-colorlevel_onearg.html --- TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-colorlevel_onearg.html Sat Feb 16 10:30:28 2002 +++ new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-colorlevel_onearg.html Thu Jun 19 01:06:06 2003 @@ -18,3 +18,4 @@ #ffeeff #ffeeff #ffeeff +#ffeeff diff -uNr TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-count.html new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-count.html --- TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-count.html Sat Feb 16 10:30:28 2002 +++ new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-count.html Thu Jun 19 01:06:06 2003 @@ -1,3 +1,7 @@ +THIS IS A TEST PATTERN GOLEN OUTPUT FOR TREEPLUGIN +THAT WAS NOT PASSING AS OF Wed Jun 18 2003; +EVEN IF FIXED, THE TEST PATTERN NEEDS TO BE UPDATED +TO HANDLE SUBSEQUENT TESTS ADDED, eg. non-wiki-word-name. 1, 1, 1, diff -uNr TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-foo.html new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-foo.html --- TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-foo.html Sat Feb 16 10:30:29 2002 +++ new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-foo.html Thu Jun 19 01:06:06 2003 @@ -18,3 +18,4 @@ foo, foo, foo, +foo, diff -uNr TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-level.html new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-level.html --- TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-level.html Sat Feb 16 10:30:29 2002 +++ new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-level.html Thu Jun 19 01:06:06 2003 @@ -16,5 +16,6 @@ 5, 5, 6, +6, 5, 4, diff -uNr TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-modTime.html new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-modTime.html --- TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-modTime.html Sat Feb 16 10:30:29 2002 +++ new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-modTime.html Thu Jun 19 01:06:06 2003 @@ -16,5 +16,6 @@ 10 Feb 2002 - 15:50, 15 Feb 2002 - 18:15, 15 Feb 2002 - 18:14, +15 Feb 2002 - 18:14, 10 Feb 2002 - 15:51, 15 Feb 2002 - 18:15, diff -uNr TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-onum.html new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-onum.html --- TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-onum.html Sat Feb 16 10:30:30 2002 +++ new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-onum.html Thu Jun 19 01:06:06 2003 @@ -16,5 +16,6 @@ 1.3.2.1, 1.3.2.2, 1.3.2.2.1, +1.3.2.2.2, 1.3.2.3, 1.3.3, diff -uNr TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-spacetopic.html new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-spacetopic.html --- TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-spacetopic.html Sat Feb 16 10:30:29 2002 +++ new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-spacetopic.html Thu Jun 19 01:06:06 2003 @@ -1,20 +1,21 @@ - , -Web Home, -Cgi Table, -Test Topic 1, -Tree Top, -The One, -One One, -One One One, -One Two, -One Two One, -One Two Two, -One Two Two One, -One Two Two Three, -One Two Two Two, -The Three, -Three One, -Three Three, -Three Three One, -Three Two, -The Two, +[[ ]], +[[Web Home]], +[[Cgi Table]], +[[Test Topic 1]], +[[Tree Top]], +[[The One]], +[[One One]], +[[One One One]], +[[One Two]], +[[One Two One]], +[[One Two Two]], +[[One Two Two One]], +[[One Two Two Three]], +[[One Two Two Two]], +[[The Three]], +[[Three One]], +[[Three Three]], +[[Three Three One]], +[[non-wiki-word-name]], +[[Three Two]], +[[The Two]], diff -uNr TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-summary.html new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-summary.html --- TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-summary.html Sat Feb 16 10:30:29 2002 +++ new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/format-summary.html Thu Jun 19 01:06:06 2003 @@ -18,3 +18,4 @@ 1.2 TestTopic1 1.3.1.1.1 OneOneOne , 1.3.1.2.1 OneTwoOne 1.3.1.2.2.1 OneTwoTwoOne 1.3.1.2.2.2 OneTwoTwoThree 1.3.1.2.2.3 OneTwoTwoTwo , , , 1.3.2.1 ThreeOne 1.3.2.2.1 ThreeThreeOne , 1.3.2.3 ThreeTwo , 1.3.3 TheTwo , , , \ No newline at end of file +1.1 [[CgiTable]] 1.2 [[TestTopic1]] 1.3.1.1.1 [[OneOneOne]] , 1.3.1.2.1 [[OneTwoOne]] 1.3.1.2.2.1 [[OneTwoTwoOne]] 1.3.1.2.2.2 [[OneTwoTwoThree]] 1.3.1.2.2.3 [[OneTwoTwoTwo]] , , , 1.3.2.1 [[ThreeOne]] 1.3.2.2.1 [[ThreeThreeOne]] 1.3.2.2.2 [[non-wiki-word-name]] , 1.3.2.3 [[ThreeTwo]] , 1.3.3 [[TheTwo]] , , , \ No newline at end of file diff -uNr TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/formatbranch-format.html new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/formatbranch-format.html --- TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/formatbranch-format.html Sat Feb 16 10:30:29 2002 +++ new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/formatbranch-format.html Thu Jun 19 01:06:06 2003 @@ -1,21 +1,22 @@ - - WebHome - CgiTable -TestTopic1 -TreeTop - TheOne - OneOne - OneOneOne - OneTwo
TheThree ThreeTwo TheTwo [[OneTwo]]
[[TheThree]] [[ThreeTwo]] [[TheTwo]]
diff -uNr TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/formatbranch-parent.html new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/formatbranch-parent.html
--- TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/formatbranch-parent.html Sat Feb 16 10:30:28 2002
+++ new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/formatbranch-parent.html Thu Jun 19 01:06:06 2003
@@ -1 +1 @@
- 1 WebHomeThe TWiki.Test web is the sandbox you can use for testing. Everybody is welcome to add or delete some stuff. It is recommended to walk through the1.1 CgiTablezzzzzzzzzzzzzz horizontal zzzzzzzzz1.2 TestTopic11.3 TreeTopaligned outline with zooming1.3.1 TheOne1.3.1.1 OneOne1.3.1.1.1 OneOneOne1.3.1.2 OneTwo1.3.1.2.1 OneTwoOne1.3.1.2.2 OneTwoTwo1.3.1.2.2.1 OneTwoTwoOne1.3.1.2.2.2 OneTwoTwoThree1.3.1.2.2.3 OneTwoTwoTwo1.3.2 TheThree1.3.2.1 ThreeOne1.3.2.2 ThreeThree1.3.2.2.1 ThreeThreeOne1.3.2.3 ThreeTwo1.3.3 TheTwo[[ ]]1 [[WebHome]]The TWiki.Test web is the sandbox you can use for testing. Everybody is welcome to add or delete some stuff. It is recommended to walk through the1.1 [[CgiTable]]zzzzzzzzzzzzzz horizontal zzzzzzzzz1.2 [[TestTopic1]]1.3 [[TreeTop]]aligned outline with zooming1.3.1 [[TheOne]]1.3.1.1 [[OneOne]]1.3.1.1.1 [[OneOneOne]]1.3.1.2 [[OneTwo]]1.3.1.2.1 [[OneTwoOne]]1.3.1.2.2 [[OneTwoTwo]]1.3.1.2.2.1 [[OneTwoTwoOne]]1.3.1.2.2.2 [[OneTwoTwoThree]]1.3.1.2.2.3 [[OneTwoTwoTwo]]1.3.2 [[TheThree]]1.3.2.1 [[ThreeOne]]1.3.2.2 [[ThreeThree]]1.3.2.2.1 [[ThreeThreeOne]]1.3.2.2.2 [[non-wiki-word-name]]1.3.2.3 [[ThreeTwo]]1.3.3 [[TheTwo]]
1 WebHome 1.1 CgiTable 1.2 TestTopic1 1.3 TreeTop 1.3.1 TheOne 1.3.1.1 OneOne 1.3.1.1.1 OneOneOne 1.3.1.2 OneTwo 1.3.1.2.1 OneTwoOne 1.3.1.2.2 OneTwoTwo 1.3.1.2.2.1 OneTwoTwoOne 1.3.1.2.2.2 OneTwoTwoThree 1.3.1.2.2.3 OneTwoTwoTwo 1.3.2 TheThree 1.3.2.1 ThreeOne 1.3.2.2 ThreeThree 1.3.2.2.1 ThreeThreeOne 1.3.2.3 ThreeTwo 1.3.3 TheTwo \ No newline at end of file + [[ ]] 1 [[WebHome]] 1.1 [[CgiTable]] 1.2 [[TestTopic1]] 1.3 [[TreeTop]] 1.3.1 [[TheOne]] 1.3.1.1 [[OneOne]] 1.3.1.1.1 [[OneOneOne]] 1.3.1.2 [[OneTwo]] 1.3.1.2.1 [[OneTwoOne]] 1.3.1.2.2 [[OneTwoTwo]] 1.3.1.2.2.1 [[OneTwoTwoOne]] 1.3.1.2.2.2 [[OneTwoTwoThree]] 1.3.1.2.2.3 [[OneTwoTwoTwo]] 1.3.2 [[TheThree]] 1.3.2.1 [[ThreeOne]] 1.3.2.2 [[ThreeThree]] 1.3.2.2.1 [[ThreeThreeOne]] 1.3.2.2.2 [[non-wiki-word-name]] 1.3.2.3 [[ThreeTwo]] 1.3.3 [[TheTwo]] \ No newline at end of file diff -uNr TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/formatting-ullist.html new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/formatting-ullist.html --- TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/formatting-ullist.html Sat Feb 16 10:30:29 2002 +++ new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/formatting-ullist.html Thu Jun 19 01:06:06 2003 @@ -1 +1 @@ -
1 [[WebHome]] 1.1 [[CgiTable]] 1.2 [[TestTopic1]] 1.3 [[TreeTop]] 1.3.1 [[TheOne]] 1.3.1.1 [[OneOne]] 1.3.1.1.1 [[OneOneOne]] 1.3.1.2 [[OneTwo]] 1.3.1.2.1 [[OneTwoOne]] 1.3.1.2.2 [[OneTwoTwo]] 1.3.1.2.2.1 [[OneTwoTwoOne]] 1.3.1.2.2.2 [[OneTwoTwoThree]] 1.3.1.2.2.3 [[OneTwoTwoTwo]] 1.3.2 [[TheThree]] 1.3.2.1 [[ThreeOne]] 1.3.2.2 [[ThreeThree]] 1.3.2.2.1 [[ThreeThreeOne]] 1.3.2.2.2 [[non-wiki-word-name]] 1.3.2.3 [[ThreeTwo]] 1.3.3 [[TheTwo]] [[Main.AndyGlew]] 1 [[CrossWebParent]] [[NonexistentParentParentPage]] 1 [[NonexistentParent]] [[ParentCycle1 cycle...]] 1 [[ParentCycle2]] 1.1 [[BranchOff1ParentCycle2]] 1.2 [[BranchOff2ParentCycle2]] 1.3 [[ParentCycle1]] 1.3.1 [[BranchOff1ParentCycle1]] 1.3.2 [[ParentCycle2 ...cycle]] [[Sandbox.ParentInSandbox]] 1 [[PageCreatedInSandboxWebWithParentAndChildInSandbox]] [[SelfParent cycle...]] 1 [[SelfParent]] 1.1 [[SelfParent ...cycle]] \ No newline at end of file diff -uNr TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/header.html new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/header.html --- TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/header.html Sat Feb 16 10:30:29 2002 +++ new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/header.html Thu Jun 19 01:06:06 2003 @@ -1,2 +1,2 @@ HEADER TEXT - 1 WebHome 1.1 CgiTable 1.2 TestTopic1 1.3 TreeTop 1.3.1 TheOne 1.3.1.1 OneOne 1.3.1.1.1 OneOneOne 1.3.1.2 OneTwo 1.3.1.2.1 OneTwoOne 1.3.1.2.2 OneTwoTwo 1.3.1.2.2.1 OneTwoTwoOne 1.3.1.2.2.2 OneTwoTwoThree 1.3.1.2.2.3 OneTwoTwoTwo 1.3.2 TheThree 1.3.2.1 ThreeOne 1.3.2.2 ThreeThree 1.3.2.2.1 ThreeThreeOne 1.3.2.3 ThreeTwo 1.3.3 TheTwo \ No newline at end of file + [[ ]] 1 [[WebHome]] 1.1 [[CgiTable]] 1.2 [[TestTopic1]] 1.3 [[TreeTop]] 1.3.1 [[TheOne]] 1.3.1.1 [[OneOne]] 1.3.1.1.1 [[OneOneOne]] 1.3.1.2 [[OneTwo]] 1.3.1.2.1 [[OneTwoOne]] 1.3.1.2.2 [[OneTwoTwo]] 1.3.1.2.2.1 [[OneTwoTwoOne]] 1.3.1.2.2.2 [[OneTwoTwoThree]] 1.3.1.2.2.3 [[OneTwoTwoTwo]] 1.3.2 [[TheThree]] 1.3.2.1 [[ThreeOne]] 1.3.2.2 [[ThreeThree]] 1.3.2.2.1 [[ThreeThreeOne]] 1.3.2.2.2 [[non-wiki-word-name]] 1.3.2.3 [[ThreeTwo]] 1.3.3 [[TheTwo]] \ No newline at end of file diff -uNr TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/stoplevel.html new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/stoplevel.html --- TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/stoplevel.html Sat Feb 16 10:30:30 2002 +++ new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/stoplevel.html Thu Jun 19 01:06:06 2003 @@ -1 +1 @@ - 1 WebHome 1.1 CgiTable 1.2 TestTopic1 1.3 TreeTop 1.3.1 TheOne 1.3.2 TheThree 1.3.3 TheTwo \ No newline at end of file + [[ ]] 1 [[WebHome]] 1.1 [[CgiTable]] 1.2 [[TestTopic1]] 1.3 [[TreeTop]] 1.3.1 [[TheOne]] 1.3.2 [[TheThree]] 1.3.3 [[TheTwo]] \ No newline at end of file diff -uNr TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/topic.html new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/topic.html --- TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/topic.html Sat Feb 16 10:30:30 2002 +++ new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test/treeout/topic.html Thu Jun 19 01:06:06 2003 @@ -1 +1,5 @@ +THIS IS A TEST PATTERN GOLEN OUTPUT FOR TREEPLUGIN +THAT WAS NOT PASSING AS OF Wed Jun 18 2003; +EVEN IF FIXED, THE TEST PATTERN NEEDS TO BE UPDATED +TO HANDLE SUBSEQUENT TESTS ADDED, eg. non-wiki-word-name. 1 TheOne 1.1 OneOne 1.1.1 OneOneOne 1.2 OneTwo 1.2.1 OneTwoOne 1.2.2 OneTwoTwo 1.2.2.1 OneTwoTwoOne 1.2.2.2 OneTwoTwoThree 1.2.2.3 OneTwoTwoTwo Binary files TreePlugin/lib/TWiki/Plugins/TreePlugin/test.tar.gz and new/TreePlugin/lib/TWiki/Plugins/TreePlugin/test.tar.gz differ diff -uNr TreePlugin/lib/TWiki/Plugins/TreePlugin.pm new/TreePlugin/lib/TWiki/Plugins/TreePlugin.pm --- TreePlugin/lib/TWiki/Plugins/TreePlugin.pm Mon Jan 20 13:01:14 2003 +++ new/TreePlugin/lib/TWiki/Plugins/TreePlugin.pm Thu Jul 3 18:28:11 2003 @@ -1,4 +1,4 @@ -# + # TWiki ($wikiversion has version info) # # Copyright (C) 2002 Slava Kozlov, @@ -21,7 +21,7 @@ # ========================= package TWiki::Plugins::TreePlugin; -#use TWiki::Func; +use TWiki::Func; use TWiki::Plugins::TreePlugin::TWikiNode; use TWiki::Plugins::TreePlugin::ListNodeFormatter; @@ -38,7 +38,7 @@ $VERSION = '0.310'; -$RootLabel = "_"; # what we use to label the root of a tree if not a topic +$RootLabel = "_RootLabel_"; # what we use to label the root of a tree if not a topic $cgi = &TWiki::Func::getCgiQuery(); @@ -130,6 +130,15 @@ # 2) if two topics with identical names in different webs AND # both have a TREEVIEW tag -> the second will be excluded + + +$AGdebugmsg = " AG debug message "; + +# bugs re recursion: +# 1) doesn't remember webs so: recursion across webs is problematic +# 2) if two topics with identical names in different webs AND +# both have a TREEVIEW tag -> the second will be excluded + sub handleTreeView { my ($topic, $web, $attributes) = @_; @@ -150,7 +159,7 @@ $TreeTopics{$attrTopic} = 1; my $attrHeader = TWiki::Func::extractNameValuePair( $attributes, "header" ) || ""; - $attrHeader .= "\n" if ($attrHeader); # to enable |-tables foramtting + $attrHeader .= "\n" if ($attrHeader); # to enable |-tables formatting my $attrFormat = TWiki::Func::extractNameValuePair( $attributes, "format" ) || ""; $attrFormat .= "\n" if ($attrFormat); # to enable |-tables formatting my $attrFormatBranch = TWiki::Func::extractNameValuePair( $attributes, "formatbranch" ) || ""; @@ -206,6 +215,7 @@ $node->data("text", $text); $node->data("meta", $meta); } + $node->data("parent", $parent); $parent->add_child($node); # hook me up } @@ -214,12 +224,96 @@ $root->name(" "); # change root's name so it don't show up, hack # format the tree & parse TWiki tags and rendering - return TWiki::Func::expandCommonVariables( - $attrHeader.$nodes{$attrTopic}->toHTMLFormat($formatter), - $attrTopic, - $attrWeb); + if( $attrTopic ne $RootLabel ) { + return "Tree for specific topic $attrTopic\n". + TWiki::Func::expandCommonVariables + ( + $attrHeader.$nodes{$attrTopic}->toHTMLFormat($formatter), + $attrTopic, + $attrWeb); + } + else { + my $ret = ""; + #debug $ret = "Keys of topics in node list\n\n"; + my %rootnodes = %{_findRootsBreakingCycles( \%nodes )}; + foreach my $i ( sort keys( %rootnodes ) ) { + $ret = $ret + #debug . " Tree for topic $i:\n\n" + . TWiki::Func::expandCommonVariables + ( + $attrHeader.$rootnodes{$i}->toHTMLFormat($formatter), + $attrTopic, + $attrWeb) + ; + } + #$ret = $AGdebugmsg . $ret; + return $ret; + } +} + +sub _findRootsBreakingCycles { + my ($hashMappingNamesToNodes) = @_; + my %roots = (); + + $AGdebugmsg = ""; + foreach my $i ( sort keys( %$hashMappingNamesToNodes ) ) { + my $ultimateParentNode = _findUltimateParentBreakingCycles( ${$hashMappingNamesToNodes}{$i} ); + $roots{$ultimateParentNode->name()} = $ultimateParentNode; + } + + return \%roots; } +sub _findUltimateParentBreakingCycles { + my $orignode = shift; + my $node = $orignode; + my %alreadyvisited = (); + while( $parent = _findParent( $node ) ) { + # break cycles + if( $alreadyvisited{$parent->name()} ) { + $AGdebugmsg = $AGdebugmsg . "pre-rm:" . $parent->toStringNonRecursive() . " \n"; + $parent->remove_child( $node ); + $AGdebugmsg = $AGdebugmsg . "post-rm:" . $parent->toStringNonRecursive() . " \n"; + $AGdebugmsg = + $AGdebugmsg + . $parent->name() ."<-". $node->name() ." \n \n"; + my $cycleroot = TWiki::Plugins::TreePlugin::TWikiNode->new($parent->name() . " cycle..."); + my $cycleleaf = TWiki::Plugins::TreePlugin::TWikiNode->new($node->name() . " ...cycle"); + $node->data("parent",$cycleroot); + $cycleroot->add_child($node); + $parent->add_child($cycleleaf); + # TBD: give some indication of cycle broken + return $cycleroot; + } + else { + $alreadyvisited{$parent->name()} = 1; + } + # move up + $node = $parent; + } + $AGdebugmsg = + $AGdebugmsg + . "findUltimateParent(" + . $orignode->name() + . ")" + . "=" + . $node->name() + . " "; + return $node; +} + +sub _findParent { + my $node = shift; + $AGdebugmsg = + $AGdebugmsg + . "findParent(" + . $node->name() + . ")" + . "=" + . ($node->data("parent") ? $node->data("parent")->name() : "no-parent") + . " "; + return $node->data("parent"); +} # lazy variable init # ned to abstract this at some point @@ -259,14 +353,17 @@ } +# TBD: so far as I can tell, the code below is mis-commented. +# It is not finding a child of a node via the lookup; +# instead, it is finding an entry for the node itself. sub _findTWikiNode { my ($name, $hash) = @_; - my $child = $hash->{$name}; # look for child - if (! $child) { # create if not there - $child = TWiki::Plugins::TreePlugin::TWikiNode->new($name); - $hash->{$name} = $child; + my $node = $hash->{$name}; # look for node + if (! $node) { # create if not there + $node = TWiki::Plugins::TreePlugin::TWikiNode->new($name); + $hash->{$name} = $node; } - return $child; + return $node; } # use cgi var to override given variable ref @@ -275,8 +372,13 @@ my $variable = shift; my $paramname = shift; - my $tmp = $cgi->param( $paramname ); - $$variable = $tmp if( $tmp ); + if( ! $cgi ) { + return; + } + else { + my $tmp = $cgi->param( $paramname ); + $$variable = $tmp if( $tmp ); + } } # allow other classes to see the installation web |