X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fsvc_acct.cgi;h=27ea3c5eabac5a594cb20247ede57ced5922352d;hp=1271237dfb69d9e00013124f863c967ffeb5b187;hb=11bbf29de447fe39e9d7155fe280a0df70fa8c3c;hpb=9324c64e784a866c4d615773c8ce5970cc0d6ed8 diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 1271237df..27ea3c5ea 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -9,19 +9,6 @@
% } - -
@@ -43,8 +30,9 @@ function randomPass() { <% $part_svc->svc %> - - <% mt('Username') |h %> +<% include('/elements/tr-td-label.html', + 'label' => $part_svc->part_svc_column('username')->columnlabel || mt('Username'), + 'required' => $part_svc->part_svc_column('username')->required ) %> % if ( $svcnum && $conf->exists('svc_acct-no_edit_username') ) { <% $svc_acct->username() %> @@ -56,11 +44,18 @@ function randomPass() { %if ( $part_svc->part_svc_column('_password')->columnflag ne 'F' ) { - - <% mt('Password') |h %> +% #XXX eventually should require "Edit Password" ACL +<% include('/elements/tr-td-label.html', + 'label' => $part_svc->part_svc_column('_password')->columnlabel || mt('Password'), + 'required' => $part_svc->part_svc_column('_password')->required ) %> - MAXLENGTH=<% $pmax %>> - + MAXLENGTH=<% $pmax %>> + <& /elements/random_pass.html, 'clear_password' &>
+
+ <& '/elements/validate_password.html', + 'fieldid' => 'clear_password', + 'svcnum' => $svcnum + &> %}else{ @@ -72,8 +67,9 @@ function randomPass() { %if ( $conf->exists('security_phrase') % && $part_svc->part_svc_column('sec_phrase')->columnflag ne 'F' ) { - - <% mt('Security phrase') |h %> +<% include('/elements/tr-td-label.html', + 'label' => $part_svc->part_svc_column('sec_phrase')->columnlabel || mt('Security phrase'), + 'required' => $part_svc->part_svc_column('sec_phrase')->required ) %> (<% mt('for forgotten passwords') |h %>) @@ -97,7 +93,7 @@ function randomPass() { % if ( $domsvc ) { % my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $domsvc, } ); % if ( $svc_domain ) { -% $svc_domain{$svc_domain->svcnum} = $svc_domain; +% $svc_domain{$svc_domain->svcnum} = $svc_domain->domain; % } else { % warn "unknown svc_domain.svcnum for svc_acct.domsvc: $domsvc"; % } @@ -109,8 +105,9 @@ function randomPass() { % ) % ); - - <% mt('Domain') |h %> +<% include('/elements/tr-td-label.html', + 'label' => $part_svc->part_svc_column('domsvc')->columnlabel || mt('Domain'), + 'required' => $part_svc->part_svc_column('domsvc')->required ) %> % } else { - - <% mt('Access number') |h %> +<% include('/elements/tr-td-label.html', + 'label' => $part_svc->part_svc_column('popnum')->columnlabel || mt('Access number'), + 'required' => $part_svc->part_svc_column('popnum')->required ) %> <% FS::svc_acct_pop::popselector($popnum) %> % } + +%#tower (huh) +%if ( $conf->exists('svc_acct-tower_sector') +% && $part_svc->part_svc_column('sectornum')->columnflag ne 'F' ) { + <& /elements/tr-select-tower_sector.html, + 'curr_value' => $svc_acct->sectornum, + #'part_svc' => $part_svc, + #'cust_pkg' => $cust_pkg, + 'required' => $part_svc->part_svc_column('sectornum')->required, + 'label' => $part_svc->part_svc_column('sectornum')->columnlabel || mt('Tower sector'), + &> +%} else { + +%} + +<& /elements/tr-svc_export_machine.html, + 'svc' => $svc_acct, + 'part_svc' => $part_svc, + 'cgi' => $cgi, +&> + % #uid/gid % foreach my $xid (qw( uid gid )) { % @@ -169,8 +189,11 @@ function randomPass() { % % if ( length($svc_acct->$xid()) ) { - - <% uc($xid) %> +<% include('/elements/tr-td-label.html', + 'label' => $part_svc->part_svc_column($xid)->columnlabel || uc($xid), + 'required' => $part_svc->part_svc_column($xid)->required ) %> +%# +%# <% uc($xid) %> <% $svc_acct->$xid() %> @@ -180,8 +203,9 @@ function randomPass() { % } else { - - <% uc($xid) %> +<% include('/elements/tr-td-label.html', + 'label' => $part_svc->part_svc_column($xid)->columnlabel || uc($xid), + 'required' => $part_svc->part_svc_column($xid)->required ) %> @@ -198,8 +222,9 @@ function randomPass() { % } else { - - <% mt('Real Name') |h %> +<% include('/elements/tr-td-label.html', + 'label' => $part_svc->part_svc_column('finger')->columnlabel || mt('Real Name'), + 'required' => $part_svc->part_svc_column('finger')->required ) %> @@ -216,8 +241,9 @@ function randomPass() { % } else { - - <% mt('Home directory') |h %> +<% include('/elements/tr-td-label.html', + 'label' => $part_svc->part_svc_column('dir')->columnlabel || mt('Home directory'), + 'required' => $part_svc->part_svc_column('dir')->required ) %> % } @@ -233,8 +259,9 @@ function randomPass() { % } else { - - <% mt('Shell') |h %> +<% include('/elements/tr-td-label.html', + 'label' => $part_svc->part_svc_column('shell')->columnlabel || mt('Shell'), + 'required' => $part_svc->part_svc_column('shell')->required ) %> -% } else { - - <% mt('IP') |h %> - - -% } +% if ( $conf->exists('svc_acct-ip_addr') ) { +% # router/block selection UI +% # (should we show this if slipip is fixed?) +<& /elements/tr-select-router_block_ip.html, + 'object' => $svc_acct, + 'ip_field' => 'slipip', + 'required' => $part_svc->part_svc_column('routernum')->required, + 'label' => $part_svc->part_svc_column('routernum')->columnlabel, + 'ip_addr_required' => $part_svc->part_svc_column('slipip')->required, + 'ip_addr_label' => $part_svc->part_svc_column('slipip')->columnlabel, +&> +% } else { +% # don't expose these to the user--they're only useful in the other case + + +% if ( $part_svc->part_svc_column('slipip')->columnflag =~ /^[FA]$/ ) { + +% } else { +<% include('/elements/tr-td-label.html', + 'label' => $part_svc->part_svc_column('slipip')->columnlabel || mt('IP'), + 'required' => $part_svc->part_svc_column('slipip')->required ) %> + + +% } +% } -% my %label = ( seconds => 'Time', -% upbytes => 'Upload bytes', -% downbytes => 'Download bytes', -% totalbytes => 'Total bytes', -% ); +% tie my %label, 'Tie::IxHash', seconds => 'Time', +% upbytes => 'Upload bytes', +% downbytes => 'Download bytes', +% totalbytes => 'Total bytes', +% ; % foreach my $uf (keys %label) { % my $tf = $uf . "_threshold"; % if ( $curuser->access_right('Edit usage') ) { @@ -305,14 +349,15 @@ function randomPass() { % } - - <% mt('RADIUS groups') |h %> +<% include('/elements/tr-td-label.html', + 'label' => $part_svc->part_svc_column('usergroup')->columnlabel || mt('RADIUS groups'), + 'required' => $part_svc->part_svc_column('usergroup')->required ) %> % if ( $part_svc_usergroup->columnflag eq 'F' ) { <% join('
', @groupnames) %> % } else { % my $radius_group_selected = ''; % if ( $svc_acct->svcnum ) { -% $radius_group_selected = join(',',$svc_acct->radius_groups('NUMBERS')); +% $radius_group_selected = join(',',$svc_acct->radius_groups('groupnum')); % } % elsif ( !$svc_acct->svcnum && $part_svc_usergroup->columnflag eq 'D' ) { % $radius_group_selected = $part_svc_usergroup->columnvalue; @@ -320,11 +365,41 @@ function randomPass() { <& /elements/select-radius_group.html, curr_value => $radius_group_selected, element_name => 'radius_usergroup', + multiple => 1, &> % } + +% if ( $part_svc->has_router ) { +<& /elements/hidden.html, + field => 'router_routernum', + curr_value => $svc_acct->router_routernum +&> +<& /elements/tr-input-text.html, + label => 'Attached router name', + field => 'router_routername', + size => 32, + curr_value => $svc_acct->router_routername +&> +<& /elements/tr-select-table.html, + label => 'Attached address block', + field => 'router_blocknum', + table => 'addr_block', + hashref => { 'routernum' => '0' }, + extra_sql => ($svc_acct->router_routernum ? + ' OR routernum = '.$svc_acct->router_routernum : ''), + agent_virt => 1, + agent_null => 1, + name_col => 'cidr', + order_by => 'ORDER BY ip_gateway, ip_netmask', + empty_label => '(none)', + disable_empty => 0, + curr_value => $svc_acct->router_blocknum +&> +% } + % foreach my $field ($svc_acct->virtual_fields) { % # If the flag is X, it won't even show up in $svc_acct->virtual_fields. % if ( $part_svc->part_svc_column($field)->columnflag ne 'F' ) { @@ -452,18 +527,16 @@ my $part_svc_usergroup = $part_svc->part_svc_column('usergroup'); my @groupnames; # only used for display of Fixed RADIUS groups if ( $part_svc_usergroup->columnflag eq 'F' ) { @groups = split(',',$part_svc_usergroup->columnvalue); - @groupnames = map { $_->description . " (" . $_->groupname . ")" } + @groupnames = map { $_->long_description } qsearch({ 'table' => 'radius_group', 'extra_sql' => "where groupnum in (".$part_svc_usergroup->columnvalue.")", - }); + }) if length($part_svc_usergroup->columnvalue); } my $action = $svcnum ? 'Edit' : 'Add'; my $svc = $part_svc->getfield('svc'); -my $otaker = getotaker; - my $username = $svc_acct->username; my $password = ''; @@ -484,7 +557,7 @@ my $ulen = : dbdef->table('svc_acct')->column('username')->length; my $ulen2 = $ulen+2; -my $pmax = max($conf->config('passwordmax') || 13); +my $pmax = max($conf->config('passwordmax') || 12); my $pmax2 = $pmax+2; my $p1 = popurl(1); @@ -507,4 +580,21 @@ if ( $export_google ) { } #if $error } +if ( $part_svc->has_router ) { # duplicates the one in elements/svc_Common + if ( $svcnum ) { + my $router = qsearchs('router', {svcnum => $svc_acct->svcnum}); + if ( $router ) { + $svc_acct->set("router_$_", $router->get($_)) + foreach ('routername', 'routernum'); + my ($block) = $router->addr_block; + $svc_acct->set('router_blocknum', $block->blocknum) if ( $block ); + } + } + foreach (qw(router_routername router_routernum router_blocknum)) { + if ( $cgi->param($_) =~ /^(\w+)$/ ) { + $svc_acct->set($_, $1); + } + } +} +