<%@  page pageEncoding="utf-8" contentType="text/html;charset=utf-8" import="com.novell.webaccess.common.JSPConduit, com.novell.emframe.dev.eMFrameUtils, com.novell.emframe.dev.MContext, com.novell.emframe.dev.eMFrameFactory" %>
<%   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 setFocusToFormElement()
{
	var elementCount 	= document.forms[0].elements.length;

	for (var i = 0; i < elementCount; i++)
  	{
  		if (document.forms[0].elements[i].type == "checkbox")
    	{
        	if (document.forms[0].elements[i].name.search("RowCheckBox") != -1)
         	{
            	document.ModifyTrusteesForm.elements[i].focus();
				break;

        	}
     	}
  	}


}



function assignedRightsSelected(trustee)
{
	var strResults="";
	strResults += urlEncode(trustee);
	document.ModifyTrusteesForm.elements["assignedTrustee"].value = strResults;
	document.ModifyTrusteesForm.elements["merge"].value="base.ModifyTrusteesAssignedRights";
	document.ModifyTrusteesForm.elements["nextState"].value="buildInitialPropertiesTable";
	document.ModifyTrusteesForm.submit();
}

function addButtonSelected(controlName, results)
{
	var strResults="";
	for(i=0;i < results.length; i++)
	{
		if(i > 0)
		{
			strResults += "$";
		}

		strResults += urlEncode(results[i]);
	}

	document.ModifyTrusteesForm.elements["addedTrustees"].value = strResults;
	document.ModifyTrusteesForm.elements["merge"].value="base.ModifyTrustees";
	document.ModifyTrusteesForm.elements["nextState"].value="addTrusteesToTable" ;
	document.ModifyTrusteesForm.submit();
}





function removeButtonSelected()
{
	var strResults="";

	if(checkBoxStatus() == true)
	{
		var elementCount = document.forms[0].elements.length;

		for(var i = 0; i < elementCount; i++)
		{
			if(document.forms[0].elements[i].type == "checkbox")
			{

				if (document.forms[0].elements[i].checked)
				{
					var trusteeName = document.forms[0].elements[i].value;

					if(i > 0)
					{
						strResults += "$";
					}

					strResults += urlEncode(trusteeName);
				}
			}

		}

		document.ModifyTrusteesForm.elements["removedTrustees"].value = strResults;
		document.ModifyTrusteesForm.elements["merge"].value="base.ModifyTrustees";
		document.ModifyTrusteesForm.elements["nextState"].value="removeTrusteesFromTable";
		document.ModifyTrusteesForm.submit();

	}
}


function thisButtonSelected()
{
	document.ModifyTrusteesForm.elements["merge"].value="base.ModifyTrustees";
	document.ModifyTrusteesForm.elements["nextState"].value="addThisToTable" ;
	document.ModifyTrusteesForm.submit();
}



// Returns true if any scope checkboxes are checked
function checkBoxStatus()
{
	var elementCount 	= document.forms[0].elements.length;

	for (var i = 0; i < elementCount; i++)
  	{
  		if (document.forms[0].elements[i].type == "checkbox")
    	{
        	if (document.forms[0].elements[i].name.search("RowCheckBox") != -1)
         	{
            	if (document.forms[0].elements[i].checked)
            	{
               		return true;
            	}
        	}
     	}
  	}

	return false;
}


function applySelected()
{
	document.ModifyTrusteesForm.elements["merge"].value="base.ModifyTrustees";
	document.ModifyTrusteesForm.elements["nextState"].value="apply";
	document.ModifyTrusteesForm.submit();
}

function refreshSelected()
{
	document.ModifyTrusteesForm.elements["merge"].value="base.ModifyTrustees";
	document.ModifyTrusteesForm.elements["nextState"].value="refresh";
	document.ModifyTrusteesForm.submit();
}


</SCRIPT>
</HEAD>
<BODY TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#000000" bgcolor="#FFFFFF" onLoad="returnFromOS();setFocusToFormElement();">
<FORM name="ModifyTrusteesForm" method=post action="webacc">
   <input type=hidden name="taskId" value="<%= c.var("taskId") %>">
   <input type=hidden name="merge" value="dev.GenConf">
   <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="update">
   <input type=hidden name="addedTrustees" value="">
   <input type=hidden name="removedTrustees" value="">
   <input type=hidden name="assignedTrustee" value="">
   <!-- End of hidden tags -->



   <% c.set("TaskHeader.title", c.string("eDirRights.ModifyTrusteesTitle"));
      c.set("TaskHeader.iconUrl", "dir/rights.gif");
      c.set("TaskHeader.iconAlt", c.string("eDirRights.ModifyTrusteesTitle"));
      c.set("TaskHeader.helpFile", "base/modifytrustees.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">
   		<TR bgcolor="#FFFFFF">
	    	<TD colspan="4" nowrap valign="top" class="mediumtext"><b><%= c.string("eDirRights.ObjectNameLabel") %></b>&nbsp;<%= c.var("ObjectDisplayName") %></TD>
		</TR>
		<% if(c.var("ObjectTypeName").equals("Volume")) { %>
		    <TR>
					<TD><img height="32" width="32" src="<%= c.getModulesUrl() %>/dev/images/notice32.gif" align="absmiddle" border="0"></a> <span class="typegold1"><%= c.string("eDirRights.Notice") %>&nbsp;<%= c.string("eDirRights.ModifyFilesystemNotice") %></span></TD>
			</TR>
	   	<% } %>
	    <TR bgcolor="#FFFFFF">
	    	<TD colspan="4" nowrap valign="top" height="9" class="formdescriptextCopy">&nbsp;</TD>
	   	</TR>
  	</TABLE>
	 <% if(c.var("RightsDataDirty").equals("true")) { %><div id="notice" style="display: block">
     <div class="head4" style="margin-bottom: 0.5em;">
				<img height="32" width="32" src="<%= c.getModulesUrl() %>/dev/images/notice32.gif" align="absmiddle" border="0"></a> <span class="typegold1"><%= c.string("eDirRights.Notice") %></span>
               <b><%= c.string("eDirRights.UnsavedWarningPart1") %></b></div>
			   <div class="mediumtext" style="margin-left: 2.8em; margin-bottom: 2em; line-height: 1.3em; width: 60%">
				<%= c.string("eDirRights.UnsavedWarningPart2") %></div>
		</div>
   	 <% } %>

 	<TABLE width="100%" border="0" cellspacing="0" cellpadding="3">
    	<TR bgcolor="#FFFFFF" ALIGN="RIGHT">
         	<TD align="left"><a href="javascript:removeButtonSelected()"><IMG src="<%= c.getModulesUrl() + "/dev/images/" + c.string("Button.RemoveSelected.image") %>"  alt="<%= c.string("Button.Remove.alt") %>" title="<%= c.string("Button.Remove.alt") %>" border=0 align="absmiddle"></a></TD>
		    <TD colspan="1">&nbsp;</TD>
      		<TD  valign="top">
				<% c.set("OS.Control", "RowCheckBox");
				   if (c.var("Provider.eMFrame.This.enable").equals("true")) {
					   c.set("OS.TypeFilter", "*,[root],[public],[this]");
				   } else {
					   c.set("OS.TypeFilter", "*,[root],[public]");
				   }
				   c.set("OS.Mode", "browse");
				   c.set("OS.MultiSelect", "true");
				   c.set("OS.AltText", c.string("eDirRights.AddTrusteeAlt"));
				   c.set("OS.IconName", c.plus("dev/images/", c.string("Button.AddTrustee.image"))); 
				   c.set("OS.CallBack", "addButtonSelected");
               c.set("OS.Windowed", "true");
            %>
				<jsp:include page='<%= c.getPath("dev/OS_inc.jsp") %>' flush="true" />
			 <!--	<a href="javascript:thisButtonSelected()"><img src="<%= c.getModulesUrl() %>/dev/images/en/eMb_self.gif"  alt="<%= c.string("eDirRights.AddThisAlt") %>" title="<%= c.string("eDirRights.AddThisAlt") %>" border=0 align="absmiddle"></a>  -->
      		</TD>
    	</TR>
	</TABLE>
	<TABLE width="100%" border="0" cellspacing="0" cellpadding="3">
      	<TR bgcolor="#DFDDD5">
      		<TD width="5%">&nbsp;</TD>
   			<TD width="45%" height="24">
     			<div align="left"><font color="#FFFFFF"><b><font color="#000000"><%= c.string("eDirRights.TrusteeNameHeading") %></font></b></font></div>
   			</TD>
			<TD width="45%">&nbsp;</TD>
 		</TR>
    	<!-- Load table info -->
      	<% c.set("i", "1");
	  	   c.set("count", c.var("Trustee.Member.Count"));
      	   c.set("color", "#FFFFFF");
		   MContext context = eMFrameFactory.getMContext(request);
    	   while (c.lte(c.var("i"), c.var("count"))) { %>
	  		<TR bgcolor=<%= c.var("color") %>>
	    		<TD width="5%" height="17">
            		<DIV align="left">
		        		<input type="checkbox" name="RowCheckBox" width="16" height="16" value="<%= c.var("Trustee.Member."+c.var("i")+ ".FullName") %>">
               		</DIV>
		   		</TD>		   		
            	<TD width="45%" height="17">
            		<img src="<%= c.getModulesUrl()+"/dev/images/dir/"+ c.var("Trustee.Member."+c.var("i")+ ".ImageName")%>" />
            		<%= c.var("Trustee.Member."+c.var("i")+ ".FullName") %>
            	</TD>
				<TD width="45%"	height="17">
					<a href="#" onClick="javascript:assignedRightsSelected('<%= c.toHTML((c.toScript(c.var("Trustee.Member."+c.var("i")+ ".FullName")))) %>');return false"><%= c.string("eDirRights.AssignedRightsHeading") %></a>
				</TD>
        	</TR>
	   	<% c.inc("i");
           if (c.var("color").equals("#FFFFFF")) {
	   		   c.set("color", "#EFEEE9");
	       } else {
	    	   c.set("color", "#FFFFFF");
	       }
   	  	   } %>
	</TABLE>
	<p align="center">&nbsp;</p>
   <BR>
   <div class="ruleabove">
   <TABLE width="100%" border="0" cellspacing="0" cellpadding="0" align="left">
  		<TR>
      	<TD align="left">
		   <INPUT type=image name="Modify" alt="<%= c.string("eDirRights.ModifyTrusteesTitle") %>" src="<%= c.getModulesUrl() + "/dev/images/" + c.string("Button.OK.image") %>" border=0><jsp:include page='<%= c.getPath("dev/Cancel_inc.jsp") %>' flush="true" />
         &nbsp;<A href="javascript:applySelected();" ><img src="<%= c.getModulesUrl() %>/dev/images/<%= c.string("Button.Apply.image") %>" alt="<%= c.string("Button.Apply.alt") %>" border=0 ></a>
         &nbsp;<A href="javascript:refreshSelected();" ><img src="<%= c.getModulesUrl() %>/dev/images/<%= c.string("Button.Refresh.image") %>" alt="<%= c.string("Button.RefreshAll.alt") %>" border="0" ></a>
         </TD>
      </TR>
   </TABLE>
   </div>
</FORM>
<jsp:include page='<%= c.getPath("dev/OSFooter_inc.jsp") %>' flush="true" />
</BODY></HTML>
