Line # Revision Author
1 296 ahitrov % if ( $m->comp_exists ("/comps/$prj/header.msn") ) {
2 <& "/comps/$prj/header.msn" &>
3 % } else {
4 <& "/comps/header.msn" &>
5 % }
6
7
8 % ### контент
9
10 <table cellspacing="0" cellpadding="0" width="100%" border="0">
11 <tr><td width="4%"><div style="width: 10px; height: 1px"><spacer height="1" width="10" type="block"></div></td>
12 <td width="92%" valign="top" style="padding-top:11px;">
13 <div style="padding:14px 15px; width:890px;" class="hdr"><a href="./news.html"><% $section->name %></a></div>
14
15 % if ( $id && ref $document ) {
16
17 % if ( $m->comp_exists ("/comps/$prj/article.msn") ) {
18 <& "/comps/$prj/article.msn", doc => $document, show_header => 1, show_dtime => 1 &>
19 % } else {
20 <& "/comps/article.msn", doc => $document, show_header => 1, show_dtime => 1 &>
21 % }
22
23
24 % } else {
25 % if ( ref $document && $p == 1 ) {
26 % my $img = $document->get_image ('picture');
27 % my $date = Contenido::DateTime::new ( postgres => $document->dtime );
28 % my ($a1, $a2) = $document->url ? ('<a href="http://www.rambler.ru/click?from=market_'.$prj.'&_URL='.$document->url.'" target="_blank">','</a>') : ('','');
29 <!-- 001 -->
30 <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:15px;">
31 <tr valign="top">
32 % if ( ref $img && exists $img->{filename} ) {
33 <td style="padding:0px 10px;"><a href="?id=<% $document->id %>"><img
34 src="<% $img->{filename} %>" width="<% $img->{width} %>" height="<% $img->{height} %>"
35 style="margin-bottom:10px;border:0;" alt="<% $img->{alt} |h %>"></a></td>
36 % }
37 <td width="100%">
38 <div style="padding:10px 15px;" class="hdr"><a href="?id=<% $document->id %>"><% $document->name %></a></div>
39 <div class="news" style="padding-bottom: 15px;"><% $date->dmy('.') %> <% $date->hour %>:<% $date->min %>\
40 % if ( $document->source ) {
41 | <% $a1.$document->source.$a2 %>\
42 % }
43 </div>
44 <div class="news" style="width: 650px;"><a href="?id=<% $document->id %>" style="color:#FFFFFF;"><% $document->abstr %></a></div>
45 </td></tr>
46 </table>
47 % }
48 % }
49
50 % if ( ref $documents) {
51 % if ( $id && ref $document ) {
52 <div style="background:#333333;padding:10px 15px;" class="hdr">Другие новости</div>
53 % }
54 % my ($wday, $wcount) = (0,0);
55 <div style="width: 890px;">
56 % foreach my $doc (@$documents) {
57 % next if ref $document && $doc->id == $document->id;
58 % my $date = Contenido::DateTime->new( postgres => $doc->dtime );
59 % my $dw = $date->wday;
60 % if ($dw != $wday && !$id) {
61 % $wday = $dw;
62 </div>
63 <div style="background:#333333;padding:10px 15px;" class="hdr"><% $date->day %> <% Encode::encode('utf-8', $date->month_name) %> <% $date->year %></div>
64 <div style="width: 890px;">
65 % }
66 <div class="plan"><b><% ($id ? $date->dmy('.') : '').sprintf(" %02d:%02d",$date->hour,$date->min) %></b>
67 <a href="?id=<% $doc->id %>"><% $doc->name %></a></div>
68 % }
69 </div>
70 % if ( $id && ref $document ) {
71 <div style="padding-top: 10px; padding-left:15px;" class="txt"><a href="./news.html"><b>Все новости &raquo;</b></a></div>
72 % } elsif ( !$id && $total > $size ) {
73 <div class="photo-l" style="padding-bottom:20px; padding-left: 15px;">Страницы:
74 %#<& /inc/pages_.msn, p => $p, total => $total, n => $size, delimiter => ' &nbsp;' &>
75 </div>
76 % }
77 % }
78
79 </td>
80 <td width="4%"><div style="width: 10px; height: 1px"><spacer height="1" width="10" type="block"></div></td>
81 </tr>
82 </table>
83
84 % ### Футер
85 % ##############################################
86 % if ( $m->comp_exists ("/comps/$prj/footer.msn") ) {
87 <& "/comps/$prj/footer.msn" &>
88 % } else {
89 <& "/comps/footer.msn" &>
90 % }
91 % ### /Футер
92 <%args>
93
94 $p => 1
95 $id => undef
96
97 </%args>
98 <%init>
99
100 my $prj = $request->{project};
101 my $profile = $request->{project_profile};
102 my $root = $request->{project_section};
103 &abort404 if $id && $id !~ /^\d+$/;
104
105 my $size = 20;
106 my $total;
107 my ($documents, $document);
108 my ($section) = $keeper->get_sections (
109 s => $root->id,
110 class => 'promosuite::NewsSection',
111 limit => 1,
112 status => 1,
113 );
114 if ( $id && ref $section ) {
115 $document = $keeper->get_document_by_id ($id,
116 s => $section->id,
117 # class => 'promosuite::Article',
118 class => 'promosuite::News',
119 status => [1,2],
120 );
121 $documents = $keeper->get_documents (
122 s => $section->id,
123 # class => 'promosuite::Article',
124 class => 'promosuite::News',
125 status => [1,2],
126 limit => 5,
127 order => ['date', 'direct'],
128 ref $document ? ( excludes => [$document->id] ) : (),
129 return_mode => 'array_ref',
130 );
131 } else {
132 ($document) = $keeper->get_documents (
133 s => $section->id,
134 # class => 'promosuite::Article',
135 class => 'promosuite::News',
136 status => 2,
137 order => ['date', 'direct'],
138 limit => 1,
139 ) if $p == 1;
140 $documents = $keeper->get_documents (
141 s => $section->id,
142 # class => 'promosuite::Article',
143 class => 'promosuite::News',
144 status => [1,2],
145 offset => $size * ($p-1),
146 limit => $size,
147 order => ['date', 'direct'],
148 ref $document ? (excludes => [$document->id]) : (),
149 return_mode => 'array_ref',
150 );
151 $total = $keeper->get_documents (
152 s => $section->id,
153 # class => 'promosuite::Article',
154 class => 'promosuite::News',
155 status => [1,2],
156 count => 1,
157 );
158
159 if ( $p == 1 && !$document ) {
160 $document = shift @$documents if @$documents;
161 }
162 }
163 </%init>