pari: branch asterisknow r1916 - /branches/asterisknow/config/digital.html

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Wed Dec 5 19:23:30 CST 2007


Author: pari
Date: Wed Dec  5 19:23:29 2007
New Revision: 1916

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=1916
Log:
store configured hardware information

Modified:
    branches/asterisknow/config/digital.html

Modified: branches/asterisknow/config/digital.html
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/digital.html?view=diff&rev=1916&r1=1915&r2=1916
==============================================================================
--- branches/asterisknow/config/digital.html (original)
+++ branches/asterisknow/config/digital.html Wed Dec  5 19:23:29 2007
@@ -112,6 +112,10 @@
 var GROUPS = [];
 var NEWGROUPNUMBER;
 var CURRENT_SPAN; // span being edited
+var CONFIGUREDHARDWARE = {};
+var DETECTEDHARDWARE = {};
+var hwcfgfile = 'gui_confighw.conf'; // file to store configured hardware information
+
 
 function verify_priChLimit(){
 	var l = String(CURRENT_SPAN);
@@ -358,10 +362,16 @@
 				return false;
 			}
 			for( var l in n ){ if(n.hasOwnProperty(l)){
-				if(n[l]['type'] == 'analog'){continue;} // in this page, we care only about digital spans
+				if(n[l]['type'] == 'analog'){
+					DETECTEDHARDWARE[ n[l]['location'] ] = n[l]['devicetype'];
+					continue;
+				} // in this page, we care only about digital spans
 				SPANS[l] = {};
 				for( var k in n[l] ){ if(n[l].hasOwnProperty(k)){ 
 					SPANS[l][k] = n[l][k]; // store all the other fields in spans[l]
+					if( k=='location' ){
+						DETECTEDHARDWARE[ n[l]['location'] ] = n[l]['devicetype'];
+					}
 					if( k == 'totchans' ){
 						SPANS[l]['spantype'] = n[l]['type'].split('-')[1]; // part after '-' in 'digital-T1' or 'digital-E1'
 						SPANS[l]['min_ch'] = Number(n[l]['basechan']); 
@@ -522,16 +532,40 @@
 	_$('cancel_b').disabled = false;
 }
 
+
+
+
+var storeDetectedHardware = function(){
+	var cmd = 'rm /etc/asterisk/' + hwcfgfile + '; touch /etc/asterisk/' + hwcfgfile;
+	parent.astmanEngine.run_tool( cmd , function(t){
+
+		var storeNewinfo = function(){
+			var uri = ''; c=0;
+			for(var g in DETECTEDHARDWARE){ if( DETECTEDHARDWARE.hasOwnProperty(g) ) { // g is location
+				uri += build_action('newcat', c, g , "", ""); c++;
+				uri += build_action('update', c, g , "device", DETECTEDHARDWARE[g] ); c++;
+			}}
+
+			makerequest('u', hwcfgfile, uri , function(t) {
+				// inform the user to restart
+				_$('status_message').style.display="none";
+				alert("You need to restart your machine for these settings to take effect");
+				window.location.href= "digital.html";
+			});
+		};
+
+		setTimeout( storeNewinfo , 700); // leave some time for rm, touch
+	});
+};
+
+
+
 var applySettings = {
 	generate_zaptel: function(){
 		parent.astmanEngine.run_tool(asterisk_guiEditZap + " applysettings", function(t) {
 			/* anything we need to do here? */
 			parent.astmanEngine.run_tool("ztcfg -vv", function(t) {
-				// inform the user to restart
-				
-				_$('status_message').style.display="none";
-				alert("You need to restart your machine for these settings to take effect");
-				window.location.href= "digital.html";
+				storeDetectedHardware();
 				return true; 
 			});
 		});




More information about the asterisk-gui-commits mailing list