Revision 296 (by ahitrov, 2013/03/26 17:59:01) |
Promosite (anthill) project source
|
% if ( $m->comp_exists ("/comps/$prj/header.msn") ) {
<& "/comps/$prj/header.msn" &>
% } else {
<& "/comps/header.msn" &>
% }
<table border="0" cellspacing="0" cellpadding="10" width="100%">
<tr valign="top">
<td width="80%">
<a name="members"></a>
%#<div class="mt10"></div>
<table border="0" cellspacing="0" cellpadding="0" width="100%" class="infoblock" style="z-index:1">
<tr>
<td class="cc" width="100%">
<div class="text">
<h2><% $voting->name %></h2>
% if ( $voting->status == 2 ) {
<p><& /inc/text_format.msn, doc => $voting, field => 'finished' &></p>
% } elsif ( $ok ) {
<p><& /inc/text_format.msn, doc => $voting, field => 'submit' &></p>
% } else {
<p><& /inc/text_format.msn, doc => $voting, field => 'abstr' &></p>
% }
<script language="Javascript">
<!--
function check_form () {
Form = document.forms.contest;
% foreach my $i ( 1 .. $quest->{freefields_amount} ) {
if ( !Form.freefield_<% $i %>.value ) {
alert ('Вы не заполнили поле "<% $quest->{freefields}->[$i-1] %>"');
return false;
}
% }
return true;
}
//-->
</script>
% if ( !$ok && $voting->status == 1 ) {
% if ( ref $quest && $quest->{question_amount} ) {
<form name="contest" action="contest.html" method="post" onsubmit="return check_form()">
% my $i = 0;
% foreach my $question ( @{ $quest->{questions} } ) {
<p><strong><% ++$i %>. <& /inc/text_format.msn, doc => $voting, text => $question->{question} &></strong><br>
% if ( $question->{amount} ) {
% my $j = 0;
% foreach my $choice ( @{ $question->{choices} } ) {
<input type="Radio" value="<% ++$j %>" name="r<% $i %>"><label><% $choice->{choice} %></label><br>
% }
% }
% }
% }
<p>
% if ( ref $quest && $quest->{freefields_amount} ) {
<table cellpadding="0" cellspacing="10" border="0">
% my $i = 0;
% foreach my $free ( @{ $quest->{freefields} } ) {
<tr>
<td><% $free %></td>
<td><input type="text" value="" name="freefield_<% ++$i %>" size="23" maxlength="300"></td>
</tr>
% }
% if ( $voting->status == 1 ) {
<tr>
<td></td>
<td><input type="submit" value="Ответить" >
<input type="hidden" name="filled" value="Ответить">
</td>
</tr>
% }
</table>
% }
</form>
% }
</div>
</td>
</tr>
</table>
</td>
% ### Правая колонка
% ###############################################
<td width="20%">
% if ( $m->comp_exists ("/comps/$prj/right.msn") ) {
<& "/comps/$prj/right.msn" &>
% }else{
<& /comps/right.msn &>
% }
</td>
% ### /Правая колонка
</tr>
</table>
% ### Футер
% ##############################################
% if ( $m->comp_exists ("/comps/$prj/footer.msn") ) {
<& "/comps/$prj/footer.msn" &>
% } else {
<& "/comps/footer.msn" &>
% }
% ### /Футер
%#<pre><% Dumper($quest) %></pre>
<%args>
$filled => undef
$name => undef
$phone => undef
$email => undef
$ok => undef
</%args>
<%init>
my $prj = $request->{project};
my $profile = $request->{project_profile};
my $root = $request->{project_section};
my ($voting) = $keeper->get_documents (
s => $root->id,
class => 'promosuite::Voting',
status => [1,2],
limit => 1,
);
&abort404 unless ref $voting;
my $quest = $voting->get_image('voting');
if ($filled) {
$m->comp ( '/subs/count_results.msn',
voting => $voting,
quest => $quest,
%ARGS );
$r->header_out("Location", "contest.html?ok=1");
$r->status(302);
$r->send_http_header();
$m->abort();
}
</%init>