<%!
/* */
%>

<%
int i, line_no, rc;
int line_count = 0;
int size, ftype, options;
int trace_level;
string browser, formfld, header, trace_file, filter, lastControlID;
string sel_tab[];
string ltab[];
boolean is_admin;
boolean show_lineno;

is_admin = __icm_get_system_property ("is_admin");
browser = __icm_get_browser_type();
lastControlID = htmlenc(__icm_get_form_field ("lastControlID"));
filter = filterenc(urldec(__icm_get_form_field ("filter")));
show_lineno = __icm_get_form_field ("slineno");
formfld = anumenc(__icm_get_form_field ("line_no"));
if (formfld != "")
  line_no = formfld;

ftype = __icm_get_form_field ("ftype");
formfld = __icm_get_form_field ("onInputProcessing");
if (formfld == "outleft")
  line_no = 0;
else if (formfld == "left"){
  line_no -= 500; if (line_no < 0) line_no = 0;
} else if (formfld == "right")
  line_no += 500;
else if (formfld == "outright")
  line_no = -500;

trace_level = __icm_get_system_property ("trace_level");
trace_file = __icm_get_system_property ("trace_file");
sel_tab[trace_level] = "selected";

options = 0;
if (ftype) options = 1;
if (show_lineno) options = options | 4;
line_count = __icm_get_trace_lines (line_no, filter, ltab, size, options);
%>

<!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>Trace File</title>
    <script type="text/javascript" src="../public/js/bspMenu.js"></script>
    <script language="JavaScript" type="text/javascript">
      <!--
      function restoreFocus(lastControlID) {
        if (lastControlID != '') {
	  var lastUsedControl=document.getElementById(lastControlID);
	  if (lastUsedControl != null && lastUsedControl.className != 'bspMenuBox') {
	    lastUsedControl.focus();
	  }
        }
      }
      function callSubmitAction(form,value,lastControlID)
      {
	var Form = document[form];
      	Form.onInputProcessing.value = value;
      	Form.lastControlID.value = lastControlID;
      	Form.submit();
      }
      function callGotoAction(form,value)
      {
	var Form = document[form];
      	Form.line_no.value = value;
      	Form.submit();
      }
      function callLineFilterAction(form,lastControlID) {
        var Form = document[form];
        Form.lastControlID.value = lastControlID;
        Form.submit();
      }
      function callSubmitConfirmCombo(value,lastControlID)
      {
        var Form = document['lvlForm'];
        if (Form.trcLevel.value.length>0){
	    document.lvlForm.what.value = value;
            document.lvlForm.trc_level.value = Form.trcLevel.value;
            document.lvlForm.lastControlID.value = lastControlID;
            document.lvlForm.submit();
        }
      }

      window.onload = function() {
        initializeMenu ("TrcFileMenu", "trcFileObj");
        initializeMenu ("TrcFileMenu2", "trcFileObj2");
        restoreMenuFocus('<%=lastControlID%>');
      }
      document.onclick=bspMenuHide;
      -->
    </script>
  </head>
  <body class="sapBdy">
      <div id="TrcFileMenu" class="bspMenuBox" onMouseover="bspMenuHighlight(event)" onMouseout="bspMenuUnHighlight(event)" onClick="bspMenuSelect(event,'TrcFileMenu')" display:none>
      <div><%=trace_file%>:</div>
      <div title="Reset" class="bspMenuItem" url="./confirm.icp?what=reset_trace_file">Reset</div>
      <div title="Download" class="bspMenuItem" url="../download?ftype=0">Download</div>

<%
	if (show_lineno == 0) {
%>
      <div title="Show line numbers" class="bspMenuItem" url="./show_trace.icp?slineno=1">Show line numbers</div>
<%
	} else {
%>
      <div title="Hide line numbers" class="bspMenuItem" url="./show_trace.icp?slineno=0">Hide line numbers</div>

<%
	} 
%>

      <hr>
<%
	if (ftype == 0) {
%>
      <div title="Show dev_icmbnd" class="bspMenuItem" url="./show_trace.icp?ftype=1">Show dev_icmbnd</div>
<%
	} else {
%>
      <div title="Show <%=trace_file%>" class="bspMenuItem" url="./show_trace.icp?ftype=0">Show <%=trace_file%></div>
<%
	} 
%>

      <hr>
      <div title="Close Menu" class="bspMenuItem">Close Menu</div>
      </div>
      
      <div id="TrcFileMenu2" class="bspMenuBox" onMouseover="bspMenuHighlight(event)" onMouseout="bspMenuUnHighlight(event)" onClick="bspMenuSelect(event,'TrcFileMenu2')" display:none>
            <div><%=trace_file%>:</div>
            <div title="Reset" class="bspMenuItem" url="./confirm.icp?what=reset_trace_file">Reset</div>
            <div title="Download" class="bspMenuItem" url="../download?ftype=0">Download</div>
      
<%
      if (show_lineno == 0) {
%>
            <div title="Show line numbers" class="bspMenuItem" url="./show_trace.icp?slineno=1">Show line numbers</div>
<%
      } else {
%>
            <div title="Hide line numbers" class="bspMenuItem" url="./show_trace.icp?slineno=0">Hide line numbers</div>
      
<%
      } 
%>
      <hr>
<%
      if (ftype == 0) {
%>
         <div title="Show dev_icmbnd" class="bspMenuItem" url="./show_trace.icp?ftype=1">Show dev_icmbnd</div>
<%
      } else {
%>
        <div title="Show <%=trace_file%>" class="bspMenuItem" url="./show_trace.icp?ftype=0">Show <%=trace_file%></div>
<%
      } 
%>
      
    <hr>
    <div title="Close Menu" class="bspMenuItem">Close Menu</div>
    </div>
      

    <table border=0 cellspacing=1 cellpadding=0 class="sapTbvAlt" width="100%" rules="rows">
    <form action="confirm.icp" name="lvlForm" method="POST">
    <input type="hidden" name="what" value="">
    <input type="hidden" name="ftype" value="<%=ftype%>">
    <input type="hidden" name="trc_level" value="<%=trace_level%>">
    <input type="hidden" name="lastControlID" value="<%=lastControlID%>">
    <tr>
      <td class="sapTbvCellAlt" style="white-space:nowrap;">
        <a name="page_top"></a>
<%
	if (is_admin) {
%>
	<a title="Trace File Menu" accesskey="t" href="javascript:void(0);" id="trcFileObj" class="sapBtnStd" onClick="bspMenuMainAction('TrcFileMenu',event,this,84)" onKeyUp="bspMenuMainAction('TrcFileMenu',event,this,84)">
	  <b><i><u>T</u>race File</i>&nbsp;<img border=0 src="../public/images/cmenu/Triangle.gif" alt=""></b></a>
<%
	} else __output ("<i>Trace File</i>");
%>
	&nbsp; (<%=size%>bytes)
      </td>
      <td class="sapTbvCellAlt" align="center">
<%
	if (ftype == 0) {
%>
	<nobr>
	  <label for="trcLevelBox">Trace Level</label>:<nobr>
<%
	if (is_admin) {
%>
	  <select title="Trace Level" name="trcLevel" class="sapDdlWhl" id="trcLevelBox"
	    onChange="callSubmitConfirmCombo('set_trace_level','trcLevelBox');">
	    <option value="0" <%=sel_tab[0]%>>0</option>
	    <option value="1" <%=sel_tab[1]%>>1</option>
	    <option value="2" <%=sel_tab[2]%>>2</option>
	    <option value="3" <%=sel_tab[3]%>>3</option>
	  </select>
<%
	} else __output (trace_level);
	}
%>
        </nobr>
      </td>
    </form>
    <form action="show_trace.icp" name="traceFormA" method="POST">
      <input type="hidden" name="onInputProcessing" value="">
      <input type="hidden" name="lastControlID" value="<%=lastControlID%>">
      <input type="hidden" name="ftype" value="<%=ftype%>">
      <td class="sapTbvCellAlt" align="center"><label for="line_no1">Line</label>:
          <input title="Line" type="text" class="sapEdfTxtEnbl" id="line_no1" name="line_no" size="3" value="<%= line_no %>"> <label for="filter1">Filter</label>:
          <input title="Filter" type="text" class="sapEdfTxtEnbl" id="filter1" name="filter" size="12" value="<%=filter %>">
          <!--
          <input type="submit" class="sapBtnStd" name="send" value="Display">
          -->
          <a id="FilterButton" href="javascript:callLineFilterAction('traceFormA','FilterButton')" class="sapBtnStd">Display</a>
      </td>
      <td class="sapTbvCellAlt" align="center">
        <nobr>
          <a id="outleftPager" href="javascript:callSubmitAction('traceFormA', 'outleft','outleftPager')"><nobr><img width=15 height=15 src="../public/images/hbrowser/outleft.gif" BORDER=0 title="first page" alt=""></nobr></a>
          <a id="leftPager" href="javascript:callSubmitAction('traceFormA', 'left','leftPager')"><nobr><img width=15 height=15 src="../public/images/hbrowser/left.gif" BORDER=0 title="previous page" alt=""></nobr></a>
          <a id="rightPager" href="javascript:callSubmitAction('traceFormA', 'right','rightPager')"><nobr><img width=15 height=15 src="../public/images/hbrowser/right.gif" BORDER=0 title="next page" alt=""></nobr></a>
          <a id="outrightPager" href="javascript:callSubmitAction('traceFormA', 'outright','outrightPager')"><nobr><img width=15 height=15 src="../public/images/hbrowser/outright.gif" BORDER=0 title="last page" alt=""></nobr></a>
      </td>
      <td class="sapTbvCellAlt" align="center">
        <nobr>
          <a href="#page_top"><nobr><img width=15 height=15 src="../public/images/tableview/top_off.gif" BORDER=0 title="Top of page" alt=""></nobr></a>
          <a href="#page_bottom"><nobr><img width=15 height=15 src="../public/images/tableview/bottom.gif" BORDER=0 title="Bottom of page" alt=""></nobr></a>
      </td>
    </tr>
    </form>
    <form action="show_trace.icp" name="traceFormTxt" method="POST">
      <input type="hidden" name="ftype" value="<%=ftype%>">
      <input type="hidden" name="line_no" value="">
    <tr>
      <td class="sapTbvCellStdTT" colspan="5">
<%
    for (i = 0; i < line_count; i++)
    {
	__output(ltab[i],"<br>");
    }
%>
      </td>
    </tr>
    </form>
    <form action="show_trace.icp" name="traceFormB" method="POST">
      <input type="hidden" name="onInputProcessing" value="">
      <input type="hidden" name="lastControlID" value="<%=lastControlID%>">
      <input type="hidden" name="ftype" value="<%=ftype%>">
    <tr>
      <td class="sapTbvCellAlt">
      <a name="page_bottom"></a>
	<a title="Trace File Menu" href="javascript:void(0);" id="trcFileObj2" class="sapBtnStd" onKeyUp="bspMenuMainAction('TrcFileMenu2',event,this)" onClick="bspMenuMainAction('TrcFileMenu2', event, this);">
	  <b><i>Trace File</i>&nbsp;<img border=0 src="../public/images/cmenu/Triangle.gif" alt=""></b><br></a>
	&nbsp; (<%=size%>bytes)
      </td>
      <td class="sapTbvCellAlt" align="center">&nbsp;</td>
      <td class="sapTbvCellAlt" align="center"><label for="line_no2">Line</label>:
          <input title="Line" type="text" class="sapEdfTxtEnbl" id="line_no2" name="line_no" size="3" value="<%=line_no%>"><label for="filter2">Filter</label>:
          <input title="Filter" type="text" class="sapEdfTxtEnbl" id="filter2" name="filter" size="12" value="<%=filter %>">
          <input type="submit" class="sapBtnStd" name="send" value="Display">
      </td>
      <td class="sapTbvCellAlt" align="center">
        <nobr>
          <a id="outleftPager2" href="javascript:callSubmitAction('traceFormB', 'outleft','outleftPager2')"><nobr><img width=15 height=15 src="../public/images/hbrowser/outleft.gif" BORDER=0 title="first page" alt=""></nobr></a>
          <a id="leftPager2" href="javascript:callSubmitAction('traceFormB', 'left','leftPager2')"><nobr><img width=15 height=15 src="../public/images/hbrowser/left.gif" BORDER=0 title="previous page" alt=""></nobr></a>
          <a id="rightPager2" href="javascript:callSubmitAction('traceFormB', 'right','rightPager2')"><nobr><img width=15 height=15 src="../public/images/hbrowser/right.gif" BORDER=0 title="next page" alt=""></nobr></a>
          <a id="outrightPager2" href="javascript:callSubmitAction('traceFormB', 'outright','outrightPager2')"><nobr><img width=15 height=15 src="../public/images/hbrowser/outright.gif" BORDER=0 title="last page" alt=""></nobr></a>
      </td>
      <td class="sapTbvCellAlt" align="center">
        <nobr>
          <a href="#page_top"><nobr><img width=15 height=15 src="../public/images/tableview/top.gif" BORDER=0 title="Top of page" alt=""></nobr></a>
          <a href="#page_bottom"><nobr><img width=15 height=15 src="../public/images/tableview/bottom_off.gif" BORDER=0 title="Bottom of page" alt=""></nobr></a>
      </td>
    </tr>
    </form>
    </table>
  <script language="JavaScript" type="text/javascript">
    <!--
    restoreFocus('<%=lastControlID%>');
    -->
  </script>
  </body>
</html>
