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

    File:
    Description:
    Parameters:
    Note:

*/ %>

<!-- #include file="../Shared/common.inc" -->
<!-- #include file="./mobile.inc" -->
<!-- #include file="./iface.inc" -->
<%
var qrc = getQParamInt("qrc", 0) != 0;
var verdieping_key = getQParamInt("verdieping_key", user.alg_verdieping_key({withcurrent:true}));
%>

<html>
    <head>
<% FCLTMHeader.Generate({}); %>
</head>
<%
   var sql = "SELECT alg_gebouw_omschrijving||' - '||alg_verdieping_omschrijving verdieping_naam"
           + " FROM alg_verdieping v, alg_gebouw g"
           + " WHERE v.alg_gebouw_key = g.alg_gebouw_key"
           + "   AND alg_verdieping_key = " + verdieping_key;

   var oRs = Oracle.Execute(sql);
   var verdieping_naam = oRs("verdieping_naam").value;
   // Welke disciplines mag ik (default) zien?



   sql = "SELECT DISTINCT d.ins_discipline_key"
       + " FROM fac_v_my_disciplines m, ins_v_aanwezigdiscipline d, ins_disc_params dp "
       + " WHERE d.ins_discipline_key=m.ins_discipline_key(+)" // outer join voor S("fg_publiclayers")
       + "   AND d.ins_discipline_min_level = 1"
       + "   AND dp.ins_disc_params_cadlayers IS NOT NULL"
       + "   AND BITAND(dp.ins_disc_params_type, 1)>0" // binnen
       + "   AND BITAND(dp.ins_disc_params_type, 4)>0" // default aan
       + "   AND dp.ins_discipline_key = d.ins_discipline_key"
       + "   AND (fac_functie_code IN ('WEB_INSMAN', 'INSUSE')"
         + (S("fg_publiclayers").length ? " OR d.ins_discipline_key IN (" + S("fg_publiclayers").join(",") + ")" : "")
         + " ) "
       + "   AND prs_perslid_key(+)="+user_key;
    oRs = Oracle.Execute(sql);
    discs = [];
    while (!oRs.Eof)
    {
        discs.push(oRs("ins_discipline_key").Value);
        oRs.MoveNext();
    }
    oRs.Close();

%>
  <body>
<%
    PAGE_START();
    HEADER({title: L("lcl_prs_wp_fgraph")+" "+ safe.html(verdieping_naam), back:!qrc, home: !qrc});
    CONTENT_START();
    // toon verdieping user.alg_verdieping_key({withcurrent:true})
    var imgurl = "../cad/mySlnk2IMG.asp?mode=0";
    imgurl += "&scenario_key=0&vkey=" + verdieping_key
    imgurl += "&paperColor="+S("fg_paperColor")+"&labelpos=2";
    imgurl += "&discs=" + discs.join(',');
    if (S("fg_mobile_thema") != -1) {
        imgurl += "&thema=" + S("fg_mobile_thema");
    }
    if (S("fg_mobile_label") != -1) {
        imgurl += "&label=" + S("fg_mobile_label");
    }
    var sizeX = 640;
    var sizeY = 480;
    imgurl += "&sizeX=" + (2*sizeX); // dubbele resolutie, kun je nog een beetje inzoomen
    imgurl += "&sizeY=" + (2*sizeY);
    %><div id="mobplan"><img width="100%" src="<%=safe.htmlattr(imgurl)%>"></div><%

    if (false && S("fg_mobile_thema") != -1) { // todo tzt: niet zomaar kopieren en dit werkt niet vanzelf
        CONTROLGROUP_START()
           BUTTON(L("lcl_fg_legenda"), {linkid: "../cad/legenda.asp?thema="+S("fg_mobile_thema")+"&parentkey="+verdieping_key+"&mode=0&scenario_key=0" , dataicon: "check"});
        CONTROLGROUP_END()
    }
    CONTENT_END();
    FOOTER();
    PAGE_END();
%>
  </body>
</html>