diff options
-rw-r--r-- | FS/FS/part_export.pm | 26 | ||||
-rw-r--r-- | httemplate/edit/part_export.cgi | 23 |
2 files changed, 41 insertions, 8 deletions
diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm index bf6072089..7661d7e10 100644 --- a/FS/FS/part_export.pm +++ b/FS/FS/part_export.pm @@ -514,6 +514,20 @@ sub exporttype2svcdb { ''; } +tie my %sysvshell_options, 'Tie::IxHash', + 'crypt' => { label=>'Password encryption', + type=>'select', options=>[qw(crypt md5)], + default=>'crypt', + }, +; + +tie my %bsdshell_options, 'Tie::IxHash', + 'crypt' => { label=>'Password encryption', + type=>'select', options=>[qw(crypt md5)], + default=>'crypt', + }, +; + tie my %shellcommands_options, 'Tie::IxHash', #'machine' => { label=>'Remote machine' }, 'user' => { label=>'Remote username', default=>'root' }, @@ -599,12 +613,16 @@ tie my %sqlmail_options, 'Tie::IxHash', 'sysvshell' => { 'desc' => 'Batch export of /etc/passwd and /etc/shadow files (Linux/SysV)', - 'options' => {}, + 'options' => \%sysvshell_options, + 'nodomain' => 'Y', + 'notes' => 'MD5 crypt requires installation of <a href="http://search.cpan.org/search?dist=Crypt-PasswdMD5">Crypt::PasswdMD5</a> from CPAN.', }, 'bsdshell' => { 'desc' => 'Batch export of /etc/passwd and /etc/master.passwd files (BSD)', - 'options' => {}, + 'options' => \%bsdshell_options, + 'nodomain' => 'Y', + 'notes' => 'MD5 crypt requires installation of <a href="http://search.cpan.org/search?dist=Crypt-PasswdMD5">Crypt::PasswdMD5</a> from CPAN.', }, # 'nis' => { # 'desc' => @@ -614,6 +632,7 @@ tie my %sqlmail_options, 'Tie::IxHash', 'textradius' => { 'desc' => 'Batch export of a text /etc/raddb/users file (Livingston, Cistron)', 'options' => {}, + 'notes' => 'unfinished...', }, 'shellcommands' => { @@ -634,8 +653,7 @@ tie my %sqlmail_options, 'Tie::IxHash', 'desc' => 'Real-time export to SQL-backed mail server', 'options' => \%sqlmail_options, 'nodomain' => 'Y', - 'notes' => 'Database schema can be made to work with Courier IMAP and - Exim. Others could work but are untested.', + 'notes' => 'Database schema can be made to work with Courier IMAP and Exim. Others could work but are untested.', }, 'cyrus' => { diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index af89c4ead..fbc698e8b 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -45,15 +45,30 @@ my $widget = new HTML::Widgets::SelectLayers( if $layer; foreach my $option ( keys %{$exports->{$layer}{options}} ) { -# foreach my $option ( qw(url login password groupID ) ) { my $optinfo = $exports->{$layer}{options}{$option}; my $label = $optinfo->{label}; + my $type = defined($optinfo->{type}) ? $optinfo->{type} : 'text'; my $value = $cgi->param($option) || $part_export->option($option) || (exists $optinfo->{default} ? $optinfo->{default} : ''); - $html .= qq!<TR><TD ALIGN="right">$label</TD>!. - qq!<TD><INPUT TYPE="text" NAME="$option" VALUE="$value" SIZE=64></TD>!. - '</TR>'; + $html .= qq!<TR><TD ALIGN="right">$label</TD><TD>!; + if ( $type eq 'select' ) { + $html .= qq!<SELECT NAME="$option">!; + foreach my $select_option ( @{$optinfo->{options}} ) { + #if ( ref($select_option) ) { + #} else { + $selected = $select_option eq $value ? ' SELECTED' : ''; + $html .= qq!<OPTION VALUE="$select_option"$selected>!. + qq!$select_option</OPTION>!; + #} + } + $html .= '</SELECT>'; + } elsif ( $type eq 'text' ) { + $html .= qq!<INPUT TYPE="text" NAME="$option" VALUE="$value" SIZE=64>!; + } else { + $html .= "unknown type $type"; + } + $html .= '</TD></TR>'; } $html .= '</TABLE>'; |