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

[livejournal] r23477: LJSUP-14582: There shouldn't be discount...

Committer: wisest-owl
LJSUP-14582: There shouldn't be discounts for gift

U   trunk/cgi-bin/htmlcontrols.pl
U   trunk/cgi-bin/weblib.pl
Modified: trunk/cgi-bin/htmlcontrols.pl
===================================================================
--- trunk/cgi-bin/htmlcontrols.pl	2012-12-17 10:58:53 UTC (rev 23476)
+++ trunk/cgi-bin/htmlcontrols.pl	2012-12-17 14:18:08 UTC (rev 23477)
@@ -132,10 +132,12 @@
         # items can be either pairs of $value, $text or a list of $it hashrefs (or a mix)
         my $it = {};
         my $text;
+        my $js_data;
         if (ref $value) {
             $it = $value;
             $value = $it->{value};
             $text = $it->{text};
+            $js_data = $it->{js_data};
         } else {
             $text = shift @items;
         }
@@ -148,6 +150,7 @@
             while (defined (my $value = shift @sub_items)) {
                 my $it = {};
                 my $text;
+
                 if (ref $value) {
                     $it = $value;
                     $value = $it->{value};
@@ -196,7 +199,7 @@
             # is this individual option disabled?
             my $dis = $it->{'disabled'} ? " disabled='disabled' style='color: #999;'" : '';
 
-            $ret .= "<option value=\"$value\"$id$sel$dis>" .
+            $ret .= "<option value=\"$value\"$id$sel$dis $js_data>" .
                       ($ehtml ? ehtml($text) : $text) . "</option>\n";
         }
     }

Modified: trunk/cgi-bin/weblib.pl
===================================================================
--- trunk/cgi-bin/weblib.pl	2012-12-17 10:58:53 UTC (rev 23476)
+++ trunk/cgi-bin/weblib.pl	2012-12-17 14:18:08 UTC (rev 23477)
@@ -174,7 +174,8 @@
 #           'authas' - current user, gets selected in drop-down;
 #           'label' - label to go before form elements;
 #           'button' - button label for submit button;
-#           others - arguments to pass to [func[LJ::get_authas_list]].
+#           others - arguments to pass to [func[LJ::get_authas_list]];
+#           check_paid - for each user in list will set parameter 'data-paid:0|1', used by JS
 # </LJFUNC>
 sub make_authas_select {
     my ($u, $opts) = @_; # type, authas, label, button
@@ -198,7 +199,20 @@
                                  %select_id,
                                  },
                                  ## We loaded all users in LJ::get_authas_list(). Here we use their singletons.
-                                 (map { my $u = LJ::load_user ($_); ($_, $u->display_name) } @list), @{$opts->{'add_fields'}} ) . " ";
+                                 (map {
+                                    my $u = LJ::load_user ($_);
+                                    my %is_paid = $opts->{'check_paid'}
+                                        ? ($u && ($u->get_cap('perm') || $u->get_cap('paid'))
+                                            ? ( js_data => " data-paid='1' " )
+                                            : ( js_data => " data-paid='0' " )
+                                          )
+                                        : undef;
+                                    {
+                                        text    => $_,
+                                        value   => $u->display_name,
+                                        %is_paid,
+                                    }
+                                } @list), @{$opts->{'add_fields'}} ) . " ";
         $ret .= $opts->{'button_tag'} . LJ::html_submit(undef, $opts->{'button'} || $BML::ML{'web.authas.btn'}) . $opts->{'button_close_tag'};
         return $ret;
     }

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