2 <%= header('Edit Configuration', menubar( 'Main Menu' => $p ) ) %>
4 var gSafeOnload = new Array();
5 window.onload = SafeOnload;
6 function SafeAddOnLoad(f) {
7 gSafeOnload[gSafeOnload.length] = f;
11 for (var i=0;i<gSafeOnload.length;i++)
16 <% my $conf = new FS::Conf; my @config_items = $conf->config_items; %>
18 <form name="OneTrueForm" action="config-process.cgi" METHOD="POST">
20 <% foreach my $section ( qw(required billing username password UI session
21 shell mail radius apache BIND
23 '', 'deprecated') { %>
25 <% foreach my $nav_section ( qw(required billing username password UI session
26 shell mail radius apache BIND
28 '', 'deprecated') { %>
29 <% if ( $section eq $nav_section ) { %>
30 [<A NAME="not<%= $nav_section || 'unclassified' %>" style="background-color: #cccccc"><%= ucfirst($nav_section || 'unclassified') %></A>]
32 [<A HREF="#<%= $nav_section %>"><%= ucfirst($nav_section || 'unclassified') %></A>]
36 <A NAME="<%= $section || 'unclassified' %>"></A>
37 <%= table("#cccccc", 2) %>
39 <th colspan="2" bgcolor="#dcdcdc">
40 <%= ucfirst($section || 'unclassified') %> configuration options
43 <% foreach my $i (grep $_->section eq $section, @config_items) { %>
47 foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) {
48 #warn $i->key unless defined($type);
50 <% if ( $type eq '' ) { %>
51 <font color="#ff0000">no type</font>
52 <% } elsif ( $type eq 'textarea' ) { %>
53 <textarea name="<%= $i->key. $n %>" rows=5><%= join("\n", $conf->config($i->key) ) %></textarea>
54 <% } elsif ( $type eq 'checkbox' ) { %>
55 <input name="<%= $i->key. $n %>" type="checkbox" value="1"<%= $conf->exists($i->key) ? ' CHECKED' : '' %>>
56 <% } elsif ( $type eq 'text' ) { %>
57 <input name="<%= $i->key. $n %>" type="<%= $type %>" value="<%= $conf->exists($i->key) ? $conf->config($i->key) : '' %>">
58 <% } elsif ( $type eq 'select' ) { %>
59 <select name="<%= $i->key. $n %>">
61 foreach my $value ( "", @{$i->select_enum} ) {
62 local($^W)=0; next if $saw{$value}++; %>
63 <option value="<%= $value %>"<%= $value eq $conf->config($i->key) ? ' SELECTED' : '' %>><%= $value %>
65 <% if ( $conf->exists($i->key) && $conf->config($i->key) && ! grep { $conf->config($i->key) eq $_ } @{$i->select_enum}) { %>
66 <option value=<%= $conf->config($i->key) %> SELECTED><%= conf->config($i->key) %>
68 <% } elsif ( $type eq 'editlist' ) { %>
70 function doremove<%= $i->key. $n %>() {
71 fromObject = document.OneTrueForm.<%= $i->key. $n %>;
72 for (var i=fromObject.options.length-1;i>-1;i--) {
73 if (fromObject.options[i].selected)
74 deleteOption<%= $i->key. $n %>(fromObject,i);
77 function deleteOption<%= $i->key. $n %>(object,index) {
78 object.options[index] = null;
80 function doadd<%= $i->key. $n %>(object) {
82 <% if ( defined($i->editlist_parts) ) { %>
84 <% foreach my $pnum ( 0 .. scalar(@{$i->editlist_parts})-1 ) { %>
86 if ( myvalue != "" ) { myvalue = myvalue + " "; }
87 <% if ( $i->editlist_parts->[$pnum]{type} eq 'select' ) { %>
88 myvalue = myvalue + object.add<%= $i->key. $n . "_$pnum" %>.options[object.add<%= $i->key. $n . "_$pnum" %>.selectedIndex].value;
89 <!-- #RESET SELECT?? maybe not... -->
90 <% } elsif ( $i->editlist_parts->[$pnum]{type} eq 'immutable' ) { %>
91 myvalue = myvalue + object.add<%= $i->key. $n . "_$pnum" %>.value;
93 myvalue = myvalue + object.add<%= $i->key. $n . "_$pnum" %>.value;
94 object.add<%= $i->key. $n. "_$pnum" %>.value = "";
100 myvalue = object.add<%= $i->key. $n. "_1" %>.value;
102 var optionName = new Option(myvalue, myvalue);
103 var length = object.<%= $i->key. $n %>.length;
104 object.<%= $i->key. $n %>.options[length] = optionName;
107 <select multiple size=5 name="<%= $i->key. $n %>">
108 <option selected>--------------------------------</option>
109 <% foreach my $line ( $conf->config($i->key) ) { %>
110 <option value="$line">$line</option>
113 <input type="button" value="remove selected" onClick="doremove<%= $i->key. $n %>()">
114 <script>SafeAddOnLoad(doremove<%= $i->key. $n %>)</script>
116 <% if ( defined $i->editlist_parts ) { %>
117 <% my $pnum=0; foreach my $part ( @{$i->editlist_parts} ) { %>
118 <% if ( $part->{type} eq 'text' ) { %>
119 <input type="text" name="add<%= $i->key. $n."_$pnum" %>">
120 <% } elsif ( $part->{type} eq 'immutable' ) { %>
121 <%= $part->{value} %><input type="hidden" name="add<%= $i->key. $n. "_$pnum" %>" value="<%= $part->{value} %>">
122 <% } elsif ( $part->{type} eq 'select' ) { %>
123 <select name="add<%= $i->key. $n. "_$pnum" %>">
124 <% foreach my $key ( keys %{$part->{select_enum}} ) { %>
125 <option value="<%= $key %>"><%= $part->{select_enum}{$key} %></option>
129 <font color="#ff0000">unknown type <%= $part->type %></font>
133 <input type="text" name="add<%= $i->key. $n %>_0">
135 <input type="button" value="add" onClick="doadd<%= $i->key. $n %>(this.form)">
137 <font color="#ff0000">unknown type <%= $type %></font>
141 <td><a name="<%= $i->key %>">
142 <b><%= $i->key %></b> - <%= $i->description %>
149 You may need to restart Apache and/or freeside-queued for configuration
150 changes to take effect.<BR>
152 <input type="submit" value="Apply changes">