sympa.conf.podpl 6.79 KB
Newer Older
1
2
3
4
# $Id$

use strict;
use warnings;
5
use English qw(-no_match_vars);
6
7
8

use Sympa::ConfDef;
use Sympa::Constants;
IKEDA Soji's avatar
IKEDA Soji committed
9
10
11
12
13
14
use Sympa::ListDef;

my %overrides;
while (my ($pname, $pitem) = each %Sympa::ListDef::pinfo) {
    %overrides = (%overrides, _get_overrides($pname, $pitem, [$pname]));
}
15

16
17
18
my $parameters = '';

foreach my $param (@Sympa::ConfDef::params) {
19
20
    if (exists $param->{name}) {
        my $name = $param->{name};
21
        my $default =
22
23
24
25
26
27
28
29
30
              (exists $param->{default_s}) ? $param->{default_s}
            : (exists $param->{default})   ? $param->{default}
            :                                undef;
        my $query = $param->{gettext_id}
            if exists $param->{gettext_id};
        my $advice = $param->{gettext_comment}
            if exists $param->{gettext_comment};
        my $example = $param->{sample}
            if exists $param->{sample};
31
        my $optional = 1
32
            if exists $param->{optional} and $param->{optional};
33
        my $vhost = 1
34
            if exists $param->{vhost} and $param->{vhost};
35
        my $multiple = 1
36
            if exists $param->{multiple} and $param->{multiple};
37
        my $scenario = $name
38
            if exists $param->{scenario} and $param->{scenario};
39

IKEDA Soji's avatar
IKEDA Soji committed
40
41
42
43
44
45
46
47
48
49
50
51
52
53
        if ($name eq 'color_0') {
            $parameters .= "=head4 C<color_0>, ..., C<color_15>\n\n";
        } elsif ($name =~ /\Acolor_/) {
            next;
        } elsif ($name eq 'dark_color') {
            $parameters .=
                "=head4 C<dark_color>, C<light_color>, C<text_color>, C<bg_color>, C<error_color>, C<selected_color>, C<shaded_color>\n\n";
        } elsif ($name =~ /_color\z/) {
            next;
        } elsif ($name eq 'main_menu_custom_button_1_title') {
            $parameters .=
                "=head4 C<main_menu_custom_button_1_title>, ... C<main_menu_custom_button_3_title>, C<main_menu_custom_button_1_url>, ... C<main_menu_custom_button_3_url>, C<main_menu_custom_button_1_target>, ... C<main_menu_custom_button_3_target>\n\n";
        } elsif ($name =~ /\Amain_menu_custom_button_/) {
            next;
54
        } else {
55
            $parameters .= sprintf "=head4 C<%s>\n\n", $param->{name};
56
        }
IKEDA Soji's avatar
IKEDA Soji committed
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
        $parameters .= sprintf "%s\n\n", _escape_pod($query)
            if defined $query;

        $parameters .= "=over\n\n";

        $parameters .= "=item Default:\n\n";
        if ($name =~ /\Acolor_/ or $name =~ /_color\z/) {
            $parameters .= "See description on web interface.\n\n";
        } elsif (defined $default) {
            if (exists $param->{gettext_unit}) {
                $parameters .= sprintf "C<%s> (%s)\n\n",
                    _escape_pod($default), $param->{gettext_unit};
            } else {
                $parameters .= sprintf "C<%s>\n\n", _escape_pod($default);
            }
        } elsif ($optional) {
            if (exists $param->{gettext_unit}) {
                $parameters .= sprintf "None (%s).\n\n",
                    $param->{gettext_unit};
            } else {
                $parameters .= "None.\n\n";
            }
79
        } else {
IKEDA Soji's avatar
IKEDA Soji committed
80
81
82
83
84
85
86
87
88
89
90
91
            $parameters .= "None, I<mandatory>.\n\n";
        }

        $parameters .= "=item Overrides:\n\n";
        $parameters .= "Virtual domain\n\n"
            if defined $vhost;
        if ($overrides{$name}) {
            if ($overrides{$name} eq $name) {
                $parameters .= "List\n\n";
            } else {
                $parameters .= sprintf "List (C<%s>)\n\n", $overrides{$name};
            }
92
        }
IKEDA Soji's avatar
IKEDA Soji committed
93
94
95
96
97
        $parameters .= "None.\n\n"
            unless defined $vhost or $overrides{$name};

        $parameters .= "=back\n\n";

98
99
100
101
        $parameters .=
            sprintf "Value of this parameter is name of C<%s> scenario.\n\n",
            $name
            if defined $scenario;
IKEDA Soji's avatar
IKEDA Soji committed
102
103
        $parameters .= sprintf "%s\n\n",
            join("\n\n", split "\n", _escape_pod($advice))
104
            if defined $advice;
IKEDA Soji's avatar
IKEDA Soji committed
105
106
107
108
109
110
111
112
113
114
        if ($name eq 'main_menu_custom_button_1_title') {
            $parameters .= "Example:\n\n";
            $parameters .= "  main_menu_custom_button_1_title FAQ\n";
            $parameters .=
                "  main_menu_custom_button_1_url http://www.renater.fr/faq/universalistes/index\n";
            $parameters .= "  main_menu_custom_button_1_target Help\n\n";
        } else {
            $parameters .= sprintf "Example:\n\n  %s %s\n\n", $name, $example
                if defined $example;
        }
115
    } else {
IKEDA Soji's avatar
IKEDA Soji committed
116
        $parameters .= sprintf "=head2 %s\n\n",
117
118
119
120
            _escape_pod($param->{gettext_id});
        $parameters .= sprintf "%s\n\n",
            join("\n\n", split "\n", _escape_pod($param->{gettext_comment}))
            if exists $param->{gettext_comment};
121
122
123
    }
}

124
125
printf do { local $RS; <DATA> }, Sympa::Constants::CONFIG(), $parameters,
    Sympa::Constants::CONFIG();
126
127
128

exit 0;

IKEDA Soji's avatar
IKEDA Soji committed
129
130
131
132
133
sub _get_overrides {
    my $pname  = shift;
    my $pitem  = shift;
    my $pnames = shift;

134
135
    return () if $pitem->{obsolete};

IKEDA Soji's avatar
IKEDA Soji committed
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
    my %ov;
    if (exists $pitem->{format} and ref $pitem->{format} eq 'HASH') {
        %ov = map {
            _get_overrides($_, $pitem->{format}->{$_}, [@$pnames, $_]);
        } keys %{$pitem->{format}};
    } elsif (exists $pitem->{default}
        and ref $pitem->{default} eq 'HASH'
        and exists $pitem->{default}->{conf}) {
        %ov = ($pitem->{default}->{conf} => join('.', @$pnames));
    } else {
        %ov = ();
    }

    return %ov;
}

152
153
154
155
156
157
158
sub _escape_pod {
    my $string = shift;
    $string =~ s/([&<>])/
        'E<' . {'&' => 'amp', '<' => 'lt', '>' => 'gt'}->{$1} . '>'
    /eg;
    return $string;
}
159

160
__END__
161
162
163
164
165
166
167
168
169
170

=encoding utf-8

=head1 NAME

sympa.conf, robot.conf - Configuration file for default site and robot

=head1 DESCRIPTION

F<%s> is main configuration file of Sympa.
IKEDA Soji's avatar
IKEDA Soji committed
171
172
173
Several parameters defined in this file may be overridden by F<robot.conf>
configuration file for each virtual domain, or by F<config> configuration file
for each mailing list.
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189

Format of F<sympa.conf> and F<robot.conf> is as following:

=over

=item *

Lines beginning with C<#> and containing only spaces are ignored.

=item *

Each line has the form "I<parameter> I<value>".
I<value> may contain spaces but may not contain newlines.

=back

IKEDA Soji's avatar
IKEDA Soji committed
190
=head1 PARAMETERS
191

IKEDA Soji's avatar
IKEDA Soji committed
192
193
194
195
196
Below is entire list of configuration parameters.
"Default" is built-in default value if any.
"Overrides" lists contexts (with parameter name) which can override
settings in site-wide context (F<sympa.conf>): Virtual domain (F<robot.conf>)
and/or List (F<config>).
197

198
%s
199
200
201
202
203

=head1 FILES

=over

204
=item F<%s>
205
206
207

Sympa main configuration file.

208
=item F<$SYSCONFDIR/E<lt>robot nameE<gt>/robot.conf>
209

IKEDA Soji's avatar
IKEDA Soji committed
210
211
212
213
214
215
Configuration specific to each virtual domain.

=item F<$EXPLDIR/E<lt>list nameE<gt>/config>
or F<$EXPLDIR/E<lt>robot nameE<gt>/E<lt>list nameE<gt>/config>

Configuration specific to each list.
216
217
218
219
220
221
222
223
224

=back

=head1 SEE ALSO

I<Sympa, Mailing List Management Software - Reference Manual>.
L<http://www.sympa.org/manual/>.

=cut