<%--
 Copyright : All Rights Reserved. Copyright (C) 2006, Hitachi, Ltd.
 Title     : ServerConductor WebConsole
 Version   : 08-00
 Name      : errorDialog.jsp
 Date      : 2006/04/10
 Author    : Annie.J
 --%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page session = "false" %>
<%@ page language = "java" %>
<%@ page import = "JP.co.Hitachi.soft.System_Manager.webconsole.common.Const"%>
<%@ page import = "JP.co.Hitachi.soft.System_Manager.webconsole.common.MessageConstant"%>     <% // 800WA_WEBCONSOLE181 %>
<%@ page import = "org.apache.struts.util.MessageResources"%>                                 <% // 800WA_WEBCONSOLE181 %> 
<%@ page import = "JP.co.Hitachi.soft.System_Manager.webconsole.common.ResourceBundler"%>     <% // 800WA_WEBCONSOLE181 %> 
<%@ page import = "JP.co.Hitachi.soft.System_Manager.webconsole.common.WcException"%>         <% // 800WA_WEBCONSOLE181 %>
<%@ page import = "JP.co.Hitachi.soft.System_Manager.webconsole.model.bean.ErrorBean"%>       <% // 800WA_WEBCONSOLE181 %> 
<%@ taglib prefix = "html" uri = "/WEB-INF/struts-html.tld" %>
<%@ taglib prefix = "bean" uri = "/WEB-INF/struts-bean.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"); %> --%>					<% // 800WA_WEBCONSOLE308 %>
<% response.addHeader("Cache-control","no-cache"); %> 							<% // 800WA_WEBCONSOLE308 %>
<util:checkURL/> 
<html:html locale = "true">

<util:set name = "CommonProductName">                                           
    <bean:message                                                               
        bundle = "<%= Const.MESSAGE_RESOURCES_KEY_INTERNAL%>" 
                      key = "internal.common.product.name"/>                    <% //800WA_WEBCONSOLE131 %>
</util:set>
<util:set name = "errPageTitle">
  <bean:message bundle = "<%=Const.MESSAGE_RESOURCES_KEY_DIALOG%>" 
                key= "dialog.error.dialog.title" 
                arg0= "<%=pageContext.getAttribute("CommonProductName").toString()%>"/>
</util:set>                                                                     <% //800WA_WEBCONSOLE131 %>

<%                                                                              // 800WA_WEBCONSOLE181
   Object l_objParam= request.getAttribute(Const.ATTRIBUTE_REQUEST_ERROR_BEAN); // 800WA_WEBCONSOLE181
  
   if(l_objParam == null)                                                       // 800WA_WEBCONSOLE181
   {                                                                            // 800WA_WEBCONSOLE181
     ErrorBean l_objErrBean = new ErrorBean();                                  // 800WA_WEBCONSOLE181
     l_objErrBean.setErrorCode(MessageConstant.MSG_SERVLET_ERROR);              // 800WA_WEBCONSOLE181
     MessageResources l_objMsgResource = ResourceBundler.getResourceBundle(     // 800WA_WEBCONSOLE181
                Const.PROPERTIES_FILE_MESSAGE_RESOURCES);                       // 800WA_WEBCONSOLE181
     l_objErrBean.setErrorMessage(                                              // 800WA_WEBCONSOLE181
          l_objMsgResource.getMessage(request.getLocale(),                      // 800WA_WEBCONSOLE181
          MessageConstant.MSG_SERVLET_ERROR ));                                 // 800WA_WEBCONSOLE181
             
     // Set the error bean into the request object.                             // 800WA_WEBCONSOLE181
     request.setAttribute(Const.ATTRIBUTE_REQUEST_ERROR_BEAN,                   // 800WA_WEBCONSOLE181
                        l_objErrBean);                                          // 800WA_WEBCONSOLE181
   }                                                                            // 800WA_WEBCONSOLE181
%>                                                                              <% // 800WA_WEBCONSOLE181 %>

<head>
  
<%--  <script src = "js/envSet.js"> </script>   --%>                            <%// 800WA_WEBCONSOLE454 %><% // 800WA_WEBCONSOLE487 %>
  
  <%-- set the flag for closing on ok button click as a page attribute. --%>    <% // 800WA_WEBCONSOLE169 %>
  <util:set name = "closeOnOkEvent">
     <%=request.getAttribute(
  			Const.ATTRIBUTE_REQUEST_ERROR_WINDOW_CLOSE)%>
  </util:set>                                                                   <% // 800WA_WEBCONSOLE169 %>

  <script language = "javascript">                                              <% //800WA_WEBCONSOLE106 %>
    var l_varCloseFlag = 
        <%=pageContext.getAttribute("closeOnOkEvent").toString()%>;             <% // 800WA_WEBCONSOLE169 %>

    function okBtn(errorcode, url)                                              <% //800WA_WEBCONSOLE106 %>
    {		 	                                                                <% //800WA_WEBCONSOLE106 %>
  	  if (errorcode == "KASM1802A-E")                                           <% //800WA_WEBCONSOLE106 %>
  	  {                                                                         <% //800WA_WEBCONSOLE106 %>
  		window.parent.close(); 		                                            <% //800WA_WEBCONSOLE106 %>         
  		window.open(url,"Login",
  		  "menubar = no, toolbar = no, scrollbars = yes,status = yes, "  + 
          "location = no, width = 800px, height = 600px, resizable = yes");     <% //800WA_WEBCONSOLE106 %>
  	  }                                                                         <% //800WA_WEBCONSOLE106 %>
 	  else if(l_varCloseFlag)                                                   <% // 800WA_WEBCONSOLE169 %>
 	  {                                                                         <% // 800WA_WEBCONSOLE169 %>
 	    <%-- window.close(); --%>                                              	<% // 800WA_WEBCONSOLE169 %><% // 800WA_WEBCONSOLE240 %>
 	    window.parent.close();													<% // 800WA_WEBCONSOLE240 %>
 	  }                                                                         <% // 800WA_WEBCONSOLE169 %>
      else if (history.length > 0)                                              <% //800WA_WEBCONSOLE106 %>                    
      {                                                                         <% //800WA_WEBCONSOLE106 %>
        <% if (request.getAttribute(                                            //   800WA_WEBCONSOLE240
               Const.ATTRIBUTE_REQUEST_ERROR_DEFAULT_PAGE_FLAG) != null &&      //   800WA_WEBCONSOLE240
               request.getAttribute(                                            //   800WA_WEBCONSOLE240
               Const.ATTRIBUTE_REQUEST_ERROR_DEFAULT_PAGE_FLAG).equals(         //   800WA_WEBCONSOLE240
               Const.DEFAULT_PAGE_TRUE)) {%>                                    <% //800WA_WEBCONSOLE240 %>
            window.location = "<%= request.getContextPath()%>/jsp/default.html";<% //800WA_WEBCONSOLE240 %>
            return;                                                             <% //800WA_WEBCONSOLE240 %>
        <%}%>                                                                   <% //800WA_WEBCONSOLE240 %>
        
        <%-- history.back(-1);  --%>                                            <% //800WA_WEBCONSOLE106 %>  <% //800WA_WEBCONSOLE155 %>  
		var status = history.back(-1);                                          <% //800WA_WEBCONSOLE155 %>
		if(status == "undefined")								 <% //800WA_WEBCONSOLE155 %>
    	{                                                                       <% //800WA_WEBCONSOLE155 %>
		  window.close();
		}                                                                       <% //800WA_WEBCONSOLE155 %>
 	  }                                                                         <% //800WA_WEBCONSOLE106 %>
	  else                                                                      <% //800WA_WEBCONSOLE106 %>
	  {                                                                         <% //800WA_WEBCONSOLE106 %>
		window.parent.close();                                                  <% //800WA_WEBCONSOLE106 %>
	  }                                                                         <% //800WA_WEBCONSOLE106 %>
    }                                                                           <% //800WA_WEBCONSOLE106 %>
    
<%--    window.document.title = 
        "<%=pageContext.getAttribute("errPageTitle").toString() %>";  --%>      <% //800WA_WEBCONSOLE131 %>  <% //800WA_WEBCONSOLE159 %>
    
  </script>                                                                     <% //800WA_WEBCONSOLE106 %>
  <script src = "js/common.js"></script>
  <link rel = "stylesheet" type = "text/css" href = "css/common.css">
</head>
<%-- <body> --%>                                                                <% //800WA_WEBCONSOLE105 %>
<%-- <body onload = "OK.focus()">  --%>                                         <% //800WA_WEBCONSOLE105 %><% //800WA_WEBCONSOLE445 %>
<body onload = "OK.focus()" onclick = "releaseSelection()">                     <% //800WA_WEBCONSOLE445 %>
<jsp:useBean id = "ErrorBean" scope = "request"
  class = "JP.co.Hitachi.soft.System_Manager.webconsole.model.bean.ErrorBean"/> 
<%-- <table width = "70%" align = "left" border = "0" > --%>                    <% //800WA_WEBCONSOLE104 %>
     <table width = "100%" align = "left" border = "0" >                        <% //800WA_WEBCONSOLE104 %>
 	  <tr>
 		<%-- <td align = "left"  width = "10%" > --%>                           <%-- 800WA_WEBCONSOLE440 --%>		
 		<td align = "left"  width = "10%" class = "nowrap" >                    <%-- 800WA_WEBCONSOLE440 --%>
 	
	   <%-- Alt properties is displayed based on the error icon --%>
	<%
				
 			String error = ErrorBean.getErrorCode();
 		 	         			 
 			if(error.endsWith("E"))
 	    {
 	%>
 	
			<script>
			    window.document.title = 
		        "<%=pageContext.getAttribute("errPageTitle").toString()%>";     <% //800WA_WEBCONSOLE159 %>
			</script>                                                           <% //800WA_WEBCONSOLE159 %>
 			
 			<util:set name = "AltAlertLvErr">
			<bean:message bundle = "<%= Const.MESSAGE_RESOURCES_KEY_ALT %>"
			                         key = "alt.alert.lv.err"/>
			</util:set>
 			<img alt = '<%= pageContext.getAttribute("AltAlertLvErr").toString()%>' 
 			src = "<%= ErrorBean.getImageUrl() %>"/>
 			<%-- dialog resource property set for OK button in errorscreen --%>
 			
 			<util:set name = "OK">
			<bean:message bundle = "<%= Const.MESSAGE_RESOURCES_KEY_DIALOG %>" 
			                                  key = "dialog.error.ok"/>
			</util:set>
 	
	   <%-- Alt properties is displayed based on the information icon --%>
	<%
 		}
 				 		  				 
 				 else if(error.endsWith("I")) 
 		{
 	%>
            <util:set name = "infPageTitle">
				<bean:message bundle = "<%=Const.MESSAGE_RESOURCES_KEY_DIALOG%>" 
                	key= "dialog.info.dialog.title" 
	                arg0= "<%=pageContext.getAttribute("CommonProductName").toString()%>"/>
			</util:set>                                                         <% //800WA_WEBCONSOLE159 %>
			
			<script>
			    window.document.title = 
		        "<%=pageContext.getAttribute("infPageTitle").toString()%>";     <% //800WA_WEBCONSOLE159 %>
			</script>                                                           <% //800WA_WEBCONSOLE159 %>
			 	
 			<util:set name = "AltAlertLvInf">
			<bean:message bundle = "<%= Const.MESSAGE_RESOURCES_KEY_ALT %>"
			                   key = "alt.alert.lv.inf"/>
		    </util:set>
 			<img alt = '<%=pageContext.getAttribute("AltAlertLvInf").toString()%>' 
 			src = "<%= ErrorBean.getImageUrl() %>"/>
 				
 		<%-- dialog resource property is set for OK button for information--%>
 			
 			<util:set name = "OK">
			<bean:message bundle = "<%= Const.MESSAGE_RESOURCES_KEY_DIALOG %>" 
			                            key = "dialog.info.ok"/>
			</util:set>
			 		
 	
	   <%-- Alt properties is displayed based on the warning icon --%>
	<%
 		} 
 		   
 				
 				else 
 				
 		{
 	%>
 	
 	        <util:set name = "warnPageTitle">
	    		<bean:message bundle = "<%=Const.MESSAGE_RESOURCES_KEY_DIALOG%>" 
               	key= "dialog.alert.dialog.title" 
                arg0= "<%=pageContext.getAttribute("CommonProductName").toString()%>"/>
			</util:set>                                                         <% //800WA_WEBCONSOLE159 %>
			<script>
			    window.document.title = 
		        "<%=pageContext.getAttribute("warnPageTitle").toString()%>";    <% //800WA_WEBCONSOLE159 %>
			</script>                                                           <% //800WA_WEBCONSOLE159 %>
 	
 			<util:set name = "AltAlertLvWrn">
			<bean:message bundle = "<%= Const.MESSAGE_RESOURCES_KEY_ALT %>"
			                                   key = "alt.alert.lv.wrn"/>
			</util:set>
 			<img alt = '<%=pageContext.getAttribute("AltAlertLvWrn").toString()%>'
 			src = "<%= ErrorBean.getImageUrl() %>"/>
 			
 			<%-- dialog resource property is set for OK button for warning--%>
 			
 			<util:set name = "OK">
			<bean:message bundle = "<%= Const.MESSAGE_RESOURCES_KEY_DIALOG %>" 
			                                  key = "dialog.alert.ok"/>
			</util:set>
			
 	<%
 		} 
 	%>
 				
 	     </td>
        <%-- <td> --%>                                                          <%-- 800WA_WEBCONSOLE440 --%>  
        <td class = "nowrap">                                                   <%-- 800WA_WEBCONSOLE440 --%>                                        
        	 
        	<%= ErrorBean.getErrorCode()%>
         
         </td>
 	 </tr>
 	 <tr>
 	     <td>&nbsp;</td> 
 	     
 	     <td>
 			
 			<%= ErrorBean.getErrorMessage()%>
 			
 	     </td>
     </tr>
      <tr>
 	     <td>&nbsp;</td> 
 	     <td align="right">

    <util:set name = "func">                                                    <% // 800WA_WEBCONSOLE106 %>
<%-- okBtn('<%= ErrorBean.getErrorCode()%>','<util:rewrite action="login"/>')--%><% // 800WA_WEBCONSOLE106 %><%-- 800WA_WEBCONSOLE454 --%>
    okBtn('<%= ErrorBean.getErrorCode()%>','<util:rewrite action="login"/>');
	                                                         clearHeader();     <%-- 800WA_WEBCONSOLE454 --%> 
     </util:set>                                                                <% // 800WA_WEBCONSOLE106 %>
 
<%-- 			<html:button property = "OK" styleClass = "small"                   
        	  value = '<%= pageContext.getAttribute("OK").toString()%>'        
                onclick = "history.go(-1)"/>                            --%>    <% // 800WA_WEBCONSOLE106 %>
            <%if (ErrorBean.getButtonFlag()) {%>                                <% // 800WA_WEBCONSOLE372 %>
 			<html:button property = "OK" styleClass = "small"                   
        	  value = '<%= pageContext.getAttribute("OK").toString()%>'        
   			   onclick = '<%= pageContext.getAttribute("func").toString()%>'/>  <% // 800WA_WEBCONSOLE106 %>
            <%}%>                                                               <% // 800WA_WEBCONSOLE372 %>
 	     </td>
     </tr>
    </table>
  </body>
</html:html>