Revision 296 (by ahitrov, 2013/03/26 17:59:01) |
Promosite (anthill) project source
|
<div class="news-hdr"><% ref $section ? $section->name : 'Новости' %></div>
% 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"' : '';
<div class="news">22.10.07<br>
<a href="<% $href %>"<% $target %>><% $doc->name %></a></div>
<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>
% }
<%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>