A suggestion to simply extract/merge this functionality from/with another plugin.
[ikiwiki] / IkiWiki / Plugin / opendiscussion.pm
1 #!/usr/bin/perl
2 package IkiWiki::Plugin::opendiscussion;
3
4 use warnings;
5 use strict;
6 use IkiWiki 3.00;
7
8 sub import {
9         hook(type => "getsetup", id => "opendiscussion", call => \&getsetup);
10         hook(type => "canedit", id => "opendiscussion", call => \&canedit);
11 }
12
13 sub getsetup () {
14         return 
15                 plugin => {
16                         safe => 1,
17                         rebuild => 0,
18                 },
19 }
20
21 sub canedit ($$) {
22         my $page=shift;
23         my $cgi=shift;
24         my $session=shift;
25
26         my $discussion=lc(gettext("Discussion"));
27         return "" if $page=~/(\/|^)\Q$discussion\E$/;
28         return undef;
29 }
30
31 1