wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[livejournal] r17287: LJSUP-6572. Add form for membership requ...

Committer: gprochaev
LJSUP-6572. Add form for membership request canceling

U   trunk/bin/upgrading/en.dat
U   trunk/cgi-bin/LJ/Event/CommunityJoinReject.pm
U   trunk/cgi-bin/LJ/Event.pm
U   trunk/cgi-bin/communitylib.pl
U   trunk/htdocs/community/members.bml.text
U   trunk/htdocs/community/pending.bml
U   trunk/htdocs/community/pending.bml.text
U   trunk/htdocs/manage/subscriptions/user.bml
Modified: trunk/bin/upgrading/en.dat
===================================================================
--- trunk/bin/upgrading/en.dat	2010-09-06 07:32:26 UTC (rev 17286)
+++ trunk/bin/upgrading/en.dat	2010-09-06 07:44:29 UTC (rev 17287)
@@ -1512,6 +1512,8 @@
 esn.comm_join_reject.email_subject|staleness=1
 esn.comm_join_reject.email_subject=Your Request to Join [[community]] community
 
+esn.comm_join_reject.maint.email_subject=[[username]] has been rejected from joining [[community]]
+
 esn.comm_join_reject.email_text|staleness=1
 esn.comm_join_reject.email_text<<
 Dear [[user]],
@@ -1527,6 +1529,30 @@
 
 .
 
+esn.comm_join_reject.maint.email_text<<
+Dear [[user]], 
+
+A membership request from [[username]] to the [[community]] (which you maintain) has been rejected by [[maintainer]] for the following reason: [[reason]].
+
+Regards,
+[[sitename]] Team
+
+.
+
+pending.mail.reject.subject=Your Request to Join [[community]] community
+
+pending.mail.reject.body<<
+Dear [[username]], 
+
+Your request to join the [[community]] community has been declined by the maintainer(s) of the community for the following reason: [[reason]]. 
+
+Replies to this email are not sent to the community's maintainer(s). If you would like to discuss the reasons your membership request was rejected, you will need to contact a maintainer directly. Maintainers are listed on the community's Profile page. 
+
+Regards, 
+[[sitename]] Team
+
+.
+
 esn.defriended.alert|staleness=1
 esn.defriended.alert=[[who]] removed you from their Friends list.
 

Modified: trunk/cgi-bin/LJ/Event/CommunityJoinReject.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/CommunityJoinReject.pm	2010-09-06 07:32:26 UTC (rev 17286)
+++ trunk/cgi-bin/LJ/Event/CommunityJoinReject.pm	2010-09-06 07:44:29 UTC (rev 17287)
@@ -4,11 +4,11 @@
 use base 'LJ::Event';
 
 sub new {
-    my ($class, $u, $cu) = @_;
+    my ($class, $u, $cu, $mu, $maintu, $reason) = @_;
     foreach ($u, $cu) {
         croak 'Not an LJ::User' unless LJ::isu($_);
     }
-    return $class->SUPER::new($u, $cu->{userid});
+    return $class->SUPER::new($u, $cu->{userid}, $mu->{userid}, $maintu->{userid}, $reason);
 }
 
 sub is_common { 1 } # As seen in LJ/Event.pm, event fired without subscription
@@ -36,29 +36,138 @@
                                             #',
 );
 
+sub subscriptions {
+    my ($self, %args) = @_;
+    my $cid   = delete $args{'cluster'};
+    my $limit = delete $args{'limit'};
+    confess("Unknown options: " . join(', ', keys %args)) if %args;
+    confess("Can't call in web context") if LJ::is_web_context();
+
+    # allsubs
+    my @subs;
+
+    my $limit_remain = $limit;
+
+    # SQL to match only on active subs
+    my $and_enabled = "AND flags & " .
+        LJ::Subscription->INACTIVE . " = 0";
+
+    # TODO: gearman parallelize:
+    foreach my $cid ($cid ? ($cid) : @LJ::CLUSTERS) {
+        # we got enough subs
+        last if $limit && $limit_remain <= 0;
+
+        ## hack: use inactive server of user cluster to find subscriptions
+        ## LJ::DBUtil wouldn't load in web-context
+        ## inactive DB may be unavailable due to backup, or on dev servers
+        ## TODO: check that LJ::get_cluster_master($cid) in other parts of code
+        ## will return handle to 'active' db, not cached 'inactive' db handle
+        my $udbh = '';
+        if (not $LJ::DISABLED{'try_to_load_subscriptions_from_slave'}){
+            $udbh = eval { 
+                        require 'LJ/DBUtil.pm';
+                        LJ::DBUtil->get_inactive_db($cid); # connect to slave 
+                    };
+        }
+        $udbh ||= LJ::get_cluster_master($cid); # default (master) connect
+
+        die "Can't connect to db" unless $udbh;
+
+        # first we find exact matches (or all matches)
+        my $journal_match = "AND journalid=?";
+
+        my $limit_sql = ($limit && $limit_remain) ? "LIMIT $limit_remain" : '';
+        my $sql = "SELECT userid, subid, is_dirty, journalid, etypeid, " .
+            "arg1, arg2, ntypeid, createtime, expiretime, flags  " .
+            "FROM subs WHERE userid=? AND etypeid=? $journal_match $and_enabled $limit_sql";
+
+        my $sth = $udbh->prepare($sql);
+        $sth->execute($self->{args}[0], __PACKAGE__->etypeid, $self->u->id);
+        if ($sth->err) {
+            warn "SQL: [$sql]\n";
+            die $sth->errstr;
+        }
+
+        while (my $row = $sth->fetchrow_hashref) {
+            my $sub = LJ::Subscription->new_from_row($row);
+            next unless $sub->owner->clusterid == $cid;
+
+            push @subs, $sub;
+        }
+
+        $limit_remain = $limit - @subs;
+    }
+
+    return @subs;
+}
+
+sub is_subscription_ntype_disabled_for {
+    my ($self, $ntypeid, $u) = @_;
+
+    return 1 if $self->SUPER::is_subscription_ntype_disabled_for($ntypeid, $u);
+
+    return 0 if $ntypeid == LJ::NotificationMethod::ntypeid ('LJ::NotificationMethod::Email');
+
+    return 1;
+}
+
+sub subscription_as_html {
+    my ($class, $subscr, $field_num) = @_;
+
+    my $journal = $subscr->journal;
+
+    return LJ::Lang::ml('event.community.join_reject', { community => $journal->ljuser_display } );
+}
+
 sub as_email_subject {
     my ($self, $u) = @_;
-    my $cu      = $self->community;
-    my $lang    = $u->prop('browselang');
-    return LJ::Lang::get_text($lang, 'esn.comm_join_reject.email_subject', undef, { 'community' => $cu->{user} });
+
+    my $mt  = LJ::load_userid($self->{'args'}[0]);
+    my $cu = $self->community->is_community ? $self->community : LJ::load_userid($self->{'userid'});
+    if ($cu->is_community && $mt->can_manage ($cu)) {
+        my $rej_user = LJ::load_userid($self->{'args'}[2]);
+        my $lang    = $mt->prop('browselang');
+        return LJ::Lang::get_text($lang, 'esn.comm_join_reject.maint.email_subject', undef, { 'username' => $rej_user->{user}, 'community' => $cu->{user} });
+    } else {
+        my $lang    = $u->prop('browselang');
+        return LJ::Lang::get_text($lang, 'esn.comm_join_reject.email_subject', undef, { 'community' => $cu->{user} });
+    }
 }
 
 sub _as_email {
     my ($self, $u, $cu, $is_html) = @_;
 
-    # Precache text lines
-    my $lang    = $u->prop('browselang');
-    #LJ::Lang::get_text_multi($lang, undef, \@_ml_strings_en);
+    my $mt  = LJ::load_userid($self->{'args'}[0]);
+    my $remover = LJ::load_userid($self->{'args'}[1]);
+    my $rej_u = LJ::load_userid($self->{'args'}[2]);
+    $cu = LJ::load_userid($self->{'userid'}) unless $cu->is_community;
+    my $reason = $self->{'args'}[3];
 
-    my $vars = {
-            'user'      => $u->{name},
-            'username'  => $u->{name},
-            'community' => $cu->{user},
-            'sitename'  => $LJ::SITENAME,
-            'siteroot'  => $LJ::SITEROOT,
-    };
+    if ($mt && $mt->can_manage ($cu)) {
+        my $lang    = $mt->prop('browselang');
+        return LJ::Lang::get_text($lang, 'esn.comm_join_reject.maint.email_text', undef, {
+                user        => $mt->{'name'},
+                username    => $rej_u ? $rej_u->{'name'} : '',
+                community   => $cu->{'user'},
+                maintainer  => $remover->{'user'},
+                reason      => $reason,
+                sitename    => $LJ::SITENAME,
+        });
+    } else {
+        # Precache text lines
+        my $lang    = $u->prop('browselang');
+        #LJ::Lang::get_text_multi($lang, undef, \@_ml_strings_en);
 
-    return LJ::Lang::get_text($lang, 'esn.comm_join_reject.email_text', undef, $vars);
+        my $vars = {
+                'user'      => $u->{name},
+                'username'  => $u->{name},
+                'community' => $cu->{user},
+                'sitename'  => $LJ::SITENAME,
+                'siteroot'  => $LJ::SITEROOT,
+        };
+
+        return LJ::Lang::get_text($lang, 'esn.comm_join_reject.email_text', undef, $vars);
+    }
 }
 
 sub as_email_string {
@@ -90,7 +199,7 @@
 }
 
 sub available_for_user  { 1 }
-sub is_subscription_visible_to  { 0 }
-sub is_tracking { 0 }
+sub is_subscription_visible_to  { 1 }
+sub is_tracking { 1 }
 
 1;

Modified: trunk/cgi-bin/LJ/Event.pm
===================================================================
--- trunk/cgi-bin/LJ/Event.pm	2010-09-06 07:32:26 UTC (rev 17286)
+++ trunk/cgi-bin/LJ/Event.pm	2010-09-06 07:44:29 UTC (rev 17287)
@@ -72,7 +72,7 @@
 # my $event = LJ::Event::ExampleEvent->new($u, $arg1, $arg2);
 sub new {
     my ($class, $u, @args) = @_;
-    confess("too many args")        if @args > 2;
+    confess("too many args")        if @args > 4;
 
     return bless {
         userid => $u ? $u->id : 0,
@@ -85,13 +85,13 @@
 # determining type, and userid for journalid for determining journal.
 #
 # my $event =
-#     LJ::Event->new_from_raw_params($example_etypeid, $u->id, $arg1, $arg2);
+#     LJ::Event->new_from_raw_params($example_etypeid, $u->id, $arg1, $arg2, $arg3, $arg4);
 sub new_from_raw_params {
-    my (undef, $etypeid, $journalid, $arg1, $arg2) = @_;
+    my (undef, $etypeid, $journalid, $arg1, $arg2, $arg3, $arg4) = @_;
 
     my $class   = LJ::Event->class($etypeid) or confess "Classname cannot be undefined/false";
     my $journal = LJ::load_userid($journalid);
-    my $evt     = LJ::Event->new($journal, $arg1, $arg2);
+    my $evt     = LJ::Event->new($journal, $arg1, $arg2, $arg3, $arg4);
 
     # bless into correct class
     bless $evt, $class;
@@ -598,6 +598,7 @@
 
         # first we find exact matches (or all matches)
         my $journal_match = $allmatch ? "" : "AND journalid=?";
+
         my $limit_sql = ($limit && $limit_remain) ? "LIMIT $limit_remain" : '';
         my $sql = "SELECT userid, subid, is_dirty, journalid, etypeid, " .
             "arg1, arg2, ntypeid, createtime, expiretime, flags  " .

Modified: trunk/cgi-bin/communitylib.pl
===================================================================
--- trunk/cgi-bin/communitylib.pl	2010-09-06 07:32:26 UTC (rev 17286)
+++ trunk/cgi-bin/communitylib.pl	2010-09-06 07:44:29 UTC (rev 17287)
@@ -575,11 +575,13 @@
 # des-userid: userid of the user doing the join
 # returns: 1 on success, 0/undef on error
 # </LJFUNC>
+## LJ::reject_pending_member($cid, $id, $remote->{userid}, $POST{'reason'});
 sub reject_pending_member {
-    my ($commid, $userid) = @_;
+    my ($commid, $userid, $maintid, $reason) = @_;
     my $cu = LJ::want_user($commid);
     my $u = LJ::want_user($userid);
-    return unless $cu && $u;
+    my $mu = LJ::want_user($maintid);
+    return unless $cu && $u && $mu;
 
     # step 1, update authactions table
     my $dbh = LJ::get_db_writer();
@@ -601,8 +603,21 @@
     unless ($u->has_subscription(%params)) {
         $u->subscribe(%params, method => 'Email');
     }
+
+    # Email to user about rejecting
     LJ::Event::CommunityJoinReject->new($u, $cu)->fire unless $LJ::DISABLED{esn};
 
+    # Email to maints about user rejecting
+    my $maintainers = LJ::load_rel_user($commid, 'A');
+    foreach my $mid (@$maintainers) {
+        next if $mid == $maintid;
+        my $maintu = LJ::load_userid($mid);
+        my %params = (event => 'CommunityJoinReject', journal => $cu);
+        if ($maintu && $maintu->has_subscription(%params)) {
+            LJ::Event::CommunityJoinReject->new($cu, $maintu, $mu, $u, $reason)->fire unless $LJ::DISABLED{esn};
+        }
+    }
+
     return 1;
 }
 

Modified: trunk/htdocs/community/members.bml.text
===================================================================
--- trunk/htdocs/community/members.bml.text	2010-09-06 07:32:26 UTC (rev 17286)
+++ trunk/htdocs/community/members.bml.text	2010-09-06 07:44:29 UTC (rev 17287)
@@ -77,8 +77,12 @@
 
 .success.message2=The following changes have been made:
 
+.success.message=The following changes have been made:
+
 .success.nochanges=No changes have been made.
 
+.success.return=<a [[aopts]]>Return to the list</a>
+
 .success.return2=<a [[aopts]]>Return to the list</a>
 
 .title=Community Members

Modified: trunk/htdocs/community/pending.bml
===================================================================
--- trunk/htdocs/community/pending.bml	2010-09-06 07:32:26 UTC (rev 17286)
+++ trunk/htdocs/community/pending.bml	2010-09-06 07:44:29 UTC (rev 17287)
@@ -53,150 +53,209 @@
         unless @$pendids || LJ::did_post();
 
     # saving a form submission
+    my ($added, $rejected, $ignored, $previous, $banned, $ban_skipped);
     if (LJ::did_post()) {
         unless (LJ::check_form_auth()) {
             $ret .= "<?h1 $ML{'Error'} h1?><?p $ML{'error.invalidform'} p?>";
             return $ret;
         }
-        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, $banned, $ban_skipped);
-        foreach my $id (@userids) {
-            unless ($us->{$id}) {
-                $previous++;
-                next;
-            }
+        $ret .= "<?h1 $ML{'/community/members.bml.success.header'} h1?><?p $ML{'/community/members.bml.success.message'} p?>"
+            if ($POST{'reject_select'} eq '1' and $POST{'approve'}) or $POST{'reject_done'} eq '1';
 
-            unless (defined $POST{"pending_$id"}) {
-                $ignored++;
-                next;
-            }
+        if ($POST{'reject_select'} eq '1') {
+            $ret .= "<h3>".$ML{'.following_users'}."</h3>";
+            $ret .= $ML{'.you_can_remove'};
 
-            if ($POST{"pending_$id"} eq 'on' and $POST{"approve"}) {
-                LJ::approve_pending_member($cid, $id);
-                $added++;
-            } elsif ($POST{"pending_$id"} eq 'on' and $POST{"reject"}) {
-                LJ::reject_pending_member($cid, $id);
-                $rejected++;
-            } elsif ($POST{"pending_$id"} eq 'on' and $POST{"reject_ban"}) {
-                my $banlist = LJ::load_rel_user($c, 'B') || [];
-                if (scalar(@$banlist) >= ($LJ::MAX_BANS || 5000)) {
-                    $ban_skipped++;
-                } else {
-                    LJ::set_rel($c, $us->{$id}, 'B');
-                    $c->log_event('ban_set', { actiontarget => $id, remote => $remote });
-                    LJ::run_hooks('ban_set', $c, $us->{$id});
-                    $banned++;
+            my @userids = split(',', $POST{'ids'});
 
-                    LJ::reject_pending_member($cid, $id); # only in case of successful ban
-                    $rejected++; # for keeping this user in list for later reject
+            my @to_show = ();
+            foreach my $id (@userids) {
+                unless ($us->{$id}) {
+                    $previous++;
+                    next;
                 }
+                unless (defined $POST{"pending_$id"}) {
+                    $ignored++;
+                    next;
+                }
+                next unless $POST{"pending_$id"} eq 'on';
+
+                push @to_show, $us->{$id};
+
+                if ($POST{"approve"}) {
+                    LJ::approve_pending_member($cid, $id);
+                    $added++;
+                }
             }
+            if ($POST{"approve"}) {
+                $ret .= "<?p " . BML::ml('.success.added', { num => $added }) . " p?>" if $added;
+            } else {
+                $ret .= "<form method='post' action='pending.bml?authas=$cname'>\n";
+                $ret .= LJ::form_auth();
+                $ret .= "<div>" . join ("</div>, <div>", map { $_->{'user'} } @to_show) . "</div>\n";
+                $ret .= LJ::html_hidden('ids', join(',', map { $_->{'userid'} } @to_show)) . "\n";
+                $ret .= "<textarea name='reason' rows='7' cols='50'>".$ML{'.reason.default.text'}."</textarea><br/>\n";
+                $ret .= $ML{'.reason.reject.text'}."<br/>\n";
+                $ret .= LJ::html_hidden('reject_done', 1);
+                $ret .= LJ::html_hidden('reject', $POST{'reject'});
+                $ret .= LJ::html_submit('yes_reject', $ML{'.button.yes.reject'});
+                $ret .= LJ::html_hidden('previous', $previous);
+                $ret .= LJ::html_hidden('ignored', $ignored);
+                $ret .= "</form>";
+            }
         }
 
-        $ret .= "<?h1 $ML{'/community/members.bml.success.header'} h1?><?p $ML{'/community/members.bml.success.message'} p?>";
-        $ret .= "<?p " . BML::ml('.success.added', { num => $added }) . " p?>" if $added;
-        $ret .= "<?p " . BML::ml('.success.rejected', { num => $rejected }) . " p?>" if $rejected;
-        $ret .= "<?p " . BML::ml('.success.ignored', { num => $ignored }) . " p?>" if $ignored;
-        $ret .= "<?p " . BML::ml('.success.previous', { num => $previous }) . " p?>" if $previous;
-        $ret .= "<?p " . BML::ml('.success.banned', { num => $banned }) . " p?>" if $banned;
-        $ret .= "<?p " . BML::ml('.success.ban_skipped', { num => $ban_skipped }) . " p?>" if $ban_skipped;
-        $ret .= "<?p " . BML::ml("/community/members.bml.success.return", { 'link' => BML::get_uri() . "?authas=$cname" }) . " p?>";
+        if ($POST{'reject_done'} eq '1') {
+            my @userids = split(',', $POST{'ids'});
 
-        return $ret;
-    }
+            # need a db handle now
+            my $dbh = LJ::get_db_writer();
+            
+            # hit up each user to find out what to do with them
+            foreach my $id (@userids) {
+                if ($POST{"approve"}) {
+                    LJ::approve_pending_member($cid, $id);
+                    $added++;
+                } elsif ($POST{"reject"}) {
+                    LJ::reject_pending_member($cid, $id, $remote->{userid}, $POST{'reason'});
+                    $rejected++;
+                } elsif ($POST{"reject_ban"}) {
+                    my $banlist = LJ::load_rel_user($c, 'B') || [];
+                    if (scalar(@$banlist) >= ($LJ::MAX_BANS || 5000)) {
+                        $ban_skipped++;
+                    } else {
+                        LJ::set_rel($c, $us->{$id}, 'B');
+                        $c->log_event('ban_set', { actiontarget => $id, remote => $remote });
+                        LJ::run_hooks('ban_set', $c, $us->{$id});
+                        $banned++;
 
-    my @users = sort { $a->{user} cmp $b->{user} } values %$us;
-    my $page_size = 100; # change to adjust page size
+                        LJ::reject_pending_member($cid, $id, $remote->{userid}, $POST{'reason'}); # only in case of successful ban
+                        $rejected++; # for keeping this user in list for later reject
+                    }
+                }
+                if ($POST{"reject"} or $POST{"reject_ban"}) {
+                    LJ::send_mail({ 'to' => $us->{$id}->email_raw,
+                                    'from' => $LJ::ACCOUNTS_EMAIL,
+                                    'fromname' => $LJ::SITENAMESHORT,
+                                    'wrap' => 1,
+                                    'charset' => 'utf-8',
+                                    'subject' => LJ::Lang::ml ('pending.mail.reject.subject', { community => $cname }),
+                                    'body'    => ( LJ::Lang::ml ('pending.mail.reject.body', 
+                                                    {
+                                                        community => $cname,
+                                                        username  => $us->{$id}->{'user'},
+                                                        reason    => $POST{'reason'},
+                                                        sitename  => $LJ::SITENAMESHORT,
+                                                    }
+                                                ))
+                                           });
+                }
+            }
 
-    # are we going to jump to a specific user ?
-    my $jumppage;
-    my $jumpuser;
-    my $jumpto = $POST{'jumpto'} || $GET{'jumpto'};
-    if (@users > $page_size && $jumpto =~ /^\w+$/) {
-        my $ct;
-        foreach (@users) {
-            $jumppage++ if $ct % $page_size == 0;
-            if ($jumpto eq $_->{'name'}) {
-                $jumpuser = $_->{'name'};
-                last;
+            $previous = $POST{'previous'};
+            $ignored = $POST{'ignored'};
+            $ret .= "<?p " . BML::ml('.success.rejected', { num => $rejected }) . " p?>" if $rejected;
+            $ret .= "<?p " . BML::ml('.success.ignored', { num => $ignored }) . " p?>" if $ignored;
+            $ret .= "<?p " . BML::ml('.success.previous', { num => $previous }) . " p?>" if $previous;
+            $ret .= "<?p " . BML::ml('.success.banned', { num => $banned }) . " p?>" if $banned;
+            $ret .= "<?p " . BML::ml('.success.ban_skipped', { num => $ban_skipped }) . " p?>" if $ban_skipped;
+
+        }
+        $ret .= "<?p " . BML::ml("/community/members.bml.success.return", { 'aopts' => "href='".BML::get_uri() . "?authas=$cname'" }) . " p?>";
+    } else {
+
+        my @users = sort { $a->{user} cmp $b->{user} } values %$us;
+        my $page_size = 100; # change to adjust page size
+
+        # are we going to jump to a specific user ?
+        my $jumppage;
+        my $jumpuser;
+        my $jumpto = $POST{'jumpto'} || $GET{'jumpto'};
+        if (@users > $page_size && $jumpto =~ /^\w+$/) {
+            my $ct;
+            foreach (@users) {
+                $jumppage++ if $ct % $page_size == 0;
+                if ($jumpto eq $_->{'name'}) {
+                    $jumpuser = $_->{'name'};
+                    last;
+                }
+                $ct++;
             }
-            $ct++;
+            undef $jumppage unless $jumpuser;
         }
-        undef $jumppage unless $jumpuser;
-    }
 
-    # how to make links back to this page
-    my $self_link = sub {
-        return "pending.bml?authas=$cname&page=$_[0]";
-    };
+        # how to make links back to this page
+        my $self_link = sub {
+            return "pending.bml?authas=$cname&page=$_[0]";
+        };
 
-    my %items = BML::paging(\@users, $jumppage || $GET{page}, $page_size);
-    my $navbar = LJ::paging_bar($items{page}, $items{pages},
-                                 { self_link => $self_link });
-    @users = @{$items{items}};
+        my %items = BML::paging(\@users, $jumppage || $GET{page}, $page_size);
+        my $navbar = LJ::paging_bar($items{page}, $items{pages},
+                                     { self_link => $self_link });
+        @users = @{$items{items}};
 
-    # output starts here
-    $ret .= "<form method='post' action='pending.bml?authas=$cname'>";
-    $ret .= LJ::form_auth();
+        # output starts here
+        $ret .= "<div align='center'>";
+        $ret .= "<form method='post' action='pending.bml?authas=$cname'>";
+        $ret .= LJ::form_auth();
 
-    # jump to user
-    if ($items{'pages'} > 1 || $GET{'jumpto'} ne '') {
-        $ret .= "<div style='margin-left: 30px;'>$ML{'.jump'}: ";
-        $ret .= LJ::html_text({ 'name' => 'jumpto', 'value' => ($POST{'jumpto'} || $GET{'jumpto'}),
-                                'class' => 'text', 'size' => '10', 'maxlength' => '15' }) . " ";
-        $ret .= LJ::html_submit(undef, 'Go') . "</div>";
-    }
+        # jump to user
+        if ($items{'pages'} > 1 || $GET{'jumpto'} ne '') {
+            $ret .= "<div style='margin-left: 30px;'>$ML{'.jump'}: ";
+            $ret .= LJ::html_text({ 'name' => 'jumpto', 'value' => ($POST{'jumpto'} || $GET{'jumpto'}),
+                                    'class' => 'text', 'size' => '10', 'maxlength' => '15' }) . " ";
+            $ret .= LJ::html_submit(undef, 'Go') . "</div>";
+        }
 
-    # table headers
-    $ret .= "<br /><div align='center'><table class='userslist-table' cellspacing='0' cellpadding='2'>\n<tr><th>";
-    $ret .= LJ::html_check({ id => 'all', name => 'all', checked => 'checked', 
-	onchange =>
-		"var inputs = document.getElementById('content-wrapper').getElementsByTagName('input');
-		for (var i = 0; i < inputs.length; i++) {
-			if (inputs[i].type == 'checkbox' && inputs[i].getAttribute('id') !== 'all') {
-				inputs[i].checked = this.checked;
-			}
-		}", 
-	onclick =>
-		"var inputs = document.getElementById('content-wrapper').getElementsByTagName('input');
-		for (var i = 0; i < inputs.length; i++) {
-			if (inputs[i].type == 'checkbox' && inputs[i].getAttribute('id') !== 'all') {
-				inputs[i].checked = this.checked;
-			}
-		}", 
-  	 selected => 0 });
-    $ret .= "</th><th>$ML{'/community/members.bml.key.user'}</th></tr>\n";
+        # table headers
+        $ret .= "<br /><table class='userslist-table' cellspacing='0' cellpadding='2'>\n<tr><th>";
+        $ret .= LJ::html_check({ id => 'all', name => 'all', checked => 'checked', 
+        onchange =>
+            "var inputs = document.getElementById('content-wrapper').getElementsByTagName('input');
+            for (var i = 0; i < inputs.length; i++) {
+                if (inputs[i].type == 'checkbox' && inputs[i].getAttribute('id') !== 'all') {
+                    inputs[i].checked = this.checked;
+                }
+            }", 
+        onclick =>
+            "var inputs = document.getElementById('content-wrapper').getElementsByTagName('input');
+            for (var i = 0; i < inputs.length; i++) {
+                if (inputs[i].type == 'checkbox' && inputs[i].getAttribute('id') !== 'all') {
+                    inputs[i].checked = this.checked;
+                }
+            }", 
+         selected => 0 });
+        $ret .= "</th><th>$ML{'/community/members.bml.key.user'}</th></tr>\n";
 
-    # rows for existing users
-    my $rc = 0;
-    foreach (@users) {
-        my $rstyle = ($rc++ & 1) ? '#efefef' : '#fff';
-        $ret .= "<tr style='background-color: $rstyle;'><td>";
-        $ret .= LJ::html_check({ id => 'pending_' . $_->userid, name => 'pending_' . $_->userid, 
-                                 selected => $jumpto ? ($_->user eq $jumpto ? 1 : 0) : 1 });
-        $ret .= "</td><td>" . LJ::ljuser($_->{user}) . "</td></tr>\n";
-    }
+        # rows for existing users
+        my $rc = 0;
+        foreach (@users) {
+            my $rstyle = ($rc++ & 1) ? '#efefef' : '#fff';
+            $ret .= "<tr style='background-color: $rstyle;'><td>";
+            $ret .= LJ::html_check({ id => 'pending_' . $_->userid, name => 'pending_' . $_->userid, 
+                                     selected => $jumpto ? ($_->user eq $jumpto ? 1 : 0) : 1 });
+            $ret .= "</td><td>" . LJ::ljuser($_->{user}) . "</td></tr>\n";
+        }
 
-    # some hidden values
-    $ret .= LJ::html_hidden('ids', join(',', map { $_->{userid}} @users)) . "\n";
-    $ret .= "</table><p>";
-    $ret .= LJ::html_submit('approve', $ML{'.button.approve'});
-    $ret .= LJ::html_submit('reject', $ML{'.button.reject'});
-    $ret .= LJ::html_submit('reject_ban', $ML{'.button.reject_ban'});
-    $ret .= "</p></div></form>\n\n";
+        # some hidden values
+        $ret .= LJ::html_hidden('ids', join(',', map { $_->{userid}} @users)) . "\n";
+        $ret .= "</table>";
+        $ret .= LJ::html_submit('approve', $ML{'.button.approve'});
+        $ret .= LJ::html_hidden('reject_select', 1);
+        $ret .= LJ::html_submit('reject', $ML{'.button.reject'});
+        $ret .= LJ::html_submit('reject_ban', $ML{'.button.reject_ban'});
+        $ret .= "</form></div>\n\n";
 
-    $ret .= $navbar;
+        $ret .= $navbar;
 
-    $ret .= BML::ml('Backlink', {
-        'link' => '/community/manage.bml',
-        'text' => $ML{'/community/members.bml.manage2'},
-    });
+        $ret .= BML::ml('Backlink', {
+            'link' => '/community/manage.bml',
+            'text' => $ML{'/community/members.bml.manage2'},
+        });
 
+    }
+
     return $ret;
 
 }

Modified: trunk/htdocs/community/pending.bml.text
===================================================================
--- trunk/htdocs/community/pending.bml.text	2010-09-06 07:32:26 UTC (rev 17286)
+++ trunk/htdocs/community/pending.bml.text	2010-09-06 07:44:29 UTC (rev 17287)
@@ -10,9 +10,13 @@
 .button.reject|staleness=1
 .button.reject=Reject membership
 
+.button.yes.reject=Yes, reject listed users
+
 .button.reject_ban|staleness=1
 .button.reject_ban=Reject membership and set ban
 
+.following_users=You have selected to reject the following user(s):
+
 .jump|staleness=1
 .jump=Jump to user
 
@@ -22,6 +26,10 @@
 
 .nopending.title=Nobody Pending
 
+.reason.reject.text=Use the above field to specify the reason you are rejecting membership. This field is optional.
+
+.reason.default.text=No reason given
+
 .succedd.ban_skipped|staleness=1
 .succedd.ban_skipped=You have [[num]] failed [[?num|ban|bans]] from this community. You can clean ban list and try again.
 
@@ -40,3 +48,6 @@
 
 .yes=Yes
 
+.you_can_remove=You can remove users from this list by hovering over the username and clicking the 'x' button.
+
+

Modified: trunk/htdocs/manage/subscriptions/user.bml
===================================================================
--- trunk/htdocs/manage/subscriptions/user.bml	2010-09-06 07:32:26 UTC (rev 17286)
+++ trunk/htdocs/manage/subscriptions/user.bml	2010-09-06 07:44:29 UTC (rev 17287)
@@ -47,7 +47,6 @@
         );
 
         my %etypeids = map { LJ::Event->event_to_etypeid($_) => 1 } @events;
-
         return 0 unless $etypeids{$subhash->{'etypeid'}};
 
         return 1;
@@ -121,6 +120,9 @@
     push @$groups, { event => "UserExpunged", 'journalid' => $journal->id }
         unless LJ::User->is_protected_username($journal->user);
 
+    push @$groups, { event => "CommunityJoinReject", 'journalid' => $journal->id }
+        if LJ::can_manage($u, $journal); 
+
     $ret .= $widget->render({
         'title' => BML::ml('subscribe_interface.category.this-journal', { 'journal' => $journal->ljuser_display }),
         'groups' => $set->extract_groups($groups),

Tags: bml, dat, livejournal, pl, pm, text, wisest-owl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments