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", alias => 'news' &>
% } else {
<& "/comps/header.msn", alias => 'news' &>
% }

%
% if ( $id && ref $document ) {
%       ### Текст новости
%       #######################################################
%	if ( $m->comp_exists ("/comps/$prj/article.msn") ) {
<& "/comps/$prj/article.msn", document => $document &>
%	} else {
<& "/comps/article.msn", document => $document &>
%	}
%
% } ### /Одна Новость
% 
% ### Список новостей
% #######################################################
% if ( ref $section ) {
%	if ( $m->comp_exists ("/comps/$prj/news_list.msn") ) {
<& "/comps/$prj/news_list.msn", id => $id, p => $p, size => $profile->news_count || 10  &>
%	} else {
<& "/comps/news_list.msn", id => $id, p => $p, size => $profile->news_count || 10 &>
%	}
% }

% ### Футер
% ##############################################
% if ( $m->comp_exists ("/comps/$prj/footer.msn") ) {
<& "/comps/$prj/footer.msn" &>
% } else {
<& "/comps/footer.msn" &>
% }
% ### /Футер
<%args>

        $p      => 1
        $id     => undef

</%args>
<%init>

  my $prj = $request->{project};
  my $profile = $request->{project_profile};
  my $root = $request->{project_section};
  &abort404     if $id && $id !~ /^\d+$/;

  my $document;
  my ($section) = $keeper->get_sections (
		s	=> $root->id,
		class	=> 'promosuite::NewsSection',
		limit	=> 1,
		status	=> 1,
	);
  if ( $id && ref $section ) {
	$document = $keeper->get_document_by_id ($id,
		s	=> $section->id,
#		class	=> 'promosuite::Article',
		class   => 'promosuite::News',
		status	=> [1,2],
        );
  }
</%init>