8f180b6481c6fbaf5149c6849c2903f4f9b84630
[freeside.git] / httemplate / view / svc_acct / basics.html
1 <% &ntable("#cccccc") %><TR><TD><% &ntable("#cccccc",2) %>
2
3 <& /view/elements/tr.html, label=>mt('Service'),  value=>$part_svc->svc &>
4 <& /view/elements/tr.html, label=>mt('Username'), value=>$svc_acct->username &>
5 <& /view/elements/tr.html, label=>mt('Domain'),   value=>$domain &>
6
7 % if ( $opt{'communigate'} ) {
8   <& /view/elements/tr.html, label=>mt('Aliases'), value=>$svc_acct->cgp_aliases &>
9 %}
10
11 % if ( $svc_acct->pbxsvc ) {
12   <& /view/elements/tr.html, label=>mt('PBX'), value=>$svc_acct->pbx_title &>
13 %}
14
15 % my $show_pw = '';
16 % my $password = $svc_acct->get_cleartext_password; 
17 % if ( $password =~ /^\*\w+\* (.*)$/ ) {
18 %   $password = $1;
19 %   $show_pw .= '<I>('. mt('login disabled') .')</I> ';
20 % } 
21 % if ( ! $password
22 %      && $svc_acct->_password_encryption ne 'plain'
23 %      && $svc_acct->_password
24 %    )
25 % {
26 %   $show_pw .= '<I>('. uc($svc_acct->_password_encryption). ' '.mt('encrypted').')</I>';
27 % } elsif ( $conf->exists('showpasswords') ) { 
28 %   $show_pw .= '<PRE>'. encode_entities($password). '</PRE>';
29 % } else { 
30 %   $show_pw .= '<I>('. mt('hidden') .')</I>';
31 % } 
32 % $password = ''; 
33 <& /view/elements/tr.html, label=>mt('Password'), value=>$show_pw &>
34
35
36 % if ( $conf->exists('security_phrase') ) {
37   <& /view/elements/tr.html, label=>mt('Security phrase'), value=>$svc_acct->sec_phrase &>
38 % } 
39
40 % if ( $svc_acct->popnum ) {
41 %   my $svc_acct_pop = qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum});
42     <& /view/elements/tr.html, label=>mt('Access number'), value=>$svc_acct_pop->text &>
43 % } 
44
45 % if ( $svc_acct->sectornum && $conf->exists('svc_acct-tower_sector') ) {
46 %   my $tower_sector = $svc_acct->tower_sector;
47 %   my $link = $tower_sector->ip_addr
48 %                ? '<A HREF="http://'. $tower_sector->ip_addr. '">'
49 %                : '';
50     <& /view/elements/tr.html,
51         label => mt('Tower sector'),
52         value => $link. $tower_sector->description. ($link ? '</A>' : ''),
53     &>
54 % }
55
56 % if ($svc_acct->uid ne '') { 
57   <& /view/elements/tr.html, label=>mt('UID'), value=>$svc_acct->uid &>
58 % } 
59
60 % if ($svc_acct->gid ne '') { 
61   <& /view/elements/tr.html, label=>mt('GID'), value=>$svc_acct->gid &>
62 % } 
63
64 % if ($svc_acct->finger ne '') { 
65   <& /view/elements/tr.html, label=>mt('Real Name'), value=>$svc_acct->finger &>
66 % } 
67
68 % if ($svc_acct->dir ne '') { 
69   <& /view/elements/tr.html, label=>mt('Home directory'), value=>$svc_acct->dir &>
70 % } 
71
72 % if ($svc_acct->shell ne '') { 
73   <& /view/elements/tr.html, label=>mt('Shell'), value=>$svc_acct->shell &>
74 % } 
75
76 % if ($svc_acct->quota ne '' && ! $opt{'communigate'} ) { 
77
78   <& /view/elements/tr.html, label=>mt('Quota'), value=>$svc_acct->quota &>
79
80 % } elsif ( $opt{'communigate'} ) {
81
82   <& communigate.html, %opt &>
83
84 % }
85
86 % if ($svc_acct->slipip) { 
87   <& /view/elements/tr.html,
88        label=>mt('IP address'),
89        value=> ( $svc_acct->slipip eq "0.0.0.0" || $svc_acct->slipip eq '0e0' )
90                  ? "<I>(".mt('Dynamic').")</I>"
91                  : $svc_acct->slipip. ' '.
92                    include('/elements/popup_link-ping.html',
93                              'ip'=>$svc_acct->slipip,
94                           )
95   &>
96 % } 
97
98 <& usage.html, 'svc_acct' => $svc_acct &>
99
100 % foreach my $attribute ( grep /^radius_/, $svc_acct->fields ) {
101 %   $attribute =~ /^radius_(.*)$/;
102 %   my $pattribute = $FS::raddb::attrib{$1};
103     <& /view/elements/tr.html, label=>mt("Radius (reply) [_1]",$pattribute),
104                           value=>$svc_acct->getfield($attribute)
105     &>
106 % } 
107
108 % foreach my $attribute ( grep /^rc_/, $svc_acct->fields ) {
109 %   $attribute =~ /^rc_(.*)$/;
110 %   my $pattribute = $FS::raddb::attrib{$1};
111     <& /view/elements/tr.html, label=>mt("Radius (check) [_1]",$pattribute),
112                           value=>$svc_acct->getfield($attribute)
113     &>
114 % } 
115
116 <& /view/elements/tr.html, label=>mt('RADIUS groups'),
117     value=>join('<BR>', $svc_acct->radius_groups('long_description')) &>
118
119 %# Can this be abstracted further?  Maybe a library function like
120 %# widget('HTML', 'view', $svc_acct) ?  It would definitely make UI 
121 %# style management easier.
122 % foreach (sort { $a cmp $b } $svc_acct->virtual_fields) { 
123   <% $svc_acct->pvf($_)->widget('HTML', 'view', $svc_acct->getfield($_)) %>
124 % } 
125
126 </TABLE></TD></TR></TABLE>
127 <%init>
128
129 my %opt = @_;
130
131 my $conf = new FS::Conf;
132
133 my $svc_acct = $opt{'svc_acct'};
134 my $part_svc = $opt{'part_svc'};
135
136 die 'Empty domsvc for svc_acct.svcnum '. $svc_acct->svcnum
137   unless $svc_acct->domsvc;
138 my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc } );
139 die 'Unknown domain (domsvc '. $svc_acct->domsvc.
140     ' for svc_acct.svcnum '. $svc_acct->svcnum. ')'
141   unless $svc_domain;
142 my $domain = $svc_domain->domain;
143
144 </%init>