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

<%
  String nameOfForm = Constants.HttpSessionFields.T4FORM_NAME;
  if(request.getAttribute(Constants.HttpRequestFields.FORM_NAME) != null ) {
  	nameOfForm = (String)request.getAttribute(Constants.HttpRequestFields.FORM_NAME);
  }
  T4Interface t4 =
    ((T4Interface)session.getAttribute(
      Constants.HttpSessionFields.CURRENT_T4));
%>
 
<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="detail.property"/>
              </div>
            </td>                                                
            <td align="left">
              <div class="table-header-text">
                <bean:message key="detail.value"/>
              </div>
            </td>                        
           </tr>
           <logic:present name="<%=nameOfForm%>">                     
           <tr>
             <td align="left" nowrap>
               <div class="table-normal-text">
                 <bean:message key="storage.mgmt.system.name.colon" />
               </div>
             </td>                        
             <td align="left" nowrap>
               <div class="table-normal-text"> 
                 <bean:write name="<%=nameOfForm%>" property="name"/> 
               </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">    
                <html:text disabled="<%=readOnly%>" name="<%=nameOfForm%>" property="description" size="30" maxlength="39"/>                      
              </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 arrayhealth = "array.health.code." + 
                  t4.getHealthStatus();
              %>
             <bean:message key="<%=arrayhealth%>"/>                           
            </div>
           </td>
          </tr>  
          <!-- firmware version -->
          <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()%>
              </div>
            </td>
          </tr>  
          <% if(((T4Form)session.getAttribute(nameOfForm)).getFormType() == 
               T4Form.CUSTOM_MODE) {%>
          <tr>
             <td align="left" nowrap>
               <div class="table-normal-text">
                 <bean:message key="storage.mgmt.system.segmentsize" />
               </div>
             </td>
             <td align="left" nowrap>
               <div class="table-normal-text">  
                 <html:select name="<%=nameOfForm%>" property="blockSize" disabled="<%=readOnly%>">
          		  <html:option key="array.blocksize.4096" value='<%="" + Constants.StorageSize._4K%>'/>
           		  <html:option key="array.blocksize.8192" value='<%="" + Constants.StorageSize._8K%>'/>
           		  <html:option key="array.blocksize.16384" value='<%="" + Constants.StorageSize._16K%>'/>
           		  <html:option key="array.blocksize.32768" value='<%="" + Constants.StorageSize._32K%>'/>
           		  <html:option key="array.blocksize.65536" value='<%="" + Constants.StorageSize._64K%>'/>
           	  </html:select>
           	 </div>
           </td>                        
        </tr> 
        <tr>
          <td align="left" nowrap>
            <div class="table-normal-text">
               <bean:message key="storage.mgmt.system.readahead" />
            </div>
          </td>
          <td align="left" nowrap>
            <div class="table-normal-text">
             <%  int raMode = t4.getReadaheadMode(); %>
             <!-- The reason the struts html select tag is not used here is because
                  the values in this select box are different from the display values.
                  The display values are 'on' and 'off' where the actual values are
                  1 and 0. In order to properly pre-select the values, the values
                  and display values must match.
             -->
             <select name="readaheadMode" <%=(readOnly ? "disabled" : "")%>>
             <% if(raMode == 0) { %>
               <option selected value="0"><bean:message key="array.readahead.0"/>
               <option value="1"><bean:message key="array.readahead.1"/>
             <% } else { %>
               <option value="0"><bean:message key="array.readahead.0"/>
               <option selected value="1"><bean:message key="array.readahead.1"/>
             <% } %>
             </select>
             <html:hidden name="<%=nameOfForm%>" property="readaheadMode"/> 
           </div>
        </td>
      </tr>
      <tr>
        <td align="left" nowrap>
          <div class="table-normal-text">
            <bean:message key="storage.mgmt.system.diskscrub" />
          </div>
        </td>
        <td align="left" nowrap>
          <div class="table-normal-text">
          <% if(t4.isFeatureSupported(
               Constants.SupportedFeature.FEATURE_DISK_SCRUBBING)) { 
               %>
             <html:select name="<%=nameOfForm%>" property="diskScrubbing" disabled="<%=readOnly%>">
       		  <html:option key="array.diskscrubbing.enabled" value='<%=Constants.T4.DISK_SCRUBBING_ON%>'/>
       		  <html:option key="array.diskscrubbing.disabled" value='<%=Constants.T4.DISK_SCRUBBING_OFF%>'/>
       	     </html:select>                            
         <% } else { %>
             <bean:message key="not.supported.firmware"/>
         <% } %>
         </div>
      </td>
     </tr>  
     <tr>
       <td align="left" nowrap>
         <div class="table-normal-text">
           <bean:message key="storage.mgmt.system.diskrecon" />
         </div>
       </td>
       <td align="left" nowrap>
         <div class="table-normal-text">
           <html:select name="<%=nameOfForm%>" property="diskReconRate" disabled="<%=readOnly%>">
       		  <html:option key="array.diskrecon.1" value='<%="1"%>'/>
       		  <html:option key="array.diskrecon.8" value='<%="8"%>'/>  
       		  <html:option key="array.diskrecon.16" value='<%="16"%>'/> 
   	       </html:select>                            
        </div>
      </td>
    </tr>  
    <tr>
      <td align="left" nowrap>
        <div class="table-normal-text">
           <bean:message key="storage.mgmt.system.failover" />
        </div>
      </td>
      <td align="left" nowrap>
        <div class="table-normal-text">
         <% if((T4Form)session.getAttribute(nameOfForm) != null) {
           String failover = 
            ((T4Form)session.getAttribute(nameOfForm)).getFailoverMode();
            if(Constants.T4.EXP_LUN_FAILOVER_MODE.equals(failover) ||
               Constants.T4.IMP_LUN_FAILOVER_MODE.equals(failover) ||
               Constants.T4.NO_LUN_FAILOVER_MODE.equals(failover)) { 
        %>
          <html:select name="<%=nameOfForm%>" property="failoverMode" disabled="<%=readOnly%>">
      		  <html:option key="array.failover.mpxio" value='<%="mpxio"%>'/>
       		  <html:option key="array.failover.readWrite" value='<%="readWrite"%>'/>
      		  <html:option key="array.failover.none" value='<%="none"%>'/>
   	      </html:select>                             
       <%
            } else {
             ((T4Form)session.getAttribute(nameOfForm)).
               setFailoverMode(Constants.T4.UNSUPPORTED_LUN_FAILOVER_MODE);
       %>
          <html:select name="<%=nameOfForm%>" property="failoverMode" disabled="<%=readOnly%>">
      		  <html:option key="array.failover.mpxio" value='<%="mpxio"%>'/>
       		  <html:option key="array.failover.readWrite" value='<%="readWrite"%>'/>
       		  <html:option key="array.failover.none" value='<%="none"%>'/>
	          <html:option key="array.failover.unsupported" value='<%="Unsupported"%>'/>
   	      </html:select>                             
      <%    }// end else
         }// end form != null
      %>
      </div>
     </td>
    </tr>   
    <tr>
       <td align="left" nowrap>
         <div class="table-normal-text">
            <bean:message key="storage.mgmt.system.cache" />
          </div>
       </td>
       <td align="left" nowrap>
         <div class="table-normal-text">
            <html:select name="<%=nameOfForm%>" property="cacheMode" disabled="<%=readOnly%>">
       		  <html:option key="array.cachemode.disabled" value='<%="off"%>'/>
      		  <html:option key="array.cachemode.writeThrough" value='<%="writeThrough"%>'/>  
      		  <html:option key="array.cachemode.writeBehind" value='<%="writeBehind"%>'/>
     		  <html:option key="array.cachemode.auto" value='<%="auto"%>'/>
     	    </html:select>                            
         </div>
      </td>
   </tr>

  <% } // end if custom mode %>
  <!-- array hot spare pool size row -->
  <tr>
     <td align="left" nowrap>
       <div class="table-normal-text">
         <bean:message key="storage.mgmt.system.hotsparepoolsize" />
       </div>
     </td>
     <td align="left" nowrap>
       <div class="table-normal-text">
       <% if(t4.isFeatureSupported(
              Constants.SupportedFeature.FEATURE_ARRAY_HOT_SPARE)) {
           int max = t4.getMaxAhsPoolSizeAllowed();
           // only show the select box if more than 0 is allowed
           if(max > 0) {
       %>
           <html:select name="<%=nameOfForm%>" property="arrayHotSparePoolSize" disabled="<%=readOnly%>">
           <% 
              String prefix = "arrayhotsparepoolsize.";
              for(int i = 0; i <= max; i++) { 
                String key = prefix + i;
           %>
                <html:option key="<%=key%>" value='<%="" + i%>'/>
           <% }// end for loop %>
           </html:select>
      <% 
           // end max > 0
           } else {
      %>
           
            <bean:write name="<%=nameOfForm%>" property="arrayHotSparePoolSize"/>
            <bean:message key="arrayhotsparepoolsize.disks"/>
      <%
           }
         } else { %>
          <bean:message key="not.supported.firmware"/>
      <% } %>
      </div>
    </td>
  </tr>  
  <% if(((T4Form)session.getAttribute(nameOfForm)).getFormType() != T4Form.CUSTOM_MODE) {%>
  <tr>
    <td colspan="2" align="right">
      <div class="table-normal-text">
        <a href="javascript:submitForm('more_for_custom');"><bean:message key="more.link"/></a>
      </div>
    </td>
  </tr>
  <% } else {%>
  <tr>
    <td colspan="2" align="right">
      <div class="table-normal-text">
        <a href="javascript:submitForm('less_for_express');"><bean:message key="less.link"/></a>
      </div>
   </td>
  </tr>
<% } %>
</logic:present>                                   
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
