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

    File:         alg_show_district.asp
    Description:  show mode voor het districten scherm
    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"], js: []})

var dis_key  = getQParamInt("dis_key")
var reg_key

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

var sql = "SELECT * "
        + "  FROM alg_district"
        + " WHERE alg_district_key = " + dis_key;
var oRs = Oracle.Execute(sql);
var dis_deleted = oRs("alg_district_verwijder").value != null;
oRs.Close();
%>

<html>
  <head>
<%  FCLTHeader.Generate(); %>
    <script  type="text/javascript" >
      function dis_change()
      {
        if (FcltMgr.startEdit(window))
          window.location.href = "alg_edit_district.asp?dis_key=<%=dis_key%>"
      }
      function dis_delete()
      {
        if (confirm(L("lcl_alg_del_txt_district")))
        {
            var data = { key: <%=dis_key%>,
                         level: "D"
                       };
            <% protectRequest.dataToken("data"); %>
            $.post("alg_delete.asp",
                   data,
                   FcltCallbackClose,
                   "json");
        }
      }
    </script>
  </head>

  <body id="showbody">
<%  var buttons = [];
    if (!dis_deleted)
    {
      if (this_alg.writeuse || this_alg.writeman)
        buttons.push({title: L("lcl_change"), action:"dis_change()", icon: "wijzigen.png" });
      if (this_alg.writeman) // ALGMAN nodig
        buttons.push({title: L("lcl_delete"), action:"dis_delete()", icon: "delete.png" });
    }

    IFRAMER_HEADER(L("lcl_alg_district_frame"), buttons);
%>
    <div id="show">
<%    if (dis_deleted == 1)
      {
%>      <div class="alg_deleted"><%=L("lcl_record_is_deleted")%></div><%
      }
%>
      <form name=u2 onSubmit="return false;">
<%      BLOCK_START("algInfo", "");
        FCLTplaatsselector(-1,
                           { regiokey: reg_key,
                             districtkey: dis_key,
                             startlevel: 0, // Regio
                             eindlevel: 1, // District
                             readonly: true });
        BLOCK_END();

        generateFlexKenmerkBlock ({ onrgoed_key    : dis_key,
                                   onrgoed_niveau : onrgoedlvl,
                                   reado          : true,
                                   flexcolumns    : S("alg_flexcolumns"),
                                   this_alg       : this_alg });
%>
      </form>
    </div>
  </body>
</html>
