<%--
  /**
   * Copyright (c) 2003 by Sun Microsystems, Inc. All rights reserved.
   * Use is subject to license terms.
   *
   * "@(#)sa_initiators.jsp    1.17    03/05/29     SMI"
   * 
   */
 --%>
<%@ include file="/layout/toptags.jsp"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.ui.business.AccessMatrixWrapper"%>
<!-- 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.access.array.selection.accessmatrix.button"/>
    </title>
</head>
<%@include file="/layout/bodytag.jsp"%>
<%@include file="/layout/top.jsp"%>
<%@include file="/layout/breadcrumb.jsp"%>
<%@include file="/layout/spacer.jsp"%>
<!-- override the selected sub item for the paging mechanism-->
<% selectedSubItem = "root.menu.item1.item0accessmatrix"; %>
<% String t4 = ((T4Interface)session.getAttribute(Constants.HttpSessionFields.CURRENT_T4)).getName(); %>
<html:form action="root.menu.item1.item0accessmatrix.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">

  <%@ include file="/layout/user_messages.jsp"%>
  
<!-- 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>
<% try { %>

  <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.access.array.selection.accessmatrix.button"/> 
              </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="8" width="1" src="images/general/dot.gif"></td>
  </tr>
</table>

<% boolean hasList = true; %>
<% List accessMatrixList = (List)session.getAttribute("AccessMatrixList");
%>
<logic:notPresent name="AccessMatrixList">         
<% hasList = false; %>
<!-- message to show if there are no initiators in the list --> 
<table bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td>
      <bean:message key="storage.access.accessmatrix.none"/>
    </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>
</logic:notPresent>
<logic:present name="AccessMatrixList">  
<table>
          <tr>
            <td><img alt border="0" src="images/general/dot.gif" width="1" height="5"></td>
          </tr>
    <%@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 colspan="4">
                          <div class="table-header-text">
                            <bean:message key="storage.access.accessmatrix.header.volume"/>
                          </div>
                        </td>     
                        <td colspan="3">
                          <div class="table-header-text">
                            <bean:message key="storage.access.accessmatrix.header.initiator"/>
                          </div>
                        </td>
			<td colspan="3">
                          <div class="table-header-text">
                            <bean:message key="storage.access.accessmatrix.header.permission"/>
                          </div>
                        </td>                            
                      </tr>
                      <tr class="header-row">
                        <td >
                          <div class="table-header-text">
                            <bean:message key="storage.access.accessmatrix.header.name"/>
                          </div>
                        </td>     
                        <td >
                          <div class="table-header-text">
                            <bean:message key="storage.access.accessmatrix.header.lun"/>
                          </div>
                        </td>     
                        <td >
                          <div class="table-header-text">
                            <bean:message key="storage.access.accessmatrix.header.group"/>
                          </div>
                        </td>     
			<!-- spacer cell -->
			    <td nowrap>
			       <img src="images/general/dot.gif" border="0" width="25" height="1"/>
			    </td>
                        <td >
                          <div class="table-header-text">
                            <bean:message key="storage.access.accessmatrix.header.wwn"/>
                          </div>
                        </td>     
                        <td >
                          <div class="table-header-text">
                            <bean:message key="storage.access.accessmatrix.header.igroup"/>
                          </div>
                        </td>     
			<!-- spacer cell -->
			    <td nowrap>
			       <img src="images/general/dot.gif" border="0" width="25" height="1"/>
			    </td>
                        <td >
                          <div class="table-header-text">
                            <bean:message key="storage.access.accessmatrix.header.defperm"/>
                          </div>
                        </td>     
                        <td >
                          <div class="table-header-text">
                            <bean:message key="storage.access.accessmatrix.header.grpperm"/>
                          </div>
                        </td>     
                        <td >
                          <div class="table-header-text">
                            <bean:message key="storage.access.accessmatrix.header.efperm"/>
                          </div>
                        </td>     
                      </tr>
                      <!-- Begin Initiator row listing -->           
                      <logic:present name="AccessMatrixList">         
                        <%@include file="/layout/listingCalc.jsp"%>
 				 	    <logic:iterate id="aml" name="AccessMatrixList" type="AccessMatrixWrapper" indexId="index" offset='<%=offsetStr%>' length='<%=lengthStr%>'>

                          <tr>
                            <td align="left">   
                             <div class="table-normal-text">   
			         <a href="root.menu.item0.item4edit.do?name=<%=URLEncoder.encode(aml.getVolumeName())%>&t4Name=<%=URLEncoder.encode(t4)%>">
                                <bean:write name="aml" property="volumeName"/>
				</a>
                             </div>
                            </td>  
                            <td align="right">                                                     
                              <div class="table-normal-text">   
                                   <bean:write name="aml" property="lunNumber"/>
                              </div>
                            </td>                                                                           
                            <td align="left">                                                     
                              <div class="table-normal-text">   
			          <% if (aml.getVolGroupName() != null && aml.getVolGroupName().trim().length() > 0) { %>
				   <a href="root.menu.item1.item0edit.do?name=<%=URLEncoder.encode(aml.getVolGroupName())%>&t4Name=<%=URLEncoder.encode(t4)%>">
                                   <bean:write name="aml" property="volGroupName"/>
				   </a>
				   <% } else { %>
				    -
				   <% } %>
                              </div>
                            </td>
			    <!-- spacer cell -->
			    <td nowrap>
			       <img src="images/general/dot.gif" border="0" width="25" height="1"/>
			    </td>
                            <td align="left">                                                     
                              <div class="table-normal-text">   
			      <% String iniWWN = aml.getIniWWN();
			         if(iniWWN != null && iniWWN.equals("default")) {
				 %>
				   <bean:message key="storage.access.initiator.default"/>
				   <% } else { %>
				   <a href="root.menu.item1.item0iniedit.do?name=<%=URLEncoder.encode(iniWWN)%>&t4Name=<%=URLEncoder.encode(t4)%>">
                                   <bean:write name="aml" property="iniWWN"/>
				   </a>
				   <% } %>
                              </div>
                            </td>                                                                           
                            <td align="left">                                                     
                              <div class="table-normal-text">   
			      		<%if(aml.getIniGroupName() != null) { %>
				   <a href="root.menu.item1.item0editig.do?name=<%=URLEncoder.encode(aml.getIniGroupName())%>&t4Name=<%=URLEncoder.encode(t4)%>">
                                   <bean:write name="aml" property="iniGroupName"/>
				   </a>
				   <% } else {%>
				   	-
				   <% } %>
                              </div>
                            </td>                                                                           
			    <!-- spacer cell -->
			    <td>
			       <img src="images/general/dot.gif" border="0" width="25" height="1"/>
			    </td>
                            <td align="left">                                                     
                              <div class="table-normal-text">   
			           <bean:message key="<%="storage.access.accessmatrix.perm" + aml.getVolumeDefPerm()%>" />
                              </div>
                            </td>                                                                           
                            <td align="left">                                                     
                              <div class="table-normal-text">   
			           <bean:message key="<%="storage.access.accessmatrix.perm" + aml.getGroupPermission()%>" />
                              </div>
                            </td>                                                                           
                            <td align="left">                                                     
                              <div class="table-normal-text">   
			           <bean:message key="<%="storage.access.accessmatrix.perm" + aml.getEffectivePermission()%>" />
				   <!--
                                   <bean:write name="aml" property="effectivePermission"/>
				   -->
                              </div>
                            </td>                                                                           
                         </tr>
                        </logic:iterate>
                      </logic:present>                                                         
                    </table>
                  </td>
                </tr>
              </table>
            </td>
          </tr>
          <%@include file="/layout/prevnext.jsp"%>
        </table>
 </logic:present>                                                         
      
</div>
<% } catch (Exception e) {
	e.printStackTrace();
} %>

</html:form>

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