mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2025-01-09 00:20:08 +00:00
Room-Change via Ajax is functional now
This commit is contained in:
parent
1ac020f216
commit
65de6db578
@ -35,6 +35,16 @@ if (typeof TimWolla.WCF == 'undefined') TimWolla.WCF = {};
|
|||||||
window.history.replaceState({}, '', target.attr('href'));
|
window.history.replaceState({}, '', target.attr('href'));
|
||||||
$('.activeMenuItem .chatRoom').parent().removeClass('activeMenuItem');
|
$('.activeMenuItem .chatRoom').parent().removeClass('activeMenuItem');
|
||||||
target.parent().addClass('activeMenuItem');
|
target.parent().addClass('activeMenuItem');
|
||||||
|
$.ajax(target.attr('href'), {
|
||||||
|
dataType: 'json',
|
||||||
|
data: { ajax: 1 },
|
||||||
|
type: 'POST',
|
||||||
|
success: function (data, textStatus, jqXHR) {
|
||||||
|
$('#topic').text(data.topic);
|
||||||
|
if (data.topic == '') $('#topic').hide();
|
||||||
|
else $('#topic').show();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})(jQuery, document);
|
})(jQuery, document);
|
@ -77,6 +77,15 @@ public function readData() {
|
|||||||
'color1' => $this->userData['color'][1],
|
'color1' => $this->userData['color'][1],
|
||||||
'color2' => $this->userData['color'][2]
|
'color2' => $this->userData['color'][2]
|
||||||
));
|
));
|
||||||
|
if ($this->room->topic != '') {
|
||||||
|
chat\message\ChatMessageEditor::create(array(
|
||||||
|
'roomID' => $this->room->roomID,
|
||||||
|
'sender' => WCF::getUser()->userID,
|
||||||
|
'time' => TIME_NOW,
|
||||||
|
'type' => chat\message\ChatMessage::TYPE_INFORMATION,
|
||||||
|
'message' => WCF::getLanguage()->getDynamicVariable($this->room->topic)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
$this->readDefaultSmileys();
|
$this->readDefaultSmileys();
|
||||||
$this->readChatVersion();
|
$this->readChatVersion();
|
||||||
@ -96,7 +105,10 @@ public function readDefaultSmileys() {
|
|||||||
public function readParameters() {
|
public function readParameters() {
|
||||||
parent::readParameters();
|
parent::readParameters();
|
||||||
|
|
||||||
if (isset($_GET['id'])) $this->roomID = (int) $_GET['id'];
|
if (isset($_REQUEST['id'])) $this->roomID = (int) $_REQUEST['id'];
|
||||||
|
if (isset($_REQUEST['ajax'])) {
|
||||||
|
$this->useTemplate = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -162,5 +174,11 @@ public function show() {
|
|||||||
// remove index breadcrumb
|
// remove index breadcrumb
|
||||||
WCF::getBreadcrumbs()->remove(0);
|
WCF::getBreadcrumbs()->remove(0);
|
||||||
parent::show();
|
parent::show();
|
||||||
|
|
||||||
|
@header('Content-type: application/json');
|
||||||
|
echo \wcf\util\JSON::encode(array(
|
||||||
|
'topic' => WCF::getLanguage()->get($this->room->topic)
|
||||||
|
));
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
padding: 0px 15px 25px;
|
padding: 0px 15px 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.topic, #smileyList {
|
#topic, #smileyList {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +183,7 @@
|
|||||||
<div class="second column">
|
<div class="second column">
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<div class="topic border"{if !$room->topic|language} style="display: none;"{/if}>
|
<div class="border" id="topic"{if !$room->topic|language} style="display: none;"{/if}>
|
||||||
{$room->topic|language}
|
{$room->topic|language}
|
||||||
</div>
|
</div>
|
||||||
<div class="chatMessage border content">
|
<div class="chatMessage border content">
|
||||||
|
Loading…
Reference in New Issue
Block a user