version 1.60, 2002/01/15 03:34:31
|
version 1.69, 2002/06/15 02:20:23
|
Line 110 sub GetTourQuestions {
|
Line 110 sub GetTourQuestions {
|
my (@arr, @Questions); |
my (@arr, @Questions); |
|
|
my ($sth) = $dbh->prepare("SELECT QuestionId FROM Questions |
my ($sth) = $dbh->prepare("SELECT QuestionId FROM Questions |
WHERE ParentId=$ParentId"); |
WHERE ParentId=$ParentId order by Number"); |
|
|
$sth->execute; |
$sth->execute; |
|
|
Line 161 sub printform
|
Line 161 sub printform
|
my $inputstring=textfield(-name=>'sstr', |
my $inputstring=textfield(-name=>'sstr', |
-default=>param('sstr')||'', |
-default=>param('sstr')||'', |
-size=>30, |
-size=>30, |
-maxlength=>30); |
-maxlength=>50); |
my $qnumber="Выводить по".br. textfield(-name=>'kvo', |
my $qnumber="Выводить по".br. textfield(-name=>'kvo', |
-default=>param('kvo')||'150', |
-default=>param('kvo')||'150', |
-size=>3, |
-size=>3, |
Line 645 sub PrintList {
|
Line 645 sub PrintList {
|
|
|
print "$nav".br."\n"; |
print "$nav".br."\n"; |
for (my $i = $first; $i <= $last; $i++) { |
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') |
if (param('metod') eq 'rus' || param('metod') eq 'proxy') |
{ |
{ |
$output=~s/\b($shablon)\b/\<strong\>$1\<\/strong\>/gi; |
$output=~s/\b($shablon)\b/\<strong\>$1\<\/strong\>/gi; |
Line 821 sub PrintTournament {
|
Line 821 sub PrintTournament {
|
} |
} |
} else { |
} else { |
my ($qnum) = GetQNum($dbh); |
my ($qnum) = GetQNum($dbh); |
$output .= h2("Банк Вопросов: $qnum вопросов") . p . "\n"; |
$output .= h2("Банк Вопросов: $qnum вопрос".&Suffix($qnum)) |
|
. p . "\n"; |
} |
} |
|
|
for ($i = 0; $i <= $#Tours; $i++) { |
for ($i = 0; $i <= $#Tours; $i++) { |
Line 840 sub PrintTournament {
|
Line 841 sub PrintTournament {
|
$qnum = ''; |
$qnum = ''; |
} |
} |
if ($Tournament{'Type'} =~ /Г/) { |
if ($Tournament{'Type'} =~ /Г/) { |
|
$SingleTour=0; |
$imgsrc = "/icons/folder.gif"; |
$imgsrc = "/icons/folder.gif"; |
$alt = "[*]"; |
$alt = "[*]"; |
} else { |
} else { |
Line 1009 sub PrintField {
|
Line 1011 sub PrintField {
|
$value =~ s/^\s+/<br> /mg; |
$value =~ s/^\s+/<br> /mg; |
$value =~ s/^\|([^\n]*)/<pre>$1<\/pre>/mg; |
$value =~ s/^\|([^\n]*)/<pre>$1<\/pre>/mg; |
$value =~ s/\s+-+\s+/ – /mg; |
$value =~ s/\s+-+\s+/ – /mg; |
$value =~ s/(\s)"/$1“/mg; |
# $value =~ s/(\s)"/$1“/mg; |
$value =~ s/^"/“/mg; |
# $value =~ s/^"/“/mg; |
$value =~ s/"/”/mg; |
# $value =~ s/"/”/mg; |
} |
} |
|
|
|
|
Line 1025 sub PrintQuestion {
|
Line 1027 sub PrintQuestion {
|
my ($dbh, $Id, $answer, $qnum, $title, $text) = @_; |
my ($dbh, $Id, $answer, $qnum, $title, $text) = @_; |
my ($output, $titles) = ('', ''); |
my ($output, $titles) = ('', ''); |
my (%Question) = &GetQuestion($dbh, $Id); |
my (%Question) = &GetQuestion($dbh, $Id); |
|
$qnum = $Question{'Number'} |
|
if ($qnum == 0); |
if (!$text) { |
if (!$text) { |
$output .= hr({width=>"50%"}); |
$output .= hr({width=>"50%"}); |
if ($title) { |
if ($title) { |
Line 1037 sub PrintQuestion {
|
Line 1041 sub PrintQuestion {
|
a({href=>url . "?tour=$fname"}, $Tournament{'Title'}, $Tournament{'PlayedAt'})); |
a({href=>url . "?tour=$fname"}, $Tournament{'Title'}, $Tournament{'PlayedAt'})); |
$titles .= |
$titles .= |
dl(dd(img({src=>"/icons/folder.open.gif"}) . " " . |
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)); |
$output .= dl(strong($titles)); |
} |
} |
|
|
$qnum = $Question{'Number'} |
|
if ($qnum == 0); |
$output.= "<a NAME=\"$qnum\">"; |
|
|
$output .= |
$output .= |
&PrintField("Вопрос $qnum", $Question{'Question'}, $text); |
&PrintField("Вопрос $qnum", $Question{'Question'}, $text); |
|
|
if ($answer) { |
if ($answer==1) { |
$output .= |
$output .= |
&PrintField("Ответ", $Question{'Answer'}, $text); |
&PrintField("Ответ", $Question{'Answer'}, $text); |
|
|
Line 1094 sub PrintQuestion {
|
Line 1098 sub PrintQuestion {
|
$output .= &PrintField("Комментарии", $Question{'Comments'}, $text); |
$output .= &PrintField("Комментарии", $Question{'Comments'}, $text); |
} |
} |
} |
} |
|
elsif ($answer==2) { |
|
my $text=$Question{'Answer'}; |
|
$text=~s/\n/<option>/mg; |
|
$output.="<select><option selected>Ответ:<option>$text</select>"; |
|
$text=$Question{'Comments'}||''; |
|
if ($text) { |
|
$text=~s/\n/<option>/mg; |
|
$output.="<select><option selected>Комментарий:<option>$text</select>" |
|
} |
|
} |
|
elsif ($answer==3) { |
|
$output.= <<EOTT |
|
<div align=right STYLE="cursor:hand;" OnStart="toggle(document.all.HideShow$qnum);" OnClick="toggle(document.all.HideShow$qnum);"> |
|
<font size=-2 color=red> Показать/убрать ответ</font></div> |
|
<span style="display:none" id=HideShow$qnum> |
|
EOTT |
|
.&PrintField("Ответ", $Question{'Answer'}, $text); |
|
if ($Question{'Authors'}) { |
|
$output .= &PrintField("Автор(ы)", $Question{'Authors'}, $text); |
|
} |
|
if ($Question{'Sources'}) { |
|
$output .= &PrintField("Источник(и)", $Question{'Sources'}, $text); |
|
} |
|
|
|
if ($Question{'Comments'}) { |
|
$output .= &PrintField("Комментарии", $Question{'Comments'}, $text); |
|
} |
|
|
|
|
|
$output.="</span>" |
|
|
|
} |
# $output.=br.a({href=> url."?metod=proxy&qid=$Id"}, 'Близкие вопросы').p |
# $output.=br.a({href=> url."?metod=proxy&qid=$Id"}, 'Близкие вопросы').p |
# if $answer; |
# if $answer; |
return $output; |
return $output; |
Line 1650 $sstr=~s/[^йцукенгшщзхъфывапролджэячсмит
|
Line 1686 $sstr=~s/[^йцукенгшщзхъфывапролджэячсмит
|
$tour = ($sth->fetchrow)[0]; |
$tour = ($sth->fetchrow)[0]; |
$sth->finish; |
$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) { |
if (!$text) { |
print &Include_virtual("../dimrub/db/footer.html"); |
print &Include_virtual("../dimrub/db/footer.html"); |
|
print <<EEE |
|
<SCRIPT LANGUAGE="JavaScript"> |
|
function toggle(e) { |
|
if (e.style.display == "none") { |
|
e.style.display=""; |
|
} else { |
|
e.style.display = "none"; |
|
} |
|
} |
|
</SCRIPT> |
|
EEE |
|
; |
print end_html; |
print end_html; |
} |
} |
$dbh->disconnect; |
$dbh->disconnect; |