2007-02-02 03:33:03 +01:00
|
|
|
#!/usr/bin/perl
|
|
|
|
package IkiWiki::Plugin::opendiscussion;
|
|
|
|
|
|
|
|
use warnings;
|
|
|
|
use strict;
|
2007-04-27 04:55:52 +02:00
|
|
|
use IkiWiki 2.00;
|
2007-02-02 03:33:03 +01:00
|
|
|
|
|
|
|
sub import { #{{{
|
2008-08-03 23:20:21 +02:00
|
|
|
hook(type => "getsetup", id => "opendiscussion", call => \&getsetup);
|
2007-02-02 03:33:03 +01:00
|
|
|
hook(type => "canedit", id => "opendiscussion", call => \&canedit);
|
|
|
|
} # }}}
|
|
|
|
|
2008-08-03 23:20:21 +02:00
|
|
|
sub getsetup () { #{{{
|
|
|
|
return
|
|
|
|
plugin => {
|
|
|
|
safe => 1,
|
|
|
|
rebuild => 0,
|
|
|
|
},
|
|
|
|
} #}}}
|
|
|
|
|
2007-02-02 03:33:03 +01:00
|
|
|
sub canedit ($$) { #{{{
|
|
|
|
my $page=shift;
|
|
|
|
my $cgi=shift;
|
|
|
|
my $session=shift;
|
|
|
|
|
|
|
|
my $discussion=gettext("discussion");
|
2008-01-07 22:10:32 +01:00
|
|
|
return "" if $page=~/(\/|^)\Q$discussion\E$/;
|
2007-02-02 03:33:03 +01:00
|
|
|
return undef;
|
|
|
|
} #}}}
|
|
|
|
|
|
|
|
1
|