Revision 296 (by ahitrov, 2013/03/26 17:59:01) |
Promosite (anthill) project source
|
<table border="0" cellspacing="0" cellpadding="0" width="240">
<tr><td class="cc" width="100%">
<h2><% ref $section ? $section->name : 'Новости' %></h2>
<table cellpadding=0 cellspacing=0 border=0 width=100%>
% foreach my $doc (@news) {
% my $href = $profile->media ? $state->{media}->site_prefix.$doc->get_path : 'news.html?id='.$doc->id;
% my $target = $href =~ /^http:/ ? ' target="_blank"' : '';
<tr valign=top>
<td class=ppp><p><img src="/i/<% $prj %>/plus.gif" width="12" height="12" alt="" border="0" vspace=3 align=left></td>
<td width=100%><p><a href="<% $href %>"<% $target %>><% $doc->name %></a></td>
</tr>
% }
</table>
</td></tr>
</table>
<%args>
$n => undef
</%args>
<%init>
my $prj = $request->{project};
my $profile = $request->{project_profile};
my $root = $request->{project_section};
$n = $n || $profile->newsblock_count || 5;
my @news;
my $section;
if ( $profile->media ) {
my @aliases = split ( /\ +/, $profile->media );
my @sect_ids;
foreach my $alias ( @aliases ) {
my $sect = $keeper->{media}->get_rubric($alias);
push @sect_ids, $sect->id if ref $sect;
@news = $keeper->{media}->get_documents (
s => \@sect_ids,
class => 'media::News',
status => [5,8],
limit => $n,
order => [qw|date direct|],
light => 1,
);
}
}else{
($section) = $keeper->get_sections (
s => $root->id,
class => 'promosuite::NewsSection',
status => 1,
limit => 1,
);
return unless ref $section;
@news = $keeper->get_documents (
s => $section->id,
# class => 'promosuite::Article',
class => 'promosuite::News',
status => 2,
limit => $n,
order => [qw|date direct|],
light => 1,
);
}
# return unless @news;
</%init>