sunnyman's (sunnyman) wrote in changelog,
sunnyman's
sunnyman
changelog

[ljcom] r11417: LJSUP-10937: SelfPromo shop: Drop-down l...

Committer: vtroitsky
LJSUP-10937: SelfPromo shop: Drop-down list for communitites that might be promoted was added, also journal to promote fixed for remote user only.
U   trunk/cgi-bin/LJ/Widget/Shop/View/SelfPromo.pm
U   trunk/htdocs/shop/selfpromo.bml.text.local
Modified: trunk/cgi-bin/LJ/Widget/Shop/View/SelfPromo.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/Shop/View/SelfPromo.pm	2012-02-06 14:32:33 UTC (rev 11416)
+++ trunk/cgi-bin/LJ/Widget/Shop/View/SelfPromo.pm	2012-02-07 06:47:51 UTC (rev 11417)
@@ -56,7 +56,7 @@
 
         my $hide_buyout = 0;
         my $owner_cancel = 0;
-    # TODO (refactoring) : 
+    # TODO (refactoring): Move that method into SelfPromo object 
         my $data_selfpromo = LJ::PersonalStats->get_selfpromo_data( { 'type' => $type } );
         foreach my $row (@$data_selfpromo) {
 
@@ -85,9 +85,10 @@
                     'minutes' => sprintf( '%02d', $remtime_minutes ),
                 },
             );
+
         }
 
-        push @{$result->{$type}}, {
+        my $elem = {
             'type'                  => $type,
             'ml_current_price'      => $ml_current_price,
             'ml_info_title_object'  => $ml_info_title_object,
@@ -99,6 +100,9 @@
             'form_disabled'         => !$remote ? 1 : 0,
         };
 
+        $elem->{'ljuser'} = $remote->ljuser_display() if $remote && $type eq 'journal';
+        $elem->{'communities'} = [ map { {'user' => $_ } } LJ::get_authas_list($remote, {type => 'C'}) ] if $remote && $type eq 'community';
+        push @{$result->{$type}}, $elem;
     }
     return $result;
 }
@@ -158,15 +162,17 @@
 # TODO (refactoring) Incapsulate that logic into SelfPromo facade + PromoObject
     my $class = LJ::Pay::SelfPromo->get_class_by_type($type); 
 
+
+# TODO (refactoring): 
     my $object_url = LJ::Request->post_param('object_link');
-    unless ( $object_url =~ m{^https?://} ) {
+    unless ( $object_url =~ m{^https?://} || $type ne 'entry') {
         $object_url = 'http://' . $object_url;
     }
 
 # TODO Refactoring: move logic inside PromoObject constructor  !!!
     # my $promo_object = LJ::SelfPromo::Promo->create_from_url(url => $object_url, type => $type);
 
-    my $object = ($type eq 'entry' ? LJ::Entry->new_from_url($object_url) : LJ::User->new_from_url($object_url));
+    my $object = ($type eq 'entry' ? LJ::Entry->new_from_url($object_url) : LJ::load_user($object_url));
 
     # unless ($promo_object) {
     unless ($object) {
@@ -231,12 +237,12 @@
     my ($self, $type, $class) = @_;
 
     my $object_url = LJ::Request->post_param('object_link');
-    unless ( $object_url =~ m{^https?://} ) {
+    unless ( $object_url =~ m{^https?://} || $type ne 'entry') {
         $object_url = 'http://' . $object_url;
     }
 
 # TODO Refactoring: move logic inside PromoObject constructor  !!!
-    my $object = ($type eq 'entry' ? LJ::Entry->new_from_url($object_url) : LJ::User->new_from_url($object_url));
+    my $object = ($type eq 'entry' ? LJ::Entry->new_from_url($object_url) : LJ::load_user($object_url));
 
     unless ($object) {
         $self->ml_error(
@@ -345,6 +351,7 @@
 sub process_withdraw_request {
     my ($self, $type, $class) = @_;
 
+    # TODO: Object may already has been changed
     $class->check_current_promo;
 
     my $object_url = LJ::Request->post_param('withdraw_url');

Modified: trunk/htdocs/shop/selfpromo.bml.text.local
===================================================================
--- trunk/htdocs/shop/selfpromo.bml.text.local	2012-02-06 14:32:33 UTC (rev 11416)
+++ trunk/htdocs/shop/selfpromo.bml.text.local	2012-02-07 06:47:51 UTC (rev 11417)
@@ -121,24 +121,26 @@
 .info.title.somebody.journal=Somebody is already promoting a journal
 .info.title.somebody.community=Somebody is already promoting a community
 
-.label.current_price|staleness=1
 .label.current_price=Current price:
 
-.label.entry_link|staleness=1
 .label.entry_link=Link to your post:
 
-.label.journal_link|staleness=1
-.label.journal_link=Link to your journal:
+.label.journal_link=Promote your journal:
 
-.label.community_link|staleness=1
-.label.community_link=Link to your community:
+.label.community_link=Select your community:
 
+.label.no_communities=No communitites to promote
+
 .label.price|staleness=1
 .label.price=Your price:
 
 .placeholder.object_link|staleness=1
 .placeholder.object_link=Paste your URL here
 
+.placeholder.journal= Please <a href="/login.bml">login</a> in or <a href="/create.bml">sign up</a> to promote your journal
+
+.placeholder.community= Please <a href="/login.bml">login</a> in or <a href="/create.bml">sign up</a> to promote your community
+
 .placeholder.price|staleness=1
 .placeholder.price=LJ Tokens
 

Tags: ljcom, local, pm, sunnyman, vtroitsky
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