<%--
 Copyright : All Rights Reserved. Copyright (C) 2006, Hitachi, Ltd.
 Title     : ServerConductor WebConsole
 Version   : 08-00
 Name      : loginMain.jsp
 Date      : 2006/04/10
 Author    : Kimura
--%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language = "java"%>
<%@ page errorPage = "errorDialog.jsp" %>
<%@ page import = "JP.co.Hitachi.soft.System_Manager.data.HsmConst"%>
<%@ page import = "JP.co.Hitachi.soft.System_Manager.webconsole.common.Const"%>
<%@ page import = "JP.co.Hitachi.soft.System_Manager.webconsole.common
.MessageConstant"%>
<%@ taglib prefix = "bean"  uri = "/WEB-INF/struts-bean.tld" %>
<%@ taglib prefix = "html"  uri = "/WEB-INF/struts-html.tld" %>
<%@ taglib prefix = "logic" uri = "/WEB-INF/struts-logic.tld"%>
<%@ taglib prefix = "util"  uri = "/WEB-INF/common-tags.tld" %>
<%@ page contentType = "text/html; charset = UTF-8" pageEncoding = "UTF-8" %>
<% response.addHeader("Cache-Control","no-cache"); %>
<util:checkURL/>

<html:html locale = "true">
<head>
<title></title>
<script src = "js/common.js"></script>
<script src = "js/login.js"></script>
<link rel = "stylesheet" type = "text/css" href = "css/common.css">
</head>
<body onLoad = "loginForm.password.focus()">
<%-- Error message is displayed in the same screen --%>
<logic:present 
  scope = "session"
  name = "<%= Const.ATTRIBUTE_SESSION_LOGIN_ERROR_BEAN%>">
  
  <jsp:useBean id = "Login_ErrorBean" scope = "session" 
   class = "JP.co.Hitachi.soft.System_Manager.webconsole.model.bean.ErrorBean"/>

    <table border = "0" align = "center">
        <tr>
           <%-- <td style = "padding-left:5px;padding-right:5px"> --%>          <%-- 800WA_WEBCONSOLE440 --%>
           <td style = "padding-left:5px;padding-right:5px" valign = "top" >    <%-- 800WA_WEBCONSOLE440 --%>
                <util:set name = "ImageErrorTypeError">
                     <%= Const.PATH_IMAGES %><%= Const.IMAGE_ERROR_TYPE_ERROR %>
                </util:set>                
                <%-- Get alt data for the error icon from property file --%>
                <util:set name = "AltAlertLvErr">
                     <bean:message key = "alt.alert.lv.err"
                      bundle = "<%= Const.MESSAGE_RESOURCES_KEY_ALT %>"/>
                </util:set>
                <html:img align = "left"  border = "0" 
                 src = "<%= pageContext.getAttribute("ImageErrorTypeError")
                                                                 .toString() %>" 
                 alt = "<%= pageContext.getAttribute("AltAlertLvErr")
                                                               .toString() %>"/>
            </td>
           <%-- <td style = "padding-left:5px;padding-right:5px"> --%>          <%-- 800WA_WEBCONSOLE440 --%>
           <td style = "padding-left:5px;padding-right:5px" 
                                            class = "nowrap" valign = "top">    <%-- 800WA_WEBCONSOLE440 --%>
               <jsp:getProperty name = "Login_ErrorBean" 
                property = "errorCode"/>
            </td>
            <td style = "padding-left:5px;padding-right:5px">
               <jsp:getProperty name = "Login_ErrorBean" 
                property = "errorMessage"/>
            </td>
        </tr>
    </table>
</logic:present>

<%-- Create the JavaScript for check the password box entry --%>
<util:set name = "FnEntryCheck">
    return checkEntry(password,
    '<%= MessageConstant.MSG_PASSWORD_CHECK %>',
    '<bean:message
      bundle = "<%= Const.MESSAGE_RESOURCES_KEY_ERRMESSAGE%>" 
      key = "<%= MessageConstant.MSG_PASSWORD_CHECK%>"/>')
</util:set>

<%-- login form --%>    
<html:form
  action = "loginauth" target = "_parent"
  onsubmit = "<%= pageContext.getAttribute("FnEntryCheck").toString()%>">
    <table border = "0" cellspacing = "0" cellpadding = "5"
                                               align = "center" class = "small">
        <tr>
            <td>
                <bean:message
                 bundle = "<%= Const.MESSAGE_RESOURCES_KEY_LOGIN%>" 
                 key = "login.input.manager.service"/>
            </td>
            <td>
                <%= request.getServerName() %>
            </td>
        </tr>
        <tr>
            <td rowspan = "2">
                <bean:message
                 bundle = "<%= Const.MESSAGE_RESOURCES_KEY_LOGIN%>"
                 key = "login.input.user.kind"/>
            </td>
            <td>
                <html:radio property = "userType" 
                 value = "<%= new Integer(HsmConst.USER_TYPE_ADMIN)
                                                                .toString()%>"/>
                <bean:message
                 bundle = "<%= Const.MESSAGE_RESOURCES_KEY_LOGIN%>"
                 key = "login.input.user.kind.administrator"/>
            </td>
        </tr>
        <tr>
            <td>
                <html:radio property = "userType"
                 value = "<%= new Integer(HsmConst.USER_TYPE_SUBADMIN)
                                                               .toString() %>"/>
                <bean:message
                 bundle = "<%= Const.MESSAGE_RESOURCES_KEY_LOGIN%>"
                 key = "login.input.user.kind.subadministrator"/>
            </td>
        </tr>
        <tr>
            <td>
                <bean:message
                 bundle = "<%= Const.MESSAGE_RESOURCES_KEY_LOGIN%>"
                 key = "login.input.password"/>
            </td>
            <td>
                <html:password size = "20"
                 property = "password" redisplay = "false"/>
            </td>
        </tr>
        <tr align = "center">
            <td colspan = "2">
                <html:submit styleClass = "small">
                     <bean:message
                      bundle = "<%= Const.MESSAGE_RESOURCES_KEY_LOGIN%>" 
                      key = "login.input.login.button"/>
                </html:submit>
            </td>
        </tr>
    </table>
</html:form>
</body>
</html:html>

<%-- Remove session variables --%>
<logic:present 
 scope = "session"
 name = "<%= Const.ATTRIBUTE_SESSION_LOGIN_ERROR_BEAN%>">
    <% session.removeAttribute(Const.ATTRIBUTE_SESSION_LOGIN_ERROR_BEAN); %>
</logic:present>
<logic:present 
 scope = "session"
 name = "loginForm">
    <% session.removeAttribute("loginForm"); %>  
</logic:present>
