broadband_snmp export: better MIB selection
[freeside.git] / httemplate / browse / part_export.cgi
1 <% include("/elements/header.html", "Export Listing") %>
2
3 Provisioning services to external machines, databases and APIs.<BR><BR>
4
5 <A HREF="<% $p %>edit/part_export.cgi"><I>Add a new export</I></A><BR><BR>
6
7 <SCRIPT>
8 function part_export_areyousure(href) {
9   if (confirm("Are you sure you want to delete this export?") == true)
10     window.location.href = href;
11 }
12 </SCRIPT>
13
14 <% include('/elements/table-grid.html') %>
15 % my $bgcolor1 = '#eeeeee';
16 %   my $bgcolor2 = '#ffffff';
17 %   my $bgcolor = '';
18
19   <TR>
20     <TH COLSPAN=2 CLASS="grid" BGCOLOR="#cccccc">Export</TH>
21     <TH CLASS="grid" BGCOLOR="#cccccc">Options</TH>
22   </TR>
23
24 % foreach my $part_export ( sort { 
25 %     $a->getfield('exportnum') <=> $b->getfield('exportnum')
26 %   } qsearch('part_export',{})
27 % ) {
28 %   if ( $bgcolor eq $bgcolor1 ) {
29 %     $bgcolor = $bgcolor2;
30 %   } else {
31 %     $bgcolor = $bgcolor1;
32 %   }
33
34     <TR>
35
36       <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><A HREF="<% $p %>edit/part_export.cgi?<% $part_export->exportnum %>"><% $part_export->exportnum %></A></TD>
37
38       <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
39         <% $part_export->label_html %>
40         (<A HREF="<% $p %>edit/part_export.cgi?<% $part_export->exportnum %>">edit</A>&nbsp;|&nbsp;<A HREF="javascript:part_export_areyousure('<% $p %>misc/delete-part_export.cgi?<% $part_export->exportnum %>')">delete</A>)
41       </TD>
42
43       <TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
44         <% itable() %>
45 %         my %opt = $part_export->options;
46 %         my $defs = $part_export->info->{options};
47 %         my %multiples;
48 %         foreach my $opt (keys %$defs) { # is a Tie::IxHash
49 %           my $group = $defs->{$opt}->{multiple};
50 %           if ( $group ) {
51 %             my @values = split("\n", $opt{$opt});
52 %             $multiples{$group} ||= [];
53 %             push @{ $multiples{$group} }, [ $opt, @values ] if @values;
54 %             delete $opt{$opt};
55 %           } elsif (length($opt{$opt})) { # the normal case
56 %#         foreach my $opt ( keys %opt ) { 
57   
58             <TR>
59               <TD ALIGN="right" VALIGN="top" WIDTH="33%"><% $opt %>:&nbsp;</TD>
60               <TD ALIGN="left" WIDTH="67%"><% encode_entities($opt{$opt}) %></TD>
61             </TR>
62 %             delete $opt{$opt};
63 %           }
64 %         }
65 %         # now any that are somehow not in the options list
66 %         foreach my $opt (keys %opt) {
67 %           if ( length($opt{$opt}) ) {
68             <TR>
69               <TD ALIGN="right" VALIGN="top" WIDTH="33%"><% $opt %>:&nbsp;</TD>
70               <TD ALIGN="left" WIDTH="67%"><% encode_entities($opt{$opt}) %></TD>
71             </TR>
72 %           }
73 %         }
74 %         # now show any multiple-option groups
75 %         foreach (sort keys %multiples) {
76 %           my $set = $multiples{$_};
77             <TR><TD ALIGN="center" COLSPAN=2><TABLE CLASS="grid">
78               <TR>
79 %             foreach my $col (@$set) {
80                 <TH><% shift @$col %></TH>
81 %             }
82               </TR>
83 %           while ( 1 ) {
84               <TR>
85 %             my $end = 1;
86 %             foreach my $col (@$set) {
87                 <TD><% shift @$col %></TD>
88 %               $end = 0 if @$col;
89 %             }
90               </TR>
91 %             last if $end;
92 %           }
93             </TABLE></TD></TR>
94 %         } #foreach keys %multiples
95
96         </TABLE>
97       </TD>
98
99     </TR>
100
101 % } 
102
103 </TABLE>
104
105 <% include('/elements/footer.html') %>
106
107 <%init>
108 die "access denied"
109   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
110 </%init>