| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Kwiki::RecentChanges::Atom; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
29981
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
40
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
41
|
|
|
5
|
1
|
|
|
1
|
|
508
|
use Kwiki::Plugin '-Base'; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Kwiki::Installer '-base'; |
|
7
|
|
|
|
|
|
|
use XML::Atom::Feed; |
|
8
|
|
|
|
|
|
|
use XML::Atom::Entry; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = "0.03"; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
const class_id => 'RecentChangesAtom'; |
|
13
|
|
|
|
|
|
|
const class_title => 'RecentChangesAtom'; |
|
14
|
|
|
|
|
|
|
const screen_template => 'atom_screen.xml'; |
|
15
|
|
|
|
|
|
|
const config_file => 'atom.yaml'; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub register { |
|
18
|
|
|
|
|
|
|
my $registry = shift; |
|
19
|
|
|
|
|
|
|
$registry->add(action => 'RecentChangesAtom'); |
|
20
|
|
|
|
|
|
|
$registry->add(toolbar => 'atom_button', |
|
21
|
|
|
|
|
|
|
template => 'atom_button.html', |
|
22
|
|
|
|
|
|
|
); |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub RecentChangesAtom { |
|
26
|
|
|
|
|
|
|
my $feed = new XML::Atom::Feed; |
|
27
|
|
|
|
|
|
|
$feed->title($self->config->atom_title); |
|
28
|
|
|
|
|
|
|
$ENV{SERVER_PROTOCOL} =~ m!^(\w+)/!; |
|
29
|
|
|
|
|
|
|
my $protocol = $1; |
|
30
|
|
|
|
|
|
|
my $depth_object = $self->preferences->recent_changes_depth; |
|
31
|
|
|
|
|
|
|
my $depth = 7; |
|
32
|
|
|
|
|
|
|
my $label = +{@{$depth_object->choices}}->{$depth}; |
|
33
|
|
|
|
|
|
|
my $pages; |
|
34
|
|
|
|
|
|
|
@$pages = sort { |
|
35
|
|
|
|
|
|
|
$b->modified_time <=> $a->modified_time; |
|
36
|
|
|
|
|
|
|
} $self->pages->all_since($depth * 1440); |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
foreach my $page (@$pages) { |
|
39
|
|
|
|
|
|
|
my $entry = new XML::Atom::Entry; |
|
40
|
|
|
|
|
|
|
$entry->title($page->id); |
|
41
|
|
|
|
|
|
|
$entry->content("Last edited by " . $page->metadata->edit_by); |
|
42
|
|
|
|
|
|
|
$entry->link("\L$protocol" . "://" . $ENV{SERVER_NAME} . |
|
43
|
|
|
|
|
|
|
$page->hub->config->script_name . "?" . $page->id); |
|
44
|
|
|
|
|
|
|
$feed->add_entry($entry); |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
{ |
|
48
|
|
|
|
|
|
|
no warnings 'redefine'; |
|
49
|
|
|
|
|
|
|
eval "*Spoon::Cookie::content_type = sub {(-type=>'application/xml')};" |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
$self->render_screen(xml => $feed->as_xml, |
|
53
|
|
|
|
|
|
|
screen_title => "Changes in the $label:", |
|
54
|
|
|
|
|
|
|
); |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 NAME |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Kwiki::RecentChanges::Atom - Kwiki Plugin to create an Atom feed of recent changes |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 VERSION |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Version 0.03 |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
$ cpan Kwiki::RecentChanges::Atom |
|
68
|
|
|
|
|
|
|
$ cd /path/to/kwiki |
|
69
|
|
|
|
|
|
|
$ vim plugins |
|
70
|
|
|
|
|
|
|
$ kwiki -update |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This module adds a Atom feed of recent changes to your Kwiki. It also |
|
75
|
|
|
|
|
|
|
adds an Atom icon to your toolbar. |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 AUTHOR |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Steve Peters, C<< >> |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 BUGS |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
|
84
|
|
|
|
|
|
|
C, or through the web interface at |
|
85
|
|
|
|
|
|
|
L. I will be notified, and then you'll automatically |
|
86
|
|
|
|
|
|
|
be notified of progress on your bug as I make changes. |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 TODO |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
The documentation for L doesn't suggest that it populates a |
|
91
|
|
|
|
|
|
|
lot of fields typical to an Atom feed. I need to investigate to see if that |
|
92
|
|
|
|
|
|
|
module creates a very simple feed or if there are a lot of undocumented |
|
93
|
|
|
|
|
|
|
methods. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
James Peregrino's Kwiki::RecentChangesRSS helped this module along. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
L, L |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Copyright 2004-5 Steve Peters, All Rights Reserved. |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
108
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
1; # End of Kwiki::RecentChanges::Atom |
|
113
|
|
|
|
|
|
|
__DATA__ |