holyandrew (holyandrew) wrote in changelog,
holyandrew
holyandrew
changelog

[livejournal] r21879: LJSUP-12032: Display social capital in t...

Committer: akanashin
LJSUP-12032: Display social capital in the contextual hover
U   trunk/htdocs/tools/endpoints/ctxpopup.bml
Modified: trunk/htdocs/tools/endpoints/ctxpopup.bml
===================================================================
--- trunk/htdocs/tools/endpoints/ctxpopup.bml	2012-05-03 13:55:08 UTC (rev 21878)
+++ trunk/htdocs/tools/endpoints/ctxpopup.bml	2012-05-03 14:12:37 UTC (rev 21879)
@@ -1,4 +1,5 @@
 <?_code # -*-bml-*-
+
 {
     use strict;
     use vars qw(%GET);
@@ -118,6 +119,28 @@
         $ret{userpic_h} = 100;
     }
 
+    if ($u && ($u->is_personal || $u->is_comm)) {
+        my ($position, $first, $soc_capital);
+
+        $position = LJ::PersonalStats::DB->fetch_raw('ratings', {
+            func => 'get_value',
+            what => $u->journaltype eq 'C' ? 'communities' : 'users',
+            journal_id => $u->userid,
+            by => 'friends_weight',
+            type => 0,
+            sup =>  LJ::SUP->is_sup_enabled($u) ? 1 : 0,
+        });
+
+        if (ref $position eq 'HASH' && ( $u->journaltype eq 'C' || LJ::SUP->is_sup_enabled($u) )) {
+            $first = $position->{result}->{position}!=0 ? 0 : 1;
+            $soc_capital = int($position->{result}->{value}/1000);
+            $soc_capital = $soc_capital < 10 ? ' <10 ' : LJ::commafy($soc_capital);
+
+            $ret{first}  = $first; 
+            $ret{value}  = $soc_capital;
+        }
+    }
+
     if ( $remote ) {
         $ret{is_friend}    = LJ::is_friend($remote, $u);
         $ret{is_friend_of} = LJ::is_friend($u, $remote);

Tags: akanashin, bml, holyandrew, livejournal
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