• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.
Patch assumed to be against AT version 11698

Enhancements to improve the actionnotify operation:

  1. Generate the keys in sorted order so they don't re-order themselves randomly.
  2. Allow actionnotify be able to specify the "age=X" parameter
  3. Allow actionnotify be able to specify the "duedays=X" parameter

Example usage in a crontab:

#
# TWiki Action Tracker Notification Support
#
#     - Late AI, get notified 3 times per week, on Mon, Wed, and Fri
#     - AI due in 3 days, get notified once per day
#     - AI due in 7 days, get notified once per day
#     - When an AI gets created, get notified on that day
#
  21   23  *   * 1,3,5 (cd /var/www/twiki/tools; perl -I ../bin ./actionnotify state=late)
  22   01  *   *   *   (cd /var/www/twiki/tools; perl -I ../bin ./actionnotify state=open duedays=3)
  23   01  *   *   *   (cd /var/www/twiki/tools; perl -I ../bin ./actionnotify state=open duedays=7)
  24   23  *   *   *   (cd /var/www/twiki/tools; perl -I ../bin ./actionnotify state=open age=0)
  25   23  *   *   *   (cd /var/www/twiki/tools; perl -I ../bin ./actionnotify changedsince=yesterday)

--- lib/TWiki/Plugins/ActionTrackerPlugin/Action.pm   2007/01/10 17:00:08   1.1
+++ lib/TWiki/Plugins/ActionTrackerPlugin/Action.pm   2007/01/10 17:06:01
@@ -117,6 +117,10 @@
    new TWiki::Plugins::ActionTrackerPlugin::AttrDef( 'names', $nw, 1, 0, undef ),
    within       =>
    new TWiki::Plugins::ActionTrackerPlugin::AttrDef( 'noload', 0, 1, 0, undef ),
+   duedays      =>
+   new TWiki::Plugins::ActionTrackerPlugin::AttrDef( 'noload', 0, 1, 0, undef ),
+   age          =>
+   new TWiki::Plugins::ActionTrackerPlugin::AttrDef( 'noload', 0, 1, 0, undef ),
    ACTION_NUMBER=>
    new TWiki::Plugins::ActionTrackerPlugin::AttrDef( 'noload', 0, 0, 0, undef ),
   );
@@ -329,7 +333,7 @@
     my $this = shift;
     my $attrs = '';
     my $descr = '';
-    foreach my $key ( keys %$this ) {
+    foreach my $key ( sort ( keys %$this ) ) {
         my $type = $types{$key};
         if ( $key eq 'text') {
             $descr = $this->{text};
@@ -439,6 +443,15 @@
     }
 }
 
+# PUBLIC return how many days old the action item is.
+sub daysOld {
+    my $this = shift;
+    if ( defined ($this->{created} )) {
+   return ($now - $this->{created}) / 86400;
+    }
+    return -1;
+}
+
 # PUBLIC true if due time is before now and not closed
 sub isLate {
     my $this = shift;
@@ -495,6 +508,28 @@
     }
 }
 
+# PRIVATE match if there are at exactly $val duedays to go before
+# action falls due
+sub _matchField_duedays {
+    my ( $this, $val ) = @_;
+    my $slack = $this->secsToGo() - $val * 86400;
+    if ($val > 0) {
+   return ($slack <= 0) && ($slack >= -86400);
+    } else {
+   return ($slack >= 0) && ($slack <= 86400);
+    }
+}
+
+# PRIVATE match if the action item's age is exactly $val days ago
+sub _matchField_age {
+    my ( $this, $val ) = @_;
+    if ($val >= 0) {
+   return ($this->daysOld() - $val) == 0;
+    } else {
+   return 0;
+    }
+}
+
 # PRIVATE match boolean attribute "closed"
 sub _matchField_closed {
     my ( $this, $val ) = @_;

-- TWiki:Main.JonDiekema - 10 Jan 2007


Nice one, thanks Jon. Before I can apply the patch I need you to:
  1. Verify that the patch is against rev 11698
  2. Provide user documentation
  3. Update the unit testcases so that the functionality of the patch is tested and the existing tests don't fail when this patch is applied.
    • If you can't work out how to do this I will help, but it would be most helpful if you could do 1 and 2
Thanks,

CC


Jon mailed me:

I didn't realize that I had this out there. I will work to complete items 1 and 2, since it would be desirable to get this into the mainline.

Changed state to "Being worked on"

CC


The sort change of the patch is already in the source:

-    foreach my $key ( keys %$this ) {
+    foreach my $key ( sort ( keys %$this ) ) {

The "age" and "duedays" parameters introduced by the patch may either have been subsumed by the "due=" parameter or we simply didn't understand the "due=" parameter when we invented the new parameters.

It looks to me like the example crontab entries:

  22   01  *   *   *   (cd /var/www/twiki/tools; perl -I ../bin ./actionnotify state=open duedays=3)
  23   01  *   *   *   (cd /var/www/twiki/tools; perl -I ../bin ./actionnotify state=open duedays=7)
  24   23  *   *   *   (cd /var/www/twiki/tools; perl -I ../bin ./actionnotify state=open age=0)

can be expressed as:

  22   01  *   *   *   (cd /var/www/twiki/tools; perl -I ../bin ./actionnotify state=open due="now + 3 days")
  23   01  *   *   *   (cd /var/www/twiki/tools; perl -I ../bin ./actionnotify state=open due="now + 7 days")
  24   23  *   *   *   (cd /var/www/twiki/tools; perl -I ../bin ./actionnotify state=open due="now")

I have not had time to confirm this, however.

-- JerryVanBaren - 16 Apr 2007

No further feedback for a year. Closed.

-- CrawfordCurrie - 13 Apr 2008

ItemTemplate
Summary Plugin enhancements (patch)
ReportedBy TWiki:Main.JonDiekema
Codebase

SVN Range TWiki-4.1.0, Wed, 10 Jan 2007, build 12488
AppliesTo Extension
Component ActionTrackerPlugin
Priority Enhancement
CurrentState No Action Required
WaitingFor TWiki:Main.JonDiekema
Checkins

TargetRelease n/a
ReleasedIn

Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r6 - 2008-04-13 - CrawfordCurrie
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback