<%@  page pageEncoding="utf-8" contentType="text/html;charset=utf-8" import="com.novell.webaccess.common.JSPConduit, com.novell.emframe.dev.eMFrameUtils" %>
<%   JSPConduit c = JSPConduit.getJSPConduit(request);
   c.stringTable("DevResources");
   c.stringTable("BaseResources");
   c.stringTable("FwResources"); %>
<HTML><HEAD><TITLE></TITLE>
<LINK rel='stylesheet' href='<%= c.getModulesUrl() + "/dev/css/hf_style.css" %>'>
<jsp:include page='<%= c.getPath("dev/eMFrameScripts_inc.jsp") %>' flush="true" />
<jsp:include page='<%= c.getPath("dev/OSScripts_inc.jsp") %>' flush="true" />
<SCRIPT language="JavaScript">


function showPropertyEffectiveRights()
{
	var index 	= document.ViewEffectiveRightsForm.elements["Property List"].selectedIndex;
	var value	= document.ViewEffectiveRightsForm.elements["Property List"].options[index].value;
	var name 	= document.ViewEffectiveRightsForm.elements["Property List"].options[index].text;
	var valueArray = value.split(":");
	var size=0;
	for(var l=0;l < valueArray.length;l++)
	{
		if(valueArray[l] == "true")
		{
			size++;
		}
	}
	var rights = new Array(size);
	var i = 0;
	if(name == "[Entry Rights]")
	{
		if(valueArray[0] == "true")
		{
			rights[i] = "<%= c.string("eDirRights.Supervisor") %>";
			i++;
		}
		if(valueArray[1] == "true")
		{
			rights[i] = "<%= c.string("eDirRights.Browse") %>";
			i++;
		}
		if(valueArray[2] == "true")
		{
			rights[i] = "<%= c.string("eDirRights.Create") %>";
			i++;
		}
		if(valueArray[3] == "true")
		{
			rights[i] = "<%= c.string("eDirRights.Rename") %>";
			i++;
		}
		if(valueArray[4] == "true")
		{
			rights[i] = "<%= c.string("eDirRights.Delete") %>";
			i++
		}
		if(valueArray[5] == "true")
		{
			rights[i] = "<%= c.string("eDirRights.Dynamic") %>";
		}

	}
	else
	{
		if(valueArray[0] == "true")
		{
			rights[i] = "<%= c.string("eDirRights.Supervisor") %>";
			i++;
		}
		if(valueArray[1] == "true")
		{
			rights[i] = "<%= c.string("eDirRights.Compare") %>";
			i++;
		}
		if(valueArray[2] == "true")
		{
			rights[i] = "<%= c.string("eDirRights.Read") %>";
			i++;
		}
		if(valueArray[3] == "true")
		{
			rights[i] = "<%= c.string("eDirRights.Write") %>";
			i++;
		}
		if(valueArray[4] == "true")
		{
			rights[i] = "<%= c.string("eDirRights.Self") %>";
			i++
		}
		if(valueArray[5] == "true")
		{
			rights[i] = "<%= c.string("eDirRights.Dynamic") %>";
		}


	}

	doWrite(rights);
}



function doWrite(rights)
{

  RightsFrame.document.writeln("<TABLE style=\"font-size: 0.8em; font-family: 'Trebuchet MS', Arial, Helvetica, Geneva, Swiss, SunSans-Regular\" width='100%' border='0' cellspacing='0' cellpadding='0'>");
  for(var i= 0; i < rights.length; i++)
  {
  	RightsFrame.document.writeln("<TR bgcolor='#FFFFFF'><TD>");
	RightsFrame.document.writeln("<FONT color='#808080'>");
	RightsFrame.document.writeln(rights[i]);
	RightsFrame.document.writeln("</FONT>");
	RightsFrame.document.writeln("</TD></TR>");

  }
  RightsFrame.document.writeln("</TABLE>");
  RightsFrame.document.close();
}



function changeProperties()
{

	if (document.ViewEffectiveRightsForm.elements["changePropertiesCheckBox"].checked)
	{
		document.ViewEffectiveRightsForm.elements["showProperties"].value = "true";
	}
	else
	{
		document.ViewEffectiveRightsForm.elements["showProperties"].value = "false";
	}

	document.ViewEffectiveRightsForm.elements["merge"].value="base.ViewEffectiveRights";
	document.ViewEffectiveRightsForm.elements["nextState"].value="buildPropertiesList";
	document.ViewEffectiveRightsForm.elements["newObjectSelected"].value = "false";
	document.ViewEffectiveRightsForm.submit();
}


function setFocusToFormElement()
{
	document.ViewEffectiveRightsForm.elements["Property List"].focus();
	document.ViewEffectiveRightsForm.elements["Property List"].options[0].selected=true;
	showPropertyEffectiveRights();
}


function newObjectP(controlName, results)
{
	document.ViewEffectiveRightsForm.elements["merge"].value="base.ViewEffectiveRights";
	document.ViewEffectiveRightsForm.elements["nextState"].value="buildPropertiesList";
	document.ViewEffectiveRightsForm.elements["newObjectSelected"].value = "true";
	document.ViewEffectiveRightsForm.elements["ObjectP"].value = results;
	document.ViewEffectiveRightsForm.submit();
}


</SCRIPT>
</HEAD>
<BODY TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#000000" bgcolor="#FFFFFF" onLoad="returnFromOS();setFocusToFormElement();">
<FORM name="ViewEffectiveRightsForm" method=post action="webacc" >
   <input type=hidden name="taskId" value="<%= c.var("taskId") %>">
   <input type=hidden name="merge" value="fw.Body">
   <input type=hidden name="error" value="dev.GenErr">
   <input type=hidden name="User.context" value="<%= c.var("User.context") %>">
   <input type=hidden name="nextState" value="CompleteTask">
   <input type=hidden name="showProperties" value="">
   <input type=hidden name="newObjectSelected" value="">
   <!-- End of hidden tags -->

   <% c.set("TaskHeader.title", c.string("eDirRights.ViewEffectiveRightsTitle"));
      c.set("TaskHeader.iconUrl", "dir/rights.gif");
      c.set("TaskHeader.iconAlt", c.string("eDirRights.ViewEffectiveRightsTitle"));
      c.set("TaskHeader.helpFile", "base/vieweffectiverights.html");
      c.set("TaskHeader.HelpWindowWidth", "500");
      c.set("TaskHeader.HelpWindowHeight", "500"); %>
   <jsp:include page='<%= c.getPath("dev/TaskHeader_inc.jsp") %>' flush="true" />

   <BR>

	<TABLE width="100%" border="0" cellspacing="0" cellpadding="3" height="69">
   		<TR>
	    	<TD colspan="4" nowrap valign="top" class="mediumtext"><b><%= c.string("eDirRights.TrusteeNameLabel") %></b>&nbsp;<%= c.var("TrusteeDisplayName") %></TD>
		</TR>
		<TR>
			<TD>&nbsp;</TD>
		</TR>

   		<TR>
	    	<TD nowrap valign="top">
				<div class="mediumtext"><%= c.string("eDirRights.ViewEffectiveRightsObjectString") %></div> <BR>

				<div class="mediumtext"><%= c.string("eDirRights.ObjectNameLabel") %></div>
   				<input type=text name="ObjectP" value="<%= c.var("ObjectP") %>" style="color:gray" readonly size=35>
   				<% c.set("OS.TypeFilter", "*,[root]");
   				   c.set("OS.Control", "ObjectP");
				   c.set("OS.CallBack", "newObjectP"); %>
   				<jsp:include page='<%= c.getPath("dev/OS_inc.jsp") %>' flush="true" />
	    	</TD>
		</TR>
	    <TR>
	    	<TD colspan="4" nowrap valign="top" height="9" class="formdescriptextCopy">&nbsp;</TD>
	   	</TR>
	 </TABLE>
	 <TABLE width="100%" border="0" cellspacing="0" cellpadding="3" height="69">
		<TR>
			<TD>
				<div align="left" class="mediumtext"><%= c.string("eDirRights.PropertyNameLabel") %></div>
			</TD>
			<TD>
				<div align="left" class="mediumtext"><%= c.string("eDirRights.EffectiveRightsLabel") %></div>
			</TD>
		</TR>
		<TR>
			<TD>
				<select name="Property List" <% if(!eMFrameUtils.isMS55(request)) {%>class="largetext"<%}%> size=10 onchange="showPropertyEffectiveRights()" >
		      	<% c.set("i", "1");
			  	   c.set("count", c.var("Property.Count"));
		    	   while (c.lte(c.var("i"), c.var("count"))) {
					   if (c.var("Property."+c.var("i")+ ".Name").equals("[Entry Rights]")) { %>
		       			<option value="<%= c.var("Property."+c.var("i")+ ".Supervisor") %>:<%= c.var("Property."+c.var("i")+ ".Browse") %>:<%= c.var("Property."+c.var("i")+ ".Create") %>:<%= c.var("Property."+c.var("i")+ ".Rename") %>:<%= c.var("Property."+c.var("i")+ ".Delete") %>:<%= c.var("Property."+c.var("i")+ ".Dynamic") %>"><%= c.var("Property."+c.var("i")+ ".Name") %></option>
					<% } else { %>
						<option value="<%= c.var("Property."+c.var("i")+ ".Supervisor") %>:<%= c.var("Property."+c.var("i")+ ".Compare") %>:<%= c.var("Property."+c.var("i")+ ".Read") %>:<%= c.var("Property."+c.var("i")+ ".Write") %>:<%= c.var("Property."+c.var("i")+ ".Self") %>:<%= c.var("Property."+c.var("i")+ ".Dynamic") %>"><%= c.var("Property."+c.var("i")+ ".Name") %></option>
					<% }
				   c.inc("i");
		   	  	   } %>
				</select>
			</TD>
			<TD>
				<DIV align="left">
			   	<IFRAME src="webacc?taskId=dev.Empty&merge=fw.Empty" name="RightsFrame" width="200" height="165" scrolling="auto"  frameborder="1">
			      </IFRAME>
			   </DIV>
		   </TD>
		</TR>
		<TR>
			<TD>
				<div align="left" class="mediumtext"><input type="checkbox" name="changePropertiesCheckBox"
				 width="16" height="16" onClick="changeProperties()" <% if (c.var("ShowProperties").equals("true")) { %> CHECKED <% } %>><%= c.string("eDirRights.ShowAllProperties") %></div>
			</TD>
		</TR>
  	</TABLE>
	<p align="center">&nbsp;</p>
	<div class="ruleabove">
    <TABLE width="100%" border="0" cellspacing="0" cellpadding="0" align="left">
  		<TR>
      	<TD align="left">
		   <INPUT type=image name="Done" alt="<%= c.string("Button.Done.alt") %>" src="<%= c.getModulesUrl() + "/dev/images/" + c.string("Button.Done.image") %>" border=0>
         </TD>
      </TR>
   </TABLE>
   </div>
</FORM>
<jsp:include page='<%= c.getPath("dev/OSFooter_inc.jsp") %>' flush="true" />
</BODY></HTML>
