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

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Mon Dec 8 12:43:12 CST 2008


Author: rbrindley
Date: Mon Dec  8 12:43:10 2008
New Revision: 4308

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

- added id attributes to conf divs
- abstracted out add conf member code into addMeetmeMember func
- moved conf appendTo func above add member code to comply with addMeetmeMember func
- implemented meetmejoin, meetmeleave, and meetmetalking cases in parseOutput's event switchcase
- removed meetmestoptalking as its not in 1.4 and on; replaced with status: off in meetmetalking
- added and implemented manager_events.(meetmejoin, meetmeleave, meetmetalking)


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=4308&r1=4307&r2=4308
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/welcome2.js (original)
+++ team/rbrindley/welcome_revamp/config/js/welcome2.js Mon Dec  8 12:43:10 2008
@@ -485,6 +485,8 @@
 		}
 
 		var tmp = conf_template.clone();
+		tmp.attr('id','conf_'+l.toString());
+		tmp.appendTo(conf_body);
 		var users_template = conf_template.contents().find('.members tr.template');
 
 		tmp.contents().find(".name").html(l);
@@ -495,13 +497,7 @@
 			
 			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);
+				addMeetmeMember(l, user.cid, user.duration);
 			}
 
 		}else{
@@ -510,7 +506,6 @@
 			tmp.contents().find(".members > .list > tbody").empty().html('<tr><td colspan="4">No Active Members</td></tr>');
 		}
 
-		tmp.appendTo(conf_body);
 		tmp.removeClass("template");
 	}
 };
@@ -601,6 +596,32 @@
 			var queue = event[3].split(' ')[1];		//Queue: 6501
 			this.removeQueueCall(queue, exten);
 			break;
+		case 'event: meetmejoin':
+			var chan = event[2].split(' ')[1];
+			var meetme = event[4].split(' ')[1];
+			var usernum = event[5].split(' ')[1];
+			chan = chan.split('/')[1].split('-')[0];	/* SIP/6000-123 */
+
+			this.meetmeJoin(meetme, usernum, chan, 0);
+			break;
+		case 'event: meetmeleave':
+			var chan = event[2].split(' ')[1];
+			var meetme = event[4].split(' ')[1];
+			var usernum = event[5].split(' ')[1];
+			chan = chan.split('/')[1].split('-')[0];	/* SIP/6000-123 */
+
+			this.meetmeLeave(meetme, usernum, chan);
+			break;
+		case 'event: meetmetalking':
+			var chan = event[2].split(' ')[1];
+			var meetme = event[4].split(' ')[1];
+			var usernum = event[5].split(' ')[1];
+			var status = event[6].split(' ')[1];
+			chan = chan.split('/')[1].split('-')[0];	/* SIP/6000-123 */
+			status = status.toString() == 'on' ? 1: 0;
+
+			this.meetmeTalking(meetme, chan, status);
+			break;
 		case 'event: newchannel':
 			/* event[2]= 'Channel: Zap/2-1' or 'Channel: SIP/101-3f3f' */
 			var exten = event[2].split(' ')[1].split('/')[1].split('-')[0];
@@ -644,10 +665,6 @@
 		case 'event: dial':
 		case 'event: musiconhold':
 		case 'event: link':
-		case 'event: meetmejoin':
-		case 'event: meetmeleave':
-		case 'event: meetmestoptalking':
-		case 'event: meetmetalking':
 		case 'event: messagewaiting':
 		case 'event: newcallerid':
 		case 'event: newexten':
@@ -851,6 +868,66 @@
 	}
 };
 
+manager_events.meetmeJoin = function (meetme, user_num, chan) {
+	var conf = $('#conf_'+meetme.toString()+' .members > .list > tbody');
+	if (conf.find('tr:first > td:first').html() == 'No Active Members') {
+		conf.empty();
+		conf = $('#conf_'+meetme.toString());
+		conf.find('.status').html('1 User');
+		conf.find('.time').addClass('count_html_up').html('00:00');
+	} else {
+		conf = $('#conf_'+meetme.toString());
+		var status = conf.contents().find('.status').html();
+		status = status.split(' ')[0];
+		status = parseInt(status)+1;
+		conf.find('.status').html(status+' Users');
+	}
+
+	addMeetmeMember(meetme, chan, 0);
+};
+
+manager_events.meetmeLeave = function (meetme, user_num, chan) {
+	$('#'+meetme.toString()+'_'+chan.toString()).remove();
+	
+	var conf = $('#conf_'+meetme.toString()+' .members > .list > tbody');
+	if (conf.children('tr').length == 0 ) {
+		conf = $('#conf_'+meetme.toString());
+		conf.find(".status").html('Not In Use');
+		conf.find(".time").removeClass('count_html_up').html("00:00");
+		conf.find(".members > .list > tbody").empty().html('<tr><td colspan="4">No Active Members</td></tr>');
+	} else {
+		conf = $('#conf_'+meetme.toString());
+		var status = conf.contents().find('.status').html();
+		status = status.split(' ')[0];
+		status = parseInt(status)-1;
+		conf.find('.status').html(status+' Users');
+	}
+};
+
+manager_events.meetmeTalking = function(meetme, exten, is_talking) {
+	var user_stat;
+	if ( user_stat = $('#'+meetme.toString()+'_'+exten.toString()+' .mem_status') ) {
+		user_stat.html( is_talking ? 'Talking' : 'Active' );
+	}
+};
+
+//abstracted out because its called in manager_events.meetmeJoin & loadConferences
+addMeetmeMember = function(meetme, user_num, duration) {
+	//set duration's default value
+	duration = typeof(duration) != 'undefined' ? duration : 0;
+
+	var conf = $('#conf_'+meetme.toString()+' .members > .list > tbody');
+
+	var new_row = $('#sys_status_meetme > .body > div.template .members tr.template').clone();
+	new_row.children('.extension').html(user_num);
+	new_row.children('.duration').addClass('count_html_up').html(secs2html(duration));
+	new_row.children('.mem_status').html('Active');
+
+	new_row.removeClass('template');
+	new_row.attr('id',meetme.toString()+'_'+user_num);
+	conf.append(new_row);
+};
+
 var countHtml = function() {
 	$('.count_html_up').each( function(i) {
 		var old_time = this.innerHTML;




More information about the asterisk-gui-commits mailing list