% foreach my $cls ( @$lclasses ) {
% }
% if ( $total > $size ) {
Страницы: <&
'/inc/pages_.msn', total => $total, n => $size, p => $p,
params => { id => $document->id, class => $document->class, link_class => $class },
&>
% }
<& /contenido/components/document_links_list.msn, parent_url => $parent_url,
links => $links, docs => $docs, $link_id_name eq 'dest_id' ? (destination => $document) : (source => $document) &>
<%args>
$document => undef
$lclasses => undef
$class => undef
$p => 1
$opts => {}
$link_id_name => 'dest_id'
$link_class_name=> 'dest_class'
$parent_url => undef
%args>
<%init>
return unless ref $document;
return unless ref $lclasses eq 'ARRAY' && @$lclasses;
$class ||= $lclasses->[0];
my $back = URI::Escape::uri_escape( $parent_url );
my $size = 20;
my $revert_id = $link_id_name eq 'dest_id' ? 'source_id' : 'dest_id';
my $revert_class = $link_class_name eq 'dest_class' ? 'source_class' : 'dest_class';
$opts->{order_by} ||= 'id desc';
my $links = $keeper->get_links (
class => $class,
$link_id_name => $document->id,
$link_class_name => $document->class,
limit => $size,
offset => $size*($p-1),
%$opts,
return_mode => 'array_ref',
);
my $total = $keeper->get_links (
class => $class,
$link_id_name => $document->id,
$link_class_name => $document->class,
count => 1,
%$opts,
);
my $docs = {};
my %dclasses = map { $_->$revert_class => 1 } @$links if ref $links eq 'ARRAY';
my @dclasses = keys %dclasses;
foreach my $cls ( @dclasses ) {
my %sids = map { $_->$revert_id => 1 } @$links if ref $links eq 'ARRAY';
my @sids = keys %sids;
my @docs = $keeper->get_documents (
id => \@sids,
class => $cls,
) if @sids;
map { $docs->{$_->id} = $_ } @docs;
}
%init>