2 <%= header('Edit Configuration', menubar( 'Main Menu' => $p ) ) %>
4 var gSafeOnload = new Array();
5 var gSafeOnsubmit = new Array();
6 window.onload = SafeOnload;
7 function SafeAddOnLoad(f) {
8 gSafeOnload[gSafeOnload.length] = f;
10 function SafeOnload() {
11 for (var i=0;i<gSafeOnload.length;i++)
14 function SafeAddOnSubmit(f) {
15 gSafeOnsubmit[gSafeOnsubmit.length] = f;
17 function SafeOnsubmit() {
18 for (var i=0;i<gSafeOnsubmit.length;i++)
23 <% my $conf = new FS::Conf; my @config_items = $conf->config_items; %>
25 <form name="OneTrueForm" action="config-process.cgi" METHOD="POST" onSubmit="SafeOnsubmit()">
27 <% foreach my $section ( qw(required billing username password UI session
28 shell mail apache BIND
30 '', 'deprecated') { %>
31 <A NAME="<%= $section || 'unclassified' %>"></A>
33 <% foreach my $nav_section ( qw(required billing username password UI session
34 shell mail apache BIND
36 '', 'deprecated') { %>
37 <% if ( $section eq $nav_section ) { %>
38 [<A NAME="not<%= $nav_section || 'unclassified' %>" style="background-color: #cccccc"><%= ucfirst($nav_section || 'unclassified') %></A>]
40 [<A HREF="#<%= $nav_section || 'unclassified' %>"><%= ucfirst($nav_section || 'unclassified') %></A>]
44 <%= table("#cccccc", 2) %>
46 <th colspan="2" bgcolor="#dcdcdc">
47 <%= ucfirst($section || 'unclassified') %> configuration options
50 <% foreach my $i (grep $_->section eq $section, @config_items) { %>
54 foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) {
55 #warn $i->key unless defined($type);
57 <% if ( $type eq '' ) { %>
58 <font color="#ff0000">no type</font>
59 <% } elsif ( $type eq 'textarea' ) { %>
60 <textarea name="<%= $i->key. $n %>" rows=5><%= "\n". join("\n", $conf->config($i->key) ) %></textarea>
61 <% } elsif ( $type eq 'checkbox' ) { %>
62 <input name="<%= $i->key. $n %>" type="checkbox" value="1"<%= $conf->exists($i->key) ? ' CHECKED' : '' %>>
63 <% } elsif ( $type eq 'text' ) { %>
64 <input name="<%= $i->key. $n %>" type="<%= $type %>" value="<%= $conf->exists($i->key) ? $conf->config($i->key) : '' %>">
65 <% } elsif ( $type eq 'select' || $type eq 'selectmultiple' ) { %>
66 <select name="<%= $i->key. $n %>" <%= $type eq 'selectmultiple' ? 'MULTIPLE' : '' %>>
68 foreach my $value ( "", @{$i->select_enum} ) {
69 local($^W)=0; next if $saw{$value}++; %>
70 <option value="<%= $value %>"<%= $value eq $conf->config($i->key) || ( $type eq 'selectmultiple' && grep { $_ eq $value } $conf->config($i->key) ) ? ' SELECTED' : '' %>><%= $value %>
72 <% if ( $conf->exists($i->key) && $conf->config($i->key) && ! grep { $conf->config($i->key) eq $_ } @{$i->select_enum}) { %>
73 <option value=<%= $conf->config($i->key) %> SELECTED><%= $conf->config($i->key) %>
76 <% } elsif ( $type eq 'editlist' ) { %>
78 function doremove<%= $i->key. $n %>() {
79 fromObject = document.OneTrueForm.<%= $i->key. $n %>;
80 for (var i=fromObject.options.length-1;i>-1;i--) {
81 if (fromObject.options[i].selected)
82 deleteOption<%= $i->key. $n %>(fromObject,i);
85 function deleteOption<%= $i->key. $n %>(object,index) {
86 object.options[index] = null;
88 function selectall<%= $i->key. $n %>() {
89 fromObject = document.OneTrueForm.<%= $i->key. $n %>;
90 for (var i=fromObject.options.length-1;i>-1;i--) {
91 fromObject.options[i].selected = true;
94 function doadd<%= $i->key. $n %>(object) {
96 <% if ( defined($i->editlist_parts) ) { %>
98 <% foreach my $pnum ( 0 .. scalar(@{$i->editlist_parts})-1 ) { %>
100 if ( myvalue != "" ) { myvalue = myvalue + " "; }
101 <% if ( $i->editlist_parts->[$pnum]{type} eq 'select' ) { %>
102 myvalue = myvalue + object.add<%= $i->key. $n . "_$pnum" %>.options[object.add<%= $i->key. $n . "_$pnum" %>.selectedIndex].value;
103 <!-- #RESET SELECT?? maybe not... -->
104 <% } elsif ( $i->editlist_parts->[$pnum]{type} eq 'immutable' ) { %>
105 myvalue = myvalue + object.add<%= $i->key. $n . "_$pnum" %>.value;
107 myvalue = myvalue + object.add<%= $i->key. $n . "_$pnum" %>.value;
108 object.add<%= $i->key. $n. "_$pnum" %>.value = "";
114 myvalue = object.add<%= $i->key. $n. "_1" %>.value;
116 var optionName = new Option(myvalue, myvalue);
117 var length = object.<%= $i->key. $n %>.length;
118 object.<%= $i->key. $n %>.options[length] = optionName;
121 <select multiple size=5 name="<%= $i->key. $n %>">
122 <option selected>----------------------------------------------------------------</option>
123 <% foreach my $line ( $conf->config($i->key) ) { %>
124 <option value="<%= $line %>"><%= $line %></option>
127 <input type="button" value="remove selected" onClick="doremove<%= $i->key. $n %>()">
128 <script>SafeAddOnLoad(doremove<%= $i->key. $n %>);
129 SafeAddOnSubmit(selectall<%= $i->key. $n %>);</script>
132 <% if ( defined $i->editlist_parts ) { %>
133 <% my $pnum=0; foreach my $part ( @{$i->editlist_parts} ) { %>
135 <% if ( $part->{type} eq 'text' ) { %>
136 <input type="text" name="add<%= $i->key. $n."_$pnum" %>">
137 <% } elsif ( $part->{type} eq 'immutable' ) { %>
138 <%= $part->{value} %><input type="hidden" name="add<%= $i->key. $n. "_$pnum" %>" value="<%= $part->{value} %>">
139 <% } elsif ( $part->{type} eq 'select' ) { %>
140 <select name="add<%= $i->key. $n. "_$pnum" %>">
141 <% foreach my $key ( keys %{$part->{select_enum}} ) { %>
142 <option value="<%= $key %>"><%= $part->{select_enum}{$key} %></option>
146 <font color="#ff0000">unknown type <%= $part->type %></font>
151 <td><input type="text" name="add<%= $i->key. $n %>_0"></td>
153 <td><input type="button" value="add" onClick="doadd<%= $i->key. $n %>(this.form)"></td>
156 <font color="#ff0000">unknown type <%= $type %></font>
160 <td><a name="<%= $i->key %>">
161 <b><%= $i->key %></b> - <%= $i->description %>
167 You may need to restart Apache and/or freeside-queued for configuration
168 changes to take effect.<br>
170 <input type="submit" value="Apply changes"><br><br>