diff options
author | Joey Hess <joey@kitenet.net> | 2011-06-14 13:59:11 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-06-14 13:59:56 -0400 |
commit | d4d232740078d0cab15b4f78e797c0802b692e5c (patch) | |
tree | fb567adc667b607a86a1adc7363370db224a87c2 /IkiWiki/Plugin | |
parent | e2cb19ed9e107d89251655232649a6d2eb9c187b (diff) | |
download | ikiwiki-d4d232740078d0cab15b4f78e797c0802b692e5c.tar ikiwiki-d4d232740078d0cab15b4f78e797c0802b692e5c.tar.gz |
fixed saving attachments on page save
Also saved on preview, but previewing is a bit broken, does not see the
newly saved attachment yet.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r-- | IkiWiki/Plugin/attachment.pm | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm index 7f88010b5..06b0c6c51 100644 --- a/IkiWiki/Plugin/attachment.pm +++ b/IkiWiki/Plugin/attachment.pm @@ -118,7 +118,7 @@ sub formbuilder (@) { ($form->submitted eq "Upload Attachment" || $form->submitted eq "Save Page")) { attachment_store($filename, $form, $q, $params{session}); } - if ($form->submitted eq "Save Page") { + if ($form->submitted eq "Save Page" || $form->submitted eq "Preview") { attachments_save($form, $params{session}); } @@ -236,7 +236,7 @@ sub attachments_save { my $dest=$config{srcdir}."/". linkpage(IkiWiki::possibly_foolish_untaint( attachment_location($form->field('page')))). - $filename; + IkiWiki::basename($filename); unlink($dest); rename($filename, $dest); push @attachments, $dest; @@ -291,12 +291,13 @@ sub attachment_list ($) { # attachments in holding directory my $dir=attachment_holding_dir($page); + my $heldmsg=gettext("this attachment is not yet saved"); foreach my $file (glob("$dir/*")) { my $mtime=(stat($file))[9]; my $f=IkiWiki::basename($file); $attachments{$f}={ "field-select" => '<input type="checkbox" name="attachment_select" value="'.$f.'" />', - link => $f, # no link possible + link => "<span title=\"$heldmsg\">$f</span>", size => IkiWiki::Plugin::filecheck::humansize((stat($file))[7]), mtime => displaytime($mtime), mtime_raw => $mtime, |