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

version 1.152, 2009/05/02 21:23:07 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 1389  sub PrintField { Line 1414  sub PrintField {
                         if $value !~ /^\|/;                          if $value !~ /^\|/;
             $value =~ s/^\|([^\n]*)/<pre>$1<\/pre>/mg;              $value =~ s/^\|([^\n]*)/<pre>$1<\/pre>/mg;
   
             $value =~ s/(http:\/\/\S+[^\s\)\(\,\.])/a({href=>escapeUrl($1)},$1)/egm if $header !~ /^Авто/;#!!!              $value =~ s/(http:\/\/\S+[^\s\)\(\,\.\]])/a({href=>escapeUrl($1)},$1)/egm if $header !~ /^Авто/;#!!!
   
               $value =~ s/\.\.\.\]/!!!ZAKR!!!/g;
               $value =~ s/пропущено\]/!!!PROP!!!/g;
               $value =~ s/пропущены\]/!!!PROP2!!!/g;
               $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/!!!ZAKR!!!/\.\.\.\]/g;
               $value =~ s/!!!PROP!!!/пропущено\]/g;
               $value =~ s/!!!PROP2!!!/пропущены\]/g;
   
   
 #           $value =~ s/(http:\/\/\S+[^\s\)\(\,\.])/make/eg if $header !~ /^Авто/;#!!!  #           $value =~ s/(http:\/\/\S+[^\s\)\(\,\.])/make/eg if $header !~ /^Авто/;#!!!
Line 1549  EOTT Line 1583  EOTT
 $output.="</span>"  $output.="</span>"
   
         }          }
         $output=~s/\(pic: ([^\)]*)\)/<p><img src="\/znatoki\/images\/db\/$1"><p>/g unless $text;          $output=~s/\(pic: ([^\)]*)\)/<p><img src="\/znatoki\/images\/db\/$1"><\/p>/g unless $text;
           $output=~s/\(aud: ([^\)]*)\)/<embed type="application\/x-shockwave-flash" src="http:\/\/www.google.com\/reader\/ui\/3247397568-audio-player.swf?audioUrl=\/znatoki\/sounds\/db\/$1"  allowscriptaccess="never" width="400" height="27" quality="best" bgcolor="#ff0000" wmode="window" flashvars="playerMode=embedded" \/>/g unless $text;
   
         $output=~s/⌡/\&iuml;/g;          $output=~s/⌡/\&iuml;/g;
         $output=~s/⌠/\&Iuml;/g;          $output=~s/⌠/\&Iuml;/g;
   
Line 2169  MAIN: Line 2205  MAIN:
 $globaloutput.="<style>  $globaloutput.="<style>
 td      {font-size: x-small; font-family : sans-serif}  td      {font-size: x-small; font-family : sans-serif}
 th      {font-size: x-small; font-family : sans-serif}  th      {font-size: x-small; font-family : sans-serif}
   div.razdatka { 
       background-color:#EEEEFF;
       padding:4px;
       border:1px solid black;
   }
   
   div.razdatka_header {font-style:italic;}
   
 </style>\n";  </style>\n";
   
                 $globaloutput.=&Include_virtual("$reklama")||'';                  $globaloutput.=&Include_virtual("$reklama")||'';

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


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