web config should workish now
authorivan <ivan>
Tue, 30 Oct 2001 14:20:46 +0000 (14:20 +0000)
committerivan <ivan>
Tue, 30 Oct 2001 14:20:46 +0000 (14:20 +0000)
htetc/handler.pl
httemplate/config/config-view.cgi
httemplate/config/config.cgi [new file with mode: 0644]

index f01d3cd..d10ecc9 100644 (file)
@@ -59,6 +59,7 @@ sub handler
       #use CGI::Carp qw(fatalsToBrowser);
       use Date::Format;
       use Date::Parse;
+      use HTML::Entities;
       use FS::UID qw(cgisuidsetup);
       use FS::Record qw(qsearch qsearchs fields);
       use FS::part_svc;
index 09e535b..3c16c48 100644 (file)
@@ -25,7 +25,9 @@
             <tr><td><font color="#ff0000">no type</font></td></tr>
           <% } elsif ( $type eq 'textarea' ) { %>
             <tr><td bgcolor="#ffffff">
-              <pre><%= join("\n", $conf->config($i->key) ) %></pre>
+<pre>
+<%= encode_entities(join("\n", $conf->config($i->key) ) ) %>
+</pre>
             </td></tr>
           <% } elsif ( $type eq 'checkbox' ) { %>
             <tr><td bgcolor="#<%= $conf->exists($i->key) ? '00ff00">YES' : 'ff0000">NO' %></td></tr>
diff --git a/httemplate/config/config.cgi b/httemplate/config/config.cgi
new file mode 100644 (file)
index 0000000..32ddc04
--- /dev/null
@@ -0,0 +1,48 @@
+<%= header('Edit Configuration', menubar( 'Main Menu' => $p ) ) %>
+
+<% my $conf = new FS::Conf; my @config_items = $conf->config_items; %>
+
+<form action="config-process.cgi">
+
+<% foreach my $section ( qw(required billing username password UI session
+                            apache BIND shell
+                           ),
+                         '', 'depreciated') { %>
+  <%= table("#cccccc", 2) %>
+  <tr>
+    <th colspan="2" bgcolor="#dcdcdc">
+      <%= ucfirst($section || 'unclassified') %> configuration options
+    </th>
+  </tr>
+  <% foreach my $i (grep $_->section eq $section, @config_items) { %>
+    <tr>
+      <td>
+        <% my $n = 0;
+           foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) {
+             #warn $i->key unless defined($type);
+        %>
+          <% 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>
+          <% } 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) : '' %>">
+          <% } else { %>
+            <font color="#ff0000">unknown type <%= $type %></font>
+          <% } %>
+        <% $n++; } %>
+      </td>
+      <td><a name="<%= $i->key %>">
+        <b><%= $i->key %></b> - <%= $i->description %>
+      </a></td>
+    </tr>
+  <% } %>
+  </table><br><br>
+<% } %>
+
+<input type="submit" value="Apply changes">
+</form>
+
+</body></html>