<%!

/**********************************************************************
**
**     SAP AG Walldorf
**     (C) Copyright SAP AG 1999-2010
**
***********************************************************************/

#include "publicincl/tools.inc"

struct icm_adm_status_type
{
  string auth_file;
  string port;
  string host;
  string rhost;
  string hostaddr;
  string rhostaddr;
};
%>

<%
  int user_count;
  int nr, rc;
  string what, browser, fld, is_checked, opstr;
  string user, passwd;
  boolean is_admin;

  struct icm_adm_status_type icm_adm_status;
  struct icm_user_type icm_user_info[];

  is_admin = __icm_get_system_property ("is_admin");
  browser = __icm_get_browser_type();
  what = anumenc(__icm_get_form_field ("what"));

  rc = __icm_adm_hdl (1, icm_adm_status);

  user_count = 0;
  if (rc == 0)
    user_count = __icm_get_user_info(icm_adm_status.auth_file, icm_user_info);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <link rel=stylesheet type="text/css" href="../public/css/controls_<%=browser%>.css">
    <link rel=stylesheet type="text/css" href="../public/css/sapbsp.css">
    <title>HTTP admin handler</title>
    <script type="text/javascript" src="../public/js/bspMenu.js"></script>
    <script language="JavaScript" type="text/javascript">
      <!--
      window.onload = function() {
      }
      document.onclick=bspMenuHide;
      -->
    </script>
  </head>

  <body class="sapBdy">
      <table border="0" cellspacing="0" cellpadding="0" class="sapTbvAlt" width="100%">
	<tr>
	  <td class="sapTbvCellAlt" Colspan="2">
	    <b><i>Web Admin handler</i></b>
	  </td>
	  <td class="sapTbvCellAlt" align="right">
	    <a href="javascript:location.reload()" class="sapBtnEmph" title="refresh page"><nobr>Refresh</nobr></a>
	  </td>
	</tr>
	<tr>
          <td class="sapTbvCellStd">Name of Authentication File:</td>
          <td class="sapTbvCellStd"><%=icm_adm_status.auth_file%></td>
	  <td class="sapTbvCellStd">&nbsp;</td>
	</tr>
	<tr>
          <td class="sapTbvCellStd"> Admin restricted to local port:</td>
          <td class="sapTbvCellStd" Colspan="2">
<%
	if (icm_adm_status.port == "")
	  __output ("&nbsp");
	else
	  __output (icm_adm_status.port);
%>
        </td>
	<tr>
          <td class="sapTbvCellStd">Admin restricted to local host:</td>
          <td class="sapTbvCellStd">
<%
	    if (icm_adm_status.host == "")
		__output ("&nbsp");
	    else
		__output (icm_adm_status.host, "(", icm_adm_status.hostaddr, ")");
%>
          </td>
          <td class="sapTbvCellStd">&nbsp;</td>
	</tr>
	<tr>
          <td class="sapTbvCellStd">Admin restricted to client host:</td>
          <td class="sapTbvCellStd">
<%
	    if (icm_adm_status.rhost == "")
		__output ("&nbsp");
	    else
		__output (icm_adm_status.rhost, "(", icm_adm_status.rhostaddr, ")");
%>
          </td>
          <td class="sapTbvCellStd">&nbsp;</td>
	</tr>
	<tr>
	  <td class="sapTbvCellStd" Colspan="3">&nbsp;</td>
	</tr>
      </table>

    <table border=0 cellspacing=1 cellpadding=0 class="sapTbvAlt" width="100%">
      <tr>
        <td class="sapTbvCellAlt" Colspan=5>
          <b><i>Users in file <%=icm_adm_status.auth_file%></i></b>
        </td>
        <td class="sapTbvCellAlt" align="right" border="0">
<%  if (is_admin) { %>
	  <a accesskey="e" onKeyUp="javascript:callUrlWithKey(event,69,'./user_admin.icp?afile=admin')" 
	     href="./user_admin.icp?afile=admin" class="sapBtnEmph" title="change/add/del user"><u>E</u>dit Users</a>
<% } else __output("&nbsp;"); %>
        </td>
      </tr>
      <tr>
        <th align="left" class="sapTbvCellAlt">
          <i>&nbsp;</i>
        </th>
        <th align="left" class="sapTbvCellAlt">
          <i>Name</i>
        </th>
        <th align="left" class="sapTbvCellAlt">
          <i>Group</i>
        </th>
        <th align="left" class="sapTbvCellAlt" width="500">
          <i>Client Certificate Data</i>
        </th>
        <th align="left" class="sapTbvCellAlt" width="80">
          <i>Password</i>
        </th>
        <th align="left" class="sapTbvCellAlt" width="50">
          <i>Attributes</i>
        </th>
      </tr>
<%
	for (nr = 0; nr < user_count; nr++) {
	  if (icm_user_info[nr].passwd != "x") passwd = "set";
	  else passwd = "none";
%>
      <tr>
	<td class="sapTbvCellStd" nowrap align=left width=2><%=nr%></td>
        <td class="sapTbvCellStd"><%=icm_user_info[nr].user%></td>
        <td class="sapTbvCellStd"><%=icm_user_info[nr].group%></td>
        <td class="sapTbvCellStd"><%=icm_user_info[nr].cert%></td>
        <td class="sapTbvCellStd"><%=passwd%></td>
        <td class="sapTbvCellStd">
<%
          if (icm_user_info[nr].locked)
	    __output("<img src=\"../public/icons/s_s_locl.gif\" alt=\"user is locked\">");
	  else
	    __output("&nbsp;");
%>
	</td>
      </tr>
<%
	}
%>

    </table>
  </body>
</html>

