Changeset 2226
- Timestamp:
- 01/29/09 13:35:57 (3 years ago)
- Location:
- trunk/ActionTrackerPlugin
- Files:
-
- 19 edited
- 3 moved
-
data/System (moved) (moved from trunk/ActionTrackerPlugin/data/TWiki)
-
data/System/ActionTrackerPlugin.txt (modified) (10 diffs)
-
lib/Foswiki (moved) (moved from trunk/ActionTrackerPlugin/lib/TWiki)
-
lib/Foswiki/Plugins/ActionTrackerPlugin.pm (modified) (29 diffs)
-
lib/Foswiki/Plugins/ActionTrackerPlugin/Action.pm (modified) (16 diffs)
-
lib/Foswiki/Plugins/ActionTrackerPlugin/ActionNotify.pm (modified) (24 diffs)
-
lib/Foswiki/Plugins/ActionTrackerPlugin/ActionSet.pm (modified) (8 diffs)
-
lib/Foswiki/Plugins/ActionTrackerPlugin/AttrDef.pm (modified) (1 diff)
-
lib/Foswiki/Plugins/ActionTrackerPlugin/DEPENDENCIES (modified) (1 diff)
-
lib/Foswiki/Plugins/ActionTrackerPlugin/Format.pm (modified) (6 diffs)
-
lib/Foswiki/Plugins/ActionTrackerPlugin/MANIFEST (modified) (1 diff)
-
lib/Foswiki/Plugins/ActionTrackerPlugin/Options.pm (modified) (2 diffs)
-
lib/Foswiki/Plugins/ActionTrackerPlugin/build.pl (modified) (1 diff)
-
pub/System (moved) (moved from trunk/ActionTrackerPlugin/pub/TWiki)
-
templates/actionform.tmpl (modified) (1 diff)
-
test/unit/ActionTrackerPlugin/ActionNotifyTests.pm (modified) (8 diffs)
-
test/unit/ActionTrackerPlugin/ActionTests.pm (modified) (44 diffs)
-
test/unit/ActionTrackerPlugin/ActionTrackerPluginTests.pm (modified) (13 diffs)
-
test/unit/ActionTrackerPlugin/ExtendedActionSetTests.pm (modified) (4 diffs)
-
test/unit/ActionTrackerPlugin/FileActionSetTests.pm (modified) (15 diffs)
-
test/unit/ActionTrackerPlugin/LiveActionSetTests.pm (modified) (11 diffs)
-
test/unit/ActionTrackerPlugin/SimpleActionSetTests.pm (modified) (23 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ActionTrackerPlugin/data/System/ActionTrackerPlugin.txt
r1340 r2226 14 14 It takes the skills of a juggler to keep track of all the demands that modern life makes on us. Wouldn't it be great if we could capture what we have to do _at the time we think of it_, and be able to get a to-do list on demand? No more fighting with post-it notes, no more forgetting actions from the minutes of obscure meetings, and remember your partners birthday every year into the bargain! 15 15 16 This plugin provides support for tracking actions embedded in TWikitopics. Actions captured this way can then be tracked from anywhere you want.16 This plugin provides support for tracking actions embedded in topics. Actions captured this way can then be tracked from anywhere you want. 17 17 18 18 This is particularly useful for [[http://en.wikipedia.org/wiki/Minutes][meeting minutes]]. As you write the minutes during the meeting, you simply enter the actions into the text and as soon as the topic is saved, the actions "go live". For example, at a recent meeting of the British Cabinet: … … 29 29 Actions are nicely formatted for display, and automatic notification of actions is supported using 'cron'. 30 30 31 <div class="twikiBroadcastMessage" style="background-color:#ffc;">WARNING: TWiki-4 only. If you want to use this plugin with an earlier version of TWiki, please use [[http://twiki.org/cgi-bin/attach/Plugins/ActionTrackerPlugin?filename=ActionTrackerPlugin.zip&revInfo=1][revision 22 of the zip]].</div>32 33 31 %TOC% 34 32 35 33 ---+ Features 36 * Actions can be embedded in TWikitopics.34 * Actions can be embedded in topics. 37 35 * Actions can be listed using searches. 38 36 * Automatic action state e-mail notification. … … 47 45 __Note:__ if you have previously used this plugin you will note that the syntax of actions has changed. The plugin still recognises the old syntax, and will automatically upgrade topics when you edit them. 48 46 49 Write the command =%<nop>ACTION{= _attributes_ =}% ... %<nop>ENDACTION%= anywhere in a TWikitopic, where =...= represents the action description. Standard attributes are47 Write the command =%<nop>ACTION{= _attributes_ =}% ... %<nop>ENDACTION%= anywhere in a topic, where =...= represents the action description. Standard attributes are 50 48 | *Name* | *Value* | *Description* | *Auto-completed* | 51 49 | =who= | See [[#PeopleAnchor][People]] | The person or team responsible for completing the action. | current user | … … 76 74 ---++ Action searches 77 75 78 Write the command =%<nop>ACTIONSEARCH{= _attributes_ =}%= anywhere in a TWikitopic. Standard attributes are76 Write the command =%<nop>ACTIONSEARCH{= _attributes_ =}%= anywhere in a topic. Standard attributes are 79 77 | *Name* | *Value* | *Description* | 80 78 | =who= | See [[#PeopleAnchor][People]] | Person responsible for closing the action. | … … 160 158 E-mail addresses of people are found by the process [[#TranslatingNamesToEmailAddresses][described below]]. 161 159 162 You can also use the shorthand =me= for the currently logged-in user (this is =TWiki<nop>Guest=unless you have been prompted for a username and password). In actions, this will automatically be expanded when the topic is saved, and in searches it will match the currently logged in user.160 You can also use the shorthand =me= for the currently logged-in user (this is the guest user unless you have been prompted for a username and password). In actions, this will automatically be expanded when the topic is saved, and in searches it will match the currently logged in user. 163 161 164 162 ---++++ Groups 165 163 166 You can assign an action to a group defined using a TWiki group topic (see %SYSTEMWEB%.CompleteDocumentation). Alternatively you can give a list of people as the value of the attribute. For example,164 You can assign an action to a group. Alternatively you can give a list of people as the value of the attribute. For example, 167 165 <pre> 168 166 %ACTION<nop>{who=AdminGroup ...}% … … 176 174 ---+++ UIDs 177 175 _For administrators only_: 178 Each action is assigned a Unique Identifier (UID) when it is created. This UID is a six-digit number, and is generated when the action is first saved by incrementing a number in a special file (<code>pub/_work_areas/ActionTrackerPlugin/UIDRegister</code> under the TWikiinstallation). If this file is accidentally deleted, or is not writable, then you will have problems and you may get duplicate UIDs. Normally this won't matter a hoot, as UIDs only _have_ to be unique within a single topic, but if the file is persistantly inaccessible it could be a bit of a nuisance.176 Each action is assigned a Unique Identifier (UID) when it is created. This UID is a six-digit number, and is generated when the action is first saved by incrementing a number in a special file (<code>pub/_work_areas/ActionTrackerPlugin/UIDRegister</code> under the installation). If this file is accidentally deleted, or is not writable, then you will have problems and you may get duplicate UIDs. Normally this won't matter a hoot, as UIDs only _have_ to be unique within a single topic, but if the file is persistantly inaccessible it could be a bit of a nuisance. 179 177 180 178 #NotiFication … … 190 188 For example: 191 189 <pre> actionnotify "header=\"| Assigned to | Due ||\"" format=\"'| $who | $due | $edit |'\" state="open" </pre> 192 Note that the =actionnotify= script must be run from the =bin= directory. This is so it can pick up the TWikipath configuration file, =setlib.cfg=.190 Note that the =actionnotify= script must be run from the =bin= directory. This is so it can pick up the path configuration file, =setlib.cfg=. 193 191 194 192 For example, you could set up the cron jobs as follows: … … 339 337 * Set SHORTDESCRIPTION = Adds support for action tags in topics, and automatic notification of action statuses 340 338 --> 341 You can override the defaults for these values in %USERSWEB%.<nop>SitePreferences, the Web<nop>Preferences topic of the current web, or in individual topics. Use the standard TWiki'Set' syntax e.g:339 You can override the defaults for these values in %USERSWEB%.<nop>SitePreferences, the Web<nop>Preferences topic of the current web, or in individual topics. Use the standard 'Set' syntax e.g: 342 340 <pre> 343 341 *<nop> Set ACTIONTRACKERPLUGIN_EDITORIENT = rows … … 400 398 ---+ Plugin Info 401 399 402 Another great TWiki extension from the <a style="text-decoration:none" href="http://wikiring.com"><img src="%ATTACHURLPATH%/wikiringlogo20x20.png" alt="" /> *WikiRing* </a> - __Working together to improve your wiki experience__!400 Another great Foswiki extension from the <a style="text-decoration:none" href="http://wikiring.com"><img src="%ATTACHURLPATH%/wikiringlogo20x20.png" alt="" /> *WikiRing* </a> - __Working together to improve your wiki experience__! 403 401 404 402 Thanks are due to the following sponsors, who have helped make this plugin possible: … … 409 407 | Author: | [[http://c-dot.co.uk][CrawfordCurrie]] | 410 408 | Version: | %$VERSION% | 411 | Copyright | Copyright © 2002-2003 Motorola. All Rights Reserved.%BR% Copyright © 2004-200 8Crawford Currie |409 | Copyright | Copyright © 2002-2003 Motorola. All Rights Reserved.%BR% Copyright © 2004-2009 Crawford Currie | 412 410 | License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) | 413 411 | Change History: | | 414 | 5 Dec 2008 ||412 | 29 Jan 2009 | Foswikitask:Item455: port to foswiki Foswikitask:Item5974: correct CSS for search results table Foswikitask:Item5938: load CSS for ACTIONSEARCH Foswikitask:Item5606: Foswikitask:Item5915: respect global settings for time format | 415 413 | 7 May 2008 | TWikibug:Item5607: http: was being doubled up on URLs in mail due to a core bug | 416 414 | 13 Apr 2008 | TWikibug:Item4649: merged TWiki:Main.JoaquinBuendia's fix for AJAX updates on IE. TWikibug:Item4760: fixed WYSIWYG editing of topics containing actions TWikibug:Item5531: added simple button option for state changes | -
trunk/ActionTrackerPlugin/lib/Foswiki/Plugins/ActionTrackerPlugin.pm
r1340 r2226 1 1 # 2 2 # Copyright (C) 2002 Motorola - All rights reserved 3 # Copyright (C) 2004-200 5Crawford Currie http://c-dot.co.uk3 # Copyright (C) 2004-2009 Crawford Currie http://c-dot.co.uk 4 4 # 5 5 # TWiki extension that adds tags for action tracking … … 16 16 # http://www.gnu.org/copyleft/gpl.html 17 17 # 18 package TWiki::Plugins::ActionTrackerPlugin;18 package Foswiki::Plugins::ActionTrackerPlugin; 19 19 20 20 use strict; … … 22 22 use Error qw( :try ); 23 23 24 require TWiki::Func;25 require TWiki::Plugins;24 require Foswiki::Func; 25 require Foswiki::Plugins; 26 26 27 27 use vars qw( $VERSION $RELEASE $initialised $SHORTDESCRIPTION ); … … 43 43 # COVERAGE OFF standard plugin code 44 44 45 if( $ TWiki::Plugins::VERSION < 1.026 ) {46 TWiki::Func::writeWarning( 'Version mismatch between ActionTrackerPlugin and Plugins.pm $TWiki::Plugins::VERSION. 1.026 required.' );45 if( $Foswiki::Plugins::VERSION < 1.026 ) { 46 Foswiki::Func::writeWarning( 'Version mismatch between ActionTrackerPlugin and Plugins.pm $Foswiki::Plugins::VERSION. 1.026 required.' ); 47 47 } 48 48 # COVERAGE ON … … 51 51 $doneHeader = 0; 52 52 53 TWiki::Func::registerRESTHandler( 'update', \&_updateRESTHandler );54 TWiki::Func::registerTagHandler(53 Foswiki::Func::registerRESTHandler( 'update', \&_updateRESTHandler ); 54 Foswiki::Func::registerTagHandler( 55 55 'ACTIONSEARCH', \&_handleActionSearch, 'context-free'); 56 56 … … 58 58 }; 59 59 60 sub _addCSSAndJS { 61 my $debug = ''; 62 $debug = '_src' if DEBUG; 63 64 Foswiki::Func::addToHEAD('ACTIONTRACKERPLUGIN_CSS', <<HERE); 65 <link rel="stylesheet" href="$options->{CSS}" type="text/css" media="all" /> 66 HERE 67 Foswiki::Func::addToHEAD('ACTIONTRACKERPLUGIN_JS', <<HERE); 68 <script type='text/javascript' src='%PUBURLPATH%/%SYSTEMWEB%/ActionTrackerPlugin/atp$debug.js'></script> 69 HERE 70 } 71 60 72 sub commonTagsHandler { 61 73 my( $otext, $topic, $web, $meta ) = @_; … … 65 77 return unless _lazyInit($web, $topic); 66 78 67 my $debug = ''; 68 $debug = '_src' if DEBUG; 69 70 TWiki::Func::addToHEAD('ACTIONTRACKERPLUGIN_CSS', <<HERE); 71 <link rel="stylesheet" href="$options->{CSS}" type="text/css" media="all" /> 72 HERE 73 TWiki::Func::addToHEAD('ACTIONTRACKERPLUGIN_JS', <<HERE); 74 <script type='text/javascript' src='%PUBURLPATH%/%SYSTEMWEB%/ActionTrackerPlugin/atp$debug.js'></script> 75 HERE 79 _addCSSAndJS(); 76 80 77 81 # Format actions in the topic. 78 82 # Done this way so we get tables built up by 79 83 # collapsing successive actions. 80 my $as = TWiki::Plugins::ActionTrackerPlugin::ActionSet::load(84 my $as = Foswiki::Plugins::ActionTrackerPlugin::ActionSet::load( 81 85 $web, $topic, $otext, 1); 82 86 my $actionGroup; … … 87 91 if (!$actionGroup) { 88 92 $actionGroup = 89 new TWiki::Plugins::ActionTrackerPlugin::ActionSet();93 new Foswiki::Plugins::ActionTrackerPlugin::ActionSet(); 90 94 } 91 95 $actionGroup->add($entry); … … 127 131 #my( $text, $topic, $web, $meta ) = @_; 128 132 129 if( TWiki::Func::getSkin() =~ /\baction\b/ ) { 133 if( Foswiki::Func::getSkin() =~ /\baction\b/ ) { 134 print STDERR "Action edit\n"; 130 135 return _beforeActionEdit(@_); 131 136 } else { 137 print STDERR "Noamrl edit\n"; 132 138 return _beforeNormalEdit(@_); 133 139 } … … 143 149 return unless _lazyInit($_[2], $_[1]); 144 150 145 my $as = TWiki::Plugins::ActionTrackerPlugin::ActionSet::load(151 my $as = Foswiki::Plugins::ActionTrackerPlugin::ActionSet::load( 146 152 $_[2], $_[1], $_[0], 1); 147 153 $_[0] = $as->stringify(); … … 154 160 return unless _lazyInit($web, $topic); 155 161 156 my $query = TWiki::Func::getCgiQuery();162 my $query = Foswiki::Func::getCgiQuery(); 157 163 158 164 my $uid = $query->param( 'atp_action' ); … … 162 168 # as %TEXT%. This is done so we can use the standard template mechanism 163 169 # without screwing up the content of the subtemplate. 164 my $tmpl = TWiki::Func::readTemplate( 'actionform', 165 TWiki::Func::getSkin()); 166 167 my $date = TWiki::Func::formatTime( time(), undef, 'gmtime' ); 170 my $tmpl = Foswiki::Func::readTemplate( 'actionform', 171 Foswiki::Func::getSkin()); 172 173 my $date = Foswiki::Func::formatTime( time(), undef, 174 $Foswiki::cfg{DisplayTimeValues} ); 168 175 169 176 die unless ($date); 170 177 171 178 $tmpl =~ s/%DATE%/$date/go; 172 my $user = TWiki::Func::getWikiUserName();179 my $user = Foswiki::Func::getWikiUserName(); 173 180 $tmpl =~ s/%WIKIUSERNAME%/$user/go; 174 $tmpl = TWiki::Func::expandCommonVariables( $tmpl, $topic, $web );175 $tmpl = TWiki::Func::renderText( $tmpl, $web );181 $tmpl = Foswiki::Func::expandCommonVariables( $tmpl, $topic, $web ); 182 $tmpl = Foswiki::Func::renderText( $tmpl, $web ); 176 183 177 184 # The 'command' parameter is used to signal to the afterEditHandler and … … 188 195 189 196 # Find the action. 190 my $as = TWiki::Plugins::ActionTrackerPlugin::ActionSet::load(197 my $as = Foswiki::Plugins::ActionTrackerPlugin::ActionSet::load( 191 198 $web, $topic, $text, 1); 192 199 my ( $action, $pre, $post ) = $as->splitOnAction( $uid ); … … 228 235 $tmpl =~ s/%SUBMITCOMMAND%/$submitCmd/go; 229 236 230 my $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(237 my $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 231 238 $options->{EDITHEADER}, 232 239 $options->{EDITFORMAT}, … … 252 259 253 260 # Add styles and javascript for the calendar 254 TWiki::Func::addToHEAD(261 Foswiki::Func::addToHEAD( 255 262 'ATP_CSS', 256 263 '<style type="text/css" media="all">@import url("%ACTIONTRACKERPLUGIN_CSS%");</style>'); 257 264 258 use TWiki::Contrib::JSCalendarContrib;259 if( $@ || !$ TWiki::Contrib::JSCalendarContrib::VERSION ) {260 TWiki::Func::writeWarning('JSCalendarContrib not found '.$@);265 use Foswiki::Contrib::JSCalendarContrib; 266 if( $@ || !$Foswiki::Contrib::JSCalendarContrib::VERSION ) { 267 Foswiki::Func::writeWarning('JSCalendarContrib not found '.$@); 261 268 } else { 262 TWiki::Contrib::JSCalendarContrib::addHEAD( 'twiki' );269 Foswiki::Contrib::JSCalendarContrib::addHEAD( 'foswiki' ); 263 270 } 264 271 } … … 282 289 ### my ( $text, $topic, $web ) = @_; 283 290 284 my $query = TWiki::Func::getCgiQuery();291 my $query = Foswiki::Func::getCgiQuery(); 285 292 return unless ( $query->param( 'closeactioneditor' )); 286 293 … … 303 310 304 311 my $action = 305 TWiki::Plugins::ActionTrackerPlugin::Action::createFromQuery(312 Foswiki::Plugins::ActionTrackerPlugin::Action::createFromQuery( 306 313 $_[2], $_[1], $an, $query ); 307 314 … … 325 332 return unless _lazyInit($web, $topic); 326 333 327 my $query = TWiki::Func::getCgiQuery();334 my $query = Foswiki::Func::getCgiQuery(); 328 335 return unless ( $query ); # Fix from GarethEdwards 13 Jun 2003 329 336 … … 368 375 my %seenUID; 369 376 370 my $as = TWiki::Plugins::ActionTrackerPlugin::ActionSet::load(377 my $as = Foswiki::Plugins::ActionTrackerPlugin::ActionSet::load( 371 378 $_[2], $_[1], $_[0], 1); 372 379 … … 394 401 return unless _lazyInit($web, $topic); 395 402 403 _addCSSAndJS(); 404 396 405 # use default format unless overridden 397 406 my $fmt; … … 406 415 $hdrs = $defaultFormat->getHeaders() unless ( defined( $hdrs )); 407 416 $orient = $defaultFormat->getOrientation() unless ( defined( $orient )); 408 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format( $hdrs, $fmts, $orient, '', '' );417 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( $hdrs, $fmts, $orient, '', '' ); 409 418 } else { 410 419 $fmt = $defaultFormat; 411 420 } 412 421 413 my $actions = TWiki::Plugins::ActionTrackerPlugin::ActionSet::allActionsInWebs( $web, $attrs, 0 );422 my $actions = Foswiki::Plugins::ActionTrackerPlugin::ActionSet::allActionsInWebs( $web, $attrs, 0 ); 414 423 $actions->sort( $sort ); 415 424 return $actions->formatAsHTML( $fmt, 'href', $options->{USENEWWINDOW}, … … 424 433 425 434 eval { 426 require TWiki::Attrs;427 require TWiki::Plugins::ActionTrackerPlugin::Options;428 require TWiki::Plugins::ActionTrackerPlugin::Action;429 require TWiki::Plugins::ActionTrackerPlugin::ActionSet;430 require TWiki::Plugins::ActionTrackerPlugin::Format;435 require Foswiki::Attrs; 436 require Foswiki::Plugins::ActionTrackerPlugin::Options; 437 require Foswiki::Plugins::ActionTrackerPlugin::Action; 438 require Foswiki::Plugins::ActionTrackerPlugin::ActionSet; 439 require Foswiki::Plugins::ActionTrackerPlugin::Format; 431 440 }; 432 441 if ($@) { 433 TWiki::Func::writeWarning("ActionTrackerPlugin: init failed $@");442 Foswiki::Func::writeWarning("ActionTrackerPlugin: init failed $@"); 434 443 return 0; 435 444 } 436 445 437 $options = TWiki::Plugins::ActionTrackerPlugin::Options::load(446 $options = Foswiki::Plugins::ActionTrackerPlugin::Options::load( 438 447 $web, $topic); 439 448 440 $defaultFormat = new TWiki::Plugins::ActionTrackerPlugin::Format(449 $defaultFormat = new Foswiki::Plugins::ActionTrackerPlugin::Format( 441 450 $options->{TABLEHEADER}, 442 451 $options->{TABLEFORMAT}, … … 446 455 447 456 if( $options->{EXTRAS} ) { 448 my $e = TWiki::Plugins::ActionTrackerPlugin::Action::extendTypes(457 my $e = Foswiki::Plugins::ActionTrackerPlugin::Action::extendTypes( 449 458 $options->{EXTRAS} ); 450 459 # COVERAGE OFF safety net 451 460 if ( defined( $e )) { 452 TWiki::Func::writeWarning( "- TWiki::Plugins::ActionTrackerPlugin ERROR $e" );461 Foswiki::Func::writeWarning( "- Foswiki::Plugins::ActionTrackerPlugin ERROR $e" ); 453 462 } 454 463 # COVERAGE ON … … 466 475 my ( $web, $expr ) = @_; 467 476 468 eval 'require TWiki::Plugins::ActionTrackerPlugin::ActionNotify';477 eval 'require Foswiki::Plugins::ActionTrackerPlugin::ActionNotify'; 469 478 if( $@ ) { 470 TWiki::Func::writeWarning("ATP: $@");479 Foswiki::Func::writeWarning("ATP: $@"); 471 480 return; 472 481 } 473 482 474 my $text = TWiki::Plugins::ActionTrackerPlugin::ActionNotify::doNotifications( $web, $expr, 1 );483 my $text = Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::doNotifications( $web, $expr, 1 ); 475 484 476 485 $text =~ s/<html>/<\/pre>/gios; … … 483 492 sub _updateRESTHandler { 484 493 my $session = shift; 485 my $query = TWiki::Func::getCgiQuery();494 my $query = Foswiki::Func::getCgiQuery(); 486 495 try { 487 496 my $topic = $query->param('topic'); 488 497 my $web; 489 ($web, $topic) = TWiki::Func::normalizeWebTopicName(undef, $topic);498 ($web, $topic) = Foswiki::Func::normalizeWebTopicName(undef, $topic); 490 499 _lazyInit($web, $topic); 491 500 _updateSingleAction( … … 498 507 print CGI::header('text/plain', 500); 499 508 print $e->{-text}; 500 } catch TWiki::AccessControlException with {509 } catch Foswiki::AccessControlException with { 501 510 my $e = shift; 502 511 print CGI::header('text/plain', 500); … … 509 518 my ( $web, $topic, $uid, %changes ) = @_; 510 519 511 my ($meta, $text) = TWiki::Func::readTopic($web, $topic);520 my ($meta, $text) = Foswiki::Func::readTopic($web, $topic); 512 521 513 522 my $descr; … … 518 527 my %seenUID; 519 528 520 my $as = TWiki::Plugins::ActionTrackerPlugin::ActionSet::load(529 my $as = Foswiki::Plugins::ActionTrackerPlugin::ActionSet::load( 521 530 $web, $topic, $text, 1); 522 531 … … 530 539 } 531 540 } 532 TWiki::Func::saveTopic($web, $topic, $meta, $as->stringify(),541 Foswiki::Func::saveTopic($web, $topic, $meta, $as->stringify(), 533 542 { comment => 'atp save' }); 534 543 } -
trunk/ActionTrackerPlugin/lib/Foswiki/Plugins/ActionTrackerPlugin/Action.pm
r1340 r2226 3 3 =begin TML 4 4 5 ---+ package TWiki::Plugins::ActionTrackerPlugin::Action5 ---+ package Foswiki::Plugins::ActionTrackerPlugin::Action 6 6 7 7 Object that represents a single action … … 35 35 =cut 36 36 37 package TWiki::Plugins::ActionTrackerPlugin::Action;37 package Foswiki::Plugins::ActionTrackerPlugin::Action; 38 38 39 39 use strict; … … 44 44 require Time::ParseDate; 45 45 46 require TWiki::Func; 47 require TWiki::Attrs; 48 49 require TWiki::Plugins::ActionTrackerPlugin::AttrDef; 50 require TWiki::Plugins::ActionTrackerPlugin::Format; 51 52 use vars qw( $now ); 53 54 $now = time(); 46 require Foswiki::Func; 47 require Foswiki::Attrs; 48 49 require Foswiki::Plugins::ActionTrackerPlugin::AttrDef; 50 require Foswiki::Plugins::ActionTrackerPlugin::Format; 51 52 our $now = time(); 55 53 56 54 # Options for parsedate … … 71 69 ( 72 70 changedsince => 73 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(71 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 74 72 'noload', 0, 0, 0, undef ), 75 73 closed => 76 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(74 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 77 75 'date', $dw, 1, 0, undef ), 78 76 closer => 79 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(77 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 80 78 'names', $nw, 1, 0, undef ), 81 79 created => 82 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(80 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 83 81 'date', $dw, 1, 0, undef ), 84 82 creator => 85 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(83 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 86 84 'names', $nw, 1, 0, undef ), 87 85 dollar => 88 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(86 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 89 87 'noload', 0, 0, 0, undef ), 90 88 due => 91 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(89 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 92 90 'date', $dw, 1, 0, undef ), 93 91 edit => 94 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(92 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 95 93 'noload', 0, 0, 0, undef ), 96 94 format => 97 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(95 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 98 96 'noload', 0, 0, 0, undef ), 99 97 header => 100 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(98 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 101 99 'noload', 0, 0, 0, undef ), 102 100 late => 103 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(101 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 104 102 'noload', 0, 0, 0, undef ), 105 103 n => 106 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(104 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 107 105 'noload', 0, 0, 0, undef ), 108 106 nop => 109 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(107 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 110 108 'noload', 0, 0, 0, undef ), 111 109 notify => 112 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(110 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 113 111 'names', $nw, 1, 0, undef ), 114 112 percnt => 115 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(113 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 116 114 'noload', 0, 0, 0, undef ), 117 115 quot => 118 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(116 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 119 117 'noload', 0, 0, 0, undef ), 120 118 sort => 121 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(119 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 122 120 'noload', 0, 0, 0, undef ), 123 121 state => 124 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(122 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 125 123 'select', 1, 1, 1, [ 'open','closed' ] ), 126 124 text => 127 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(125 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 128 126 'noload', 0, 1, 0, undef ), 129 127 topic => 130 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(128 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 131 129 'noload', 0, 1, 0, undef ), 132 130 uid => 133 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(131 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 134 132 'text', $nw, 1, 0, undef ), 135 133 web => 136 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(134 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 137 135 'noload', 0, 1, 0, undef ), 138 136 who => 139 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(137 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 140 138 'names', $nw, 1, 0, undef ), 141 139 within => 142 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(140 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 143 141 'noload', 0, 1, 0, undef ), 144 142 ACTION_NUMBER=> 145 new TWiki::Plugins::ActionTrackerPlugin::AttrDef(143 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( 146 144 'noload', 0, 0, 0, undef ), 147 145 ); … … 154 152 my $this = {}; 155 153 156 my $attr = new TWiki::Attrs( $attrs, 1 );154 my $attr = new Foswiki::Attrs( $attrs, 1 ); 157 155 158 156 # We always have a state, and if it's not defined in the … … 242 240 } 243 241 $types{$name} = 244 new TWiki::Plugins::ActionTrackerPlugin::AttrDef( $type, $size, 1, 1, \@values );242 new Foswiki::Plugins::ActionTrackerPlugin::AttrDef( $type, $size, 1, 1, \@values ); 245 243 } else { 246 244 return 'Bad EXTRAS definition \''.$def.'\' in EXTRAS'; … … 277 275 my $this = shift; 278 276 279 my $workArea = TWiki::Func::getWorkArea('ActionTrackerPlugin');277 my $workArea = Foswiki::Func::getWorkArea('ActionTrackerPlugin'); 280 278 my $uidRegister = $workArea . '/UIDRegister'; 281 279 282 280 # Compatibility code. Upgrade existing atUidReg to plugin work area. 283 if (!-e $uidRegister && -e TWiki::Func::getDataDir() . '/atUidReg') {284 my $oldReg = TWiki::Func::getDataDir() . '/atUidReg';281 if (!-e $uidRegister && -e Foswiki::Func::getDataDir() . '/atUidReg') { 282 my $oldReg = Foswiki::Func::getDataDir() . '/atUidReg'; 285 283 open( FH, "<$oldReg" ) or die "Reading $oldReg: $!"; 286 284 my $uid = <FH>; … … 303 301 my @s = stat( $lockFile ); 304 302 if( time() - $s[9] > 10 * 60 ) { 305 TWiki::Func::writeWarning("Action Tracker Plugin: Warning: broke $lockFile");303 Foswiki::Func::writeWarning("Action Tracker Plugin: Warning: broke $lockFile"); 306 304 last; 307 305 } … … 400 398 if ( $who !~ /([A-Za-z0-9\.\+\-\_]+\@[A-Za-z0-9\.\-]+)/ ) { 401 399 if ( $who eq 'me' ) { 402 $who = TWiki::Func::getWikiName();400 $who = Foswiki::Func::getWikiName(); 403 401 } 404 402 if ( $who !~ /\./o ) { 405 $who = TWiki::Func::getMainWebname().'.'.$who;403 $who = Foswiki::Func::getMainWebname().'.'.$who; 406 404 } 407 405 } … … 439 437 $stime = ''; 440 438 } elsif ( $format eq 'attr' ) { 441 $stime = TWiki::Func::formatTime( $time, '$year-$mo-$day', 'servertime' );439 $stime = Foswiki::Func::formatTime( $time, '$year-$mo-$day', 'servertime' ); 442 440 } else { 443 $stime = TWiki::Func::formatTime( $time, '$wday, $day $month $year', 'servertime');441 $stime = Foswiki::Func::formatTime( $time, $Foswiki::cfg{DefaultDateFormat}, $Foswiki::cfg{DisplayTimeValues} ); 444 442 } 445 443 return $stime; … … 457 455 } 458 456 # No due date, use default 459 require TWiki::Plugins::ActionTrackerPlugin::Options;457 require Foswiki::Plugins::ActionTrackerPlugin::Options; 460 458 return 461 $ TWiki::Plugins::ActionTrackerPlugin::Options::options{DEFAULTDUE};459 $Foswiki::Plugins::ActionTrackerPlugin::Options::options{DEFAULTDUE}; 462 460 } 463 461 … … 629 627 my ( $this, $args, $asHTML ) = @_; 630 628 631 my ($meta, $text) = TWiki::Func::readTopic($this->{web}, $this->{topic});629 my ($meta, $text) = Foswiki::Func::readTopic($this->{web}, $this->{topic}); 632 630 633 631 if (!$meta->can('renderFormFieldForDisplay')) { 634 632 # 4.1 compatibility 635 return TWiki::Render::renderFormFieldArg($meta, $args);633 return Foswiki::Render::renderFormFieldArg($meta, $args); 636 634 } else { 637 635 my $name = $args; … … 682 680 return $this->{state} unless $this->{uid}; 683 681 # SMELL: assumes a prior call has loaded the options 684 require TWiki::Plugins::ActionTrackerPlugin::Options;682 require Foswiki::Plugins::ActionTrackerPlugin::Options; 685 683 return $this->{state} unless 686 $ TWiki::Plugins::ActionTrackerPlugin::Options::options{ENABLESTATESHORTCUT};684 $Foswiki::Plugins::ActionTrackerPlugin::Options::options{ENABLESTATESHORTCUT}; 687 685 688 686 my $input = ''; … … 744 742 my $jump = ' '. 745 743 CGI::a( { href=> 746 TWiki::Func::getViewUrl( $this->{web},744 Foswiki::Func::getViewUrl( $this->{web}, 747 745 $this->{topic} ) . 748 746 '#' . $this->getAnchor() }, … … 764 762 } 765 763 766 my $skin = join( ',', ( 'action', TWiki::Func::getSkin()));767 768 my $url = TWiki::Func::getScriptUrl(764 my $skin = join( ',', ( 'action', Foswiki::Func::getSkin())); 765 766 my $url = Foswiki::Func::getScriptUrl( 769 767 $this->{web}, $this->{topic}, 'edit', 770 768 skin => $skin, … … 915 913 } 916 914 } 917 return new TWiki::Plugins::ActionTrackerPlugin::Action( $web, $topic, $an, $attrs, $desc );915 return new Foswiki::Plugins::ActionTrackerPlugin::Action( $web, $topic, $an, $attrs, $desc ); 918 916 } 919 917 -
trunk/ActionTrackerPlugin/lib/Foswiki/Plugins/ActionTrackerPlugin/ActionNotify.pm
r1340 r2226 17 17 18 18 # This module contains the functionality of the bin/actionnotify script 19 package TWiki::Plugins::ActionTrackerPlugin::ActionNotify;19 package Foswiki::Plugins::ActionTrackerPlugin::ActionNotify; 20 20 21 21 use strict; … … 27 27 require Time::ParseDate; 28 28 29 require TWiki::Net;30 31 require TWiki::Attrs;32 33 require TWiki::Plugins::ActionTrackerPlugin::Action;34 require TWiki::Plugins::ActionTrackerPlugin::ActionSet;35 require TWiki::Plugins::ActionTrackerPlugin::Format;29 require Foswiki::Net; 30 31 require Foswiki::Attrs; 32 33 require Foswiki::Plugins::ActionTrackerPlugin::Action; 34 require Foswiki::Plugins::ActionTrackerPlugin::ActionSet; 35 require Foswiki::Plugins::ActionTrackerPlugin::Format; 36 36 37 37 my $wikiWordRE; 38 38 my $options; 39 39 40 require TWiki::Plugins::ActionTrackerPlugin::Options;40 require Foswiki::Plugins::ActionTrackerPlugin::Options; 41 41 42 42 # PUBLIC actionnotify script entry point. Reinitialises TWiki. … … 48 48 my $expr = shift; 49 49 50 my $twiki = new TWiki();50 my $twiki = new Foswiki(); 51 51 # Assign SESSION so that Func methods work 52 $ TWiki::Plugins::SESSION = $twiki;52 $Foswiki::Plugins::SESSION = $twiki; 53 53 54 54 if ( $expr =~ s/DEBUG//o ) { … … 64 64 my ( $webName, $expr, $debugMailer ) = @_; 65 65 66 $options = TWiki::Plugins::ActionTrackerPlugin::Options::load();66 $options = Foswiki::Plugins::ActionTrackerPlugin::Options::load(); 67 67 # Disable the state shortcut in mails 68 68 $options->{ENABLESTATESHORTCUT} = 0; 69 69 70 my $attrs = new TWiki::Attrs( $expr, 1 );70 my $attrs = new Foswiki::Attrs( $expr, 1 ); 71 71 my $hdr = $attrs->remove('header') || $options->{TABLEHEADER}; 72 72 my $bdy = $attrs->remove('format') || $options->{TABLEFORMAT}; … … 76 76 my $changes = $options->{NOTIFYCHANGES}; 77 77 78 my $format = new TWiki::Plugins::ActionTrackerPlugin::Format(78 my $format = new Foswiki::Plugins::ActionTrackerPlugin::Format( 79 79 $hdr, $bdy, $orient, $textform, $changes ); 80 80 … … 102 102 if ( !$attrs->isEmpty() ) { 103 103 # Get all the actions that match the search 104 $actions = TWiki::Plugins::ActionTrackerPlugin::ActionSet::allActionsInWebs( $webs, $attrs, 1 );104 $actions = Foswiki::Plugins::ActionTrackerPlugin::ActionSet::allActionsInWebs( $webs, $attrs, 1 ); 105 105 $actions->getActionees( \%people ); 106 106 } … … 130 130 131 131 if ( !defined( $mailaddr ) ) { 132 TWiki::Func::writeWarning( "No mail address found for $wikiname" );132 Foswiki::Func::writeWarning( "No mail address found for $wikiname" ); 133 133 $result .= "No mail address found for $wikiname<br />" if ( $debugMailer ); 134 134 next; … … 138 138 my $myActions; 139 139 if ( $actions ) { 140 my $ats = new TWiki::Attrs( "who=\"$wikiname\"", 1 );140 my $ats = new Foswiki::Attrs( "who=\"$wikiname\"", 1 ); 141 141 $myActions = $actions->search( $ats ); 142 142 } … … 147 147 if ( !defined( $actionsPerEmail{$email} )) { 148 148 $actionsPerEmail{$email} = 149 new TWiki::Plugins::ActionTrackerPlugin::ActionSet();149 new Foswiki::Plugins::ActionTrackerPlugin::ActionSet(); 150 150 } 151 151 $actionsPerEmail{$email}->concat( $myActions ); … … 195 195 $result .= $message; 196 196 } else { 197 my $error = TWiki::Func::sendEmail( $message );197 my $error = Foswiki::Func::sendEmail( $message ); 198 198 if ( $error ) { 199 199 $error = "ActionTrackerPlugin:ActionNotify: $error"; 200 TWiki::Func::writeWarning( $error );200 Foswiki::Func::writeWarning( $error ); 201 201 } 202 202 } … … 212 212 my ( $mailAddress ) = @_; 213 213 214 foreach my $web ( TWiki::Func::getListOfWebs( 'user' )) {214 foreach my $web ( Foswiki::Func::getListOfWebs( 'user' )) { 215 215 _loadWebNotify( $web, $mailAddress ); 216 216 } … … 223 223 224 224 # COVERAGE OFF safety net 225 if( ! TWiki::Func::webExists( $web ) ) {225 if( ! Foswiki::Func::webExists( $web ) ) { 226 226 my $error = 'ActionTrackerPlugin:ActionNotify: did not find web $web'; 227 TWiki::Func::writeWarning( $error );227 Foswiki::Func::writeWarning( $error ); 228 228 return; 229 229 } 230 230 # COVERAGE ON 231 231 232 my $topicname = $ TWiki::cfg{NotifyTopicName};233 return undef unless TWiki::Func::topicExists( $web, $topicname );232 my $topicname = $Foswiki::cfg{NotifyTopicName}; 233 return undef unless Foswiki::Func::topicExists( $web, $topicname ); 234 234 235 235 my $list = {}; 236 my $mainweb = TWiki::Func::getMainWebname();237 my $text = TWiki::Func::readTopicText( $web, $topicname, undef, 1 );236 my $mainweb = Foswiki::Func::getMainWebname(); 237 my $text = Foswiki::Func::readTopicText( $web, $topicname, undef, 1 ); 238 238 foreach my $line ( split( /\r?\n/, $text)) { 239 239 if ( $line =~ /^\s+\*\s([\w\.]+)\s+-\s+([\w\-\.\+]+\@[\w\-\.\+]+)/o ) { 240 240 my $who = $1; 241 241 my $addr = $2; 242 $who = TWiki::Plugins::ActionTrackerPlugin::Action::_canonicalName( $who );242 $who = Foswiki::Plugins::ActionTrackerPlugin::Action::_canonicalName( $who ); 243 243 if ( !defined( $mailAddress->{$who} )) { 244 TWiki::Func::writeWarning( 'ActionTrackerPlugin:ActionNotify: mail address for $who found in WebNotify' );244 Foswiki::Func::writeWarning( 'ActionTrackerPlugin:ActionNotify: mail address for $who found in WebNotify' ); 245 245 $mailAddress->{$who} = $addr; 246 246 } … … 259 259 } 260 260 my $addresses; 261 my $wikiWordRE = TWiki::Func::getRegularExpression('wikiWordRegex');262 my $webNameRE = TWiki::Func::getRegularExpression('webNameRegex');261 my $wikiWordRE = Foswiki::Func::getRegularExpression('wikiWordRegex'); 262 my $webNameRE = Foswiki::Func::getRegularExpression('webNameRegex'); 263 263 264 264 if ( $who =~ m/^([\w\-\.\+]+\@[\w\-\.\+]+)$/o ) { … … 282 282 # A legal topic wikiname 283 283 $who = 284 TWiki::Plugins::ActionTrackerPlugin::Action::_canonicalName( $who );284 Foswiki::Plugins::ActionTrackerPlugin::Action::_canonicalName( $who ); 285 285 $addresses = _getMailAddress( $who, $mailAddress ); 286 286 # Replaced by NKO … … 289 289 elsif ( $who =~ m/^($webNameRE)\.($wikiWordRE)$/o ) { 290 290 my( $inweb, $intopic ) = ( $1, $2 ); 291 $addresses = TWiki::Func::wikiToEmail($intopic); 292 291 $addresses = join(',', Foswiki::Func::wikinameToEmails($intopic)); 293 292 # LEGACY - Try and expand groups the old way 294 if( !$addresses && TWiki::Func::topicExists( $inweb, $intopic ) ) {293 if( !$addresses && Foswiki::Func::topicExists( $inweb, $intopic ) ) { 295 294 my $text = 296 TWiki::Func::readTopicText( $inweb, $intopic, undef, 1 );295 Foswiki::Func::readTopicText( $inweb, $intopic, undef, 1 ); 297 296 if ( $intopic =~ m/Group$/o ) { 298 297 # If it's a Group topic, match * Set GROUP = … … 324 323 $since, $mailaddr, $format ) = @_; 325 324 326 my $from = $ TWiki::cfg{WebMasterEmail} ||327 TWiki::Func::getPreferencesValue( 'WIKIWEBMASTER' ) || '';328 329 my $text = TWiki::Func::readTemplate( 'actionnotify' ) || <<'HERE';325 my $from = $Foswiki::cfg{WebMasterEmail} || 326 Foswiki::Func::getPreferencesValue( 'WIKIWEBMASTER' ) || ''; 327 328 my $text = Foswiki::Func::readTemplate( 'actionnotify' ) || <<'HERE'; 330 329 From: %EMAILFROM% 331 330 To: %EMAILTO% … … 352 351 if ( $actionsString ne '' ) { 353 352 $text =~ s/%ACTIONS_AS_STRING%/$actionsString/go; 354 my $asHTML = TWiki::Func::renderText( $actionsHTML );353 my $asHTML = Foswiki::Func::renderText( $actionsHTML ); 355 354 $text =~ s/%ACTIONS_AS_HTML%/$asHTML/go; 356 355 $text =~ s/%ACTIONS%(.*?)%END%/$1/gso; … … 360 359 361 360 if( $since ) { 362 $since = TWiki::Func::formatTime( $since );361 $since = Foswiki::Func::formatTime( $since ); 363 362 } else { 364 363 $since = ''; … … 368 367 if ( $changesString ne '' ) { 369 368 $text =~ s/%CHANGES_AS_STRING%/$changesString/go; 370 my $asHTML = TWiki::Func::renderText( $changesHTML );369 my $asHTML = Foswiki::Func::renderText( $changesHTML ); 371 370 $text =~ s/%CHANGES_AS_HTML%/$asHTML/go; 372 371 $text =~ s/%CHANGES%(.*?)%END%/$1/gso; … … 375 374 } 376 375 377 $text = TWiki::Func::expandCommonVariables( $text,378 $ TWiki::cfg{HomeTopicName} );376 $text = Foswiki::Func::expandCommonVariables( $text, 377 $Foswiki::cfg{HomeTopicName} ); 379 378 380 379 $text =~ s/<img src=.*?[^>]>/[IMG]/goi; # remove all images … … 382 381 # add the url host to any in-twiki urls that lack it 383 382 # SMELL: doesn't handle (undocumented) {ScriptUrlPaths} 384 my $sup = $ TWiki::cfg{ScriptUrlPath};383 my $sup = $Foswiki::cfg{ScriptUrlPath}; 385 384 $sup =~ s#/$##; 386 my $sun = TWiki::Func::getUrlHost() . $sup;385 my $sun = Foswiki::Func::getUrlHost() . $sup; 387 386 $text =~ s#href=\"$sup/#href=\"$sun/#ogi; 388 387 $text =~ s/<\/?nop( \/)?>//goi; … … 406 405 # Recover the rev at the previous date 407 406 my $oldrev = 408 TWiki::Func::getRevisionAtTime( $theWeb, $theTopic, $theDate );407 Foswiki::Func::getRevisionAtTime( $theWeb, $theTopic, $theDate ); 409 408 return unless defined( $oldrev ); 410 409 411 410 $oldrev =~ s/\d+\.(\d+)/$1/o; 412 411 # Recover the action set at that date 413 my $text = TWiki::Func::readTopicText( $theWeb, $theTopic, $oldrev, 1 );412 my $text = Foswiki::Func::readTopicText( $theWeb, $theTopic, $oldrev, 1 ); 414 413 415 414 my $oldActions = 416 TWiki::Plugins::ActionTrackerPlugin::ActionSet::load( $theWeb,415 Foswiki::Plugins::ActionTrackerPlugin::ActionSet::load( $theWeb, 417 416 $theTopic, $text ); 418 417 # Recover the current action set. 419 $text = TWiki::Func::readTopicText( $theWeb, $theTopic, undef, 1 );418 $text = Foswiki::Func::readTopicText( $theWeb, $theTopic, undef, 1 ); 420 419 my $currentActions = 421 TWiki::Plugins::ActionTrackerPlugin::ActionSet::load( $theWeb,420 Foswiki::Plugins::ActionTrackerPlugin::ActionSet::load( $theWeb, 422 421 $theTopic, $text ); 423 422 … … 434 433 sub _findChangesInWeb { 435 434 my ( $web, $topics, $theDate, $format, $notifications ) = @_; 436 my $actions = new TWiki::Plugins::ActionTrackerPlugin::ActionSet();437 438 my @tops = TWiki::Func::getTopicList( $web );435 my $actions = new Foswiki::Plugins::ActionTrackerPlugin::ActionSet(); 436 437 my @tops = Foswiki::Func::getTopicList( $web ); 439 438 my $grep = 440 TWiki::Func::searchInWebContent( '%ACTION{.*}%', $web, \@tops,439 Foswiki::Func::searchInWebContent( '%ACTION{.*}%', $web, \@tops, 441 440 { type => 'regex', 442 441 casesensitive => 1, … … 458 457 sub _findChangesInWebs { 459 458 my ( $webs, $topics, $date, $format, $notifications ) = @_; 460 my @weblist = grep { /^$webs$/ } TWiki::Func::getListOfWebs( 'user' );459 my @weblist = grep { /^$webs$/ } Foswiki::Func::getListOfWebs( 'user' ); 461 460 foreach my $web ( @weblist ) { 462 461 _findChangesInWeb( $web, $topics, $date, -
trunk/ActionTrackerPlugin/lib/Foswiki/Plugins/ActionTrackerPlugin/ActionSet.pm
r1340 r2226 18 18 # Perl object that represents a set of actions (possibly interleaved 19 19 # with blocks of topic text) 20 package TWiki::Plugins::ActionTrackerPlugin::ActionSet;20 package Foswiki::Plugins::ActionTrackerPlugin::ActionSet; 21 21 22 22 use strict; 23 23 use integer; 24 use TWiki::Func;25 26 use TWiki::Plugins::ActionTrackerPlugin::Format;24 use Foswiki::Func; 25 26 use Foswiki::Plugins::ActionTrackerPlugin::Format; 27 27 28 28 # PUBLIC constructor … … 48 48 49 49 my @blocks = split( /(%ACTION{.*?}%|%ENDACTION%)/, $text ); 50 my $actionSet = new TWiki::Plugins::ActionTrackerPlugin::ActionSet();50 my $actionSet = new Foswiki::Plugins::ActionTrackerPlugin::ActionSet(); 51 51 my $i = 0; 52 52 my $actionNumber = 0; … … 72 72 } 73 73 } 74 my $action = new TWiki::Plugins::ActionTrackerPlugin::Action(74 my $action = new Foswiki::Plugins::ActionTrackerPlugin::Action( 75 75 $web, $topic, $actionNumber++, $attrs, $descr ); 76 76 $actionSet->add($action); … … 137 137 my ( $this, $attrs ) = @_; 138 138 my $action; 139 my $chosen = new TWiki::Plugins::ActionTrackerPlugin::ActionSet();139 my $chosen = new Foswiki::Plugins::ActionTrackerPlugin::ActionSet(); 140 140 141 141 foreach $action ( @{$this->{ACTIONS}} ) { … … 262 262 my ( $web, $attrs, $internal ) = @_; 263 263 $internal = 0 unless defined ( $internal ); 264 my $actions = new TWiki::Plugins::ActionTrackerPlugin::ActionSet();265 my @tops = TWiki::Func::getTopicList( $web );264 my $actions = new Foswiki::Plugins::ActionTrackerPlugin::ActionSet(); 265 my @tops = Foswiki::Func::getTopicList( $web ); 266 266 my $topics = $attrs->{topic}; 267 267 268 268 @tops = grep( /^$topics$/, @tops ) if ( $topics ); 269 269 my $grep = 270 TWiki::Func::searchInWebContent( '%ACTION{.*}%', $web,270 Foswiki::Func::searchInWebContent( '%ACTION{.*}%', $web, 271 271 \@tops, 272 272 { type => 'regex', … … 277 277 # SMELL: always read the text, because it's faster in the current 278 278 # impl to find the perms embedded in it 279 my $text = TWiki::Func::readTopicText(279 my $text = Foswiki::Func::readTopicText( 280 280 $web, $topic, undef, $internal ); 281 next unless $internal || TWiki::Func::checkAccessPermission(282 'VIEW', TWiki::Func::getWikiName(), $text, $topic, $web);283 my $tacts = TWiki::Plugins::ActionTrackerPlugin::ActionSet::load(281 next unless $internal || Foswiki::Func::checkAccessPermission( 282 'VIEW', Foswiki::Func::getWikiName(), $text, $topic, $web); 283 my $tacts = Foswiki::Plugins::ActionTrackerPlugin::ActionSet::load( 284 284 $web, $topic, $text ); 285 285 $tacts = $tacts->search( $attrs ); … … 299 299 # Exclude webs flagged as NOSEARCHALL 300 300 $choice .= ',public' if $filter ne $theweb; 301 my @webs = grep { /^$filter$/ } TWiki::Func::getListOfWebs( $choice );302 my $actions = new TWiki::Plugins::ActionTrackerPlugin::ActionSet();301 my @webs = grep { /^$filter$/ } Foswiki::Func::getListOfWebs( $choice ); 302 my $actions = new Foswiki::Plugins::ActionTrackerPlugin::ActionSet(); 303 303 304 304 foreach my $web ( @webs ) { … … 320 320 321 321 my $found = undef; 322 my $pre = new TWiki::Plugins::ActionTrackerPlugin::ActionSet();323 my $post = new TWiki::Plugins::ActionTrackerPlugin::ActionSet();322 my $pre = new Foswiki::Plugins::ActionTrackerPlugin::ActionSet(); 323 my $post = new Foswiki::Plugins::ActionTrackerPlugin::ActionSet(); 324 324 325 325 foreach my $action (@{$this->{ACTIONS}}) { -
trunk/ActionTrackerPlugin/lib/Foswiki/Plugins/ActionTrackerPlugin/AttrDef.pm
r1340 r2226 18 18 use integer; 19 19 20 package TWiki::Plugins::ActionTrackerPlugin::AttrDef;20 package Foswiki::Plugins::ActionTrackerPlugin::AttrDef; 21 21 22 22 sub new { -
trunk/ActionTrackerPlugin/lib/Foswiki/Plugins/ActionTrackerPlugin/DEPENDENCIES
r882 r2226 1 1 Time::ParseDate,>=2003.0211,cpan,Required. Available from the CPAN:Time::ParseDate archive. 2 TWiki::Plugins,>=1.1,perl,TWiki 43 TWiki::Contrib::JSCalendarContrib,>=0.961,perl,Optional, used if installed. Used to display a neat calendar popup when editing actions. Available from the Foswiki:Extensions/JSCalendarContrib repository.2 Foswiki::Plugins,>=1.1,perl,TWiki 4 3 Foswiki::Contrib::JSCalendarContrib,>=0.961,perl,Optional, used if installed. Used to display a neat calendar popup when editing actions. Available from the Foswiki:Extensions/JSCalendarContrib repository. -
trunk/ActionTrackerPlugin/lib/Foswiki/Plugins/ActionTrackerPlugin/Format.pm
r1340 r2226 1 1 # 2 2 # Copyright (C) Motorola 2002 - All rights reserved 3 # Copyright (C) 2004-2009 Crawford Currie http://c-dot.co.uk 3 4 # 4 5 # TWiki extension that adds tags for action tracking … … 15 16 # http://www.gnu.org/copyleft/gpl.html 16 17 # 17 use strict;18 use integer;19 20 require TWiki::Func;21 22 18 # Object that represents a header and fields format 23 19 # This is where all formatting should be done; there should … … 33 29 # methods. The function must return a tuple of ( text, colour ). 34 30 # The colour may be undefined. 35 package TWiki::Plugins::ActionTrackerPlugin::Format; 31 package Foswiki::Plugins::ActionTrackerPlugin::Format; 32 33 use strict; 34 use integer; 35 36 require Foswiki::Func; 36 37 37 38 # PUBLIC Constructor … … 271 272 my $a = {}; 272 273 $a->{class} = $class if $class; 273 my $text = CGI::start_table( {class => ' twikiFormTable' }, $a );274 my $text = CGI::start_table( {class => 'atpSearch' }, $a ); 274 275 my $i; 275 276 … … 445 446 if ( $type->{type} eq 'date') { 446 447 # make sure JSCalendar is there 447 eval 'use TWiki::Contrib::JSCalendarContrib';448 eval 'use Foswiki::Contrib::JSCalendarContrib'; 448 449 unless ( $@ ) { 449 450 @extras = ( id => "date_$attrname" ); … … 453 454 -onclick => 454 455 "return showCalendar('date_$attrname','%e %B %Y')", 455 -src=> TWiki::Func::getPubUrlPath() . '/' .456 TWiki::Func::getTwikiWebname().456 -src=> Foswiki::Func::getPubUrlPath() . '/' . 457 $Foswiki::cfg{SystemWebName} . 457 458 '/JSCalendarContrib/img.gif', 458 459 -alt => 'Calendar', -
trunk/ActionTrackerPlugin/lib/Foswiki/Plugins/ActionTrackerPlugin/MANIFEST
r23 r2226 1 data/ TWiki/ActionTrackerPlugin.txt 0660 Plugin topic2 data/ TWiki/ActionTrackerPluginQBE.txt 0660 Query-by-example action search3 pub/ TWiki/ActionTrackerPlugin/styles_src.css 0660 Style sheet source4 pub/ TWiki/ActionTrackerPlugin/styles.css 0660 Style sheet5 pub/ TWiki/ActionTrackerPlugin/atp_src.js 0660 Javascript source6 pub/ TWiki/ActionTrackerPlugin/atp.js 0660 Javascript7 pub/ TWiki/ActionTrackerPlugin/juggle.gif 0660 Image8 pub/ TWiki/ActionTrackerPlugin/wikiringlogo20x20.png 06601 data/System/ActionTrackerPlugin.txt 0660 Plugin topic 2 data/System/ActionTrackerPluginQBE.txt 0660 Query-by-example action search 3 pub/System/ActionTrackerPlugin/styles_src.css 0660 Style sheet source 4 pub/System/ActionTrackerPlugin/styles.css 0660 Style sheet 5 pub/System/ActionTrackerPlugin/atp_src.js 0660 Javascript source 6 pub/System/ActionTrackerPlugin/atp.js 0660 Javascript 7 pub/System/ActionTrackerPlugin/juggle.gif 0660 Image 8 pub/System/ActionTrackerPlugin/wikiringlogo20x20.png 0660 9 9 tools/actionnotify 0555 Mailer script 10 10 templates/actionnotify.tmpl 0440 Page template for notify message 11 11 templates/edit.action.tmpl 0440 Action editor page template 12 12 templates/actionform.tmpl 0440 Action editor page subtemplate 13 lib/ TWiki/Plugins/ActionTrackerPlugin.pm 0440 Plugin Perl module14 lib/ TWiki/Plugins/ActionTrackerPlugin/Action.pm 0440 Perl support module15 lib/ TWiki/Plugins/ActionTrackerPlugin/Options.pm 0440 Perl support module16 lib/ TWiki/Plugins/ActionTrackerPlugin/ActionNotify.pm 0440 Perl support module17 lib/ TWiki/Plugins/ActionTrackerPlugin/ActionSet.pm 0440 Perl support module18 lib/ TWiki/Plugins/ActionTrackerPlugin/AttrDef.pm 0440 Perl support module19 lib/ TWiki/Plugins/ActionTrackerPlugin/Format.pm 0440 Perl support module13 lib/Foswiki/Plugins/ActionTrackerPlugin.pm 0440 Plugin Perl module 14 lib/Foswiki/Plugins/ActionTrackerPlugin/Action.pm 0440 Perl support module 15 lib/Foswiki/Plugins/ActionTrackerPlugin/Options.pm 0440 Perl support module 16 lib/Foswiki/Plugins/ActionTrackerPlugin/ActionNotify.pm 0440 Perl support module 17 lib/Foswiki/Plugins/ActionTrackerPlugin/ActionSet.pm 0440 Perl support module 18 lib/Foswiki/Plugins/ActionTrackerPlugin/AttrDef.pm 0440 Perl support module 19 lib/Foswiki/Plugins/ActionTrackerPlugin/Format.pm 0440 Perl support module -
trunk/ActionTrackerPlugin/lib/Foswiki/Plugins/ActionTrackerPlugin/Options.pm
r1340 r2226 1 1 # See bottom of file for license and copyright information 2 package TWiki::Plugins::ActionTrackerPlugin::Options;2 package Foswiki::Plugins::ActionTrackerPlugin::Options; 3 3 4 4 # Define a global so that submodules can access options without needing the … … 35 35 %options = %defaults; 36 36 37 require TWiki::Func;37 require Foswiki::Func; 38 38 foreach my $ky (keys %options) { 39 39 my $sk = 'ACTIONTRACKERPLUGIN_'.$ky; 40 $sk = TWiki::Func::getPreferencesValue( $sk );40 $sk = Foswiki::Func::getPreferencesValue( $sk ); 41 41 $options{$ky} = $sk if (defined $sk); 42 $options{$ky} = TWiki::Func::expandCommonVariables(42 $options{$ky} = Foswiki::Func::expandCommonVariables( 43 43 $options{$ky}, $topic, $web ); 44 44 } -
trunk/ActionTrackerPlugin/lib/Foswiki/Plugins/ActionTrackerPlugin/build.pl
r1065 r2226 9 9 } 10 10 11 use TWiki::Contrib::Build;11 use Foswiki::Contrib::Build; 12 12 13 $build = new TWiki::Contrib::Build("ActionTrackerPlugin");13 $build = new Foswiki::Contrib::Build("ActionTrackerPlugin"); 14 14 $build->build($build->{target}); -
trunk/ActionTrackerPlugin/templates/actionform.tmpl
r1340 r2226 7 7 <h1>Action %UID% in %WEB%.%TOPIC%</h1> 8 8 %EDITFIELDS% 9 <textarea name="text" wrap="virtual" rows="%EBH%" cols="%EBW%" style="width:99%" class=" twikiTextarea twikiEditboxStyleProportional">%TEXT%</textarea>9 <textarea name="text" wrap="virtual" rows="%EBH%" cols="%EBW%" style="width:99%" class="foswikiTextarea foswikiEditboxStyleProportional">%TEXT%</textarea> 10 10 %HIDDENFIELDS% 11 11 <br /> 12 <label for="sig" class=" twikiGrayText">Your signature to copy/paste: </label><input name="sig" type="text" readonly="readonly" title="Select, copy and paste your signature text to the bottom of your entry" id="sig" value="-- <nop>%WIKIUSERNAME% - %DATE%" /></div>12 <label for="sig" class="foswikiGrayText">Your signature to copy/paste: </label><input name="sig" type="text" readonly="readonly" title="Select, copy and paste your signature text to the bottom of your entry" id="sig" value="-- <nop>%WIKIUSERNAME% - %DATE%" /></div> 13 13 <br /> 14 14 <input type="submit" value=" %SUBMITCMDNAME% Changes " %SUBMITSCRIPT% /> -
trunk/ActionTrackerPlugin/test/unit/ActionTrackerPlugin/ActionNotifyTests.pm
r1340 r2226 4 4 use strict; 5 5 6 use TWiki::Plugins::ActionTrackerPlugin::Action;7 use TWiki::Plugins::ActionTrackerPlugin::ActionSet;8 use TWiki::Plugins::ActionTrackerPlugin::ActionNotify;9 use TWiki::Plugins::ActionTrackerPlugin::Format;10 use TWiki::Plugins::ActionTrackerPlugin::Options;6 use Foswiki::Plugins::ActionTrackerPlugin::Action; 7 use Foswiki::Plugins::ActionTrackerPlugin::ActionSet; 8 use Foswiki::Plugins::ActionTrackerPlugin::ActionNotify; 9 use Foswiki::Plugins::ActionTrackerPlugin::Format; 10 use Foswiki::Plugins::ActionTrackerPlugin::Options; 11 11 use Time::ParseDate; 12 use TWiki::Attrs;13 use TWiki::Store::RcsLite;12 use Foswiki::Attrs; 13 use Foswiki::Store::RcsLite; 14 14 15 15 sub new { … … 22 22 23 23 $this->SUPER::set_up(); 24 $ TWiki::cfg{Plugins}{ActionTrackerPlugin}{Enabled} = 1;24 $Foswiki::cfg{Plugins}{ActionTrackerPlugin}{Enabled} = 1; 25 25 26 26 # Use RcsLite so we can manually gen topic revs 27 $ TWiki::cfg{StoreImpl} = 'RcsLite';27 $Foswiki::cfg{StoreImpl} = 'RcsLite'; 28 28 29 29 # Need this to get the actionnotify template … … 31 31 my $d = "$lib/../templates"; 32 32 if (-e "$d/actionnotify.tmpl") { 33 $ TWiki::cfg{TemplateDir} = $d;33 $Foswiki::cfg{TemplateDir} = $d; 34 34 last; 35 35 } 36 36 } 37 37 38 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime("3 Jun 2002");38 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime("3 Jun 2002"); 39 39 40 40 # Actor 1 - wikiname in main, not a member of any groups … … 84 84 'actor6@correct-address'); 85 85 86 TWiki::Func::saveTopic($this->{users_web}, "TWikiFormGroup", undef, <<'HERE');86 Foswiki::Func::saveTopic($this->{users_web}, "TWikiFormGroup", undef, <<'HERE'); 87 87 Garbage 88 88 * Set GROUP = ActorThree, ActorFour 89 89 More garbage 90 90 HERE 91 TWiki::Func::saveTopic($this->{users_web}, "WebNotify", undef, <<HERE);91 Foswiki::Func::saveTopic($this->{users_web}, "WebNotify", undef, <<HERE); 92 92 Garbage 93 93 * $this->{users_web}.ActorFive - actor5\@correct.address … … 95 95 * $this->{users_web}.ActorSix 96 96 HERE 97 TWiki::Func::saveTopic($this->{test_web}, "WebNotify", undef, <<HERE97 Foswiki::Func::saveTopic($this->{test_web}, "WebNotify", undef, <<HERE 98 98 * $this->{users_web}.ActorEight - actor-8\@correct.address 99 99 HERE 100 100 ); 101 TWiki::Func::saveTopic($this->{users_web}, "EMailGroup", undef, <<'HERE');102 * Set GROUP = actorTwo@another-address.net,ActorFour103 HERE 104 105 TWiki::Func::saveTopic($this->{test_web}, "Topic1", undef, <<'HERE');101 Foswiki::Func::saveTopic($this->{users_web}, "EMailGroup", undef, <<'HERE'); 102 * Set GROUP = ActorTwo,ActorFour 103 HERE 104 105 Foswiki::Func::saveTopic($this->{test_web}, "Topic1", undef, <<'HERE'); 106 106 %ACTION{who="ActorOne,ActorTwo,ActorThree,ActorFour,ActorFive,ActorSix,ActorSeven,ActorEight" due="3 Jan 02" state=open}% A1: ontime 107 107 HERE 108 TWiki::Func::saveTopic($this->{test_web}, "Topic2", undef, <<'HERE');108 Foswiki::Func::saveTopic($this->{test_web}, "Topic2", undef, <<'HERE'); 109 109 %ACTION{who="ActorOne,ActorTwo,ActorThree,ActorFour,ActorFive,ActorSix,actor.7@seven.net,ActorEight" due="2 Jan 02" state=closed}% A2: closed 110 110 HERE 111 TWiki::Func::saveTopic($this->{users_web}, "Topic1", undef, <<'HERE');111 Foswiki::Func::saveTopic($this->{users_web}, "Topic1", undef, <<'HERE'); 112 112 %ACTION{who="ActorOne,ActorTwo,ActorThree,ActorFour,ActorFive,ActorSix,actor.7@seven.net,ActorEight,NonEntity",due="3 Jan 01",state=open}% A3: late 113 113 %ACTION{who=TWikiFormGroup,due="4 Jan 01",state=open}% A4: late 114 114 HERE 115 TWiki::Func::saveTopic($this->{users_web}, "Topic2", undef, <<'HERE');115 Foswiki::Func::saveTopic($this->{users_web}, "Topic2", undef, <<'HERE'); 116 116 %ACTION{who=EMailGroup,due="2001-01-05",state=open}% A5: late 117 117 %ACTION{who="ActorOne,ActorTwo,ActorThree,ActorFour,TWikiFormGroup,ActorFive,ActorSix,actor.7@seven.net,ActorEight,EMailGroup",due="6 Jan 99",open}% A6: late 118 118 HERE 119 119 120 my $rcs = new TWiki::Store::RcsLite($this->{twiki}, $this->{test_web}, "ActionChanged" );120 my $rcs = new Foswiki::Store::RcsLite($this->{twiki}, $this->{test_web}, "ActionChanged" ); 121 121 my $t1 = Time::ParseDate::parsedate("21 Jun 2001"); 122 122 $rcs->addRevisionFromText(<<HERE, 'Initial revision', 'crawford', $t1); … … 153 153 ); 154 154 my $who = 155 TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress('a@b.c',\%ma);155 Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress('a@b.c',\%ma); 156 156 $this->assert_str_equals( 'a@b.c', $who); 157 157 158 158 $who = 159 TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("$this->{users_web}.BimboChimp",\%ma);159 Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("$this->{users_web}.BimboChimp",\%ma); 160 160 $this->assert_str_equals( 'bimbo@zoo.org', $who); 161 161 162 162 $who = 163 TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("BimboChimp",\%ma);163 Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("BimboChimp",\%ma); 164 164 $this->assert_str_equals( 'bimbo@zoo.org', $who); 165 165 166 166 $who = 167 TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("PaxoHen,BimboChimp , BonzoClown",\%ma);167 Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("PaxoHen,BimboChimp , BonzoClown",\%ma); 168 168 $this->assert_str_equals( 'chicken@farm.net,bimbo@zoo.org,bonzo@circus.com', $who); 169 169 170 $who = TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("ActorOne",\%ma);170 $who = Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("ActorOne",\%ma); 171 171 $this->assert_str_equals( 'actor-1@an-address.net', $who); 172 173 $who = TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("EMailGroup",\%ma); 174 $this->assert_str_equals( "actorTwo\@another-address.net,actorfour\@yet-another-address.net", $who); 175 $who = TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("TWikiFormGroup",\%ma); 176 $this->assert_str_equals( "actor3\@yet-another-address.net,actorfour\@yet-another-address.net", $who); 177 178 $who = TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("ActorFive",\%ma); 172 $who = Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("EMailGroup",\%ma); 173 $this->assert_str_equals( "actorTwo\@another-address.net,actorfour\@yet-another-address.net", join(',',sort split(/[, ]+/, $who))); 174 $who = Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("TWikiFormGroup",\%ma); 175 $this->assert_str_equals( "actor3\@yet-another-address.net,actorfour\@yet-another-address.net", join(',',sort split(/[, ]+/, $who))); 176 177 $who = Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("ActorFive",\%ma); 179 178 $this->assert_str_equals('actor5@example.com', $who); 180 $who = TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("ActorEight",\%ma);179 $who = Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("ActorEight",\%ma); 181 180 $this->assert_null($who); 182 TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_loadWebNotify($this->{users_web},\%ma);183 $who = TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("ActorFive",\%ma);181 Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_loadWebNotify($this->{users_web},\%ma); 182 $who = Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("ActorFive",\%ma); 184 183 $this->assert_str_equals( "actor5\@example.com", $who); 185 TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_loadWebNotify($this->{test_web},\%ma);186 $who = TWiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("ActorEight",\%ma);184 Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_loadWebNotify($this->{test_web},\%ma); 185 $who = Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::_getMailAddress("ActorEight",\%ma); 187 186 $this->assert_str_equals( "actor-8\@correct.address", $who); 188 187 } … … 192 191 my $html; 193 192 194 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime("2 Jan 2002");195 TWiki::Plugins::ActionTrackerPlugin::ActionNotify::doNotifications($this->{twiki}->{webName}, "web='($this->{test_web}|$this->{users_web})' late" );193 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime("2 Jan 2002"); 194 Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::doNotifications($this->{twiki}->{webName}, "web='($this->{test_web}|$this->{users_web})' late" ); 196 195 if(scalar(@FoswikiFnTestCase::mails!= 8)) { 197 196 my $mess = scalar(@FoswikiFnTestCase::mails)." mails received"; … … 287 286 sub test_C_ChangedSince { 288 287 my $this = shift; 289 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime("2 Jan 2002");290 TWiki::Plugins::ActionTrackerPlugin::ActionNotify::doNotifications(288 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime("2 Jan 2002"); 289 Foswiki::Plugins::ActionTrackerPlugin::ActionNotify::doNotifications( 291 290 $this->{twiki}->{webName}, 'changedsince="1 dec 2001" web="'.$this->{test_web}.'"' ); 292 291 my $saw = ""; -
trunk/ActionTrackerPlugin/test/unit/ActionTrackerPlugin/ActionTests.pm
r1340 r2226 5 5 use strict; 6 6 7 use TWiki::Plugins::ActionTrackerPlugin::Action;8 use TWiki::Plugins::ActionTrackerPlugin::Format;7 use Foswiki::Plugins::ActionTrackerPlugin::Action; 8 use Foswiki::Plugins::ActionTrackerPlugin::Format; 9 9 use Time::ParseDate; 10 10 use CGI; … … 17 17 # Have to do this to force a read of the configuration 18 18 BEGIN { 19 new TWiki();20 $ TWiki::cfg{Plugins}{ActionTrackerPlugin}{Enabled} = 1;19 new Foswiki(); 20 $Foswiki::cfg{Plugins}{ActionTrackerPlugin}{Enabled} = 1; 21 21 }; 22 22 … … 24 24 my $this = shift; 25 25 $this->SUPER::set_up(); 26 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime("31 May 2002"); 26 27 $Foswiki::cfg{DisplayTimeValues} = 'servertime'; 28 $Foswiki::cfg{DefaultDateFormat} = '$day $month $year'; 29 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime("31 May 2002"); 27 30 } 28 31 … … 30 33 my $this = shift; 31 34 $this->SUPER::tear_down(); 32 TWiki::Plugins::ActionTrackerPlugin::Action::unextendTypes();35 Foswiki::Plugins::ActionTrackerPlugin::Action::unextendTypes(); 33 36 } 34 37 … … 37 40 38 41 # no state -> first state 39 my $action = new TWiki::Plugins::ActionTrackerPlugin::Action(42 my $action = new Foswiki::Plugins::ActionTrackerPlugin::Action( 40 43 "Test","Topic",0,"", ""); 41 44 $this->assert_str_equals("open", $action->{state}, $action->stringify()); 42 45 # closed defined -> closed state 43 $action = new TWiki::Plugins::ActionTrackerPlugin::Action(46 $action = new Foswiki::Plugins::ActionTrackerPlugin::Action( 44 47 "Test","Topic",0,"closed", ""); 45 48 $this->assert_str_equals("closed", $action->{state}); 46 49 $action = 47 new TWiki::Plugins::ActionTrackerPlugin::Action(50 new Foswiki::Plugins::ActionTrackerPlugin::Action( 48 51 "Test","Topic",0,"closed=10-may-05", ""); 49 52 $this->assert_str_equals("closed", $action->{state}); 50 53 $action = 51 TWiki::Plugins::ActionTrackerPlugin::Action->new(54 Foswiki::Plugins::ActionTrackerPlugin::Action->new( 52 55 "Test","Topic",0,"closer=Flicka", ""); 53 56 $this->assert_str_equals("open", $action->{state}); 54 57 # state def overrides closed defined 55 58 $action = 56 new TWiki::Plugins::ActionTrackerPlugin::Action(59 new Foswiki::Plugins::ActionTrackerPlugin::Action( 57 60 "Test","Topic",0,"",'closed,state="open"'); 58 61 $this->assert_str_equals("open", $action->{state}); … … 63 66 64 67 my $action = 65 new TWiki::Plugins::ActionTrackerPlugin::Action(68 new Foswiki::Plugins::ActionTrackerPlugin::Action( 66 69 "Test","Topic2",0, 67 70 "web=Wrong,topic=Wrong web=Right", ""); … … 74 77 75 78 my $action = 76 new TWiki::Plugins::ActionTrackerPlugin::Action(79 new Foswiki::Plugins::ActionTrackerPlugin::Action( 77 80 "Test","Topic",0, 78 81 'who="Who" due="2 Jun 02" open', ""); 79 82 $this->assert(!$action->isLate()); 80 83 $this->assert_num_equals(2, $action->daysToGo()); 81 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime(84 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime( 82 85 "1 Jun 2002 23:59:59"); 83 86 $this->assert(!$action->isLate()); 84 87 $this->assert_num_equals(0, $action->daysToGo()); 85 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime(88 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime( 86 89 "2 Jun 2002 00:00:01"); 87 90 $this->assert($action->isLate()); 88 91 $this->assert_num_equals(-1, $action->daysToGo()); 89 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime(92 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime( 90 93 "3 Jun 2002 00:00:01"); 91 94 $this->assert($action->isLate()); 92 95 $this->assert_num_equals(-1, $action->daysToGo()); 93 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime(96 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime( 94 97 "4 Jun 2002 00:00:01"); 95 98 $this->assert($action->isLate()); 96 99 $this->assert_num_equals(-2, $action->daysToGo()); 97 100 $action = new 98 TWiki::Plugins::ActionTrackerPlugin::Action(101 Foswiki::Plugins::ActionTrackerPlugin::Action( 99 102 "Test","Topic",0, 100 103 'who="Who" due="2 Jun 02" closed', ""); … … 106 109 107 110 my $action = 108 new TWiki::Plugins::ActionTrackerPlugin::Action(111 new Foswiki::Plugins::ActionTrackerPlugin::Action( 109 112 "Test", "Topic", 0, 110 113 'who="JohnDoe, SlyStallone",due="2 Jun 02",notify="SamPeckinpah, QuentinTarantino",creator="ThomasMoore"', … … 119 122 120 123 my $action = 121 new TWiki::Plugins::ActionTrackerPlugin::Action(124 new Foswiki::Plugins::ActionTrackerPlugin::Action( 122 125 "Test", "Topic", 0, 123 'who="JohnDoe,SlyStallone,'.$ TWiki::cfg{DefaultUserWikiName}.'" due="2 Jun 02" state=open notify="SamPeckinpah,QuentinTarantino" created="1999-01-01" creator="ThomasMoore"',126 'who="JohnDoe,SlyStallone,'.$Foswiki::cfg{DefaultUserWikiName}.'" due="2 Jun 02" state=open notify="SamPeckinpah,QuentinTarantino" created="1999-01-01" creator="ThomasMoore"', 124 127 "A new action"); 125 128 126 my $attrs = new TWiki::Attrs("who=JohnDoe",1);129 my $attrs = new Foswiki::Attrs("who=JohnDoe",1); 127 130 $this->assert($action->matches($attrs),$attrs->stringify()); 128 $attrs = new TWiki::Attrs("who=$this->{users_web}.JohnDoe",1);129 $this->assert($action->matches($attrs)); 130 $attrs = new TWiki::Attrs("who=me",1);131 $this->assert($action->matches($attrs)); 132 $attrs = new TWiki::Attrs("who=JohnSmith",1);133 $this->assert(!$action->matches($attrs)); 134 $attrs = new TWiki::Attrs("who=$this->{users_web}.SlyStallone",1);135 $this->assert($action->matches($attrs)); 136 $attrs = new TWiki::Attrs("who",1);137 $this->assert(!$action->matches($attrs)); 138 139 $attrs = new TWiki::Attrs('notify="SamPeckinpah"',1);140 $this->assert($action->matches($attrs)); 141 $attrs = new TWiki::Attrs('notify="QuentinTarantino"',1);142 $this->assert($action->matches($attrs)); 143 $attrs = new TWiki::Attrs('notify="JonasSalk,QuentinTarantino"',1);144 $this->assert($action->matches($attrs)); 145 $attrs = new TWiki::Attrs('notify="SamBrowne,OscarWilde"',1);146 $this->assert(!$action->matches($attrs)); 147 $attrs = new TWiki::Attrs("notify",1);148 $this->assert(!$action->matches($attrs)); 149 150 $attrs = new TWiki::Attrs('state="open"',1);151 $this->assert($action->matches($attrs)); 152 $attrs = new TWiki::Attrs("open",1);153 $this->assert($action->matches($attrs)); 154 $attrs = new TWiki::Attrs("openday",1);155 $this->assert(!$action->matches($attrs)); 156 $attrs = new TWiki::Attrs('state="(?!closed).*"',0);157 $this->assert($action->matches($attrs)); 158 159 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime("4 Jun 2002");160 $attrs = new TWiki::Attrs("within='+2'",1);161 $this->assert(!$action->matches($attrs)); 162 $attrs = new TWiki::Attrs("within='2'",1);163 $this->assert($action->matches($attrs)); 164 $attrs = new TWiki::Attrs("within='+1'",1);165 $this->assert(!$action->matches($attrs)); 166 $attrs = new TWiki::Attrs("within='1'",1);167 $this->assert(!$action->matches($attrs)); 168 $attrs = new TWiki::Attrs("within='-1'",1);169 $this->assert(!$action->matches($attrs)); 170 $attrs = new TWiki::Attrs("within='-2'",1);171 $this->assert($action->matches($attrs)); 172 173 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime("31 May 2002");174 $attrs = new TWiki::Attrs("within='+2'",1);175 $this->assert($action->matches($attrs)); 176 $attrs = new TWiki::Attrs("within='2'",1);177 $this->assert($action->matches($attrs)); 178 $attrs = new TWiki::Attrs("within='+1'",1);179 $this->assert(!$action->matches($attrs)); 180 $attrs = new TWiki::Attrs("within='1'",1);181 $this->assert(!$action->matches($attrs)); 182 $attrs = new TWiki::Attrs("within='-2'",1);183 $this->assert(!$action->matches($attrs)); 184 185 $attrs = new TWiki::Attrs("late",1);186 $this->assert(!$action->matches($attrs)); 187 188 $attrs = new TWiki::Attrs("web=Test",1);189 $this->assert($action->matches($attrs)); 190 $attrs = new TWiki::Attrs('web=".*t"',1);191 $this->assert($action->matches($attrs)); 192 $attrs = new TWiki::Attrs('web="A.*"',1);193 $this->assert(!$action->matches($attrs)); 194 195 $attrs = new TWiki::Attrs("topic=Topic",1);196 $this->assert($action->matches($attrs)); 197 $attrs = new TWiki::Attrs('topic=".*c"',1);198 $this->assert($action->matches($attrs)); 199 $attrs = new TWiki::Attrs('topic="A.*"',1);200 $this->assert(!$action->matches($attrs)); 201 202 $attrs = new TWiki::Attrs('due="2 Jun 02"',1);203 $this->assert($action->matches($attrs)); 204 $attrs = new TWiki::Attrs('due="3 Jun 02"',1);205 $this->assert(!$action->matches($attrs)); 206 $attrs = new TWiki::Attrs('due="< 3 Jun 02"',1);207 $this->assert($action->matches($attrs)); 208 $attrs = new TWiki::Attrs('due="> 3 Jun 02"',1);209 $this->assert(!$action->matches($attrs)); 210 $attrs = new TWiki::Attrs('due="> 1 Jun 02"',1);211 $this->assert($action->matches($attrs)); 212 $attrs = new TWiki::Attrs('due="< 1 Jun 02"',1);213 $this->assert(!$action->matches($attrs)); 214 215 $attrs = new TWiki::Attrs("creator=ThomasMoore",1);216 $this->assert($action->matches($attrs)); 217 $attrs = new TWiki::Attrs("creator=QuentinTarantino",1);218 $this->assert(!$action->matches($attrs)); 219 220 $attrs = new TWiki::Attrs('created="1999-01-01"',1);221 $this->assert($action->matches($attrs)); 222 $attrs = new TWiki::Attrs('created="2 Jun 02"',1);223 $this->assert(!$action->matches($attrs)); 224 $attrs = new TWiki::Attrs('created="2 Jan 1999"',1);225 $this->assert(!$action->matches($attrs)); 226 $attrs = new TWiki::Attrs('created="< 2 Jan 1999"',1);227 $this->assert($action->matches($attrs)); 228 $attrs = new TWiki::Attrs('created="> 2 Jan 1999"',1);229 $this->assert(!$action->matches($attrs)); 230 $attrs = new TWiki::Attrs('created=">= 1 Jan 1999"',1);231 $this->assert($action->matches($attrs)); 232 $attrs = new TWiki::Attrs('created="< 1 Jan 1999"',1);233 $this->assert(!$action->matches($attrs)); 234 235 $attrs = new TWiki::Attrs("closed",1);236 $this->assert(!$action->matches($attrs)); 237 $attrs = new TWiki::Attrs('closed="2 Jun 02"',1);238 $this->assert(!$action->matches($attrs)); 239 $attrs = new TWiki::Attrs('closed="1 Jan 1999"',1);131 $attrs = new Foswiki::Attrs("who=$this->{users_web}.JohnDoe",1); 132 $this->assert($action->matches($attrs)); 133 $attrs = new Foswiki::Attrs("who=me",1); 134 $this->assert($action->matches($attrs)); 135 $attrs = new Foswiki::Attrs("who=JohnSmith",1); 136 $this->assert(!$action->matches($attrs)); 137 $attrs = new Foswiki::Attrs("who=$this->{users_web}.SlyStallone",1); 138 $this->assert($action->matches($attrs)); 139 $attrs = new Foswiki::Attrs("who",1); 140 $this->assert(!$action->matches($attrs)); 141 142 $attrs = new Foswiki::Attrs('notify="SamPeckinpah"',1); 143 $this->assert($action->matches($attrs)); 144 $attrs = new Foswiki::Attrs('notify="QuentinTarantino"',1); 145 $this->assert($action->matches($attrs)); 146 $attrs = new Foswiki::Attrs('notify="JonasSalk,QuentinTarantino"',1); 147 $this->assert($action->matches($attrs)); 148 $attrs = new Foswiki::Attrs('notify="SamBrowne,OscarWilde"',1); 149 $this->assert(!$action->matches($attrs)); 150 $attrs = new Foswiki::Attrs("notify",1); 151 $this->assert(!$action->matches($attrs)); 152 153 $attrs = new Foswiki::Attrs('state="open"',1); 154 $this->assert($action->matches($attrs)); 155 $attrs = new Foswiki::Attrs("open",1); 156 $this->assert($action->matches($attrs)); 157 $attrs = new Foswiki::Attrs("openday",1); 158 $this->assert(!$action->matches($attrs)); 159 $attrs = new Foswiki::Attrs('state="(?!closed).*"',0); 160 $this->assert($action->matches($attrs)); 161 162 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime("4 Jun 2002"); 163 $attrs = new Foswiki::Attrs("within='+2'",1); 164 $this->assert(!$action->matches($attrs)); 165 $attrs = new Foswiki::Attrs("within='2'",1); 166 $this->assert($action->matches($attrs)); 167 $attrs = new Foswiki::Attrs("within='+1'",1); 168 $this->assert(!$action->matches($attrs)); 169 $attrs = new Foswiki::Attrs("within='1'",1); 170 $this->assert(!$action->matches($attrs)); 171 $attrs = new Foswiki::Attrs("within='-1'",1); 172 $this->assert(!$action->matches($attrs)); 173 $attrs = new Foswiki::Attrs("within='-2'",1); 174 $this->assert($action->matches($attrs)); 175 176 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime("31 May 2002"); 177 $attrs = new Foswiki::Attrs("within='+2'",1); 178 $this->assert($action->matches($attrs)); 179 $attrs = new Foswiki::Attrs("within='2'",1); 180 $this->assert($action->matches($attrs)); 181 $attrs = new Foswiki::Attrs("within='+1'",1); 182 $this->assert(!$action->matches($attrs)); 183 $attrs = new Foswiki::Attrs("within='1'",1); 184 $this->assert(!$action->matches($attrs)); 185 $attrs = new Foswiki::Attrs("within='-2'",1); 186 $this->assert(!$action->matches($attrs)); 187 188 $attrs = new Foswiki::Attrs("late",1); 189 $this->assert(!$action->matches($attrs)); 190 191 $attrs = new Foswiki::Attrs("web=Test",1); 192 $this->assert($action->matches($attrs)); 193 $attrs = new Foswiki::Attrs('web=".*t"',1); 194 $this->assert($action->matches($attrs)); 195 $attrs = new Foswiki::Attrs('web="A.*"',1); 196 $this->assert(!$action->matches($attrs)); 197 198 $attrs = new Foswiki::Attrs("topic=Topic",1); 199 $this->assert($action->matches($attrs)); 200 $attrs = new Foswiki::Attrs('topic=".*c"',1); 201 $this->assert($action->matches($attrs)); 202 $attrs = new Foswiki::Attrs('topic="A.*"',1); 203 $this->assert(!$action->matches($attrs)); 204 205 $attrs = new Foswiki::Attrs('due="2 Jun 02"',1); 206 $this->assert($action->matches($attrs)); 207 $attrs = new Foswiki::Attrs('due="3 Jun 02"',1); 208 $this->assert(!$action->matches($attrs)); 209 $attrs = new Foswiki::Attrs('due="< 3 Jun 02"',1); 210 $this->assert($action->matches($attrs)); 211 $attrs = new Foswiki::Attrs('due="> 3 Jun 02"',1); 212 $this->assert(!$action->matches($attrs)); 213 $attrs = new Foswiki::Attrs('due="> 1 Jun 02"',1); 214 $this->assert($action->matches($attrs)); 215 $attrs = new Foswiki::Attrs('due="< 1 Jun 02"',1); 216 $this->assert(!$action->matches($attrs)); 217 218 $attrs = new Foswiki::Attrs("creator=ThomasMoore",1); 219 $this->assert($action->matches($attrs)); 220 $attrs = new Foswiki::Attrs("creator=QuentinTarantino",1); 221 $this->assert(!$action->matches($attrs)); 222 223 $attrs = new Foswiki::Attrs('created="1999-01-01"',1); 224 $this->assert($action->matches($attrs)); 225 $attrs = new Foswiki::Attrs('created="2 Jun 02"',1); 226 $this->assert(!$action->matches($attrs)); 227 $attrs = new Foswiki::Attrs('created="2 Jan 1999"',1); 228 $this->assert(!$action->matches($attrs)); 229 $attrs = new Foswiki::Attrs('created="< 2 Jan 1999"',1); 230 $this->assert($action->matches($attrs)); 231 $attrs = new Foswiki::Attrs('created="> 2 Jan 1999"',1); 232 $this->assert(!$action->matches($attrs)); 233 $attrs = new Foswiki::Attrs('created=">= 1 Jan 1999"',1); 234 $this->assert($action->matches($attrs)); 235 $attrs = new Foswiki::Attrs('created="< 1 Jan 1999"',1); 236 $this->assert(!$action->matches($attrs)); 237 238 $attrs = new Foswiki::Attrs("closed",1); 239 $this->assert(!$action->matches($attrs)); 240 $attrs = new Foswiki::Attrs('closed="2 Jun 02"',1); 241 $this->assert(!$action->matches($attrs)); 242 $attrs = new Foswiki::Attrs('closed="1 Jan 1999"',1); 240 243 $this->assert(!$action->matches($attrs)); 241 244 242 245 # make it late 243 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime("3 Jun 2002");244 $attrs = new TWiki::Attrs("late",1);245 $this->assert($action->matches($attrs)); 246 247 $attrs = new TWiki::Attrs("within=-1",1);246 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime("3 Jun 2002"); 247 $attrs = new Foswiki::Attrs("late",1); 248 $this->assert($action->matches($attrs)); 249 250 $attrs = new Foswiki::Attrs("within=-1",1); 248 251 $this->assert($action->matches($attrs), $action->secsToGo()); 249 $attrs = new TWiki::Attrs("within=+1",1);252 $attrs = new Foswiki::Attrs("within=+1",1); 250 253 $this->assert(!$action->matches($attrs), $action->secsToGo()); 251 254 } … … 254 257 my $this = shift; 255 258 256 my $action = new TWiki::Plugins::ActionTrackerPlugin::Action(259 my $action = new Foswiki::Plugins::ActionTrackerPlugin::Action( 257 260 "Test", "Topic", 0, 258 261 'who="JohnDoe,SlyStallone",due="2 Jun 02" closed="2 Dec 00" closer="Death" notify="SamPeckinpah,QuentinTarantino" created="1 Jan 1999" creator="ThomasMoore"', 259 262 "A new action"); 260 my $attrs = new TWiki::Attrs("closed",1,1);263 my $attrs = new Foswiki::Attrs("closed",1,1); 261 264 $this->assert($action->matches($attrs), $action->stringify()); 262 $attrs = new TWiki::Attrs('closed="2 Dec 00"',1);263 $this->assert($action->matches($attrs)); 264 $attrs = new TWiki::Attrs('closed="> 1 Dec 00"',1);265 $this->assert($action->matches($attrs)); 266 $attrs = new TWiki::Attrs('closed="< 1 Dec 00"',1);267 $this->assert(!$action->matches($attrs)); 268 $attrs = new TWiki::Attrs('closed="2 Dec 01"',1);269 $this->assert(!$action->matches($attrs)); 270 271 $attrs = new TWiki::Attrs("closer=Death",1,1);272 $this->assert($action->matches($attrs)); 273 $attrs = new TWiki::Attrs("open",1);265 $attrs = new Foswiki::Attrs('closed="2 Dec 00"',1); 266 $this->assert($action->matches($attrs)); 267 $attrs = new Foswiki::Attrs('closed="> 1 Dec 00"',1); 268 $this->assert($action->matches($attrs)); 269 $attrs = new Foswiki::Attrs('closed="< 1 Dec 00"',1); 270 $this->assert(!$action->matches($attrs)); 271 $attrs = new Foswiki::Attrs('closed="2 Dec 01"',1); 272 $this->assert(!$action->matches($attrs)); 273 274 $attrs = new Foswiki::Attrs("closer=Death",1,1); 275 $this->assert($action->matches($attrs)); 276 $attrs = new Foswiki::Attrs("open",1); 274 277 $this->assert(!$action->matches($attrs)); 275 278 } … … 278 281 my $this = shift; 279 282 280 my $action = new TWiki::Plugins::ActionTrackerPlugin::Action(283 my $action = new Foswiki::Plugins::ActionTrackerPlugin::Action( 281 284 "Test", "Topic", 0, 282 285 'who="JohnDoe" due="2 Jun 02" state=open notify="SamPeckinpah,QuentinTarantino" created="1 Jan 1999" creator="ThomasMoore"', 283 286 "A new action"); 284 my $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(287 my $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 285 288 "|Who|Due|","|\$who|","","Who: \$who \$who","\$who,\$due"); 286 289 my $s = $fmt->formatStringTable([$action]); 287 290 $this->assert_str_equals("Who: $this->{users_web}.JohnDoe $this->{users_web}.JohnDoe\n",$s, 288 291 $fmt->stringify()); 289 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(292 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 290 293 "","","","Due: \$due"); 291 294 # make it late 292 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime("3 Jun 2002");293 $s = $fmt->formatStringTable([$action]); 294 $this->assert_str_equals("Due: Sun,02 Jun 2002 (LATE)\n", $s);295 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime("3 Jun 2002"); 296 $s = $fmt->formatStringTable([$action]); 297 $this->assert_str_equals("Due: 02 Jun 2002 (LATE)\n", $s); 295 298 # make it ontime 296 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime("1 Jun 2002");297 $s = $fmt->formatStringTable([$action]); 298 $this->assert_str_equals("Due: Sun,02 Jun 2002\n", $s);299 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime("1 Jun 2002"); 300 $s = $fmt->formatStringTable([$action]); 301 $this->assert_str_equals("Due: 02 Jun 2002\n", $s); 299 302 # make it late again 300 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime("3 Jun 2002");301 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(303 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime("3 Jun 2002"); 304 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 302 305 "","","", "State: \$state\n"); 303 306 $s = $fmt->formatStringTable([$action]); 304 307 $this->assert_str_equals("State: open\n\n", $s); 305 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(308 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 306 309 "","", "","Notify: \$notify\n"); 307 310 $s = $fmt->formatStringTable([$action]); 308 311 $this->assert_str_equals( 309 312 "Notify: $this->{users_web}.SamPeckinpah, $this->{users_web}.QuentinTarantino\n\n", $s); 310 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(313 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 311 314 "","", "", "\$creator"); 312 315 $s = $fmt->formatStringTable([$action]); 313 316 $this->assert_str_equals($s, "$this->{users_web}.ThomasMoore\n"); 314 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(317 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 315 318 "","", "","|\$created|"); 316 319 $s = $fmt->formatStringTable([$action]); 317 $this->assert_str_equals("| Fri,01 Jan 1999|\n", $s);318 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(320 $this->assert_str_equals("|01 Jan 1999|\n", $s); 321 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 319 322 "","", "","|\$edit|"); 320 323 $s = $fmt->formatStringTable([$action]); 321 324 $this->assert_str_equals("||\n", $s); 322 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(325 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 323 326 "","", "","\$web.\$topic"); 324 327 $s = $fmt->formatStringTable([$action]); 325 328 $this->assert_str_equals("Test.Topic\n", $s); 326 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(329 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 327 330 "","", "", 'Text "$text"'); 328 331 $s = $fmt->formatStringTable([$action]); 329 332 $this->assert_str_equals("Text \"A new action\"\n", $s); 330 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(333 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 331 334 "","", "","|\$n\$n()\$nop()\$quot\$percnt\$dollar|"); 332 335 $s = $fmt->formatStringTable([$action]); 333 336 $this->assert_str_equals("|\n\n\"%\$|\n", $s); 334 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(337 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 335 338 "","","","Who: \$who Creator: \$creator"); 336 339 $s = $fmt->formatStringTable([$action]); … … 342 345 my $this = shift; 343 346 344 my $action = new TWiki::Plugins::ActionTrackerPlugin::Action(347 my $action = new Foswiki::Plugins::ActionTrackerPlugin::Action( 345 348 "Test","Topic", 0, 346 349 'who=JohnDoe due="2 Jun 02" closed="1-Jan-03" closer="LucBesson"', 347 350 "A new action"); 348 my $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(351 my $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 349 352 "","", "", "|\$closed|\$closer|"); 350 353 my $s = $fmt->formatStringTable([$action]); 351 354 $this->assert_str_equals( 352 $s, "| Wed,01 Jan 2003|$this->{users_web}.LucBesson|\n");355 $s, "|01 Jan 2003|$this->{users_web}.LucBesson|\n"); 353 356 } 354 357 … … 356 359 my $this = shift; 357 360 358 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime("31 May 2002");359 my $action = TWiki::Plugins::ActionTrackerPlugin::Action->new(361 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime("31 May 2002"); 362 my $action = Foswiki::Plugins::ActionTrackerPlugin::Action->new( 360 363 "Test", "Topic", 0, 361 364 'who=JohnDoe due="2 Jun 02" state=open notify="SamPeckinpah,QuentinTarantino" created="1 Jan 1999" creator="ThomasMoore"', 362 365 "A new action"); 363 my $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(366 my $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 364 367 "|Who|Due|", "|\$who|\$due|", "rows"); 365 368 my $s = $fmt->formatHTMLTable([$action], "name", 0, 'atp'); 366 $s =~ s/<table class=\"atp \">//;369 $s =~ s/<table class=\"atpSearch\">//; 367 370 $s =~ s/<\/table>//; 368 371 $s =~ s/\n//g; 369 $this->assert_str_equals("<tr><th >Who</th><td><a name=\"AcTion0\" />$this->{users_web}.JohnDoe</td></tr><tr><th>Due</th><td><span class=\"atpOpen\">Sun,02 Jun 2002</span></td></tr>", $s);372 $this->assert_str_equals("<tr><th align=\"right\">Who</th><td><a name=\"AcTion0\" />$this->{users_web}.JohnDoe</td></tr><tr><th align=\"right\">Due</th><td><span class=\"atpOpen\">02 Jun 2002</span></td></tr>", $s); 370 373 } 371 374 … … 373 376 my $this = shift; 374 377 375 my $action = TWiki::Plugins::ActionTrackerPlugin::Action->new(378 my $action = Foswiki::Plugins::ActionTrackerPlugin::Action->new( 376 379 "Test", "Topic", 0, 377 380 'who=JohnDoe due="2 Jun 02" state=open notify="SamPeckinpah,QuentinTarantino, DavidLynch" created="1 Jan 1999" creator="ThomasMoore"', 378 381 "A new action"); 379 382 380 my $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format("", "|\$who|");383 my $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format("", "|\$who|"); 381 384 my $s = $fmt->formatHTMLTable([$action], "name", 0, 'atp'); 382 385 $this->assert_html_matches( 383 386 "<td><a name=\"AcTion0\" />$this->{users_web}.JohnDoe</td>", $s); 384 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format("", "| \$due |");387 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format("", "| \$due |"); 385 388 # make it late 386 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime("3 Jun 2002");387 $s = $fmt->formatHTMLTable([$action], "href", 0, 'atp'); 388 $this->assert_html_matches( 389 "<td> <span class=\"atpWarn\"> Sun,02 Jun 2002</span> </td>", $s);389 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime("3 Jun 2002"); 390 $s = $fmt->formatHTMLTable([$action], "href", 0, 'atp'); 391 $this->assert_html_matches( 392 "<td> <span class=\"atpWarn\">02 Jun 2002</span> </td>", $s); 390 393 391 394 # make it ontime 392 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime("1 Jun 2002");393 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(395 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime("1 Jun 2002"); 396 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 394 397 "", "| \$due |", ""); 395 398 $s = $fmt->formatHTMLTable([$action], "href", 0, 'atp'); 396 399 $this->assert_html_matches( 397 "<td> <span class=\"atpOpen\"> Sun,02 Jun 2002</span> </td>", $s);400 "<td> <span class=\"atpOpen\">02 Jun 2002</span> </td>", $s); 398 401 399 402 # Make it late again 400 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime("3 Jun 2002");401 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(403 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime("3 Jun 2002"); 404 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 402 405 "", "| \$state |", ""); 403 406 $s = $fmt->formatHTMLTable([$action], "href", 0, 'atp'); 404 407 $this->assert_html_matches("<td> open </td>", $s ); 405 408 406 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format("", "| \$notify |");409 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format("", "| \$notify |"); 407 410 $s = $fmt->formatHTMLTable([$action], "href", 0, 'atp'); 408 411 $this->assert_html_matches( … … 410 413 $s ); 411 414 412 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format("", "| \$uid |");415 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format("", "| \$uid |"); 413 416 $s = $fmt->formatHTMLTable([$action], "href", 0, 'atp'); 414 417 $this->assert_html_matches("<td> </td>", $s ); 415 418 416 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(419 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 417 420 "", "| \$creator |", ""); 418 421 $s = $fmt->formatHTMLTable([$action], "href", 0, 'atp'); 419 422 $this->assert_html_matches("<td> $this->{users_web}.ThomasMoore </td>", $s ); 420 423 421 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(424 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 422 425 "", "| \$created |", ""); 423 426 $s = $fmt->formatHTMLTable([$action], "href", 0, 'atp'); 424 $this->assert_html_matches("<td> Fri,01 Jan 1999 </td>", $s );425 426 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(427 $this->assert_html_matches("<td> 01 Jan 1999 </td>", $s ); 428 429 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 427 430 "", "| \$edit |", ""); 428 my $url = "$ TWiki::cfg{DefaultUrlHost}$TWiki::cfg{ScriptUrlPath}/edit$TWiki::cfg{ScriptSuffix}/Test/Topic\\?skin=action%2cpattern;atp_action=AcTion0;t=";431 my $url = "$Foswiki::cfg{DefaultUrlHost}$Foswiki::cfg{ScriptUrlPath}/edit$Foswiki::cfg{ScriptSuffix}/Test/Topic\\?skin=action%2cpattern;atp_action=AcTion0;t="; 429 432 $s = $fmt->formatHTMLTable([$action], "href", 0 ); 430 433 $this->assert($s =~ m(<td> <a href="(.*?)">edit</a> </td>), $s); … … 432 435 $this->assert_matches(qr(^$url\d+$), $1); 433 436 434 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(437 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 435 438 "", "| \$edit |", ""); 436 439 $s = $fmt->formatHTMLTable([$action], "href", 1, 'atp'); … … 441 444 $this->assert_matches(qr/onclick="return atp_editWindow\('$url\d+'\)"/, $x); 442 445 443 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(446 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 444 447 "", "| \$web.\$topic |", ""); 445 448 $s = $fmt->formatHTMLTable([$action], "href", 0, 'atp'); … … 447 450 $this->assert_html_matches('<td> Test.Topic </td>', $s ); 448 451 449 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(452 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 450 453 "", "| \$text |", ""); 451 454 $s = $fmt->formatHTMLTable([$action], "href", 0, 'XXX'); 452 $this->assert( $s =~ /<td> A new action <a href="$ TWiki::cfg{DefaultUrlHost}$TWiki::cfg{ScriptUrlPath}\/view$TWiki::cfg{ScriptSuffix}\/Test\/Topic#AcTion0">/,455 $this->assert( $s =~ /<td> A new action <a href="$Foswiki::cfg{DefaultUrlHost}$Foswiki::cfg{ScriptUrlPath}\/view$Foswiki::cfg{ScriptSuffix}\/Test\/Topic#AcTion0">/, 453 456 $s ); 454 457 455 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(458 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 456 459 "", "| \$n\$n()\$nop()\$quot\$percnt\$dollar |", ""); 457 460 $s = $fmt->formatHTMLTable([$action], "href", 0, 'atp'); 458 461 $this->assert_html_matches("<td> <br /><br />\"%\$ </td>", $s ); 459 462 460 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime("1 Jun 2002");461 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(463 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime("1 Jun 2002"); 464 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 462 465 "", "| \$due |", ""); 463 466 $s = $fmt->formatHTMLTable([$action], "href", 0, 'atp'); 464 467 $this->assert_html_matches( 465 "<td> <span class=\"atpOpen\"> Sun,02 Jun 2002</span> </td>", $s );466 467 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(468 "<td> <span class=\"atpOpen\">02 Jun 2002</span> </td>", $s ); 469 470 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 468 471 "", "|\$who|\$creator|", ""); 469 472 $s = $fmt->formatHTMLTable([$action], "name", 0, 'atp'); … … 476 479 my $this = shift; 477 480 478 my $action = TWiki::Plugins::ActionTrackerPlugin::Action->new(481 my $action = Foswiki::Plugins::ActionTrackerPlugin::Action->new( 479 482 "Test", "Topic", 0, 480 483 'who=JohnDoe due="2 Jun 02" closed="1-Jan-03" closer="LucBesson"', 481 484 "A new action"); 482 my $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(485 my $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 483 486 "", "|\$closed|\$closer|", ""); 484 487 my $s = $fmt->formatHTMLTable([$action], "href", 0, 'atp'); 485 488 $this->assert_html_matches( 486 "<td> Wed,01 Jan 2003</td><td>$this->{users_web}.LucBesson</td>", $s );489 "<td>01 Jan 2003</td><td>$this->{users_web}.LucBesson</td>", $s ); 487 490 } 488 491 … … 490 493 my $this = shift; 491 494 492 my $action = new TWiki::Plugins::ActionTrackerPlugin::Action(495 my $action = new Foswiki::Plugins::ActionTrackerPlugin::Action( 493 496 "Test", "Topic", 7, 494 497 "state=closed", "A new action"); 495 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime("31 May 2002");498 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime("31 May 2002"); 496 499 my $tim = Time::ParseDate::parsedate("31 May 2002"); 497 500 $action->populateMissingFields(); 498 my $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(501 my $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 499 502 "","","","|\$uid|\$who|"); 500 503 my $s = $fmt->formatStringTable([$action]); 501 $this->assert_matches(qr/^\|\d\d\d\d\d\d\|$this->{users_web}\.$ TWiki::cfg{DefaultUserWikiName}\|\n/, $s);502 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(504 $this->assert_matches(qr/^\|\d\d\d\d\d\d\|$this->{users_web}\.$Foswiki::cfg{DefaultUserWikiName}\|\n/, $s); 505 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 503 506 "","","","|\$creator|\$created|"); 504 507 $s = $fmt->formatStringTable([$action]); 505 $this->assert_str_equals("|$this->{users_web}.$ TWiki::cfg{DefaultUserWikiName}|Fri,31 May 2002|\n", $s);506 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(508 $this->assert_str_equals("|$this->{users_web}.$Foswiki::cfg{DefaultUserWikiName}|31 May 2002|\n", $s); 509 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 507 510 "","","","|\$closer|\$closed|"); 508 511 $s = $fmt->formatStringTable([$action]); 509 $this->assert_str_equals("|$this->{users_web}.$ TWiki::cfg{DefaultUserWikiName}|Fri,31 May 2002|\n", $s);512 $this->assert_str_equals("|$this->{users_web}.$Foswiki::cfg{DefaultUserWikiName}|31 May 2002|\n", $s); 510 513 $action = 511 new TWiki::Plugins::ActionTrackerPlugin::Action(514 new Foswiki::Plugins::ActionTrackerPlugin::Action( 512 515 "Test", "Topic", 8, 513 516 "who=me", "action"); 514 517 $action->populateMissingFields(); 515 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(518 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 516 519 "","","","|\$who|\$created|"); 517 520 $s = $fmt->formatStringTable([$action]); 518 $this->assert_str_equals("|$this->{users_web}.$ TWiki::cfg{DefaultUserWikiName}|Fri,31 May 2002|\n", $s);521 $this->assert_str_equals("|$this->{users_web}.$Foswiki::cfg{DefaultUserWikiName}|31 May 2002|\n", $s); 519 522 } 520 523 … … 522 525 my $this = shift; 523 526 524 my $action = TWiki::Plugins::ActionTrackerPlugin::Action->new(527 my $action = Foswiki::Plugins::ActionTrackerPlugin::Action->new( 525 528 "Test", "Topic", 5, "due=\"2 Jun 02\" state=closed", "A new action"); 526 TWiki::Plugins::ActionTrackerPlugin::Action::forceTime("30 Sep 2001");529 Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime("30 Sep 2001"); 527 530 $action->populateMissingFields(); 528 531 my $s = $action->stringify(); 529 532 $s =~ s/ uid="\d+"//o; 530 533 $s =~ s/ created="2001-09-30"//o; 531 $s =~ s/ creator="$this->{users_web}\.$ TWiki::cfg{DefaultUserWikiName}"//o;532 $s =~ s/ who="$this->{users_web}\.$ TWiki::cfg{DefaultUserWikiName}"//o;534 $s =~ s/ creator="$this->{users_web}\.$Foswiki::cfg{DefaultUserWikiName}"//o; 535 $s =~ s/ who="$this->{users_web}\.$Foswiki::cfg{DefaultUserWikiName}"//o; 533 536 $s =~ s/ due="2002-06-02"//o; 534 537 $s =~ s/ closed="2001-09-30"//o; 535 $s =~ s/ closer="$this->{users_web}\.$ TWiki::cfg{DefaultUserWikiName}"//o;538 $s =~ s/ closer="$this->{users_web}\.$Foswiki::cfg{DefaultUserWikiName}"//o; 536 539 $s =~ s/ state="closed"//o; 537 540 $this->assert_str_equals("%ACTION{ }% A new action %ENDACTION%", $s); 538 541 539 $action = TWiki::Plugins::ActionTrackerPlugin::Action->new(542 $action = Foswiki::Plugins::ActionTrackerPlugin::Action->new( 540 543 "Test", "Topic", 9, 541 544 "due=\"2 Jun 06\" state=open", … … 556 559 AFour 557 560 EOF"; 558 use TWiki::Plugins::ActionTrackerPlugin::ActionSet;559 my $as = TWiki::Plugins::ActionTrackerPlugin::ActionSet::load(561 use Foswiki::Plugins::ActionTrackerPlugin::ActionSet; 562 my $as = Foswiki::Plugins::ActionTrackerPlugin::ActionSet::load( 560 563 "Test", "Topic", $text, 1); 561 564 … … 601 604 my $this = shift; 602 605 603 my $oaction = TWiki::Plugins::ActionTrackerPlugin::Action->new(606 my $oaction = Foswiki::Plugins::ActionTrackerPlugin::Action->new( 604 607 "Test", "Topic", 0, 605 608 "who=JohnDoe due=\"2 Jun 02\" state=open notify=\"SamPeckinpah,QuentinTarantino\" created=\"1 Jan 1999\"", 606 609 "A new action"); 607 610 608 my $naction = TWiki::Plugins::ActionTrackerPlugin::Action->new( "Test", "Topic", 0, "who=JaneDoe due=\"2 Jun 09\" state=closed notify=\"SamPeckinpah,QuentinTarantino\" creator=\"ThomasMoore\"", "A new action<p>with more text");611 my $naction = Foswiki::Plugins::ActionTrackerPlugin::Action->new( "Test", "Topic", 0, "who=JaneDoe due=\"2 Jun 09\" state=closed notify=\"SamPeckinpah,QuentinTarantino\" creator=\"ThomasMoore\"", "A new action<p>with more text"); 609 612 610 613 my $s = "|\$who|\$due|\$state|\$creator|\$created|\$text|"; 611 my $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(614 my $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 612 615 $s,$s,"cols",$s,"\$who,\$due,\$state,\$created,\$creator,\$text"); 613 616 my %not = (); … … 615 618 my $text = $not{"$this->{users_web}.SamPeckinpah"}{text}; 616 619 $this->assert_matches( 617 qr/\|$this->{users_web}.JaneDoe\| Tue,2 Jun 2009\|closed\|$this->{users_web}.ThomasMoore\|/,620 qr/\|$this->{users_web}.JaneDoe\|2 Jun 2009\|closed\|$this->{users_web}.ThomasMoore\|/, 618 621 $text); 619 622 $this->assert_matches(qr/\|A new action<p>with more text\|/, $text); … … 621 624 qr/Attribute \"state\" changed, was \"open\", now \"closed\"/, $text); 622 625 $this->assert_matches( 623 qr/Attribute \"due\" changed, was \" Sun, 2 Jun 2002\", now \"Tue,2 Jun 2009\"/,626 qr/Attribute \"due\" changed, was \"2 Jun 2002\", now \"2 Jun 2009\"/, 624 627 $text); 625 628 $this->assert_matches( … … 627 630 $text); 628 631 $this->assert_matches( 629 qr/Attribute \"created\" was \" Fri,1 Jan 1999\" now removed/,632 qr/Attribute \"created\" was \"1 Jan 1999\" now removed/, 630 633 $text); 631 634 $this->assert_matches( … … 640 643 $text); 641 644 $this->assert_html_matches( 642 "<tr class=\"atpChanges\"><td class=\"atpChanges\">due</td><td class=\"atpChanges\"><span class=\"atpOpen\"> Sun, 02 Jun 2002</span></td><td class=\"atpChanges\"><span class=\"atpClosed\">Tue,02 Jun 2009</span></td></tr>",645 "<tr class=\"atpChanges\"><td class=\"atpChanges\">due</td><td class=\"atpChanges\"><span class=\"atpOpen\">02 Jun 2002</span></td><td class=\"atpChanges\"><span class=\"atpClosed\">02 Jun 2009</span></td></tr>", 643 646 $text); 644 647 $this->assert_html_matches( … … 646 649 $text); 647 650 $this->assert_html_matches( 648 "<tr class=\"atpChanges\"><td class=\"atpChanges\">created</td><td class=\"atpChanges\"> Fri,01 Jan 1999</td><td class=\"atpChanges\"> *removed* </td></tr>",651 "<tr class=\"atpChanges\"><td class=\"atpChanges\">created</td><td class=\"atpChanges\">01 Jan 1999</td><td class=\"atpChanges\"> *removed* </td></tr>", 649 652 $text); 650 653 $this->assert_html_matches( … … 659 662 my $this = shift; 660 663 661 my $s = TWiki::Plugins::ActionTrackerPlugin::Action::extendTypes(664 my $s = Foswiki::Plugins::ActionTrackerPlugin::Action::extendTypes( 662 665 "| plaintiffs,names,16| decision, text, 16|sentencing,date|sentence,select,17,life,\"5 years\",\"community service\"|"); 663 666 $this->assert(!defined($s), $s); 664 667 665 my $action = TWiki::Plugins::ActionTrackerPlugin::Action->new(668 my $action = Foswiki::Plugins::ActionTrackerPlugin::Action->new( 666 669 "Test", "Topic", 0, 667 670 'who=JohnDoe due="2002-06-02" state=open,plaintiffs="fred.bloggs@limp.net,JoeShmoe",decision="cut off their heads" sentencing=2-mar-2006 sentence="5 years"', … … 675 678 $s =~ s/ plaintiffs="fred.bloggs\@limp.net, $this->{users_web}.JoeShmoe"//o; 676 679 $s =~ s/ decision="cut off their heads"//o; 677 $s =~ s/ who="$this->{users_web}\.$ TWiki::cfg{DefaultUserWikiName}"//o;680 $s =~ s/ who="$this->{users_web}\.$Foswiki::cfg{DefaultUserWikiName}"//o; 678 681 $s =~ s/ sentencing="2006-03-02"//o; 679 682 $s =~ s/ sentence="5 years"//o; 680 683 $this->assert_str_equals("%ACTION{ }% %ENDACTION%", $s); 681 684 682 my $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(685 my $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 683 686 "", "|\$plaintiffs|","","\$plaintiffs"); 684 687 $s = $fmt->formatStringTable([$action]); … … 688 691 qr/<td>fred.bloggs\@limp.net, $this->{users_web}.JoeShmoe<\/td>/, $s ); 689 692 690 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(693 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 691 694 "", "|\$decision|","","\$decision"); 692 695 $s = $fmt->formatStringTable([$action]); … … 695 698 $this->assert_matches(qr/<td>cut off their heads<\/td>/, $s ); 696 699 697 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(700 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 698 701 "", "|\$sentence|","","\$sentence"); 699 702 $s = $fmt->formatStringTable([$action]); … … 702 705 $this->assert_matches(qr/<td>5 years<\/td>/, $s ); 703 706 704 $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format(707 $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( 705 708 "", "","","\$sentencing"); 706 709 $s = $fmt->formatStringTable([$action]); 707 $this->assert_str_equals(" Thu,02 Mar 2006\n", $s);708 709 my $attrs = TWiki::Attrs->new("sentence=\"5 years\"");710 $this->assert($action->matches($attrs)); 711 $attrs = TWiki::Attrs->new("sentence=\"life\"");712 $this->assert(!$action->matches($attrs)); 713 $attrs = TWiki::Attrs->new("sentence=\"\\d+ years\"");714 $this->assert($action->matches($attrs)); 715 716 $s = TWiki::Plugins::ActionTrackerPlugin::Action::extendTypes(710 $this->assert_str_equals("02 Mar 2006\n", $s); 711 712 my $attrs = Foswiki::Attrs->new("sentence=\"5 years\""); 713 $this->assert($action->matches($attrs)); 714 $attrs = Foswiki::Attrs->new("sentence=\"life\""); 715 $this->assert(!$action->matches($attrs)); 716 $attrs = Foswiki::Attrs->new("sentence=\"\\d+ years\""); 717 $this->assert($action->matches($attrs)); 718 719 $s = Foswiki::Plugins::ActionTrackerPlugin::Action::extendTypes( 717 720 "|state,select,17,life,\"5 years\",\"community service\"|"); 718 721 $this->assert(!defined($s),$s); 719 TWiki::Plugins::ActionTrackerPlugin::Action::unextendTypes();720 $s = TWiki::Plugins::ActionTrackerPlugin::Action::extendTypes(722 Foswiki::Plugins::ActionTrackerPlugin::Action::unextendTypes(); 723 $s = Foswiki::Plugins::ActionTrackerPlugin::Action::extendTypes( 721 724 "|who,text,17|"); 722 725 $this->assert_str_equals( 723 726 'Attempt to redefine attribute \'who\' in EXTRAS',$s); 724 $s = TWiki::Plugins::ActionTrackerPlugin::Action::extendTypes("|fleegle|");727 $s = Foswiki::Plugins::ActionTrackerPlugin::Action::extendTypes("|fleegle|"); 725 728 $this->assert_str_equals("Bad EXTRAS definition 'fleegle' in EXTRAS",$s ); 726 TWiki::Plugins::ActionTrackerPlugin::Action::unextendTypes();729 Foswiki::Plugins::ActionTrackerPlugin::Action::unextendTypes(); 727 730 } 728 731 … … 757 760 $query->param( ACTION_NUMBER=> -99); 758 761 my $action = 759 TWiki::Plugins::ActionTrackerPlugin::Action::createFromQuery(762 Foswiki::Plugins::ActionTrackerPlugin::Action::createFromQuery( 760 763 "Web","Topic",10,$query); 761 764 my $chosen = $action->stringify(); … … 776 779 777 780 my $action = 778 new TWiki::Plugins::ActionTrackerPlugin::Action(781 new Foswiki::Plugins::ActionTrackerPlugin::Action( 779 782 "Web", "Topic", 9, 780 783 'state="open" creator="$this->{users_web}.Creator" notify="$this->{users_web}.Notifyee" closer="$this->{users_web}.Closer" due="4-May-2003" closed="2-May-2003" who="$this->{users_web}.Who" created="3-May-2003" uid="UID"', 781 784 "Text"); 782 my $fmt = new TWiki::Plugins::ActionTrackerPlugin::Format( "|Who|", "|\$who|", "cols","","");785 my $fmt = new Foswiki::Plugins::ActionTrackerPlugin::Format( "|Who|", "|\$who|", "cols","",""); 783 786 my $s = $action->formatForEdit($fmt); 784 787 # only the who field should be a text; the rest should be hiddens … … 797 800 $s =~ s(<input (.*?name="due".*?)/>)(); 798 801 $this->assert_matches(qr/type="hidden"/, $1); 799 $this->assert_matches(qr/value=" Sun,4 May 2003"/, $1);802 $this->assert_matches(qr/value="4 May 2003"/, $1); 800 803 $s =~ s(<input (.*?name="closed".*?)/>)(); 801 804 $this->assert_matches(qr/type="hidden"/, $1); 802 $this->assert_matches(qr/value=" Fri,2 May 2003"/, $1);805 $this->assert_matches(qr/value="2 May 2003"/, $1); 803 806 $s =~ s(<input (.*?name="created".*?)/>)(); 804 807 $this->assert_matches(qr/type="hidden"/, $1); 805 $this->assert_matches(qr/value=" Sat,3 May 2003"/, $1);808 $this->assert_matches(qr/value="3 May 2003"/, $1); 806 809 $s =~ s(<input (.*?name="uid".*?)/>)(); 807 810 $this->assert_matches(qr/type="hidden"/, $1); … … 815 818 816 819 my $action = 817 new TWiki::Plugins::ActionTrackerPlugin::Action(820 new Foswiki::Plugins::ActionTrackerPlugin::Action( 818
