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

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Mon Nov 24 10:22:58 CST 2008


Author: rbrindley
Date: Mon Nov 24 10:22:57 2008
New Revision: 4195

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

- added load functions into welcome2.js
- copied trunk listings and users, now extensions, listings code from welcome.js into welcome2.js
- modified welcome2.html to accomodate for the javascript changes.


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=4195&r1=4194&r2=4195
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/welcome2.js (original)
+++ team/rbrindley/welcome_revamp/config/js/welcome2.js Mon Nov 24 10:22:57 2008
@@ -19,23 +19,14 @@
  *
  */
 
+var REGISTRY_OUTPUT = { } ;
+
  /* This function will be called when the page has completed loading */
  $(document).ready(function() {
 
- 	$('#sysstat_right_container').sortable({
+ 	$('#sysstat_right_container, #sysstat_left_container').sortable({
 		axis: 'y',
-		containment: '#sysstat_right_container',
-		cursor: 'move',
-		forcePlaceholderSize: true,
-		handle: 'div.handle',
-		items: '> div.content',
-		opacity: 0.7,
-		placeholder: 'placeholder'
-	});
-
- 	$('#sysstat_left_container').sortable({
-		axis: 'y',
-		containment: '#sysstat_left_container',
+		cancel: '.minimaxi',
 		cursor: 'move',
 		forcePlaceholderSize: true,
 		handle: 'div.handle',
@@ -56,8 +47,284 @@
 		}
 	}));
 
+	setTimeout("loadTrunks()", 1);
+	setTimeout("loadExtensions()", 1);
+	setTimeout("loadQueues()", 1);
+	setTimeout("loadAgents()", 1);
+	setTimeout("loadConferenceRooms()", 1);
+	setTimeout("loadParkingLot()", 1);
+
 	return;
  });
+
+var loadTrunks = function() {
+	EX_CF = config2json({filename:'extensions.conf', usf:0 });
+
+	var TBL = _$('trunks_list');
+	var addCell = ASTGUI.domActions.tr_addCell; // temporarily store the function
+
+/* IAX and SIP Trunks */
+	var t = parent.ASTGUI.cliCommand('iax2 show registry') ;
+	REGISTRY_OUTPUT.iax2 = ASTGUI.parseCLIResponse(t) ;
+	t = parent.ASTGUI.cliCommand('sip show registry') ;
+	REGISTRY_OUTPUT.sip = ASTGUI.parseCLIResponse(t) ;
+	var d = [].concat( parent.astgui_managetrunks.listOfSIPTrunks() , parent.astgui_managetrunks.listOfIAXTrunks() );
+
+	d.each( function(item){
+		var ttype = parent.astgui_managetrunks.misc.getTrunkType(item) ;
+		var newRow = TBL.insertRow(-1);
+		newRow.className = ((TBL.rows.length)%2==1)?'odd':'even';
+
+		var reg = ASTGUI.getTrunkStatus(REGISTRY_OUTPUT, item, ttype) ;
+		addCell( newRow , { html: reg } );
+
+		addCell( newRow , { html: parent.sessionData.pbxinfo.trunks[ttype][item]['trunkname'] } );
+		addCell( newRow , { html: ttype } );
+		addCell( newRow , { html: parent.sessionData.pbxinfo.trunks[ttype][item]['username'] || '' } );
+		addCell( newRow , { html: parent.sessionData.pbxinfo.trunks[ttype][item]['host'] } );
+		//addCell( newRow , { html: default_IncomingRule_trunk(item) });
+	} );
+/* End IAX and SIP Trunks */
+
+/* Analog Trunks */
+	var c = parent.astgui_managetrunks.listOfAnalogTrunks();
+	c.each(function(item){
+		var newRow = TBL.insertRow(-1);
+		newRow.className = ((TBL.rows.length)%2==1)?'odd':'even';
+
+		addCell( newRow , { html:''} );
+		addCell( newRow , { html: parent.sessionData.pbxinfo['trunks']['analog'][item]['trunkname'] } );
+		addCell( newRow , { html:'Analog'} );
+		addCell( newRow , { html:''} );
+		addCell( newRow , { html:'Ports ' + parent.sessionData.pbxinfo['trunks']['analog'][item]['zapchan'] } );
+	});
+/* End Analog Trunks */
+
+/* Providers */
+	var d = parent.sessionData.pbxinfo.trunks.providers ;
+	for(var e in d){ if(d.hasOwnProperty(e)){
+
+			var ttype = parent.astgui_managetrunks.misc.getTrunkType(e) ;
+			var newRow = TBL.insertRow(-1) ;
+			newRow.className = ((TBL.rows.length)%2==1)?'odd':'even';
+			var reg = ASTGUI.getTrunkStatus(REGISTRY_OUTPUT, e, ttype) ;
+			addCell( newRow , { html: reg } );
+			addCell( newRow , { html: d[e]['trunkname'] } );
+			addCell( newRow , { html: ttype } );
+			addCell( newRow , { html: d[e]['username'] || '' } );
+			addCell( newRow , { html: d[e]['host'] } );
+	}}
+/* End Providers */
+
+/* Digital Trunks */
+	var c = parent.sessionData.pbxinfo['trunks']['pri'] ;
+	for(var d in c){if(c.hasOwnProperty(d)){
+		var newRow = TBL.insertRow(-1);
+		newRow.className = ((TBL.rows.length)%2==1)?'odd':'even';
+		addCell( newRow , { html:'' });
+		addCell( newRow , { html: c[d]['trunkname'] });
+		addCell( newRow , { html: 'Digital (' + c[d]['signalling'] + ')' }); // 
+		addCell( newRow , { html: 'Ports: ' + c[d]['zapchan'] });
+		addCell( newRow , { html:''} );
+	}}
+
+
+	var c = parent.sessionData.pbxinfo['trunks']['bri'] ;
+	for(var d in c){if(c.hasOwnProperty(d)){
+		var newRow = TBL.insertRow(-1);
+		newRow.className = ((TBL.rows.length)%2==1)?'odd':'even';
+		addCell( newRow , { html:'' });
+		addCell( newRow , { html: c[d]['trunkname'] });
+		addCell( newRow , { html: 'BRI' });
+		addCell( newRow , { html: 'Ports: ' + c[d]['ports'] });
+		addCell( newRow , { html:''} );
+	}}
+/* End Digital Trunks */
+};
+
+var loadExtensions = function() {
+	var TBL = _$('extensions_list');
+	var addCell = ASTGUI.domActions.tr_addCell; // temporarily store the function
+
+	(function(){ // List all User Extensions
+		var ul = parent.astgui_manageusers.listOfUsers();
+		ul = ul.sortNumbers( );
+		ul.each(function(user){ // list each user in table
+			var ud = parent.sessionData.pbxinfo.users[user];
+			var newRow = TBL.insertRow(-1);
+
+			var tmp_usertype_a = [];
+
+			if( ud.getProperty('hassip').isAstTrue() ){ tmp_usertype_a.push( ' SIP User' ) ; }
+			if( ud.getProperty('hasiax').isAstTrue() ){ tmp_usertype_a.push( ' IAX User' ) ; }
+			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 ){
+				var tmp_mails_str = '<font color=#888B8D> Messages : <B><font color=red>' + tmp_mails.count_new + '</font>/' + tmp_mails.count_old + '</B></font>' ;
+			}else{
+				var tmp_mails_str = '<font color=#888B8D> Messages : ' + tmp_mails.count_new + '/' + tmp_mails.count_old + '</font>' ;
+			}
+
+			newRow.className = (( TBL.rows.length)%2==1)?'odd':'even';
+				if( !ud.getProperty('context') || ! parent.sessionData.pbxinfo.callingPlans[ud.getProperty('context')] ){
+					var tmp_userstring = '<u>' + user + '</u> <font color=red>*No DialPlan assigned</font>' ;
+				}else{
+					var tmp_userstring = '<u>' + user + '</u>' ;
+				}
+
+				addCell( newRow , { html: ASTGUI.getUser_DeviceStatus_Image(user) , id : 'TD_USER_DEVICE_STATUS_' + user } );
+				addCell( newRow ,
+					{	html: tmp_userstring ,
+						onclickFunction: function(){
+							parent.miscFunctions.click_panel( 'users.html', 'users.html?EXTENSION_EDIT=' + user );
+						}
+					}
+				);
+
+				addCell( newRow , { html: ud.getProperty('fullname') } );
+				addCell( newRow , { html: tmp_mails_str } );
+				addCell( newRow , { html: tmp_usertype_a.join(',&nbsp;') } );
+		});
+	})();
+
+	(function(){ // List all meetMe Extensions
+
+		//update_Conferences_Table();
+		//update_parkedCalls_Table();
+	})();
+
+	(function(){ // List all Queue Extensions
+		var QUEUES_CONF = config2json({filename:'queues.conf', usf:1});
+		var m = parent.sessionData.pbxinfo.queues ;
+		for( l in m ){
+			if( m.hasOwnProperty(l) ){
+				var newRow = TBL.insertRow(-1);
+				newRow.className = (( TBL.rows.length)%2==1)?'odd':'even';
+				addCell( newRow , { html:''} );
+				addCell( newRow , { html: l } );
+				addCell( newRow , { html: QUEUES_CONF[l] && QUEUES_CONF[l]['fullname'] || '--' }); // Label
+				if( m[l]['configLine'].contains(',1,agentlogin()') ){
+					addCell( newRow , { html: '' } );
+					addCell( newRow , { html: '<B>Agent Login</B>' });
+				}else if( m[l]['configLine'].contains(',1,agentcallbacklogin()') ){
+					addCell( newRow , { html: '' } );
+					addCell( newRow , { html: '<B>Agent CallBack Login</B>' });	
+				}else{
+					addCell( newRow , { html: '' } );
+					addCell( newRow , { html: 'Call Queue' } );
+				}
+			}
+		}
+	})();
+
+	(function(){ // List all RingGroup Extensions
+		var c = parent.sessionData.pbxinfo.ringgroups ;
+		for(var d in c){if(c.hasOwnProperty(d)){
+			var newRow = TBL.insertRow(-1);
+			newRow.className = (( TBL.rows.length)%2==1)?'odd':'even';
+			addCell( newRow , { html: '' } );
+			addCell( newRow , { html: c[d]['extension'] || '--' } );
+			addCell( newRow , { html: c[d]['NAME'] || d } );
+			addCell( newRow , { html: '' } );
+			addCell( newRow , { html: 'Ring Group' } );
+		}}
+	})();
+
+	(function(){ // List all VoiceMenu Extensions
+		var c = parent.sessionData.pbxinfo.voicemenus ;
+		for(var d in c){if(c.hasOwnProperty(d)){
+			var newRow = TBL.insertRow(-1);
+			newRow.className = (( TBL.rows.length)%2==1)?'odd':'even';
+			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' } );
+		}}
+	})();
+
+	(function(){ // List VoicemailMain
+		var tmp = '';
+		if( parent.sessionData.pbxinfo['localextensions'].hasOwnProperty('VoiceMailMain') ){
+			tmp = ASTGUI.parseContextLine.getExten( parent.sessionData.pbxinfo['localextensions']['VoiceMailMain'] ) ;
+		}
+		var newRow = TBL.insertRow(-1);
+		newRow.className = (( TBL.rows.length)%2==1)?'odd':'even';
+		addCell( newRow , { html: '' } );
+
+		if( tmp ){
+			var tmp_voicemails = '<u>' + tmp + '</u>' ;
+		}else{
+			var tmp_voicemails = '-- <font color=red>*No Extension assigned</font>' ;
+		}
+
+		addCell( newRow ,
+			{	html: tmp_voicemails ,
+				onclickFunction: function(){
+					parent.miscFunctions.click_panel( 'voicemail.html');
+				}
+			}
+		);
+		addCell( newRow , { html: '<B>Check Voicemails</B>' } );
+		addCell( newRow , { html: '' } );
+		addCell( newRow , { html: 'VoiceMailMain' } );
+	})();
+	(function(){ // VoiceMail Groups
+		var vmgroups = parent.sessionData.pbxinfo.vmgroups.getOwnProperties();
+		vmgroups.each(function( this_vmg_exten ){
+			var newRow = TBL.insertRow(-1);
+			newRow.className = (( TBL.rows.length)%2==1)?'odd':'even';
+			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' } );
+		});
+	})();
+
+	(function(){
+		var newRow = TBL.insertRow(-1);
+		newRow.className = (( TBL.rows.length)%2==1)?'odd':'even';
+		addCell( newRow , { html: '' });
+
+		var tmp = parent.sessionData.pbxinfo['localextensions'].getProperty('defaultDirectory') ;
+		if( tmp ){
+			var tmp_dirExten = '<u>' + tmp + '</u>' ;
+		}else{
+			var tmp_dirExten = '-- <font color=red>*No Extension assigned</font>' ;
+		}
+
+		addCell( newRow ,
+			{	html: tmp_dirExten ,
+				onclickFunction: function(){ parent.miscFunctions.click_panel( 'directory.html'); }
+			}
+		);
+		addCell( newRow , { html: '<B>Dial by Names</B>' } );
+		addCell( newRow , { html: '' } );
+		addCell( newRow , { html: 'Directory' } );
+	})();
+
+};
+
+var loadQueues = function() {
+
+};
+
+var loadAgents = function() {
+
+};
+
+var loadConferenceRooms = function() {
+
+};
+
+var loadParkingLot = function() {
+
+};
 
  jQuery.delegate = function(rules) {
  return function(e) {

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=4195&r1=4194&r2=4195
==============================================================================
--- team/rbrindley/welcome_revamp/config/welcome2.html (original)
+++ team/rbrindley/welcome_revamp/config/welcome2.html Mon Nov 24 10:22:57 2008
@@ -89,6 +89,8 @@
 	-moz-border-radius: 4px;
 	-webkit-border-radius: 4px;
 	margin: 4px;
+	margin-top: 10px;
+	margin-bottom: 10px;
 }
 
 div.content_container div.content div.body {
@@ -157,7 +159,7 @@
 			<img src="images/status_gray.png" border="0"> UnAvailable 
 		</div>
 		<div id="sysstat_left_container" class="content_container">
-			<div id="sys_status_users" class="content">
+			<div id="sys_status_trunks" class="content">
 				<div class="handle title"> 
 					<span class="minimaxi">[ - ]</span>
 					Trunks
@@ -172,16 +174,15 @@
 						<td>Port/Hostname/IP</td>
 					</tr>
 					</table>
-					Trunk placeholder
-				</div>
-			</div>
-			<div id="sys_status_trunks" class="content">
-				<div class="handle title"> 
-					<span class="minimaxi">[ - ]</span>
-					Users
+				</div>
+			</div>
+			<div id="sys_status_extensions" class="content">
+				<div class="handle title"> 
+					<span class="minimaxi">[ - ]</span>
+					Extensions
 				</div>
 				<div class="body">
-					<table id="users_list" class="list">
+					<table id="extensions_list" class="list">
 					<tr class="list_titles">
 						<td></td>
 						<td>Extension</td>
@@ -190,7 +191,6 @@
 						<td>Type</td>
 					</tr>
 					</table>
-					User placeholder!
 				</div>
 			</div>
 			<div id="sys_status_queues" class="content">




More information about the asterisk-gui-commits mailing list