]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - IkiWiki/Plugin/opendiscussion.pm
po: back to the cansave hook, as the form validation is not sufficient
[git.ikiwiki.info.git] / IkiWiki / Plugin / opendiscussion.pm
1 #!/usr/bin/perl
2 package IkiWiki::Plugin::opendiscussion;
4 use warnings;
5 use strict;
6 use IkiWiki 3.00;
8 sub import {
9         hook(type => "getsetup", id => "opendiscussion", call => \&getsetup);
10         hook(type => "canedit", id => "opendiscussion", call => \&canedit);
11 }
13 sub getsetup () {
14         return 
15                 plugin => {
16                         safe => 1,
17                         rebuild => 0,
18                 },
19 }
21 sub canedit ($$) {
22         my $page=shift;
23         my $cgi=shift;
24         my $session=shift;
26         my $discussion=gettext("discussion");
27         return "" if $page=~/(\/|^)\Q$discussion\E$/;
28         return undef;
29 }
31 1