FCLT#91497 Timezone-verschil automatisch aanpassen
svn path=/Website/branches/v2025.4/; revision=71119
This commit is contained in:
@@ -112,6 +112,38 @@ if (Session("interface") == "touch") { %>
|
||||
if (<%=(!device.test(device.isSupported) && S("checkBrowser") == 1 ? "true" : "false")%> || !(Modernizr.promises && Modernizr.strictmode && Modernizr.arrow)) {
|
||||
FcltMgr.alert(L("lcl_invalid_browser"));
|
||||
}
|
||||
|
||||
<% var xfunc = user.func_enabled2("PRS", { prs_key: user_key, isOptional: true });
|
||||
var prsWriteAny =
|
||||
xfunc.canWrite("WEB_PRSMAN") ||
|
||||
xfunc.canWrite("WEB_PRSUSE") ||
|
||||
xfunc.canWrite("WEB_PROFIL");
|
||||
if (prsWriteAny) { %>
|
||||
var userTimezone = "<%=safe.jsstring(user.timezone())%>";
|
||||
var clientTimezone = Intl?.DateTimeFormat()?.resolvedOptions()?.timeZone;
|
||||
if (userTimezone && clientTimezone && userTimezone != clientTimezone) {
|
||||
$(function () {
|
||||
FcltMgr.confirm(`Your system timezone is ${safe.html(clientTimezone)}, but your Facilitor profile is set to ${userTimezone}.\nDo you want me to update it and set your current timezone to ${safe.html(clientTimezone)}?`, function () {
|
||||
var data = {
|
||||
prs_tz: clientTimezone
|
||||
};
|
||||
<% protectRequest.dataToken("data"); %>
|
||||
$.post(
|
||||
"<%=rooturl%>/APPL/PRS/prs_edit_perslid_save.asp?prs_key=<%=user_key%>",
|
||||
data,
|
||||
function (json) {
|
||||
if (json.success) {
|
||||
FcltMgr.reload();
|
||||
} else {
|
||||
FcltToast(`Could not recognize timezone '${safe.html(clientTimezone)}'`, 1);
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
<% } %>
|
||||
});
|
||||
</script>
|
||||
<%
|
||||
|
||||
@@ -325,17 +325,6 @@ function generateHeader()
|
||||
<% if (Application("otap_environment") == "O") { %>
|
||||
<a href='./fac_StreamFile.asp?logger=0' target='_blank'><button id='loggingshow'>Open logging</button></a>
|
||||
<% } %>
|
||||
<div id="tzwarning" style="background-color:#f88;padding:2px"></div>
|
||||
<script>
|
||||
var usertimezone = "<%=safe.jsstring(user.timezone())%>";
|
||||
var browsertimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
if (usertimezone && usertimezone != browsertimezone)
|
||||
{
|
||||
$(function () {
|
||||
$("#tzwarning").text("Let op: Windows tijdzone (" + browsertimezone + ") is anders dan Facilitor tijdzone (" + usertimezone + ")");
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
<%
|
||||
}
|
||||
|
||||
@@ -25,16 +25,31 @@ user.auth_required_or_abort(prsauthparams.writeman || prsauthparams.writeuse ||
|
||||
var prs_user = new Perslid(prs_key);
|
||||
user.auth_required_or_abort(!prs_user.has("WEB_FACFAC") || user.has("WEB_FACFAC")); // WEB_FACFAC alleen als je het zelf ook hebt
|
||||
|
||||
var result = {};
|
||||
|
||||
var prs_tz = getFParam("prs_tz", "");
|
||||
|
||||
if (prs_tz != "")
|
||||
{
|
||||
var sql = "SELECT '' FROM V$TIMEZONE_NAMES"
|
||||
+ " WHERE tzname = " + safe.quoted_sql(prs_tz); // Case-sensitive
|
||||
+ " WHERE tzname = " + safe.quoted_sql(prs_tz) // Case-sensitive
|
||||
+ " AND tzname NOT LIKE '%GMT%'" // Conform timezoneselector.inc
|
||||
+ " AND ("
|
||||
+ " tzname LIKE 'Europe/%' OR"
|
||||
+ " tzname LIKE 'America/%' OR"
|
||||
+ " tzname LIKE 'Asia/%' OR"
|
||||
+ " tzname LIKE 'Australia/%' OR"
|
||||
+ " tzname LIKE 'Africa/%' OR"
|
||||
+ " tzname LIKE 'Pacific/%'"
|
||||
+ " )";
|
||||
|
||||
var oRs = Oracle.Execute(sql);
|
||||
if (oRs.EoF)
|
||||
shared.internal_error("timezone (" + safe.html(prs_tz) + ") not found.");
|
||||
if (oRs.EoF) {
|
||||
result.success = false;
|
||||
Response.Write(JSON.stringify(result));
|
||||
ASPPAGE_END();
|
||||
Response.End;
|
||||
}
|
||||
oRs.Close();
|
||||
}
|
||||
|
||||
@@ -251,10 +266,7 @@ if (!custfunc.prs_postsave(prs_key, pResult))
|
||||
abort_with_warning(pResult.errmsg);
|
||||
}
|
||||
|
||||
|
||||
result = { success: true
|
||||
, prs_key: prs_key
|
||||
};
|
||||
result.success = true;
|
||||
Response.Write(JSON.stringify(result));
|
||||
ASPPAGE_END();
|
||||
%>
|
||||
<% ASPPAGE_END(); %>
|
||||
|
||||
@@ -31,7 +31,7 @@ function FCLTtimezoneselector(fieldName, params)
|
||||
+ " tzname LIKE 'Asia/%' OR"
|
||||
+ " tzname LIKE 'Australia/%' OR"
|
||||
+ " tzname LIKE 'Africa/%' OR"
|
||||
+ " tzname LIKE 'Pacific/%'"
|
||||
+ " tzname LIKE 'Pacific/%'" // En deze dan; [Antarctica, Atlantic, Arctic, Brazil, Canada, Chile, Indian, Mexico, US] ?
|
||||
+ " )"
|
||||
+ " GROUP BY tzname, TZ_OFFSET(tzname)"
|
||||
+ " ORDER BY TO_NUMBER(SUBSTR(TZ_OFFSET(tzname), 1, 3)"
|
||||
|
||||
Reference in New Issue
Block a user