<%@  page pageEncoding="utf-8" contentType="text/html;charset=utf-8" import="com.novell.emframe.fw.authenticator.DirAuthenticator" %>
<%@ page import="com.novell.emframe.fw.studio.StudioPluginInfo" %>
<%@ page import="java.util.*" %>
<%@ page import="com.novell.emframe.dev.dataTable.*" %>
<%@ page import="com.novell.emframe.dev.eMFrameUtils" %>
<%@ page import="com.novell.emframe.dev.MContext" %>
<%@ page import="com.novell.emframe.dev.eMFrameFactory" %>
<%@ page import="com.novell.application.console.snapin.ObjectEntry" %>
<%@ page import="java.util.Enumeration" %>
<%@ page import="com.novell.application.console.snapin.ObjectEntryEnumeration" %>
<%@ page import="com.novell.admin.ns.nds.NDSNamespace" %>
<%@ page import="com.novell.webaccess.common.JSPConduit"%>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/iman.tld" prefix="iman" %>
<iman:stringtable bundle="DevResources"/>
<iman:stringtable bundle="FwResources"/>
<iman:osScripts/>
<iman:eMFrameScripts/>
<iman:dialogScripts/>
<iman:dataTableScripts/>
<iman:stylesheet/>


<%
   response.setContentType("text/xml; charset=UTF-8");
   response.setHeader("Cache-Control", "no-cache");

    // Data
     DirAuthenticator dirAuth = DirAuthenticator.getDirAuth(request);
     Hashtable authBrokers = dirAuth.getAuthenticationBrokers();
     TableCell[][] data = new TableCell[authBrokers.size()][];
     Enumeration authBrokerEnum = authBrokers.keys();
     
     int i=0;
     while(authBrokerEnum.hasMoreElements())
     {
        String authBrokerKey = (String)authBrokerEnum.nextElement();
        StringTokenizer stok = new StringTokenizer(authBrokerKey,":");
        String treename = (String)stok.nextElement();
        String username = (String)stok.nextElement();
        String protocol = (String)stok.nextElement();
        String rank = (String)stok.nextElement();
        data[i] = new TableCell[4];
        
        data[i][0] = new TextTableCell(username, username);
        data[i][1] = new TextTableCell(treename, treename);
        data[i][2] = new TextTableCell(protocol, protocol);
        data[i][3] = new TextTableCell(rank, rank);
        i++;
     }
     request.setAttribute("data", data);
 
%>
<iman:stringtable bundle="FwResources"/>
<iman:stringtable bundle="DevResources"/>
<iman:dataTableScripts/>
<iman:stylesheet/>
<script>
function authenticationsListEventHandler(menuItemId, selectedIndices, tableData)
{
   if(menuItemId=="New")
   {
      activateImanDialog('authenticate');
   }
}
</script>
<iman:dataTable id="authenticationTable" titleKey="AuthenticationsList.Title" tableData="${data}" menuActionHandler="authenticationsListEventHandler" width="500">

	<iman:menuItem textKey="General.New" id="New"/>
	<iman:menuItem textKey="General.Delete" id="Delete"/>
	 
   <iman:columnHeader textKey="AuthenticationsList.Name"/>
   <iman:columnHeader textKey="AuthenticationsList.Tree"/>
	<iman:columnHeader textKey="AuthenticationsList.Protocol"/>
   <iman:columnHeader textKey="AuthenticationsList.Rank"/>
</iman:dataTable>

<iman:dialog border="0"closeButton="false" id="authenticate" width="500" height="500" dialogColor="#ffffff" titleBarColor="#458ab9">      
      <iman:dirAuthentication callback="myCallback" initCallbackOnSuccess="true" closeButton="true" rank="secondary" />
</iman:dialog>
