Index: section_browse_row.msn =================================================================== --- section_browse_row.msn (revision 615) +++ section_browse_row.msn (revision 616) @@ -1,16 +1,20 @@ +% unless ( $no_tr ) { +% } \ -% if ($document_access == 2) { +% if ($document_access == 2) { -% } else { +% } else {   -% } +% } % -% for my $col (@$columns) { -% my $attr = $col->{attr}; -% my $type = exists $col->{inline_type} ? $col->{inline_type} : $col->{type}; -% if ($attr eq '_sort_') { +% 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') { +% } elsif ($attr eq 'dtime') { % <& "/contenido/components/show_dtime.msn", dtime=>$document->{dtime} &>\ % -% if ($document->{ctime} ne $document->{mtime}) { -% my $colortime = '#c66'; +% if ($document->{ctime} ne $document->{mtime}) { +% my $colortime = '#c66'; %
<& "/contenido/components/show_dtime.msn", dtime=>$document->{mtime} &>
\ % -% } +% } % -% } elsif ($attr eq 'name') { +% } 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) { +% 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 { +% } else { % <% $name | h %>\ % -% } +% } % \ % -% } elsif ($attr eq 'id') { +% } elsif ($attr eq 'id') { % \ -% if ($document_access == 2) { +% if ($document_access == 2) { <% $document->id %> \ -% } else { +% } 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 ( 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 '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; -% } +% } 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; +% } -% } 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 '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 '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 '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 ) { +% } 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 { +% } else { <% $document->$attr %>\ -% } -% } else { +% } +% } else { <% $document->$attr %>\ -% } +% } % -% } elsif ($attr eq 'class') { +% } elsif ($attr eq 'class') { % <% $document->class_name %> (<% $document->class %>)\ % -% } elsif ($type eq 'datetime') { +% } elsif ($type eq 'datetime') { % <& "/contenido/components/show_dtime.msn", dtime=>$document->{$attr} &>\ % -% } elsif ($attr eq '_act_') { +% } elsif ($attr eq '_act_') { % \ -% if ($document_access == 2) { +% if ($document_access == 2) { % Редактировать документ\ @@ -155,67 +159,70 @@ src="/contenido/i/actions/copy.gif" width="15" height="17" alt="Копировать документ" align="absmiddle" border="0" hspace="1">\ Удалить документ\ -% if ( $document->status != 0 ) { -Скрыть/деактивировать документ\ -% } -% if ( $document->status != 1 ) { -Присвоить документу статус=1\ -% } +% if ( $document->status != 0 ) { +Документ активен\ +% } else { +Документ не активен\ +% }
\ % -% } else { +% } else {  \ -% } -% if ( $inline_status ) { +% } +% if ( $inline_status ) { -% } -% if ( $delete_status ) { +% } +% if ( $delete_status ) { -% } +% } % -% } else { -% my $attr = $attr; -% if ($type eq 'date') { -% my $date=$document->{$attr}; -% $date=~/(\d{4}-\d{2}-\d{2})/; +% } else { +% my $attr = $attr; +% if ($type eq 'date') { +% my $date=$document->{$attr}; +% $date=~/(\d{4}-\d{2}-\d{2})/; <% $1 || ' ' %>\ -% } elsif ($type eq 'datetime') { +% } elsif ($type eq 'datetime') { <% $document->{$attr} || ' ' %>\ -% } elsif ($type eq 'integer') { +% } elsif ($type eq 'integer') { <% $document->{$attr} %> \ -% } elsif ($type eq 'lookup' || $type eq 'pickup' || $type eq 'autocomplete') { +% } 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) { +% 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 { +% } else { <% $document->{$attr} %>???\ -% } -% } else { +% } +% } else { NULL\ -% } -% } elsif ($type eq 'checkbox') { +% } +% } 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}, 'Неизвестный']; +% } 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 { +% } else { <% defined($document->$attr) ? $document->$attr : ' ' %>\ -% } -% } +% } +% } % -% } #- for @columns -% +% } #- for @columns +% unless ( $no_tr ) { +% } <%args> + $no_tr => undef $toopi => undef $filter => undef $document => undef