pari: branch asterisknow r1759 - /branches/asterisknow/config/misdn.html

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Mon Oct 29 23:27:51 CDT 2007


Author: pari
Date: Mon Oct 29 23:27:50 2007
New Revision: 1759

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=1759
Log:
This is really confusing

 - I will finish the rest of it after clearing some things with bkruse

 - This is just a commit to save the changes i made so far to misdn.html
   



Modified:
    branches/asterisknow/config/misdn.html

Modified: branches/asterisknow/config/misdn.html
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/misdn.html?view=diff&rev=1759&r1=1758&r2=1759
==============================================================================
--- branches/asterisknow/config/misdn.html (original)
+++ branches/asterisknow/config/misdn.html Mon Oct 29 23:27:50 2007
@@ -80,41 +80,6 @@
 	_$('bg_transparent').style.display = "none";
 }
 
-function preparemenus(){
-	menu.style.width="80";
-	menu.style.borderColor = "#eee #bbb #bbb #ddd";
-	ASTGUI.events.add( document.body , "click", function(){ menu.style.display="none"; } );
-
-	var editSPAN = function(l){ // show values for SPAN l in the edit_span dialog box
-		_$('editspan_SPAN').innerHTML = SPANS[l]['description'];
-		_$('editspan_ALARMS').innerHTML = SPANS[l]['alarms'];
-
-		ASTGUI.selectbox.selectOption( _$('editspan_portset') , SPANS[l]['portset'] );
-
-		_$('editspan_channels').innerHTML = String(SPANS[l]['usedchans']) + "/" + String(SPANS[l]['totchans']) + " ("+SPANS[l]['spantype']+")";
-	
-		if( SPANS[l]['portset'] ){
-			ASTGUI.selectbox.selectOption( _$('editspan_portset') , SPANS[l]['portset'] );
-		}else{
-			_$('editspan_portset').selectedIndex = 0; 
-		}
-		if(SPANS[l]['switchtype']){
-			ASTGUI.selectbox.selectOption( _$('editspan_switchtype') , SPANS[l]['switchtype'] );
-		}else{
-			_$('editspan_switchtype').selectedIndex = -1 ;
-		}
-		ASTGUI.selectbox.selectOption( _$('editspan_syncsrc') , SPANS[l]['syncsrc'] );
-		ASTGUI.selectbox.selectOption( _$('editspan_lbo') , SPANS[l]['lbo'] );
-		_$('edit_span').style.display = "";
-		_$('bg_transparent').style.display = "";
-	};
-
-	var menuitem1 = document.createElement('div');
-	menuitem1.innerHTML = "Edit" ;
-	menuitem1.onclick =  function(){ hide_mymenu();  editSPAN( this.parentNode.span_value); };
-	menu.appendChild(menuitem1);
-}
-
 function show_downmenu(s){
 	var a = _$("span_"+s);
 	menu.span_value = s ;
@@ -173,172 +138,7 @@
 
 }
 
-function localajaxinit(){
-	menu = document.getElementById('mymenu');
-	setWindowTitle("mISDN Setup Wizard");
-	top._$('mainscreen').width= 798;
-	_$('save_b').disabled = true;
-	_$('cancel_b').disabled = true;
-
-	ASTGUI.events.add( _$('bridging') , "change" , function(){_$('save_b').disabled = false; _$('cancel_b').disabled = false;}) ;
-	ASTGUI.events.add( _$('echocancel') , "change" , function(){_$('save_b').disabled = false; _$('cancel_b').disabled = false;}) ;
-	ASTGUI.events.add( _$('echotraining') , "change" , function(){_$('save_b').disabled = false; _$('cancel_b').disabled = false;}) ;
-
-	showdiv_statusmessage(); // create status message dialog
-	_$('message_text').innerHTML = "Detecting mISDN Cards ...";
-	_$('status_message').style.display="block";
-	setTimeout("_$('status_message').style.display='none';", 3000);
-	preparemenus();
-	loadConfigFiles.runandread();
-	parent.loadscreen(this);
-}
-
-var loadConfigFiles = {
-	// read applyzap.conf (if exists) - so that the GUI knows the last configured hardware
-	// run ztscan - to detect digital cards
-	// read ztscan.conf - read spans information 
-	//   see if the number of spans in ztscan.conf matches with that from applyzap.conf 
-	//   (this way we know if any changes in digital hardware since the gui was last used)
-	// read users.conf - and read spans information
-
-	runandread: function(){
-		
-		var applyMParse = function(n){ // read applyzap.conf
-			if( ASTGUI.checkType.isString(n) &&  n=="ERROR: CONFIG FILE NOT FOUND" ){ 
-				oldSpanCount = 0;
-				oldLoadZone ='us';
-				setTimeout( function(){ parent.astmanEngine.run_tool("/bin/touch /etc/asterisk/applyzap.conf", function(){} ); } , 100);
-			}else{
-				try{
-					if ( n['default']['bridging'] ) { ASTGUI.selectbox.selectOption( _$('bridging'), n['general'][i].split('bridging=')[1]); }
-					for (var i=0; i < n['general'].length; i++){
-						if( n['general'][i].beginsWith('span=') ){ oldSpanCount++; continue; }
-						tmpfields = ['echocancel', 'echotraining'];
-						for (var x=0; x < tmpfields.length; x++) {
-							if( n['general'][i].contains(tmpfields[x]+'=') ){
-								ASTGUI.selectbox.selectOption( _$(tmpfields[x]) , n['general'][i].split(tmpfields[x]+'=')[1]);
-								continue;
-							}
-						}
-					}
-				}catch(err){
-
-				}
-			}
-			loadConfigFiles.runmISDN(); // to next step - run ztscan and read ztscan.conf
-		};
-		config2json("misdn.conf", 0, applyMParse);
-	},
-
-	runmISDN: function(){
-		parent.astmanEngine.run_tool(asterisk_guiMisdn_scan, function(t) { // run ztscan and then try loading ztscan.conf
-			setTimeout( function(){ loadConfigFiles.loadMisdnConf();} , 1000); // leave some time for misdn-init to generate /etc/misdn-init.conf
-		});
-	},
-
-	loadMisdnConf: function(n){
-
-		var makeSymLink = function() {
-			parent.astmanEngine.run_tool("/bin/touch /etc/asterisk/misdn-init.conf", function(t) { // touch misdn-init.conf so we can write to it
-				var h= 0;
-				var uri = build_action('newcat', h, 'general', '', '', ''); h++;
-				uri += build_action('append', h, 'general', '#include "../misdn-init.conf" ;', '', '');
-				makerequest('u', 'misdn-init.conf', uri, function(t){return true;});
-			})
-		}
-		var digitalparse = function(n){
-		parent.astmanEngine.run_tool(asterisk_guiMisdn + " scan", function(t) { return true});
-		if( n == "ERROR: CONFIG FILE NOT FOUND"){
-			gui_feedback("First time running mISDN scan detected!");
-			makeSymLink();
-		}
-		//	loadConfigFile.loadMisdnConf();
-			/* We are setting up mISDN for the first time. */
-			new Ajax.Request("/asterisk/static/scan.html", {
-				method : "get",
-				asynchronous : true,
-				onComplete : function(c) {
-					var records = c.responseText.split("\n");
-					var span = 1;
-					for(var mn = 0; mn < records.length; mn++) {
-						if(records[mn].beginsWith('card=')) { 
-							/* We found a 4 port mISDN card */
-							CARDS++;
-							var ns = (span + 3);
-							while(span <= ns) {
-								if(!SPANS[span]) { SPANS[span] = {}; }
-								SPANS[span]['card'] = records[mn];
-								span++;
-							}
-						}
-					}
-					if(CARDS == 0) {
-						_$('errmsg').innerHTML = "No mISDN Cards detected (found 0 spans)!";
-						_$('errmsg').style.display = '';
-						_$('div_digitalcardstable').style.display = 'none';
-						gui_feedback("No mISDN Cards found !!");
-						return false;
-					}
-					_$('b410p_cards').innerHTML = "You Have <i>"+CARDS+"x</i> B410p Card(s)";
-					/* Here we would call something to setup a table for basic cards... (4 port BRI)*/
-					return true;
-				},
-				onFailure : function() {
-					gui_alert("For some reason, I could not grab scan.html, is the misdn-init tool installed?");
-					return false;
-				}
-			});
-			for( var l in n ){ if(n.hasOwnProperty(l)){
-				if( l =='general') { 
-					if(!n[l]['card']) {
-						_$('errmsg').innerHTML = "No mISDN Cards detected (found 0 spans)!";
-						_$('errmsg').style.display = '';
-						_$('div_digitalcardstable').style.display = 'none';
-						gui_feedback("No Cards/Spans found !!");
-						return false;
-					}
-					var parse_fields = ['te_ptp', 'te_ptmp', 'te_capi_ptp', 'te_capi_ptmp', 'nt_ptp', 'nt_ptmp']; 
-					for(var x=0; x < parse_fields.length; x++) {
-						if(n[l][parse_fields[x]]) {
-							var k = n[l][parse_fields[x]].split(",")
-							for(var i in k){ if(k.hasOwnProperty(i)){
-								if(!SPANS[k[i]]) { SPANS[k[i]] = {}; }
-								SPANS[k[i]]['portset'] = parse_fields[x];
-							}}
-						}
-					}
-					continue;
-				}
-			}}
-			loadConfigFiles.checkHardwareChanges();
-		};
-		config2json("misdn-init.conf", 1, digitalparse);
-	},
-
-	checkHardwareChanges: function(){
-		var usersparse = function(n){ // read users.conf and load switchtype, signalling, zapchan into the SPANS object
-			if( n == "ERROR: CONFIG FILE NOT FOUND"){
-				_$('errmsg').innerHTML = "/etc/asterisk/users.conf not found";
-				_$('errmsg').style.display = '';
-				_$('div_digitalcardstable').style.display = 'none';
-				gui_feedback("No Users File found !!");
-				return false;
-			}
-			var abcd = function(){
-				var tmp;
-				for( var l in n ){ if(n.hasOwnProperty(l)){
-					if( l.beginsWith('bri_')) {
-						tmp = l.split('bri_')[1];
-						if (!SPANS[tmp]){SPANS[tmp] = {};}
-						for( var k in n[l] ){ if(n[l].hasOwnProperty(k)){ SPANS[tmp][k] = n[l][k]; }}
-					}
-				}}
-			}();
-			showtable();
-		};
-		config2json("users.conf", 1, usersparse);
-	}
-};
+
 
 
 
@@ -457,6 +257,350 @@
 	});
 }
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+var loadConfigFiles = {
+	// read misdn.conf (if exists) - so that the GUI knows the last configured hardware
+	// run ztscan - to detect digital cards
+	// read ztscan.conf - read spans information 
+	//   see if the number of spans in ztscan.conf matches with that from applyzap.conf 
+	//   (this way we know if any changes in digital hardware since the gui was last used)
+	// read users.conf - and read spans information
+
+	runandread: function(){
+		
+		var applyMParse = function(n){ // read misdn.conf
+			if( ASTGUI.checkType.isString(n) &&  n=="ERROR: CONFIG FILE NOT FOUND" ){ 
+				oldSpanCount = 0;
+				oldLoadZone ='us';
+				setTimeout( function(){ parent.astmanEngine.run_tool("/bin/touch /etc/asterisk/misdn.conf", function(){} ); } , 100);
+			}else{
+				try{
+					if ( n['default']['bridging'] ) { ASTGUI.selectbox.selectOption( _$('bridging'), n['general'][i].split('bridging=')[1]); }
+					for (var i=0; i < n['general'].length; i++){
+						if( n['general'][i].beginsWith('span=') ){ oldSpanCount++; continue; }
+						tmpfields = ['echocancel', 'echotraining'];
+						for (var x=0; x < tmpfields.length; x++) {
+							if( n['general'][i].contains(tmpfields[x]+'=') ){
+								ASTGUI.selectbox.selectOption( _$(tmpfields[x]) , n['general'][i].split(tmpfields[x]+'=')[1]);
+								continue;
+							}
+						}
+					}
+				}catch(err){
+
+				}
+			}
+			loadConfigFiles.runmISDN(); // to next step - run misdn-init scan
+		};
+		config2json("misdn.conf", 0, applyMParse);
+	},
+
+	runmISDN: function(){
+		parent.astmanEngine.run_tool(asterisk_guiMisdn_scan, function(t) { // run 'misdn-init scan'
+			setTimeout( function(){ loadConfigFiles.loadScanHtml();} , 1000); // leave some time for 'misdn-init scan' to generate scan.html
+		});
+	},
+
+	loadScanHtml: function(n){ // reads and parses scan.html
+			new Ajax.Request("/asterisk/static/scan.html", {
+				method : "get",
+				asynchronous : true,
+				onComplete : function(c) {
+					try{
+						var records = c.responseText.split("\n");
+						var span = 1;
+						for(var mn = 0; mn < records.length; mn++) {
+							if(records[mn].beginsWith('card=')) { 
+								/* We found a 4 port mISDN card */
+								CARDS++;
+								var ns = (span + 3);
+								while(span <= ns) {
+									if(!SPANS[span]) { SPANS[span] = {}; }
+									SPANS[span]['card'] = records[mn];
+									span++;
+								}
+							}
+						}
+						if(CARDS == 0) {
+							_$('errmsg').innerHTML = "No mISDN Cards detected (found 0 spans)!";
+							_$('errmsg').style.display = '';
+							_$('div_digitalcardstable').style.display = 'none';
+							gui_feedback("No mISDN Cards found !!");
+							return false;
+						}
+						_$('b410p_cards').innerHTML = "You Have <i>"+CARDS+"x</i> B410p Card(s)";
+						/* Here we would call something to setup a table for basic cards... (4 port BRI)*/
+					}catch(err){
+						_$('errmsg').innerHTML = "No mISDN Cards detected (found 0 spans)!";
+						_$('errmsg').style.display = '';
+						_$('div_digitalcardstable').style.display = 'none';
+						gui_feedback("No mISDN Cards found !!");
+						return false;
+					}
+					finally{
+						loadConfigFiles.loadMisdnConf(); // reads and parses misdn-init.conf
+					}
+					
+					return true;
+				},
+				onFailure : function() {
+					gui_alert("For some reason, I could not grab scan.html, is the misdn-init tool installed?");
+					return false;
+				}
+			});
+	},
+
+	loadMisdnConf: function(n){ // reads and parses misdn-init.conf
+		var makeSymLink = function() {
+			parent.astmanEngine.run_tool("/bin/touch /etc/asterisk/misdn-init.conf", function(t) { // touch misdn-init.conf so we can write to it
+				var h= 0;
+				var uri = build_action('newcat', h, 'general', '', '', ''); h++;
+				uri += build_action('append', h, 'general', '#include "../misdn-init.conf" ;', '', '');
+				makerequest('u', 'misdn-init.conf', uri, function(t){return true;});
+			})
+		}
+		var digitalparse = function(n){
+			parent.astmanEngine.run_tool(asterisk_guiMisdn + " scan", function(t) { return true});
+			if( n == "ERROR: CONFIG FILE NOT FOUND"){
+				gui_feedback("First time running mISDN scan detected!");
+				makeSymLink();
+			}
+			//	loadConfigFile.loadMisdnConf();
+			/* We are setting up mISDN for the first time. */
+			for( var l in n ){ if(n.hasOwnProperty(l)){
+				if( l =='general') { 
+					if(!n[l]['card']) {
+						_$('errmsg').innerHTML = "No mISDN Cards detected (found 0 spans)!";
+						_$('errmsg').style.display = '';
+						_$('div_digitalcardstable').style.display = 'none';
+						gui_feedback("No Cards/Spans found !!");
+						return false;
+					}
+					var parse_fields = ['te_ptp', 'te_ptmp', 'te_capi_ptp', 'te_capi_ptmp', 'nt_ptp', 'nt_ptmp']; 
+					for(var x=0; x < parse_fields.length; x++) {
+						if(n[l][parse_fields[x]]) {
+							var k = n[l][parse_fields[x]].split(",")
+							for(var i in k){ if(k.hasOwnProperty(i)){
+								if(!SPANS[k[i]]) { SPANS[k[i]] = {}; }
+								SPANS[k[i]]['portset'] = parse_fields[x];
+							}}
+						}
+					}
+					continue;
+				}
+			}}
+			loadConfigFiles.checkHardwareChanges();
+		};
+		config2json("misdn-init.conf", 1, digitalparse);
+	},
+
+	checkHardwareChanges: function(){
+		var usersparse = function(n){ // read users.conf and load switchtype, signalling, zapchan into the SPANS object
+			if( n == "ERROR: CONFIG FILE NOT FOUND"){
+				_$('errmsg').innerHTML = "/etc/asterisk/users.conf not found";
+				_$('errmsg').style.display = '';
+				_$('div_digitalcardstable').style.display = 'none';
+				gui_feedback("No Users File found !!");
+				return false;
+			}
+			var abcd = function(){
+				var tmp;
+				for( var l in n ){ if(n.hasOwnProperty(l)){
+					if( l.beginsWith('bri_')) {
+						tmp = l.split('bri_')[1];
+						if (!SPANS[tmp]){SPANS[tmp] = {};}
+						for( var k in n[l] ){ if(n[l].hasOwnProperty(k)){ SPANS[tmp][k] = n[l][k]; }}
+					}
+				}}
+			}();
+			showtable();
+		};
+		config2json("users.conf", 1, usersparse);
+	}
+};
+
+
+
+
+
+
+
+
+
+function preparemenus(){
+	menu.style.width="80";
+	menu.style.borderColor = "#eee #bbb #bbb #ddd";
+	ASTGUI.events.add( document.body , "click", function(){ menu.style.display="none"; } );
+
+	var editSPAN = function(l){ // show values for SPAN l in the edit_span dialog box
+		_$('editspan_SPAN').innerHTML = SPANS[l]['description'];
+		_$('editspan_ALARMS').innerHTML = SPANS[l]['alarms'];
+
+		ASTGUI.selectbox.selectOption( _$('editspan_portset') , SPANS[l]['portset'] );
+
+		_$('editspan_channels').innerHTML = String(SPANS[l]['usedchans']) + "/" + String(SPANS[l]['totchans']) + " ("+SPANS[l]['spantype']+")";
+	
+		if( SPANS[l]['portset'] ){
+			ASTGUI.selectbox.selectOption( _$('editspan_portset') , SPANS[l]['portset'] );
+		}else{
+			_$('editspan_portset').selectedIndex = 0; 
+		}
+		if(SPANS[l]['switchtype']){
+			ASTGUI.selectbox.selectOption( _$('editspan_switchtype') , SPANS[l]['switchtype'] );
+		}else{
+			_$('editspan_switchtype').selectedIndex = -1 ;
+		}
+		ASTGUI.selectbox.selectOption( _$('editspan_syncsrc') , SPANS[l]['syncsrc'] );
+		ASTGUI.selectbox.selectOption( _$('editspan_lbo') , SPANS[l]['lbo'] );
+		_$('edit_span').style.display = "";
+		_$('bg_transparent').style.display = "";
+	};
+
+	var menuitem1 = document.createElement('div');
+	menuitem1.innerHTML = "Edit" ;
+	menuitem1.onclick =  function(){ hide_mymenu();  editSPAN( this.parentNode.span_value); };
+	menu.appendChild(menuitem1);
+}
+
+
+function localajaxinit(){
+	menu = document.getElementById('mymenu');
+	setWindowTitle("mISDN Setup Wizard");
+	top._$('mainscreen').width= 798;
+	_$('save_b').disabled = true;
+	_$('cancel_b').disabled = true;
+
+	var y = function(){_$('save_b').disabled = false; _$('cancel_b').disabled = false;};
+	ASTGUI.events.add( _$('bridging'),'change',y);
+	ASTGUI.events.add( _$('echocancel'),'change',y);
+	ASTGUI.events.add( _$('echotraining'),'change',y);
+
+	showdiv_statusmessage(); // create status message dialog
+	_$('message_text').innerHTML = "Detecting mISDN Cards ...";
+	_$('status_message').style.display='';
+	setTimeout(function(){_$('status_message').style.display='none';}, 3000);
+	preparemenus();
+	loadConfigFiles.runandread();
+	parent.loadscreen(this);
+}
+
+
 </script>
 <body onload="localajaxinit()" onunload="resetmainscreen()"  bgcolor="#EFEFEF">
 
@@ -470,15 +614,20 @@
 <div style="overflow:auto;left:40" id="div_digitalcardstable">
 	<h2 align="center"><div id="b410p_cards"></div></h2>
 	<table class="taglist" id="digitalcardstable" cellpadding=5 cellspacing=1 border=0 align=center></table>
-	<table  cellpadding=5 cellspacing=1 align=center border=0>
-		<h2 align="center">General mISDN Settings</h2>
-		<tr align="center">	<td align="right">Bridging :
+	<h2 align="center">General mISDN Settings</h2>
+	<table  cellpadding=5 cellspacing=1 align=center border=0 width=275>
+		<tr>
+			<td align="right">Bridging :</td>
+			<td>
 				<select id="bridging">
 					<option value="yes">Yes</option>
 					<option value="no">No</option>
 				</select>
 			</td>
-			<td align="right">Echo Cancel :
+		</tr>
+		<tr>		
+			<td align="right">Echo Cancel :</td>
+			<td>
 				<select id="echocancel">
 					<option value="0">0 (No)</option>
 					<option value="32">32 MS</option>
@@ -487,7 +636,10 @@
 					<option value="256">256 MS</option>
 				</select>
 			</td>
-			<td align="right">Echo Training :
+		</tr>
+		<tr>
+			<td align="right">Echo Training :</td>
+			<td>
 				<select id="echotraining">
 					<option value="yes">Yes</option>
 					<option value="no">No</option>
@@ -495,7 +647,7 @@
 			</td>
 		</tr>
 		<tr>
-			<td>
+			<td colspan=2 align=center>
 				<input align="center" type="button" id="save_b" value="Apply Changes" onclick="applyDigitalSettings()"> &nbsp;&nbsp;
 				<input align="center" type="button" id="cancel_b" value="Cancel Changes" onclick="reloadpage()">
 			</td>




More information about the asterisk-gui-commits mailing list