pari: branch asterisknow r1769 - in /branches/asterisknow/config: ./ scripts/

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Fri Nov 2 17:49:26 CDT 2007


Author: pari
Date: Fri Nov  2 17:49:26 2007
New Revision: 1769

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=1769
Log:
misdn/bri detection and configuration with some default options

Modified:
    branches/asterisknow/config/misdn.html
    branches/asterisknow/config/scripts/astman.js

Modified: branches/asterisknow/config/misdn.html
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/misdn.html?view=diff&rev=1769&r1=1768&r2=1769
==============================================================================
--- branches/asterisknow/config/misdn.html (original)
+++ branches/asterisknow/config/misdn.html Fri Nov  2 17:49:26 2007
@@ -66,618 +66,272 @@
 	}
 </style>
 <script>
-var SPANS = {};
-var oldSpanCount = 0; // we get this from previuos applyzap.conf
-var oldLoadZone;
-var menu ; // document.getElementById('mymenu');
-var tot_spans = 0;
 var CARDS = 0;
-
-function hide_mymenu(){ menu.style.display="none"; }
-
-function canelSpanInfo(){
-	_$('edit_span').style.display = "none";
-	_$('bg_transparent').style.display = "none";
-}
-
-function show_downmenu(s){
-	var a = _$("span_"+s);
-	menu.span_value = s ;
-	ASTGUI.alignBbelowA(a,menu);
-	setTimeout( function(){ menu.style.display=""; } , 100 );
-}
-
-function showtable(){ // navigates through the SPANS object and presents as a table to the user
-	var tbl = _$('digitalcardstable') ;
-
-	var add_fRow = function(){
-		var newRow = tbl.insertRow(-1);
-		newRow.className = "frow";
-
-		var l = 0;
-		var newCell0 = newRow.insertCell(l);
-		newCell0.innerHTML =  "Span/Card";
-		newCell0.style.width = 15; l++;
-
-		var newCell1 = newRow.insertCell(l); l++;
-		newCell1.innerHTML =  "Port Settings";
-
-		var newcell2 = newRow.insertCell(l); l++;
-		newcell2.innerhtml = "Advanced Options" ;
-
-	};
-
-	var addrow_totable = function(span){
-		var sno = tbl.rows.length + 1;
-		var newRow = tbl.insertRow(-1);
-		newRow.className = ((tbl.rows.length)%2==1)?"odd":"even";
-
-		newRow.id ="row" + span ;
-		newRow["span_value"] = span;
-
-		var l = 0;
-		var newCell0 = newRow.insertCell(l); l++
-		newCell0.innerHTML =  span + " / " + SPANS[span]['card'].split("=")[1].split(",")[0];
-		newCell0.style.width = 5;
-
-		var newCell1 = newRow.insertCell(l); l++
-		ASTGUI.selectbox.selectOption( _$('editspan_portset') , SPANS[span]['portset'] );
-		newCell1.innerHTML =  _$('editspan_portset')[_$('editspan_portset').selectedIndex].innerHTML;
-		_$('editspan_portset').selectedIndex = 0;	
-		newCell1.align = "center";
+var PORTS = {}; // each port corresponds to a physical port on the bri card
+var pmode_defs = {
+	'te_ptp':'TE-Mode, PTP',
+	'te_ptmp':'TE-Mode, PTMP',
+	'te_capi_ptp':'TE-Mode(Capi), PTP',
+	'te_capi_ptmp':'TE-Mode(Capi), PTMP',
+	'nt_ptp':'NT-Mode, PTP',
+	'nt_ptmp':'NT-Mode, PMTP'
+};
+
+function resetmainscreen(){ top._$('mainscreen').width= 540; }
+
+function localajaxinit(){
+	setWindowTitle("misdn Cards Configuration");
+	top._$('mainscreen').width= 798;
+	showdiv_statusmessage(); // create status message dialog
+	_$('message_text').innerHTML = "Detecting BRI Cards ...";
+	_$('status_message').style.display='';
+	setTimeout("_$('status_message').style.display='none';", 1000);
+
+	parent.loadscreen(this);
+	setTimeout(
+		function(){
+			 parent.astmanEngine.run_tool("touch /etc/asterisk/misdninit_guiRead.conf", function(t){
+				misdnConfig.detectCards();
+			})
+		}
+	, 1000 );
+}
+
+var misdnConfig = {
+
+	detectCards: function(){
+		parent.astmanEngine.run_tool(asterisk_guiMisdn_scan, function(t) { // run 'misdn-init scan'
+			var loadScanHtml = function(){
+				new Ajax.Request("./scan.html", {
+					method : "get",
+					asynchronous : true,
+					onComplete : function(c){
+						try{
+							var records = c.responseText.split("\n");
+							var span=1, ns;
+							for(var mn = 0; mn < records.length; mn++) {
+								if(records[mn].contains('card')) { /* assume b410p */
+									CARDS++; ns = (span + 3);
+									var csp = 1;
+									while(span <= ns) {
+										if(!PORTS[span]) {
+											PORTS[span] = {}; 
+											PORTS[span]['card'] = records[mn];
+											PORTS[span]['cardno'] = CARDS;
+											PORTS[span]['card_portno'] = csp;
+										} span++; csp++;
+									}
+								}
+							}
+							if(CARDS == 0) {
+								_$('errmsg').innerHTML = "No mISDN Cards detected (found 0 spans)!";
+								_$('errmsg').style.display = '';
+								_$('div_misdncardstable').style.display = 'none';
+								gui_feedback("No mISDN Cards found !!");
+								return false;
+							}
+							_$('b410p_cards').innerHTML = "<B>"+CARDS+"</B> B410p Card(s) detected !";
+						}catch(err){
+							_$('errmsg').innerHTML = "No mISDN Cards detected (found 0 spans)!";
+							_$('errmsg').style.display = '';
+							_$('div_misdncardstable').style.display = 'none';
+							gui_feedback("No mISDN Cards found !!");
+							return false;
+						}
+						finally{
+							misdnConfig.readCardsConfiguration(); // 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;
+					}
+				});
+			};
+			setTimeout( function(){loadScanHtml();} , 1000); // leave some time for 'misdn-init scan' to generate scan.html
+		});
+	},
+	readCardsConfiguration: function(){
+
+		var parseMisdnInit = function(c){
+			var records = c['general'] ;
+			var a,b,c,d;
+
+			for(var t=0; t < records.length; t++ ){
+				if( records[t].beginsWith('nt_ptp') || records[t].beginsWith('nt_ptmp') || records[t].beginsWith('te_ptp') || records[t].beginsWith('te_ptmp')  || records[t].beginsWith('te_capi_ptp') || records[t].beginsWith('te_capi_ptmp') ){
+					a = records[t].split("=")[0];
+					b = records[t].split("=")[1];
+					if( b.contains(",") ){
+						c = b.split(",");
+						c.each( function(d) {
+							PORTS[d]['portType'] = a.strip(); // set port type of port d to a
+						});
+					}else{
+						PORTS[b]['portType'] = a.strip(); // set port type of port d to a
+					}
+				}
+			}
+			// done parsing misdn-init.conf
+			// show table
+			parent.astmanEngine.run_tool("touch /etc/asterisk/applymisdn.conf", function(t){}) // just to make sure it is there later when we write to it
+			misdnConfig.showMisdnConfiginTable();
+		};
+
+		var somefunction = function(){
+			var c = 0;
+			var uri = build_action('delcat', c, 'general', "", ""); c++;
+			uri += build_action('newcat', c, 'general', "", ""); c++;
+			uri += build_action('update', c, 'general', '#include "../misdn-init.conf" ; = ', ''); c++;
+			makerequest('u', "misdninit_guiRead.conf", uri, function(t) { config2json("misdninit_guiRead.conf", 0, parseMisdnInit); });
+		}();
+	},
+
+	showMisdnConfiginTable: function(){
+		var tbl = _$('misdntable') ;
+		var add_fRow = function(){
+			var newRow = tbl.insertRow(-1);
+			newRow.className = "frow";
+
+			var newCell0 = newRow.insertCell(0);
+			newCell0.innerHTML = "Card/Port";
 	
-		var newCell2 = newRow.insertCell(l); l++
-		newCell2.innerHTML = "<span class=\"downmenubutton\" id='" + "span_" + span + "'  onclick=\"show_downmenu( '"+ span + "');\">Options&nbsp;&nbsp;<img src=images/1.gif></span>" ;
-		newCell2.style.width = 90;
-		newCell2.align = "center";
-	};
-
-	ASTGUI.domActions.clear_table(tbl);
-	add_fRow();
-	for( var k in SPANS ){ if( SPANS.hasOwnProperty(k) ){ addrow_totable(k); }}
-
-}
-
-
-
-
-
-function resetmainscreen(){ top._$('mainscreen').width= 540; }
-
-function reloadpage(){ window.location.href="misdn.html"; }
-
-function updateSpanInfo(){
-	var b = String( menu.span_value );
-	SPANS[b]['portset'] = _$('editspan_portset').value;
-	SPANS[b]['switchtype'] = _$('editspan_switchtype').value;
-	SPANS[b]['syncsrc'] = _$('editspan_syncsrc').value;
-	SPANS[b]['lbo'] = _$('editspan_lbo').value;
-	canelSpanInfo();
-	_$('save_b').disabled = false;
-	_$('cancel_b').disabled = false;
-	showtable();
-}
-
-var applySettings = {
-	generate_zaptel: function(){
-		parent.astmanEngine.run_tool(asterisk_guiEditZap + " applysettings misdn", function(t) {
-			/* anything we need to do here? */
-			// inform the user to restart
+			var newCell1 = newRow.insertCell(1);
+			newCell1.innerHTML = "Mode";
+	
+			var newCell2 = newRow.insertCell(2);
+			newCell2.innerHTML =  "";
+		};
+
+		var addrow_totable = function(port_no){
+			var sno = tbl.rows.length + 1;
+			var newRow = tbl.insertRow(-1);
+			newRow.id = 'misdntable_r'+port_no;
+			newRow["port_no"] = port_no;
+			if( PORTS[port_no]['edited'] ){ newRow.style.background = "#C9AAAA"; }
+
+			var newCell0 = newRow.insertCell(0);
+			newCell0.innerHTML = PORTS[port_no]['cardno'] + "/" + PORTS[port_no]['card_portno'];
+			newCell0.align = "center";
+
+			var newCell1 = newRow.insertCell(1);
+			newCell1.innerHTML = pmode_defs[PORTS[port_no]['portType']] ;
+			newCell1.align = "center";
+
+			var newCell2 = newRow.insertCell(2);
+			newCell2.innerHTML = '<input type=button value="Edit" onclick="edit_port(' + port_no  + ')">';
+			newCell2.align = "center";
+		};
+
+		ASTGUI.domActions.clear_table(tbl);
+		add_fRow();
+		for( var k in PORTS ){ if( PORTS.hasOwnProperty(k) ){ addrow_totable(k); }}
+
+	}
+};
+
+function edit_port(p){
+	ASTGUI.selectbox.selectOption( _$('editport_type'), PORTS[p]['portType'] );
+	_$('editport_label').innerHTML = PORTS[p]['cardno'] + "/" + PORTS[p]['card_portno']
+	_$('edit_port').style.display = "";
+	_$('edit_port')['port_editing'] = p;
+	
+}
+
+
+function canelPortInfo(){
+	_$('edit_port').style.display = "none";
+}
+
+function updatePortInfo(){
+	var p = _$('edit_port')['port_editing'];
+	PORTS[p]['portType'] = _$('editport_type').value;
+	PORTS[p]['edited'] = true;
+	misdnConfig.showMisdnConfiginTable();
+	_$('edit_port').style.display = "none";
+
+	_$('misdntable_r'+p).style.background = "#C9AAAA";
+
+}
+
+function reloadpage(){
+ window.location.href = window.location.href;
+}
+
+
+function generate_applyMisdn(){
+ //save the PORTS object with some default options into /etc/misdn-init.conf via /etc/asterisk/applymisdn.conf
+	 // first generate the output into [general] section of applymisdn.conf
+	var uri = '', c=0, d= 'general', e, addedcards = {};
+	var pmode_ports = {'te_ptp':[] , 'te_ptmp':[] ,'te_capi_ptp':[] , 'te_capi_ptmp':[] ,'nt_ptp':[] , 'nt_ptmp': [] };
+
+	uri += build_action('delcat', c, d , "", ""); c++;
+	uri += build_action('newcat', c, d , "", ""); c++;
+
+	for( var k in PORTS ){ if( PORTS.hasOwnProperty(k) ){ 
+		e = PORTS[k]['card'].split('=')[1] ;
+		if(!addedcards[e]){
+			addedcards[e] = true;
+			uri+= build_action('append', c, d , 'card', e ); c++;
+		}
+		pmode_ports[PORTS[k]['portType']].push(k);
+	}}
+
+
+	for( var k in pmode_ports ){ if( pmode_ports.hasOwnProperty(k) && pmode_ports[k].length ){
+		uri += build_action('append' , c , d , k , pmode_ports[k].join(',') ) ; c++ ;
+	}}
+
+	uri += build_action('append' , c , d , "poll" , "128") ; c++ ;
+	uri += build_action('append' , c , d , "dsp_options" , "0") ; c++ ;
+	uri += build_action('append' , c , d , "debug" , "0") ; c++ ;
+
+	makerequest('u', "applymisdn.conf", uri, function(t) {
+		// call the script that would generate /etc/misdn-init.conf from /etc/asterisk/applymisdn.conf
+		parent.astmanEngine.run_tool("sh /var/lib/asterisk/scripts/editmisdn.sh applysettings", function(t) {
 			alert("You need to restart your machine for these settings to take effect");
 			window.location.href= "misdn.html";
 			return true; 
 		});
-		/* to run ztcfg and apply settings, you can do this call, but replace applysettings with ztcfg.
-		You can then read /var/lib/asterisk/static-http/config/ztcfg_output.html to look at ztcfg errors */
-	},
-
-	updateUsersConf: function(){
-		/* update the users.conf to make sure there are corresponding [SPAN_x] contexts are updated */
-		
-		var uri1 = [];
-		var uri2 = '';
-		var add_lines = function(){
-			// for each span update span with new values of 'switchtype', 'singalling'
-			var c = 0, d ='', e ='', f=0, uri = '';
-			for( var k in SPANS ){ if( SPANS.hasOwnProperty(k) ){ if(SPANS[k]['signalling']){
-				uri = '', c=0;
-				d = 'span_'+ String(k);
-				e = asterisk_guiTDPrefix + d ;
-				uri += build_action('delcat', c, d , "", ""); c++;
-				uri += build_action('newcat', c, d , "", ""); c++;
-				uri += build_action('update', c, d , "switchtype", SPANS[k]['switchtype']); c++;
-				uri += build_action('update', c, d , "signalling", SPANS[k]['signalling']); c++;
-				uri += build_action('update', c, d , "context", e); c++;
-				uri += build_action('update', c, d , "group", String(k)); c++;
-				uri += build_action('update', c, d , "trunkname", 'Span '+String(k)); c++;
-				uri += build_action('update', c, d , "trunkstyle", 'digital'); c++;
-				uri += build_action('update', c, d , "zapchan", SPANS[k]['zapchanstring'] ); c++;
-
-				uri2 += build_action('delete', f, 'globals', d, "", ""); f++;
-				uri2 += build_action('update', f, 'globals', d,'Zap/g'+String(k)); f++;
-				uri2 += build_action('delcat', f, e , "", ""); f++;
-				uri2 += build_action('newcat', f, e , "", ""); f++;
-				uri2 += build_action('update', f, e , 'include', 'default'); f++;
-
-				uri1.push(uri);
-			}}}
-		}();
-
-		var something = function(){
-			if(uri1.length){
-				makerequest('u', "users.conf", uri1.shift() , function(t) { something(); } );
-			}else{
-				makerequest('u', "extensions.conf", uri2 , function(t) { applySettings.generate_zaptel(); });
-			}
-		};
-		something();
-	},
-
-	updateZaptel: function(){ 
-	// navigate through the SPANS object and save it to the applyzap.conf, 
-	// then call a script which will generate zaptel.conf from it and asks the user to restart his machine
-		var uri = '';
-		var add_lines = function(){
-			var c = 0, context = 'general' ;
-			uri = build_action('delcat', c, context,"", ""); c++;
-			uri += build_action('newcat', c , context, "", ""); c++;
-			var type = new Array(); 
-			var parse_fields = ['te_ptp', 'te_ptmp', 'te_capi_ptp', 'te_capi_ptmp', 'nt_ptp', 'nt_ptmp']; 
-			/* here are the field names, now if SPANS[1]['portset'] is te_ptp, then we want
-			to have at LEAST te_ptp=1 now if spans2 is te_ptp, then we cannot do:
-			te_ptp=1
-			te_ptp=2
-			we have to do
-			te_ptp=1,2
-			*/
-			for( var k in SPANS ){ if( SPANS.hasOwnProperty(k) ){
-				type.push(SPANS[k]['portset']);
-			}}
-			uri += build_action('append', c, context, SPANS[k]['portset'], k); c++;
-			for(var i=1; i<=CARDS; i++) {uri += build_action('append', c, context, "card", i+",0x4"); c++;}
-			uri += build_action('append', c, context, 'bridging', _$('bridging').value); c++;
-			uri += build_action('append', c, context, 'echocancel', _$('echocancel').value); c++;
-			uri += build_action('append', c, context, 'echotraining', _$('echotraining').value); c++;
-		}();
-		makerequest('u', "applymisdn.conf", uri , function(t) { applySettings.updateUsersConf(); });
-	}
-};
-
-
-function applyDigitalSettings(){
- 	// write to applyzap.conf - generate new applyzap.conf
- 	// write to users.conf - update [spans_x] contexts
- 	// call the asterisk_guiEditZap - which will generate zaptel.conf from applyzap.conf
-	applySettings.updateZaptel();
-}
-
-function remove_misdn_conf() {
-	parent.astmanEngine.run_tool("rm /etc/asterisk/misdn-init.conf", function(t) { // touch misdn-init.conf so we can write to it
-		location.href="misdn.html";
 	});
 }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-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">
-
 <div style="font-size : 12px; padding : 4px 6px 4px 6px; border-style : solid none solid none; border-top-color : #BDC7E7; border-bottom-color : #182052; border-width : 1px 0px 1px 0px; background-color : #ef8700; color : #ffffff;">
 	<span style="margin-left: 4px;font-weight:bold;">Digital Card Configuration Wizard (Beta)</span>
 	<span style="cursor: pointer; cursor: hand;" onclick="window.location.href=window.location.href;" >&nbsp;<img src="images/refresh.png" title=" Refresh " border=0 >&nbsp;</span>
 </div>
 
-<div class="pageheading">mISDN (b410p) Card Setup<br><a href="#" onClick="remove_misdn_conf();">Redo mISDN Setup</a></div>
-
-<div style="overflow:auto;left:40" id="div_digitalcardstable">
+<div style="overflow:auto;left:40" id="div_misdncardstable">
 	<h2 align="center"><div id="b410p_cards"></div></h2>
-	<table class="taglist" id="digitalcardstable" cellpadding=5 cellspacing=1 border=0 align=center></table>
-	<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>
-		</tr>
-		<tr>		
-			<td align="right">Echo Cancel :</td>
-			<td>
-				<select id="echocancel">
-					<option value="0">0 (No)</option>
-					<option value="32">32 MS</option>
-					<option value="64">64 MS</option>
-					<option value="128">128 MS</option>
-					<option value="256">256 MS</option>
-				</select>
-			</td>
-		</tr>
-		<tr>
-			<td align="right">Echo Training :</td>
-			<td>
-				<select id="echotraining">
-					<option value="yes">Yes</option>
-					<option value="no">No</option>
-				</select>
-			</td>
-		</tr>
-		<tr>
-			<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>
-		</tr>
-	</table>
+	<table class="taglist" id="misdntable" cellpadding=5 cellspacing=1 border=0 align=center></table>
+	<center>
+		<input type="button" id="save_a" value="Update" onclick="generate_applyMisdn();">&nbsp;&nbsp;
+		<input type="button" id="cancel_a" value="Cancel" onclick="reloadpage();">
+	</center>
 </div>
 
 <div id="errmsg" style="display:none"></div>
-<div id="mymenu" class="mymenu" style="display:none"></div>
 <div id="bg_transparent" STYLE="display:none; position: absolute; left: 0; top: 0; width:100%; height:100%;  background-color:#FFFFFF; filter:alpha(opacity=50); -moz-opacity:.50;opacity:.50; border-width: 0px; z-index:4">
 </div>
 
-<div id="edit_span" STYLE="display:none; position: absolute; left: 30; top: 40; width:500; height:310;  background-color:#F4EFE5;   border-width: 1px; border-color: #7E5538; border-style: solid; z-index:5">
-	<table width="100%" cellpadding=0 cellspacing=0  onmousedown="ASTGUI.startDrag(event , 'edit_span');">
+<div id="edit_port" STYLE="display:none; position: absolute; left: 30; top: 40; width:500; height:180;  background-color:#F4EFE5;   border-width: 1px; border-color: #7E5538; border-style: solid; z-index:5">
+	<TABLE width="100%" cellpadding=0 cellspacing=0  onmousedown="ASTGUI.startDrag(event , 'edit_port');">
 	<TR bgcolor="#7E5538"  style="background-image:url('images/title_gradient.gif');">
 		<TD Height="20" align="right" style="cursor: move">
 			<A href="#" onclick="$('cancel_a').click();"><font style="color:#FFFFFF; font-size: 12px; font-weight:bold;">X</font></A>
 		</TD>
 		<TD width=4></TD>
 	</TR>
-	</table>
+	</TABLE>
 	<TABLE	align=center cellpadding=2 cellspacing=2 border=0>
-	<TR>	<TD align="right">SPAN:</TD>
-		<TD><span id="editspan_SPAN"></span></TD>
-	</TR>
-	<TR>	<TD align="right">ALARMS:</TD>
-		<TD><span id="editspan_ALARMS"></span></TD>
-	</TR>
-	<TR>	<TD align="right">Port Settings</TD>
-		<TD>	<select id="editspan_portset">
+	<TR>	<TD align="right">Card/Port:</TD>
+		<TD> <span id="editport_label"></span> </TD>
+	</TR>
+	<TR>	<TD align="right">Port Settings:</TD>
+		<TD>	<select id="editport_type">
 			<option value="te_ptp">TE-Mode, PTP</option>
 			<option value="te_ptmp">TE-Mode, PTMP</option>
 			<option value="te_capi_ptp">TE-Mode(Capi), PTP</option>
@@ -687,49 +341,19 @@
 			</select>
 		</TD>
 	</TR>
-	<TR>	<TD align="right">Channels:</TD>
-		<TD><span id="editspan_channels"></span></TD>
-	</TR>
-	<TR id="signalling_container">	<TD align="right">Switch Type</TD>
-		<TD>	<select id="editspan_switchtype">
-				<option value="national">National ISDN 2 (default)</option>
-				<option value="dms100">Nortel DMS100</option>
-				<option value="4ess">AT&T 4ESS</option>
-				<option value="5ess">Lucent 5ESS</option>
-				<option value="euroisdn">EuroISDN</option>
-				<option value="ni1">Old National ISDN 1</option>
-				<option value="qsig">Q.SIG</option>
-			</select>
-		</TD>
-	</TR>
-	<TR>	<TD align="right">Sync/Clock Source</TD>
-		<TD>	<select id="editspan_syncsrc">
+	<TR>	<TD align="right">Sync/Clock Source:</TD>
+		<TD>	<select id="editport_mode">
 				<option value="0">Master (0) (Set Timing)</option>
 				<option value="1">Slave (1) (Take Timing)</option>
 			</select>
 		</TD>
 	</TR>
-	<TR>	<TD align="right">Line Build Out</TD>
-		<TD>	<select id="editspan_lbo">
-				<option value="0">0 db (CSU)/0-133 feet (DSX-1)</option>
-				<option value="1">133-266 feet (DSX-1)</option>
-				<option value="2">266-399 feet (DSX-1)</option>
-				<option value="3">399-533 feet (DSX-1)</option>
-				<option value="4">533-655 feet (DSX-1)</option>
-				<option value="5">-7.5db (CSU)</option>
-				<option value="6">-15db (CSU)</option>
-				<option value="7">-22.5db (CSU)</option>
-			</select>
-		</TD>
-	</TR>
-	
 	<TR>	<TD colspan=2 align=center height=50 valign=middle>  
-			<input type="button" id="save_a" value="Update" onclick="updateSpanInfo();">&nbsp;&nbsp;
-			<input type="button" id="cancel_a" value="Cancel" onclick="canelSpanInfo();">
+			<input type="button" id="save_a" value="Update" onclick="updatePortInfo();">&nbsp;&nbsp;
+			<input type="button" id="cancel_a" value="Cancel" onclick="canelPortInfo();">
 		</TD>
 	</TR>
 	</TABLE>
 </div>
-
 </body>
-</html>
+</html>

Modified: branches/asterisknow/config/scripts/astman.js
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/scripts/astman.js?view=diff&rev=1769&r1=1768&r2=1769
==============================================================================
--- branches/asterisknow/config/scripts/astman.js (original)
+++ branches/asterisknow/config/scripts/astman.js Fri Nov  2 17:49:26 2007
@@ -35,7 +35,8 @@
 var asterisk_guiZapscan = "zapscan.bin" ;
 var asterisk_guiZtscan = "ztscan";
 var asterisk_guiMisdn = "misdn-init";
-var asterisk_guiMisdn_scan = "misdn-init scan > /var/lib/asterisk/static-http/scan.html";
+var asterisk_guiMisdn_scan = "misdn-init scan > /var/lib/asterisk/static-http/config/scan.html";
+
 var asterisk_guiEditZap = "sh " + asterisk_scriptsFolder + "editzap.sh";
 var asterisk_rawmanPath = "../../rawman" ;
 var asterisk_guiConfigFile = "guipreferences.conf"; // will be created in asterisk_configfolder, if the file does not exist 




More information about the asterisk-gui-commits mailing list