]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
Implement request #3054906: Show user's full name instead of nickname
authorChristian Weiske <cweiske@cweiske.de>
Tue, 15 Mar 2011 18:13:14 +0000 (19:13 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Tue, 15 Mar 2011 18:13:14 +0000 (19:13 +0100)
data/templates/bookmarkcommondescriptionedit.tpl.php
data/templates/bookmarks.tpl.php
data/templates/sidebar.block.users.php
data/templates/tagcommondescriptionedit.tpl.php
data/templates/users.tpl.php
doc/ChangeLog
src/SemanticScuttle/Model/UserArray.php [new file with mode: 0644]
src/SemanticScuttle/Service/Bookmark.php
src/SemanticScuttle/header.php
www/rss.php

index af5909a0675bc2de2e460aa985e108ad3053e297..807c58b983a7072a7093d6d7dd3d5d4f81a5c726 100644 (file)
@@ -30,7 +30,8 @@ window.onload = function() {
        if(strlen($description['cdDatetime'])>0) {
           echo T_('Last modification:').' '.$description['cdDatetime'].', ';
           $lastUser = $userservice->getUser($description['uId']);
-          echo  '<a href="'.createURL('profile', $lastUser['username']).'">'.$lastUser['username'].'</a>';
+          echo  '<a href="'.createURL('profile', $lastUser['username']).'">'
+           . SemanticScuttle_Model_UserArray::getName($lastUser) . '</a>';
        }
        ?>
     </td>
index e32d3c9e35b52b5d515904f0af78993ccd7516bd..c404358b39017e271727d471d9bf6bbd8ec54c81 100644 (file)
@@ -309,7 +309,8 @@ if ($currenttag!= '') {
                        $copy .= T_('you');
                } else {
                        $copy .= '<a href="' . createURL('bookmarks', $row['username']) . '">'
-                . $row['username'] . '</a>';
+                . SemanticScuttle_Model_UserArray::getName($row)
+                . '</a>';
                }
 
                // Udders!
index 3ad18bc43d83027a5097baa63a79180bdce1e81f..826871e5c53e4bbd58854b760b84b74304fbba68 100644 (file)
@@ -18,7 +18,7 @@ if ($lastUsers && count($lastUsers) > 0) {
 foreach ($lastUsers as $row) {
     echo '<tr><td>';
     echo  '<a href="'.createURL('profile', $row['username']).'">';
-    echo $row['username'];
+    echo SemanticScuttle_Model_UserArray::getName($row);
     echo '</a>';
     echo ' (<a href="'.createURL('bookmarks', $row['username']).'">'.T_('bookmarks').'</a>)';
     echo '</td></tr>';
index d3a006a693cb5d0f3d7bda6942742b149ed3e58c..f938f93ba039ba79348c30b853d53a1ad2a83891 100644 (file)
@@ -20,7 +20,8 @@ window.onload = function() {
        if(strlen($description['cdDatetime'])>0) {
           echo T_('Last modification:').' '.$description['cdDatetime'].', ';
           $lastUser = $userservice->getUser($description['uId']);
-          echo  '<a href="'.createURL('profile', $lastUser['username']).'">'.$lastUser['username'].'</a>';
+          echo  '<a href="' . createURL('profile', $lastUser['username']) . '">'
+           . SemanticScuttle_Model_UserArray::getName($lastUser) . '</a>';
        }
        ?>
     </td>
index c209f9473df4054d6c13af06ba731d53f6a46470..fa92bef95435ae55e1e95f561a924a3ae1dcf137 100644 (file)
@@ -14,7 +14,14 @@ if ($users && count($users) > 0) {
 <?php
 $contents = '<';
 foreach ($users as $row) {
-    echo  '<li><strong>'.$row['username'].'</strong> (<a href="'.createURL('profile', $row['username']).'">'.T_('profile').'</a> '.T_('created in').' '.date('M Y',strtotime($row['uDatetime'])).') : <a href="'.createURL('bookmarks', $row['username']).'">'.T_('bookmarks').'</a></li>';
+    echo  '<li><strong>'
+        . SemanticScuttle_Model_UserArray::getName($row) . '</strong>'
+        . ' (<a href="' . createURL('profile', $row['username']) . '">'
+        . T_('profile') . '</a> '
+        . T_('created in') . ' '
+        . date('M Y', strtotime($row['uDatetime'])) . ')'
+        . ' : <a href="' . createURL('bookmarks', $row['username']).'">'
+        . T_('bookmarks') . '</a></li>';
 }
 ?>
 </ul>
index 6144a814c88751be0ce7c98e7a9f8ce6c3720196..4c93a9a6226b6829c2619b332309d924e309d944 100644 (file)
@@ -3,12 +3,13 @@ ChangeLog for SemantiScuttle
 
 0.9X.X - 2010-XX-XX
 -------------------
+- Fix bug #3187177: Wrong URL / Export XML Bookmarks
 - Fix bug in getTagsForBookmarks() that fetched all tags
-- Show error message on mysqli connection errors
+- Implement request #3054906: Show user's full name instead of nickname
 - Implement patch #3059829: update FR_CA translation
+- Show error message on mysqli connection errors
 - Update php-gettext library to 1.0.10
 - api/posts/add respects the "replace" parameter now
-- Fix bug #3187177: Wrong URL / Export XML Bookmarks 
 
 
 0.97.2 - 2011-02-17
diff --git a/src/SemanticScuttle/Model/UserArray.php b/src/SemanticScuttle/Model/UserArray.php
new file mode 100644 (file)
index 0000000..a0d9c9b
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+/**
+ * SemanticScuttle - your social bookmark manager.
+ *
+ * PHP version 5.
+ *
+ * @category Bookmarking
+ * @package  SemanticScuttle
+ * @author   Christian Weiske <cweiske@cweiske.de>
+ * @license  GPL http://www.gnu.org/licenses/gpl.html
+ * @link     http://sourceforge.net/projects/semanticscuttle
+ */
+
+/**
+ * Mostly static methods that help working with a user row array from database.
+ *
+ * @category Bookmarking
+ * @package  SemanticScuttle
+ * @author   Christian Weiske <cweiske@cweiske.de>
+ * @license  GPL http://www.gnu.org/licenses/gpl.html
+ * @link     http://sourceforge.net/projects/semanticscuttle
+ */
+class SemanticScuttle_Model_UserArray
+{
+    /**
+     * Returns full user name as specified in the profile if it is set,
+     * otherwise the nickname/loginname is returned.
+     *
+     * @param array $row User row array from database
+     *
+     * @return string Full name or username
+     */
+    public static function getName($row)
+    {
+        if (isset($row['name']) && $row['name']) {
+            return $row['name'];
+        }
+        return $row['username'];
+    }
+}
+?>
\ No newline at end of file
index 6f8a1721282807b04817d1c1ba757cde0f7f3086..a30ad5f6a0f443afab43683548dd1a7a2f8eb80a 100644 (file)
@@ -734,7 +734,8 @@ class SemanticScuttle_Service_Bookmark extends SemanticScuttle_DbService
         if (SQL_LAYER == 'mysql4') {
             $query_1 .= 'SQL_CALC_FOUND_ROWS ';
         }
-        $query_1 .= 'B.*, U.'. $userservice->getFieldName('username');
+        $query_1 .= 'B.*, U.'. $userservice->getFieldName('username')
+            . ', U.name';
 
         $query_2 = ' FROM '. $userservice->getTableName() .' AS U'
             . ', '. $this->getTableName() .' AS B';
index d1a5c293bb09d834a6028f30e9e8eaace3ebd36e..4fecb8f3eaa189837bc526280792c4434e9a8297 100644 (file)
@@ -68,6 +68,7 @@ require_once 'SemanticScuttle/Service.php';
 require_once 'SemanticScuttle/DbService.php';
 require_once 'SemanticScuttle/Service/Factory.php';
 require_once 'SemanticScuttle/functions.php';
+require_once 'SemanticScuttle/Model/UserArray.php';
 
 if (count($GLOBALS['serviceoverrides']) > 0
     && !defined('UNIT_TEST_MODE')
index 6dcfb4c85a34aedf5f9e5b8871595ae6c60b2011..298d9bacdbc7796457e49fea380ef8374a87bb59 100644 (file)
@@ -116,7 +116,7 @@ foreach ($bookmarks_tmp as $key => $row) {
         'title'       => $row['bTitle'],
         'link'        => $_link,
         'description' => $row['bDescription'],
-        'creator'     => $row['username'],
+        'creator'     => SemanticScuttle_Model_UserArray::getName($row),
         'pubdate'     => $_pubdate,
         'tags'        => $row['tags']
     );