1 |
3 |
ahitrov@rambler.ru |
% foreach my $cls ( @$lclasses ) { |
2 |
|
|
<div class="pad_<% $class eq $cls ? 'active' : 'passive' %>"> |
3 |
|
|
% if ( $class eq $cls ) { |
4 |
|
|
<nowrap><% $cls->class_name |h %></nowrap> |
5 |
|
|
% } else { |
6 |
|
|
<nowrap><a href="?id=<% $document->id %>&class=<% $document->class %>&link_class=<% $cls %>"><% $cls->class_name %></a></nowrap> |
7 |
|
|
% } |
8 |
|
|
</div> |
9 |
|
|
% } |
10 |
|
|
<br clear="all"> |
11 |
|
|
<div style="padding:4px 0 2px;"><a target="_top" |
12 |
371 |
ahitrov |
href="link_frame.html?class=<% $class %>&<% $link_class_name %>=<% $document->class %>&<% $link_id_name %>=<% $document->id %>&back=<% $back %>"><b>�������� �����</b></a></div> |
13 |
3 |
ahitrov@rambler.ru |
% if ( $total > $size ) { |
14 |
|
|
<div style="padding:2px 0 4px;"><b>��������:</b> <& |
15 |
|
|
'/inc/pages_.msn', total => $total, n => $size, p => $p, |
16 |
|
|
params => { id => $document->id, class => $document->class, link_class => $class }, |
17 |
|
|
&></div> |
18 |
|
|
% } |
19 |
371 |
ahitrov |
<& /contenido/components/document_links_list.msn, parent_url => $parent_url, |
20 |
3 |
ahitrov@rambler.ru |
links => $links, docs => $docs, $link_id_name eq 'dest_id' ? (destination => $document) : (source => $document) &> |
21 |
|
|
<%args> |
22 |
|
|
|
23 |
|
|
$document => undef |
24 |
|
|
$lclasses => undef |
25 |
|
|
$class => undef |
26 |
|
|
$p => 1 |
27 |
|
|
$opts => {} |
28 |
|
|
$link_id_name => 'dest_id' |
29 |
|
|
$link_class_name=> 'dest_class' |
30 |
371 |
ahitrov |
$parent_url => undef |
31 |
3 |
ahitrov@rambler.ru |
|
32 |
|
|
</%args> |
33 |
|
|
<%init> |
34 |
|
|
|
35 |
|
|
return unless ref $document; |
36 |
|
|
return unless ref $lclasses eq 'ARRAY' && @$lclasses; |
37 |
|
|
$class ||= $lclasses->[0]; |
38 |
371 |
ahitrov |
my $back = URI::Escape::uri_escape( $parent_url ); |
39 |
3 |
ahitrov@rambler.ru |
|
40 |
|
|
my $size = 20; |
41 |
|
|
my $revert_id = $link_id_name eq 'dest_id' ? 'source_id' : 'dest_id'; |
42 |
|
|
my $revert_class = $link_class_name eq 'dest_class' ? 'source_class' : 'dest_class'; |
43 |
|
|
$opts->{order_by} ||= 'id desc'; |
44 |
|
|
my $links = $keeper->get_links ( |
45 |
|
|
class => $class, |
46 |
|
|
$link_id_name => $document->id, |
47 |
|
|
$link_class_name => $document->class, |
48 |
|
|
limit => $size, |
49 |
|
|
offset => $size*($p-1), |
50 |
|
|
%$opts, |
51 |
|
|
return_mode => 'array_ref', |
52 |
|
|
); |
53 |
|
|
my $total = $keeper->get_links ( |
54 |
|
|
class => $class, |
55 |
|
|
$link_id_name => $document->id, |
56 |
|
|
$link_class_name => $document->class, |
57 |
|
|
count => 1, |
58 |
|
|
%$opts, |
59 |
|
|
); |
60 |
|
|
my $docs = {}; |
61 |
|
|
my %dclasses = map { $_->$revert_class => 1 } @$links if ref $links eq 'ARRAY'; |
62 |
|
|
my @dclasses = keys %dclasses; |
63 |
|
|
foreach my $cls ( @dclasses ) { |
64 |
|
|
my %sids = map { $_->$revert_id => 1 } @$links if ref $links eq 'ARRAY'; |
65 |
|
|
my @sids = keys %sids; |
66 |
|
|
my @docs = $keeper->get_documents ( |
67 |
|
|
id => \@sids, |
68 |
|
|
class => $cls, |
69 |
|
|
) if @sids; |
70 |
|
|
map { $docs->{$_->id} = $_ } @docs; |
71 |
|
|
} |
72 |
|
|
|
73 |
|
|
</%init> |