Changeset 471


Ignore:
Timestamp:
Sep 16, 2004, 1:11:29 PM (17 years ago)
Author:
kake
Message:

Improved RecentChanges.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Changes

    r470 r471  
     10.40
     2        Recent Changes now shows changes in the past 24 hours, past week,
     3          past fortnight, and past 30 days.
     4
    150.39    15 September 2004
    26        Split commit_node out into OpenGuides.pm in preparation for spam filter
  • trunk/PREREQUISITES

    r470 r471  
    1 Modules required by OpenGuides 0.39
     1Modules required by OpenGuides 0.40
    22===================================
    33
  • trunk/lib/OpenGuides.pm

    r470 r471  
    1313use vars qw( $VERSION );
    1414
    15 $VERSION = '0.39';
     15$VERSION = '0.40';
    1616
    1717=head1 NAME
     
    187187    if ($id eq "RecentChanges") {
    188188        my $minor_edits = $self->get_cookie( "show_minor_edits_in_rc" );
    189         my %criteria = ( days => 7 );
    190         $criteria{metadata_was} = { edit_type => "Normal edit" }
    191           unless $minor_edits;
    192         my @recent = $wiki->list_recent_changes( %criteria );
    193         @recent = map { {name          => CGI->escapeHTML($_->{name}),
    194                          last_modified => CGI->escapeHTML($_->{last_modified}),
    195                          version       => CGI->escapeHTML($_->{version}),
    196                          comment       => CGI->escapeHTML($_->{metadata}{comment}[0]),
    197                          username      => CGI->escapeHTML($_->{metadata}{username}[0]),
    198                          host          => CGI->escapeHTML($_->{metadata}{host}[0]),
    199                          username_param => CGI->escape($_->{metadata}{username}[0]),
    200                          edit_type     => CGI->escapeHTML($_->{metadata}{edit_type}[0]),
    201                          url           => "$config->{_}->{script_name}?"
    202           . CGI->escape($wiki->formatter->node_name_to_node_param($_->{name})) }
    203                        } @recent;
    204         $tt_vars{recent_changes} = \@recent;
    205         $tt_vars{days} = 7;
     189        my %recent_changes;
     190        for my $days ( [0, 1], [1, 7], [7, 14], [14, 30] ) {
     191            my %criteria = ( between_days => $days );
     192            $criteria{metadata_was} = { edit_type => "Normal edit" }
     193              unless $minor_edits;
     194            my @rc = $self->{wiki}->list_recent_changes( %criteria );
     195
     196            @rc = map {
     197                {
     198                  name        => CGI->escapeHTML($_->{name}),
     199                  last_modified => CGI->escapeHTML($_->{last_modified}),
     200                  version     => CGI->escapeHTML($_->{version}),
     201                  comment     => CGI->escapeHTML($_->{metadata}{comment}[0]),
     202                  username    => CGI->escapeHTML($_->{metadata}{username}[0]),
     203                  host        => CGI->escapeHTML($_->{metadata}{host}[0]),
     204                  username_param => CGI->escape($_->{metadata}{username}[0]),
     205                  edit_type   => CGI->escapeHTML($_->{metadata}{edit_type}[0]),
     206                  url         => "$config->{_}->{script_name}?"
     207          . CGI->escape($wiki->formatter->node_name_to_node_param($_->{name})),
     208                }
     209                       } @rc;
     210            if ( scalar @rc ) {
     211                $recent_changes{$days->[1]} = \@rc;
     212            }
     213        }
     214        $tt_vars{recent_changes} = \%recent_changes;
    206215        return %tt_vars if $args{return_tt_vars};
    207216        my $output = $self->process_template(
  • trunk/templates/recent_changes.tt

    r470 r471  
    44<div id="content">
    55  [% INCLUDE navbar.tt %]
    6   <h2>Site changes in the last [% days %] days</h2>
     6  <h2>Recent site changes</h2>
    77  [% content %]
    8   <table id="recentchanges" cellpadding="0" cellspacing="0" border="0" summary="Table containing the list of recent changes to this site">
    9     [% FOREACH node = recent_changes %]
     8
     9  [% BLOCK changes %]
     10    <table id="recentchanges_[% days %]" cellpadding="0" cellspacing="0"
     11     border="0"
     12     summary="Table containing the list of recent changes to this site">
     13    [% FOREACH node = nodes %]
    1014      <tr>
    1115        <td class="recentchanges_node_name"><a href="[% node.url %]">[% node.name %]</a></td>
     
    3337      </tr>
    3438    [% END %]
    35   </table>
     39    </table>
     40  [% END %]
     41
     42[% IF recent_changes.1 %]
     43  <h2>Pages changed in the last 24 hours:</h2>
     44  [% INCLUDE changes nodes = recent_changes.1 days = 1 %]
     45[% END %]
     46
     47[% IF recent_changes.7 %]
     48  <h2>Pages changed in the last week:</h2>
     49  [% INCLUDE changes nodes = recent_changes.7 days = 7 %]
     50[% END %]
     51
     52[% IF recent_changes.14 %]
     53  <h2>Pages changed in the last fortnight:</h2>
     54  [% INCLUDE changes nodes = recent_changes.14 days = 14 %]
     55[% END %]
     56
     57[% IF recent_changes.30 %]
     58  <h2>Pages changed in the last 30 days:</h2>
     59  [% INCLUDE changes nodes = recent_changes.30 days = 30 %]
     60[% END %]
    3661
    3762[% INCLUDE footer.tt %]
  • trunk/wiki.cgi

    r470 r471  
    55
    66use vars qw( $VERSION );
    7 $VERSION = '0.39';
     7$VERSION = '0.40';
    88
    99use CGI qw/:standard/;
Note: See TracChangeset for help on using the changeset viewer.