version 1.78, 2002/11/10 16:10:53
|
version 1.81, 2003/01/12 09:51:35
|
Line 779 print "$query" if $printqueries;
|
Line 779 print "$query" if $printqueries;
|
|
|
sub PrintRandom { |
sub PrintRandom { |
my ($dbh, $type, $num, $text) = @_; |
my ($dbh, $type, $num, $text) = @_; |
|
my $razd=param('razd'); |
|
my $answer=$razd?0:1; |
my (@Questions) = &Get12Random($dbh, $type, $num); |
my (@Questions) = &Get12Random($dbh, $type, $num); |
my ($output, $i) = ('', 0); |
my ($output, $i) = ('', 0); |
|
|
Line 793 sub PrintRandom {
|
Line 795 sub PrintRandom {
|
# Passing DB handler, question ID, print answer, question |
# Passing DB handler, question ID, print answer, question |
# number, print title, print text/html |
# number, print title, print text/html |
$output .= |
$output .= |
&PrintQuestion($dbh, $Questions[$i], 1, $i + 1, 0, $text); |
&PrintQuestion($dbh, $Questions[$i], $answer, $i + 1, 0, $text); |
} |
} |
|
unless ($answer ) |
|
{ |
|
$output.=$text?"\n".('-'x 20)."\nОтветы\n~~~~~~\n\n":h2('Ответы'); |
|
for ($i = 0; $i <= $#Questions; $i++) { |
|
$output .= |
|
&PrintQuestion($dbh, $Questions[$i], -1, $i + 1, 0, $text); |
|
} |
|
} |
|
|
return $output; |
return $output; |
} |
} |
|
|
Line 1041 sub PrintField {
|
Line 1052 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/(http:\/\/\S+[^\s\)\(\,\.])/<a href="$1">$1<\/a>/g if $header !~ /^Авто/; |
|
# $value =~ s/(http:\/\/(?:\w+.)+[\w\\\~]+(\?[^\s.]+)?)/<a href="$1">$1<\/a>/g if $header !~ /^Авто/; |
# $value =~ s/(\s)"/$1“/mg; |
# $value =~ s/(\s)"/$1“/mg; |
# $value =~ s/^"/“/mg; |
# $value =~ s/^"/“/mg; |
# $value =~ s/"/”/mg; |
# $value =~ s/"/”/mg; |
Line 1060 sub PrintQuestion {
|
Line 1073 sub PrintQuestion {
|
$qnum = $Question{'Number'} |
$qnum = $Question{'Number'} |
if ($qnum == 0); |
if ($qnum == 0); |
if (!$text) { |
if (!$text) { |
$output .= hr({width=>"50%"}); |
$output .= hr({width=>"50%"}) if $answer>=0; |
if ($title) { |
if ($title) { |
my (%Tour) = GetTournament($dbh, $Question{'ParentId'}); |
my (%Tour) = GetTournament($dbh, $Question{'ParentId'}); |
my (%Tournament) = GetTournament($dbh, $Tour{'ParentId'}); |
my (%Tournament) = GetTournament($dbh, $Tour{'ParentId'}); |
my $fname=$Tournament{'FileName'}; |
my $fname=$Tournament{'FileName'}; |
return "" if $fname=~/mgp0203/; |
#return "" if $fname=~/mgp0203/; |
$fname=~s/\.txt//; |
$fname=~s/\.txt//; |
$titles .= |
$titles .= |
dd(img({src=>"/icons/folder.open.gif"}) . " " . |
dd(img({src=>"/icons/folder.open.gif"}) . " " . |
Line 1078 return "" if $fname=~/mgp0203/;
|
Line 1091 return "" if $fname=~/mgp0203/;
|
} |
} |
|
|
|
|
$output.= "<a NAME=\"$qnum\">"; |
$output.= "<a NAME=\"$qnum\">" unless $text; |
|
|
$output .= |
if ($answer>=0) {$output .= |
&PrintField("Вопрос $qnum", $Question{'Question'}, $text); |
&PrintField("Вопрос $qnum", $Question{'Question'}, $text);} |
|
else {$output .="$qnum. "} |
if ($answer==1) { |
if ($answer==1|| $answer==-1) { |
$output .= |
$output .= |
&PrintField("Ответ", $Question{'Answer'}, $text); |
&PrintField("Ответ", $Question{'Answer'}, $text); |
|
|
if ($Question{'Authors'}) { |
if ($Question{'Authors'} ) { |
my $q=$Question{'Authors'}; |
my $q=$Question{'Authors'}; |
###АВТОРА!! |
###АВТОРА!! |
my $sth=$dbh->prepare("select Authors.Id,Name, Surname, Nicks from Authors, A2Q |
my $sth=$dbh->prepare("select Authors.Id,Name, Surname, Nicks from Authors, A2Q |
where Authors.Id=Author And Question=$Id"); |
where Authors.Id=Author And Question=$Id"); |
$sth->execute; |
$sth->execute; |
my ($AuthorId,$Name, $Surname,$other,$Nicks); |
my ($AuthorId,$Name, $Surname,$other,$Nicks); |
|
if (!$text) { |
while ((($AuthorId,$Name, $Surname,$Nicks)=$sth->fetchrow),$AuthorId) |
while ((($AuthorId,$Name, $Surname,$Nicks)=$sth->fetchrow),$AuthorId) |
{ |
{ |
my ($firstletter)=$Name=~m/^./g; |
my ($firstletter)=$Name=~m/^./g; |
Line 1115 return "" if $fname=~/mgp0203/;
|
Line 1128 return "" if $fname=~/mgp0203/;
|
} |
} |
$q=~s/($sha)/a({href=>url."?qofauthor=$AuthorId"},$1)/ei; |
$q=~s/($sha)/a({href=>url."?qofauthor=$AuthorId"},$1)/ei; |
} |
} |
|
} |
$output .= &PrintField("Автор(ы)", $q, $text); |
$output .= &PrintField("Автор(ы)", $q, $text); |
|
|
} |
} |
Line 1156 EOTT
|
Line 1169 EOTT
|
$output .= &PrintField("Комментарии", $Question{'Comments'}, $text); |
$output .= &PrintField("Комментарии", $Question{'Comments'}, $text); |
} |
} |
|
|
|
$output=~s/(pic:[^\)]*)/<img src="\/images\/$1">/g; |
|
|
$output.="</span>" |
$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>0 && !$text; |
return $output; |
return $output; |
} |
} |
|
|