~kosova/+junk/tuxfamily-twiki

« back to all changes in this revision

Viewing changes to foswiki/lib/Foswiki/Configure/UIs/TAGS.pm

  • Committer: James Michael DuPont
  • Date: 2009-07-18 19:58:49 UTC
  • Revision ID: jamesmikedupont@gmail.com-20090718195849-vgbmaht2ys791uo2
added foswiki

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# See bottom of file for license and copyright information
 
2
 
 
3
package Foswiki::Configure::UIs::TAGS;
 
4
 
 
5
use strict;
 
6
 
 
7
use base 'Foswiki::Configure::UI';
 
8
 
 
9
use Foswiki::Configure::Type;
 
10
use Foswiki::Configure::Value;
 
11
 
 
12
sub ui {
 
13
    my %modules;
 
14
    my $scanner = Foswiki::Configure::Type::load('SELECTCLASS');
 
15
    my $classes = $scanner->findClasses('Foswiki::Tags::*');
 
16
    foreach my $module (@$classes) {
 
17
        $module =~ s/^.*::([^:]*)/$1/;
 
18
        $Foswiki::cfg{Tags}{$module}{Enabled} ||= 0;
 
19
 
 
20
        # only add the first instance of any tag, as only
 
21
        # the first can get loaded from @INC.
 
22
        unless ( $modules{$module} ) {
 
23
            $modules{$module} = 1;
 
24
        }
 
25
    }
 
26
    my $block = '';
 
27
    foreach my $m ( sort keys %modules ) {
 
28
        my $value = new Foswiki::Configure::Value(
 
29
            'BOOLEAN', '',
 
30
 
 
31
            # SMELL - i'm assuming that the Tag topic is in the SystemWeb :(
 
32
            # Which of course it isn't.
 
33
"<a rel=\"nofollow\" href=\"$Foswiki::cfg{ScriptUrlPath}/view$Foswiki::cfg{ScriptSuffix}/$Foswiki::cfg{SystemWebName}/$m\">$m</a>",
 
34
            '{Tags}{' . $m . '}{Enabled}'
 
35
        );
 
36
        $block .= $value->buildInputFields();
 
37
    }
 
38
 
 
39
    return $block;
 
40
}
 
41
 
 
42
1;
 
43
__DATA__
 
44
#
 
45
# Foswiki - The Free and Open Source Wiki, http://foswiki.org/
 
46
#
 
47
# Copyright (C) 2008 Foswiki Contributors. All Rights Reserved.
 
48
# Foswiki Contributors are listed in the AUTHORS file in the root
 
49
# of this distribution. NOTE: Please extend that file, not this notice.
 
50
#
 
51
# Additional copyrights apply to some or all of the code in this
 
52
# file as follows:
 
53
#
 
54
# Copyright (C) 2000-2006 TWiki Contributors. All Rights Reserved.
 
55
# TWiki Contributors are listed in the AUTHORS file in the root
 
56
# of this distribution. NOTE: Please extend that file, not this notice.
 
57
#
 
58
# This program is free software; you can redistribute it and/or
 
59
# modify it under the terms of the GNU General Public License
 
60
# as published by the Free Software Foundation; either version 2
 
61
# of the License, or (at your option) any later version. For
 
62
# more details read LICENSE in the root of this distribution.
 
63
#
 
64
# This program is distributed in the hope that it will be useful,
 
65
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
66
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
67
#
 
68
# As per the GPL, removal of this notice is prohibited.