<html>
   <head>
      <meta HTTP-EQUIV='Pragma' CONTENT='no-cache'>
      <link rel="stylesheet" href='stylemain.css' type='text/css'>
         <link rel="stylesheet" href='colors.css' type='text/css'>
            <script type="text/javascript" src="lang/b28n.js"></script>
            <script type="text/javascript" src="util.js"></script>
            <script language="javascript"><%ejGetOther(forbidHTMLCode)%></script>
            <script language="javascript">
<!-- hide
setLanguage('<%ejGet(webUILanguage)%>'); 

var obj1Items = '<%ejGetObject(MDMOID_CONF_UPDATE)%>';
var obj1Cols = numOfCol(obj1Items);

var updateEnable = getValueFromList(obj1Items, 0);
var updatePeriod = getValueFromList(obj1Items, 1);
var updateServer = getValueFromList(obj1Items, 2);
var updateName = getValueFromList(obj1Items, 3);

function initTranslation() {
	var idArray = new Array("autoupdatesettingsTitle", "autoupdatesettingsTips", "autoupdatesettingsEnalbe", "autoupdatesettingsPeriod", 
		"autoupdatesettingsServer", "autoupdatesettingsName", "autoupdatesettingsApply", "autoupdatesettingsAlert_1", "autoupdatesettingsAlert_3", 
		"autoupdatesettingsAlert_3", "autoupdatesettingsProtocol");
	setAllIdValue(idArray);
}

function btnApply()
{
	var loc = 'autoupdatesettings.cmd?action=savapply';

	with( document.forms[0] )
	{
		if(autoUpdateEnabled.checked)
		{
			loc += '&updateEnable=1';
		}
		else
		{
			loc += '&updateEnable=0';
		}

		if(IsNotDigit(autoUpdatePeriod.value) || (autoUpdatePeriod.value>500) || (autoUpdatePeriod.value<1))
		{
			//alert('Update Period must be integer between [1-500].');
			alert(_("autoupdatesettingsAlert_1"));
			return;
		}
		loc += '&updatePeriod='+autoUpdatePeriod.value;

		if((autoUpdateServer.value.length == 0) || (autoUpdateServer.value.length >127))
		{
			//alert('TFTP Server Address length is invalid [1-127].');
			alert(_("autoupdatesettingsAlert_2"));
			return;
		}
		loc += '&updateServer='+autoUpdateServer.value;

		if((autoUpdateFileName.value.length == 0) || (autoUpdateFileName.value.length >63))
		{
			//alert('Settings File Name length is invalid [1-63].');
			alert(_("autoupdatesettingsAlert_3"));
			return;
		}
		loc += '&updateName='+autoUpdateFileName.value;
	}
	
	loc += '&sessionKey=<%ejGetOther(sessionKey)%>';
	var code = 'location="' + loc + '"';
	eval(code);
}

function frmLoad()
{
	initTranslation();
	with (document.forms[0])
	{
		if(updateEnable == '1')
		{
			autoUpdateEnabled.checked = true;
		}
		else
		{
			autoUpdateEnabled.checked = false;
		}
		autoUpdatePeriod.value = updatePeriod;
		autoUpdateServer.value = updateServer;
		autoUpdateFileName.value = updateName;
	}
}

// done hiding -->
</script>
   </head>
  <body onLoad='frmLoad()'>
    <blockquote>
      <form>
        <b id='autoupdatesettingsTitle'>Tools -- Auto Update Settings</b><br><br>
       <span id='autoupdatesettingsTips'>Automatically request the configuration file on bootup and scheduled.</span>
        <br><br>
        <input type='checkbox' name='autoUpdateEnabled'><span id='autoupdatesettingsEnalbe'>Enable Auto Update Settings.</span>
        <br><br>
        <div id="autoUpdateConfig">
          <table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td id='autoupdatesettings'>Provisioning Using Protocol:</td>
              <td>
                <select name='wanIf' disabled>
                  <option value="tftp" selected>TFTP</option>
                </select>
              </td>
            </tr>
            <tr>
              <td id='autoupdatesettingsPeriod'>Update Period (hours):</td>
              <td><input type='text' name='autoUpdatePeriod'></td>
            </tr>
            <tr>
              <td id='autoupdatesettingsServer'>Config Server Path:</td>
              <td><input type='text' name='autoUpdateServer' disabled></td>
            </tr>
            <tr>
              <td id='autoupdatesettingsName'>Provisioning File Name:</td>
              <td><input type='text' name='autoUpdateFileName' disabled></td>
            </tr>
          </table>
        </div>
        <br><br>
        <center>
        <input type="button" value="Apply/Save" onClick='btnApply()' id='autoupdatesettingsApply'>
        </center>
      </form>
    </blockquote>
  </body>
</html>
