--- db/prgsrc/db.cgi 2002/05/04 03:35:36 1.63 +++ db/prgsrc/db.cgi 2002/05/14 00:12:35 1.66 @@ -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; @@ -1026,6 +1026,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) { @@ -1038,13 +1040,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); @@ -1651,7 +1653,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");