--- db/prgsrc/db.cgi 2002/01/25 20:47:29 1.62 +++ db/prgsrc/db.cgi 2002/06/08 10:07:14 1.67 @@ -645,7 +645,7 @@ sub PrintList { print "$nav".br."\n"; for (my $i = $first; $i <= $last; $i++) { - my $output = &PrintQuestion($dbh, $$Questions[$i-1], 1, $i, 1); + my $output = &PrintQuestion($dbh, $$Questions[$i-1], 1, 0, 1); if (param('metod') eq 'rus' || param('metod') eq 'proxy') { $output=~s/\b($shablon)\b/\$1\<\/strong\>/gi; @@ -821,7 +821,8 @@ sub PrintTournament { } } else { my ($qnum) = GetQNum($dbh); - $output .= h2("Банк Вопросов: $qnum вопросов") . p . "\n"; + $output .= h2("Банк Вопросов: $qnum вопрос".&Suffix($qnum)) + . p . "\n"; } for ($i = 0; $i <= $#Tours; $i++) { @@ -840,6 +841,7 @@ sub PrintTournament { $qnum = ''; } if ($Tournament{'Type'} =~ /Г/) { + $SingleTour=0; $imgsrc = "/icons/folder.gif"; $alt = "[*]"; } else { @@ -1025,6 +1027,8 @@ sub PrintQuestion { my ($dbh, $Id, $answer, $qnum, $title, $text) = @_; my ($output, $titles) = ('', ''); my (%Question) = &GetQuestion($dbh, $Id); + $qnum = $Question{'Number'} + if ($qnum == 0); if (!$text) { $output .= hr({width=>"50%"}); if ($title) { @@ -1037,13 +1041,13 @@ sub PrintQuestion { a({href=>url . "?tour=$fname"}, $Tournament{'Title'}, $Tournament{'PlayedAt'})); $titles .= dl(dd(img({src=>"/icons/folder.open.gif"}) . " " . - a({href=>url . "?tour=$fname.$Tour{Number}"}, $Tour{'Title'}))); + a({href=>url . "?tour=$fname.$Tour{Number}#$qnum"}, $Tour{'Title'}))); } $output .= dl(strong($titles)); } - $qnum = $Question{'Number'} - if ($qnum == 0); + + $output.= ""; $output .= &PrintField("Вопрос $qnum", $Question{'Question'}, $text); @@ -1650,7 +1654,20 @@ $sstr=~s/[^йцукенгшщзхъфывапролджэячсмит $tour = ($sth->fetchrow)[0]; $sth->finish; } - print &PrintTournament($dbh, $tour, param('answer')); + my $QuestionNumber=0; + my $qnum; + if ($qnum=param('qnumber')){ + my ($sth) = $dbh->prepare("SELECT QuestionId FROM Questions + WHERE ParentId=$tour AND Number=$qnum"); + $sth->execute; + $QuestionNumber=($sth->fetchrow)[0]||0; + } + if ($QuestionNumber) { + print &PrintQuestion($dbh, $QuestionNumber, param('answer')||0, $qnum, 1); +# $dbh, $Id, $answer, $qnum, $title, $text + } else { + print &PrintTournament($dbh, $tour, param('answer')); + } } if (!$text) { print &Include_virtual("../dimrub/db/footer.html");