2007-07-04 14:17:08 +00:00
|
|
|
# Copyright (C) 2007 Alex Schroeder <alex@emacswiki.org>
|
|
|
|
|
#
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
2016-08-16 14:59:13 +02:00
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
2007-07-04 14:17:08 +00:00
|
|
|
# (at your option) any later version.
|
|
|
|
|
#
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2016-08-16 14:59:13 +02:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2007-07-04 14:17:08 +00:00
|
|
|
|
2015-03-27 03:01:01 +02:00
|
|
|
use strict;
|
2015-08-18 10:48:03 +02:00
|
|
|
use v5.10;
|
2015-03-27 03:01:01 +02:00
|
|
|
|
2014-08-21 22:23:23 +02:00
|
|
|
AddModuleDescription('archive.pl', 'Archive Extension');
|
2007-07-04 14:17:08 +00:00
|
|
|
|
2015-04-10 13:31:28 +03:00
|
|
|
our ($q);
|
2015-03-27 03:01:01 +02:00
|
|
|
|
2015-04-11 23:41:33 +03:00
|
|
|
*OldArchiveGetHeader = \&GetHeader;
|
|
|
|
|
*GetHeader = \&NewArchiveGetHeader;
|
2007-07-04 14:17:08 +00:00
|
|
|
|
|
|
|
|
# this assumes that *all* calls to GetHeader will print!
|
|
|
|
|
sub NewArchiveGetHeader {
|
|
|
|
|
my ($id) = @_;
|
|
|
|
|
print OldArchiveGetHeader(@_);
|
|
|
|
|
my %dates = ();
|
|
|
|
|
for (AllPagesList()) {
|
2007-07-04 20:14:44 +00:00
|
|
|
$dates{$1}++ if /^(\d\d\d\d-\d\d)-\d\d/;
|
2007-07-04 14:17:08 +00:00
|
|
|
}
|
|
|
|
|
print $q->div({-class=>'archive'},
|
2007-07-04 14:52:44 +00:00
|
|
|
$q->p($q->span(T('Archive:')),
|
|
|
|
|
map {
|
2015-03-27 03:01:01 +02:00
|
|
|
my $key = $_;
|
2007-07-04 20:14:44 +00:00
|
|
|
my ($year, $month) = split(/-/, $key);
|
2007-07-04 14:52:44 +00:00
|
|
|
if (defined(&month_name)) {
|
|
|
|
|
ScriptLink('action=collect;match=' . UrlEncode("^$year-$month"),
|
2007-07-04 20:14:44 +00:00
|
|
|
month_name($month) . " $year ($dates{$key})");
|
2007-07-04 14:52:44 +00:00
|
|
|
} else {
|
|
|
|
|
ScriptLink('action=index;match=' . UrlEncode("^$year-$month"),
|
2007-07-04 20:14:44 +00:00
|
|
|
"$year-$month ($dates{$key})");
|
2007-07-04 14:52:44 +00:00
|
|
|
}
|
2007-07-04 20:14:44 +00:00
|
|
|
} sort { $b <=> $a } keys %dates));
|
2007-07-04 14:17:08 +00:00
|
|
|
return '';
|
|
|
|
|
}
|