MDL-8323 finished full conversion to proper $COURSE global - no more $CFG->coursethem...
[moodle.git] / mod / chat / gui_header_js / chatinput.php
CommitLineData
516121bd 1<?php // $Id$
1515a89e 2
516121bd 3 $nomoodlecookie = true; // Session not needed!
1515a89e 4
516121bd 5 require('../../../config.php');
6 require('../lib.php');
f7e648da 7
516121bd 8 $chat_sid = required_param('chat_sid', PARAM_ALPHANUM);
f7e648da 9
516121bd 10 if (!$chatuser = get_record('chat_users', 'sid', $chat_sid)) {
11 error('Not logged in!');
12 }
f7e648da 13
aa5c32fd 14 //Get the user theme
9152fc99 15 $USER = get_record('user', 'id', $chatuser->userid);
aa5c32fd 16
9152fc99 17 //Setup course, lang and theme
18 course_setup($chatuser->course);
1515a89e 19
516121bd 20 ob_start();
21 ?>
f4ba7e1a 22 <script type="text/javascript">
0cdf34fb 23 //<![CDATA[
07b76bad 24 var waitFlag = false;
516121bd 25 function empty_field_and_submit() {
07b76bad 26 if(waitFlag) return false;
27 waitFlag = true;
28 var input_chat_message = document.getElementById('input_chat_message');
9152fc99 29 document.getElementById('sendForm').chat_message.value = input_chat_message.value;
07b76bad 30 input_chat_message.value = '';
31 input_chat_message.className = 'wait';
9152fc99 32 document.getElementById('sendForm').submit();
4d038740 33 enableForm();
516121bd 34 return false;
35 }
07b76bad 36
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 }
43
0cdf34fb 44 //]]>
516121bd 45 </script>
46 <?php
1515a89e 47
516121bd 48 $meta = ob_get_clean();
b7dc2256 49 print_header('', '', '', 'input_chat_message', $meta, false);
1515a89e 50
516121bd 51?>
b7dc2256 52 <form action="../empty.php" method="post" target="empty" id="inputForm"
0cdf34fb 53 onsubmit="return empty_field_and_submit()">
07b76bad 54 &gt;&gt;<input type="text" id="input_chat_message" name="chat_message" size="60" value="" />
516121bd 55 <?php helpbutton('chatting', get_string('helpchatting', 'chat'), 'chat', true, false); ?>
56 </form>
57
b7dc2256 58 <form action="insert.php" method="post" target="empty" id="sendForm">
516121bd 59 <input type="hidden" name="chat_sid" value="<?php echo $chat_sid ?>" />
60 <input type="hidden" name="chat_message" />
61 </form>
d3cc8d56 62</div>
63</div>
1515a89e 64</body>
3dfd307f 65</html>