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

    File:           alg_verdieping.asp
    Description:    Verdieping wrapper

    Parameters:

    Context:
    Note:

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

<%
FCLTHeader.Requires({plugins:["jQuery", "suggest"],
                         js: ["jquery-ui.js"],
                         css: [] // css voor plaatselector in alg_edit_verdieping
                    })

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

if (flr_key > 0)
{
    sql = "SELECT g.alg_gebouw_code, "
        + "       v.alg_verdieping_omschrijving "
        + "  FROM alg_gebouw g, "
        + "       alg_verdieping v "
        + " WHERE v.alg_verdieping_key = " + flr_key
        + "   AND v.alg_gebouw_key = g.alg_gebouw_key ";

   oRs = Oracle.Execute(sql);

   var bld_code = oRs("alg_gebouw_code").value;
   var flr_oms = oRs("alg_verdieping_omschrijving").value;

   var floor_name   = " " + bld_code + "-" + flr_oms;
}
else
{
  var floor_name = "";
}
%>

<html>
  <head>
<%  FCLTHeader.Generate();
%>
    <script  type="text/javascript" >
      FcltMgr.setTitle(L("lcl_floor")+" "+"<%=safe.jsstring(floor_name)%>", {hot: false});
<%    if (flr_key == -1) { %>FcltMgr.startEdit(window);<% } %>
      function algClose(params)
      {
          <% if (flr_key == -1)
             { %>
              if (params.cancel)
              {
                  FcltMgr.closeDetail(window, params );
                  return true;
              }
              if (!params.keepForm)
                window.location.href = "alg_verdieping.asp?key=" + params.flr_key;
          <% } else { /* Bestaande verdieping bewerkt, switch naar show-mode */ %>
              if (params.close)
              {
                FcltMgr.closeDetail(window, { close: true})
              }
              if (!params.keepForm)
                $("#algverdframe")[0].src = "alg_show_verdieping.asp?flr_key=<%=flr_key%>";
          <% } %>
      }
    </script>
  </head>

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

  IFRAMER("algverdframe", page, { FcltClose: "algClose" } );

  if (flr_key > -1)
  {
    page0 = "../alg/alg_ruimte_search_list.asp?chkgeb=1&verdiepingkey="+flr_key;
    IFRAMER("algruimteframe", 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)
    {
      // vind dit dubieus maar ga het nu niet uitzoeken: we geven statusflags mee, cnt_search_list heeft zelf defaults en cnt_full overruled
      // dat. Die statusparameters kunnen vast weggemanaged worden, maar met cnt_full=0 hebben ze wel (gewenst) effect.
      var page2="../cnt/cnt_search_list.asp?tiny=1&urole=" + curole + "&ffutu=1&fact=1&frap=1&fopz=1&sact=1&flr_key="+ flr_key;
      page2 += "&cnt_full="+cnt_full;
      IFRAMER("cntlistframe", page2, { icon: "fa-list" } );
    }
    // tracking naar subframe :-)
    var autfunction = ["WEB_ALGUSE", "WEB_ALGMAN"];
    var authparams = user.checkAutorisation(autfunction, true);
    if (authparams && authparams.ALGreadlevel <= 4 && authparams.PRSreadlevel < 9)
    {
      page3 = protectQS.create("../shared/status_info.asp?flr_key=" + flr_key);
      IFRAMER("alghistoryframe", page3, { icon: "fa-list", title: L("lcl_tracking")} );
    }
  }

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