MDL-8323 finished full conversion to proper $COURSE global - no more $CFG->coursethem...
[moodle.git] / mod / chat / gui_header_js / chatinput.php
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!');
12     }
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();
21     ?>
22     <script type="text/javascript">
23     //<![CDATA[
24     var waitFlag = false;
25     function empty_field_and_submit() {
26         if(waitFlag) return false;
27         waitFlag = true;
28         var input_chat_message = document.getElementById('input_chat_message');
29         document.getElementById('sendForm').chat_message.value = input_chat_message.value;
30         input_chat_message.value = '';
31         input_chat_message.className = 'wait';
32         document.getElementById('sendForm').submit();
33         enableForm();
34         return false;
35     }
37     function enableForm() {
38         var input_chat_message = document.getElementById('input_chat_message');
39         waitFlag = false;
40         input_chat_message.className = '';
41         input_chat_message.focus();
42     }
44     //]]>
45     </script>
46     <?php
48     $meta = ob_get_clean();
49     print_header('', '', '', 'input_chat_message', $meta, false);
51 ?>
52     <form action="../empty.php" method="post" target="empty" id="inputForm"
53           onsubmit="return empty_field_and_submit()">
54         &gt;&gt;<input type="text" id="input_chat_message" name="chat_message" size="60" value="" />
55         <?php helpbutton('chatting', get_string('helpchatting', 'chat'), 'chat', true, false); ?>
56     </form>
58     <form action="insert.php" method="post" target="empty" id="sendForm">
59         <input type="hidden" name="chat_sid" value="<?php echo $chat_sid ?>" />
60         <input type="hidden" name="chat_message" />
61     </form>
62 </div>
63 </div>
64 </body>
65 </html>