*** XpTrackerPlugin.pm.orig Sat Feb 22 19:46:42 2003 --- XpTrackerPlugin.pm Tue Apr 29 10:31:07 2003 *************** *** 1,4 **** - # # Copyright (C) 2000-2001 Andrea Sterbini, a.sterbini@flashnet.it # Copyright (C) 2001 Peter Thoeny, Peter@Thoeny.com --- 1,3 ---- *************** *** 49,112 **** # ========================= package TWiki::Plugins::XpTrackerPlugin; use HTTP::Date; # ========================= use vars qw( ! $web $topic $user $installWeb $VERSION $debug ! $exampleCfgVar $dataDir ! ); ! ! use vars qw ( @timeRec ! $cacheFileName ! %cachedProjectTeams ! %cachedTeamIterations ! %cachedIterationStories ! ); ! ! $VERSION = '3.100'; ! # ========================= sub initPlugin { ! ( $topic, $web, $user, $installWeb ) = @_; ! ! &TWiki::Func::writeDebug( "- TWiki::Plugins::XpTrackerPlugin::initPlugin is OK" ) if $debug; ! ! # check for Plugins.pm versions ! if( $TWiki::Plugins::VERSION < 1 ) { ! &TWiki::Func::writeWarning( "Version mismatch between XpTrackerPlugin and Plugins.pm" ); ! return 0; ! } ! ! $query = &TWiki::Func::getCgiQuery(); ! if( ! $query ) { ! return 0; ! } # Get plugin preferences, the variable defined by: * Set EXAMPLE = ... $exampleCfgVar = &TWiki::Prefs::getPreferencesValue( "XPTRACKERPLUGIN_EXAMPLE" ) || "default"; # Get plugin debug flag $debug = &TWiki::Func::getPreferencesFlag( "XPTRACKERPLUGIN_DEBUG" ); ! ! # reasonable defaults for colouring. By default task and stories ! # have the same colour schemes. ! %defaults = ( ! headercolor => $webColor, ! taskunstartedcolor => '#FFCCCC', ! taskprogresscolor => '#FFFF99', ! taskcompletecolor => '#99FF99', ! storyunstartedcolor => '#FFCCCC', ! storyprogresscolor => '#FFFF99', ! storyacceptancecolor => '#CCFFFF', ! storycompletecolor => '#99FF99' ! ); ! # now get defaults from XpTrackerPlugin topic my $v; ! foreach $option (keys %defaults) { # read defaults from XpTrackerPlugin topic $v = &TWiki::Func::getPreferencesValue("XPTRACKERPLUGIN_\U$option\E") || undef; $defaults{$option} = $v if defined($v); --- 48,128 ---- # ========================= package TWiki::Plugins::XpTrackerPlugin; + use strict; use HTTP::Date; # ========================= use vars qw( ! $web $topic $user $installWeb $VERSION $debug ! $exampleCfgVar $dataDir $pluginName ! @timeRec ! %defaults ! $cacheFileName ! ); ! ! $VERSION = '3.101'; ! $pluginName = "XpTrackerPlugin"; ! ! # reasonable defaults for colouring. By default task and stories ! # have the same colour schemes. ! %defaults = ( ! headercolor => "%WEBBGCOLOR%", ! taskunstartedcolor => '#FFCCCC', ! taskprogresscolor => '#FFFF99', ! taskcompletecolor => '#99FF99', ! storyunstartedcolor => '#FFCCCC', ! storyprogresscolor => '#FFFF99', ! storyacceptancecolor => '#CCFFFF', ! storycompletecolor => '#99FF99' ! ); ! ! my %cachedProjectTeams; ! my %cachedTeamIterations; ! my %cachedIterationStories; ! my %targetOrder; ! my %unstarted; # ========================= sub initPlugin { ! ( $topic, $web, $user, $installWeb ) = @_; ! ! &TWiki::Func::writeDebug( "- TWiki::Plugins::XpTrackerPlugin::initPlugin is OK" ) if $debug; ! ! # check for Plugins.pm versions ! if( $TWiki::Plugins::VERSION < 1 ) { ! &TWiki::Func::writeWarning( "Version mismatch between XpTrackerPlugin and Plugins.pm" ); ! return 0; ! } ! ! my $query = &TWiki::Func::getCgiQuery(); ! if( ! $query ) { ! return 0; ! } ! ! ### ! # attempt to fix cross-web .xpcache corruption ! # will only work when XpTrackerPlugin is disabled in TWikiPreferences ! # and enabled on a per-web basis ! # ! %cachedProjectTeams = undef; ! %cachedTeamIterations = undef; ! %cachedIterationStories = undef; ! %targetOrder = undef; ! %unstarted = undef; ! xpCacheRead($web); ! # ! ### # Get plugin preferences, the variable defined by: * Set EXAMPLE = ... $exampleCfgVar = &TWiki::Prefs::getPreferencesValue( "XPTRACKERPLUGIN_EXAMPLE" ) || "default"; # Get plugin debug flag $debug = &TWiki::Func::getPreferencesFlag( "XPTRACKERPLUGIN_DEBUG" ); ! # now get defaults from XpTrackerPlugin topic my $v; ! foreach my $option (keys %defaults) { # read defaults from XpTrackerPlugin topic $v = &TWiki::Func::getPreferencesValue("XPTRACKERPLUGIN_\U$option\E") || undef; $defaults{$option} = $v if defined($v); *************** *** 138,147 **** # $_[0]=~ s/%WIKIWEB%/$wikiToolName.$web/go; # ========================== START XP TAGS ========================== RJB 2001.03.13 # search for create new page link if( $query->param( 'xpsave' ) ) { ! xpSavePage($web); # return; # in case browser does not redirect } --- 154,167 ---- # $_[0]=~ s/%WIKIWEB%/$wikiToolName.$web/go; # ========================== START XP TAGS ========================== RJB 2001.03.13 + my $text = $_[0]; + my $topic = $_[1]; + my $web = $_[2]; # search for create new page link + my $query = &TWiki::Func::getCgiQuery(); if( $query->param( 'xpsave' ) ) { ! &xpSavePage($web); # return; # in case browser does not redirect } *************** *** 551,556 **** --- 571,577 ---- my $taskCount = 0; # Amount of tasks in this story my @storyStat = ( 0, 0, 0 ); # Array of counts of task status my $storyStatS = ''; + my $color; while(1) { (my $status,my $name,my $est,my $who,my $spent,my $etc,my $tstatus) = xpGetNextTask($storyText); *************** *** 847,853 **** foreach my $story (@allStories) { my $storyText = &TWiki::Store::readTopic($web, $story); ! $targetOrder{$story} = &xpGetValue("\\*Development order\\*", $storyText, "order"); my $storySummary = &xpGetValue("\\*Story summary\\*", $storyText, "notagsforthis"); my $fea = &xpGetValue("\\*FEA\\*", $storyText, "notagsforthis"); --- 868,875 ---- foreach my $story (@allStories) { my $storyText = &TWiki::Store::readTopic($web, $story); ! ! $targetOrder{$story} = &xpGetValue("\\*Development order\\*", $storyText, "order"); my $storySummary = &xpGetValue("\\*Story summary\\*", $storyText, "notagsforthis"); my $fea = &xpGetValue("\\*FEA\\*", $storyText, "notagsforthis"); *************** *** 1520,1526 **** # write out all iterations to table foreach my $project (@projects) { ! $list .= "| $project |\n"; } # append form to allow creation of new projects --- 1542,1548 ---- # write out all iterations to table foreach my $project (@projects) { ! $list .= "| $project |\n" unless $project =~ /^\s*$/; } # append form to allow creation of new projects *************** *** 1535,1542 **** # Get all the projects for the web sub xpGetAllProjects { ! ! return keys %cachedProjectTeams; } ########################### --- 1557,1565 ---- # Get all the projects for the web sub xpGetAllProjects { ! ! return keys %cachedProjectTeams; ! } ########################### *************** *** 1605,1629 **** } # dump information to disk cache file ! my $projCache = ""; ! my $teamCache = ""; ! my $iterCache = ""; ! my @projects = &xpGetAllProjects($web); ! foreach my $project (@projects) { ! ! my @teams = &xpGetProjectTeams($project,$web); ! $projCache .= "PROJ : $project : @teams \n"; ! foreach my $team (@teams) { ! ! my @teamIters = &xpGetTeamIterations($team,$web); ! $teamCache .= "TEAM : $team : @teamIters \n"; ! foreach my $iter (@teamIters) { ! ! my @iterStories = &xpGetIterStories($iter,$web); ! $iterCache .= "ITER : $iter : @iterStories \n"; ! } ! } ! } my $cacheText = $projCache.$teamCache.$iterCache; &TWiki::Store::saveFile($cacheFileName, $cacheText); --- 1628,1659 ---- } # dump information to disk cache file ! my $projCache = ""; ! my $teamCache = ""; ! my $iterCache = ""; ! my @projects = &xpGetAllProjects($web); ! foreach my $project (@projects) { ! ! if ($project =~ /^\s*$/) { ! next ; ! } ! ! my @teams = &xpGetProjectTeams($project,$web); ! $projCache .= "PROJ : $project : @teams \n"; ! ! foreach my $team (@teams) { ! ! my @teamIters = &xpGetTeamIterations($team,$web); ! $teamCache .= "TEAM : $team : @teamIters \n"; ! ! foreach my $iter (@teamIters) { ! ! my @iterStories = &xpGetIterStories($iter,$web); ! $iterCache .= "ITER : $iter : @iterStories \n"; ! ! } ! } ! } my $cacheText = $projCache.$teamCache.$iterCache; &TWiki::Store::saveFile($cacheFileName, $cacheText); *************** *** 1657,1676 **** } } ! # read disk cache ! my $cacheText = &TWiki::Store::readFile($cacheFileName); ! ! while($cacheText =~ s/PROJ : (.*?) : (.*?)\n//) { ! $cachedProjectTeams{$1} = "$2"; ! } ! ! while($cacheText =~ s/TEAM : (.*?) : (.*?)\n//) { ! $cachedTeamIterations{$1} = "$2"; ! } ! ! while($cacheText =~ s/ITER : (.*?) : (.*?)\n//) { ! $cachedIterationStories{$1} = "$2"; ! } } sub xpSavePage() --- 1687,1706 ---- } } ! # read disk cache ! my $cacheText = &TWiki::Store::readFile($cacheFileName); ! ! while($cacheText =~ s/PROJ : (.*?) : (.*?)\n//) { ! $cachedProjectTeams{$1} = "$2"; ! } ! ! while($cacheText =~ s/TEAM : (.*?) : (.*?)\n//) { ! $cachedTeamIterations{$1} = "$2"; ! } ! ! while($cacheText =~ s/ITER : (.*?) : (.*?)\n//) { ! $cachedIterationStories{$1} = "$2"; ! } } sub xpSavePage() *************** *** 1678,1683 **** --- 1708,1714 ---- my ( $web ) = @_; # check the user has entered a non-null string + my $query = &TWiki::Func::getCgiQuery(); my $title = $query->param( 'topic' ); if($title eq "") { TWiki::redirect( $query, &TWiki::getViewUrl( "", "NewPageError" ) ); *************** *** 1714,1725 **** # save new page and open in browser my $error = &TWiki::Store::saveTopic( $web, $title, $text, $meta ); ! TWiki::redirect( $query, &TWiki::getViewUrl( "", $topic ) ); ! &TWiki::Store::lockTopic( $theTopic, "on" ); if( $error ) { ! $url = &TWiki::Func::getOopsUrl( $theWeb, $theTopic, "oopssaveerr", $error ); ! TWiki::redirect( $query, $url ); } } --- 1745,1756 ---- # save new page and open in browser my $error = &TWiki::Store::saveTopic( $web, $title, $text, $meta ); ! TWiki::redirect( $query, &TWiki::getViewUrl( "", $title ) ); ! &TWiki::Store::lockTopic( $title, "on" ); if( $error ) { ! TWiki::redirect($query, ! &TWiki::Func::getOopsUrl( $web, $title, "oopssaveerr", $error )); } } *************** *** 1789,1794 **** --- 1820,1828 ---- } # Show them + my $iterEst = 0; + my $iterSpent = 0; + my $iterEtc = 0; foreach my $story (sort { $targetOrder{$a} <=> $targetOrder{$b} || $a cmp $b } keys %targetStories) { # foreach my $story (sort { $a cmp $b } keys %targetStories) { *************** *** 1809,1814 **** --- 1843,1849 ---- my (@taskName, @taskStat, @taskEst, @taskWho, @taskSpent, @taskEtc) = (); # arrays for each task my $taskCount = 0; # Amount of tasks in this story my @storyStat = ( 0, 0, 0 ); # Array of counts of task status + my $storyStat; while(1) { (my $status,my $name,my $est,my $who,my $spent,my $etc,my $tstatus) = xpGetNextTask($storyText); *************** *** 2023,2029 **** HTTP::Date::str2time($iterDate) - $now; # $projiterSec[$count] = # 8*3600 + # (no) extra time till end of day # Time::ParseDate::parsedate($iterDate,%pdopt) - $now; ! $projiterDate[$count] = $iterDate; } } } --- 2058,2066 ---- HTTP::Date::str2time($iterDate) - $now; # $projiterSec[$count] = # 8*3600 + # (no) extra time till end of day # Time::ParseDate::parsedate($iterDate,%pdopt) - $now; ! # DD: this is the only place @projiterDate is references/used/defined ! # so I'm just commenting it out ! # $projiterDate[$count] = $iterDate; } } }