1 |
296 |
ahitrov |
<h1><% $voting->name %></h1> |
2 |
|
|
<p><% $voting->abstr %></p> |
3 |
|
|
|
4 |
|
|
<form action="./get_vote.html" method="POST"> |
5 |
|
|
% my $num = 0; |
6 |
|
|
% foreach my $id (1..$question_set->{question_amount}) |
7 |
|
|
% { |
8 |
|
|
% $num++; |
9 |
|
|
% my $question = $question_set->{questions}->[$id-1]; |
10 |
|
|
% next unless ($question->{question} && $question->{amount}); |
11 |
|
|
% my $question_name = $question->{question}; |
12 |
|
|
% my $qimg_src; |
13 |
|
|
% if ( $question_name =~ /<%\s*\w+_(\d+)\s*%>/i ) { |
14 |
|
|
% my $index = $1; |
15 |
|
|
% if ( ref $pictures && exists $pictures->{"image_$index"} ) { |
16 |
|
|
% my $img = $pictures->{"image_$index"}; |
17 |
|
|
% my $mini = $pictures->{"image_$index"}{mini}; |
18 |
|
|
% $qimg_src = '<a href="/images/'.$img->{filename}.'" rel="lightbox" title=""><img src="/images/'.$mini->{filename}.'" width="'.$mini->{width}.'" height="'.$mini->{height}.'" hspace="5"></a>'; |
19 |
|
|
% } |
20 |
|
|
% $question_name =~ s/<%\s*\w+_(\d+)\s*%>/$qimg_src/i; |
21 |
|
|
% } |
22 |
|
|
|
23 |
|
|
<h2>\ |
24 |
|
|
%# if ( $qimg_src ) { |
25 |
|
|
%#<% $qimg_src %><br>\ |
26 |
|
|
%# } |
27 |
|
|
% if ( $question_name ) { |
28 |
|
|
<% $question_name %>\ |
29 |
|
|
% } |
30 |
|
|
</h2> |
31 |
|
|
% if ($question->{allow_multi}) { |
32 |
|
|
%# <i>(можно выбрать несколько вариантов ответа)</i> |
33 |
|
|
% } |
34 |
|
|
% my $type = "radio"; |
35 |
|
|
% $type = "checkbox" if $question->{allow_multi}; |
36 |
|
|
<div class="eda"> |
37 |
|
|
% if ( $question->{range} ) { |
38 |
|
|
<table cellspacing="1" cellpadding="3"> |
39 |
|
|
<tr><td></td><% map { '<td align="center">'.$_.'</td>' } (1..10) %></tr> |
40 |
|
|
% } |
41 |
|
|
% my @random; |
42 |
|
|
% if ( ref $question->{choices} eq 'ARRAY' ) { |
43 |
|
|
% my $i = 1; |
44 |
|
|
% map { $_->{id} = $i++; } @{ $question->{choices} }; |
45 |
|
|
% @random = grep { $_->{random} } @{ $question->{choices} }; |
46 |
|
|
% } |
47 |
|
|
% foreach my $choice_id (1..$question->{amount}) { |
48 |
|
|
% my $choice; |
49 |
|
|
% if ( $question->{choices}->[$choice_id-1]->{random} ) { |
50 |
|
|
% ($choice) = splice(@random, int(rand(scalar @random)), 1); |
51 |
|
|
% } else { |
52 |
|
|
% $choice = $question->{choices}->[$choice_id-1]; |
53 |
|
|
% } |
54 |
|
|
% my $choice_name = $choice->{choice}; |
55 |
|
|
% my $img_src; |
56 |
|
|
% if ( $choice_name =~ /<%\s*\w+_(\d+)\s*%>/i ) { |
57 |
|
|
% my $index = $1; |
58 |
|
|
% if ( ref $pictures && exists $pictures->{"image_$index"} ) { |
59 |
|
|
% my $img = $pictures->{"image_$index"}; |
60 |
|
|
% my $mini = $pictures->{"image_$index"}{mini}; |
61 |
|
|
% $img_src = '<a href="/images/'.$img->{filename}.'" rel="lightbox" title=""><img src="/images/'.$mini->{filename}.'" width="'.$mini->{width}.'" height="'.$mini->{height}.'"></a>'; |
62 |
|
|
% } |
63 |
|
|
% $choice_name =~ s/<%\s*\w+_(\d+)\s*%>//i; |
64 |
|
|
% } |
65 |
|
|
% if ( $img_src && $choice_name ) { |
66 |
|
|
<% $img_src %><br> |
67 |
|
|
% } |
68 |
|
|
% if ( $question->{range} ) { |
69 |
|
|
<tr valign="top" bgcolor="<% $choice_id % 2 ? '#e0e0e0' : 'white' %>"><td><% $choice_name || $img_src %></td> |
70 |
|
|
% for ( 1..$question->{range} ) { |
71 |
|
|
<td><input type="radio" name="question<% $id %>_<% $choice->{id} %>" value="<% $_ %>"></td>\ |
72 |
|
|
% } |
73 |
|
|
</tr> |
74 |
|
|
% } else { |
75 |
|
|
<input type="<% $type %>" name="question<% $id %>" value="<% $choice->{id} %>"><% $choice_name || $img_src %><br> |
76 |
|
|
% } |
77 |
|
|
% } |
78 |
|
|
% if ( $question->{range} ) { |
79 |
|
|
</table> |
80 |
|
|
% } |
81 |
|
|
</div> |
82 |
|
|
|
83 |
|
|
% } |
84 |
|
|
|
85 |
|
|
<div class="r--normal edac"> |
86 |
|
|
|
87 |
|
|
% foreach my $id (1..$question_set->{freefields_amount}) { |
88 |
|
|
|
89 |
|
|
<div class="t-text"><% $question_set->{freefields}[1-$id] %></div> |
90 |
|
|
<div class="t-bull"><input type="text" name="freefield<% $id %>" value=""></div> |
91 |
|
|
<div class="cls"></div> |
92 |
|
|
% } |
93 |
|
|
|
94 |
|
|
<div><input type="Submit" value=" Отправить " class="btn"></div> |
95 |
|
|
</div> |
96 |
|
|
|
97 |
|
|
<input type="hidden" name="vote" value="<% $voting->id %>"> |
98 |
|
|
%#<input type="hidden" name="place" value="<% $place %>"> |
99 |
|
|
%#<input type="hidden" name="_URL" value="http://<% $state->{httpd_server} %>/result.html?rubric=<% $rubric %>&id=<% $voting->id() %>"> |
100 |
|
|
|
101 |
|
|
</form> |
102 |
|
|
|
103 |
|
|
<%args> |
104 |
|
|
|
105 |
|
|
$voting => undef |
106 |
|
|
|
107 |
|
|
</%args> |
108 |
|
|
<%init> |
109 |
|
|
|
110 |
|
|
return unless ref $voting; |
111 |
|
|
|
112 |
|
|
my $question_set=$voting->get_image('voting'); |
113 |
|
|
my $pictures = $voting->get_image('pictures'); |
114 |
|
|
|
115 |
|
|
|
116 |
|
|
</%init> |