<%--
  /**
   * Copyright (c) 2003 by Sun Microsystems, Inc. All rights reserved.
   * Use is subject to license terms.
   *
   * "@(#)sa_array_selection.jsp    1.23    03/08/07     SMI"
   * 
   */
 --%>
<%@ include file="/layout/toptags.jsp"%>

<!-- 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="main.menu.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.item1.item0.do">

<!-- hidden element which specifies the action for this form -->
<input type="hidden" name="request_action" value="<%=request.getAttribute("request_action")%>">

<div class="content-layout">

  <% boolean allOk = true; %>
  <logic:equal name="System" property="allUnhealthy" value="true">
   <% allOk = false; %>
   <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td>
       <table>
         <tr><td>
                <img src="/nsm/images/general/dot.gif" width="1" height="10" border="0">
         </td></tr>
         <tr><td>
           <table border="0" cellspacing="0" cellpadding="2" align="left" bgcolor="#9999CC">
             
             <tr><td>
               <table cellspacing="0" cellpadding="5" border="0"  bgcolor="#FFFFFF">
                 <tr>
                  <td valign="top"><img src="images/icons/warning_16.gif" width="16" height="16" alt='<bean:message key="icon.warning"/>' border="0"></td>
                  <td><div class="error-message-header-text">                                   
                     <b><bean:message key="storage.mgmt.system.allunhealthyarrays"/></b></div>
                </tr>
              </table>
             </td></tr>
           </table>
         </td></tr>
         <tr><td>
            <img src="/nsm/images/general/dot.gif" width="1" height="10" border="0">
         </td></tr>
       </table>
     </td>
   </tr>
  </table>
 </logic:equal>
  <%
    
    boolean hasList = true;
    List t4List = (List)session.getAttribute("T4List");    
    if(t4List == null || t4List.size() == 0) {    	      
    	hasList = false;
  %>
   <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td>
       <table>
         <tr><td>
                <img src="/nsm/images/general/dot.gif" width="1" height="10" border="0">
         </td></tr>
         <tr><td>
           <table border="0" cellspacing="0" cellpadding="2" align="left" bgcolor="#9999CC">
             
             <tr><td>
               <table cellspacing="0" cellpadding="5" border="0"  bgcolor="#FFFFFF">
                 <tr>
                  <td valign="top"><img src="images/icons/warning_16.gif" width="16" height="16" alt="Warning" border="0"></td>
                  <td><div class="error-message-header-text">                                   
                     <b><bean:message key="storage.mgmt.system.noarrays"/></b></div>
                </tr>
              </table>
             </td></tr>
           </table>
         </td></tr>
         <tr><td>
            <img src="/nsm/images/general/dot.gif" width="1" height="10" border="0">
         </td></tr>
       </table>
     </td>
   </tr>
  </table>
  <% } %>
<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:write name="System" property="productName"/>             
              </div>
            </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="8" 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="8" width="1" src="images/general/dot.gif"></td>
  </tr>
</table>


  <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="main.menu.t4.section.title"/> 
              </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><img alt border="0" height="5" src="/images/general/dot.gif" width="1"></td>
    </tr>
     <tr>
                        <td>
                           <bean:message key="storage.access.array.selection.instructions"/>
                        </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="8" 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 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="storage.access.array.selection.volgrps.button" href="javascript:document.forms[0].action='root.menu.item1.item0volgrps.do';document.forms[0].submit();" title="storage.access.array.selection.volgrps.button" isEnabled="<%=hasList && allOk%>" />
                              </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="storage.access.array.selection.inigrps.button" href="javascript:document.forms[0].action='root.menu.item1.item0inigrps.do';document.forms[0].submit();" title="storage.access.array.selection.inigrps.button" isEnabled="<%=hasList && allOk%>" />                                 
                              </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="storage.access.array.selection.initiators.button" href="javascript:document.forms[0].action='root.menu.item1.item0ini.do';document.forms[0].submit();" title="storage.access.array.selection.initiators.button" isEnabled="<%=hasList && allOk%>" />
                              </td>
                            </tr>
                          </table>
                        </td>
                      </tr>
                    </table>
                  </td>
                  <td width="10"><img alt width="10" height="1" border="0" src="images/general/dot.gif"></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="storage.access.array.selection.accessmatrix.button" href="javascript:document.forms[0].action='root.menu.item1.item0accessmatrix.do';document.forms[0].submit();" title="storage.access.array.selection.accessmatrix.button" isEnabled="<%=hasList && allOk%>" />
                              </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>
      </td>
    </tr>
  </table>
 
 <% if(hasList) { %>
      <table>      
          <%@include file="/layout/prevnext.jsp"%>   
          <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> </td>
                        
                        <td>
                          <div class="table-header-text">
                            <bean:message key="main.menu.t4.summary.name"/>
                          </div>
                        </td>                        
                        
                        <td>
                          <div class="table-header-text">
                            <bean:message key="main.menu.t4.summary.description"/>
                          </div>
                        </td>   
                        <!-- only show this button for mr1 or mr2-->
                        <%
                           com.sun.netstorage.array.mgmt.cfg.ui.forms.OverallSystemForm form = 
                             (com.sun.netstorage.array.mgmt.cfg.ui.forms.OverallSystemForm)
                                session.getAttribute("System");
                           switch(form.getConfigType()) {
                             case MaseratiConfig.MIDRANGE1_INT:
                             case MaseratiConfig.MIDRANGE2_INT:
                        %>
                           <td>
                             <div class="table-header-text">
                               <bean:message key="main.menu.t4.summary.password.required"/>
                             </div>
                           </td>                      
			<% } // end switch %>
                        <td>
                          <div class="table-header-text">
                            <bean:message key="main.menu.t4.summary.health"/>
                          </div>
                        </td>                      

                      </tr>                                           
                      <%
                        // determine which T4 to select in the list
                        String selection = request.getParameter(Constants.HttpRequestFields.SELECTED_INDEX_PARAM);                        
                        if(selection == null) {
                        	T4Interface current = (T4Interface)session.getAttribute(Constants.HttpSessionFields.CURRENT_T4);
                        	if (current != null) {
                        	    com.sun.netstorage.array.mgmt.cfg.ui.business.T4s t4BusObj = new com.sun.netstorage.array.mgmt.cfg.ui.business.T4s();
                        	    try {
                        	        selection = Integer.toString(t4BusObj.indexFromName(current.getName(), (List)session.getAttribute(Constants.HttpRequestFields.T4_LIST_PARAM)));
                        	    }
                        	    catch(Exception e) {                        	    	
                        	    	selection = "0";
                        	    }
                        	}
                        	else {
	                        	selection = "0";
                        	}
                        } 
                      %>                                      
                      <!-- Begin T4 row listing -->           
                      <logic:present name="T4List">         
                         <% String okHealth = 
                              Integer.toString(Constants.T4.HEALTH_OK_CODE);
                            List healthList = 
                              (List)session.getAttribute(
                                Constants.HttpSessionFields.HEALTH_STATUS_LIST);
                         %>
                        <%@include file="/layout/listingCalc.jsp"%>
 				 	    <logic:iterate id="t4" name="T4List" type="T4Interface" indexId="index" offset='<%=offsetStr%>' length='<%=lengthStr%>'>

                          <tr>
                            <td align="center">
                             <logic:notEqual name="t4" property="healthStatus" value="<%=okHealth%>">
                                 &nbsp;
                             </logic:notEqual>
                             <logic:equal name="t4" property="healthStatus" value="<%=okHealth%>">

                                <logic:equal name="index" value="<%=selection%>">                     
                                   <input checked type="radio" name="index" value="<%=index%>">
                                </logic:equal>
                                <logic:notEqual name="index" value="<%=selection%>">                                                     
                                   <input type="radio" name="index" value="<%=index%>">
                                </logic:notEqual>
                             </logic:equal>
                            </td>   
                            <td>     
                              <div class="table-label-text">                    
                                <bean:write name="t4" property="name"/>
                              </div>
                            </td> 
                            <td>              
                              <div class="table-label-text">                 
                               <logic:present name="t4" property="description">
                                  <bean:write name="t4" property="description"/>
                               </logic:present>
                               <logic:notPresent name="t4" property="description">
                                  &nbsp;
                               </logic:notPresent>
                              </div>
                            </td> 
                           <%
                               switch(form.getConfigType()) {
                                 case MaseratiConfig.MIDRANGE1_INT:
                                 case MaseratiConfig.MIDRANGE2_INT:
                           %>
                                <td align="center">
                                  <div class="table-label-text">
				  
                                    <% if(!Constants.UserAccount.GUEST_ACCOUNT.equals(aui.role)) { 
				    try { 
                                         int connectivity = 0;
                                         Integer healthIntObj = 
                                           (Integer)healthList.get(index.intValue());
                                         // only show the connectivity status if the t4 health is ok
                                         //  otherwise show unknown (0).
                                         if(healthIntObj.intValue() == Constants.T4.HEALTH_OK_CODE) {
                                           connectivity = t4.getConnectivity();
                                         }
                                    %>
                                      <bean:message key='<%="array.password.required." + connectivity%>' />
                                    <% }catch(Exception e) { %>
                                      <bean:message key="array.health.code.0"/>
                                    <% } 
				    } else {%>
                                      <bean:message key="array.password.required.0"/>
				    <% } %>
                                  </div>
                                </td>                      
                         <% } // end switch %>
                            <td align="center">              
                              <div class="table-label-text">                 
                               <% try { 
                               %>
                                  <bean:message key='<%="array.health.code." + healthList.get(index.intValue())%>' />
                               <% }catch(Exception e) { %>
                                  <bean:message key="array.health.code.x"/>
                               <% } %>
                              </div>
                            </td>                                                
                         </tr>
                        </logic:iterate>
                      </logic:present>
                    </table>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
          <%@include file="/layout/prevnext.jsp"%>
        </table>
<% } // end if(hasList) 
%>      
</div>

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

</html:form>
</body>
</html:html>
