441c20add35d17bfd67952bb50a0387a39fbd116
[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 % if ( $opt{cust_svc}->agent_svcid ) {
5   <& /view/elements/tr.html, label=>mt('Legacy ID'),  value=>$opt{cust_svc}->agent_svcid &>
6 % }
7 <& /view/elements/tr.html, label=>mt('Username'), value=>$svc_acct->username &>
8 <& /view/elements/tr.html, label=>mt('Domain'),   value=>$domain &>
9
10 % if ( $opt{'communigate'} ) {
11   <& /view/elements/tr.html, label=>mt('Aliases'), value=>$svc_acct->cgp_aliases &>
12 %}
13
14 % if ( $svc_acct->pbxsvc ) {
15   <& /view/elements/tr.html, label=>mt('PBX'), value=>$svc_acct->pbx_title &>
16 %}
17
18 % my $show_pw = '';
19 % my $password = $svc_acct->get_cleartext_password; 
20 % if ( $password =~ /^\*\w+\* (.*)$/ ) {
21 %   $password = $1;
22 %   $show_pw .= '<I>('. mt('login disabled') .')</I> ';
23 % }
24 % if ( ! $password
25 %      && $svc_acct->_password_encryption ne 'plain'
26 %      && $svc_acct->_password
27 %    )
28 % {
29 %   $show_pw .= '<I>('. uc($svc_acct->_password_encryption). ' '.mt('encrypted').')</I>';
30 % } elsif ( $conf->exists('showpasswords') ) { 
31 %   $show_pw .= '<SPAN >'. encode_entities($password). '</PRE>';
32 % } else { 
33 %   $password = '';
34 %   $show_pw .= '<I>('. mt('hidden') .')</I>';
35 % }
36 <TR>
37   <TD ALIGN="right"><% mt('Password') %></TD>
38   <TD STYLE="background-color: #ffffff; white-space: nowrap">
39   <% $show_pw %>
40 % my $curuser = $FS::CurrentUser::CurrentUser;
41 % if ( $curuser->access_right('Provision customer service') or
42 %     ($curuser->access_right('Edit password') and
43 %      ! $part_svc->restrict_edit_password) )
44 % {
45   <& /elements/change_password.html,
46       'svc_acct'    => $svc_acct,
47       'curr_value'  => $password,
48   &>
49 % }
50   </TD>
51 </TR>
52
53 % if ( $conf->exists('security_phrase') ) {
54   <& /view/elements/tr.html, label=>mt('Security phrase'), value=>$svc_acct->sec_phrase &>
55 % } 
56
57 % if ( $svc_acct->popnum ) {
58 %   my $svc_acct_pop = qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum});
59     <& /view/elements/tr.html, label=>mt('Access number'), value=>$svc_acct_pop->text &>
60 % } 
61
62 % if ( $svc_acct->sectornum && $conf->exists('svc_acct-tower_sector') ) {
63 %   my $tower_sector = $svc_acct->tower_sector;
64 %   my $link = $tower_sector->ip_addr
65 %                ? '<A HREF="http://'. $tower_sector->ip_addr. '">'
66 %                : '';
67     <& /view/elements/tr.html,
68         label => mt('Tower sector'),
69         value => $link. $tower_sector->description. ($link ? '</A>' : ''),
70     &>
71 % }
72
73 <& /view/elements/tr-svc_export_machine.html,
74      'svc'      => $svc_acct,
75      'part_svc' => $part_svc,
76 &>
77
78 % if ($svc_acct->uid ne '') { 
79   <& /view/elements/tr.html, label=>mt('UID'), value=>$svc_acct->uid &>
80 % } 
81
82 % if ($svc_acct->gid ne '') { 
83   <& /view/elements/tr.html, label=>mt('GID'), value=>$svc_acct->gid &>
84 % } 
85
86 % if ($svc_acct->finger ne '') { 
87   <& /view/elements/tr.html, label=>mt('Real Name'), value=>$svc_acct->finger &>
88 % } 
89
90 % if ($svc_acct->dir ne '') { 
91   <& /view/elements/tr.html, label=>mt('Home directory'), value=>$svc_acct->dir &>
92 % } 
93
94 % if ($svc_acct->shell ne '') { 
95   <& /view/elements/tr.html, label=>mt('Shell'), value=>$svc_acct->shell &>
96 % } 
97
98 % if ($svc_acct->quota ne '' && ! $opt{'communigate'} ) { 
99
100   <& /view/elements/tr.html, label=>mt('Quota'), value=>$svc_acct->quota &>
101
102 % } elsif ( $opt{'communigate'} ) {
103
104   <& communigate.html, %opt &>
105
106 % }
107
108 <%perl>
109 # minor false laziness w/ view/svc_broadband.cgi
110 sub slipip {
111   my $svc_acct = shift;
112   my $out = $svc_acct->slipip or return '';
113   if ( $out eq '0.0.0.0' or $out eq '0e0' ) {
114     return '<I>('.mt('Dynamic').'</I>';
115   }
116   $out .= ' ('.
117           include('/elements/popup_link-ping.html', ip => $svc_acct->slipip).
118           ')';
119   if ( my $addr_block = $svc_acct->addr_block ) {
120     $out .= '<br>Netmask: ' . $addr_block->NetAddr->mask .
121             '<br>Gateway: ' . $addr_block->ip_gateway;
122   }
123   $out;
124 }
125 </%perl>
126
127 % if ($svc_acct->slipip) { 
128   <& /view/elements/tr.html,
129        label=>mt('IP address'),
130        value=> slipip($svc_acct)
131   &>
132 % } 
133
134 <& usage.html, 'svc_acct' => $svc_acct &>
135
136 % foreach my $attribute ( grep /^radius_/, $svc_acct->fields ) {
137 %   $attribute =~ /^radius_(.*)$/;
138 %   my $pattribute = $FS::raddb::attrib{$1};
139     <& /view/elements/tr.html, label=>mt("Radius (reply) [_1]",$pattribute),
140                           value=>$svc_acct->getfield($attribute)
141     &>
142 % } 
143
144 % foreach my $attribute ( grep /^rc_/, $svc_acct->fields ) {
145 %   $attribute =~ /^rc_(.*)$/;
146 %   my $pattribute = $FS::raddb::attrib{$1};
147     <& /view/elements/tr.html, label=>mt("Radius (check) [_1]",$pattribute),
148                           value=>$svc_acct->getfield($attribute)
149     &>
150 % } 
151
152 <& /view/elements/tr.html, label=>mt('RADIUS groups'),
153     value=>join('<BR>', $svc_acct->radius_groups('long_description')) &>
154
155 <& router.html, 'svc_acct' => $svc_acct &>
156
157 %# Can this be abstracted further?  Maybe a library function like
158 %# widget('HTML', 'view', $svc_acct) ?  It would definitely make UI 
159 %# style management easier.
160 % foreach (sort { $a cmp $b } $svc_acct->virtual_fields) { 
161   <% $svc_acct->pvf($_)->widget('HTML', 'view', $svc_acct->getfield($_)) %>
162 % } 
163
164 </TABLE></TD></TR></TABLE>
165 <%init>
166
167 my %opt = @_;
168
169 my $conf = new FS::Conf;
170
171 my $svc_acct = $opt{'svc_acct'};
172 my $part_svc = $opt{'part_svc'};
173
174 die 'Empty domsvc for svc_acct.svcnum '. $svc_acct->svcnum
175   unless $svc_acct->domsvc;
176 my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc } );
177 die 'Unknown domain (domsvc '. $svc_acct->domsvc.
178     ' for svc_acct.svcnum '. $svc_acct->svcnum. ')'
179   unless $svc_domain;
180 my $domain = $svc_domain->domain;
181
182 </%init>