<!--
   Name:  DGFilterPage.jsp

   Copyright (c) 1997-2003 Novell, Inc.  All Rights Reserved.

   THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND TREATIES.
   USE AND REDISTRIBUTION OF THIS WORK IS SUBJECT TO THE LICENSE AGREEMENT
   ACCOMPANYING THE SOFTWARE DEVELOPMENT KIT (SDK) THAT CONTAINS THIS WORK.
   PURSUANT TO THE SDK LICENSE AGREEMENT, NOVELL HEREBY GRANTS TO DEVELOPER A
   ROYALTY-FREE, NON-EXCLUSIVE LICENSE TO INCLUDE NOVELL'S SAMPLE CODE IN ITS
   PRODUCT. NOVELL GRANTS DEVELOPER WORLDWIDE DISTRIBUTION RIGHTS TO MARKET,
   DISTRIBUTE, OR SELL NOVELL'S SAMPLE CODE AS A COMPONENT OF DEVELOPER'S
   PRODUCTS. NOVELL SHALL HAVE NO OBLIGATIONS TO DEVELOPER OR DEVELOPER'S
   CUSTOMERS WITH RESPECT TO THIS CODE.

-->
<%@  page pageEncoding="utf-8" contentType="text/html;charset=utf-8" import="com.novell.webaccess.common.JSPConduit, com.novell.emframe.dev.eMFrameUtils,
	java.util.Hashtable, com.novell.emframe.dev.eMFrameFactory" %>
<%@ taglib uri="/WEB-INF/iman.tld" prefix="iman" %>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/fmt.tld" prefix="fmt" %>
<% JSPConduit c = new JSPConduit(request); %>

<iman:stringtable bundle="BaseResources"/>

<html>
   <head>
      <title><iman:string key="DynamicGroup.EditFilterDlgTitle"/></title>
      <link rel="stylesheet" href="<c:out value="${ContextPath}" />/portal/modules/dev/css/hf_style.css">

	   <script>
			<% if ( c.def( "DGCloseWindow" ))
			{%>
				<%/*
				 * Returns true of the object is defined, false otherwise.
				 */%>
				function isObjectDefined( obj )
				{
					if ( obj == null )
					{
						return false;
					}

					var sType = typeof obj;
					if ( sType != "undefined" && sType != "unknown" )
					{
						return true;
					}
					return false;
				}<%/*  end isObjectDefined()  */%>

				<%/*
				 * Returns true if window.opener is valid, false otherwise.
				 */%>
				function isOpenerValid()
				{
					if ( isObjectDefined( window.opener ) )
					{
						var type = typeof window.opener.name;
						if ( type == "string" )
						{
							return true;
						}
					}
					return false;
				}<%/*  end isOpenerValid()  */%>
			<% } %>

			function onInit()
			{
				<% if ( c.def( "DGCloseWindow" ))
				{ %>
					<%/* Make sure the window that opened us is still valid.  */%>
					if ( isOpenerValid() )
					{
						<%/* Make sure the opener has a refresh() function.  */%>
						if ( window.opener.updateFilter )
						{
							window.opener.updateFilter( '<%= c.var( "filterParam" ) %>', '<%= c.var( "filterParamXML" ) %>' );
						}
					}
					window.close();
				<% } %>
			}

	      function onOK()
	      {
				document.forms[0].submit();
	      }

			function onCancel()
			{
				window.close();
			}

		</script>
	</head>

	<body onload="onInit()">
		<form name="form" 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="validateFilter">
	
			<iman:taskHeader titleKey="DynamicGroup.FilterLabel" titleBundle="BaseResources" />

			<table class="mediumtext" border="0" bgcolor="#FFFFFF" cellpadding="0" cellspacing="0">
				<tr>
					<td height="9">
					</td>
				</tr>
				<tr>
					<td>
						<textarea
		      			name="filterControl" 
		      			style="WIDTH: 450px" 
		      			rows="6" 
		      			cols="40"><c:out value="${filterParam}"/></textarea>
					</td>
				</tr>
				<tr>
					<td height="9">
					</td>
				</tr>
			</table>

		   <HR color="#6B8899" size="2">
		   <iman:button key="OK" 		onClick="onOK();"/>
		   <iman:button key="Cancel" 	onClick="onCancel();"/>
		</form>
	</body>
</html>
