% % 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 'dtime') { % % % } #- for @columns % % } #- foreach @documents
Удаление документов<% $_->{shortname} || $_->{rusname} %>
Документы не найдены
\ % if ($document_access == 2) { % $delete_status = 1; % } else {   % } <& "/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') { % my $style = $document->contenido_status_style ? ' style="'.$document->contenido_status_style.'"' : ''; % my ($a1, $a2) = $href ? ('','') : ('','');
class="<% $document->status ? '':'hiddensect' %>">\ % % my $name=$document->name ? $document->name : 'Безымянный документ N'.$document->id; <% $a1 %><% $name | h %><% $a2 %>\ % \ % % } elsif ($col->{attr} eq 'id') { % \ % if ($document_access == 2) { <% $document->id %> \ % } else { <% $document->id %> \ % } \ % % } elsif ( exists $col->{inline} && $col->{inline} ) { % $inline_status = 1; % my $attr = $col->{attr}; % if ( $col->{type} =~ /^(string|integer|float)$/ && $col->{inline} ) { % my $style = $col->{inline_style} ? $col->{inline_style} : ($col->{type} =~ /^(integer|float)$/ ? 'text-align:right; ' : '' ); % } elsif ($col->{type} eq 'checkbox') { % my $checked = $document->$attr ? ' checked' : ''; > % } elsif ($col->{type} eq 'select') { % my $options = {}; % if ($toopi && (ref($toopi) eq 'HASH') && (exists($toopi->{$document->class}))) { % %{ $options } = %{ $toopi->{$document->class} }; % } % my $values = $options->{$col->{attr}}; % } elsif ($col->{type} eq 'status') { % my $cases = $col->{cases}; % if ( ref $cases eq 'ARRAY' ) { % } % } % % } 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_') { % my $actions; % if ( $document->$user_id == $user->id ) { % $actions = join (' | ', map { ''.$_->{name}.'' } @actions); % } else { % my $profile = exists $users{$document->$user_id} ? $users{$document->$user_id} : undef; % unless ( ref $profile ) { % $profile = $keeper->get_user_by_id( $document->$user_id ); % $users{$profile->id} = $profile if ref $profile; % } % if ( ref $profile ) { % $actions = $profile->name; % } else { % $actions = join (' | ', map { ''.$_->{name}.'' } @actions); % } % } <% $actions %>\ % if ( $inline_status ) { % } % if ( $delete_status ) { % } % % } 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}} : ' ' %>\ % } % }
% if ( ref $filter eq 'HASH' ) { % while ( my ($key, $value) = each %$filter ) { % next if $key eq 's'; % } % } % if ( $inline_status || $delete_status ) {
% if ( $inline_status ) { % } % if ( $delete_status ) { % }
% }
<%args> $section => undef $documents => undef $columns => undef $id => undef $filter => undef $status => undef <%init> return unless ref $documents eq 'ARRAY'; return unless ref $columns eq 'ARRAY'; @$columns = grep { $_->{attr} ne 'status' } @$columns; my $toopi = $project->documents(); my $inline_status = 0; my $delete_status = 0; my $params = ref $filter eq 'HASH' ? join ('&', map { $_.'='.$filter->{$_} } keys %$filter ) : ''; my $params_unclassed = ref $filter eq 'HASH' ? join ('&', map { $_.'='.$filter->{$_} } grep { $_ ne 'class' } keys %$filter ) : ''; my $params_unsection = ref $filter eq 'HASH' ? join ('&', map { $_.'='.$filter->{$_} } grep { $_ ne 's' } keys %$filter ) : ''; my $active_rights = $m->comp('/contenido/webshop/subs/user_rights.msn'); my %users; my ($href, @actions, $user_id); if ( $status == 1 && (!$active_rights || $active_rights == 1) ) { $href = 'take_care.html'; @actions = { href => $href, name => 'обработать' }; $user_id = 'manager_id'; } elsif ( $status == 2 && (!$active_rights || $active_rights == 2) ) { $href = 'facility.html'; @actions = { href => $href, name => 'собрать' }; $user_id = 'vault_id'; } elsif ( $status == 3 && (!$active_rights || $active_rights == 3) ) { $href = 'delivery.html'; @actions = { href => $href, name => 'доставить' }; $user_id = 'postman_id'; } elsif ( $status == 4 && !$active_rights ) { $href = 'delivery.html'; @actions = { href => $href, name => 'просмотр' }; }