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

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Wed Dec 3 10:19:42 CST 2008


Author: rbrindley
Date: Wed Dec  3 10:19:41 2008
New Revision: 4268

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=4268
Log:
merged branches/2.0 from 4232 to 4267

Added:
    team/rbrindley/welcome_revamp/config/blank.html
      - copied unchanged from r4267, branches/2.0/config/blank.html
    team/rbrindley/welcome_revamp/config/skype.html
      - copied unchanged from r4267, branches/2.0/config/skype.html
Removed:
    team/rbrindley/welcome_revamp/scripts/gui_sysinfo
Modified:
    team/rbrindley/welcome_revamp/config/gtalk.html
    team/rbrindley/welcome_revamp/config/index.html
    team/rbrindley/welcome_revamp/config/js/astman.js
    team/rbrindley/welcome_revamp/config/js/callingrules.js
    team/rbrindley/welcome_revamp/config/js/index.js
    team/rbrindley/welcome_revamp/config/js/menus.js
    team/rbrindley/welcome_revamp/config/js/pbx.js
    team/rbrindley/welcome_revamp/config/js/sysinfo.js
    team/rbrindley/welcome_revamp/config/menus.html
    team/rbrindley/welcome_revamp/config/paging.html
    team/rbrindley/welcome_revamp/config/sysinfo.html
    team/rbrindley/welcome_revamp/developer_info/CODING-GUIDELINES

Modified: team/rbrindley/welcome_revamp/config/gtalk.html
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/gtalk.html?view=diff&rev=4268&r1=4267&r2=4268
==============================================================================
--- team/rbrindley/welcome_revamp/config/gtalk.html (original)
+++ team/rbrindley/welcome_revamp/config/gtalk.html Wed Dec  3 10:19:41 2008
@@ -25,9 +25,8 @@
 <style type="text/css">
 	#table_BuddiesList {
 		border: 1px solid #666666;
-		margin-top: 5px;
-		margin-bottom:10px;
-		width: 96%;
+		margin: 0px;
+		width: 95% ;
 		text-align: center;
 		padding : 1px;
 	}
@@ -46,12 +45,14 @@
 
 	#table_AccountsList {
 		border: 1px solid #666666;
-		margin-top: 5px;
-		margin-bottom:10px;
+		margin: 0px;
 		text-align: center;
 		padding : 1px;
-	}
-	#table_AccountsList tr.heading { background: #6b79a5;}
+		width: 95% ;
+	}
+	#table_AccountsList tr.heading { background: #FFFFFF;}
+	#table_AccountsList tr.frow { background: #6b79a5; color: #CED7EF; }
+	#table_AccountsList tr.frow td{ font-weight:bold; }
 	#table_AccountsList tr td { padding : 3px; }
 	#table_AccountsList tr.even { background: #DFDFDF; }
 	#table_AccountsList tr.odd { background: #FFFFFF; }
@@ -62,7 +63,7 @@
 
 </style>
 <script>
-var GTALK_CNF , JABBER_CNF;
+var GTALK_CNF , JABBER_CNF, EXTENSIONS_CNF;
 
 var EDIT_BUDDY ;
 var EDIT_ACCOUNT ;
@@ -74,47 +75,64 @@
 		var TBL = _$('table_BuddiesList');
 		ASTGUI.domActions.clear_table(TBL);
 
-			var newRow = TBL.insertRow(-1);
-			newRow.className = 'heading' ;
-			addCell( newRow , { html: "<span class='lite_Heading'>Peers</span>",align:'center', colspan:4 });
-
-			var newRow = TBL.insertRow(-1);
-			newRow.className = 'frow' ;
-			addCell( newRow , { html: 'UserName' });
-			addCell( newRow , { html: 'Context' });
-			addCell( newRow , { html: '&nbsp;&nbsp;Connection&nbsp;&nbsp;' });
-			addCell( newRow , { html: '',width:'175px' });
 
 		for( buddy in GTALK_CNF ){
 			if( !GTALK_CNF.hasOwnProperty(buddy) || buddy == 'general' ) continue;
 
 			var newRow = TBL.insertRow(-1);
 			newRow.className = ((TBL.rows.length)%2==1)?'odd':'even';
-			addCell( newRow , { html:GTALK_CNF[buddy].username });
-			addCell( newRow , { html:GTALK_CNF[buddy].context });
+			addCell( newRow , { html:GTALK_CNF[buddy].username , align:'left'});
+
+			var tmp_context = GTALK_CNF[buddy].context || '' ;
+
+			var dest_line = ( tmp_context && tmp_context.contains(ASTGUI.contexts.gtalkIncomingContext) && EXTENSIONS_CNF.hasOwnProperty(tmp_context) ) ? EXTENSIONS_CNF[tmp_context][0] : '' ;
+			var dest_args = ASTGUI.parseContextLine.getArgs(dest_line) ;
+			addCell( newRow , { html: ASTGUI.parseContextLine.toKnownContext(dest_args) , align:'left' } );
+
+
 			addCell( newRow , { html:GTALK_CNF[buddy].connection });
+
 			var tmp = "<span class='guiButton' onclick=\"MANAGE_BUDDIES.edit_buddy_form('" + buddy +"')\">Edit</span>&nbsp;"
 					+ "<span class='guiButtonDelete' onclick=\"MANAGE_BUDDIES.deleteBuddy('" + buddy +"')\">Delete</span>" ;
 			addCell( newRow , { html: tmp });
-
-		}
-	},
-
-	deleteBuddy : function(a){ // MANAGE_BUDDIES.deleteBuddy();
-		if(!confirm("Delete peer '"+ a + "' ?")) { return true; }
-		var u = new listOfSynActions('gtalk.conf') ;
+		}
+
+		if( TBL.rows.length == 0 ){
+			var newRow = TBL.insertRow(-1);
+			addCell( newRow , { html: "<BR>No peers configured. To send or receive calls from your friends on google talk, Add the peer name by clicking on the 'New peer' button.<BR><BR>" });
+		}else{
+			var newRow = TBL.insertRow(0);
+			newRow.className = 'frow' ;
+			addCell( newRow , { html: 'UserName' , align: 'left' });
+			addCell( newRow , { html: 'Incoming Calls', align: 'left' });
+			addCell( newRow , { html: 'Connection' });
+			addCell( newRow , { html: '' });
+		}
+	},
+
+	deleteBuddy : function(a , silentmode){ // MANAGE_BUDDIES.deleteBuddy(); use silentmode to delete while editing buddy
+		if(!silentmode){
+			if( !confirm("Delete peer '"+ a + "' ?") ) return true;
+		}
+
+		var u = new listOfSynActions('gtalk.conf');
 			u.new_action('delcat', a, '', '');
 		u.callActions();
-		ASTGUI.feedback( { msg:"'deleted peer " + a , showfor: 3, color:'red', bgcolor:'#FFFFFF' } );
-		window.location.reload();
+
+		u.clearActions('extensions.conf');
+			u.new_action('delcat', GTALK_CNF[a].context , '', '');
+		u.callActions();
+
+		if(!silentmode){
+			ASTGUI.feedback( { msg:"deleted peer '" + a + "'" , showfor: 3, color:'red', bgcolor:'#FFFFFF' } );
+			window.location.reload();
+		}
 	},
 
 	addBuddy: function(){ // MANAGE_BUDDIES.addBuddy();
 
 		if ( EDIT_BUDDY ){
-			var u = new listOfSynActions('gtalk.conf') ;
-			u.new_action('delcat', EDIT_BUDDY , '', '');
-			u.callActions();
+			this.deleteBuddy(EDIT_BUDDY , true);
 		}
 
 		var v = new listOfActions('gtalk.conf');
@@ -129,9 +147,16 @@
 		v.new_action('append', catname , 'username', tmp_uname );
 		v.new_action('append', catname , 'disallow', 'all');
 		v.new_action('append', catname , 'allow', 'all');
-		v.new_action('append', catname , 'context', 'default');
+		v.new_action('append', catname , 'context', ASTGUI.contexts.gtalkIncomingContext + catname );
+
 		v.new_action('append', catname , 'connection', tmp_connection );
 		v.callActions( function(){
+
+			var W = new listOfSynActions('extensions.conf') ;
+			W.new_action('newcat', ASTGUI.contexts.gtalkIncomingContext + catname , '', '');
+			W.new_action('append', ASTGUI.contexts.gtalkIncomingContext + catname , 'exten', 's,1,' + ASTGUI.getFieldValue('edit_buddyIncomingCalls_select') );
+			W.callActions();
+
 			ASTGUI.feedback( { msg:"updated peer" , showfor: 3, color:'red', bgcolor:'#FFFFFF' } );
 			window.location.reload();
 		});
@@ -139,17 +164,20 @@
 
 	new_buddy_form : function(){ // MANAGE_BUDDIES.new_buddy_form();
 		EDIT_BUDDY = '';
-		ASTGUI.resetTheseFields([ 'edit_buddyName_text', 'edit_buddyConnection_select' ]);
+		ASTGUI.resetTheseFields([ 'edit_buddyName_text', 'edit_buddyConnection_select', 'edit_buddyIncomingCalls_select']);
 		$('#buddy_editdiv .dialog_title > span').html('Add Peer');
 		$('#buddy_editdiv').showWithBg();
 	},
 
 	edit_buddy_form : function(a){ // MANAGE_BUDDIES.edit_buddy_form();
 		if(!a) return;
-
 		EDIT_BUDDY = a;
 		ASTGUI.updateFieldToValue( 'edit_buddyName_text',  GTALK_CNF[EDIT_BUDDY].username );
 		ASTGUI.updateFieldToValue( 'edit_buddyConnection_select', GTALK_CNF[EDIT_BUDDY].connection );
+
+		var dest_line = ( EXTENSIONS_CNF.hasOwnProperty( GTALK_CNF[EDIT_BUDDY].context ) ) ? EXTENSIONS_CNF[ GTALK_CNF[EDIT_BUDDY].context ][0] : '' ;
+		ASTGUI.selectbox.selectDestinationOption( 'edit_buddyIncomingCalls_select' , ASTGUI.parseContextLine.getAppWithArgs(dest_line) );
+
 		$('#buddy_editdiv .dialog_title > span').html( 'Edit Peer ' + EDIT_BUDDY);
 		$('#buddy_editdiv').showWithBg();
 	}
@@ -161,40 +189,45 @@
 		var TBL = _$('table_AccountsList');
 		ASTGUI.domActions.clear_table(TBL);
 
-			var newRow = TBL.insertRow(-1);
-			newRow.className = 'heading' ;
-			addCell( newRow , { html: "<span class='lite_Heading' style='color: #FFFFFF;'>gtalk Accounts</span>",align:'center', colspan:2 });
-
 		for( account in JABBER_CNF ){
 			if( !JABBER_CNF.hasOwnProperty(account) || account == 'general' ) continue;
-
-			ASTGUI.selectbox.append('edit_buddyConnection_select', account , account );
+			ASTGUI.selectbox.append('edit_buddyConnection_select', account , account);
 
 			var newRow = TBL.insertRow(-1);
-			newRow.className = ((TBL.rows.length)%2==0) ? 'odd':'even';
-
-			addCell( newRow , { html:JABBER_CNF[account].username + "&nbsp;&nbsp;[" + account + "]" } );
+			newRow.className = ((TBL.rows.length)%2==1) ? 'odd':'even';
+			addCell( newRow , { html: JABBER_CNF[account].username, align: 'left' });
+			addCell( newRow , { html: account, align: 'left' });
 				var tmp = "<span class='guiButton' onclick=\"MANAGE_ACCOUNTS.edit_Account_form('" + account +"')\">Edit</span>&nbsp;"
 					+ "<span class='guiButtonDelete' onclick=\"MANAGE_ACCOUNTS.deleteAccount('" + account +"')\">Delete</span>" ;
-			addCell( newRow , { html: tmp, width: '175px'});
-		}
-	},
-
-	deleteAccount : function(a){ // MANAGE_ACCOUNTS.deleteAccount()
-		if(!confirm("Delete account '"+ a + "' ?")) { return true; }
+			addCell( newRow , { html: tmp, align: 'center' });
+		}
+
+		if( TBL.rows.length == 0 ){
+			var newRow = TBL.insertRow(-1);
+			addCell( newRow , { html: "<BR>No google talk accounts configured. <BR> Please click on 'New gtalk Account' button to send and receive calls via your google talk account.<BR><BR>"});
+		}else{
+			var newRow = TBL.insertRow(0);
+			newRow.className = 'frow' ;
+			addCell( newRow , { html: 'UserName' , align: 'left' });
+			addCell( newRow , { html: 'Account', align: 'left' });
+			addCell( newRow , { html: '' });
+		}
+	},
+
+	deleteAccount : function(a, silentmode){ // MANAGE_ACCOUNTS.deleteAccount()
+		if(!silentmode && !confirm("Delete account '"+ a + "' ?")) { return true; }
 		var u = new listOfSynActions('jabber.conf') ;
-			u.new_action('delcat', a, '', '');
+		u.new_action('delcat', a, '', '');
 		u.callActions();
-		ASTGUI.feedback( { msg:"'Deleted jabber account " + a , showfor: 3, color:'red', bgcolor:'#FFFFFF' } );
-		window.location.reload();
-
+		if( !silentmode ){
+			ASTGUI.feedback({ msg:"Deleted jabber account '" + a + "'", showfor: 3, color:'red', bgcolor:'#FFFFFF' });
+			window.location.reload();
+		}
 	},
 
 	saveAccount : function(){ // MANAGE_ACCOUNTS.saveAccount()
 		if ( EDIT_ACCOUNT ){
-			var u = new listOfSynActions('jabber.conf') ;
-			u.new_action('delcat', EDIT_ACCOUNT , '', '');
-			u.callActions();
+			this.deleteAccount(EDIT_ACCOUNT, true);
 		}
 
 		var v = new listOfActions('jabber.conf');
@@ -242,10 +275,64 @@
 
 };
 
+
+
 var localajaxinit = function(){
 	top.document.title = 'Google Talk Preferences' ;
 	GTALK_CNF = config2json({ filename:'gtalk.conf', usf:1 }); // buddies
 	JABBER_CNF = config2json({ filename:'jabber.conf', usf:1 }); // accounts
+	EXTENSIONS_CNF = config2json({ filename:'extensions.conf', usf:0 });
+
+	var someArray = parent.miscFunctions.getAllDestinations() ; 
+	ASTGUI.selectbox.populateArray('edit_buddyIncomingCalls_select', someArray);
+
+	(function(){
+		// check if the general section of the config files are configured
+		var u = new listOfSynActions('gtalk.conf') ;
+		if( !GTALK_CNF.hasOwnProperty('general') ){
+			u.new_action('newcat', 'general' , '', '');
+		}
+		if( GTALK_CNF.hasOwnProperty('general') && !GTALK_CNF['general'].hasOwnProperty('allowguest') ){
+			u.new_action('append', 'general' , 'allowguest', 'no');
+		}
+
+		var v = new listOfSynActions('jabber.conf') ;
+		if( !JABBER_CNF.hasOwnProperty('general') ){
+			v.new_action('newcat', 'general' , '', '');
+		}
+		if( JABBER_CNF.hasOwnProperty('general') && !JABBER_CNF['general'].hasOwnProperty('autoprune') ){
+			v.new_action('append', 'general' , 'autoprune', 'no');
+		}
+		if( JABBER_CNF.hasOwnProperty('general') && !JABBER_CNF['general'].hasOwnProperty('autoregister') ){
+			v.new_action('append', 'general' , 'autoregister', 'yes');
+		}
+
+		if( u.actionCount || v.actionCount ) {
+			u.callActions();
+			v.callActions();
+			window.location.reload();
+		}
+	})();
+
+	(function(){
+		var t = [{	url:'#',
+				desc:'Google Talk Accounts',
+				click_function: function(){
+					$('#table_BuddiesList_DIV').hide();
+					$('#table_AccountsList_DIV').show();
+				}
+			},{	url: '#',
+				desc: '&nbsp;&nbsp;&nbsp;Peers&nbsp;&nbsp;&nbsp;',
+				click_function: function(){
+					$('#table_BuddiesList_DIV').show();
+					$('#table_AccountsList_DIV').hide();
+				}
+			}];
+
+		ASTGUI.tabbedOptions( _$('tabbedMenu') , t );
+
+		$('#tabbedMenu').find('A:eq(0)').click();
+	})();
 
 	MANAGE_ACCOUNTS.listAccounts();
 	MANAGE_BUDDIES.listBuddies();
@@ -258,26 +345,23 @@
 		Google Talk Settings
 		<span class='refresh_icon' onclick="window.location.reload();" >&nbsp;<img src="images/refresh.png" title=" Refresh " border=0 >&nbsp;</span>
 	</div>
-	<div class='top_buttons'>
-		<span class='guiButtonNew' onclick='MANAGE_BUDDIES.new_buddy_form();'>New Peer</span>
-		<span class='guiButtonNew' onclick='MANAGE_ACCOUNTS.new_Account_form();'>New gtalk Account</span>
-		<span class='lite_Heading'  style='margin-left: 80px'> Google Talk Settings </span>
+
+	<center><div id="tabbedMenu" style="margin-bottom: 0px;"></div></center>
+
+	<div id='table_BuddiesList_DIV' style='margin-left:50px; margin-top: 0px; margin-right: 50px; padding: 0px'>
+		<div style="margin-bottom: 10px; margin-top:0px">
+			<span class='guiButtonNew' onclick='MANAGE_BUDDIES.new_buddy_form();'>New Peer</span>
+			<!--<span class='lite_Heading' style="margin-left: 50px">Peers</span>-->
+		</div>
+		<div><table id='table_BuddiesList' cellpadding=0 cellspacing=0 border=0 align=center></table></div>
 	</div>
-	<!--<center>
-		<div style='text-align:center; 	background-color : #FFFFFF; width: 95%; padding: 5px; margin-left: 1px; margin-top:14px; margin-bottom:20px; border:1px solid #CDCDCD; color: #575757 ' class='lite'>
-		send or receive calls to your buddies on Google Talk network
+	<div  id='table_AccountsList_DIV' style='margin-left:50px; margin-top: 0px; margin-right: 50px; padding: 0px'>
+		<div style="margin-bottom: 10px; margin-top:0px">
+			<span class='guiButtonNew' onclick='MANAGE_ACCOUNTS.new_Account_form();'>New gtalk Account</span>
+			<!--<span class='lite_Heading' style="margin-left: 50px">gtalk Accounts</span>-->
 		</div>
-	</center>-->
-	<div>
-		<div style='float:left; margin:20px'>
-			<table id='table_BuddiesList' cellpadding=0 cellspacing=0 border=0 align=center></table>
-		</div>
-		<div style='float:right; margin:20px'>
-			<table id='table_AccountsList' cellpadding=0 cellspacing=0 border=0 align=center></table>
-		</div>
+		<table id='table_AccountsList' cellpadding=0 cellspacing=0 border=0 align=center></table>
 	</div>
-
-
 
 <div id="buddy_editdiv" STYLE="width:500px; display:none;" class='dialog'>
 	<TABLE width="100%" cellpadding=0 cellspacing=0>
@@ -294,6 +378,11 @@
 		<tr>	<td align=right>Connection:&nbsp;</td>
 			<td colspan=2><select id="edit_buddyConnection_select"></select></td>
 		</tr>
+
+		<tr>	<td align=right>Incoming Calls to :&nbsp;</td>
+			<td colspan=2><select id="edit_buddyIncomingCalls_select"></select></td>
+		</tr>
+
 		<tr>	<td align="right" colspan=2 height=10></td></tr>
 		<tr>	<td align=center colspan=3>
 				<span class='guiButtonCancel' onclick='ASTGUI.hideDrag(event);'>Cancel</span>

Modified: team/rbrindley/welcome_revamp/config/index.html
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/index.html?view=diff&rev=4268&r1=4267&r2=4268
==============================================================================
--- team/rbrindley/welcome_revamp/config/index.html (original)
+++ team/rbrindley/welcome_revamp/config/index.html Wed Dec  3 10:19:41 2008
@@ -178,6 +178,14 @@
 			<div class="ui-accordion-link">Follow Me</div>
 			<div class="ui-accordion-desc"></div>
 		</div>
+		<div page='gtalk.html' style='display:none'>
+			<div class="ui-accordion-link">Google Talk</div>
+			<div class="ui-accordion-desc">Send or Receive calls from your buddies on Google Talk network</div>
+		</div>
+		<div page='skype.html' style='display:none'>
+			<div class="ui-accordion-link">Skype</div>
+			<div class="ui-accordion-desc">Send or Receive calls from your buddies on Skype network</div>
+		</div>
 		<div page='directory.html'>
 			<div class="ui-accordion-link">Directory</div>
 			<div class="ui-accordion-desc">Preferences for 'Dialing by Name Directory'</div>
@@ -202,7 +210,7 @@
 			<div class="ui-accordion-link">Networking</div>
 			<div class="ui-accordion-desc">Configures networking parameters.</div>
 		</div>
-		<div page='registerg729.html' class='forAA50'>
+		<div page='registerg729.html' style='display:none'>
 			<div class="ui-accordion-link">G.729 Codec</div>
 			<div class="ui-accordion-desc">Register & Manage your G.729 Codec License Keys</div>
 		</div>

Modified: team/rbrindley/welcome_revamp/config/js/astman.js
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/js/astman.js?view=diff&rev=4268&r1=4267&r2=4268
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/astman.js (original)
+++ team/rbrindley/welcome_revamp/config/js/astman.js Wed Dec  3 10:19:41 2008
@@ -359,6 +359,8 @@
 		Directory: 'directory', // ASTGUI.contexts.Directory
 		CallingRulePrefix : 'CallingRule_', // context for calling rules being with - ASTGUI.contexts.CallingRulePrefix 
 		CallingPlanPrefix: 'DLPN_', // context for DialPlans -- ASTGUI.contexts.CallingPlanPrefix
+		gtalkIncomingContext: 'gtalk_incoming_', // ASTGUI.contexts.gtalkIncomingContext
+		skypeIncomingContext: 'skype_incoming_', // ASTGUI.contexts.skypeIncomingContext
 		mohdirPrefix : 'guimohdir_' // ASTGUI.contexts.mohdirPrefix
 		// music on hold directories created by gui will have this prefix
 		// also post_mappings definitions in http.conf will have this name
@@ -1214,12 +1216,19 @@
 		return a instanceof Array || ( a!= null && typeof a=="object" && typeof a.push == "function" && typeof a.concat == "function" )
 	},
 
-	loadHTML: function(u){
+	loadHTML: function(u , cb){
 		// ASTGUI.loadHTML(url)
 		// loads URL 'url' in synchronus mode. note that 'url' is restricted by same origin policy
 		var r =  Math.round(10000*Math.random());
-		var s = $.ajax({ url: u + '?r=' + r , async: false });
-		return s.responseText;
+
+		if( cb && typeof cb == 'function' ) {
+			$.ajax({ url: u + '?r=' + r , async: true, success: function(msg){
+				cb(msg);
+			}});
+		}else{
+			var s = $.ajax({ url: u + '?r=' + r , async: false });
+			return s.responseText;
+		}
 	},
 
 	listSystemFiles : function( dir , cb ){
@@ -1227,16 +1236,17 @@
 		// list of files in 'dir' will be sent to callBackFunction as an array
 		try{
 		this.systemCmd( top.sessionData.directories.script_ListFiles + ' ' +  dir , function(){
-			var op = ASTGUI.loadHTML( top.sessionData.directories.output_SysInfo );
-			var tmp_files = op.split('\n');
-			var files = [];
-			for( var i =0 ; i < tmp_files.length ; i++){
-				if( typeof tmp_files[i] == "undefined" ){ continue; }
-				tmp_files[i] = tmp_files[i].trim();
-				if( tmp_files[i] == "" ){ continue; }
-				files.push(tmp_files[i]);
-			}
-			cb(files);
+			ASTGUI.loadHTML( top.sessionData.directories.output_SysInfo , function(op){
+				var tmp_files = op.split('\n');
+				var files = [];
+				for( var i =0 ; i < tmp_files.length ; i++){
+					if( typeof tmp_files[i] == "undefined" ){ continue; }
+					tmp_files[i] = tmp_files[i].trim();
+					if( tmp_files[i] == "" ){ continue; }
+					files.push(tmp_files[i]);
+				}
+				cb(files);
+			});
 		});
 		}catch(err){
 			ASTGUI.Log.Error(err.description);
@@ -1600,7 +1610,7 @@
 			// expects  q  as 'exten=s,2,foo(ssssssss,ssdsd,assd)' OR 's,2,foo(ssssssss,ssdsd,assd)' OR 's,2,foo(ssssssss|ssdsd|assd)'
 			// OR 's,1,Answer' OR 's,n,Hangup'
 			// and   returns [ssssssss,ssdsd,assd] or [] // arguments as an array 
-			if (typeof q != 'string') return [];
+			if (typeof q != 'string' || !q ) return [];
 			q = q.trim();
 			if ( !q.endsWith(')') || !q.contains('(') ){
 				ASTGUI.Log.Error( "ASTGUI.parseContextLine.getArgs() - No Argument found for \"" + q + "\" " );
@@ -1636,6 +1646,7 @@
 
 		toKnownContext: function(args){  // usage ASTGUI.parseContextLine.toKnownContext(y)
 			// converts args to a readable format - ex: default|6000|1 to 'user 6000'
+			if(!args.length){ return ''; }
 			try{
 			if(typeof args == 'string'){
 				args = this.getArgsArrayFromArgsString(args);
@@ -1648,6 +1659,9 @@
 				if( parent.sessionData.pbxinfo.users.hasOwnProperty(u) ){
 					return 'Goto User ' + u ;
 				}
+			};
+			if( args[0] == 'pagegroups' ){
+				return 'Goto Page Group ' + args[1] ;
 			};
 			if( args[0] == ASTGUI.contexts.QUEUES ){
 				return 'Goto Queue ' + args[1] ;
@@ -1714,6 +1728,9 @@
 			}
 
 			if( all_LC == "disa" ){
+				if ( args[0] && args[1] && args[0] == 'no-password' ){
+					return 'DISA using context ' + args[1] + ' (no password)';
+				}
 				return 'DISA ' + ( args[0] && ' using password ' + args[0] ) + ( args[1] && ' against context ' + args[1] ) ;
 			}
 
@@ -1819,6 +1836,11 @@
 					var channel = u[0] + '/' + u[1] ;
 					u.splice(0,2);
 					WhatToDial = u.join('/'); // take the part after second '/'
+				}
+				if( u.length == 2){
+					var trunkname = u[0] ;
+					var channel = u[0] ;
+					var WhatToDial = u[1] ;
 				}
 			}
 			// we expect WhatToDial to be in '1${EXTEN:1}' or in '${EXTEN}' or in '${EXTEN:1}' or in '9${EXTEN}' format or a plain extensin string
@@ -2281,12 +2303,16 @@
 		// usage :: ASTGUI.systemCmdWithOutput( 'uptime' , callback(output){ /* do something with output */ } );
 		// Use this function when you want to execute a specific system command and read the output
 		// output will be sent as a argument to the callback function
-		var fcmd = cmd + ' > ' + top.sessionData.directories.guiInstall + ( top.sessionData.directories.output_SysInfo.afterChar('/') || top.sessionData.directories.output_SysInfo ) ;
+		//var fcmd = cmd + ' > ' + top.sessionData.directories.guiInstall +  ;
+		var tmp_opf = ( top.sessionData.directories.output_SysInfo.afterChar('/') || top.sessionData.directories.output_SysInfo ).rChop('.html') + Math.round( 10000 * Math.random() ) + '.html' ;
+		var fcmd = cmd + ' > ' + top.sessionData.directories.guiInstall + tmp_opf ;
+
 		var after = function(){
 			parent.document.getElementById('ajaxstatus').style.display = 'none';
-			var op = ASTGUI.loadHTML( top.sessionData.directories.output_SysInfo ) ;
-			cb( op ) ;
+			ASTGUI.loadHTML( tmp_opf , cb );
+			ASTGUI.systemCmd( 'rm ' + top.sessionData.directories.guiInstall + tmp_opf, function(){});
 		};
+
 		var delay_cb = function(){ setTimeout(after,500); };
 		if( parent.sessionData.PLATFORM.isAA50 ){
 			parent.document.getElementById('ajaxstatus').style.display = '';

Modified: team/rbrindley/welcome_revamp/config/js/callingrules.js
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/js/callingrules.js?view=diff&rev=4268&r1=4267&r2=4268
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/callingrules.js (original)
+++ team/rbrindley/welcome_revamp/config/js/callingrules.js Wed Dec  3 10:19:41 2008
@@ -60,6 +60,7 @@
 	}else{
 		_$('toLocalDest').checked = false;
 		ASTGUI.selectbox.selectOption(DOM_new_crl_trunk, tmp_cr.firstTrunk );
+
 		DOM_new_crl_tr_stripx.value = tmp_cr.stripdigits_firstTrunk  ;
 		DOM_new_crl_tr_prepend.value = tmp_cr.firstPrepend ;
 		if(tmp_cr.secondTrunk){
@@ -116,6 +117,12 @@
 			ASTGUI.selectbox.append( DOM_new_crl_trunk, a[0], a[1] );
 			ASTGUI.selectbox.append( DOM_new_crl_fotrunk , a[0], a[1] );
 		});
+
+		var modules_show = ASTGUI.cliCommand('module show');
+		if( modules_show.contains('res_skypeforasterisk') && modules_show.contains('chan_skype') ){
+			ASTGUI.selectbox.append( DOM_new_crl_trunk , 'Skype', 'Skype');
+			ASTGUI.selectbox.append( DOM_new_crl_fotrunk , 'Skype', 'Skype');
+		}
 	})();
 };
 
@@ -305,15 +312,18 @@
 			return ;
 		}
 
-		var Trunk_Build_str = ',${' + t1 + '}/' + DOM_new_crl_tr_prepend.value + '${EXTEN:' + tmp_stripx  + '}' ;
+		var t1_braces = (t1 == 'Skype') ? t1 : '${' + t1 + '}' ;
+		var Trunk_Build_str = ',' + t1_braces + '/' + DOM_new_crl_tr_prepend.value + '${EXTEN:' + tmp_stripx  + '}' ;
 		var foTrunk_Build_str = ',' ;
+
 		if(DOM_new_crl_foChkbx.checked){
-			foTrunk_Build_str += '${' + t2 + '}/' + DOM_new_crl_fotr_prepend.value + '${EXTEN:' + tmp_fotr_stripx + '}' ;
-		}
-
-		var t1 = ',' + t1 ;
-		var t2 = ',' + t2 ;
-		var as = DOM_new_crl_pattern.value + ',1,Macro(' + ASTGUI.contexts.dialtrunks + Trunk_Build_str + foTrunk_Build_str + t1 + t2 + ')' ;
+			var t2_braces = (t2 == 'Skype') ? t2 : '${' + t2 + '}' ;
+			foTrunk_Build_str += t2_braces + '/' + DOM_new_crl_fotr_prepend.value + '${EXTEN:' + tmp_fotr_stripx + '}' ;
+		}
+
+		var t1_cidarg = ( t1 == 'Skype') ? ',' : ',' + t1 ;
+		var t2_cidarg = ( t2 == 'Skype') ? ',' : ',' + t2 ;
+		var as = DOM_new_crl_pattern.value + ',1,Macro(' + ASTGUI.contexts.dialtrunks + Trunk_Build_str + foTrunk_Build_str + t1_cidarg + t2_cidarg + ')' ;
 	}
 
 	if( isNew ){

Modified: team/rbrindley/welcome_revamp/config/js/index.js
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/js/index.js?view=diff&rev=4268&r1=4267&r2=4268
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/index.js (original)
+++ team/rbrindley/welcome_revamp/config/js/index.js Wed Dec  3 10:19:41 2008
@@ -253,11 +253,8 @@
 		sessionData.directories.scripts = sessionData.directories.astvarlibdir + 'scripts/';/* Directory for gui scripts (listfiles, for example) */	
 		sessionData.directories.output_SysInfo = './sysinfo_output.html' ;
 		sessionData.directories.voicemails_dir = sessionData.directories.astspooldir + 'voicemail/default/' ;
-
-
 		sessionData.directories.script_takeBackup =  'sh ' + sessionData.directories.scripts + 'takebackup';
 		sessionData.directories.script_restoreBackup =  'sh ' + sessionData.directories.scripts + 'restorebackup';
-		sessionData.directories.script_SysInfo = 'sh ' + sessionData.directories.scripts + 'gui_sysinfo';
 		sessionData.directories.script_ListFiles = 'sh ' + sessionData.directories.scripts + 'listfiles';
 		sessionData.directories.script_NetworkSettings = 'sh ' + sessionData.directories.scripts + 'networking.sh';
 		sessionData.directories.script_generateZaptel = 'sh ' + sessionData.directories.scripts + 'editzap.sh';
@@ -428,6 +425,21 @@
 		if( !tmp_continue )return;
 
 		$(".AdvancedMode").hide();
+
+		setTimeout( function(){
+			var modules_show = ASTGUI.cliCommand('module show');
+			if( modules_show.contains('res_jabber.so') && modules_show.contains('chan_gtalk.so') ){
+				miscFunctions.hide_panel('gtalk.html', 1);
+			}
+			if( modules_show.contains('codec_g729a') ){
+				miscFunctions.hide_panel('registerg729.html', 1);
+			}
+			if( modules_show.contains('res_skypeforasterisk') && modules_show.contains('chan_skype') ){
+				miscFunctions.hide_panel('skype.html', 1);
+			}
+
+		}, 2000);
+
 		if(sessionData.PLATFORM.isAA50 ){
 			$(".notinAA50").remove(); 
 			$(".forAA50").show();
@@ -526,11 +538,15 @@
 		return TI_LIST;
 	},
 
-	hide_panel: function(fname){ // parent.miscFunctions.hide_panel('page.html')
+	hide_panel: function(fname , show){ // parent.miscFunctions.hide_panel('page.html' , 0/1 )
 		var t = $('.ui-accordion-link') ;
 		for(var p=0; p < t.length ; p++){
 			if( $(t[p].parentNode).attr("page") == fname ){
-				$(t[p].parentNode).hide();
+				if(show){
+					$(t[p].parentNode).show();
+				}else{
+					$(t[p].parentNode).hide();
+				}
 				return;
 			}
 		}
@@ -1011,6 +1027,9 @@
 		DOM_mainscreen.style.top = DOM_accordion_div.offsetTop ;
 		miscFunctions.resizeMainIframe();
 		window.onresize = miscFunctions.resizeMainIframe;
+		window.onunload = function (e) {
+			DOM_mainscreen.src = 'blank.html';
+		};
 		ASTGUI.Log.Debug('calling onLogInFunctions.checkifLoggedIn()');
 		onLogInFunctions.checkifLoggedIn();
 		if(sessionData.DEBUG_MODE){

Modified: team/rbrindley/welcome_revamp/config/js/menus.js
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/js/menus.js?view=diff&rev=4268&r1=4267&r2=4268
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/menus.js (original)
+++ team/rbrindley/welcome_revamp/config/js/menus.js Wed Dec  3 10:19:41 2008
@@ -46,6 +46,7 @@
 var chop_Extension = function(a){
 	if( !a ){ return ''; }
 	if( a.endsWith('.gsm') ){ return a.rChop('.gsm'); }
+	else if( a.endsWith('.wav') ){ return a.rChop('.wav'); }
 	else if( a.endsWith('.alaw') ){ return a.rChop('.alaw'); }
 	else if( a.endsWith('.g722') ){ return a.rChop('.g722'); }
 	else if( a.endsWith('.g729') ){ return a.rChop('.g729'); }
@@ -301,6 +302,18 @@
 					$('#newstep_custom').show();
 					tip_chosenStep.innerHTML = 'Add a <i>Custom Step</i> to the VoiceMenu';
 					break;
+				case 'DialViaSkype':
+					lbl('Dial via Skype');
+					$('#newstep_dial_ThisNumber').show();
+					_$('newstep_dial_ThisNumber').value = '';
+					tip_chosenStep.innerHTML = 'Dial a number/buddy using the default skype account';
+					break;
+				case 'DialViaGtalk':
+					lbl('Dial via gtalk');
+					$('#newstep_gtalkpeers').show();
+					_$('newstep_gtalkpeers').selectedIndex = -1 ;
+					tip_chosenStep.innerHTML = 'Dial a user on the google talk network.';
+					break;
 				case 'Macro':
 					lbl('Macro');
 					$('#newstep_custom').show();
@@ -411,6 +424,12 @@
 				break;
 			case 'CustomApp':
 				newstep = ASTGUI.getFieldValue('newstep_custom') ;
+				break;
+			case 'DialViaSkype':
+				newstep = 'Dial(Skype/' + ASTGUI.getFieldValue('newstep_dial_ThisNumber') + ')' ;
+				break;
+			case 'DialViaGtalk':
+				newstep = 'Dial(gtalk/' + ASTGUI.getFieldValue('newstep_gtalkpeers') + ')' ;
 				break;
 			case 'Macro':
 				newstep = 'Macro(' + ASTGUI.getFieldValue('newstep_custom') + ')' ;
@@ -688,6 +707,25 @@
 	if(parent.sessionData.advancedmode == true ){
 		ASTGUI.selectbox.append('newStep_select_action', 'Custom App', 'CustomApp');
 	}
+
+	setTimeout( function(){
+		var modules_show = ASTGUI.cliCommand('module show');
+		if( modules_show.contains('res_skypeforasterisk') && modules_show.contains('chan_skype') ){
+			ASTGUI.selectbox.append('newStep_select_action', 'Dial via Skype', 'DialViaSkype');
+		}
+		if( modules_show.contains('res_jabber') && modules_show.contains('chan_gtalk') ){
+			ASTGUI.selectbox.append('newStep_select_action', 'Dial via gtalk', 'DialViaGtalk');
+			var GTALK_CNF = config2json({ filename:'gtalk.conf', usf:1 }); // buddies
+			for( buddy in GTALK_CNF ){
+				if( !GTALK_CNF.hasOwnProperty(buddy) || buddy == 'general' ) continue;
+				ASTGUI.selectbox.append( 'newstep_gtalkpeers' , GTALK_CNF[buddy].username , GTALK_CNF[buddy].connection + '/' + GTALK_CNF[buddy].username );
+			}
+		}
+
+
+
+	}, 1000);
+
 	if( !ASTGUI.miscFunctions.alertIfRangeisNotdefined('vme_start','vme_end', 'VoiceMenus') ){
 		$('.top_buttons').hide();
 		return;

Modified: team/rbrindley/welcome_revamp/config/js/pbx.js
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/js/pbx.js?view=diff&rev=4268&r1=4267&r2=4268
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/pbx.js (original)
+++ team/rbrindley/welcome_revamp/config/js/pbx.js Wed Dec  3 10:19:41 2008
@@ -1091,6 +1091,7 @@
 		},
 
 		getTrunkName: function(TRUNK){ // astgui_managetrunks.misc.getTrunkName(TRUNK)
+			if( TRUNK == 'Skype' ) return TRUNK ;
 			var r = sessionData.pbxinfo.trunks;
 			if ( r.sip[TRUNK] ) { return r.sip[TRUNK]['trunkname'] || TRUNK ; }
 			if ( r.iax[TRUNK] ) { return r.iax[TRUNK]['trunkname'] || TRUNK ; }

Modified: team/rbrindley/welcome_revamp/config/js/sysinfo.js
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/js/sysinfo.js?view=diff&rev=4268&r1=4267&r2=4268
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/sysinfo.js (original)
+++ team/rbrindley/welcome_revamp/config/js/sysinfo.js Wed Dec  3 10:19:41 2008
@@ -48,14 +48,18 @@
 };
 
 function getsysinfohtml(){
-	_$('sysinfohtml').innerHTML = ASTGUI.loadHTML(top.sessionData.directories.output_SysInfo);
-	_$('osversion').innerHTML = _$('si_uname').innerHTML;
-	_$('uptime').innerHTML = _$('si_uptime').innerHTML.replace(/load average/, "<BR>Load Average");
+	ASTGUI.systemCmdWithOutput( 'uname -a' , function(output){ _$('osversion').innerHTML = output; });
+	ASTGUI.systemCmdWithOutput( 'uptime' , function(output){ _$('uptime').innerHTML = output.replace(/load average/, "<BR>Load Average"); });
+	ASTGUI.systemCmdWithOutput( 'date' , function(output){ 
+		_$('today').innerHTML = (parent.sessionData.PLATFORM.isAA50) ? ASTGUI.toLocalTime(output).camelize() : output ;
+		if(parent.sessionData.PLATFORM.isAA50) {
+			_$('today').innerHTML += "&nbsp;&nbsp;<A href='date.html' class='splbutton' title='Click to update Date and Time'><B>Edit</B></A>";
+		}
+	});
+	ASTGUI.systemCmdWithOutput( 'hostname' , function(output){ 
+		_$('hostname').innerHTML = output ;
+	});
+
 	_$('asterisk').innerHTML =  parent.sessionData.AsteriskVersionString + "<BR>" + "Asterisk GUI-version : " + ( parent.sessionData.gui_version || ASTGUI.globals.version ) ;
-	_$('today').innerHTML = (parent.sessionData.PLATFORM.isAA50) ? ASTGUI.toLocalTime(_$('si_date').innerHTML).camelize() : _$('si_date').innerHTML ;
-	if(parent.sessionData.PLATFORM.isAA50) {
-		_$('today').innerHTML += "&nbsp;&nbsp;<A href='date.html' class='splbutton' title='Click to update Date and Time'><B>Edit</B></A>";
-	}
-	_$('hostname').innerHTML =_$('si_hostname').innerHTML;
 	$('#tabbedMenu').find('A:eq(0)').click();
 }

Modified: team/rbrindley/welcome_revamp/config/menus.html
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/menus.html?view=diff&rev=4268&r1=4267&r2=4268
==============================================================================
--- team/rbrindley/welcome_revamp/config/menus.html (original)
+++ team/rbrindley/welcome_revamp/config/menus.html Wed Dec  3 10:19:41 2008
@@ -213,6 +213,7 @@
 						<input class='class_newStep_details_td' id="newstep_UserEvent_eventname" size=5>
 						<span  class='class_newStep_details_td' id='newstep_UserEvent_body_lbl'>Body:</span>
 						<input class='class_newStep_details_td' id="newstep_UserEvent_body" size=5>
+						<select class='class_newStep_details_td' id="newstep_gtalkpeers"></select>
 					</td>
 					<td>
 						<span class='guiButton' onclick='VoiceMenus_miscFunctions.push_newstep();'>&uarr; Add new Step</span>

Modified: team/rbrindley/welcome_revamp/config/paging.html
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/paging.html?view=diff&rev=4268&r1=4267&r2=4268
==============================================================================
--- team/rbrindley/welcome_revamp/config/paging.html (original)
+++ team/rbrindley/welcome_revamp/config/paging.html Wed Dec  3 10:19:41 2008
@@ -58,7 +58,7 @@
 	<span style="cursor: pointer; cursor: hand;" onclick="window.location.reload();" >&nbsp;<img src="images/refresh.png" title=" Refresh " border=0 >&nbsp;</span>
 </div>
 
-<div id="tabbedMenu"></div>
+<center><div id="tabbedMenu"></div></center>
 
 
 <div class='hideall' id='TAB_group_Paging'>

Modified: team/rbrindley/welcome_revamp/config/sysinfo.html
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/sysinfo.html?view=diff&rev=4268&r1=4267&r2=4268
==============================================================================
--- team/rbrindley/welcome_revamp/config/sysinfo.html (original)
+++ team/rbrindley/welcome_revamp/config/sysinfo.html Wed Dec  3 10:19:41 2008
@@ -103,6 +103,8 @@
 		ASTGUI.tabbedOptions( _$('tabbedMenu') , t );
 	})();
 	parent.ASTGUI.systemCmd( top.sessionData.directories.script_SysInfo, function(){ parent.ASTGUI.dialog.hide(); getsysinfohtml(); } );
+	parent.ASTGUI.dialog.hide();
+	getsysinfohtml();
 }
 </script>
 
@@ -111,8 +113,6 @@
 
 </style>
 <body bgcolor="EFEFEF">
-<div id="sysinfohtml" style="display:none"></div>
-
 <div class="iframeTitleBar"> System Information <span style="cursor: pointer; cursor: hand;" onclick="window.location.reload();" >&nbsp;<img src="images/refresh.png" title=" Refresh " border=0 >&nbsp;</span> </div>
 
 <div id="tabbedMenu"></div>

Modified: team/rbrindley/welcome_revamp/developer_info/CODING-GUIDELINES
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/developer_info/CODING-GUIDELINES?view=diff&rev=4268&r1=4267&r2=4268
==============================================================================
--- team/rbrindley/welcome_revamp/developer_info/CODING-GUIDELINES (original)
+++ team/rbrindley/welcome_revamp/developer_info/CODING-GUIDELINES Wed Dec  3 10:19:41 2008
@@ -182,6 +182,17 @@
   (http://www.prototypejs.org), we should do what we can to follow their
   conventions.
 
+- Javascript code should be considered as libraries. Functions that can be
+  reused should reside in a file with the proper scope. For example, a
+  generic parsing function that could be used on any page should exist in 
+  index.js as opposed to only welcome.js. 
+
+- Javascript code should exist in a separate file located in config/js/ if
+  code is roughly 100 lines or longer, or used in multiple pages. The
+  exception to this guideline is any window.onload functions (for jQuery
+  this is $(document).ready()). These functions should remain in the html
+  file as they are considered to be custom for that page.
+
 - refrain from using 'onclick' and other associated html attributes. There
   is a wonderful thing called Event Delegation 
   (http://icant.co.uk/sandbox/eventdelegation/). This is a much faster




More information about the asterisk-gui-commits mailing list