summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-06-09 16:59:17 -0400
committerJoey Hess <joey@kitenet.net>2010-06-09 16:59:17 -0400
commite93cee33786da51d80f375cbeb8fb24db24bf0c9 (patch)
tree5f1356baee0ea7399072b710eed1839b88eda8d2 /IkiWiki/Plugin
parent95b45864debe8070e8229cc7def21aef5447f541 (diff)
Fix display of sidebar when previewing page edit. (Thanks, privat)
On second thought, only display a page's personal sidebar when previewing it, not when editing normally.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/editpage.pm17
1 files changed, 11 insertions, 6 deletions
diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm
index aa73eb87d..af2c5ff4e 100644
--- a/IkiWiki/Plugin/editpage.pm
+++ b/IkiWiki/Plugin/editpage.pm
@@ -153,6 +153,7 @@ sub cgi_editpage ($$) {
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));
@@ -166,6 +167,8 @@ sub cgi_editpage ($$) {
exit;
}
elsif ($form->submitted eq "Preview") {
+ $previewing=1;
+
my $new=not exists $pagesources{$page};
if ($new) {
# temporarily record its type
@@ -255,7 +258,7 @@ sub cgi_editpage ($$) {
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
@@ -313,7 +316,9 @@ sub cgi_editpage ($$) {
}
showform($form, \@buttons, $session, $q,
- forcebaseurl => $baseurl, page => $page);
+ forcebaseurl => $baseurl,
+ ($previewing ? (page => $page) : ()),
+ );
}
else {
# save page
@@ -331,7 +336,7 @@ sub cgi_editpage ($$) {
$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) {
@@ -346,7 +351,7 @@ sub cgi_editpage ($$) {
"\n\n\n".$form->field("editcontent"),
force => 1);
showform($form, \@buttons, $session, $q,
- forcebaseurl => $baseurl, page => $page);
+ forcebaseurl => $baseurl);
exit;
}
@@ -387,7 +392,7 @@ sub cgi_editpage ($$) {
$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;
}
@@ -426,7 +431,7 @@ sub cgi_editpage ($$) {
$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