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

    File:           alg_gebouw.asp
    Status:
    Description:


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

<%
FCLTHeader.Requires({plugins:["suggest","jQuery"], js: ["jquery-ui.js"]})

var bld_key = getQParamInt("key", -1);
var cnt_full = getQParamInt("cnt_full", 1);

if (bld_key > 0)
{
  var sql = "SELECT alg_gebouw_code, alg_locatie_key, alg_gebouw_x, alg_gebouw_y "
          + "  FROM alg_gebouw "
          + " WHERE alg_gebouw_key = " + bld_key;
  var oRs = Oracle.Execute(sql);
  var bld_name = " " + oRs("alg_gebouw_code").Value;
  var loc_key = oRs("alg_locatie_key").Value;
  var bld_x = oRs("alg_gebouw_x").Value;
  var bld_y = oRs("alg_gebouw_y").Value;
  oRs.Close();
}
else
{
  var bld_name = "";
  var loc_key = -1;
}

%>

<html>
  <head>
<%  FCLTHeader.Generate(); %>
    <script  type="text/javascript" >
      FcltMgr.setTitle(L("lcl_building")+" "+"<%=safe.jsstring(bld_name)%>", {hot:false});

<%    if (bld_key == -1) { %>FcltMgr.startEdit(window);<% } %>
      function algClose(params)
      {
          <% if (bld_key == -1)
             { %>
              if (params.cancel)
              {
                  FcltMgr.closeDetail(window, params );
                  return true;
              }
              if (!params.keepForm)
                  window.location.href = "alg_gebouw.asp?verynew=1&key=" + params.bld_key;
          <% } else { /* Bestaand gebouw bewerkt, switch naar show-mode */ %>
              if (params.close)
              {
                FcltMgr.closeDetail(window, { close: true})
              }
              if (!params.keepForm)
                  $("#algframe")[0].src = "alg_show_gebouw.asp?bld_key=<%=bld_key%>";
          <% } %>
      }
    </script>
  </head>

  <body>
  <% PAGE_START(); %>
<%  if (bld_key == -1)
        var page="alg_edit_gebouw.asp"; // Maak een nieuw
    else
        var page="alg_show_gebouw.asp";
    page += "?bld_key="+bld_key;

    IFRAMER("algframe", page, { title: L("lcl_alg_gebouw_frame"),
                                FcltClose: "algClose" } );

    if (bld_key > -1)
    {
      page0 = "../alg/alg_verdieping_search_list.asp?chkgeb=1&gebouwkey="+bld_key;
      IFRAMER("algverdiepingframe", page0, { icon: "fa-list" } );

      var authparamsCNTUSE = user.checkAutorisation("WEB_CNTUSE", true);
      var authparamsCNTMAN = user.checkAutorisation("WEB_CNTMAN", true);
      var curole = "bo";

      if (!authparamsCNTMAN && authparamsCNTUSE)
        curole = "fe";

      if (authparamsCNTMAN || authparamsCNTUSE)
      {
          var page1 = "../cnt/cnt_search_list.asp?embedded=1&tiny=1&urole=" + curole
                    + "&ffutu=1&fact=1&frap=1&fopz=1&sact=1&bld_key=" + bld_key
                    + "&cnt_full="+cnt_full;
          IFRAMER("cntlistframe", page1, { icon: "fa-list"} );
      }

      if (S("alg_fg_remote_maps") != "" && bld_x && bld_y)
      {
          var page2 = "../cad/ShowGoogleMap.asp?bld_key=" + bld_key;
          IFRAMER("mapsframe", page2, { title: L("lcl_maps"), icon: "fa-map-marker-alt" } );
      }
      // tracking naar subframe :-)
      var autfunction = ["WEB_ALGUSE", "WEB_ALGMAN"];
      var authparams = user.checkAutorisation(autfunction, true);
      if (authparams && authparams.ALGreadlevel <= 3 && authparams.PRSreadlevel < 9)
      {
        page3 = protectQS.create("../shared/status_info.asp?bld_key=" + bld_key);
        IFRAMER("alghistoryframe", page3, { icon: "fa-list", title: L("lcl_tracking")} );
      }

      page4 = "alg_show_note2.asp?alg_key=" + bld_key + "&alg_typ=G";
      IFRAMER("algnoteframe", page4, { refreshOnClose: true, sidebar: true } ); // sidebar heeft geen icon/title nodig

    }
%>
<% PAGE_END(); %>
  </body>
</html>
<% ASPPAGE_END(); %>
