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

    File:         alg_wp.asp
    Description:  Wrapper for alg_show_wp.asp/alg_edit_wp.asp

    Parameters:

    Context:
    Note:

*/ %>

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

<%
FCLTHeader.Requires({plugins:["suggest","jQuery"], js: ["jQuery-ui.js"]})
// jQuery-ui.js is nodig in het child formulier prs_perslidwerkplek_search_list

var wp_key = getQParamInt("key", -1);
var room_key = getQParamInt("room_key", -1);

var wp_naam = "";
if (wp_key > 0)
{
  var sql = "SELECT prs_werkplek_aanduiding "
          + "  FROM prs_v_werkplek_gegevens "
          + " WHERE prs_werkplek_key = " + wp_key;

  var oRs = Oracle.Execute(sql);
  wp_naam = oRs("prs_werkplek_aanduiding").value;
}
%>
<html>
  <head>
<%  FCLTHeader.Generate();
%>
    <script  type="text/javascript" >
      FcltMgr.setTitle("<%=L("lcl_workplace")+' '+safe.jsstring(wp_naam)%>", {hot: false});
<%    if (wp_key == -1) { %>FcltMgr.startEdit(window);<% } %>
      function algClose(params)
      {
          <% if (wp_key == -1)
             { %>
              if (params.cancel)
              {
                  FcltMgr.closeDetail(window, params );
                  return true;
              }
              if (!params.keepForm)
                  window.location.href = "alg_wp.asp?verynew=1&key=" + params.wp_key;
          <% } else { /* Bestaande werkplek bewerkt, switch naar show-mode */ %>
              if (params.close)
              {
                FcltMgr.closeDetail(window, { close: true})
              }
              if (!params.keepForm && !params.deleted)
                  $("#algFrame")[0].src = "alg_show_wp.asp?wp_key=<%=wp_key%>";
          <% } %>
      }
    </script>
  </head>

  <body>
<%  if (wp_key == -1)
        var page="alg_edit_wp.asp"; // Maak een nieuw
    else
        var page="alg_show_wp.asp";
    page += "?wp_key="+wp_key+"&room_key="+room_key;

    IFRAMER("algFrame", page, { title: L("lcl_alg_wp_frame"),
                                initHeight: "450px",
                                FcltClose: "algClose" } );
    if (wp_key > -1)
    {
      var page2 ="../prs/prs_perslidwerkplek_search_list.asp?embedded=1&wp_key=" + wp_key;
      IFRAMER("algFrame", page2, { initHeight: "450px" } );

      var page3 ="../ins/ins_search_list.asp?urole=bo&tiny=1&werkplekkey=" + wp_key;
      IFRAMER("algFrame", page3, { initHeight: "450px" } );
    }
%>
  </body>
</html>
