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

    File:               prs_afdeling.asp
    Description:        dit is de grote 'wrapper' voor de diverse andere schermen

    Parameters:         prs_afdeling

    Context:
    Note:

*/ %>

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

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

  var autfunction = "WEB_PRSUSE";
  var authparams = user.checkAutorisation(autfunction);   //Wat weet ik dan nou van disciplines???
  var afd_key = getQParamInt("key", -1);

  if (afd_key > 0)
  {
        sql = " select niveau, prs_afdeling_naam "
        + "  FROM prs_v_afdeling d"
        + "  WHERE prs_afdeling_key = " + afd_key;

     oRs = Oracle.Execute(sql);

     var afd_naam   = oRs("prs_afdeling_naam").value;
     var afd_niveau = oRs("niveau").value;
  }
  else
  {
    var afd_naam = ""
    var afd_niveau = getQParamInt("afd_niveau");
  }
%>

<html>
  <head>
<%
   FCLTHeader.Generate();
%>
  <script  type="text/javascript" >
      FcltMgr.setTitle(L("lcl_dep_name_level<%=afd_niveau%>") + " " + "<%=safe.jsstring(afd_naam)%>", {hot:false});
<%    if (afd_key == -1) { %>FcltMgr.startEdit(window);<% } %>
      function prsClose(params)
      {
          <% if (afd_key == -1)
             { %>
              if (params.cancel)
              {
                  FcltMgr.closeDetail(window, params );
                  return true;
              }
              if (!params.keepForm)
                  window.location.href = "prs_afdeling.asp?verynew=1&afd_niveau=<%=afd_niveau%>&key=" + params.afd_key;
          <% } else { /* Bestaande afdeling bewerkt, switch naar show-mode */ %>
              if (params.close)
              {
                FcltMgr.closeDetail(window, { close: true})
              }
              if (!params.keepForm)
                  $("#prsFrame")[0].src = "prs_show_afdeling.asp?afd_key=<%=afd_key%>&afd_niveau=<%=afd_niveau%>";
          <% } %>
      }
    </script>
  </head>

<body>
<%
PAGE_START();
if (afd_key == -1)
    var page="prs_edit_afdeling.asp"; // Maak een nieuw
else
    var page="prs_show_afdeling.asp";
page += "?afd_key="+afd_key+"&afd_niveau="+afd_niveau;

IFRAMER("prsFrame", page, { FcltClose: "prsClose", title: L("lcl_prs_afdeling_frame") } );
PAGE_END();
%>
</body>
</html>
<% ASPPAGE_END(); %>
