typo in javascript code, message submit did not work :-(

This commit is contained in:
skodak
2005-02-04 22:58:28 +00:00
parent 2ac0d13b6f
commit 342769e94d
+80 -80
View File
@@ -1,80 +1,80 @@
<?php // $Id$ <?php // $Id$
$nomoodlecookie = true; // Session not needed! $nomoodlecookie = true; // Session not needed!
require('../../../config.php'); require('../../../config.php');
require('../lib.php'); require('../lib.php');
$chat_sid = required_param('chat_sid', PARAM_ALPHANUM); $chat_sid = required_param('chat_sid', PARAM_ALPHANUM);
$groupid = optional_param('groupid', 0, PARAM_INT); $groupid = optional_param('groupid', 0, PARAM_INT);
if (!$chatuser = get_record('chat_users', 'sid', $chat_sid)) { if (!$chatuser = get_record('chat_users', 'sid', $chat_sid)) {
error('Not logged in!'); error('Not logged in!');
} }
chat_force_language($chatuser->lang); chat_force_language($chatuser->lang);
?> ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html> <html>
<head> <head>
<meta http-equiv="content-type" content="text/html; charset=<?php echo get_string('thischarset'); ?>" /> <meta http-equiv="content-type" content="text/html; charset=<?php echo get_string('thischarset'); ?>" />
<title>Message Input</title> <title>Message Input</title>
<?php <?php
$focus = ''; $focus = '';
include("$CFG->javascript"); include("$CFG->javascript");
?> ?>
<script type="text/javascript"> <script type="text/javascript">
<!-- <!--
scroll_active = true; scroll_active = true;
function empty_field_and_submit() { function empty_field_and_submit() {
var cf = document.getElementById('sendform'); var cf = document.getElementById('sendform');
var inpf = document.getElementById('inputform'); var inpf = document.getElementById('inputform');
cf.chat_msgidnr.value = parseInt(cf.chat_msgidnr.value) + 1; cf.chat_msgidnr.value = parseInt(cf.chat_msgidnr.value) + 1;
cf.chat_message.value = inpf.chat_message.value; cf.chat_message.value = inpf.chat_message.value;
cf.submit(); cf.submit();
inpf.chat_message.value=''; inpf.chat_message.value='';
inpf.chat_message.focus(); inpf.chat_message.focus();
return false; return false;
} }
function prepareusers() { function prepareusers() {
var frm = window.parent.frames; var frm = window.parent.frames;
for(i = 0; i < frm.length; ++i) { for(i = 0; i < frm.length; ++i) {
if(frm[i]).name == "users") { if(frm[i].name == "users") {
window.userFrame = frm[i]; window.userFrame = frm[i];
window.userHREF = frm[i].location.href; window.userHREF = frm[i].location.href;
window.setTimeout("reloadusers();", <?php echo $CFG->chat_refresh_userlist; ?> * 1000); window.setTimeout("reloadusers();", <?php echo $CFG->chat_refresh_userlist; ?> * 1000);
} }
} }
} }
function reloadusers() { function reloadusers() {
if(window.userFrame) { if(window.userFrame) {
window.userFrame.location.href = window.userFrame.location.href; window.userFrame.location.href = window.userFrame.location.href;
window.setTimeout("reloadusers();", <?php echo $CFG->chat_refresh_userlist; ?> * 1000); window.setTimeout("reloadusers();", <?php echo $CFG->chat_refresh_userlist; ?> * 1000);
} }
} }
// --> // -->
</script> </script>
</head> </head>
<body bgcolor="<?php echo $THEME->body ?>" onload="document.getElementById('inputform').chat_message.focus();document.getElementById('inputform').chat_message.select(); prepareusers();"> <body bgcolor="<?php echo $THEME->body ?>" onload="document.getElementById('inputform').chat_message.focus(); prepareusers();">
<form action="<?php echo "http://$CFG->chat_serverhost:$CFG->chat_serverport/"; ?>" method="get" target="empty" id="inputform" onsubmit="return empty_field_and_submit();"> <form action="../empty.php" method="get" target="empty" id="inputform" onsubmit="return empty_field_and_submit();">
&gt;&gt; <input type="text" name="chat_message" size="60" value="" /> &gt;&gt; <input type="text" name="chat_message" size="60" value="" />
<?php helpbutton("chatting", get_string("helpchatting", "chat"), "chat", true, false); ?> <?php helpbutton("chatting", get_string("helpchatting", "chat"), "chat", true, false); ?>
</form> </form>
<form action="<?php echo "http://$CFG->chat_serverhost:$CFG->chat_serverport/"; ?>" method="get" target="empty" id="sendform"> <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="win" value="message" />
<input type="hidden" name="chat_message" value="" /> <input type="hidden" name="chat_message" value="" />
<input type="hidden" name="chat_msgidnr" value="0" /> <input type="hidden" name="chat_msgidnr" value="0" />
<input type="hidden" name="chat_sid" value="<?php echo $chat_sid ?>" /> <input type="hidden" name="chat_sid" value="<?php echo $chat_sid ?>" />
<input type="hidden" name="groupid" value="<?php echo $groupid ?>" /> <input type="hidden" name="groupid" value="<?php echo $groupid ?>" />
</form> </form>
</body> </body>
</html> </html>