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

    File:               faq.asp
    Description:        Bekijk KB-item (Mobile version)  BLST#77422
    Parameters:         faq_key
    Note:               Eerste versie, basis, functioneert.
                        Je kunt hier natuurlijk eenvoudig een "echte webpagina" van maken
                        en dat wordt de bedoeling, als een informatiepagina.
*/ %>

<!-- #include file="../Shared/common.inc" -->
<!-- #include file="./resultset_table.inc" -->
<!-- #include file="../fac/fac.inc" -->
<!-- #include file="../fac/faq_flexkenmerk.inc" -->
<!-- #include file="./mobile.inc" -->
<!-- #include file="./iface.inc" -->
<%
FCLTHeader.Requires({plugins: ["suggest"]});

var faq_key = getQParamInt("faq_key");
var qrc = getQParamInt("qrc", 0) != 0;

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

user.auth_required_or_abort(this_faq.canReadAny);

var sql = "SELECT fac_faq_question"
        + "     , fac_faq_answer"
        + "     , fac_faq_answer2"
        + "     , fac_faq_source"
        + "     , fac_faq_url"
        + "     , fac_faq_level"
        + "     , fac_faq_datum"
        + "     , COALESCE((SELECT MAX(tr.fac_tracking_datum)"
        + "                   FROM fac_tracking tr"
        + "                      , fac_srtnotificatie str"
        + "                  WHERE tr.fac_srtnotificatie_key = str.fac_srtnotificatie_key"
        + "                    AND tr.fac_tracking_refkey = f.fac_faq_key"
        + "                    AND str.fac_srtnotificatie_xmlnode = 'kennisbank'"
        + "                )"
        + "              , f.fac_faq_wijzigdatum"
        + "               ) wijzigdatum"   // ja, zo doet de desktop het ook, dus zal wel goed zijn
        + "     , fac_faq_wijzigdatum"
        + "     , fac_faq_vervaldatum"
        + "     , fac_faq_lang"
        + "     , fac_functie_key"
        + "     , fac_faq_hint"
        + "     , fac_faq_displaymode"
        + "     , prs_perslid_key"
        + "     , faq_ins_discipline_key"
        + "     , ins_discipline_image"
        + "  FROM fac_faq f, faq_discipline fd"
        + " WHERE f.faq_ins_discipline_key = fd.ins_discipline_key"
        + "   AND fac_faq_key = " + faq_key;

var oRs = Oracle.Execute(sql);
if (oRs.Eof)
    shared.record_not_found("<!--" + faq_key + "-->");

var subject = L("lcl_faq_kennisbank_nr") + " " + faq_key ;
%>
<html>
  <head>
<%  FCLTMHeader.Generate({title:  subject }); %>
  </head>
  <body>
<%
    PAGE_START({id: "page-1-" + faq_key});
      HEADER({title: (faq_key > -1 ? subject : "") , back: !qrc, home: !qrc});
      CONTENT_START();
        CARDS_WRAPPER_START();
          CARD_START({ "cls": "faq with-icon" });
            Response.Write(I(oRs("ins_discipline_image").Value || "fa-book"));
            Response.Write( "<div class='card-title'>");
            Response.Write(oRs("fac_faq_question").Value);
            Response.Write("</div>");

            Response.Write( "<div class='card-descr'>");
            Response.Write(safe.html(oRs("fac_faq_answer").Value));
            if (oRs("fac_faq_answer2").Value)
            {
                Response.Write("<br>" + safe.html(oRs("fac_faq_answer2").Value));
            }
            //if (isProf && oRs("wijzigdatum").Value)
            {
                Response.Write("<br>");
                Response.Write("<div style='font-weight: normal; font-size: 0.7em;'>");
                Response.Write(L("lcl_faq_wijzigdatum") + ": " + toDateTimeString(oRs("wijzigdatum").Value));
                Response.Write("</div>");
            }
            if (oRs("fac_faq_url").Value)
            {
                Response.Write("<br>");
                Response.Write("<div>" + L("lcl_faq_link") + ": <a href='" + oRs("fac_faq_url").Value + "'>" + oRs("fac_faq_url").Value + "</a></div>");
            }

            generateFlexKenmerkCode ({faq_key: faq_key,
                                      disc_key: oRs("faq_ins_discipline_key").Value,
                                      prs_key: user_key,
                                      mobile: true,
                                      reado: true
                                     });

            Response.Write("</div>");
          CARD_END();
        CARDS_WRAPPER_END();

        CONTROLGROUP_START()
        // Buttons
        CONTROLGROUP_END()

      CONTENT_END();
      FOOTER();
    PAGE_END()

oRs.close();

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