diff options
author | Mark Wells <mark@freeside.biz> | 2012-06-13 16:18:49 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2012-06-13 16:18:49 -0700 |
commit | 9ef78be87df0f0f880ff5d903ed6243b67369cf0 (patch) | |
tree | e69278b1e33baf2b9c0356ed31435fc0f0188b01 /httemplate | |
parent | daa09251fec52517b630b3f6935041dc7c795f90 (diff) |
table of FTP targets for invoice spool upload, #17620
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/browse/ftp_target.html | 56 | ||||
-rwxr-xr-x | httemplate/edit/ftp_target.html | 46 | ||||
-rw-r--r-- | httemplate/edit/process/ftp_target.html | 12 | ||||
-rw-r--r-- | httemplate/elements/menu.html | 3 | ||||
-rw-r--r-- | httemplate/misc/delete-ftp_target.html | 18 |
5 files changed, 135 insertions, 0 deletions
diff --git a/httemplate/browse/ftp_target.html b/httemplate/browse/ftp_target.html new file mode 100644 index 000000000..4a5782058 --- /dev/null +++ b/httemplate/browse/ftp_target.html @@ -0,0 +1,56 @@ +<& elements/browse.html, + 'title' => 'FTP targets', + 'menubar' => [ 'Add a target' => $p.'edit/ftp_target.html', ], + 'name' => 'FTP targets', + 'query' => { 'table' => 'ftp_target', + 'hashref' => {}, + }, + 'count_query' => $count_query, + 'header' => [ '#', + 'Server', + 'Username', + 'Password', + 'Path', + 'Protocol', + '', #handling + ], + 'fields' => [ 'targetnum', + 'hostname', + 'username', + 'password', + 'path', + sub { + my $ftp_target = shift; + my $label; + if ($ftp_target->secure) { + $label = 'SFTP'; + $label .= ' (port '.$ftp_target->port.')' + if $ftp_target->port != 22; + } + else { + $label = 'FTP'; + $label .= ' (port '.$ftp_target->port.')' + if $ftp_target->port != 21; + } + $label; + }, + 'handling', + ], + 'links' => [ $link, $link ], +&> +</TABLE> + +<% include('/elements/footer.html') %> + +<%once> + +my $count_query = 'SELECT COUNT(*) FROM ftp_target'; + +</%once> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my $link = [ $p.'edit/ftp_target.html?', 'targetnum' ]; +</%init> diff --git a/httemplate/edit/ftp_target.html b/httemplate/edit/ftp_target.html new file mode 100755 index 000000000..aebf9aaed --- /dev/null +++ b/httemplate/edit/ftp_target.html @@ -0,0 +1,46 @@ +<& elements/edit.html, + 'post_url' => popurl(1).'process/ftp_target.html', + 'name' => 'FTP target', + 'table' => 'ftp_target', + 'viewall_url' => "${p}browse/ftp_target.html", + 'labels' => { targetnum => 'Target', + hostname => 'Server', + username => 'Username', + password => 'Password', + path => 'Directory', + port => 'Port', + secure => 'Use SFTP', + handling => 'Special handling', + }, + 'fields' => [ + { field => 'hostname', size => 40 }, + { field => 'port', size => 8 }, + { field => 'secure', type => 'checkbox', value => 'Y' }, + 'username', + 'password', + { field => 'path', size => 40 }, + { field => 'handling', + type => 'select', + options => [ FS::ftp_target->handling_types ], + }, + ], + 'menubar' => \@menubar, + 'edit_callback' => $edit_callback, +&> +<%init> + +my $curuser = $FS::CurrentUser::CurrentUser; + +die "access denied" + unless $curuser->access_right('Configuration'); + +my @menubar = ('View all FTP targets' => $p.'browse/ftp_target.html'); +my $edit_callback = sub { + my ($cgi, $object) = @_; + if ( $object->targetnum ) { + push @menubar, 'Delete this target', + $p.'misc/delete-ftp_target.html?'.$object->targetnum; + } +}; + +</%init> diff --git a/httemplate/edit/process/ftp_target.html b/httemplate/edit/process/ftp_target.html new file mode 100644 index 000000000..35f56c490 --- /dev/null +++ b/httemplate/edit/process/ftp_target.html @@ -0,0 +1,12 @@ +<& elements/process.html, + 'table' => 'ftp_target', + 'viewall_dir' => 'browse', + 'agent_null' => 1, +&> +<%init> +my $curuser = $FS::CurrentUser::CurrentUser; + +die "access denied" + unless $curuser->access_right('Configuration'); + +</%init> diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index cf79af9d5..06f7d59ea 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -579,6 +579,9 @@ $config_misc{'Inventory classes and inventory'} = [ $fsurl.'browse/inventory_cla || $curuser->access_right('Edit global inventory') || $curuser->access_right('Configuration'); +$config_misc{'FTP targets'} = [ $fsurl.'browse/ftp_target.html', 'FTP servers for billing and payment processing' ] + if $curuser->access_right('Configuration'); + tie my %config_menu, 'Tie::IxHash'; if ( $curuser->access_right('Configuration' ) ) { %config_menu = ( diff --git a/httemplate/misc/delete-ftp_target.html b/httemplate/misc/delete-ftp_target.html new file mode 100644 index 000000000..c8bd29701 --- /dev/null +++ b/httemplate/misc/delete-ftp_target.html @@ -0,0 +1,18 @@ +% if ( $error ) { +% errorpage($error); +% } else { +<% $cgi->redirect("${p}browse/ftp_target.html") %> +% } +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my($query) = $cgi->keywords; +$query =~ /^(\d+)$/ || die "Illegal targetnum"; +my $targetnum = $1; + +my $target = qsearchs('ftp_target',{'targetnum'=>$targetnum}); +my $error = $target->delete; + +</%init> |