<%@  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("FwResources"); %>
<HTML>
<HEAD>
<TITLE><%= c.toDisplay(c.string("RBSManagement.CreateTaskTitle")) %></TITLE>
<LINK href="<%= c.getModulesUrl() + "/dev/css/hf_style.css" %>" rel="styleSheet" type="text/css">
<jsp:include page='<%= c.getPath("dev/eMFrameScripts_inc.jsp") %>' flush="true" />
<jsp:include page='<%= c.getPath("dev/OSScripts_inc.jsp") %>' flush="true" />
<style>
.gray
{
background-color: #bfbfbf;
}
</style>
<SCRIPT language="JavaScript">


   function setWaitCursor()
   {
	   document.body.style.cursor="wait";
   }


   function checkCreateTaskNullInput()
   {
      var strContainerInput = document.CreateTaskForm.CreateTaskContext.value;
      var strTaskNameInput = document.CreateTaskForm.CreateTaskName.value;

      if ((null == strTaskNameInput) || (0 == strTaskNameInput.length))
      {
         alert("<%= c.toScript(c.string("TaskBuilder.MustEnterTaskName")) %>");
         return false;
      }

      if ((null == strContainerInput) || (0 == strContainerInput.length))
      {
         alert("<%= c.toScript(c.string("CreateRole.InvalidRoleContext")) %>");
         return false;
      }

      // Make sure they haven't entered more than 1024 characters.
      var sizeOk = checkFinalTextAreaSize();
      if (sizeOk == false)
      {
      	 document.CreateTaskForm.CreateTaskDescription.focus();
         return false;
      }

      // Everything is ok. Get the new role name.
      getSelectedTaskName();

      setWaitCursor();
      return true;
   }


   function setFocusToFormElement()
   {
      document.CreateTaskForm.CreateTaskName.focus();
   }


   function getSelectedTaskName()
   {
      var strCreateTaskName = document.CreateTaskForm.elements["CreateTaskName"].value;
      var strCreateTaskContext = document.CreateTaskForm.elements["CreateTaskContext"].value;
      var strCreateTaskFullName = strCreateTaskName + "." + strCreateTaskContext;

      document.CreateTaskForm.elements["CreateTaskFullName"].value=strCreateTaskFullName;
      document.CreateTaskForm.elements["CreateTaskDisplayName"].value=strCreateTaskName;
   }

	// Check to make sure the description attribute max size is not exceeded.
   function checkFinalTextAreaSize()
   {
      var maxlimit = 1024;

      if (document.CreateTaskForm.CreateTaskDescription.value.length > maxlimit) // if too long...trim it!
		{
         var limitMessage = "<%= c.toScript(c.string("ModifyRBSObjectDescription.ExceededLimit")) %>";
         alert(limitMessage);
         document.CreateTaskForm.CreateTaskDescription.value = document.CreateTaskForm.CreateTaskDescription.value.substring(0, maxlimit);
         return false;
      }
      else
      {
      	return true;
      }
   }

</SCRIPT>
</HEAD>

<BODY TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#000000" bgcolor="#FFFFFF" onLoad="returnFromOS();setFocusToFormElement();">
<FORM name="CreateTaskForm" method=post action="webacc" onSubmit="return(checkCreateTaskNullInput())">
   <input type=hidden name="taskId" value="<%= c.var("taskId") %>">
   <input type=hidden name="merge" value="fw.eGuideTaskAddress">
   <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="getEGuideAddress">
   <input type=hidden name="CreateTaskPreviousPage" value="CrtRole">
   <input type=hidden name="CreateTaskFullName" value="<%= c.toDisplay(c.var("CreateTaskFullName")) %>">
   <input type=hidden name="CreateTaskDisplayName" value="<%= c.toDisplay(c.var("CreateTaskDisplayName")) %>">
   <input type=hidden name="RBSAdmin_TaskDelegate" value="<%= c.var("RBSAdmin_TaskDelegate") %>">

   <!-- End of hidden tags -->

<% if (session.getAttribute("DeviceType").equals("browser")) { %>
	<DIV id="Layer2" style="position:absolute; left:5px; top:4px; width:650px; height:400px; z-index:2">
<% }

      c.set("WizardHeader.title", c.toDisplay(c.string("eGuide.Taskbuilder.Title")));
      c.set("WizardHeader.subtitle", c.toDisplay(c.string("eGuide.Taskbuilder.NameDescription.SubTitle"))); %>
   <jsp:include page='<%= c.getPath("dev/WizardHeader_inc.jsp") %>' flush="true" />

   <TABLE width="100%" border="0" cellspacing="0" cellpadding="3">
   	<TR>
      	<TD class="mediumtext" width="48%" valign="bottom"><%= c.toDisplay(c.string("eGuide.Taskbuilder.TaskName")) %><BR>
         <input type=text name="CreateTaskName" value="<%= c.toDisplay(c.var("CreateTaskDisplayName")) %>" size=35 maxlength=64></TD>
         <TD width="2%" bgcolor="#FFFFFF">&nbsp;</TD>
      </TR>
      <TR>
      	<TD class="mediumtext" width="48%" valign="bottom"><%= c.toDisplay(c.string("CreateRole.Collection")) %><BR>
         <% if (c.var("RBSAdmin_TaskDelegate").equals("taskDelegate") == false) { %>
            <input type=text name="CreateTaskContext" value="<%= c.toDisplay(c.var("CreateTaskContext")) %>" size=35>
		   	<% c.set("OS.TypeFilter", "rbsCollection2");
		   	   c.set("OS.Control", "CreateTaskContext");
               c.set("OS.Mode", "search"); %>
		   	<jsp:include page='<%= c.getPath("dev/OS_inc.jsp") %>' flush="true" />
            <% } else { %>
               <input class="gray" type="text" name="CreateTaskContext" value="<%= c.toHTML(c.var("CreateTaskContext")) %>" size="35" readonly>
            <% } %>

         </TD>
      </TR>
      <TR>
      	<TD class="mediumtext" width="48%" valign="bottom"><%= c.toDisplay(c.string("CreateRole.Description")) %><BR>
         <TEXTAREA name="CreateTaskDescription" value="<%= c.toDisplay(c.var("CreateTaskDescription")) %>" rows="3" cols=30 wrap="VIRTUAL"><%= c.toDisplay(c.var("CreateTaskDescription")) %></TEXTAREA>
         </TD>
         <TD width="2%">&nbsp;</TD>
      	<TD width="50%">&nbsp;</TD>
      </TR>
   </TABLE>
<!--
<% if (session.getAttribute("DeviceType").equals("browser")) { %>
	</DIV>
   <DIV id="Layer1" style="position:absolute; left:6px; top:480px; width:650px; height:80px; z-index:3">
<% } %>
-->
	<BR>
   <TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
      <TR>
      	<TD class="ruleabove">
         	<a href="#"><IMG src="<%= c.getModulesUrl() + "/dev/images/" + c.string("Button.BackDisabled.image") %>" alt="<%= c.toDisplay(c.string("Button.Back.alt")) %>" border=0></a>
            <INPUT type=image name="Next" alt="<%= c.toDisplay(c.string("Button.Next.alt")) %>" src="<%= c.getModulesUrl() + "/dev/images/" + c.string("Button.Next.image") %>" border=0>
            <jsp:include page='<%= c.getPath("dev/Cancel_inc.jsp") %>' flush="true" />
         </TD>
      </TR>
   </TABLE>
<% if (session.getAttribute("DeviceType").equals("browser")) { %>
	</DIV>
<% } %>
</FORM>
<jsp:include page='<%= c.getPath("dev/OSFooter_inc.jsp") %>' flush="true" />
</BODY>

</HTML>
