Changeset 2227


Ignore:
Timestamp:
01/29/09 15:09:14 (3 years ago)
Author:
CrawfordCurrie
Message:

Item4312: support for header, footer etc. Item412: added =reverse= sort for searches

Location:
trunk/ActionTrackerPlugin
Files:
1 added
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/ActionTrackerPlugin/data/System/ActionTrackerPlugin.txt

    r2226 r2227  
    1010--> 
    1111<div style="float:right"> 
    12 <a href="http://wikiring.com"><img src="%ATTACHURLPATH%/juggle.gif" title="WikiRing: Professional Wiki Innovation and Support" /></a> 
     12<a href="http://wikiring.com"><img src="%ATTACHURLPATH%/logo.png" title="WikiRing: Professional Wiki Innovation and Support" /></a> 
    1313</div> 
    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  
    16 This plugin provides support for tracking actions embedded in topics. Actions captured this way can then be tracked from anywhere you want. 
    17  
    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: 
     14This plugin provides support for tracking actions embedded in topics. Actions captured this way can then be searched from any topic in the wiki. 
     15 
     16---+ Features 
     17   * Actions are be embedded in topics. 
     18   * List actions using searches. 
     19   * Automatic e-mail notification of changes. 
     20   * Assign actions to individuals, or to predefined groups. 
     21   * Pop-up action editor. 
     22   * Fully configurable - add your own action attributes. 
     23 
     24This plugin 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".  
     25For example, at a recent meeting of the British Cabinet: 
    1926<verbatim> 
    2027GordonBrown agreed to a zero tax rate for all self-employed software engineers, to make up for past unfair treatment. 
     
    2936Actions are nicely formatted for display, and automatic notification of actions is supported using 'cron'. 
    3037 
     38Actions are _embedded into topics_ so you can easily edit them, and even process them with other tools. No separate database to worry about! 
     39 
    3140%TOC% 
    32  
    33 ---+ Features 
    34         * Actions can be embedded in  topics. 
    35         * Actions can be listed using searches. 
    36         * Automatic action state e-mail notification. 
    37         * Actions can be assigned to individuals, or to predefined groups. 
    38         * Fully configurable. 
    3941 
    4042--- 
     
    342344</pre> 
    343345---++ Formatting how actions are displayed 
    344 The format of an action output. The following fields can be output: =web=, =topic=, =text=, =who=, =due=, =notify=, =uid=, =creator=, =state=, =edit=, and any =ACTIONTRACKERPLUGIN_EXTRAS= you may have. These settings can be overridden in an =ACTIONSEARCH= command using the =format= and =header= attributes. =TABLEHEADER= defines the column headings, =TABLEFORMAT= defines the contents of the columns, and if =TABLEORIENT= is set to =rows=, action tables will be aligned as rows of values instead of the default columns of values. 
     346The default format of an action output, unless overridden by =format=, =header= etc. The following fields can be output: =web=, =topic=, =text=, =who=, =due=, =notify=, =uid=, =creator=, =state=, =edit=, and any =ACTIONTRACKERPLUGIN_EXTRAS= you may have. =TABLEHEADER= defines the column headings, =TABLEFORMAT= defines the contents of the columns, and if =TABLEORIENT= is set to =rows=, action tables will be aligned as rows of values instead of the default columns of values. 
    345347   * ACTIONTRACKERPLUGIN_TABLEHEADER =| Assigned to | Due date | Description | State | Notify ||= 
    346348   * ACTIONTRACKERPLUGIN_TABLEFORMAT =| $who | $due | $text $link | $state | $notify | $edit |= 
     
    410412|  License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) | 
    411413|  Change History: | | 
    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 | 
     414|  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 Foswikitask:Item4312: support for header, footer etc. Foswikitask:Item412: added =reverse= | 
    413415|  7 May 2008 | TWikibug:Item5607: http: was being doubled up on URLs in mail due to a core bug | 
    414416|  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 | 
     
    450452 
    451453%META:FILEATTACHMENT{name="styles.css" attr="" comment="Stylesheet for actions"}% 
    452 %META:FILEATTACHMENT{name="juggle.gif" attr="h" comment="Logo"}% 
     454%META:FILEATTACHMENT{name="logo.png" attr="h" comment="Logo"}% 
    453455%META:FILEATTACHMENT{name="wikiringlogo20x20.png" attr="h" comment="" version="1"}% 
  • trunk/ActionTrackerPlugin/lib/Foswiki/Plugins/ActionTrackerPlugin.pm

    r2226 r2227  
    132132 
    133133    if( Foswiki::Func::getSkin() =~ /\baction\b/ ) { 
    134 print STDERR "Action edit\n"; 
    135134        return _beforeActionEdit(@_); 
    136135    } else { 
    137 print STDERR "Noamrl edit\n"; 
    138136        return _beforeNormalEdit(@_); 
    139137    } 
     
    411409    my $orient = $attrs->remove( 'orient' ); 
    412410    my $sort = $attrs->remove( 'sort' ); 
     411    my $reverse = $attrs->remove( 'reverse' ); 
    413412    if ( defined( $fmts ) || defined( $hdrs ) || defined( $orient )) { 
    414413        $fmts = $defaultFormat->getFields() unless ( defined( $fmts )); 
     
    421420 
    422421    my $actions = Foswiki::Plugins::ActionTrackerPlugin::ActionSet::allActionsInWebs( $web, $attrs, 0 ); 
    423     $actions->sort( $sort ); 
     422    $actions->sort( $sort, $reverse ); 
    424423    return $actions->formatAsHTML( $fmt, 'href', $options->{USENEWWINDOW}, 
    425424                                   'atpSearch' ); 
     
    440439    }; 
    441440    if ($@) { 
     441        print STDERR "ActionTrackerPlugin: init failed $@\n"; 
    442442        Foswiki::Func::writeWarning("ActionTrackerPlugin: init failed $@"); 
    443443        return 0; 
  • trunk/ActionTrackerPlugin/lib/Foswiki/Plugins/ActionTrackerPlugin/ActionSet.pm

    r2226 r2227  
    8989# of attributes by string value 
    9090sub sort { 
    91     my ( $this, $order ) = @_; 
     91    my ( $this, $order, $reverse ) = @_; 
     92    my @ordered; 
    9293    if ( defined( $order ) ) { 
    9394        $order =~ s/[^\w,]//g; 
    9495        @_sortfields = split( /,\s*/, $order ); 
    95         @{$this->{ACTIONS}} = sort { 
     96        @ordered = sort { 
    9697            foreach my $sf ( @_sortfields ) { 
    9798                return -1 unless ref($a); 
     
    115116        } @{$this->{ACTIONS}}; 
    116117    } else { 
    117         @{$this->{ACTIONS}} = 
     118        @ordered = 
    118119          sort { 
    119120              my $x = $a->secsToGo(); 
     
    121122              return $x <=> $y; 
    122123          } @{$this->{ACTIONS}}; 
     124    } 
     125    if (Foswiki::Func::isTrue($reverse)) { 
     126        @{$this->{ACTIONS}} = reverse @ordered; 
     127    } else { 
     128        @{$this->{ACTIONS}} = @ordered; 
    123129    } 
    124130} 
  • trunk/ActionTrackerPlugin/lib/Foswiki/Plugins/ActionTrackerPlugin/Format.pm

    r2226 r2227  
    145145    my $args = shift; 
    146146    my $asHTML = shift; 
    147     if ( defined( &{ref( $object ) . "::_formatField_$vbl"} ) ) { 
     147    my $fn = "_formatField_$vbl"; 
     148    if ( $object->can($fn) ) { 
    148149        # special format for this field 
    149         my $fn = "_formatField_$vbl"; 
    150150        return $object->$fn( $args, $asHTML, @_ ); 
    151151    } 
     
    153153    if( $type ) { 
    154154        my $typename = $type->{type}; 
    155         if ( defined( &{ref( $object ) . "::_formatType_$typename"} ) ) { 
     155        $fn = "_formatType_$typename"; 
     156        if ( $object->can($fn) ) { 
    156157            # special format for this type 
    157             my $fn = "_formatType_$typename"; 
    158158            return $object->$fn( $vbl, $args, $asHTML, @_ ); 
    159159        } 
     
    169169        return ''; 
    170170    } 
    171 } 
    172  
    173 # PRIVATE STATIC fill in variable expansions in simple text form 
    174 sub _expandString { 
    175     my $object = shift; 
    176     my $var = shift; 
    177     my $args = shift; 
    178  
    179     if ( $var eq "dollar") { 
    180         return "\$"; 
    181     } elsif ($var eq "nop") { 
    182         return ""; 
    183     } elsif ($var eq "n") { 
    184         return "\n"; 
    185     } elsif ($var eq "percnt") { 
    186         return "%"; 
    187     } elsif ($var eq "quot") { 
    188         return "\""; 
    189     } 
    190     my $t = _expandVar( $object, $var, $args, @_ ); 
    191     return $t; 
    192 } 
    193  
    194 # PUBLIC fill in the text template using values 
    195 # extracted from the given object 
    196 sub _formatAsString { 
    197     my $this = shift; 
    198     my $object = shift; 
    199  
    200     my $fmt = $this->{TEXTFORM} || ''; 
    201     $fmt =~ s/\$(\w+\b)(?:\((.*?)\))?/ 
    202       _expandString( $object, $1, $2, 0, @_ )/geos; 
    203  
    204     return $fmt; 
    205 } 
    206  
    207 # PRIVATE STATIC fill in variable expansions. If any of the expansions 
    208 # returns a non-zero color, then fill in the passed-by-reference color 
    209 # variable $col with the value returned. 
    210 sub _expandHTML { 
    211     my $object = shift; 
    212     my $var = shift; 
    213     my $args = shift; 
    214  
    215     if ( $var eq "dollar") { 
    216         return "\$"; 
    217     } elsif ($var eq "nop") { 
    218         return ""; 
    219     } elsif ($var eq "n") { 
    220         return CGI::br(); 
    221     } elsif ($var eq "percnt") { 
    222         return "%"; 
    223     } elsif ($var eq "quot") { 
    224         return "\""; 
    225     } 
    226  
    227     my $t = _expandVar( $object, $var, $args, @_ ); 
    228  
    229     return $t; 
    230171} 
    231172 
     
    249190            my $c; 
    250191            my $entry = $i; 
     192            $entry = Foswiki::Func::decodeFormatTokens($entry); 
    251193            $entry =~ s/\$(\w+)(?:\((.*?)\))?/ 
    252               _expandHTML( $object, $1, $2, 1, $jump, $newWindow )/ges; 
     194              _expandVar( $object, $1, $2, 1, $jump, $newWindow )/ges; 
    253195            if( !$anchored ) { 
    254196                $entry = CGI::a( { name=>$object->getAnchor() } ).$entry; 
     
    306248    my $text = ''; 
    307249    foreach my $row ( @$data ) { 
    308         my $horzrow = $this->_formatAsString( $row, @_ ); 
    309         $text .= $horzrow."\n"; 
     250        my $fmt = $this->{TEXTFORM} || ''; 
     251        $fmt = Foswiki::Func::decodeFormatTokens($fmt); 
     252        $fmt =~ s/\$(\w+\b)(?:\((.*?)\))?/ 
     253          _expandVar( $row, $1, $2, 0, @_ )/geos; 
     254        $text .= $fmt."\n"; 
    310255    } 
    311256    return $text; 
  • trunk/ActionTrackerPlugin/lib/Foswiki/Plugins/ActionTrackerPlugin/MANIFEST

    r2226 r2227  
    55pub/System/ActionTrackerPlugin/atp_src.js 0660 Javascript source 
    66pub/System/ActionTrackerPlugin/atp.js 0660 Javascript 
    7 pub/System/ActionTrackerPlugin/juggle.gif 0660 Image 
     7pub/System/ActionTrackerPlugin/logo.png 0660 Image 
    88pub/System/ActionTrackerPlugin/wikiringlogo20x20.png 0660 
    99tools/actionnotify 0555 Mailer script 
  • trunk/ActionTrackerPlugin/test/unit/ActionTrackerPlugin/ActionTests.pm

    r2226 r2227  
    459459        "", "| \$n\$n()\$nop()\$quot\$percnt\$dollar |", ""); 
    460460    $s = $fmt->formatHTMLTable([$action], "href", 0, 'atp'); 
    461     $this->assert_html_matches("<td> <br /><br />\"%\$ </td>", $s ); 
     461    $this->assert_html_matches("<td> \n\n\"%\$ </td>", $s ); 
    462462 
    463463    Foswiki::Plugins::ActionTrackerPlugin::Action::forceTime("1 Jun 2002"); 
Note: See TracChangeset for help on using the changeset viewer.