318d0b6ea92e432530ac8af3afaacec3d83ff877
[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 %               'data'  => $type_pkgs->pkg. ' - '. $type_pkgs->comment,
21 %               'align' => 'left',
22 %               'link'  => $p. 'edit/part_pkg.cgi?'. $type_pkgs->pkgpart,
23 %             },
24 %           ];
25 %         }
26 %
27 %    $agent_type->type_pkgs_enabled
28 %  ];
29 %
30 %};
31 %
32 %my $link = [ $p.'edit/agent_type.cgi?', 'typenum' ];
33 %
34 %
35 <% include( 'elements/browse.html',
36                  'title'   => 'Agent Types',
37                  'menubar'     => [ #'Main menu' => $p,
38                                     'Agents'    =>"${p}browse/agent.cgi",
39                                   ],
40                  'html_init'   => $html_init,
41                  'name'        => 'agent types',
42                  'query'       => { 'table'     => 'agent_type',
43                                     'hashref'   => {},
44                                     'extra_sql' => 'ORDER BY typenum', # 'ORDER BY atype',
45                                   },
46                  'count_query' => $count_query,
47                  'header'      => [ '#',
48                                     'Agent Type',
49                                     'Packages',
50                                   ],
51                  'fields'      => [ 'typenum',
52                                     'atype',
53                                     $packages_sub,
54                                   ],
55                  'links'       => [ $link,
56                                     $link,
57                                     '',
58                                   ],
59              )
60 %>