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

[ljcom] r10463: LJSUP-8688 (Google integration)

Committer: ailyin
LJSUP-8688 (Google integration)
A   trunk/cgi-bin/LJ/Client/Google.pm
A   trunk/cgi-bin/LJ/Identity/Google.pm
A   trunk/cgi-bin/LJ/Talk/Author/Google.pm
A   trunk/htdocs/identity/callback-google.bml
A   trunk/htdocs/identity/google-interstitial.bml
A   trunk/htdocs/identity/google-interstitial.bml.text.local
U   trunk/htdocs/identity/login.bml.text.local
A   trunk/htdocs/img/google-profile.gif
U   trunk/htdocs/talkpost.bml.text.local
U   trunk/htdocs/userinfo.bml.text.local
A   trunk/templates/CommentForm/Author-Google.tmpl
A   trunk/templates/CommentForm/AuthorDisabled-Google.tmpl
A   trunk/templates/CommentForm/AuthorTitle-Google.tmpl
A   trunk/templates/Identity/GoogleInterstitial.tmpl
A   trunk/templates/Identity/GoogleInterstitialCompact.tmpl
A   trunk/templates/Identity/Login-google.tmpl
Added: trunk/cgi-bin/LJ/Client/Google.pm
===================================================================
--- trunk/cgi-bin/LJ/Client/Google.pm	                        (rev 0)
+++ trunk/cgi-bin/LJ/Client/Google.pm	2011-05-03 03:22:27 UTC (rev 10463)
@@ -0,0 +1,102 @@
+package LJ::Client::Google;
+use strict;
+use warnings;
+
+sub fetch_access_token {
+    my ( $class, $opts ) = @_;
+
+    my $postdata = {
+        'client_id'     => $LJ::GOOGLE_OAUTH_CONF->{'client_id'},
+        'client_secret' => $LJ::GOOGLE_OAUTH_CONF->{'client_secret'},
+    };
+
+    if ( my $code = $opts->{'code'} ) {
+        $postdata->{'code'}          = $code;
+        $postdata->{'grant_type'}    = 'authorization_code';
+
+    } elsif ( my $refresh_token = $opts->{'refresh_token'} ) {
+        $postdata->{'refresh_token'} = $refresh_token;
+        $postdata->{'grant_type'}    = 'refresh_token';
+
+    }
+
+    my $ua = $class->get_useragent;
+
+    my $res = $ua->post( 'https://accounts.google.com/o/oauth2/token',
+                         $postdata );
+
+    unless ( $res->is_success ) {
+        require Data::Dumper;
+        warn 'google connectivity error: ' .
+             Data::Dumper::Dumper($res);
+        die 'google connectivity error';
+    }
+
+    return LJ::JSON->from_json( $res->content );
+}
+
+sub save_access_token {
+    my ( $class, $u, $token_info ) = @_;
+
+    die 'no user to save the token in'
+        unless $u;
+
+    $u->set_prop( {
+        'google_access_token'  => $token_info->{'access_token'},
+        'google_refresh_token' => $token_info->{'refresh_token'},
+        'google_token_expire'  => time + $token_info->{'expires_in'},
+    } );
+}
+
+sub get_user_access_token {
+    my ( $class, $u ) = @_;
+
+    if ( $u->prop('google_token_expire') >= time ) {
+        my $token_info = $class->fetch_access_token( {
+            'refresh_token' => $u->prop('google_refresh_token'),
+        } );
+
+        $class->save_access_token( $u, $token_info );
+    }
+
+    return $u->prop('google_access_token');
+}
+
+sub fetch_userinfo {
+    my ( $class, $opts ) = @_;
+
+    my $access_token = $opts->{'access_token'};
+
+    unless ( $access_token ) {
+        my $u = $opts->{'user'};
+
+        die 'no access token passed and no user to extract it from'
+            unless $u;
+
+        $access_token = $class->get_user_access_token($u);
+    }
+
+    my $url = 'https://www-opensocial.googleusercontent.com/'
+            . 'api/people/@me/@self?'
+            . 'oauth_token=' . $access_token;
+
+    my $ua = $class->get_useragent;
+
+    my $res = $ua->get($url);
+
+    unless ( $res->is_success ) {
+        require Data::Dumper;
+        warn 'google connectivity error: ' .
+             Data::Dumper::Dumper($res);
+        die 'google connectivity error';
+    }
+
+    my $result_hash = LJ::JSON->from_json( $res->content );
+    return $result_hash->{'entry'};
+}
+
+sub get_useragent {
+    return LJ::get_useragent( 'role' => 'google_auth' );
+}
+
+1;

Added: trunk/cgi-bin/LJ/Identity/Google.pm
===================================================================
--- trunk/cgi-bin/LJ/Identity/Google.pm	                        (rev 0)
+++ trunk/cgi-bin/LJ/Identity/Google.pm	2011-05-03 03:22:27 UTC (rev 10463)
@@ -0,0 +1,143 @@
+package LJ::Identity::Google;
+use strict;
+use warnings;
+
+use base qw( LJ::Identity );
+
+sub typeid { 'G' }
+sub pretty_type { 'Google' }
+sub short_code { 'google' }
+
+sub enabled {
+    return LJ::is_enabled('twitter_auth')
+        && $LJ::GOOGLE_OAUTH_CONF;
+}
+
+## GFC version, drop this
+# sub attempt_login {
+#     my ($class, $errs, %opts) = @_;
+# 
+#     $errs ||= [];
+#     my $returl = $opts{'returl'} || $LJ::SITEROOT;
+#     my $returl_fail = $opts{'returl_fail'} || $returl || $LJ::SITEROOT;
+# 
+#     my $fcauth
+#         = LJ::Request->cookie( 'fcauth' . $LJ::GOOGLE_FC_CONF->{'site_id'} );
+# 
+#     die 'no fcauth cookie'
+#         unless $fcauth;
+# 
+#     my $profile = LJ::Client::GoogleFC->fetch_user_profile( {
+#         'fcauth' => $fcauth,
+#     } );
+# 
+#     # callback-google.bml logic goes here, yo
+#     die;
+# }
+
+sub attempt_login {
+    my ($class, $errs, %opts) = @_;
+
+    my $forwhat = $opts{'forwhat'} || 'login';
+
+    my $callback_url = "$LJ::SITEROOT/identity/callback-google.bml?" .
+                       'forwhat=' . $forwhat;
+
+    my $addr  = 'https://accounts.google.com/o/oauth2/auth?'
+              . 'scope=' . LJ::eurl('https://www.google.com/m8/feeds/') . '&'
+              . 'client_id=' . $LJ::GOOGLE_OAUTH_CONF->{'client_id'} . '&'
+              . 'redirect_uri=' . LJ::eurl($callback_url) . '&'
+              . 'response_type=code';
+
+    return LJ::Request->redirect($addr);
+}
+
+sub initialize_user {
+    my ($self, $u, $extra) = @_;
+
+    my $ua = LJ::Client::Google->get_useragent;
+
+    my $token_info = $extra->{'token_info'};
+    my $userinfo = $extra->{'userinfo'};
+
+    die "no access token passed" unless $token_info;
+
+    my $userdata = $extra->{'userdata'};
+    unless ($userinfo) {
+        $userinfo = LJ::Client::Google->fetch_userinfo( {
+            'access_token' => $token_info->{'access_token'},
+        } );
+    }
+
+    my $googleuserid = $userinfo->{'id'};
+
+    ## INITIALIZE USER PROFILE
+
+    my $name = $userinfo->{'displayName'};
+    my $link = $userinfo->{'profileUrl'};
+
+    # these are pretty much essential and cannot be changed by the
+    # user: the access token we're using to communicate on the user's
+    # behalf, their name, and the link to their profile
+    LJ::Client::Google->save_access_token( $u, $token_info );
+
+    $u->set_prop( 'google_userid'       => $googleuserid );
+    $u->set_prop( 'google_name'         => $name );
+    $u->set_prop( 'google_link'         => $link );
+
+    # google doesn't let us know their gender, so default to unspecified
+    $u->set_prop( 'gender' => 'U' );
+
+    # the name specified in profile; this can actually be changed
+    # by the user later in the profile settings
+    LJ::update_user( $u, { 'name' => $name } );
+
+    # userpic
+    my $upidata = $ua->get( $userinfo->{'thumbnailUrl'} )->content;
+
+    my $userpic = eval { LJ::Userpic->create($u, data => \$upidata) };
+    $userpic->make_default if $userpic;
+
+    # website
+    $u->set_prop( 'url' => $link );
+
+    # facebook identities are plus accounts by default
+    $u->add_to_class('plus');
+
+    # until they get notifications set, they don't get anything
+    LJ::update_user($u, { 'opt_gettalkemail' => 'N' });
+
+    # ping events feed to let subscribers know of this account
+    LJ::run_hooks('profile_save', $u);
+}
+
+sub url {
+    my ($self, $u) = @_;
+
+    # the 'url' prop should have been set by the initialization code;
+    # failing that, let's not re-fetch the website from there, and let's
+    # link to their facebook profile instead.
+    return $u->prop('google_link');
+}
+
+sub display_name {
+    my ($self, $u) = @_;
+    return $u->prop('google_name') || $u->username;
+}
+
+sub ljuser_display_params {
+    my ($self, $u, $opts) = @_;
+
+    return {
+        'journal_url'  => $u->prop('google_link') || 'about:blank',
+        'journal_name' => $u->display_name,
+        'userhead'     => 'google-profile.gif',
+        'userhead_w'   => 16,
+    };
+}
+
+sub profile_window_title {
+    return LJ::Lang::ml('/userinfo.bml.title.googleprofile');
+}
+
+1;

Added: trunk/cgi-bin/LJ/Talk/Author/Google.pm
===================================================================
--- trunk/cgi-bin/LJ/Talk/Author/Google.pm	                        (rev 0)
+++ trunk/cgi-bin/LJ/Talk/Author/Google.pm	2011-05-03 03:22:27 UTC (rev 10463)
@@ -0,0 +1,8 @@
+package LJ::Talk::Author::Google;
+use strict;
+
+use base qw( LJ::Talk::Author::Identity );
+
+sub identity_class { 'LJ::Identity::Google' }
+
+1;

Added: trunk/htdocs/identity/callback-google.bml
===================================================================
--- trunk/htdocs/identity/callback-google.bml	                        (rev 0)
+++ trunk/htdocs/identity/callback-google.bml	2011-05-03 03:22:27 UTC (rev 10463)
@@ -0,0 +1,81 @@
+<?page
+body<=
+<?_code
+{
+#line 6
+    use strict;
+    use vars qw($title);
+    use LJ::Client::Google;
+
+    # user will unlikely ever need to see this
+    $title = 'Google Landing Page';
+
+    my $forwhat = LJ::Request->get_param('forwhat') || 'login';
+
+    my ($returl, $returl_fail);
+    eval {
+        ($returl, $returl_fail) =
+        LJ::Identity::Google->unpack_forwhat($forwhat);
+    };
+
+    return LJ::Lang::ml('error.invalidform') if $@;
+
+    unless (LJ::Identity::Google->enabled) {
+        return 'This feature is disabled.';
+    }
+
+    my $code = LJ::Request->get_param('code');
+
+    unless ( $code ) {
+        require Data::Dumper;
+
+        warn 'could not get code from Google ' .
+             '(this could be a user cancel) ' .
+             Data::Dumper::Dumper(\%GET);
+
+        return LJ::Request->redirect($returl_fail);
+    }
+
+    my $token_info
+        = LJ::Client::Google->fetch_access_token( { 'code' => $code } );
+
+    my $created;
+
+    my $userinfo = LJ::Client::Google->fetch_userinfo( {
+        'access_token' => $token_info->{'access_token'},
+    } );
+
+    my $u = LJ::User::load_identity_user(
+        'V', $userinfo->{'id'},
+        { 'token_info' => $token_info, 'userinfo' => $userinfo }, 
+        \$created
+    );
+
+    LJ::Client::Google->save_access_token( $u, $token_info );
+
+    # do we need to re-initialize every time? either fix this, or drop this
+    # LJ::Identity::Google->initialize_user( $u, $token_info );
+
+    # send out a P3P header thing so as to work around IE's
+    # unwillingness to receive our cookies while we're in an iframe
+    # affects the partner sites authorization
+    LJ::Session->allow_login_from_iframe;
+
+    $u->make_login_session('long', 0);
+    LJ::set_remote($u);
+
+    return LJ::Request->redirect($returl) unless $created;
+
+    my $redirect_url = "$LJ::SITEROOT/identity/google-interstitial.bml?" .
+                       'ret=' . LJ::eurl($returl) . '&' .
+                       'forwhat=' . LJ::eurl($forwhat);
+
+    return LJ::Request->redirect($redirect_url);
+}
+_code?>
+<=body
+title=><?_code return $title; _code?>
+head<=
+<?_code return $headextra; _code?>
+<=head
+page?>
\ No newline at end of file

Added: trunk/htdocs/identity/google-interstitial.bml
===================================================================
--- trunk/htdocs/identity/google-interstitial.bml	                        (rev 0)
+++ trunk/htdocs/identity/google-interstitial.bml	2011-05-03 03:22:27 UTC (rev 10463)
@@ -0,0 +1,205 @@
+<?_code
+{
+#line 4
+    use strict;
+    use vars qw($title);
+
+    use Carp qw();
+
+    $title = LJ::Lang::ml('.title');
+
+    my $remote = LJ::get_remote();
+    unless (    $remote
+             && $remote->is_identity
+             && $remote->identity->short_code eq 'google' )
+    {
+        return LJ::Request->redirect("$LJ::SITEROOT/login.bml");
+    }
+
+    my $returl  = LJ::Request->get_param('ret') || $LJ::SITEROOT;
+    my $forwhat = LJ::Request->get_param('forwhat') || 'login';
+
+    my $external_site_case = ( $forwhat eq 'external' );
+
+    my @errors;
+    my $step2 = 0;
+
+    my $handle_post = sub {
+        if (!LJ::check_form_auth()) {
+            push @errors, LJ::Lang::ml('error.invalidform');
+            return;
+        }
+
+        return LJ::Request->redirect($returl) if $POST{'next'};
+
+        if (!LJ::Request->post_param('subscribe')) {
+            return LJ::Request->redirect($returl);
+        }
+
+        my $email = LJ::Request->post_param('email');
+
+        my @email_errors;
+        LJ::check_email($email, \@email_errors);
+
+        if ($LJ::USER_EMAIL and $email =~ /\@\Q$LJ::USER_DOMAIN\E$/i) {
+            push @email_errors,
+                LJ::Lang::ml(
+                    'widget.createaccount.error.email.lj_domain',
+                    { domain => $LJ::USER_DOMAIN }
+                );
+        }
+
+        if (@email_errors) {
+            push @errors, @email_errors;
+            return;
+        }
+
+        my $u = $remote;
+
+        LJ::update_user($remote, {
+            'email' => $email,
+
+            # validated email becomes transitioning, transitioning
+            # or non-validated stay intact
+            'status' => $u->email_status eq 'N' ? 'N' : 'T',
+        });
+
+        # send validation mail
+        my $aa = LJ::register_authaction($u->{'userid'},
+                                         'validateemail', $email);
+
+        LJ::send_mail({
+            'to' => $email,
+            'from' => $LJ::DONOTREPLY_EMAIL,
+            'charset' => 'utf-8',
+            'subject' => LJ::Lang::ml('email.newacct.subject'),
+            'body' => LJ::Lang::ml(
+                'email.newacct.google.body',
+                {
+                    username => $u->username,
+                    display_name => $u->display_name,
+                    sitename => $LJ::SITENAME,
+                    siteroot => $LJ::SITEROOT,
+                    conflink => "$LJ::SITEROOT/confirm/$aa->{'aaid'}." .
+                                $aa->{'authcode'},
+                }
+            ),
+        });
+
+        # copypasta from LJ::Hooks::CreatePage with adjustments
+        # possibly refactor to reduce code duplication?
+
+        # we are not anymore using this. ugh.
+        LJ::update_user($u, {'opt_gettalkemail' => 'N'});
+
+        my @subs = (
+            'CommentReply',
+            'Befriended-u',
+            'UserMessageRecvd-u',
+            'InvitedFriendJoins-u',
+            'NewUserpic',
+            'Birthday',
+            'NewVGift',
+        );
+
+        ## LJINT-362 (Comments for side projects):
+        ## in case an account is created on an external site, only
+        ## subscribe them to comment replies
+        if ( $external_site_case ) {
+            @subs = qw( CommentReply );
+        }
+
+        my $set = LJ::Subscription::GroupSet->fetch_for_user($u);
+        my $newset = $set->clone;
+
+        my @ntypeids = map { LJ::NotificationMethod->method_to_ntypeid($_) }
+            qw(Inbox Email);
+
+        foreach my $subcode (@subs) {
+            my $journalid = 0;
+
+            if ($subcode =~ /\-u$/) {
+                $journalid = $u->id;
+                $subcode =~ s/\-u$//;
+            }
+
+            my %sub = (
+                'userid' => $u->id,
+                'journalid' => $journalid,
+                'etypeid' => LJ::Event->event_to_etypeid($subcode),
+                'arg1' => 0,
+                'arg2' => 0,
+                'is_dirty' => 0,
+                'ntypeid' => 0,
+                'createtime' => time,
+                'expiretime' => 0,
+                'flags' => 0,
+            );
+
+            foreach my $ntypeid (@ntypeids) {
+                $sub{'ntypeid'} = $ntypeid;
+                $newset->insert_sub(bless({%sub}, 'LJ::Subscription'));
+            }
+        }
+
+        eval {
+            $set->update($newset);
+        };
+
+        if ($@) {
+            # theoretically, we didn't subscribe to any tracking subs yet,
+            # so there shouldn't be any errors, but if there are any,
+            # let's report
+            Carp::cluck "error subscribing user: " . $u->id;
+        }
+
+        $step2 = 1;
+    };
+
+    if (LJ::Request->did_post) {
+        $handle_post->();
+        return if LJ::Request->redirected;
+
+        ## LJINT-362 (Comments for side projects):
+        ## for external sites, there is no step 2; just
+        ## redirect them to the appropriate iframe
+        if ( $external_site_case && $step2 ) {
+            return LJ::Request->redirect( $returl );
+        }
+    }
+
+    my $mode = LJ::Request->get_param('mode');
+    unless ( defined $mode ) {
+        $mode = $external_site_case ? 'compact' : 'full';
+    }
+
+    my $template_file = $mode eq 'compact' ? 'GoogleInterstitialCompact.tmpl'
+                                           : 'GoogleInterstitial.tmpl';
+
+    my $template = LJ::HTML::Template->new(
+        { use_expr => 1 }, # force HTML::Template::Pro with Expr support
+        filename => "$ENV{'LJHOME'}/templates/Identity/$template_file",
+        die_on_bad_params => 0,
+        strict => 0,
+    ) or die "Can't open template: $!";
+
+    $template->param(
+        'errors' => [ map { { 'error' => $_ } } @errors ],
+        'form_intro' => LJ::form_auth(),
+        'form_email' => LJ::ehtml(LJ::Request->post_param('email')),
+        'ml_congrats' => LJ::Lang::ml('.congrats', {
+            'username' => $remote->ljuser_display, }),
+        'step2' => $step2,
+        'ml_validation' => LJ::Lang::ml('.validation', { resend_url => "$LJ::SITEROOT/register.bml" }),
+    );
+
+    if ( $mode eq 'compact' ) {
+        return $template->output;
+    } else {
+        return BML::render_page({
+            'body' => $template->output,
+            'title' => $title,
+        });
+    }
+}
+_code?>

Added: trunk/htdocs/identity/google-interstitial.bml.text.local
===================================================================
--- trunk/htdocs/identity/google-interstitial.bml.text.local	                        (rev 0)
+++ trunk/htdocs/identity/google-interstitial.bml.text.local	2011-05-03 03:22:27 UTC (rev 10463)
@@ -0,0 +1,21 @@
+.btn.proceed=Save and proceed
+
+.btn.next=Next
+
+.congrats=Congratulations, [[username]], your accounts are now connected.
+
+.desc=Log into LiveJournal with your Google account and get instant access to LiveJournal, including commenting, friend-finding, uploading userpics, and more!
+
+.heading.subscribe=Do you want to receive email notifications?
+
+.label.email=Enter your email:
+
+.label.subscribe.yes=Yes
+
+.label.subscribe.no=No
+
+.title=Log in with OpenID and more
+
+.tip.email=This is where you’ll get notifications and important account information. We will never share or sell your email address!
+
+.validation=Validation...[[resend_url]]

Modified: trunk/htdocs/identity/login.bml.text.local
===================================================================
--- trunk/htdocs/identity/login.bml.text.local	2011-04-29 07:43:04 UTC (rev 10462)
+++ trunk/htdocs/identity/login.bml.text.local	2011-05-03 03:22:27 UTC (rev 10463)
@@ -2,6 +2,10 @@
 
 .facebook.desc=Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut gravida nunc vitae purus egestas lobortis. Morbi varius ligula vitae diam vehicula a elementum felis sagittis. Morbi in sapien sit amet lectus dignissim consequat nec eu arcu.
 
+.google.btn.connect=Connect
+
+.google.desc=Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut gravida nunc vitae purus egestas lobortis. Morbi varius ligula vitae diam vehicula a elementum felis sagittis. Morbi in sapien sit amet lectus dignissim consequat nec eu arcu.
+
 .mailru.btn.connect=Enter from @Mail.ru
 
 .mailru.desc=Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut gravida nunc vitae purus egestas lobortis. Morbi varius ligula vitae diam vehicula a elementum felis sagittis. Morbi in sapien sit amet lectus dignissim consequat nec eu arcu.
@@ -16,6 +20,8 @@
 
 .tab.vkontakte=Vkontakte
 
+.tab.google=Google
+
 .twitter.btn.connect=Sign in with Twitter
 
 .twitter.desc=Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut gravida nunc vitae purus egestas lobortis. Morbi varius ligula vitae diam vehicula a elementum felis sagittis. Morbi in sapien sit amet lectus dignissim consequat nec eu arcu.

Added: trunk/htdocs/img/google-profile.gif
===================================================================
(Binary files differ)


Property changes on: trunk/htdocs/img/google-profile.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: trunk/htdocs/talkpost.bml.text.local
===================================================================
--- trunk/htdocs/talkpost.bml.text.local	2011-04-29 07:43:04 UTC (rev 10462)
+++ trunk/htdocs/talkpost.bml.text.local	2011-05-03 03:22:27 UTC (rev 10463)
@@ -7,6 +7,10 @@
 
 .facebook.who.you.are=We will figure who you are
 
+.google=Google
+
+.google.who.you.are=We will figure who you are
+
 .livejournal=LiveJournal
 
 .loginq=Log in?

Modified: trunk/htdocs/userinfo.bml.text.local
===================================================================
--- trunk/htdocs/userinfo.bml.text.local	2011-04-29 07:43:04 UTC (rev 10462)
+++ trunk/htdocs/userinfo.bml.text.local	2011-05-03 03:22:27 UTC (rev 10463)
@@ -136,6 +136,8 @@
 
 .title.facebookprofile=Profile
 
+.title.googleprofile=Profile
+
 .title.mailruprofile=Mail.ru profile
 
 .title.twitterprofile=Profile

Added: trunk/templates/CommentForm/Author-Google.tmpl
===================================================================
--- trunk/templates/CommentForm/Author-Google.tmpl	                        (rev 0)
+++ trunk/templates/CommentForm/Author-Google.tmpl	2011-05-03 03:22:27 UTC (rev 10463)
@@ -0,0 +1,89 @@
+<TMPL_IF everyone_can_comment>
+    <TMPL_IF is_identity>
+        <div class="b-postform-login-item b-postform-login-google">
+            <input type="radio" tabindex="16" name="usertype" value="google_cookie" id="talkpostfromgoogli" class="b-postform-login-radio" <TMPL_IF whocheck_google_cookie>checked="checked"</TMPL_IF> />
+            <label for="talkpostfromgoogli" class="b-postform-login-service"><TMPL_VAR expr="ml('/talkpost.bml.google')"></label>
+            <div class="b-postform-login-opts">
+                <strong><TMPL_VAR remote_display_name></strong>
+                <TMPL_VAR ml_willscreen>
+            </div>
+        </div>
+    <TMPL_ELSE>
+        <div class="b-postform-login-item b-postform-login-google">
+            <input type="radio" tabindex="16" name="usertype" value="google" id="talkpostfromgooglo" class="b-postform-login-radio" <TMPL_IF whocheck_google>checked="checked"</TMPL_IF> />
+            <label for="talkpostfromgooglo" class="b-postform-login-service"><TMPL_VAR expr="ml('/talkpost.bml.google')"></label>
+            <div class="b-postform-login-opts">
+                <span class="i-bubble b-bubble-lite"><i class="i-bubble-arrow-border"></i><i class="i-bubble-arrow"></i><TMPL_VAR expr="ml('/talkpost.bml.google.who.you.are')"><TMPL_VAR helpicon_google></span>
+                <TMPL_VAR ml_willscreen>
+            </div>
+        </div>
+    </TMPL_IF>
+<TMPL_ELSIF registered_can_comment>
+    <TMPL_IF is_trusted_identity>
+        <TMPL_IF remote_banned>
+            <div class="b-postform-login-item b-postform-login-google">
+                <div class="b-postform-login-opts">
+                    <TMPL_VAR ml_loggedin>
+                    <TMPL_VAR ml_banned>
+                </div>
+            </div>
+        <TMPL_ELSE>
+            <div class="b-postform-login-item b-postform-login-google">
+                <input type="radio" tabindex="16" name="usertype" value="google_cookie" id="talkpostfromgoogli" class="b-postform-login-radio" <TMPL_IF whocheck_google_cookie>checked="checked"</TMPL_IF> />
+                <label for="talkpostfromgoogli" class="b-postform-login-service"><TMPL_VAR expr="ml('/talkpost.bml.google')"></label>
+                <div class="b-postform-login-opts">
+                    <strong><TMPL_VAR remote_display_name></strong>
+                    <TMPL_VAR ml_willscreen>
+                </div>
+            </div>
+        </TMPL_IF>
+    <TMPL_ELSIF is_identity>
+        <div class="b-postform-login-item b-postform-login-google b-postform-login-disabled">
+            <span class="b-postform-login-service"><TMPL_VAR expr="ml('/talkpost.bml.google')"></span>
+            <div class="b-postform-login-opts">
+                <TMPL_VAR ml_noopenidpost>
+                <TMPL_VAR helpicon_google>
+            </div>
+        </div>
+    <TMPL_ELSE>
+        <div class="b-postform-login-item b-postform-login-google">
+            <input type="radio" tabindex="16" name="usertype" value="google" id="talkpostfromgooglo" class="b-postform-login-radio" <TMPL_IF whocheck_google>checked="checked"</TMPL_IF> />
+            <label for="talkpostfromgooglo" class="b-postform-login-service"><TMPL_VAR expr="ml('/talkpost.bml.google')"></label>
+            <div class="b-postform-login-opts">
+                <span class="i-bubble b-bubble-lite"><i class="i-bubble-arrow-border"></i><i class="i-bubble-arrow"></i><TMPL_VAR expr="ml('/talkpost.bml.google.who.you.are')"><TMPL_VAR helpicon_google></span>
+                <TMPL_VAR ml_willscreen>
+            </div>
+        </div>
+    </TMPL_IF>
+<TMPL_ELSIF friends_can_comment>
+    <TMPL_IF is_identity>
+        <TMPL_IF remote_can_comment>
+            <div class="b-postform-login-item b-postform-login-google">
+                <input type="radio" tabindex="16" name="usertype" value="google_cookie" id="talkpostfromgoogli" class="b-postform-login-radio" <TMPL_IF whocheck_google_cookie>checked="checked"</TMPL_IF> />
+                <label for="talkpostfromgoogli" class="b-postform-login-service"><TMPL_VAR expr="ml('/talkpost.bml.google')"></label>
+                <div class="b-postform-login-opts">
+                    <strong><TMPL_VAR remote_display_name></strong>
+                    <TMPL_VAR ml_willscreen>
+                </div>
+            </div>
+        <TMPL_ELSE>
+            <div class="b-postform-login-item b-postform-login-google b-postform-login-disabled">
+                <span class="b-postform-login-service"><TMPL_VAR expr="ml('/talkpost.bml.google')"></span>
+                <div class="b-postform-login-opts">
+                    <strong><TMPL_VAR remote_display_name></strong>
+                    <TMPL_VAR ml_notafriend>
+                    <TMPL_VAR ml_willscreen>
+                </div>
+            </div>
+        </TMPL_IF>
+    <TMPL_ELSE>
+        <div class="b-postform-login-item b-postform-login-google">
+            <input type="radio" tabindex="16" name="usertype" value="google" id="talkpostfromgooglo" class="b-postform-login-radio" <TMPL_IF whocheck_google>checked="checked"</TMPL_IF> />
+            <label for="talkpostfromgooglo" class="b-postform-login-service"><TMPL_VAR expr="ml('/talkpost.bml.google')"></label>
+            <div class="b-postform-login-opts">
+                <span class="i-bubble b-bubble-lite"><i class="i-bubble-arrow-border"></i><i class="i-bubble-arrow"></i><TMPL_VAR expr="ml('/talkpost.bml.google.who.you.are')"><TMPL_VAR helpicon_google></span>
+                <TMPL_VAR ml_willscreen>
+            </div>
+        </div>
+    </TMPL_IF>
+</TMPL_IF>

Added: trunk/templates/CommentForm/AuthorDisabled-Google.tmpl
===================================================================
--- trunk/templates/CommentForm/AuthorDisabled-Google.tmpl	                        (rev 0)
+++ trunk/templates/CommentForm/AuthorDisabled-Google.tmpl	2011-05-03 03:22:27 UTC (rev 10463)
@@ -0,0 +1,13 @@
+<TMPL_IF everyone_can_comment>
+<TMPL_ELSIF registered_can_comment>
+    <TMPL_IF is_trusted_identity>
+    <TMPL_ELSIF is_identity>
+        b-postform-ability-disabled-google
+    </TMPL_IF>
+<TMPL_ELSIF friends_can_comment>
+    <TMPL_IF is_identity>
+        <TMPL_UNLESS remote_can_comment>
+            b-postform-ability-disabled-google
+        </TMPL_UNLESS>
+    </TMPL_IF>
+</TMPL_IF>

Added: trunk/templates/CommentForm/AuthorTitle-Google.tmpl
===================================================================
--- trunk/templates/CommentForm/AuthorTitle-Google.tmpl	                        (rev 0)
+++ trunk/templates/CommentForm/AuthorTitle-Google.tmpl	2011-05-03 03:22:27 UTC (rev 10463)
@@ -0,0 +1,21 @@
+<TMPL_IF everyone_can_comment>
+    <span class="b-postform-login-services-item b-postform-login-services-google"><a href="#google" tabindex="11"><img src="<TMPL_VAR lj_imgprefix>/icons/google-16.gif" /><span class="b-postform-login-services-name"><TMPL_VAR expr="ml('/talkpost.bml.google')"></span></a></span>
+<TMPL_ELSIF registered_can_comment>
+    <TMPL_IF is_trusted_identity>
+        <span class="b-postform-login-services-item b-postform-login-services-google"><a href="#google" tabindex="11"><img src="<TMPL_VAR lj_imgprefix>/icons/google-16.gif" /><span class="b-postform-login-services-name"><TMPL_VAR expr="ml('/talkpost.bml.google')"></span></a></span>
+    <TMPL_ELSIF is_identity>
+        <span class="b-postform-login-services-item b-postform-login-services-google"><a href="#google" title="<TMPL_VAR ml_noopenidpost>" class="b-postform-login-services-disabled"><img src="<TMPL_VAR lj_imgprefix>/icons/google-16.gif" /><span class="b-postform-login-services-name"><TMPL_VAR expr="ml('/talkpost.bml.google')"></span></a></span>
+    <TMPL_ELSE>
+        <span class="b-postform-login-services-item b-postform-login-services-google"><a href="#google" tabindex="11"><img src="<TMPL_VAR lj_imgprefix>/icons/google-16.gif" /><span class="b-postform-login-services-name"><TMPL_VAR expr="ml('/talkpost.bml.google')"></span></a></span>
+    </TMPL_IF>
+<TMPL_ELSIF friends_can_comment>
+    <TMPL_IF is_identity>
+        <TMPL_IF remote_can_comment>
+            <span class="b-postform-login-services-item b-postform-login-services-google"><a href="#google" tabindex="11"><img src="<TMPL_VAR lj_imgprefix>/icons/google-16.gif" /><span class="b-postform-login-services-name"><TMPL_VAR expr="ml('/talkpost.bml.google')"></span></a></span>
+        <TMPL_ELSE>
+            <span class="b-postform-login-services-item b-postform-login-services-google"><a href="#google" title="<TMPL_VAR remote_display_name> <TMPL_VAR ml_notafriend> <TMPL_VAR ml_willscreen>" class="b-postform-login-services-disabled"><img src="<TMPL_VAR lj_imgprefix>/icons/google-16.gif" /><span class="b-postform-login-services-name"><TMPL_VAR expr="ml('/talkpost.bml.google')"></span></a></span>
+        </TMPL_IF>
+    <TMPL_ELSE>
+        <span class="b-postform-login-services-item b-postform-login-services-google"><a href="#google" tabindex="11"><img src="<TMPL_VAR lj_imgprefix>/icons/google-16.gif" /><span class="b-postform-login-services-name"><TMPL_VAR expr="ml('/talkpost.bml.google')"></span></a></span>
+    </TMPL_IF>
+</TMPL_IF>

Added: trunk/templates/Identity/GoogleInterstitial.tmpl
===================================================================
--- trunk/templates/Identity/GoogleInterstitial.tmpl	                        (rev 0)
+++ trunk/templates/Identity/GoogleInterstitial.tmpl	2011-05-03 03:22:27 UTC (rev 10463)
@@ -0,0 +1,56 @@
+<form action="" method="post" class="b-googinterstitial-form">
+<TMPL_VAR form_intro>
+<TMPL_IF step2>
+	<div class="warningbar">
+		<p><TMPL_VAR ml_validation></p>
+	</div>
+	<p class="b-googinterstitial-submit"><input type="submit" name="next" value="<TMPL_VAR expr="ml('.btn.next')">"></p>
+<TMPL_ELSE>
+	<h4><TMPL_VAR ml_congrats></h4>
+	<p><TMPL_VAR expr="ml('.desc')"></p>
+	<h4><TMPL_VAR expr="ml('.heading.subscribe')"></h4>
+	<ul>
+		<li>
+			<input type="radio" name="subscribe" value="1" id="subscribe_yes" checked="checked">
+			<label for="subscribe_yes"><TMPL_VAR expr="ml('.label.subscribe.yes')"></label>
+		</li>
+		<li>
+			<input type="radio" name="subscribe" value="0" id="subscribe_no">
+			<label for="subscribe_no"><TMPL_VAR expr="ml('.label.subscribe.no')"></label>
+		</li>
+		<li>
+			<table class="b-form-columns">
+			<tr>
+				<td>
+					<label for="email"><strong><TMPL_VAR expr="ml('.label.email')"></strong></label>
+				</td>
+				<td>
+					<input type="text" name="email" id="email" value="<TMPL_VAR form_email>">
+				</td>
+				<td>
+				<TMPL_IF errors>
+					<TMPL_LOOP errors>
+					<span class="i-bubble b-bubble-warning">
+						<i class="i-bubble-arrow-border"></i>
+						<i class="i-bubble-arrow"></i>
+						<TMPL_VAR error>
+					</span>
+					</TMPL_LOOP>
+				<TMPL_ELSE>
+					<span class="i-bubble b-bubble-alert">
+						<i class="i-bubble-arrow-border"></i>
+						<i class="i-bubble-arrow"></i>
+						<TMPL_VAR expr="ml('.tip.email')">
+					</span>
+				</TMPL_IF>
+				</td>
+			</tr>
+			</table>
+		</li>
+	</ul>
+	<p class="b-googinterstitial-submit">
+		<button type="submit"><TMPL_VAR expr="ml('.btn.proceed')"></button>
+	</p>
+</TMPL_IF>
+</form>
+

Added: trunk/templates/Identity/GoogleInterstitialCompact.tmpl
===================================================================
--- trunk/templates/Identity/GoogleInterstitialCompact.tmpl	                        (rev 0)
+++ trunk/templates/Identity/GoogleInterstitialCompact.tmpl	2011-05-03 03:22:27 UTC (rev 10463)
@@ -0,0 +1,63 @@
+<html>
+<head>
+<title>Google Interstitial</title>
+<TMPL_VAR lj_res_includes>
+</head>
+
+<body>
+
+<form action="" method="post" class="b-googinterstitial-form b-googinterstitial-form-compact">
+<TMPL_VAR form_intro>
+<TMPL_IF step2>
+	<div class="warningbar">
+		<p><TMPL_VAR ml_validation></p>
+	</div>
+	<p class="b-googinterstitial-submit"><input type="submit" name="next" value="<TMPL_VAR expr="ml('.btn.next')">"></p>
+<TMPL_ELSE>
+	<h4><TMPL_VAR ml_congrats></h4>
+	<p><TMPL_VAR expr="ml('.desc')"></p>
+	<h5><TMPL_VAR expr="ml('.heading.subscribe')"></h5>
+	<ul class="checkboxes">
+		<li>
+			<input type="radio" name="subscribe" value="1" id="subscribe_yes" checked="checked">
+			<label for="subscribe_yes"><TMPL_VAR expr="ml('.label.subscribe.yes')"></label>
+		</li>
+		<li>
+			<input type="radio" name="subscribe" value="0" id="subscribe_no">
+			<label for="subscribe_no"><TMPL_VAR expr="ml('.label.subscribe.no')"></label>
+		</li>
+	<table class="b-form-columns">
+	<tr>
+		<td>
+			<label for="email"><strong><TMPL_VAR expr="ml('.label.email')"></strong></label>
+		</td>
+		<td>
+			<input type="text" name="email" id="email" value="<TMPL_VAR form_email>">
+		</td>
+		<td>
+		<TMPL_IF errors>
+			<TMPL_LOOP errors>
+			<span class="i-bubble b-bubble-warning">
+				<i class="i-bubble-arrow-border"></i>
+				<i class="i-bubble-arrow"></i>
+				<TMPL_VAR error>
+			</span>
+			</TMPL_LOOP>
+		<TMPL_ELSE>
+			<span class="i-bubble b-bubble-alert">
+				<i class="i-bubble-arrow-border"></i>
+				<i class="i-bubble-arrow"></i>
+				<TMPL_VAR expr="ml('.tip.email')">
+			</span>
+		</TMPL_IF>
+		</td>
+	</tr>
+	</table>
+	</ul>
+	<p class="b-googinterstitial-submit">
+		<button type="submit"><TMPL_VAR expr="ml('.btn.proceed')"></button>
+	</p>
+</TMPL_IF>
+</form>
+
+</body>

Added: trunk/templates/Identity/Login-google.tmpl
===================================================================
--- trunk/templates/Identity/Login-google.tmpl	                        (rev 0)
+++ trunk/templates/Identity/Login-google.tmpl	2011-05-03 03:22:27 UTC (rev 10463)
@@ -0,0 +1,3 @@
+<button type="submit" class="b-googlebtn"><span><i></i><TMPL_VAR expr="ml('/identity/login.bml.google.btn.connect')"></span></button>
+<p class="b-auth-desc"><TMPL_VAR expr="ml('/identity/login.bml.google.desc')"></p>
+<TMPL_IF errors><TMPL_LOOP errors><p class="b-auth-error"><span class="i-message i-message-error"><TMPL_VAR error></span></p></TMPL_LOOP></TMPL_IF>

Tags: andy, bml, gif, ljcom, local, pm, tmpl
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