From 30972c2bac125638df6a4375ba43ce7fabbe08ce Mon Sep 17 00:00:00 2001 From: samhemelryk Date: Fri, 26 Jun 2009 05:49:33 +0000 Subject: [PATCH] mod-chat MDL-16706 Removed inline JS and replaced with new PAGE methods Removed print_header $meta at same time as no longer used --- mod/chat/gui_header_js/chat_gui_header.js | 21 +++++++++++++++ mod/chat/gui_header_js/chatinput.php | 32 ++--------------------- 2 files changed, 23 insertions(+), 30 deletions(-) create mode 100644 mod/chat/gui_header_js/chat_gui_header.js diff --git a/mod/chat/gui_header_js/chat_gui_header.js b/mod/chat/gui_header_js/chat_gui_header.js new file mode 100644 index 0000000000..7c7540054d --- /dev/null +++ b/mod/chat/gui_header_js/chat_gui_header.js @@ -0,0 +1,21 @@ +var waitFlag = false; +function empty_field_and_submit() { + if(waitFlag) { + return false; + } + waitFlag = true; + var input_chat_message = document.getElementById('input_chat_message'); + document.getElementById('sendForm').chat_message.value = input_chat_message.value; + input_chat_message.value = ''; + input_chat_message.className = 'wait'; + document.getElementById('sendForm').submit(); + enableForm(); + return false; +} + +function enableForm() { + var input_chat_message = document.getElementById('input_chat_message'); + waitFlag = false; + input_chat_message.className = ''; + input_chat_message.focus(); +} \ No newline at end of file diff --git a/mod/chat/gui_header_js/chatinput.php b/mod/chat/gui_header_js/chatinput.php index 027ee59d42..2729a6e18e 100644 --- a/mod/chat/gui_header_js/chatinput.php +++ b/mod/chat/gui_header_js/chatinput.php @@ -31,37 +31,9 @@ //Setup course, lang and theme $PAGE->set_course($course); + $PAGE->requires->js('mod/chat/gui_header_js/chat_gui_header.js'); - ob_start(); - ?> - -