<%!
/* decls */
%>

<%
string appl, browser, what, tracefile, lastControlID;
string action_no, p1, systemID;
boolean error;
string token;
string msg_confirm;

appl = __icm_get_system_property ("app_name");
browser = __icm_get_browser_type();
what = htmlenc(__icm_get_form_field ("what"));
lastControlID = htmlenc(__icm_get_form_field ("lastControlID"));
systemID = htmlenc(__icm_get_form_field ("systemID"));

%>
<!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>Confirm operation</title>
    <script language="JavaScript" type="text/javascript">
      <!--
      function callSubmitActionKey(ev,keycode,what,p1,systemID,token)
      {
      	if (ev.keyCode == keycode) {
      	  callSubmitAction(what,p1,systemID,token);
      	}
      }
      function callUrlWithKey(ev,keycode,url) {
        if (ev.keyCode == keycode) {
          window.location=url;
        }
      }
      function callSubmitAction(what,p1,systemID, token)
      {
	var Form = document['doForm'];
      	Form.what.value = what;
      	Form.p1.value = p1;
      	Form.token.value = token;
      	Form.systemID.value = systemID;
      	Form.submit();
      }
      -->
    </script>
  </head>
  <body class="sapBdy">
    <form action="do_action.icp" name="doForm" method="POST">
    <input type="hidden" name="what" value="">
    <input type="hidden" name="p1" value="">
    <input type="hidden" name="token" value="">
    <input type="hidden" name="lastControlID" value="<%=lastControlID%>">
    <input type="hidden" name="systemID" value="<%=systemID%>">
      <table border="0" cellspacing="0" cellpadding="0" class="sapTbvAlt" width="50%">
	<tr>
	  <td class="sapTbvCellAlt" Colspan="1" align="center">
	    <img src="../public/icons/s_m_crit.gif">
	  </td>
	  <td class="sapTbvCellAlt" Colspan="2" align="center">
	    <b><i>Confirm operation</i></b>
	  </td>
	  <td class="sapTbvCellAlt" Colspan="1" align="center">
	    <img src="../public/icons/s_m_crit.gif">
	  </td>
	</tr>
	<tr>
	  <td class="sapTbvCellStd" Colspan="4">&nbsp;</td>
	</tr>
	<tr>
	  <td class="sapTbvCellStd" Colspan="4">&nbsp;</td>
	</tr>
	<tr>
<%
    if (what == "reset_trace_file") {
	action_no  = "./show_trace.icp?lastControlID=" + lastControlID;
	token = __icm_get_token(2);
	tracefile = __icm_get_param ("icm/trace_file");
	msg_confirm = "Do you really want to reset the trace file (Previous content will be saved in " + tracefile + ".old)?";
    }
    else if (what == "set_trace_level") {
	p1 = htmlenc(__icm_get_form_field ("trc_level"));
	action_no  = "./show_trace.icp?lastControlID=" + lastControlID;
	token = __icm_get_token(1);
	msg_confirm = "Do you really want to set the trace level to " + htmlenc(p1) + "?";
    }
    else if (what == "restart_icm") {
	action_no  = "./monitor.icp?lastControlID=" + lastControlID;
	token = __icm_get_token(3);
	msg_confirm = "Do you really want to restart " + appl + "?";
    }
    else if (what == "shutdown_icm") {
	action_no  = "./monitor.icp?lastControlID=" + lastControlID;
	token = __icm_get_token(3);
	msg_confirm = "Do you really want to shutdown " + appl + "?";
    }
    else if (what == "reinit_icm") {
	action_no  = "./monitor.icp?lastControlID=" + lastControlID;
	token = __icm_get_token(18);
	msg_confirm = "Do you really want to reinitialize " + appl + "?";
    }
    else if (what == "shutdown_wd") {
	action_no  = "./monitor.icp?lastControlID=" + lastControlID;
	token = __icm_get_token(15);
	msg_confirm = "Do you really want to shutdown SAP Web Dispatcher Watchdog (including child processes)?";
    }
    else if (what == "change_maint") {
	action_no  = "./monitor.icp?lastControlID=" + lastControlID;
	p1 = htmlenc(__icm_get_form_field ("p1"));
	if (p1 == "1") {
	  token = __icm_get_token(20);
	  msg_confirm = "Do you really want to enter the maintenance mode?";
        } else {
	  token = __icm_get_token(21);
	  msg_confirm = "Do you really want to leave the maintenance mode?";
	}
    }
    else if (what == "reset_hbuf") {
	action_no  = "./show_htab.icp?lastControlID=" + lastControlID;
	token = __icm_get_token(10);
	msg_confirm = "Do you really want to reset the hostname buffer?";
    }
    else if (what == "reset_peaks") {
	action_no  = "./monitor.icp?lastControlID=" + lastControlID;
	token = __icm_get_token(16);
	msg_confirm = "Do you really want to reset the peak values?";
    }
    else if (what == "reset_tot") {
	action_no  = "./monitor.icp?lastControlID=" + lastControlID;
	token = __icm_get_token(17);
	msg_confirm = "Do you really want to reset the total values?";
    }
    else if (what == "inval_cache") {
	action_no  = "./show_cache.icp?lastControlID=" + lastControlID;
	token = __icm_get_token(104);
	msg_confirm = "Do you really want to invalidate all cache entries?";
    }
    else if (what == "wdisp_purge") {
	p1 = htmlenc(__icm_get_form_field ("timeout"));
	action_no  = "./wdisp_ssl.icp?lastControlID=" + lastControlID;
	token = __icm_get_token(503);
	msg_confirm = "Do you really want to purge outdated SSL entries (timeout= " + p1 + ")?";
    }
    else if (what == "wdisp_session_purge") {
	p1 = htmlenc(__icm_get_form_field ("timeout"));
	action_no  = "./wdisp_session.icp?lastControlID=" + lastControlID;
	token = __icm_get_token(603);
	msg_confirm = "Do you really want to purge outdated session entries (timeout= " + p1 + ")?";
    }
    else if (what == "icm_filter") {
        p1 = htmlenc(__icm_get_form_field ("p1"));
	action_no  = "./show_auth.icp?hdlsel=" + p1 + "&lastControlID=" + lastControlID;
	token = __icm_get_token(24);
	msg_confirm = "Do you really want to perform the filter change?";
    }
    else if (what == "activate_auth") {
        p1 = htmlenc(__icm_get_form_field ("hdlsel"));
	action_no  = "./show_auth.icp?hdlsel=" + p1 + "&lastControlID=" + lastControlID;
	token = __icm_get_token(407);
	msg_confirm = "Do you really want to activate the Access Handler?";
    }
    else if (what == "deactivate_auth") {
        p1 = htmlenc(__icm_get_form_field ("hdlsel"));
	action_no  = "./show_auth.icp?hdlsel=" + p1 + "&lastControlID=" + lastControlID;
	token = __icm_get_token(408);
	msg_confirm = "Do you really want to deactivate the Access Handler?";
    }
    else if (what == "reload_perm") {
        p1 = htmlenc(__icm_get_form_field ("hdlsel"));
	action_no  = "./show_auth.icp?hdlsel=" + p1 + "&lastControlID=" + lastControlID;
	token = __icm_get_token(403);
	msg_confirm = "Do you really want to reload the permission file?";
    }
    else if (what == "reload_filt") {
        p1 = htmlenc(__icm_get_form_field ("hdlsel"));
	action_no  = "./show_auth.icp?hdlsel=" + p1 + "&lastControlID=" + lastControlID;
	token = __icm_get_token(403);
	msg_confirm = "Do you really want to reload the filter rules?";
    }
    else if (what == "activate_cache") {
        p1 = htmlenc(__icm_get_form_field ("hdlsel"));
	action_no  = "./show_cache.icp?hdlsel=" + p1 + "&lastControlID=" + lastControlID;
	token = __icm_get_token(105);
	msg_confirm = "Do you really want to activate the Cache Handler?";
    }
    else if (what == "deactivate_cache") {
        p1 = htmlenc(__icm_get_form_field ("hdlsel"));
	action_no  = "./show_cache.icp?hdlsel=" + p1 + "&lastControlID=" + lastControlID;
	token = __icm_get_token(106);
	msg_confirm = "Do you really want to deactivate the Cache Handler?";
    }
    else if (what == "activate_log") {
        p1 = htmlenc(__icm_get_form_field ("hdlsel"));
	action_no  = "./show_log.icp?hdlsel=" + p1 + "&lastControlID=" + lastControlID;
	token = __icm_get_token(205);
	msg_confirm = "Do you really want to activate the Logging Handler?";
    }
    else if (what == "deactivate_log") {
        p1 = htmlenc(__icm_get_form_field ("hdlsel"));
	action_no  = "./show_log.icp?hdlsel=" + p1 + "&lastControlID=" + lastControlID;
	token = __icm_get_token(206);
	msg_confirm = "Do you really want to deactivate the Logging Handler?";
    }       
    else if (what == "activate_mod") {
        p1 = htmlenc(__icm_get_form_field ("hdlsel"));
	action_no  = "./show_mod.icp?hdlsel=" + p1 + "&lastControlID=" + lastControlID;
	token = __icm_get_token(302);
	msg_confirm = "Do you really want to activate the Modification Handler?";
    }
    else if (what == "deactivate_mod") {
        p1 = htmlenc(__icm_get_form_field ("hdlsel"));
	action_no  = "./show_mod.icp?hdlsel=" + p1 + "&lastControlID=" + lastControlID;
	token = __icm_get_token(303);
	msg_confirm = "Do you really want to deactivate the Modification Handler?";
    }       
    else if (what == "reload_wdisp_conf") {
	action_no  = "./wdisp_host.icp?lastControlID=" + lastControlID + "&systemID=" + systemID;
	token = __icm_get_token(9);
	msg_confirm = "Do you really want to reload Web Dispatcher configuration?";
    }       
    else if (what == "reload_wdisp_group_conf") {
	action_no  = "./wdisp_group.icp?lastControlID=" + lastControlID + "&systemID=" + systemID;
	token = __icm_get_token(9);
	msg_confirm = "Do you really want to reload Web Dispatcher configuration?";
    }       
    else if (what == "NodeDeactivate") {
        p1 = nodeenc(__icm_get_form_field ("p1"));
	action_no  = "./wdisp_host.icp?lastControlID=" + lastControlID + "&systemID=" + systemID;
	token = __icm_get_token(505);
	msg_confirm = "Do you really want to deactivate server " + strtok(p1, ":") + "?";
    }
    else if (what == "NodeActivate") {
        p1 = nodeenc(__icm_get_form_field ("p1"));
	action_no  = "./wdisp_host.icp?lastControlID=" + lastControlID + "&systemID=" + systemID;
	token = __icm_get_token(504);
	msg_confirm = "Do you really want to activate server " + strtok(p1, ":") + "?";
    }
    else if (what == "PoolReset") {
	action_no  = "./wdisp_host.icp?lastControlID=" + lastControlID + "&systemID=" + systemID;
	token = __icm_get_token(507);
	msg_confirm = "Do you really want to reset the peak values?";
    }
    else if (what == "ResetReqCount") {
	action_no  = "./wdisp_host.icp?lastControlID=" + lastControlID + "&systemID=" + systemID;
	token = __icm_get_token(508);
	msg_confirm = "Do you really want to reset the request counter?";
    }
    else
	error = TRUE;

    if (!error) {
%>
	  <td class="sapTbvCellStd" Colspan="4" align="center">
	    <b><i><%=msg_confirm%></i></b>
	  </td>
	</tr>
	<tr>
	  <td class="sapTbvCellStd" Colspan="4">&nbsp;</td>
	</tr>
	<tr>
	  <td class="sapTbvCellStd" Colspan="4">&nbsp;</td>
	</tr>

	<tr>
	  <td class="sapTbvCellStd">&nbsp;</td>
	  <td class="sapTbvCellStd" align="center">
	    <a accesskey="y" onKeyUp="javascript:callSubmitActionKey(event,89,'<%=what%>', '<%=p1%>', '<%=systemID%>', '<%=token%>')" href="javascript:callSubmitAction('<%=what%>', '<%=p1%>', '<%=systemID%>', '<%=token%>')" class="sapBtnStd">
	      <nobr><u>Y</u>es</nobr></a>
	  </td>
	  <td class="sapTbvCellStd" Colspan="1" align="center">
	    <a accesskey="n" onKeyUp="javascript:callUrlWithKey(event,78,'<%=action_no%>')" href="<%=action_no%>" class="sapBtnEmph">
	      <nobr><u>N</u>o</nobr></a>
	  </td>
	  <td class="sapTbvCellStd">&nbsp;</td>
	</tr>
      </table><p>
<%
   }
   else {
%>
	<tr>
	  <td class="sapTbvCellAlt" Colspan="1" align="center">
	    <img src="../public/icons/s_m_erro.gif">
	  </td>
	  <td class="sapTbvCellAlt" Colspan="2" align="center">
	    <b><i>A runtime error occured</i></b>
	  </td>
	  <td class="sapTbvCellAlt" Colspan="1" align="center">
	    <img src="../public/icons/s_m_erro.gif">
	  </td>
	</tr>
	<tr>
	  <td class="sapTbvCellStd" Colspan="4">&nbsp;</td>
	</tr>
	<tr>
	  <td class="sapTbvCellStd" Colspan="4">&nbsp;</td>
	</tr>
	<tr>
	  <td class="sapTbvCellStd" Colspan="4" align="center">
	    <b><i>Illegal or empty operation: <%= htmlenc(what) %></i></b>
	  </td>
	</tr>
	<tr>
	  <td class="sapTbvCellStd" Colspan="4">&nbsp;</td>
	</tr>
	<tr>
	  <td class="sapTbvCellStd" Colspan="4">&nbsp;</td>
	</tr>
      </table><p>

      <span align="center">
	<a href="./monitor.icp" class="sapBtnStd">
	  <nobr>Back to monitor page</nobr></a>
      </span><br>
<%
   }
%>
    </form>
  </body>
</html>
