body<= " unless $remote; # for now, assume we're operating on $remote. maybe in the future we'll be able to # manage other P type accounts, but we can't yet my $u = $remote; return $LJ::MSG_READONLY_USER if LJ::get_cap($u, "readonly"); # always have links at top my $ret = BML::ml('Backlink', { 'link' => '/manage/index.bml', 'text' => $ML{'/manage/invites.bml.manage'}, }); # get pending invites my $pending = LJ::get_pending_invites($u) || []; # short out? return "" unless @$pending; # load communities and maintainers my @ids; push @ids, ($_->[0], $_->[1]) foreach @$pending; my $us = LJ::load_userids(@ids); # all possible attributes my @allattribs = ('member', 'post', 'preapprove', 'moderate', 'admin'); # see if they posted and if we should take actions if (LJ::did_post()) { # change the back link $ret = BML::ml('Backlink', { 'link' => '/manage/invites.bml', 'text' => $ML{'/manage/invites.bml.back'}, }); my (@accepted, @rejected, @undecided); foreach my $invite (@$pending) { my ($commid, $maintid, $date, $argline) = @$invite; my $args = {}; LJ::decode_url_string($invite->[3], $args); # now take actions? if ($POST{"pending_$commid"} eq 'yes') { my $rval = LJ::accept_comm_invite($u, $us->{$commid}); push @accepted, [ $commid, $args ] if $rval; } elsif ($POST{"pending_$commid"} eq 'no') { my $rval = LJ::reject_comm_invite($u, $us->{$commid}); push @rejected, $commid if $rval; } else { push @undecided, $commid; } } # communities they've joined if (@accepted) { $ret .= ""; } # communities they rejected if (@rejected) { $ret .= ""; } # now print out undecided results if (@undecided) { $ret .= ""; } return $ret; } # prepare table $ret .= "
"; $ret .= ""; $ret .= ""; $ret .= ""; # now list memberships my $rc = 0; foreach my $invite (@$pending) { # get variables we'll need for HTML generatrion my $rstyle = ($rc++ & 1) ? "" : ""; my $cu = $us->{$invite->[0]}; my $key = "pending_$invite->[0]"; my @tags = (); my $args = {}; LJ::decode_url_string($invite->[3], $args); foreach (@allattribs) { push @tags, $ML{".label.$_"} if $args->{$_}; } my $ename = LJ::ehtml($cu->{name}); my $date = LJ::mysql_time($invite->[2]); # now generate HTML $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= ""; $ret .= "\n"; } # all done $ret .= "
$ML{'.community.title'}$ML{'.abilities.title'}$ML{'.actions.title'}
" . LJ::ljuser($cu, { type => 'C' }) . " - $ename" . join(', ', @tags) . "" . LJ::html_check({ type => 'radio', name => $key, id => "yes$key", value => 'yes' }); $ret .= " " . LJ::html_check({ type => 'radio', name => $key, id => "no$key", value => 'no' }); $ret .= "
"; $ret .= BML::ml('.fromline', { user => LJ::ljuser($us->{$invite->[1]}, { type => 'P' }), date => $date }); $ret .= "

"; $ret .= LJ::html_submit('submit', $ML{'.submit'}); $ret .= "
"; return $ret; } _code?> <=body page?>