summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki/CGI.pm1
-rw-r--r--IkiWiki/Plugin/rename.pm46
-rw-r--r--templates/renamesummary.tmpl6
3 files changed, 37 insertions, 16 deletions
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm
index 287b1f5aa..4cb45895b 100644
--- a/IkiWiki/CGI.pm
+++ b/IkiWiki/CGI.pm
@@ -365,7 +365,6 @@ sub cgi_editpage ($$) { #{{{
htmllink($page, $page, "ikiwiki/formatting",
noimageinline => 1,
linktext => "FormattingHelp"));
- $form->tmpl_param("message", "");
if ($form->submitted eq "Cancel") {
if ($form->field("do") eq "create" && defined $from) {
diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm
index 9fa3f6a85..fdd9dc71c 100644
--- a/IkiWiki/Plugin/rename.pm
+++ b/IkiWiki/Plugin/rename.pm
@@ -74,18 +74,6 @@ sub check_canrename ($$$$$$$) { #{{{
}
} #}}}
-sub formbuilder_setup (@) { #{{{
- my %params=@_;
- my $form=$params{form};
- my $q=$params{cgi};
-
- if (defined $form->field("do") && $form->field("do") eq "edit") {
- # Rename button for the page, and also for attachments.
- push @{$params{buttons}}, "Rename";
- $form->tmpl_param("field-rename" => '<input name="_submit" type="submit" value="Rename Attachment" />');
- }
-} #}}}
-
sub rename_form ($$$) { #{{{
my $q=shift;
my $session=shift;
@@ -141,8 +129,10 @@ sub rename_start ($$$$) {
exit 0;
}
-sub postrename ($;$$) {
+my $renamesummary;
+sub postrename ($;$$$) {
my $session=shift;
+ my $src=shift;
my $dest=shift;
my $attachment=shift;
@@ -151,6 +141,15 @@ sub postrename ($;$$) {
$session->clear("postrename");
IkiWiki::cgi_savesession($session);
+ if (defined $src) {
+ # Generate a rename summary, that will be shown at the top
+ # of the edit template.
+ my $template=template("renamesummary.tmpl");
+ $template->param(src => $src);
+ $template->param(dest => $dest);
+ $renamesummary=$template->output;
+ }
+
if (defined $dest && ! $attachment) {
# They renamed the page they were editing. This requires
# fixups to the edit form state.
@@ -164,6 +163,22 @@ sub postrename ($;$$) {
IkiWiki::cgi_editpage($postrename, $session);
}
+sub formbuilder_setup (@) { #{{{
+ my %params=@_;
+ my $form=$params{form};
+ my $q=$params{cgi};
+
+ if (defined $form->field("do") && $form->field("do") eq "edit") {
+ # Rename button for the page, and also for attachments.
+ push @{$params{buttons}}, "Rename";
+ $form->tmpl_param("field-rename" => '<input name="_submit" type="submit" value="Rename Attachment" />');
+
+ if (defined $renamesummary) {
+ $form->tmpl_param(message => $renamesummary);
+ }
+ }
+} #}}}
+
sub formbuilder (@) { #{{{
my %params=@_;
my $form=$params{form};
@@ -226,7 +241,8 @@ sub sessioncgi ($$) { #{{{
if ($config{rcs}) {
IkiWiki::disable_commit_hook();
IkiWiki::rcs_rename($srcfile, $destfile);
- IkiWiki::rcs_commit_staged(sprintf(gettext("rename %s to %s", $src, $dest)),
+ IkiWiki::rcs_commit_staged(
+ sprintf(gettext("rename %s to %s"), $src, $dest),
$session->param("name"), $ENV{REMOTE_ADDR});
IkiWiki::enable_commit_hook();
IkiWiki::rcs_update();
@@ -239,7 +255,7 @@ sub sessioncgi ($$) { #{{{
IkiWiki::refresh();
IkiWiki::saveindex();
- postrename($session, $dest, $q->param("attachment"));
+ postrename($session, $src, $dest, $q->param("attachment"));
}
else {
IkiWiki::showform($form, $buttons, $session, $q);
diff --git a/templates/renamesummary.tmpl b/templates/renamesummary.tmpl
new file mode 100644
index 000000000..1d5e159d8
--- /dev/null
+++ b/templates/renamesummary.tmpl
@@ -0,0 +1,6 @@
+<p>
+<b>Successfully renamed <TMPL_VAR SRC> to <TMPL_VAR DEST>.</b>
+</p>
+<p>
+Summary of links: TODO
+</p>