Revision 296 (by ahitrov, 2013/03/26 17:59:01) |
Promosite (anthill) project source
|
% 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="./photo.html"><% $section->name %></a></div>
% if ( ref $document ) {
<div style="background:#333333;padding:10px 15px;" class="hdr"><% $document->name %></div>
% if ( $m->comp_exists ("/comps/$prj/block_rep_photos.msn") ) {
<& "/comps/$prj/block_rep_photos.msn", doc => $document &>
% } else {
<& "/comps/block_rep_photos.msn", doc => $document &>
% }
<br clear="all" style="font-size:5px;">
<div style="background:#333333; height:1px; margin-bottom: 10px;" ><spacer type="block"></div>
<div class="photo-l" style="padding-bottom:20px; padding-left: 15px;"><a href="./photo.html">Вернуться к фотогалерее</a></div>
% } elsif ( ref $section &&ref $documents eq 'ARRAY' && @$documents ) {
% foreach my $photorep ( @$documents ) {
<div style="background:#333333;padding:10px 15px;" class="hdr"><% $photorep->name %></div>
% if ( $m->comp_exists ("/comps/$prj/block_rep_photos.msn") ) {
<& "/comps/$prj/block_rep_photos.msn", doc => $photorep, show => 'rubber', max => 10 &>
% } else {
<& "/comps/block_rep_photos.msn", doc => $photorep, show => 'rubber', max => 10 &>
% }
<br clear="all" style="font-size:5px;">
<div style="background:#333333; height:1px; margin-bottom: 10px;" ><spacer type="block"></div>
<div class="photo-l" style="padding-bottom:20px; padding-left: 15px;"><a href="?id=<% $photorep->id %>">Весь фоторепортаж</a></div>
% }
% }
% if ( ($total > $size) && !$id ) {
<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>
$id => undef
$p => 1
</%args>
<%init>
my $prj = $request->{project};
my $profile = $request->{project_profile};
my $root = $request->{project_section};
&abort404 if $id && $id !~ /^\d+$/;
my $size = 5;
my ($documents, $document, $total) = ([], undef, 0);
my ($section) = $keeper->get_sections (
s => $root->id,
class => 'promosuite::MultimediaSection',
limit => 1,
status => 1,
);
if ( ref $section ) {
if ( $id ) {
$document = $keeper->get_document_by_id ($id,
s => $section->id,
class => 'promosuite::Photorep',
status => 1,
);
&abort404 unless ref $document;
}else{
$documents = $keeper->get_documents (
s => $section->id,
class => 'promosuite::Photorep',
status => 1,
order => ['date', 'direct'],
limit => $size,
offset => $size * ($p-1),
return_mode => 'array_ref',
);
if ( @$documents ) {
$request->{photorep} = $documents;
}
}
$total = $keeper->get_documents (
s => $section->id,
class => 'promosuite::Photorep',
status => 1,
count => 1,
);
}
</%init>