fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-09-26 10:24 am

[dw-free] move /manage/invitecodes to /invite

[commit: http://hg.dwscoalition.org/dw-free/rev/24b9ef4fd714]

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

Redirect /manage/invitecodes to /invite.

Patch by [personal profile] kareila.

Files modified:
  • bin/upgrading/deadphrases.dat
  • cgi-bin/DW/InviteCodeRequests.pm
  • cgi-bin/redirect.dat
  • htdocs/invite.bml
  • htdocs/invite.bml.text
  • htdocs/manage/circle/invite.bml
  • htdocs/manage/index.bml
  • htdocs/manage/invitecodes.bml
  • htdocs/manage/invitecodes.bml.text
--------------------------------------------------------------------------------
diff -r 803864aec0f8 -r 24b9ef4fd714 bin/upgrading/deadphrases.dat
--- a/bin/upgrading/deadphrases.dat	Mon Sep 26 16:10:16 2011 +0800
+++ b/bin/upgrading/deadphrases.dat	Mon Sep 26 18:24:37 2011 +0800
@@ -132,6 +132,23 @@
 general /manage/index.bml.information.emailpost
 general /manage/index.bml.information.emailpost.about
 
+general /manage/invitecodes.bml.code.use
+general /manage/invitecodes.bml.form.request.header
+general /manage/invitecodes.bml.form.request.intro
+general /manage/invitecodes.bml.form.request.reason
+general /manage/invitecodes.bml.form.request.submit
+general /manage/invitecodes.bml.header.code
+general /manage/invitecodes.bml.header.email
+general /manage/invitecodes.bml.header.recipient
+general /manage/invitecodes.bml.header.sent
+general /manage/invitecodes.bml.header.used
+general /manage/invitecodes.bml.label.viewing.full
+general /manage/invitecodes.bml.label.viewing.partial
+general /manage/invitecodes.bml.msg.request.error
+general /manage/invitecodes.bml.msg.request.success
+general /manage/invitecodes.bml.noinvitecodes
+general /manage/invitecodes.bml.noinvitecodes.partial
+
 general /manage/links.bml.about
 general /manage/links.bml.about.blank
 general /manage/links.bml.about.heading
diff -r 803864aec0f8 -r 24b9ef4fd714 cgi-bin/DW/InviteCodeRequests.pm
--- a/cgi-bin/DW/InviteCodeRequests.pm	Mon Sep 26 16:10:16 2011 +0800
+++ b/cgi-bin/DW/InviteCodeRequests.pm	Mon Sep 26 18:24:37 2011 +0800
@@ -232,7 +232,7 @@
         subject => LJ::Lang::ml( 'email.invitecoderequest.accept.subject' ),
         body => LJ::Lang::ml( 'email.invitecoderequest.accept.body2', { 
             siteroot => $LJ::SITEROOT, 
-            invitesurl => $LJ::SITEROOT . '/manage/invitecodes',
+            invitesurl => $LJ::SITEROOT . '/invite',
             sitename => $LJ::SITENAMESHORT,
             number => $opts{num_invites},
             codes => join( "\n", @invitecodes ),
diff -r 803864aec0f8 -r 24b9ef4fd714 cgi-bin/redirect.dat
--- a/cgi-bin/redirect.dat	Mon Sep 26 16:10:16 2011 +0800
+++ b/cgi-bin/redirect.dat	Mon Sep 26 18:24:37 2011 +0800
@@ -13,6 +13,8 @@
 /manage/comments                    /manage/settings/?cat=privacy
 /manage/comments/                   /manage/settings/?cat=privacy
 /manage/comments/index.bml          /manage/settings/?cat=privacy
+/manage/invitecodes                 /invite
+/manage/invitecodes.bml             /invite
 /manage/subscriptions               /manage/subscriptions/filters
 /manage/subscriptions/              /manage/subscriptions/filters
 /manage/subscriptions/index.bml     /manage/subscriptions/filters
diff -r 803864aec0f8 -r 24b9ef4fd714 htdocs/invite.bml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/invite.bml	Mon Sep 26 18:24:37 2011 +0800
@@ -0,0 +1,138 @@
+<?_c
+#
+# manage/invitecodes.bml
+#
+# Invite code management system (user-facing).
+#
+# Authors:
+#      Afuna <coder.dw@afunamatata.com>
+#
+# 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
+title=>Invite Codes
+body<=
+<?_code
+{
+    use strict;
+
+    return LJ::server_down_html() if ($LJ::SERVER_DOWN);
+
+    my $remote = LJ::get_remote();
+    return "<?needlogin?>"
+        unless $remote;
+
+    my $ret;
+
+    if ( LJ::did_post() ) {
+        return "<?h1 $ML{'Error'} ?h1> $ML{'error.invalidform'}" unless LJ::check_form_auth();
+        if ( DW::InviteCodeRequests->create( userid => $remote->id, reason => $POST{reason} ) ) {
+            $ret .= "<div class='highlight-box'>$ML{'.msg.request.success'}</div>";
+        } else {
+            $ret .= "<?errorbar $ML{'.msg.request.error'} errorbar?>";
+        }
+    }
+
+    if ( DW::BusinessRules::InviteCodeRequests::can_request( user => $remote ) ) {
+        $ret .= "<?h2 $ML{'.form.request.header'} h2?>";
+        $ret .= "<?p $ML{'.form.request.intro'} p?>";
+        $ret .= "<div><form method='POST'>";
+        $ret .= LJ::form_auth();
+        $ret .= LJ::labelfy( 'reason', $ML{'.form.request.reason'} );
+        $ret .= LJ::html_text( { name => 'reason', id => 'reason', size => 75, maxlength => 255  } );
+        $ret .= LJ::html_submit( value => $ML{'.form.request.submit'} );
+        $ret .= "</form></div>";
+    }
+
+    if ( $GET{full} ) {
+        $ret .= "<p>" . LJ::Lang::ml( '.label.viewing.full', { aopts => "href='/invite'" } ) . "</p>";
+    } else {
+        $ret .= "<p>" . LJ::Lang::ml( '.label.viewing.partial', { aopts => "href='/invite?full=1'" } ) . "</p>";
+    }
+
+    my @invitecodes = DW::InviteCodes->by_owner( userid => $remote->id );
+
+    my @recipient_ids;
+    foreach my $code ( @invitecodes ) {
+        push @recipient_ids, $code->recipient if $code->recipient;
+    }
+
+    my $recipient_users = LJ::load_userids( @recipient_ids );
+
+    unless ( $GET{full} ) {
+        # filter out codes that were used over two weeks ago
+        my $two_weeks_ago = time() - ( 14 * 24 * 60 * 60 );
+        @invitecodes = grep {
+            my $u = $recipient_users->{$_->recipient};
+            # if it's used, we should always have a recipient, but...
+            ! $_->is_used || ( $u && $u->timecreate ) > $two_weeks_ago
+        } @invitecodes;
+    }
+
+    if ( @invitecodes ) {
+
+        $ret .= "<p>" . LJ::Lang::ml( '.label.send', { aopts => "href='/manage/circle/invite'" } ) . "</p>";
+
+        # sort so that invite codes end up in this order:
+        #  - unsent and unused
+        #  - sent but unused, with earliest sent first
+        #  - used
+        @invitecodes = sort {
+            return $a->is_used <=> $b->is_used if $a->is_used != $b->is_used;
+            return $a->timesent <=> $b->timesent;
+        } @invitecodes;
+
+
+        $ret .= "<table class='invitecodes' id='invitecodes'><thead><tr><th>$ML{'.header.code'}</th><th>$ML{'.header.recipient'}</th><th width='200'>$ML{'.header.used'}</th><th width='200'>$ML{'.header.sent'}</th><th>$ML{'.header.email'}</th></tr></thead>";
+
+        foreach my $code ( @invitecodes ) {
+            $ret .= "<tr>";
+            $ret .= "<td><tt>".$code->code."</tt></td>";
+            $ret .= "<td>";
+
+            if( $code->is_used ) {
+                my $u = $recipient_users->{$code->recipient};
+                $ret .= $u->ljuser_display;
+            } else {
+                my $create_link = ($LJ::USE_SSL ? $LJ::SSLROOT : $LJ::SITEROOT)
+                    . "/create?from=$remote->{user}&code=".$code->code;
+                $ret .= BML::ml( '.code.use', { aopts => "href='$create_link'" } );
+            }
+
+            $ret .= "</td>";
+
+            $ret .= "<td>";
+            if ( $code->is_used ) {
+                my $u = $recipient_users->{$code->recipient};
+                my $timeused = $u->timecreate;
+                $ret .= LJ::time_to_http( $timeused ) if $timeused;
+            }
+            $ret .= "</td>";
+
+            $ret .= "<td>";
+            $ret .= LJ::time_to_http( $code->timesent ) if $code->timesent;
+            $ret .= "</td>";
+
+            $ret .= "<td>";
+            $ret .= $code->email;
+            $ret .= "</td>";
+
+            $ret .= "</tr>";
+        }
+
+        $ret .= "</table>";
+    } elsif ( $GET{full} ) {
+        $ret .= "<?p $ML{'.noinvitecodes'} p?>";
+    } else {
+        $ret .= "<?p $ML{'.noinvitecodes.partial'} p?>";
+   }
+
+    return $ret;
+} _code?>
+<=body
+page?>
diff -r 803864aec0f8 -r 24b9ef4fd714 htdocs/invite.bml.text
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/htdocs/invite.bml.text	Mon Sep 26 18:24:37 2011 +0800
@@ -0,0 +1,35 @@
+;; -*- coding: utf-8 -*-
+.code.use=<a [[aopts]]>Use this code</a>
+
+.form.request.header=Request More Invite Codes
+
+.form.request.intro=Are you out of invite codes but still know people you'd like to invite to our site? Enter a short message below to ask for an invite, and a site administrator will review your request.
+
+.form.request.reason=Reason:
+
+.form.request.submit=Request invites:
+
+.header.code=Code:
+
+.header.email=Sent to email:
+
+.header.recipient=Recipient:
+
+.header.sent=Sent on:
+
+.header.used=Used on:
+
+.label.send=You can <a [[aopts]]>email an invite code to a friend.</a>
+
+.label.viewing.full=Here is a full list of your invite codes. See only those which are <a [[aopts]]>unused, or used but recently sent</a>.
+
+.label.viewing.partial=Here are your unused and recently sent invite codes. See the <a [[aopts]]>full list of your invite codes</a>.
+
+.msg.request.error=Your request didn't go through.
+
+.msg.request.success=Your request for new invite codes has been forwarded to site administrators for review.
+
+.noinvitecodes=You don't have any invite codes.
+
+.noinvitecodes.partial=You have no unused or recently sent invite codes.
+
diff -r 803864aec0f8 -r 24b9ef4fd714 htdocs/manage/circle/invite.bml
--- a/htdocs/manage/circle/invite.bml	Mon Sep 26 16:10:16 2011 +0800
+++ b/htdocs/manage/circle/invite.bml	Mon Sep 26 18:24:37 2011 +0800
@@ -52,7 +52,7 @@
 
         unless ( @invitecodes ) {
             $body = $ML{'.msg.noinvitecodes'};
-            $body .= " " . BML::ml( '.msg.noinvitecodes.requestmore', { aopts => "href='$LJ::SITEROOT/manage/invitecodes'" } )
+            $body .= " " . BML::ml( '.msg.noinvitecodes.requestmore', { aopts => "href='$LJ::SITEROOT/invite'" } )
                 if DW::BusinessRules::InviteCodeRequests::can_request( user => $u );
             return;
         }
@@ -207,7 +207,7 @@
         $body .= $findfriends_intro;
     } elsif ( $LJ::USE_ACCT_CODES ) {
         my $unusedinvites = DW::InviteCodes->unused_count( userid => $u->id );
-        $body .= "<?p " . BML::ml('.intro.code3', { aopts => "href='$LJ::SITEROOT/manage/invitecodes'" , num => $unusedinvites, notif => "href='$LJ::SITEROOT/manage/settings/?cat=notifications'" } ) . " p?>";
+        $body .= "<?p " . BML::ml('.intro.code3', { aopts => "href='$LJ::SITEROOT/invite'" , num => $unusedinvites, notif => "href='$LJ::SITEROOT/manage/settings/?cat=notifications'" } ) . " p?>";
     } else {
         $body .= "<?p " . BML::ml('.intro', { aopts => "href='$create_link'", createlink => $create_link} ) . " p?>";
     }
diff -r 803864aec0f8 -r 24b9ef4fd714 htdocs/manage/index.bml
--- a/htdocs/manage/index.bml	Mon Sep 26 16:10:16 2011 +0800
+++ b/htdocs/manage/index.bml	Mon Sep 26 18:24:37 2011 +0800
@@ -238,7 +238,7 @@
 <li><a href="/manage/circle/edit" title="<?_ml .friends.edit.about _ml?>"><?_ml /manage/circle/edit.bml.title2 _ml?></a></li>
 <li><a href="/manage/circle/editfilters" title="<?_ml .friends.groups.about _ml?>"><?_ml /manage/circle/editfilters.bml.title2 _ml?></a></li>
 <li><a href="/manage/circle/filter" title="<?_ml .friends.filter.about _ml?>"><?_ml .friends.filter _ml?></a></li>
-<li><a href="/manage/invitecodes" title="<?_ml .invites.manage.about _ml?>"><?_ml .invites.manage _ml?></a></li>
+<li><a href="/invite" title="<?_ml .invites.manage.about _ml?>"><?_ml .invites.manage _ml?></a></li>
 <=list
 block?>
 
diff -r 803864aec0f8 -r 24b9ef4fd714 htdocs/manage/invitecodes.bml
--- a/htdocs/manage/invitecodes.bml	Mon Sep 26 16:10:16 2011 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-<?_c
-#
-# manage/invitecodes.bml
-#
-# Invite code management system (user-facing).
-#
-# Authors:
-#      Afuna <coder.dw@afunamatata.com>
-#
-# 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
-title=>Invite Codes
-body<=
-<?_code
-{
-    use strict;
-
-    return LJ::server_down_html() if ($LJ::SERVER_DOWN);
-
-    my $remote = LJ::get_remote();
-    return "<?needlogin?>"
-        unless $remote;
-
-    my $ret;
-
-    if ( LJ::did_post() ) {
-        return "<?h1 $ML{'Error'} ?h1> $ML{'error.invalidform'}" unless LJ::check_form_auth();
-        if ( DW::InviteCodeRequests->create( userid => $remote->id, reason => $POST{reason} ) ) {
-            $ret .= "<div class='highlight-box'>$ML{'.msg.request.success'}</div>";
-        } else {
-            $ret .= "<?errorbar $ML{'.msg.request.error'} errorbar?>";
-        }
-    }
-
-    if ( DW::BusinessRules::InviteCodeRequests::can_request( user => $remote ) ) {
-        $ret .= "<?h2 $ML{'.form.request.header'} h2?>";
-        $ret .= "<?p $ML{'.form.request.intro'} p?>";
-        $ret .= "<div><form method='POST'>";
-        $ret .= LJ::form_auth();
-        $ret .= LJ::labelfy( 'reason', $ML{'.form.request.reason'} );
-        $ret .= LJ::html_text( { name => 'reason', id => 'reason', size => 75, maxlength => 255  } );
-        $ret .= LJ::html_submit( value => $ML{'.form.request.submit'} );
-        $ret .= "</form></div>";
-    }
-
-    if ( $GET{full} ) {
-        $ret .= "<p>" . BML::ml( '.label.viewing.full', { aopts => "href='invitecodes'" } ) . "</p>";
-    } else {
-        $ret .= "<p>" . BML::ml( '.label.viewing.partial', { aopts => "href='invitecodes?full=1'" } ) . "</p>";
-    }
-
-    my @invitecodes = DW::InviteCodes->by_owner( userid => $remote->id );
-
-    my @recipient_ids;
-    foreach my $code ( @invitecodes ) {
-        push @recipient_ids, $code->recipient if $code->recipient;
-    }
-
-    my $recipient_users = LJ::load_userids( @recipient_ids );
-
-    unless ( $GET{full} ) {
-        # filter out codes that were used over two weeks ago
-        my $two_weeks_ago = time() - ( 14 * 24 * 60 * 60 );
-        @invitecodes = grep {
-            my $u = $recipient_users->{$_->recipient};
-            # if it's used, we should always have a recipient, but...
-            ! $_->is_used || ( $u && $u->timecreate ) > $two_weeks_ago
-        } @invitecodes;
-    }
-
-    if ( @invitecodes ) {
-
-        # sort so that invite codes end up in this order:
-        #  - unsent and unused
-        #  - sent but unused, with earliest sent first
-        #  - used
-        @invitecodes = sort {
-            return $a->is_used <=> $b->is_used if $a->is_used != $b->is_used;
-            return $a->timesent <=> $b->timesent;
-        } @invitecodes;
-
-
-        $ret .= "<table class='invitecodes' id='invitecodes'><thead><tr><th>$ML{'.header.code'}</th><th>$ML{'.header.recipient'}</th><th width='200'>$ML{'.header.used'}</th><th width='200'>$ML{'.header.sent'}</th><th>$ML{'.header.email'}</th></tr></thead>";
-
-        foreach my $code ( @invitecodes ) {
-            $ret .= "<tr>";
-            $ret .= "<td><tt>".$code->code."</tt></td>";
-            $ret .= "<td>";
-
-            if( $code->is_used ) {
-                my $u = $recipient_users->{$code->recipient};
-                $ret .= $u->ljuser_display;
-            } else {
-                my $create_link = ($LJ::USE_SSL ? $LJ::SSLROOT : $LJ::SITEROOT)
-                    . "/create?from=$remote->{user}&code=".$code->code;
-                $ret .= BML::ml( '.code.use', { aopts => "href='$create_link'" } );
-            }
-
-            $ret .= "</td>";
-
-            $ret .= "<td>";
-            if ( $code->is_used ) {
-                my $u = $recipient_users->{$code->recipient};
-                my $timeused = $u->timecreate;
-                $ret .= LJ::time_to_http( $timeused ) if $timeused;
-            }
-            $ret .= "</td>";
-
-            $ret .= "<td>";
-            $ret .= LJ::time_to_http( $code->timesent ) if $code->timesent;
-            $ret .= "</td>";
-
-            $ret .= "<td>";
-            $ret .= $code->email;
-            $ret .= "</td>";
-
-            $ret .= "</tr>";
-        }
-
-        $ret .= "</table>";
-    } elsif ( $GET{full} ) {
-        $ret .= "<?p $ML{'.noinvitecodes'} p?>";
-    } else {
-        $ret .= "<?p $ML{'.noinvitecodes.partial'} p?>";
-   }
-
-    return $ret;
-} _code?>
-<=body
-page?>
diff -r 803864aec0f8 -r 24b9ef4fd714 htdocs/manage/invitecodes.bml.text
--- a/htdocs/manage/invitecodes.bml.text	Mon Sep 26 16:10:16 2011 +0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-;; -*- coding: utf-8 -*-
-.code.use=<a [[aopts]]>Use this code</a>
-
-.form.request.header=Request More Invite Codes
-
-.form.request.intro=Are you out of invite codes but still know people you'd like to invite to our site? Enter a short message below to ask for an invite, and a site administrator will review your request.
-
-.form.request.reason=Reason:
-
-.form.request.submit=Request invites:
-
-.header.code=Code:
-
-.header.email=Sent to email:
-
-.header.recipient=Recipient:
-
-.header.sent=Sent on:
-
-.header.used=Used on:
-
-.label.viewing.full=Here is a full list of your invite codes. See only those which are <a [[aopts]]>unused, or used but recently sent</a>.
-
-.label.viewing.partial=Here are your unused and recently sent invite codes. See the <a [[aopts]]>full list of your invite codes</a>.
-
-.msg.request.error=Your request didn't go through.
-
-.msg.request.success=Your request for new invite codes has been forwarded to site administrators for review.
-
-.noinvitecodes=You don't have any invite codes.
-
-.noinvitecodes.partial=You have no unused or recently sent invite codes.
-
--------------------------------------------------------------------------------