add Excel and CSV download of templated reports and clean up their HTML formatting...
[freeside.git] / httemplate / search / svc_www.cgi
1 <%
2
3 #my $conf = new FS::Conf;
4
5 my($query)=$cgi->keywords;
6 $query ||= ''; #to avoid use of unitialized value errors
7 my(@svc_www, $orderby);
8 if ( $query eq 'svcnum' ) {
9   $orderby = 'ORDER BY svcnum';
10 } else {
11   eidiot('unimplemented');
12 }
13
14 my $count_query = 'SELECT COUNT(*) FROM svc_www';
15 my $sql_query = {
16   'table'     => 'svc_www',
17   'hashref'   => {},
18   'extra_sql' => $orderby,
19 };
20
21 my $link  = [ "${p}view/svc_www.cgi?", 'svcnum', ];
22 #my $dlink = [ "${p}view/svc_www.cgi?", 'svcnum', ];
23 my $ulink = [ "${p}view/svc_acct.cgi?", 'usersvc', ];
24
25
26 %><%= include( 'elements/search.html',
27                  'title'       => 'Virtual Host Search Results',
28                  'name'        => 'virtual hosts',
29                  'query'       => $sql_query,
30                  'count_query' => $count_query,
31                  'header'      => [ '#', 'Zone', 'User', ],
32                  'fields'      => [ 'svcnum',
33                                     sub { $_[0]->domain_record->zone },
34                                     sub { $_[0]->svc_acct->email },
35                                   ],
36                  'links'       => [ $link,
37                                     '',
38                                     $ulink,
39                                   ],
40              )
41 %>