noimageinline => 1,
linktext => "FormattingHelp"));
+ my $previewing=0;
if ($form->submitted eq "Cancel") {
if ($form->field("do") eq "create" && defined $from) {
redirect($q, urlto($from, undef, 1));
exit;
}
elsif ($form->submitted eq "Preview") {
+ $previewing=1;
+
my $new=not exists $pagesources{$page};
if ($new) {
# temporarily record its type
if (! @page_locs) {
# hmm, someone else made the page in the
# meantime?
- if ($form->submitted eq "Preview") {
+ if ($previewing) {
# let them go ahead with the edit
# and resolve the conflict at save
# time
}
showform($form, \@buttons, $session, $q,
- forcebaseurl => $baseurl, page => $page);
+ forcebaseurl => $baseurl,
+ ($previewing ? (page => $page) : ()),
+ );
}
else {
# save page
$form->field(name => "type", type => 'hidden');
$form->title(sprintf(gettext("editing %s"), $page));
showform($form, \@buttons, $session, $q,
- forcebaseurl => $baseurl, page => $page);
+ forcebaseurl => $baseurl);
exit;
}
elsif ($form->field("do") eq "create" && $exists) {
"\n\n\n".$form->field("editcontent"),
force => 1);
showform($form, \@buttons, $session, $q,
- forcebaseurl => $baseurl, page => $page);
+ forcebaseurl => $baseurl);
exit;
}
$form->field(name => "type", type => 'hidden');
$form->title(sprintf(gettext("editing %s"), $page));
showform($form, \@buttons, $session, $q,
- forcebaseurl => $baseurl, page => $page);
+ forcebaseurl => $baseurl);
exit;
}
$form->field(name => "type", type => 'hidden');
$form->title(sprintf(gettext("editing %s"), $page));
showform($form, \@buttons, $session, $q,
- forcebaseurl => $baseurl, page => $page);
+ forcebaseurl => $baseurl);
}
else {
# The trailing question mark tries to avoid broken