Diff for /db/prgsrc/db.cgi between versions 1.102 and 1.103

version 1.102, 2003/04/20 08:21:12 version 1.103, 2003/04/20 11:35:05
Line 14  my $newsurl='http://news.chgk.info/'; Line 14  my $newsurl='http://news.chgk.info/';
 my $HTMLDIR="";  my $HTMLDIR="";
 my $realHTMLDIR;  my $realHTMLDIR;
 if ($^O =~ /win/i) {  if ($^O =~ /win/i) {
  $realHTMLDIR="/html/znatoki/baza";   $realHTMLDIR="/html/znatoki/baza/";
 } else   } else 
 {  {
   $realHTMLDIR="/home/znatoki/public_html/dimrub/db/baza/";    $realHTMLDIR="/home/znatoki/public_html/dimrub/db/baza/";
Line 1049  sub PrintTournament { Line 1049  sub PrintTournament {
                else {$textid=$Tournament{'Id'}};                 else {$textid=$Tournament{'Id'}};
                                   
   
                 if ($SingleTour or $Tournament{'Type'} =~ /Т/) {                  if ($SingleTour or ($Tournament{'Type'} =~ /Т/)) {
                         $list .= dd(img({src=>$imgsrc, alt=>$alt})                          $list .= dd(img({src=>$imgsrc, alt=>$alt})
                                 . " " . $Tournament{'Title'} . " " .                                  . " " . $Tournament{'Title'} . " " .
                                     $Tournament{'PlayedAt'} . $qnum) .                                      ($Tournament{'PlayedAt'}||"") . $qnum) .
                                 dl(                                  dl(
                                         dd("["                                          dd("["
                                                 . a({href=>tourhref($textid,0)},                                                  . a({href=>tourhref($textid,0)},
Line 1063  sub PrintTournament { Line 1063  sub PrintTournament {
                 } else {                  } else {
                         $list .= dd(a({href=>                          $list .= dd(a({href=>
                                  $url . "?tour=$textid&comp=1"},                                   $url . "?tour=$textid&comp=1"},
                                 img({src=>'/icons/compressed.gif', alt=>'[ZIP]', border=>1})). " " .                                   img({src=>'/icons/compressed.gif', alt=>'[ZIP]', border=>1})). 
                                   " " . 
                                 img({src=>$imgsrc, alt=>$alt})                                  img({src=>$imgsrc, alt=>$alt})
                                 . " " . a({href=>tourhref($textid,0,1)},                                  . " " . a({href=>tourhref($textid,0,1)},
                                 $Tournament{'Title'}. " ".                                  $Tournament{'Title'}. " ".
                                           $Tournament{'PlayedAt'}||'') . $qnum);                                            ($Tournament{'PlayedAt'}||'')) . $qnum); 
                 }                  }
         }          }
         $output .= dl($list);          $output .= dl($list);
Line 1414  sub Include_virtual { Line 1415  sub Include_virtual {
         my ($fn, $output) = (@_, '');          my ($fn, $output) = (@_, '');
   
         open F , $fn          open F , $fn
                 or return; #die "Can't open the file $fn: $!\n";                  or return ""; #die "Can't open the file $fn: $!\n";
   
         while (<F>) {          while (<F>) {
                 if (/<!--#include/o) {                  if (/<!--#include/o) {
Line 1425  sub Include_virtual { Line 1426  sub Include_virtual {
                 }                  }
                 $output .= $_;                  $output .= $_;
         }          }
         return $output;          return $output||"";
 }  }
   
 sub PrintArchive {  sub PrintArchive {
Line 1767  sub WriteFile { Line 1768  sub WriteFile {
   
 sub Bottom  sub Bottom
 {  {
         my $output.=&Include_virtual("../dimrub/db/footer.html");          my $output.=&Include_virtual("../dimrub/db/footer.html")||"";
         $output.=p."<center><font size=-2>Обновление: ".&Include_virtual("../dimrub/db/date")."</center></font>";          $output.=p."<center><font size=-2>Обновление: ".&Include_virtual("../dimrub/db/date")."</center></font>";
         $output.=<<EEE          $output.=<<EEE
 <SCRIPT LANGUAGE="JavaScript">  <SCRIPT LANGUAGE="JavaScript">
Line 2023  EOT Line 2024  EOT
                   open TS, "timestamp";                    open TS, "timestamp";
                   my $d=$dbh->quote(<TS>);                    my $d=$dbh->quote(<TS>);
                   close TS;                    close TS;
                   my ($sth) = $dbh->prepare("SELECT t1.Id, t1.FileName, t1.Type,                     open FF, ">${realHTMLDIR}index.html" or die "ERROR! - ${HTMLDIR}index.html\n";
                         count(t2.Id)                          my $o=$globaloutput;
                      FROM Tournaments as t1, Tournaments as t2                         $o.=&PrintTournament($dbh, 0, 0);
                      WHERE t1.CreatedAt>$d AND t2.ParentId=t1.Id GROUP BY t1.Id");                         $o.=&Bottom;
                          print FF $o;
                     close FF;
                     open FF, ">${realHTMLDIR}all.html" or die "ERROR! - ${HTMLDIR}all.html\n";
                          $o=$globaloutput;
                          $o.=&PrintAll($dbh,0);
                          $o.=&Bottom;
                          print FF $o;
                          close FF;
   
   
   #                 my ($sth) = $dbh->prepare("SELECT t1.Id, t1.FileName, t1.Type, 
   #                       count(t2.Id) 
   #                     FROM Tournaments as t1, Tournaments as t2
   #                    WHERE t1.CreatedAt>$d AND t2.ParentId=t1.Id GROUP BY t1.Id");
   my ($sth) = $dbh->prepare("SELECT t1.Id, t1.FileName, t1.Type, count(t2.Id)  FROM Tournaments as t1  LEFT JOIN Tournaments as t2 
    ON t2.ParentId=t1.id WHERE t1.CreatedAt>$d GROUP BY t1.Id");
                   $sth->execute;                    $sth->execute;
                   my ($Id,$fname,$type,$c);                    my ($Id,$fname,$type,$c);
                   while (($Id,$fname,$type,$c)=$sth->fetchrow,$Id) {                    while (($Id,$fname,$type,$c)=$sth->fetchrow,$Id) {
                        next unless $fname;
                      print "$fname\n";                       print "$fname\n";
                      $fname=~s/\.txt$//;                       $fname=~s/\.txt$//;
 print "  c=$c\n";         
                      if ($type=~/Т/ || $c<=1)                       if ($type=~/Т/ || $c<=1)
                      {                       {
                        open FF, ">$realHTMLDIR$fname-q.html" or die "ERROR! - $HTMLDIR$fname-q.html\n";                         open FF, ">$realHTMLDIR$fname-q.html" or die "ERROR! - $HTMLDIR$fname-q.html\n";

Removed from v.1.102  
changed lines
  Added in v.1.103


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