% if ( $m->comp_exists ("/comps/$prj/header.msn") ) { <& "/comps/$prj/header.msn" &> % } else { <& "/comps/header.msn" &> % } % ### контент
% if ( $id && ref $document ) { % if ( $m->comp_exists ("/comps/$prj/article.msn") ) { <& "/comps/$prj/article.msn", doc => $document, show_header => 1, show_dtime => 1 &> % } else { <& "/comps/article.msn", doc => $document, show_header => 1, show_dtime => 1 &> % } % } else { % if ( ref $document && $p == 1 ) { % my $img = $document->get_image ('picture'); % my $date = Contenido::DateTime::new ( postgres => $document->dtime ); % my ($a1, $a2) = $document->url ? ('','') : ('',''); % if ( ref $img && exists $img->{filename} ) { % }
<% $img->{alt} |h %>
<% $date->dmy('.') %> <% $date->hour %>:<% $date->min %>\ % if ( $document->source ) { | <% $a1.$document->source.$a2 %>\ % }
% } % } % if ( ref $documents) { % if ( $id && ref $document ) {
Другие новости
% } % my ($wday, $wcount) = (0,0);
% foreach my $doc (@$documents) { % next if ref $document && $doc->id == $document->id; % my $date = Contenido::DateTime->new( postgres => $doc->dtime ); % my $dw = $date->wday; % if ($dw != $wday && !$id) { % $wday = $dw;
<% $date->day %> <% Encode::encode('utf-8', $date->month_name) %> <% $date->year %>
% }
<% ($id ? $date->dmy('.') : '').sprintf(" %02d:%02d",$date->hour,$date->min) %> <% $doc->name %>
% }
% if ( $id && ref $document ) { % } elsif ( !$id && $total > $size ) {
Страницы: %#<& /inc/pages_.msn, p => $p, total => $total, n => $size, delimiter => '  ' &>
% } % }
% ### Футер % ############################################## % if ( $m->comp_exists ("/comps/$prj/footer.msn") ) { <& "/comps/$prj/footer.msn" &> % } else { <& "/comps/footer.msn" &> % } % ### /Футер <%args> $p => 1 $id => undef <%init> my $prj = $request->{project}; my $profile = $request->{project_profile}; my $root = $request->{project_section}; &abort404 if $id && $id !~ /^\d+$/; my $size = 20; my $total; my ($documents, $document); my ($section) = $keeper->get_sections ( s => $root->id, class => 'promosuite::NewsSection', limit => 1, status => 1, ); if ( $id && ref $section ) { $document = $keeper->get_document_by_id ($id, s => $section->id, # class => 'promosuite::Article', class => 'promosuite::News', status => [1,2], ); $documents = $keeper->get_documents ( s => $section->id, # class => 'promosuite::Article', class => 'promosuite::News', status => [1,2], limit => 5, order => ['date', 'direct'], ref $document ? ( excludes => [$document->id] ) : (), return_mode => 'array_ref', ); } else { ($document) = $keeper->get_documents ( s => $section->id, # class => 'promosuite::Article', class => 'promosuite::News', status => 2, order => ['date', 'direct'], limit => 1, ) if $p == 1; $documents = $keeper->get_documents ( s => $section->id, # class => 'promosuite::Article', class => 'promosuite::News', status => [1,2], offset => $size * ($p-1), limit => $size, order => ['date', 'direct'], ref $document ? (excludes => [$document->id]) : (), return_mode => 'array_ref', ); $total = $keeper->get_documents ( s => $section->id, # class => 'promosuite::Article', class => 'promosuite::News', status => [1,2], count => 1, ); if ( $p == 1 && !$document ) { $document = shift @$documents if @$documents; } }