<%--
  /**
   * Copyright (c) 2003 by Sun Microsystems, Inc. All rights reserved.
   * Use is subject to license terms.
   *
   * "@(#)sm_disks_include.jsp    1.2    03/07/24     SMI"
   * 
   */
 --%>

<%@ page import="com.sun.netstorage.array.mgmt.cfg.mgmt.business.DiskInterface"%>

<%
boolean showHelpTextAndButtons = request.getAttribute(Constants.HttpRequestFields.DISK_INCLUDE_HIDE_HELP) == null;
%>
<% if (showHelpTextAndButtons) { %>
<!-- pool section instructions --> 
<table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td><img alt border="0" height="8" width="1" src="images/general/dot.gif"></td>
  </tr>
  <tr>
    <bean:message key="express.subreports.disks.instructions"/>
  </tr>
</table>

<%@include file="/layout/spacer.jsp"%>

  <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">
                <%
                  String name = "";
                  if(request.getParameter("index") != null){
                  	name = request.getParameter("index");
                  }
		  String diskTableTitle = "tray.detail.disk.header";
		  if(request.getAttribute(Constants.HttpRequestFields.DISK_TABLE_TITLE) != null ){
		  	diskTableTitle = (String)request.getAttribute(Constants.HttpRequestFields.DISK_TABLE_TITLE);
			name=(String)request.getAttribute(Constants.HttpRequestFields.DISK_TABLE_TITLE_OBJECT);
		  }
                %>
                <bean:message key="<%=diskTableTitle%>" arg0="<%=name%>"/>                 
              </div>
            </td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td><img alt border="0" height="5" src="/images/general/dot.gif" width="1"></td>
    </tr>
  </table>

<!-- spacer between two sections -->
<%@include file="/layout/spacer.jsp"%>

<% } %>

  <table border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td nowrap>                  
              <table class="back-table" border="0" cellspacing="0" cellpadding="1" width="100%">
                <tr>
                  <td>
                    <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="report.disk.title"/>
                          </div>
                        </td>                                                
                        <td align="left">
                          <div class="table-header-text">
                            <bean:message key="report.disk.capacity.label"/>
                          </div>
                        </td>  
                        <td align="left">
                          <div class="table-header-text">
                            <bean:message key="report.disk.status.label"/>
                          </div>
                        </td>  
                        <td align="left">
                          <div class="table-header-text">
                            <bean:message key="report.disk.state.label"/>
                          </div>
                        </td>  
                        <td align="left">
                          <div class="table-header-text">
                            <bean:message key="report.disk.role.label"/>
                          </div>
                        </td>  
                        <td align="left">
                          <div class="table-header-text">
                            <bean:message key="storage.mgmt.volumes.pool"/>
                          </div>
                        </td>  
                      </tr>
                      <!-- begin data row listing -->
                      <logic:notPresent name="<%=Constants.HttpSessionFields.TRAY_DISK_LIST%>">
                        <tr>
                          <td colspan="7">
                             <bean:message key="tray.table.nodisks"/>
                          </td>
                        </tr>
                      </logic:notPresent>
                      <logic:present name="<%=Constants.HttpSessionFields.TRAY_DISK_LIST%>">
                         <logic:iterate id="disk" name="<%=Constants.HttpSessionFields.TRAY_DISK_LIST%>" type="DiskInterface" indexId="idx">
                           <tr>
                             <td>
                                <div class="table-normal-text">
                                     <bean:write name="disk" property="name"/>
                                </div>
                             </td>
                             <td align="right">
                                <div class="table-normal-text">
				<%
					java.text.NumberFormat nf1 = 
						java.text.NumberFormat.getInstance(request.getLocale());
					nf1.setMinimumFractionDigits(2);
					String convertedSize = "0";
					try {
					convertedSize =
					  nf1.format(
				  	    nf1.parse(
					      com.sun.netstorage.array.mgmt.cfg.util.Convert.bytesStringToMBOrGB("" + 
					      	disk.getCapacity())));
					} catch (Exception e) {
						Trace.verbose(this, "diskInclude", e);
					}	
					String unit = "size." + 
						com.sun.netstorage.array.mgmt.cfg.util.Convert.getMBOrGBString("" + 
						disk.getCapacity());

				%>
				  <%=convertedSize%> <bean:message key="<%=unit%>"/>  
                                </div>
                             </td>
                             <td>
                                <div class="table-normal-text">
				    <bean:message key="<%="disk.status." + disk.getStatus()%>"/>
                                </div>
                             </td>
                             <td>
                                <div class="table-normal-text">
				    <bean:message key="<%="disk.state." + disk.getState()%>"/>
                                </div>
                             </td>
                             <td>
                                <div class="table-normal-text">
				    <bean:message key="<%="disk.role." + disk.getRole()%>"/>
                                </div>
                             </td>
                             <td>
                                <div class="table-normal-text">
				<% if(disk.getRaidGroupName() != null) { %>
				  <a href="root.menu.item0.item2pooldetails.do?name=<%=disk.getRaidGroupName()%>&t4Name=<%=((T4Interface)session.getAttribute(Constants.HttpSessionFields.CURRENT_T4)).getName()%>">
                                     <bean:write name="disk" property="raidGroupName"/>
				  </a>
				     <% } else { %>
				     -
				     <% } %>
                                </div>
                             </td>
                           </tr>
                         </logic:iterate>
                       </logic:present>  
                    </table>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
