<%@  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.toHTML(c.string("RBSManagement.RoleTaskSummaryTitle")) %></TITLE>
<LINK href="<%= c.getModulesUrl() + "/dev/css/hf_style.css" %>" rel="styleSheet" type="text/css">
<SCRIPT language="JavaScript">

	//==================================
   // onPageLoad()
   //==================================
   function onPageLoad()
   {
   	// Set the initial focus
      var oElement = document.getElementById("taskbutton");

      if (oElement != null) // oElement will be null if there are no roles or tasks in the display
      {
      	oElement.focus();
      }
   }

   //==================================
   // setWaitCursor()
   //==================================
   function setWaitCursor()
   {
	   document.body.style.cursor="wait";
   }

   //==================================
   // modifyRoleTasks()
   //==================================
   function modifyRoleTasks(displayName, fullName)
	{
      var roleDisplayName	= displayName;
      var roleFullName		= fullName;

      setWaitCursor();

      document.RoleTaskSummaryForm.elements["SelectedRoleDisplayName"].value=roleDisplayName;
      document.RoleTaskSummaryForm.elements["SelectedRoleFullName"].value=roleFullName;

      document.RoleTaskSummaryForm.elements["merge"].value="fw.ModifyRoleTasks";
      document.RoleTaskSummaryForm.elements["nextState"].value="setupModifyTasksPage";
      document.RoleTaskSummaryForm.submit();
	}

	//==================================
   // modifyRoleAssociations()
   //==================================
	function modifyRoleAssociations(displayName, fullName)
	{
      var roleDisplayName	= displayName;
      var roleFullName		= fullName;

      setWaitCursor();

      document.RoleTaskSummaryForm.elements["SelectedRoleDisplayName"].value=roleDisplayName;
      document.RoleTaskSummaryForm.elements["SelectedRoleFullName"].value=roleFullName;

      document.RoleTaskSummaryForm.elements["merge"].value="fw.ModifyRoleAssociations";
      document.RoleTaskSummaryForm.elements["nextState"].value="setupModifyAssociationsPage";
      document.RoleTaskSummaryForm.submit();
	}

	//==================================
   // modifyRoleAssociations()
   //==================================
	function getRightsReport(fullName)
	{
      document.RoleTaskSummaryForm.elements["SelectedRoleFullName"].value=fullName;
      document.RoleTaskSummaryForm.elements["merge"].value="fw.RoleRightsReport";
      document.RoleTaskSummaryForm.elements["nextState"].value="getRoleRightsReport";
      document.RoleTaskSummaryForm.submit();
   }


</SCRIPT>
</HEAD>
<BODY TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#000000" bgcolor="#FFFFFF" onload="onPageLoad()">
<FORM name="RoleTaskSummaryForm" method=post action="webacc">
   <input type=hidden name="taskId" value="<%= c.var("taskId") %>">
   <input type=hidden name="merge" value="">
   <input type=hidden name="error" value="dev.MooGenErr">
   <input type=hidden name="User.context" value="<%= c.var("User.context") %>">
   <input type=hidden name="nextState" value="">
   <input type=hidden name="SelectedRoleDisplayName" value="">
   <input type=hidden name="SelectedRoleFullName" value="">
   <input type=hidden name="SelfProvisioningRole" value="false">
   <input type=hidden name="RBSAdmin_RoleType" value="iManager">
   <!-- End of hidden tags -->
   
<DIV class="head2"> 
  	<% c.set("TaskHeader.title", c.toHTML(c.string("RoleTaskSummary.ModifyRoles"))); 
      c.set("TaskHeader.helpFile", "base/roletasksummary.html"); 
	   c.set("TaskHeader.HelpWindowWidth", "500"); 
	   c.set("TaskHeader.HelpWindowHeight", "500"); %>
   <jsp:include page='<%= c.getPath("dev/TaskHeader_inc.jsp") %>' flush="true" />
   <BR>
   <TABLE width="100%" border="0" cellpadding="2" cellspacing="0">
      <TR> 																	  
      	<TD width="5%" height="26" class="tablecolumnhead2">&nbsp;</TD>
         <TD width="65%" height="26" class="tablecolumnhead2"><DIV align="left" nowrap><%= c.toHTML(c.string("RoleTaskSummary.RolesAndTasks")) %></DIV></TD>
         <TD width="30%" height="26" class="tablecolumnhead2"><DIV align="left" nowrap><%= c.toHTML(c.string("RoleTaskSummary.RightsAdvisory")) %></DIV></TD>
    	</TR>
    	
      <!-- Load Roles and description -->
      <% if (c.var("OwnedRoles.Count").equals("0")) { %>
      	<TR bgcolor=<%= c.var("color") %>>
         	<TD colspan="7" class="head5" height="2" bgcolor="#EFEEE9" valign="middle" nowrap>&nbsp;<%= c.toHTML(c.string("RoleTaskSummary.NoImanagerRoles")) %></TD>	
         </TR>
      <% } 
         c.set("i", "0"); 
         c.set("color", "#EFEEE9"); 
         while (c.lt(c.var("i"), c.var("OwnedRoles.Count"))) { %>
	      <TR bgcolor=<%= c.var("color") %>> 
	      	<TD width="5%" class="text10px" height="2" bgcolor="#EFEEE9" nowrap>
               <DIV align="left">
               	<a href="#" id="taskbutton" onClick="javascript:modifyRoleTasks('<%= c.toHTML((c.toScript(c.var("Role."+c.var("i")+ ".DisplayName")))) %>','<%= c.toHTML((c.toScript(c.var("Role."+c.var("i")+ ".FullName")))) %>');return false"><IMG src="<%= c.getModulesUrl() + "/fw/images/" + c.string("Button.ModifyTasks.image") %>" alt="<%= c.toHTML(c.string("Button.ModifyTasks.alt")) %>" title="<%= c.toHTML(c.string("Button.ModifyTasks.alt")) %>" width="16" height="16" border="0"></a>
               	<a href="#" onClick="javascript:modifyRoleAssociations('<%= c.toHTML((c.toScript(c.var("Role."+c.var("i")+ ".DisplayName")))) %>','<%= c.toHTML((c.toScript(c.var("Role."+c.var("i")+ ".FullName")))) %>');return false"><IMG src="<%= c.getModulesUrl() + "/fw/images/" + c.string("Button.ModifyRoles.image") %>" alt="<%= c.toHTML(c.string("Button.ModifyMembers.alt")) %>" title="<%= c.toHTML(c.string("Button.ModifyMembers.alt")) %>" width="16" height="16" border="0"></a>
               </DIV>
	      	</TD>
            <TD width="65%" class="head5" height="2" bgcolor="#EFEEE9" align="left" nowrap><%= c.toHTML(c.var("Role."+c.var("i")+ ".DisplayName")) %></TD>
            <TD width="30%" class="head5" height="2"  align="left" bgcolor="#EFEEE9"><a href="#" onClick="javascript:getRightsReport('<%= c.toHTML((c.toScript(c.var("Role."+c.var("i")+ ".FullName")))) %>');return false"><%= c.toHTML(c.string("RoleRightsReport.RightsReport")) %></a></TD>
         </TR>
         
         <!-- Load Tasks for Role -->
         <% c.set("j", "0"); 
            c.set("color", "#FFFFFF"); 
            while (c.lt(c.var("j"), c.var("OwnedRole."+c.var("i")+ ".Tasks.Count"))) { %>
	         <TR> 
			      <TD width="5%" height="2">&nbsp;</TD>
               <TD width="65%" class="smalltext" height="2">&nbsp;&nbsp;&nbsp;&nbsp;<%= c.toHTML(c.var("Role."+c.var("i")+ ".Task."+c.var("j")+ ".DisplayName")) %></TD>
               <TD width="30%" class="smalltext" height="2" align="left">
               <% if (c.var("Role."+c.var("i")+ ".Task."+c.var("j")+ ".SuperAndSecondaryRights").equals("true")) { %>
               	&nbsp;<%= c.toHTML(c.string("RBSManagement.SupervisorySecondary")) %>
               <% } else { 
               	   if (c.var("Role."+c.var("i")+ ".Task."+c.var("j")+ ".SupervisorRights").equals("true")) { %>
               	&nbsp;<%= c.toHTML(c.string("RBSManagement.Supervisory")) %>
                  <% } 
               	   if (c.var("Role."+c.var("i")+ ".Task."+c.var("j")+ ".SecondaryRights").equals("true")) { %>
               	&nbsp;<%= c.toHTML(c.string("RBSManagement.Secondary")) %>
                  <% } 
                  } %>
               </TD>
		    	</TR>
         <% c.inc("j"); 
            } 
   	   c.inc("i"); 
   	   } %>
	</TABLE>
   </FONT>
</DIV>
</FORM>
</BODY></HTML>
