don't redirect to a GET with sensitive data, RT#26099
[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 % if( $part_export->exportname ) {
40   <B><% $part_export->exportname %>:</B><BR>
41 % }
42 <% $part_export->exporttype %> to <% $part_export->machine %> (<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>)</TD>
43
44       <TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
45         <% itable() %>
46 %         my %opt = $part_export->options;
47 %         my $defs = $part_export->info->{options};
48 %         my %multiples;
49 %         foreach my $opt (keys %$defs) { # is a Tie::IxHash
50 %           my $group = $defs->{$opt}->{multiple};
51 %           if ( $group ) {
52 %             my @values = split("\n", $opt{$opt});
53 %             $multiples{$group} ||= [];
54 %             push @{ $multiples{$group} }, [ $opt, @values ] if @values;
55 %             delete $opt{$opt};
56 %           } elsif (length($opt{$opt})) { # the normal case
57 %#         foreach my $opt ( keys %opt ) { 
58   
59             <TR>
60               <TD ALIGN="right" VALIGN="top" WIDTH="33%"><% $opt %>:&nbsp;</TD>
61               <TD ALIGN="left" WIDTH="67%"><% encode_entities($opt{$opt}) %></TD>
62             </TR>
63 %             delete $opt{$opt};
64 %           }
65 %         }
66 %         # now any that are somehow not in the options list
67 %         foreach my $opt (keys %opt) {
68 %           if ( length($opt{$opt}) ) {
69             <TR>
70               <TD ALIGN="right" VALIGN="top" WIDTH="33%"><% $opt %>:&nbsp;</TD>
71               <TD ALIGN="left" WIDTH="67%"><% encode_entities($opt{$opt}) %></TD>
72             </TR>
73 %           }
74 %         }
75 %         # now show any multiple-option groups
76 %         foreach (sort keys %multiples) {
77 %           my $set = $multiples{$_};
78             <TR><TD ALIGN="center" COLSPAN=2><TABLE CLASS="grid">
79               <TR>
80 %             foreach my $col (@$set) {
81                 <TH><% shift @$col %></TH>
82 %             }
83               </TR>
84 %           while ( 1 ) {
85               <TR>
86 %             my $end = 1;
87 %             foreach my $col (@$set) {
88                 <TD><% shift @$col %></TD>
89 %               $end = 0 if @$col;
90 %             }
91               </TR>
92 %             last if $end;
93 %           }
94             </TABLE></TD></TR>
95 %         } #foreach keys %multiples
96
97         </TABLE>
98       </TD>
99
100     </TR>
101
102 % } 
103
104 </TABLE>
105
106 <% include('/elements/footer.html') %>
107
108 <%init>
109 die "access denied"
110   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
111 </%init>