1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40: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> * @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
* @package timwolla.wcf.chat * @package timwolla.wcf.chat
*/ */
if (typeof TimWolla == undefined) var TimWolla = {}; if (typeof TimWolla == 'undefined') var TimWolla = {};
if (typeof TimWolla.WCF == undefined) var TimWolla.WCF = {}; if (typeof TimWolla.WCF == 'undefined') TimWolla.WCF = {};
var TimWolla.WCF.Chat = {};
(function ($, document) { (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); })(jQuery, document);

View File

@ -1,5 +1,6 @@
<?php <?php
namespace wcf\page; namespace wcf\page;
use \wcf\system\WCF;
/** /**
* Shows the chat-interface * Shows the chat-interface
@ -11,8 +12,39 @@
* @subpackage page * @subpackage page
*/ */
class ChatPage extends AbstractPage { 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() { public function show() {
\wcf\system\menu\page\PageMenu::getInstance()->setActiveMenuItem('wcf.header.menu.chat'); \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> <title>{lang}wcf.chat.title{/lang} - {PAGE_TITLE|language}</title>
{include file='headInclude' sandbox=false} {include file='headInclude' sandbox=false}
<script type="text/javascript">
//<![CDATA[
new TimWolla.WCF.Chat({$roomID},1);
//]]>
</script>
</head> </head>
<body id="tpl{$templateName|ucfirst}"> <body id="tpl{$templateName|ucfirst}">