<%--
  /**
   * Copyright (c) 2003 by Sun Microsystems, Inc. All rights reserved.
   * Use is subject to license terms.
   *
   * "@(#)sm_add_to_profile.jsp    1.14    03/06/02     SMI"
   * 
   */
 --%>
<%@ include file="/layout/toptags.jsp"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.ui.forms.T4Form"%>
<!-- 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="storage.mgmt.system.addprofile.title"/>
    </title>
</head>

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



<html:form action="root.menu.item0.item1addToProfile.do">
<input type="hidden" name="request_action" value="<%=request.getAttribute("request_action")%>">
<div class="content-layout">

<%@ include file="/layout/user_messages.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">
                <bean:message key="storage.mgmt.system.addprofile.header" arg0='<%= ((T4Interface)session.getAttribute("CurrentT4")).getName()%>'/>             
              </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>
        </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 -->
<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 bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <%
       String profile = 
        ((T4Interface)session.getAttribute(
           Constants.HttpSessionFields.CURRENT_T4)).getProfile().getName();
       MessageResources messages = 
		    (MessageResources) application.getAttribute(Action.MESSAGES_KEY);
       String localizedProfileName =
         "<b>" + messages.getMessage(request.getLocale(), profile) + "</b>";
    %>
    <td><bean:message key="storage.mgmt.system.addprofile.traydirections" arg0='<%=localizedProfileName%>'/>
   
    </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>


<!-- only show the tray listing if we have some trays to choose from -->
<logic:present name="Profile" property="traysWithSpace">
 
  <table border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td>
        <table border="0" cellpadding="1" cellspacing="0" class="button-link-enabled-text">
          <tr>
             <td>
                <table border="0" cellpadding="0" cellspacing="0" class="button-content-enabled">
                  <tr>
                    <td align="center" valign="middle" nowrap>
                       <component:button text="storage.mgmt.system.addprofile.add.button" href="javascript:submitForm('add_selected');" title="storage.mgmt.system.addprofile.add.button" isEnabled="true" />
                    </td>
                  </tr>
                </table>
              </td>                                      
           </tr>
         </table>
       </td>   
       <td><img alt border="0" height="20" width="10" src="images/general/dot.gif"></td> 
     </tr>
     <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 align="center" valign="middle" nowrap><a href="javascript:checkAll(document.forms[0])"><img src="images/icons/select-all-small.gif" alt='<bean:message key="table.select.all"/>' vspace="2" border="0" width="11" height="13"></a><a href="javascript:unCheckAll(document.forms[0])"><img src="images/icons/deselect-all-small.gif" alt='<bean:message key="table.deselect.all"/>' vspace="2" border="0" width="11" height="13"></a></td>
                        <td nowrap>
                          <div class="table-header-text">
                            <bean:message key="tray.table.id"/>
                          </div>
                        </td>      
                        <td nowrap>
                          <div class="table-header-text">
                            <bean:message key="tray.table.drivenum.short"/> 
                          </div>
                        </td>       
                        <td nowrap>
                          <div class="table-header-text">
                            <bean:message key="tray.table.drivecapacity"/> 
                          </div>
                        </td>           
                        <td nowrap>
                          <div class="table-header-text">
                           <bean:message key="tray.table.hotspare"/> 
                          </div>
                        </td>
                        <td nowrap>
                          <div class="table-header-text">
                           <bean:message key="tray.table.driveavailable"/> 
                          </div>
                        </td>                        
                        <td nowrap>
                          <div class="table-header-text">
                            <bean:message key="tray.table.drivetoallocate"/> 
                          </div>
                        </td>
                      </tr>
                      <!-- Begin tray row listing(s) -->                         
 				 	    <logic:iterate id="trayW" name="Profile" property="traysWithSpace" type="TrayWrapper" indexId="idx"> 				 	      
                          <tr>           
                            <td>
                              <input type="checkbox" name="tray<%=idx%>" value="<%=idx%>">
                            </td>                  
                            <td>     
                              <div class="table-label-text">                    
                                <bean:write name="trayW" property="tray.id"/>
                              </div>
                            </td>     
                            <td>  
                              <div class="table-label-text">                        
                                <bean:write name="trayW" property="tray.numberOfDrives"/>
                              </div>
                            </td>                    
                            <td>        
                              <div class="table-label-text">                  
                                
                                <%=nf.format(nf.parse(Convert.bytesToGB(trayW.getTray().getDriveCapacity())))%>     
                                <bean:message key="size.GB"/>                           
                              </div>
                            </td>      
                            <td>    
                              <div class="table-label-text">                      
                                <bean:write name="trayW" property="tray.numberOfHotSpare"/>
                              </div>
                            </td> 
                            <td>
                              <div class="table-label-text">
                                <%                                   
                                   List possibleDrives = trayW.getPossibleDrivesToAdd();
                                   //int avail = trayW.getTray().getNumberOfDrives() - trayW.getTray().getNumberOfHotSpare();                           
                                   int avail = ((Integer)possibleDrives.get(possibleDrives.size() - 1)).intValue();
                                %>
                                <%= avail %>
                              </div>
                            </td>
                           
                            <td>                         
                              <div class="table-label-text"> 
                                <select name="numdrives<%=idx%>">    
                                  <%
                                      
                                      for(int j = 0; j < possibleDrives.size(); j++) {
                                      	int drive = ((Integer)possibleDrives.get(j)).intValue();                                      	
                                  %>                            	                            	  
 	    	                           <option 
 	    	                               <% if ( j == possibleDrives.size()-1) { %>
                                              selected
                                           <% } %>
 	    	                           ><%=drive%>
 	    	                      <%
                                      }
 	    	                      %>
                                  <select> 
                                
                              </div>
                            </td>
                         </tr>
                        </logic:iterate>                                              
                                                                
                    </table>
                  </td>
                </tr>                 
              </table>
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>

</logic:present>


<!-- 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><img alt border="0" height="20" width="1" src="images/general/dot.gif"></
td>
  </tr>
</table>


</div>

</html:form>
</body>

</html:html>
