<%@ page import="com.novell.emframe.dev.*"%>
<%@  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"/>
<iman:stringtable bundle="BaseResources"/>


<HTML>
<HEAD>
   <TITLE><iman:string key="ProductName"/></TITLE>
   <iman:stylesheet/>
   <iman:eMFrameScripts/>
   <iman:osScripts/>

   <SCRIPT>
      var returnMethodName = "<c:out value="${param.returnMethodName}"/>";
      var startingPriv = 0;
   </SCRIPT>
   <SCRIPT src="<%= session.getAttribute("ModulesPath") %>/fw/javascripts/ACLEditorPopupScripts.js"></SCRIPT>
</HEAD>


<c:if test="${param.priv != null}">
  <c:if test="${param.attr != null}">
 	<BODY onLoad="onInit(<c:out value="${param.priv}"/>, '<iman:toScript><c:out value="${param.attr}"/></iman:toScript>' );">
  </c:if>
</c:if>
<FORM name="form" method=post action="webacc">

   <iman:taskHeader titleKey="AclEditorTitle" titleBundle="FwResources"/><BR>

   <SPAN class="mediumtext"><iman:string key="AclSubjectNameLabel"/></SPAN><BR>
   <INPUT type="text" name="subjectName" value="<c:out value="${param.subj}"/>" style="width: <iman:string key="UI.textboxPixel"/>"><iman:os typeFilter="*" control="subjectName"/><BR><BR>

   <SPAN class="mediumtext"><iman:string key="eDirRights.PropertyNameHeading"/>:</SPAN><BR>
   <SELECT name="protectedAttributeName" size=10 style="WIDTH: 250px; height:175px;" onChange="showPrivilages()">

      <%
         MContext context = eMFrameFactory.getMContext(request);
         String attributeName = request.getParameter("attr");
      %>

      <% if(attributeName!=null && attributeName.equals("[All Attributes Rights]")) {%>
         <OPTION value="[All Attributes Rights]" selected>[All Attributes Rights]
      <% }else{ %>
         <OPTION value="[All Attributes Rights]">[All Attributes Rights]
      <% } %>

      <% if(attributeName!=null && attributeName.equals("[Entry Rights]")) {%>
         <OPTION value="[Entry Rights]" selected>[Entry Rights]
      <% }else{ %>
         <OPTION value="[Entry Rights]">[Entry Rights]
      <% } %>



         <%
            String[] attrs = context.getDirUtils().getSortedAttrs();

            for(int i=0; i<attrs.length; i++)
            {
               boolean selected = attributeName!=null && attrs[i].equals(attributeName);
               if(selected)
               {
                  out.println("<OPTION value=\""+ eMFrameUtils.toDisplay(attrs[i]) +"\" selected>"+attrs[i]+"");
               }
               else
               {
                  out.println("<OPTION value=\""+ eMFrameUtils.toDisplay(attrs[i]) +"\">"+attrs[i]+"");
               }
            }
         %>
   </SELECT><BR><BR>

   <SPAN class="mediumtext"><iman:string key="eDirRights.AssignedRightsHeading"/>:</SPAN><BR>
   <DIV id="privilagesDiv" class="mediumtext">
   </DIV>
   <BR>


   <iman:bar/>
   <iman:button key="OK" onClick="onOk()"/>
   <iman:button key="Cancel" onClick="window.close()" />

</FORM>
<iman:osFooter/>
</BODY>
</HTML>
