<%@  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.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/MoveListItems_inc.jsp") %>' flush="true" />
<jsp:include page='<%= c.getPath("dev/eMFrameScripts_inc.jsp") %>' flush="true" />

<script language="JavaScript">

    //Global variables
    var myWindow = null;


    /*******************
     * FUNCTION HEADER *
     *******************/
    function addSelected()
    {
        if ((myWindow == null) || myWindow.closed)
        {
            var strUrl = "webacc?taskId=<%= c.var("taskId") %>&merge=fw.DeveloperRole&User.context=<%= c.toDisplay(c.var("User.context")) %>&nextState=DeveloperRolePage&Task.SelectedButton=AddRoleListButton";
            var winOptions = "toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,width=575,height=500";
            myWindow = window.open(strUrl, "", winOptions);
        }
        else
        {
            myWindow.focus();
        }
    }


    /*******************
     * FUNCTION HEADER *
     *******************/
    function deleteSelected()
    {
        var form = document.DeveloperRoleListForm;

        if((form.List.selectedIndex == -1) || (form.List.length == 0))
        {
            return;
        }

        if(confirm("<%= c.toScript(c.string("DevelopersForm.DeleteObject")) %>")== false)
        {
            return;
        }

        form.elements["merge"].value="fw.DeveloperRoleList";
        form.elements["nextState"].value="DeveloperRoleListPage";
        form.elements["Task.SelectedButton"].value="DeleteRoleListButton";
        form.elements["Selected_Item"].value=form.List.options[form.List.selectedIndex].value;
        form.submit();
    }


    /*******************
     * FUNCTION HEADER *
     *******************/
    function modifySelected()
    {
        var form = document.DeveloperRoleListForm;

        if((form.List.selectedIndex == -1) || (form.List.length == 0))
        {
            return;
        }

        if ((myWindow == null) || myWindow.closed)
        {
            var selectedItem = form.List.options[form.List.selectedIndex].value;
            var strUrl = "webacc?taskId=<%= c.var("taskId") %>&merge=fw.DeveloperRole&User.context=<%= c.toDisplay(c.var("User.context")) %>&nextState=DeveloperRolePage&Task.SelectedButton=ModifyRoleListButton&Selected_Item="+urlEncode(selectedItem);
            var winOptions = "toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,width=575,height=500";
            myWindow = window.open(strUrl, "", winOptions);
        }
        else
        {
            myWindow.focus();
        }
    }


    /*******************
     * FUNCTION HEADER *
     *******************/
    function nextSelected()
    {
        var form = document.DeveloperRoleListForm;

        form.elements["merge"].value="fw.DeveloperTaskList";
        form.elements["nextState"].value="DeveloperTaskListPage";
        form.elements["Task.SelectedButton"].value="NextRoleListButton";
        form.submit();
    }


    /*******************
     * FUNCTION HEADER *
     *******************/
    function backSelected()
    {
        var form = document.DeveloperRoleListForm;

        form.elements["merge"].value="fw.DeveloperModule";
        form.elements["nextState"].value="DeveloperModulePage";
        form.elements["Task.SelectedButton"].value="BackRoleListButton";
        form.submit();
    }


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

        sortLists(form.List);

        if( form.List.length > 0 )
        {
            form.List.options[0].selected=true;
        }
    }


    /*******************
     * FUNCTION HEADER *
     *******************/
    function setRoleInfo(roleName, version, displayKey, descKey, desc, addMod, misc)
    {
        var form = document.DeveloperRoleListForm;

        form.elements["DR_RoleName_Name"].value = roleName;
        form.elements["DR_Version_Name"].value = version;
        form.elements["DR_DisplayNameKey_Name"].value = displayKey;
        form.elements["DR_DescNameKey_Name"].value = descKey;
        form.elements["DR_DescriptionData_Name"].value = desc;

        form.elements["merge"].value="fw.DeveloperRoleList";
        form.elements["nextState"].value="DeveloperRoleListPage";
        form.elements["Task.SelectedButton"].value="OkRoleButton";
        form.elements["AddOrModify"].value=addMod;
        form.elements["DR_MiscellaneousData_Name"].value = misc;
        form.submit();
    }

    /*******************
     * FUNCTION HEADER *
     *******************/
	function checkDefaultKey(evt)
   {
      var keyCode = evt.which ? evt.which : evt.keyCode;
      // 13 is the Enter key code
      if (keyCode == 13)
      {
         return(nextSelected());
      }
      return true;
   }


</SCRIPT>
</HEAD>

<BODY   TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#000000" bgcolor="#FFFFFF"
        onLoad="onPageLoad()">
<form   name="DeveloperRoleListForm"
        method="post"
        onSubmit="return(nextSelected())"
        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="Selected_Item"
                value="">

        <input  type=hidden
                name="Task.SelectedButton"
                value="">

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

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

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

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

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

        <input   type=hidden
                name="AddOrModify"
                value="<%= c.toDisplay(c.var("AddOrModify_Value")) %>">

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

	<!-- ************ -->
	<!-- HEADER TABLE -->
	<!-- ************ -->
    <% c.set("WizardHeader.title", c.toDisplay(c.string("DevelopersForm.Wizard.Header")));
       c.set("WizardHeader.subtitle", c.toDisplay(c.string("Schema.Step3")));
       c.set("WizardHeader.instruction", c.toDisplay(c.string("DevelopersForm.RoleList.Step")));
       c.set("WizardHeader.helpFile", "base/xmlinstallfile_roles.html"); %>
    <jsp:include page='<%= c.getPath("dev/WizardHeader_inc.jsp") %>' flush="true" />

	<!-- ************************* -->
	<!-- STEPS & INSTRUCTION TABLE -->
	<!-- ************************* -->
    <table border="0" cellspacing="0" cellpadding="2" width="90%">
        <tr valign="baseline">
            <td height="16" colspan="7" align="center" valign="middle" class="instructions">
                <div align="left"><%= c.toDisplay(c.string("DevelopersForm.RoleList.Instruction")) %></div>
            </td>
        </tr>
        <tr valign="baseline">
            <td height="16" colspan="5" align="center" valign="middle" class="mediumtext">
                &nbsp;
            </td>
        </tr>
    </table>

    <!-- ************* -->
    <!-- CONTENT TABLE -->
    <!-- ************* -->
    <table border="0" cellspacing="3" cellpadding="0">
        <tr>
            <td class="mediumtext">
                <b><%= c.toDisplay(c.string("DevelopersForm.RoleList.Roles")) %>
            </td>
        </tr>
        <tr>
            <td>
                <select size="10" name="List" style="WIDTH: 250px" onkeypress="return checkDefaultKey(event)">
                    <% c.set("i", "0");
                       while (c.lt(c.var("i"), c.var("List.Count"))) { %>
                        <OPTION value="<%= c.toDisplay(c.var("List.Element."+c.var("i"))) %>"><%= c.toDisplay(c.var("List.Element."+c.var("i"))) %>
                    <% c.inc("i");
                       } %>
                </select>
            </td>
            <td valign="top" align="center">
                <table border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td>
                            <a href="#" onClick="javascript:addSelected();return false"><IMG src="<%= c.getModulesUrl() + "/dev/images/iconadd.gif" %>" alt="<%= c.string("Button.Add.alt") %>" title="<%= c.string("Button.Add.alt") %>" border=0></a>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <a href="#" onClick="javascript:deleteSelected();return false"><IMG src="<%= c.getModulesUrl() + "/dev/images/iconremove.gif" %>" alt="<%= c.string("Button.Delete.alt") %>" title="<%= c.string("Button.Delete.alt") %>" border=0></a>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <a href="#"onClick="javascript:modifySelected();return false"><IMG src="<%= c.getModulesUrl() + "/dev/images/iconedit.gif" %>" alt="<%= c.string("Button.Modify.alt") %>" title="<%= c.string("Button.Modify.alt") %>" border=0></a>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>

	<!-- ************ -->
	<!-- BUTTON TABLE -->
	<!-- ************ -->
    <table width="85%" 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:backSelected();return false">
                    <IMG src="<%= c.getModulesUrl() + "/dev/images/" + c.string("Button.Back.image") %>"
                    alt="<%= c.string("Button.Back.alt") %>"
                    title="<%= c.string("Button.Back.alt") %>"
                    border=0></a>
                <a href="#" onClick="javascript:nextSelected();return false">
                    <IMG src="<%= c.getModulesUrl() + "/dev/images/" + c.string("Button.Next.image") %>"
                    alt="<%= c.string("Button.Next.alt") %>"
                    title="<%= c.string("Button.Next.alt") %>"
                    border=0></a><jsp:include page='<%= c.getPath("dev/Cancel_inc.jsp") %>' flush="true" />
            </td>
        </tr>
    </table>
</form>
</BODY></HTML>
