<%--
  /**
   * Copyright (c) 2003 by Sun Microsystems, Inc. All rights reserved.
   * Use is subject to license terms.
   *
   * "@(#)sm_profile_details.jsp    1.12    03/09/11     SMI"
   * 
   */
 --%>
<%@ include file="/layout/toptags.jsp"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.ui.forms.StorageProfileForm" %>
<!-- locale stuff -->
<html:html locale="true">
<!-- end locale -->

<!-- Place Java Script Here -->
<!-- HTML -->
<head>
<%@include file="/layout/page_head_section.jsp"%>
<script language"javascript">
function submitCreate() {
    document.forms[0].action='root.menu.item0.item3.do';
    submitForm('editprofile'); 
}
</script>
    <title>
        <bean:message  key="storage.mgmt.profile.summary.crumb"/>
    </title>
</head>
<%@include file="/layout/bodytag.jsp"%>
<%@include file="/layout/top.jsp"%>
<%@include file="/layout/breadcrumb.jsp"%>

<html:form action="root.menu.item0.item3profiledetails.do">
<% try { %>
<!-- hidden element which specifies the action for this form -->
<input type="hidden" name="request_action" value="<%=request.getAttribute("request_action")%>">
<% 
   StorageProfileForm form = (StorageProfileForm)session.getAttribute("storageProfile");
   if (form.getReadaheadMode() != 0) {
       form.setReadaheadMode(1);
   }
   boolean currentInUse = form.isInUse(); 
   boolean areAllHealthy = form.isHealth();
%>
<div class="content-layout">
  <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr width="100%">
       <td nowrap ><img alt border="0" src="images/general/dot.gif" width="1" height="7"></td>
    </tr>
  </table>

  <%@ 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.profile.details.header"/> 
              </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>
    <tr>
       <td>
           <table border="0" cellpadding="3" cellspacing="0" width="100%">
              <tr>
                 <td>
                 <bean:message key="storage.mgmt.profile.details.msg"/>
                 </td>
              </tr>
           </table>
       </td>
    </tr>

    <tr width="100%">
       <td nowrap ><img alt border="0" src="images/general/dot.gif" width="1" height="7"></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="button.save" href="javascript:submitForm('modifyprofile')" title="button.save" isEnabled="<%= !readOnly && areAllHealthy %>" />
                              </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="button.saveas" href="javascript:submitForm('saveas');" title="button.saveas" isEnabled="<%= !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>         
                                 <%
                                    // set the cancel link to be the current page by default
				    //  this should be overwritten unless an exception occurs
				   //   or if the crumb is not found
                                   String cancelLink = "root.menu.item0.item3.do";
				   try {
                                      if(crumbs != null) {
                                      // get the cancel button link from the previous breadcrumb
                                      //  so it's the second to the last link (-2)
                                        crumb = (com.sun.netstorage.array.mgmt.cfg.ui.core.action.Crumb)crumbs.get(crumbs.size() - 2);
                                        if(crumb != null) {
                                            cancelLink = crumb.getLink();
                                        }
                                     }
                                  } catch(Exception ex) {} 
                                 %>
                                 <component:button text="button.cancel" href="<%= cancelLink %>" title="button.cancel" 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>

  <!-- Profile details table -->
  <table>
    <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 nowrap>
                       <div class="table-header-text">
                          <bean:message key="storage.mgmt.profile.details.table.title" />
                       </div>
                     </td>
                     <td nowrap>
                       <div class="table-header-text">
                          &nbsp;
                       </div>
                     </td>
                  </tr>

                  <!-- end column header row -->

                  <!-- Begin profile details listing-->
                  <tr>
                     <td nowrap align="left">
                        <div class="table-normal-text">
                            <bean:message key="storage.mgmt.profile.details.table.name"/>
                        </div>
                     </td>
                     <td nowrap>
                        <div class="table-normal-text">
                        
                           <html:text name="storageProfile" property="name" size="32" disabled="<%= readOnly %>" maxlength='<%= ""  + Constants.ObjectValidation.MAX_PROFILE_NAME %>' />
                        </div>
                     </td>
                  </tr>
                  <tr>
                     <td nowrap align="left">
                        <div class="table-normal-text">
                            <bean:message key="storage.mgmt.profile.details.table.description"/>
                        </div>
                     </td>
                     <td >
                        <div class="table-normal-text">
                           <!-- TO DO: replace with correct method  and 32 with constants -->
                           <html:textarea cols="50" rows="3" name="storageProfile" property="description" disabled="<%=  readOnly %>" />
                        </div>
                     </td>
                  </tr>
                  <tr>
                     <td nowrap align="left">
                        <div class="table-normal-text">
                            <bean:message key="storage.mgmt.profile.details.table.raid"/>
                        </div>
                     </td>
                     <td nowrap>
                        <div class="table-normal-text">
                      <% if (!currentInUse && !readOnly) { %>
                            <html:select name="storageProfile" property="raidLevel" disabled="<%= currentInUse || readOnly%>" onchange="javascript:changeDiskValues(14,'2')">
                    		  <html:option key="array.raid.0" value='<%="" + Constants.RAIDLevel.RAID_0 %>'/>
                    		  <html:option key="array.raid.1" value='<%="" + Constants.RAIDLevel.RAID_1 %>'/>
                    		  <html:option key="array.raid.5" value='<%="" + Constants.RAIDLevel.RAID_5 %>'/>
                      	    </html:select>
                       <% } else { %>
                           <bean:message key='<%= "array.raid." + form.getRaidLevel()%>'/>
                       <% } %>
                        </div>
                     </td>
                  </tr>
                  <tr>
                     <td nowrap align="left">
                        <div class="table-normal-text">
                            <bean:message key="storage.mgmt.profile.details.table.segmentsize"/>
                        </div>
                     </td>
                     <td nowrap>
                        <div class="table-normal-text">
                      <% if (!currentInUse && !readOnly) { %>
                           <html:select name="storageProfile" property="segmentSize" disabled="<%= currentInUse || readOnly%>">
                    		  <html:option key="array.segmentSize.4096" value='<%="" + Constants.StorageSize._4K%>'/>
                    		  <html:option key="array.segmentSize.8192" value='<%="" + Constants.StorageSize._8K%>'/>
                    		  <html:option key="array.segmentSize.16384" value='<%="" + Constants.StorageSize._16K%>'/>
                    		  <html:option key="array.segmentSize.32768" value='<%="" + Constants.StorageSize._32K%>'/>
                    		  <html:option key="array.segmentSize.65536" value='<%="" + Constants.StorageSize._64K%>'/>
                    	  </html:select>
                       <% } else { %>
                           <bean:message key='<%= "array.segmentSize." + form.getSegmentSize()%>'/>
                       <% } %>

                        </div>
                     </td>
                  </tr>
                  <tr>
                     <td nowrap align="left">
                        <div class="table-normal-text">
                            <bean:message key="storage.mgmt.profile.details.table.readahead"/>
                        </div>
                     </td>
                     <td nowrap>
                        <div class="table-normal-text">
                      <% if (!currentInUse && !readOnly) { %>
                           <html:select name="storageProfile" property="readaheadMode" disabled="<%= currentInUse || readOnly%>">
                    		  <html:option key="array.readahead.0" value='<%="" + Constants.T4.READAHEAD_ON_INT %>'/>
                    		  <html:option key="array.readahead.1" value='<%="" + Constants.T4.READAHEAD_OFF_INT %>'/>
                    	   </html:select>
                       <% } else { %>
                           <bean:message key='<%= "array.readahead." + form.getReadaheadMode()%>'/>
                       <% } %>
                        </div>
                     </td>
                  </tr>
                  <tr>
                     <td nowrap align="left">
                        <div class="table-normal-text">
                            <bean:message key="storage.mgmt.profile.details.table.numberdrives"/>
                        </div>
                     </td>
                     <td nowrap>
                        <div class="table-normal-text">
                      <% if (!currentInUse && !readOnly) { %>
                           <html:select name="storageProfile" property="numberOfDrives" disabled="<%= currentInUse || readOnly%>">
            		       <html:option key="storage.profile.diskdrive.value.variable" value="<%= Constants.ProfileProperties.NUMBER_OF_DRIVES_VARIABLE %>"/>
            		       <html:option key="2" value="2"/>
            		       <html:option key="3" value="3"/>
            		       <html:option key="4" value="4"/>
            		       <html:option key="5" value="5"/>
            		       <html:option key="6" value="6"/>
            		       <html:option key="7" value="7"/>
            		       <html:option key="8" value="8"/>
            		       <html:option key="9" value="9"/>
            		       <html:option key="10" value="10"/>
            		       <html:option key="11" value="11"/>
            		       <html:option key="12" value="12"/>
            		       <html:option key="13" value="13"/>
            		       <html:option key="14" value="14"/>
                    	   </html:select>
                       <% } else if (form.getNumberOfDrives() == Constants.ProfileProperties.NUMBER_OF_DRIVES_VARIABLE) { %>
                           <bean:message key="storage.profile.diskdrive.value.variable" />
                       <% } else {%>
                           <%= form.getNumberOfDrives()%>
                       <% } %>
                         </div>
                     </td>
                  </tr>
                  <tr>
                     <td nowrap align="left">
                        <div class="table-normal-text">
                            <bean:message key="storage.mgmt.profile.details.table.arraytype"/>
                        </div>
                     </td>
                     <td nowrap>
                        <div class="table-normal-text">
                      <% if (!currentInUse && !readOnly) { %>
                           <html:select name="storageProfile" property="arrayType" disabled="<%= currentInUse || readOnly%>">
                    		  <html:option key="array.type.0" value='<%="" + Constants.ArrayType.IOPS %>'/>
                    		  <html:option key="array.type.1" value='<%="" + Constants.ArrayType.BANDWIDTH %>'/>
                    		  <html:option key="array.type.2" value='<%="" + Constants.ArrayType.CAPACITY %>'/>
                    		  <html:option key="array.type.3" value='<%="" + Constants.ArrayType.BM_IOPS %>'/>
                    		  <html:option key="array.type.4" value='<%="" + Constants.ArrayType.BM_BANDWIDTH %>'/>
                    		  <html:option key="array.type.5" value='<%="" + Constants.ArrayType.BM_CAPACITY %>'/>
                      	    </html:select>
                       <% } else { %>
                           <bean:message key='<%= "array.type." + form.getArrayType()%>'/>
                       <% } %>
                        </div>
                     </td>
                  </tr>
                  <tr>
                     <td nowrap align="left">
                        <div class="table-normal-text">
                            <bean:message key="storage.mgmt.profile.details.table.dedicatedhotspare"/>  
                        </div>
                     </td>
                     <td nowrap>
                        <div class="table-normal-text">
                      <% if (!currentInUse && !readOnly) { %>
                           <html:select name="storageProfile" property="dedicatedHotSpare" disabled="<%= currentInUse || readOnly%>">
                    		  <html:option key="storage.profile.dedicatedhotspare.value.0" value="0"/>
                    		  <html:option key="storage.profile.dedicatedhotspare.value.1" value="1"/>
                      	    </html:select>

                       <% } else { %>
                           <bean:message key='<%= "storage.profile.dedicatedhotspare.value." + form.getDedicatedHotSpare()%>'/>
                       <% } %>
                        </div>
                     </td>
                  </tr>
 
                 </table>
               </td>
             </tr>
           </table>
         </td>
       </tr>
     </table>
  <!-- End of Profile details table -->
</div>

<script language="javascript">
changeDiskValues(14,'2');
</script>
<% } catch (Exception e) {Trace.verbose(this, "JSP Page", e);} %>
</html:form>

</body>
</div>
</html:html> 
