3 # $Id: agent_type.cgi,v 1.2 1998-11-21 07:39:52 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.2 1998-11-21 07:39:52 ivan
20 use CGI::Carp qw(fatalsToBrowser);
21 use FS::UID qw(cgisuidsetup swapuid);
22 use FS::Record qw(qsearch qsearchs);
23 use FS::CGI qw(header menubar popurl table);
33 print $cgi->header, header("Agent Type Listing", menubar(
35 )), "Agent types define groups of packages that you can then assign to".
36 " particular agents.<BR><BR>", table, <<END;
38 <TH COLSPAN=2>Agent Type</TH>
39 <TH COLSPAN="2">Packages</TH>
44 foreach $agent_type ( sort {
45 $a->getfield('typenum') <=> $b->getfield('typenum')
46 } qsearch('agent_type',{}) ) {
47 my($hashref)=$agent_type->hashref;
48 my(@type_pkgs)=qsearch('type_pkgs',{'typenum'=> $hashref->{typenum} });
49 my($rowspan)=scalar(@type_pkgs);
50 $rowspan = int($rowspan/2+0.5) ;
53 <TD ROWSPAN=$rowspan><A HREF="$p/edit/agent_type.cgi?$hashref->{typenum}">
56 <TD ROWSPAN=$rowspan><A HREF="$p/edit/agent_type.cgi?$hashref->{typenum}">$hashref->{atype}</A></TD>
61 foreach $type_pkgs ( @type_pkgs ) {
62 my($pkgpart)=$type_pkgs->getfield('pkgpart');
63 my($part_pkg) = qsearchs('part_pkg',{'pkgpart'=> $pkgpart });
64 print qq!<TR>! if ($tdcount == 0) ;
65 $tdcount = 0 if ($tdcount == -1) ;
66 print qq!<TD><A HREF="$p/edit/part_pkg.cgi?$pkgpart">!,
67 $part_pkg->getfield('pkg'),"</A></TD>";
80 <TR><TD COLSPAN=2><I><A HREF="$p/edit/agent_type.cgi">Add new agent type</A></I></TD></TR>