1 |
3 |
ahitrov@rambler.ru |
<& "/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 %><% $defaults %>" 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 |
|
|
<th> </th> |
16 |
|
|
</tr> |
17 |
|
|
% foreach my $doc (@$docs) { |
18 |
|
|
% my $document_access = $user->section_accesses($user, $doc->section); |
19 |
|
|
% my $color = $doc->contenido_status_style ? $doc->contenido_status_style : |
20 |
|
|
% $doc->status == 1 ? 'blue' : |
21 |
|
|
% $doc->status == 0 ? 'gray' : 'blue'; |
22 |
|
|
% my ($a1, $a2) = $document_access == 2 ? ('<a href="document.html?id='.$doc->id.'&class='.$doc->class.'" style="'.$color.'" target="_blank">', '</a>') : ('',''); |
23 |
|
|
%# my ($stat) = grep { $_->{attr} eq 'status' } @props; |
24 |
|
|
%# my ($case) = grep { $_->[0] == $banner->status } @{ $stat->{cases} } if ref $stat eq 'HASH' && exists $stat->{cases}; |
25 |
|
|
<tr> |
26 |
|
|
% foreach my $prop (@props) { |
27 |
|
|
% my $attr = $prop->{attr}; |
28 |
|
|
% if ( $attr =~ /dtime/ ) { |
29 |
|
|
<td><% $a1 %><& "/contenido/components/show_dtime.msn", dtime => $doc->$attr &><% $a2 %></td> |
30 |
|
|
% }else{ |
31 |
|
|
<td><% $a1.$doc->$attr.$a2 %></td> |
32 |
|
|
% } |
33 |
|
|
% } |
34 |
|
|
<td nowrap>\ |
35 |
|
|
% if ($document_access == 2) { |
36 |
|
|
<a href="document_fast_delete.html?id=<% $doc->id %>&class=<% $doc->class %>" onclick="return confirm('������� ��������?');" title="������� ��������"><img |
37 |
|
|
src="/contenido/i/actions/delete.gif" width="14" height="17" alt="������� ��������" align="absmiddle" border="0" hspace="1"></a>\ |
38 |
|
|
% } |
39 |
|
|
</td> |
40 |
|
|
</tr> |
41 |
|
|
% } |
42 |
|
|
</table> |
43 |
|
|
% } |
44 |
|
|
%#<pre><% Dumper($docs->[0]->required_properties) %></pre> |
45 |
|
|
<%args> |
46 |
|
|
$id => undef |
47 |
|
|
$filter => undef |
48 |
|
|
$field => undef |
49 |
|
|
$from => undef |
50 |
|
|
$to => undef |
51 |
|
|
$class => undef |
52 |
|
|
$order_by => undef |
53 |
|
|
$p => 1 |
54 |
|
|
</%args> |
55 |
|
|
<%init> |
56 |
|
|
|
57 |
|
|
my ($docs, $total); |
58 |
|
|
my $defaults = ''; |
59 |
|
|
my $size = 15; |
60 |
|
|
if ( $id && $filter && $class ) { |
61 |
|
|
my %opts = (); |
62 |
|
|
$opts{$filter} = $id; |
63 |
|
|
$opts{order_by} = $order_by if $order_by; |
64 |
|
|
$docs = $keeper->get_documents ( |
65 |
|
|
class => $class, |
66 |
|
|
return_mode => 'array_ref', |
67 |
|
|
offset => ($p-1)*$size, |
68 |
|
|
limit => $size, |
69 |
|
|
%opts, |
70 |
|
|
); |
71 |
|
|
delete $opts{order_by}; |
72 |
|
|
$total = $keeper->get_documents ( |
73 |
|
|
class => $class, |
74 |
|
|
count => 1, |
75 |
|
|
%opts, |
76 |
|
|
); |
77 |
|
|
} else { |
78 |
|
|
return; |
79 |
|
|
} |
80 |
|
|
if ( defined $from && defined $to ) { |
81 |
|
|
if ( ref $from eq 'ARRAY' && ref $to eq 'ARRAY' && (scalar @$from == scalar @$to) ) { |
82 |
|
|
for ( 0..(scalar @$from - 1) ) { |
83 |
|
|
$defaults .= '&'.$from->[$_].'='.$to->[$_]; |
84 |
|
|
} |
85 |
|
|
} elsif ( !ref $from && !ref $to ) { |
86 |
|
|
$defaults .= '&'.$from.'='.$to; |
87 |
|
|
} |
88 |
|
|
} |
89 |
|
|
|
90 |
|
|
</%init> |