pari: branch asterisknow r2026 - /branches/asterisknow/config/provisioning.html

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Wed Dec 19 22:05:31 CST 2007


Author: pari
Date: Wed Dec 19 22:05:31 2007
New Revision: 2026

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=2026
Log:
reading provision settings

Modified:
    branches/asterisknow/config/provisioning.html

Modified: branches/asterisknow/config/provisioning.html
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/provisioning.html?view=diff&rev=2026&r1=2025&r2=2026
==============================================================================
--- branches/asterisknow/config/provisioning.html (original)
+++ branches/asterisknow/config/provisioning.html Wed Dec 19 22:05:31 2007
@@ -21,15 +21,79 @@
 <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 file_storeSettings = 'provisioning.conf';
 
 
 function localajaxinit() {
+	_$('thispage_settings').style.display = 'none';
 	setWindowTitle("Settings for auto provisioning Polycom phones");
+
+	ASTGUI.events.add( _$('DHCP_WAN_PROVISION') , 'change', function(){ 
+		if(_$('DHCP_WAN_PROVISION').checked){
+			_$('TFTP_LAN').disabled = false;
+			_$('NTP_ADDRESS').disabled = false;
+			_$('WAN_INTERFACE').disabled = false;
+		}else{
+			_$('TFTP_LAN').disabled = true;
+			_$('NTP_ADDRESS').disabled = true;
+			_$('WAN_INTERFACE').disabled = true;
+		}
+	});
+
 	parent.loadscreen(this);
+	// use provisioning.conf  to store and retrieve settings - 
+	// note that provisioning.conf is not use by networking.sh or any other script
+	// it is just an easy and convinient way for the gui to later retrieve the last applied settings
+	// for this reason it is possible that the setting in network.params file to be different from those in provisioning.conf 
+	// if the user edits any of these file manually
 
+	// basically what we do in this page is 
+		// display the settings from provisioning.conf - is file not found create one with default values
+		// default values -
+		//	TFTP_LAN 		= http://0.0.0.0/phoneprov
+		//	DHCP_WAN_PROVISION	= off
+		//	NTP_ADDRESS		= 
+		//	WAN_INTERFACE		= eth0 ( also save this as serveriface in phoneprov.conf[general] )
+		//
+		//
+		// save back to provisioning.conf
+		// also generate a new network.params
+		// update serveriface in phoneprov.conf - touch this file on load (just to make sure it exists when writing)
+		// finally call networking.sh
+		//
+	
+	var parseProvisioningConf = function(n){
+		if( n == "ERROR: CONFIG FILE NOT FOUND"){// provisioning.conf not found
+			gui_feedback ( " Creating file " + file_storeSettings , 'default') ;
+			parent.astmanEngine.run_tool('touch /etc/asterisk/' + file_storeSettings ,onSuccess = function() { 
+				setTimeout( function(){window.location.reload();} , 1000);
+			});
+			return false ;
+		}
 
+		try{
+			_$('TFTP_LAN').value = ( n.hasOwnProperty('general') && n['general']['TFTP_LAN'] ) ? n['general']['TFTP_LAN'] : 'http://0.0.0.0/phoneprov' ;
+			_$('DHCP_WAN_PROVISION').checked = ( n.hasOwnProperty('general') && n['general']['DHCP_WAN_PROVISION'] && n['general']['DHCP_WAN_PROVISION'] =='on') ? true : false;
+			_$('NTP_ADDRESS').value = ( n.hasOwnProperty('general') && n['general']['NTP_ADDRESS'] ) ? n['general']['NTP_ADDRESS'] : '';
+			_$('WAN_INTERFACE').value = ( n.hasOwnProperty('general') && n['general']['WAN_INTERFACE'] ) ? n['general']['WAN_INTERFACE'] : 'eth0';
+		}catch(err){
 
+		}finally{
+			_$('thispage_settings').style.display = '';
+			if(_$('DHCP_WAN_PROVISION').checked){
+				_$('TFTP_LAN').disabled = false;
+				_$('NTP_ADDRESS').disabled = false;
+				_$('WAN_INTERFACE').disabled = false;
+			}else{
+				_$('TFTP_LAN').disabled = true;
+				_$('NTP_ADDRESS').disabled = true;
+				_$('WAN_INTERFACE').disabled = true;
+			}
+		}
+
+	};
+
+	config2json( file_storeSettings , 1, parseProvisioningConf);
 }
 
 
@@ -43,7 +107,7 @@
 <div class="mainscreenContentBox" id="mailboxcontent">
 <table class="mainscreenTable" align="center">
 	<tr><td valign="top" align="center">
-		<table align="center">
+		<table align="center" id="thispage_settings">
 			<TR>	<TD height=10></TD>
 				<TD></TD>
 			</TR>
@@ -65,7 +129,7 @@
 			</TR>
 
 			<TR>	<TD>Network Interface</TD>
-				<TD><input type="text" id='SRVINTERFACE' size=14 class='input9'></TD>
+				<TD><input type="text" id='WAN_INTERFACE' size=14 class='input9'></TD>
 			</TR>
 			<TR>	<TD height=10></TD>
 				<TD></TD>




More information about the asterisk-gui-commits mailing list