package promosuite::News; use strict; use vars qw(@ISA); use Contenido::Document; use Time::ParseDate; use Contenido::Globals; @ISA = ('Contenido::Document'); sub extra_properties { return ( { 'attr' => 'status', 'type' => 'status', 'rusname' => 'Статус новости', 'cases' => [ [0, 'Новость не активна'], [1, 'Обычная новость'], [2, 'Новость в блоке'], [3, 'Новость импортирована'], ], }, { 'attr' => 'abstr', 'type' => 'text', 'rusname' => 'Аннотация', 'rows' => 10 }, { 'attr' => 'body', 'type' => 'text', 'rusname' => 'Текст статьи', 'rows' => 40 }, { 'attr' => 'author', 'type' => 'string', 'rusname' => 'Автор статьи' }, { 'attr' => 'source', 'type' => 'string', 'rusname' => 'Источник' }, { 'attr' => 'source_id', 'type' => 'pickup', 'rusname' => 'Источник из базы', lookup_opts => { class => 'promosuite::Source', search_by => 'name' }, }, { 'attr' => 'url', 'type' => 'string', 'rusname' => 'URL оригинала' }, { 'attr' => 'icon', 'type' => 'image', 'rusname' => 'Иконка для выноски', preview => ['100x100', '50x50'] }, { 'attr' => 'picture', 'type' => 'image', 'rusname' => 'Иллюстрация к статье', preview => '100x100' }, { 'attr' => 'file1', 'type' => 'multimedia_new', 'rusname' => 'Прицепленный документ 1', iattrs => ['alt'], softrename => 1 }, { 'attr' => 'file2', 'type' => 'multimedia_new', 'rusname' => 'Прицепленный документ 2', iattrs => ['alt'], softrename => 1 }, { 'attr' => 'pictures', 'type' => 'images', 'rusname' => 'Список иллюстраций', preview => '240x240' }, ) } sub class_name { return 'Новость'; } sub class_description { return 'Новость'; } sub class_table { return 'promosuite::SQL::NewsTable'; } sub export_to_search { my $self=shift; my $keeper = $self->{keeper}; my $xml; my %path; foreach ('style', 'auto', 'home', 'money') { $path{ $project->s_alias->{$_} } = $_; } my @sections = $self->sections; my $main_sect = $keeper->get_section_by_id($sections[0]); unless($main_sect) { warn "wrong section stucture for mediapps::Article $self->{id}\n"; return undef; } my $app = $main_sect->pid(); $xml = "mtime(), UK=>1)."\" status=\"".($self->status() ? "add" : "del")."\">\n"; #$xml .= "section()."\" name=\"".$keeper->get_section_by_id($self->section())->name()."\"/>\n"; $xml .= "name()."]]>\n"; $xml .= "body()."]]>\n\n"; return $xml; } sub contenido_status_style { my $self = shift; if ( $self->status == 3 ) { return 'color:green;'; } if ( $self->status == 2 ) { return 'color:red;'; } } 1;