Committer: ailyin
LJINT-362 (comments for side projects); includes changes by szhirkov and mchervonniyU trunk/cgi-bin/LJ/ExternalComments.pm U trunk/cgi-bin/LJ/Talk/Author/Facebook.pm U trunk/cgi-bin/LJ/Talk/Author/Twitter.pm U trunk/htdocs/gadgets/logout.bml A trunk/htdocs/js/partners/ A trunk/htdocs/js/partners/placeholder.js U trunk/htdocs/stc/partners/login.css U trunk/htdocs/tools/endpoints/comments.bml
Modified: trunk/cgi-bin/LJ/ExternalComments.pm =================================================================== --- trunk/cgi-bin/LJ/ExternalComments.pm 2010-12-02 06:04:23 UTC (rev 9781) +++ trunk/cgi-bin/LJ/ExternalComments.pm 2010-12-02 07:04:56 UTC (rev 9782) @@ -26,10 +26,10 @@ ## get data from DB my $dbr = LJ::get_db_reader(); ($jitemid) = $dbr->selectrow_array(" - SELECT jitemid + SELECT jitemid FROM exturl2entry_map WHERE - userid = ? + userid = ? AND url_md5 = ? ", undef, $u->userid, $url_md5); die DBI->errstr if DBI->err; @@ -41,8 +41,8 @@ } else { ## cache negative mapping LJ::MemCache::set($cache_key, 0, 3600); - } - + } + return $jitemid; } @@ -69,7 +69,7 @@ $year += 1900; my $req = { - event => "text", + event => "see $url", subject => "subject text", allowmask => 0, username => $u->username, @@ -99,10 +99,13 @@ $u->userid, $jitemid, $url_md5) or die DBI->errstr; + my $entry = LJ::Entry->new($u, 'jitemid' => $jitemid); + $entry->set_prop( 'external_url' => $url ); + ## update cache my $cache_key = [$u->userid, $u->userid . "." . $url_md5]; LJ::MemCache::set($cache_key, $jitemid); - + return $jitemid; } Modified: trunk/cgi-bin/LJ/Talk/Author/Facebook.pm =================================================================== --- trunk/cgi-bin/LJ/Talk/Author/Facebook.pm 2010-12-02 06:04:23 UTC (rev 9781) +++ trunk/cgi-bin/LJ/Talk/Author/Facebook.pm 2010-12-02 07:04:56 UTC (rev 9782) @@ -40,6 +40,16 @@ return $usertype =~ /^(?:facebook|facebook_cookie)$/; } +sub usertype_default { + my ( $class, $remote ) = @_; + + return unless $remote + && $remote->is_identity + && $remote->identity->short_code eq 'facebook'; + + return 'facebook_cookie'; +} + sub handle_user_input { my ($class, $form, $remote, $need_captcha, $errret, $init) = @_; Modified: trunk/cgi-bin/LJ/Talk/Author/Twitter.pm =================================================================== --- trunk/cgi-bin/LJ/Talk/Author/Twitter.pm 2010-12-02 06:04:23 UTC (rev 9781) +++ trunk/cgi-bin/LJ/Talk/Author/Twitter.pm 2010-12-02 07:04:56 UTC (rev 9782) @@ -40,6 +40,16 @@ return $usertype =~ /^(?:twitter|twitter_cookie)$/; } +sub usertype_default { + my ( $class, $remote ) = @_; + + return unless $remote + && $remote->is_identity + && $remote->identity->short_code eq 'twitter'; + + return 'twitter_cookie'; +} + sub handle_user_input { my ($class, $form, $remote, $need_captcha, $errret, $init) = @_; Modified: trunk/htdocs/gadgets/logout.bml =================================================================== --- trunk/htdocs/gadgets/logout.bml 2010-12-02 06:04:23 UTC (rev 9781) +++ trunk/htdocs/gadgets/logout.bml 2010-12-02 07:04:56 UTC (rev 9782) @@ -12,8 +12,12 @@ my $user = $POST{'user'} || $GET{'user'}; my $sessid = $POST{'sessid'} || $GET{'sessid'}; + die 'no sessid' unless $sessid; + ## delete user sessions. - $u->logout_all if $u; + # TODO: move this to LJ::User? + $u->session($sessid)->destroy; + $u->_logout_common; ## Redirect instead of xml-response? my $returnto = $GET{returnto} || $POST{returnto}; Added: trunk/htdocs/js/partners/placeholder.js =================================================================== --- trunk/htdocs/js/partners/placeholder.js (rev 0) +++ trunk/htdocs/js/partners/placeholder.js 2010-12-02 07:04:56 UTC (rev 9782) @@ -0,0 +1,25 @@ +(function ($) { + $(function () { + $('input:text, input:password, textarea').placeholder(); + }); + + $.fn.placeholder = function () { + return this.each(function () { + var field = $(this), + hintLabel = field.prev(); + + field + .bind('focus', function () { + hintLabel.hide(); + }) + .bind('blur', function () { + if (field.val() === '') { + hintLabel.show(); + } else { + hintLabel.hide(); + } + }) + .trigger('blur'); + }) + } +})(jQuery); Modified: trunk/htdocs/stc/partners/login.css =================================================================== --- trunk/htdocs/stc/partners/login.css 2010-12-02 06:04:23 UTC (rev 9781) +++ trunk/htdocs/stc/partners/login.css 2010-12-02 07:04:56 UTC (rev 9782) @@ -63,7 +63,7 @@ } .b-auth FORM { padding:10px 30px; - margin:0 0 17px; + height:180px; overflow:hidden; border:1px solid #CCC; border-radius:6px; @@ -78,11 +78,12 @@ .b-auth #tab-facebook FORM, .b-auth #tab-twitter FORM { padding:30px; + height:140px; } .b-auth-user-form, .b-auth-openid-form { - float:left; + /*float:left;*/ margin:0; padding:20px 0; text-align:left; @@ -157,7 +158,6 @@ .lj3-form-wrapper .lj3-form { display:none; padding:10px 30px; - margin:0 0 17px; overflow:hidden; border:1px solid #CCC; border-radius:6px; @@ -220,7 +220,7 @@ } .lj3-post-comment .lj3-input-wrapper TEXTAREA { width:520px; - height:67px; + height:112px; font-size:15px; } Modified: trunk/htdocs/tools/endpoints/comments.bml =================================================================== --- trunk/htdocs/tools/endpoints/comments.bml 2010-12-02 06:04:23 UTC (rev 9781) +++ trunk/htdocs/tools/endpoints/comments.bml 2010-12-02 07:04:56 UTC (rev 9782) @@ -70,8 +70,11 @@ }); ## my $data = {}; - $data->{comment_id} = $comment->{talkid}; - $data->{parent_id} = $comment->{parenttalkid}; + $data->{comment_id} = $comment->{talkid} * 256 + $entry->anum; + $data->{parent_id} = + $comment->{parenttalkid} + ? $comment->{parenttalkid} * 256 + $entry->anum + : 0 ; $data->{username} = $comment->{userpost} || ''; if ($pu){