Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[ljcom] r9303: LJSUP-6137 (FaceBook authorization. Serv...

Committer: ailyin
LJSUP-6137 (FaceBook authorization. Server side): checkpoint commit
U   branches/facebook-integration2/bin/upgrading/proplists-local.dat
U   branches/facebook-integration2/cgi-bin/LJ/Hooks/Userinfo.pm
U   branches/facebook-integration2/htdocs/manage/profile/index.bml.text.local
Modified: branches/facebook-integration2/bin/upgrading/proplists-local.dat
===================================================================
--- branches/facebook-integration2/bin/upgrading/proplists-local.dat	2010-08-03 06:45:49 UTC (rev 9302)
+++ branches/facebook-integration2/bin/upgrading/proplists-local.dat	2010-08-03 07:14:57 UTC (rev 9303)
@@ -438,3 +438,8 @@
   datatype: char
   des: a link to the user's profile on facebook (for identities of type 'facebook' only)
   cldversion: 8
+
+userproplist.im_openid:
+  datatype: char
+  des: a user-provided OpenID identity, to be displayed in the user's profile
+  cldversion: 8

Modified: branches/facebook-integration2/cgi-bin/LJ/Hooks/Userinfo.pm
===================================================================
--- branches/facebook-integration2/cgi-bin/LJ/Hooks/Userinfo.pm	2010-08-03 06:45:49 UTC (rev 9302)
+++ branches/facebook-integration2/cgi-bin/LJ/Hooks/Userinfo.pm	2010-08-03 07:14:57 UTC (rev 9303)
@@ -411,26 +411,57 @@
     my $remote = $opts{remote};
     my $mangleaddress = $opts{mangleaddress} || sub { return $_[0]; };
 
-    return "" if $u->hide_ljtalk;
+    my $ret = '';
 
-    my $jab_title = LJ::run_hook('jabber_title');
-    my $jab_link = LJ::run_hook('jabber_link');
+    if ($u->is_person && $u->prop('facebook_access_token')) {
+        my $fb_name = LJ::ehtml($u->prop('facebook_name'));
+        my $fb_link = LJ::ehtml($u->prop('facebook_link'));
 
-    my $online = "";
-    if ($u->can_show_onlinestatus($remote)) {
-        if ($u->jabber_is_online) {
-            my $jabon = LJ::Lang::ml('ljcom.userinfo.im.jabber.status.on', { jabbertitle => $jab_title });
-            $online = "<img src='$LJ::IMGPREFIX/profile_icons/jabber.gif' alt=\"$jabon\" title=\"$jabon\" align='absmiddle' />";
-        } else {
-            my $jaboff = LJ::Lang::ml('ljcom.userinfo.im.jabber.status.off', { jabbertitle => $jab_title });
-            $online = "<img src='$LJ::IMGPREFIX/profile_icons/jabber-off.gif' alt=\"$jaboff\" title=\"$jaboff\" align='absmiddle' />";
+        $ret .= qq{
+            <tr class='im_lj'>
+                <td class='im_icon'>
+                    <img src='$LJ::IMGPREFIX/facebook-profile.gif' alt='' />
+                </td>
+                <td colspan="2"><a href="$fb_link">$fb_name</a></td>
+            </tr>
+        };
+    }
+
+    if ($u->prop('im_openid')) {
+        my $openid = LJ::ehtml($u->prop('im_openid'));
+
+        $ret .= qq{
+            <tr class='im_lj'>
+                <td class='im_icon'>
+                    <img src='$LJ::IMGPREFIX/openid-profile.gif' alt='' />
+                </td>
+                <td colspan="2">$openid</td>
+            </tr>
+        };
+    }
+
+    unless ($u->hide_ljtalk) {
+        my $jab_title = LJ::run_hook('jabber_title');
+        my $jab_link = LJ::run_hook('jabber_link');
+
+        my $online = "";
+        if ($u->can_show_onlinestatus($remote)) {
+            if ($u->jabber_is_online) {
+                my $jabon = LJ::Lang::ml('ljcom.userinfo.im.jabber.status.on', { jabbertitle => $jab_title });
+                $online = "<img src='$LJ::IMGPREFIX/profile_icons/jabber.gif' alt=\"$jabon\" title=\"$jabon\" align='absmiddle' />";
+            } else {
+                my $jaboff = LJ::Lang::ml('ljcom.userinfo.im.jabber.status.off', { jabbertitle => $jab_title });
+                $online = "<img src='$LJ::IMGPREFIX/profile_icons/jabber-off.gif' alt=\"$jaboff\" title=\"$jaboff\" align='absmiddle' />";
+            }
         }
+
+        my $ljtalk = $mangleaddress ? $mangleaddress->($u->ljtalk_id) : $u->ljtalk_id;
+        $ljtalk = "<tr class='im_lj'><td class='im_icon'><a href='$jab_link'><img src='$LJ::IMGPREFIX/profile_icons/ljtalk.gif' alt='$jab_title' title='$jab_title' /></a></td><td>$ljtalk</td><td class='im_status'>$online</td></tr>\n";
+
+        $ret .= $ljtalk;
     }
 
-    my $ljtalk = $mangleaddress ? $mangleaddress->($u->ljtalk_id) : $u->ljtalk_id;
-    $ljtalk = "<tr class='im_lj'><td class='im_icon'><a href='$jab_link'><img src='$LJ::IMGPREFIX/profile_icons/ljtalk.gif' alt='$jab_title' title='$jab_title' /></a></td><td>$ljtalk</td><td class='im_status'>$online</td></tr>\n";
-
-    return $ljtalk;
+    return $ret;
 });
 
 LJ::register_hook("userinfo_modify_view_links", sub {
@@ -448,4 +479,55 @@
     return;
 });
 
+LJ::register_hook('extra_im_services', sub {
+    my ($u) = @_;
+
+    my $ret = '';
+
+    my %ml = (
+        'facebook_field_name' =>
+            LJ::Lang::ml('/manage/profile/index.bml.chat.facebook'),
+
+        'facebook_none' =>
+            LJ::Lang::ml('/manage/profile/index.bml.chat.facebook.none'),
+
+        'facebook_change' =>
+            LJ::Lang::ml('/manage/profile/index.bml.chat.facebook.change'),
+
+        'openid_field_name' =>
+            LJ::Lang::ml('/manage/profile/index.bml.chat.openid'),
+    );
+
+    $ret .= "<tr><td class='field_name'>$ml{facebook_field_name}</td><td>";
+    if ($u->prop('facebook_access_token')) {
+        my $facebook_name = $u->prop('facebook_name');
+        $ret .= qq{
+            <img src="$LJ::IMGPREFIX/facebook-profile.gif">
+            <strong>$facebook_name</strong>
+        }
+    } else {
+        $ret .= "<em>($ml{facebook_none})</em> ";
+    }
+    $ret .= qq{<a href="$LJ::SITEROOT/manage/settings/?cat=privacy">$ml{facebook_change}</a>};
+    $ret .= "</td></tr>\n";
+
+    $ret .= "<tr><td class='field_name'>$ml{openid_field_name}</td><td>";
+    $ret .= LJ::html_text({
+        'name' => 'contact_openid',
+        'value' => $u->prop('im_openid'),
+        'size' => '20',
+        'maxlength' => 150,
+    });
+
+    $ret .= "</td></tr>\n";
+
+    return $ret;
+});
+
+LJ::register_hook('save_extra_profile_fields', sub {
+    my ($u) = @_;
+
+    $u->set_prop('im_openid' => LJ::Request->post_param('contact_openid'));
+});
+
 1;

Modified: branches/facebook-integration2/htdocs/manage/profile/index.bml.text.local
===================================================================
--- branches/facebook-integration2/htdocs/manage/profile/index.bml.text.local	2010-08-03 06:45:49 UTC (rev 9302)
+++ branches/facebook-integration2/htdocs/manage/profile/index.bml.text.local	2010-08-03 07:14:57 UTC (rev 9303)
@@ -1,10 +1,18 @@
 ;; -*- coding: utf-8 -*-
 .birthday.year.opt=month/dd/yyyy
 
+.chat.facebook=Facebook
+
+.chat.facebook.none=None
+
+.chat.facebook.change=Change
+
 .chat.gizmo2=<a [[aopts]]>Gizmo/LJ Talk</a>
 
 .chat.ljtalk=<a [[aopts]]>Gizmo/LJ Talk</a>
 
+.chat.openid=OpenID
+
 .chat.msnusername=Windows LiveID 
 
 .error.gender.not_specified=Please select one of the following options.

Tags: andy, dat, ljcom, local, 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