1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
<?php // $Id: chatinput.php,v 1.9 2005/02/12 10:54:25 skodak Exp $
$nomoodlecookie = true; // Session not needed!
require('../../../config.php');
require('../lib.php');
$chat_sid = required_param('chat_sid', PARAM_ALPHANUM);
if (!$chatuser = get_record('chat_users', 'sid', $chat_sid)) {
error('Not logged in!');
}
chat_force_language($chatuser->lang);
ob_start();
?>
<script type="text/javascript">
<!--
scroll_active = true;
function empty_field_and_submit() {
var cf = document.getElementById('sendform');
var inpf = document.getElementById('inputform');
cf.chat_msgidnr.value = parseInt(cf.chat_msgidnr.value) + 1;
cf.chat_message.value = inpf.chat_message.value;
inpf.chat_message.value='';
cf.submit();
inpf.chat_message.focus();
return false;
}
function prepareusers() {
var frm = window.parent.frames;
for(i = 0; i < frm.length; ++i) {
if(frm[i].name == "users") {
window.userFrame = frm[i];
window.userHREF = frm[i].location.href;
window.setTimeout("reloadusers();", <?php echo $CFG->chat_refresh_userlist; ?> * 1000);
}
}
}
function reloadusers() {
if(window.userFrame) {
window.userFrame.location.href = window.userFrame.location.href;
window.setTimeout("reloadusers();", <?php echo $CFG->chat_refresh_userlist; ?> * 1000);
}
}
// -->
</script>
<?php
$meta = ob_get_clean();
// TODO: there will be two onload in body tag, does it matter?
print_header('', '', '', 'inputform.chat_message', $meta, false, ' ', '', false, 'onload="setfocus(); prepareusers();"');
?>
<form action="../empty.php" method="get" target="empty" id="inputform"
onsubmit="return empty_field_and_submit();">
>><input type="text" name="chat_message" size="60" value="" />
<?php helpbutton("chatting", get_string("helpchatting", "chat"), "chat", true, false); ?>
</form>
<form action="<?php echo "http://$CFG->chat_serverhost:$CFG->chat_serverport/"; ?>" method="get" target="empty" id="sendform">
<input type="hidden" name="win" value="message" />
<input type="hidden" name="chat_message" value="" />
<input type="hidden" name="chat_msgidnr" value="0" />
<input type="hidden" name="chat_sid" value="<?php echo $chat_sid ?>" />
</form>
</body>
</html>
|