[dw-free] circle gifts page: don't show "buy gift" for seed accounts
[commit: http://hg.dwscoalition.org/dw-free/rev/1590b436d29f]
http://bugs.dwscoalition.org/show_bug.cgi?id=3737
Move seed accounts to their own section.
Patch by
fu.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=3737
Move seed accounts to their own section.
Patch by
Files modified:
- htdocs/shop/gifts.bml
- htdocs/shop/gifts.bml.text
--------------------------------------------------------------------------------
diff -r 6a8a8e352026 -r 1590b436d29f htdocs/shop/gifts.bml
--- a/htdocs/shop/gifts.bml Thu Jun 16 14:55:45 2011 +0800
+++ b/htdocs/shop/gifts.bml Thu Jun 16 15:02:53 2011 +0800
@@ -29,31 +29,33 @@
my $remote = LJ::get_remote();
return "<?needlogin?>" unless $remote;
- my ( $ret, @free, @expired, @expiring, @paid );
+ my ( $ret, @free, @expired, @expiring, @paid, @seed );
my $circle = LJ::load_userids( $remote->circle_userids );
foreach my $target ( values %$circle ) {
if ( ( $target->is_person || $target->is_community ) && $target->is_visible ) {
- my $paidstatus = DW::Pay::get_paid_status( $target );
+ my $paidstatus = DW::Pay::get_paid_status( $target );
# account was never paid if it has no paidstatus row:
push @free, $target unless defined $paidstatus;
if ( defined $paidstatus ) {
- # account is expired if it's not permanent,
- # and if the expiration date has passed:
- push @expired, $target unless $paidstatus->{permanent} ||
- $paidstatus->{expiresin} > 0;
+ if ( $paidstatus->{permanent} ) {
+ push @seed, $target;
+ } else {
+ # account is expired if the expiration date has passed:
+ push @expired, $target unless $paidstatus->{expiresin} > 0;
- # account is expiring soon if the expiration time is
- # within the next month:
- push @expiring, $target if $paidstatus->{expiresin} < 2592000
- && $paidstatus->{expiresin} > 0;
+ # account is expiring soon if the expiration time is
+ # within the next month:
+ push @expiring, $target if $paidstatus->{expiresin} < 2592000
+ && $paidstatus->{expiresin} > 0;
- # account is expiring in more than one month:
- push @paid, $target if $paidstatus->{expiresin} >= 2592000;
+ # account is expiring in more than one month:
+ push @paid, $target if $paidstatus->{expiresin} >= 2592000;
+ }
}
}
}
@@ -76,8 +78,11 @@
$ret .= "<li>" . $person->ljuser_display . ": " . $person->name_html;
$ret .= ", " . $person->last_updated if $opts{last_updated};
- $ret .= " [<a href='" . $person->gift_url . "'>";
- $ret .= LJ::Lang::ml( '.buy.gift' ) . "</a>]";
+
+ unless ( $opts{no_paid_time} ) {
+ $ret .= " [<a href='" . $person->gift_url . "'>";
+ $ret .= LJ::Lang::ml( '.buy.gift' ) . "</a>]";
+ }
if ( $person->is_personal ) {
$ret .= " [<a href='" . $person->gift_points_url . "'>";
@@ -116,6 +121,9 @@
# do the same with the paid users
my $paidusers = join '', map { $list_item->( $_ ) } @paid;
+ # do the same with seed users
+ my $seedusers = join '', map { $list_item->( $_, no_paid_time => 1 ) } @seed;
+
# and, now we build the page.
$ret .= "<p>";
$ret .= LJ::Lang::ml( '.about', { sitename => $LJ::SITENAMESHORT } );
@@ -167,6 +175,13 @@
$ret .= "<p>" . LJ::Lang::ml( '.paid.other.about' ) . "</p>";
$ret .= "<ul> " . $paidusers . "</ul>";
}
+
+ if ( $seedusers ) {
+ $ret .= "<h2>" . LJ::Lang::ml( '.seed.header' ) . "</h2>\n";
+ $ret .= "<p>" . LJ::Lang::ml( '.seed.about' ) . "</p>";
+ $ret .= "<ul> " . $seedusers . "</ul>";
+ }
+
return $ret;
}
_code?>
diff -r 6a8a8e352026 -r 1590b436d29f htdocs/shop/gifts.bml.text
--- a/htdocs/shop/gifts.bml.text Thu Jun 16 14:55:45 2011 +0800
+++ b/htdocs/shop/gifts.bml.text Thu Jun 16 15:02:53 2011 +0800
@@ -31,5 +31,9 @@
.paid.soon.about=These are the people in your Circle who have paid accounts that are expiring within the next month:
+.seed.header=Never Expiring
+
+.seed.about=These are the people in your circle who have seed accounts, but who might appreciate some points:
+
.title=Give the Gift of [[sitename]]
--------------------------------------------------------------------------------
