[ljcom] r10512: LJSUP-8689: Donate (Give) button
Committer: afedorov
LJSUP-8689: Donate (Give) buttonU trunk/bin/upgrading/en_LJ.dat U trunk/bin/upgrading/proplists-local.dat U trunk/cgi-bin/LJ/Hooks/ESN.pm U trunk/cgi-bin/LJ/Pay/Payment/PayItem.pm U trunk/cgi-bin/LJ/Pay/Wallet.pm U trunk/cgi-bin/LJ/Widget/Shop/History.pm U trunk/cgi-bin/crumbs-local.pl
Modified: trunk/bin/upgrading/en_LJ.dat
===================================================================
--- trunk/bin/upgrading/en_LJ.dat 2011-05-16 08:34:29 UTC (rev 10511)
+++ trunk/bin/upgrading/en_LJ.dat 2011-05-17 05:14:10 UTC (rev 10512)
@@ -1309,6 +1309,8 @@
crumb.games=Games
+crumb.givetokens=Give LJ Tokens
+
crumb.goat=About Frank
crumb.guidingprinciples=Our Guiding Principles
@@ -1923,6 +1925,14 @@
entryform.format.preformatted=None
+entryform.give=Give button:
+
+entryform.give.default=Journal Default
+
+entryform.give.disable=Disable
+
+entryform.give.enable=Enable
+
entryform.htmlokay.rte_nosupport=(Sorry, your browser does not currently support the rich text environment.)
entryform.nojstime.note=<b>Note:</b> The time/date above is from our server.<br />Correct them for your timezone before posting.
@@ -2313,6 +2323,8 @@
event.community.join_reject=A membership request has been rejected in a [[community]]
+event.give=Someone sends me a Give LJ Tokens
+
event.journal_new_comment.my_journal=Someone comments in my journal on any entry
event.perm_sale|staleness=1
@@ -2365,6 +2377,10 @@
friendsfriends.text=Hey friend, the [[link]] page shows all your friends' Friends pages in one Friends page. Say that three times fast.
+give_features.give=Give
+
+give_features.given=Given [[count]]
+
home_promo_nonpaid1=<b><a href="http://www.livejournal.com/myads/">Your Journal - Your Money</a></b><br/> Display Google Ads in your journal to earn extra cash. <a href=http://www.livejournal.com/manage/payments/modify.bml?ref=pb1>Upgrade to a Paid Account</a> to participate.
home_promo_nonpaid2=<b><a href=http://www.livejournal.com/manage/payments/modify.bml?ref=pb2>Upgrade to Paid Account</a></b><br/>Enjoy an ad-free journal and access to all <a href=http://www.livejournal.com/paidaccounts/>premium features</a>.
@@ -5477,6 +5493,10 @@
setting.ga_webpropertyID.error=must contain only A-Z, 0-9 or '-'.
+setting.give.label=Give button / link
+
+setting.give.option.self=Display button <span class="smaller">(to receive notifications set the <a href="[[url]]">Notifications settings</a>)<span>
+
setting.googleanalytics.label=Google Analytics
setting.googleanalytics.option=Enter your web property ID obtained from Google
@@ -9995,14 +10015,20 @@
wallet.tokens.item.name=LJ Tokens
+wallet.tokens.donate.name=Give for an <a href="[[url]]">entry</a>
+
wallet.tokens.item.type=[[qty]] [[?qty|token|tokens|tokens]] ($[[amt]] USD)
wallet.widget.history.des.anon=Received from an anonymous sender
wallet.widget.history.des.buy=Buy tokens
+wallet.widget.history.des.donate=Sent for an <a href="[[url]]">entry</a> to [[to]]
+
wallet.widget.history.des.rcvd=Received from [[from]]
+wallet.widget.history.des.rcvd_donate=You got tokens for an <a href="[[url]]">entry</a> from [[from]]
+
wallet.widget.history.des.sent=Sent to [[to]]
wallet.widget.history.des.order=<a href="[[cart_link]]">Order in LJ Shop</a>
Modified: trunk/bin/upgrading/proplists-local.dat
===================================================================
--- trunk/bin/upgrading/proplists-local.dat 2011-05-16 08:34:29 UTC (rev 10511)
+++ trunk/bin/upgrading/proplists-local.dat 2011-05-17 05:14:10 UTC (rev 10512)
@@ -746,3 +746,10 @@
des: a link to this user's Google profile
cldversion: 8
+userproplist.give_features:
+ indexed: 0
+ cldversion: 8
+ multihomed: 0
+ datatype: bool
+ des: Boolean: 1 - enable "Give" features in journal
+ prettyname: Enable "Give" features
Modified: trunk/cgi-bin/LJ/Hooks/ESN.pm
===================================================================
--- trunk/cgi-bin/LJ/Hooks/ESN.pm 2011-05-16 08:34:29 UTC (rev 10511)
+++ trunk/cgi-bin/LJ/Hooks/ESN.pm 2011-05-17 05:14:10 UTC (rev 10512)
@@ -195,6 +195,7 @@
'Defriended-u',
'UserMessageRecvd-u',
(LJ::SUP->is_sup_enabled($remote) ? ('WishList', 'WishListExpire') : ()),
+ 'GiveFeatures',
];
}
});
Modified: trunk/cgi-bin/LJ/Pay/Payment/PayItem.pm
===================================================================
--- trunk/cgi-bin/LJ/Pay/Payment/PayItem.pm 2011-05-16 08:34:29 UTC (rev 10511)
+++ trunk/cgi-bin/LJ/Pay/Payment/PayItem.pm 2011-05-17 05:14:10 UTC (rev 10512)
@@ -47,6 +47,7 @@
'userpic_large' => 'LJ::Pay::Payment::PayItem::Addon::Userpics::Large',
'tokens' => 'LJ::Pay::Payment::PayItem::WalletTokens',
'userhead' => 'LJ::Pay::Payment::PayItem::UserHead',
+ 'donate' => 'LJ::Pay::Payment::PayItem::Donate',
);
my @FREEZABLE_CLASSES = qw/
Modified: trunk/cgi-bin/LJ/Pay/Wallet.pm
===================================================================
--- trunk/cgi-bin/LJ/Pay/Wallet.pm 2011-05-16 08:34:29 UTC (rev 10511)
+++ trunk/cgi-bin/LJ/Pay/Wallet.pm 2011-05-17 05:14:10 UTC (rev 10512)
@@ -247,7 +247,7 @@
my $pi = LJ::Pay::Payment::PayItem->load($piid);
LJ::Pay::Wallet::Error->raise(ERROR_INVALID_PAYITEM, { 'piid' => $piid })
- unless $pi->get_item eq 'tokens';
+ unless $pi->get_item =~ /^(?:tokens|donate)$/;
my $uid = $pi->get_rcptid;
my $u = LJ::want_user($uid);
Modified: trunk/cgi-bin/LJ/Widget/Shop/History.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/Shop/History.pm 2011-05-16 08:34:29 UTC (rev 10511)
+++ trunk/cgi-bin/LJ/Widget/Shop/History.pm 2011-05-17 05:14:10 UTC (rev 10512)
@@ -90,13 +90,28 @@
if ($logitem->userid == $buyer_userid) {
$des = LJ::Lang::ml('wallet.widget.history.des.buy');
} else {
+ my $cart = $logitem->cart;
if ($logitem->item->get_anon || !$buyer_userid) {
$des = LJ::Lang::ml('wallet.widget.history.des.anon');
} else {
my $buyer = LJ::load_userid($buyer_userid);
- $des = LJ::Lang::ml('wallet.widget.history.des.rcvd', {
- 'from' => $buyer->ljuser_display,
- });
+ if (LJ::Pay::Payment::PayItem::Donate->present_in($cart)) {
+ my $entry;
+ my $vars = $cart->payvar_get_all;
+ if ( $vars->{'donate_jid'} && $vars->{'donate_jitemid'} ) {
+ my $journal = LJ::load_userid( $vars->{'donate_jid'} );
+ $entry = LJ::Entry->new( $journal, 'jitemid' => $vars->{'donate_jitemid'} )
+ if $journal;
+ }
+ $des = LJ::Lang::ml('wallet.widget.history.des.rcvd_donate', {
+ 'from' => $buyer->ljuser_display,
+ 'url' => ( $entry && $entry->valid ) ? $entry->url : '',
+ });
+ } else {
+ $des = LJ::Lang::ml('wallet.widget.history.des.rcvd', {
+ 'from' => $buyer->ljuser_display,
+ });
+ }
}
$token_xfer = 1;
}
@@ -109,6 +124,21 @@
$des = LJ::Lang::ml('wallet.widget.history.des.sent', {
'to' => $rcpt->ljuser_display,
});
+ } elsif (LJ::Pay::Payment::PayItem::Donate->present_in($cart)) {
+ my @items = $cart->get_items;
+ my $rcptid = $items[0]->get_rcptid;
+ my $rcpt = LJ::load_userid($rcptid);
+ my $entry;
+ my $vars = $cart->payvar_get_all;
+ if ( $vars->{'donate_jid'} && $vars->{'donate_jitemid'} ) {
+ my $journal = LJ::load_userid( $vars->{'donate_jid'} );
+ $entry = LJ::Entry->new( $journal, 'jitemid' => $vars->{'donate_jitemid'} )
+ if $journal;
+ }
+ $des = LJ::Lang::ml('wallet.widget.history.des.donate', {
+ 'to' => $rcpt->ljuser_display,
+ 'url' => ( $entry && $entry->valid ) ? $entry->url : '',
+ });
} else {
my $cart_link = $cart->cart_link;
$des = LJ::Lang::ml('wallet.widget.history.des.order', {
Modified: trunk/cgi-bin/crumbs-local.pl
===================================================================
--- trunk/cgi-bin/crumbs-local.pl 2011-05-16 08:34:29 UTC (rev 10511)
+++ trunk/cgi-bin/crumbs-local.pl 2011-05-17 05:14:10 UTC (rev 10512)
@@ -25,6 +25,7 @@
'extralj' => ['ExtraLJ', '/extra/', 'home'],
'filemanager' => ['File Manager', '/manage/files.bml', 'manage'],
'games' => ['Games', '', 'apps'],
+ 'givetokens' => ['Give tokens', '/give_tokens.bml', 'home'],
'goat' => ['About Frank', '/site/goat.bml', 'home'],
'legal' => ['Legal Information', '/legal/', 'home'],
'ljhome' => ['Home', "$LJ::SITEROOT/", ''],

