<%--
  /**
   * Copyright (c) 2003 by Sun Microsystems, Inc. All rights reserved.
   * Use is subject to license terms.
   *
   * "@(#)admin_array_details.jsp    1.10    03/09/25     SMI"
   * 
   */
 --%>
<%@ include file="/layout/toptags.jsp"%>
<!-- locale stuff -->
<html:html locale="true">
<!-- end locale -->

<!-- Place Java Script Here -->

<!-- HTML -->
<head>
<%@include file="/layout/page_head_section.jsp"%>
    <title>
        <bean:message  key="admin.general.arraydetails.title"/>
    </title>
</head>

<%@include file="/layout/bodytag.jsp"%>
<%@include file="/layout/top.jsp"%>
<%@include file="/layout/breadcrumb.jsp"%>
<%@include file="/layout/spacer.jsp"%>
<%@ include file="/layout/user_messages.jsp"%>


<table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td><img alt border="0" height="10" width="1" src="images/general/dot.gif"></td>
  </tr>
</table>

<jsp:include page="/layout/section_header.jsp" flush="true">
	<jsp:param name="sectionname" value="storage.mgmt.system.section.title" />
</jsp:include>

<div class="content-layout">
<html:form action="root.menu.item3.item0.arraydetails.do">
<!-- need a field to submit the form -->
 <input type="hidden" name="request_action" value="show"/> 
<!-- ARRAY DETAILS Section -->    
<%
    T4Interface t4 = (T4Interface) session.getAttribute(Constants.HttpSessionFields.CURRENT_T4);
%>
  
<!-- Array details help text section. -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td>
      <bean:message key="admin.general.arraydetails.helptext"/>
    </td>
  </tr>
  <tr>
    <td>
      <img width="10" height="15" border="0" src="images/general/dot.gif"/>
    </td>          		          
  </tr>
</table> 

<!-- Array details table. -->
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td nowrap>
      <table class="back-table" border="0" cellspacing="0" cellpadding="1" width="100%">
        <tr>
          <td align="left" valign="middle">
            <table class="front-table" border="0" cellspacing="0" cellpadding="0" width="100%">
              <tr class="header-row">                        
                <td align="left">
                  <div class="table-header-text">
                    <bean:message key="detail.property"/>
                  </div>
                </td>                                                
                <td align="left">
                  <div class="table-header-text">
                    <bean:message key="detail.value"/>
                  </div>
                </td>                        
              </tr>
              <tr>
                <td align="left" nowrap>
                  <div class="table-normal-text">
                    <bean:message key="admin.general.arraydetails.table.array" />
                  </div>
                </td>
                <td align="left" nowrap>
                  <div class="table-normal-text">
                    <%=t4.getName()%>
                  </div>
                </td>
              </tr>
              <tr>
                <td align="left" nowrap>
                  <div class="table-normal-text">
                    <bean:message key="storage.mgmt.system.array.description" />
                  </div>
                </td>
                <td align="left" nowrap>
                  <div class="table-normal-text">
                    <%=(t4.getDescription() == null ? "&nbsp;" : t4.getDescription())%>
                  </div>
                </td>
              </tr>                     
              <tr>
                <td align="left" nowrap>
                  <div class="table-normal-text">
                    <bean:message key="storage.mgmt.system.firmware" />
                  </div>
                </td>
                <td align="left" nowrap>
                  <div class="table-normal-text">
                    <%=(t4.getFirmwareVersion() == null ? "&nbsp;" : t4.getFirmwareVersion())%>
                  </div>
                </td>
              </tr>                     
              <tr>
                <td align="left" nowrap>
                  <div class="table-normal-text">
                    <bean:message key="storage.mgmt.system.health" />
                  </div>
                </td>
                <td align="left" nowrap>
                  <div class="table-normal-text">           
                    <% String health = "array.health.code." + t4.getHealthStatus(); %>
                    <bean:message key="<%=health%>" />
                  </div>
                </td>
              </tr>
            </table> <!-- front-table -->
          </td>
        </tr>
      </table> <!-- back-table -->
    </td>
  </tr>
</table>


<table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td><img alt border="0" height="25" width="1" src="images/general/dot.gif"/></td>
  </tr>
</table>

<!-- Subtitle and help text section. -->        
<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td nowrap>
      <div class="major-category-text">
        <bean:message key="admin.general.arraydetails.reconfiguration"/> 
      </div>
    </td>
    <td valign="bottom" width="99%">
      <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
          <td class="property-separator" valign="bottom"><img alt border="0" height="2" src="/images/general/dot.gif" width="1"></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td colspan="2"><img alt border="0" height="10" width="1" src="images/general/dot.gif"></td>
  </tr>
  <tr>
    <td colspan="2"><bean:message key="admin.general.arraydetails.reconfiguration.helptext"/></td>
  </tr>
</table>

<!-- TRAYS in this ARRAY section -->

<!-- spacer between two sections -->
<table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td><img alt border="0" height="12" width="1" src="images/general/dot.gif"></td>
  </tr>
</table>

<!-- Tray subtitle and button row. -->
<%
	boolean enableAddExpansion = false;
	boolean enableRemoveExpansion = false;
   	List trays = null;
 
    // check if we should use the rarp remove expansion
    //   wizard or not
    boolean showRarp = 
      (t4.isFeatureSupported(
        Constants.SupportedFeature.FEATURE_BOOT_R) ? false : true);

	if (t4.getHealthStatus() == 2) {    
    	trays = (List)session.getAttribute(Constants.HttpSessionFields.TRAY_LIST_PARAM);
    	boolean[] buttonRules = (boolean[]) session.getAttribute(Constants.HttpSessionFields.ENABLE_RECONFIGURATION);
    	// If the session variable is missing buttons are disabled.
    	if(buttonRules != null) {
			enableAddExpansion = buttonRules[0];
			enableRemoveExpansion = buttonRules[1];    	
			Trace.verbose(
			    this, 
			    "admin_array_details.jsp", 
			    "\n enableAddExpansion: " + enableAddExpansion
			    + "\n enableRemoveExpansion: " + enableRemoveExpansion);
	    }
    }
%>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td>
      <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
          <td nowrap>
            <div class="major-category-text">
              <bean:message key="admin.general.arraydetails.tray"/> 
            </div>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td><img alt border="0" height="5" src="/images/general/dot.gif" width="1"></td>
  </tr>
  <tr>
    <td>
      <bean:message key="admin.general.arraydetails.tray.helptext"/>
    </td>
  </tr>
  <tr>
    <td><img alt border="0" height="8" width="1" src="images/general/dot.gif"></td>
  </tr>    
  <tr>
    <td nowrap>
      <table border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td align="left" valign="middle">
            <table border="0" cellpadding="0" cellspacing="0">
              <tr>                  
                <td>
                  <table border="0" cellpadding="1" cellspacing="0" class="button-link-enabled-text">
                    <tr>
                      <td>
                        <table>
                          <tr>
                            <td align="center" valign="middle" nowrap>                                         
                              <component:button text="admin.general.arraydetails.tray.addexpansion.button" 
                              			href="javascript:addExpansionWizard()" 
                                        title="admin.general.arraydetails.tray.addexpansion.button"
                                        isEnabled="<%=enableAddExpansion && !readOnly%>" />
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
                </td>
                <td width="10"><img alt width="10" height="1" border="0" src="images/general/dot.gif"></td> 
              </tr>
            </table>
          </td>
            
          <td>
            <table border="0" cellpadding="0" cellspacing="0">
              <tr>                  
                <td>
                  <table border="0" cellpadding="1" cellspacing="0" class="button-link-enabled-text">
                    <tr>
                      <td>
                        <table>
                          <tr>
                            <td align="center" valign="middle" nowrap>         
                              <% String wizardRef = "javascript:removeExpansionWizard(" + showRarp + ")"; %>
                              <component:button text="admin.general.arraydetails.tray.removeexpansion.button" 
                              			href="<%=wizardRef%>"
                                        title="admin.general.arraydetails.tray.removeexpansion.button"
                                        isEnabled="<%=enableRemoveExpansion && !readOnly%>" />
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
                </td>
                <td width="10"><img alt width="10" height="1" border="0" src="images/general/dot.gif"></td>
              </tr>
            </table>
          </td> 
          
          <td>
            <table border="0" cellpadding="0" cellspacing="0">
              <tr>                  
                <td>
                  <table border="0" cellpadding="1" cellspacing="0" class="button-link-enabled-text">
                    <tr>
                      <td>
                        <table>
                          <tr>
                            <td align="center" valign="middle" nowrap>         
                              <component:button text="admin.general.refresh.button" 
                              			href="javascript:document.forms[0].request_action='show';document.forms[0].submit();" 
                                        title="admin.general.refresh.button"
                                        isEnabled="<%=true%>" />
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
                </td>
                <td width="10"><img alt width="10" height="1" border="0" src="images/general/dot.gif"></td>
              </tr>
            </table>
          </td>                                                                                                         
        </tr>        
      </table>
    </td>
  </tr>
</table>

<!-- spacer between two sections -->
<table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td><img alt border="0" height="10" width="1" src="images/general/dot.gif"></td>
  </tr>
</table>

<!-- list of trays table -->
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td nowrap>
      <table class="back-table" border="0" cellspacing="0" cellpadding="1">
        <tr>
          <td>
            <table class="front-table" border="0" cellspacing="0" cellpadding="0">
              <tr class="header-row">
                <td align="center">
                  <div class="table-header-text">
                    <bean:message key="tray.table.id.short"/>
                  </div>
                </td>
                <td align="center">
                  <div class="table-header-text">
                    <bean:message key="tray.table.type.short"/>
                  </div>
                </td>                                               
                <td align="center">
                  <div class="table-header-text">
                    <bean:message key="tray.table.status"/> 
                  </div>
                </td>
                <td align="center">
                  <div class="table-header-text">
                    <bean:message key="tray.table.state"/> 
                  </div>
                </td>
                <td align="center">
                  <div class="table-header-text">
                    <bean:message key="tray.table.role"/> 
                  </div>
                </td>
              </tr>
                
              <!-- Begin tray row listing(s) -->                                                  
              <%
              	 if (trays != null) {
	                 Trace.verbose(this, "admin_array_details.jsp", "Go into loop on trays");                 
	                 for (int index = 0; index < trays.size(); index++) {
	                     try {
	                           Trace.verbose(this, "admin_array_details.jsp", "get tray " + index);
	                           TrayInterface tray = (TrayInterface) trays.get(index);
	                           int trayType = tray.getTrayType();
	                           String trayRole = tray.getRole();
	                           boolean isController = 
	                              (trayType == 
	                                  Constants.Tray.MAIN_SYSTEM_CHASSIS ? true : false);
	                           boolean isMaster = ("master".equals(trayRole) ? true : false);                         
	              %>
	
	              <tr>                             
	                <td align="center" nowrap>   
	                  <div class="table-label-text">         
	                    <%=tray.getId()%>
	                  </div>
	                </td> 
	                <td align="center" nowrap>                    
	                  <div class="table-label-text">
	                    <% String typeStr = "tray.type." + trayType; %>
	                    <bean:message key="<%=typeStr%>"/>
	                  </div>
	                </td>
	                <td align="center" nowrap>                                           
	                  <div class="table-label-text">
	                    <% String statusStr = "tray.status." + tray.getStatus(); %>
	                    <bean:message key="<%=statusStr%>"/>
	                  </div>
	                </td> 
	                <td align="center" nowrap>                                           
	                  <div class="table-label-text">
	                    <% String stateStr = "tray.state." + tray.getState(); %>
	                    <bean:message key="<%=stateStr%>"/>
	                  </div>
	                </td> 
	                <td align="center" nowrap>                                             
	                  <div class="table-label-text">
	                    <% String roleStr = "tray.role." + trayRole;%>
	                    <bean:message key="<%=roleStr%>"/>
	                  </div>
	                </td> 
	              </tr>
	              <!-- Line row. -->
	              <tr height="1">
	                <td class="line-row" height="1" colspan="6"><img src="images/general/dot.gif" border="0" width="1" height="1"></td>
	              </tr>                         
	              <%
	                     } catch (Throwable x) {
	                        Trace.verbose(this, "admin_array_details.jsp", "Exception in page!");
	                        Trace.verbose(this, "admin_array_details.jsp", x);
	                     }
	                  } // for loop end                  
	                  Trace.verbose(this, "admin_array_details.jsp", "Done looping thru trays");
	                  
                  } else {
                  	// Case with no trays available.
                  	Trace.verbose(this, "admin_array_details.jsp", "No trays available.");                  
              %>               
	              <tr>
	                <td align="center" nowrap colspan="5">                                             
	                  <div class="table-label-text">                    
	                    <bean:message key="admin.general.arraydetails.notrays.table.label"/>
	                  </div>
	                </td> 
	              </tr>  
	                          
              <% } %>
              
            </table> <!-- front-table -->
          </td>
        </tr>
      </table> <!-- back-table -->
    </td>
  </tr>
</table>

</html:form>
</div>


</body>
</html:html> 
