- Introduced a new workspace for FaceAI in package.json. - Implemented FaceAI handoff logic in faceai_handoff.php, including identity verification and token signing. - Created faceai_return.php to handle return requests from FaceAI, validating tokens and forwarding results. - Developed faceai_simulator.php and faceai_simulator_view.php for simulating the FaceAI interface with demo photos. - Enhanced rus-ecom-240621.js to support new FaceAI features, including dynamic URL building and button integration. - Added faceai_config.php for configuration management, including environment variable handling and utility functions. - Updated HTML structure and styles in simulator view for better user experience.
452 lines
12 KiB
JavaScript
452 lines
12 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 buildFaceAiLaunchUrl() {
|
|
var raceId = $("#id_gara").val() || "";
|
|
var raceSlug = $("#garaDesc").val() || "";
|
|
var raceName = $("h1.my-4").last().text().replace(/\s+/g, " ").trim();
|
|
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),
|
|
"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));
|
|
}
|
|
|
|
return handoffUrl + "?" + query.join("&");
|
|
}
|
|
|
|
function launchFaceAi() {
|
|
$("body").addClass("loading");
|
|
window.location.href = buildFaceAiLaunchUrl();
|
|
return false;
|
|
}
|
|
|
|
function initFaceAiRaceSearchButton() {
|
|
var select = $("#tipoPuntoFoto");
|
|
if (!select.length || $("#faceaiLaunchButton").length) {
|
|
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();
|
|
});
|
|
|
|
|
|
|
|
|
|
/*************************************************************/
|
|
/*************************************************************/
|
|
/*** 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);
|
|
|
|
}
|