WZUV#71932 Fix voor het zien van de locaties in de Android App
svn path=/Website/branches/v2022.1/; revision=55536
This commit is contained in:
@@ -121,21 +121,6 @@ span.miconimg {
|
||||
|
||||
white-space: normal;
|
||||
}
|
||||
#page_setlocation div.locations {
|
||||
height: 45vh;
|
||||
overflow: scroll;
|
||||
}
|
||||
#page_setlocation div.locations table {
|
||||
width: 100%;
|
||||
}
|
||||
#page_setlocation div.locations table tr td {
|
||||
background-color: ==mobilelistbackgroundcolor== !important;
|
||||
color: ==mobilelisttextcolor== !important;
|
||||
}
|
||||
#page_setlocation div.locations table tr.selected td {
|
||||
background-color: darkgrey !important; /* harde kleur.. */
|
||||
color: white !important; /* harde kleur.. */
|
||||
}
|
||||
#loginhtml {
|
||||
background-image: none !important;
|
||||
}
|
||||
@@ -682,6 +667,7 @@ label.ui-btn {
|
||||
background-color: ==buttonbackgroundcolor== !important;
|
||||
}
|
||||
|
||||
#alg_key.ui-controlgroup a.selected,
|
||||
.ui-btn:hover {
|
||||
color: ==buttonhovercolor== !important;
|
||||
background-color: ==buttonhoverbackgroundcolor== !important;
|
||||
|
||||
@@ -61,110 +61,13 @@ oRs.Close();
|
||||
// Als keys meegegeven, dan globallocation zetten op die key en refresh naar Facilitor.asp (die toont de locatie)
|
||||
// Als geen keys meegegeven, dan plaatsselector met default de huidige globallocation om aan te laten passen
|
||||
%>
|
||||
<html><head>
|
||||
<% FCLTMHeader.Generate({title: L("lcl_mobile_setlocation")}); %>
|
||||
<script>
|
||||
function showError(error)
|
||||
{
|
||||
var txt;
|
||||
switch(error.code)
|
||||
{
|
||||
case error.PERMISSION_DENIED:
|
||||
txt = "User denied the request for Geolocation."
|
||||
break;
|
||||
case error.POSITION_UNAVAILABLE:
|
||||
txt = "Location information is unavailable."
|
||||
break;
|
||||
case error.TIMEOUT:
|
||||
txt = "The request to get user location timed out."
|
||||
break;
|
||||
case error.UNKNOWN_ERROR:
|
||||
txt = "An unknown error occurred."
|
||||
break;
|
||||
}
|
||||
alert(txt);
|
||||
}
|
||||
var latitude = <%=safe.jsfloat(latitude)%>;
|
||||
var longitude = <%=safe.jsfloat(longitude)%>;
|
||||
function loc_submit() {
|
||||
var selected = $("table tr.selected td");
|
||||
if (selected.length == 0)
|
||||
<html>
|
||||
<head>
|
||||
<% FCLTMHeader.Generate({ title: L("lcl_mobile_setlocation") });
|
||||
var init_alg_key = -1;
|
||||
if (S("mobile_alg_level") == 'L')
|
||||
{
|
||||
jqToast("<%=L("lcl_select_location")%>");
|
||||
return false;
|
||||
}
|
||||
var data = $("form[name=setloc]").serialize()+"&alg_key="+selected.attr("value");
|
||||
$.post($("form[name=setloc]")[0].action, data, function() { window.history.back(); });
|
||||
}
|
||||
|
||||
$(function() {
|
||||
// selectByGPS gives an error when run on an android device in NativeScript
|
||||
// setTimeout gives the shell time to reload the page with lat,long coordinates
|
||||
if (latitude > -91) {
|
||||
$.getJSON("getLocation.asp", {lat: latitude, lng: longitude },
|
||||
function (data)
|
||||
{
|
||||
$("#alg_key").val(data.alg_key).selectmenu('refresh');
|
||||
});
|
||||
}
|
||||
});
|
||||
function selectByGPS() {
|
||||
{
|
||||
setTimeout(function () {
|
||||
navigator.geolocation.getCurrentPosition (
|
||||
function (pos)
|
||||
{
|
||||
var lat = pos.coords.latitude;
|
||||
var lng = pos.coords.longitude;
|
||||
if (lat == null) {
|
||||
alert("Cannot access coordinates");
|
||||
}
|
||||
$.getJSON("getLocation.asp", {lat: lat, lng: lng },
|
||||
function (data)
|
||||
{
|
||||
//alert(data.alg_key);
|
||||
$("#alg_key").val(data.alg_key).selectmenu('refresh');
|
||||
});
|
||||
|
||||
}, showError
|
||||
, {timeout: 15000, enableHighAccuracy: true});
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
$(function () {
|
||||
<% if (S("mobile_alg_level") == 'G') { %>
|
||||
var selected_key = "<%=user.alg_gebouw_key({withcurrent:true})%>";
|
||||
<% } else if (S("mobile_alg_level") == 'L') { %>
|
||||
var selected_key = "<%=user.alg_locatie_key({withcurrent:true})%>";
|
||||
<% } else if (S("mobile_alg_level") == 'V') { %>
|
||||
var selected_key = "<%=user.alg_verdieping_key({withcurrent:true})%>";
|
||||
<% } %>
|
||||
$("table tr").on("click", function () {
|
||||
$("table tr").removeClass("selected");
|
||||
$(this).closest("tr").addClass("selected");
|
||||
});
|
||||
var jq_obj = $("table tr td[value=" + selected_key + "]");
|
||||
jq_obj.click();
|
||||
$("div.locations").animate({ scrollTop: jq_obj[0].offsetTop }, 250);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<%
|
||||
PAGE_START({ id: "page_setlocation" });
|
||||
HEADER ({back: !qrc});
|
||||
CONTENT_START();
|
||||
|
||||
%>
|
||||
<form id="setloc" name="setloc" action="<%=rooturl + "/appl/pda/"%>setlocation.asp" method="post">
|
||||
<div class="ui-bar" id="setloctxt"><%= L("lcl_mobile_setlocation_intro")%></div>
|
||||
<%
|
||||
CONTROLGROUP_START();
|
||||
BUTTON(L("lcl_mobile_currentgps"), {click: "selectByGPS()", dataicon: "fa fa-location-arrow", id: "gpsbut", linkid: (Session("fclt_build") ? "loc:" : rooturl) + "/appl/pda/setlocation.asp"});
|
||||
%> <input type="text" placeholder="<%=L("lcl_autofilter")%>" id="filter"> <%
|
||||
%> <div class="locations"> <%
|
||||
if (S("mobile_alg_level") == 'L') {
|
||||
sql = "SELECT l.alg_locatie_key, l.alg_locatie_omschrijving"
|
||||
sql = "SELECT l.alg_locatie_key key, l.alg_locatie_omschrijving descr"
|
||||
+ " FROM alg_locatie l"
|
||||
+ " WHERE l.alg_locatie_verwijder IS NULL" // in scope
|
||||
+ " AND ( l.alg_locatie_vervaldatum IS NULL"
|
||||
@@ -186,10 +89,11 @@ $(function () {
|
||||
+ " WHERE prs_perslid_key = " + user_key
|
||||
+ " AND niveau = " + autlevel + ")";
|
||||
sql += " ORDER BY 2";
|
||||
FCLTselector("alg_key", sql, {initKey: user.alg_locatie_key({withcurrent:true}), nolabel: L("lcl_location"), mobile:true, datafilter:true, datainput: "#filter"});
|
||||
|
||||
} else if (S("mobile_alg_level") == 'G') {
|
||||
sql = "SELECT g.alg_gebouw_key, COALESCE(alg_locatie_plaats, alg_locatie_omschrijving)||': '||alg_gebouw_omschrijving"
|
||||
init_alg_key = user.alg_locatie_key({ withcurrent: true });
|
||||
}
|
||||
else if (S("mobile_alg_level") == 'G')
|
||||
{
|
||||
sql = "SELECT g.alg_gebouw_key key, COALESCE(alg_locatie_plaats, alg_locatie_omschrijving)||': '||alg_gebouw_omschrijving descr"
|
||||
+ " FROM alg_gebouw g, alg_srtgebouw sg, alg_locatie l"
|
||||
+ " WHERE sg.alg_srtgebouw_key = g.alg_srtgebouw_key"
|
||||
+ " AND g.alg_locatie_key = l.alg_locatie_key"
|
||||
@@ -204,10 +108,11 @@ $(function () {
|
||||
+ " WHERE prs_perslid_key = " + user_key
|
||||
+ " AND niveau = " + autlevel + ")";
|
||||
sql += " ORDER BY 2";
|
||||
FCLTselector("alg_key", sql, {initKey: user.alg_gebouw_key({withcurrent:true}), nolabel: L("lcl_building"), mobile:true, datafilter:true, datainput: "#filter"});
|
||||
|
||||
} else if (S("mobile_alg_level") == 'V') {
|
||||
sql = "SELECT v.alg_verdieping_key, alg_gebouw_omschrijving||'/'||v.alg_verdieping_code"
|
||||
init_alg_key = user.alg_gebouw_key({ withcurrent: true });
|
||||
}
|
||||
else if (S("mobile_alg_level") == 'V')
|
||||
{
|
||||
sql = "SELECT v.alg_verdieping_key key, alg_gebouw_omschrijving||'/'||v.alg_verdieping_code descr"
|
||||
+ " FROM alg_gebouw g, alg_srtgebouw sg, alg_verdieping v, alg_locatie l"
|
||||
+ " WHERE g.alg_gebouw_key = v.alg_gebouw_key"
|
||||
+ " AND g.alg_locatie_key = l.alg_locatie_key"
|
||||
@@ -224,10 +129,121 @@ $(function () {
|
||||
+ " WHERE prs_perslid_key = " + user_key
|
||||
+ " AND niveau = " + autlevel + ")";
|
||||
sql += " ORDER BY 2";
|
||||
FCLTselector("alg_key", sql, {initKey: user.alg_verdieping_key({withcurrent:true}), nolabel: L("lcl_floor"), mobile:true, datafilter:true, datainput: "#filter"});
|
||||
init_alg_key = user.alg_verdieping_key({ withcurrent: true });
|
||||
}
|
||||
%> </div> <%
|
||||
BUTTON(L("lcl_select"), {click: "loc_submit()", dataicon: "fa-fclt-save"});
|
||||
%>
|
||||
|
||||
<script>
|
||||
function showError(error)
|
||||
{
|
||||
var txt;
|
||||
switch(error.code)
|
||||
{
|
||||
case error.PERMISSION_DENIED:
|
||||
txt = "User denied the request for Geolocation."
|
||||
break;
|
||||
case error.POSITION_UNAVAILABLE:
|
||||
txt = "Location information is unavailable."
|
||||
break;
|
||||
case error.TIMEOUT:
|
||||
txt = "The request to get user location timed out."
|
||||
break;
|
||||
case error.UNKNOWN_ERROR:
|
||||
txt = "An unknown error occurred."
|
||||
break;
|
||||
}
|
||||
FcltMgr.alert(txt);
|
||||
}
|
||||
|
||||
function loc_submit() {
|
||||
var $selected = $("#alg_key.ui-controlgroup").find(".selected");
|
||||
if (!$selected.length)
|
||||
{
|
||||
jqToast("<%=L("lcl_select_location")%>");
|
||||
return false;
|
||||
}
|
||||
var selected_key = parseInt($selected.attr("id").substr(4), 10);
|
||||
var data = $("form[name=setloc]").serialize()+"&alg_key="+selected_key;
|
||||
$.post($("form[name=setloc]")[0].action, data, function() { location.href = "<%=rooturl + "/appl/pda/Facilitor.asp"%>"; });
|
||||
}
|
||||
|
||||
function doPlaceSelect(alg_key)
|
||||
{
|
||||
var select_this_key = alg_key || <%=init_alg_key%>;
|
||||
$("#alg_key").find(".selected").removeClass("selected");
|
||||
$("#alg-" + select_this_key).addClass("selected");
|
||||
}
|
||||
|
||||
function selectByGPS()
|
||||
{
|
||||
navigator.geolocation.getCurrentPosition(function (pos)
|
||||
{
|
||||
var lat = pos.coords.latitude;
|
||||
var lng = pos.coords.longitude;
|
||||
if (lat == null)
|
||||
FcltMgr.alert("Cannot access coordinates");
|
||||
$.getJSON("getLocation.asp", { lat: lat, lng: lng },
|
||||
function (data)
|
||||
{
|
||||
doPlaceSelect(data.alg_key);
|
||||
});
|
||||
|
||||
},
|
||||
showError,
|
||||
{ timeout: 15000, enableHighAccuracy: true });
|
||||
return false;
|
||||
}
|
||||
|
||||
$(function()
|
||||
{
|
||||
var latitude = <%=safe.jsfloat(latitude)%>;
|
||||
var longitude = <%=safe.jsfloat(longitude)%>;
|
||||
if (latitude > -91) {
|
||||
$.getJSON("getLocation.asp", { lat: latitude, lng: longitude },
|
||||
function (data)
|
||||
{
|
||||
doPlaceSelect(data.alg_key);
|
||||
});
|
||||
}
|
||||
else
|
||||
doPlaceSelect();
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<%
|
||||
PAGE_START({ id: "page_setlocation" });
|
||||
HEADER ({back: !qrc});
|
||||
CONTENT_START();
|
||||
%>
|
||||
<form id="setloc" name="setloc" action="<%=rooturl + "/appl/pda/"%>setlocation.asp" method="post">
|
||||
<div class="ui-bar" id="setloctxt"><%= L("lcl_mobile_setlocation_intro")%></div>
|
||||
<%
|
||||
CONTROLGROUP_START();
|
||||
var gps_btn_params = { dataicon: "fa fa-location-arrow", id: "gps-btn" };
|
||||
if (Session("fclt_build"))
|
||||
gps_btn_params.linkid = "loc:/appl/pda/setlocation.asp";
|
||||
else
|
||||
gps_btn_params.click = "selectByGPS();";
|
||||
BUTTON(L("lcl_mobile_currentgps"), gps_btn_params);
|
||||
%> <input type="text" placeholder="<%=L("lcl_autofilter")%>" id="filter">
|
||||
<%
|
||||
var oRs = Oracle.Execute(sql);
|
||||
if (!oRs.EoF)
|
||||
{
|
||||
%> <fieldset id="alg_key" data-role="controlgroup" data-mini="true" data-filter="true" data-input="#filter"><%
|
||||
while (!oRs.EoF)
|
||||
{
|
||||
BUTTON(safe.html(oRs("descr").Value), {
|
||||
"id" : "alg-" + oRs("key").Value,
|
||||
"click" : "doPlaceSelect(" + oRs("key").Value + ")"
|
||||
});
|
||||
oRs.MoveNext();
|
||||
}
|
||||
%> </fieldset ><%
|
||||
}
|
||||
oRs.Close();
|
||||
BUTTON(L("lcl_select"), { click: "loc_submit()", dataicon: "fa-fclt-save" });
|
||||
CONTROLGROUP_END();
|
||||
IFACE.FORM_END();
|
||||
%>
|
||||
|
||||
@@ -139,12 +139,7 @@ function FCLTselector(fieldName, sql, params)
|
||||
startmulti = true;
|
||||
if (params.multi && !params.initKey && params.initKey != "" && !params.emptyOption && params.emptyOption != "")
|
||||
startmulti = true;
|
||||
/* a list on mobile with a dataFilter has to be a table */
|
||||
%>
|
||||
<%=((params.mobile && params.datafilter) ? "<table " : "<select ")%>
|
||||
class='fld<%=(params.startmulti?"multi":"")%><%=params.required? " required" : ""%> <%=params.extraclass? " " + params.extraclass : ""%>'
|
||||
<%=params.datafilter? " data-filter='true'" : ""%>
|
||||
<%=params.datainput? " data-input='"+ safe.htmlattr(params.datainput) +"'" : ""%>
|
||||
%><select class="fld<%=(params.startmulti ? "multi" : "")%><%=params.required? " required" : ""%> <%=params.extraclass? " " + params.extraclass : ""%>"
|
||||
name='<%=fieldName%>'
|
||||
id='<%=params.id%>'
|
||||
<%=startmulti? " multiple" : ""%>
|
||||
@@ -154,12 +149,9 @@ function FCLTselector(fieldName, sql, params)
|
||||
<%=params.onChange? " onchange='" + safe.htmlattr(params.onChange) + "'" : ""%>
|
||||
<%=params.onDblClick? " onDblClick='" + safe.htmlattr(params.onDblClick) + "'" : "" %>
|
||||
<%=(params.mobile ? " data-icon='fa fa-chevron-down'" : "") /* LET OP DAT HTML-HAAKJE HIERACHTER */ %>>
|
||||
|
||||
<% result = FCLTselectorOptions(sql, params) %>
|
||||
<% /* a list on mobile with a dataFilter has to be a table */
|
||||
%>
|
||||
<%=((params.mobile && params.datafilter) ? "</table>" : "</select>")%>
|
||||
<%}
|
||||
<% result = FCLTselectorOptions(sql, params) %>
|
||||
</select><%
|
||||
}
|
||||
else
|
||||
{ // we moeten hier wat ingewikkeld doen omdat we wel de key hebben van de te tonen waarde, maar niet de waarde zelf
|
||||
// NB: in het geval van een readonly/multi listbox toont-ie maar 1 waarde.
|
||||
@@ -251,10 +243,8 @@ function FCLTselectorOptions(sql, params)
|
||||
// TODO: als required en initKey dan hoeft emptyoption er natuurlijk niet bij zou ik zeggen
|
||||
if ((((params.emptyOption || params.emptyOption == "") && !(justone && params.required == 1)) || params.initEmpty) && !(params.selectjustone && justone))
|
||||
{ var hasEmpty = true; // afgeleide var voor het gemak
|
||||
/* a list on mobile with a dataFilter has to be a table */
|
||||
%>
|
||||
<%=((params.mobile && params.datafilter) ? "<tr><td " : "<option ")%>
|
||||
value="<%=params.emptyKey%>" <%=params.required? " class='" + required_class + "'" : ""%> <%=valueInArray(params.initKey, params.emptyKey, params.multi)? " selected" : ""%>
|
||||
<option value="<%=params.emptyKey%>" <%=params.required? " class='" + required_class + "'" : ""%> <%=valueInArray(params.initKey, params.emptyKey, params.multi)? " selected" : ""%>
|
||||
<% if (params.extraParamValue && params.extraParamValueInit)
|
||||
{
|
||||
for (var i = 0; i < extraPV.length; i++)
|
||||
@@ -262,10 +252,7 @@ function FCLTselectorOptions(sql, params)
|
||||
<%=" " + extraPV[i].replace(/^\s+|\s+$/g,"")%>="<%=safe.htmlattr(extraPVI[i]? extraPVI[i].replace(/^\s+|\s+$/g,"") : "")%>" <% /* replace is for trim spaces */ %>
|
||||
<% }
|
||||
} /* LET OP DAT HTML-HAAKJE HIERACHTER */ %>>
|
||||
<%=(!noresults || params.emptyIsRealValue) && params.emptyOption? safe.html(params.emptyOption) : " "%>
|
||||
<% /* a list on mobile with a dataFilter has to be a table */
|
||||
%>
|
||||
<%=((params.mobile && params.datafilter) ? "</td></tr>" : "</option>")%>
|
||||
<%=(!noresults || params.emptyIsRealValue) && params.emptyOption? safe.html(params.emptyOption) : " "%></option>
|
||||
<% }
|
||||
|
||||
while (!oRs.eof)
|
||||
@@ -276,10 +263,7 @@ function FCLTselectorOptions(sql, params)
|
||||
result.initKey = oRs(0).value;
|
||||
result.initText = oRs(1).value;
|
||||
}
|
||||
/* a list on mobile with a dataFilter has to be a table */
|
||||
%>
|
||||
<%=((params.mobile && params.datafilter) ? "<tr><td " : "<option ")%>
|
||||
value="<%=safe.htmlattr(oRs(0).value)%>" <%=valueInArray(params.initKey, oRs(0).value, params.multi) || (justone && !hasEmpty)? " selected " : ""%>
|
||||
%> <option value="<%=safe.htmlattr(oRs(0).value)%>" <%=valueInArray(params.initKey, oRs(0).value, params.multi) || (justone && !hasEmpty)? " selected " : ""%>
|
||||
<% if (params.titleCol)
|
||||
{
|
||||
title = oRs(params.titleCol).value;
|
||||
@@ -312,10 +296,7 @@ function FCLTselectorOptions(sql, params)
|
||||
{ %>
|
||||
<%=extraPV[i].replace(/^\s+|\s+$/g,"")%>="<%=safe.htmlattr(oRs(extraPV[i].replace(/^\s+|\s+$/g,"")).value)%>" <% /* replace is for trim spaces */ %>
|
||||
<% }
|
||||
} /* LET OP DAT HTML-HAAKJE HIERACHTER */ %>><%=safe.html(oRs(1).value)%>
|
||||
<% /* a list on mobile with a dataFilter has to be a table */
|
||||
%>
|
||||
<%=((params.mobile && params.datafilter) ? "</td></tr>" : "</option>")%>
|
||||
} /* LET OP DAT HTML-HAAKJE HIERACHTER */ %>><%=safe.html(oRs(1).value)%></option>
|
||||
<% oRs.MoveNext();
|
||||
}
|
||||
oRs.close();
|
||||
|
||||
Reference in New Issue
Block a user