Add section to the gifts page showing everybody in your circle in case 
you're looking for someone in specific.

        Patch by yvi. 

diffs (123 lines):

diff -r 59955acbe4f8 -r 2519def8adac htdocs/shop/gifts.bml
--- a/htdocs/shop/gifts.bml     Sun May 02 06:57:34 2010 +0000
+++ b/htdocs/shop/gifts.bml     Sun May 02 07:06:07 2010 +0000
@@ -29,7 +29,7 @@ body<=
     my $remote = LJ::get_remote();
     return "<?needlogin?>" unless $remote;
 
-    my ( $ret, @free, @expiring );
+    my ( $ret, @free, @expiring, @paid );
 
     my $circle = LJ::load_userids( $remote->circle_userids );
 
@@ -49,6 +49,9 @@ body<=
             # account is expiring soon if the expiration time is
             # within the next month:
             push @expiring, $target if $paidstatus &&  
$paidstatus->{expiresin} < 2592000  && $paidstatus->{expiresin} > 0;
+
+            # account is expiring in more than one month
+            push @paid, $target if $paidstatus &&  $paidstatus->{expiresin} >= 
2592000;
         }
     }
 
@@ -56,6 +59,7 @@ body<=
     # now that we have the lists, sort them alphabetically by display name: 
     @free = sort { $a->display_name cmp $b->display_name } @free;
     @expiring = sort { $a->display_name cmp $b->display_name } @expiring;
+    @paid = sort { $a->display_name cmp $b->display_name } @paid;
 
     # and we've got our lists. the only thing left is to format them
     # for human display, so we:
@@ -67,7 +71,8 @@ body<=
     my $freecommunities;
     foreach my $person ( @free ) {
         my $linked = "<li>" . $person->ljuser_display . ": " . 
$person->name_html . ", " . $person->last_updated . " [<a 
href='$LJ::SITEROOT/shop/account?for=gift&user=" 
-            . $person->user . "'>" . BML::ml( '.buy' ) . "</a>]</li>\n";
+            . $person->user . "'>" . BML::ml( '.buy.gift' ) . "</a>]" . " [<a 
href='$LJ::SITEROOT/shop/points?for="
+            . $person->user . "'>" . BML::ml( '.buy.points' ) . "</a>]</li>\n";
         if ( $person->is_personal ) {
             $freeusers .= $linked;
         } else {
@@ -79,11 +84,25 @@ body<=
     # the display username and a buy-a-gift link:
     my $expusers;
     foreach my $person ( @expiring ) {
-        $expusers .= "<li>" . $person->ljuser_display . ": " . 
$person->name_html . " [<a href='$LJ::SITEROOT/shop/account?for=gift&user=" . 
$person->user . "'>" . BML::ml( '.buy' ) . "</a>]</li>\n";
+        $expusers .= "<li>" . $person->ljuser_display . ": " . 
$person->name_html . " [<a href='$LJ::SITEROOT/shop/account?for=gift&user=" . 
$person->user . "'>" . BML::ml( '.buy.gift' ) . "</a>]" . " [<a 
href='$LJ::SITEROOT/shop/points?for=" . $person->user . "'>" . BML::ml( 
'.buy.points' ) . "</a>]</li>\n";
+    }
+
+    # do the same with the paid users
+    my $paidusers;
+    foreach my $person ( @paid ) {
+        $paidusers .= "<li>" . $person->ljuser_display . ": " . 
$person->name_html . " [<a href='$LJ::SITEROOT/shop/account?for=gift&user=" . 
$person->user . "'>" . BML::ml( '.buy.gift' ) . "</a>]" . " [<a 
href='$LJ::SITEROOT/shop/points?for=" . $person->user . "'>" . BML::ml( 
'.buy.points' ) . "</a>]</li>\n";
     }
 
     # and, now we build the page.
     $ret .= "<p>" . BML::ml( '.about', { 'sitename' => $LJ::SITENAMESHORT } ) 
. "</p>";
+
+    unless ( $freeusers || $freecommunities || $expusers ) {
+        if ( $paidusers ) {
+            $ret .= "<p>" . BML::ml( '.none.free.text', { 'sitename' => 
$LJ::SITENAMESHORT, 'aopts' => "href='$LJ::SITEROOT/shop/'" } ) . "</p>";
+        } else {
+            $ret .= "<p>" . BML::ml( '.none.text', { 'sitename' => 
$LJ::SITENAMESHORT, 'aopts' => "href='$LJ::SITEROOT/shop/'" } ) . "</p>";
+        }
+    }
 
     if ( $freeusers || $freecommunities ) {
         $ret .= "<h2>" . BML::ml( '.free.header' ) . "</h2>\n";
@@ -102,15 +121,17 @@ body<=
     }
 
     if ( $expusers ) {
-        $ret .= "<h2>" . BML::ml( '.paid.header' ) . "</h2>\n";
-        $ret .= "<p>" . BML::ml( '.paid.about' ) . "</p>";
+        $ret .= "<h2>" . BML::ml( '.paid.header.soon' ) . "</h2>\n";
+        $ret .= "<p>" . BML::ml( '.paid.soon.about' ) . "</p>";
         $ret .= "<ul> " . $expusers . "</ul>";
+        $ret .= "<br />";
     }
 
-    unless ( $freeusers || $freecommunities || $expusers ) {
-        $ret .= "<p>" . BML::ml( '.none.text', { 'sitename' => 
$LJ::SITENAMESHORT, 'aopts' => "href='$LJ::SITEROOT/shop/'" } ) . "</p>";
+    if ( $paidusers ) {
+        $ret .= "<h2>" . BML::ml( '.paid.header.other' ) . "</h2>\n";
+        $ret .= "<p>" . BML::ml( '.paid.other.about' ) . "</p>";
+        $ret .= "<ul> " . $paidusers . "</ul>";
     }
-
     return $ret;
 }
 _code?>
diff -r 59955acbe4f8 -r 2519def8adac htdocs/shop/gifts.bml.text
--- a/htdocs/shop/gifts.bml.text        Sun May 02 06:57:34 2010 +0000
+++ b/htdocs/shop/gifts.bml.text        Sun May 02 07:06:07 2010 +0000
@@ -2,7 +2,9 @@
 
 .about=Are you looking for a gift for a birthday or a holiday? Is one of the 
people in your Circle such a compelling writer that you want to find a way to 
say a quick "thank you for being so awesome"? Give the gift of a paid 
[[sitename]] account!
 
-.buy=Buy gift
+.buy.gift=Buy gift
+
+.buy.points=Buy points
 
 .free.about=These are the people in your Circle who have free accounts and 
might appreciate the chance to try out some of our <a [[aopts]]>paid 
features</a>: 
 
@@ -12,10 +14,16 @@
 
 .free.header.communities=Communities
 
+.none.free.text=All of the people in your Circle have paid accounts that 
aren't set to expire soon. You can still buy a gift for them, or buy a gift for 
others in the <a [[aopts]]>[[sitename]] Shop</a>.
+
 .none.text=None of the people in your Circle have free accounts or have paid 
accounts that are expiring within the next month! You can still buy someone a 
gift in the <a [[aopts]]>[[sitename]] Shop</a>.
 
-.paid.about=These are the people in your Circle who have paid accounts that 
are expiring within the next month:
+.paid.header.other=Expiring in the far future
 
-.paid.header=Expiring Soon
+.paid.header.soon=Expiring Soon
+
+.paid.other.about=These are the people in your Circle whose paid accounts 
won't expire for a while, but who might appreciate a gift anyway:
+
+.paid.soon.about=These are the people in your Circle who have paid accounts 
that are expiring within the next month:
 
 .title=Give the Gift of [[sitename]]
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to