holyandrew (holyandrew) wrote in changelog,
holyandrew
holyandrew
changelog

[ljcom] r11790: LJSUP-11857: Cyr sub domains

Committer: akanashin
LJSUP-11857: Cyr sub domains
U   trunk/bin/upgrading/en_LJ.dat
U   trunk/cgi-bin/LJ/Console/Command/DomainRU.pm
U   trunk/cgi-bin/LJ/Widget/Shop/View/DomainRU.pm
Modified: trunk/bin/upgrading/en_LJ.dat
===================================================================
--- trunk/bin/upgrading/en_LJ.dat	2012-04-25 10:30:07 UTC (rev 11789)
+++ trunk/bin/upgrading/en_LJ.dat	2012-04-25 11:54:15 UTC (rev 11790)
@@ -5230,9 +5230,9 @@
 
 pay.product.rename_action.details.redir.yes=Auto forward; 
 
-pay.product.rename_action.details.domainru.no=No store domains РФ; 
+pay.product.rename_action.details.domainru.no=No store domains RF; 
 
-pay.product.rename_action.details.domainru.yes=Store domains РФ; 
+pay.product.rename_action.details.domainru.yes=Store domains RF; 
 
 
 pay.product.rename_action.short=Rename
@@ -7997,6 +7997,14 @@
 shop.error.diskquota.nothing_selected|staleness=1
 shop.error.diskquota.nothing_selected=You didn't select for how long you want to buy the addon. Please choose one of the options below.
 
+shop.error.domainru.errordomain=Invalid format. Please enter other domain name
+shop.error.domainru.needtokens=There was an error processing your request: You only have [[tokens]] LJ Tokens in your Wallet, which is not enough to pay [[price]] for domain RF.
+shop.error.domainru.not_your_account=You do not own this account
+shop.error.domainru.page_not_found=Account with name %domainname% doesn't exist. If you want to buy this domain %domainname%.жж.рф, please go to <here should be a link to appropriate page>
+shop.error.domainru.useddomain=Sorry, this domain is already in use. You can track user if he has been purged somewhen and his domain become vacant
+shop.error.domainru.warning.anon=This service is available for logged in users only. Please sign in or sign up
+shop.error.domainru.warning.upgrade=To buy domain please upgrade your account
+
 shop.error.global.cannot_load_cart|staleness=1
 shop.error.global.cannot_load_cart=Cannot load cart
 
@@ -8023,11 +8031,6 @@
 
 shop.error.userhead.not_personal=You can buy custom userheads for personal accounts only.
 
-shop.error.domainru.needtokens=There was an error processing your request: You only have [[tokens]] LJ Tokens in your Wallet, which is not enough to pay [[price]] for domain РФ.
-shop.error.domainru.errordomain=Invalid format. Please enter other domain name
-shop.error.domainru.useddomain=Sorry, this domain is already in use. You can track user if he has been purged somewhen and his domain become vacant
-shop.error.domainru.not_your_account=You do not own this account
-
 shop.history.forwhat.appbill|staleness=1
 shop.history.forwhat.appbill=Application payment
 

Modified: trunk/cgi-bin/LJ/Console/Command/DomainRU.pm
===================================================================
--- trunk/cgi-bin/LJ/Console/Command/DomainRU.pm	2012-04-25 10:30:07 UTC (rev 11789)
+++ trunk/cgi-bin/LJ/Console/Command/DomainRU.pm	2012-04-25 11:54:15 UTC (rev 11790)
@@ -24,9 +24,16 @@
 }
 
 sub execute {
-    my ($self, $account, $domain, $action, $reason) = @_;
-    my ($rval, @errs);
+    my ($self, $account, $arg1, $arg2, $reason) = @_;
+    my ($domain, $action, $rval, @errs);
 
+    if ($arg1 eq 'show') {
+        $action = $arg1;
+    } else {
+        $domain = $arg1;
+        $action = $arg2;
+    }
+    
     if ($action eq 'show' && !$account) {
         return $self->error("This command takes two arguments. Consult the reference.")
     } elsif (!$account || !$domain || !$action) {
@@ -47,7 +54,7 @@
             'subitem' => join(':', @subitem_params),
             'anon'    => 0,
             'qty'     => 1,
-            'rcptid'  => $remote->userid,
+            'rcptid'  => LJ::load_user($account)->userid,
             'amt'     => 0,
             'status'  => 'done',
         );

Modified: trunk/cgi-bin/LJ/Widget/Shop/View/DomainRU.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/Shop/View/DomainRU.pm	2012-04-25 10:30:07 UTC (rev 11789)
+++ trunk/cgi-bin/LJ/Widget/Shop/View/DomainRU.pm	2012-04-25 11:54:15 UTC (rev 11790)
@@ -4,7 +4,7 @@
 use base 'LJ::Widget::Shop::View';
 
 #sub get_subpage { 'renameaccount' }
-sub require_remote { 1 }
+sub require_remote { 0 }
 
 sub premature_checks {
     my ($self) = @_;
@@ -12,11 +12,15 @@
     $self->SUPER::premature_checks;
     return if LJ::Request->redirected;
 
-    my $authas_param =
-        LJ::Request->post_param('authas') ||
-        LJ::get_remote()->user;
+    my $remote = LJ::get_remote();
+    
+    if ($remote) {
+        my $authas_param =
+            LJ::Request->post_param('authas') ||
+            LJ::get_remote()->user;
 
-    $self->{'authas'} = LJ::get_authas_user($authas_param, 'S');
+        $self->{'authas'} = LJ::get_authas_user($authas_param, 'S');
+    }
 }
 
 sub authas {
@@ -31,15 +35,23 @@
     my $remote = LJ::get_remote();
     my $current = $self->authas || $remote;
 
+    unless ($remote) {
+        $self->ml_warning('shop.error.domainru.warning.anon');
+    }
+
+#    if ($remote && !$remote->get_cap('paid')) {
+#        $self->ml_warning('shop.error.domainru.warning.upgrade');
+#    }
+
     my $buy_manage = LJ::Request->get_param('type');
     my $delete = LJ::Request->get_param('delete');
     my $auth = LJ::Request->get_param('auth');
     my $dom = LJ::Request->get_param('dom');
 
     my $authas_opts = {
-        'authas' => $current->user,
+        'authas' => $current ? $current->user : '',
         'label' => ' ',
-        'nocomms' => $remote->ljuser_display,
+        'nocomms' => $remote ? $remote->ljuser_display : '',
 		'button_tag' => '<noscript>',
 		'button_close_tag' => '</noscript>',
         'type'  => 'S',
@@ -52,23 +64,22 @@
     my $domains = LJ::Pay::Payment::PayItem::DomainRU->get_domains();
 
     my %ret = (
-        'current_username' => $current->user,
+        'current_username' => $current ? $current->user : '',
         'type'             => $buy_manage ||= 'buy',
         'domains'          => $domains, 
         'total_cost'       => $LJ::Pay::Payment::PayItem::DomainRU::shop_price*LJ::Pay::Wallet::EXCHANGE_RATE,
+        'form_enabled'     => $remote ? 1 : 0,
     );
-
-    unless ($LJ::TESTING_ENVIRONMENT) {
-        $ret{'authas_select'} =
-            LJ::make_authas_select($remote, $authas_opts);
-
-        # work around a bug in HTML::Template::Pro that prevents a code like
-        # ml('string', param, ljuser(username)) from working properly
-        $ret{'current_ljuser'} = $current->ljuser_display;
-        $ret{'current_username'} = LJ::Lang::ml ('shop.view.renameaccount.authas', { username => $current->user });
-        $ret{'is_authas'} = $current->user eq $remote->user ? 0 : 1;
-    } else {
-        $ret{'authas'} = [ LJ::get_authas_list($remote, $authas_opts) ];
+    
+    if ($remote) {
+        unless ($LJ::TESTING_ENVIRONMENT) {
+            $ret{'authas_select'} = LJ::make_authas_select($remote, $authas_opts);
+            $ret{'current_ljuser'} = $current->ljuser_display;
+            $ret{'current_username'} = LJ::Lang::ml ('shop.view.renameaccount.authas', { username => $current->user });
+            $ret{'is_authas'} = $current->user eq $remote->user ? 0 : 1;
+        } else {
+            $ret{'authas'} = [ LJ::get_authas_list($remote, $authas_opts) ];
+        }
     }
 
     return \%ret;

Tags: akanashin, dat, holyandrew, ljcom, pm
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