diff --git a/file/lib/data/room/RoomAction.class.php b/file/lib/data/room/RoomAction.class.php index e7f3b81..c1ff418 100644 --- a/file/lib/data/room/RoomAction.class.php +++ b/file/lib/data/room/RoomAction.class.php @@ -206,5 +206,34 @@ public function leave() { // set current room to null ChatUtil::writeUserData(array('roomID' => null), $this->parameters['user']); + + \wcf\system\nodePush\NodePushHandler::getInstance()->sendMessage('be.bastelstu.chat.join'); + } + + /** + * Validates permissions. + */ + public function validateGetDashboardRoomList() { + if (!CHAT_ACTIVE) throw new \wcf\system\exception\IllegalLinkException(); + } + + /** + * Returns dashboard roomlist. + */ + public function getDashboardRoomList() { + $rooms = Room::getCache(); + + foreach ($rooms as $key => $room) { + if (!$room->canEnter()) unset($rooms[$key]); + } + + \wcf\system\WCF::getTPL()->assign(array( + 'rooms' => $rooms, + 'onlyList' => true + )); + + return array( + 'template' => \wcf\system\WCF::getTPL()->fetch('dashboardBoxOnlineList', 'chat') + ); } } diff --git a/file/lib/page/ChatPage.class.php b/file/lib/page/ChatPage.class.php index 3166080..c085abb 100644 --- a/file/lib/page/ChatPage.class.php +++ b/file/lib/page/ChatPage.class.php @@ -208,6 +208,7 @@ public function show() { \wcf\system\user\activity\point\UserActivityPointHandler::getInstance()->fireEvent('be.bastelstu.chat.activityPointEvent.join', $result, WCF::getUser()->userID); // break if not using ajax + \wcf\system\nodePush\NodePushHandler::getInstance()->sendMessage('be.bastelstu.chat.join'); if ($this->useTemplate) exit; @header('Content-type: application/json'); diff --git a/file/lib/system/dashboard/box/OnlineListDashboardBox.class.php b/file/lib/system/dashboard/box/OnlineListDashboardBox.class.php index b0b9aae..bdfde1c 100644 --- a/file/lib/system/dashboard/box/OnlineListDashboardBox.class.php +++ b/file/lib/system/dashboard/box/OnlineListDashboardBox.class.php @@ -24,6 +24,7 @@ class OnlineListDashboardBox extends \wcf\system\dashboard\box\AbstractContentDa public function init(\wcf\data\dashboard\box\DashboardBox $box, \wcf\page\IPage $page) { parent::init($box, $page); + if (!CHAT_ACTIVE) return; if (!\wcf\system\WCF::getUser()->userID) return; $this->rooms = data\room\Room::getCache(); diff --git a/template/dashboardBoxOnlineList.tpl b/template/dashboardBoxOnlineList.tpl index fdb7b01..acdcca5 100644 --- a/template/dashboardBoxOnlineList.tpl +++ b/template/dashboardBoxOnlineList.tpl @@ -1,34 +1,62 @@ -{hascontent} -
-

{lang}chat.header.menu.chat{/lang}

-
- -
- +{capture assign='roomList'} + {foreach from=$rooms item='room'} + {assign var='users' value=$room->getUsers()} + + {if $users|count > 0} +
  • +
    +
    +
    +

    {$room} {#$users|count}

    +

    {$room->topic|language}

    +
    + +
      + {foreach from=$users item='user'} +
    • {$user}
    • + {/foreach} +
    +
    +
    +
  • + {/if} + {/foreach} +{/capture} +{if $onlyList|isset} + {@$roomList} +{else} + -{/hascontent} \ No newline at end of file +{/if} \ No newline at end of file