broadband_snmp export: better MIB selection
[freeside.git] / httemplate / browse / part_export.cgi
index b7ecc00..91238a0 100755 (executable)
@@ -43,14 +43,56 @@ function part_export_areyousure(href) {
       <TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
         <% itable() %>
 %         my %opt = $part_export->options;
-%         foreach my $opt ( keys %opt ) { 
+%         my $defs = $part_export->info->{options};
+%         my %multiples;
+%         foreach my $opt (keys %$defs) { # is a Tie::IxHash
+%           my $group = $defs->{$opt}->{multiple};
+%           if ( $group ) {
+%             my @values = split("\n", $opt{$opt});
+%             $multiples{$group} ||= [];
+%             push @{ $multiples{$group} }, [ $opt, @values ] if @values;
+%             delete $opt{$opt};
+%           } elsif (length($opt{$opt})) { # the normal case
+%#         foreach my $opt ( keys %opt ) { 
   
             <TR>
               <TD ALIGN="right" VALIGN="top" WIDTH="33%"><% $opt %>:&nbsp;</TD>
               <TD ALIGN="left" WIDTH="67%"><% encode_entities($opt{$opt}) %></TD>
             </TR>
-%         } 
-  
+%             delete $opt{$opt};
+%           }
+%         }
+%         # now any that are somehow not in the options list
+%         foreach my $opt (keys %opt) {
+%           if ( length($opt{$opt}) ) {
+            <TR>
+              <TD ALIGN="right" VALIGN="top" WIDTH="33%"><% $opt %>:&nbsp;</TD>
+              <TD ALIGN="left" WIDTH="67%"><% encode_entities($opt{$opt}) %></TD>
+            </TR>
+%           }
+%         }
+%         # now show any multiple-option groups
+%         foreach (sort keys %multiples) {
+%           my $set = $multiples{$_};
+            <TR><TD ALIGN="center" COLSPAN=2><TABLE CLASS="grid">
+              <TR>
+%             foreach my $col (@$set) {
+                <TH><% shift @$col %></TH>
+%             }
+              </TR>
+%           while ( 1 ) {
+              <TR>
+%             my $end = 1;
+%             foreach my $col (@$set) {
+                <TD><% shift @$col %></TD>
+%               $end = 0 if @$col;
+%             }
+              </TR>
+%             last if $end;
+%           }
+            </TABLE></TD></TR>
+%         } #foreach keys %multiples
+
         </TABLE>
       </TD>