Revision 338

Date:
2013/05/08 15:43:21
Author:
ahitrov
Revision Log:
document_filter_list.html from core
Files:
  • /utf8/plugins/users/comps/contenido/users/document_filter_list.html

Legend:

 
Added
 
Removed
 
Modified
  • utf8/plugins/users/comps/contenido/users/document_filter_list.html

     
    1 <& "/contenido/components/title.msn" &>
    2 <div style="font:bold 13px Verdana; margin:4px;">Класс: <span style="color:teal;"><% $class %></span>
    3 <span style="font:11px Verdana;">(<a href="document.html?class=<% $class %>&<% $field %>=<% $id %>" target="_blank">создать новый</a>)</span></div>
    4 % if ( ref $docs eq 'ARRAY' && @$docs ) {
    5 % if ($total > $size) {
    6 <div style="font-size:75%; font-family:Arial; text-align:center;">
    7 <& /inc/pages_.msn, p => $p, n => $size, total => $total, params => {%ARGS} &></div>
    8 % }
    9 % my @props = sort { $a->{column} <=> $b->{column} } grep { exists $_->{column} } $docs->[0]->required_properties;
    10 <table width="100%" border="0" cellpadding="4" cellspacing="0" class="tlistdocs">
    11 <tr bgcolor="#efefef">
    12 % foreach my $prop (@props) {
    13 <th><% $prop->{rusname} %></th>
    14 % }
    15 </tr>
    16 % foreach my $doc (@$docs) {
    17 % my $color = $doc->contenido_status_style ? $doc->contenido_status_style :
    18 % $doc->status == 1 ? 'blue' :
    19 % $doc->status == 0 ? 'gray' : 'blue';
    20
    21 %# my ($stat) = grep { $_->{attr} eq 'status' } @props;
    22 %# my ($case) = grep { $_->[0] == $banner->status } @{ $stat->{cases} } if ref $stat eq 'HASH' && exists $stat->{cases};
    23 <tr>
    24 % foreach my $prop (@props) {
    25 % my $attr = $prop->{attr};
    26 % if ( $attr =~ /dtime/ ) {
    27 <td><a href="document.html?id=<% $doc->id %>&class=<% $doc->class %>"
    28 style="<% $color %>" target="_blank"><& "/contenido/components/show_dtime.msn", dtime => $doc->$attr &></a></td>
    29 % } elsif ( $prop->{type} eq 'status' ) {
    30 % my ($case) = grep { $_->[0] == $doc->$attr } @{$prop->{cases}};
    31 <td><% ref $case ? $case->[1] : 'Статус: '.$prop->$attr %></td>
    32 % } else {
    33 <td><a href="document.html?id=<% $doc->id %>&class=<% $doc->class %>"
    34 style="<% $color %>" target="_blank"><% $doc->$attr %></a></td>
    35 % }
    36 % }
    37 </tr>
    38 % }
    39 </table>
    40 % }
    41 %#<pre><% Dumper($docs->[0]->required_properties) %></pre>
    42 <%args>
    43 $id => undef
    44 $filter => undef
    45 $field => undef
    46 $class => undef
    47 $order_by => undef
    48 $p => 1
    49 </%args>
    50 <%init>
    51
    52 my ($docs, $total);
    53 my $size = 15;
    54 if ( $id && $filter && $class ) {
    55 my %opts = ();
    56 $opts{$filter} = $id;
    57 $opts{order_by} = $order_by if $order_by;
    58 $docs = $keeper->get_documents (
    59 class => $class,
    60 return_mode => 'array_ref',
    61 offset => ($p-1)*$size,
    62 limit => $size,
    63 %opts,
    64 );
    65 $total = $keeper->get_documents (
    66 class => $class,
    67 count => 1,
    68 %opts,
    69 );
    70 } else {
    71 return;
    72 }
    73
    74 </%init>