Screen Topics body<= quote($_); } keys %cataccess); $and_cat_in = "AND tpcatid IN ($in)"; } $sth = $dbh->prepare("SELECT tptopid, tpcatid, topname FROM topic_list WHERE status='new' $and_cat_in"); $sth->execute; if ($dbh->err) { return $dbh->errstr; } @new = (); push @new, $_ while ($_ = $sth->fetchrow_hashref); unless (@new) { return "Empty! ... no topics are awaiting approval"; } $ret .= "
"; my $count = 0; foreach my $new (@new) { next if (++$count > 50); &load_cats_up($new->{'tpcatid'}, \%cat); $ret .= "

"; my $fullcat; my $catup = $new->{'tpcatid'}; while ($catup) { $fullcat = "$cat{$catup}->{'catname'} : $fullcat"; $catup = $cat{$catup}->{'parent'}; } $fullcat =~ s/\s+:\s+$//; $ret .= "[$fullcat]"; $ret .= "
$new->{'topname'}"; my %opts = ("L" => "Leave", "A" => "Approve", "D" => "Deny"); foreach (qw(L A D)) { $ret .= "
{'tptopid'}\" VALUE=\"$_\">$opts{$_}\n"; } } $ret .= "

"; return $ret; sub load_cats_up { my $catid = shift; my $hashref = shift; $catid += 0; while ($catid) { unless ($hashref->{$catid}) { $sth = $dbh->prepare("SELECT parent, catname FROM topic_cats WHERE tpcatid=$catid"); $sth->execute; my $cat = $sth->fetchrow_hashref; if ($cat) { $hashref->{$catid} = $cat; $catid = $cat->{'parent'} } } else { $catid = $hashref->{$catid}->{'parent'}; } } } _code?> <=body page?> post: htdocs/admin/topics/screentop_do.bml _c?>