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

    File:               fac_typeopdr_list.asp
    Description:        Show an overview of mld_typeopdrfaq items in list-form,
                        which meets with the given requirements
    Parameters:
    Context:
    Note:
*/ %>

<!-- #include file="../Shared/common.inc" -->
<!-- #include file="../Shared/resultset_table_v2.inc" -->
<!-- #include file="../MLD/mld.inc" -->
<!-- #include file="../fac/fac.inc" -->

<%
var outputmode = getQParamInt("outputmode", 0); //  0 = screen, 1 = print, 2 = excel etc
var showall    = getQParamInt("showall", 0) == 1;
var faq_key    = getQParamInt("faq_key");

var sql = "SELECT fac_faq_level"
        + "     , fac_faq_datum"
        + "  FROM fac_faq f"
        + " WHERE fac_faq_key = " + faq_key;
var oRs = Oracle.Execute(sql);
if (oRs.Eof)
    shared.record_not_found("<!--" + faq_key + "-->");

var level = oRs("fac_faq_level").Value;
var datum = oRs("fac_faq_datum").Value;
var mustProf = (level & 1) == 0; // Alleen professionals
oRs.close();

var this_faq = fac.func_enabled_faq(faq_key); // Wat heb ik zoal aan rechten op deze specifieke kennisbankitem.

user.auth_required_or_abort(this_faq.canReadAny);

var addButton = [];

%>
<html>
  <head>
<%  FCLTHeader.Generate({outputmode:outputmode}) %>
    <script type="text/javascript">
      function mld_typeopdrfaq()
      {
        FcltMgr.openModalDetail("../fac/fac_typeopdrfaq.asp?faq_key=<%=faq_key%>",
                                L("lcl_faq_typeopdrfaq"),
                                { callback: FcltMgr.reload });
      }
    </script>
  </head>
  <body id="listbody">
<%
    function fnrowData(oRs)
    {
      var typeopdr_key = oRs("mld_typeopdr_key").value;

      var data = { typeopdr_key: typeopdr_key };
      return JSON.stringify(data);
    }

    if (this_faq.canChange)
    {
      addButton = [{icon: "fa-fclt-edit", title: L("lcl_change"), action: "mld_typeopdrfaq()"}];
    }

    var sql = "SELECT f.mld_typeopdrfaq_key"
            + "     , mto.mld_typeopdr_key"
            + "     , " + lcl.xsqla("mto.mld_typeopdr_omschrijving", "mto.mld_typeopdr_key")
            + "  FROM mld_typeopdrfaq f"
            + "     , mld_typeopdr mto"
            + " WHERE f.mld_typeopdr_key = mto.mld_typeopdr_key(+)"
            + "   AND fac_faq_key = " + faq_key;

    var rst = new ResultsetTable({ sql: sql
                                 , keyColumn: "mld_typeopdrfaq_key"
                                 , ID: "mldtypeopdrfaqtable"
                                 , noPrint: true
                                 , showAll: showall
                                 , rowData: fnrowData
                                 , outputmode: outputmode
                                 , title: L("lcl_faq_voor_typeopdr")
                                 , buttons: addButton
                                 });

    rst.addColumn(new Column({caption: L("mld_typeopdr_omschrijving"), content: "mld_typeopdr_omschrijving"}));

    var cnt = rst.processResultset();
%>
  </body>
</html>

<% ASPPAGE_END(); %>
