summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2011-01-05 13:49:04 -0400
committerJoey Hess <joey@kitenet.net>2011-01-05 13:50:42 -0400
commit8c9c3915ecaf9cce4d0335f2b3c588d7f96d2b36 (patch)
treec237bd8dd6f067158f7bc3f3f5fad8d2f33fb270 /IkiWiki/Plugin
parenta554a3d538133479b7f93f16374eb0b8923ca6ba (diff)
Fix base url when previewing. Was broken by urlto changes in last release.
Added a showform_preview that is like showform, but sets forcebaseurl to point to the page being previewed.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/comments.pm8
-rw-r--r--IkiWiki/Plugin/editpage.pm19
2 files changed, 12 insertions, 15 deletions
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm
index 63e9ab499..f3d6f20d6 100644
--- a/IkiWiki/Plugin/comments.pm
+++ b/IkiWiki/Plugin/comments.pm
@@ -372,8 +372,6 @@ sub editcomment ($$) {
error(gettext("bad page name"));
}
- my $baseurl = urlto($page);
-
$form->title(sprintf(gettext("commenting on %s"),
IkiWiki::pagetitle(IkiWiki::basename($page))));
@@ -385,7 +383,7 @@ sub editcomment ($$) {
if ($form->submitted eq CANCEL) {
# bounce back to the page they wanted to comment on, and exit.
- IkiWiki::redirect($cgi, $baseurl);
+ IkiWiki::redirect($cgi, urlto($page));
exit;
}
@@ -556,8 +554,8 @@ sub editcomment ($$) {
}
else {
- IkiWiki::showform ($form, \@buttons, $session, $cgi,
- forcebaseurl => $baseurl, page => $page);
+ IkiWiki::showform_preview($form, \@buttons, $session, $cgi,
+ page => $page);
}
exit;
diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm
index 537b86ad1..f6cebd4cd 100644
--- a/IkiWiki/Plugin/editpage.pm
+++ b/IkiWiki/Plugin/editpage.pm
@@ -312,8 +312,7 @@ sub cgi_editpage ($$) {
$form->title(sprintf(gettext("editing %s"), pagetitle(basename($page))));
}
- showform($form, \@buttons, $session, $q,
- forcebaseurl => $baseurl, page => $page);
+ showform_preview($form, \@buttons, $session, $q, page => $page);
}
else {
# save page
@@ -330,8 +329,8 @@ sub cgi_editpage ($$) {
$form->field(name => "page", type => 'hidden');
$form->field(name => "type", type => 'hidden');
$form->title(sprintf(gettext("editing %s"), $page));
- showform($form, \@buttons, $session, $q,
- forcebaseurl => $baseurl, page => $page);
+ showform_preview($form, \@buttons, $session, $q,
+ page => $page);
exit;
}
elsif ($form->field("do") eq "create" && $exists) {
@@ -345,8 +344,8 @@ sub cgi_editpage ($$) {
value => readfile("$config{srcdir}/$file").
"\n\n\n".$form->field("editcontent"),
force => 1);
- showform($form, \@buttons, $session, $q,
- forcebaseurl => $baseurl, page => $page);
+ showform_preview($form, \@buttons, $session, $q,
+ page => $page);
exit;
}
@@ -386,8 +385,8 @@ sub cgi_editpage ($$) {
$form->field(name => "page", type => 'hidden');
$form->field(name => "type", type => 'hidden');
$form->title(sprintf(gettext("editing %s"), $page));
- showform($form, \@buttons, $session, $q,
- forcebaseurl => $baseurl, page => $page);
+ showform_preview($form, \@buttons, $session, $q,
+ page => $page);
exit;
}
@@ -428,8 +427,8 @@ sub cgi_editpage ($$) {
$form->field(name => "page", type => 'hidden');
$form->field(name => "type", type => 'hidden');
$form->title(sprintf(gettext("editing %s"), $page));
- showform($form, \@buttons, $session, $q,
- forcebaseurl => $baseurl, page => $page);
+ showform_preview($form, \@buttons, $session, $q,
+ page => $page);
}
else {
# The trailing question mark tries to avoid broken