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

   c.stringTable("DevResources");
   c.stringTable("FwResources");
   c.stringTable("com.novell.emframe.version");
%>
<% try  { %><HTML>
<HEAD>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<TITLE><%= c.string("AuthenticateForm.Title") %></TITLE>

<script language="JavaScript">
   function pageInit()
   {
      if(document.AuthenticateForm != null)
      {
         if(document.AuthenticateForm.username.value.length > 0)
         {
             document.AuthenticateForm.password.focus();
         }
         else
         {
              document.AuthenticateForm.username.focus();
         }
   	}
   }

   function saveCookie()
   {
      var myCookie = "l=";
      myCookie = myCookie + document.AuthenticateForm.AuthenticateName.value + "|";
      myCookie = myCookie + document.AuthenticateForm.AuthenticateContext.value + "|";
      myCookie = myCookie + document.AuthenticateForm.AuthenticateTree.value;

      var exp = new Date();
      var oneMonthFromNow = exp.getTime() + (30 * 24 * 60 * 60 * 1000);
      exp.setTime(oneMonthFromNow);

      document.cookie = myCookie + "; expires=" + exp.toGMTString();
   }
</script>

</HEAD>
<BODY topmargin=5 leftmargin=5 TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#000000" bgcolor="#FFFFFF" onLoad="pageInit()">
<form name="AuthenticateForm" method=post action="webacc" target="_top" onSubmit="saveCookie();">

<%--
<input type=hidden name="taskId" value="fw.Authenticate">
<input type=hidden name="merge" value="fw.Launch">
<input type=hidden name="error" value="fw.AuthFail">
<input type=hidden name="forceMaster" value="<%= c.var("forceMaster") %>">
<input type=hidden name="ldapNameFormat" value="<%= c.var("ldapNameFormat") %>">
--%>

      <input type=hidden name="merge" value="fw/Launch">
      <input type=hidden name="error" value="fw/AuthForm">
      <input type=hidden name="forceMaster" value="<%= c.var("forceMaster") %>">
      <input type=hidden name='Login_Key' value='<%= c.var("Login_Key") %>'>
      
<% c.set("TaskHeader.title", c.plus(c.plus(c.string("Common.ProductName"), " "), c.string("AuthenticateForm.LoginTitle"))); %>
<jsp:include page='<%= c.getPath("dev/TaskHeader_inc.jsp") %>' flush="true" /><BR>
<TABLE cellpadding=0 cellspacing=0>
<% if ( c.def("Url.relogin") && c.var("Url.relogin").equals("true")) { %>
	<tr>
	  <TD></TD>
	  <td colspan=2><b><FONT face="Helvetica,Arial" size=-1><%= c.string("AuthenticateForm.Pocket.TimeoutMsg") %></font></b><br><br></td>
	</tr>
<% }
   if ( c.def("Url.oldlogin") && c.var("Url.oldlogin").equals("true")) { %>
	<tr>
	  <TD></TD>
	  <td colspan=2><b><FONT face="Helvetica,Arial" size=-1><%= c.string("AuthenticateForm.Pocket.OldLoginScreenMsg") %></font></b><br><br></td>
	</tr>
<% } %>

<%--
<TR>
<TD></TD>
<TD>
<FONT face="Helvetica,Arial" size=-1><%= c.string("AuthenticateForm.UserNameEditBoxHeader") %>&nbsp;&nbsp;</FONT></TD>
<TD><INPUT NAME="AuthenticateName" value="<%= c.toHTML(c.var("Authenticate.Form.UserNameInitialValue")) %>" TYPE=text SIZE=15></TD>
</TR>
--%>

<tr>
  <td height="50" nowrap valign="bottom" class="mediumtext">
     <%= c.string("AuthenticateForm.UserNameEditBoxHeader") %>
     <br>
     <input type="text" name="username" maxLength="256" value="<%= c.toHTML(c.var("username")) %>" size="15">
  </td>
</tr>


<%--
<TR>
<TD></TD>
<TD><FONT face="Helvetica,Arial" size=-1><%= c.string("AuthenticateForm.PasswordEditBoxHeader") %></FONT></TD>
<TD><INPUT NAME="AuthenticatePassword" value="" TYPE=password SIZE=15>
</TD>
</TR>
--%>

<tr>
  <td valign="bottom" class="mediumtext">
     <%= c.string("AuthenticateForm.PasswordEditBoxHeader") %>
     <br>
     <input type="password" name="password" maxLength="256" value="" size="15">
  </td>
</tr>


<%-- CONTEXT is gone
<% if (c.var("Authenticate.Form.ContextMode").equals("invisible") == false) { %>
<TR>
<TD></TD>
<TD><FONT face="Helvetica,Arial" size=-1><%= c.string("AuthenticateForm.ContextEditBoxHeader") %></FONT></TD>
<TD><INPUT NAME="AuthenticateContext" value="<%= c.toHTML(c.var("Authenticate.Form.ContextInitialValue")) %>" TYPE=input SIZE=15>
</TD>
</TR>
<% } else { %>
<INPUT NAME="AuthenticateContext" value="<%= c.toHTML(c.var("Authenticate.Form.ContextInitialValue")) %>" TYPE=hidden>
<% }
--%>

<%-- 
<% if (c.var("Authenticate.Form.TreeMode").equals("invisible") == false) { %>
<TR>
<TD></TD>
<TD><FONT face="Helvetica,Arial" size=-1><%= c.string("AuthenticateForm.TreeEditBoxHeader") %></FONT></TD>
<TD><INPUT NAME="AuthenticateTree" value="<%= c.toHTML(c.var("Authenticate.Form.TreeInitialValue")) %>" TYPE=text SIZE=15>
</TD>
</TR>
<% } else { %>
<INPUT NAME="AuthenticateTree" value="<%= c.toHTML(c.var("Authenticate.Form.TreeInitialValue")) %>" TYPE=hidden>
<% } %>
--%>

<tr>
   <td valign="bottom" class="mediumtext">
      <% if (c.var(DirAuthenticator.SETTING_SHOW_TREE).equals("true") == true)
      { %>
         <!-- Tree text -->
         <%= c.string("AuthenticateForm.TreeEditBoxHeader") %>
         <br>
         <input type="text" name="tree" maxLength="256" value="<%= c.var(DirAuthenticator.SETTING_DEFAULT_TREE) %>" size="15">
      <% } %>
   </td>
</tr>

<tr>
   <td valign="bottom" class="mediumtext">
      <% if (c.var(DirAuthenticator.SETTING_SHOW_PROTOCOL).equals("true") == true)
      { %>
         <!-- Show Protocol prompt -->
         <%= c.string("AuthenticateForm.ProtocolEditBoxHeader") %>
         <br>
         <select name="protocol" size=1>
            <% if (c.var(DirAuthenticator.SETTING_DEFAULT_PROTOCOL).equals(DirAuthenticator.VALUE_DEFAULT_PROTOCOL_NDAP) == true)
            { %>
               <option selected value="<%= DirAuthenticator.VALUE_DEFAULT_PROTOCOL_NDAP %>"><%= c.string("AuthenticateForm.ProtocolSelect.NDAP") %></option>
            <% } 
            else 
            { %>
               <option value="<%= DirAuthenticator.VALUE_DEFAULT_PROTOCOL_NDAP %>"><%= c.string("AuthenticateForm.ProtocolSelect.NDAP") %></option>
            <% } %>
         
            <% if (c.var(DirAuthenticator.SETTING_DEFAULT_PROTOCOL).equals(DirAuthenticator.VALUE_DEFAULT_PROTOCOL_LDAP) == true)
            { %>
               <option selected value="<%= DirAuthenticator.VALUE_DEFAULT_PROTOCOL_LDAP %>"><%= c.string("AuthenticateForm.ProtocolSelect.LDAP") %></option>
            <% } 
            else 
            { %>
               <option value="<%= DirAuthenticator.VALUE_DEFAULT_PROTOCOL_LDAP %>"><%= c.string("AuthenticateForm.ProtocolSelect.LDAP") %></option>
            <% } %>
          
            <% if (c.var(DirAuthenticator.SETTING_DEFAULT_PROTOCOL).equals(DirAuthenticator.VALUE_DEFAULT_PROTOCOL_LDAPS) == true)
            { %>
               <option selected value="<%= DirAuthenticator.VALUE_DEFAULT_PROTOCOL_LDAPS %>"><%= c.string("AuthenticateForm.ProtocolSelect.LDAPS") %></option>
            <% } 
            else 
            { %>
               <option value="<%= DirAuthenticator.VALUE_DEFAULT_PROTOCOL_LDAPS %>"><%= c.string("AuthenticateForm.ProtocolSelect.LDAPS") %></option>
            <% } %>
         </select>
      <% } %>
   </td>
</tr>

</TABLE>
<BR>
<input type=image name="login_button" alt="<%= c.toHTML(c.string("Button.Login.alt")) %>" src="<%= c.getModulesUrl() + "/dev/images/" + c.string("Button.Login.image") %>" border=0>

<%--
<% if ((c.var("Authenticate.Form.ContextMode").equals("invisible")) || (c.var("Authenticate.Form.TreeMode").equals("invisible"))) { %>
   &nbsp;&nbsp;&nbsp;<a href="webacc?taskId=fw.AuthenticateForm&merge=fw.AuthForm&ShowAdvanced=true&User.context=<%= c.var("User.context") %>"><img name="<%= c.toHTML(c.string("AuthenticateForm.LoginButtonHint")) %>" alt="<%= c.toHTML(c.string("AuthenticateForm.LoginButtonHint")) %>" src="<%= c.getModulesUrl() + "/dev/images/" + c.string("Button.Advanced.image") %>" border=0></a>
<% } %>
--%>

<BR>
<FONT face="Arial,Helvetica" size=-1>
<BR><%= c.string("Application.htmlCopyright") %>  <%= c.string("Application.verString") %> <%= c.string("version") %>
</FONT>
</FORM>

</BODY>
</HTML> <% } catch (Exception e) { e.printStackTrace(); %>Exception occured processing JSP page<% } %>
