Moved user online record from wbb into wcf
authorMarcel Werk <burntime@woltlab.com>
Wed, 25 Sep 2013 20:24:32 +0000 (22:24 +0200)
committerMarcel Werk <burntime@woltlab.com>
Wed, 25 Sep 2013 20:24:32 +0000 (22:24 +0200)
com.woltlab.wcf/option.xml
com.woltlab.wcf/templates/usersOnlineInfoBox.tpl [new file with mode: 0644]
com.woltlab.wcf/templates/usersOnlineList.tpl
wcfsetup/install/files/lib/data/user/online/UsersOnlineList.class.php
wcfsetup/install/files/lib/page/UsersOnlineListPage.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 6ef779d70e26d8e251fb22e3cb59dd1542aa5813..4bfbce98bdb632ed7fdc90a34671e74c376f0b05 100644 (file)
@@ -946,6 +946,28 @@ DESC:wcf.global.sortOrder.descending]]></selectoptions>
                                <defaultvalue>0</defaultvalue>
                                <minvalue>0</minvalue>
                        </option>
+                       <option name="users_online_record_no_guests">
+                               <categoryname>user.list.online</categoryname>
+                               <optiontype>boolean</optiontype>
+                               <defaultvalue>0</defaultvalue>
+                               <options>module_users_online</options>
+                       </option>
+                       <option name="users_online_enable_legend">
+                               <categoryname>user.list.online</categoryname>
+                               <optiontype>boolean</optiontype>
+                               <defaultvalue>0</defaultvalue>
+                               <options>module_users_online</options>
+                       </option>
+                       <option name="users_online_record">
+                               <categoryname>user.list.online</categoryname>
+                               <optiontype>integer</optiontype>
+                               <hidden>1</hidden>
+                       </option>
+                       <option name="users_online_record_time">
+                               <categoryname>user.list.online</categoryname>
+                               <optiontype>integer</optiontype>
+                               <hidden>1</hidden>
+                       </option>
                        <!-- /user.list.online -->
                        
                        <!-- user.cleanup -->
diff --git a/com.woltlab.wcf/templates/usersOnlineInfoBox.tpl b/com.woltlab.wcf/templates/usersOnlineInfoBox.tpl
new file mode 100644 (file)
index 0000000..820926d
--- /dev/null
@@ -0,0 +1,30 @@
+{if !$usersOnlineShowRecord|isset}{assign var='usersOnlineShowRecord' value=true}{/if}
+{if MODULE_USERS_ONLINE && $usersOnlineList->stats[total]}
+       <li class="box32 usersOnlineInfoBox">
+               <span class="icon icon32 icon-user"></span>
+               
+               <div>
+                       <div class="containerHeadline">
+                               <h3><a href="{link controller='UsersOnlineList'}{/link}">{lang}wcf.user.usersOnline{/lang}</a> <span class="badge">{#$usersOnlineList->stats[total]}</span></h3>
+                               <p>{lang}wcf.user.usersOnline.detail{/lang}{if $usersOnlineShowRecord} - {lang}wcf.user.usersOnline.record{/lang}{/if}</p>
+                       </div>
+                       
+                       <ul class="dataList">
+                               {foreach from=$usersOnlineList->getObjects() item=userOnline}
+                                       <li><a href="{link controller='User' object=$userOnline->getDecoratedObject()}{/link}" class="userLink" data-user-id="{@$userOnline->userID}">{@$userOnline->getFormattedUsername()}</a></li>
+                               {/foreach}
+                       </ul>
+                       
+                       {if USERS_ONLINE_ENABLE_LEGEND && $usersOnlineList->getUsersOnlineMarkings()|count}
+                               <div class="usersOnlineLegend">
+                                       <p>{lang}wcf.user.usersOnline.marking.legend{/lang}:</p>
+                                       <ul class="dataList">
+                                               {foreach from=$usersOnlineList->getUsersOnlineMarkings() item=usersOnlineMarking}
+                                                       <li>{@$usersOnlineMarking}</li>
+                                               {/foreach}
+                                       </ul>
+                               </div>
+                       {/if}
+               </div>
+       </li>
+{/if}
\ No newline at end of file
index 914e00eddad18588b24faff223d37dfff2d70e97..59376e1c71db0033c79d21b95614dad1947acf97 100644 (file)
                </form>
        </div>
        
+       <fieldset>
+               <legend>{lang}wcf.user.usersOnline{/lang}</legend>
+               
+               <p><small>{lang}wcf.user.usersOnline.detail{/lang}</small></p>
+               <p><small>{lang}wcf.index.usersOnline.record{/lang}</small></p>
+               
+               {if USERS_ONLINE_ENABLE_LEGEND && $objects->getUsersOnlineMarkings()|count}
+                       <div class="marginTopSmall">
+                               <p><small>{lang}wcf.user.usersOnline.marking.legend{/lang}</small></p>
+                               <ul class="dataList">
+                                       {foreach from=$usersOnlineList->getUsersOnlineMarkings() item=usersOnlineMarking}
+                                               <li><small>{@$usersOnlineMarking}</small></li>
+                                       {/foreach}
+                               </ul>
+                       </div>
+               {/if}
+       </fieldset>
+       
        {@$__boxSidebar}
 {/capture}
 
index 01d9b03f1ff685ad14875cefac946fdd47e185ad..d836d0754fb0daf0dc36cb5e01cfd186cc907556 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\data\user\online;
+use wcf\data\option\OptionAction;
 use wcf\data\session\SessionList;
 use wcf\data\user\group\UserGroup;
 use wcf\data\user\User;
@@ -125,6 +126,21 @@ class UsersOnlineList extends SessionList {
                return $this->usersOnlineMarkings;
        }
        
+       /**
+        * Checks the users online record.
+        */
+       public function checkRecord() {
+               $usersOnlineTotal = (USERS_ONLINE_RECORD_NO_GUESTS ? $this->stats['members'] : $this->stats['total']);
+               if ($usersOnlineTotal > USERS_ONLINE_RECORD) {
+                       // save new record
+                       $optionAction = new OptionAction(array(), 'import', array('data' => array(
+                               'users_online_record' => $usersOnlineTotal,
+                               'users_online_record_time' => TIME_NOW
+                       )));
+                       $optionAction->executeAction();
+               }
+       }
+       
        /**
         * Checks the 'canViewOnlineStatus' setting.
         * 
index 020a2086fb8ec6c4470dcdc6560ba7ffbd9abfe7..02273924b6b07508c2a80aba0492c4039526de87 100644 (file)
@@ -76,6 +76,8 @@ class UsersOnlineListPage extends SortablePage {
         */
        protected function initObjectList() {
                parent::initObjectList();
+               $this->objectList->readStats();
+               $this->objectList->checkRecord();
                
                if (!USERS_ONLINE_SHOW_ROBOTS) {
                        $this->objectList->getConditionBuilder()->add('session.spiderID IS NULL');
index bf1faf7a72d5c6cdb1ae00a2913936b6e5c7e794..0810844729e5089410c48250a784708e9fcd1177 100644 (file)
 Beispiele:<br />
 WBB=WoltLab Burning Board<br />
 GmbH=Gesellschaft mit beschränkter Haftung]]></item>
+               <item name="wcf.acp.option.users_online_record_no_guests"><![CDATA[Nur registrierte Benutzer im Benutzer-Online-Rekord zählen]]></item>
+               <item name="wcf.acp.option.users_online_enable_legend"><![CDATA[Legende der Benutzergruppen unter der Benutzer-Online-Liste anzeigen]]></item>
        </category>
        
        <category name="wcf.acp.package">
@@ -2219,6 +2221,7 @@ Sollten Sie sich nicht auf der Website: {@PAGE_TITLE|language} angemeldet haben,
                <item name="wcf.user.usersOnline.lastActivity"><![CDATA[Letzte Aktivität]]></item>
                <item name="wcf.user.usersOnline.location.unknown"><![CDATA[Unbekannter Ort]]></item>
                <item name="wcf.user.usersOnline.robots"><![CDATA[Suchmaschinen-Roboter]]></item>
+               <item name="wcf.user.usersOnline.record"><![CDATA[{if USERS_ONLINE_RECORD > 0}Rekord: {#USERS_ONLINE_RECORD} Benutzer ({@USERS_ONLINE_RECORD_TIME|time}){/if}]]></item>
        </category>
        
        <category name="wcf.user.recentActivity">
index 0b8d02db88c228412aeb811a2983c95804b34254..e99fdaa2ce8144081c45518ec1a95b104c7e057f 100644 (file)
@@ -842,6 +842,8 @@ Examples for medium ID detection:
 Beispiele:<br />
 WBB=WoltLab Burning Board<br />
 GmbH=Gesellschaft mit beschränkter Haftung]]></item>
+               <item name="wcf.acp.option.users_online_enable_legendusers_online_record_no_guests"><![CDATA[Exclude guests from user online record]]></item>
+               <item name="wcf.acp.option.users_online_enable_legend"><![CDATA[Display legend for “Users Online” list]]></item>
        </category>
        
        <category name="wcf.acp.package">
@@ -2216,6 +2218,7 @@ You can safely ignore this email if you did not register with the website: {@PAG
                <item name="wcf.user.usersOnline.lastActivity"><![CDATA[Last Activity]]></item>
                <item name="wcf.user.usersOnline.location.unknown"><![CDATA[Unknown location]]></item>
                <item name="wcf.user.usersOnline.robots"><![CDATA[Search Engine Robots]]></item>
+               <item name="wcf.user.usersOnline.record"><![CDATA[{if USERS_ONLINE_RECORD > 0}Record: {#USERS_ONLINE_RECORD} User{if USERS_ONLINE_RECORD != 1}s{/if} ({@USERS_ONLINE_RECORD_TIME|time}){/if}]]></item>
        </category>
        
        <category name="wcf.user.recentActivity">