<%@  page pageEncoding="utf-8" contentType="text/html;charset=utf-8" import="com.novell.webaccess.common.JSPConduit,
                  java.util.ResourceBundle,
                  com.novell.emframe.dev.eMFrameUtils" %>

<%   JSPConduit c = JSPConduit.getJSPConduit(request);
	c.stringTable("DevResources");
	c.stringTable("FwResources"); %>
<%@ 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="FwResources"/>
<iman:stringtable bundle="DevResources"/>
<x:parse xml="${edas}" var="edasXml"/>


<HTML>
<HEAD>
	<TITLE><iman:string key="ProductName"/></TITLE>
	<LINK rel="stylesheet" href="<c:out value="${ContextPath}" />/portal/modules/dev/css/hf_style.css">
	<iman:include page="fw/UiHandlerTools.jsp" />


	{SHARED_HEADER_CODE}


	<SCRIPT>
		function onInit()
		{
			var form = document.forms[0];
			try
			{
				{ONINIT}
			}
			catch( e )
			{
			}
		}

		function onOK()
		{
			try
			{
				var form = document.forms[0];
				var openerForm = opener.document.forms[0];

				notifyAllOfExit();

				var action   	 = "<%= c.var( "action" ) %>";
				var attrName 	 = '<%= c.var( "attrName" ) %>';
				var safeAttrName = '<%= c.var( "safeAttrName" ) %>';

				if ( action == "delete" )
				{
					var l = openerForm.<%= c.var("controlString") %>;

					l.value = "<attribute></attribute>";
					window.opener.moveAttributeToUnvaluedList( attrName, safeAttrName );
				}
				else
				{
					{ONEXIT}

					var resultField = form.elements['<%= c.var("controlString") %>'];

               if(resultField != null)
               {
                  var openerField = openerForm.<%= c.var("controlString") %>;

						if (( resultField.value.indexOf( "<mvstring></mvstring>" ) != -1 ) ||
							 ( resultField.value.indexOf( "<value></value>" ) != -1 ) ||
							 ( resultField.value.indexOf( "<attribute></attribute>" ) != -1 ) ||
							 ( resultField.value.indexOf( "<attribute ></attribute>" ) != -1 ))
						{
							alert( "<%= c.toScript( c.string( "OtherPage.MustSpecifyValue" )) %>" );
							return false;
						}

                  if (  action == "add" )
                  {
                     openerField.value = resultField.value;
                     window.opener.moveAttributeToValuedList( attrName, safeAttrName );
                  }
                  else if ( action == "edit" )
                  {
                     openerField.value = resultField.value;
                  }
               }
				}

				window.close();
			}
			catch( e )
			{
				alert( e.description );
			}
		}

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

   </SCRIPT>
</HEAD>

<BODY onLoad="onInit();">
{FORM_TAG}
<%---<FORM name="form" method="post" action="webacc" onSubmit="return onOK();"> ----%>

	<%-- - edas and system variables  - --%>
	<INPUT type="hidden" name="taskId" value="<c:out value="${taskId}"/>">
	<INPUT type="hidden" name="eDirCommand" value="Write">
	<INPUT type="hidden" name="merge" value="dev.GenConf">
	<INPUT type="hidden" name="error" value="dev.GenErr">

	{SHARED_FORM_CODE}

	<%if ( c.var( "action" ).equals( "add" ))
	{
		c.set( "editorTitle", c.string( "OtherPage.AddAttribute" ));
	}
	else if ( c.var( "action" ).equals( "delete" ))
	{
		c.set( "editorTitle", c.string( "OtherPage.DeleteAttribute" ));
	}
	else
	{
		c.set( "editorTitle", c.string( "OtherPage.EditAttribute" ));
	}%>

	<iman:taskHeader title="${editorTitle}" /><BR>

	<TABLE class="mediumtext" border="0" bgcolor="#FFFFFF" cellpadding="0" cellspacing="0">

		{CONTROLS}

	</TABLE>

   <iman:bar/>
   <%if ( !c.var("eDirRights$target$" + c.var( "safeAttrName" )).equals("R") || c.var( "action" ).equals( "delete" )) %>
   <% { %>
      <iman:button key="OK" 		onClick="onOK();"/>
   <% } %>
   <iman:button key="Cancel" 	onClick="onCancel();"/>

</FORM>
<iman:include page="dev/OSFooter_inc.jsp"/>
</BODY>
</HTML>
