afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] changelog2010-01-30 04:26 am

[dw-free] combine /admin/invites and /admin/invitecodes

[commit: http://hg.dwscoalition.org/dw-free/rev/7dba15b9d841]

http://bugs.dwscoalition.org/show_bug.cgi?id=2299

Combine invite code management admin pages into a central index. No
functional changes.

Patch by [staff profile] denise.

Files modified:
  • htdocs/admin/index.bml
  • htdocs/admin/index.bml.text
  • htdocs/admin/invitecodes.bml
  • htdocs/admin/invites/codetrace.bml
  • htdocs/admin/invites/index.bml
  • htdocs/admin/invites/index.bml.text
--------------------------------------------------------------------------------
diff -r bbe1694d81a6 -r 7dba15b9d841 htdocs/admin/index.bml
--- a/htdocs/admin/index.bml	Sat Jan 30 03:42:41 2010 +0000
+++ b/htdocs/admin/index.bml	Sat Jan 30 04:24:22 2010 +0000
@@ -53,14 +53,7 @@ body<=
             '<?_ml .admin.faq.link _ml?>', '<?_ml .admin.faq.text _ml?>', [ 'faqadd', 'faqedit', 'faqcat' ] ],
         [ 'fileedit/',
             '<?_ml .admin.file_edit.link _ml?>', 'Allows you to edit various include files.', [ 'fileedit' ] ],
-        [ 'invites/promo',
-            '<?_ml .admin.invite_promo.link _ml?>', '<?_ml .admin.invite_promo.text _ml?>', [ 'payments' ] ],
-        [ 'invites/requests',
-            '<?_ml .admin.invite_requests.link _ml?>', '<?_ml .admin.invite_requests.text _ml?>', [ 'payments' ] ],
-        [ 'invites/review',
-            '<?_ml .admin.invite_review.link _ml?>', '<?_ml .admin.invite_review.text _ml?>', [ 'payments' ] ],
-        [ 'invitecodes',
-            '<?_ml .admin.invite_codes.link _ml?>', '<?_ml .admin.invite_codes.text _ml?>', [ 'finduser:codetrace', 'finduser:*' ] ],
+        [ 'invites/', '<?_ml .admin.invites.link _ml?>', '<?_ml .admin.invites.text _ml?>', [ 'finduser:codetrace', 'finduser:*', 'payments' ] ],
         [ 'logout_user',
             '<?_ml .admin.logout_user.link _ml?>', '<?_ml .admin.logout_user.text _ml?>', [ 'suspend' ] ],
         [ 'memcache',
diff -r bbe1694d81a6 -r 7dba15b9d841 htdocs/admin/index.bml.text
--- a/htdocs/admin/index.bml.text	Sat Jan 30 03:42:41 2010 +0000
+++ b/htdocs/admin/index.bml.text	Sat Jan 30 04:24:22 2010 +0000
@@ -26,17 +26,8 @@
 .admin.file_edit.link=File Edit
 .admin.file_edit.text=Allows you to edit various include files.
 
-.admin.invite_codes.link=Invite Codes
-.admin.invite_codes.text=Shows the provenance of an invite code.
-
-.admin.invite_promo.link=Promotional Invite Codes
-.admin.invite_promo.text=Allows you to manage promotional invite codes.
-
-.admin.invite_requests.link=Invite Code Requests
-.admin.invite_requests.text=Allows you to review requests for invite codes.
-
-.admin.invite_review.link=Review Invite History
-.admin.invite_review.text=Allows you to view a user's invite history.
+.admin.invites.link=Invite Code Management
+.admin.invites.text=View and manage invite codes.
 
 .admin.logout_user.link=Logout User
 .admin.logout_user.text=Logs a user out of the site.
diff -r bbe1694d81a6 -r 7dba15b9d841 htdocs/admin/invitecodes.bml
--- a/htdocs/admin/invitecodes.bml	Sat Jan 30 03:42:41 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-<?page
-title=>Codetrace
-body<=
-<?_code
-{
-    use strict;
-    use vars qw( %POST );
-
-    return LJ::server_down_html if ( $LJ::SERVER_DOWN );
-
-    my $remote = LJ::get_remote;
-    my @displayprivs = ( "finduser:codetrace", "finduser:*" );
-    my $numprivs = @displayprivs;
-
-    return "<?needlogin?>"
-        unless $remote;
-
-    return BML::ml( "admin.noprivserror", { numprivs => $numprivs, needprivs => "<b>" . join(", ", @displayprivs) . "</b>"} )
-        unless $remote->has_priv( "finduser", "codetrace" );
-
-    my $ret;
-
-    $ret .= "<form method='GET'>";
-    $ret .= "View invite details: ";
-    $ret .= "<table>";
-    $ret .= "<tr><td><label>By code: </label></td>";
-    $ret .= "<td>" . LJ::html_text( { name => 'code', maxlength => DW::InviteCodes::CODE_LEN, size => DW::InviteCodes::CODE_LEN } ) . "</td></tr>";
-    $ret .= "<tr><td><label>By account: </label></td>";
-    $ret .= "<td>" . LJ::html_text( { name => 'account', maxlength => 25, size=> 20 } ) . "</td></tr>";
-    $ret .= "<tr><td colspan='2' align='right'>";
-    $ret .= LJ::html_submit( value => "View" );
-    $ret .= "</td></tr></table>";
-    $ret .= "</form>";
-    $ret .= "<?hr?>";
-
-    if ( $GET{code} ) {
-
-        my $code = DW::InviteCodes->new( code => $GET{code} );
-        return $ret . "Error: invalid code '$GET{code}'" unless $code;
-
-        $ret .= display_codes ( $remote, $code );
-
-    } elsif ( $GET{account} ) {
-
-        my $account = LJ::load_user( $GET{account} );
-        return $ret . "Error: invalid user '$GET{account}'" unless $account;
-
-        my @used = DW::InviteCodes->by_recipient( userid => $account->id );
-        my @owned = DW::InviteCodes->by_owner( userid => $account->id );
-
-        $ret .= display_codes ( $account, @used, @owned );
-    }
-
-    return $ret;
-}
-
-sub display_codes {
-    my ($account, @codes) = @_;
-
-    my $ret = "<table border='1' cellpadding='5'><tr><th>Code</th><th>Owner</th><th>Recipient</th><th>Reason</th><th>Date generated</th><th>Date sent</th><th>Date used</th><th>Email</th></tr>";
-
-    foreach my $code ( @codes ) {
-        my $owner = $code->owner == $account->id ? $account : LJ::load_userid( $code->owner );
-        my $recipient = $code->is_used ? LJ::load_userid( $code->recipient ) : undef;
-        $ret .= "<tr>";
-        $ret .= "<td><tt>" . $code->code . "</tt></td>";
-        $ret .= "<td>" . ( $owner ? $owner->ljuser_display : "" ) . "</td>";
-        $ret .= "<td>" . ( $code->is_used ? $recipient->ljuser_display : "" ) . "</td>";
-        $ret .= "<td>" . $code->reason . "</td>";
-        $ret .= "<td>" . LJ::time_to_http( $code->timegenerate). "</td>";
-        $ret .= "<td>" . ( $code->timesent ? LJ::time_to_http( $code->timesent ) : "" ) . "</td>";
-        $ret .= "<td>" . ( $code->is_used ? LJ::time_to_http( $recipient->timecreate ) : "" ) . "</td>";
-        $ret .= "<td>" . $code->email . "</td>";
-        $ret .= "</tr>";
-    }
-    $ret .= "</table>";
-
-    return $ret;
-}
-
- _code?>
-<=body
-page?>
diff -r bbe1694d81a6 -r 7dba15b9d841 htdocs/admin/invites/codetrace.bml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/admin/invites/codetrace.bml	Sat Jan 30 04:24:22 2010 +0000
@@ -0,0 +1,83 @@
+<?page
+title=>Codetrace
+body<=
+<?_code
+{
+    use strict;
+    use vars qw( %POST );
+
+    return LJ::server_down_html if ( $LJ::SERVER_DOWN );
+
+    my $remote = LJ::get_remote;
+    my @displayprivs = ( "finduser:codetrace", "finduser:*" );
+    my $numprivs = @displayprivs;
+
+    return "<?needlogin?>"
+        unless $remote;
+
+    return BML::ml( "admin.noprivserror", { numprivs => $numprivs, needprivs => "<b>" . join(", ", @displayprivs) . "</b>"} )
+        unless $remote->has_priv( "finduser", "codetrace" );
+
+    my $ret;
+
+    $ret .= "<form method='GET'>";
+    $ret .= "View invite details: ";
+    $ret .= "<table>";
+    $ret .= "<tr><td><label>By code: </label></td>";
+    $ret .= "<td>" . LJ::html_text( { name => 'code', maxlength => DW::InviteCodes::CODE_LEN, size => DW::InviteCodes::CODE_LEN } ) . "</td></tr>";
+    $ret .= "<tr><td><label>By account: </label></td>";
+    $ret .= "<td>" . LJ::html_text( { name => 'account', maxlength => 25, size=> 20 } ) . "</td></tr>";
+    $ret .= "<tr><td colspan='2' align='right'>";
+    $ret .= LJ::html_submit( value => "View" );
+    $ret .= "</td></tr></table>";
+    $ret .= "</form>";
+    $ret .= "<?hr?>";
+
+    if ( $GET{code} ) {
+
+        my $code = DW::InviteCodes->new( code => $GET{code} );
+        return $ret . "Error: invalid code '$GET{code}'" unless $code;
+
+        $ret .= display_codes ( $remote, $code );
+
+    } elsif ( $GET{account} ) {
+
+        my $account = LJ::load_user( $GET{account} );
+        return $ret . "Error: invalid user '$GET{account}'" unless $account;
+
+        my @used = DW::InviteCodes->by_recipient( userid => $account->id );
+        my @owned = DW::InviteCodes->by_owner( userid => $account->id );
+
+        $ret .= display_codes ( $account, @used, @owned );
+    }
+
+    return $ret;
+}
+
+sub display_codes {
+    my ($account, @codes) = @_;
+
+    my $ret = "<table border='1' cellpadding='5'><tr><th>Code</th><th>Owner</th><th>Recipient</th><th>Reason</th><th>Date generated</th><th>Date sent</th><th>Date used</th><th>Email</th></tr>";
+
+    foreach my $code ( @codes ) {
+        my $owner = $code->owner == $account->id ? $account : LJ::load_userid( $code->owner );
+        my $recipient = LJ::load_userid( $code->recipient ) if $code->is_used;
+        $ret .= "<tr>";
+        $ret .= "<td><tt>" . $code->code . "</tt></td>";
+        $ret .= "<td>" . ( $owner ? $owner->ljuser_display : "" ) . "</td>";
+        $ret .= "<td>" . ( $code->is_used ? $recipient->ljuser_display : "" ) . "</td>";
+        $ret .= "<td>" . $code->reason . "</td>";
+        $ret .= "<td>" . LJ::time_to_http( $code->timegenerate). "</td>";
+        $ret .= "<td>" . ( $code->timesent ? LJ::time_to_http( $code->timesent ) : "" ) . "</td>";
+        $ret .= "<td>" . ( $code->is_used ? LJ::time_to_http( $recipient->timecreate ) : "" ) . "</td>";
+        $ret .= "<td>" . $code->email . "</td>";
+        $ret .= "</tr>";
+    }
+    $ret .= "</table>";
+
+    return $ret;
+}
+
+ _code?>
+<=body
+page?>
diff -r bbe1694d81a6 -r 7dba15b9d841 htdocs/admin/invites/index.bml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/admin/invites/index.bml	Sat Jan 30 04:24:22 2010 +0000
@@ -0,0 +1,59 @@
+<?_c
+#
+# admin/invites/index.bml
+#
+# Brief dashboard page for dealing with invite codes.
+#
+# Authors:
+#      Denise Paolucci <denise@dreamwidth.org>
+#
+# Copyright (c) 2009 by Dreamwidth Studios, LLC.
+#
+# This program is free software; you may redistribute it and/or modify it under
+# the same terms as Perl itself. For a copy of the license, please reference
+# 'perldoc perlartistic' or 'perldoc perlgpl'.
+#
+_c?><?page
+body<=
+<?_code
+{
+    use strict;
+    use vars qw/ %GET %POST /;
+
+    # for pages that require authentication
+    my $remote = LJ::get_remote();
+    return "<?needlogin?>" unless $remote;
+
+    my $haspayments = $remote->has_priv( "payments" );
+    my $hasfinduser = $remote->has_priv ( "finduser", "codetrace" );
+
+    my $ret;
+
+    $ret .= "<div class='itemhead'><a href='codetrace'><?_ml .codetrace.head _ml?></a></div><div class='itemdef'><?_ml .codetrace.desc _ml?></div>" 
+        if $hasfinduser;
+
+    $ret .= "<div class='itemhead'><a href='distribute'><?_ml .distribute.head _ml?></a></div><div class='itemdef'><?_ml .distribute.desc _ml?></div>"
+        if $haspayments;
+
+    $ret .= "<div class='itemhead'><a href='requests'><?_ml .requests.head _ml?></a></div><div class='itemdef'><?_ml .requests.desc _ml?></div>"
+        if $haspayments;
+
+    $ret .= "<div class='itemhead'><a href='review'><?_ml .review.head _ml?></a></div><div class='itemdef'><?_ml .review.desc _ml?></div>"
+        if $haspayments;
+
+    $ret .= "<div class='itemhead'><a href='promo'><?_ml .promo.head _ml?></a></div><div class='itemdef'><?_ml .promo.desc _ml?></div>"
+        if $haspayments;
+
+
+    return $ret;
+}
+_code?>
+<=body
+title=><?_ml .title _ml?>
+head<=
+    <style type="text/css">
+    .itemhead {font-size: bigger; font-weight: bold;}
+    .itemdef {margin-left: 2em; margin-bottom: 15px;}
+    </style>
+<=head
+page?>
diff -r bbe1694d81a6 -r 7dba15b9d841 htdocs/admin/invites/index.bml.text
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/admin/invites/index.bml.text	Sat Jan 30 04:24:22 2010 +0000
@@ -0,0 +1,23 @@
+;; -*- coding: utf-8 -*-
+
+.codetrace.desc=Look up invite codes, by code or by user
+
+.codetrace.head=Codetrace
+
+.distribute.desc=Bulk invite code distribution
+
+.distribute.head=Distribute Invite Codes
+
+.promo.desc=Create and manage promotional invite codes
+
+.promo.head=Manage Promo Codes
+
+.requests.desc=Process requests for invite codes
+
+.requests.head=Invite Code Requests
+
+.review.desc=Review an individual user's invite history
+
+.review.head=Review Invite History
+
+.title=Invite Codes Administration
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org