From 1e1a0a1a7945cae26175e3afe25e61ec6114c48e Mon Sep 17 00:00:00 2001 From: mark Date: Mon, 31 Oct 2011 19:20:29 +0000 Subject: export NAS table to sqlradius, #14697 --- httemplate/edit/nas.html | 25 ++++++++++++++++++++++--- httemplate/edit/part_export.cgi | 20 ++++++++++++++++++++ httemplate/edit/process/nas.html | 7 ++++++- httemplate/edit/process/part_export.cgi | 10 ++++++++++ 4 files changed, 58 insertions(+), 4 deletions(-) (limited to 'httemplate/edit') diff --git a/httemplate/edit/nas.html b/httemplate/edit/nas.html index 64d722e52..9d9b8e9fd 100644 --- a/httemplate/edit/nas.html +++ b/httemplate/edit/nas.html @@ -8,7 +8,7 @@ 'secret' => 'Shared secret', 'type' => 'Type', 'ports' => 'Ports', - 'server' => 'Server', + 'server' => 'Virtual server', 'community' => 'Community', 'description' => 'Description', }, @@ -25,8 +25,7 @@ { field=>'community', size=>40, maxlength=>50 }, { field=>'description', size=>100, maxlength=>200 }, ], - 'html_bottom' => '* '. - emt('required fields'). '
', + 'html_bottom' => \&html_bottom, 'new_hashref_callback' => sub { +{ 'type' => 'other', 'secret' => 'secret', 'description' => 'RADIUS Client', @@ -38,4 +37,24 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); +sub html_bottom { + my $nas = shift; + '* '. + emt('required fields'). '

'. + ''.emt('Export to these RADIUS servers:'). + '
'. + + include('/elements/checkboxes-table.html', + 'source_obj' => $nas, + 'link_table' => 'export_nas', + 'target_table' => 'part_export', + 'hashref' => { 'exporttype' => 'sqlradius' }, + 'name_callback' => sub { $_[0]->label }, + 'default' => 'yes', + 'target_link' => $p.'edit/part_export.cgi?', + 'disable-able' => 1, + ) +} + + diff --git a/httemplate/edit/part_export.cgi b/httemplate/edit/part_export.cgi index 32ed1fc94..9a0e0bd29 100644 --- a/httemplate/edit/part_export.cgi +++ b/httemplate/edit/part_export.cgi @@ -139,6 +139,26 @@ my $widget = new HTML::Widgets::SelectLayers( $html .= ''; } } + + if ( $exports->{$layer}{nas} and qsearch('nas',{}) ) { + # show NAS checkboxes + $html .= 'Export RADIUS clients'; + + $html .= include('/elements/checkboxes-table.html', + 'source_obj' => $part_export, + 'link_table' => 'export_nas', + 'target_table' => 'nas', + #hashref => {}, + 'name_callback' => sub { + $_[0]->shortname . ' (' . $_[0]->nasname . ')', + }, + 'default' => 'yes', + 'target_link' => $p.'edit/nas.html?', + ); + + $html .= ''; + } + $html .= ''; $html .= 'exportnum; } +my $info = FS::part_export::export_info()->{$new->exporttype}; +if ( $info->{nas} ) { + my @nasnums = map { /^nasnum(\d+)$/ ? $1 : () } keys %{ $cgi->Vars }; + $error ||= $new->process_m2m( + link_table => 'export_nas', + target_table => 'nas', + params => \@nasnums + ); +} + -- cgit v1.2.1