<%@  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");
   c.stringTable("BaseResources"); %>

<HTML>
<HEAD>
<TITLE><%= c.string("RenameObject.RenameObjectTitle") %></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" />
<script language="JavaScript">

   function setSelection(strSelection)
   {
      document.RenameObjectForm.RenameObjectName.value = unescape(strSelection);
   }

   function checkNullInput()
   {
      var strInput = document.RenameObjectForm.RenameObjectName.value;
      if ((null == strInput) || (0 == strInput.length))
      {
         alert("<%= c.string("RenameObject.InvalidObjectName") %>");
         return false;
      }
      var containerInput = document.RenameObjectForm.RenameNewName.value;
      if ((null == containerInput) || (0 == containerInput.length))
      {
         alert("<%= c.string("RenameObject.InvalidName") %>");
         return false;
      }

      return true;
   }

   function setFocusToFormElement()
   {
      // added for Object View
      if ("<%= c.var("OS.ReturningToAnchor") %>"!="true")    //haven't entered a value from OS
      {
         document.RenameObjectForm.RenameObjectName.value = "<%= c.toScript(eMFrameUtils.getSingleTarget(request)) %>";
      }

      document.RenameObjectForm.RenameObjectName.focus();
   }

   function disableOldName()
   {
        // Need to work on this for Netscape.
        document.RenameObjectForm.EnableOldName.checked = false;
        document.RenameObjectForm.EnableOldName.disabled = true;
        document.RenameObjectForm.EnableOldName.blur();
        return true;
	}

    function copyValue(controlName, results)
    {
         var tmp = results[0];
         if (tmp != null)
         {
	 	      document.RenameObjectForm.RenameObjectName.value = tmp;
	 	      document.RenameObjectForm.RenameNewName.value = tmp.substring(0, tmp.indexOf("."));
            if (document.RenameObjectForm.RenameNewName.value.length == 0)
            {
               document.RenameObjectForm.RenameNewName.value = tmp.substring(0, tmp.indexOf(","));
            }
         }
    }


</script>
</HEAD>

<BODY TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#000000" bgcolor="#FFFFFF" onLoad="setFocusToFormElement();returnFromOS();">
<form name="RenameObjectForm" 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="nextState" value="doRenameObject">
   <input type=hidden name="keepOldName" value="">
   <input type=hidden name="OSSearchFilter" value="<%= c.var("OSSearchFilter") %>">
   <input type=hidden name="GifName" value="<%= c.var("GifName") %>">
   <input type=hidden name="TranslatedClass" value="<%= c.var("TranslatedClass") %>">

	<% c.set("TaskHeader.title", c.formatMessage(c.string("RenameObject.RenameObject"), new String[]{c.var("TranslatedClass")}));
      c.set("TaskHeader.iconUrl", c.plus("dir/", c.var("GifName"))); %>

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


<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td class="instructions"><%= c.string("RenameObject.SelectPrompt") %></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td class="mediumtext"><%= c.string("RenameObject.ObjectName") %></td>
  </tr>
  <tr>
    <td><input type="text" name="RenameObjectName" size="<%= c.string("UI.textboxSize") %>" style="width:<%= c.string("UI.textboxPixel") %>" onchange="RenameNewName.value = this.value.substring(0, this.value.indexOf('.')); if (RenameNewName.value.length== 0) RenameNewName.value = this.value.substring(0, this.value.indexOf(',')); " >
	 <%
       c.set("OS.TypeFilter", c.var("OSSearchFilter"));
       c.set("OS.Control", "RenameObjectName");
       c.set("OS.CallBack", "copyValue");
       c.set("OS.History", "true"); %>
	 <jsp:include page='<%= c.getPath("dev/OS_inc.jsp") %>' flush="true" /></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
         <td class="mediumtext"><%= c.string("RenameObject.NewName") %></td>
      </tr>
      <tr>
         <td ><input type="text" name="RenameNewName" size="<%= c.string("UI.textboxSize") %>" maxlength="64" style="width:<%= c.string("UI.textboxPixel") %>" ></td>
      </tr>
      <tr>
         <td class="smalltext2d"><%= c.string("RenameObject.RenameNote") %></td>
      </tr>
    </TABLE>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>

<table width="90%" border="0" cellspacing="0" cellpadding="3">
  <tr>
    <td width="3%"><input type="checkbox" name="EnableOldName" value=""></td>
    <td width="64%" class="mediumtext"><%= c.string("RenameObject.SaveOldName") %></td>
    <td width="33%" >&nbsp;</td>
  </tr>
  <% if(!"false".equals(c.var("aliasCreation"))) { %>
  <tr>
    <td width="3%"><input type="checkbox" name="EnableCreateAlias" value=""></td>
    <td width="64%" class="mediumtext"><%= c.string("RenameObject.CreateAlias") %></td>
    <td width="33%" >&nbsp;</td>
  </tr>
  <%}%>
  <tr>
    <td colspan="2"></td>
  </tr>
</table>
<br>

<jsp:include page='<%= c.getPath("dev/Bar_inc.jsp") %>' flush="true" />
<INPUT type=image name="Rename" alt="<%= c.string("Button.OK.alt") %>" src="<%= c.getModulesUrl() + "/dev/images/" + c.string("Button.OK.image") %>" border=0><jsp:include page='<%= c.getPath("dev/Cancel_inc.jsp") %>' flush="true" />
</form>
<jsp:include page='<%= c.getPath("dev/OSFooter_inc.jsp") %>' flush="true" />
</BODY></HTML>
