<%@  page pageEncoding="utf-8" contentType="text/html;charset=utf-8" import="com.novell.webaccess.common.JSPConduit, com.novell.emframe.dev.eMFrameUtils" %>
<%   JSPConduit c = JSPConduit.getJSPConduit(request);
   c.stringTable("DevResources");
   c.stringTable("FwResources");
   c.stringTable("BaseResources"); %>

<HTML>
<HEAD>
   <TITLE><%= c.string("ProductName") %></TITLE>

   <jsp:include page='<%= c.getPath("dev/eMFrameScripts_inc.jsp") %>' flush="true" />
   <jsp:include page='<%= c.getPath("dev/XmlScripts_inc.jsp") %>' flush="true" />
   <jsp:include page='<%= c.getPath("dev/ValidateIntegerScripts_inc.jsp") %>' flush="true" />
   <jsp:include page='<%= c.getPath("dev/OSScripts_inc.jsp") %>' flush="true" />
   <SCRIPT language="JavaScript" src="<%= c.getModulesUrl() + "/dev/javascripts/" %>Interval.js"></SCRIPT>

   <LINK rel='stylesheet' href='<%= c.getModulesUrl() + "/dev/css/hf_style.css" %>'>
   <jsp:include page='<%= c.getPath("dev/PageScripts_inc.jsp") %>' flush="true" />
   <SCRIPT language="JavaScript">
      var ENABLED_COLOR = "white";
      var DISABLED_COLOR = "#EFEEE9";
      var initLil = 0;
      var initDi = false;

      var initAttemptD = 0;
      var initAttemptH = 0;
      var initAttemptM = 0;
      var initLockoutD = 0;
      var initLockoutH = 0;
      var initLockoutM = 0;

      function onInit()
      {
         var form=document.forms[0];

         // init for Detect Intruder
         var xStr="<%= c.toScript(c.var("eDir$target$Detect_Intruder")) %>";
         if(getValueFromXml(xStr) == 'true')
         {
         	form._eDir$target$Detect_Intruder.checked=true;
            form._eDir$target$Detect_Intruder.value = true;
         }
         else
         {
            form._eDir$target$Detect_Intruder.value = false;
         }

         initMooMode("_Detect_Intruder_mode", xStr);

         initWidgetFromXml(form._eDir$target$Login_Intruder_Limit, "<%= c.toScript(c.var("eDir$target$Login_Intruder_Limit")) %>");   // for Login Intruder Limit
         // init for Intruder Attempt Reset Interval
         var xStr="<%= c.toScript(c.var("eDir$target$Intruder_Attempt_Reset_Interval")) %>";
         form._eDir$target$Intruder_Attempt_Reset_Interval.value=getValueFromXml(xStr)
         initMooMode("_eDir$target$Intruder_Attempt_Reset_Interval_mode", xStr);
         unpackInterval("_eDir$target$Intruder_Attempt_Reset_Interval");

         // init for Lockout After Detection
         var xStr="<%= c.toScript(c.var("eDir$target$Lockout_After_Detection")) %>";
         if(getValueFromXml(xStr) == 'true')
         	form._eDir$target$Lockout_After_Detection.checked=true;
         initMooMode("_Lockout_After_Detection_mode", xStr);

         // init for Intruder Lockout Reset Interval
         var xStr="<%= c.toScript(c.var("eDir$target$Intruder_Lockout_Reset_Interval")) %>";
         form._eDir$target$Intruder_Lockout_Reset_Interval.value=getValueFromXml(xStr)
         initMooMode("_Intruder_Lockout_Reset_Interval_mode", xStr);
         unpackInterval("_eDir$target$Intruder_Lockout_Reset_Interval");

         getInitValues();
      }

      function isPageValid() // called when user leaves this page or applys changes
      {
         // What should this method do?
         // -data validation
         // -gather applet values
         // -if this method returns false, the page will not be saved

         var form=document.forms[0];

         if (!validateAllFields())
         {
            return false;
         }

         form.eDir$target$Detect_Intruder.value = toXmlString((form._eDir$target$Detect_Intruder.checked?'true':'false')<% if (c.var("Task.moo").equals("true")) { %>, form._Detect_Intruder_mode.value<% } %>);
         form.eDir$target$Login_Intruder_Limit.value = getWidgetValueAsXml(form._eDir$target$Login_Intruder_Limit);   // for Login Intruder Limit
         packInterval(form._eDir$target$Intruder_Attempt_Reset_Interval, form._eDir$target$Intruder_Attempt_Reset_IntervalDays, form._eDir$target$Intruder_Attempt_Reset_IntervalHours, form._eDir$target$Intruder_Attempt_Reset_IntervalMinutes);
		   form.eDir$target$Intruder_Attempt_Reset_Interval.value = toXmlString(form._eDir$target$Intruder_Attempt_Reset_Interval.value <% if (c.var("Task.moo").equals("true")) { %>, form._Intruder_Attempt_Reset_Interval_mode.value<% } %>);   // exit for Intruder Attempt Reset Interval
         form.eDir$target$Lockout_After_Detection.value = toXmlString((form._eDir$target$Lockout_After_Detection.checked?'true':'false')<% if (c.var("Task.moo").equals("true")) { %>, form._Lockout_After_Detection_mode.value<% } %>);
         packInterval(form._eDir$target$Intruder_Lockout_Reset_Interval, form._eDir$target$Intruder_Lockout_Reset_IntervalDays, form._eDir$target$Intruder_Lockout_Reset_IntervalHours, form._eDir$target$Intruder_Lockout_Reset_IntervalMinutes);
         form.eDir$target$Intruder_Lockout_Reset_Interval.value = toXmlString(form._eDir$target$Intruder_Lockout_Reset_Interval.value <% if (c.var("Task.moo").equals("true")) { %>, form._Intruder_Lockout_Reset_Interval_mode.value<% } %>);   // exit for Intruder Lockout Reset Interval

         return true;
      }

      function getInitValues()
      {
         var form=document.forms[0];

         if (form._eDir$target$Login_Intruder_Limit.value == null || form._eDir$target$Login_Intruder_Limit.value.length == 0)
         {
            initLil = 7;
            initAttemptM = 30;
            initLockoutM = 15;
         }
         else
         {
            initLil = form._eDir$target$Login_Intruder_Limit.value;
            initAttemptM = form._eDir$target$Intruder_Attempt_Reset_IntervalMinutes.value;
            initLockoutM = form._eDir$target$Intruder_Lockout_Reset_IntervalMinutes.value;
         }

         initDi = form._eDir$target$Detect_Intruder.value;
         initAttemptD = form._eDir$target$Intruder_Attempt_Reset_IntervalDays.value;
         initAttemptH = form._eDir$target$Intruder_Attempt_Reset_IntervalHours.value;

         initLockoutD = form._eDir$target$Intruder_Lockout_Reset_IntervalDays.value;
         initLockoutH = form._eDir$target$Intruder_Lockout_Reset_IntervalHours.value;


      }

      function setInitValuesInControls()
      {
         var form=document.forms[0];

         form._eDir$target$Login_Intruder_Limit.value = initLil;
         form._eDir$target$Intruder_Attempt_Reset_IntervalDays.value = initAttemptD;
         form._eDir$target$Intruder_Attempt_Reset_IntervalHours.value = initAttemptH;
         form._eDir$target$Intruder_Attempt_Reset_IntervalMinutes.value = initAttemptM;

         form._eDir$target$Intruder_Lockout_Reset_IntervalDays.value = initLockoutD;
         form._eDir$target$Intruder_Lockout_Reset_IntervalHours.value = initLockoutH;
         form._eDir$target$Intruder_Lockout_Reset_IntervalMinutes.value = initLockoutM;
      }

     function validateAllFields()
     {
         var form=document.forms[0];

         if (!validateIntegerField(form._eDir$target$Login_Intruder_Limit, 0, 999) ||
            !validateIntegerField(form._eDir$target$Intruder_Attempt_Reset_IntervalDays, 0, 999) ||
            !validateIntegerField(form._eDir$target$Intruder_Attempt_Reset_IntervalHours, 0, 999) ||
            !validateIntegerField(form._eDir$target$Intruder_Attempt_Reset_IntervalMinutes, 0, 999) ||
            !validateIntegerField(form._eDir$target$Intruder_Lockout_Reset_IntervalDays, 0, 999) ||
            !validateIntegerField(form._eDir$target$Intruder_Lockout_Reset_IntervalHours, 0, 999) ||
            !validateIntegerField(form._eDir$target$Intruder_Lockout_Reset_IntervalMinutes, 0, 999) )
         {
            return false;
         }
         return true;
     }

      function disableControl(control)
      {
         control.disabled = true;
         control.style.backgroundColor = DISABLED_COLOR;
         control.value = 0;
      }

      function enableControl(control)
      {
         control.disabled = false;
         control.style.backgroundColor = ENABLED_COLOR;
      }


	  function EnableDisableControls()
      {
         with(document.forms[0])
         {
            if (_eDir$target$Detect_Intruder.checked == true)
            {
               _eDir$target$Detect_Intruder.value = true;

               _eDir$target$Lockout_After_Detection.disabled = false;

               enableControl(_eDir$target$Login_Intruder_Limit);
               enableControl(_eDir$target$Intruder_Attempt_Reset_IntervalDays);
               enableControl(_eDir$target$Intruder_Attempt_Reset_IntervalHours);
			      enableControl(_eDir$target$Intruder_Attempt_Reset_IntervalMinutes);

               setInitValuesInControls();
            }
            else
            {
               _eDir$target$Detect_Intruder.value = false;

               disableControl(_eDir$target$Login_Intruder_Limit);
               disableControl(_eDir$target$Intruder_Attempt_Reset_IntervalDays);
               disableControl(_eDir$target$Intruder_Attempt_Reset_IntervalHours);
			      disableControl(_eDir$target$Intruder_Attempt_Reset_IntervalMinutes);

               _eDir$target$Lockout_After_Detection.disabled = true;
               _eDir$target$Lockout_After_Detection.checked = false;
            }


            if (_eDir$target$Lockout_After_Detection.checked == true)
            {
               enableControl(_eDir$target$Intruder_Lockout_Reset_IntervalDays);
               enableControl(_eDir$target$Intruder_Lockout_Reset_IntervalHours);
               enableControl(_eDir$target$Intruder_Lockout_Reset_IntervalMinutes);
            }
            else
            {
               disableControl(_eDir$target$Intruder_Lockout_Reset_IntervalDays);
               disableControl(_eDir$target$Intruder_Lockout_Reset_IntervalHours);
               disableControl(_eDir$target$Intruder_Lockout_Reset_IntervalMinutes);
            }
         }
      }

   </SCRIPT>
</HEAD>

<BODY onLoad="onInit();EnableDisableControls();">
<FORM name="form" method=post action="webacc">
   <jsp:include page='<%= c.getPath("dev/Messagebar_inc.jsp") %>' flush="true" />
	<jsp:include page='<%= c.getPath("dev/BookVars_inc.jsp") %>' flush="true" />

   <!---- UI Created by UiHandlers ---->

      <TABLE class="mediumtext" border='0' bgcolor='#FFFFFF' cellpadding='0' cellspacing='0'>
         <!-- Detect Intruder -->
         <TR>
            <TD align=left colspan=2>
               <INPUT name='_eDir$target$Detect_Intruder' onClick="EnableDisableControls()" type=checkbox <% if (c.var("eDirRights$target$Detect_Intruder").equals("R") || c.var("eDirRights$target$Detect_Intruder").equals("NONE")) { %>DISABLED<% } %> >
               <INPUT name='eDir$target$Detect_Intruder' type=hidden>
               <%= c.string("ModifyOrg.DetectIntruder") %>
            </TD>
            <TD>
               <% if (c.var("Task.moo").equals("true")) {    c.set("ModeSelector.name", "_Detect_Intruder_mode"); %>&nbsp;&nbsp;<jsp:include page='<%= c.getPath("dev/ModeSelector_inc.jsp") %>' flush="true" /><% } %>
            </TD>
         </TR>

         <TR>
            <TD height=8><br></TD>
         </TR>
         <!-- Login Intruder Limit -->
         <TR>
            <TD align=left>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%= c.string("ModifyOrg.LoginAttempts") %>&nbsp;&nbsp;
            </TD>
            <TD>
               <INPUT name='eDir$target$Login_Intruder_Limit' type=hidden value="<%= c.var("eDir$target$Login_Intruder_Limit") %>">
               <INPUT type=text name='_eDir$target$Login_Intruder_Limit' size=<%= c.string("UI.numberboxSize") %> style="padding-left:3;padding-right:3;width:<%= c.string("UI.numberboxPixel") %>"   <% if (c.var("eDirRights$target$Login_Intruder_Limit").equals("R") || c.var("eDirRights$target$Login_Intruder_Limit").equals("NONE")) { %>DISABLED<% } %>  onChange='validateNumericString(this, "<%= c.string("UIHandler.OnlyDigits") %> ");validateIntegerField(this, 0, 999);initLil=this.value;'>
            </TD>
            <TD valign=top>
               <% if (c.var("Task.moo").equals("true")) {    c.set("ModeSelector.name", "_Login_Intruder_Limit_mode"); %>&nbsp;&nbsp;<jsp:include page='<%= c.getPath("dev/ModeSelector_inc.jsp") %>' flush="true" /><% } %>
            </TD>
         </TR>
         <TR>
            <TD height=8></TD>
         </TR>
         <!-- Intruder Attempt Reset Interval -->
         <TR>
            <TD align=left colspan="2">
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%= c.var("Intruder_Attempt_Reset_IntervalDisplayName") %>:&nbsp;&nbsp;
            </TD>
         </TR>
         <TR>
            <TD>
               <INPUT name='eDir$target$Intruder_Attempt_Reset_Interval' type=hidden>
               <INPUT name='_eDir$target$Intruder_Attempt_Reset_Interval' type=hidden>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%= c.string("UIHandler.Days") %>
            </TD>
            <TD>
               <INPUT type=text size="<%= c.string("UI.textboxSize") %>" style="padding-left:3;padding-right:3;width:<%= c.string("UI.numberboxPixel") %>" name="_eDir$target$Intruder_Attempt_Reset_IntervalDays" <% if (c.var("eDirRights$target$Intruder_Attempt_Reset_Interval").equals("R") || c.var("eDirRights$target$Intruder_Attempt_Reset_Interval").equals("NONE")) { %>DISABLED<% } %>  onChange='validateNumericString(this, "<%= c.string("UIHandler.OnlyDigits") %> ");validateIntegerField(this, 0, 999);initAttemptD=this.value;'>
            </TD>
         </tr>
         <tr>
            <td>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%= c.string("UIHandler.Hours") %>
            </td>
            <td>
               <INPUT type=text size="<%= c.string("UI.textboxSize") %>" style="padding-left:3;padding-right:3;width:<%= c.string("UI.numberboxPixel") %>" name="_eDir$target$Intruder_Attempt_Reset_IntervalHours"  <% if (c.var("eDirRights$target$Intruder_Attempt_Reset_Interval").equals("R") || c.var("eDirRights$target$Intruder_Attempt_Reset_Interval").equals("NONE")) { %>DISABLED<% } %>  onChange='validateNumericString(this, "<%= c.string("UIHandler.OnlyDigits") %> ");validateIntegerField(this, 0, 999);initAttemptH=this.value;'>
            </td>
         </tr>
         <tr>
            <td>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%= c.string("UIHandler.Minutes") %>
            </td>
            <td>
               <INPUT type=text size="<%= c.string("UI.textboxSize") %>" style="padding-left:3;padding-right:3;width:<%= c.string("UI.numberboxPixel") %>" name="_eDir$target$Intruder_Attempt_Reset_IntervalMinutes"   <% if (c.var("eDirRights$target$Intruder_Attempt_Reset_Interval").equals("R") || c.var("eDirRights$target$Intruder_Attempt_Reset_Interval").equals("NONE")) { %>DISABLED<% } %> onChange='validateNumericString(this, "<%= c.string("UIHandler.OnlyDigits") %> ");validateIntegerField(this, 0, 999);initAttemptM=this.value;'>
            </td>
         </tr>

         <TR>
            <TD height=8><br></TD>
         </TR>
         <!-- Lockout After Detection -->
         <TR>
            <TD align=left colspan=2>
               <INPUT name='_eDir$target$Lockout_After_Detection' onClick="EnableDisableControls()" type=checkbox <% if (c.var("eDirRights$target$Lockout_After_Detection").equals("R") || c.var("eDirRights$target$Lockout_After_Detection").equals("NONE")) { %>DISABLED<% } %> >
               <INPUT name='eDir$target$Lockout_After_Detection' type=hidden>
               <%= c.string("ModifyOrg.LockoutAfterDetection") %>
            </TD>
            <TD>
               <% if (c.var("Task.moo").equals("true")) {    c.set("ModeSelector.name", "_Lockout_After_Detection_mode"); %>&nbsp;&nbsp;<jsp:include page='<%= c.getPath("dev/ModeSelector_inc.jsp") %>' flush="true" /><% } %>
            </TD>
         </TR>

         <TR>
            <TD height=8></TD>
         </TR>
         <!-- Intruder Lockout Reset Interval -->
         <TR>
            <TD>
               <INPUT name='eDir$target$Intruder_Lockout_Reset_Interval' type=hidden>
               <INPUT name='_eDir$target$Intruder_Lockout_Reset_Interval' type=hidden>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%= c.string("UIHandler.Days") %>
            </td>
            <td>
               <INPUT type=text size="<%= c.string("UI.textboxSize") %>" style="padding-left:3;padding-right:3;width:<%= c.string("UI.numberboxPixel") %>" name="_eDir$target$Intruder_Lockout_Reset_IntervalDays" <% if (c.var("eDirRights$target$Intruder_Lockout_Reset_Interval").equals("R") || c.var("eDirRights$target$Intruder_Lockout_Reset_Interval").equals("NONE")) { %>DISABLED<% } %>  onChange='validateNumericString(this, "<%= c.string("UIHandler.OnlyDigits") %> ");validateIntegerField(this, 0, 999);initLockoutD=this.value;'>
            </td>
         </tr>
         <tr>
            <td>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%= c.string("UIHandler.Hours") %>
            </td>
            <td>
               <INPUT type=text size="<%= c.string("UI.textboxSize") %>" style="padding-left:3;padding-right:3;width:<%= c.string("UI.numberboxPixel") %>" name="_eDir$target$Intruder_Lockout_Reset_IntervalHours"  <% if (c.var("eDirRights$target$Intruder_Lockout_Reset_Interval").equals("R") || c.var("eDirRights$target$Intruder_Lockout_Reset_Interval").equals("NONE")) { %>DISABLED<% } %>  onChange='validateNumericString(this, "<%= c.string("UIHandler.OnlyDigits") %> ");validateIntegerField(this, 0, 999);initLockoutH=this.value;'>
            </td>
         </tr>
         <tr>
            <td>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%= c.string("UIHandler.Minutes") %>
            </td>
            <td>
               <INPUT type=text size="<%= c.string("UI.textboxSize") %>" style="padding-left:3;padding-right:3;width:<%= c.string("UI.numberboxPixel") %>" name="_eDir$target$Intruder_Lockout_Reset_IntervalMinutes"   <% if (c.var("eDirRights$target$Intruder_Lockout_Reset_Interval").equals("R") || c.var("eDirRights$target$Intruder_Lockout_Reset_Interval").equals("NONE")) { %>DISABLED<% } %> onChange='validateNumericString(this, "<%= c.string("UIHandler.OnlyDigits") %> ");validateIntegerField(this, 0, 999); initLockoutM=this.value;'>
            </td>
         </tr>
      </TABLE>


</FORM>
<jsp:include page='<%= c.getPath("dev/OSFooter_inc.jsp") %>' flush="true" />
</BODY>
</HTML>
