Line # Revision Author
1 195 ahitrov %# vim:syn=mason:
2 % users_index_tree( $sect, 0, \$line, $level, $mode, $profile, $width_limit, $root );
3 <%args>
4
5 $root => 1
6 $level => 3
7 $mode => 1
8 $width_limit => undef
9
10 </%args>
11 <%init>
12 my $profile = $m->comp('/contenido/components/context.msn', name => 'profile');
13
14 sub users_index_tree
15 {
16 my ($sect, $offset, $line_ref, $count_offset, $viewmode, $profile, $width_limit, $root) = @_;
17 my $section_access = $user->section_accesses($user, $sect->{id});
18
19 my $spacer = '';
20 for(my $c=1; $c<$offset; $c++)
21 {
22 $spacer = $spacer.(($c == $offset-1) ? '&nbsp;&nbsp;&raquo;&nbsp;&nbsp;' : '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
23 }
24 if( $sect->{id} && ($sect->{id} != 1) && ($offset != 0) && $section_access > 0)
25 {
26 $$line_ref++;
27
28 my $href = 'sections.html?id='.$sect->id;
29
30 my $sname = $sect->name();
31 $sname = substr($sname, 0, $width_limit - $offset).' ...' if defined $width_limit && $offset + length($sname) > $width_limit;
32 my $html_sect = (!$sect->status ? '<span class="hiddensect">' : '').($section_access ? '<a href="'.$href.'">' : '').$sname.'&nbsp;' . ($section_access ? '</a>' : '') . '&nbsp;'.(!$sect->status ? '&nbsp; (�������)</span>' : $sect->status == 3 ? '&nbsp;(��������)' : '');
33 my $style = ($offset == 1) ? ($viewmode ? ' style="font-size:110%;"':' style="font-size:95%;"') : '';
34
35 $m->out(<<EOT);
36 <tr>
37 <td align="right">&nbsp;${$line_ref}&nbsp;<a href="section.html?id=$sect->{id}&move=up&ret=$root"><img src="/contenido/i/ico-up-9x10.gif" border=0 alt="����������� ������ �� ��� �����"></a>&nbsp;<a href="section.html?id=$sect->{id}&move=down&ret=$root"><img src="/contenido/i/ico-down-9x10.gif" border=0 alt="����������� ������ �� ��� ����"></a></td>
38 <td><table cellpadding="0" cellspacing="0" border="0">
39 <tr valign="top">
40 <td width="10">&nbsp;</td>
41 <td>$spacer</td>
42 <td nowrap $style>$html_sect</td>
43 </tr>
44 </table>
45 </td>
46 EOT
47
48 if ($viewmode)
49 {
50 my $fhref = '/contenido/?set_context=filter-'.$sect->id();
51 $m->out(qq^\n<td align="center" nowrap><a href="$fhref">���.������</a>^);
52 $m->out(qq^&nbsp;&nbsp;&nbsp;<a href="document.html?sect_id=$sect->{id}">���.�����</a>^) if $section_access == 2;
53 $m->out("</td>");
54 }
55
56 $m->out('</tr>');
57 }
58
59 my $childs = $sect->{childs} || [];
60 if( ref($childs) && @$childs && $offset < $count_offset )
61 {
62 $offset++;
63 foreach my $child (@$childs)
64 {
65 next if ( $child->class() ne 'users::Section' );
66 next if (! $request->{cCLASSES}->{$child->class()});
67 users_index_tree( $child, $offset, $line_ref, $count_offset, $viewmode, $profile, $width_limit, $root );
68 }
69 $offset--;
70 }
71 }
72
73 my $sect = $keeper->get_tree(light=>1, root=>$root);
74 return undef unless ref $sect;
75
76 $user->get_accesses();
77
78 my $line = 0;
79 $request->{cCLASSES} = {};
80 $request->{cCLASSES}->{'users::Section'} = 1;
81 if (ref($request->{tab}->{sections}))
82 {
83 map { $request->{cCLASSES}->{$_} = 1 } (@{ $request->{tab}->{sections} });
84 }
85 return undef if (scalar(keys(%{ $request->{cCLASSES} })) == 0);
86
87 </%init>