2006-02-22 22:21:35 +00:00
|
|
|
# Copyright (C) 2006 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
|
2006-02-22 22:21:35 +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/>.
|
2006-02-22 22:21:35 +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('today.pl', 'Blog Module');
|
2006-02-22 22:21:35 +00:00
|
|
|
|
2015-04-10 13:31:28 +03:00
|
|
|
our (%Action, $Now, @MyAdminCode, $UsePathInfo, $NamespaceCurrent);
|
2015-03-27 03:01:01 +02:00
|
|
|
|
2006-02-22 22:21:35 +00:00
|
|
|
# New Action
|
|
|
|
|
|
2007-08-03 23:08:43 +00:00
|
|
|
push(@MyAdminCode, \&TodayMenu);
|
|
|
|
|
|
|
|
|
|
sub TodayMenu {
|
|
|
|
|
my ($id, $menuref, $restref) = @_;
|
|
|
|
|
push(@$menuref,
|
|
|
|
|
ScriptLink('action=new',
|
|
|
|
|
T('Create a new page for today'),
|
|
|
|
|
'today'));
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-22 22:21:35 +00:00
|
|
|
$Action{new} = \&DoNew;
|
|
|
|
|
|
|
|
|
|
sub DoNew {
|
2006-02-22 22:27:27 +00:00
|
|
|
my $id = shift;
|
2006-04-29 17:11:23 +00:00
|
|
|
# GetId() returns "SandWiki" for the following URL:
|
|
|
|
|
# http://www.communitywiki.org/odd/SandWiki?action=new.
|
|
|
|
|
if ($UsePathInfo and $NamespaceCurrent
|
|
|
|
|
and $id eq $NamespaceCurrent
|
|
|
|
|
and GetParam($NamespaceCurrent, 0) == 0
|
|
|
|
|
and not GetParam('id', '')) {
|
|
|
|
|
# Undo this unless we're getting
|
|
|
|
|
# http://www.communitywiki.org/odd/SandWiki/SandWiki?action=new or
|
|
|
|
|
# http://www.communitywiki.org/odd/SandWiki?action=new;id=SandWiki.
|
|
|
|
|
$id = '';
|
|
|
|
|
}
|
2006-02-22 22:28:42 +00:00
|
|
|
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = gmtime($Now);
|
2015-03-27 03:01:01 +02:00
|
|
|
my $today = sprintf("%d-%02d-%02d", $year + 1900, $mon + 1, $mday);
|
2006-05-20 15:22:32 +00:00
|
|
|
$today .= sprintf("_%02dh%02d", $hour, $min) if GetParam('hour', 0);
|
2006-05-23 22:31:20 +00:00
|
|
|
$today .= "_$id" if $id;
|
2006-02-22 22:27:27 +00:00
|
|
|
return DoEdit($today);
|
2006-02-22 22:21:35 +00:00
|
|
|
}
|