<%@ page import="com.novell.emframe.dev.*,
                 com.novell.admin.ns.nds.NDSNamespace,
                 com.novell.application.console.snapin.ObjectEntry,
                 com.novell.admin.common.exceptions.SPIException"%>
<%@  page pageEncoding="utf-8" contentType="text/html;charset=utf-8" %>
<%@ taglib uri="/WEB-INF/iman.tld" prefix="iman" %>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/x.tld" prefix="x" %>
<iman:stringtable bundle="DevResources" />
<iman:stringtable bundle="FwResources" />


<%
   MContext taskContext = eMFrameFactory.getMContext(request);
   boolean isContainer = false;
   try
   {
      String targetPack = request.getParameter("eDir$target");
      String[] targets = eMFrameUtils.unpack(targetPack, taskContext);
      ObjectEntry treeOE = (ObjectEntry) taskContext.getAuthenticationBroker().getAPIObject("NDSNamespace");
      NDSNamespace ns = (NDSNamespace) treeOE.getNamespace();
      ObjectEntry objectEntry = ns.getObjectEntry(targets[0]);
      isContainer = objectEntry.getObjectType().isContainer();
   }
   catch(Throwable e)
   {
      D.log(e);
   }
%>

<SCRIPT>
   var editingIndex = -1;
   var isTargetContainer = <%= isContainer %>;
</SCRIPT>
<SCRIPT src="<%= session.getAttribute("ModulesPath") %>/fw/javascripts/ACLEditorScripts.js"></SCRIPT>


<TABLE cellpadding="0" cellspacing="0">
   <TR>
      <TD>
         <SELECT name="ACL_Editor" id="ACL_Editor" size=10 style="WIDTH: 350px; height:175px;">
         <x:forEach select="$ACLEditor_xmlNodeSet/value">
            <c:set var="priv"><x:out select="./privileges"/></c:set>
            <c:set var="attr"><x:out select="./protected-attr-name"/></c:set>
            <c:set var="subj"><x:out select="./subject"/></c:set>

            <%
               String priv = (String)pageContext.findAttribute("priv");
               String attr = (String)pageContext.findAttribute("attr");
               String subj = (String)pageContext.findAttribute("subj");
               String pack = eMFrameUtils.pack(new String[]{priv, attr, subj}, taskContext);
            %>

            <OPTION value="<%= pack %>"><x:out select="./subject"/> - <x:out select="./protected-attr-name"/> - <x:out select="./privileges"/>
         </x:forEach>
         </SELECT>
      </TD>

      <TD valign="top"><A href="javascript:addAclItem()"><IMG alt="<iman:string key="Widgets.addItem"/>" src="<%= session.getAttribute("ModulesPath") %>/dev/images/iconadd.gif" border="0"></a><iman:spacer/></TD>
      <TD valign="top"><A href="javascript:deleteAclItem()"><IMG alt="<iman:string key="Widgets.removeItem"/>" src="<%= session.getAttribute("ModulesPath") %>/dev/images/iconremove.gif" border="0"></A><iman:spacer/></TD>
      <TD valign="top"><A href="javascript:editAclItem()"><IMG alt="<iman:string key="Widgets.editItem"/>" src="<%= session.getAttribute("ModulesPath") %>/dev/images/iconedit.gif" border="0"></A><iman:spacer/></TD>
   </TR>
</TABLE>


