📄 provisioning.html.svn-base
字号:
<!-- * Manage network settings on the appliance * * Copyright (C) 2006 - 2007, Digium, Inc. * * Mark Spencer <markster@digium.com> * Pari Nannapaneni <pari@digium.com> * Brandon Kruse <bkruse@digium.com> * * All Rights Reserved. * * Distribution of this file is subject to the license * agreement you accepted when obtained and/or activated * the Digium product containing this file. *--><script src="scripts/prototype.js"></script><script src="scripts/astman.js"></script><script src="scripts/tooltip.js"></script><link href="stylesheets/schwing.css" media="all" rel="Stylesheet" type="text/css" /><script>var network_params = "/etc/asterisk/scripts/network.params";var file_storeSettings = 'provisioning.conf';// use provisioning.conf to store and retrieve settings - // note that provisioning.conf is not used by networking.sh or any other script// it is just an easy and convinient way for the gui to retrieve the last applied settings// for this reason it is possible that the settings in network.params file to be different from those in provisioning.conf // if the user edits any of these files manuallyfunction apply_settings(){ // 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 DWP = (_$('DHCP_WAN_PROVISION').checked)? 'on': 'off'; var TFTPL = _$('TFTP_LAN').value ; var NTPAD = _$('NTP_ADDRESS').value; var WI = _$('WAN_INTERFACE').value; var uri = build_action( 'update', 0 , 'general' , 'DHCP_WAN_PROVISION' , DWP ); uri += build_action( 'update', 1 , 'general' , 'TFTP_LAN' , TFTPL ); uri += build_action( 'update', 2 , 'general' , 'NTP_ADDRESS' , NTPAD ); uri += build_action( 'update', 3 , 'general' , 'WAN_INTERFACE' , WI ); gui_feedback ( " Applying Settings !! " , 'default') ; _$('thispage_settings').style.display = 'none'; makerequest('u', file_storeSettings , uri, function(t){ var uri2 = build_action( 'update', 0 , 'general' , 'serveriface' , WI ); makerequest('u', 'phoneprov.conf' , uri2, function(t){ var cmd1 = "echo \"DHCP_WAN_PROVISION=" + DWP + " TFTP_LAN=" + TFTPL + " NTP_ADDRESS=" + NTPAD + " WAN_INTERFACE=" + WI + "\" > " + network_params; parent.astmanEngine.run_tool( cmd1 , onSuccess = function(){ }); }); }); setTimeout( function(){ parent.astmanEngine.run_tool( asterisk_guiNetworkSettings, onSuccess = function() { gui_feedback ( " Done " , 'green' ) ; window.location.reload(); }); } , 3000 );}function localajaxinit() { _$('thispage_settings').style.display = 'none'; setWindowTitle("Settings for auto provisioning Polycom phones"); ASTGUI.events.add( _$('DHCP_WAN_PROVISION') , 'change', function(){ var y = _$('DHCP_WAN_PROVISION').checked; _$('TFTP_LAN').disabled = !y; _$('NTP_ADDRESS').disabled = !y; _$('WAN_INTERFACE').disabled = !y; }); parent.loadscreen(this); // 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] ) 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('echo "[general]" > /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:8088/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);}</script><body id="foo" onload="localajaxinit()" bgcolor="EFEFEF"><div class="mainscreenTitleBar"> <span style="margin-left: 4px;font-weight:bold;">Settings for auto provisioning Polycom phones</span> <span style="cursor: pointer; cursor: hand;" onclick="window.location.href=window.location.href;" > <img src="images/refresh.png" title=" Refresh " border=0 > </span></div><div class="mainscreenContentBox" id="mailboxcontent"><table class="mainscreenTable" align="center"> <tr><td valign="top" align="center"> <table align="center" id="thispage_settings"> <TR> <TD height=10></TD> <TD></TD> </TR> <TR> <TD align=right><input type="checkbox" id='DHCP_WAN_PROVISION'> </TD> <TD>Enable Auto Provisioning</TD> </TR> <TR onmouseover="show_tooltip('en', 'networking', 3);"> <TD valign="top" align="right">URL for Polycom <BR> auto provisioning:</TD> <TD> <input type="text" id='TFTP_LAN' size=24 class='input9'></TD> </TR> <TR> <TD height=10></TD> <TD></TD> </TR> <TR> <TD>NTP Server: </TD> <TD><input type="text" id='NTP_ADDRESS' size=14 class='input9'></TD> </TR> <TR> <TD>Network Interface</TD> <TD><input type="text" id='WAN_INTERFACE' size=14 class='input9'></TD> </TR> <TR> <TD height=10></TD> <TD></TD> </TR> <TR> <TD colspan=2 align=center> <BR> <input type="button" value="Save" id="save" onclick='apply_settings();'> <input type="button" value="Cancel" id="cancel" onclick='window.location.reload();'> </TD> </TR> </table> </td> </tr></table></div></body>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -