import torrus 1.0.9
[freeside.git] / httemplate / edit / access_group.html
1 <% include( 'elements/edit.html',
2               'name'   => 'Employee Group',
3               'table'  => 'access_group',
4               'labels' => { 
5                             'groupnum'   => 'Group number',
6                             'groupname'  => 'Group name',
7                           },
8
9               'viewall_dir' => 'browse',
10
11               'html_bottom' => $html_bottom_sub,
12           )
13 %>
14 <%once>
15
16 tie my %rights, 'Tie::IxHash', FS::AccessRight->rights_info;
17
18 </%once>
19 <%init>
20
21 my $html_bottom_sub = sub {
22   my $access_group = shift;
23
24   #some false laziness w/browse/access_group.html
25   my $columns = 3;
26   my $count = 0;
27
28   '<BR>'.
29   '<FONT SIZE="+1">Group limited to these agent(s)</FONT><BR>'.
30   'Employees in this group will only see customers of the selected agents in the system and reports.<BR>'.
31   ntable("#cccccc",2).
32   '<TR><TD>'.
33   include( '/elements/checkboxes-table.html',
34              'source_obj'   => $access_group,
35              'link_table'   => 'access_groupagent',
36              'target_table' => 'agent',
37              'name_col'     => 'agent',
38              'target_link'  => $p.'edit/agent.cgi?',
39              'disable-able' => 1,
40          ).
41   '</TD></TR></TABLE>'.
42
43   '<BR><FONT SIZE="+1">Group access rights</FONT><BR>'.
44   include('/elements/table-grid.html', bgcolor=>'#cccccc' ).
45   '<TR>'. join( '', map {
46     '<TD CLASS="inv" VALIGN="top"><TABLE BGCOLOR="#cccccc" WIDTH=100%>'.
47     '<TR><TH BGCOLOR="#dcdcdc">'. $_. '</TH></TR>'.
48     '<TR><TD>'.
49     include( '/elements/checkboxes-table-name.html',
50                'source_obj'   => $access_group,
51                'link_table'   => 'access_right',
52                'link_static'  => { 'righttype' =>
53                                      'FS::access_group',
54                                  },
55                'num_col'      => 'rightobjnum',
56                'name_col'     => 'rightname',
57                'names_list'   => [ map { 
58                                          my $rn =
59                                            ref($_) ? $_->{'rightname'} : $_;
60                                          my %hash = ();
61                                          $hash{'note'} = '&nbsp;*'
62                                            if ref($_) && $_->{'global'};
63                                          $hash{'desc'} = $_->{'desc'}
64                                            if ref($_) &&  $_->{'desc'};
65                                          [ $rn => \%hash ];
66                                        }
67                                        @{ $rights{$_} }
68                                  ],
69            ).
70     '<BR>'.
71     '</TD></TR></TABLE></TD>'.
72     ( ++$count % $columns ? '' : '</TR><TR>')
73   
74   } keys %rights ). '</TR></TABLE>'.
75   
76   '* Global rights.  These rights provide access to global data which is shared among all agents.  Their use is not recommended for groups which are limited to a subset of agents.<BR>';
77
78 };
79
80 </%init>