Revision 296 (by ahitrov, 2013/03/26 17:59:01) Promosite (anthill) project source
<h1><% $voting->name %></h1>
<p><% $voting->abstr %></p>

<form action="./get_vote.html" method="POST">
%	my $num = 0;
%	foreach my $id (1..$question_set->{question_amount})
%	{
%		$num++;
%		my $question = $question_set->{questions}->[$id-1];
%		next unless ($question->{question} && $question->{amount});
%		my $question_name = $question->{question};
%		my $qimg_src;
%		if ( $question_name =~ /<%\s*\w+_(\d+)\s*%>/i ) {
%			my $index = $1;
%			if ( ref $pictures && exists $pictures->{"image_$index"} ) {
%				my $img = $pictures->{"image_$index"};
%				my $mini = $pictures->{"image_$index"}{mini};
%				$qimg_src = '<a href="/images/'.$img->{filename}.'" rel="lightbox" title=""><img src="/images/'.$mini->{filename}.'" width="'.$mini->{width}.'" height="'.$mini->{height}.'" hspace="5"></a>';
%			}
%			$question_name =~ s/<%\s*\w+_(\d+)\s*%>/$qimg_src/i;
%		}

<h2>\
%#		if ( $qimg_src ) {
%#<% $qimg_src %><br>\
%#		}
%		if ( $question_name ) {
<% $question_name %>\
%		}
</h2>
%		if ($question->{allow_multi}) {
%#			<i>(можно выбрать несколько вариантов ответа)</i>
%		}
%		my $type = "radio";
%		$type = "checkbox" if $question->{allow_multi};
	<div class="eda">
%		if ( $question->{range} ) {
	<table cellspacing="1" cellpadding="3">
	<tr><td></td><% map { '<td align="center">'.$_.'</td>' } (1..10) %></tr>
%		}
%		my @random;
%		if ( ref $question->{choices} eq 'ARRAY' ) {
%			my $i = 1;
%			map { $_->{id} = $i++; } @{ $question->{choices} };
%			@random = grep { $_->{random} } @{ $question->{choices} };
%		}
%		foreach my $choice_id (1..$question->{amount}) {
%			my $choice;
%			if ( $question->{choices}->[$choice_id-1]->{random} ) {
%				($choice) = splice(@random, int(rand(scalar @random)), 1);
%			} else {
%				$choice = $question->{choices}->[$choice_id-1];
%			}
%			my $choice_name = $choice->{choice};
%			my $img_src;
%			if ( $choice_name =~ /<%\s*\w+_(\d+)\s*%>/i ) {
%				my $index = $1;
%				if ( ref $pictures && exists $pictures->{"image_$index"} ) {
%					my $img = $pictures->{"image_$index"};
%					my $mini = $pictures->{"image_$index"}{mini};
%					$img_src = '<a href="/images/'.$img->{filename}.'" rel="lightbox" title=""><img src="/images/'.$mini->{filename}.'" width="'.$mini->{width}.'" height="'.$mini->{height}.'"></a>';
%				}
%				$choice_name =~ s/<%\s*\w+_(\d+)\s*%>//i;
%			}
%			if ( $img_src && $choice_name ) {
                <% $img_src %><br>
%			}
%			if ( $question->{range} ) {
	<tr valign="top" bgcolor="<% $choice_id % 2 ? '#e0e0e0' : 'white' %>"><td><% $choice_name || $img_src %></td>
%			for ( 1..$question->{range} ) {
	<td><input type="radio" name="question<% $id %>_<% $choice->{id} %>" value="<% $_ %>"></td>\
%			}
	</tr>
%			} else {
		<input type="<% $type %>" name="question<% $id %>" value="<% $choice->{id} %>"><% $choice_name || $img_src %><br>
%			}
%		}
%		if ( $question->{range} ) {
	</table>
%		}
	</div>

%	}

<div class="r--normal edac">

%       foreach my $id (1..$question_set->{freefields_amount}) {

	<div class="t-text"><% $question_set->{freefields}[1-$id] %></div>
	<div class="t-bull"><input type="text" name="freefield<% $id %>" value=""></div>
	<div class="cls"></div>
%       }

	<div><input type="Submit" value=" Отправить " class="btn"></div>
</div>

<input type="hidden" name="vote" value="<% $voting->id %>">
%#<input type="hidden" name="place" value="<% $place %>">
%#<input type="hidden" name="_URL" value="http://<% $state->{httpd_server} %>/result.html?rubric=<% $rubric %>&id=<% $voting->id() %>">

</form>

<%args>

	$voting	=> undef

</%args>
<%init>

  return	unless ref $voting;

  my $question_set=$voting->get_image('voting');
  my $pictures = $voting->get_image('pictures');


</%init>