# HG changeset patch # User matthew@heavyhorse.vm.bytemark.co.uk # Date 1271439333 -3600 # Node ID e5e70a46ace8cf6b3d8f6dcf54c2001e7012b62a # Parent 5cb47f4087a878b3e4f2734a69a8ee292639f10c Add set_assistant and show_message functions diff -r 5cb47f4087a8 -r e5e70a46ace8 support-chat/js/supportchat.js --- a/support-chat/js/supportchat.js Fri Apr 16 18:34:56 2010 +0100 +++ b/support-chat/js/supportchat.js Fri Apr 16 18:35:33 2010 +0100 @@ -65,6 +65,35 @@ } } +var current_assistant = null; +function set_assistant(new_assistant) +{ + if(new_assistant == null) + { + $("#support-assistant-name").text("No assistant present."); + question_muc.send_message("{System} There is now no active assistant"); + team_muc.send_message("Query has no active assistant"); + show_message(null, current_assistant + " has left, please stand by."); + } + else + { + $("#support-assistant-name").html("Assistant: "+htmlescape(new_assistant)); + question_muc.send_message("{System} "+new_assistant+": You are now the selected assistant"); + team_muc.send_message("Query being handled by "+new_assistant); + show_message(null, "You are now being assisted by " + new_assistant) + } + current_assistant = new_assistant; +} + +function show_message(nick, message) +{ + var html = ""; + if(nick) + html += "" + htmlescape(nick) + "" + ": "; + html += htmlescape(message) + "
\n"; + $("#support-log").append(html).scrollTop($("#support-log")[0].scrollHeight); +} + /* Handle the user submitting the question form */ function on_question_submit() {