juks (juks) wrote in changelog,
juks
juks
changelog

[ljcom] r10077: LJSUP-7445 Try & buy

Committer: iaskarov
LJSUP-7445 Try & buy
U   trunk/cgi-bin/LJ/Hooks/Userinfo.pm
U   trunk/cgi-bin/LJ/Pay.pm
U   trunk/cgi-bin/LJ/Widget/HomepageEN.pm
U   trunk/cgi-bin/LJ/Widget/HomepageRU.pm
U   trunk/cgi-bin/ljcom.pl
U   trunk/htdocs/manage/account/index.bml
Modified: trunk/cgi-bin/LJ/Hooks/Userinfo.pm
===================================================================
--- trunk/cgi-bin/LJ/Hooks/Userinfo.pm	2011-02-18 08:13:22 UTC (rev 10076)
+++ trunk/cgi-bin/LJ/Hooks/Userinfo.pm	2011-02-18 08:17:27 UTC (rev 10077)
@@ -417,7 +417,7 @@
                                                   "WHERE userid=$u->{'userid'}");
             $ret .= "<strong>" . LJ::LJcom::acct_name($u->{caps}, substr($paiduntil, 0, 10)) . "</strong>";
         } else {
-            $ret .= "<strong>" . LJ::LJcom::acct_name($u->{caps}) . "</strong>";
+            $ret .= "<strong>" . LJ::LJcom::acct_name($u->{caps}, undef, 'u', $u) . "</strong>";
         }
 
         unless ($u->get_cap("perm")) {

Modified: trunk/cgi-bin/LJ/Pay.pm
===================================================================
--- trunk/cgi-bin/LJ/Pay.pm	2011-02-18 08:13:22 UTC (rev 10076)
+++ trunk/cgi-bin/LJ/Pay.pm	2011-02-18 08:17:27 UTC (rev 10077)
@@ -405,7 +405,7 @@
     $ret .= '<td class="b-accstats-subhead b-accstats-voice"><span>' . BML::ml('pay.widget.voiceposts.title') . '</span></td>' unless $is_comm || $is_identity;
     
     if ($show_trynbuy) {
-        $ret .= $is_comm ? '<td rowspan="3" class="b-accstats-button b-accstats-button-tnb"><a href="' . $LJ::SITEROOT .'/community/account.bml?authas=' . $u->user . '" class="b-accstats-trynbuy">' . BML::ml('pay.widget.trynbuy') . '</a></td>' : '<td rowspan="3" class="b-accstats-button"><a href="' . $LJ::SITEROOT .'/manage/account/?changelevel=1" class="b-accstats-trynbuy">' . BML::ml('pay.widget.trynbuy') . '</a></td>';
+        $ret .= $is_comm ? '<td rowspan="3" class="b-accstats-button b-accstats-button-tnb"><a href="' . $LJ::SITEROOT .'/community/account.bml?authas=' . $u->user . '" class="b-accstats-trynbuy">' . BML::ml('pay.widget.trynbuy') . '</a></td>' : '<td rowspan="3" class="b-accstats-button"><a href="' . $LJ::SITEROOT .'/manage/account/?changelevel=2" class="b-accstats-trynbuy">' . BML::ml('pay.widget.trynbuy') . '</a></td>';
     }
     
     if(!$u->get_cap('paid')) {    

Modified: trunk/cgi-bin/LJ/Widget/HomepageEN.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/HomepageEN.pm	2011-02-18 08:13:22 UTC (rev 10076)
+++ trunk/cgi-bin/LJ/Widget/HomepageEN.pm	2011-02-18 08:17:27 UTC (rev 10077)
@@ -156,7 +156,7 @@
     $result{widget_publicstats} = LJ::Widget::PublicStats->render( show_latest_posts => 0, short_numbers => 1 );
     
     ## Widget Trynbuy
-    if(LJ::TryNBuy->can_enable($remote)) {
+    if(LJ::TryNBuy->can_enable($remote) || LJ::TryNBuy->active($remote)) {
         $result{widget_trynbuy} = LJ::Widget::Trynbuy->render(stage => 'simple');
     }
     

Modified: trunk/cgi-bin/LJ/Widget/HomepageRU.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/HomepageRU.pm	2011-02-18 08:13:22 UTC (rev 10076)
+++ trunk/cgi-bin/LJ/Widget/HomepageRU.pm	2011-02-18 08:17:27 UTC (rev 10077)
@@ -129,7 +129,7 @@
     $result{widget_settingproddisplay} = LJ::Widget::SettingProdDisplay->render;
     
     ## Widget Trynbuy
-    if(LJ::TryNBuy->can_enable($remote)) {
+    if(LJ::TryNBuy->can_enable($remote) || LJ::TryNBuy->active($remote)) {
         $result{widget_trynbuy} = LJ::Widget::Trynbuy->render(stage => 'simple');
     }
 

Modified: trunk/cgi-bin/ljcom.pl
===================================================================
--- trunk/cgi-bin/ljcom.pl	2011-02-18 08:13:22 UTC (rev 10076)
+++ trunk/cgi-bin/ljcom.pl	2011-02-18 08:17:27 UTC (rev 10077)
@@ -196,7 +196,7 @@
         }
     } elsif (LJ::caps_in_group($caps, "trynbuy")) {   
         ## TRY'n'BUY
-        return "*trynbuy*";
+        return LJ::Lang::ml('trynbuy.account.title', {expdate => LJ::TryNBuy->exp_date($opts{u})});
     } elsif (LJ::caps_in_group($caps, "plus")) {
         if ($display_extrainfo) {
             return $is_early ? $BML::ML{'ljcom.userinfo.types.previously_early'} : "";

Modified: trunk/htdocs/manage/account/index.bml
===================================================================
--- trunk/htdocs/manage/account/index.bml	2011-02-18 08:13:22 UTC (rev 10076)
+++ trunk/htdocs/manage/account/index.bml	2011-02-18 08:17:27 UTC (rev 10077)
@@ -27,7 +27,7 @@
     my $is_permanent = $u->in_class('perm'); 
 
     # plus users visiting this page with the ?changelevel=1 argument get an option to downgrade to basic
-    my $change_level = $GET{changelevel} && LJ::is_enabled('basic_downgrade', $u) && $u->in_class('plus') ? 1 : 0;
+    my $change_level = (($GET{changelevel} == 1) && (LJ::is_enabled('basic_downgrade', $u)) && ($u->in_class('plus'))) ? 1 : ($GET{changelevel} == 2) ? 2 : 0;
 
     $title = $ML{'.title.upgrade'};
     $title = $ML{'.title1'} if $u->get_cap('paid');
@@ -446,7 +446,7 @@
 
             if($u && !LJ::TryNBuy->active($u) && !LJ::TryNBuy->already_used($u)) {
                 $body .= "<tr><td>";
-                $body .= LJ::html_check({ type => "radio", name => "acct_level", value => "trynbuy", id => "change_level_trynbuy", selected => $u->knows_about_sponsors ? 0 : 1 });
+                $body .= LJ::html_check({ type => "radio", name => "acct_level", value => "trynbuy", id => "change_level_trynbuy", selected => ($change_level == 2) ? 1 : 0 });
                 $body .= "</td><td>";
                 $body .= "<p><strong><label for='change_level_trynbuy'>$ML{'.changelevel.trynbuy.title'}</label></strong><br />";
                 $body .= "<label for='change_level_trynbuy'>" . BML::ml('.changelevel.trynbuy.text') . "</label></p>";
@@ -454,7 +454,7 @@
             }
 
             $body .= "<tr class='paid_block'><td>";
-            $body .= LJ::html_check({ type => "radio", name => "acct_level", value => "paid", id => "change_level_paid", selected => $u->knows_about_sponsors ? 0 : 1 });
+            $body .= LJ::html_check({ type => "radio", name => "acct_level", value => "paid", id => "change_level_paid", selected => $u->knows_about_sponsors || $change_level == 2 ? 0 : 1 });
             $body .= "</td><td>";
             $body .= "<p><strong><label for='change_level_paid'>$ML{'.changelevel.paid.title'}</label></strong><br />";
             $body .= "<label for='change_level_paid'>" . BML::ml('.changelevel.paid.text', { price => "\$2", aopts => "href='$LJ::HELPURL{paid_benefits_full}'" }) . "</label></p>";

Tags: bml, juks, ljcom, pl, pm
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