605 lines
18 KiB
JavaScript
605 lines
18 KiB
JavaScript
// JavaScript Document
|
|
|
|
|
|
/***************************************************/
|
|
/***************************************************/
|
|
/* PAGINA INDEX.JSP */
|
|
/***************************************************/
|
|
/***************************************************/
|
|
function searchFS() {
|
|
|
|
var f = document.frmFS;
|
|
|
|
Ab.submitAj('frmFS', 'gareFS');
|
|
console.log("1 fatto..");
|
|
|
|
|
|
}
|
|
|
|
function searchFE() {
|
|
|
|
f
|
|
Ab.submitAj('frmFE', 'gareFE');
|
|
console.log("2 fatto..");
|
|
|
|
}
|
|
|
|
function prevPageFS() {
|
|
var f = document.frmFS;
|
|
//
|
|
var currentPage=eval($("#pageNumberFS").val());
|
|
//alert(currentPage );
|
|
if(currentPage>1)
|
|
{
|
|
f.pageNumberFS.value =currentPage - 1;
|
|
Ab.submitAj('frmFS', 'gareFS');
|
|
}
|
|
|
|
}
|
|
|
|
function nextPageFS() {
|
|
var f = document.frmFS;
|
|
//
|
|
var currentPage=eval($("#pageNumberFS").val());
|
|
var totPage=eval($("#totPageNumber_0").val());
|
|
//alert(currentPage +" "+totPage );
|
|
if(currentPage<totPage)
|
|
{
|
|
f.pageNumberFS.value = currentPage + 1;
|
|
//alert(f.pageNumberFS.value);
|
|
Ab.submitAj('frmFS', 'gareFS');
|
|
}
|
|
|
|
}
|
|
|
|
function prevPageFE() {
|
|
var f = document.frmFE;
|
|
//
|
|
var currentPage=eval($("#pageNumberFE").val());
|
|
//alert(currentPage );
|
|
if(currentPage>1)
|
|
{
|
|
f.pageNumberFE.value =currentPage - 1;
|
|
Ab.submitAj('frmFE', 'gareFE');
|
|
}
|
|
}
|
|
|
|
function nextPageFE() {
|
|
var f = document.frmFE;
|
|
//
|
|
var currentPage=eval($("#pageNumberFE").val());
|
|
var totPage=eval($("#totPageNumber_1").val());
|
|
//alert(currentPage +" "+totPage );
|
|
if(currentPage<totPage)
|
|
{
|
|
f.pageNumberFE.value = currentPage + 1;
|
|
//alert(f.pageNumberFS.value);
|
|
Ab.submitAj('frmFE', 'gareFE');
|
|
}
|
|
}
|
|
/***************************************************/
|
|
/***************************************************/
|
|
/* PAGINA GARA.CR */
|
|
/***************************************************/
|
|
/***************************************************/
|
|
function searchGara() {
|
|
//eventi,Gara.abl,search,,@id_tipoGara@flgMese@anno@pageNumber
|
|
var f = document.main;
|
|
$("body").addClass("loading");
|
|
f.submit();
|
|
//Ab.submitAj('main');
|
|
|
|
|
|
}
|
|
/***************************************************/
|
|
/***************************************************/
|
|
/* PAGINA RICERCA FOTOCR */
|
|
/***************************************************/
|
|
/***************************************************/
|
|
function getTipoPuntoFotoValue() {
|
|
var field = $("#tipoPuntoFoto");
|
|
if (!field.length) {
|
|
return "";
|
|
}
|
|
|
|
return field.val() || "";
|
|
}
|
|
|
|
function getCurrentLangValue() {
|
|
var field = $("#lang");
|
|
if (field.length && field.val()) {
|
|
return field.val();
|
|
}
|
|
|
|
return $("html").attr("lang") || "it";
|
|
}
|
|
|
|
function getFaceAiStorageValue(fieldId, simulatorKey) {
|
|
var field = $("#" + fieldId);
|
|
if (field.length && field.val()) {
|
|
return field.val();
|
|
}
|
|
|
|
if (window.faceAiSimulator && window.faceAiSimulator.raceStorage && window.faceAiSimulator.raceStorage[simulatorKey]) {
|
|
return window.faceAiSimulator.raceStorage[simulatorKey];
|
|
}
|
|
|
|
return "";
|
|
}
|
|
|
|
function faceAiFeatureEnabled() {
|
|
var config = window.faceAiConfig || {};
|
|
var simulatorConfig = window.faceAiSimulator || {};
|
|
var value = typeof config.enabled !== "undefined" ? config.enabled : simulatorConfig.enabled;
|
|
|
|
if (typeof value === "string") {
|
|
value = value.toLowerCase();
|
|
return value === "1" || value === "true" || value === "yes" || value === "on";
|
|
}
|
|
|
|
return value === true;
|
|
}
|
|
|
|
function faceAiEscapeHtml(value) {
|
|
return String(value || "")
|
|
.replace(/&/g, "&")
|
|
.replace(/</g, "<")
|
|
.replace(/>/g, ">")
|
|
.replace(/"/g, """)
|
|
.replace(/'/g, "'");
|
|
}
|
|
|
|
function isFaceAiDebugEnabled() {
|
|
var hostname = window.location && window.location.hostname ? window.location.hostname : "";
|
|
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1";
|
|
}
|
|
|
|
function getFaceAiDebugPayload() {
|
|
var raceYear = getFaceAiStorageValue("faceAiRaceYear", "year");
|
|
var raceMonthFolder = getFaceAiStorageValue("faceAiRaceMonthFolder", "monthFolder");
|
|
var raceFolder = getFaceAiStorageValue("faceAiRaceFolder", "raceFolder");
|
|
var racePathBase = $("#faceAiRacePathBase").val() || "";
|
|
var raceStorageRelativeDir = $("#faceAiRaceStorageRelativeDir").val() || [raceYear, raceMonthFolder, raceFolder].filter(Boolean).join("/");
|
|
var simulatorConfig = window.faceAiSimulator || null;
|
|
|
|
return {
|
|
pageUrl: window.location.href,
|
|
race: {
|
|
id: $("#id_gara").val() || "",
|
|
slug: $("#garaDesc").val() || "",
|
|
name: $("h1.my-4").last().text().replace(/\s+/g, " ").trim(),
|
|
lang: getCurrentLangValue(),
|
|
storage: {
|
|
year: raceYear,
|
|
monthFolder: raceMonthFolder,
|
|
raceFolder: raceFolder,
|
|
pathBase: racePathBase,
|
|
relativeDir: raceStorageRelativeDir
|
|
}
|
|
},
|
|
simulator: simulatorConfig,
|
|
handoff: {
|
|
url: (simulatorConfig && simulatorConfig.handoffUrl) || "faceai_handoff.php",
|
|
returnUrl: (simulatorConfig && simulatorConfig.returnUrl) || window.location.href
|
|
}
|
|
};
|
|
}
|
|
|
|
function logFaceAiDebug(label, extraPayload) {
|
|
if (!isFaceAiDebugEnabled() || !window.console || typeof window.console.groupCollapsed !== "function") {
|
|
return;
|
|
}
|
|
|
|
var payload = getFaceAiDebugPayload();
|
|
if (extraPayload) {
|
|
payload.extra = extraPayload;
|
|
}
|
|
|
|
window.console.groupCollapsed("[FaceAI] " + label);
|
|
window.console.log(payload);
|
|
window.console.groupEnd();
|
|
}
|
|
|
|
function getFaceAiErrorState() {
|
|
if (typeof URLSearchParams === "undefined") {
|
|
return null;
|
|
}
|
|
|
|
var params = new URLSearchParams(window.location.search || "");
|
|
if (params.get("faceaiError") !== "1") {
|
|
return null;
|
|
}
|
|
|
|
return {
|
|
title: params.get("faceaiErrorTitle") || "Face ID non disponibile",
|
|
message: params.get("faceaiErrorMessage") || "Il servizio Face ID non e al momento disponibile. Riprova piu tardi."
|
|
};
|
|
}
|
|
|
|
function clearFaceAiErrorState() {
|
|
if (!window.history || !window.history.replaceState || typeof URL === "undefined") {
|
|
return;
|
|
}
|
|
|
|
var cleanUrl = new URL(window.location.href);
|
|
cleanUrl.searchParams.delete("faceaiError");
|
|
cleanUrl.searchParams.delete("faceaiErrorTitle");
|
|
cleanUrl.searchParams.delete("faceaiErrorMessage");
|
|
window.history.replaceState({}, document.title, cleanUrl.pathname + cleanUrl.search + cleanUrl.hash);
|
|
}
|
|
|
|
function showFaceAiErrorModal(title, message) {
|
|
var modal = $("#faceAiErrorModal");
|
|
|
|
if (!modal.length) {
|
|
$("body").append('<div class="modal fade" id="faceAiErrorModal" tabindex="-1" role="dialog" aria-labelledby="faceAiErrorModalLabel" aria-hidden="true"><div class="modal-dialog modal-sm" role="document"><div class="modal-content"><div class="modal-header"><h5 class="modal-title" id="faceAiErrorModalLabel"></h5><button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fa fa-close"></i> </button></div><div class="modal-body text-center"><p id="faceAiErrorModalMessage" class="mb-0"></p></div></div></div></div>');
|
|
modal = $("#faceAiErrorModal");
|
|
}
|
|
|
|
$("#faceAiErrorModalLabel").html(faceAiEscapeHtml(title));
|
|
$("#faceAiErrorModalMessage").html(faceAiEscapeHtml(message));
|
|
modal.modal("show");
|
|
}
|
|
|
|
function initFaceAiErrorModal() {
|
|
var errorState = getFaceAiErrorState();
|
|
if (!errorState) {
|
|
return;
|
|
}
|
|
|
|
showFaceAiErrorModal(errorState.title, errorState.message);
|
|
clearFaceAiErrorState();
|
|
}
|
|
|
|
function buildFaceAiLaunchUrl() {
|
|
var raceId = $("#id_gara").val() || "";
|
|
var raceSlug = $("#garaDesc").val() || "";
|
|
var raceName = $("h1.my-4").last().text().replace(/\s+/g, " ").trim();
|
|
var raceYear = getFaceAiStorageValue("faceAiRaceYear", "year");
|
|
var raceMonthFolder = getFaceAiStorageValue("faceAiRaceMonthFolder", "monthFolder");
|
|
var raceFolder = getFaceAiStorageValue("faceAiRaceFolder", "raceFolder");
|
|
var lang = getCurrentLangValue();
|
|
var handoffUrl = (window.faceAiSimulator && window.faceAiSimulator.handoffUrl) || "faceai_handoff.php";
|
|
var returnUrl = (window.faceAiSimulator && window.faceAiSimulator.returnUrl) || window.location.href;
|
|
var query = [
|
|
"raceId=" + encodeURIComponent(raceId),
|
|
"raceSlug=" + encodeURIComponent(raceSlug),
|
|
"raceName=" + encodeURIComponent(raceName),
|
|
"raceYear=" + encodeURIComponent(raceYear),
|
|
"raceMonthFolder=" + encodeURIComponent(raceMonthFolder),
|
|
"raceFolder=" + encodeURIComponent(raceFolder),
|
|
"lang=" + encodeURIComponent(lang),
|
|
"returnUrl=" + encodeURIComponent(returnUrl)
|
|
];
|
|
|
|
if (window.faceAiSimulator && window.faceAiSimulator.devUserId) {
|
|
query.push("devUserId=" + encodeURIComponent(window.faceAiSimulator.devUserId));
|
|
}
|
|
if (window.faceAiSimulator && window.faceAiSimulator.devDisplayName) {
|
|
query.push("devDisplayName=" + encodeURIComponent(window.faceAiSimulator.devDisplayName));
|
|
}
|
|
if (window.faceAiSimulator && window.faceAiSimulator.devEmail) {
|
|
query.push("devEmail=" + encodeURIComponent(window.faceAiSimulator.devEmail));
|
|
}
|
|
if (window.faceAiSimulator && window.faceAiSimulator.devMembershipStatus) {
|
|
query.push("devMembershipStatus=" + encodeURIComponent(window.faceAiSimulator.devMembershipStatus));
|
|
}
|
|
|
|
logFaceAiDebug("Legacy launch payload prepared", {
|
|
query: query.slice(0),
|
|
raceId: raceId,
|
|
raceSlug: raceSlug,
|
|
raceName: raceName
|
|
});
|
|
|
|
return handoffUrl + "?" + query.join("&");
|
|
}
|
|
|
|
function launchFaceAi() {
|
|
logFaceAiDebug("Redirecting to FaceAI handoff");
|
|
$("body").addClass("loading");
|
|
window.location.href = buildFaceAiLaunchUrl();
|
|
return false;
|
|
}
|
|
|
|
function initFaceAiRaceSearchButton() {
|
|
var select = $("#tipoPuntoFoto");
|
|
if (!select.length || $("#faceaiLaunchButton").length || !faceAiFeatureEnabled()) {
|
|
return;
|
|
}
|
|
|
|
var inputGroup = select.closest(".input-group");
|
|
var renderTarget = inputGroup.length ? inputGroup : select.parent();
|
|
var currentValue = select.val() || "";
|
|
|
|
if (!renderTarget.length) {
|
|
return;
|
|
}
|
|
|
|
select.off("change");
|
|
select.remove();
|
|
|
|
if (!$("#tipoPuntoFoto").length) {
|
|
renderTarget.append('<input type="hidden" name="tipoPuntoFoto" id="tipoPuntoFoto" value="' + currentValue.replace(/"/g, '"') + '">');
|
|
}
|
|
|
|
renderTarget.append('<button type="button" id="faceaiLaunchButton" class="btn btn-warning btn-block text-uppercase" onclick="return launchFaceAi();"><i class="fa fa-camera-retro" aria-hidden="true"></i> Face ID</button>');
|
|
}
|
|
|
|
function searching() {
|
|
//gara%201_gara-1---2.html
|
|
$("body").addClass("loading");
|
|
theSvlt = $("#garaDesc").val() + "_gara-" + $("#id_gara").val() + "-" + $("#id_puntoFoto").val() + "-" + getTipoPuntoFotoValue() + "-" + $("#pageRow").val() + "-1-"+$("#pettorale").val()+"-"+getCurrentLangValue()+".html";
|
|
//alert(theSvlt);
|
|
location.href = theSvlt;
|
|
|
|
}
|
|
function searchingTPF() {
|
|
//gara%201_gara-1---2.html
|
|
|
|
theSvlt = $("#garaDesc").val() + "_gara-" + $("#id_gara").val() + "--" + getTipoPuntoFotoValue() + "-" + $("#pageRow").val() + "-1.html";
|
|
//alert(theSvlt);
|
|
location.href = theSvlt;
|
|
|
|
}
|
|
function searchingPF() {
|
|
//gara%201_gara-1---2.html
|
|
|
|
theSvlt = $("#garaDesc").val() + "_gara-" + $("#id_gara").val() + "-" + $("#id_puntoFoto").val() + "--" + $("#pageRow").val() + "-1.html";
|
|
//alert(theSvlt);
|
|
location.href = theSvlt;
|
|
|
|
}
|
|
function loginFCR() {
|
|
//FACCIO IL SUBMIT
|
|
var f = document.frmLogin;
|
|
if (Ab.validateForm('login', 'Login', 'R', 'pwd', 'password', 'R')) {
|
|
$("body").addClass("loading");
|
|
f.cmdIU.value = "check";
|
|
f.act.value = "";
|
|
f.thePage.value = window.location.href;
|
|
f.action = "Logon.abl";
|
|
f.submit();
|
|
}
|
|
|
|
}
|
|
|
|
function mostraFoto(l_id) {
|
|
//alert("Foto2.abl?cmd=mostraFoto&id_foto=" + l_id);
|
|
$("#fotoView").load("Foto2.abl?cmd=mostraFoto&id_foto=" + l_id);
|
|
|
|
$("#ModalLog").modal("show");
|
|
|
|
}
|
|
/***************************************************/
|
|
/***************************************************/
|
|
/* PAGINA dati personali DOCUMENTOCR */
|
|
/***************************************************/
|
|
/***************************************************/
|
|
function loginDCR() {
|
|
//FACCIO IL SUBMIT
|
|
var f = document.frmLogin;
|
|
if (Ab.validateForm('login', 'Login', 'R', 'pwd', 'password', 'R')) {
|
|
$("body").addClass("loading");
|
|
f.cmdIU.value = "check";
|
|
f.act.value = ""
|
|
f.action = "Logon.abl";
|
|
f.submit();
|
|
}
|
|
|
|
}
|
|
/*************************************************************/
|
|
/*************************************************************/
|
|
/*** invia coupon
|
|
/*************************************************************/
|
|
/*************************************************************/
|
|
|
|
function inviaCoupon() {
|
|
//FACCIO IL SUBMIT
|
|
|
|
var f = document.frmCoupon;
|
|
if (Ab.validateForm('coupon', 'Coupon', 'R')) {
|
|
$("body").addClass("loading");
|
|
f.cmd.value = "inviaCoupon";
|
|
f.act.value = ""
|
|
f.action = "Ordine.abl";
|
|
f.submit();
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/*************************************************************/
|
|
/*************************************************************/
|
|
/*** LOST PASSWORD
|
|
/*************************************************************/
|
|
/*************************************************************/
|
|
|
|
function lostPwdForm(theForm) {
|
|
var f = theForm;
|
|
var l_lang = $("#lang").val();
|
|
if (Ab.validateForm('lostPwdEmail', 'Email di recupero', 'RisEmail')) {
|
|
$("body").addClass("loading");
|
|
f.action = "Users.abl";
|
|
f.cmd.value = "lostPassword";
|
|
f.act.value = "";
|
|
f.submit();
|
|
}
|
|
}
|
|
|
|
function lostPwdCheckOut() {
|
|
lostPwdForm(document.cart);
|
|
}
|
|
|
|
function lostPwdLogon() {
|
|
lostPwdForm(document.frmLogin);
|
|
}
|
|
|
|
/***************************************************/
|
|
/***************************************************/
|
|
/* PAGINA registrazione */
|
|
/***************************************************/
|
|
/***************************************************/
|
|
function controlloRegistrazione() {
|
|
//alert('pio');
|
|
var f = document.dettaglio;
|
|
//if (Ab.validateForm('login', 'Login', 'R', 'pwd', 'Password', 'R', 'nome', 'Nome', 'R', 'cognome', 'Cognome', 'R', 'eMail', 'Indirizzo e-mail', 'RisEmail', 'citta', 'Citta', 'R', 'cap', 'Cap', 'R', 'indirizzo', 'Indirizzo', 'R', 'numeroCivico', 'Numero Civico', 'R', 'codFisc', 'Codice Fiscale', 'R'))
|
|
if (Ab.validateForm('login', 'Login', 'R', 'pwd', 'Password', 'R', 'nome', 'Nome', 'R', 'cognome', 'Cognome', 'R', 'eMail', 'Indirizzo e-mail', 'RisEmail', 'citta', 'Citta', 'R', 'cap', 'Cap', 'R', 'indirizzo', 'Indirizzo', 'R', 'numeroCivico', 'Numero Civico', 'R'))
|
|
// if(true)
|
|
{
|
|
|
|
//checkboxes
|
|
|
|
|
|
if (f.ckFlgPrivTrattamento.checked) f.flgPrivTrattamento.value = "1";
|
|
else f.flgPrivTrattamento.value = "0";
|
|
if (f.ckFlgPrivComunicazione.checked) f.flgPrivComunicazione.value = "1";
|
|
else f.flgPrivComunicazione.value = "0";
|
|
if (f.ckflgMl.checked) f.flgMl.value = "1";
|
|
else f.flgMl.value = "0";
|
|
//privacy
|
|
|
|
if (f.flgPrivTrattamento.value == "1")
|
|
return true;
|
|
else {
|
|
alert("Attenzione!. E' obbligatorio fornire il consenso al trattamento dei dati comuni");
|
|
return false;
|
|
}
|
|
if (f.flgPrivComunicazione.value == "1")
|
|
return true;
|
|
else {
|
|
alert("Attenzione!. E' obbligatorio fornire il consenso alle norme di utilizzo delle immagini");
|
|
return false;
|
|
}
|
|
|
|
|
|
|
|
|
|
} else
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
/*************************************************************/
|
|
/*************************************************************/
|
|
/*** VISTA COMPATTA E ESTESA FOTOCR
|
|
/*************************************************************/
|
|
/*************************************************************/
|
|
|
|
function vistaCompatta() {
|
|
|
|
//fetch(servlet, command, divList, postProcess, async, type)
|
|
Ab.fetch("Foto2.abl", "cmd=vistaCompatta", "vis", null, 1);
|
|
var thePage= window.location.href;
|
|
|
|
location.href = thePage;
|
|
}
|
|
|
|
function vistaEstesa() {
|
|
|
|
Ab.fetch("Foto2.abl", "cmd=vistaEstesa", "vis", null, 1);
|
|
var thePage= window.location.href;
|
|
|
|
location.href = thePage;
|
|
}
|
|
|
|
/*************************************************************/
|
|
/*************************************************************/
|
|
/*** go page sopra
|
|
/*************************************************************/
|
|
/*************************************************************/
|
|
function goPage()
|
|
{
|
|
//richiamo anche un metodo che carica i checkBox e i checkRadio
|
|
var pnGo=$("#pageNumberGo").val(),
|
|
pn=$("#totPageNumber").val();
|
|
|
|
|
|
if(parseFloat(pnGo)<= parseFloat(pn))
|
|
{
|
|
theSvlt = $("#garaDesc").val() + "_gara-" + $("#id_gara").val() + "-" + $("#id_puntoFoto").val() + "-" + getTipoPuntoFotoValue() + "-" + $("#pageRow").val() + "-"+pnGo+".html";
|
|
//alert(theSvlt);
|
|
location.href = theSvlt;
|
|
}
|
|
else
|
|
alert('Errore!!');
|
|
}
|
|
|
|
$(function() {
|
|
initFaceAiRaceSearchButton();
|
|
initFaceAiErrorModal();
|
|
logFaceAiDebug("Legacy race page ready");
|
|
});
|
|
|
|
|
|
|
|
|
|
/*************************************************************/
|
|
/*************************************************************/
|
|
/*** fase INIZIALE pagamento paypal
|
|
/*************************************************************/
|
|
/*************************************************************/
|
|
function startPayPal()
|
|
{
|
|
var f = document.paypal;
|
|
//if (confirm(f.seiSicuro.value))
|
|
{
|
|
{
|
|
$("body").addClass("loading");
|
|
f.submit();
|
|
}
|
|
}
|
|
|
|
}
|
|
function startPayPal1()
|
|
{
|
|
$("#amt").val("20,00");
|
|
startPayPal();
|
|
|
|
}
|
|
function startPayPal3()
|
|
{
|
|
$("#amt").val("40,00");
|
|
startPayPal();
|
|
|
|
}
|
|
function startPayPal20f()
|
|
{
|
|
$("#amt").val("5,00");
|
|
startPayPal();
|
|
|
|
}
|
|
/*************************************************************/
|
|
/*************************************************************/
|
|
/*** fase finale pagamento paypal
|
|
/*************************************************************/
|
|
/*************************************************************/
|
|
function doPayPal()
|
|
{
|
|
var f = document.cart;
|
|
//if (confirm(f.seiSicuro.value))
|
|
{
|
|
|
|
{
|
|
$("body").addClass("loading");
|
|
f.action="PayPalDoPayment.abl";
|
|
f.cmd.value="doPayment";
|
|
f.submit();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
/*************************************************************/
|
|
/*************************************************************/
|
|
/*** faggiungo click thru sull'allegato immagine
|
|
/*************************************************************/
|
|
/*************************************************************/
|
|
function addClickThroughAttach(id)
|
|
{
|
|
//alert('aaaa News.abl?cmd=addClickThroughAttach&id='+id);
|
|
Ab.fetch4("News.abl", "cmd=addClickThroughAttach&id="+id, null, null, true, null) ;
|
|
//Ab.fetch("News.abl", "cmd=addClickThroughAttach&id="+id, "", null, 1);
|
|
|
|
}
|