--- register/prgsrc/register.cgi 2002/01/28 17:00:56 1.10 +++ register/prgsrc/register.cgi 2004/04/19 20:29:38 1.18 @@ -20,11 +20,11 @@ Boris Veytsman =head1 DATE -$Date: 2002/01/28 17:00:56 $ +$Date: 2004/04/19 20:29:38 $ =head1 REVISION -$Revision: 1.10 $ +$Revision: 1.18 $ =cut @@ -41,11 +41,11 @@ use POSIX qw(locale_h); setlocale(LC_CTYPE,'russian'); $ENV{'LANG'}='ru_RU.KOI8-R'; -my ($SENDMAIL) = "/usr/sbin/sendmail"; +my ($SENDMAIL) = "mail"; my $TO = 'borisv@lk.net, igra@gorlovka.net, erudit@mail.od.ua'; my $FROM = 'borisv@lk.net'; -my $date='$Date: 2002/01/28 17:00:56 $'; +my $date='$Date: 2004/04/19 20:29:38 $'; $date =~ s/[^ ]* ([^ ]*) .*/$1/; @@ -53,7 +53,7 @@ my $dbh = DBI->connect("DBI:mysql:chgk", or do { print h1("Временные проблемы") . "База данных временно не работает. Заходите попозже."; - print &Include_virtual("../dimrub/db/reklama.html"); + print &Include_virtual("../../dimrub/db/reklama.html"); print end_html; die "Can't connect to DB chgk\n"; }; @@ -66,12 +66,12 @@ print header(-charset=>'koi8-r'); ################################################## print start_html(-"title"=>'Register of Clubs', -author=>'borisv@lk.net', - -background=>"../images/map.jpg"); -print &Include_virtual("../dimrub/db/reklama.html"); + -background=>"../../images/map.jpg"); +print &Include_virtual("../../dimrub/db/reklama.html"); print < - + END ################################################ @@ -86,23 +86,23 @@ my $self=url(); # The navigation panel has three special lines ############################################### print < -
Home
-
Все регионы
-
Все клубы
-
Добавить клуб
-
Кто есть кто
+ END @@ -125,8 +125,8 @@ END

Журнал "Игра"
и
-Интернет Клуб Что? Где? Когда?
ПРЕДСТАВЛЯЮТ
Регистр Клубов Интеллектуальных Игр @@ -174,7 +174,7 @@ END

END -print &Include_virtual("../boris/register/regions.html"); +print &Include_virtual("../../boris/register/regions.html"); print < END @@ -189,15 +189,12 @@ END $sth->finish; print "

"; - print "Всего клубов: $count
\n"; - print "Эту страничку посмотрели "; - print `/home/piataev/public_html/cgi-bin/counter.sh /znatoki/cgi-bin/register.cgi`; - print " раз(а)

\n"; + print "Всего клубов: $count

\n"; print <
-owl +owl Boris Veytsman, $date
@@ -271,7 +268,7 @@ SELECT Child FROM RegionRegion WHERE Par push @kids,"rid=$kid"; } my $clause = join(' OR ', @kids); - $result .= "
\n"; + $result .= "
    \n"; $sth=$args{'dbh'}->prepare(" SELECT rid FROM Regions WHERE $clause ORDER BY Name"); $sth->execute; @@ -279,9 +276,9 @@ SELECT rid FROM Regions WHERE $clause OR $result .= ListRegions( %args,'rid'=>$kid, 'level'=>$args{'level'}-1, - 'tag'=>'dt'); + 'tag'=>'li'); } - $result .= "
\n"; + $result .= "\n"; } } return $result; @@ -326,7 +323,7 @@ sub ListClubs { my $sth; if ($args{'cid'}) { $sth = $args{'dbh'}->prepare(" -SELECT Child FROM ClubClub WHERE Parent=$args{'cid'}"); +SELECT Child, Status FROM ClubClub WHERE Parent=$args{'cid'}"); } else { $sth = $args{'dbh'}->prepare(" SELECT cid FROM ClubRegion WHERE rid=$args{'rid'}"); @@ -344,27 +341,34 @@ SELECT cid FROM ClubRegion WHERE rid=$ar $result=<Клубы:

-
\n +
    \n END } else { $result=<
    Клубы:
    -
    \n +
      \n END } my @clubs=(); - while (my ($club)=$sth->fetchrow_array) { + my %stat=(); + while (my ($club,$status)=$sth->fetchrow_array) { push @clubs,"cid=$club"; + if ($status) { + $stat{$club}=$status; + } } my $clause = join(' OR ', @clubs); $sth=$args{'dbh'}->prepare(" SELECT cid, Name FROM Clubs WHERE $clause ORDER BY Name"); $sth->execute; while (my ($cid,$Name)=$sth->fetchrow_array) { - $result .= dt("$Name\n"); + my $res="$Name\n"; + if (exists $stat{$cid}) { + $res .= " ($stat{$cid})\n"; + } + $result .= li($res); } - $result .= "
\n"; + $result .= "\n"; } @@ -376,7 +380,7 @@ sub ListParents { my $sth; $sth = $args{'dbh'}->prepare(" -SELECT Parent FROM ClubClub WHERE Child=$args{'cid'}"); +SELECT Parent, Status FROM ClubClub WHERE Child=$args{'cid'}"); $sth->execute; @@ -392,15 +396,23 @@ SELECT Parent FROM ClubClub WHERE Child= END my @clubs=(); - while (my ($club)=$sth->fetchrow_array) { + my %stat=(); + while (my ($club,$status)=$sth->fetchrow_array) { push @clubs,"cid=$club"; + if ($status) { + $stat{$club}=$status; + } } my $clause = join(' OR ', @clubs); $sth=$args{'dbh'}->prepare(" SELECT cid, Name FROM Clubs WHERE $clause ORDER BY Name"); $sth->execute; while (my ($cid,$Name)=$sth->fetchrow_array) { - $result .= dt("$Name\n"); + my $res = "$Name\n"; + if (exists $stat{$cid}) { + $res .= " ($stat{$cid})\n"; + } + $result .= dt($res); } $result .= "\n"; } @@ -517,7 +529,7 @@ sub htmlize { sub ListPeople { my %args = @_; my $sth = $args{'dbh'}->prepare(" -SELECT pid,Position FROM ClubPeople WHERE cid=$args{'cid'} ORDER BY Weight DESC"); +SELECT a.pid,a.Position FROM ClubPeople=a,People=b WHERE a.cid=$args{'cid'} and a.pid=b.pid ORDER BY a.Weight Desc, b.Name"); $sth->execute; if (!$sth->rows) { @@ -562,7 +574,7 @@ SELECT * FROM People WHERE pid=$args{'pi if (my $string=$person->{'URL'}) { $string = htmlize($string); - push @entries, "Домашнаяя страничка: $string"; + push @entries, "Домашняя страничка: $string"; } if (my $string=$person->{'Phone'}) { @@ -767,11 +779,8 @@ sub AddClub { # Sending the letter with results ##################################################################### sub SendLetter { - open(MAIL,"| $SENDMAIL -t"); + open(MAIL,"| $SENDMAIL -s 'Registracionnaya kartochka kluba' $TO"); print MAIL <