New logic for controlling the current UI state

Thu, 18 Mar 2010 18:14:06 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 18 Mar 2010 18:14:06 +0000
changeset 23
ee84e7c22600
parent 22
54574593fa89
child 24
ae502df97907

New logic for controlling the current UI state

js/supportchat.js file | annotate | diff | comparison | revisions
--- a/js/supportchat.js	Thu Mar 18 18:13:39 2010 +0000
+++ b/js/supportchat.js	Thu Mar 18 18:14:06 2010 +0000
@@ -41,6 +41,16 @@
 
 /*** UI handling */
 
+var ui_state = "question";
+function set_ui_state(new_state)
+{
+	if(ui_state != new_state)
+	{
+		$("#support-"+ui_state).hide();
+		$("#support-"+(ui_state=new_state)).show();
+	}
+}
+
 /* Handle the user submitting the question form */
 function on_question_submit()
 {
@@ -50,12 +60,18 @@
 	
 	var our_nick = question_name;
 	
+	set_ui_state("wait");
+	
 	// Create our question room
 	var question_muc = new MUC(conn, {
 		joined: function (stanza, muc, nick)
 		{
 			if(nick == our_nick)
 				team_muc.join(support_config.team_rooms[question_type], our_nick);
+			else if(ui_state == "wait")
+			{
+				set_ui_state("converse");
+			}
 		}
 	});
 
@@ -100,14 +116,6 @@
 	$("#support-wait").show();
 }
 
-/* Update the UI according to whether we are
-   waiting on a network operation
-*/
-function set_busy_status(status)
-{
-	//FIXME
-}
-
 function display_ui()
 {
 	// Display pop-up, showing question form

mercurial