<%@ language="javascript"%>
<% /*
     $Revision$
     $Id$

    File:               ins_state_history_add.asp
    Description:        Add a new state to the history of a sensor
    Parameters:
    Context:            From ins_state_hisotry_add.asp
    Note:

*/ %>

<!-- #include file="../Shared/common.inc"-->
<!-- #include file="../shared/save2db.inc" -->
<!-- #include file="./ins.inc" -->

<%
protectRequest.validateToken();
FCLTHeader.Requires()

var ins_key = getFParamInt("ins_key");

authparams = user.checkAutorisation("WEB_PRSSYS");
%>

<html>
  <head>
<%
    FCLTHeader.Generate();
%>
  </head>
  <body>
<%
  // Deze velden altijd opslaan
  var fields = [ { dbs: "ins_deel_state",     typ: "varchar",  frm: "state",    track: L("lcl_ins_sensor_value") } ];

  var insUpd = buildTrackingUpdate("ins_deel", " ins_deel_key = " + ins_key, fields);

  /* SUBMIT THE CHANGED DATA */
  var err = Oracle.Execute(insUpd.sql, true);
  if (err.friendlyMsg)
    abort_with_warning(err.friendlyMsg);

  if (insUpd.trackarray.length)
    ins.trackdeelupdate(ins_key, L("lcl_ins_sensor_simulatie") + "\n" + insUpd.trackarray.join("\n"));
%>
    <script>
      FcltMgr.closeDetail(window, {succes : true} );
    </script>
  </body>
</html>
<% ASPPAGE_END(); %>
