Diff for /register/prgsrc/register.cgi between versions 1.5 and 1.8

version 1.5, 2001/09/11 21:48:53 version 1.8, 2001/09/20 21:49:35
Line 34  $Revision$ Line 34  $Revision$
 ###################################################  ###################################################
   
     use strict;      use strict;
   use vars qw(%ENV);
 use CGI qw(:standard);  use CGI qw(:standard);
 use DBI;  use DBI;
 use POSIX qw(locale_h);  use POSIX qw(locale_h);
   
 setlocale(LC_CTYPE,'russian');  setlocale(LC_CTYPE,'russian');
   $ENV{'LANG'}='ru_RU.KOI8-R';
 my ($SENDMAIL) = "/usr/sbin/sendmail";  my ($SENDMAIL) = "/usr/sbin/sendmail";
 my $TO = 'borisv@lk.net, igra@gorlovka.net';  my $TO = 'borisv@lk.net, igra@gorlovka.net, erudit@mail.od.ua';
 my $FROM = 'borisv@lk.net';  my $FROM = 'borisv@lk.net';
   
 my $date='$Date$';  my $date='$Date$';
Line 89  print <<END; Line 90  print <<END;
 <dt><a href="$self?rid=1&level=1000&clubs=0">Все регионы</a></dt>  <dt><a href="$self?rid=1&level=1000&clubs=0">Все регионы</a></dt>
 <dt><a href="$self?rid=1&level=1000&clubs=1">Все клубы</a></dt>  <dt><a href="$self?rid=1&level=1000&clubs=1">Все клубы</a></dt>
 <dt><a href="$self?addclub=1">Добавить клуб</a></dt>  <dt><a href="$self?addclub=1">Добавить клуб</a></dt>
   <dt><a href="$self?whoiswho=1">Кто есть кто</a></dt>
 END  END
   
 #################################################  #################################################
Line 146  END Line 148  END
         $cid =~ s/(\d*)/$1/;          $cid =~ s/(\d*)/$1/;
         print ClubInfo(dbh=>$dbh,cid=>$cid,          print ClubInfo(dbh=>$dbh,cid=>$cid,
                        self=>$self);                         self=>$self);
       } elsif (param('pid')) {
           my $pid = param('pid');
           $pid =~ s/(\d*)/$1/;
           print ListPerson(dbh=>$dbh,pid=>$pid,
                            self=>$self,
                            positions=>1,
                            displayperson=>1);
       } elsif (param('whoiswho')) {
           print PrintWhoIsWho(dbh=>$dbh,
                               self=>$self);
     } elsif (param('addclub')) {      } elsif (param('addclub')) {
         print AddClub();          print AddClub();
     } elsif (param('Submit')) {      } elsif (param('Submit')) {
Line 157  END Line 169  END
 <dt><a href="$self?rid=1&level=1000&clubs=1">Все клубы</a></dt>  <dt><a href="$self?rid=1&level=1000&clubs=1">Все клубы</a></dt>
 <dt><a href="$self?addclub=1">Добавить клуб или изменить сведения  <dt><a href="$self?addclub=1">Добавить клуб или изменить сведения
 о клубе</a></dt>  о клубе</a></dt>
   <dt><a href="$self?whoiswho=1">Кто есть кто</a></dt>
 </dl>  </dl>
 END  END
 }  }
Line 164  END Line 177  END
 ####################################################################  ####################################################################
 # And the bottom of the page  # And the bottom of the page
 ###################################################################  ###################################################################
       my $sth=$dbh->prepare("select count(*) from Clubs");
       $sth->execute;
       my ($count) = $sth->fetchrow_array;
       $sth->finish;
   
     print "<p align=center>";      print "<p align=center>";
       print "Всего клубов: $count<br>\n";
     print "Эту страничку посмотрели ";      print "Эту страничку посмотрели ";
     print `/home/piataev/public_html/cgi-bin/counter.sh /znatoki/cgi-bin/register.cgi`;      print `/home/piataev/public_html/cgi-bin/counter.sh /znatoki/cgi-bin/register.cgi`;
     print " раз(а)</p>\n";      print " раз(а)</p>\n";
Line 288  SELECT cid FROM ClubRegion WHERE rid=$ar Line 306  SELECT cid FROM ClubRegion WHERE rid=$ar
   
         $result=<<END;          $result=<<END;
 <h3>Клубы:</h3>  <h3>Клубы:</h3>
 <dd><dl>\n  <dl>\n
 END  END
      } else {       } else {
     
Line 332  SELECT Parent FROM ClubClub WHERE Child= Line 350  SELECT Parent FROM ClubClub WHERE Child=
                   
     $result=<<END;      $result=<<END;
 <h3>Коллективный член ассоциаций:</h3>  <h3>Коллективный член ассоциаций:</h3>
 <dd><dl>\n  <dl>\n
 END  END
   
     my @clubs=();      my @clubs=();
Line 489  SELECT * FROM People WHERE pid=$args{'pi Line 507  SELECT * FROM People WHERE pid=$args{'pi
         return "";          return "";
     }      }
   
       my $result="";
     my @entries=();      my @entries=();
     my $person=$sth->fetchrow_hashref;      my $person=$sth->fetchrow_hashref;
     if (my $string = $person->{'Name'}) {      if (my $string = $person->{'Name'}) {
         push @entries, $string;          if ($args{'displayperson'}) {
               $result=h2($string);
           } else {
               push @entries, 
               "<a href=\"$args{'self'}?pid=$args{'pid'}\">$string</a>";
           }
     }      }
     if (my $string=$person->{'Address'}) {      if (my $string=$person->{'Address'}) {
         push @entries, "Адрес: $string";          push @entries, "Адрес: $string";
Line 516  SELECT * FROM People WHERE pid=$args{'pi Line 540  SELECT * FROM People WHERE pid=$args{'pi
         push @entries, "E-mail: $string";          push @entries, "E-mail: $string";
     }      }
   
     return p(join('; ',@entries).".");      $result.=p(join('; ',@entries).".");
       if ($args{'positions'}) {
           my $sth=$dbh->prepare("SELECT cid,Position FROM ClubPeople
   WHERE pid=$args{'pid'} ORDER by Weight");
           $sth->execute;
           $result .= "<dl>\n";
           while (my ($cid,$Position)=$sth->fetchrow_array) {
               my $sth1=$dbh->prepare("Select Name from Clubs where
   cid=$cid");
               $sth1->execute;
               my ($Name)=$sth1->fetchrow_array;
               $sth1->finish;
               $result .= "<dd><strong>$Position,</strong> ";
               $result .= "<a href=\"$args{self}?cid=$cid\">$Name</a></dd>\n";
           }
           $sth->finish;
           $result .= "</dl>\n";
       }
       return $result;
   
 }  }
   
Line 710  END Line 752  END
             "обработки будут внесены в базу данных");              "обработки будут внесены в базу данных");
 }  }
   
   ###############################################################
   # Printing Who is Who list
   ###############################################################
   sub PrintWhoIsWho {
       my %args =@_;
       my $result = h2("Кто есть кто");
       $result .= "\n<dl>\n";
       my $sth = $dbh->prepare("SELECT pid,Name FROM People ORDER BY Name");  
       $sth->execute;
       while (my($pid,$Name)=$sth->fetchrow_array) {
           $result .= dd("<a href=\"$args{'self'}?pid=$pid\">$Name</a>");
           $result .= "\n";
       }
       $sth->finish;
       $result .= "</dl>\n";
       return $result;
   }

Removed from v.1.5  
changed lines
  Added in v.1.8


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