<%!
struct icm_http_subhdl
{
  boolean active;
  string name;
  int    type;
  int    flags;
  int    param_idx;

  string param_prefix;
  string url_prefix;
};
struct icm_mod_info_type
{
  boolean active;
  string file;
  string format;
  int maxsize;
  int switcht;
  int fsize;
  int lcount;
};
%>

<%
  int i, count, rc;
  int line_count = 0;
  string hdlsel, what, browser, lastControlID;
  string rules[];
  boolean is_admin;

  string tab_hdlsel[];
  struct icm_http_subhdl icm_subhdl_tab[];
  struct icm_mod_info_type icm_mod_info;

  is_admin = __icm_get_system_property ("is_admin");
  browser = __icm_get_browser_type();
  lastControlID = __icm_get_form_field ("lastControlID");

  count = __icm_http_hdl (2,icm_subhdl_tab,13);
  for (i = 0; i < count; i++) {
    tab_hdlsel[i] = "";
  }

  hdlsel = anumenc(__icm_get_form_field ("hdlsel"));
  if (hdlsel != "")
    tab_hdlsel[hdlsel] = "selected";

  rc = __icm_mod_hdl (1,hdlsel,icm_mod_info);
  if (rc == 0)
    line_count = __icm_mod_hdl (4,hdlsel,rules);
%>
<!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 Request Modification Handler</title>
    <script type="text/javascript" src="../public/js/bspMenu.js"></script>
    <script language="JavaScript" type="text/javascript">
      <!--
      window.onload = function() {
        initializeMenu ("activeMenu", "activeObj");
        restoreMenuFocus('<%=lastControlID%>');
      }
      document.onclick=bspMenuHide;
      -->
    </script>
    <script language="JavaScript" type="text/javascript">
        <!--
	function callSubmitCombo(form)
	{
	  var Form = document[form];
      	  Form.submit();
	}
      	//-->
    </script>
  </head>

  <body class="sapBdy">
     <form action="" method="GET" name="FormHdl">
      <div id="activeMenu" class="bspMenuBox" onMouseover="bspMenuHighlight(event)" onMouseout="bspMenuUnHighlight(event)" onClick="bspMenuSelect(event,'activeMenu')" display:none>
<%
if (icm_mod_info.active) {     
%>
      <div title="Deactivate Handler" class="bspMenuItem" url="./confirm.icp?what=deactivate_mod&amp;hdlsel=<%=hdlsel%>">Deactivate Handler</div>
      <hr>
      <div title="Close Menu" class="bspMenuItem">Close Menu</div>
<%
} else {
%>
      <div title="title="Activate Handler"" class="bspMenuItem" url="./confirm.icp?what=activate_mod&amp;hdlsel=<%=hdlsel%>">Activate Handler</div>
      <hr>
      <div title="Close Menu" class="bspMenuItem">Close Menu</div>
<%
}
%>
      </div>
      
      <table border="0" cellspacing="0" cellpadding="0" class="sapTbvAlt" width="100%">
	<tr>
          <td class="sapTbvCellAlt" Colspan="2">
	   <b><i><label for="hdlsel">Request Modification Handler</label> for &nbsp;
	    <select title="Modification Handler" id="hdlsel" name="hdlsel" class="sapDdlStd"
	      onChange="callSubmitCombo('FormHdl');">
<%
	if (count == 0)
	  __output("<option value=\"0\">icm/HTTP/mod_0</option>");
	for (i = 0; i < count; i++) {
%>
	    <option value="<%=i%>" <%=tab_hdlsel[i]%>>icm/HTTP/mod_<%=i%></option>
<%
	}
%>
	    </select>
	   </i></b>
          </td>
	  <td class="sapTbvCellAlt" align="right">
	    <a href="javascript:parent.frames['main'].location.reload()" class="sapBtnEmph" title="refresh page"><nobr>Refresh</nobr></a>
	  </td>
	</tr>
	<tr>
	  <td class="sapTbvCellStd">Modification Handler Status</td>
	  <td class="sapTbvCellStd">
<%
if (icm_mod_info.active) {
  if (is_admin) {
	    __output("<a title=\"Modification Handler Status Menu\" href=\"javascript:void(0);\" id=\"activeObj\" class=\"sapBtnStd\" onKeyUp=\"bspMenuMainAction('activeMenu', event, this);\" onClick=\"bspMenuMainAction('activeMenu', event, this);\"><i>active</i>");
	    __output("&nbsp;<img border=\"0\" src=\"../public/images/cmenu/Triangle.gif\" alt=\"\"></a>");
  } else {
	    __output("<i>active</i>");
  }
	    __output(" <img title=\"green\" alt=\"green\" src=\"../public/icons/s_s_tl_g.gif\" alt=\"\">");
} else {
  if (is_admin) {
	    __output("<a title=\"Modification Handler Status Menu\" href=\"javascript:void(0);\" id=\"activeObj\" class=\"sapBtnStd\" onKeyUp=\"bspMenuMainAction('activeMenu', event, this);\" onClick=\"bspMenuMainAction('activeMenu', event, this);\"><i>inactive</i>");
	    __output("&nbsp;<img border=\"0\" src=\"../public/images/cmenu/Triangle.gif\" alt=\"\"></a>");
  } else {
	    __output("<i>inactive</i>");
  }
	    __output(" <img title=\"red\" alt=\"red\" src=\"../public/icons/s_s_tl_r.gif\" alt=\"\">");
}
%>
	  </td>
	  <td class="sapTbvCellStd">&nbsp;</td>
	</tr>
	<tr>
          <td class="sapTbvCellStd">Name of rule File:</td>
          <td class="sapTbvCellStd"><%=icm_mod_info.file%></td>
          <td class="sapTbvCellStd">&nbsp;</td>
	</tr>
	<tr>
          <td class="sapTbvCellStd">URL Prefix for this Handler:</td>
          <td class="sapTbvCellStd"><%=icm_subhdl_tab[hdlsel].url_prefix%></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=3>
            <b><i>HTTP Modification Rules</i></b>
          </td>
        </tr>
	<tr>
          <td class="sapTbvCellStdTT" colspan="3">
<%
    for (i = 0; i < line_count; i++)
    {
	__output(rules[i],"<br>");
    }
%>
          </td>
	</tr>
      </table>
    </form>
  </body>
</html>

