$state='body';
}
elsif ($state eq 'body' && /$div/) {
+ my $committype="web";
if (defined $message[0] &&
- $message[0]->{line}=~/^web commit by (\w+)(.*)/) {
- $user="$1 (web)";
+ $message[0]->{line}=~/^web commit by (\w+):?(.*)/) {
+ $user="$1";
$message[0]->{line}=$2;
}
+ else {
+ $committype="svn";
+ }
- push @ret, { rev => $rev, user => $user,
+ push @ret, { rev => $rev,
+ user => htmllink("", $user, 1),
+ committype => $committype,
when => $when, message => [@message],
pages => [@pages] } if @pages;
return @ret if @ret >= $num;
print $q->header, $template->output;
} #}}}
-sub userinfo_get ($$) { #{{
+sub userinfo_get ($$) { #{{{
my $user=shift;
my $field=shift;
return "";
}
return $userdata->{$user}->{$field};
-} #}}
+} #}}}
-sub userinfo_set ($$) { #{{
+sub userinfo_set ($$) { #{{{
my $user=shift;
my $info=shift;
my $ret=Storable::lock_store($userdata, "$srcdir/.ikiwiki/userdb");
umask($oldmask);
return $ret;
-} #}}
+} #}}}
sub cgi_signin ($$) { #{{{
my $q=shift;
fields => [qw(do from page content comments)],
header => 1,
method => 'POST',
- validate => {},
- required => [qw{}],
+ validate => {
+ content => '/.+/',
+ },
+ required => [qw{content}],
javascript => 0,
params => $q,
action => $q->request_uri,
$form->field(name => "content", type => "textarea", rows => 20,
cols => 80);
+ if ($form->submitted eq "Cancel") {
+ print $q->redirect("$url/".htmlpage($page));
+ return;
+ }
if (! $form->submitted || ! $form->validate) {
if ($form->field("do") eq "create") {
if (exists $pagesources{lc($page)}) {
$form->tmpl_param("can_commit", $svn);
$form->tmpl_param("indexlink", indexlink());
- print $form->render(submit => ["Save Page"]);
+ print $form->render(submit => ["Save Page", "Cancel"]);
}
else {
# save page
refresh();
}
- print $q->redirect("$url/".htmlpage($page));
+ # The trailing question mark tries to avoid broken
+ # caches and get the most recent version of the page.
+ print $q->redirect("$url/".htmlpage($page)."?");
}
} #}}}