4 #if ( $cgi->param('clone') && $cgi->param('clone') =~ /^(\d+)$/ ) {
5 # $cgi->param('clone', $1);
7 # $cgi->param('clone', '');
9 #if ( $cgi->param('svcpart') && $cgi->param('svcpart') =~ /^(\d+)$/ ) {
10 # $cgi->param('svcpart', $1);
12 # $cgi->param('svcpart', '');
15 my($query) = $cgi->keywords;
19 if ( $cgi->param('error') ) {
20 $part_export = new FS::part_export ( {
21 map { $_, scalar($cgi->param($_)) } fields('part_export')
26 if ( $cgi->param('clone') && $cgi->param('clone') =~ /^(\d+)$/ ) {
28 my $old_part_export = qsearchs('part_export', { 'exportnum' => $1 } );
29 unless ( $part_export ) {
30 ($part_export, $options) = $old_part_export->clone;
32 } elsif ( $cgi->param('new_with_svcpart')
33 && $cgi->param('new_with_svcpart') =~ /^(\d+)$/ ) {
34 $part_export ||= new FS::part_export ( { 'svcpart' => $1 } );
35 } elsif ( $query =~ /^(\d+)$/ ) {
36 $part_export ||= qsearchs('part_export', { 'exportnum' => $1 } );
38 $action ||= $part_export->exportnum ? 'Edit' : 'Add';
44 'Batch export of /etc/passwd and /etc/shadow files (Linux/SysV)',
49 'Batch export of /etc/passwd and /etc/master.passwd files (BSD)',
54 # 'Batch export of /etc/global/passwd and /etc/global/shadow for NIS ',
59 'Batch export of /etc/passwd and /etc/master.passwd files (BSD)',
63 'desc' => 'Batch export of a text /etc/raddb/users file (Livingston, Cistron)',
66 'desc' => 'Real-time export to SQL-backed RADIUS (ICRADIUS, FreeRADIUS)',
68 'datasrc' => { label=>'DBI data source' },
69 'username' => { label=>'Database username' },
70 'password' => { label=>'Database password' },
73 'notes' => 'Not specifying datasrc will export to the freeside database? (no... notes on MySQL replication, DBI::Proxy, etc., from Conf.pm && export.html etc.',
76 'desc' => 'Real-time export to Cyrus IMAP server',
79 'desc' => 'Real-time export to Critical Path Account Provisioning Protocol',
82 'desc' => 'Real-time export to InfoStreet streetSmartAPI',
84 'url' => { label=>'XML-RPC Access URL', },
85 'login' => { label=>'InfoStreet login', },
86 'password' => { label=>'InfoStreet password', },
87 'groupID' => { label=>'InfoStreet groupID', },
90 'notes' => 'http://www.infostreet.com/ .... install Frontier::Client',
104 my $svcdb = $part_export->part_svc->svcdb;
105 my %layers = map { $_ => "$_ - ". $exports{$svcdb}{$_}{desc} }
106 keys %{$exports{$svcdb}};
109 my $widget = new HTML::Widgets::SelectLayers(
110 'selected_layer' => $part_export->exporttype,
111 'selected_layer' => $part_export->exporttype,
112 'options' => \%layers,
113 'form_name' => 'dummy',
114 'form_action' => 'process/part_export.cgi',
115 'form_text' => [qw( exportnum svcpart machine )],
116 # 'form_checkbox' => [qw()],
117 'html_between' => "</TD></TR></TABLE>\n",
118 'layer_callback' => sub {
120 my $html = qq!<INPUT TYPE="hidden" NAME="exporttype" VALUE="$layer">!.
122 foreach my $option ( keys %{$exports{$svcdb}->{$layer}{options}} ) {
123 # foreach my $option ( qw(url login password groupID ) ) {
124 my $optinfo = $exports{$svcdb}->{$layer}{options}{$option};
125 my $label = $optinfo->{label};
126 my $value = $part_export->option($option);
127 $html .= qq!<TR><TD ALIGN="right">$label</TD><TD>!.
128 qq!<TD><INPUT TYPE="text" NAME="$option" VALUE="$value"></TD>!.
133 $html .= '<INPUT TYPE="hidden" NAME="options" VALUE="'.
134 join(',', keys %{$exports{$svcdb}->{$layer}{options}} ). '">';
136 $html .= '<INPUT TYPE="hidden" NAME="nodomain" VALUE="'.
137 $exports{$svcdb}->{$layer}{nodomain}. '">';
139 $html .= '<INPUT TYPE="submit" VALUE="'.
140 ( $part_export->exportnum ? "Apply changes" : "Add export" ).
148 <%= header("$action Export", menubar(
149 'Main Menu' => popurl(2),
150 ), ' onLoad="visualize()"')
153 <% if ( $cgi->param('error') ) { %>
154 <FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT>
159 <INPUT TYPE="hidden" NAME="exportnum" VALUE="<%= $part_export->exportnum %>">
161 <%= ntable("#cccccc",2) %>
163 <TD ALIGN="right">Service</TD>
164 <TD BGCOLOR="#ffffff">
165 <%= $part_export->svcpart %> - <%= $part_export->part_svc->svc %>
166 <INPUT TYPE="hidden" NAME="svcpart" VALUE="<%= $part_export->svcpart %>">
170 <TD ALIGN="right">Export host</TD>
172 <INPUT TYPE="text" NAME="machine" VALUE="<%= $part_export->machine %>">
176 <TD ALIGN="right">Export</TD>
177 <TD><%= $widget->html %>