Line # Revision Author
1 296 ahitrov <%args>
2
3 $CP => undef
4
5 </%args>
6 <%init>
7
8 my $prj = $request->{project};
9 my $profile = $request->{project_profile};
10 my $root = $request->{project_section};
11
12 my $emailto = $profile->mailto || 'ahitrov@mail.ru';
13
14 return 'Вы не указали имя' unless $ARGS{name};
15 $ARGS{name} = Convert::Cyrillic::cstocs($CP, 'UTF8', $ARGS{name});
16
17 return 'Вы не указали фамилию' unless $ARGS{lastname};
18 $ARGS{lastname} = Convert::Cyrillic::cstocs($CP, 'UTF8', $ARGS{lastname});
19
20 $ARGS{job} = Convert::Cyrillic::cstocs($CP, 'UTF8', $ARGS{job});
21 $ARGS{position} = Convert::Cyrillic::cstocs($CP, 'UTF8', $ARGS{position});
22
23 return 'Вы не заполнили адрес электронной почты' unless $ARGS{email};
24
25 return 'Вы не заполнили поле вопроса' unless $ARGS{question};
26 $ARGS{question} = Convert::Cyrillic::cstocs($CP, 'UTF8', $ARGS{question});
27
28 return 'Вы не заполнили поле вопроса' unless $ARGS{question};
29
30 my ($document, $section);
31 if ( $ARGS{doc_id} ) {
32 $document = $keeper->get_document_by_id ( $ARGS{doc_id},
33 class => 'promosuite::Article',
34 );
35 }
36 if ( ref $document && $document->sections ) {
37 ($section) = $keeper->get_sections (
38 id => $document->{sections},
39 class => 'promosuite::SubSection',
40 limit => 1,
41 order_by => 'sorder',
42 );
43 }
44 if ( $ARGS{email} =~ /([\w\.-]+)\@([a-zA-Z\.-]+)/ ) {
45 my $msg = {
46 to => $emailto,
47 from => $ARGS{email},
48 subject => 'RAMBLER 2 Developers - обратная связь на проекте',
49 body => $m->scomp ("/comps/$prj/feedback_template.msn", section => $section, doc => $document, %ARGS),
50 };
51 $m->comp('/subs/sendmail.msn', email => $msg) if $msg->{body};
52 } else {
53 return 'Указан неверный e-mail';
54 }
55
56 return undef;
57
58 </%init>