]> sipb.mit.edu Git - ikiwiki.git/commitdiff
Merge branch 'master' into autoconfig
authorJoey Hess <joey@kodama.kitenet.net>
Fri, 25 Jul 2008 23:27:15 +0000 (19:27 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Fri, 25 Jul 2008 23:27:15 +0000 (19:27 -0400)
1  2 
IkiWiki/Plugin/attachment.pm

index 8fa330e6d2d07c54b0766b6ba5062b24bef28b68,720078be15cfcd51399f375815b4d22e1a2e8d7b..3fe33c858ae849f7314a2e33ab9a40d946f259f6
@@@ -6,24 -6,11 +6,24 @@@ use strict
  use IkiWiki 2.00;
  
  sub import { #{{{
 +      hook(type => "getsetup", id => "attachment", call => \&getsetup);
        hook(type => "checkconfig", id => "attachment", call => \&checkconfig);
        hook(type => "formbuilder_setup", id => "attachment", call => \&formbuilder_setup);
        hook(type => "formbuilder", id => "attachment", call => \&formbuilder);
  } # }}}
  
 +sub getsetup () { #{{{
 +      return
 +               => {
 +                      type => "string",
 +                      default => "",
 +                      example => "clamdscan -",
 +                      description => "virus checker program (reads STDIN, returns nonzero if virus found)",
 +                      safe => 0, # executed
 +                      rebuild => 0,
 +              },
 +} #}}}
 +
  sub check_canattach ($$;$) { #{{{
        my $session=shift;
        my $dest=shift; # where it's going to be put, under the srcdir
@@@ -206,8 -193,10 +206,10 @@@ sub formbuilder (@) { #{{
                IkiWiki::saveindex();
        }
        elsif ($form->submitted eq "Insert Links") {
+               my $page=quotemeta($q->param("page"));
                my $add="";
                foreach my $f ($q->param("attachment_select")) {
+                       $f=~s/^$page\///;
                        $add.="[[$f]]\n";
                }
                $form->field(name => 'editcontent',