quote($_); } keys %cataccess); $and_cat_in = "AND tl.tpcatid IN ($in)"; } $sth = $dbh->prepare("SELECT tm.tpmapid, tm.tptopid, tm.itemid FROM topic_map tm, topic_list tl WHERE tm.tptopid=tl.tptopid AND tm.status='new' $and_cat_in LIMIT 50"); $sth->execute; if ($dbh->err) { return $dbh->errstr; } my %topic; while (my $map = $sth->fetchrow_hashref) { push @maps, $map; $topic{$map->{'tptopid'}} = undef; } unless (@maps) { return "Empty! ... no items are awaiting approval"; } my $top_in = join(",", keys %topic); $sth = $dbh->prepare("SELECT tptopid, tpcatid, topname FROM topic_list WHERE tptopid IN ($top_in)"); $sth->execute; if ($dbh->err) { return $dbh->errstr; } my %cat; while (my $top = $sth->fetchrow_hashref) { $topic{$top->{'tptopid'}} = $top; $cat{$top->{'tpcatid'}} = undef; } my $cat_in = join(",", keys %cat); $sth = $dbh->prepare("SELECT tpcatid, parent, catname FROM topic_cats WHERE tpcatid IN ($cat_in)"); $sth->execute; if ($dbh->err) { return $dbh->errstr; } while (my $cat = $sth->fetchrow_hashref) { $cat{$cat->{'tpcatid'}} = $cat; } $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?> link: htdocs/talkpost.bml post: htdocs/admin/topics/screen_links.bml _c?>