<%@  page pageEncoding="utf-8" contentType="text/html;charset=utf-8"
   import="com.novell.webaccess.common.JSPConduit" %>

<%   JSPConduit c = JSPConduit.getJSPConduit(request);
   c.stringTable("DevResources");
   c.stringTable("FwResources"); %>

<HTML>
<HEAD>
<TITLE><%= c.string("RolestoUserReportTaskDisplayName") %></TITLE>
<% if (c.var("inProgress").equals("true")) { %>
   <META HTTP-EQUIV="Refresh" CONTENT="1">
<% } %>
<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 HEADER *
    *******************/
    function selectAllRoles()
    {
        var numOptions = document.GetRolesForm.SelectedRole.length;
        for(var i = 0; i < numOptions; i++)
        {
            document.GetRolesForm.SelectedRole.options[i].selected = "selected";
        }

        return false;
    }


</script>
</HEAD>

<BODY   TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#000000" bgcolor="#FFFFFF"
        onLoad="returnFromOS();">

<form   name="GetRolesForm"
        method=post
        action="webacc">

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

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

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

   <% c.set("TaskHeader.title", c.string("UsersToRoleReport.ReportHeader"));
      c.set("TaskHeader.helpFile", "fw/getrolesform.html");
      c.set("TaskHeader.iconUrl", "dev/bullet_default_16.gif"); %>
   <jsp:include page='<%= c.getPath("dev/TaskHeader_inc.jsp") %>' flush="true" />

   <div class="formdescriptextml0"  style="width: 70%"><%= c.string("UsersToRoleReport.Instructions") %></div>
   <div class="mediumtext" style="margin-top: 1em;"><%= c.string("UsersToRoleReport.RolePrompt") %></div>

   <div>

      <select name="SelectedRole" multiple="multiple" size="8">
        <% String sRoleCount = (String)c.get("Role.Count");
           if (sRoleCount != null)
           {
               int iRoleCount = Integer.parseInt(sRoleCount);
               for (int i=0; i<iRoleCount; i++)
               {

                   String sRole = (String)c.get("Role."+i);
                   String sRoleDisplayName = (String)c.get(sRole);

                   if (i==0)
                   {
                       %>
                            <option value="<%=sRole%>" selected="selected"><%=sRoleDisplayName %> (<%=sRole.substring(sRole.indexOf(".")+1)%>)</option>
                       <%
                   }
                   else
                   {
                       %>
                                <option value="<%=sRole%>"><%=sRoleDisplayName %> (<%=sRole.substring(sRole.indexOf(".")+1)%>)</option>
                       <%
                   }
               }
           }
           %>
      </select>
    </div>
    <a href="#" onClick="javascript:selectAllRoles();return false"><%= c.string("UsersToRoleReport.SelectAllRoles") %></a>

      <% if (c.var("inProgress").equals("true")) { %>
         <div id="generate" style="display: block">
            <div class="head4" style="margin-bottom: 0.5em;  margin-top: 2em">
               <img height="32" width="32" src="<%= c.getModulesUrl() %>/dev/images/In-progress_framed32.gif" align="absmiddle"> <span class="typegold1">"<%= c.toHTML(c.string("RolesToUserReport.Generating")) %>"</span>
                  <b>"<%= c.toHTML(c.string("RolestoUserReportTaskDisplayName")) %>"</b></div>
            <div class="mediumtext" style="margin-left: 3em; margin-bottom: 2em; margin-top: 2em; width: 350px"><%= c.toHTML(c.var("progressMessage")) %></div>
            <div class="mediumtext" style="margin-left: 3em; margin-bottom: 2em; width: 350px">"<%= c.toHTML(c.string("RolesToUserReport.CancelReport")) %>"</div>
         </div>
      <% } %>

      <% if (c.var("progressCancelled").equals("true")) { %>
         <div id="cancel" style="display: block">
            <div class="head4" style="margin-bottom: 0.5em;  margin-top: 2em">
               <img height="32" width="32" src="<%= c.getModulesUrl() %>/dev/images/cancelled32.gif" align="absmiddle"> <span class="typegold1">"<%= c.toHTML(c.string("RolesToUserReport.Cancelled")) %>"</span>
                  <b>"<%= c.toHTML(c.string("RolestoUserReportTaskDisplayName")) %>"</b></div>
            <div class="mediumtext" style="margin-left: 3em; margin-bottom: 2em; width: 350px">"<%= c.toHTML(c.string("RolesToUserReport.CancelledMessage")) %>"</div>
         </div>
      <% } %>
      <div class="margintop3">
         <jsp:include page='<%= c.getPath("dev/Bar_inc.jsp") %>' flush="true" />
         <% if (c.var("inProgress").equals("true")) { %>
         <a href="webacc?taskId=<%= c.var("taskId") %>&merge=fw.GetRolesUserNameForm&nextState=cancel&User.context=<%= c.var("User.context") %>">
            <IMG name="Cancel" alt="<%= c.string("Button.Cancel.alt") %>" title="<%= c.string("Button.Cancel.alt") %>" src="<%= c.getModulesUrl() + "/dev/images/" + c.string("Button.Cancel.image") %>" border=0></a>
         <% } else { %>
            <input   type=image
               name="OKButton"
               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" />
         <% } %>
		</div>
</form>
<jsp:include page='<%= c.getPath("dev/OSFooter_inc.jsp") %>' flush="true" />
</BODY></HTML>
