Files
Facilitor/APPL/PDA/plattegrond.asp
2017-03-10 18:22:57 +00:00

160 lines
6.5 KiB
Plaintext

<%@ language = "JavaScript" %>
<% /*
$Revision$
$Id$
Description: Select a CAD-theme to display
Parameters:
Note: You should set S("fg_mobile_thema") to -1
and not use parameter thema_key
to get this page. Else it will be bypassed
*/ %>
<!-- #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}));
var thema_key = getQParamInt("thema_key", S("fg_mobile_thema"));
if (thema_key == -1) // Dan vragen we een thema
{
Server.Transfer("cad_thema_select.asp");
}
%>
<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({id: "page-2-"+verdieping_key});
HEADER({title: safe.html(verdieping_naam), back:!qrc, home: !qrc});
CONTENT_START();
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 (thema_key != -1) {
imgurl += "&thema=" + thema_key;
}
if (S("fg_mobile_label") != -1) {
imgurl += "&label=" + S("fg_mobile_label");
}
// iphone7 resolution as reference
var sizeX = 1334;
var sizeY = 750;
sizeX = 1920;
sizeY = 1080;
imgurl += "&sizeX=" + (1*sizeX);
imgurl += "&sizeY=" + (1*sizeY);
%><div id="mobplan"><img width="100%" src="<%=safe.htmlattr(imgurl)%>"></div><%
if (thema_key != -1) {
// vrij nauwkeurig gestript uit cad/legenda.asp
sql = "SELECT ts.cad_legenda_key,"
+ lcl.xsqla('ts.cad_legenda_omschrijving','ts.cad_legenda_key')+","
+ " ts.cad_legenda_discreet, "
+ " tt.cad_thema_view, tt.cad_thema_type, tt.fac_functie_key"
+ " FROM cad_legenda ts, cad_thema tt"
+ " WHERE tt.cad_thema_key = " + thema_key
+ " AND tt.cad_legenda_key = ts.cad_legenda_key";
oRs = Oracle.Execute(sql)
if (!oRs.Eof) { // Is wel heel vreemd, een lege legenda
var themaType = oRs("cad_thema_type").Value;
var legendaOmschrijving=oRs("cad_legenda_omschrijving").value;
var discreet=oRs("cad_legenda_discreet").value==1;
var legenda_key=oRs("cad_legenda_key").value;
var viewName = oRs("cad_thema_view").value;
oRs.close();
var wkveld = "null waarde_key";
var waardenSQL = "select waarde, "+wkveld
+ " from " + viewName + " th, alg_ruimte ar "
+ " where th.alg_ruimte_key = ar.alg_ruimte_key"
+ " and alg_verdieping_key = " + verdieping_key;
if (discreet)
sql = "SELECT "+ lcl.xsqla('ti.CAD_LEGENDAWAARDE_OMSCHR','ti.cad_legendawaarde_key')
+ ", ti.CAD_LEGENDAWAARDE_RGB, TH2.WAARDE_KEY, COUNT(*) aantal"
+ " FROM CAD_LEGENDAWAARDE ti, (" + waardenSQL + ") TH2 "
+ " WHERE TI.CAD_LEGENDAWAARDE_VALUE = TH2.WAARDE "
+ " AND ti.CAD_LEGENDA_KEY = " + legenda_key
+ " GROUP BY "+lcl.xsql('ti.CAD_LEGENDAWAARDE_OMSCHR','ti.cad_legendawaarde_key')+", ti.CAD_LEGENDAWAARDE_RGB, TH2.WAARDE_KEY"
+ " ORDER BY CAD_LEGENDAWAARDE_OMSCHR";
else // Niet discreet-->alle waarden ongeacht voorkomen
sql = "SELECT DISTINCT "+ lcl.xsqla('ti.CAD_LEGENDAWAARDE_OMSCHR','ti.cad_legendawaarde_key')
+ ", ti.CAD_LEGENDAWAARDE_RGB, "
+ " fac.safe_to_number(CAD_LEGENDAWAARDE_VALUE)"
+ " FROM CAD_LEGENDAWAARDE ti"
+ " WHERE ti.CAD_LEGENDA_KEY = " + legenda_key
+ " ORDER BY fac.safe_to_number(CAD_LEGENDAWAARDE_VALUE)" // Numeriek sorteren!
oRs = Oracle.Execute(sql)
%>
<div class='mlegendatitel'><%=legendaOmschrijving%></div>
<%
v_count = "";
while (!oRs.EOF)
{
v_waarde_key = null;
v_waarde = oRs.Fields("CAD_LEGENDAWAARDE_OMSCHR").value;
v_kleur = oRs.Fields("CAD_LEGENDAWAARDE_RGB").value.replace(/ /g,'');
if (discreet) {
v_count = " (" + oRs.Fields("aantal").value + "x)";
v_waarde_key = oRs.Fields("waarde_key").value;
}
%>
<div class='mlegendaregel'><span style="background-color: #<%=v_kleur%>; padding: 0 10px;">&nbsp;&nbsp;</span> <%=safe.html(v_waarde)%> <%=v_count%></div>
<%
oRs.MoveNext();
}
oRs.Close();
}
}
CONTENT_END();
FOOTER();
PAGE_END();
%>
</body>
</html>