<& "/contenido/components/header.msn" &> <& "/contenido/components/naviline.msn", sect_id => $owner->id &>
<& /contenido/users/components/find_user.msn, search => $search, search_by => $search_by, url=>'sections.html' &> <& "/contenido/users/components/subsection.msn", section => $owner &> <& "/contenido/components/class_filter.msn", class=> $class, section => $owner &> % if (( $owner->id ) && ($owner->id > 0) && $owner->id != 1 ) % { <& "/contenido/components/section_info.msn", section => $owner &> % }   % if($owner->id) {
Документы\ % if ($class) { класса <% $class %>\ % if ($use_section) { c учетом текущей секции\ % } % } else { в разделе\ % } % if ($total > 0) { (всего: <% $total %>, показано с <% $first + 1 %> по <% ($first + $n > $total) ? $total : $first + $n %>) % } % if ($total or defined($alpha) or defined($search) ) { % if ($section_access == 2) { <& "/contenido/components/new_objects_form.msn", proto => 'documents', sect_id => $owner->id, default => ($owner->default_document_class ? $owner->default_document_class : $class) &> % }
Поиск по букве:  [сброс фильтра]
<& /inc/alpha.msn, alpha=>$alpha, params=>\%ARGS, &>
% ## Форма поиска. Работает при включенном фильтре класса % ## и описанной для класса функции search_fields % ######################################################## % % if ( $filter{class} ) { % my $document = $filter{class}->new ($keeper); % my @fields = $document->search_fields; % if ( @fields ) { % my @props = $document->required_properties;
Поиск по полю:  [сброс фильтра]
:
% if ( $id ) { % } % if ( $class ) { % } % if ( $use_section ) { % }
% } % } <& /inc/pages_.msn, p=>$p, n=>$n, total=>$total, href=>'sections.html', params=>\%ARGS, &>
% % foreach (@columns) { % % % } % % % unless (@documents) { % } % foreach my $document (@documents) { % % next unless ref($document); % my $document_access = $user->section_accesses($user, $document->section); % % % for my $col (@columns) { % % if ($col->{attr} eq '_sort_') { % % % } #- for @columns % % } #- foreach @documents
<% $_->{rusname} %>
Документы не найдены
<% $document->{sorder} %> Переместить документ на шаг вверх Переместить документ на шаг вниз\ % % } elsif ($col->{attr} eq 'dtime') { % <& "/contenido/components/show_dtime.msn", dtime=>$document->{dtime} &>\ % % if ($document->{ctime} ne $document->{mtime}) { % % my $colortime = '#c66'; %
<& "/contenido/components/show_dtime.msn", dtime=>$document->{mtime} &>
\ % % } % % } elsif ($col->{attr} eq 'name') { %
contenido_status_style ? ' style="' . $document->contenido_status_style . '"' : '' %> class="<% $document->status ? '':'hiddensect' %>">\ % % my $name=$document->name ? $document->name : 'Безымянный документ N'.$document->id; % if ($document_access == 2) { % contenido_status_style ? ' style="' . $document->contenido_status_style . '"' : '' %> href="document.html?id=<% $document->id %>&class=<% $document->class %>"><% $name | h %> \ % % } else { % <% $name | h %> \ % % } % \ % % } elsif ($col->{attr} eq 'id') { % \ % % if ($document_access == 2) { % <% $document->id %> \ % % } else { % <% $document->id %> \ % % } % \ % % } elsif ($col->{attr} eq 'class') { % <% $document->class_name %> (<% $document->class %>)\ % % } elsif ($col->{type} eq 'datetime') { % <& "/contenido/components/show_dtime.msn", dtime=>$document->{$col->{attr}} &>\ % % } elsif ($col->{attr} eq '_act_') { % \ % if ($document_access == 2) { % Редактировать документ\ Копировать документ\ Удалить документ\ % if ( $document->status != 0 ) { Деактивировать пользователя\ % } % if ( $document->status != 1 ) { Присвоить пользователю статус=1\ % }
\ %#редактировать
\ %#удалить\ % % } else {  \ % } % % } else { % % if ($col->{type} eq 'date') { % my $date=$document->{$col->{attr}}; % $date=~/(\d{4}-\d{2}-\d{2})/;
<% $1 || ' ' %>\ % } elsif ($col->{type} eq 'datetime') { <% $document->{$col->{attr}} || ' ' %>\ % } elsif ($col->{type} eq 'integer') { <% $document->{$col->{attr}} %> \ % } elsif ($col->{type} eq 'lookup') { \ % my $id = $document->{$col->{attr}}; % if ($id) { % my ($doc)=$keeper->get_documents( ( ref($col->{lookup_opts}) ? %{$col->{lookup_opts}} : () ), id=>$id); % if ($doc) { <% $doc->name || $doc->id %> \ % } else { <% $document->{$col->{attr}} %>???\ % } % } else { NULL\ % } % } elsif ($col->{type} eq 'status') { % my $status_map = ref $col->{cases} eq 'ARRAY' ? $col->{cases} : $keeper->default_status(); % my ($doc_status) = grep { $_->[0] eq $document->{$col->{attr}} } @$status_map; % $doc_status ||= [$document->{$col->{attr}}, 'Неизвестный']; <% $doc_status->[1].'('.$doc_status->[0].')' %>\ % } else { <% defined($document->{$col->{attr}}) ? $document->{$col->{attr}} : ' ' %>\ % } % } %
<& /inc/pages_.msn, p=>$p, n=>$n, total=>$total, href=>'sections.html', params=>\%ARGS, &>
% } else {

---- Нет документов -----

% } % % if ($section_access == 2) { <& "/contenido/components/new_objects_form.msn", proto => 'documents', sect_id => $owner->id, default => ($owner->default_document_class ? $owner->default_document_class : $class) &> % }
% } <%args> $id => 1 $p => 1 $class => undef $use_section => undef $alpha => undef $alpha_search => undef $search_by => undef $search => undef <%init> $id = 0 if $id =~ /\D/; my $owner; # Операции... if ($id && ($id > 0)) { $owner = $keeper->get_section_by_id($id); } if (! ref($owner)) { return undef; } $class = $state->{users}->profile_document_class; # Фильтры работают в любом случае... my $filter = $m->comp('/contenido/components/context.msn', name => 'filter'); my $profile = $m->comp('/contenido/components/context.msn', name => 'profile'); unless (defined $request->{section_accesses}->{$id}) { $request->{section_accesses}->{$id} = $user->get_section_access($id); } my $section_access = $request->{section_accesses}->{$id}; my (@documents, $total); my $s = $owner->id; my $sorted = $owner->_sorted(); $s .= ",$filter" if ($filter > 0); my %filter=(); my %order = (not $class and $owner->order_by) ? (order_by => $owner->order_by) : (order => ['date','direct']); if (defined $alpha and $alpha ne '') { $filter{ilike}=1; $filter{ $alpha_search || 'name' }="$alpha%"; $order{order}=['name','reverse']; delete $order{order_by}; } $filter{class} = $owner->default_document_class if $owner->default_document_class; $filter{class}=$class if ($class); $filter{s}=$s unless ($class && !$use_section); if ( $search_by && $search ) { $filter{$search_by}='%'.$search.'%'; $filter{ilike} = 1; } # Дополнительные фильтры раздела if ($owner->filters) { no strict 'vars'; my $filters = eval($owner->filters); if ($@) { warn "Bad filter: " . $owner->filters . " in section " . $owner->id; } elsif (ref $filters eq 'HASH') { map { $filter{$_} = $filters->{$_} } keys %$filters; } } $total = $keeper->get_documents(%filter, count=>1); my $n = 40; my $first = $n * ($p - 1); ($first,$p)=(0,0) if ($first>$total); if ($class && !$use_section) { @documents = $keeper->get_documents(%filter, %order, limit=>$n, offset=>$first, light=>1); } elsif ($sorted) { @documents = $keeper->get_sorted_documents(%filter, limit=>$n, offset=>$first, light=>1); } else { @documents = $keeper->get_documents(%filter, %order, limit=>$n, offset=>$first, light=>1); } # набор колонок таблицы документов... my @columns = $sorted ? ({attr => '_sort_', name => 'N'}) : (); # пытаемся найти колонки, которые документ сам пожелал показать (required_properties -> column)... if ($filter{class} or @documents and $documents[0]) { push @columns, sort {$a->{column} <=> $b->{column}} grep {$_->{column}} ($filter{class} ? $filter{class}->new($keeper)->structure : $documents[0]->structure); } # стандартная жопка таблицы... @columns = (@columns, {attr => '_act_', rusname => 'Действия'}, );