wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[ljcom] r11132: LJSUP-10238: LJ SHOP 2011 update: virtua...

Committer: gprochaev
LJSUP-10238: LJ SHOP 2011 update: virtual gifts

U   trunk/cgi-bin/LJ/EventsFeed/NewVGift.pm
U   trunk/htdocs/manage/vgift.bml
Modified: trunk/cgi-bin/LJ/EventsFeed/NewVGift.pm
===================================================================
--- trunk/cgi-bin/LJ/EventsFeed/NewVGift.pm	2011-11-01 09:10:18 UTC (rev 11131)
+++ trunk/cgi-bin/LJ/EventsFeed/NewVGift.pm	2011-11-01 13:11:04 UTC (rev 11132)
@@ -7,7 +7,8 @@
 sub new {
     my ($class, $gift) = @_;
 
-    croak "Must pass an LJ::User" unless UNIVERSAL::isa($gift, 'LJ::VGift');
+    croak "Must pass an LJ::VGift" unless UNIVERSAL::isa($gift, 'LJ::Shop::Feature::VGiftReceived')
+                                      or UNIVERSAL::isa($gift, 'LJ::VGift');
 
     my $to = $gift->u;
     my $from = $gift->anonymous ? undef : $gift->from;

Modified: trunk/htdocs/manage/vgift.bml
===================================================================
--- trunk/htdocs/manage/vgift.bml	2011-11-01 09:10:18 UTC (rev 11131)
+++ trunk/htdocs/manage/vgift.bml	2011-11-01 13:11:04 UTC (rev 11132)
@@ -5,6 +5,8 @@
     use strict;
     use vars qw(%POST %GET $title $head);
 
+    use LJ::Shop::Feature::VGiftReceived;
+
     return LJ::server_down_html() if $LJ::SERVER_DOWN;
 
     $title = "Virtual Gifts";
@@ -25,7 +27,12 @@
                 or $rcpt_disable_vgifts_value eq "anon" and not $remote
                 or $rcpt_disable_vgifts_value eq "non-friends" and not $u->is_friend($remote));
 
-    my @gifts = LJ::VGift->all_gifts($u);
+    my @vgifts = ();
+    unless (LJ::is_enabled('shop3') || LJ::is_enabled('shop3_beta')) {
+        @vgifts = LJ::VGift->all_gifts($u);
+    } else {
+        @vgifts = LJ::Shop::Feature::VGiftReceived->all_gifts($u);
+    }
 
     if (@gifts) {
         foreach my $g (@gifts) {
@@ -35,8 +42,14 @@
 
             # promo and tracking
             my $xtra = "";
-            $xtra .= $g->tagline($remote) if ($g->tagline($remote));
-            $xtra .= $g->tracking($remote) if ($g->tracking($remote));
+            if (LJ::is_enabled('shop3') || LJ::is_enabled('shop3_beta')) {
+                my $gifttype = $g->gifttype();
+                $xtra .= $gifttype->tagline($remote) if ($gifttype->tagline($remote));
+                $xtra .= $gifttype->tracking($remote) if ($gifttype->tracking($remote));
+            } else {
+                $xtra .= $g->tagline($remote) if ($g->tagline($remote));
+                $xtra .= $g->tracking($remote) if ($g->tracking($remote));
+            }
             $xtra = "<p style='font-size: smaller; font-style: italic; color: #666;'>$xtra</p>" if ($xtra);
 
             if ((length $note) > 100) {
@@ -45,10 +58,18 @@
             }
             $ret .= "<div style='float: left; width: 300px; height: 140px'>";
             $ret .= " <div style='float: left; margin: 0 5px 0 0; position: relative;'>";
-            $ret .= "  <a href='$url' alt='Virtual Gift' title='Virtual Gift' style='border:0 !important;'>".$g->display_html_code."</a>";
+            if (LJ::is_enabled('shop3') || LJ::is_enabled('shop3_beta')) {
+                $ret .= "  <a href='$url' alt='Virtual Gift' title='Virtual Gift' style='border:0 !important;'>".$gifttype->display_html_code."</a>";
+            } else {
+                $ret .= "  <a href='$url' alt='Virtual Gift' title='Virtual Gift' style='border:0 !important;'>".$g->display_html_code."</a>";
+            }
             $ret .= " </div>";
             $ret .= " <div>";
-            $ret .= "<b>" . $g->name . "</b><br />";
+            if (LJ::is_enabled('shop3') || LJ::is_enabled('shop3_beta')) {
+                $ret .= "<b>" . $gifttype->name . "</b><br />";
+            } else {
+                $ret .= "<b>" . $g->name . "</b><br />";
+            }
             $ret .= "  From: $from<br />";
             $ret .= "  Date: " . scalar(gmtime($g->daterecv_unix)) . "<br />";
             $ret .= "  <p>" . $note . "</p>";

Tags: bml, gprochaev, ljcom, pm, wisest-owl
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