From 11e9145a428d164faa26da0a883f3706f0e8cc69 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Wed, 25 Sep 2013 22:24:32 +0200 Subject: [PATCH] Moved user online record from wbb into wcf --- com.woltlab.wcf/option.xml | 22 ++++++++++++++ .../templates/usersOnlineInfoBox.tpl | 30 +++++++++++++++++++ com.woltlab.wcf/templates/usersOnlineList.tpl | 18 +++++++++++ .../user/online/UsersOnlineList.class.php | 16 ++++++++++ .../lib/page/UsersOnlineListPage.class.php | 2 ++ wcfsetup/install/lang/de.xml | 3 ++ wcfsetup/install/lang/en.xml | 3 ++ 7 files changed, 94 insertions(+) create mode 100644 com.woltlab.wcf/templates/usersOnlineInfoBox.tpl diff --git a/com.woltlab.wcf/option.xml b/com.woltlab.wcf/option.xml index 6ef779d70e..4bfbce98bd 100644 --- a/com.woltlab.wcf/option.xml +++ b/com.woltlab.wcf/option.xml @@ -946,6 +946,28 @@ DESC:wcf.global.sortOrder.descending]]> 0 0 + + + + diff --git a/com.woltlab.wcf/templates/usersOnlineInfoBox.tpl b/com.woltlab.wcf/templates/usersOnlineInfoBox.tpl new file mode 100644 index 0000000000..820926d11f --- /dev/null +++ b/com.woltlab.wcf/templates/usersOnlineInfoBox.tpl @@ -0,0 +1,30 @@ +{if !$usersOnlineShowRecord|isset}{assign var='usersOnlineShowRecord' value=true}{/if} +{if MODULE_USERS_ONLINE && $usersOnlineList->stats[total]} +
  • + + +
    +
    +

    {lang}wcf.user.usersOnline{/lang} {#$usersOnlineList->stats[total]}

    +

    {lang}wcf.user.usersOnline.detail{/lang}{if $usersOnlineShowRecord} - {lang}wcf.user.usersOnline.record{/lang}{/if}

    +
    + + + + {if USERS_ONLINE_ENABLE_LEGEND && $usersOnlineList->getUsersOnlineMarkings()|count} +
    +

    {lang}wcf.user.usersOnline.marking.legend{/lang}:

    +
      + {foreach from=$usersOnlineList->getUsersOnlineMarkings() item=usersOnlineMarking} +
    • {@$usersOnlineMarking}
    • + {/foreach} +
    +
    + {/if} +
    +
  • +{/if} \ No newline at end of file diff --git a/com.woltlab.wcf/templates/usersOnlineList.tpl b/com.woltlab.wcf/templates/usersOnlineList.tpl index 914e00edda..59376e1c71 100644 --- a/com.woltlab.wcf/templates/usersOnlineList.tpl +++ b/com.woltlab.wcf/templates/usersOnlineList.tpl @@ -63,6 +63,24 @@ +
    + {lang}wcf.user.usersOnline{/lang} + +

    {lang}wcf.user.usersOnline.detail{/lang}

    +

    {lang}wcf.index.usersOnline.record{/lang}

    + + {if USERS_ONLINE_ENABLE_LEGEND && $objects->getUsersOnlineMarkings()|count} +
    +

    {lang}wcf.user.usersOnline.marking.legend{/lang}

    +
      + {foreach from=$usersOnlineList->getUsersOnlineMarkings() item=usersOnlineMarking} +
    • {@$usersOnlineMarking}
    • + {/foreach} +
    +
    + {/if} +
    + {@$__boxSidebar} {/capture} diff --git a/wcfsetup/install/files/lib/data/user/online/UsersOnlineList.class.php b/wcfsetup/install/files/lib/data/user/online/UsersOnlineList.class.php index 01d9b03f1f..d836d0754f 100644 --- a/wcfsetup/install/files/lib/data/user/online/UsersOnlineList.class.php +++ b/wcfsetup/install/files/lib/data/user/online/UsersOnlineList.class.php @@ -1,5 +1,6 @@ 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. * diff --git a/wcfsetup/install/files/lib/page/UsersOnlineListPage.class.php b/wcfsetup/install/files/lib/page/UsersOnlineListPage.class.php index 020a2086fb..02273924b6 100644 --- a/wcfsetup/install/files/lib/page/UsersOnlineListPage.class.php +++ b/wcfsetup/install/files/lib/page/UsersOnlineListPage.class.php @@ -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'); diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index bf1faf7a72..0810844729 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -843,6 +843,8 @@ Beispiele:
    WBB=WoltLab Burning Board
    GmbH=Gesellschaft mit beschränkter Haftung]]> + + @@ -2219,6 +2221,7 @@ Sollten Sie sich nicht auf der Website: {@PAGE_TITLE|language} angemeldet haben, + 0}Rekord: {#USERS_ONLINE_RECORD} Benutzer ({@USERS_ONLINE_RECORD_TIME|time}){/if}]]> diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 0b8d02db88..e99fdaa2ce 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -842,6 +842,8 @@ Examples for medium ID detection: Beispiele:
    WBB=WoltLab Burning Board
    GmbH=Gesellschaft mit beschränkter Haftung]]> + +
    @@ -2216,6 +2218,7 @@ You can safely ignore this email if you did not register with the website: {@PAG + 0}Record: {#USERS_ONLINE_RECORD} User{if USERS_ONLINE_RECORD != 1}s{/if} ({@USERS_ONLINE_RECORD_TIME|time}){/if}]]> -- 2.20.1