adding some strings
[moodle-linuxchix.git] / mod / chat / gui_sockets / chatinput.php
blobc33e2ccb86e85c7b5c069493110ca6c8872927de
1 <?php // $Id$
3 $nomoodlecookie = true; // Session not needed!
5 require('../../../config.php');
6 require('../lib.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!');
14 //Get the user theme
15 $USER = get_record('user', 'id', $chatuser->userid);
17 //Setup course, lang and theme
18 course_setup($chatuser->course);
20 ob_start();
22 <script type="text/javascript">
23 <!--
25 scroll_active = true;
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='';
32 cf.submit();
33 inpf.chat_message.focus();
34 return false;
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);
52 // -->
53 </script>
54 <?php
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, '&nbsp;', '', false, 'onload="setfocus(); prepareusers();"');
62 <form action="../empty.php" method="get" target="empty" id="inputform"
63 onsubmit="return empty_field_and_submit();">
64 &gt;&gt;<input type="text" name="chat_message" size="60" value="" />
65 <?php helpbutton("chatting", get_string("helpchatting", "chat"), "chat", true, false); ?>
66 </form>
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 ?>" />
73 </form>
74 </body>
76 </html>