[freeside-commits] freeside/httemplate/config config-process.cgi,
1.7, 1.8 config-view.cgi, 1.13, 1.14 config.cgi, 1.18, 1.19
Ivan,,,
ivan at wavetail.420.am
Wed Aug 23 15:25:39 PDT 2006
- Previous message: [freeside-commits] freeside/httemplate/docs trouble.html,1.1,NONE
- Next message: [freeside-commits] freeside/httemplate/edit/cust_main billing.html,
1.8, 1.9 contact.html, 1.4, 1.5 select-country.html, 1.3,
1.4 select-county.html, 1.2, 1.3 select-state.html, 1.2, 1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/httemplate/config
In directory wavetail:/tmp/cvs-serv18630/httemplate/config
Modified Files:
config-process.cgi config-view.cgi config.cgi
Log Message:
Will things ever be the same again?
It's the final masonize
Index: config.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/config/config.cgi,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- config.cgi 10 Aug 2006 22:18:45 -0000 1.18
+++ config.cgi 23 Aug 2006 22:25:37 -0000 1.19
@@ -1,5 +1,5 @@
<!-- mason kludge -->
-<%= include("/elements/header.html",'Edit Configuration', menubar( 'Main Menu' => $p ) ) %>
+<% include("/elements/header.html",'Edit Configuration', menubar( 'Main Menu' => $p ) ) %>
<SCRIPT>
var gSafeOnload = new Array();
var gSafeOnsubmit = new Array();
@@ -19,218 +19,241 @@
gSafeOnsubmit[i]();
}
</SCRIPT>
+% my $conf = new FS::Conf; my @config_items = $conf->config_items;
-<% my $conf = new FS::Conf; my @config_items = $conf->config_items; %>
<form name="OneTrueForm" action="config-process.cgi" METHOD="POST" onSubmit="SafeOnsubmit()">
+% foreach my $section ( qw(required billing username password UI session
+% shell BIND
+% ),
+% '', 'deprecated') {
-<% foreach my $section ( qw(required billing username password UI session
- shell BIND
- ),
- '', 'deprecated') { %>
- <A NAME="<%= $section || 'unclassified' %>"></A>
+ <A NAME="<% $section || 'unclassified' %>"></A>
<FONT SIZE="-2">
- <% foreach my $nav_section ( qw(required billing username password UI session
- shell 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 || 'unclassified' %>"><%= ucfirst($nav_section || 'unclassified') %></A>]
- <% } %>
- <% } %>
+% foreach my $nav_section ( qw(required billing username password UI session
+% shell 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 || 'unclassified' %>"><% ucfirst($nav_section || 'unclassified') %></A>]
+% }
+% }
+
</FONT><BR>
- <%= table("#cccccc", 2) %>
+ <% table("#cccccc", 2) %>
<tr>
<th colspan="2" bgcolor="#dcdcdc">
- <%= ucfirst($section || 'unclassified') %> configuration options
+ <% ucfirst($section || 'unclassified') %> configuration options
</th>
</tr>
- <% foreach my $i (grep $_->section eq $section, @config_items) { %>
+% 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 '' ) { %>
+% 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' ) {
- <% } elsif ( $type eq 'textarea' ) { %>
- <textarea name="<%= $i->key. $n %>" rows=5><%= "\n". 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' ) {
- <% } elsif ( $type eq 'checkbox' ) { %>
- <input name="<%= $i->key. $n %>" type="checkbox" value="1"<%= $conf->exists($i->key) ? ' CHECKED' : '' %>>
+ <input name="<% $i->key. $n %>" type="checkbox" value="1"<% $conf->exists($i->key) ? ' CHECKED' : '' %>>
+% } elsif ( $type eq 'text' ) {
- <% } elsif ( $type eq 'text' ) { %>
- <input name="<%= $i->key. $n %>" type="<%= $type %>" value="<%= $conf->exists($i->key) ? $conf->config($i->key) : '' %>">
+ <input name="<% $i->key. $n %>" type="<% $type %>" value="<% $conf->exists($i->key) ? $conf->config($i->key) : '' %>">
+% } elsif ( $type eq 'select' || $type eq 'selectmultiple' ) {
- <% } elsif ( $type eq 'select' || $type eq 'selectmultiple' ) { %>
- <select name="<%= $i->key. $n %>" <%= $type eq 'selectmultiple' ? 'MULTIPLE' : '' %>>
- <%
- my %hash = ();
- if ( $i->select_enum ) {
- tie %hash, 'Tie::IxHash',
- '' => '', map { $_ => $_ } @{ $i->select_enum };
- } elsif ( $i->select_hash ) {
- if ( ref($i->select_hash) eq 'ARRAY' ) {
- tie %hash, 'Tie::IxHash',
- '' => '', @{ $i->select_hash };
- } else {
- tie %hash, 'Tie::IxHash',
- '' => '', %{ $i->select_hash };
- }
- } else {
- %hash = ( '' => 'WARNING: neither select_enum nor select_hash specified in Conf.pm for configuration option "'. $i->key. '"' );
- }
-
- my %saw = ();
- foreach my $value ( keys %hash ) {
- local($^W)=0; next if $saw{$value}++;
- my $label = $hash{$value};
- %>
+ <select name="<% $i->key. $n %>" <% $type eq 'selectmultiple' ? 'MULTIPLE' : '' %>>
+%
+% my %hash = ();
+% if ( $i->select_enum ) {
+% tie %hash, 'Tie::IxHash',
+% '' => '', map { $_ => $_ } @{ $i->select_enum };
+% } elsif ( $i->select_hash ) {
+% if ( ref($i->select_hash) eq 'ARRAY' ) {
+% tie %hash, 'Tie::IxHash',
+% '' => '', @{ $i->select_hash };
+% } else {
+% tie %hash, 'Tie::IxHash',
+% '' => '', %{ $i->select_hash };
+% }
+% } else {
+% %hash = ( '' => 'WARNING: neither select_enum nor select_hash specified in Conf.pm for configuration option "'. $i->key. '"' );
+% }
+%
+% my %saw = ();
+% foreach my $value ( keys %hash ) {
+% local($^W)=0; next if $saw{$value}++;
+% my $label = $hash{$value};
+%
- <option value="<%= $value %>"<%= $value eq $conf->config($i->key) || ( $type eq 'selectmultiple' && grep { $_ eq $value } $conf->config($i->key) ) ? ' SELECTED' : '' %>><%= $label %>
- <% } %>
+ <option value="<% $value %>"<% $value eq $conf->config($i->key) || ( $type eq 'selectmultiple' && grep { $_ eq $value } $conf->config($i->key) ) ? ' SELECTED' : '' %>><% $label %>
+% }
+% my $curvalue = $conf->config($i->key);
+% if ( $conf->exists($i->key) && $curvalue
+% && ! $hash{$curvalue}
+% ) {
+%
- <% my $curvalue = $conf->config($i->key);
- if ( $conf->exists($i->key) && $curvalue
- && ! $hash{$curvalue}
- ) {
- %>
- <option value="<%= $conf->config($i->key) %>" SELECTED><%= exists( $hash{ $conf->config($i->key) } ) ? $hash{ $conf->config($i->key) } : $conf->config($i->key) %>
+ <option value="<% $conf->config($i->key) %>" SELECTED><% exists( $hash{ $conf->config($i->key) } ) ? $hash{ $conf->config($i->key) } : $conf->config($i->key) %>
+% }
- <% } %>
</select>
+% } elsif ( $type eq 'select-sub' ) {
- <% } elsif ( $type eq 'select-sub' ) { %>
- <select name="<%= $i->key. $n %>">
+ <select name="<% $i->key. $n %>">
<option value="">
- <% my %options = &{$i->options_sub};
- my @options = sort { $a <=> $b } keys %options;
- my %saw;
- foreach my $value ( @options ) {
- local($^W)=0; next if $saw{$value}++;
- %>
- <option value="<%= $value %>"<%= $value eq $conf->config($i->key) ? ' SELECTED' : '' %>><%= $value %>: <%= $options{$value} %>
- <% } %>
- <% if ( $conf->exists($i->key) && $conf->config($i->key) && ! exists $options{$conf->config($i->key)} ) { %>
- <option value=<%= $conf->config($i->key) %> SELECTED><%= $conf->config($i->key) %>: <%= &{ $i->option_sub }( $conf->config($i->key) ) %>
- <% } %>
+% my %options = &{$i->options_sub};
+% my @options = sort { $a <=> $b } keys %options;
+% my %saw;
+% foreach my $value ( @options ) {
+% local($^W)=0; next if $saw{$value}++;
+%
+
+ <option value="<% $value %>"<% $value eq $conf->config($i->key) ? ' SELECTED' : '' %>><% $value %>: <% $options{$value} %>
+% }
+% if ( $conf->exists($i->key) && $conf->config($i->key) && ! exists $options{$conf->config($i->key)} ) {
+
+ <option value=<% $conf->config($i->key) %> SELECTED><% $conf->config($i->key) %>: <% &{ $i->option_sub }( $conf->config($i->key) ) %>
+% }
+
</select>
+% } elsif ( $type eq 'editlist' ) {
- <% } elsif ( $type eq 'editlist' ) { %>
<script>
- function doremove<%= $i->key. $n %>() {
- fromObject = document.OneTrueForm.<%= $i->key. $n %>;
+ 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);
+ deleteOption<% $i->key. $n %>(fromObject,i);
}
}
- function deleteOption<%= $i->key. $n %>(object,index) {
+ function deleteOption<% $i->key. $n %>(object,index) {
object.options[index] = null;
}
- function selectall<%= $i->key. $n %>() {
- fromObject = document.OneTrueForm.<%= $i->key. $n %>;
+ 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) {
+ function doadd<% $i->key. $n %>(object) {
var myvalue = "";
- <% if ( defined($i->editlist_parts) ) { %>
+% if ( defined($i->editlist_parts) ) {
+% foreach my $pnum ( 0 .. scalar(@{$i->editlist_parts})-1 ) {
- <% 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;
+% 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 = "";
- <% } %>
+% } 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;
+% }
- <% } %>
- <% } 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;
+ var length = object.<% $i->key. $n %>.length;
+ object.<% $i->key. $n %>.options[length] = optionName;
}
</script>
- <select multiple size=5 name="<%= $i->key. $n %>">
+ <select multiple size=5 name="<% $i->key. $n %>">
<option selected>----------------------------------------------------------------</option>
- <% foreach my $line ( $conf->config($i->key) ) { %>
- <option value="<%= $line %>"><%= $line %></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 %>);
- SafeAddOnSubmit(selectall<%= $i->key. $n %>);</script>
+ <input type="button" value="remove selected" onClick="doremove<% $i->key. $n %>()">
+ <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} ) { %>
+ <% 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' ) { %>
- <%= $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>
- <% } %>
+% 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>
- <% } %>
+% } else {
+
+ <font color="#ff0000">unknown type <% $part->type %></font>
+% }
+
</td>
- <% $pnum++; } %>
- <% } else { %>
- <td><input type="text" name="add<%= $i->key. $n %>_0"></td>
- <% } %>
- <td><input type="button" value="add" onClick="doadd<%= $i->key. $n %>(this.form)"></td>
- </tr></table>
+% $pnum++; }
+% } else {
- <% } else { %>
+ <td><input type="text" name="add<% $i->key. $n %>_0"></td>
+% }
- <font color="#ff0000">unknown type <%= $type %></font>
+ <td><input type="button" value="add" onClick="doadd<% $i->key. $n %>(this.form)"></td>
+ </tr></table>
+% } else {
- <% } %>
- <% $n++; } %>
+ <font color="#ff0000">unknown type <% $type %></font>
+% }
+% $n++; }
+
</td>
- <td><a name="<%= $i->key %>">
- <b><%= $i->key %></b> - <%= $i->description %>
+ <td><a name="<% $i->key %>">
+ <b><% $i->key %></b> - <% $i->description %>
</a></td>
</tr>
- <% } %>
+% }
+
</table><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>
+% }
-<% } %>
</form>
Index: config-view.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/config/config-view.cgi,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- config-view.cgi 31 Jan 2006 04:26:54 -0000 1.13
+++ config-view.cgi 23 Aug 2006 22:25:37 -0000 1.14
@@ -1,80 +1,92 @@
<!-- mason kludge -->
-<%= include("/elements/header.html",'View Configuration', menubar( 'Main Menu' => $p,
+<% include("/elements/header.html",'View Configuration', menubar( 'Main Menu' => $p,
'Edit Configuration' => 'config.cgi' ) ) %>
+% my $conf = new FS::Conf; my @config_items = $conf->config_items;
+% foreach my $section ( qw(required billing username password UI session
+% shell BIND
+% ),
+% '', 'deprecated') {
-<% my $conf = new FS::Conf; my @config_items = $conf->config_items; %>
-
-<% foreach my $section ( qw(required billing username password UI session
- shell BIND
- ),
- '', 'deprecated') { %>
- <A NAME="<%= $section || 'unclassified' %>"></A>
+ <A NAME="<% $section || 'unclassified' %>"></A>
<FONT SIZE="-2">
- <% foreach my $nav_section ( qw(required billing username password UI session
- shell 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 || 'unclassified' %>"><%= ucfirst($nav_section || 'unclassified') %></A>]
- <% } %>
- <% } %>
+% foreach my $nav_section ( qw(required billing username password UI session
+% shell 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 || 'unclassified' %>"><% ucfirst($nav_section || 'unclassified') %></A>]
+% }
+% }
+
</FONT><BR>
- <%= table("#cccccc", 2) %>
+ <% table("#cccccc", 2) %>
<tr>
<th colspan="2" bgcolor="#dcdcdc">
- <%= ucfirst($section || 'unclassified') %> configuration options
+ <% ucfirst($section || 'unclassified') %> configuration options
</th>
</tr>
- <% foreach my $i (grep $_->section eq $section, @config_items) { %>
+% foreach my $i (grep $_->section eq $section, @config_items) {
+
<tr>
- <td><a name="<%= $i->key %>">
- <b><%= $i->key %></b> - <%= $i->description %>
+ <td><a name="<% $i->key %>">
+ <b><% $i->key %></b> - <% $i->description %>
</a></td>
<td><table border=0>
- <% foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) {
- my $n = 0; %>
- <% if ( $type eq '' ) { %>
+% foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) {
+% my $n = 0;
+% if ( $type eq '' ) {
+
<tr>
<td><font color="#ff0000">no type</font></td>
</tr>
- <% } elsif ( $type eq 'textarea'
- || $type eq 'editlist'
- || $type eq 'selectmultiple' ) { %>
+% } elsif ( $type eq 'textarea'
+% || $type eq 'editlist'
+% || $type eq 'selectmultiple' ) {
+
<tr>
<td bgcolor="#ffffff">
<pre>
-<%= encode_entities(join("\n", $conf->config($i->key) ) ) %>
+<% encode_entities(join("\n", $conf->config($i->key) ) ) %>
</pre>
</td>
</tr>
- <% } elsif ( $type eq 'checkbox' ) { %>
+% } elsif ( $type eq 'checkbox' ) {
+
<tr>
- <td bgcolor="#<%= $conf->exists($i->key) ? '00ff00">YES' : 'ff0000">NO' %></td>
+ <td bgcolor="#<% $conf->exists($i->key) ? '00ff00">YES' : 'ff0000">NO' %></td>
</tr>
- <% } elsif ( $type eq 'text' || $type eq 'select' ) { %>
+% } elsif ( $type eq 'text' || $type eq 'select' ) {
+
<tr>
<td bgcolor="#ffffff">
- <%= $conf->exists($i->key) ? $conf->config($i->key) : '' %>
+ <% $conf->exists($i->key) ? $conf->config($i->key) : '' %>
</td></tr>
- <% } elsif ( $type eq 'select-sub' ) { %>
+% } elsif ( $type eq 'select-sub' ) {
+
<tr>
<td bgcolor="#ffffff">
- <%= $conf->config($i->key) %>:
- <%= &{ $i->option_sub }( $conf->config($i->key) ) %>
+ <% $conf->config($i->key) %>:
+ <% &{ $i->option_sub }( $conf->config($i->key) ) %>
</td>
</tr>
- <% } else { %>
+% } else {
+
<tr><td>
- <font color="#ff0000">unknown type <%= $type %></font>
+ <font color="#ff0000">unknown type <% $type %></font>
</td></tr>
- <% } %>
- <% $n++; } %>
+% }
+% $n++; }
+
</table></td>
</tr>
- <% } %>
+% }
+
</table><br><br>
-<% } %>
+% }
+
</body></html>
Index: config-process.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/config/config-process.cgi,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- config-process.cgi 7 Apr 2002 00:00:41 -0000 1.7
+++ config-process.cgi 23 Aug 2006 22:25:37 -0000 1.8
@@ -1,51 +1,52 @@
-<%
- my $conf = new FS::Conf;
- $FS::Conf::DEBUG = 1;
- my @config_items = $conf->config_items;
-
- foreach my $i ( @config_items ) {
- my @touch = ();
- my @delete = ();
- my $n = 0;
- foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) {
- if ( $type eq '' ) {
- } elsif ( $type eq 'textarea' ) {
- if ( $cgi->param($i->key. $n) ne '' ) {
- my $value = $cgi->param($i->key. $n);
- $value =~ s/\r\n/\n/g; #browsers?
- $conf->set($i->key, $value);
- } else {
- $conf->delete($i->key);
- }
- } elsif ( $type eq 'checkbox' ) {
-# if ( defined($cgi->param($i->key. $n)) && $cgi->param($i->key. $n) ) {
- if ( defined $cgi->param($i->key. $n) ) {
- #$conf->touch($i->key);
- push @touch, $i->key;
- } else {
- #$conf->delete($i->key);
- push @delete, $i->key;
- }
- } elsif ( $type eq 'text' || $type eq 'select' ) {
- if ( $cgi->param($i->key. $n) ne '' ) {
- $conf->set($i->key, $cgi->param($i->key. $n));
- } else {
- $conf->delete($i->key);
- }
- } elsif ( $type eq 'editlist' || $type eq 'selectmultiple' ) {
- if ( scalar(@{[ $cgi->param($i->key. $n) ]}) ) {
- $conf->set($i->key, join("\n", @{[ $cgi->param($i->key. $n) ]} ));
- } else {
- $conf->delete($i->key);
- }
- } else {
- }
- $n++;
- }
- # warn @touch;
- $conf->touch($_) foreach @touch;
- $conf->delete($_) foreach @delete;
- }
+%
+% my $conf = new FS::Conf;
+% $FS::Conf::DEBUG = 1;
+% my @config_items = $conf->config_items;
+%
+% foreach my $i ( @config_items ) {
+% my @touch = ();
+% my @delete = ();
+% my $n = 0;
+% foreach my $type ( ref($i->type) ? @{$i->type} : $i->type ) {
+% if ( $type eq '' ) {
+% } elsif ( $type eq 'textarea' ) {
+% if ( $cgi->param($i->key. $n) ne '' ) {
+% my $value = $cgi->param($i->key. $n);
+% $value =~ s/\r\n/\n/g; #browsers?
+% $conf->set($i->key, $value);
+% } else {
+% $conf->delete($i->key);
+% }
+% } elsif ( $type eq 'checkbox' ) {
+%# if ( defined($cgi->param($i->key. $n)) && $cgi->param($i->key. $n) ) {
+% if ( defined $cgi->param($i->key. $n) ) {
+% #$conf->touch($i->key);
+% push @touch, $i->key;
+% } else {
+% #$conf->delete($i->key);
+% push @delete, $i->key;
+% }
+% } elsif ( $type eq 'text' || $type eq 'select' ) {
+% if ( $cgi->param($i->key. $n) ne '' ) {
+% $conf->set($i->key, $cgi->param($i->key. $n));
+% } else {
+% $conf->delete($i->key);
+% }
+% } elsif ( $type eq 'editlist' || $type eq 'selectmultiple' ) {
+% if ( scalar(@{[ $cgi->param($i->key. $n) ]}) ) {
+% $conf->set($i->key, join("\n", @{[ $cgi->param($i->key. $n) ]} ));
+% } else {
+% $conf->delete($i->key);
+% }
+% } else {
+% }
+% $n++;
+% }
+% # warn @touch;
+% $conf->touch($_) foreach @touch;
+% $conf->delete($_) foreach @delete;
+% }
+%
+%
-%>
-<%= $cgi->redirect("config-view.cgi") %>
+<% $cgi->redirect("config-view.cgi") %>
- Previous message: [freeside-commits] freeside/httemplate/docs trouble.html,1.1,NONE
- Next message: [freeside-commits] freeside/httemplate/edit/cust_main billing.html,
1.8, 1.9 contact.html, 1.4, 1.5 select-country.html, 1.3,
1.4 select-county.html, 1.2, 1.3 select-state.html, 1.2, 1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list