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 <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 %>. <% $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 % ### Блок внешнего анонса
94 % ################################
95 % if ( $m->comp_exists ("/comps/$prj/block_contest.msn") ) {
96 <& "/comps/$prj/block_contest.msn" &>
97 % } else {
98 <& "/comps/block_contest.msn" &>
99 % }
100 % ### /Блок внешнего анонса
101 %
102 %
103
104 %#<& /www/comps/block_translation.msn &>
105
106 %#<& /www/comps/block_ticket.msn &>
107
108 %#<& /www/comps/block_cover.msn &>
109
110
111 <div class="mt10"></div>
112
113
114 </td></tr>
115 </table>
116
117 % ### Футер
118 % ##############################################
119 % if ( $m->comp_exists ("/comps/$prj/footer.msn") ) {
120 <& "/comps/$prj/footer.msn" &>
121 % } else {
122 <& "/comps/footer.msn" &>
123 % }
124 % ### /Футер
125
126 %#<pre><% Dumper($quest) %></pre>
127 <%once>
128 my %answers = (
129 1 => 'a',
130 2 => 'b',
131 3 => 'c',
132 4 => 'b',
133 5 => 'a',
134 6 => 'c',
135 );
136 </%once>
137 <%args>
138
139 $filled => undef
140 $name => undef
141 $phone => undef
142 $email => undef
143 $ok => undef
144
145 </%args>
146 <%init>
147
148 my $prj = $request->{project};
149 my $profile = $request->{project_profile};
150 my $root = $request->{project_section};
151
152 my ($voting) = $keeper->get_documents (
153 s => $root->id,
154 class => 'promosuite::Voting',
155 status => [1,2],
156 limit => 1,
157 );
158 &abort404 unless ref $voting;
159 my $quest = $voting->get_image('voting');
160
161 if ($filled) {
162 $m->comp ( '/subs/count_results.msn',
163 voting => $voting,
164 quest => $quest,
165 %ARGS );
166
167 $r->header_out("Location", "contest.html?ok=1");
168 $r->status(302);
169 $r->send_http_header();
170 $m->abort();
171 }
172
173 </%init>