[livejournal] r17296: LJSUP-6535
Committer: gprochaev
[LJSUP-6535] I like button with faces. ONTDU trunk/bin/upgrading/s2layers/core1.s2 U trunk/cgi-bin/LJ/S2.pm A trunk/cgi-bin/LJ/Widget/FaceBookILike.pm
Modified: trunk/bin/upgrading/s2layers/core1.s2
===================================================================
--- trunk/bin/upgrading/s2layers/core1.s2 2010-09-07 03:50:45 UTC (rev 17295)
+++ trunk/bin/upgrading/s2layers/core1.s2 2010-09-07 07:14:02 UTC (rev 17296)
@@ -566,6 +566,9 @@
function builtin widget(string{} opts) : string
"Returns rendered widget body.";
+
+ function builtin render_widget(string{} opts)
+ "Prints rendered widget body.";
}
class TagsPage extends Page
Modified: trunk/cgi-bin/LJ/S2.pm
===================================================================
--- trunk/cgi-bin/LJ/S2.pm 2010-09-07 03:50:45 UTC (rev 17295)
+++ trunk/cgi-bin/LJ/S2.pm 2010-09-07 07:14:02 UTC (rev 17296)
@@ -3692,14 +3692,6 @@
$link->{_raw} = qq|<iframe src="$url" scrolling="no" frameborder="0" style="border:none;overflow:hidden;width:150px;height:21px;" allowTransparency="true"></iframe>|;
return $link;
}
- if ($key eq "facebook_faces") {
- my $entry = LJ::Entry->new($journalu->{'userid'}, ditemid => $this->{'itemid'});
- return $null_link unless $entry->security eq 'public';
- my $entry_url = LJ::eurl($entry->url);
- my $link = {};
- $link->{_raw} = qq|<iframe src="http://www.facebook.com/plugins/like.php?href=$entry_url&layout=standard&show_faces=true&width=450&action=like&colorscheme=light&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>|;
- return $link;
- }
if ($key eq "mem_add") {
return $null_link if $LJ::DISABLED{'memories'};
return LJ::S2::Link("$LJ::SITEROOT/tools/memadd.bml?journal=$journal&itemid=$this->{'itemid'}",
@@ -3974,7 +3966,7 @@
$S2::pout->($ad_html) if $ad_html;
}
-my %approved_widget_classes = map { $_ => $_ } qw (TopEntries TopUsers);
+my %approved_widget_classes = map { $_ => $_ } qw (TopEntries TopUsers FaceBookILike);
sub Page__widget
{
@@ -3999,6 +3991,13 @@
return $ret;
}
+sub Page__render_widget {
+ my ($ctx, $this, $opts) = @_;
+
+ my $rendered = Page__widget($ctx, $this, $opts);
+ $S2::pout->($rendered);
+}
+
sub Entry__print_ebox {
my $args = _get_Entry_ebox_args(@_);
return unless $args;
Added: trunk/cgi-bin/LJ/Widget/FaceBookILike.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/FaceBookILike.pm (rev 0)
+++ trunk/cgi-bin/LJ/Widget/FaceBookILike.pm 2010-09-07 07:14:02 UTC (rev 17296)
@@ -0,0 +1,34 @@
+package LJ::Widget::FaceBookILike;
+
+use strict;
+use base qw(LJ::Widget);
+use Carp qw(croak);
+
+sub need_res {
+ return qw( );
+}
+
+sub render_body {
+ my $class = shift;
+ my %opts = @_;
+
+#use Data::Dumper;
+#warn Dumper \%opts;
+
+# return '';
+# return '' unless LJ::is_enabled('widget_fb_i_like');
+
+=head
+ my $entry = LJ::Entry->new($journalu->{'userid'}, ditemid => $this->{'itemid'});
+ return $null_link unless $entry->security eq 'public';
+=cut
+ my $entry_url = LJ::eurl($opts{journal}->journal_base);
+
+ my $ret = qq|<iframe src="http://www.facebook.com/plugins/like.php?href=$entry_url&layout=standard&show_faces=true&width=450&action=like&colorscheme=light&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>|;
+
+ return $ret;
+
+
+}
+
+1;
