holyandrew (holyandrew) wrote in changelog,
holyandrew
holyandrew
changelog

[ljcom] r12109: LJSUP-12413: New promo product - Promo i...

Committer: akanashin
LJSUP-12413: New promo product - Promo in notifications
U   trunk/bin/upgrading/en_LJ.dat
U   trunk/bin/upgrading/update-db-local.pl
U   trunk/cgi-bin/LJ/Hooks/ESN.pm
U   trunk/cgi-bin/LJ/Pay/Payment/PayItem.pm
U   trunk/cgi-bin/LJ/Widget/Shop/LeftMenu.pm
A   trunk/htdocs/shop/notificationpromo.bml
Modified: trunk/bin/upgrading/en_LJ.dat
===================================================================
--- trunk/bin/upgrading/en_LJ.dat	2012-06-14 09:41:03 UTC (rev 12108)
+++ trunk/bin/upgrading/en_LJ.dat	2012-06-14 11:35:58 UTC (rev 12109)
@@ -5044,6 +5044,222 @@
 
 notification.support.submit.request.subject=Support Request #[[request_id]]
 
+
+notificationpromo.notification.activate.body<<
+Dear [[user]],
+
+Promotion of your entry at [[object_url]] was enabled successfully.
+
+Thank you for using the service.
+
+Best!
+
+LiveJournal team
+http://www.livejournal.com
+.
+
+notificationpromo.notification.activate.subject=Entry promotion enabled
+
+notificationpromo.notification.admin_cancel.body<<
+Dear [[user]]!
+
+You have successfully cancelled the promotion of the entry at [[object_url]].
+
+- LiveJournal
+.
+
+notificationpromo.notification.deactivate.buyout.subject=Entry promotion discontinued
+
+notificationpromo.notification.deactivate.buyout2.body<<
+Dear [[user]],
+
+Promotion of your entry at [[object_url]] has been discontinued because someone else bought it out. Your entry stayed promoted for [[duration_hours]] [[?duration_hours|hour|hours|hours]] [[duration_min]] [[?duration_min|minute|minutes|minutes]]. You have been granted [[refund_amount]] [[?refund_amount|token|tokens|tokens]] as a refund.
+
+If you want to promote an entry again, you can purchase another promotion at the promotion page (http://www.livejournal.com/shop/selfpromo.bml).
+
+Thank you for using the service!
+
+LiveJournal Team
+http://www.livejournal.com
+.
+
+notificationpromo.notification.deactivate.buyout2.subject=Entry promotion discontinued
+
+notificationpromo.notification.deactivate.buyout3.body<<
+Dear [[user]],
+
+Promotion of your entry at [[object_url]] has been discontinued because someone else bought it out. Your entry stayed promoted for [[duration_hours]] [[?duration_hours|hour|hours|hours]] [[duration_min]] [[?duration_min|minute|minutes|minutes]].
+
+If you want to promote an entry again, you can purchase promotion at the promotion page (http://www.livejournal.com/shop/selfpromo.bml).
+
+Thank you for using the service!
+
+LiveJournal Team
+http://www.livejournal.com
+.
+
+notificationpromo.notification.deactivate.buyout3.subject=Entry promotion discontinued
+
+notificationpromo.notification.deactivate.deleted.body<<
+Dear [[user]],
+
+Promotion of your entry at [[object_url]] has been discontinued because it was deleted.
+
+Thank you for using the service!
+
+LiveJournal Team
+http://www.livejournal.com
+.
+
+notificationpromo.notification.deactivate.deleted.subject=Entry promotion discontinued
+
+notificationpromo.notification.deactivate.expired.body<<
+Dear [[user]],
+
+Promotion of your entry at [[object_url]] has expired.
+
+If you want to promote an entry again, you can purchase another promotion at the promotion page (http://www.livejournal.com/shop/selfpromo.bml).
+
+Thank you for using the service!
+
+LiveJournal Team
+http://www.livejournal.com
+.
+
+notificationpromo.notification.deactivate.expired.subject=Your promotion has expired and has been deactivated
+
+notificationpromo.notification.deactivate.ineligible.entry_adult_content.body<<
+Dear [[user]],
+
+Promotion of your entry at [[object_url]] has been discontinued because it has been marked as containing adult content.
+
+Thank you for using the service!
+
+LiveJournal Team
+http://www.livejournal.com
+.
+
+notificationpromo.notification.deactivate.ineligible.entry_adult_content.subject=Entry promotion discontinued
+
+notificationpromo.notification.deactivate.ineligible.entry_invisible.body<<
+Dear [[user]],
+
+Promotion of your entry at [[object_url]] has been discontinued because it has failed to remain visible (i. e. it was deleted or suspended).
+
+Thank you for using the service!
+
+LiveJournal Team
+http://www.livejournal.com
+.
+
+notificationpromo.notification.deactivate.ineligible.entry_invisible.subject=Entry promotion discontinued
+
+notificationpromo.notification.deactivate.ineligible.entry_not_public.body<<
+Dear [[user]],
+
+Promotion of your entry at [[object_url]] has been discontinued because it is no longer publicly available.
+
+Thank you for using the service!
+
+LiveJournal Team
+http://www.livejournal.com
+.
+
+notificationpromo.notification.deactivate.ineligible.entry_not_public.subject=Entry promotion discontinued
+
+notificationpromo.notification.deactivate.ineligible.journal_adult_content.body<<
+Dear [[user]],
+
+Promotion of your entry at [[object_url]] has been discontinued because your journal has been marked as containing adult content.
+
+Thank you for using the service!
+
+LiveJournal Team
+http://www.livejournal.com
+.
+
+notificationpromo.notification.deactivate.ineligible.journal_adult_content.subject=Entry promotion discontinued
+
+notificationpromo.notification.deactivate.ineligible.journal_invisible.body<<
+Dear [[user]],
+
+Promotion of your entry at [[object_url]] has been discontinued because that journal has failed to remain visible (i. e. it was deleted or suspended).
+
+Thank you for using the service!
+
+LiveJournal Team
+http://www.livejournal.com
+.
+
+notificationpromo.notification.deactivate.ineligible.journal_invisible.subject=Entry promotion discontinued
+
+notificationpromo.notification.deactivate.ineligible.not_found.body<<
+Dear [[user]],
+
+Promotion of your entry has been discontinued because entry was deleted.
+
+Thank you for using the service!
+
+LiveJournal Team
+http://www.livejournal.com
+.
+
+notificationpromo.notification.deactivate.ineligible.not_found.subject=Entry promotion discontinued
+
+notificationpromo.notification.deactivate.ineligible.poster_invisible.body<<
+Dear [[user]],
+
+Promotion of your entry at [[object_url]] has been discontinued because your account has failed to remain visible (i. e. it was deleted or suspended).
+
+Thank you for using the service!
+
+LiveJournal Team
+http://www.livejournal.com
+.
+
+notificationpromo.notification.deactivate.ineligible.poster_invisible.subject=Entry promotion discontinued
+
+notificationpromo.notification.deactivate.owner.body<<
+Dear [[user]],
+
+Promotion entry at [[object_url]] has been discontinued by [[owner]].
+
+Thank you for using the service!
+
+LiveJournal Team
+http://www.livejournal.com
+.
+
+notificationpromo.notification.deactivate.owner.subject=Entry promotion discontinued
+
+notificationpromo.notification.deactivate.withdraw.body<<
+Dear [[user]],
+
+You have successfully withdrawn promotion of your entry at [[object_url]], so it is no longer promoted.
+
+Thank you for using the service!
+
+LiveJournal Team
+http://www.livejournal.com
+.
+
+notificationpromo.notification.deactivate.withdraw.subject=Entry promotion withdrawn
+
+notificationpromo.shop_item.name=Promotion of the <a href="[[object_url]]">entry</a>
+
+selfpromo.error.two_promos_entry=You can't promote your entries in Ukrainian and Default Promo at the same time. Please try again later.
+selfpromo.error.two_promos_journal=You can't promote your journal in Ukrainian and Default Promo at the same time. Please try again later
+selfpromo.error.two_promos_community=You can't promote your community in Ukrainian and Default Promo at the same time. Please try again later.
+
+selfpromo.journal.notification.activate.body<<
+Dear [[user]]!
+ Promotion of your journal [[object_url]] was enabled successfully.
+ Thank you for using the service!
+Best regards,
+LiveJournal Team
+http://www.livejournal.com
+.
+
 oauth.token_key_error=Token is undefined
 oauth.token_error=Incorrect token
 oauth.internal_error=Internal error
@@ -8718,6 +8934,101 @@
 shop.view.next|staleness=1
 shop.view.next=Next &rarr;
 
+shop.view.notificationpromo.btn.submit|staleness=1
+shop.view.notificationpromo.btn.submit=Submit
+
+shop.view.notificationpromo.btn.preview|staleness=1
+shop.view.notificationpromo.btn.preview=Preview
+
+shop.view.notificationpromo.btn.withdraw|staleness=1
+shop.view.notificationpromo.btn.withdraw=Withdraw
+
+shop.view.notificationpromo.confirm.label|staleness=1
+shop.view.notificationpromo.confirm.label=I confirm that my entry meets the requirements of LiveJournal to promotion
+
+shop.view.notificationpromo.current_price|staleness=1
+shop.view.notificationpromo.current_price=[[price]] tokens
+
+shop.view.notificationpromo.description|staleness=1
+shop.view.notificationpromo.description=Description of Notification Promo
+
+shop.view.notificationpromo.error.ineligible|staleness=1 
+shop.view.notificationpromo.error.ineligible=Ineligible entry by url [[object_url]] user [[poster_ljuser]]
+
+shop.view.notificationpromo.error.not_found|staleness=1 
+shop.view.notificationpromo.error.not_found=Not found entry by url [[object_url]]
+
+shop.view.notificationpromo.error.not_logged_in|staleness=1 
+shop.view.notificationpromo.error.not_logged_in=Not logged in
+
+shop.view.notificationpromo.error.not_specified|staleness=1 
+shop.view.notificationpromo.error.not_specified=Not specified
+
+shop.view.notificationpromo.error.price_insufficient|staleness=1 
+shop.view.notificationpromo.error.price_insufficient=Price insufficient
+
+shop.view.notificationpromo.error.price_invalid|staleness=1 
+shop.view.notificationpromo.error.price_invalid=Price invalid
+
+shop.view.notificationpromo.error.wallet_insufficient_funds|staleness=1 
+shop.view.notificationpromo.error.wallet_insufficient_funds=Wallet insufficient funds
+
+shop.view.notificationpromo.info.title.remote|staleness=1
+shop.view.notificationpromo.info.title.remote=You are already promoting an entry
+
+shop.view.notificationpromo.info.title.somebody|staleness=1
+shop.view.notificationpromo.info.title.somebody=Somebody is already promoting an entry
+
+shop.view.notificationpromo.label.current_price|staleness=1
+shop.view.notificationpromo.label.current_price=Current price:
+
+shop.view.notificationpromo.label.price|staleness=1
+shop.view.notificationpromo.label.price=Your price
+
+shop.view.notificationpromo.placeholder.object_link|staleness=1
+shop.view.notificationpromo.placeholder.object_link=Paste you url here
+
+shop.view.notificationpromo.placeholder.price|staleness=1
+shop.view.notificationpromo.placeholder.price=tokens
+
+shop.view.notificationpromo.plaintext.place|staleness=1
+shop.view.notificationpromo.plaintext.place=Place your post in promo in notification here: 
+
+shop.view.notificationpromo.plaintext.source|staleness=1
+shop.view.notificationpromo.plaintext.source=source
+
+shop.view.notificationpromo.plaintext.title|staleness=1
+shop.view.notificationpromo.plaintext.title=PROMO:
+
+shop.view.notificationpromo.plaintext.user|staleness=1
+shop.view.notificationpromo.plaintext.user=by user
+
+shop.view.notificationpromo.price_description|staleness=1
+shop.view.notificationpromo.price_description=Enter number of LJ tokens (a multiple of 100) you would like to pay
+
+shop.view.notificationpromo.remaining_time|staleness=1
+shop.view.notificationpromo.remaining_time=Time remaining: [[hours]] [[?hours|hour|hours|hours]] [[minutes]] [[?minutes|minute|minutes|minutes]].
+
+shop.view.notificationpromo.view.default|staleness=1
+shop.view.notificationpromo.view.default=Default
+shop.view.notificationpromo.view.default.description|staleness=1
+shop.view.notificationpromo.view.default.description=Switch to default notification promo
+
+shop.view.notificationpromo.view.my|staleness=1
+shop.view.notificationpromo.view.my=Malaysia
+shop.view.notificationpromo.view.my.description|staleness=1
+shop.view.notificationpromo.view.my.description=Switch to malaysia notification promo
+
+shop.view.notificationpromo.view.sg|staleness=1
+shop.view.notificationpromo.view.sg=Singapore
+shop.view.notificationpromo.view.sg.description|staleness=1
+shop.view.notificationpromo.view.sg.description=Switch to singapore notification promo
+
+shop.view.notificationpromo.view.ua|staleness=1
+shop.view.notificationpromo.view.ua=Ukraine
+shop.view.notificationpromo.view.ua.description|staleness=1
+shop.view.notificationpromo.view.ua.description=Switch to ukraina notification promo
+
 shop.view.onetime_payment|staleness=1
 shop.view.onetime_payment=ONETIME PAYMENT
 

Modified: trunk/bin/upgrading/update-db-local.pl
===================================================================
--- trunk/bin/upgrading/update-db-local.pl	2012-06-14 09:41:03 UTC (rev 12108)
+++ trunk/bin/upgrading/update-db-local.pl	2012-06-14 11:35:58 UTC (rev 12109)
@@ -582,6 +582,26 @@
 )
 EOC
 
+register_tablecreate('notificationpromo', <<'EOC');
+CREATE TABLE `notificationpromo` (
+  `promoid` int(11) NOT NULL AUTO_INCREMENT,
+  `journalid` int(11) NOT NULL DEFAULT '0',
+  `posterid` int(11) NOT NULL DEFAULT '0',
+  `promoterid` int(11) NOT NULL DEFAULT '0',
+  `jitemid` int(11) NOT NULL DEFAULT '0',
+  `ditemid` int(11) NOT NULL DEFAULT '0',
+  `started` int(11) NOT NULL DEFAULT '0',
+  `exptime` int(11) NOT NULL DEFAULT '0',
+  `cost` int(11) NOT NULL DEFAULT '0',
+  `active` int(11) NOT NULL DEFAULT '1',
+  `finished` int(11) NOT NULL DEFAULT '0',
+  `type` enum('entry','journal','community') NOT NULL DEFAULT 'entry',
+  `country` char(3) NOT NULL DEFAULT 'cyr',
+  PRIMARY KEY (`promoid`),
+  KEY `type_promoid_index` (`type`,`promoid`)
+)
+EOC
+
 # used in ssldocs/tools/endpoints/offerpal.bml to prevent duplicates
 register_tablecreate('offerpal', <<'EOC');
 CREATE TABLE `offerpal` (

Modified: trunk/cgi-bin/LJ/Hooks/ESN.pm
===================================================================
--- trunk/cgi-bin/LJ/Hooks/ESN.pm	2012-06-14 09:41:03 UTC (rev 12108)
+++ trunk/cgi-bin/LJ/Hooks/ESN.pm	2012-06-14 11:35:58 UTC (rev 12109)
@@ -7,6 +7,10 @@
 );
 
 use Digest::MD5 qw/md5_hex/;
+use LJ::Pay::PromotedObject qw(:types);
+use LJ::Pay::PromotionSlot qw(:regions :classes);
+use LJ::Pay::Promotion::Notifications;
+use LJ::Pay::NotificationPromo;
 
 LJ::register_hook('esn_send_email', sub {
     my ($self, $opts, $ev) = @_;
@@ -42,6 +46,9 @@
         $html_body = $frame_tmpl->output();
     }
 
+    $html_body  .= LJ::run_hook('add_notificationpromo', $u, 'html');
+    $plain_body .= LJ::run_hook('add_notificationpromo', $u, 'plaintext');
+
     if( $ev->need_standard_footer ) {
         $html_body .= $footer;
     }
@@ -72,6 +79,35 @@
     return 1;
 });
 
+LJ::register_hook('add_notificationpromo', sub {
+    my $u = shift;
+    my $type = shift;
+    my $params;
+    my $str;
+
+    return if $LJ::DISABLED{notificationpromo};
+
+    my $active_region = lc($u->prop('country') || LJ::GeoLocation->get_country_info_by_ip());
+    return unless LJ::Pay::Promotion::Notifications->is_avialable_region($active_region);
+
+    my $slot = LJ::Pay::PromotionSlot->find_slot(class => LJ::Pay::PromotionSlot::PROMO_NOTIFICATIONS(), type => LJ::Pay::PromotionSlot::PROMO_OBJECT_TYPE_ENTRY(), region => $active_region);
+    return unless $slot;
+
+    my $promo = $slot->current_promotion;
+    return unless $promo;
+
+    my $object = $promo->promoted_object();
+    return unless $object;
+
+    $params = $object->get_template_params();
+
+    my $tmpl_file = $type eq 'html' ? 'NotificationPromoPreview.tmpl' : 'NotificationPromoPlainText.tmpl';
+    my $tmpl = LJ::HTML::Template->new({use_expr => 1}, filename => "$ENV{LJHOME}/templates/Shop/$tmpl_file");
+    $tmpl->param( 'data_notificationpromo' => [$params] );
+
+    return $tmpl->output();
+});
+
 LJ::register_hook('subscriptions_manage_friend_pending_extra', sub {
     my $remote = shift;
     return LJ::Subscription::Pending->new(

Modified: trunk/cgi-bin/LJ/Pay/Payment/PayItem.pm
===================================================================
--- trunk/cgi-bin/LJ/Pay/Payment/PayItem.pm	2012-06-14 09:41:03 UTC (rev 12108)
+++ trunk/cgi-bin/LJ/Pay/Payment/PayItem.pm	2012-06-14 11:35:58 UTC (rev 12109)
@@ -52,6 +52,7 @@
     'royalty'       => 'LJ::Pay::Payment::PayItem::Royalty',
     'selfpromo'     => 'LJ::Pay::Payment::PayItem::SelfPromo',
     'domainru'      => 'LJ::Pay::Payment::PayItem::DomainRU',
+    'notificationpromo' => 'LJ::Pay::Payment::PayItem::NotificationPromo',
 );
 
 my @FREEZABLE_CLASSES = qw/

Modified: trunk/cgi-bin/LJ/Widget/Shop/LeftMenu.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/Shop/LeftMenu.pm	2012-06-14 09:41:03 UTC (rev 12108)
+++ trunk/cgi-bin/LJ/Widget/Shop/LeftMenu.pm	2012-06-14 11:35:58 UTC (rev 12109)
@@ -65,6 +65,12 @@
         } unless $LJ::DISABLED{'commercial_promo'};
     }
 
+    push @$paid_services, {
+        name => LJ::Lang::ml('/shop/index.bml.storefront.notificationpromo'),
+        url => '/shop/notificationpromo.bml',
+            is_selected => $subpage eq 'notificationpromo' ? 1 : 0,
+    } unless $LJ::DISABLED{'notificationpromo'};
+
     my %top_map = (
         paidaccount => 0,
         paidservice => 1,

Added: trunk/htdocs/shop/notificationpromo.bml
===================================================================
--- trunk/htdocs/shop/notificationpromo.bml	                        (rev 0)
+++ trunk/htdocs/shop/notificationpromo.bml	2012-06-14 11:35:58 UTC (rev 12109)
@@ -0,0 +1,23 @@
+<?_code {
+
+use strict;
+use warnings;
+
+return LJ::Request->redirect ($LJ::PAGE_404)
+    if $LJ::DISABLED{'notification_promo'};
+
+if ( LJ::Request->did_post ) {
+    my $action = LJ::Request->post_param('action');
+    if ( $action eq 'preview' ) {
+        my $widget = LJ::Widget::Shop::View::NotificationPromo->new;
+        $widget->premature_checks;
+        return $widget->process_preview_request;
+    }
+}
+
+return BML::render_page({
+    'title' => LJ::Lang::ml('/shop/notificationpromo.bml.title'),
+    'body'  => LJ::Widget::Shop::View::NotificationPromo->render || undef,
+});
+
+} _code?>

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