summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-07-01 18:08:31 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-07-01 18:08:31 -0400
commit8441d3153506bc704d97def187c7a77c10fa7e3f (patch)
tree5b0316e0fd846e97a7789dc1cb1b4cd5d1134e78 /IkiWiki
parent0ffcafc1305de5ec242f3f0835064682d408c3d0 (diff)
add both kinds of links
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/attachment.pm17
1 files changed, 13 insertions, 4 deletions
diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm
index 1d392589e..690b61cbc 100644
--- a/IkiWiki/Plugin/attachment.pm
+++ b/IkiWiki/Plugin/attachment.pm
@@ -27,17 +27,17 @@ sub attachment_location ($) {
}
sub attachment_list ($) {
- my $loc=attachment_location(shift);
+ my $page=shift;
+ my $loc=attachment_location($page);
my @ret;
foreach my $f (values %pagesources) {
- print STDERR ">>$f\n" if ! defined IkiWiki::pagetype($f);
if (! defined IkiWiki::pagetype($f) &&
$f=~m/^\Q$loc\E[^\/]+$/ &&
-e "$config{srcdir}/$f") {
push @ret, {
"field-select" => '<input type="checkbox" name="attachment_select" value="'.$f.'">',
- link => $f,
+ link => htmllink($page, $page, $f, noimageinline => 1),
size => (stat(_))[7],
mtime => displaytime($IkiWiki::pagemtime{$f}),
};
@@ -87,11 +87,11 @@ sub formbuilder_setup (@) { #{{{
sub formbuilder (@) { #{{{
my %params=@_;
my $form=$params{form};
+ my $q=$params{cgi};
return if $form->field("do") ne "edit";
if ($form->submitted eq "Upload" || $form->submitted eq "Save Page") {
- my $q=$params{cgi};
my $session=$params{session};
my $filename=$q->param('attachment');
@@ -163,6 +163,15 @@ sub formbuilder (@) { #{{{
IkiWiki::refresh();
IkiWiki::saveindex();
}
+ elsif ($form->submitted eq "Insert Links") {
+ my $add="";
+ foreach my $f ($q->param("attachment_select")) {
+ $add.="[[$f]]\n";
+ }
+ $form->field(name => 'editcontent',
+ value => $form->field('editcontent')."\n\n".$add,
+ force => 1);
+ }
} # }}}
package IkiWiki::PageSpec;