line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Wiki::Simple::Plugin::RecentChanges;
|
2
|
1
|
|
|
1
|
|
1214
|
use CGI::Wiki::Simple::Plugin();
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use HTML::Entities;
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use vars qw($VERSION);
|
6
|
|
|
|
|
|
|
$VERSION = 0.11;
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
CGI::Wiki::Simple::Plugin::RecentChanges - Node that lists the recent changes
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
This node lists the nodes that were changed in your wiki. This only works for nodes that
|
15
|
|
|
|
|
|
|
are stored within a CGI::Wiki::Store::Database, at least until I implement more of
|
16
|
|
|
|
|
|
|
the store properties for the plugins as well.
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=for example begin
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use CGI::Wiki::Simple;
|
23
|
|
|
|
|
|
|
use CGI::Wiki::Simple::Plugin::RecentChanges( name => 'LastWeekChanges', days => 7 );
|
24
|
|
|
|
|
|
|
# also
|
25
|
|
|
|
|
|
|
use CGI::Wiki::Simple::Plugin::RecentChanges( name => 'Recent20Changes', last_n_changes => 20 );
|
26
|
|
|
|
|
|
|
# also
|
27
|
|
|
|
|
|
|
use CGI::Wiki::Simple::Plugin::RecentChanges( name => 'RecentFileChanges', days => 14, re => qr/^File:(.*)$/ );
|
28
|
|
|
|
|
|
|
# This will display all changed nodes that match ^File:
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=for example end
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
use vars qw(%args);
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub import {
|
37
|
|
|
|
|
|
|
my ($module,%node_args) = @_;
|
38
|
|
|
|
|
|
|
my $node = delete $node_args{name};
|
39
|
|
|
|
|
|
|
$args{$node} = { %node_args };
|
40
|
|
|
|
|
|
|
$args{$node}->{re} ||= '^(.*)$';
|
41
|
|
|
|
|
|
|
CGI::Wiki::Simple::Plugin::register_nodes(module => $module, name => $node);
|
42
|
|
|
|
|
|
|
};
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub retrieve_node {
|
45
|
|
|
|
|
|
|
my (%node_args) = @_;
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my $node = $node_args{name};
|
48
|
|
|
|
|
|
|
my %params = %{$args{$node}};
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $re = delete $params{re} || '^(.*)$';
|
51
|
|
|
|
|
|
|
my %nodes = map {
|
52
|
|
|
|
|
|
|
$_->{name} =~ /$re/ ?
|
53
|
|
|
|
|
|
|
($_->{name} => [ $1, $_->{last_modified} ])
|
54
|
|
|
|
|
|
|
: ()
|
55
|
|
|
|
|
|
|
} $node_args{wiki}->list_recent_changes( %params );
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
return (
|
58
|
|
|
|
|
|
|
"" .
59
|
|
|
|
|
|
|
join ("\n", map { " | " .
|
60
|
|
|
|
|
|
|
$node_args{wiki}->inside_link( node => $_, title => $nodes{$_}->[0] ) .
|
61
|
|
|
|
|
|
|
" | ".$nodes{$_}->[1]." | " }
62
|
|
|
|
|
|
|
sort { $nodes{$b}->[1] cmp $nodes{$a}->[1] }
|
63
|
|
|
|
|
|
|
keys %nodes)
|
64
|
|
|
|
|
|
|
. " | ",0,"");
|
65
|
|
|
|
|
|
|
};
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |