summaryrefslogtreecommitdiff
path: root/httemplate/config
diff options
context:
space:
mode:
authorivan <ivan>2002-03-17 08:33:39 +0000
committerivan <ivan>2002-03-17 08:33:39 +0000
commit697dfd9ac2dfa36aa244e6d2d9f2e8f8a364a120 (patch)
treea2945095ee9ee7f92526d176979806bde65525bb /httemplate/config
parent62a0a2a05de9f43e625357cc262312b86d178799 (diff)
new domain record editing foo
Diffstat (limited to 'httemplate/config')
-rw-r--r--httemplate/config/config-view.cgi15
-rw-r--r--httemplate/config/config.cgi95
2 files changed, 108 insertions, 2 deletions
diff --git a/httemplate/config/config-view.cgi b/httemplate/config/config-view.cgi
index 138ec4737..917cc7316 100644
--- a/httemplate/config/config-view.cgi
+++ b/httemplate/config/config-view.cgi
@@ -8,6 +8,19 @@
shell mail radius apache BIND
),
'', 'deprecated') { %>
+ <FONT SIZE="-2">
+ <% foreach my $nav_section ( qw(required billing username password UI session
+ shell mail radius apache BIND
+ ),
+ '', 'deprecated') { %>
+ <% 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>]
+ <% } %>
+ <% } %>
+ </FONT><BR>
+ <A NAME="<%= $section || 'unclassified' %>"></A>
<%= table("#cccccc", 2) %>
<tr>
<th colspan="2" bgcolor="#dcdcdc">
@@ -24,7 +37,7 @@
my $n = 0; %>
<% if ( $type eq '' ) { %>
<tr><td><font color="#ff0000">no type</font></td></tr>
- <% } elsif ( $type eq 'textarea' ) { %>
+ <% } elsif ( $type eq 'textarea' || $type eq 'editlist' ) { %>
<tr><td bgcolor="#ffffff">
<pre>
<%= encode_entities(join("\n", $conf->config($i->key) ) ) %>
diff --git a/httemplate/config/config.cgi b/httemplate/config/config.cgi
index 19775c7aa..155dcfdbc 100644
--- a/httemplate/config/config.cgi
+++ b/httemplate/config/config.cgi
@@ -1,14 +1,39 @@
<!-- mason kludge -->
<%= header('Edit Configuration', menubar( 'Main Menu' => $p ) ) %>
+<SCRIPT>
+var gSafeOnload = new Array();
+window.onload = SafeOnload;
+function SafeAddOnLoad(f) {
+ gSafeOnload[gSafeOnload.length] = f;
+}
+function SafeOnload()
+{
+ for (var i=0;i<gSafeOnload.length;i++)
+ gSafeOnload[i]();
+}
+</SCRIPT>
<% my $conf = new FS::Conf; my @config_items = $conf->config_items; %>
-<form action="config-process.cgi" METHOD="POST">
+<form name="OneTrueForm" action="config-process.cgi" METHOD="POST">
<% foreach my $section ( qw(required billing username password UI session
shell mail radius apache BIND
),
'', 'deprecated') { %>
+ <FONT SIZE="-2">
+ <% foreach my $nav_section ( qw(required billing username password UI session
+ shell mail radius apache BIND
+ ),
+ '', 'deprecated') { %>
+ <% 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>]
+ <% } %>
+ <% } %>
+ </FONT><BR>
+ <A NAME="<%= $section || 'unclassified' %>"></A>
<%= table("#cccccc", 2) %>
<tr>
<th colspan="2" bgcolor="#dcdcdc">
@@ -40,6 +65,74 @@
<% 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) %>
<% } %>
+ <% } elsif ( $type eq 'editlist' ) { %>
+ <script>
+ function doremove<%= $i->key. $n %>() {
+ fromObject = document.OneTrueForm.<%= $i->key. $n %>;
+ for (var i=fromObject.options.length-1;i>-1;i--) {
+ if (fromObject.options[i].selected)
+ deleteOption<%= $i->key. $n %>(fromObject,i);
+ }
+ }
+ function deleteOption<%= $i->key. $n %>(object,index) {
+ object.options[index] = null;
+ }
+ function doadd<%= $i->key. $n %>(object) {
+ var myvalue = "";
+ <% if ( defined($i->editlist_parts) ) { %>
+
+ <% foreach my $pnum ( 0 .. scalar(@{$i->editlist_parts})-1 ) { %>
+
+ if ( myvalue != "" ) { myvalue = myvalue + " "; }
+ <% if ( $i->editlist_parts->[$pnum]{type} eq 'select' ) { %>
+ myvalue = myvalue + object.add<%= $i->key. $n . "_$pnum" %>.options[object.add<%= $i->key. $n . "_$pnum" %>.selectedIndex].value;
+ <!-- #RESET SELECT?? maybe not... -->
+ <% } elsif ( $i->editlist_parts->[$pnum]{type} eq 'immutable' ) { %>
+ myvalue = myvalue + object.add<%= $i->key. $n . "_$pnum" %>.value;
+ <% } else { %>
+ myvalue = myvalue + object.add<%= $i->key. $n . "_$pnum" %>.value;
+ object.add<%= $i->key. $n. "_$pnum" %>.value = "";
+ <% } %>
+
+
+ <% } %>
+ <% } else { %>
+ myvalue = object.add<%= $i->key. $n. "_1" %>.value;
+ <% } %>
+ var optionName = new Option(myvalue, myvalue);
+ var length = object.<%= $i->key. $n %>.length;
+ object.<%= $i->key. $n %>.options[length] = optionName;
+ }
+ </script>
+ <select multiple size=5 name="<%= $i->key. $n %>">
+ <option selected>--------------------------------</option>
+ <% foreach my $line ( $conf->config($i->key) ) { %>
+ <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>
+ <br>
+ <% if ( defined $i->editlist_parts ) { %>
+ <% my $pnum=0; foreach my $part ( @{$i->editlist_parts} ) { %>
+ <% if ( $part->{type} eq 'text' ) { %>
+ <input type="text" name="add<%= $i->key. $n."_$pnum" %>">
+ <% } elsif ( $part->{type} eq 'immutable' ) { %>
+ <%= $part->{value} %><input type="hidden" name="add<%= $i->key. $n. "_$pnum" %>" value="<%= $part->{value} %>">
+ <% } elsif ( $part->{type} eq 'select' ) { %>
+ <select name="add<%= $i->key. $n. "_$pnum" %>">
+ <% foreach my $key ( keys %{$part->{select_enum}} ) { %>
+ <option value="<%= $key %>"><%= $part->{select_enum}{$key} %></option>
+ <% } %>
+ </select>
+ <% } else { %>
+ <font color="#ff0000">unknown type <%= $part->type %></font>
+ <% } %>
+ <% $pnum++; } %>
+ <% } else { %>
+ <input type="text" name="add<%= $i->key. $n %>_0">
+ <% } %>
+ <input type="button" value="add" onClick="doadd<%= $i->key. $n %>(this.form)">
<% } else { %>
<font color="#ff0000">unknown type <%= $type %></font>
<% } %>