<%--
  /**
   * Copyright (c) 2003 by Sun Microsystems, Inc. All rights reserved.
   * Use is subject to license terms.
   *
   * "@(#)admin_general.jsp    1.32    03/09/25     SMI"
   * 
   */
 --%>
<%@ include file="/layout/toptags.jsp"%>
<!-- locale stuff -->
<html locale="true">
<!-- end locale -->

<!-- Place Java Script Here -->

<!--  -->
<head>
<%@include file="/layout/page_head_section.jsp"%>
	<title>
		<bean:message  key="admin.general.title"/>
	</title>
</head>

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

<html:form action="/root.menu.item3.item0.do">

<jsp:include page="/layout/section_header.jsp" flush="true">
	<jsp:param name="sectionname" value="admin.general.subtitle" />
</jsp:include>
<% int status = ((Integer)session.getAttribute("POWER_STATUS")).intValue();%>
<% boolean partialShutdownAvail = ((Boolean)session.getAttribute("PARTIAL_SHUTDOWN_AVAIL")).booleanValue(); %>
<!-- hidden element which specifies the action for this form -->
<input type="hidden" name="action" value="<%=request.getAttribute("action")%>">
<input type="hidden" name="contactEmail" value="" />
<% try { %>
<div class="content-layout">
<!-- Button row -->
<table border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td nowrap>
      	<table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="left">
              <table border="0" cellpadding="0" cellspacing="0">
                <tr>
				  <td>
				  	<img width="10" height="1" border="0" src="images/general/dot.gif">
				  </td>

                  <!-- if status is FULL_POWER -->
		  		<%if(status == Constants.ComputerSystemProperties.FULL_POWER) {%>
                        <td>
				            <component:button 
                                text="button.partialshutdown" 
                                href="javascript:submitForm('confirmpartialshutdown')" 
                                title="admin.general.partialshutdown" 
                                isEnabled='<%=!readOnly && partialShutdownAvail%>' />
				        </td>
				        <td><img width="10" height="1" border="0" src="images/general/dot.gif"> </td>
				        <td>
				            <component:button 
                                text="button.fullshutdown" 
                                href="javascript:submitForm('confirmfullshutdown')" 
                                title="admin.general.fullshutdown" 
                                isEnabled="<%=!readOnly%>" />
				        </td>
                  <% } %>

                  <!-- if status is POWER_SAVE_LOW_POWER -->
		  	<% if(status == Constants.ComputerSystemProperties.POWER_SAVE_LOW_POWER) { %>
                        <td> 
                            <component:button 
                                text="button.reboot" 
                                href="javascript:submitForm('reboot')" 
                                title="button.reboot" 
                                isEnabled='<%=!readOnly && partialShutdownAvail%>' />
                        </td>
                        <td><img width="10" height="1" border="0" src="images/general/dot.gif"></td>
                        <td>
				            <component:button 
                                text="button.fullshutdown" 
                                href="javascript:submitForm('confirmfullshutdown')" 
                                title="admin.general.fullshutdown" 
                                isEnabled="<%=!readOnly%>" />
                        </td>
                  <% } %>

                  <!-- if status is FULL_SHUTDOWN -->
		  	<% if(status == Constants.ComputerSystemProperties.FULL_SHUTDOWN) { %>
                        <td> 
                            <component:button 
                                text="button.reboot" 
                                href="javascript:submitForm('reboot')" 
                                title="button.reboot" 
                                isEnabled='<%=!readOnly && partialShutdownAvail%>' />
                        </td>
                        <td><img width="10" height="1" border="0" src="images/general/dot.gif"></td>
                        <td>
				            <component:button 
                                text="button.fullshutdown" 
                                href="javascript:submitForm('confirmfullshutdown')" 
                                title="admin.general.fullshutdown" 
                                isEnabled="<%=false%>" />
                        </td>
                  <% } %>

                  <!-- if status is POWER_SERVICE_ERROR -->
		  	<% if(status == Constants.ComputerSystemProperties.POWER_SERVICE_ERROR) { %>
                        <td> 
                            <component:button 
                                text="button.reboot" 
                                href="javascript:submitForm('reboot')" 
                                title="button.reboot" 
                                isEnabled="<%=false%>" />
                        </td>
                        <td><img width="10" height="1" border="0" src="images/general/dot.gif"></td>
                        <td>
				            <component:button 
                                text="button.fullshutdown" 
                                href="javascript:submitForm('confirmfullshutdown')" 
                                title="admin.general.fullshutdown" 
                                isEnabled="<%=false%>" />
                        </td>
                  <% } %>

                  
				</tr>
		      </table>
		    </td>
		  </tr>
		</table>  
      </td>
    </tr>
  </table>
<!-- end button row -->

<!-- start system info section -->
  <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td colspan="2"><img alt border="0" height="20" src="/images/general/dot.gif" width="1"></td>

    </tr>
    <tr>
      <td colspan="2">
        <table border="0" cellpadding="0" cellspacing="0" width="100%">
          <tr>
            <td nowrap>
              <span class="major-category-text">
                <bean:message key="admin.general.system" />
              </span>
            </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>
		  
	  <!-- Save and Cancel button table. -->
	  <tr>
	    <td aligin="left" colspan="2">
	      <table border="0" cellpadding="0" cellspacing="0">
                <tr>
            	  <td>
             	    <img width="10" height="5" border="0" src="images/general/dot.gif">
            	  </td>          		          
        	</tr>
          	<tr>
                  <td>
                    <img width="10" height="1" border="0" src="images/general/dot.gif">
                  </td>          		
            	  <td>
                    <component:button text="button.save" href="javascript:submitForm('save')" title="admin.general.savesettings" isEnabled="<%=!readOnly%>" />
                  </td>
                  <td>
                    <img width="10" height="1" border="0" src="images/general/dot.gif">
                  </td>
                  <td>
                    <component:button text="button.cancel" href="javascript:submitForm('show')" title="admin.general.cancelsettings" isEnabled="<%=!readOnly%>" />
                  </td>
                </tr>		       
	      </table>
	    </td>
	  </tr>
		  
        </table>
      </td>
    </tr>
    <tr>
      <td colspan="2"><img alt border="0" height="10" src="/images/general/dot.gif" width="1"></td>
    </tr>
    <tr>
      <td nowrap>
        <table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td nowrap>
              <table class="back-table" border="0" cellspacing="0" cellpadding="1" width="50%">
                <tr>
                  <td>
                    <table class="front-table" border="0" cellspacing="0" cellpadding="0" width="100%">
                      <tr class="header-row">

                        <td>
                          <div class="table-header-text">
                            <bean:message key="detail.property" />
                          </div>
                        </td>
                        <td>
                          <div class="table-header-text">
                            <bean:message key="detail.value" />
                          </div>
                        </td>

                      </tr>
                      <tr>
                        <td align="left" nowrap>
                          <div class="table-label-text">
                            <bean:message key="admin.general.maseratiid" />
                          </div>
                        </td>
                        <td align="left" nowrap>
                          <div class="table-label-text">
			  <input type="hidden" name="maseratiId" value="<bean:write name="AdminGeneral" property="maseratiId"/>"/>
			   <bean:write name="AdminGeneral" property="maseratiId"/>
                          </div>
                        </td>
                      </tr>
                      <tr>
                        <td align="left" nowrap>
                          <div class="table-normal-text">
                            <bean:message key="admin.general.description" />
                          </div>

                        </td>
                        <td align="left" nowrap>
                          <div class="table-label-text">
                            <html:text property="description" size="60" disabled="<%=readOnly%>"/>
                          </div>
                        </td>
                      </tr>
                      <tr>
                        <td align="left" nowrap>

                          <div class="table-normal-text">
                            <bean:message key="admin.general.vendor" />
                          </div>
                        </td>
                        <td align="left" nowrap>
                          <div class="table-label-text">
                            <bean:write name="AdminGeneral" property="vendor" />
                          </div>
                        </td>
                      </tr>

                      <tr>
                        <td align="left" nowrap>
                          <div class="table-normal-text">
                            <bean:message key="admin.general.model" />
                          </div>
                        </td>
                        <td align="left" nowrap>
                          <div class="table-label-text">
                             <bean:write name="AdminGeneral" property="model" />
                          </div>

                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
        </table>

      </td>
      
    </tr>
  </table>
</div>
<!-- end system info section -->

<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 class="content-layout">
<!-- begin individual array power management section -->
  <%
    com.sun.netstorage.array.mgmt.cfg.ui.forms.AdminGeneralForm form = 
     (com.sun.netstorage.array.mgmt.cfg.ui.forms.AdminGeneralForm)request.getAttribute("AdminGeneral");
    boolean someOK = true;
    if(form != null) {
       if(form.getAllArraysUnhealthy()) {
            someOK = false;
       }
    }
    Trace.verbose(this, "admin_general.jsp", "someOK = " + someOK);
 
    boolean hasList = true;
    List t4List = (List)session.getAttribute("T4List");    
    if(t4List == null || t4List.size() == 0) {    	      
    	hasList = false;
  %>
        <!-- show warning msg if there are no arrays -->
   <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>
  <% } else {
        Trace.verbose(this, "admin_general.jsp", 
                        "there are " + t4List.size() + " arrays to show");
     } // endif %>
<!-- 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>

<!-- individual array section title and helptext -->
  <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="admin.general.individualarray.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>
            <bean:message key="admin.general.individualarray.helptext"/>
        </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="5" width="1" src="images/general/dot.gif"></td>
  </tr>
</table>

<!-- individual array button row -->
  <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="admin.general.individualarray.shutdown" 
                                            href="javascript:submitForm('arrayshutdownconfirm')" 
                                            title="admin.general.individualarray.shutdown"
                                            isEnabled="<%=hasList && someOK && !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>         
                                <component:button text="admin.general.individualarray.reset" 
                                            href="javascript:submitForm('arrayresetconfirm')" 
                                            title="admin.general.individualarray.reset"
                                            isEnabled="<%=hasList && someOK && !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>         
                                <component:button text="admin.general.individualarray.resetlabels" 
                                            href="javascript:submitForm('arrayresetlabelsconfirm')" 
                                            title="admin.general.individualarray.resetlabels"
                                            isEnabled="<%=hasList && someOK && !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>         
                              <component:button text="admin.general.refresh.button" 
                              			href="javascript:document.forms[0].action='root.menu.item3.item0.do';document.forms[0].submit();" 
                                        title="admin.general.refresh.button"
                                        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>
 
 <!-- individual array selection table -->
 <% if(hasList) { %>
      <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 align="center" valign="middle" nowrap>
                            <a href="javascript:checkAll(document.forms[0])">
                            <img src="images/icons/select-all-small.gif" 
                                    alt="Select all table rows" 
                                    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="Deselect all table rows" 
                                    vspace="2" border="0" width="11" height="13"></a>
                        </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>   
                        <td>
                          <div class="table-header-text">
                            <bean:message key="array.firmware-version.label"/>
                          </div>
                        </td> 
                        <td>
                          <div class="table-header-text">
                            <bean:message key="main.menu.t4.summary.health"/>
                          </div>
                        </td>                      

                      </tr>                                           
                                 
                      <!-- Begin T4 row listing -->           
                      <%
                        String okHealth = Integer.toString(Constants.T4.HEALTH_OK_CODE);
                        List healthList = (List)session.getAttribute(
                                            Constants.HttpSessionFields.HEALTH_STATUS_LIST);
                        Trace.verbose(this, "admin_general.jsp", "Go into loop on arrays");
                        for (int index = 0; index < t4List.size(); index++) {
                            try {
                                Trace.verbose(this, "admin_general.jsp", "get array " + index);
                                T4Interface t4 = (T4Interface) t4List.get(index);
                                boolean isBad = 
                                            (okHealth.equals("" + healthList.get(index)) ? 
                                                    false : true);
                       %>

                          <tr>
                            <td align="center">
                              <div class="table-normal-text">
                                <% if(isBad) { %>
                                  &nbsp;
                                <% } else { %>
                                <input <% if(readOnly || isBad) {%>disabled <% } %> 
                                            type="checkbox" name="id" value="<%=index%>">
                                <% } %>
                              </div>
                            </td>
                            <td>     
                              <div class="table-label-text">                    
                                <% if (isBad) { %>
                                    <%=t4.getName()%>
                                <% } else { %>
                                    <%String url = 
                                        "root.menu.item3.item0.arraydetails.do?arrayIndex="+index; %>
                                    <html:link href="<%=url%>"><%=t4.getName()%></html:link>
                                <% } // endif %>
                              </div>
                            </td> 
                            <td>              
                              <div class="table-label-text">                 
                                <%=(t4.getDescription() == null ? "&nbsp;" : t4.getDescription())%> 
                              </div>
                            </td> 
                            <td align="right">
                              <div class="table-label-text">                    
                                <%=t4.getFirmwareVersion()%>
                               </div>
                            </td>								
                            <td>              
                              <div class="table-label-text">                 
                               <% try { 
                               %>
                                  <bean:message 
                                    key='<%="array.health.code." + healthList.get(index)%>' />
                               <% }catch(Exception e) { %>
                                  <bean:message key="array.health.code.x"/>
                               <% } %>
                              </div>
                            </td>                                                
                         </tr>
                    <%
                        } catch (Throwable x) {
              	            Trace.verbose(this, "admin_general.jsp", "Exception in page!");
              	            Trace.verbose(this, "admin_general.jsp", x);
                        }
                    }
                    Trace.verbose(this, "admin_general.jsp", "Done looping thru arrays");
                    %> 
                    </table>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
        </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>

<!-- end individual array power management section -->

<% } catch (Throwable t) {Trace.verbose(this, "admin general jsp exception", t);} %>
</html:form>
</body>

</html>
