<%@  page pageEncoding="utf-8" contentType="text/html;charset=utf-8" import="com.novell.webaccess.common.JSPConduit, com.novell.emframe.dev.eMFrameUtils,
                                                                             com.novell.emframe.dev.MContext,
                                                                             com.novell.emframe.dev.eMFrameFactory,
                                                                             com.novell.application.console.snapin.ObjectEntry,
                                                                             com.novell.emframe.fw.RBSUtil" %>
<%   JSPConduit c = JSPConduit.getJSPConduit(request);
   c.stringTable("DevResources");
   c.stringTable("FwResources"); %>
<HTML>
<HEAD>
<TITLE><%= c.string("RBSCollectionName.Title") %></TITLE>
<LINK rel='stylesheet' href='<%= c.getModulesUrl() + "/dev/css/hf_style.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 setFocusToFormElement()
    {
        if( document.EditCollectionOwnerList.OwnerList.length > 0 )
        {
            document.EditCollectionOwnerList.OwnerList.options[0].selected=true;
        }
    }

    function addOption(controlName, results)
    {
	 	  var count = document.EditCollectionOwnerList.OwnerList.length;

        if(count > 0)
        {
            for(var index = 0; index < count; index++)
            {
                var element = document.EditCollectionOwnerList.OwnerList.options[index].value;
                if(element == results)
                {
                    alert("<%= c.string("RBSCollectionName.SelectionExist") %>");
                    return;
                }
            }
        }

        document.EditCollectionOwnerList.elements[controlName].value=results;
		  document.EditCollectionOwnerList.elements["merge"].value="fw.RBSCollectionOwnerList";
        document.EditCollectionOwnerList.elements["nextState"].value="addOwner";
        <% if (c.var("Browser.name").equals("NSN") && c.gte(c.var("Browser.mjrVer"), "5")) { %>
		  setTimeout('document.EditCollectionOwnerList.submit()',1000);
		  <% } else { %>
		  document.EditCollectionOwnerList.submit();
		  <% } %>
    }

    function deleteOption()
    {
        if (document.EditCollectionOwnerList.OwnerList.length == 0)
        {
            alert("<%= c.string("RBSCollectionName.NoEntries") %>");
            return;
        }
        var iSelectedIndex = document.EditCollectionOwnerList.OwnerList.selectedIndex;
        if (iSelectedIndex == -1)
        {
            alert("<%= c.string("RBSCollectionName.NoSelection") %>");
            return;
        }

        if(confirm("<%= c.string("RBSCollectionName.ConfirmDelete") %>")== false)
        {
            return;
        }

        var iSelectedValue = document.EditCollectionOwnerList.OwnerList.options[iSelectedIndex].value;
        document.EditCollectionOwnerList.elements["nextState"].value="deleteOwner";
        document.EditCollectionOwnerList.elements["Selected_Item"].value=iSelectedValue;
        document.EditCollectionOwnerList.submit();
    }

    function finishedOption()
    {
        document.EditCollectionOwnerList.elements["nextState"].value="saveOwner";
        document.EditCollectionOwnerList.elements["merge"].value="dev.GenConf";
        document.EditCollectionOwnerList.submit();
    }
</SCRIPT>
</HEAD>

<BODY TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#000000" bgcolor="#FFFFFF" onLoad="returnFromOS();setFocusToFormElement()">
<FORM   name="EditCollectionOwnerList"
        method="post"
        action="webacc">

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

        <input  type=hidden
                name="merge"
                value="fw.RBSCollectionOwnerList">

        <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="">

   <% c.set("TaskHeader.title", c.string("RBSCollectionName.TaskHeaderTitle"));
      c.set("TaskHeader.iconUrl", "dir/rbsCollection2.gif");
      c.set("TaskHeader.helpFile", "base/modifycollectionowners.html"); %>
   <jsp:include page='<%= c.getPath("dev/TaskHeader_inc.jsp") %>' flush="true" /><BR>

   <TABLE border="0" cellspacing="0" >
      <TR>
            <TD class="mediumtext">
                <B><%= c.string("RBSCollectionName.Collection") %></B>&nbsp;<%= c.toHTML(c.var("RBSCollectionContext")) %>
            </td>
      </TR>
        <TR>
            <TD class="mediumtext">
                &nbsp;
            </td>
        </TR>
      <TR>
        <TD class="mediumtext" valign=bottom>
            <%= c.string("RBSCollectionName.Owner") %>
        </TD>
      </TR>
   </table>
   <TABLE border="0" cellspacing="0" >
      <TR>
         <TD align=right valign=top>
            <SELECT name="OwnerList" size=10 style="WIDTH: 250px">
               <% c.set("i", "0");
                  while (c.lt(c.var("i"), c.var("Task.CollectionList.Count"))) { %>
                  <OPTION value="<%= c.toHTML(c.var("Task.CollectionList."+c.var("i"))) %>"><%= c.toHTML(c.var("Task.CollectionList."+c.var("i"))) %>
                  <% c.inc("i");
                 } %>
            </SELECT>
         </TD>
         <TD align=left valign=top>
            <TABLE border=0>
                <TR>
                    <TD>
                        <%
                           c.set("OS.TypeFilter", c.var("MemberTypeFilter"));
                           c.set("OS.Mode", "Browse");
                           c.set("OS.IconName", "dev/images/iconadd.gif");
                           c.set("OS.CallBack", "addOption");
                           c.set("OS.Control", "Selected_Item");
                           c.set("OS.History", "true"); %>
                        <jsp:include page='<%= c.getPath("dev/OS_inc.jsp") %>' flush="true" />
                    </TD>
                </TR>
                <TR>
                    <TD>
                        <a href="#" onClick="javascript:deleteOption();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>
            </TABLE>
         </TD>
      </TR>
        <TR>
            <TD class="mediumtext">
                &nbsp;
            </td>
        </TR>
   </TABLE>
   <jsp:include page='<%= c.getPath("dev/Bar_inc.jsp") %>' flush="true" />
        <a href="#" onClick="javascript:finishedOption();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><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>
