% if ( $m->comp_exists ("/comps/$prj/header.msn") ) {
<& "/comps/$prj/header.msn" &>
% } else {
<& "/comps/header.msn" &>
% }
% ### контент
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<tr><td width="4%"><div style="width: 10px; height: 1px"><spacer height="1" width="10" type="block"></div></td>
<td width="92%" valign="top" style="padding-top:11px;">
<div style="padding:14px 15px; width:890px;" class="hdr"><a href="./news.html"><% $section->name %></a></div>
% 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 ? ('<a href="http://www.rambler.ru/click?from=market_'.$prj.'&_URL='.$document->url.'" target="_blank">','</a>') : ('','');
<!-- 001 -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:15px;">
<tr valign="top">
% if ( ref $img && exists $img->{filename} ) {
<td style="padding:0px 10px;"><a href="?id=<% $document->id %>"><img
src="<% $img->{filename} %>" width="<% $img->{width} %>" height="<% $img->{height} %>"
style="margin-bottom:10px;border:0;" alt="<% $img->{alt} |h %>"></a></td>
% }
<td width="100%">
<div style="padding:10px 15px;" class="hdr"><a href="?id=<% $document->id %>"><% $document->name %></a></div>
<div class="news" style="padding-bottom: 15px;"><% $date->dmy('.') %> <% $date->hour %>:<% $date->min %>\
% if ( $document->source ) {
| <% $a1.$document->source.$a2 %>\
% }
</div>
<div class="news" style="width: 650px;"><a href="?id=<% $document->id %>" style="color:#FFFFFF;"><% $document->abstr %></a></div>
</td></tr>
</table>
% }
% }
% if ( ref $documents) {
% if ( $id && ref $document ) {
<div style="background:#333333;padding:10px 15px;" class="hdr">Другие новости</div>
% }
% my ($wday, $wcount) = (0,0);
<div style="width: 890px;">
% 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;
</div>
<div style="background:#333333;padding:10px 15px;" class="hdr"><% $date->day %> <% Encode::encode('utf-8', $date->month_name) %> <% $date->year %></div>
<div style="width: 890px;">
% }
<div class="plan"><b><% ($id ? $date->dmy('.') : '').sprintf(" %02d:%02d",$date->hour,$date->min) %></b>
<a href="?id=<% $doc->id %>"><% $doc->name %></a></div>
% }
</div>
% if ( $id && ref $document ) {
<div style="padding-top: 10px; padding-left:15px;" class="txt"><a href="./news.html"><b>Все новости »</b></a></div>
% } elsif ( !$id && $total > $size ) {
<div class="photo-l" style="padding-bottom:20px; padding-left: 15px;">Страницы:
%#<& /inc/pages_.msn, p => $p, total => $total, n => $size, delimiter => ' ' &>
</div>
% }
% }
</td>
<td width="4%"><div style="width: 10px; height: 1px"><spacer height="1" width="10" type="block"></div></td>
</tr>
</table>
% ### Футер
% ##############################################
% if ( $m->comp_exists ("/comps/$prj/footer.msn") ) {
<& "/comps/$prj/footer.msn" &>
% } else {
<& "/comps/footer.msn" &>
% }
% ### /Футер
<%args>
$p => 1
$id => undef
</%args>
<%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;
}
}
</%init>