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 |
|
|
<table border="0" cellspacing="0" cellpadding="10" width="100%"> |
8 |
|
|
<tr valign="top"> |
9 |
|
|
<td width="80%"> |
10 |
|
|
|
11 |
|
|
<a name="members"></a> |
12 |
|
|
%#<div class="mt10"></div> |
13 |
|
|
<table border="0" cellspacing="0" cellpadding="0" width="100%" class="infoblock" style="z-index:1"> |
14 |
|
|
<tr> |
15 |
|
|
<td class="cc" width="100%"> |
16 |
|
|
|
17 |
|
|
<div class="text"> |
18 |
|
|
<h2><% $voting->name %></h2> |
19 |
|
|
% if ( $voting->status == 2 ) { |
20 |
|
|
<p><& /inc/text_format.msn, doc => $voting, field => 'finished' &></p> |
21 |
|
|
% } elsif ( $ok ) { |
22 |
|
|
<p><& /inc/text_format.msn, doc => $voting, field => 'submit' &></p> |
23 |
|
|
% } else { |
24 |
|
|
<p><& /inc/text_format.msn, doc => $voting, field => 'abstr' &></p> |
25 |
|
|
% } |
26 |
|
|
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
<script language="Javascript"> |
30 |
|
|
<!-- |
31 |
|
|
function check_form () { |
32 |
|
|
Form = document.forms.contest; |
33 |
|
|
% foreach my $i ( 1 .. $quest->{freefields_amount} ) { |
34 |
|
|
if ( !Form.freefield_<% $i %>.value ) { |
35 |
|
|
alert ('Вы не заполнили поле "<% $quest->{freefields}->[$i-1] %>"'); |
36 |
|
|
return false; |
37 |
|
|
} |
38 |
|
|
% } |
39 |
|
|
return true; |
40 |
|
|
} |
41 |
|
|
//--> |
42 |
|
|
</script> |
43 |
|
|
|
44 |
|
|
% if ( !$ok && $voting->status == 1 ) { |
45 |
|
|
% if ( ref $quest && $quest->{question_amount} ) { |
46 |
|
|
<form name="contest" action="contest.html" method="post" onsubmit="return check_form()"> |
47 |
|
|
% my $i = 0; |
48 |
|
|
% foreach my $question ( @{ $quest->{questions} } ) { |
49 |
|
|
<p><strong><% ++$i %>. <& /inc/text_format.msn, doc => $voting, text => $question->{question} &></strong><br> |
50 |
|
|
% if ( $question->{amount} ) { |
51 |
|
|
% my $j = 0; |
52 |
|
|
% foreach my $choice ( @{ $question->{choices} } ) { |
53 |
|
|
<input type="Radio" value="<% ++$j %>" name="r<% $i %>"><label><% $choice->{choice} %></label><br> |
54 |
|
|
% } |
55 |
|
|
% } |
56 |
|
|
% } |
57 |
|
|
% } |
58 |
|
|
<p> |
59 |
|
|
% if ( ref $quest && $quest->{freefields_amount} ) { |
60 |
|
|
<table cellpadding="0" cellspacing="10" border="0"> |
61 |
|
|
% my $i = 0; |
62 |
|
|
% foreach my $free ( @{ $quest->{freefields} } ) { |
63 |
|
|
<tr> |
64 |
|
|
<td><% $free %></td> |
65 |
|
|
<td><input type="text" value="" name="freefield_<% ++$i %>" size="23" maxlength="300"></td> |
66 |
|
|
</tr> |
67 |
|
|
% } |
68 |
|
|
% if ( $voting->status == 1 ) { |
69 |
|
|
<tr> |
70 |
|
|
<td></td> |
71 |
|
|
<td><input type="submit" value="Ответить" > |
72 |
|
|
<input type="hidden" name="filled" value="Ответить"> |
73 |
|
|
</td> |
74 |
|
|
</tr> |
75 |
|
|
% } |
76 |
|
|
</table> |
77 |
|
|
% } |
78 |
|
|
|
79 |
|
|
</form> |
80 |
|
|
% } |
81 |
|
|
|
82 |
|
|
|
83 |
|
|
</div> |
84 |
|
|
|
85 |
|
|
</td> |
86 |
|
|
</tr> |
87 |
|
|
</table> |
88 |
|
|
</td> |
89 |
|
|
|
90 |
|
|
% ### Правая колонка |
91 |
|
|
% ############################################### |
92 |
|
|
<td width="20%"> |
93 |
|
|
% if ( $m->comp_exists ("/comps/$prj/right.msn") ) { |
94 |
|
|
<& "/comps/$prj/right.msn" &> |
95 |
|
|
% }else{ |
96 |
|
|
<& /comps/right.msn &> |
97 |
|
|
% } |
98 |
|
|
</td> |
99 |
|
|
% ### /Правая колонка |
100 |
|
|
|
101 |
|
|
</tr> |
102 |
|
|
</table> |
103 |
|
|
|
104 |
|
|
% ### Футер |
105 |
|
|
% ############################################## |
106 |
|
|
% if ( $m->comp_exists ("/comps/$prj/footer.msn") ) { |
107 |
|
|
<& "/comps/$prj/footer.msn" &> |
108 |
|
|
% } else { |
109 |
|
|
<& "/comps/footer.msn" &> |
110 |
|
|
% } |
111 |
|
|
% ### /Футер |
112 |
|
|
|
113 |
|
|
%#<pre><% Dumper($quest) %></pre> |
114 |
|
|
<%args> |
115 |
|
|
|
116 |
|
|
$filled => undef |
117 |
|
|
$name => undef |
118 |
|
|
$phone => undef |
119 |
|
|
$email => undef |
120 |
|
|
$ok => undef |
121 |
|
|
|
122 |
|
|
</%args> |
123 |
|
|
<%init> |
124 |
|
|
|
125 |
|
|
my $prj = $request->{project}; |
126 |
|
|
my $profile = $request->{project_profile}; |
127 |
|
|
my $root = $request->{project_section}; |
128 |
|
|
|
129 |
|
|
my ($voting) = $keeper->get_documents ( |
130 |
|
|
s => $root->id, |
131 |
|
|
class => 'promosuite::Voting', |
132 |
|
|
status => [1,2], |
133 |
|
|
limit => 1, |
134 |
|
|
); |
135 |
|
|
&abort404 unless ref $voting; |
136 |
|
|
my $quest = $voting->get_image('voting'); |
137 |
|
|
|
138 |
|
|
if ($filled) { |
139 |
|
|
$m->comp ( '/subs/count_results.msn', |
140 |
|
|
voting => $voting, |
141 |
|
|
quest => $quest, |
142 |
|
|
%ARGS ); |
143 |
|
|
|
144 |
|
|
$r->header_out("Location", "contest.html?ok=1"); |
145 |
|
|
$r->status(302); |
146 |
|
|
$r->send_http_header(); |
147 |
|
|
$m->abort(); |
148 |
|
|
} |
149 |
|
|
|
150 |
|
|
</%init> |