From: samhemelryk Date: Fri, 26 Jun 2009 06:53:23 +0000 (+0000) Subject: mod-chat MDL-16706 Removed inline JS and replaced with new PAGE methods X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=0763ab2c65378c898b4225bb1733f6aa62baf7db;p=moodle.git mod-chat MDL-16706 Removed inline JS and replaced with new PAGE methods --- diff --git a/mod/chat/gui_sockets/chat_gui_sockets.js b/mod/chat/gui_sockets/chat_gui_sockets.js new file mode 100644 index 0000000000..68a8d1b433 --- /dev/null +++ b/mod/chat/gui_sockets/chat_gui_sockets.js @@ -0,0 +1,14 @@ +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 setfocus() { + document.getElementsByName("chat_message")[0].focus(); +} \ No newline at end of file diff --git a/mod/chat/gui_sockets/chatinput.php b/mod/chat/gui_sockets/chatinput.php index 53dbc5c1b9..71c9e28ea9 100644 --- a/mod/chat/gui_sockets/chatinput.php +++ b/mod/chat/gui_sockets/chatinput.php @@ -16,30 +16,10 @@ //Setup course, lang and theme $PAGE->set_course($DB->get_record('course', array('id' => $chatuser->course))); - - ob_start(); - ?> - - requires->js('mod/chat/gui_sockets/chat_gui_sockets.js')->in_head(); + $PAGE->requires->js_function_call('setfocus'); // TODO: there will be two onload in body tag, does it matter? - print_header('', '', '', 'inputform.chat_message', $meta, false, ' ', '', false, 'onload="setfocus();"'); + print_header('', '', '', 'inputform.chat_message', '', false, ' ', '', false); ?>