1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00

Add option to force a room selection

This commit is contained in:
Tim Düsterhus 2014-02-13 16:39:16 +01:00
parent 4d208f8893
commit 1c1f695ecd
4 changed files with 197 additions and 151 deletions

View File

@ -173,6 +173,10 @@ public function readRoom() {
if ($this->roomID === 0) {
// no room given
if (CHAT_FORCE_ROOM_SELECT) {
return;
}
else {
$room = reset($this->rooms);
if ($room === null) {
// no valid room found
@ -184,6 +188,7 @@ public function readRoom() {
)));
exit;
}
}
if (!isset($this->rooms[$this->roomID])) throw new exception\IllegalLinkException();
$this->room = $this->rooms[$this->roomID];

View File

@ -44,6 +44,8 @@ public function isVisible() {
* @see \wcf\system\menu\page\PageMenuItemProvider::getLink()
*/
public function getLink() {
if (CHAT_FORCE_ROOM_SELECT) return parent::getLink();
return \wcf\system\request\LinkHandler::getInstance()->getLink('Chat', array(
'application' => 'chat',
'object' => $this->room,

View File

@ -18,6 +18,11 @@
<optiontype>boolean</optiontype>
<defaultvalue>1</defaultvalue>
</option>
<option name="chat_force_room_select">
<categoryname>chat.general</categoryname>
<optiontype>boolean</optiontype>
<defaultvalue>0</defaultvalue>
</option>
<option name="chat_reloadtime">
<categoryname>chat.general</categoryname>
<optiontype>integer</optiontype>

View File

@ -1,9 +1,10 @@
{include file='documentHeader'}
<head>
<title>{$room} - {lang}chat.general.title{/lang} - {PAGE_TITLE|language}</title>
<title>{if $room}{$room} - {/if}{lang}chat.general.title{/lang} - {PAGE_TITLE|language}</title>
{include file='headInclude' sandbox=false}
{if $room}
{include file='javascriptInclude' application='chat'}
<script data-relocate="true">
//<![CDATA[
@ -74,9 +75,11 @@
})(jQuery, this);
//]]>
</script>
{/if}
</head>
<body id="tpl{$templateName|ucfirst}">
{if $room}
{capture assign='sidebar'}{include application='chat' file='sidebar'}{/capture}
{include file='header' sandbox=false sidebarOrientation='right'}
@ -152,6 +155,37 @@
*}<li><a id="timsChatMark" class="button timsChatToggle jsTooltip" title="{lang}chat.general.mark{/lang}" data-status="0"><span class="icon icon16 icon-check"></span><span class="invisible">{lang}chat.general.mark{/lang}</span></a></li>
</ul>
</nav>
{else}
{include file='header' sandbox=false}
<header class="boxHeadline">
<h1>{lang}chat.general.title{/lang}</h1>
</header>
<div class="container marginTop">
<ul class="containerList">
{foreach from=$rooms item='room'}
{assign var='users' value=$room->getUsers()}
<li>
<div>
<div>
<div class="containerHeadline">
<h3><a href="{link application='chat' controller='Chat' object=$room}{/link}">{$room}</a> <span class="badge">{#$users|count}</span></h3>
<p>{$room->topic|language}</p>
</div>
<ul class="dataList">
{foreach from=$users item='user'}
<li><a href="{link controller='User' object=$user}{/link}" class="userLink" data-user-id="{$user->userID}">{$user}</a></li>
{/foreach}
</ul>
</div>
</div>
</li>
{/foreach}
</ul>
</div>
{/if}
{include file='footer' sandbox=false}
</body>