3 # $Id: agent_type.cgi,v 1.7 1999-04-09 03:52:55 ivan Exp $
5 # ivan@sisd.com 97-dec-10
7 # Changes to allow page to work at a relative position in server
8 # Changes to make "Packages" display 2-wide in table (old way was too vertical)
9 # bmccane@maxbaud.net 98-apr-3
11 # lose background, FS::CGI ivan@sisd.com 98-sep-2
13 # $Log: agent_type.cgi,v $
14 # Revision 1.7 1999-04-09 03:52:55 ivan
15 # explicit & for table/itable/ntable
17 # Revision 1.6 1999/04/07 11:10:46 ivan
20 # Revision 1.5 1999/01/19 05:13:25 ivan
21 # for mod_perl: no more top-level my() variables; use vars instead
22 # also the last s/create/new/;
24 # Revision 1.4 1999/01/18 09:41:15 ivan
25 # all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl
28 # Revision 1.3 1998/12/17 05:25:17 ivan
29 # fix visual and other bugs
31 # Revision 1.2 1998/11/21 07:39:52 ivan
36 use vars qw( $cgi $p $agent_type );
38 use CGI::Carp qw(fatalsToBrowser);
39 use FS::UID qw(cgisuidsetup swapuid);
40 use FS::Record qw(qsearch qsearchs);
41 use FS::CGI qw(header menubar popurl table);
51 print $cgi->header( '-expires' => 'now' ), header("Agent Type Listing", menubar(
53 )), "Agent types define groups of packages that you can then assign to".
54 " particular agents.<BR><BR>", &table, <<END;
56 <TH COLSPAN=2>Agent Type</TH>
57 <TH COLSPAN="2">Packages</TH>
61 foreach $agent_type ( sort {
62 $a->getfield('typenum') <=> $b->getfield('typenum')
63 } qsearch('agent_type',{}) ) {
64 my($hashref)=$agent_type->hashref;
65 my(@type_pkgs)=qsearch('type_pkgs',{'typenum'=> $hashref->{typenum} });
66 my($rowspan)=scalar(@type_pkgs);
67 $rowspan = int($rowspan/2+0.5) ;
70 <TD ROWSPAN=$rowspan><A HREF="${p}edit/agent_type.cgi?$hashref->{typenum}">
73 <TD ROWSPAN=$rowspan><A HREF="${p}edit/agent_type.cgi?$hashref->{typenum}">$hashref->{atype}</A></TD>
78 foreach $type_pkgs ( @type_pkgs ) {
79 my($pkgpart)=$type_pkgs->getfield('pkgpart');
80 my($part_pkg) = qsearchs('part_pkg',{'pkgpart'=> $pkgpart });
81 print qq!<TR>! if ($tdcount == 0) ;
82 $tdcount = 0 if ($tdcount == -1) ;
83 print qq!<TD><A HREF="${p}edit/part_pkg.cgi?$pkgpart">!,
84 $part_pkg->getfield('pkg'),"</A></TD>";
97 <TR><TD COLSPAN=2><I><A HREF="${p}edit/agent_type.cgi">Add new agent type</A></I></TD></TR>