<%@  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" />
<% if (session.getAttribute("DeviceType").equals("browser")) { %>
<jsp:include page='<%= c.getPath("dev/ASScripts_inc.jsp") %>' flush="true" />
<% } %>
<SCRIPT language="JavaScript">

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

		strResults += results[i];
	}

	document.ModifyDynamicGroupForm.elements["addedMembers"].value = strResults;
	document.ModifyDynamicGroupForm.elements["merge"].value="base.ModifyDynamicGroup";
	document.ModifyDynamicGroupForm.elements["nextState"].value="addMembersToList" ;
	document.ModifyDynamicGroupForm.submit();
}



function removeMemberButtonSelected()
{
	if(document.ModifyDynamicGroupForm.elements["member list"].selectedIndex != -1)
	{
		var index = document.ModifyDynamicGroupForm.elements["member list"].selectedIndex;
		var member="";
		member = document.ModifyDynamicGroupForm.elements["member list"].options[index].text;
		document.ModifyDynamicGroupForm.elements["removeMember"].value = member;
		document.ModifyDynamicGroupForm.elements["merge"].value="base.ModifyDynamicGroup";
		document.ModifyDynamicGroupForm.elements["nextState"].value="removeMemberFromList" ;
		document.ModifyDynamicGroupForm.submit();
	}
}



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

		strResults += results[i];
	}

	document.ModifyDynamicGroupForm.elements["addedEMembers"].value = strResults;
	document.ModifyDynamicGroupForm.elements["merge"].value="base.ModifyDynamicGroup";
	document.ModifyDynamicGroupForm.elements["nextState"].value="addEMembersToList" ;
	document.ModifyDynamicGroupForm.submit();
}


function removeEMemberButtonSelected()
{
	if(document.ModifyDynamicGroupForm.elements["emember list"].selectedIndex != -1)
	{
		var index = document.ModifyDynamicGroupForm.elements["emember list"].selectedIndex;
		var member="";
		member = document.ModifyDynamicGroupForm.elements["emember list"].options[index].text;
		document.ModifyDynamicGroupForm.elements["removeEMember"].value = member;
		document.ModifyDynamicGroupForm.elements["merge"].value="base.ModifyDynamicGroup";
		document.ModifyDynamicGroupForm.elements["nextState"].value="removeEMemberFromList" ;
		document.ModifyDynamicGroupForm.submit();
	}
}



function identityButtonSelected(controlName, results)
{
	var strResults="";
	for(i=0;i < results.length; i++)
	{
		strResults += results[i];
	}

	document.ModifyDynamicGroupForm.elements["identityDN"].value = strResults;
	document.ModifyDynamicGroupForm.elements["merge"].value="base.ModifyDynamicGroup";
	document.ModifyDynamicGroupForm.elements["nextState"].value="setIdentity" ;
	document.ModifyDynamicGroupForm.submit();
}


function filterButtonSelected(controlName,type, criterion)
{
	var strResults="";
	strResults += criterion;
	document.ModifyDynamicGroupForm.elements["filterXML"].value = strResults;
	document.ModifyDynamicGroupForm.elements["merge"].value="base.ModifyDynamicGroup";
	document.ModifyDynamicGroupForm.elements["nextState"].value="convertFilterXML" ;
	document.ModifyDynamicGroupForm.submit();

}


function checkNullInput()
 {
  var strInput = document.ModifyDynamicGroupForm.filter.value;
  if ((null == strInput) || (0 == strInput.length))
  {
     alert("<%= c.string("DynamicGroup.EmptyFilterMsg") %>");
  }
  return true;
}



</SCRIPT>
</HEAD>
<BODY TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#000000" bgcolor="#FFFFFF" onLoad="returnFromOS()">
<FORM name="ModifyDynamicGroupForm" method=post action="webacc" onSubmit="return(checkNullInput())">
   <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="addedMembers" value="">
   <input type=hidden name="addedEMembers" value="">
   <input type=hidden name="removeMember" value="">
   <input type=hidden name="removeEMember" value="">
   <input type=hidden name="identityDN" value="">
   <input type=hidden name="filterXML" value="">
   <input type=hidden name="nextState" value="update">
   <!-- End of hidden tags -->


   <% if (c.var("taskId").equals("base.ModifyDynamicGroup")) {
   	   c.set("TaskHeader.title", c.plus(c.plus(c.string("DynamicGroup.ModifyDynamicGroupTitle"), ":"), c.var("dgName")));
       c.set("TaskHeader.iconAlt", c.string("DynamicGroup.ModifyDynamicGroupTitle"));

      } else {
   		   c.set("TaskHeader.title", c.plus(c.plus(c.string("DynamicGroup.ModifyDynamicGroupExTitle"), ":"), c.var("dgName")));
   		   c.set("TaskHeader.iconAlt", c.string("DynamicGroup.ModifyDynamicGroupExTitle"));

      }

      c.set("TaskHeader.iconUrl", "dir/dynamicGroup.gif");
      c.set("TaskHeader.helpFile", "base/modifydynamicgroup.html");
      c.set("TaskHeader.HelpWindowWidth", "500");
      c.set("TaskHeader.HelpWindowHeight", "500"); %>

   <jsp:include page='<%= c.getPath("dev/TaskHeader_inc.jsp") %>' flush="true" />

   <BR>
	<TABLE  border="0" cellspacing="2" cellpadding="0" >
		<TR>
			<TD align=left class="mediumtext" >
				<%= c.string("DynamicGroup.UniqueMemberLabel") %><BR>
				<select name="member list" size="1" style="WIDTH: 270px" >
				<% c.set("i", "0");
			  	   c.set("count", c.var("Member.Count"));
		    	   while (c.lt(c.var("i"), c.var("count"))) { %>
	           		<option><%= c.var("Member."+c.var("i")+ ".Name") %></option>
				<% c.inc("i");
		   	  	   } %>
		      	</select>
			</TD>
			<TD align=left class="mediumtext">
				<% c.set("OS.Control", "member list");
				   c.set("OS.TypeFilter", "*");
				   c.set("OS.Mode", "browse");
				   c.set("OS.MultiSelect", "true");
				   c.set("OS.AltText", c.string("DynamicGroup.AddMemberAlt"));
				   c.set("OS.IconName", "dev/iconadd.gif");
				   c.set("OS.CallBack", "addMemberButtonSelected"); %>
				<BR>
				<jsp:include page='<%= c.getPath("dev/OS_inc.jsp") %>' flush="true" />
				 <a href="javascript:removeMemberButtonSelected()"><img src="<%= c.getModulesUrl() %>/dev/images/iconremove.gif" alt="<%= c.string("DynamicGroup.RemoveMemberAlt") %>" title="<%= c.string("DynamicGroup.RemoveMemberAlt") %>" border=0 align="absmiddle"></a>
			</TD>
		</TR>
	</TABLE>
	<BR>
	<TABLE  border="0" cellspacing="2" cellpadding="0" >
		<TR>
			<TD align=left class="mediumtext">
				<%= c.string("DynamicGroup.ExcludedMemberLabel") %><BR>
				<select name="emember list" size="1" style="WIDTH: 270px" >
				<% c.set("i", "0");
			  	   c.set("count", c.var("EMember.Count"));
		    	   while (c.lt(c.var("i"), c.var("count"))) { %>
	           		<option><%= c.var("EMember."+c.var("i")+ ".Name") %></option>
				<% c.inc("i");
		   	  	   } %>
		      	</select>
			</TD>
			<TD align=left class="mediumtext" >
				<% c.set("OS.Control", "emember list");
				   c.set("OS.TypeFilter", "*");
				   c.set("OS.Mode", "browse");
				   c.set("OS.MultiSelect", "true");
				   c.set("OS.AltText", c.string("DynamicGroup.AddMemberAlt"));
				   c.set("OS.IconName", "dev/iconadd.gif");
				   c.set("OS.CallBack", "addEMemberButtonSelected"); %>
				<BR>
				<jsp:include page='<%= c.getPath("dev/OS_inc.jsp") %>' flush="true" />
				 <a href="javascript:removeEMemberButtonSelected()"><img src="<%= c.getModulesUrl() %>/dev/images/iconremove.gif" alt="<%= c.string("DynamicGroup.RemoveMemberAlt") %>" title="<%= c.string("DynamicGroup.RemoveMemberAlt") %>" border=0 align="absmiddle"></a>
			</TD>
		</TR>
   </TABLE>
   <BR>
   <TABLE  border="0" cellspacing="2" cellpadding="0" >
		<TR>
			<TD align=left class="mediumtext">
				<%= c.string("DynamicGroup.IdentityObjectLabel") %><BR>
				<input type=text name="Identity" value= "<%= c.var("IdentityDN") %>" style="color:gray" readonly size=41>
   				<% c.set("OS.TypeFilter", "*,[public]");
   				   c.set("OS.Control", "Identity");
				   c.set("OS.CallBack", "identityButtonSelected"); %>
   				<jsp:include page='<%= c.getPath("dev/OS_inc.jsp") %>' flush="true" />
			</TD>
		</TR>
   </TABLE>
   <BR>
   <TABLE  width="100%" border="0" cellspacing="2" cellpadding="0" >
	<TR bgcolor="#DFDDD5">
		<TD  height="24">
			<div align="left"><font color="#FFFFFF"><b><font color="#000000"><%= c.string("DynamicGroup.MemberQueryHeading") %></font></b></font></div>
		</TD>
	</TR>
   </TABLE>
   <TABLE  border="0" cellspacing="2" cellpadding="0" >
		<TR>
			<TD align=left class="mediumtext">
				<%= c.string("DynamicGroup.baseDNLabel") %><BR>
				<input type=text name="baseDN" value= "<%= c.var("baseDN") %>"  style="color:gray" readonly size=41>
				<% c.set("OS.TypeFilter", "[containers],[root]");
   				   c.set("OS.Control", "baseDN"); %>
				<jsp:include page='<%= c.getPath("dev/OS_inc.jsp") %>' flush="true" />
			</TD>
		</TR>
   </TABLE>
   <BR>
   <TABLE  border="0" cellspacing="2" cellpadding="0" >
   	    <TR>
			<TD align=left class="mediumtext">
				<%= c.string("DynamicGroup.ScopeLabel") %><BR>
				<select name="Scope" size="1" style="WIDTH: 270px" >
				<% if (c.var("ScopeSelectedName").equals("sub")) { %>
					<option selected>Sub Container Search</option>
				<option>One Level Search</option>
				<option>Base DN</option>
				<% } else if (c.var("ScopeSelectedName").equals("one")) { %>
					<option selected>One Level Search</option>
				<option>Sub Container Search</option>
				<option>Base DN</option>
				<% } else if (c.var("ScopeSelectedName").equals("base")) { %>
					<option selected>Base DN</option>
				<option>Sub Container Search</option>
				<option>One Level Search</option>
				<% } else { %>
					<option selected>Sub Container Search</option>
				<option>One Level Search</option>
				<option>Base DN</option>
				<% } %>
		      	</select>
			</TD>
		</TR>
   </TABLE>
   <BR>
   <TABLE  border="0" cellspacing="2" cellpadding="0" >
   	    <TR>
			<TD align=left class="mediumtext">
				<%= c.string("DynamicGroup.XChainLabel") %><BR>
				<select name="XChain" size="1" style="WIDTH: 270px" >
				<% if (c.var("XChainSelectedName").equals("x-chain")) { %>
					<option selected>x-chain is set</option>
				<option>x-chain is not set</option>
				<% } else if (c.var("XChainSelectedName").equals("")) { %>
					<option selected>x-chain is not set</option>
				<option>x-chain is set</option>
				<% } else { %>
					<option selected>x-chain is set</option>
				<option>x-chain is not set</option>
				<% } %>
		      	</select>
			</TD>
		</TR>
   </TABLE>
   <BR>
   <TABLE  border="0" cellspacing="2" cellpadding="0" >
		<TR>
		   	<TD align=left class="mediumtext">
				<%= c.string("DynamicGroup.FilterLabel") %><BR>
				<TEXTAREA name="filter" rows="10" cols="40"><%= c.var("ldap2254String") %></TEXTAREA>
			</TD>
			<% if (session.getAttribute("DeviceType").equals("browser")) { %>
			<TD valign=top class="mediumtext">
				<BR>
				<% c.set("AS.Types", "User");
				   c.set("AS.ControlCallBack", "filterButtonSelected"); %>
				<jsp:include page='<%= c.getPath("dev/AS_inc.jsp") %>' flush="true" />
      		</TD>
			<TD valign= bottom class="mediumtext">
				<div class="instructions"><%= c.string("DynamicGroup.ModifyDynamicGroupFilterWarning") %></div>
			</TD>
			<% } %>
		</TR>
   </TABLE>
   <BR>
   <div class="ruleabove">
   <TABLE width="100%" border="0" cellspacing="0" cellpadding="0" align="left">
  		<TR>
      	<TD align="left">
		   <INPUT type=image name="Create" alt="<%= c.string("DynamicGroup.ModifyDynamicGroupEntryFormTitle") %>" src="<%= c.getModulesUrl() + "/dev/images/" + c.string("Button.OK.image") %>" border=0><jsp:include page='<%= c.getPath("dev/Cancel_inc.jsp") %>' flush="true" />
         </TD>
      </TR>
   </TABLE>
   </div>
</FORM>
<jsp:include page='<%= c.getPath("dev/OSFooter_inc.jsp") %>' flush="true" />
</BODY></HTML>
