juks (juks) wrote in changelog,
juks
juks
changelog

[ljcom] r9969: LJSUP-7445 Try & buy

Committer: iaskarov
LJSUP-7445 Try & buy
U   trunk/cgi-bin/LJ/Pay.pm
U   trunk/cgi-bin/LJ/Widget/HomepageEN.pm
U   trunk/templates/Homepage/index_en.tmpl
Modified: trunk/cgi-bin/LJ/Pay.pm
===================================================================
--- trunk/cgi-bin/LJ/Pay.pm	2011-01-28 12:02:44 UTC (rev 9968)
+++ trunk/cgi-bin/LJ/Pay.pm	2011-01-31 10:38:41 UTC (rev 9969)
@@ -393,21 +393,22 @@
 
     $ret .= "<?standout " unless $opts->{'nostandout'};
 
-    $ret .= $opts->{noboldheading} ? "$BML::ML{'pay.widget.header'}<br />" : "<b>$BML::ML{'pay.widget.header'}</b><br />";
-
-    $ret .= "<div style='margin-left: 15px'>" unless $opts->{noindent};
-
-    my $phonemax = LJ::get_cap($u, 'phonepost_monthquota') || 0;
-    my $phoneusage = 0;
-    if ($phonemax > 0) {
-        my $dbcr = LJ::get_cluster_reader($u);
-        $phoneusage = LJ::PhonePost::phoneposts_this_month($u)+0;
-    }
-
-    $ret .= "<br />" . BML::ml('pay.widget.voiceposts', {'numused' => $phoneusage, 'max' => $phonemax, 'aopts' => "href='$LJ::SITEROOT/support/faqbrowse.bml?faqid=183&amp;view=full'"}) . " $upgrade_link"
-        unless $is_comm || $is_identity;
-
-
+    $ret .= '<div class="b-accstats-wrapper">';
+    $ret .= '<table class="b-accstats-table">';
+    $ret .= '<tr>';
+    $ret .= '<th class="b-accstats-head">' . BML::ml('pay.widget.title') . '</th>';
+    $ret .= '<td class="b-accstats-subhead b-accstats-userpics"><span>' . BML::ml('pay.widget.userpics.title') . '</span></td>';
+    $ret .= '<td class="b-accstats-subhead b-accstats-storage"><span>' . BML::ml('pay.widget.storage.title') . '</span></td>' unless $is_comm || $is_identity;
+    $ret .= '<td class="b-accstats-subhead b-accstats-subs"><span>' . BML::ml('pay.widget.subscriptions.title') . '</span></td>' if $u->can_use_esn && !$u->is_community;
+    $ret .= '<td class="b-accstats-subhead b-accstats-voice"><span>' . BML::ml('pay.widget.voiceposts.title') . '</span></td>' unless $is_comm || $is_identity;
+    $ret .= '<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_identity ? '<td rowspan="3" class="b-accstats-button"><a href="' . $LJ::SITEROOT .'/identity/convert.bml" class="b-accstats-upgrade">' . BML::ml('pay.widget.upgradefull') . '</a></td>' : '<td rowspan="3" class="b-accstats-button"><a href="' . $LJ::SITEROOT .'/manage/account/?changelevel=2" class="b-accstats-upgrade">' . BML::ml('pay.widget.upgradenow') . '</a></td>';
+    $ret .= '</tr>';
+    $ret .= '<tr>';
+    $ret .= '<th class="b-accstats-subhead b-accstats-border">' . BML::ml('pay.widget.header') . '</th>';
+    
+    #userpics
+    $ret .= '<td class="b-accstats-border">';
     my %cap_opts = ();
     my $upicmax = LJ::get_cap($u, 'userpics', \%cap_opts) || 0;
     my $upicusage = 0;
@@ -415,14 +416,15 @@
         my $dbcr = LJ::get_cluster_reader($u);
         $upicusage = LJ::userpic_count($u);
     }
-
     my $trim = sub { return substr($_[0], 0, 10); };
-    $ret .= "<br />" . BML::ml('pay.widget.userpics', {'numused' => $upicusage, 'max' => $upicmax, 'aopts' => "href='$LJ::SITEROOT/support/faqbrowse.bml?faqid=1'"});
+    $ret .= BML::ml('pay.widget.userpics', {'numused' => $upicusage, 'max' => $upicmax, 'aopts' => "href='$LJ::SITEROOT/support/faqbrowse.bml?faqid=1'"});
     my @upics_str = ();
     push @upics_str => BML::ml('pay.widget.userpics.exp.small', { num => $cap_opts{small_packs}, date => $trim->($cap_opts{small_exp})}) if $cap_opts{small_packs};
     push @upics_str => BML::ml('pay.widget.userpics.exp.large', { num => $cap_opts{large_packs}, date => $trim->($cap_opts{large_exp})}) if $cap_opts{large_packs};
     $ret .= " (" . (join ";", @upics_str) . ")" if @upics_str;
-    # Disk usage stat
+    $ret .= '</td>';
+    
+    #storage
     my %shift = ( GiB => 1 << 30, MiB => 1 << 20, KiB => 1 << 10 );
     my $size = sub {
         my $bytes = shift;
@@ -430,40 +432,60 @@
         return sprintf("%.2f MB", $bytes / $shift{MiB}) if $bytes >= $shift{MiB};
         return sprintf("%.2f KB", $bytes / $shift{KiB});
     };
-
     my $used_size = LJ::Blob->get_disk_usage($u);
     my $max_size = LJ::get_cap($u, "disk_quota") * $shift{MiB};
-    $ret .= "<br />" . BML::ml('pay.widget.storage', {'amountused' => $size->($used_size), 'max' => $size->($max_size)}) . " $upgrade_link"
+    $ret .= '<td class="b-accstats-border">' . BML::ml('pay.widget.storage', {'amountused' => $size->($used_size), 'max' => $size->($max_size)}) . '</td>'
         unless $is_comm || $is_identity;
-
-    # subscriptions
+    
+    #subscriptions
+    my $phonemax = LJ::get_cap($u, 'phonepost_monthquota') || 0;
+    my $phoneusage = 0;
+    if ($phonemax > 0) {
+        my $dbcr = LJ::get_cluster_reader($u);
+        $phoneusage = LJ::PhonePost::phoneposts_this_month($u)+0;
+    }
     my $sub_count = $u->subscriptions_count;
     my $sub_max = $u->get_cap('subscriptions');
-    $ret .= "<br />" . BML::ml('pay.widget.subscriptions', { numused => $sub_count, max => $sub_max })
+    $ret .= '<td class="b-accstats-border">' . BML::ml('pay.widget.subscriptions', { numused => $sub_count, max => $sub_max }) . '</td>'
         if $u->can_use_esn && !$u->is_community;
+    
+    #voice
+    $ret .= '<td class="b-accstats-border">' . BML::ml('pay.widget.voiceposts', {'numused' => $phoneusage, 'max' => $phonemax, 'aopts' => "href='$LJ::SITEROOT/support/faqbrowse.bml?faqid=183&amp;view=full'"}) . '</td>'
+        unless $is_comm || $is_identity;
+    
+    $ret .= '</tr>';
+    $ret .= '<tr>';
+    $ret .= '<th class="b-accstats-subhead">' . BML::ml('pay.widget.upgrade') . '</th>';
+    $ret .= '<td>' . BML::ml('pay.widget.upgradebonus.userpics') . '</td>';
+    $ret .= '<td>' . BML::ml('pay.widget.upgradebonus.storage') . '</td>' unless $is_comm || $is_identity;
+    $ret .= '<td>' . BML::ml('pay.widget.upgradebonus.subscriptions') . '</td>' if $u->can_use_esn && !$u->is_community;
+    $ret .= '<td>' . BML::ml('pay.widget.upgradebonus.voice') . '</td>' unless $is_comm || $is_identity;
+    $ret .= '</tr>';
+    $ret .= '</table>';
+    $ret .= '</div>';
 
-    if ($opts->{noindent}) {
-        $ret .= "<br /><br />";
-    } else {
-        $ret .= "</div><br />";
-    }
 
-    if (!$u->get_cap('paid')) {
-        $ret .= "<p>" . BML::ml('pay.widget.upgradebonus', { aopts => "href='$LJ::SITEROOT/manage/account'" }) . "</p>";
-    }
+    $ret .= '<ul>';
 
+#    if (!$u->get_cap('paid')) {
+#        $ret .= "<p>" . BML::ml('pay.widget.upgradebonus', { aopts => "href='$LJ::SITEROOT/manage/account'" }) . "</p>";
+#    }
+
     my $text = $u->in_class("paid") ? $BML::ML{'pay.widget.details'} : $BML::ML{'pay.widget.upgrade'};
-    $ret .= "<a href='$LJ::SITEROOT/manage/payments/'>$text</a><br />"
+    $ret .= "<li><a href='$LJ::SITEROOT/manage/payments/'>$text</a></li>"
         unless $opts->{nodetail_link} || $is_identity;
 
-    $ret .= "<a href='$LJ::SITEROOT/manage/payments/history.bml'>$BML::ML{'pay.widget.history'}</a><br />"
+    $ret .= "<li><a href='$LJ::SITEROOT/manage/payments/history.bml'>$BML::ML{'pay.widget.history'}</a></li>"
         unless $opts->{'nopayhistory'} || $is_identity;
 
-    # SMS quota
+
+# SMS quota
     my $sms_left = $u->sms_quota_remaining || 0;
-    $ret .= "<a href='$LJ::SITEROOT/manage/sms/'>" . BML::ml('pay.widget.sms', { num => $sms_left }) . "</a> $upgrade_link<br />"
+    $ret .= "<li><a href='$LJ::SITEROOT/manage/sms/'>" . BML::ml('pay.widget.sms', { num => $sms_left }) . "</a></li>"
         if $u->can_use_sms && !$is_comm && !$is_identity;
 
+
+# gift certs
     my $dbh = LJ::get_db_writer();
     my $sth = $dbh->prepare("SELECT arg, payid FROM coupon WHERE rcptid=?");
     $sth->execute($u->id);
@@ -472,8 +494,10 @@
     while (my $row = $sth->fetchrow_hashref) {
         $giftcert_sum += $row->{arg} unless $row->{payid};
     }
+    $ret .= "<li><a href='$LJ::SITEROOT/manage/payments/giftcerts.bml?authas=" . $u->user . "'>" . LJ::Lang::ml('pay.widget.giftcerts.sum', { sum => sprintf("\$%.02f", $giftcert_sum) }) . "</a></li>" if ($giftcert_sum);
+    
+    $ret .= '</ul>';
 
-    $ret .= "<a href='$LJ::SITEROOT/manage/payments/giftcerts.bml?authas=" . $u->user . "'>" . LJ::Lang::ml('pay.widget.giftcerts.sum', { sum => sprintf("\$%.02f", $giftcert_sum) }) . "</a>";
 
     $ret .= " standout?>" unless $opts->{'nostandout'};
 

Modified: trunk/cgi-bin/LJ/Widget/HomepageEN.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/HomepageEN.pm	2011-01-28 12:02:44 UTC (rev 9968)
+++ trunk/cgi-bin/LJ/Widget/HomepageEN.pm	2011-01-31 10:38:41 UTC (rev 9969)
@@ -154,7 +154,10 @@
 
     ## Widget PublicStats
     $result{widget_publicstats} = LJ::Widget::PublicStats->render( show_latest_posts => 0, short_numbers => 1 );
-
+    
+    ## Widget Trynbuy
+    $result{widget_trynbuy} = LJ::Widget::Trynbuy->render(stage => 'simple');
+    
     ## Strings
     $result{string_loggedout_facts_open} = BML::ml('.loggedout.facts.open', { aopts => "href='http://www.livejournal.org/'" });
     $result{string_loggedout_facts_volunteer} = BML::ml('.loggedout.facts.volunteer', { aopts => "href='$LJ::HELPURL{how_to_help}'", sitename => $LJ::SITENAMEABBREV });

Modified: trunk/templates/Homepage/index_en.tmpl
===================================================================
--- trunk/templates/Homepage/index_en.tmpl	2011-01-28 12:02:44 UTC (rev 9968)
+++ trunk/templates/Homepage/index_en.tmpl	2011-01-31 10:38:41 UTC (rev 9969)
@@ -59,6 +59,7 @@
             <tmpl_var info_box>
             <tmpl_var widget_vgifts>
             <tmpl_var widget_updatesforuser>
+            <tmpl_var widget_trynbuy>
             <tmpl_var widget_featuredstyles>
         </div>
     </div><!-- end .homepage-loggedin  -->
@@ -146,6 +147,8 @@
                         </tmpl_if>
                     </div>
                 </div><!-- end .homepage-stats -->
+
+                <tmpl_var widget_trynbuy>
         
                 <tmpl_var widget_photos2homepage>
                 <tmpl_var widget_polloftheday>

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