<%@  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" />
<% c.set("MVStringEditor_mode", "mvsel"); %>
<jsp:include page='<%= c.getPath("dev/MVStringEditorScripts_inc.jsp") %>' flush="true" />

<script language="JavaScript">


    /*******************
     * FUNCTION HEADER *
     *******************/
    function onPageLoad()
    {
        var form = document.DeveloperRoleForm;

        form.DR_RoleName_Name.focus();
        mvLoadFromPack("DR_MiscellaneousData_Name", "<%= c.toScript(c.var("DR_MiscellaneousData_Value")) %>" );
    }


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

        if(checkDuplicateNames() == false)
        {
            return;
        }

        var form = document.DeveloperRoleForm;

        var roleName = form.DR_RoleName_Name.value;
        var version = form.DR_Version_Name.value;
        var displayKey = form.DR_DisplayNameKey_Name.value;
        var descKey = form.DR_DescNameKey_Name.value;
        var desc = form.DR_DescriptionData_Name.value;
        var addMod = form.AddOrModify.value;
        var misc = mvGetValuesAsPack("DR_MiscellaneousData_Name");

        window.opener.setRoleInfo(roleName, version, displayKey, descKey, desc, addMod, misc);
        window.close();
    }


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


    /*******************
     * FUNCTION HEADER *
     *******************/
    function checkRequiredFields()
    {
        var roleName = document.DeveloperRoleForm.DR_RoleName_Name.value;

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


    /*******************
     * FUNCTION HEADER *
     *******************/
    function checkDuplicateNames()
    {
        var form = document.DeveloperRoleForm;

        var oldName = form.Old_Role_Name.value;
        var roleName = form.DR_RoleName_Name.value;
        var addOrModify = form.AddOrModify.value;

        // If this is a modify, check to see if the name changed
        if(addOrModify == "ModifyRole")
        {
            if(roleName.toUpperCase() == oldName.toUpperCase())
            {
                return true;
            }
        }

        var roleList = form.DR_Role_List_Name.value;
        var roleArray = roleList.split(",");

        if(roleArray.length > 0)
        {
            for (i = 0; i < roleArray.length; i++)
            {
                if(roleName.toUpperCase() == roleArray[i].toUpperCase())
                {
                    alert("<%= c.toScript(c.string("DevelopersForm.Role.NameExist")) %>");
                    return false;
                }
            }
        }
        return true;
    }


</SCRIPT>
</HEAD>

<BODY   TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#000000" bgcolor="#FFFFFF"
        onLoad="onPageLoad()">
<form   name="DeveloperRoleForm"
        method="post"
        action="webacc">

        <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="DR_Role_List_Name"
                value="<%= c.var("DR_Role_List_Value") %>">

        <input  type=hidden
                name="Old_Role_Name"
                value="<%= c.var("DR_RoleName_Value") %>">


    <!-- ************* -->
    <!-- CONTENT TABLE -->
    <!-- ************* -->
    <% c.set("FormHeader.title", c.toDisplay(c.string("DevelopersForm.Role.RoleInformation")));
       c.set("FormHeader.helpFile", "base/xmlinstallfile_roleinfo.html"); %>
    <jsp:include page='<%= c.getPath("dev/FormHeader_inc.jsp") %>' flush="true" />
    <TABLE width="100%" border="0" cellspacing="0" cellpadding="3">
       <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.Role.RoleId")) %>
            </td>
            <td valign="baseline" class="mediumtext">
                <input  type="text"
                        name="DR_RoleName_Name"
                        value="<%= c.var("DR_RoleName_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.Role.RoleIdExample")) %>
            </td>
        </tr>
        <tr>
            <td colspan="2" >
                &nbsp;
            </td>
        </tr>
        <tr>
            <td colspan="2" height="17" class="tablesubhead1">
                <%= c.toDisplay(c.string("DevelopersForm.Module.Versioniong")) %>
            </td>
        </tr>
        <tr>
            <td colspan="2" height="11">
            </td>
        </tr>
        <tr>
            <td width="30%" class="mediumtext">
                <%= c.toDisplay(c.string("DevelopersForm.Role.VersionNumber")) %>
            </td>
            <td width="70%">
                <input  type="text"
                        name="DR_Version_Name"
                        value="<%= c.var("DR_Version_Value") %>"
                        size="4">
            </td>
        </tr>
        <tr>
            <td width="30%" valign="bottom">&nbsp; </td>
            <td width="70%">&nbsp;</td>
        </tr>
        <tr>
            <td colspan="2" class="tablesubhead1">
                <%= c.toDisplay(c.string("DevelopersForm.ResourceFile")) %>
            </td>
        </tr>
            <td colspan="2" class="smalltext">
                &nbsp;
            </td>
        <tr>
            <td valign="middle" class="mediumtext">
                <%= c.toDisplay(c.string("DevelopersForm.DisplayKey")) %>
            </td>
            <td valign="baseline" class="mediumtext">
                <input  type="text"
                name="DR_DisplayNameKey_Name"
                value="<%= c.var("DR_DisplayNameKey_Value") %>"
                size="30">
            </td>
        </tr>
        <tr>
            <td class="smalltext2d">
                &nbsp;
            </td>
            <td valign="top" class="smalltext2d">
                <%= c.toDisplay(c.string("DevelopersForm.Role.DisplayKeyExample")) %>
            </td>
        </tr>
            <td colspan="2">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td valign="middle" class="mediumtext">
                <%= c.toDisplay(c.string("DevelopersForm.RoleDescKey")) %>
            </td>
            <td valign="baseline" class="mediumtext">
                <input  type="text"
                name="DR_DescNameKey_Name"
                value="<%= c.var("DR_DescNameKey_Value") %>"
                size="30">
            </td>
        </tr>
        <tr>
            <td class="smalltext2d">
                &nbsp;
            </td>
            <td valign="top" class="smalltext2d">
                <%= c.toDisplay(c.string("DevelopersForm.Role.DescKeyExample")) %>
            </td>
        </tr>
            <td colspan="2">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td colspan="2" class="tablesubhead1">
                <%= c.toDisplay(c.string("DevelopersForm.Description")) %>
            </td>
        </tr>
        </tr>
            <td colspan="2" class="smalltext">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td valign="top" class="mediumtext">
                <%= c.toDisplay(c.string("DevelopersForm.Role.RoleDescription")) %>
            </td>
            <td valign="bottom">
                <textarea   name="DR_DescriptionData_Name"
                            rows="4"
                            cols="30"
                            maxlength="64"
                            wrap=virtual><%= c.toDisplay(c.var("DR_DescriptionData_Value")) %></textarea>
            </td>
        </tr>
        <tr>
            <td width="30%" valign="bottom">&nbsp; </td>
            <td width="70%">&nbsp;</td>
        </tr>
        <tr>
            <td colspan="2" class="tablesubhead1">
                <%= c.toDisplay(c.string("DevelopersForm.Advanced")) %>
            </td>
        </tr>
            <td colspan="2" class="smalltext">
                &nbsp;
            </td>
        <tr>
            <td valign="top" class="mediumtext">
                <%= c.toDisplay(c.string("DevelopersForm.Parameters")) %>
            </td>
            <td>
                <% c.set("MVStringEditor_name", "DR_MiscellaneousData_Name");
                   c.set("MVStringEditor_fixedHeight", "5");
                   c.set("MVStringEditor_mode", "mvsel"); %>
                <jsp:include page='<%= c.getPath("dev/MVStringEditor_inc.jsp") %>' flush="true" />
            </td>
        </tr>
        <tr>
            <td class="smalltext2d">
                &nbsp;
            </td>
            <td valign="top" class="smalltext2d">
                <%= c.toDisplay(c.string("DevelopersForm.Task.OtherExample")) %>
            </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>
