<%@  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("DevelopersForm.Task.DisplayName")) %></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" />
<script language="JavaScript">


    /*******************
     * FUNCTION HEADER *
     *******************/
    function okSelected()
    {
        if(checkRequiredFields() == false)
        {
           return false;
        }

        if(checkDuplicateNames() == false)
        {
           return false;
        }
        var form = document.DeveloperPageForm;

        var pageName = form.DP_TaskName_Name.value;
        var addMod = form.AddOrModify.value;
        window.opener.setPageInfo(pageName, addMod);
        window.close();
    }


    /*******************
     * FUNCTION HEADER *
     *******************/
    function cancelSelected()
    {
        window.close();
    }


    /*******************
     * FUNCTION HEADER *
     *******************/
    function onPageLoad()
    {
        document.DeveloperPageForm.DP_TaskName_Name.focus();
    }


    /*******************
     * FUNCTION HEADER *
     *******************/
    function checkRequiredFields()
    {
        var pageName = document.DeveloperPageForm.DP_TaskName_Name.value;

        if ((pageName == null) || (pageName.length == 0))
        {
            alert("<%= c.toScript(c.string("DevelopersForm.NameRequired")) %>");
            return false;
        }
        return true;
    }


    /*******************
     * FUNCTION HEADER *
     *******************/   
    function checkDuplicateNames()
    {
        var form = document.DeveloperPageForm;
        
        var oldName = form.Old_Page_Name.value;
        var pageName = form.DP_TaskName_Name.value;
        var addOrModify = form.AddOrModify.value;
        
        // If this is a modify, check to see if the name changed
        if(addOrModify == "ModifyPage")
        {
            if(pageName.toUpperCase() == oldName.toUpperCase())
            {
                return true;
            }
        }
        
        var pageList = form.DP_Page_List_Name.value;
        var pageArray = pageList.split(",");
        
        if(pageArray.length > 0)
        {
            for (i = 0; i < pageArray.length; i++)
            {
                if(pageName.toUpperCase() == pageArray[i].toUpperCase())
                {
                    alert("<%= c.toScript(c.string("DevelopersForm.Page.NameExist")) %>");
                    return false;
                }
            }
        }
        return true;
    }


</SCRIPT>
</HEAD>

<BODY   TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#000000" bgcolor="#FFFFFF"
        onLoad="onPageLoad()">
<form   name="DeveloperPageForm"
        method="post"
        action="webacc"
        onSubmit='return(okSelected());'>

        <input  type=hidden
                name="taskId"
                value="fw.Developer">

        <input  type=hidden
                name="merge"
                value="">

        <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="">
            
        <input  type=hidden
                name="Task.SelectedButton"
                value="">
            
        <input  type=hidden
                name="AddOrModify"
                value="<%= c.var("AddOrModify_Value") %>">
            
        <input  type=hidden
                name="DP_Page_List_Name"
                value="<%= c.toDisplay(c.var("DP_Page_List_Value")) %>">
                    
        <input  type=hidden
                name="Old_Page_Name"
                value="<%= c.toDisplay(c.var("DP_TaskName_Value")) %>">
            
    <!-- ************* -->
    <!-- CONTENT TABLE -->
    <!-- ************* -->
    <% c.set("FormHeader.title", c.toDisplay(c.string("DevelopersForm.Page.PageInformation"))); 
       c.set("FormHeader.helpFile", "base/xmlinstallfile_pageinfo.html"); %>
    <jsp:include page='<%= c.getPath("dev/FormHeader_inc.jsp") %>' flush="true" />
    
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
       <tr> 
            <td colspan="2" > 
                <div align="right">
                    <font color="#FF0000" class="smalltext">
                        <%= c.toDisplay(c.string("DevelopersForm.RequiredField")) %>
                    </font>
                </div>
            </td>
        </tr>
        <tr> 
            <td valign="middle" class="mediumtext">
                <%= c.toDisplay(c.string("DevelopersForm.Page.PageId")) %>
            </td>
            <td valign="baseline" class="mediumtext"> 
                <input  type="text"
                        name="DP_TaskName_Name"
                        value="<%= c.toDisplay(c.var("DP_TaskName_Value")) %>"
                        size="30">&nbsp;<font color="#FF0000">*</font>
            </td>
        </tr>
        <tr> 
            <td class="smalltext2d">
                &nbsp;
            </td>
            <td valign="top" class="smalltext2d"> 
                <%= c.toDisplay(c.string("DevelopersForm.Page.PageIdExample")) %>
            </td>
        </tr>
       <tr> 
            <td colspan="2">
                &nbsp;
            </td>
        </tr>

    </table> 
    <table>
     <tr> 
         <td valign="top" class="smalltext2d"> 
                <%= c.toDisplay(c.string("DevelopersForm.Page.Note")) %>
         </td>
     </tr>
    </table>
	<!-- ************ -->
	<!-- BUTTON TABLE -->
	<!-- ************ -->
    <table width="100%" border="0" cellspacing="0" cellpadding="0" height="25">
        <tr valign="baseline" bgcolor="#FFFFFF">
            <td height="16" colspan="5" align="center" valign="middle" class="mediumtext">
                &nbsp;
            </td>
            <td height="16" align="left" valign="middle" colspan="2" class="mediumtext">
                &nbsp;
            </td>
        </tr>
        <tr> 
            <td colspan="2" height="23" class="ruleabove">
                <a href="#"onClick="javascript:okSelected();return false">
                    <IMG src="<%= c.getModulesUrl() + "/dev/images/" + c.string("Button.OK.image") %>"
                    alt="<%= c.string("Button.OK.alt") %>"
                    title="<%= c.string("Button.OK.alt") %>"
                    border=0></a>
                <a href="#" onClick="javascript:cancelSelected();return false">
                    <IMG src="<%= c.getModulesUrl() + "/dev/images/" + c.string("Button.Cancel.image") %>"
                    alt="<%= c.string("Button.Cancel.alt") %>"
                    title="<%= c.string("Button.Cancel.alt") %>"
                    border=0></a>
            </td>
        </tr>
    </table>
</form>
</BODY></HTML>

