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

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Fri Dec 5 16:52:43 CST 2008


Author: rbrindley
Date: Fri Dec  5 16:52:43 2008
New Revision: 4307

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

- changed loadConferences to read from 'show channels concise' instead of 'meetme' 
- implemented members in loadConferences
- removed active_count in loadConferences
- added hrs to html2secs and secs2html


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=4307&r1=4306&r2=4307
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/welcome2.js (original)
+++ team/rbrindley/welcome_revamp/config/js/welcome2.js Fri Dec  5 16:52:43 2008
@@ -431,29 +431,50 @@
 	var conf_body = $('#sys_status_meetme > .body');
 	var active_conferences = {};
 
-	var meetme_status = ASTGUI.cliCommand('meetme');
-	meetme_status = parent.ASTGUI.parseCLIResponse(meetme_status);
-	if ( meetme_status.contains('No active MeetMe conferences') ){
-		// No active MeetMe conferences.
-	}else{
-		// sx00i*CLI> meetme
-		// Conf Num       Parties        Marked     Activity  Creation
-		// 6302           0001           N/A        00:00:09  Static
-		// 6300           0001           N/A        00:02:51  Static
-		// * Total number of MeetMe users: 2
-		meetme_status = meetme_status.split('\n');
-		while( meetme_status.length ){
-			var this_line = meetme_status[0];
-			meetme_status.removeFirst();
-			this_line = this_line.trim();
-			if( !this_line || this_line.beginsWith('Conf Num') ||  this_line.beginsWith('* Total number') ) { 
-				continue; 
-			}
-			var tmp_vars = this_line.split(/\s+/); // ['6302','0001','N/A','00:00:09', 'Static' ]
-			active_conferences[ tmp_vars[0] ] = {} ;
-			active_conferences[ tmp_vars[0] ]['count'] = tmp_vars[1] ;
-			active_conferences[ tmp_vars[0] ]['duration'] = tmp_vars[3] ;
-		}
+	var show_chans = ASTGUI.cliCommand('show channels concise');
+	// DAHDI/pseudo-1529934219!default!s!1!Rsrvd!(None)!!!!3!1086!(None)
+	// SIP/6001-081f6500!DLPN_users!6300!1!Up!MeetMe!6300|MIx!6001!!3!1086!(None)
+	show_chans = parent.ASTGUI.parseCLIResponse(show_chans);
+	var chans = show_chans.trim().split('\n');
+
+	for (var i=0; i<chans.length; i++) {
+		var chan = chans[i].trim();
+		if (chan.length == 0) {
+			continue;
+		}
+
+		chan = chan.split('!');
+		/* 0. Channel		1. Context	2. Extension	3. Prio		4. State
+		*  5. Application	6. Data		7. CallerID	8. <blank>	9. AccountCode
+		*  10. Duration		10. BridgedTo 						*/
+		if (chan[5].toLowerCase() != 'meetme') {
+			continue;
+		}
+
+		var conf_room = chan[6].match('[\\w\\d][\\d\\w]*(?=[\\||,])');
+
+		if (active_conferences[conf_room]) {
+	/* Existing Conf */
+			var conf = active_conferences[conf_room];
+			var tmp_dur = parseInt(chan[10]);
+			conf.duration = conf.duration < tmp_dur ? tmp_dur : conf.duration;
+		} else {
+	/* New Conf */
+			var conf = {};
+			conf.id = conf_room;
+			conf.count = 0;
+			conf.duration = parseInt(chan[10]);
+			conf.users = new Array();
+		}
+		
+		var user = {};
+		user.cid = chan[7];
+		user.duration = chan[10];
+
+		conf.count++;
+		conf.users.push(user);
+
+		active_conferences[conf_room] = conf;
 	}
 
 	var active_count = 0;
@@ -464,26 +485,33 @@
 		}
 
 		var tmp = conf_template.clone();
+		var users_template = conf_template.contents().find('.members tr.template');
 
 		tmp.contents().find(".name").html(l);
 		if( active_conferences.hasOwnProperty(l) ) {
 			active_count++;
 			tmp.contents().find(".status").html(Number(active_conferences[l].count) + ' Users');
-			tmp.contents().find(".time").html(active_conferences[l].duration);
-			//newcell.innerHTML =  l + '<BR><font color=red>' + Number(active_conferences[l].count) + ' Users</font> - ' + active_conferences[l].duration ;
+			tmp.contents().find(".time").addClass('count_html_up').html(secs2html(active_conferences[l].duration));
+			
+			var conf_list_tbody = tmp.contents().find('.members > .list > tbody').empty();
+			while ( user = active_conferences[l].users.pop() ) {
+				var new_row = users_template.clone();
+				new_row.children('.extension').html(user.cid);
+				new_row.children('.duration').addClass('count_html_up').html(secs2html(user.duration));
+				new_row.children('.mem_status').html('Active');
+
+				new_row.removeClass('template');
+				conf_list_tbody.append(new_row);
+			}
+
 		}else{
 			tmp.contents().find(".status").html('Not In Use');
 			tmp.contents().find(".time").html("00:00");
-		}
-		tmp.contents().find(".members > .list > tbody").empty().html('<tr><td colspan="4">Not yet implemented</td></tr>');
+			tmp.contents().find(".members > .list > tbody").empty().html('<tr><td colspan="4">No Active Members</td></tr>');
+		}
 
 		tmp.appendTo(conf_body);
 		tmp.removeClass("template");
-	}
-
-	if(active_count){
-		if(manager_timers.conferences){ clearTimeout ( manager_timers.conferences ) } ;
-		manager_timers.conferences = setTimeout ( update_Conferences_Table , 5000 ) ;
 	}
 };
 
@@ -860,9 +888,11 @@
 };
 
 var html2secs = function(html) {
-	html = html.split(':');
-
-	if (html[0].toString() != '00') {
+	html = html.trim().split(':');
+
+	if (html.length == 3) {
+		return (parseInt(html[0]) * 60*60) + (parseInt(html[1]) * 60) + parseInt(html[2]);
+	} else if (html[0].toString() != '00') {
 		return ((parseInt(html[0])*60)+parseInt(html[1]));
 	} else {
 		return parseInt(html[1]);
@@ -871,8 +901,14 @@
 
 var secs2html = function(secs) {
 	var mins = Math.floor(secs/60);
+	var hrs = Math.floor(mins/60);
+	mins = mins % 60;
 	secs = secs % 60;
-	return ''+mins.toString()+':'+(secs<10?'0':'')+secs.toString();
+	if (hrs != 0) {
+		return (''+hrs.toString()+':'+mins.toString()+':'+(secs<10?'0':'')+secs.toString());
+	} else {
+		return (''+mins.toString()+':'+(secs<10?'0':'')+secs.toString());
+	}
 };
 
 var pushRow = function(tbody, cells) {

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=4307&r1=4306&r2=4307
==============================================================================
--- team/rbrindley/welcome_revamp/config/welcome2.html (original)
+++ team/rbrindley/welcome_revamp/config/welcome2.html Fri Dec  5 16:52:43 2008
@@ -570,11 +570,12 @@
 							<div class="members">
 								<table class="list">
 								<tbody>
-								<tr>
+								<tr class="template">
 									<td class="checkbox"><img src="images/checkbox_blank.gif" /></td>
 									<td class="person"><img src="images/agent_loggedin.png" /></td>
 									<td class="extension"></td>
 									<td class="mem_status"></td>
+									<td class="duration"></td>
 								</tr>
 								</tbody>
 								</table>




More information about the asterisk-gui-commits mailing list