NEW FEATURE: use gravatars as icons for players
authorArun Persaud <arun@nubati.net>
Fri, 23 Oct 2009 05:56:21 +0000 (22:56 -0700)
committerArun Persaud <arun@nubati.net>
Sat, 31 Oct 2009 03:49:42 +0000 (20:49 -0700)
use icons at the table and on the user page (for last players logged in).

css/standard022.css [moved from css/standard021.css with 98% similarity]
include/db.php
include/functions.php
include/output.php
include/preferences.php
include/user.php

similarity index 98%
rename from css/standard021.css
rename to css/standard022.css
index 695792494e2dc59e6ab2a7ccc398bf7c42544c05..79dfeea8515367bc3ad6423b9ec6d543309f31bb 100644 (file)
@@ -165,7 +165,7 @@ body { background-color: #ddd; }
 div.table {
   position:absolute;
   width:100%;
-  height:35em;
+  height:37em;
   margin:0;
   left:0;
   padding:0;
@@ -202,7 +202,7 @@ div.table div.table0 {
   right:62.5%;
 }
 div.table div.table1 {
-  top:7.5%;
+  top:0%;
   left:43.75%;
 }
 div.table div.table2 {
@@ -210,7 +210,7 @@ div.table div.table2 {
   left:62.5%;
 }
 div.table div.table3 {
-  bottom:5%;
+  bottom:0%;
   left: 43.75%;
 }
 
@@ -413,7 +413,7 @@ ul.tricks li div div span.comment span{
 
 .mycards {
   margin:0;
-  margin-top:34.5em;
+  margin-top:38.5em;
   padding:0;
   border-top:       2px solid gray;
 /* border-bottom:    2px solid green;*/
@@ -643,4 +643,10 @@ table.openid td, table.openid th{
 .vacation {
     color: #666;
     background-color: #fc3;
+}
+
+div.table div img.gravatar, img.gravatar  { 
+    width:  4em;
+    height: 4em;
+    border: 3px solid #aaa;
 }
\ No newline at end of file
index cc40f67c1e8054a60515806445e25e7b0533136b..882a1adb35448224451f230aff4f6278fa373a80 100644 (file)
@@ -470,6 +470,17 @@ function DB_get_names_of_last_logins($N)
   return $names;
 }
 
+function DB_get_emails_of_last_logins($N)
+{
+  $emails  = array();
+
+  $result = DB_query("SELECT email FROM User ORDER BY last_login DESC LIMIT $N");
+  while($r = DB_fetch_array($result))
+    $emails[] = $r[0];
+
+  return $emails;
+}
+
 function DB_get_names_of_new_logins($N)
 {
   $names  = array();
index 43fbb24deeeb726e6154b5f0bdad84e8e1d75811..63216eb3d44bbcf91374961ef7da24d337c01a0c 100644 (file)
@@ -803,7 +803,8 @@ function display_table ()
                     "        Hand.point_call, ".
                     "        User.last_login, ".
                     "        Hand.hash,       ".
-                    "        User.timezone    ".
+                    "        User.timezone,    ".
+                    "        User.email       ".
                     "FROM Hand ".
                     "LEFT JOIN User ON User.id=Hand.user_id ".
                     "WHERE Hand.game_id='".$gameid."' ".
@@ -821,11 +822,14 @@ function display_table ()
       $call      = $r[5];
       $hash      = $r[7];
       $timezone  = $r[8];
+      $email     = $r[9];      
       $wins      = DB_get_number_of_tricks($gameid,$pos);
       date_default_timezone_set($defaulttimezone);
       $lastlogin = strtotime($r[6]);
       date_default_timezone_set($timezone);
       $timenow   = strtotime(date("Y-m-d H:i:s"));
+      $gravatar = "$name<br /><img class=\"gravatar\" title=\"$name\" src=\"http://www.gravatar.com/avatar/".md5(strtolower(trim($email)))."?d=identicon\" />";
+
 
       echo "  <div class=\"table".($pos-1)."\">\n";
 
@@ -838,10 +842,10 @@ function display_table ()
          $comment = $vacation[2];
 
              $title = "begin: $start  end: $stop $comment";
-             echo "   <span class=\"vacation\" title=\"$title\">$name (on vacation until $stop)</span> \n";
+             echo "   <span class=\"vacation\" title=\"$title\">$gravatar (on vacation until $stop)</span> \n";
        }
       else
-       echo "   $name \n";
+       echo "   $gravatar \n";
       if($debug)
        echo"</a>\n";
 
index 33f7b199d4b9e0c9e18b3f1a99a49fabdeb2b0fe..9e87de34658ec5a7fea1012a7c8086c41eda9703 100644 (file)
@@ -301,7 +301,7 @@ function output_header()
      <title>e-Doko</title>
      <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
      <link rel="shortcut icon" type="image/x-icon" href="pics/edoko-favicon.png" />
-     <link rel="stylesheet" type="text/css" href="css/standard021.css" />
+     <link rel="stylesheet" type="text/css" href="css/standard022.css" />
      <script type="text/javascript" src="include/game.js"> </script>
      <script type="text/javascript" src="include/jquery.js"> </script>
      <script type="text/javascript" src="include/jquery.tablesorter.js"></script>
index 2e3eef2fbf53ba6c771db53747d619d4454d398c..70ecabbc2f1b4e629ca50b502d6555162cd92bfe 100644 (file)
@@ -496,6 +496,7 @@ if($changed_openid)
 echo "    </fieldset>\n";
 echo "    <fieldset><legend>Submit</legend><input type=\"submit\"  name=\"passwd\" value=\"set\" /></fieldset>\n";
 echo "  </form>\n";
+echo " <p>E-DoKo uses <a href=\"http://www.gravatar.org\">gravatars</a> as icons. I</p>";
 echo "</div>\n";
 
 return;
index bac439895098d170ba6c86f12fdb93e4631b27ff..a027f40ee18cf3a173ffcb185ce30e66a119555f 100644 (file)
@@ -206,9 +206,14 @@ else
        echo "</p>\n";
 
        /* display last 5 users that logged on */
-       $names = DB_get_names_of_last_logins(5);
        echo "<h4>Players last logged in:</h4>\n<p>\n";
-       echo implode(", ",$names).",...\n";
+
+       $names  = DB_get_names_of_last_logins(7);
+       $emails = DB_get_emails_of_last_logins(7);
+       for($i=0;$i<7;$i++)
+         {
+           echo "<img class=\"gravatar\" title=\"".$names[$i]."\" src=\"http://www.gravatar.com/avatar/".md5(strtolower(trim($emails[$i])))."?d=identicon\" />\n";
+         }
        echo "</p>\n";
 
        echo "</div>\n";