_sorted() ? 'draggable="true"' : '' %>>
% }
\
% if ($document_access == 2) {
% } else {
% }
|
%
% for my $col (@$columns) {
% my $attr = $col->{attr};
% my $type = exists $col->{inline_type} ? $col->{inline_type} : $col->{type};
% my $class_name = $document->class;
% $class_name =~ s/:/-/g;
% if ($attr eq '_sort_') {
%
<% $document->{sorder} %> \
%
% } elsif ($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 ($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 %><% $params_unclassed ? '&'.$params_unclassed : '' %>"><% $name | h %>\
%
% } else {
%
<% $name | h %>\
%
% }
%
\
%
% } elsif ($attr eq 'id') {
%
| \
% if ($document_access == 2) {
<% $document->id %> \
% } else {
<% $document->id %> \
% }
\
%
% } elsif ( exists $col->{inline} && $col->{inline} ) {
% if ( $type =~ /^(string|integer|float)$/ && $col->{inline} ) {
% my $style = $col->{inline_style} ? $col->{inline_style} : ($col->{type} =~ /^(integer|float)$/ ? 'text-align:right; ' : '' );
% $style .= $col->{inline_width} ? ' width:'.$col->{inline_width}.'px; ' : ' width:65px; ';
|
% } elsif ($type eq 'checkbox') {
% my $checked = $document->$attr ? ' checked' : '';
| >
% } elsif ($type eq 'text') {
% my $style = $col->{inline_style} ? $col->{inline_style} : '';
% $style .= $col->{inline_width} ? ' width:'.$col->{inline_width}.'px; ' : ' width:100px; ';
% $style .= $col->{inline_height} ? ' width:'.$col->{inline_height}.'px; ' : ' height:70px; ';
% my $value = $document->$attr;
% for ( $value ) {
% s/</sgi;
% s/>/>/sgi;
% }
|
% } elsif ($type eq 'select') {
% my $options = {};
% if ($toopi && (ref($toopi) eq 'HASH') && (exists($toopi->{$document->class}))) {
% %{ $options } = %{ $toopi->{$document->class} };
% }
% my $values = $options->{$attr};
|
% } elsif ($type eq 'status') {
% my $cases = $col->{cases};
% if ( ref $cases eq 'ARRAY' ) {
|
% }
% } elsif ($type eq 'pickup' || $type eq 'autocomplete') {
% my %opts = %{ $col->{lookup_opts} };
% my $doc;
% if ( $document->$attr ) {
% $doc = $keeper->get_document_by_id( $document->$attr, %opts );
% }
|
% } elsif ($type eq 'lookup') {
% my %opts = %{ $col->{lookup_opts} };
% delete $opts{search_by} if exists $opts{search_by};
% my $docs;
% if ( ref $lookup_elements eq 'HASH' && exists $lookup_elements->{$attr} ) {
% $docs = $lookup_elements->{$attr};
% } else {
% $docs = $keeper->get_documents( %opts, return_mode => 'array_ref', names => 1 );
% if ( ref $lookup_elements eq 'HASH' ) {
% $lookup_elements->{$attr} = $docs;
% }
% }
% if ( ref $docs eq 'ARRAY' && @$docs ) {
|
% } else {
| <% $document->$attr %>\
% }
% } else {
| <% $document->$attr %>\
% }
%
% } elsif ($attr eq 'class') {
%
| <% $document->class_name %> (<% $document->class %>)\
%
% } elsif ($type eq 'datetime') {
%
| <& "/contenido/components/show_dtime.msn", dtime=>$document->{$attr} &>\
%
% } elsif ($attr eq '_act_') {
%
| \
% if ($document_access == 2) {
%
\
\
\
% if ( $document->status != 0 ) {
\
% } else {
\
% }
\
%
% } else {
\
% }
% if ( $inline_status ) {
% }
% if ( $delete_status ) {
% }
%
% } else {
% my $attr = $attr;
% if ($type eq 'date') {
% my $date=$document->{$attr};
% $date=~/(\d{4})-(\d{2})-(\d{2})/;
| <% $3.'.'.$2.'.'.$1 || ' ' %>\
% } elsif ($type eq 'datetime') {
| <% $document->{$attr} || ' ' %>\
% } elsif ($type eq 'integer') {
| <% $document->{$attr} %> \
% } elsif ($type eq 'lookup' || $type eq 'pickup' || $type eq 'autocomplete') {
| \
% my $id = $document->{$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->{$attr} %>???\
% }
% } else {
NULL\
% }
% } elsif ($type eq 'checkbox') {
| <% $document->$attr ? '' : ' ' %>\
% } elsif ($type eq 'status') {
% my $status_map = ref $col->{cases} eq 'ARRAY' ? $col->{cases} : $keeper->default_status();
% my ($doc_status) = grep { $_->[0] eq $document->{$attr} } @$status_map;
% $doc_status ||= [$document->{$attr}, 'Неизвестный'];
| <% $doc_status->[1].'('.$doc_status->[0].')' %>\
% } else {
| <% defined($document->$attr) ? $document->$attr : ' ' %>\
% }
% }
|
%
% } #- for @columns
% unless ( $no_tr ) {
% }
<%args>
$no_tr => undef
$toopi => undef
$filter => undef
$document => undef
$columns => undef
$section => undef
$inline_status => undef
$lookup_elements => undef
$params_unclassed => undef
$params_unsection => undef
%args>
<%init>
return unless ref $document;
return unless ref $columns eq 'ARRAY';
my $document_access = exists $document->{document_access} ? $document->{document_access} : $user->section_accesses($user, $document->section);
my $delete_status = $document_access == 2 ? 1 : 0;
my $id = ref $section ? $section->id : undef;
$toopi = $project->documents() unless defined $toopi;
my $params = ref $filter eq 'HASH' ? join ('&', map { $_.'='.$filter->{$_} } keys %$filter ) : '';
unless ( defined $params_unclassed ) {
$params_unclassed = ref $filter eq 'HASH' ? join ('&', map { $_.'='.$filter->{$_} } grep { $_ ne 'class' } keys %$filter ) : '';
}
unless ( defined $params_unsection ) {
$params_unsection = ref $filter eq 'HASH' ? join ('&', map { $_.'='.$filter->{$_} } grep { $_ ne 's' } keys %$filter ) : '';
}
unless ( defined $inline_status ) {
map {
if ( exists $_->{inline} && $_->{inline} ) {
$inline_status = 1;
}
} @$columns;
}
%init>