pari: branch aadk r874 - in /branches/aadk: ./ config/ config/scripts/

asterisk-gui-commits at lists.digium.com asterisk-gui-commits at lists.digium.com
Fri May 4 15:36:22 MST 2007


Author: pari
Date: Fri May  4 17:36:21 2007
New Revision: 874

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=874
Log:
Merged revisions 841,848,852,856-860,865-866,868,871-872 via svnmerge from 
https://origsvn.digium.com/svn/asterisk-gui/trunk

........
r841 | pari | 2007-05-02 12:20:22 -0500 (Wed, 02 May 2007) | 4 lines

The Service Providers page in the setup wizard is replaced with the
same code of the page from GUI.


........
r848 | pari | 2007-05-02 12:51:50 -0500 (Wed, 02 May 2007) | 1 line

set proper path to service providers logos
........
r852 | pari | 2007-05-02 17:46:19 -0500 (Wed, 02 May 2007) | 1 line

gui_alert replaced by alert
........
r856 | pari | 2007-05-02 20:03:21 -0500 (Wed, 02 May 2007) | 1 line

New Feature: Execute Asterisk CLI commands from the GUI
........
r857 | pari | 2007-05-03 11:18:00 -0500 (Thu, 03 May 2007) | 1 line

setfocus not working -> looks like setfocus is being executed while parent.loadscreen is still in progress, adding a small delay
........
r858 | pari | 2007-05-03 11:30:33 -0500 (Thu, 03 May 2007) | 1 line

Strip off rawman response messages from the command output
........
r859 | pari | 2007-05-03 11:34:10 -0500 (Thu, 03 May 2007) | 1 line

set cli_cmd class to input9
........
r860 | bkruse | 2007-05-03 11:46:38 -0500 (Thu, 03 May 2007) | 1 line

Change run_cmd to cliCommand to stay with the naming convention we have. Awesome job pari
........
r865 | pari | 2007-05-03 12:37:44 -0500 (Thu, 03 May 2007) | 1 line

CLI command history
........
r866 | pari | 2007-05-03 13:46:55 -0500 (Thu, 03 May 2007) | 1 line

onKeyPress do not work with textbox + up/down arrow key events - but found that onKeyDown does, so reverting back to text box using onKeyDown
........
r868 | pari | 2007-05-04 12:54:16 -0500 (Fri, 04 May 2007) | 1 line

load home.html after finished loading parent
........
r871 | pari | 2007-05-04 17:10:19 -0500 (Fri, 04 May 2007) | 1 line

make sure that analog lines are used in only once
........
r872 | pari | 2007-05-04 17:32:31 -0500 (Fri, 04 May 2007) | 1 line

Also in setup wizard: make sure that analog lines are used in only once
........

Added:
    branches/aadk/config/cli.html
      - copied, changed from r860, trunk/config/cli.html
Modified:
    branches/aadk/   (props changed)
    branches/aadk/config/cfgbasic.html
    branches/aadk/config/scripts/astman.js
    branches/aadk/config/trunks.html

Propchange: branches/aadk/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri May  4 17:36:21 2007
@@ -1,1 +1,1 @@
-/trunk:1-430,433-449,489-501,505-506,508-510,512-540,542-557,559,561-577,580-586,588-616,618-767,769-839,851,861
+/trunk:1-430,433-449,489-501,505-506,508-510,512-540,542-557,559,561-577,580-586,588-616,618-767,769-873

Modified: branches/aadk/config/cfgbasic.html
URL: http://svn.digium.com/view/asterisk-gui/branches/aadk/config/cfgbasic.html?view=diff&rev=874&r1=873&r2=874
==============================================================================
--- branches/aadk/config/cfgbasic.html (original)
+++ branches/aadk/config/cfgbasic.html Fri May  4 17:36:21 2007
@@ -111,6 +111,8 @@
 panels.splice(10,0,
 
 	new PanelDef("feditor", "File Editor", "accordion-icon.gif", " Manually edit Config Files"),
+
+	new PanelDef("cli", "Asterisk CLI", "accordion-icon.gif", " Asterisk Command Line Interface"),
 
 	new PanelDef("moh", "Music On Hold", "accordion-icon.gif", " Music on hold sometimes keeps people less angry while they wait for an answer"),
 
@@ -178,6 +180,7 @@
 }
 
 function registerajax() {
+	_$('mainscreen').src = "home.html" ;
 	Rico.Corner.round('tooltip_round', {compact:true});
 		// if you want google style feedback boxes :-)
 		// _$('feedback_round').style.backgroundColor = "#EFEFEF";		 
@@ -281,7 +284,7 @@
 			<span style="margin-left: 4px;font-weight:bold">Loading Screen&nbsp;<img src='images/dots.gif'></span>
 		</div>
 		<div id="borderbox" class="mainscreenBorderBox" height="100%"></div>
-		<iframe width="540" height="505" frameborder="0" border="0" marginheight="0" marginwidth="0" src="home.html" id="mainscreen" style="position:absolute;top:48px;" SCROLLING=no></iframe>
+		<iframe width="540" height="505" frameborder="0" border="0" marginheight="0" marginwidth="0" id="mainscreen" style="position:absolute;top:48px;" SCROLLING=no></iframe>
 	</td>
 	<td valign=top width=250 height="505">
 		<div class="mainscreenTooltipBar" align=right>

Copied: branches/aadk/config/cli.html (from r860, trunk/config/cli.html)
URL: http://svn.digium.com/view/asterisk-gui/branches/aadk/config/cli.html?view=diff&rev=874&p1=trunk/config/cli.html&r1=860&p2=branches/aadk/config/cli.html&r2=874
==============================================================================
--- trunk/config/cli.html (original)
+++ branches/aadk/config/cli.html Fri May  4 17:36:21 2007
@@ -24,6 +24,10 @@
 <link href="stylesheets/rico.css" media="all" rel="Stylesheet" type="text/css" />
 <link href="stylesheets/schwing.css" media="all" rel="Stylesheet" type="text/css" />
 <script>
+var CLI_HSTY = []; // cli history of previous commands 
+var CLI_INDEX = 0; // index for navigating through command history
+var COMMAND;
+
 function localajaxinit() {
 	top._$('mainscreen').width= 798;
 	setWindowTitle("Asterisk CLI Emulator");
@@ -41,19 +45,36 @@
 }
 
 function gotResponse(op){
-
+	var cc = _$('cli_cmd');
 	op = op.replace(/Response: Follows/, "");
 	op = op.replace(/Privilege: Command/, "");
 	op = op.replace(/--END COMMAND--/, "");
-	op = "Command><B> <Font color=#13138a size=+1>" + _$('cli_cmd').value + "</FONT></B>" + op ;
+	op = "Command><B> <Font color=#13138a size=+1>" + COMMAND + "</FONT></B>" + op ;
+	CLI_HSTY.push(COMMAND); CLI_INDEX = CLI_HSTY.length;
 	_$('cli_output').innerHTML = "<PRE>"+ op + "</PRE>";
 	_$('cli_cmd').value = "";
 	_$('cli_cmd').focus();
 }
 
 function sendCommand(e){
+	var cc = _$('cli_cmd');
+
+	if(e.keyCode == 38){
+		if(CLI_INDEX ==0){return false;}
+		cc.value =CLI_HSTY[CLI_INDEX-1]; CLI_INDEX -= 1;
+		cc.focus(); 
+		return false;
+	}
+	if(e.keyCode == 40){
+		if(!CLI_HSTY[CLI_INDEX]){cc.value = ""; CLI_INDEX = CLI_HSTY.length; return false;}
+		cc.value = CLI_HSTY[CLI_INDEX]; CLI_INDEX += 1;
+		cc.focus();
+		return false;
+	}
+
 	if(e.keyCode == 13){
-		executeCommand( _$('cli_cmd').value );
+		COMMAND = cc.value;
+		executeCommand(COMMAND);
 		return false;
 	}
 }
@@ -67,6 +88,6 @@
 </div>
 <div style="padding : 0px 0px 0px 0px;">
 <div style="padding : 0px 1px 0px 2px; height:444px;width= 797px; overflow :auto; font-size : 12px;" id="cli_output"></div><BR>
-Asterisk CLI>&nbsp;<input id="cli_cmd" size=95 onKeyPress="sendCommand(event)" class="input9">
+Asterisk CLI>&nbsp;<input id="cli_cmd" style="height:18px" onKeyDown="sendCommand(event)" class="input9" size=95>
 </div>
 </body>

Modified: branches/aadk/config/scripts/astman.js
URL: http://svn.digium.com/view/asterisk-gui/branches/aadk/config/scripts/astman.js?view=diff&rev=874&r1=873&r2=874
==============================================================================
--- branches/aadk/config/scripts/astman.js (original)
+++ branches/aadk/config/scripts/astman.js Fri May  4 17:36:21 2007
@@ -1049,6 +1049,23 @@
 		};
 		var tmp;
 		opt.parameters="action=originate&channel=" + encodeURIComponent("Local/executecommand@"+asterisk_guitools ) + "&Variable=command%3d"+ encodeURIComponent(tool) + "&application=noop&timeout=60000";
+		tmp = new Ajax.Request(this.url, opt);
+	}
+
+	this.cliCommand = function(cmd, callback) {
+		var opt = {
+			method: 'get',
+			asynchronous: true,
+			onSuccess: function(originalRequest) { 
+				if (callback)
+					callback(originalRequest.responseText);
+			},
+			onFailure: function(t) {
+				gui_alert("Tool Error: " + t.status + ": " + t.statusText);
+			}
+		};
+		var tmp;
+		opt.parameters="action=command&command=" + encodeURIComponent(cmd);
 		tmp = new Ajax.Request(this.url, opt);
 	}
 

Modified: branches/aadk/config/trunks.html
URL: http://svn.digium.com/view/asterisk-gui/branches/aadk/config/trunks.html?view=diff&rev=874&r1=873&r2=874
==============================================================================
--- branches/aadk/config/trunks.html (original)
+++ branches/aadk/config/trunks.html Fri May  4 17:36:21 2007
@@ -40,7 +40,9 @@
 var isnewtrunk;
 var dids_array = [];
 var old_trunkname;
-
+var used_fxos = {};
+used_fxos.oldvalue = "";
+used_fxos.newvalue = "";
 
 function add_didcontext(trunk){
 	var didcontext = asterisk_guiTDPrefix + trunk ;
@@ -126,7 +128,14 @@
 }
 
 callbacks.format = function(t) {
-	if( InArray(dids_array, t.name) ){ return t.fieldbyname['trunkname']; }
+	if( InArray(dids_array, t.name) ){ 
+		// 
+		if(t.fieldbyname['zapchan']){ 
+			var s = t.fieldbyname['zapchan'].split(",");
+			for(var u=0; u < s.length; u++){ used_fxos[s[u]] = true ; }
+		} 
+		return t.fieldbyname['trunkname']; 
+	}
 	return null;
 }
 
@@ -234,6 +243,8 @@
 	}else{
 
 		if( _$('trunkstyleanalog').checked ){
+
+			used_fxos.oldvalue = _$('devices').stored_config.catbyname[_dvcs_v].fieldbyname['zapchan'] ;
 			_$('context').value =  asterisk_guiTDPrefix + _$('name').value  ;
 			var needcomma = 0 ;
 			var count = 0 ;
@@ -246,6 +257,7 @@
 					count++ ;
 				}
 			}
+			used_fxos.newvalue = _$('trunkname').value;
 			_$('trunkname').value = ((count > 1) ? "Ports ":"Port ") + _$('trunkname').value ;
 		}
 
@@ -257,6 +269,7 @@
 }
 
 callbacks.savechanges = function() {
+	update_used_fxos();
 	if(isnewtrunk == 1){ //New Trunk created , add [DID_trunk_x] in extensions.conf
 		add_didcontext(_$('name').value);
 		if (_$('trunkstylevoip').checked) {
@@ -271,9 +284,19 @@
 		callbacks_savechanges_step2();
 	}else{
 		if(old_trunkname != _$('name').value ){ update_didcontext(old_trunkname, _$('name').value); } // rename DID if needed
+		hideSPdetails();
+		loadServiceProvidersintotable();
 	}
 
 	return true;
+}
+
+function update_used_fxos(){
+	var r; 
+	var ovs = used_fxos.oldvalue.split(",");
+	var nvs = used_fxos.newvalue.split(",");
+	for(r=0; r < ovs.length; r++){ delete used_fxos[ovs[r]]; }
+	for(r=0; r < nvs.length; r++){ used_fxos[nvs[r]] = true; }
 }
 
 
@@ -349,6 +372,7 @@
 		_provider.selectedIndex  = -1;
 		count = 0;
 		_trunkname.value = "";
+		used_fxos.oldvalue = "";
 		for (var x=0;x<_zapchan.options.length;x++) {
 			if (_zapchan.options[x].selected) {
 				if (needcomma){ _trunkname.value += "," }
@@ -357,6 +381,7 @@
 				count++;
 			}
 		}
+		used_fxos.newvalue = _trunkname.value; 
 		_trunkname.value = ((count > 1) ? "Ports ":"Port ") + _trunkname.value;
 		_$('callerid').value = 'asreceived';
 		_$('hassip').value = 'no';
@@ -463,6 +488,7 @@
 	_zcal.innerHTML ="";
 	_$('customvoip').style.display = "none" ;
 	_$('voip').style.display= "none";
+	var disablestring;
 
 	if (_$('trunkstyleanalog').checked) {
 		_$('analog').style.display = "block";
@@ -472,10 +498,17 @@
 		}else{
 			for (k=0;k< _zapchan.length ;k++ ){
 				var selectedline = "selectedline" + k;
+				
+				if( used_fxos[_zapchan.options[k].value] && !_zapchan.options[k].selected){
+					disablestring = " disabled";
+				}else{
+					disablestring = "";
+				}
+
 				if(_zapchan.options[k].selected){
-					_zcal.innerHTML += '<LABEL FOR="' + selectedline + '"><INPUT id="' + selectedline + '" TYPE="CHECKBOX" VALUE="'+ _zapchan.options[k].value+ '" checked onclick="update_zapchan()">' + _zapchan.options[k].text + '</LABEL><BR>';
+					_zcal.innerHTML += '<LABEL FOR="' + selectedline + '"><INPUT id="' + selectedline + '" TYPE="CHECKBOX" VALUE="'+ _zapchan.options[k].value+ '" checked onclick="update_zapchan()"' + disablestring +'>' + _zapchan.options[k].text + '</LABEL><BR>';
 				}else{
-					_zcal.innerHTML += '<LABEL FOR="'+ selectedline+'"><INPUT id="' + selectedline + '" TYPE="CHECKBOX" VALUE="'+ _zapchan.options[k].value+ '" onclick="update_zapchan()">' + _zapchan.options[k].text + '</LABEL><BR>';
+					_zcal.innerHTML += '<LABEL FOR="'+ selectedline+'"><INPUT id="' + selectedline + '" TYPE="CHECKBOX" VALUE="'+ _zapchan.options[k].value+ '" onclick="update_zapchan()"' + disablestring +'>' + _zapchan.options[k].text + '</LABEL><BR>';
 				}
 			}
 		}



More information about the asterisk-gui-commits mailing list