buttons => $buttons);
});
}
- else {
- printheader($session);
- print misctemplate($form->title, $form->render(submit => $buttons));
- }
+
+ printheader($session);
+ print misctemplate($form->title, $form->render(submit => $buttons));
}
sub redirect ($$) { #{{{
$form->field(name => "email", size => 50, fieldset => "preferences");
$form->field(name => "subscriptions", size => 50,
fieldset => "preferences",
- comment => "(".htmllink("", "", "PageSpec", noimageinline => 1).")");
+ comment => "(".htmllink("", "", "ikiwiki/PageSpec", noimageinline => 1).")");
$form->field(name => "banned_users", size => 50,
fieldset => "admin");
fields => \@fields,
charset => "utf-8",
method => 'POST',
- validate => {
- editcontent => '/.+/',
- },
required => [qw{editcontent}],
javascript => 0,
params => $q,
# characters.
my ($page)=$form->field('page');
$page=titlepage(possibly_foolish_untaint($page));
- if (! defined $page || ! length $page || file_pruned($page, $config{srcdir}) || $page=~/^\//) {
+ if (! defined $page || ! length $page ||
+ file_pruned($page, $config{srcdir}) || $page=~/^\//) {
error("bad page name");
}
$form->field(name => "rcsinfo",
value => rcs_prepedit($file), force => 1);
}
+ $form->field(name => "editcontent", validate => '/.*/');
}
else {
$type=$form->param('type');
if (! $form->submitted) {
$form->field(name => "rcsinfo", value => "", force => 1);
}
+ $form->field(name => "editcontent", validate => '/.+/');
}
$form->field(name => "do", type => 'hidden');
$form->tmpl_param("can_commit", $config{rcs});
$form->tmpl_param("indexlink", indexlink());
$form->tmpl_param("helponformattinglink",
- htmllink("", "", "HelpOnFormatting", noimageinline => 1));
+ htmllink("", "", "ikiwiki/formatting",
+ noimageinline => 1,
+ linktext => "FormattingHelp"));
$form->tmpl_param("baseurl", baseurl());
if ($form->submitted eq "Cancel") {
}
showform($form, \@buttons, $session, $q);
+ saveindex();
}
else {
# save page
my $exists=-e "$config{srcdir}/$file";
- if ($form->field("do") ne "create" &&
- ! $exists && ! -e "$config{underlaydir}/$file") {
+ if ($form->field("do") ne "create" && ! $exists &&
+ ! eval { srcfile($file) }) {
$form->tmpl_param("page_gone", 1);
$form->field(name => "do", value => "create", force => 1);
$form->tmpl_param("page_select", 0);
});
$content=~s/\r\n/\n/g;
$content=~s/\r/\n/g;
+ $content.="\n" if $content !~ /\n$/;
$config{cgi}=0; # avoid cgi error message
eval { writefile($file, $config{srcdir}, $content) };
# may have been committed while the post-commit hook was
# disabled.
require IkiWiki::Render;
+ # Reload index, since the first time it's loaded is before
+ # the wiki is locked, and things may have changed in the
+ # meantime.
+ loadindex();
refresh();
saveindex();