rbrindley: branch rbrindley/welcome_revamp r4281 - in /team/rbrindley/welcome...

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Wed Dec 3 19:16:46 CST 2008


Author: rbrindley
Date: Wed Dec  3 19:16:46 2008
New Revision: 4281

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

- added manager_event and manager_timers global vars
- added agents to have class 'agent_XXXX'
- removed loadAgents function (functionality in loadQueues)
- added manager_events.watch and manager.parseOutput functions to handle ami events
- added updateAgent to handle agent status for queues
	- currently handles agentcallbacklogin and agentcallbacklogoff
- added #today div to fix a bug with sysinfo


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

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=4281&r1=4280&r2=4281
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/welcome2.js (original)
+++ team/rbrindley/welcome_revamp/config/js/welcome2.js Wed Dec  3 19:16:46 2008
@@ -19,7 +19,9 @@
  *
  */
 
-var REGISTRY_OUTPUT = { } ;
+var REGISTRY_OUTPUT = {};
+var manager_events = {};
+var manager_timers = {};
 
 var loadTrunks = function() {
 	EX_CF = config2json({filename:'extensions.conf', usf:0 });
@@ -337,6 +339,7 @@
 
 				agent.removeClass('template');
 				agent.removeAttr('id');
+				agent.addClass('agent_'+a_exten);
 				agents.append(agent);
 
 				line_index++;
@@ -414,10 +417,6 @@
 		queue_conts[cont_index].append(queue);
 		cont_index = cont_index == 1 ? 0 : 1;
 	});
-};
-
-var loadAgents = function() {
-
 };
 
 var loadConferenceRooms = function() {
@@ -508,6 +507,88 @@
 	});
 };
 
+manager_events.watch = function() {
+	$.get( ASTGUI.paths.rawman, {action:'waitevent'}, function(op){ manager_events.parseOutput(op); });
+};
+
+manager_events.parseOutput = function(op) {
+	var event = op.toLowerCase();
+	event = event.split('\n');
+
+	switch (event[3].trim()) {
+	case 'event: agentcallbacklogin':
+		var agent = event[5].split(' ')[1];	
+		var loginchan = event[6].split(' ')[1];	
+		this.updateAgent("callbacklogin", agent, loginchan);
+		break;
+	case 'event: agentcallbacklogoff':
+		var agent = event[5].split(' ')[1];	
+		var loginchan = event[6].split(' ')[1];	
+		this.updateAgent("callbacklogoff", agent, loginchan);
+		break;
+	case 'event: agentcalled':
+	case 'event: agentcomplete':
+	case 'event: agentconnect':
+	case 'event: agentdump':
+	case 'event: agentlogin':
+	case 'event: agentlogoff':
+	case 'event: queuememberpaused':
+	case 'event: queuememberstatus':
+	case 'event: dial':
+	case 'event: extensionstatus':
+	case 'event: hangup':
+	case 'event: musiconhold':
+	case 'event: join':
+	case 'event: leave':
+	case 'event: link':
+	case 'event: meetmejoin':
+	case 'event: meetmeleave':
+	case 'event: meetmestoptalking':
+	case 'event: meetmetalking':
+	case 'event: messagewaiting':
+	case 'event: newcallerid':
+	case 'event: newchannel':
+	case 'event: newexten':
+	case 'event: parkedcall':
+	case 'event: rename':
+	case 'event: setcdruserfield':
+	case 'event: unlink':
+	case 'event: unparkedcall':
+	case 'event: alarm':
+	case 'event: alarmclear':
+	case 'event: dndstate':
+	case 'event: logchannel':
+	case 'event: peerstatus':
+	case 'event: registry':
+	case 'event: reload':
+	case 'event: shutdown':
+	case 'event: userevent':
+	case 'event: newstate':
+		break;
+	default:
+		//console.log(event[3]);
+		break;
+	}
+
+	this.watch();	
+};
+
+manager_events.updateAgent = function(event, agent, loginchan) {
+	/* The agent can belong to multiple queues, below will gather all of its locations*/
+	var agent_locs = $('#sys_status_queues .agent_'+agent.toString());
+
+	switch(event) {
+	case 'callbacklogin':
+		agent_locs.children('.status_icon').attr('src','images/agent_loggedin.png');
+		break;
+	case 'callbacklogoff':
+		agent_locs.children('.status_icon').attr('src','images/agent_loggedout.png');
+		break;
+	default:
+		break;
+	}
+};
+
 var pushRow = function(tbody, cells) {
 	var new_row = $("<tr></tr>");
 	for (var i=0; i < cells.length; i++) {

Modified: team/rbrindley/welcome_revamp/config/welcome2.html
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/welcome2.html?view=diff&rev=4281&r1=4280&r2=4281
==============================================================================
--- team/rbrindley/welcome_revamp/config/welcome2.html (original)
+++ team/rbrindley/welcome_revamp/config/welcome2.html Wed Dec  3 19:16:46 2008
@@ -384,7 +384,6 @@
 	setTimeout("loadTrunks()", 1);
 	loadExtensions();
 	setTimeout("loadQueues()", 1);
-	setTimeout("loadAgents()", 1);
 	setTimeout("loadConferenceRooms()", 1);
 	setTimeout("loadParkingLot()", 1);
 
@@ -403,6 +402,8 @@
 			cssDesc: "header_sort_down",
 			widgets: ['zebra']
 		});
+
+	manager_events.watch();
 
 	return;
  });
@@ -608,6 +609,7 @@
 						<B>Hostname:</B> <div id="hostname" style="font-family:courier; font-size:10pt;"></div><BR>
 						<B>OS Version:</B> <div id="osversion" style="font-family:courier; font-size:10pt;"></div><BR>
 						<B>Asterisk Build:</B> <div id="asterisk" style="font-family:courier; font-size:10pt;"></div><BR>
+						<B>Server Date & Timezone</B> <div id="today" style="font-family:courier; font-size:10pt;"></div><BR>
 						<B>Uptime:</B> <div id="uptime" style="font-family:courier; font-size:10pt;"></div><BR>
 					</div>
 					<div id="info_network" class="ui-tabs-panel">




More information about the asterisk-gui-commits mailing list