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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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} 
Note: See TracChangeset for help on using the changeset viewer.