--- db/prgsrc/db.cgi 2002/05/10 16:42:40 1.64 +++ db/prgsrc/db.cgi 2002/06/15 02:20:23 1.69 @@ -110,7 +110,7 @@ sub GetTourQuestions { my (@arr, @Questions); my ($sth) = $dbh->prepare("SELECT QuestionId FROM Questions - WHERE ParentId=$ParentId"); + WHERE ParentId=$ParentId order by Number"); $sth->execute; @@ -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++) { @@ -1026,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) { @@ -1038,18 +1041,18 @@ 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); - if ($answer) { + if ($answer==1) { $output .= &PrintField("Ответ", $Question{'Answer'}, $text); @@ -1095,6 +1098,38 @@ sub PrintQuestion { $output .= &PrintField("Комментарии", $Question{'Comments'}, $text); } } + elsif ($answer==2) { + my $text=$Question{'Answer'}; + $text=~s/\n/