<!-- mason kludge -->
-<%
-
-print header("Agent Type Listing", menubar(
+<%= header("Agent Type Listing", menubar(
'Main Menu' => $p,
-)), "Agent types define groups of packages that you can then assign to".
- " particular agents.<BR><BR>", &table(), <<END;
- <TR>
- <TH COLSPAN=2>Agent Type</TH>
- <TH COLSPAN=2>Packages</TH>
- </TR>
-END
+ 'Agents' => $p. 'browse/agent.cgi',
+)) %>
+Agent types define groups of packages that you can then assign to particular
+agents.<BR><BR>
+<A HREF="<%= $p %>edit/agent_type.cgi"><I>Add a new agent type</I></A><BR><BR>
+
+<%= table() %>
+<TR>
+ <TH COLSPAN=2>Agent Type</TH>
+ <TH COLSPAN=2>Packages</TH>
+</TR>
+<%
foreach my $agent_type ( sort {
$a->getfield('typenum') <=> $b->getfield('typenum')
} qsearch('agent_type',{}) ) {
- my($hashref)=$agent_type->hashref;
- my(@type_pkgs)=qsearch('type_pkgs',{'typenum'=> $hashref->{typenum} });
- my($rowspan)=scalar(@type_pkgs);
+ my $hashref = $agent_type->hashref;
+ #more efficient to do this with SQL...
+ my @type_pkgs = grep { ! $_->part_pkg->disabled }
+ qsearch('type_pkgs',{'typenum'=> $hashref->{typenum} });
+ my $rowspan = scalar(@type_pkgs);
$rowspan = int($rowspan/2+0.5) ;
print <<END;
<TR>
}
print <<END;
- <TR><TD COLSPAN=4><I><A HREF="${p}edit/agent_type.cgi">Add a new agent type</A></I></TD></TR>
</TABLE>
</BODY>
</HTML>