line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Kwiki::RecentChanges; |
2
|
1
|
|
|
1
|
|
36086
|
use Kwiki::Plugin -Base; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
use mixin 'Kwiki::Installer'; |
4
|
|
|
|
|
|
|
our $VERSION = '0.14'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
const class_id => 'recent_changes'; |
7
|
|
|
|
|
|
|
const css_file => 'recent_changes.css'; |
8
|
|
|
|
|
|
|
const cgi_class => 'Kwiki::RecentChanges::CGI'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub register { |
11
|
|
|
|
|
|
|
my $registry = shift; |
12
|
|
|
|
|
|
|
$registry->add(action => 'recent_changes_ajax_list'); |
13
|
|
|
|
|
|
|
$registry->add(action => 'recent_changes'); |
14
|
|
|
|
|
|
|
$registry->add(toolbar => 'recent_changes_button', |
15
|
|
|
|
|
|
|
template => 'recent_changes_button.html', |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
$registry->add(toolbar => 'recent_changes_options', |
18
|
|
|
|
|
|
|
template => 'recent_changes_options.html', |
19
|
|
|
|
|
|
|
show_for => 'recent_changes' |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
$registry->add(preference => $self->recent_changes_depth); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub recent_changes_depth { |
26
|
|
|
|
|
|
|
my $p = $self->new_preference('recent_changes_depth'); |
27
|
|
|
|
|
|
|
$p->query('What time interval should "Recent Changes" display?'); |
28
|
|
|
|
|
|
|
$p->type('pulldown'); |
29
|
|
|
|
|
|
|
my $choices = [ |
30
|
|
|
|
|
|
|
1 => 'Last 24 hours', |
31
|
|
|
|
|
|
|
2 => 'Last 2 Days', |
32
|
|
|
|
|
|
|
3 => 'Last 3 Days', |
33
|
|
|
|
|
|
|
7 => 'Last Week', |
34
|
|
|
|
|
|
|
14 => 'Last 2 Weeks', |
35
|
|
|
|
|
|
|
30 => 'Last Month', |
36
|
|
|
|
|
|
|
60 => 'Last 2 Months', |
37
|
|
|
|
|
|
|
90 => 'Last 3 Months', |
38
|
|
|
|
|
|
|
182 => 'Last 6 Months', |
39
|
|
|
|
|
|
|
]; |
40
|
|
|
|
|
|
|
$p->choices($choices); |
41
|
|
|
|
|
|
|
$p->default(7); |
42
|
|
|
|
|
|
|
return $p; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub recent_changed_pages { |
46
|
|
|
|
|
|
|
my $depth_object = $self->preferences->recent_changes_depth; |
47
|
|
|
|
|
|
|
my $depth = $depth_object->value; |
48
|
|
|
|
|
|
|
my $label = +{@{$depth_object->choices}}->{$depth}; |
49
|
|
|
|
|
|
|
my $pages; |
50
|
|
|
|
|
|
|
@$pages = sort { |
51
|
|
|
|
|
|
|
$b->modified_time <=> $a->modified_time |
52
|
|
|
|
|
|
|
} $self->pages->all_since($depth * 1440); |
53
|
|
|
|
|
|
|
return $pages; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub recent_changes_ajax_list { |
57
|
|
|
|
|
|
|
my $pages = $self->recent_changed_pages; |
58
|
|
|
|
|
|
|
$self->hub->headers->content_type("text/xml"); |
59
|
|
|
|
|
|
|
$self->template_process('recent_changes_ajax_list.xml', pages => $pages); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub recent_changes { |
63
|
|
|
|
|
|
|
my $depth_object = $self->preferences->recent_changes_depth; |
64
|
|
|
|
|
|
|
my $depth = $self->cgi->depth || $depth_object->value; |
65
|
|
|
|
|
|
|
my $label = +{@{$depth_object->choices}}->{$depth}; |
66
|
|
|
|
|
|
|
my $pages; |
67
|
|
|
|
|
|
|
@$pages = sort { |
68
|
|
|
|
|
|
|
$b->modified_time <=> $a->modified_time |
69
|
|
|
|
|
|
|
} $self->pages->all_since($depth * 1440); |
70
|
|
|
|
|
|
|
my $num = @$pages; |
71
|
|
|
|
|
|
|
$self->render_screen( |
72
|
|
|
|
|
|
|
pages => $pages, |
73
|
|
|
|
|
|
|
screen_title => "$num Changes in the $label:", |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
package Kwiki::RecentChanges::CGI; |
78
|
|
|
|
|
|
|
use Kwiki::CGI -base; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
cgi 'depth'; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
package Kwiki::RecentChanges; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
__DATA__ |