diff options
Diffstat (limited to 'httemplate/view')
-rw-r--r-- | httemplate/view/elements/svc_Common.html | 14 | ||||
-rw-r--r-- | httemplate/view/svc_acct/basics.html | 2 | ||||
-rw-r--r-- | httemplate/view/svc_broadband.cgi | 274 |
3 files changed, 64 insertions, 226 deletions
diff --git a/httemplate/view/elements/svc_Common.html b/httemplate/view/elements/svc_Common.html index 38fa90eb9..a822412bf 100644 --- a/httemplate/view/elements/svc_Common.html +++ b/httemplate/view/elements/svc_Common.html @@ -159,13 +159,13 @@ my($label, $value, $svcdb) = $cust_svc->label; my $part_svc = $cust_svc->part_svc; - #false laziness w/edit/svc_Common.html - #override default labels with service-definition labels if applicable - my $labels = $opt{labels}; #not -> here - foreach my $field ( keys %$labels ) { - my $col = $part_svc->part_svc_column($field); - $labels->{$field} = $col->columnlabel if $col->columnlabel !~ /^\S*$/; - } +#false laziness w/edit/svc_Common.html +#override default labels with service-definition labels if applicable +my $labels = $opt{labels}; #not -> here +foreach my $field ( keys %$labels ) { + my $col = $part_svc->part_svc_column($field); + $labels->{$field} = $col->columnlabel if $col->columnlabel !~ /^\s*$/; +} my $pkgnum = $cust_svc->pkgnum; diff --git a/httemplate/view/svc_acct/basics.html b/httemplate/view/svc_acct/basics.html index 6a0ed9260..a253e3bf7 100644 --- a/httemplate/view/svc_acct/basics.html +++ b/httemplate/view/svc_acct/basics.html @@ -100,7 +100,7 @@ % } <& /view/elements/tr.html, label=>mt('RADIUS groups'), - value=>join('<BR>', $svc_acct->radius_groups('COMBINED')) &> + value=>join('<BR>', $svc_acct->radius_groups('long_description')) &> %# Can this be abstracted further? Maybe a library function like %# widget('HTML', 'view', $svc_acct) ? It would definitely make UI diff --git a/httemplate/view/svc_broadband.cgi b/httemplate/view/svc_broadband.cgi index dead70b7f..627775992 100644 --- a/httemplate/view/svc_broadband.cgi +++ b/httemplate/view/svc_broadband.cgi @@ -1,225 +1,63 @@ -<%include("/elements/header.html",'Broadband Service View', menubar( - ( ( $custnum ) - ? ( "View this customer (#$display_custnum)" => "${p}view/cust_main.cgi?$custnum", - ) - : ( "Cancel this (unaudited) website" => - "${p}misc/cancel-unaudited.cgi?$svcnum" ) - ) -)) -%> - -<% include('/elements/init_overlib.html') %> - -<% include('/view/elements/svc_edit_link.html', 'svc'=>$svc_broadband) %> -<BR> -<%ntable("#cccccc")%> - <TR> - <TD> - <%ntable("#cccccc",2)%> - <TR> - <TD ALIGN="right">Service number</TD> - <TD BGCOLOR="#ffffff"><%$svcnum%></TD> - </TR> - <TR> - <TD ALIGN="right">Description</TD> - <TD BGCOLOR="#ffffff"><%$description%></TD> - </TR> - -% if ( $router ) { - <TR> - <TD ALIGN="right">Router</TD> - <TD BGCOLOR="#ffffff"><%$router->routernum%>: <%$router->routername%></TD> - </TR> -% } - - <TR> - <TD ALIGN="right">Download Speed</TD> - <TD BGCOLOR="#ffffff"><%$speed_down%></TD> - </TR> - <TR> - <TD ALIGN="right">Upload Speed</TD> - <TD BGCOLOR="#ffffff"><%$speed_up%></TD> - </TR> - -% if ( $ip_addr ) { - <TR> - <TD ALIGN="right">IP Address</TD> - <TD BGCOLOR="#ffffff"> - <%$ip_addr%> - (<% include('/elements/popup_link-ping.html', 'ip'=>$ip_addr ) %>) - </TD> - </TR> - <TR> - <TD ALIGN="right">IP Netmask</TD> - <TD BGCOLOR="#ffffff"><%$addr_block->NetAddr->mask%></TD> - </TR> - <TR> - <TD ALIGN="right">IP Gateway</TD> - <TD BGCOLOR="#ffffff"><%$addr_block->ip_gateway%></TD> - </TR> -% } - - <TR> - <TD ALIGN="right">MAC Address</TD> - <TD BGCOLOR="#ffffff"><%$mac_addr%></TD> - </TR> - <TR> - <TD ALIGN="right">Latitude</TD> - <TD BGCOLOR="#ffffff"><%$latitude%></TD> - </TR> - <TR> - <TD ALIGN="right">Longitude</TD> - <TD BGCOLOR="#ffffff"><%$longitude%></TD> - </TR> - <TR> - <TD ALIGN="right">Altitude</TD> - <TD BGCOLOR="#ffffff"><%$altitude%></TD> - </TR> - <TR> - <TD ALIGN="right">VLAN Profile</TD> - <TD BGCOLOR="#ffffff"><%$vlan_profile%></TD> - </TR> - <TR> - <TD ALIGN="right">Authentication Key</TD> - <TD BGCOLOR="#ffffff"><%$auth_key%></TD> - </TR> - <TR> - <TD ALIGN="right">Service Plan Id</TD> - <TD BGCOLOR="#ffffff"><%$plan_id%></TD> - </TR> - <TR COLSPAN="2"><TD></TD></TR> -% -%foreach (sort { $a cmp $b } $svc_broadband->virtual_fields) { -% print $svc_broadband->pvf($_)->widget('HTML', 'view', -% $svc_broadband->getfield($_)), "\n"; -%} -% -% - - </TABLE> - </TD> - </TR> -</TABLE> - -<BR> -<%ntable("#cccccc", 2)%> -% -% my $sb_router = qsearchs('router', { svcnum => $svcnum }); -% if ($sb_router) { -% - - <B>Router associated: <%$sb_router->routername%> </B> - <A HREF="<%popurl(2)%>edit/router.cgi?<%$sb_router->routernum%>"> - (details) - </A> - <BR> -% my @sb_addr_block; -% if (@sb_addr_block = $sb_router->addr_block) { -% - - <B>Address space </B> - <A HREF="<%popurl(2)%>browse/addr_block.cgi"> - (edit) - </A> - <BR> -% print ntable("#cccccc", 1); -% foreach (@sb_addr_block) { - - <TR> - <TD><%$_->ip_gateway%>/<%$_->ip_netmask%></TD> - </TR> -% } - - </TABLE> -% } else { - - <B>No address space allocated.</B> -% } - - <BR> -% -% } else { -% - - -<FORM METHOD="GET" ACTION="<%popurl(2)%>edit/router.cgi"> - <INPUT TYPE="hidden" NAME="svcnum" VALUE="<%$svcnum%>"> -Add router named - <INPUT TYPE="text" NAME="routername" SIZE="32" VALUE="Broadband router (<%$svcnum%>)"> - <INPUT TYPE="submit" VALUE="Add router"> -</FORM> -% -%} -% - - -<BR> -<%joblisting({'svcnum'=>$svcnum}, 1)%> - -<% include('/elements/footer.html') %> +<& elements/svc_Common.html, + table => 'svc_broadband', + labels => \%labels, + fields => \@fields, +&> <%init> -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('View customer services'); - -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/; -my $svcnum = $1; -my $svc_broadband = qsearchs({ - 'select' => 'svc_broadband.*', - 'table' => 'svc_broadband', - 'addl_from' => ' LEFT JOIN cust_svc USING ( svcnum ) '. - ' LEFT JOIN cust_pkg USING ( pkgnum ) '. - ' LEFT JOIN cust_main USING ( custnum ) ', - 'hashref' => { 'svcnum' => $svcnum }, - 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql( - 'null_right' => 'View/link unlinked services' - ), -}) or die "svc_broadband: Unknown svcnum $svcnum"; - -#false laziness w/all svc_*.cgi -my $cust_svc = qsearchs( 'cust_svc', { 'svcnum' => $svcnum } ); -my $pkgnum = $cust_svc->getfield('pkgnum'); -my($cust_pkg, $custnum, $display_custnum); -if ($pkgnum) { - $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ); - $custnum = $cust_pkg->custnum; - $display_custnum = $cust_pkg->cust_main->display_custnum; -} else { - $cust_pkg = ''; - $custnum = ''; +my $conf = FS::Conf->new; +my $fields = FS::svc_broadband->table_info->{'fields'}; +my %labels = map { $_ => ( ref($fields->{$_}) + ? $fields->{$_}{'label'} + : $fields->{$_} + ); + } keys %$fields; + +$labels{'router'} = emt('Router'); +$labels{'usergroup'} = emt('RADIUS groups'); #? + +my @fields = ( + 'description', + { field => 'router', value => \&router }, + 'speed_down', + 'speed_up', + { field => 'ip_addr', value => \&ip_addr }, + 'mac_addr', + 'latitude', + 'longitude', + 'altitude', + 'vlan_profile', + 'authkey', + 'plan_id', +); + +push @fields, + { field => 'usergroup', value => \&usergroup } + if $conf->exists('svc_broadband-radius'); + +sub router { + my $svc = shift; + my $addr_block = $svc->addr_block or return ''; + my $router = $addr_block->router or return ''; + $router->routernum . ': ' . $router->routername; } -#eofalse -my $addr_block = $svc_broadband->addr_block; -my $router = $addr_block->router if $addr_block; - -#if (not $router) { die "Could not lookup router for svc_broadband (svcnum $svcnum)" }; +sub ip_addr { + my $svc = shift; + my $ip_addr = $svc->ip_addr; + my $out = $ip_addr . ' (' . + include('/elements/popup_link-ping.html', ip => $ip_addr) . ')'; + if ( my $addr_block = $svc->addr_block ) { + $out .= '<br>Netmask: ' . $addr_block->NetAddr->mask . + '<br>Gateway: ' . $addr_block->ip_gateway; + } + $out; +} -my ( - $speed_down, - $speed_up, - $ip_addr, - $mac_addr, - $latitude, - $longitude, - $altitude, - $vlan_profile, - $auth_key, - $description, - $plan_id, - ) = ( - $svc_broadband->getfield('speed_down'), - $svc_broadband->getfield('speed_up'), - $svc_broadband->getfield('ip_addr'), - $svc_broadband->mac_addr, - $svc_broadband->latitude, - $svc_broadband->longitude, - $svc_broadband->altitude, - $svc_broadband->vlan_profile, - $svc_broadband->auth_key, - $svc_broadband->description, - $svc_broadband->plan_id, - ); +sub usergroup { + my $svc = shift; + my $usergroup = $svc->usergroup; + join('<BR>', $svc->radius_groups('long_description')); +} </%init> |