<%--
  /**
   * Copyright (c) 2003 by Sun Microsystems, Inc. All rights reserved.
   * Use is subject to license terms.
   *
   * "@(#)sm_createpoolwiz_pool1.jsp    1.13    03/05/14     SMI"
   * 
   */
 --%>
<%@ include file="/layout/toptags.jsp"%>
<html:html>

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

<%@ include file="/layout/wizard_body_tag.jsp" %>
<html:form action="/CreatePoolWizard.do">
<%@ include file="/wizard/wizard_framework_fields.jsp"%>

<div class="content-layout">

<%@ include file="/layout/user_messages.jsp"%>
<% try { %>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr class="wizard-content-title-row">
    <td>
      <div class="wizard-content-title-text">
        <bean:message key="storage.mgmt.pools.createwizard.pool.settings"/>
      </div>
    </td>
  </tr>
  <tr>
    <td class="wizard-content-divider"><img alt width="1" height="1" src="/images/general/dot.gif" border="0"></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="20" width="1" src="images/general/dot.gif"></td>
  </tr>
</table>

  <!-- spacer between two sections -->
<table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td><bean:message key="storage.mgmt.pools.createwizard.pool.settings.msg"/>
    </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="20" width="1" src="images/general/dot.gif"></td>
  </tr>
</table>


 
  <table border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td nowrap>
        <table border="0" cellspacing="0" cellpadding="0">          
          <tr>
            <td><img alt width="1" height="2" border="0" src="images/general/dot.gif"></td>
          </tr>
          <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 colspan="2">
                          <div class="table-header-text">
                            <bean:message key="pools.table.name"/>
                          </div>
                        </td>                            
                      </tr>
                      <tr>
                       <td nowrap>
                          <div class="table-normal-text">
                            <bean:message key="storage.mgmt.pools.createwizard.pool.name"/>
                          </div>
                       </td>
                      <td nowrap>
                         <div class="table-normal-text">
                            <html:text name="CreatePool" 
                            property="pool1Name" size="14" maxlength="12"/>
                         </div>
                      </td>
                    </tr>               
                    </table>
                  </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="20" width="1" src="images/general/dot.gif"></td>
  </tr>
</table>

<!-- spacer between two sections -->
<table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>   
    <td><bean:message key="storage.mgmt.pools.createwizard.pool.settings1"/></td>
  </tr>
</table>

<table border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td nowrap>
        <table border="0" cellspacing="0" cellpadding="0">          
          <tr>
            <td><img alt width="1" height="2" border="0" src="images/general/dot.gif"></td>
          </tr>
          <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></td>
                        <td nowrap>
                          <div class="table-header-text">
                            <bean:message key="pools.table.raidtype"/>
                          </div>
                        </td> 
                        <td nowrap>
                          <div class="table-header-text">
                            <bean:message key="pools.table.datadrives"/>
                          </div>
                        </td>
                        <td nowrap>
                          <div class="table-header-text">
                            <bean:message key="pools.table.hotspare"/>
                          </div>
                        </td>                           
                      </tr>
                      
                      <%                                     
                          com.sun.netstorage.array.mgmt.cfg.ui.forms.PoolCreateForm form =
                            (com.sun.netstorage.array.mgmt.cfg.ui.forms.PoolCreateForm)session.getAttribute("CreatePool");
                          List drives = form.getRaid01DataDrives();
                         String half01 = "";
                         if(drives != null && !form.getTrayToModify().isDepop()){
                            half01 = drives.get(drives.size()/2).toString();
                         } else {
			                half01 = drives.get(drives.size() - 1).toString();
			 }
                         
                         int maxHS = 0;
                         String[] hotspares = form.getPossibleHotspares();     
                         maxHS = hotspares.length;
                      %>
                                    
                      <tr>
                       <td nowrap>
                         <div class="table-normal-text">
                           <input <%if(form.getRaidLevelPool1() == 0){%> checked <% } %> type="radio" name="raidLevelPool1" value="<%=Constants.RAIDLevel.RAID_0%>"/>
                         </div>
                       </td>
                       <td nowrap>
                         <div class="table-normal-text">
                          <bean:message key="pools.table.raid"/>&nbsp;<%=Constants.RAIDLevel.RAID_0%>
                         </div>
                       </td>
                       <logic:present name="CreatePool" property="raid01DataDrives">
		       		 <% String sel = "" + half01;
				      	 if(form.getRaidLevelPool1() == 0 && form.getDataDrivePool1() != null && 
					 	!form.getDataDrivePool1().trim().equals("")) {
					 	sel = form.getDataDrivePool1();
					 }
					 %>

                          <td nowrap align-"center">
                             <div class="table-normal-text">
                               <select name="dataDriveSelection<%=Constants.RAIDLevel.RAID_0%>">
                                 <logic:iterate id="drive" name="CreatePool" property="raid01DataDrives" indexId="idx">                                    
				     				      <%	
                                       if(drive.toString().equals(sel)) {
                                      %>
                                           <option selected><%=drive%>  
                                      <% } else { %>                                 
                                           <option><%=drive%> 
                                      <% } %>
                                 </logic:iterate>
                               </select>
                             </div>
                          </td>
                       </logic:present>
                       <td nowrap>
                         <div class="table-normal-text">
                         <%
                             if(form.getShowHotspare()) {
                         %>
                               <input type="hidden" name="hotspareSelection<%=Constants.Tray.HOTSPARE_0%>" value="<%=Constants.Tray.HOTSPARE_0%>">
                               <%=Constants.Tray.HOTSPARE_0%>
                         <% } else { %>
                           <bean:message key="storage.mgmt.pools.createwizard.notavailable"/>
                         <% } %>
                         </div>
                       </td>
                    </tr>               
                    <tr>
                       <td nowrap>
                         <div class="table-normal-text">
                          <input type="radio" <%if(form.getRaidLevelPool1() == 1){%> checked <% } %> name="raidLevelPool1" value="<%=Constants.RAIDLevel.RAID_1%>"/>
                         </div>
                       </td>
                       <td nowrap>
                         <div class="table-normal-text">
                          <bean:message key="pools.table.raid"/>&nbsp;<%=Constants.RAIDLevel.RAID_1%>
                         </div>
                       </td>
                       <logic:present name="CreatePool" property="raid01DataDrives">
				<% String sel = "" + half01;
				      	 if(form.getRaidLevelPool1() == 1 && form.getDataDrivePool1() != null && 
					 	!form.getDataDrivePool1().trim().equals("")) {
					 	sel = form.getDataDrivePool1();
					 }
					 %>

                          <td nowrap align-"center">
                             <div class="table-normal-text">
                               <select name="dataDriveSelection<%=Constants.RAIDLevel.RAID_1%>">
                                 <logic:iterate id="drive" name="CreatePool" property="raid01DataDrives" indexId="idx">
                                    <%                                                                                                                                                         
                                       if(drive.toString().equals(sel)) {
                                       //if(idx.intValue() == sel) {
                                      %>
                                           <option selected><%=drive%>  
                                      <% } else { %>                                 
                                           <option><%=drive%> 
                                      <% } %>
                                 </logic:iterate>
                               </select>
                             </div>
                          </td>
                       </logic:present>
                       <td nowrap>
                         <div class="table-normal-text">
                         <%
                             if(form.getShowHotspare()) {
                         %>
                           <select name="hotspareSelection<%=Constants.RAIDLevel.RAID_1%>"> 
                             <logic:iterate id="hs" name="CreatePool" property="possibleHotspares" indexId="index">
                                   <%
                                     if(index.intValue() == maxHS -1){
                                   %>
                                      <option selected><%=hs%>
                                   <% } else { %>
                                      <option><%=hs%>
                                   <% } %>
                             </logic:iterate>
                           </select>
                         <% } else { %>
                           <bean:message key="storage.mgmt.pools.createwizard.notavailable"/>
                         <% } %>
                         </div>
                       </td>
                    </tr>
                    <tr>
                       <td nowrap>
                         <div class="table-normal-text">
                          <input type="radio" name="raidLevelPool1" <%if(form.getRaidLevelPool1() == 5){%> checked <% } %> value="<%=Constants.RAIDLevel.RAID_5%>"/>
                         </div>
                       </td>
                       <td nowrap>
                         <div class="table-normal-text">
                          <bean:message key="pools.table.raid"/>&nbsp;<%=Constants.RAIDLevel.RAID_5%>
                         </div>
                       </td>
                       <logic:present name="CreatePool" property="raid5DataDrives">
			       	
                          <td nowrap align-"center">
                             <div class="table-normal-text">
                               <select name="dataDriveSelection<%=Constants.RAIDLevel.RAID_5%>">
                                 <logic:iterate id="drive" name="CreatePool" property="raid5DataDrives" indexId="idx">
                                    
                                    
                                      <%                                       
                                       List drives5 = 
                                        ((com.sun.netstorage.array.mgmt.cfg.ui.forms.PoolCreateForm)session.getAttribute("CreatePool")).getRaid5DataDrives();
                                       int half = 0;
                                       if(drives5 != null && !form.getTrayToModify().isDepop()){
                                          half = drives5.size()/2;
                                       } else {
				       	  half = drives5.size() - 1;
				       }
 					String sel = "" + half;
				      	 if(form.getRaidLevelPool1() == 5 && form.getDataDrivePool1() != null && 
					 	!form.getDataDrivePool1().trim().equals("")) {
					 	sel = form.getDataDrivePool1();
					 }

                                       if(drive.toString().equals(sel)) {
                                      %>
                                           <option selected><%=drive%>
                                      <% } else { %>
                                           <option><%=drive%>                              
                                      <% } %>
                                 </logic:iterate>
                               </select>
                             </div>
                          </td>
                       </logic:present>
                       <td nowrap>
                         <div class="table-normal-text">
                         <%
                             if(form.getShowHotspare()) {
                         %>
                           <select name="hotspareSelection<%=Constants.RAIDLevel.RAID_5%>">
                             <logic:iterate id="hs" name="CreatePool" property="possibleHotspares" indexId="index">
                                   <%
                                     if(index.intValue() == maxHS -1){
                                   %>
                                      <option selected><%=hs%>
                                   <% } else { %>
                                      <option><%=hs%>
                                   <% } %>
                             </logic:iterate>
                           </select>
                         <% } else { %>
                           <bean:message key="storage.mgmt.pools.createwizard.notavailable"/>
                         <% } %>
                         </div>
                       </td>
                    </tr>
                    </table>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>

<% } catch (Throwable t) {
    Trace.verbose(this, "create pool 1 jsp exception", t);
	} %>

</div>

</html:form>
</body>

</html:html>
