rbrindley: branch rbrindley/welcome_revamp r4284 - /team/rbrindley/welcome_re...

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Thu Dec 4 16:21:45 CST 2008


Author: rbrindley
Date: Thu Dec  4 16:21:40 2008
New Revision: 4284

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=4284
Log:

- changed id field of extensions' first td from 'TD_DEVICE...' to 'exten_status_...'
- organized cases in parseOutput by implemented/not implemented and then alpha
- removed a few alerts used for testing
- implemented manager_events.updateExtension


Modified:
    team/rbrindley/welcome_revamp/config/js/welcome2.js

Modified: team/rbrindley/welcome_revamp/config/js/welcome2.js
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/js/welcome2.js?view=diff&rev=4284&r1=4283&r2=4284
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/welcome2.js (original)
+++ team/rbrindley/welcome_revamp/config/js/welcome2.js Thu Dec  4 16:21:40 2008
@@ -142,7 +142,7 @@
 		}
 
 		pushRow(exten_tbody, [
-			$("<td></td>").html(ASTGUI.getUser_DeviceStatus_Image(user)).attr("id","TD_USER_DEVICE_STATUS_"+user),
+			$("<td></td>").html(ASTGUI.getUser_DeviceStatus_Image(user)).attr("id","exten_status_"+user),
 			$("<td></td>").html(tmp_userstring),
 			$("<td></td>").html(ud.getProperty('fullname')),
 			$("<td></td>").html(tmp_mails_str),
@@ -538,6 +538,18 @@
 			var loginchan = event[2].split(' ')[1];	
 			this.updateAgent("callbacklogoff", agent, loginchan);
 			break;
+		case 'event: queuememberstatus':
+			var agent = event[4].split(' ')[1].split('/')[1];	//MemberName: 6000
+			var queue = event[2].split(' ')[1];			//Queue: 6501
+			var status = event[9].split(' ')[1];			//Status: 1
+			this.updateAgent('status_'+status.toString(), agent, queue);
+			break;
+		case 'event: extensionstatus':
+			var exten = event[2].split(' ')[1];	//Exten: SIP/6000
+			var context = event[3].split(' ')[1];	//Context: default
+			var status = event[4].split(' ')[1];	//Status: 1
+			this.updateExtension(exten, context, status);
+			break;
 		case 'event: agentcalled':
 		case 'event: agentcomplete':
 		case 'event: agentconnect':
@@ -545,18 +557,7 @@
 		case 'event: agentlogin':
 		case 'event: agentlogoff':
 		case 'event: queuememberpaused':
-		case 'event: queuememberstatus':
-			var agent = event[4].split(' ')[1].split('/')[1];	//MemberName: 6000
-			var queue = event[2].split(' ')[1];			//Queue: 6501
-			var status = event[9].split(' ')[1];			//Status: 1
-			this.updateAgent('status_'+status.toString(), agent, queue);
-			break;
 		case 'event: dial':
-		case 'event: extensionstatus':
-			var exten = event[2].split(' ')[1];	//Exten: SIP/6000
-			var context = event[3].split(' ')[1];	//Context: default
-			var status = event[4].split(' ')[1];	//Status: 1
-			this.updateExtension(exten, context, status);
 		case 'event: hangup':
 		case 'event: musiconhold':
 		case 'event: join':
@@ -585,7 +586,6 @@
 		case 'event: shutdown':
 		case 'event: userevent':
 		case 'event: newstate':
-			break;
 		default:
 			//console.log(event[3]);
 			break;
@@ -618,7 +618,6 @@
 		break;
 	case 'status_4': /* Invalid */
 		agent_locs.children('.status_icon').attr('src','images/agent_loggedout.png');
-		alert(event);
 		break;
 	case 'status_5': /* Not Available (Disconnected) */
 		agent_locs.children('.status_icon').attr('src','images/agent_loggedout.png');
@@ -633,24 +632,39 @@
 		agent_locs.children('.status_icon').attr('src','images/status_red.png');
 		break;
 	default:
-		alert(event);
+		alert('updateAgent: '+event.toString());
 		break;
 	}
 };
 
 manager_events.updateExtension = function(exten, context, status) {
-	switch(status) {
-	case 0:	/* Unknown */
-	case 1:	/* Not In Use */
-	case 2:	/* In Use */
-	case 3:	/* Busy */
-	case 4:	/* Invalid */
-	case 5:	/* Unavailable */
-	case 6:	/* Ringing */
-	case 7:	/* Ringing In Use */
-	case 8:	/* On Hold */
+	if ( exten.contains('/')) {
+		exten = exten.split('/')[1];	// SIP/6000
+	}
+	var exten_status_img = $('#exten_status_'+exten.toString()+' img');
+	switch(status.toString()) {
+	case '0':	/* Not In Use */
+		exten_status_img.attr('src','images/status_green.png');
+		break;
+	case '1':	/* In Use */
+	case '2':	/* Busy */
+	case '16':	/* On Hold */
+		exten_status_img.attr('src','images/status_red.png');
+		break;
+	case '-1':	/* Invalid */
+	case '4':	/* Unavailable */
+		exten_status_img.attr('src','images/status_gray.png');
+		break;
+	case '8':	/* Ringing */
+	case '9':	/* Ringing In Use */
+		exten_status_img.attr('src','images/status_orange.png');
+		break;
 	default:
-		alert(status);
+		alert('updateExtension:\r\n'
+			+'status: '+status.toString()
+			+'exten: '+exten.toString()
+			+'context: '+context.toString()
+		);
 		break;
 	}
 };




More information about the asterisk-gui-commits mailing list