--- db/prgsrc/db.cgi 2004/05/02 20:48:30 1.134 +++ db/prgsrc/db.cgi 2004/08/28 23:47:41 1.135 @@ -48,7 +48,7 @@ if ($^O =~ /win/i) { my $usehtml=$opt_z||0; $usehtml=1; -$usehtml=0 if $url=~/zaba/; +$usehtml=0 if $url=~/zaba/ || $url=~/localhost/; my $usewas=0; my $cashednumber=500; @@ -92,8 +92,8 @@ POSIX::setlocale( &POSIX::LC_ALL, $thisl if ((uc 'а') ne 'А') {print STDERR "Koi8-r locale not installed!\n"}; -my %fieldname= (0,'Question', 1, 'Answer', 2, 'Comments', 3, 'Authors', 4, 'Sources'); -my %rusfieldname=('Question','Вопрос', 'Answer', 'Ответ', +my %fieldname= (0,'Question', 1, 'Answer', 2, 'PassCriteria', 3, 'Comments', 4, 'Authors', 5, 'Sources'); +my %rusfieldname=('Question','Вопрос', 'Answer', 'Ответ', 'PassCriteria','Зачёт', 'Comments', 'Комментарии', 'Authors', 'Автор', 'Sources', 'Источник','old','Старый','rus','Новый', 'chgk', 'ЧГК', 'brain', 'Брейн-ринг','game', 'Своя игра', @@ -206,12 +206,12 @@ sub GetTournament { sub fetchquestion { my ($sth,$q,$WithTour)=@_; if ($WithTour) { - ($$q{'QuestionId'}, $$q{'Question'},$$q{'Answer'},$$q{'Comments'},$$q{'Authors'},$$q{'Sources'}, + ($$q{'QuestionId'}, $$q{'Question'},$$q{'Answer'},$$q{'PassCriteria'},$$q{'Comments'},$$q{'Authors'},$$q{'Sources'}, $$q{'Number'}, $$q{'Title'}, $$q{'TourTitle'}, $$q{'FileName'},$$q{'PlayedAt'},$$q{'TourNumber'}) = $sth->fetchrow; } else { - ($$q{'QuestionId'}, $$q{'Question'},$$q{'Answer'},$$q{'Comments'},$$q{'Authors'},$$q{'Sources'}, + ($$q{'QuestionId'}, $$q{'Question'},$$q{'Answer'},$$q{'PassCriteria'},$$q{'Comments'},$$q{'Authors'},$$q{'Sources'}, $$q{'Number'})= $sth->fetchrow; } @@ -233,13 +233,13 @@ sub SelectQuestions { my $query; if ($WithTour) { - $query="SELECT QuestionId, Questions.Question, Answer, Comments, Authors, Sources, + $query="SELECT QuestionId, Questions.Question, Answer, PassCriteria, Comments, Authors, Sources, Questions.Number , t2.Title, t1.Title, t2.FileName, t2.PlayedAt,t1.Number from Questions,Tournaments as t1, Tournaments as t2 WHERE $where"; } else { - $query="SELECT QuestionId, Questions.Question, Answer, Comments, Authors, Sources, + $query="SELECT QuestionId, Questions.Question, Answer, PassCriteria, Comments, Authors, Sources, Questions.Number from Questions WHERE $where"; } @@ -357,11 +357,11 @@ sub printform my $sstr=param('sstr'); my @df=keys %searchin; my %checked; - $checked{lc $_}="" foreach ('Question','Answer','Comments','Authors','Sources','old','rus', + $checked{lc $_}="" foreach ('Question','Answer','PassCriteria','Comments','Authors','Sources','old','rus', 'chgk','brain','igp','game','ehruditka','beskrylka'); @df=('Question', 'Answer') unless @df; $checked{lc $_}="checked" foreach @df; - my $fields=checkbox_group('searchin',['Question','Answer','Comments','Authors','Sources'], [@df], + my $fields=checkbox_group('searchin',['Question','Answer','PassCriteria','Comments','Authors','Sources'], [@df], 'false',\%rusfieldname); @df=param('type'); @df=('chgk','brain','igp','game','ehruditka','beskrylka') unless @df; @@ -387,7 +387,7 @@ action="/znatoki/cgi-bin/db.cgi"> -
Вариант поиска: - + Простой (старый)  "Что? Где? Когда?" @@ -405,11 +405,11 @@ action="/znatoki/cgi-bin/db.cgi">  "Бескрылка"
Расширенный (с учетом грамматики, в вопросах всех типов) + Расширенный (с учетом грамматики, в вопросах всех типов)
Искать: - + Все слова Любое слово @@ -421,6 +421,8 @@ action="/znatoki/cgi-bin/db.cgi"> Ответ
+Зачёт
+
Комментарии
Автор
@@ -709,13 +711,13 @@ sub Search { ###Simple and advanced query processing. Added by R7 if ($metod eq 'simple' || $metod eq 'advanced') { - foreach (qw/Question Answer Sources Authors Comments/) { + foreach (qw/Question Answer PassCriteria Sources Authors Comments/) { if (param($_)) { push @fields, $_; } } - @fields=(qw/Question Answer Sources Authors Comments/) unless scalar @fields; + @fields=(qw/Question Answer PassCriteria Sources Authors Comments/) unless scalar @fields; my $fields=join ",", @fields; my $q=new Text::Query($sstr, -parse => 'Text::Query::'. @@ -733,7 +735,6 @@ sub Search { ###### { -# foreach (qw/Question Answer Sources Authors Comments/) { foreach (param('searchin')) { # if (param($_)) { push @fields, "IFNULL($_, '')"; @@ -1384,6 +1385,10 @@ sub PrintQuestion { if ($answer==1|| $answer==-1) { $output .= &PrintField("Ответ", $Question{'Answer'}, $text); + if ($Question{'PassCriteria'} ) { + $output .= + &PrintField("Зачёт", $Question{'PassCriteria'}, $text); + } if ($Question{'Authors'} ) { my $q=$Question{'Authors'}; @@ -1452,6 +1457,10 @@ EOTT if ($Question{'Authors'}) { $output .= &PrintField("Автор(ы)", $Question{'Authors'}, $text); } + if ($Question{'PassCriteria'}) { + $output .= &PrintField("Зачёт", $Question{'PassCriteria'}, $text); + } + if ($Question{'Sources'}) { $output .= &PrintField("Источник(и)", $Question{'Sources'}, $text); } @@ -1895,6 +1904,7 @@ sub WriteFile { { print OUT "Вопрос $q:\n".$Question{$tour}[$q]{'Question'}."\n\n"; print OUT "Ответ:\n".$Question{$tour}[$q]{'Answer'}."\n\n"; + print OUT "Зачёт:\n".$Question{$tour}[$q]{'PassCriteria'}."\n\n"; print OUT "Автор:\n".$Question{$tour}[$q]{'Authors'}."\n\n" if !$tourauthor && !$eqauthor && $Question{$tour}[$q]{'Authors'}; print OUT "Комментарий:\n".$Question{$tour}[$q]{'Comments'}."\n\n"