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

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Fri Dec 5 09:42:56 CST 2008


Author: rbrindley
Date: Fri Dec  5 09:42:55 2008
New Revision: 4289

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

- added class count_html_down to waittime in queue calls
- added class count_up to timeout in parked calls
- added and implemented countHtml, countSecs, html2secs, secs2html functions to provide
  ticker functionality


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=4289&r1=4288&r2=4289
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/welcome2.js (original)
+++ team/rbrindley/welcome_revamp/config/js/welcome2.js Fri Dec  5 09:42:55 2008
@@ -396,7 +396,7 @@
 
 				$('<td></td>').html(order).appendTo(call);
 				$('<td></td>').html(cid).appendTo(call);
-				$('<td></td>').html(waittime).appendTo(call);
+				$('<td></td>').html(waittime).addClass('count_html_up').appendTo(call);
 
 				call.addClass(call_class);
 				call.attr('id',''+q_name.toString()+'_call_'+cid.toString());
@@ -498,7 +498,7 @@
 				$("<td></td>").html(chunk.CallerID),
 				$("<td></td>").html(chunk.Channel),
 				$("<td></td>").html(chunk.Exten),
-				$("<td></td>").html(chunk.Timeout).addClass('countdown')
+				$("<td></td>").html(chunk.Timeout).addClass('count_down')
 			]);
 		});
 
@@ -688,7 +688,7 @@
 
 	$("<td></td>").html(position).appendTo(new_row);
 	$("<td></td>").html(exten).appendTo(new_row);
-	$("<td></td>").html('0:00').appendTo(new_row);
+	$("<td></td>").html('0:00').addClass('count_html_up').appendTo(new_row);
 
 	calls_tbody.append(new_row);
 };
@@ -794,9 +794,61 @@
 	$('<td></td>').html(cid).appendTo(new_row);
 	$('<td></td>').html(chan).appendTo(new_row);
 	$('<td></td>').html(exten).appendTo(new_row);
-	$('<td></td>').html(timeout).addClass('countdown').appendTo(new_row);
+	$('<td></td>').html(timeout).addClass('count_down').appendTo(new_row);
 
 	plot_tbody.append(new_row);
+};
+
+var countHtml = function() {
+	$('.count_html_up').each( function(i) {
+		var old_time = this.innerHTML;
+		old_time = html2secs(old_time.toString());
+
+		var new_time = parseInt(old_time)+1;
+		new_time = secs2html(new_time);
+
+		this.innerHTML = new_time;
+	});
+
+	$('.count_html_down').each( function(i) {
+		var old_time = this.innerHTML;
+		old_time = html2secs(old_time.toString());
+
+		var new_time = parseInt(old_time)-1;
+		new_time = secs2html(new_time);
+
+		this.innerHTML = new_time;
+	});
+
+	setTimeout('countHtml()',1000);
+};
+
+var countSecs = function() {
+	$('.count_up').each( function(i) {
+		this.innerHTML = parseInt(this.innerHTML)+1;
+	});
+
+	$('.count_down').each( function(i) {
+		this.innerHTML = parseInt(this.innerHTML)-1;
+	});
+
+	setTimeout('countSecs()',1000);
+};
+
+var html2secs = function(html) {
+	html = html.split(':');
+
+	if (html[0].toString() != '00') {
+		return ((parseInt(html[0])*60)+parseInt(html[1]));
+	} else {
+		return parseInt(html[1]);
+	}
+};
+
+var secs2html = function(secs) {
+	var mins = Math.floor(secs/60);
+	secs = secs % 60;
+	return ''+mins.toString()+':'+(secs<10?'0':'')+secs.toString();
 };
 
 var pushRow = function(tbody, cells) {




More information about the asterisk-gui-commits mailing list