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
* -> Problem: the sidebar now shows the foo link (it is the root sidebar!)
* -> Was expecte : the sidebar displays "world"
-> One could argue that the behavior here is right, or wrong.
-> Is a page edit page really the same as the page being edited?
-> The next case is more clear.. --[[Joey]]
+> I think it's a misconception to think that the page editing page is the same
+> as the page it's editing. If you were deleting that page, would you expect
+> the "are you sure" confirmation page to display the page's sidebar?
+> --[[Joey]]
### A last example
* -> Problem: the sidebar still displays the foo link
* -> Was expected: the sidebar display "goodby"
-> I think this is worth fixing. --[[Joey]]
+> In the specific case of previewing, it is indeed a bug that the
+> right sidebar is not displayed. And replacing the regular sidebar
+> with the one from the previewed page is probably the best we can do..
+> displaying 2 sidebars would be confusing, and the `page.tmpl` can
+> put the sidebar anywhere so we can't just display the preview sidebar
+> next to the rest of the page preview. --[[Joey]]
## Some superficial hacking
this bug but it may help developers to find and solve the real problem.
> Oh, it's pretty reasonable. I don't think it breaks anything. :)
+> I modified it a bit, and explicitly made it *not* "fix" the second example.
> [[done]]
> --[[Joey]]