1 |
296 |
ahitrov |
<div class="news-hdr"><% ref $section ? $section->name : 'Новости' %></div> |
2 |
|
|
|
3 |
|
|
% foreach my $doc (@news) { |
4 |
|
|
% my $href = $profile->media ? $state->{media}->site_prefix.$doc->get_path : 'news.html?id='.$doc->id; |
5 |
|
|
% my $target = $href =~ /^http:/ ? ' target="_blank"' : ''; |
6 |
|
|
<div class="news">22.10.07<br> |
7 |
|
|
<a href="<% $href %>"<% $target %>><% $doc->name %></a></div> |
8 |
|
|
<td class=ppp><p><img src="/i/<% $prj %>/plus.gif" width="12" height="12" alt="" border="0" vspace=3 align=left></td> |
9 |
|
|
<td width=100%><p><a href="<% $href %>"<% $target %>><% $doc->name %></a></td> |
10 |
|
|
% } |
11 |
|
|
<%args> |
12 |
|
|
|
13 |
|
|
$n => undef |
14 |
|
|
|
15 |
|
|
</%args> |
16 |
|
|
<%init> |
17 |
|
|
|
18 |
|
|
my $prj = $request->{project}; |
19 |
|
|
my $profile = $request->{project_profile}; |
20 |
|
|
my $root = $request->{project_section}; |
21 |
|
|
$n = $n || $profile->newsblock_count || 5; |
22 |
|
|
my @news; |
23 |
|
|
my $section; |
24 |
|
|
if ( $profile->media ) { |
25 |
|
|
my @aliases = split ( /\ +/, $profile->media ); |
26 |
|
|
my @sect_ids; |
27 |
|
|
foreach my $alias ( @aliases ) { |
28 |
|
|
my $sect = $keeper->{media}->get_rubric($alias); |
29 |
|
|
push @sect_ids, $sect->id if ref $sect; |
30 |
|
|
@news = $keeper->{media}->get_documents ( |
31 |
|
|
s => \@sect_ids, |
32 |
|
|
class => 'media::News', |
33 |
|
|
status => [5,8], |
34 |
|
|
limit => $n, |
35 |
|
|
order => [qw|date direct|], |
36 |
|
|
light => 1, |
37 |
|
|
); |
38 |
|
|
} |
39 |
|
|
}else{ |
40 |
|
|
($section) = $keeper->get_sections ( |
41 |
|
|
s => $root->id, |
42 |
|
|
class => 'promosuite::NewsSection', |
43 |
|
|
status => 1, |
44 |
|
|
limit => 1, |
45 |
|
|
); |
46 |
|
|
return unless ref $section; |
47 |
|
|
@news = $keeper->get_documents ( |
48 |
|
|
s => $section->id, |
49 |
|
|
# class => 'promosuite::Article', |
50 |
|
|
class => 'promosuite::News', |
51 |
|
|
status => 2, |
52 |
|
|
limit => $n, |
53 |
|
|
order => [qw|date direct|], |
54 |
|
|
light => 1, |
55 |
|
|
); |
56 |
|
|
} |
57 |
|
|
# return unless @news; |
58 |
|
|
|
59 |
|
|
</%init> |