4 #if ( $cgi->param('clone') && $cgi->param('clone') =~ /^(\d+)$/ ) {
5 # $cgi->param('clone', $1);
7 # $cgi->param('clone', '');
10 my($query) = $cgi->keywords;
13 if ( $cgi->param('error') ) {
14 $part_export = new FS::part_export ( {
15 map { $_, scalar($cgi->param($_)) } fields('part_export')
17 } elsif ( $query =~ /^(\d+)$/ ) {
18 $part_export = qsearchs('part_export', { 'exportnum' => $1 } );
20 $part_export = new FS::part_export;
22 $action ||= $part_export->exportnum ? 'Edit' : 'Add';
24 #my $exports = FS::part_export::export_info($svcdb);
25 my $exports = FS::part_export::export_info();
27 my %layers = map { $_ => "$_ - ". $exports->{$_}{desc} } keys %$exports;
30 my $widget = new HTML::Widgets::SelectLayers(
31 'selected_layer' => $part_export->exporttype,
32 'options' => \%layers,
33 'form_name' => 'dummy',
34 'form_action' => 'process/part_export.cgi',
35 'form_text' => [qw( exportnum machine )],
36 # 'form_checkbox' => [qw()],
37 'html_between' => "</TD></TR></TABLE>\n",
38 'layer_callback' => sub {
40 my $html = qq!<INPUT TYPE="hidden" NAME="exporttype" VALUE="$layer">!.
43 $html .= '<TR><TD ALIGN="right">Description</TD><TD BGCOLOR=#ffffff>'.
44 $exports->{$layer}{notes}. '</TD></TR>'
47 foreach my $option ( keys %{$exports->{$layer}{options}} ) {
48 # foreach my $option ( qw(url login password groupID ) ) {
49 my $optinfo = $exports->{$layer}{options}{$option};
50 my $label = $optinfo->{label};
51 my $value = $cgi->param($option)
52 || $part_export->option($option)
53 || (exists $optinfo->{default} ? $optinfo->{default} : '');
54 $html .= qq!<TR><TD ALIGN="right">$label</TD>!.
55 qq!<TD><INPUT TYPE="text" NAME="$option" VALUE="$value" SIZE=64></TD>!.
60 $html .= '<INPUT TYPE="hidden" NAME="options" VALUE="'.
61 join(',', keys %{$exports->{$layer}{options}} ). '">';
63 $html .= '<INPUT TYPE="hidden" NAME="nodomain" VALUE="'.
64 $exports->{$layer}{nodomain}. '">';
66 $html .= '<INPUT TYPE="submit" VALUE="'.
67 ( $part_export->exportnum ? "Apply changes" : "Add export" ).
75 <%= header("$action Export", menubar(
76 'Main Menu' => popurl(2),
77 ), ' onLoad="visualize()"')
80 <% if ( $cgi->param('error') ) { %>
81 <FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT>
86 <INPUT TYPE="hidden" NAME="exportnum" VALUE="<%= $part_export->exportnum %>">
88 <%= ntable("#cccccc",2) %>
90 <TD ALIGN="right">Export host</TD>
92 <INPUT TYPE="text" NAME="machine" VALUE="<%= $part_export->machine %>">
96 <TD ALIGN="right">Export</TD>
97 <TD><%= $widget->html %>