summaryrefslogtreecommitdiff
path: root/httemplate/edit/ftp_target.html
blob: aebf9aaedfb52119765e1c2093fad1c15780ab7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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>