3 $nomoodlecookie = true; // Session not needed!
5 require('../../../config.php');
8 $chat_sid = required_param('chat_sid', PARAM_ALPHANUM
);
10 if (!$chatuser = get_record('chat_users', 'sid', $chat_sid)) {
11 error('Not logged in!');
15 $USER = get_record('user', 'id', $chatuser->userid
);
17 //Setup course, lang and theme
18 course_setup($chatuser->course
);
22 <script type
="text/javascript">
26 function empty_field_and_submit() {
27 var cf
= document
.getElementById('sendform');
28 var inpf
= document
.getElementById('inputform');
29 cf
.chat_msgidnr
.value
= parseInt(cf
.chat_msgidnr
.value
) +
1;
30 cf
.chat_message
.value
= inpf
.chat_message
.value
;
31 inpf
.chat_message
.value
='';
33 inpf
.chat_message
.focus();
36 function prepareusers() {
37 var frm
= window
.parent
.frames
;
38 for(i
= 0; i
< frm
.length
; ++i
) {
39 if(frm
[i
].name
== "users") {
40 window
.userFrame
= frm
[i
];
41 window
.userHREF
= frm
[i
].location
.href
;
42 window
.setTimeout("reloadusers();", <?php
echo $CFG->chat_refresh_userlist
; ?
> * 1000);
46 function reloadusers() {
47 if(window
.userFrame
) {
48 window
.userFrame
.location
.href
= window
.userFrame
.location
.href
;
49 window
.setTimeout("reloadusers();", <?php
echo $CFG->chat_refresh_userlist
; ?
> * 1000);
56 $meta = ob_get_clean();
57 // TODO: there will be two onload in body tag, does it matter?
58 print_header('', '', '', 'inputform.chat_message', $meta, false, ' ', '', false, 'onload="setfocus(); prepareusers();"');
62 <form action
="../empty.php" method
="get" target
="empty" id
="inputform"
63 onsubmit
="return empty_field_and_submit();">
64 >
;>
;<input type
="text" name
="chat_message" size
="60" value
="" />
65 <?php
helpbutton("chatting", get_string("helpchatting", "chat"), "chat", true, false); ?
>
68 <form action
="<?php echo "http
://$CFG->chat_serverhost:$CFG->chat_serverport/"; ?>" method="get" target="empty" id="sendform">
69 <input type
="hidden" name
="win" value
="message" />
70 <input type
="hidden" name
="chat_message" value
="" />
71 <input type
="hidden" name
="chat_msgidnr" value
="0" />
72 <input type
="hidden" name
="chat_sid" value
="<?php echo $chat_sid ?>" />