<%@ LANGUAGE="JavaScript" %>
<% /*
     $Revision$
     $Id$

    File:               bes_select_discipline.asp
    Description:        Vraag om een discipline (catalogus) die je in mag voeren

    Parameters:
    Context:            Vanuit bes_bestelling.asp als geen discipline meegegeven
    Note:

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

<%
  FCLTHeader.Requires({ plugins:[] });

// AUTORISATIEPARAMETERS
//   var urole = getQParamSafe("urole");

    sql = "SELECT ins_discipline_key"
        + ", "+ lcl.xsqla('ins_discipline_omschrijving','d.ins_discipline_key')
        + ",      bes_disc_params_logo_url"
        + ",      bes_disc_params_punchouturl"
        + "  FROM bes_v_aanwezigdiscipline d"
        + ",      bes_disc_params dp"
        + " WHERE d.ins_discipline_key = dp.bes_ins_discipline_key"
        + "   AND ins_discipline_key IN ("
	       + " SELECT ins_discipline_key"
	       + "   FROM fac_v_my_disciplines"
         + "    WHERE fac_functie_code IN ('WEB_BESFOF', 'WEB_BESUSE')"
         + "      AND fac_gebruiker_alg_level_write < 9"
         + "      AND fac_gebruiker_prs_level_write < 9"
         + "      AND prs_perslid_key = "+user_key+")"
         + " ORDER BY "+ lcl.xsql('ins_discipline_omschrijving','d.ins_discipline_key');

    oRs = Oracle.Execute(sql);

    var buttons = [];
    oRs = Oracle.Execute(sql);
    while (!oRs.eof)
    {
      var disc = oRs("ins_discipline_key").value;
      var ttl = oRs("ins_discipline_omschrijving").value;
      if (oRs("bes_disc_params_punchouturl").Value)
        ttl += " " + L("lcl_bes_punchout");
      buttons.push({ title: ttl,
                     action: "FcltMgr.closeDetail(window, { disc_key:" + disc + "});"
                   });
      oRs.MoveNext();
    }

%>
<html>
<head>
<% FCLTHeader.Generate(); %>
</head>

<body class="modal" id="besseldisc">
    <% CreateButtons(buttons, { vertical: 1, isDialog: true} ) %>
</body>
