журнал (shhh) wrote in changelog,
журнал
shhh
changelog

[ljcom] r12278: LJSUP-12917: Add RESERVED and INCOMING t...

Committer: nnikulochkina
LJSUP-12917: Add RESERVED and INCOMING tabs to user wallet page
U   trunk/bin/upgrading/en_LJ.dat
U   trunk/cgi-bin/LJ/Widget/Shop/View/Wallet.pm
U   trunk/templates/Shop/Wallet.tmpl
Modified: trunk/bin/upgrading/en_LJ.dat
===================================================================
--- trunk/bin/upgrading/en_LJ.dat	2012-07-12 13:55:42 UTC (rev 12277)
+++ trunk/bin/upgrading/en_LJ.dat	2012-07-12 14:46:50 UTC (rev 12278)
@@ -13741,6 +13741,9 @@
 wallet.bml.free.tokens.title|staleness=1
 wallet.bml.free.tokens.title=Sed ut perspiciatis unde omnis iste natus 100 LJ Tokens for free?
 
+wallet.bml.incoming.repost=Paid repost <a href="[[url]]">[[subject]]</a>
+wallet.bml.incoming.repost.nosubject=No subject
+
 wallet.bml.landing.ajax_check_error.amt.insufficient_funds|staleness=1
 wallet.bml.landing.ajax_check_error.amt.insufficient_funds=Please reduce amount
 
@@ -13816,6 +13819,8 @@
 wallet.bml.landing.text.balance|staleness=1
 wallet.bml.landing.text.balance=Available balance: <strong>[[qty]]</strong> [[?qty|token|tokens|tokens]].
 
+wallet.bml.landing.text.incoming=Incoming: <strong>[[qty]]</strong> [[?qty|token|tokens|tokens]]
+
 wallet.bml.landing.title|staleness=1
 wallet.bml.landing.title=[[feature_name]]
 

Modified: trunk/cgi-bin/LJ/Widget/Shop/View/Wallet.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/Shop/View/Wallet.pm	2012-07-12 13:55:42 UTC (rev 12277)
+++ trunk/cgi-bin/LJ/Widget/Shop/View/Wallet.pm	2012-07-12 14:46:50 UTC (rev 12278)
@@ -5,6 +5,9 @@
 
 use LJ::Pay::Wallet;
 use LJ::Pay::Wallet::Error qw(:codes);
+use LJ::Pay::Wallet::Blocking;
+use LJ::Pay::Wallet::Account;
+
 use Digest::MD5 qw(md5_hex);
 
 sub get_subpage { 'wallet' }
@@ -46,6 +49,7 @@
     }
 
     my $balance = int eval { LJ::Pay::Wallet->get_user_balance($remote) };
+    my $incoming = $LJ::DISABLED{wallet_ext} ? 0 : int eval { LJ::Pay::Wallet::Blocking->get_incoming_amount($remote) };
 
     my %packages = %{LJ::Pay::Payment::PayItem::WalletTokens::PACKAGES()};
     my @order = @{LJ::Pay::Payment::PayItem::WalletTokens::PACKAGES_ORDER()};
@@ -100,8 +104,10 @@
     );
 
     my $show_tab = LJ::Request->get_param('show');
-    $show_tab = 'buy' unless $show_tab =~ /(buy|send|free)/;
+    $show_tab = 'buy' unless $show_tab =~ /(buy|send|free|incoming|reserved)/;
 
+    $show_tab = 'buy' if $LJ::DISABLED{wallet_ext} && $show_tab =~ /(incoming|reserved)/;
+    
     # autocomplete To field on Add form
     my @flist =
         LJ::isu($remote) ?
@@ -113,6 +119,20 @@
         $show_tab = 'buy' unless $free_tokens_status;
     }
 
+    my ($blockings, $accounts);
+
+    if ($show_tab =~ /incoming/) {
+        my $res = LJ::Pay::Wallet::Blocking->get_incoming_blockings($remote);
+        $blockings = $res->{items} if $res;
+    }
+
+    if ($show_tab =~ /reserved/) {
+        my $res = eval{LJ::Pay::Wallet::Account->get_user_active_accounts($remote)};
+        $accounts = $res->{items};
+    }
+
+
+
     # reserved
     my $transac_id = 0;
     my $sid = $LJ::FREE_TOKENS->{'freetopay'}->{'sid'};
@@ -133,8 +153,13 @@
         'promo_block_for_empty_wallet' => ($balance == 0),
         'free_tokens_enabled' => $free_tokens_status,
         'balance' => $balance,
+        'incoming' => $incoming,
         'self_uri' => LJ::Request->uri,
 
+        'wallet_ext_disabled' => $LJ::DISABLED{wallet_ext},
+        'blockings' => $blockings,
+        'accounts'  => $accounts,
+
         'tab_buy_active' => $show_tab eq 'buy',
         'tab_send_active' => $show_tab eq 'send',
         'tab_tokens_free' => $show_tab eq 'free',

Modified: trunk/templates/Shop/Wallet.tmpl
===================================================================
--- trunk/templates/Shop/Wallet.tmpl	2012-07-12 13:55:42 UTC (rev 12277)
+++ trunk/templates/Shop/Wallet.tmpl	2012-07-12 14:46:50 UTC (rev 12278)
@@ -15,7 +15,10 @@
 	</div>
 </TMPL_IF>
 
-<p class="b-wallet-balance"><TMPL_VAR expr="ml('wallet.bml.landing.text.balance', 'qty', balance)"></p>
+<p class="b-wallet-balance">
+        <TMPL_VAR expr="ml('wallet.bml.landing.text.balance', 'qty', balance)">
+        <TMPL_UNLESS wallet_ext_disabled><TMPL_VAR expr="ml('wallet.bml.landing.text.incoming', 'qty', incoming)"></TMPL_UNLESS>
+</p>
 
 <div class="b-buy">
 	<ul class="m-buy-types" id="mTabsShop">
@@ -160,4 +163,12 @@
 </script>
 <tmpl_var js_complete>
 
+<TMPL_UNLESS wallet_ext_disabled>
+<TMPL_IF blockings>
+        <TMPL_LOOP blockings>
+        <tmpl_var date> | <tmpl_var desc> | <tmpl_var qty> <br>
+        </TMPL_LOOP>
+</TMPL_IF>
+</TMPL_UNLESS>
+
 </div>

Tags: dat, ljcom, nikulochkina, nnikulochkina, pm, tmpl
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