<%= header('Edit Configuration', menubar( 'Main Menu' => $p ) ) %>
<SCRIPT>
var gSafeOnload = new Array();
+var gSafeOnsubmit = new Array();
window.onload = SafeOnload;
function SafeAddOnLoad(f) {
gSafeOnload[gSafeOnload.length] = f;
}
-function SafeOnload()
-{
+function SafeOnload() {
for (var i=0;i<gSafeOnload.length;i++)
gSafeOnload[i]();
}
+function SafeAddOnSubmit(f) {
+ gSafeOnsubmit[gSafeOnsubmit.length] = f;
+}
+function SafeOnsubmit() {
+ for (var i=0;i<gSafeOnsubmit.length;i++)
+ gSafeOnsubmit[i]();
+}
</SCRIPT>
<% my $conf = new FS::Conf; my @config_items = $conf->config_items; %>
-<form name="OneTrueForm" action="config-process.cgi" METHOD="POST">
+<form name="OneTrueForm" action="config-process.cgi" METHOD="POST" onSubmit="SafeOnsubmit()">
<% foreach my $section ( qw(required billing username password UI session
shell mail radius apache BIND
),
'', 'deprecated') { %>
+ <A NAME="<%= $section || 'unclassified' %>"></A>
<FONT SIZE="-2">
<% foreach my $nav_section ( qw(required billing username password UI session
shell mail radius apache BIND
<% if ( $section eq $nav_section ) { %>
[<A NAME="not<%= $nav_section || 'unclassified' %>" style="background-color: #cccccc"><%= ucfirst($nav_section || 'unclassified') %></A>]
<% } else { %>
- [<A HREF="#<%= $nav_section %>"><%= ucfirst($nav_section || 'unclassified') %></A>]
+ [<A HREF="#<%= $nav_section || 'unclassified' %>"><%= ucfirst($nav_section || 'unclassified') %></A>]
<% } %>
<% } %>
</FONT><BR>
- <A NAME="<%= $section || 'unclassified' %>"></A>
<%= table("#cccccc", 2) %>
<tr>
<th colspan="2" bgcolor="#dcdcdc">
<% if ( $type eq '' ) { %>
<font color="#ff0000">no type</font>
<% } elsif ( $type eq 'textarea' ) { %>
- <textarea name="<%= $i->key. $n %>" rows=5><%= join("\n", $conf->config($i->key) ) %></textarea>
+ <textarea name="<%= $i->key. $n %>" rows=5><%= "\n". join("\n", $conf->config($i->key) ) %></textarea>
<% } elsif ( $type eq 'checkbox' ) { %>
<input name="<%= $i->key. $n %>" type="checkbox" value="1"<%= $conf->exists($i->key) ? ' CHECKED' : '' %>>
<% } elsif ( $type eq 'text' ) { %>
<input name="<%= $i->key. $n %>" type="<%= $type %>" value="<%= $conf->exists($i->key) ? $conf->config($i->key) : '' %>">
- <% } elsif ( $type eq 'select' ) { %>
- <select name="<%= $i->key. $n %>">
+ <% } elsif ( $type eq 'select' || $type eq 'selectmultiple' ) { %>
+ <select name="<%= $i->key. $n %>" <%= $type eq 'selectmultiple' ? 'MULTIPLE' : '' %>>
<% my %saw;
foreach my $value ( "", @{$i->select_enum} ) {
local($^W)=0; next if $saw{$value}++; %>
- <option value="<%= $value %>"<%= $value eq $conf->config($i->key) ? ' SELECTED' : '' %>><%= $value %>
+ <option value="<%= $value %>"<%= $value eq $conf->config($i->key) || ( $type eq 'selectmultiple' && grep { $_ eq $value } $conf->config($i->key) ) ? ' SELECTED' : '' %>><%= $value %>
<% } %>
<% if ( $conf->exists($i->key) && $conf->config($i->key) && ! grep { $conf->config($i->key) eq $_ } @{$i->select_enum}) { %>
<option value=<%= $conf->config($i->key) %> SELECTED><%= conf->config($i->key) %>
<% } %>
+ </select>
<% } elsif ( $type eq 'editlist' ) { %>
<script>
function doremove<%= $i->key. $n %>() {
function deleteOption<%= $i->key. $n %>(object,index) {
object.options[index] = null;
}
+ function selectall<%= $i->key. $n %>() {
+ fromObject = document.OneTrueForm.<%= $i->key. $n %>;
+ for (var i=fromObject.options.length-1;i>-1;i--) {
+ fromObject.options[i].selected = true;
+ }
+ }
function doadd<%= $i->key. $n %>(object) {
var myvalue = "";
<% if ( defined($i->editlist_parts) ) { %>
}
</script>
<select multiple size=5 name="<%= $i->key. $n %>">
- <option selected>--------------------------------</option>
+ <option selected>----------------------------------------------------------------</option>
<% foreach my $line ( $conf->config($i->key) ) { %>
- <option value="$line">$line</option>
+ <option value="<%= $line %>"><%= $line %></option>
<% } %>
</select><br>
<input type="button" value="remove selected" onClick="doremove<%= $i->key. $n %>()">
- <script>SafeAddOnLoad(doremove<%= $i->key. $n %>)</script>
+ <script>SafeAddOnLoad(doremove<%= $i->key. $n %>);
+ SafeAddOnSubmit(selectall<%= $i->key. $n %>);</script>
<br>
+ <%= itable() %><tr>
<% if ( defined $i->editlist_parts ) { %>
<% my $pnum=0; foreach my $part ( @{$i->editlist_parts} ) { %>
+ <td>
<% if ( $part->{type} eq 'text' ) { %>
<input type="text" name="add<%= $i->key. $n."_$pnum" %>">
<% } elsif ( $part->{type} eq 'immutable' ) { %>
<% } else { %>
<font color="#ff0000">unknown type <%= $part->type %></font>
<% } %>
+ </td>
<% $pnum++; } %>
<% } else { %>
- <input type="text" name="add<%= $i->key. $n %>_0">
+ <td><input type="text" name="add<%= $i->key. $n %>_0"></td>
<% } %>
- <input type="button" value="add" onClick="doadd<%= $i->key. $n %>(this.form)">
+ <td><input type="button" value="add" onClick="doadd<%= $i->key. $n %>(this.form)"></td>
+ </tr></table>
<% } else { %>
<font color="#ff0000">unknown type <%= $type %></font>
<% } %>
</a></td>
</tr>
<% } %>
- </table><br><br>
-<% } %>
+ </table><br>
-You may need to restart Apache and/or freeside-queued for configuration
-changes to take effect.<BR>
+ You may need to restart Apache and/or freeside-queued for configuration
+ changes to take effect.<br>
+
+ <input type="submit" value="Apply changes"><br><br>
+
+<% } %>
-<input type="submit" value="Apply changes">
</form>
</body></html>