Added colored usernames in message sidebar
authorMarcel Werk <burntime@woltlab.com>
Sun, 23 Mar 2014 23:53:50 +0000 (00:53 +0100)
committerMarcel Werk <burntime@woltlab.com>
Sun, 23 Mar 2014 23:53:50 +0000 (00:53 +0100)
com.woltlab.wcf/option.xml
com.woltlab.wcf/templates/messageSidebar.tpl
wcfsetup/install/files/lib/data/user/UserProfile.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index e22db648d67f88ba4b564336e66647108dd4ee0a..8768b66803cb0f476c45a6336c7e18317ab9105c 100644 (file)
@@ -1129,6 +1129,12 @@ DESC:wcf.global.sortOrder.descending]]></selectoptions>
                                <optiontype>boolean</optiontype>
                                <defaultvalue>0</defaultvalue>
                        </option>
+                       <option name="message_sidebar_enable_user_online_marking">
+                               <categoryname>message.sidebar</categoryname>
+                               <optiontype>boolean</optiontype>
+                               <defaultvalue>1</defaultvalue>
+                               <options>module_users_online</options>
+                       </option>
                        <option name="message_sidebar_user_options">
                                <categoryname>message.sidebar</categoryname>
                                <optiontype>useroptions</optiontype>
index 645a7ea8e22d2f2edb1a87ece4d273bb84976bce..5bd409de140c5fbb64f90ca4d0d2fccd3ed454e0 100644 (file)
@@ -21,7 +21,7 @@
                        <header>
                                <h2 class="username">
                                        <a href="{link controller='User' object=$userProfile->getDecoratedObject()}{/link}" class="userLink" data-user-id="{@$userProfile->userID}" rel="author">
-                                               <span itemprop="name">{$username}</span>
+                                               <span itemprop="name">{if MESSAGE_SIDEBAR_ENABLE_USER_ONLINE_MARKING}{@$userProfile->getFormattedUsername()}{else}{$username}{/if}</span>
                                        </a>
                                </h2>
                                
index 2637fc2e6ffe5aa5f4a3176642a5c9bd6dced2f4..189cbbf6d5f94e7407a5562c5aa214ff3349fb73 100644 (file)
@@ -3,6 +3,7 @@ namespace wcf\data\user;
 use wcf\data\user\avatar\DefaultAvatar;
 use wcf\data\user\avatar\Gravatar;
 use wcf\data\user\avatar\UserAvatar;
+use wcf\data\user\group\UserGroup;
 use wcf\data\user\online\UserOnline;
 use wcf\data\user\option\ViewableUserOption;
 use wcf\data\user\rank\UserRank;
@@ -772,4 +773,22 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
                $option->setOptionValue($this->getDecoratedObject());
                return $option->optionValue;
        }
+       
+       /**
+        * Returns the formatted username.
+        *
+        * @return      string
+        */
+       public function getFormattedUsername() {
+               $username = StringUtil::encodeHTML($this->username);
+       
+               if ($this->userOnlineGroupID) {
+                       $group = UserGroup::getGroupByID($this->userOnlineGroupID);
+                       if ($group !== null && $group->userOnlineMarking && $group->userOnlineMarking != '%s') {
+                               return sprintf($group->userOnlineMarking, $username);
+                       }
+               }
+               
+               return $username;
+       }
 }
index e2699d3af7df7a04fe075e68fe44900fd3849cf9..240062baa1d089d657eeb54921a5e9b452f2c26a 100644 (file)
@@ -876,6 +876,7 @@ GmbH=Gesellschaft mit beschränkter Haftung]]></item>
                <item name="wcf.acp.option.google_maps_enable_double_click_zoom"><![CDATA[Zoom durch Doppelklick zulassen]]></item>
                <item name="wcf.acp.option.google_maps_default_latitude"><![CDATA[Standard-Kartenposition (Breitengrad)]]></item>
                <item name="wcf.acp.option.google_maps_default_longitude"><![CDATA[Standard-Kartenposition (Längengrad)]]></item>
+               <item name="wcf.acp.option.message_sidebar_enable_user_online_marking"><![CDATA[„Benutzer online“-Darstellung für Benutzernamen verwenden]]></item>
        </category>
        
        <category name="wcf.acp.package">
index c132fec057becc247162cb7b94b15edcf0503abc..05010b6addf48fd628334e87299b0f30175710d8 100644 (file)
@@ -876,6 +876,7 @@ GmbH=Gesellschaft mit beschränkter Haftung]]></item>
                <item name="wcf.acp.option.google_maps_enable_double_click_zoom"><![CDATA[Enable Zoom by Double-Clicking]]></item>
                <item name="wcf.acp.option.google_maps_default_latitude"><![CDATA[Default Map Position (Latitude)]]></item>
                <item name="wcf.acp.option.google_maps_default_longitude"><![CDATA[Default Map Position (Longitude)]]></item>
+               <item name="wcf.acp.option.message_sidebar_enable_user_online_marking"><![CDATA[TODO: „Benutzer online“-Darstellung für Benutzernamen verwenden]]></item>
        </category>
        
        <category name="wcf.acp.package">