removed <!-- $Id$ --> from all files to fix any redirects, whew
[freeside.git] / httemplate / browse / agent_type.cgi
1 <%
2
3 print header("Agent Type Listing", menubar(
4   'Main Menu' => $p,
5 )), "Agent types define groups of packages that you can then assign to".
6     " particular agents.<BR><BR>", &table(), <<END;
7       <TR>
8         <TH COLSPAN=2>Agent Type</TH>
9         <TH COLSPAN=2>Packages</TH>
10       </TR>
11 END
12
13 foreach my $agent_type ( sort { 
14   $a->getfield('typenum') <=> $b->getfield('typenum')
15 } qsearch('agent_type',{}) ) {
16   my($hashref)=$agent_type->hashref;
17   my(@type_pkgs)=qsearch('type_pkgs',{'typenum'=> $hashref->{typenum} });
18   my($rowspan)=scalar(@type_pkgs);
19   $rowspan = int($rowspan/2+0.5) ;
20   print <<END;
21       <TR>
22         <TD ROWSPAN=$rowspan><A HREF="${p}edit/agent_type.cgi?$hashref->{typenum}">
23           $hashref->{typenum}
24         </A></TD>
25         <TD ROWSPAN=$rowspan><A HREF="${p}edit/agent_type.cgi?$hashref->{typenum}">$hashref->{atype}</A></TD>
26 END
27
28   my($type_pkgs);
29   my($tdcount) = -1 ;
30   foreach $type_pkgs ( @type_pkgs ) {
31     my($pkgpart)=$type_pkgs->getfield('pkgpart');
32     my($part_pkg) = qsearchs('part_pkg',{'pkgpart'=> $pkgpart });
33     print qq!<TR>! if ($tdcount == 0) ;
34     $tdcount = 0 if ($tdcount == -1) ;
35     print qq!<TD><A HREF="${p}edit/part_pkg.cgi?$pkgpart">!,
36           $part_pkg->getfield('pkg'),"</A></TD>";
37     $tdcount ++ ;
38     if ($tdcount == 2)
39     {
40         print qq!</TR>\n! ;
41         $tdcount = 0 ;
42     }
43   }
44
45   print "</TR>";
46 }
47
48 print <<END;
49   <TR><TD COLSPAN=4><I><A HREF="${p}edit/agent_type.cgi">Add a new agent type</A></I></TD></TR>
50     </TABLE>
51   </BODY>
52 </HTML>
53 END
54
55 %>