summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-07-22 20:17:03 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-07-22 20:17:03 -0400
commit1c9a3cb82b5810214d9c1b9bad2462cd7e784ff6 (patch)
tree88adeca054f6eefcab74da3aba7d7b31c203c086 /IkiWiki/Plugin
parentd76c10cba24c2bea026facb2a9e5e3215d7f3994 (diff)
add a rename summary
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/rename.pm46
1 files changed, 31 insertions, 15 deletions
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);