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

    File:         alg_edit_district.asp
    Description:  edit screen voor districten
    Parameters:   dis_key

    Context:
    Note:

*/ %>
<!--#include file="../Shared/common.inc" -->
<!--#include file="../Shared/iface.inc" -->

<!--#include file="../Shared/plaatsselector.inc" -->
<!-- #include file="alg_flexkenmerk.inc" -->
<!-- #include file="alg.inc" -->

<%
FCLTHeader.Requires({plugins:["jQuery", "kenmerk"], js: []})

var dis_key  = getQParamInt("dis_key");

var onrgoedlvl = "D";

var this_alg = alg.func_enabled(dis_key, onrgoedlvl);
user.auth_required_or_abort(this_alg.readman || this_alg.readuse);

if (dis_key > 0)
{
    sql = " select * "
        + "  FROM alg_district "
        + "  WHERE alg_district_key = " + dis_key;

     oRs = Oracle.Execute(sql);

   var dis_oms   = oRs("alg_district_omschrijving").value;

   oRs.Close();
}
%>

<html>
<head>
<%
   FCLTHeader.Generate();
%>
<script>
    function alg_submit()
    {
        document.activeElement.blur(); // trigger laatste onChanges

        if (!validateForm("u2"))
            return false;

        document.forms.u2.submit();

    }
    function alg_cancel()
    {
        FcltMgr.closeDetail(window, { cancel: true } );
    }
</script>
</head>

<body id="editbody">
<%
  var buttons =  [ {title: L("lcl_submit"), action:"alg_submit()", icon: "opslaan.png" },
                   {title: L("lcl_cancel"), action:"alg_cancel()", icon: "undo.png" } ];
  IFRAMER_HEADER(L("lcl_alg_district_frame"), buttons);
%>
<div id="edit">
<form name="u2"
      action="alg_edit_district_save.asp?dis_key=<%=dis_key%>"
      method="post"
      target="hidFrameSubmit"
      onSubmit="alg_submit();">
<%
if (this_alg.writeman)
    manRWFIELD = RWFIELDTR;
else
    manRWFIELD = function (a,b,c,d,e) { ROFIELDTR(b,c,d,e) }; // als geen USE of <self> dan zijn er veel readonly

  BLOCK_START("algInfo", "");
      FCLTplaatsselector(this_alg.authparams("WEB_ALGMAN").ALGwritelevel, {
            districtkey: dis_key,
            startlevel: 0, // Regio
            eindlevel: 0, // Regio
            required: true,
            readonly: !this_alg.writeman
          });

  manRWFIELD("dis_oms",  "fld required", L("lcl_district"),           dis_oms);

  BLOCK_END();

generateFlexKenmerkBlock ({
     onrgoed_key    : dis_key,
     onrgoed_niveau : onrgoedlvl,
     reado          : false,
     flexcolumns    : S("alg_flexcolumns"),
     this_alg       : this_alg
});
IFACE.FORM_END();
%>
</form>
<iframe src="../Shared/empty.html" name="hidFrameSubmit" style="display:none"></iframe>
</div>
</body>
</html>
