[freeside-commits] freeside/httemplate/config config-view.cgi, 1.33, 1.34 config.cgi, 1.31, 1.32 config-process.cgi, 1.18, 1.19

Ivan,,, ivan at wavetail.420.am
Fri Sep 25 03:14:32 PDT 2009


Update of /home/cvs/cvsroot/freeside/httemplate/config
In directory wavetail.420.am:/tmp/cvs-serv18545/httemplate/config

Modified Files:
	config-view.cgi config.cgi config-process.cgi 
Log Message:
nomadix, RT#5876

Index: config-process.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/config/config-process.cgi,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- config-process.cgi	2 May 2009 00:01:30 -0000	1.18
+++ config-process.cgi	25 Sep 2009 10:14:30 -0000	1.19
@@ -41,15 +41,18 @@
     } else {
       push @delete, $i->key;
     }
-  } elsif ( $type eq 'text' || $type eq 'select' || $type eq 'select-sub' )  {
-    if ( $cgi->param($i->key.$n) ne '' ) {
-      $conf->set($i->key, $cgi->param($i->key.$n), $agentnum);
+  } elsif ( $type =~ /^(editlist|selectmultiple)$/
+            or ( $type =~ /^select(-(sub|part_svc))?$/ || $i->multiple )
+          )
+  {
+    if ( scalar(@{[ $cgi->param($i->key.$n) ]}) ) {
+      $conf->set($i->key, join("\n", @{[ $cgi->param($i->key.$n) ]} ), $agentnum);
     } else {
       $conf->delete($i->key, $agentnum);
     }
-  } 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) ]} ), $agentnum);
+  } elsif ( $type =~ /^(text|select(-(sub|part_svc))?)$/ ) {
+    if ( $cgi->param($i->key.$n) ne '' ) {
+      $conf->set($i->key, $cgi->param($i->key.$n), $agentnum);
     } else {
       $conf->delete($i->key, $agentnum);
     }
@@ -101,6 +104,11 @@
 
 %     } elsif ( $type eq 'text' || $type eq 'select' ) {
         configCell.innerHTML = <% $conf->exists($i->key, $agentnum) ? $conf->config($i->key, $agentnum) : '' |js_string %>;
+%     } elsif ( $type eq 'select-part_svc' && ! $i->multiple ) {
+        configCell.innerHTML =
+          <% $conf->config($i->key, $agentnum) |js_string %>
+%# + ': ' +
+%#          <% &{ $i->option_sub }( $conf->config($i->key, $agentnum) ) |js_string %>;
 %     } elsif ( $type eq 'select-sub' ) {
         configCell.innerHTML =
           <% $conf->config($i->key, $agentnum) |js_string %> + ': ' +

Index: config-view.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/config/config-view.cgi,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- config-view.cgi	12 Aug 2009 14:58:50 -0000	1.33
+++ config-view.cgi	25 Sep 2009 10:14:30 -0000	1.34
@@ -156,7 +156,9 @@
 
 %   } elsif (    $type eq 'textarea'
 %             || $type eq 'editlist'
-%             || $type eq 'selectmultiple' ) { 
+%             || $type eq 'selectmultiple'
+%           )
+%   {
 
             <tr>
               <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
@@ -197,7 +199,7 @@
               </td>
             </tr>
 
-%   } elsif ( $type eq 'select-sub' ) { 
+%   } elsif ( $type eq 'select-sub' ) {
 
             <tr>
               <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
@@ -206,12 +208,25 @@
               </td>
             </tr>
 
-%   } else { 
+%   } elsif ( $type eq 'select-part_svc' ) {
+%     my @svcparts = $conf->config($i->key, $agentnum);
+
+            <tr>
+              <td id="<% $agentnum.$i->key.$n %>" bgcolor="#ffffff">
+                <% join('<BR>', map { $_ # ': '. $svc
+                                    }
+                                    @svcparts
+                       )
+                %>
+              </td>
+            </tr>
+
+%   } else {
 
             <tr><td>
               <font color="#ff0000">unknown type <% $type %></font>
             </td></tr>
-%   } 
+%   }
 %   $n++;
 % } 
 

Index: config.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/config/config.cgi,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- config.cgi	3 May 2009 03:13:02 -0000	1.31
+++ config.cgi	25 Sep 2009 10:14:30 -0000	1.32
@@ -267,9 +267,24 @@
     <td><input type="button" value="add" onClick="doadd<% "$key$n" %>(this.form)"></td>
   </tr></table>
 
+%   } elsif ( $element_types{$type} ) {
+%
+%     my %opt = ( 'element_name' => "$key$n",
+%                 'empty_label'  => ' ',
+%               );
+%     if ( $config_item->multiple ) {
+%       $opt{'multiple'} = 1 if $config_item->multiple;
+%       $opt{'curr_value'} = [ $conf->config($key, $agentnum) ];
+%     } else {
+%       $opt{'curr_value'} = 
+%         $conf->exists($key, $agentnum) ? $conf->config($key, $agentnum) : '';
+%     }
+
+      <% include("/elements/$type.html", %opt ) %>
+
 %   } else {
 
-  <font color="#ff0000">unknown type <% $type %></font>
+      <font color="#ff0000">unknown type <% $type %></font>
 
 %   }
 % $n++;
@@ -292,6 +307,10 @@
 my @config_items = $conf->config_items; 
 my %confitems = map { $_->key => $_ } @config_items;
 
+my %element_types = map { $_ => 1 } qw(
+  select-part_svc
+);
+
 </%once>
 <%init>
 



More information about the freeside-commits mailing list