mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Make tab appear when chat message is sent from supervisor
This commit is contained in:
@@ -274,7 +274,7 @@ xhtml_object($data,"main-content");
|
|||||||
|
|
||||||
<?php if ($chat) { ?>
|
<?php if ($chat) { ?>
|
||||||
<div class="tabbertab <?php if ((DEFAULT_TAB == 'chat' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'chat' && $appointment))
|
<div class="tabbertab <?php if ((DEFAULT_TAB == 'chat' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'chat' && $appointment))
|
||||||
print "tabbertabdefault"; ?>">
|
print "tabbertabdefault"; ?>" id="tab-chat">
|
||||||
<h2><?php echo T_("Supervisor chat"); ?></h2>
|
<h2><?php echo T_("Supervisor chat"); ?></h2>
|
||||||
<div id="div-supervisorchat" class="tabberdiv"><?php xhtml_object("supervisorchat.php","main-supervisorchat");?></div>
|
<div id="div-supervisorchat" class="tabberdiv"><?php xhtml_object("supervisorchat.php","main-supervisorchat");?></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -33,11 +33,26 @@ function OnMessageStanza(stanza)
|
|||||||
//alert(sFrom + ':' + sType + ':' + sBody + ':' + sBareJid);
|
//alert(sFrom + ':' + sType + ':' + sBody + ':' + sBareJid);
|
||||||
// do something, e.g. show sBody with jQuer
|
// do something, e.g. show sBody with jQuer
|
||||||
|
|
||||||
//make sure the chat tab is in focus when an incoming messages appears
|
|
||||||
|
|
||||||
//display message as new row in message table if it is from the supervisor
|
//display message as new row in message table if it is from the supervisor
|
||||||
if (sBareJid == SUPERVISOR_XMPP)
|
if (sBareJid == SUPERVISOR_XMPP)
|
||||||
{
|
{
|
||||||
|
//make sure the chat tab is in focus when an incoming messages appears
|
||||||
|
|
||||||
|
//find the index of div-supervisorchat (children of tab-main)
|
||||||
|
var tm = parent.document.getElementById('tab-main')
|
||||||
|
var i = 0;
|
||||||
|
|
||||||
|
for (i=0;i<tm.children.length;i++)
|
||||||
|
{
|
||||||
|
if (tm.children[i].id == 'tab-chat')
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tm.tabber.tabShow(i-1);
|
||||||
|
|
||||||
var html = '<tr><td>' + SUPERVISOR_NAME + '</td><td>' + sBody + '</td></tr>';
|
var html = '<tr><td>' + SUPERVISOR_NAME + '</td><td>' + sBody + '</td></tr>';
|
||||||
$('#chattable > tbody > tr').eq(0).after(html);
|
$('#chattable > tbody > tr').eq(0).after(html);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ if ($chatenabled && operator_chat_enabled($operator_id))
|
|||||||
print "<div style='display:none' id='statusavailable'>" . T_("Supervisor is available") . "</div>";
|
print "<div style='display:none' id='statusavailable'>" . T_("Supervisor is available") . "</div>";
|
||||||
print "<div id='statusunavailable'>" . T_("Supervisor not available") . "</div>";
|
print "<div id='statusunavailable'>" . T_("Supervisor not available") . "</div>";
|
||||||
|
|
||||||
print "<div id='chatbox'><input type='text' id='chattext'/> <div id='chatclick'>" . T_("Send") . "</div></div>";
|
print "<div id='chatbox'><label for='chattext'>" . T_("Message") . ":</label><input type='text' id='chattext'/> <input type='submit' id='chatclick' value='" . T_("Send") . "'/></div>";
|
||||||
|
|
||||||
//table for chat messages
|
//table for chat messages
|
||||||
print "<table class='tclass' id='chattable'><tbody><tr><th>" . T_("From") . "</th><th>" . T_("Message") . "</th></tr></tbody></table>";
|
print "<table class='tclass' id='chattable'><tbody><tr><th>" . T_("From") . "</th><th>" . T_("Message") . "</th></tr></tbody></table>";
|
||||||
|
|||||||
Reference in New Issue
Block a user