Show
Ignore:
Timestamp:
05/25/06 15:59:17 (6 years ago)
Author:
nick
Message:

Support for RSS feeds of the node all versions, and tests for it

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • wiki-toolkit/trunk/lib/Wiki/Toolkit/Feed/Listing.pm

    r298 r308  
    99Handles common data fetching tasks, so that child classes need only 
    1010worry about formatting the feeds. 
     11 
     12Also enforces some common methods that must be implemented. 
    1113 
    1214=cut 
     
    7476    my ($self, %args) = @_; 
    7577 
    76     # TODO. Will make use of store->list_node_all_versions() 
     78    # Check we got the right options 
     79    unless($args{'name'}) { 
     80        return (); 
     81    } 
     82 
     83    # Do the fetch 
     84    my @nodes = $self->{wiki}->list_node_all_versions( 
     85                        name => $args{'name'}, 
     86                        with_content => 0, 
     87                        with_metadata => 1, 
     88    ); 
     89 
     90    # Ensure that all the metadata fields are arrays and not strings 
     91    foreach my $node (@nodes) { 
     92        foreach my $mdk (keys %{$node->{'metadata'}}) { 
     93            unless(ref($node->{'metadata'}->{$mdk}) eq "ARRAY") { 
     94                $node->{'metadata'}->{$mdk} = [ $node->{'metadata'}->{$mdk} ]; 
     95            } 
     96        } 
     97    } 
     98 
     99    return @nodes; 
    77100} 
    78101 
     102 
     103# The following are methods that any feed renderer must provide 
     104 
     105=item B<recent_changes> 
     106All implementing feed renderers must implement a method to fetch a list 
     107of recent changes, and render them 
     108=cut 
     109sub recent_changes    { die("Not implemented by feed renderer!"); } 
     110=item B<node_all_versions> 
     111All implementing feed renderers must implement a method to fetch a list 
     112of the different versions of a node, and render them 
     113=cut 
     114sub node_all_versions { die("Not implemented by feed renderer!"); } 
     115=item B<feed_timestamp> 
     116All implementing feed renderers must implement a method to produce a 
     117feed specific timestamp, based on the supplied node 
     118=cut 
     119sub feed_timestamp    { die("Not implemented by feed renderer!"); } 
     120 
    791211;