body<= '/community/manage.bml', 'text' => $ML{'/community/members.bml.manage2'}, }); # get remote my $remote = LJ::get_remote(); return "" unless $remote; my $cname = $GET{'comm'}; return BML::redirect("$LJ::SITEROOT/community/manage.bml") unless $cname; # get $c object my $c = LJ::load_user($cname); return "" unless $c; my $cid = $c->{'userid'}; # is $remote an admin? unless (LJ::can_manage($remote, $c)) { $ret .= " LJ::ljuser($cname, { type => 'C' }) }); $ret .= " p?>"; return $ret; } # hit up the database to find pending members my $pendids = LJ::get_pending_members($c) || []; my $us = LJ::load_userids(@$pendids); # nothing pending? return "" unless @$pendids || LJ::did_post(); # saving a form submission if ($POST{'action:update'}) { my @userids = split(',', $POST{'ids'}); # need a db handle now my $dbh = LJ::get_db_writer(); # hit up each user to find out what to do with them my ($added, $rejected, $ignored, $previous); foreach my $id (@userids) { unless ($us->{$id}) { $previous++; next; } if ($POST{"pending_$id"} eq 'yes') { LJ::approve_pending_member($cid, $id); $added++; } elsif ($POST{"pending_$id"} eq 'no') { LJ::reject_pending_member($cid, $id); $rejected++; } else { $ignored++; } } $ret .= ""; $ret .= " $added }) . " p?>" if $added; $ret .= " $rejected }) . " p?>" if $rejected; $ret .= " $ignored }) . " p?>" if $ignored; $ret .= " $previous }) . " p?>" if $previous; $ret .= " BML::get_uri() . "?comm=$cname" }) . " p?>"; return $ret; } my @users = sort { $a->{user} cmp $b->{user} } values %$us; my $page_size = 100; # change to adjust page size # how to make links back to this page my $self_link = sub { return "pending.bml?comm=$cname&page=$_[0]"; }; my %items = BML::paging(\@users, $GET{page}, $page_size); my $navbar = LJ::paging_bar($items{page}, $items{pages}, { self_link => $self_link }); @users = @{$items{items}}; # output starts here $ret .= " LJ::ljuser($cname, { type => 'C' }) }); $ret .= " " . BML::ml('/community/members.bml.settings', { 'link' => "settings.bml?comm=$cname"}) . " p?>"; $ret .= "
"; # table headers $ret .= "
\n" . "\n"; # rows for existing users my $rc = 0; foreach (@users) { my $rstyle = ($rc++ & 1) ? '' : ''; $ret .= ""; $ret .= "\n"; $ret .= "\n"; $ret .= "\n"; } # some hidden values $ret .= LJ::html_hidden('ids', join(',', map { $_->{userid}} @users)) . "\n"; $ret .= "
$ML{'/community/members.bml.key.user'}$ML{'.approve.title'}
" . LJ::ljuser($_->{user}) . "" . LJ::html_check({ type => 'radio', name => "pending_$_->{userid}", id => "pending_$_->{userid}_yes", value => 'yes' }); $ret .= " " . LJ::html_check({ type => 'radio', name => "pending_$_->{userid}", id => "pending_$_->{userid}_no", value => 'no' }); $ret .= "

" . LJ::html_submit('action:update', $ML{'/community/members.bml.update'}) . "

\n"; $ret .= "
\n\n"; $ret .= $navbar; return $ret; } _code?> <=body page?>