%# vim:syn=mason: % index_tree( $sect->{$root}, 0, \$line, $level, $mode, $profile, $width_limit, $root ); <%args> $root => 1 $level => 3 $mode => 1 $width_limit => undef $avail_classes => undef <%init> my $profile = $m->comp('/contenido/components/context.msn', name => 'profile'); sub index_tree { my ($sect, $offset, $line_ref, $count_offset, $viewmode, $profile, $width_limit, $root) = @_; my $section_access = $user->section_accesses($user, $sect->{id}); my $spacer = ''; for(my $c=1; $c<$offset; $c++) { $spacer = $spacer.(($c == $offset-1) ? '  »  ' : '     '); } if( ref $sect && $sect->id && ($sect->id != 1) && ($offset != 0) && $section_access > 0) { $$line_ref++; my $href = 'sections.html?id='.$sect->id; my $sname = $sect->name(); $sname =~ s/<\/?.+?>//g; $sname = substr($sname, 0, $width_limit - $offset).' ...' if defined $width_limit && $offset + length($sname) > $width_limit; my $statstyle = $sect->contenido_status_style ? ' style="' . $sect->contenido_status_style . '"' : ''; my @properties = $sect->structure(); my ($statprop) = grep { $_->{attr} eq 'status' } @properties; my ($statcase) = grep { $_->[0] == $sect->status } @{$statprop->{cases}} if exists $statprop->{cases} && ref $statprop->{cases} eq 'ARRAY'; my $statname = $statcase->[1] if ref $statcase; my $html_sect = 'status ? ' class="hiddensect"' : '').'>'.($section_access ? '' : '').$sname.' ' . ($section_access ? '' : '') . ' '.($sect->status != 1 && $statname ? ' ('.$statname.')' : '').''; my $style = ($offset == 1) ? ($viewmode ? ' style="font-size:110%;"':' style="font-size:95%;"') : ''; $m->out(<  ${$line_ref} Переместить секцию на шаг вверх Переместить секцию на шаг вниз
  $spacer $html_sect
EOT if ($viewmode) { my $fhref = '/contenido/?set_context=filter-'.$sect->id(); my $new_doc_class = $sect->default_document_class; $m->out(qq^\nуст.фильтр^); $m->out(qq^   доб.докум^) if $section_access == 2 and $new_doc_class; $m->out(""); } $m->out(''); } my $childs = $sect->{children} || []; if( ref($childs) && @$childs && $offset < $count_offset ) { $offset++; foreach my $child (@$childs) { next if (! $request->{cCLASSES}->{$child->class()}); index_tree( $child, $offset, $line_ref, $count_offset, $viewmode, $profile, $width_limit, $root ); } $offset--; } } $request->{cCLASSES} = {}; my @avail_classes; if ( ref $avail_classes eq 'ARRAY' && @$avail_classes ) { map { $request->{cCLASSES}->{$_} = 1 } @$avail_classes; @avail_classes = @$avail_classes; } elsif (ref($request->{tab}->{sections})) { map { $request->{cCLASSES}->{$_} = 1 } (@{ $request->{tab}->{sections} }); return undef if (scalar(keys(%{ $request->{cCLASSES} })) == 0); @avail_classes = keys( %{ $request->{cCLASSES} } ); } push @avail_classes, 'Contenido::Section' unless exists $request->{cCLASSES}{'Contenido::Section'}; my $sect = $keeper->get_section_tree(root=>$root, class => \@avail_classes); return undef unless ref $sect && exists $sect->{$root}; $user->get_accesses(); my $line = 0;