first part of ACL and re-skinning work and some other small stuff
[freeside.git] / httemplate / browse / agent_type.cgi
1 <%
2
3 my $html_init = 
4   'Agent types define groups of packages that you can then assign to'.
5   ' particular agents.<BR><BR>'.
6   qq!<A HREF="${p}edit/agent_type.cgi"><I>Add a new agent type</I></A><BR><BR>!;
7
8 my $count_query = 'SELECT COUNT(*) FROM agent_type';
9
10 #false laziness w/access_user.html
11 my $packages_sub = sub {
12   my $agent_type = shift;
13
14   [ map  {
15            my $type_pkgs = $_;
16            my $part_pkg = $type_pkgs->part_pkg;
17            [
18              {
19                'data'  => $part_pkg->pkg. ' - '. $part_pkg->comment,
20                'align' => 'left',
21                'link'  => $p. 'edit/part_pkg.cgi?'. $type_pkgs->pkgpart,
22              },
23            ];
24          }
25     #sort {
26     #     }
27     grep {
28            $_->part_pkg and ! $_->part_pkg->disabled
29          }
30     $agent_type->type_pkgs #XXX the method should order itself by something
31   ];
32
33 };
34
35 my $link = [ $p.'edit/agent_type.cgi?', 'typenum' ];
36
37 %><%= include( 'elements/browse.html',
38                  'title'   => 'Agent Types',
39                  'menubar'     => [ #'Main menu' => $p,
40                                     'Agents'    =>"${p}browse/agent.cgi",
41                                   ],
42                  'html_init'   => $html_init,
43                  'name'        => 'agent types',
44                  'query'       => { 'table'     => 'agent_type',
45                                     'hashref'   => {},
46                                     'extra_sql' => 'ORDER BY typenum', # 'ORDER BY atype',
47                                   },
48                  'count_query' => $count_query,
49                  'header'      => [ '#',
50                                     'Agent Type',
51                                     'Packages',
52                                   ],
53                  'fields'      => [ 'typenum',
54                                     'atype',
55                                     $packages_sub,
56                                   ],
57                  'links'       => [ $link,
58                                     $link,
59                                     '',
60                                   ],
61              )
62 %>