<%@ page import="com.novell.emframe.dev.*,
                 com.novell.admin.ns.nds.*,
                 com.novell.admin.ns.*,
                 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().getProtocolObject(AuthenticationBroker.PROTOCOL_ADMINNAMESPACE);
      AdminNamespace ns = treeOE.getAdminNamespace(); 
      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/KeplerACLEditorScripts.js"></SCRIPT>


<TABLE cellpadding="0" cellspacing="0">
   <TR>
      <TD>
         <SELECT name="ACL_Editor" id="ACL_Editor" size=3 style="WIDTH: 500px; height:125px;">
         <x:forEach select="$ACLEditor_xmlNodeSet/value">
            <c:set var="priv"><x:out select="./nvds-privileges"/></c:set>
            <c:set var="attr"><x:out select="./nvds-attributename"/></c:set>
            <c:set var="subj"><x:out select="./nvds-trustee"/></c:set>
            <c:set var="scope"><x:out select="./nvds-scope"/></c:set>
            <c:set var="modifier"><x:out select="./nvds-modifier"/></c:set>
            <c:set var="classname"><x:out select="./nvds-classname"/></c:set>
            <c:set var="filter"><x:out select="./nvds-filter"/></c:set>

            <%
               String priv = (String)pageContext.findAttribute("priv");
               String attr = (String)pageContext.findAttribute("attr");
               String subj = (String)pageContext.findAttribute("subj");
               String scope = (String)pageContext.findAttribute("scope");
               String modifier = (String)pageContext.findAttribute("modifier");
               String classname = (String)pageContext.findAttribute("classname");
               String filter = (String)pageContext.findAttribute("filter");
               String pack = eMFrameUtils.pack(new String[]{priv, attr, subj, scope, modifier, classname, filter}, taskContext);
            %>
            <OPTION value="<%= pack %>"><x:out select="./nvds-filter"/> - <x:out select="./nvds-classname"/> - <x:out select="./nvds-modifier"/> - <x:out select="./nvds-scope"/> - <x:out select="./nvds-trustee"/> - <x:out select="./nvds-attributename"/> - <x:out select="./nvds-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>


