pari: branch 2.0 r3759 - in /branches/2.0/config: js/astman.js welcome.html

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Thu Sep 4 16:55:52 CDT 2008


Author: pari
Date: Thu Sep  4 16:55:52 2008
New Revision: 3759

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

 Show MailBox count of each user in welcome page

** may be moved to async mode later



Modified:
    branches/2.0/config/js/astman.js
    branches/2.0/config/welcome.html

Modified: branches/2.0/config/js/astman.js
URL: http://svn.digium.com/view/asterisk-gui/branches/2.0/config/js/astman.js?view=diff&rev=3759&r1=3758&r2=3759
==============================================================================
--- branches/2.0/config/js/astman.js (original)
+++ branches/2.0/config/js/astman.js Thu Sep  4 16:55:52 2008
@@ -432,6 +432,27 @@
 	cliCommand : function(cmd) { // ASTGUI.cliCommand(cmd);
 		ASTGUI.debugLog("Executing manager command : '" + cmd + "'" , 'manager');
 		return makeSyncRequest ( { action :'command', command: cmd } );
+	},
+
+	mailboxCount : function(mbox){ // ASTGUI.mailboxCount(mox) ; --> returns the number of New/Old Messages in mbox's mailbox
+		if(!mbox.contains('@')){ mbox = mbox + '@default' ; }
+		var t = makeSyncRequest ( { action :'MailboxCount', Mailbox: mbox } );
+		var tr = { count_new:0 , count_old : 0 };
+		try{
+			var lines = t.split('\n');
+			lines.each(function( this_line){
+				if(!this_line.contains('Messages:') ) return;
+				this_line = this_line.trim();
+				if( this_line.contains('NewMessages:') ){
+					tr.count_new = Number(this_line.afterChar(':').trim());
+				}
+				if( this_line.contains('OldMessages:') ){
+					tr.count_old = Number(this_line.afterChar(':').trim());
+				}
+			});
+		}finally{
+			return tr;
+		}
 	},
 
 	doTransfer : function(from, to) {

Modified: branches/2.0/config/welcome.html
URL: http://svn.digium.com/view/asterisk-gui/branches/2.0/config/welcome.html?view=diff&rev=3759&r1=3758&r2=3759
==============================================================================
--- branches/2.0/config/welcome.html (original)
+++ branches/2.0/config/welcome.html Thu Sep  4 16:55:52 2008
@@ -35,7 +35,7 @@
 	#table_Ext_list tr.frow { background: #6b79a5; color: #CED7EF; }
 	#table_Ext_list tr.frow td{ font-weight:bold; }
 	#table_Ext_list tr td{ padding : 3px; }
-	#table_Ext_list tr.even { background: #DFDFDF; }
+	#table_Ext_list tr.even { background: #EFEFEF; }
 	#table_Ext_list tr.odd{ background: #FFFFFF; }
 	#table_Ext_list tr.even:hover, #table_Ext_list tr.odd:hover {
 		background: #a8b6e5;
@@ -178,8 +178,9 @@
 		var newRow = DOM_table_Ext_list.insertRow(-1);
 		newRow.className = "frow";
 		addCell( newRow , { html:'', width:'15px'} );
-		addCell( newRow , { html:'Extension', width:'380px' } );
-		addCell( newRow , { html:'Name/Label', width:'320px' } );
+		addCell( newRow , { html:'Extension', width:'320px' } );
+		addCell( newRow , { html:'Name/Label' } );
+		addCell( newRow , { html:'Status' } );
 		addCell( newRow , { html:'Type', width:'275px'} );
 	})();
 	(function(){ // List all User Extensions
@@ -196,6 +197,13 @@
 			if( ud.getProperty('hassip').isAstTrue() && ud.getProperty('hasiax').isAstTrue() ){ tmp_usertype_a = [ 'SIP/IAX User' ] ; }
 			if( ud.getProperty('zapchan') ){
 				tmp_usertype_a.push( 'Analog User (Port ' + ud['zapchan'] + ')' ) ;
+			}
+
+			var tmp_mails = ASTGUI.mailboxCount(user);
+			if( tmp_mails.count_new == 0 && tmp_mails.count_old == 0 ){
+				var tmp_mails_str = '<font color=#888B8D> Messages : ' + tmp_mails.count_new + '/' + tmp_mails.count_old + '</font>' ;
+			}else{
+				var tmp_mails_str = '<font color=#888B8D> Messages : <B><font color=red>' + tmp_mails.count_new + '</font>/' + tmp_mails.count_old + '</B></font>' ;
 			}
 
 			newRow.className = ((DOM_table_Ext_list.rows.length)%2==1)?'odd':'even';
@@ -215,6 +223,7 @@
 				);
 
 				addCell( newRow , { html: ud.getProperty('fullname') } );
+				addCell( newRow , { html: tmp_mails_str } );
 				addCell( newRow , { html: tmp_usertype_a.join(',&nbsp;') } );
 		});
 	})();
@@ -227,6 +236,7 @@
 				addCell( newRow , { html:'' });
 				addCell( newRow , { html: l });
 				addCell( newRow , { html: '' });
+				addCell( newRow , { html: '' } );
 				addCell( newRow , { html: 'Conference Room' });
 		}}
 	})();
@@ -246,6 +256,7 @@
 				}else if( m[l]['configLine'].contains(',1,agentcallbacklogin()') ){
 					addCell( newRow , { html: '<B>Agent CallBack Login</B>' });	
 				}else{
+					addCell( newRow , { html: '' } );
 					addCell( newRow , { html: 'Call Queue' } );
 				}
 			}
@@ -260,6 +271,7 @@
 			addCell( newRow , { html: '' } );
 			addCell( newRow , { html: c[d]['extension'] || '--' } );
 			addCell( newRow , { html: c[d]['NAME'] || d } );
+			addCell( newRow , { html: '' } );
 			addCell( newRow , { html: 'Ring Group' } );
 		}}
 	})();
@@ -272,6 +284,7 @@
 			addCell( newRow , { html: '' } );
 			addCell( newRow , { html: ASTGUI.parseContextLine.getExten(c[d].getProperty('alias_exten')) || '--' } );
 			addCell( newRow , { html: c[d]['comment'] || d } );
+			addCell( newRow , { html: '' } );
 			addCell( newRow , { html: 'Voice Menu' } );
 		}}
 	})();
@@ -299,6 +312,7 @@
 			}
 		);
 		addCell( newRow , { html: '<B>Check Voicemails</B>' } );
+		addCell( newRow , { html: '' } );
 		addCell( newRow , { html: 'VoiceMailMain' } );
 	})();
 	(function(){ // VoiceMail Groups
@@ -309,6 +323,7 @@
 			addCell( newRow , { html: '' } );
 			addCell( newRow , { html: this_vmg_exten });
 			addCell( newRow , { html: parent.sessionData.pbxinfo.vmgroups[this_vmg_exten].getProperty('label')  });
+			addCell( newRow , { html: '' } );
 			addCell( newRow , { html: 'VoiceMail Group' } );
 		});
 	})();
@@ -331,6 +346,7 @@
 			}
 		);
 		addCell( newRow , { html: '<B>Dial by Names</B>' } );
+		addCell( newRow , { html: '' } );
 		addCell( newRow , { html: 'Directory' } );
 	})();
 };




More information about the asterisk-gui-commits mailing list