*** TreePlugin-for-4.0.pm Tue Feb 7 11:07:00 2006 --- TreePlugin-orig.pm Tue Feb 7 11:12:12 2006 *************** *** 33,45 **** # ========================= use vars qw( $web $topic $user $installWeb $VERSION $debug $INTREE ! %FormatMap $RootLabel ); $VERSION = '0.311'; $RootLabel = "_RootLabel_"; # what we use to label the root of a tree if not a topic # ========================= sub initPlugin { --- 33,47 ---- # ========================= use vars qw( $web $topic $user $installWeb $VERSION $debug $INTREE ! %FormatMap %TreeTopics $RootLabel $cgi $CurrUrl ); $VERSION = '0.311'; $RootLabel = "_RootLabel_"; # what we use to label the root of a tree if not a topic + $cgi = &TWiki::Func::getCgiQuery(); + # ========================= sub initPlugin { *************** *** 60,69 **** &TWiki::Func::writeDebug( "installWeb: $installWeb" ) if $debug; ! my $cgi = &TWiki::Func::getCgiQuery(); if( ! $cgi ) { return 0; } # Plugin correctly initialized &TWiki::Func::writeDebug( "- TWiki::Plugins::TreePlugin::initPlugin( $web.$topic ) is OK" ) if $debug; --- 62,76 ---- &TWiki::Func::writeDebug( "installWeb: $installWeb" ) if $debug; ! # mod_perl will have trouble because these three vals are globals ! %TreeTopics = (); if( ! $cgi ) { return 0; } + my $plist = $cgi->query_string(); + $plist .= "\&" if $plist; + $CurrUrl = $cgi->url . $cgi->path_info() . "?" . $plist; + # $CurrUrl =~ s/\&/\&/go; # Plugin correctly initialized &TWiki::Func::writeDebug( "- TWiki::Plugins::TreePlugin::initPlugin( $web.$topic ) is OK" ) if $debug; *************** *** 137,147 **** my ($topic, $web, $attributes) = @_; - my $cgi = &TWiki::Func::getCgiQuery(); - my $plist = $cgi->query_string(); - $plist .= "\&" if $plist; - $CurrUrl = $cgi->url . $cgi->path_info() . "?" . $plist; - # $CurrUrl =~ s/\&/\&/go; my $attrWeb = TWiki::Func::extractNameValuePair( $attributes, "web" ) || $web || ""; my $attrTopic = TWiki::Func::extractNameValuePair( $attributes, "topic" ) || $RootLabel; # ie, do all web, needs to be nonempty --- 144,149 ---- *************** *** 149,160 **** cgiOverride(\$attrTopic, "treetopic"); cgiOverride(\$attrFormatting, "formatting"); ! # we've expanded TREESEARCH on this topic before, we won't repeat ! # return "" if ($TreeTopics{$topic}); ! # # global hash, record this object and attrTopic too (as initial seed) ! # $TreeTopics{$topic} = 1; ! # $TreeTopics{$attrTopic} = 1; my $attrHeader = TWiki::Func::extractNameValuePair( $attributes, "header" ) || ""; $attrHeader .= "\n" if ($attrHeader); # to enable |-tables formatting --- 151,163 ---- cgiOverride(\$attrTopic, "treetopic"); cgiOverride(\$attrFormatting, "formatting"); ! # we've expanded TRESEARCH on this topic before, we won't repeat ! return "" ! if ($TreeTopics{$topic}); ! # global hash, record this object and attrTopic too (as initial seed) ! $TreeTopics{$topic} = 1; ! $TreeTopics{$attrTopic} = 1; my $attrHeader = TWiki::Func::extractNameValuePair( $attributes, "header" ) || ""; $attrHeader .= "\n" if ($attrHeader); # to enable |-tables formatting *************** *** 195,202 **** # get parent my( $meta, $text ) = &TWiki::Func::readTopic( $attrWeb, $topic ); ! my $ref = $meta->get( "TOPICPARENT" ); ! my %par = (defined $ref ? %$ref : ()); my $parent = ( %par ) ? _findTWikiNode($par{"name"}, \%nodes) # yes i have a parent, get it : $root; # otherwise root's my parent --- 198,204 ---- # get parent my( $meta, $text ) = &TWiki::Func::readTopic( $attrWeb, $topic ); ! my %par = $meta->findOne( "TOPICPARENT" ); my $parent = ( %par ) ? _findTWikiNode($par{"name"}, \%nodes) # yes i have a parent, get it : $root; # otherwise root's my parent *************** *** 371,377 **** my $variable = shift; my $paramname = shift; - my $cgi = &TWiki::Func::getCgiQuery(); if( ! $cgi ) { return; } --- 373,378 ---- *************** *** 408,416 **** my $formfields; # so: is new topic to have a form? if so, put in new fields ! my $ref = $meta->get( "FORM" ); ! my %form = (defined $ref ? %$ref : ()); ! #my %form = $meta->get( "FORM" ); if( %form ) { my $name = $form{"name"}; $formfields = &TWiki::Form::getFieldParams($meta); --- 409,415 ---- my $formfields; # so: is new topic to have a form? if so, put in new fields ! my %form = $meta->findOne( "FORM" ); if( %form ) { my $name = $form{"name"}; $formfields = &TWiki::Form::getFieldParams($meta); *************** *** 438,446 **** } # get this form name ! my $ref = $meta->get( "FORM" ); ! my %form = (defined $ref ? %$ref : ()); ! #my %form = $meta->get( "FORM" ); my $name = $form{"name"} if ( %form ) || ""; # get new form name, if any --- 437,443 ---- } # get this form name ! my %form = $meta->findOne( "FORM" ); my $name = $form{"name"} if ( %form ) || ""; # get new form name, if any