enable CardFortress in test database, #71513
[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 %       if ( $part_export->no_suspend ) {
42         <P STYLE="position: absolute">
43         This export will not suspend services.
44         </P>
45 %       }
46 %       if ( my @actions = $part_export->actions ) {
47         <P STYLE="position: absolute">
48         Management:
49 %         while (@actions) {
50 %           my $label = shift @actions;
51 %           my $path = shift @actions;
52             <& /elements/popup_link.html,
53               'label'       => $label,
54               'action'      => $fsurl.$path.'?'.$part_export->exportnum,
55               'actionlabel' => $label,
56             &><% @actions ? '&nbsp;|&nbsp;' : '' %>
57 %         }
58         </P>
59 %       } #if @actions
60
61       </TD>
62
63       <TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
64         <% itable() %>
65 %         my %opt = $part_export->options;
66 %         my $defs = $part_export->info->{options};
67 %         my %multiples;
68 %         foreach my $optname (keys %$defs) { # is a Tie::IxHash
69 %           my $def = $defs->{$optname};
70 %           my $group = $def->{multiple};
71 %           if ( $group ) {
72 %             my @values = split("\n", $opt{$optname});
73 %             $multiples{$group} ||= [];
74 %             push @{ $multiples{$group} }, [ $def->{label} || $optname, @values ] if @values;
75 %             delete $opt{$optname};
76 %           } elsif (length($opt{$optname})) { # the normal case
77 %             my $value = $opt{$optname};
78 %             if ( $def->{option_labels} ) {
79 %               $value = $def->{option_labels}->{$value} || $value;
80 %             }
81   
82             <TR>
83               <TD ALIGN="right" VALIGN="top" WIDTH="33%"><% $optname %>:&nbsp;</TD>
84               <TD ALIGN="left" WIDTH="67%"><% encode_entities($value) %></TD>
85             </TR>
86 %             delete $opt{$optname};
87 %           }
88 %         }
89 %         # now any that are somehow not in the options list
90 %         foreach my $opt (keys %opt) {
91 %           if ( length($opt{$opt}) ) {
92             <TR>
93               <TD ALIGN="right" VALIGN="top" WIDTH="33%"><% $opt %>:&nbsp;</TD>
94               <TD ALIGN="left" WIDTH="67%"><% encode_entities($opt{$opt}) %></TD>
95             </TR>
96 %           }
97 %         }
98 %         # now show any multiple-option groups
99 %         foreach (sort keys %multiples) {
100 %           my $set = $multiples{$_};
101             <TR><TD ALIGN="center" COLSPAN=2><TABLE CLASS="grid">
102               <TR>
103 %             foreach my $col (@$set) {
104                 <TH><% shift @$col %></TH>
105 %             }
106               </TR>
107 %           while ( 1 ) {
108               <TR>
109 %             my $end = 1;
110 %             foreach my $col (@$set) {
111                 <TD><% shift @$col %></TD>
112 %               $end = 0 if @$col;
113 %             }
114               </TR>
115 %             last if $end;
116 %           }
117             </TABLE></TD></TR>
118 %         } #foreach keys %multiples
119
120         </TABLE>
121       </TD>
122
123     </TR>
124
125 % } 
126
127 </TABLE>
128
129 <% include('/elements/footer.html') %>
130
131 <%init>
132 die "access denied"
133   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
134 </%init>