summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-07-22 18:17:11 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-07-22 18:17:11 -0400
commit421559b230a764f25db95b9b7fd7ce968d3d8471 (patch)
treecc45f28407c970bbc3ee59204953c6d72c74f4a1
parente5ea40bf20c488f21506bd0330780207f6378afb (diff)
edit page fixup in postrename
-rw-r--r--IkiWiki/Plugin/rename.pm34
1 files changed, 17 insertions, 17 deletions
diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm
index 126c7ba13..e19a11cc4 100644
--- a/IkiWiki/Plugin/rename.pm
+++ b/IkiWiki/Plugin/rename.pm
@@ -141,22 +141,27 @@ sub rename_start ($$$$) {
exit 0;
}
-sub postrename ($;$) {
+sub postrename ($;$$) {
my $session=shift;
- my $newname=shift;
+ my $dest=shift;
+ my $attachment=shift;
- # Load saved form state and return to edit form.
+ # Load saved form state and return to edit page.
my $postrename=CGI->new($session->param("postrename"));
- if (defined $newname) {
- # They renamed the page they were editing.
- # Tweak the edit form to be editing the new
- # page name, and redirect back to it.
- # (Deep evil here.)
- error("don't know how to redir back!"); ## FIXME
- }
$session->clear("postrename");
IkiWiki::cgi_savesession($session);
- IkiWiki::cgi($postrename, $session);
+
+ if (defined $dest && ! $attachment) {
+ # They renamed the page they were editing. This requires
+ # fixups to the edit form state.
+ # Tweak the edit form to be editing the new page.
+ $postrename->param("page", $dest);
+ # Get a new edit token; old one might not be valid for the
+ # renamed file.
+ $postrename->param("rcsinfo", IkiWiki::rcs_prepedit($pagesources{$dest}));
+ }
+
+ IkiWiki::cgi_editpage($postrename, $session);
}
sub formbuilder (@) { #{{{
@@ -234,12 +239,7 @@ sub sessioncgi ($$) { #{{{
IkiWiki::refresh();
IkiWiki::saveindex();
- if ($q->param("attachment")) {
- postrename($session);
- }
- else {
- postrename($session, $dest);
- }
+ postrename($session, $dest, $q->param("attachment"));
}
else {
IkiWiki::showform($form, $buttons, $session, $q);