vadvs (vadvs) wrote in changelog,
vadvs
vadvs
changelog

[livejournal] r17417: Copy pending.bml from trunk as is.

Committer: vad
Copy pending.bml from trunk as is.
U   branches/r70/htdocs/community/pending.bml
Modified: branches/r70/htdocs/community/pending.bml
===================================================================
--- branches/r70/htdocs/community/pending.bml	2010-09-20 11:41:28 UTC (rev 17416)
+++ branches/r70/htdocs/community/pending.bml	2010-09-20 16:05:53 UTC (rev 17417)
@@ -61,60 +61,35 @@
             return $ret;
         }
 
-        my @userids = split(',', $POST{'ids'});
-        my @is_selected = grep { defined $POST{"pending_$_"} } @userids;
+        $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';
 
-        $ret .= (($POST{'reject_select'} eq '1' and $POST{'approve'} and scalar @is_selected ) or $POST{'reject_done'} eq '1')
-                ? "<?h1 $ML{'/community/members.bml.success.header'} h1?><?p $ML{'/community/members.bml.success.message'} p?>"
-                : "<?h1 $ML{'/community/members.bml.success_empty.header'} h1?><?p $ML{'/community/members.bml.success_empty.message'} p?>";
-
         if ($POST{'reject_select'} eq '1') {
             $ret .= '<div class="b-pending">';
 
-            unless (scalar @is_selected) {
-                my @to_show = ();
-                foreach my $id (@userids) {
-                    unless ($us->{$id}) {
-                        $previous++;
-                        next;
-                    }
-                    unless (defined $POST{"pending_$id"}) {
-                        $ignored++;
-                        next;
-                    }
-                    if ($POST{"approve"} && !$us->{$id}->is_validated) {
-                        push @not_validated, $us->{$id};
-                        next;
-                    }
-                    next unless $POST{"pending_$id"} eq 'on';
+            my @userids = split(',', $POST{'ids'});
 
-                    push @to_show, $us->{$id};
-
-                    if ($POST{"approve"}) {
-                        LJ::approve_pending_member($cid, $id);
-                        $added++;
-                    }
+            my @to_show = ();
+            foreach my $id (@userids) {
+                unless ($us->{$id}) {
+                    $previous++;
+                    next;
                 }
+                unless (defined $POST{"pending_$id"}) {
+                    $ignored++;
+                    next;
+                }
+                if ($POST{"approve"} && !$us->{$id}->is_validated) {
+                    push @not_validated, $us->{$id};
+                    next;
+                }
+                next unless $POST{"pending_$id"} eq 'on';
+
+                push @to_show, $us->{$id};
+
                 if ($POST{"approve"}) {
-                    $ret .= "<?p " . BML::ml('.success.added', { num => $added }) . " p?>" if $added;
-                    $ret .= "<?p " . BML::ml('.success.not_validated', { list => join ",", map { $_->ljuser_display } @not_validated }) . " p?>" if scalar @not_validated;
-                } else {
-                    $ret .= "<h3>".$ML{'.following_users'}."</h3>";
-                    $ret .= '<p class="i-bubble b-bubble-alert b-bubble-noarrow b-bubble-intext">' . $ML{'.you_can_remove'} . '</p>';
-                    $ret .= "<form method='post' action='pending.bml?authas=$cname'>\n";
-                    $ret .= LJ::form_auth();
-                    $ret .= '<ul class="b-pending-users"><li>' . join (",</li><li>", map { "<span><a href='" . $_->profile_url . "' target='_blank'>" . $_->display_name . "</a><i id=\"reject_user_id_".$_->{userid}."\" class='i-pending-close' title='" . $ML{'.button.remove'} . "'></i></span>" } @to_show) . "</li></ul>\n";
-                    $ret .= LJ::html_hidden('ids', join(',', map { $_->{'userid'} } @to_show)) . "\n";
-                    $ret .= "<textarea name='reason' rows='7' cols='50' class='b-pending-reason' placeholder='".$ML{'.reason.default.text'}."'></textarea>\n";
-                    $ret .= LJ::html_hidden('reject_done', 1);
-                    $ret .= LJ::html_hidden('reject', $POST{'reject'});
-                    $ret .= LJ::html_hidden('reject_ban', $POST{'reject_ban'});
-                    $ret .= LJ::html_submit('yes_reject', $ML{'.button.yes.reject'}, {class=>'i-pending-reject'});
-                    $ret .= '<p class="i-bubble b-bubble-alert b-bubble-noarrow">' . $ML{'.reason.reject.text'} . '</p>' ."\n";
-                    $ret .= LJ::html_hidden('previous', $previous);
-                    $ret .= LJ::html_hidden('ignored', $ignored);
-                    $ret .= LJ::html_hidden('validated', join(",", @not_validated));
-                    $ret .= "</form>";
+                    LJ::approve_pending_member($cid, $id);
+                    $added++;
                 }
             }
             if ($POST{"approve"}) {
@@ -130,6 +105,7 @@
                 $ret .= "<textarea name='reason' rows='7' cols='50' class='b-pending-reason' placeholder='".$ML{'.reason.default.text'}."'></textarea>\n";
                 $ret .= LJ::html_hidden('reject_done', 1);
                 $ret .= LJ::html_hidden('reject', $POST{'reject'});
+                $ret .= LJ::html_hidden('reject_ban', $POST{'reject_ban'});
                 $ret .= LJ::html_submit('yes_reject', $ML{'.button.yes.reject'}, {class=>'i-pending-reject'});
                 $ret .= '<p class="i-bubble b-bubble-alert b-bubble-noarrow">' . $ML{'.reason.reject.text'} . '</p>' ."\n";
                 $ret .= LJ::html_hidden('previous', $previous);
@@ -141,6 +117,8 @@
         }
 
         if ($POST{'reject_done'} eq '1') {
+            my @userids = split(',', $POST{'ids'});
+
             my $reason = $POST{'reason'} || $ML{'.reason.default.text'};
 
             # need a db handle now

Tags: bml, livejournal, vadvs
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