alf (red_alf) wrote in changelog,
alf
red_alf
changelog

[livejournal] r19072: LJSUP-8689: Donate button

Committer: afedorov
LJSUP-8689: Donate button

U   trunk/cgi-bin/LJ/S2.pm
Modified: trunk/cgi-bin/LJ/S2.pm
===================================================================
--- trunk/cgi-bin/LJ/S2.pm	2011-05-18 06:55:51 UTC (rev 19071)
+++ trunk/cgi-bin/LJ/S2.pm	2011-05-18 07:42:17 UTC (rev 19072)
@@ -3971,8 +3971,8 @@
 
 sub EntryLite__get_give_button
 {
-    my ($ctx, $this, $type) = @_;
-    $type = 'button' unless $type =~ /^(?:button|link)$/;
+    my ($ctx, $this, $type, $image) = @_;
+    $type = 'button' unless $type =~ /^(?:button|string)$/;
     my $journal  = $this->{'journal'}->{'username'};
     my $journalu = LJ::load_user($journal);
     my $entry = LJ::Entry->new($journalu, ditemid => $this->{itemid});
@@ -3992,14 +3992,23 @@
                             have_tokens: '.(($remote_balance < $LJ::GIVE_TOKENS) ? 'false' : 'true' ).',
                             lj_form_auth: "'.LJ::form_auth('raw').'"
                         })
-                       </script> 
-                       <span class="lj-button light">
-                       <span class="lj-button-wrapper">
-                       <a class="lj-button-link" href="'.$give_link.'">
-                       <span class="lj-button-a"><span class="lj-button-b">'.$LJ::GIVE_TOKENS.' <img src="'.$LJ::IMGPREFIX.'/icons/donate.png" /></span><span class="lj-button-c">'.($give_count ? BML::ml('give_features.given', {'count' => $give_count}) : BML::ml('give_features.give')).'</span></span>
-                       </a>
-                       </span>
-                       </span>';
+                       </script>'; 
+    if ($type eq 'button') { 
+        $give_button .= '<span class="lj-button light"><span class="lj-button-wrapper">
+                            <a class="lj-button-link" href="'.$give_link.'">
+                                <span class="lj-button-a"><span class="lj-button-b">'.$LJ::GIVE_TOKENS.' <img src="'.$LJ::IMGPREFIX.'/icons/donate.png" /></span><span class="lj-button-c">'.($give_count ? BML::ml('give_features.given', {'count' => $give_count}) : BML::ml('give_features.give')).'</span></span>
+                            </a>
+                        </span></span>';
+    } else {
+        my $give_text = BML::ml('give_features.give') . $LJ::GIVE_TOKENS . ' LJ Tokens';
+        $give_text .= " ($give_count)" if $give_count;
+            
+        if ($image) {
+            $give_button .= '<a href="'.$give_link.'" title="'.$give_text.'"><img src="'.$LJ::IMGPREFIX.$image.'"></a>';
+        } else {
+            $give_button .= '<a href="'.$give_link.'">'.$give_text.'</a>';
+        }
+    }
     return $give_button;
 }
 

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