3 # $Id: agent_type.cgi,v 1.4 1999-01-18 09:41:15 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.4 1999-01-18 09:41:15 ivan
15 # all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl
18 # Revision 1.3 1998/12/17 05:25:17 ivan
19 # fix visual and other bugs
21 # Revision 1.2 1998/11/21 07:39:52 ivan
27 use CGI::Carp qw(fatalsToBrowser);
28 use FS::UID qw(cgisuidsetup swapuid);
29 use FS::Record qw(qsearch qsearchs);
30 use FS::CGI qw(header menubar popurl table);
40 print $cgi->header( '-expires' => 'now' ), header("Agent Type Listing", menubar(
42 )), "Agent types define groups of packages that you can then assign to".
43 " particular agents.<BR><BR>", table, <<END;
45 <TH COLSPAN=2>Agent Type</TH>
46 <TH COLSPAN="2">Packages</TH>
51 foreach $agent_type ( sort {
52 $a->getfield('typenum') <=> $b->getfield('typenum')
53 } qsearch('agent_type',{}) ) {
54 my($hashref)=$agent_type->hashref;
55 my(@type_pkgs)=qsearch('type_pkgs',{'typenum'=> $hashref->{typenum} });
56 my($rowspan)=scalar(@type_pkgs);
57 $rowspan = int($rowspan/2+0.5) ;
60 <TD ROWSPAN=$rowspan><A HREF="${p}edit/agent_type.cgi?$hashref->{typenum}">
63 <TD ROWSPAN=$rowspan><A HREF="${p}/edit/agent_type.cgi?$hashref->{typenum}">$hashref->{atype}</A></TD>
68 foreach $type_pkgs ( @type_pkgs ) {
69 my($pkgpart)=$type_pkgs->getfield('pkgpart');
70 my($part_pkg) = qsearchs('part_pkg',{'pkgpart'=> $pkgpart });
71 print qq!<TR>! if ($tdcount == 0) ;
72 $tdcount = 0 if ($tdcount == -1) ;
73 print qq!<TD><A HREF="${p}edit/part_pkg.cgi?$pkgpart">!,
74 $part_pkg->getfield('pkg'),"</A></TD>";
87 <TR><TD COLSPAN=2><I><A HREF="${p}edit/agent_type.cgi">Add new agent type</A></I></TD></TR>