1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10:08 +00:00

Read $_GET['id'] and pass it to template

This commit is contained in:
Tim Düsterhus 2011-11-26 17:19:34 +01:00
parent aabebd820e
commit 063fb644b0
3 changed files with 47 additions and 5 deletions

View File

@ -6,10 +6,15 @@
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat
*/
if (typeof TimWolla == undefined) var TimWolla = {};
if (typeof TimWolla.WCF == undefined) var TimWolla.WCF = {};
if (typeof TimWolla == 'undefined') var TimWolla = {};
if (typeof TimWolla.WCF == 'undefined') TimWolla.WCF = {};
var TimWolla.WCF.Chat = {};
(function ($, document) {
TimWolla.WCF.Chat = function(roomID, messageID) { this.init(roomID, messageID); };
TimWolla.WCF.Chat.prototype = {
init: function(roomID, messageID) {
history.replaceState({}, '', 'index.php/Chat/'+roomID);
}
};
})(jQuery, document);

View File

@ -1,5 +1,6 @@
<?php
namespace wcf\page;
use \wcf\system\WCF;
/**
* Shows the chat-interface
@ -11,8 +12,39 @@
* @subpackage page
*/
class ChatPage extends AbstractPage {
public $roomID = 0;
//public $neededModules = array('CHAT_ACTIVE');
//public $neededPermissions = array('user.chat.canEnter');
/**
* @see wcf\page\IPage::show()
* @see \wcf\page\IPage::assignVariables()
*/
public function assignVariables() {
parent::assignVariables();
WCF::getTPL()->assign(array(
'roomID' => $this->roomID
));
}
/**
* @see \wcf\page\IPage::readData()
*/
public function readData() {
parent::readData();
}
/**
* @see \wcf\page\IPage::readParameters()
*/
public function readParameters() {
parent::readParameters();
if (isset($_GET['id'])) $this->roomID = (int) $_GET['id'];
}
/**
* @see \wcf\page\IPage::show()
*/
public function show() {
\wcf\system\menu\page\PageMenu::getInstance()->setActiveMenuItem('wcf.header.menu.chat');

View File

@ -4,6 +4,11 @@
<title>{lang}wcf.chat.title{/lang} - {PAGE_TITLE|language}</title>
{include file='headInclude' sandbox=false}
<script type="text/javascript">
//<![CDATA[
new TimWolla.WCF.Chat({$roomID},1);
//]]>
</script>
</head>
<body id="tpl{$templateName|ucfirst}">