Diff for /db/prgsrc/db.cgi between versions 1.157 and 1.161

version 1.157, 2010/01/24 17:27:11 version 1.161, 2010/09/24 09:05:48
Line 233  sub SelectQuestions { Line 233  sub SelectQuestions {
 #       my $where=join " OR ",@$q;  #       my $where=join " OR ",@$q;
         my $where=join ',',@$q;          my $where=join ',',@$q;
         $where &&= "QuestionId IN (".(join ',',$where).")";          $where &&= "QuestionId IN (".(join ',',$where).")";
         $where||=1;          $where||=0;
         $where="($where) AND Questions.ParentId=t1.Id AND t1.ParentId=t2.Id"           $where="($where) AND Questions.ParentId=t1.Id AND t1.ParentId=t2.Id" 
                 if $WithTour;                  if $WithTour;
   
Line 824  sub NoCase { Line 824  sub NoCase {
   
 sub PrintList {  sub PrintList {
    my ($dbh,$Questions,$shablon,$was)=@_;     my ($dbh,$Questions,$shablon,$was)=@_;
           my $total_found  = $totalfound||$#$Questions+1;
         my $Output;          my $Output;
         my $first=param('first') ||1;          my $first=param('first') ||1;
         $first=$first-($first-1)%$outputkvo;          $first=$first-($first-1)%$outputkvo;
         my $fkvo=param('fkvo')||($#$Questions+1);          my $fkvo=param('fkvo')||$total_found;
         my $last=$first+$outputkvo-1;          my $last=$first+$outputkvo-1;
         $last=$fkvo if $fkvo<$last;          $last=$fkvo if $fkvo<$last;
         my($f,$l);          my($f,$l);
Line 899  sub PrintList { Line 900  sub PrintList {
             a({href=>$url."?".$qs."\&first=$llprint"},">>").("&nbsp;"x4)              a({href=>$url."?".$qs."\&first=$llprint"},">>").("&nbsp;"x4)
         }          }
         $Output.= "$nav".br."\n";          $Output.= "$nav".br."\n";
         my @q=@$Questions[$first-1..$last-1];          my @q;
           if ($totalfound) {
               @q = @$Questions;
           } else {
               @q=@$Questions[$first-1..$last-1];
           }
         my %q=();          my %q=();
         my $sth=SelectQuestions($dbh,\@q,1);          my $sth=SelectQuestions($dbh,\@q,1);
         my $qq;          my $qq;
Line 910  sub PrintList { Line 916  sub PrintList {
                 $q{$Q[$_]{'QuestionId'}}=$Q[$_];                  $q{$Q[$_]{'QuestionId'}}=$Q[$_];
         }          }
   
         for (my $i = $first; $i <= $last; $i++) {          for my $i(0..$#q) {
                 my $q=$q{$$Questions[$i-1]};                  my $q=$q{$q[$i]};
                 my $output;                  my $output;
                 $output = &PrintQuestion($dbh, $q, 1, 0, 1,$text,1  );                  $output = &PrintQuestion($dbh, $q, 1, 0, 1,$text,1  );
 #                if (param('metod') && (param('metod') eq 'rus' || param('metod') eq 'proxy'))  #                if (param('metod') && (param('metod') eq 'rus' || param('metod') eq 'proxy'))
Line 1092  sub PrintTournament { Line 1098  sub PrintTournament {
         @Tours = &GetTours($dbh, $Id);          @Tours = &GetTours($dbh, $Id);
         $list='';          $list='';
         my $textid;          my $textid;
           my $isGroup;
         if ($Id) {          if ($Id) {
                 for ($Tournament{'Type'}) {                  for ($Tournament{'Type'}) {
                         /Г/ && do {                          /Г/ && do {
Line 1102  sub PrintTournament { Line 1109  sub PrintTournament {
                                                 $Tournament{'PlayedAt2'}:'') .                                                   $Tournament{'PlayedAt2'}:'') . 
                                                                                               
                                               p . "\n";                                                p . "\n";
                                                 $isGroup=1;
                                 last;                                  last;
                         };                          };
                         /Ч/ && do {                          /Ч/ && do {
Line 1223  sub PrintTournament { Line 1231  sub PrintTournament {
                 $output .= p($Info);                  $output .= p($Info);
         }          }
   
   
   
         $output.=p("<a href='/dbxml.php?tour=".param('tour')."'>XML</a>");          $output.=p("<a href='/dbxml.php?tour=".param('tour')."'>XML</a>");
           
                   if ($textid=$fname)
                   {
                      $textid=~s/\.txt//;
                   }
           if (!$isGroup) {
               $output .= center("<font size='-1'>[".
                a({href=>"/v2/tour/$textid/print", target=>'_blank'}, 'версия для печати')."] [".
                a({href=>"/v2/tour/$textid/fb2", target=>'_blank'}, 'fb2')."]"."</font>");
           }
                   
         return $output;          return $output;
 }  }
Line 1340  sub PrintTour { Line 1359  sub PrintTour {
                                   
                 $bottom .=                  $bottom .=
                         "[" . a({href=>tourhref("$fname$nn",1)},                           "[" . a({href=>tourhref("$fname$nn",1)}, 
                          "ответы") .  "] " . br."\n";                           "ответы") .  "] " 
         }          }
           $bottom .= "[".a({href=>"/v2/tour/$fname/print", target=>'_blank'}, 'версия для печати')."] [".
             a({href=>"/v2/tour/$fname/fb2/", target=>'_blank'}, 'fb2')."]".br;
           
   #       $bottom .= "[".a({href=>'/v2/print/'.$fname.'.'.$Tour{'Number'}, target=>'_blank'}, 'версия для печати')."]".br;
           
         if ($n>1) {          if ($n>1) {
                 $bottom .=                  $bottom .=
                         "[" . a({href=>tourhref("$fname.".($n-1),0)},                          "[" . a({href=>tourhref("$fname.".($n-1),0)},
Line 1350  sub PrintTour { Line 1374  sub PrintTour {
                         "[" . a({href=>tourhref("$fname.".($n-1),1)},                          "[" . a({href=>tourhref("$fname.".($n-1),1)},
                         "предыдущий тур с ответами") . "] " . br."\n";                          "предыдущий тур с ответами") . "] " . br."\n";
         }          }
           
         if (&IsTour($dbh, $Tour{'ParentId'}, $n + 1)) {          if (&IsTour($dbh, $Tour{'ParentId'}, $n + 1)) {
                 $bottom .=                  $bottom .=
                         "[" . a({href=>tourhref("$fname.".($n+1),0)},                          "[" . a({href=>tourhref("$fname.".($n+1),0)},
Line 1397  sub PrintField { Line 1422  sub PrintField {
             $value =~ s/\[Раздаточный материал:(.*?)\]\s*\n/<div class='razdatka'><div class='razdatka_header'>Раздаточный материал<\/div> $1<\/div>\n$2/sm;              $value =~ s/\[Раздаточный материал:(.*?)\]\s*\n/<div class='razdatka'><div class='razdatka_header'>Раздаточный материал<\/div> $1<\/div>\n$2/sm;
             $value =~ s/<раздатка>(.*?)<\/раздатка>/<div class='razdatka'><div class='razdatka_header'>Раздаточный материал<\/div> $1<\/div>\n/sm;              $value =~ s/<раздатка>(.*?)<\/раздатка>/<div class='razdatka'><div class='razdatka_header'>Раздаточный материал<\/div> $1<\/div>\n/sm;
             $value =~ s/!!!ZAKR!!!/\.\.\.\]/g;              $value =~ s/!!!ZAKR!!!/\.\.\.\]/g;
               $value =~ s/!!!PROP!!!/пропущено\]/g;
             $value =~ s/!!!PROP2!!!/пропущены\]/g;              $value =~ s/!!!PROP2!!!/пропущены\]/g;
   
   

Removed from v.1.157  
changed lines
  Added in v.1.161


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>