body<= "; } return "" unless $remote->{journaltype} eq 'P'; $ret .= ""; $ret .= "
"; my %show; # what communities does remote my $cids = LJ::load_rel_target($remote, 'A'); my %admin; if ($cids) { foreach (@$cids) { $admin{$_} = $show{$_} = 1; } } # keep track of what communities remote moderates my $mods = LJ::load_rel_target($remote, 'M'); my %mods; my %modcount; if ($mods) { foreach (@$mods) { $mods{$_} = $show{$_} = 1; } } my %names = (); my %pending = (); if (%show) { my $in = join(',', keys %show); my $us = LJ::load_userids(keys %show); my $sth = $dbr->prepare("SELECT userid, membership FROM community ". "WHERE userid IN ($in)"); $sth->execute; my $udbr; while (my ($uid, $membership) = $sth->fetchrow_array) { my $cu = $us->{$uid}; next unless $cu && $cu->{statusvis} eq "V"; $names{$uid} = [ $cu->{user}, $cu->{name}, -1 ]; if ($mods{$uid}) { $udbr = LJ::get_cluster_reader($cu); my $sql = "SELECT COUNT(*) FROM modlog WHERE journalid=$uid"; $modcount{$uid} = $names{$uid}[2] = $udbr->selectrow_array($sql) || 0; } if ($membership eq 'moderated') { my $ids = LJ::get_pending_members($uid) || []; $pending{$uid} = scalar @$ids; } } } # deleted and expunged communities won't show up in this if (%names) { # Make up the first table row, linking to the other sort methods my @snames; $ret .= ""; if (!defined $GET{'sortby'} || $GET{'sortby'} eq 'username') { $ret .= ""; @snames = sort { $names{$a}->[0] cmp $names{$b}->[0] } keys %names; } else { $ret .= ""; } if ($GET{'sortby'} eq 'title') { $ret .= ""; @snames = sort { $names{$a}->[1] cmp $names{$b}->[1] } keys %names; } else { $ret .= ""; } $ret .= ""; if ($GET{'sortby'} eq 'mod') { $ret .= ""; @snames = sort { $names{$b}->[2] <=> $names{$a}->[2] } keys %names; } elsif (@$mods) { $ret .= ""; } foreach my $id (@snames) { my $user = $names{$id}->[0]; my $name = $names{$id}->[1]; $ret .= ""; } $ret .= "
$ML{'.commlist.username'} 'username'}) . "'>$ML{'.commlist.username'}$ML{'.commlist.title'} 'title'}) . "'>$ML{'.commlist.title'}$ML{'.commlist.actions'}$ML{'.commlist.moderation'} 'mod'}) . "'>$ML{'.commlist.moderation'}
" . LJ::eall($name) . ""; if ($admin{$id}) { $ret .= BML::ml('Actionlink', { 'link'=>"$ML{'.commlist.actinfo'}"}) . "  "; $ret .= BML::ml('Actionlink', { 'link'=>"$ML{'.commlist.actsettings2'}"}) . "  "; $ret .= BML::ml('Actionlink', { 'link'=>"$ML{'.commlist.actinvites'}"}) . "  "; my $pend = $pending{$id} ? BML::ml('.commlist.actpending', { num => $pending{$id}, aopts => "href=\"/community/pending.bml?comm=$user\"" }) : ''; $ret .= BML::ml('Actionlink', { 'link'=>"$ML{'.commlist.actmembers2'}$pend"}) . "  "; } $ret .= ""; if ($mods{$id}) { my $num = $modcount{$id} || "0"; # relying on this to be -wrapped $ret .= BML::ml('.commlist.moderation.num', { num => $num, link => "/community/moderate.bml?comm=$user" }); } $ret .= "
"; } else { $ret .= "$ML{'.commlist.none'}"; } $ret .= "
"; # save any changes if (LJ::did_post()) { my $op = $POST{email}; $op = '' if $op && $op !~ /[N]/; # add D back in here when Digest goes live LJ::set_userprop($remote, 'opt_communityjoinemail', $op); my $mod_emails = $POST{modemail} ? 1 : 0; LJ::set_userprop($remote, 'opt_nomodemail', $mod_emails ? undef : 1); } # load up our userprop LJ::load_user_props($remote, 'opt_communityjoinemail', 'opt_nomodemail'); my $op = $remote->{opt_communityjoinemail}; $op ||= 'Y'; my $mod_emails = $remote->{opt_nomodemail} ? 0 : 1; # form for setting email option $ret .= ""; $ret .= ""; $ret .= "
"; $ret .= "
"; $ret .= LJ::html_check({ type => 'radio', name => 'email', id => 'email_all', value => '', selected => ($op eq 'Y') }); $ret .= "
"; if (0) { # we don't do this right now, because the maintenance job to send email isn't # ready for use on LJ. this will be removed and the option enabled when that # task is rewritten. NOTE: add D up above in did_post() block. $ret .= LJ::html_check({ type => 'radio', name => 'email', id => 'email_digest', value => 'D', selected => ($op eq 'D') }); $ret .= "
"; } $ret .= LJ::html_check({ type => 'radio', name => 'email', id => 'email_none', value => 'N', selected => ($op eq 'N') }); $ret .= "
"; $ret .= "
"; # options for getting moderation emails $ret .= ""; $ret .= "
"; $ret .= LJ::html_check({ type => 'radio', name => 'modemail', id => 'modemail_yes', value => '1', selected => $mod_emails }); $ret .= "
"; $ret .= LJ::html_check({ type => 'radio', name => 'modemail', id => 'modemail_no', value => '0', selected => !$mod_emails }); $ret .= "
"; $ret .= "
"; $ret .= ""; $ret .= "'/community/create.bml'}) . " p?>"; return $ret; _code?> <=body page?>