/twiki/templates% diff actionnotify.tmpl.20020214 actionnotify.tmpl
5,6c5,11
< Content-Type: text/html; charset=us-ascii
< Content-Transfer-Encoding: 7bit
---
> Content-Type: multipart/alternative;
>         boundary="=====================_64421935==_.ALT"
>
> --=====================_64421935==_.ALT
> Content-Type: text/plain; charset="us-ascii"
>
> This is an automated notification from %WIKITOOLNAME%.
7a13,18
> Actions that require your attention follow:
>
> %ACTIONS_AS_STRING%
> --=====================_64421935==_.ALT
> Content-Type: text/html; charset="us-ascii"
> Content-Transfer-Encoding: 7bit
9c20,22
< <p>
---
> <html>
> <body>
> <p />
11c24
< <p>
---
> <p />
13,14c26,29
< <p>
< %EMAILBODY%
---
> <p />
> %ACTIONS_AS_HTML%
> </body>
> </html>
15a31
> --=====================_64421935==_.ALT--


/twiki/templates% diff editaction.tmpl.20020214 editaction.tmpl
27,30c27,29
< <FORM METHOD="post" ACTION="%SCRIPTURLPATH%/previewaction/%WEB%/%TOPIC%"
< ENCTYPE="application/x-www-form-urlencoded">
< <table border=1>
<  <tr bgcolor=FFCC66><th>Assignee</th><th>Due date</th><th>State</th></tr>
---
> <form method="post" action="%SCRIPTURLPATH%/previewaction/%WEB%/%TOPIC%" enctype="application/x-www-form-urlencoded">
> <table border="1">
>  <tr bgcolor="#FFCC66"><th>Assignee</th><th>Due date</th><th>State</th></tr>
32,38c31,37
<   <td align=center><INPUT TYPE="text" NAME="who" VALUE="%WHO%"></td>
<   <td align=center><INPUT TYPE="text" NAME="due" VALUE="%DUE%"></td>
<   <td align=center>
<    <SELECT NAME="state">
<      <OPTION NAME="open" %OPENSELECT%>open</OPTION>
<      <OPTION NAME="closed" %CLOSEDSELECT%>closed</OPTION>
<    </SELECT>
---
>   <td align="center"><input type="text" name="who" value="%WHO%" /></td>
>   <td align="center"><input type="text" name="due" value="%DUE%" /></td>
>   <td align="center">
>    <select name="state">
>      <option name="open" %OPENSELECT%>open</option>
>      <option name="closed" %CLOSEDSELECT%>closed</option>
>    </select>
42,43c41,42
<   <td colspan=3>
<    <TEXTAREA NAME="text" wrap="virtual" ROWS="%EBH%" COLS="%EBW%">%TEXT%</TEXTAREA>
---
>   <td colspan="3">
>    <textarea name="text" wrap="virtual" rows="%EBH%" cols="%EBW%">%TEXT%</textarea>
57c56,57
<   %TMPL:P{"sep"}% <a href="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/%WEB%/%TOPIC%?unlock=on">Cancel</a> edit %TMPL:END%
---
>   %TMPL:P{"sep"}% <a href="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/%WEB%/%TOPIC%?unlock=on">Cancel</a>
> edit %TMPL:END%
64d63
<


/twiki/bin% diff actionnotify.20020214 actionnotify
24c24,25
< ActionNotify::actionNotify( $ARGV[0] );
---
> my $attrs = join( ',', @ARGV );
> ActionNotify::actionNotify( $attrs );


/twiki/bin% diff editaction.20020214 editaction
24a25
> use TWiki::Plugins::ActionTrackerPlugin::Attrs;
47d47
<     my $tmpl = "";
98c98
<         &TWiki::Store::writeLog( "editaction", "$webName.$topic" );
---
>         &TWiki::Store::writeLog( "editaction", "$webName.$topic", "" );
126,127c126,127
<     $text =~ s/\s*<p>/\n\n/go;
<     $text =~ s/\s*<br>/\n/go;
---
>     $text =~ s/\s*<p ?\/?>/\n\n/go;
>     $text =~ s/\s*<br ?\/?>/\n/go;
137,140c137,140
<     my $openselect;
<     my $closedselect;
<     $openselect = "SELECTED" if ( $state eq "open" );
<     $closedselect = "SELECTED" if ( $state eq "closed" );
---
>     my $openselect = "";
>     my $closedselect = "";
>     $openselect   = 'selected="selected"' if ( $state eq "open" );
>     $closedselect = 'selected="selected"' if ( $state eq "closed" );


/twiki/bin% diff previewaction.20020214 previewaction
123,124c123,124
<     $desc =~ s/\r?\n\r?\n/ <p>/sgo;
<     $desc =~ s/\r?\n/ <br>/sgo;
---
>     $desc =~ s/\r?\n\r?\n/ <p \/>/sgo;
>     $desc =~ s/\r?\n/ <br \/>/sgo;
127c127
<     $text .= "%ACTION{who=$who,due=\"$due\",$state}% $desc\n";
---
>     $text .= "%ACTION{ who=\"$who\" due=\"$due\" state=\"$state\" }% $desc\n";


twiki/lib/TWiki/Plugins% ActionTrackerPlugin.pm.20020214 ActionTrackerPlugin.pm
24,25d23
< use TWiki::Plugins::ActionTrackerPlugin::Action;
< use TWiki::Plugins::ActionTrackerPlugin::ActionSet;
29,30c27,28
<           $web $topic $user $installWeb $VERSION
<           $allActions
---
>           $web $topic $user $installWeb $debug $VERSION
>           $allActions $pluginInitialized $perlTimeParseDateFound
33a32,33
> $pluginInitialized = 0;
> $perlTimeParseDateFound = 0;
44a45,50
>   # Get plugin debug flag
>   $debug = &TWiki::Func::getPreferencesFlag( "ACTIONTRACKERPLUGIN_DEBUG" ) || 0;
>
>   &TWiki::Func::writeDebug( "- TWiki::Plugins::ActionTrackerPlugin::initPlugin($web.$topic) is OK" ) if $debug;
>   $pluginInitialized = 0;
>
58a65,72
>   if ( $_[0] !~ m/%ACTION.*{.*}%/) {
>     # nothing to do
>     return;
>   }
>   unless( $pluginInitialized ) {
>     return unless( _init_defaults() );
>   }
>
66c80
<       my $formatted .= "<tr valign=top>" . $action->formatAsTableData( "name" ) . "</tr>";
---
>       my $formatted .= "<tr valign=\"top\">" . $action->formatAsTableData( "name" ) . "</tr>\n";
69,70c83,84
<     $aset = "<table border=1>" .
<       "<tr bgcolor=$Action::hdrcol><th>Assignee</th>".
---
>     $aset = "<table border=\"1\">" .
>       "<tr bgcolor=\"$Action::hdrcol\"><th>Assignee</th>".
73c87
<           "<th>State</th><th>&nbsp;</th></tr>$aset</table>";
---
>           "<th>State</th><th>&nbsp;</th></tr>\n$aset</table>";
76a91,92
>
>
118d133
<
125a141,180
> }
>
> # =========================
> # Lazy initialize of plugin 'cause of performance
> sub _init_defaults
> {
>   $libsFound = 0;
>   eval {
>     require Exporter;
>     $perlTimeParseDateFound = require Time::ParseDate;
>     # If the Time::ParseDate module is not found, then there is no use in
>     # including any of the following.
>     if( $perlTimeParseDateFound ) {
>       eval {
>         $libsFound = require TWiki::Plugins::ActionTrackerPlugin::Action;
>         require TWiki::Plugins::ActionTrackerPlugin::ActionSet;
>         require TWiki::Plugins::ActionTrackerPlugin::Attrs;
>       };
>       unless( $libsFound ) {
>         # Could not find ActionTrackerPlugin utility libs possibly because
>         # of relative use lib dir and chdir after initialization.
>         # Try again with absolute TWiki lib dir path
>         eval {
>           my $libDir = TWiki::getTWikiLibDir();
>           $libDir =~ /(.*)/;
>           $libDir = $1;       # untaint
>           $libsFound = require "$libDir/TWiki/Plugins/ActionTrackerPlugin/Action.pm";
>           require "$libDir/TWiki/Plugins/ActionTrackerPlugin/ActionSet.pm";
>           require "$libDir/TWiki/Plugins/ActionTrackerPlugin/Attrs.pm";
>         };
>       }
> #      @TWiki::Plugins::ISA = qw(
> #          TWiki::Plugins::ActionTrackerPlugin::Action;
> #          TWiki::Plugins::ActionTrackerPlugin::ActionSet;
> #          TWiki::Plugins::ActionTrackerPlugin::Attrs;
> #        );
>     }
>   };
>   $pluginInitialized = 1;
>   return $libsFound;


twiki/lib/TWiki/Plugins/ActionTrackerPlugin% diff Action.pm.20020214 Action.pm
55c55,57
<     if (defined $attr->get( "closed" )) {
---
>     if (defined $attr->get( "state" )) {
>       $this->{STATE} = $attr->get( "state" );
>     } elsif (defined $attr->get( "closed" )) {
162c164,166
<       return 0 unless ( $this->{WEB} =~ /^$web$/ );
---
>       if ( $web ) {
>         return 0 unless ( $this->{WEB} =~ /^$web$/ );
>       }
167c171,173
<       return 0 unless ( $this->{TOPIC} =~ /^$topic$/ );
---
>       if ( $topic ) {
>         return 0 unless ( $this->{TOPIC} =~ /^$topic$/ );
>       }
171,184c177,198
<       my $who = canonicalName( $a->get("who") );
<       return 0 unless ( $this->{WHO} eq $who );
<     }
<
<     if ( defined($a->get("open")) ) {
<       return 0 unless $this->{STATE} eq "open";
<     }
<
<     if ( defined($a->get("closed")) ) {
<       return 0 unless $this->{STATE} eq "closed";
<     }
<
<     if ( defined($a->get("late")) ) {
<       return 0 unless $this->daysToGo() < 0;
---
>       my $who = $a->get("who");
>       if ( $who ) {
>         $who = canonicalName( $who );
>         return 0 unless ( $this->{WHO} eq $who );
>       }
>     }
>
>     my $state = "";
>     if (defined $a->get( "state" )) {
>       $state = $a->get( "state" );
>     } elsif (defined $a->get( "closed" )) {
>       $state = "closed";
>     } elsif (defined $a->get( "open" )) {
>       $state = "open";
>     } elsif (defined $a->get( "late" )) {
>       $state = "late";
>     }
>
>     if ( $state eq "late" ) {
>       return 0 unless $this->daysToGo() < 0 && $this->{STATE} ne "closed";
>     } elsif ( $state ) {
>       return 0 unless $this->{STATE} eq $state;
188c202,205
<       return 0 unless $this->daysToGo() <= $a->get("within");
---
>       my $within = $a->get("within");
>       if ( $within ) {
>         return 0 unless $this->daysToGo() <= $within;
>       }
210c227
<       $text .= " bgcolor=$badcol";
---
>       $text .= " bgcolor=\"$badcol\"";
212c229
<       $text .= " bgcolor=$latecol";
---
>       $text .= " bgcolor=\"$latecol\"";
220c237
<       $rest =~ s/<br>/\n/sgo;
---
>       $rest =~ s/<br \/>/\n/sgo;
222a240
>       $rest =~ s/\n/ /sgo;
229,230c247,249
<       $tmp =~ s/<br>/\n/sgo;
<       $text .= "<A name=\"$anchor\"></A> " . $tmp;
---
>       $tmp =~ s/<br \/>/\n/sgo;
>       $tmp =~ s/\n/ /sgo;
>       $text .= "<a name=\"$anchor\"></a> " . $tmp;
234c253
<     $text .= "<td><A href=\"%SCRIPTURLPATH%/editaction%SCRIPTSUFFIX%/";
---
>     $text .= "<td><a href=\"%SCRIPTURLPATH%/editaction%SCRIPTSUFFIX%/";
243c262,277
<     my $this = shift;
---
>     my ( $this, $type ) = @_;
>
>     my $text = "";
>     my $sep = " ";
>     if ( defined( $type ) && $type eq "href" ) {
>       # generate multi line string with link
>       $sep = "\n  ";
>       my $anchor = "AcTion" . $this->{ACTION_NUMBER};
>       $anchor =~ s/[^A-Za-z0-9]//go;
>       $text .= TWiki::Func::getViewUrl( $this->{WEB}, $this->{TOPIC} )
>              . "#$anchor" . $sep;
>     } else {
>       # generate single line string without link
>       $text .= $this->{WEB} . "." . $this->{TOPIC} . "/"
>              . $this->{ACTION_NUMBER} . ":" . $sep;
>     }
245,246d278
<     my $text = $this->{WEB} . "." . $this->{TOPIC} .
<       "/" . $this->{ACTION_NUMBER} . ": ";
252,253c284
<     $text .= " action for " . $this->{WHO} .
<       ", due " . $this->dueString();
---
>     $text .= " action for " . $this->{WHO} . ", due " . $this->dueString();
255c286,289
<     $text .= ": " . $this->{TEXT};
---
>     my $descr = $this->{TEXT}; # keep only first line
>     $descr =~ s/(<br \/>|\n).*//so;
>     $descr =~ s/^\s*//o;
>     $text .= ":" . $sep . $descr . $sep;


twiki/lib/TWiki/Plugins/ActionTrackerPlugin% diff ActionNotify.pm.20020214 ActionNotify.pm
107a108
>     my $mainweb = TWiki::Func::getMainWebname();
111d111
<       my $mainweb = TWiki::Func::getMainWebname();
154,157c154,157
<
<     my $emailbody = $actions->formatAsTable( "href" );
<     $emailbody = TWiki::Func::renderText( $emailbody );
<     my $plaintext = $actions->formatAsString();
---
>
>     my $asString = $actions->formatAsString( "href" );
>     my $asHtml = $actions->formatAsTable( "href" );
>     $asHtml = TWiki::Func::renderText( $asHtml );
163,164c163,166
<     $text =~ s/%EMAILBODY%/$emailbody/go;
<     $text = TWiki::Func::expandCommonVariables( $text );
---
>     $text =~ s/%ACTIONS_AS_STRING%/$asString/go;
>     $text =~ s/%ACTIONS_AS_HTML%/$asHtml/go;
>     $text =~ s/%EMAILBODY%/$asHtml/go;  # deprecated
>     $text = TWiki::Func::expandCommonVariables( $text, $TWiki::mainTopicname );
167c169
<     my $sun = $TWiki::defaultUrlHost . $sup;
---
>     my $sun = TWiki::Func::getUrlHost . $sup;
168a171
>     $text =~ s|</*nop[ /]*>||goi;


twiki/lib/TWiki/Plugins/ActionTrackerPlugin% ActionSet.pm.20020214 ActionSet.pm
81,82c81,82
<     my $text = "<table border=2>\n" .
<       "<tr bgcolor=$Action::hdrcol><th>Assignee</th>".
---
>     my $text = "<table border=\"2\">\n" .
>       "<tr bgcolor=\"$Action::hdrcol\"><th>Assignee</th>".
87c87
<       $text .= "<tr valign=top>" . $action->formatAsTableData( $type ) . "</tr>\n";
---
>       $text .= "<tr valign=\"top\">" . $action->formatAsTableData( $type ) . "</tr>\n";
95c95
<     my $this = shift;
---
>     my ( $this, $type ) = @_;
100c100
<       $text .= $action->formatAsString . "\n";
---
>       $text .= $action->formatAsString( $type ) . "\n";
136c136
<     my $topics = $attrs->get( "topic" );
---
>     my $topics = $attrs->get( "topic" ) || "";
144c144
<       if ( !defined( $topics ) || $topic =~ /^$topics$/ ) {
---
>       if ( ! $topics || $topic =~ /^$topics$/ ) {


twiki/lib/TWiki/Plugins/ActionTrackerPlugin% Attrs.pm.20020214 Attrs.pm
40c40
<         $this->{$1} = 1;
---
>         $this->{$1} = "on";
63c63
<     my $ss = "{";
---
>     my $ss = "{ ";
65c65
<       $ss .= "$key=>" . $this->{$key} . ",";
---
>       $ss .= "$key=>\"" . $this->{$key} . "\" ";
67,68c67
<     chop($ss);
<     return $ss."}";
---
>     return $ss . "}";


