diff options
author | ivan <ivan> | 2007-03-11 04:13:27 +0000 |
---|---|---|
committer | ivan <ivan> | 2007-03-11 04:13:27 +0000 |
commit | a79f6e69559ec438a178f73b8b4d51d6f12c0d36 (patch) | |
tree | 273401a793c0e1866de2799094b127d3e8e89683 | |
parent | 99816612a0f864a105aaa8663ce618e604128ed6 (diff) |
move POP to browse template; whew, its paged
-rwxr-xr-x | httemplate/browse/svc_acct_pop.cgi | 129 |
1 files changed, 65 insertions, 64 deletions
diff --git a/httemplate/browse/svc_acct_pop.cgi b/httemplate/browse/svc_acct_pop.cgi index 306d02afb..44bc651cf 100755 --- a/httemplate/browse/svc_acct_pop.cgi +++ b/httemplate/browse/svc_acct_pop.cgi @@ -1,73 +1,74 @@ -<% include("/elements/header.html",'Access Number Listing', menubar( 'Main Menu' => $p )) %> -Points of Presence<BR><BR> -<A HREF="<% $p %>edit/svc_acct_pop.cgi"><I>Add new Access Number</I></A><BR><BR> -<% table() %> - <TR> - <TH></TH> - <TH>City</TH> - <TH>State</TH> - <TH>Area code</TH> - <TH>Exchange</TH> - <TH>Local</TH> - <TH>Accounts</TH> - </TR> -% -%foreach my $svc_acct_pop ( sort { -% #$a->getfield('popnum') <=> $b->getfield('popnum') -% $a->state cmp $b->state || $a->city cmp $b->city -% || $a->ac <=> $b->ac || $a->exch <=> $b->exch || $a->loc <=> $b->loc -%} qsearch('svc_acct_pop',{}) ) { -% -% my $svc_acct_pop_link = $p . 'edit/svc_acct_pop.cgi?'. $svc_acct_pop->popnum; -% -% $accounts_sth->execute($svc_acct_pop->popnum) or die $accounts_sth->errstr; -% my $num_accounts = $accounts_sth->fetchrow_arrayref->[0]; -% -% my $svc_acct_link = $p. 'search/svc_acct.cgi?popnum='. $svc_acct_pop->popnum; -% -% +<% include( 'elements/browse.html', + 'title' => 'Access Numbers', + 'html_init' => $html_init, + 'name_singular' => 'access number', + 'query' => $query, + 'count_query' => $count_query, + 'header' => [ + '#', + 'City', + 'State', + 'Area code', + 'Exchange', + 'Local', + 'Accounts', + ], + 'fields' => [ + 'popnum', + 'city', + 'state', + 'ac', + 'exch', + 'loc', + $num_accounts_sub, + ], + 'align' => 'rllrrrr', + ) +%> +<%init> - <TR> - <TD><A HREF="<% $svc_acct_pop_link %>"> - <% $svc_acct_pop->popnum %></A></TD> - <TD><A HREF="<% $svc_acct_pop_link %>"> - <% $svc_acct_pop->city %></A></TD> - <TD><A HREF="<% $svc_acct_pop_link %>"> - <% $svc_acct_pop->state %></A></TD> - <TD><A HREF="<% $svc_acct_pop_link %>"> - <% $svc_acct_pop->ac %></A></TD> - <TD><A HREF="<% $svc_acct_pop_link %>"> - <% $svc_acct_pop->exch %></A></TD> - <TD><A HREF="<% $svc_acct_pop_link %>"> - <% $svc_acct_pop->loc %></A></TD> - <TD> - <FONT COLOR="#00CC00"><B><% $num_accounts %></B></FONT> -% if ( $num_accounts ) { -<A HREF="<% $svc_acct_link %>"> -% } +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - active -% if ( $num_accounts ) { -</A> -% } +my $html_init = qq! + <A HREF="${p}edit/svc_acct_pop.cgi"><I>Add new Access Number</I></A> + <BR><BR> +!; - </TD> - </TR> -% } +my $query = { 'select' => '*, + ( SELECT COUNT(*) FROM svc_acct + WHERE svc_acct.popnum = svc_acct_pop.popnum + ) AS num_accounts + ', + 'table' => 'svc_acct_pop', + #'hashref' => { 'disabled' => '' }, + 'extra_sql' => 'ORDER BY state, city, ac, exch, loc', + }; +my $count_query = "SELECT COUNT(*) FROM svc_acct_pop"; # WHERE DISABLED IS NULL OR DISABLED = ''"; - <TR> - </TR> - </TABLE> - </BODY> -</HTML> -<%init> +my $svc_acct_pop_link = [ $p.'edit/svc_acct_pop.cgi?', 'popnum' ]; -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); +my $svc_acct_link = $p. 'search/svc_acct.cgi?popnum='; -my $accounts_sth = dbh->prepare("SELECT COUNT(*) FROM svc_acct - WHERE popnum = ? ") - or die dbh->errstr; +my $num_accounts_sub = sub { + my $svc_acct_pop = shift; + [ + [ + { 'data' => '<B><FONT COLOR="#00CC00">'. + $svc_acct_pop->get('num_accounts'). + '</FONT></B>', + 'align' => 'right', + }, + { 'data' => 'active', + 'align' => 'left', + 'link' => ( $svc_acct_pop->get('num_accounts') + ? $svc_acct_link. $svc_acct_pop->popnum + : '' + ), + }, + ], + ]; +}; </%init> |