--- register/prgsrc/register.cgi 2003/07/16 02:08:28 1.16
+++ register/prgsrc/register.cgi 2004/04/19 20:29:38 1.18
@@ -20,11 +20,11 @@ Boris Veytsman
=head1 DATE
-$Date: 2003/07/16 02:08:28 $
+$Date: 2004/04/19 20:29:38 $
=head1 REVISION
-$Revision: 1.16 $
+$Revision: 1.18 $
=cut
@@ -45,7 +45,7 @@ my ($SENDMAIL) = "mail";
my $TO = 'borisv@lk.net, igra@gorlovka.net, erudit@mail.od.ua';
my $FROM = 'borisv@lk.net';
-my $date='$Date: 2003/07/16 02:08:28 $';
+my $date='$Date: 2004/04/19 20:29:38 $';
$date =~ s/[^ ]* ([^ ]*) .*/$1/;
@@ -323,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'}");
@@ -350,15 +350,23 @@ END
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 .= li("$Name\n");
+ my $res="$Name\n";
+ if (exists $stat{$cid}) {
+ $res .= " ($stat{$cid})\n";
+ }
+ $result .= li($res);
}
$result .= "\n";
}
@@ -372,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;
@@ -388,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";
}
@@ -513,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) {