<%--
 The contents of this file are subject to the terms 
 of the Common Development and Distribution License 
 (the License).  You may not use this file except in
 compliance with the License.
 
 You can obtain a copy of the license at 
 https://glassfish.dev.java.net/public/CDDLv1.0.html or
 glassfish/bootstrap/legal/CDDLv1.0.txt.
 See the License for the specific language governing 
 permissions and limitations under the License.
 
 When distributing Covered Code, include this CDDL 
 Header Notice in each file and include the License file 
 at glassfish/bootstrap/legal/CDDLv1.0.txt.  
 If applicable, add the following below the CDDL Header, 
 with the fields enclosed by brackets [] replaced by
 you own identifying information: 
 "Portions Copyrighted [year] [name of copyright owner]"
 
 Copyright 2006 Sun Microsystems, Inc. All rights reserved.
--%>

<%@ page info="login" language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="com.sun.enterprise.tools.admingui.util.Util" %>
<%@ page import = "com.sun.enterprise.tools.admingui.ConfigProperties" %>
<%@ page import = "com.sun.enterprise.tools.admingui.util.PreloadXML" %>
<%
    if (!PreloadXML.isAlreadyLoaded()) {
	new PreloadXML(config).start();
    }
%>
<%
if (session.isNew()) {
    // Either a new session or the old session timed-out. Either way, send it to 
    // index.html so that the login screen will take the whole window (i.e. no frames).
    response.sendRedirect(Util.getMessage("com.sun.enterprise.tools.admingui.resources.Resources", "html.indexFile", null, request.getLocale()));
    return;
} else if (session.getAttribute("AdminGUItimeOut") != null) {
    // This case will happen if the user types the login URL directly AND is
    // already logged in. This attribute is set in the admingui servlet. So send
    // the response to index.html, which will then send it to TopFrameset.
    //
    // When the user logs out, should have a new session, but somehow it's not.
    // So, remove the attribute to avoid an infinite loop.
    session.removeAttribute("AdminGUItimeOut");
    response.sendRedirect(Util.getMessage("com.sun.enterprise.tools.admingui.resources.Resources", "html.indexFile", null, request.getLocale()));
    return;
}
%>

<html>
<head>

<title>Login</title>
<link rel="stylesheet" type="text/css" href="/asadmin/com_sun_web_ui/css/css_ns6up.css" />
<script type="text/javascript" src="/asadmin/com_sun_web_ui/js/browserVersion.js"></script>
<script type="text/javascript" src="/asadmin/com_sun_web_ui/js/dynamic.js"></script>
<SCRIPT language = "Javascript">
theURL = document.location.href;
if (theURL.indexOf("?") == -1) {
    browserCheck();
}

function browserCheck() {
    var agt = navigator.userAgent.toLowerCase();
    var browserName = navigator.appName;
    var is_major = parseInt(navigator.appVersion);
    var is_nav    = (browserName == "Netscape");
    var is_ie     = (browserName == "Microsoft Internet Explorer");
    var is_ie3    = (is_ie && (is_major < 4));
    var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
    var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );

if ((is_nav && ((agt.indexOf("4.79")==-1) && (is_major < 4.79))) || (is_ie && is_ie3 || is_ie4 || is_ie5))   {   
        top.location.href= "/jsp/browserError.jsp";
    }
}

function disableLogin() {
    ccSetButtonDisabled("loginButton", "loginform", true);    
    return false;
    
}
</SCRIPT>  

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" class="LogBdy"
      onLoad="javascript: document.forms[0].j_username.focus(); return true;">
<form method="POST" name="loginform" action="j_security_check" >
<% if (ConfigProperties.getInstance().isHCIAdmin22()) {%>

  <table border="0" cellpadding="0" cellspacing="0" align="center" title="">
    <tr>
      <td width="50%"><img src="/asadmin/com_sun_web_ui/images/other/dot.gif" width="1" height="1" alt="" /></td>
      <td><img src="/asadmin/com_sun_web_ui/images/other/dot.gif" width="728" height="1" alt="" /></td>
      <td width="50%"><img src="/asadmin/com_sun_web_ui/images/other/dot.gif" width="1" height="1" alt="" /></td>
    </tr>
    <tr class="LogTopBnd" style="background-image: url(../images/gradlogtop.jpg); background-repeat: repeat-x; background-position: left top;">
      <td><img src="/asadmin/com_sun_web_ui/images/other/dot.gif" width="1" height="30" alt="" /></td>
      <td nowrap="nowrap" valign="middle"></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td class="LogMidBnd" style="background-image: url(../images/gradlogsides.jpg);background-repeat:repeat-x;background-position:left top;">&nbsp;</td>
      <td class="LogCntTd" style="background-image: url(../images/login-backimage.jpg);background-repeat:no-repeat;background-position:left top;" height="435" align="center" valign="middle">
        <table border="0" background="/asadmin/com_sun_web_ui/images/other/dot.gif" cellpadding="0" cellspacing="0" width="100%" title="">
          <tr>
            <td width="260"><img src="/asadmin/com_sun_web_ui/images/other/dot.gif" width="260" height="245" alt="" /></td>
            <td width="415" bgcolor="#FFFFFF" valign="top" align="left">&nbsp;
                <img name="Login.welcomeImg" src="<%= Util.getMessage("com.sun.enterprise.tools.admingui.resources.Resources", "html.fullNameImage", null, request.getLocale()) %>" 
                     alt="Application Server Administration Console" border="0" height="56" width="400" />

              <table border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td>&nbsp;</td>
                  <td>

                  </td>
                </tr>

                <tr>
                  <td nowrap="nowrap"><div class="logLbl">
                    &nbsp;<span class="LblLev2Txt">
                    <label for="Login.username"><%= Util.getMessage("com.sun.enterprise.tools.admingui.resources.Resources", "common.UserName", null, request.getLocale()) %>: </label></span></div></td>
                  <td><div class="logInp"><input type="text" name="j_username" 
                            id="Login.username" tabindex="1"></div></td>
                </tr>
                <tr>

                  <td nowrap="nowrap"><div class="logLblLst">
                    &nbsp;<span class="LblLev2Txt">
                    <label for="Login.password"><%= Util.getMessage("com.sun.enterprise.tools.admingui.resources.Resources", "common.Password", null, request.getLocale()) %>: </label></span></div></td>
                  <td><div class="logInpLst"><input type="password" name="j_password" 
                            id="Login.password" tabindex="2"></div></td>
                </tr>

<!-- The button that submits this form once the user hits enter or -->
<!-- clicks on it. Unless you have a really good reason do not change -->
<!-- this botton tag. -->
                  <tr>
                    <td><img src="/asadmin/com_sun_web_ui/images/other/dot.gif" width="1" height="15" alt="" /></td>
                    <td>  
<table border="0">
<tr><td>
<div class="logBtn">
<!-- submit the form explicity, and then return false so that it only submits once. This is needed to support Safari -->
<div class="logBtn"> <input type="submit"
 class="Btn1Def" value="<%= Util.getMessage("com.sun.enterprise.tools.admingui.resources.Resources", "common.LogIn", null, request.getLocale()) %>"
 title="Log In to Sun Java System Application Server" tabindex="3"
 onmouseover="javascript: if (this.disabled==0) this.className='Btn1Hov'" 
onmouseout="javascript: if (this.disabled==0) this.className='Btn1'" 
onblur="javascript: if (this.disabled==0) this.className='Btn1'" 
onfocus="javascript: if (this.disabled==0) this.className='Btn1Hov'"
 onclick="javascript: disableLogin(); this.form.submit(); return false;"
 name="loginButton"
 id="loginButton">
<input type="hidden" name="loginButton.DisabledHiddenField" value="true" />
</div>
</td></tr></table>
                    </td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                  </tr>
		  <tr>
		    <td><img src="/asadmin/com_sun_web_ui/images/other/dot.gif" width="1" height="33" alt="" /></td>
	            <td>&nbsp;</td>
		  </tr>
              </table>
            </td>

<!-- Do not insert any authentication specific HTML/JSP after this comment. -->
<!-- The rest of the code is common to all login presentation -->
<!-- layers to preserve HCI look and feel and consistency among these pages  -->

          <td>&nbsp;</td>
          </tr>
        </table>
      </td>
      <td class="LogMidBnd" 
          style="background-image: url(../images/gradlogsides.jpg);background-repeat:repeat-x;background-position:left top;">&nbsp;</td>
    </tr>
    <tr class="LogBotBnd" style="background-image: url(../images/gradlogbot.jpg);background-repeat:repeat-x;background-position:left top;">
      <td>&nbsp;</td>
      <td><div class="logCpy"><span class="logTxtCpy">
	<%= Util.getMessage("com.sun.enterprise.tools.admingui.resources.Resources", "copyright.Message", null, request.getLocale()) %></div>
      </span></div>
      </td>
      <td>&nbsp;</td>
    </tr>
  </table>
<% } else { %>
  <table border="0" cellpadding="0" cellspacing="0" align="center" title="">
    <tr>
      <td width="50%"><img src="/asadmin/com_sun_web_ui/images/other/dot.gif" width="1" height="1" alt="" /></td>
      <td><img src="/asadmin/com_sun_web_ui/images/other/dot.gif" width="728" height="1" alt="" /></td>
      <td width="50%"><img src="/asadmin/com_sun_web_ui/images/other/dot.gif" width="1" height="1" alt="" /></td>

    </tr>
    <tr>
      <td><img src="/asadmin/com_sun_web_ui/images/other/dot.gif" width="1" height="30" alt="" /></td>
      <td></td>
    </tr>
    <tr>
      <td bgcolor="#CCCCCC">&nbsp;</td>
      <td background="../images/login_background.jpg" height="435" align="center" valign="middle">
        <table border="0" background="/asadmin/com_sun_web_ui/images/other/dot.gif" cellpadding="0" cellspacing="0"
               width="100%" title="">

          <tr>
            <td width="15"><img src="/asadmin/com_sun_web_ui/images/other/dot.gif" width="15" height="245" alt="" /></td>
            <td width="497" bgcolor="#FFFFFF" valign="top">&nbsp;
              <img name="Login.welcomeImg" src="<%= Util.getMessage("com.sun.enterprise.tools.admingui.resources.Resources", "html.productNameImage", null, request.getLocale()) %>" alt="Application Server Administration Console" border="0" height="28" width="306" />
              <table border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td>&nbsp;</td>
                  <td>

        </td>
                </tr>

                <tr>
                  <td nowrap="nowrap"><div class="logLbl">
                    &nbsp;<span class="LblLev2Txt">
                    <label for="Login.username"><%= Util.getMessage("com.sun.enterprise.tools.admingui.resources.Resources", "common.UserName", null, request.getLocale()) %>: </label></span></div></td>
                  <td><div class="logInp"><input type="text" name="j_username" 
                            id="Login.username" tabindex="1"></div></td>
                </tr>
                <tr>

                  <td nowrap="nowrap"><div class="logLblLst">
                    &nbsp;<span class="LblLev2Txt">
                    <label for="Login.password"><%= Util.getMessage("com.sun.enterprise.tools.admingui.resources.Resources", "common.Password", null, request.getLocale()) %>: </label></span></div></td>
                  <td><div class="logInpLst"><input type="password" name="j_password" 
                            id="Login.password" tabindex="2"></div></td>
                </tr>

<!-- The button that submits this form once the user hits enter or -->
<!-- clicks on it. Unless you have a really good reason do not change -->
<!-- this botton tag. -->
<!--
                  <tr>
                    <td style="vertical-align: top;"><font
 size="1" face="Verdana"> </font>
                    <div class="logLbl"><font size="1" face="Verdana"
 colspan="2"> &nbsp;<span class="LblLev2Txt">Remember
my
username/password?</span> </font></div>
                    </td>
                    <td><input type="radio" value="ON" name="save">Yes <input
 type="radio" name="save" value="OFF" checked="checked">No </td>
                  </tr>
-->                  
                  <tr>
                    <td><img src="/asadmin/com_sun_web_ui/images/other/dot.gif" width="1" height="15" alt="" /></td>
                    <td><div class="logBtn">
                    <div class="logBtn"> <input type="submit"
 class="Btn1Def" value="<%= Util.getMessage("com.sun.enterprise.tools.admingui.resources.Resources", "common.LogIn", null, request.getLocale()) %>"
 title="Log In to Sun Java System Application Server" tabindex="3"
 onmouseover="javascript: this.className='Btn1DefHov'"
 onmouseout="javascript: this.className='Btn1Def'"
 onblur="javascript: this.className='Btn1Def'"
 onfocus="javascript: this.className='Btn1DefHov'"> </div>
                    </td>
                  </tr>
                <tr>
                  <td>&nbsp;</td>
                </tr>
              </table>
            </td>

<!-- Do not insert any authentication specific HTML/JSP after this comment. -->
<!-- The rest of the code is common to all login presentation -->
<!-- layers to preserve HCI look and feel and consistency among these pages  -->

            <td width="15">
              <img src="/asadmin/com_sun_web_ui/images/other/dot.gif" width="15" height="245" alt="" /></td>
            <td width="186" bgcolor="#594FBF" valign="top">
              <img src="../images/login_sun_logo.gif"
                width="186" height="79" alt="Sun Microsystems, Inc." /></td>
            <td width="15">
              <img src="/asadmin/com_sun_web_ui/images/other/dot.gif" width="15" height="245" alt="" /></td>

          </tr>
        </table>
      </td>
      <td bgcolor="#CCCCCC">&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><div class="logCpy"><span class="logTxtCpy">
	<%= Util.getMessage("com.sun.enterprise.tools.admingui.resources.Resources", "copyright.Message", null, request.getLocale()) %></div>
      </td>
      <td>&nbsp;</td>
    </tr>
  </table>
<% } %> 
</form>
</body>
</html>
