added api
BIN
public/photostrf/296-20250509071709-images.jpg
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
public/photostrf/298-20250509072550-images.jpg
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
public/photostrf/300-20250509081112-images.jpg
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
public/photostrf/302-20250509081917-images.jpg
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
public/photostrf/304-20250509082403-images.jpg
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
public/photostrf/306-20250509083003-images.jpg
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
public/photostrf/308-20250509084245-images.jpg
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
public/photostrf/310-20250509085003-images.jpg
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
public/photostrf/312-20250509090555-images.jpg
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
public/photostrf/314-20250509112753-images.jpg
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 44 KiB |
BIN
public/photostrf/qrcodes/qrcode_296.png
Normal file
|
After Width: | Height: | Size: 515 B |
BIN
public/photostrf/qrcodes/qrcode_298.png
Normal file
|
After Width: | Height: | Size: 509 B |
BIN
public/photostrf/qrcodes/qrcode_300.png
Normal file
|
After Width: | Height: | Size: 508 B |
BIN
public/photostrf/qrcodes/qrcode_302.png
Normal file
|
After Width: | Height: | Size: 518 B |
BIN
public/photostrf/qrcodes/qrcode_304.png
Normal file
|
After Width: | Height: | Size: 510 B |
BIN
public/photostrf/qrcodes/qrcode_306.png
Normal file
|
After Width: | Height: | Size: 516 B |
BIN
public/photostrf/qrcodes/qrcode_308.png
Normal file
|
After Width: | Height: | Size: 512 B |
BIN
public/photostrf/qrcodes/qrcode_310.png
Normal file
|
After Width: | Height: | Size: 518 B |
BIN
public/photostrf/qrcodes/qrcode_312.png
Normal file
|
After Width: | Height: | Size: 511 B |
BIN
public/photostrf/qrcodes/qrcode_314.png
Normal file
|
After Width: | Height: | Size: 517 B |
83
public/userarea/auth_proxy.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// URL dell'API e credenziali
|
||||
$api_url = 'https://93.43.5.102/limsapi/api/authentication/authenticate';
|
||||
$credentials = [
|
||||
'Username' => 'WebApiUser',
|
||||
'Password' => 'webapiuser01'
|
||||
];
|
||||
|
||||
// Inizializza cURL
|
||||
$ch = curl_init($api_url);
|
||||
|
||||
// Configura le opzioni di cURL
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($credentials));
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
'User-Agent: Mozilla/5.0 (compatible; PHP cURL)'
|
||||
]);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Disabilita verifica SSL (solo test)
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // Disabilita verifica host (solo test)
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, true); // Abilita debug
|
||||
$log = fopen('curl_debug.log', 'a'); // Usa 'a' per appendere al log
|
||||
|
||||
// Gestione degli errori di apertura del file di log
|
||||
if ($log === false) {
|
||||
http_response_code(500);
|
||||
echo json_encode([
|
||||
'error' => 'Impossibile aprire il file di log per il debug'
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_STDERR, $log);
|
||||
|
||||
// Esegui la richiesta
|
||||
$response = curl_exec($ch);
|
||||
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
$curl_error = curl_error($ch);
|
||||
|
||||
fclose($log);
|
||||
|
||||
// Log della risposta per debug
|
||||
file_put_contents('curl_response.log', "HTTP Code: $http_code\nResponse: $response\n\n", FILE_APPEND);
|
||||
|
||||
// Verifica errori di esecuzione cURL
|
||||
if ($response === false) {
|
||||
http_response_code($http_code ? $http_code : 500);
|
||||
echo json_encode([
|
||||
'error' => 'Errore nella richiesta API',
|
||||
'http_code' => $http_code,
|
||||
'curl_error' => $curl_error
|
||||
]);
|
||||
curl_close($ch);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Rimuovi eventuali virgolette e spazi dalla risposta
|
||||
$trimmed_response = trim($response, '" \t\n\r\0\x0B');
|
||||
|
||||
// Se la risposta è una stringa non vuota, considerala il token
|
||||
if (is_string($trimmed_response) && !empty($trimmed_response)) {
|
||||
http_response_code($http_code);
|
||||
echo json_encode(['token' => $trimmed_response]);
|
||||
} else {
|
||||
// Tenta di decodificare la risposta come JSON
|
||||
$decoded = json_decode($response, true);
|
||||
if (json_last_error() === JSON_ERROR_NONE && isset($decoded['token']) && is_string($decoded['token']) && !empty($decoded['token'])) {
|
||||
http_response_code($http_code);
|
||||
echo json_encode(['token' => $decoded['token']]);
|
||||
} else {
|
||||
http_response_code($http_code);
|
||||
echo json_encode([
|
||||
'error' => 'Risposta non valida o token non trovato',
|
||||
'http_code' => $http_code,
|
||||
'response' => substr($response, 0, 1000)
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
curl_close($ch);
|
||||
76
public/userarea/class/connectapi.php
Normal file
@ -0,0 +1,76 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>VisualLims Authentication</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
max-width: 600px;
|
||||
margin: 20px auto;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
#authButton {
|
||||
padding: 10px 20px;
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#authButton:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
|
||||
#result {
|
||||
margin-top: 20px;
|
||||
padding: 10px;
|
||||
border: 1px solid #ccc;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>VisualLims Authentication</h1>
|
||||
<button id="authButton">Authenticate</button>
|
||||
<div id="result"></div>
|
||||
|
||||
<script>
|
||||
document.getElementById('authButton').addEventListener('click', async () => {
|
||||
const resultDiv = document.getElementById('result');
|
||||
resultDiv.textContent = 'Authenticating...';
|
||||
|
||||
try {
|
||||
const response = await fetch('https://93.43.5.102/limsapi/api/authentication/authenticate', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
Username: 'WebApiUserTest',
|
||||
Password: 'WebApiUserClienteTest'
|
||||
})
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
if (data && data.token) {
|
||||
resultDiv.textContent = `Token: ${data.token}`;
|
||||
} else {
|
||||
resultDiv.textContent = 'Authentication failed: No token received';
|
||||
}
|
||||
} catch (error) {
|
||||
resultDiv.textContent = `Error: ${error.message}`;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
104
public/userarea/connectapi.php
Normal file
@ -0,0 +1,104 @@
|
||||
<?php
|
||||
// Questo file può essere vuoto o contenere logica PHP aggiuntiva se necessario
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="it">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Autenticazione e Recupero Clienti VisualLims</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
max-width: 600px;
|
||||
margin: 20px auto;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
#authButton {
|
||||
padding: 10px 20px;
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#authButton:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
|
||||
#result {
|
||||
margin-top: 20px;
|
||||
padding: 10px;
|
||||
border: 1px solid #ccc;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Autenticazione e Recupero Clienti VisualLims</h1>
|
||||
<button id="authButton">Autentica e Recupera Clienti</button>
|
||||
<div id="result"></div>
|
||||
|
||||
<script>
|
||||
document.getElementById('authButton').addEventListener('click', async () => {
|
||||
const resultDiv = document.getElementById('result');
|
||||
resultDiv.textContent = 'Autenticazione e recupero clienti in corso...';
|
||||
|
||||
try {
|
||||
// Step 1: Autenticazione
|
||||
const authResponse = await fetch('auth_proxy.php', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
});
|
||||
|
||||
const authData = await authResponse.json();
|
||||
if (!authResponse.ok) {
|
||||
throw new Error(`Errore HTTP durante autenticazione! Stato: ${authResponse.status}, Dettagli: ${authData.error || JSON.stringify(authData)}`);
|
||||
}
|
||||
|
||||
// Estrai il token
|
||||
let token;
|
||||
if (authData.token && typeof authData.token === 'string' && authData.token.length > 0) {
|
||||
token = authData.token;
|
||||
} else {
|
||||
throw new Error(`Autenticazione fallita: Nessun token valido ricevuto. Dettagli: ${JSON.stringify(authData)}`);
|
||||
}
|
||||
|
||||
// Step 2: Recupero elenco clienti
|
||||
const clientiResponse = await fetch(`https://93.43.5.102/limsapi/api/odata/Cliente`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${token}`,
|
||||
'Accept': 'application/json',
|
||||
'User-Agent': 'Mozilla/5.0 (compatible; PHP cURL)'
|
||||
}
|
||||
});
|
||||
|
||||
const clientiData = await clientiResponse.json();
|
||||
if (!clientiResponse.ok) {
|
||||
throw new Error(`Errore HTTP durante recupero clienti! Stato: ${clientiResponse.status}, Dettagli: ${clientiData.error || JSON.stringify(clientiData)}`);
|
||||
}
|
||||
|
||||
// Mostra l'elenco dei clienti
|
||||
if (clientiData && clientiData.value && clientiData.value.length > 0) {
|
||||
const clientiList = clientiData.value.map(cliente => ({
|
||||
IdCliente: cliente.IdCliente,
|
||||
NomeCliente: cliente.Nome || 'N/A'
|
||||
}));
|
||||
resultDiv.textContent = `Clienti trovati:\n${JSON.stringify(clientiList, null, 2)}`;
|
||||
} else {
|
||||
resultDiv.textContent = `Nessun cliente trovato. Dettagli: ${JSON.stringify(clientiData)}`;
|
||||
}
|
||||
} catch (error) {
|
||||
resultDiv.textContent = `Errore: ${error.message}`;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
302
public/userarea/curl_debug.log
Normal file
@ -0,0 +1,302 @@
|
||||
* Trying 93.43.5.102:443...
|
||||
* Connected to 93.43.5.102 (93.43.5.102) port 443
|
||||
* ALPN: curl offers h2,http/1.1
|
||||
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
|
||||
* ALPN: server accepted h2
|
||||
* Server certificate:
|
||||
* subject: C=FR; ST=Île-de-France; O=Bureau Veritas; CN=bvcpsitaly-elims.it
|
||||
* start date: Feb 17 00:00:00 2025 GMT
|
||||
* expire date: Feb 17 23:59:59 2026 GMT
|
||||
* issuer: C=US; O=Corporation Service Company; CN=Corporation Service Company RSA OV SSL CA
|
||||
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
|
||||
* using HTTP/2
|
||||
* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/authentication/authenticate
|
||||
* [HTTP/2] [1] [:method: POST]
|
||||
* [HTTP/2] [1] [:scheme: https]
|
||||
* [HTTP/2] [1] [:authority: iftm.it]
|
||||
* [HTTP/2] [1] [:path: /limsapi/api/authentication/authenticate]
|
||||
* [HTTP/2] [1] [content-type: application/json]
|
||||
* [HTTP/2] [1] [accept: application/json]
|
||||
* [HTTP/2] [1] [user-agent: Mozilla/5.0 (compatible; PHP cURL)]
|
||||
* [HTTP/2] [1] [content-length: 51]
|
||||
> POST /limsapi/api/authentication/authenticate HTTP/2
|
||||
Host: iftm.it
|
||||
Content-Type: application/json
|
||||
Accept: application/json
|
||||
User-Agent: Mozilla/5.0 (compatible; PHP cURL)
|
||||
Content-Length: 51
|
||||
|
||||
< HTTP/2 200
|
||||
< cache-control: max-age=0
|
||||
< content-type: application/json; charset=utf-8
|
||||
< server: Microsoft-IIS/10.0
|
||||
< strict-transport-security: max-age=2592000
|
||||
< x-powered-by: ASP.NET
|
||||
< x-content-type-options: nosniff
|
||||
< date: Tue, 03 Jun 2025 09:34:52 GMT
|
||||
<
|
||||
* Connection #0 to host 93.43.5.102 left intact
|
||||
* Trying 83.149.157.58:443...
|
||||
* Connected to iftm.it (83.149.157.58) port 443
|
||||
* ALPN: curl offers h2,http/1.1
|
||||
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
|
||||
* ALPN: server accepted h2
|
||||
* Server certificate:
|
||||
* subject: CN=*.iftm.it
|
||||
* start date: Oct 8 07:42:11 2024 GMT
|
||||
* expire date: Oct 8 07:42:11 2025 GMT
|
||||
* issuer: C=IT; ST=Bergamo; L=Ponte San Pietro; O=Actalis S.p.A.; CN=Actalis Domain Validation Server CA G3
|
||||
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
|
||||
* using HTTP/2
|
||||
* [HTTP/2] [1] OPENED stream for https://iftm.it/visuallimswebapi/api/authentication/authenticate
|
||||
* [HTTP/2] [1] [:method: POST]
|
||||
* [HTTP/2] [1] [:scheme: https]
|
||||
* [HTTP/2] [1] [:authority: iftm.it]
|
||||
* [HTTP/2] [1] [:path: /visuallimswebapi/api/authentication/authenticate]
|
||||
* [HTTP/2] [1] [content-type: application/json]
|
||||
* [HTTP/2] [1] [accept: application/json]
|
||||
* [HTTP/2] [1] [user-agent: Mozilla/5.0 (compatible; PHP cURL)]
|
||||
* [HTTP/2] [1] [content-length: 64]
|
||||
> POST /visuallimswebapi/api/authentication/authenticate HTTP/2
|
||||
Host: iftm.it
|
||||
Content-Type: application/json
|
||||
Accept: application/json
|
||||
User-Agent: Mozilla/5.0 (compatible; PHP cURL)
|
||||
Content-Length: 64
|
||||
|
||||
< HTTP/2 401
|
||||
< content-type: application/json; charset=utf-8
|
||||
< server: Microsoft-IIS/10.0
|
||||
< strict-transport-security: max-age=2592000
|
||||
< x-powered-by: ASP.NET
|
||||
< date: Tue, 03 Jun 2025 09:41:50 GMT
|
||||
<
|
||||
* Connection #0 to host iftm.it left intact
|
||||
* Trying 93.43.5.102:443...
|
||||
* Connected to 93.43.5.102 (93.43.5.102) port 443
|
||||
* ALPN: curl offers h2,http/1.1
|
||||
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
|
||||
* ALPN: server accepted h2
|
||||
* Server certificate:
|
||||
* subject: C=FR; ST=Île-de-France; O=Bureau Veritas; CN=bvcpsitaly-elims.it
|
||||
* start date: Feb 17 00:00:00 2025 GMT
|
||||
* expire date: Feb 17 23:59:59 2026 GMT
|
||||
* issuer: C=US; O=Corporation Service Company; CN=Corporation Service Company RSA OV SSL CA
|
||||
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
|
||||
* using HTTP/2
|
||||
* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/authentication/authenticate
|
||||
* [HTTP/2] [1] [:method: POST]
|
||||
* [HTTP/2] [1] [:scheme: https]
|
||||
* [HTTP/2] [1] [:authority: 93.43.5.102]
|
||||
* [HTTP/2] [1] [:path: /limsapi/api/authentication/authenticate]
|
||||
* [HTTP/2] [1] [content-type: application/json]
|
||||
* [HTTP/2] [1] [accept: application/json]
|
||||
* [HTTP/2] [1] [user-agent: Mozilla/5.0 (compatible; PHP cURL)]
|
||||
* [HTTP/2] [1] [content-length: 51]
|
||||
> POST /limsapi/api/authentication/authenticate HTTP/2
|
||||
Host: 93.43.5.102
|
||||
Content-Type: application/json
|
||||
Accept: application/json
|
||||
User-Agent: Mozilla/5.0 (compatible; PHP cURL)
|
||||
Content-Length: 51
|
||||
|
||||
< HTTP/2 200
|
||||
< cache-control: max-age=0
|
||||
< content-type: application/json; charset=utf-8
|
||||
< server: Microsoft-IIS/10.0
|
||||
< strict-transport-security: max-age=2592000
|
||||
< x-powered-by: ASP.NET
|
||||
< x-content-type-options: nosniff
|
||||
< date: Tue, 03 Jun 2025 09:43:41 GMT
|
||||
<
|
||||
* Connection #0 to host 93.43.5.102 left intact
|
||||
* Trying 93.43.5.102:443...
|
||||
* Connected to 93.43.5.102 (93.43.5.102) port 443
|
||||
* ALPN: curl offers h2,http/1.1
|
||||
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
|
||||
* ALPN: server accepted h2
|
||||
* Server certificate:
|
||||
* subject: C=FR; ST=Île-de-France; O=Bureau Veritas; CN=bvcpsitaly-elims.it
|
||||
* start date: Feb 17 00:00:00 2025 GMT
|
||||
* expire date: Feb 17 23:59:59 2026 GMT
|
||||
* issuer: C=US; O=Corporation Service Company; CN=Corporation Service Company RSA OV SSL CA
|
||||
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
|
||||
* using HTTP/2
|
||||
* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/authentication/authenticate
|
||||
* [HTTP/2] [1] [:method: POST]
|
||||
* [HTTP/2] [1] [:scheme: https]
|
||||
* [HTTP/2] [1] [:authority: 93.43.5.102]
|
||||
* [HTTP/2] [1] [:path: /limsapi/api/authentication/authenticate]
|
||||
* [HTTP/2] [1] [content-type: application/json]
|
||||
* [HTTP/2] [1] [accept: application/json]
|
||||
* [HTTP/2] [1] [user-agent: Mozilla/5.0 (compatible; PHP cURL)]
|
||||
* [HTTP/2] [1] [content-length: 51]
|
||||
> POST /limsapi/api/authentication/authenticate HTTP/2
|
||||
Host: 93.43.5.102
|
||||
Content-Type: application/json
|
||||
Accept: application/json
|
||||
User-Agent: Mozilla/5.0 (compatible; PHP cURL)
|
||||
Content-Length: 51
|
||||
|
||||
< HTTP/2 200
|
||||
< cache-control: max-age=0
|
||||
< content-type: application/json; charset=utf-8
|
||||
< server: Microsoft-IIS/10.0
|
||||
< strict-transport-security: max-age=2592000
|
||||
< x-powered-by: ASP.NET
|
||||
< x-content-type-options: nosniff
|
||||
< date: Tue, 03 Jun 2025 09:45:25 GMT
|
||||
<
|
||||
* Connection #0 to host 93.43.5.102 left intact
|
||||
* Trying 93.43.5.102:443...
|
||||
* Connected to 93.43.5.102 (93.43.5.102) port 443
|
||||
* ALPN: curl offers h2,http/1.1
|
||||
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
|
||||
* ALPN: server accepted h2
|
||||
* Server certificate:
|
||||
* subject: C=FR; ST=Île-de-France; O=Bureau Veritas; CN=bvcpsitaly-elims.it
|
||||
* start date: Feb 17 00:00:00 2025 GMT
|
||||
* expire date: Feb 17 23:59:59 2026 GMT
|
||||
* issuer: C=US; O=Corporation Service Company; CN=Corporation Service Company RSA OV SSL CA
|
||||
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
|
||||
* using HTTP/2
|
||||
* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/authentication/authenticate
|
||||
* [HTTP/2] [1] [:method: POST]
|
||||
* [HTTP/2] [1] [:scheme: https]
|
||||
* [HTTP/2] [1] [:authority: 93.43.5.102]
|
||||
* [HTTP/2] [1] [:path: /limsapi/api/authentication/authenticate]
|
||||
* [HTTP/2] [1] [content-type: application/json]
|
||||
* [HTTP/2] [1] [accept: application/json]
|
||||
* [HTTP/2] [1] [user-agent: Mozilla/5.0 (compatible; PHP cURL)]
|
||||
* [HTTP/2] [1] [content-length: 51]
|
||||
> POST /limsapi/api/authentication/authenticate HTTP/2
|
||||
Host: 93.43.5.102
|
||||
Content-Type: application/json
|
||||
Accept: application/json
|
||||
User-Agent: Mozilla/5.0 (compatible; PHP cURL)
|
||||
Content-Length: 51
|
||||
|
||||
< HTTP/2 200
|
||||
< cache-control: max-age=0
|
||||
< content-type: application/json; charset=utf-8
|
||||
< server: Microsoft-IIS/10.0
|
||||
< strict-transport-security: max-age=2592000
|
||||
< x-powered-by: ASP.NET
|
||||
< x-content-type-options: nosniff
|
||||
< date: Tue, 03 Jun 2025 09:47:45 GMT
|
||||
<
|
||||
* Connection #0 to host 93.43.5.102 left intact
|
||||
* Trying 93.43.5.102:443...
|
||||
* Connected to 93.43.5.102 (93.43.5.102) port 443
|
||||
* ALPN: curl offers h2,http/1.1
|
||||
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
|
||||
* ALPN: server accepted h2
|
||||
* Server certificate:
|
||||
* subject: C=FR; ST=Île-de-France; O=Bureau Veritas; CN=bvcpsitaly-elims.it
|
||||
* start date: Feb 17 00:00:00 2025 GMT
|
||||
* expire date: Feb 17 23:59:59 2026 GMT
|
||||
* issuer: C=US; O=Corporation Service Company; CN=Corporation Service Company RSA OV SSL CA
|
||||
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
|
||||
* using HTTP/2
|
||||
* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/authentication/authenticate
|
||||
* [HTTP/2] [1] [:method: POST]
|
||||
* [HTTP/2] [1] [:scheme: https]
|
||||
* [HTTP/2] [1] [:authority: 93.43.5.102]
|
||||
* [HTTP/2] [1] [:path: /limsapi/api/authentication/authenticate]
|
||||
* [HTTP/2] [1] [content-type: application/json]
|
||||
* [HTTP/2] [1] [accept: application/json]
|
||||
* [HTTP/2] [1] [user-agent: Mozilla/5.0 (compatible; PHP cURL)]
|
||||
* [HTTP/2] [1] [content-length: 51]
|
||||
> POST /limsapi/api/authentication/authenticate HTTP/2
|
||||
Host: 93.43.5.102
|
||||
Content-Type: application/json
|
||||
Accept: application/json
|
||||
User-Agent: Mozilla/5.0 (compatible; PHP cURL)
|
||||
Content-Length: 51
|
||||
|
||||
< HTTP/2 200
|
||||
< cache-control: max-age=0
|
||||
< content-type: application/json; charset=utf-8
|
||||
< server: Microsoft-IIS/10.0
|
||||
< strict-transport-security: max-age=2592000
|
||||
< x-powered-by: ASP.NET
|
||||
< x-content-type-options: nosniff
|
||||
< date: Tue, 03 Jun 2025 09:48:27 GMT
|
||||
<
|
||||
* Connection #0 to host 93.43.5.102 left intact
|
||||
* Trying 93.43.5.102:443...
|
||||
* Connected to 93.43.5.102 (93.43.5.102) port 443
|
||||
* ALPN: curl offers h2,http/1.1
|
||||
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
|
||||
* ALPN: server accepted h2
|
||||
* Server certificate:
|
||||
* subject: C=FR; ST=Île-de-France; O=Bureau Veritas; CN=bvcpsitaly-elims.it
|
||||
* start date: Feb 17 00:00:00 2025 GMT
|
||||
* expire date: Feb 17 23:59:59 2026 GMT
|
||||
* issuer: C=US; O=Corporation Service Company; CN=Corporation Service Company RSA OV SSL CA
|
||||
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
|
||||
* using HTTP/2
|
||||
* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/authentication/authenticate
|
||||
* [HTTP/2] [1] [:method: POST]
|
||||
* [HTTP/2] [1] [:scheme: https]
|
||||
* [HTTP/2] [1] [:authority: 93.43.5.102]
|
||||
* [HTTP/2] [1] [:path: /limsapi/api/authentication/authenticate]
|
||||
* [HTTP/2] [1] [content-type: application/json]
|
||||
* [HTTP/2] [1] [accept: application/json]
|
||||
* [HTTP/2] [1] [user-agent: Mozilla/5.0 (compatible; PHP cURL)]
|
||||
* [HTTP/2] [1] [content-length: 51]
|
||||
> POST /limsapi/api/authentication/authenticate HTTP/2
|
||||
Host: 93.43.5.102
|
||||
Content-Type: application/json
|
||||
Accept: application/json
|
||||
User-Agent: Mozilla/5.0 (compatible; PHP cURL)
|
||||
Content-Length: 51
|
||||
|
||||
< HTTP/2 200
|
||||
< cache-control: max-age=0
|
||||
< content-type: application/json; charset=utf-8
|
||||
< server: Microsoft-IIS/10.0
|
||||
< strict-transport-security: max-age=2592000
|
||||
< x-powered-by: ASP.NET
|
||||
< x-content-type-options: nosniff
|
||||
< date: Tue, 03 Jun 2025 09:50:49 GMT
|
||||
<
|
||||
* Connection #0 to host 93.43.5.102 left intact
|
||||
* Trying 93.43.5.102:443...
|
||||
* Connected to 93.43.5.102 (93.43.5.102) port 443
|
||||
* ALPN: curl offers h2,http/1.1
|
||||
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
|
||||
* ALPN: server accepted h2
|
||||
* Server certificate:
|
||||
* subject: C=FR; ST=Île-de-France; O=Bureau Veritas; CN=bvcpsitaly-elims.it
|
||||
* start date: Feb 17 00:00:00 2025 GMT
|
||||
* expire date: Feb 17 23:59:59 2026 GMT
|
||||
* issuer: C=US; O=Corporation Service Company; CN=Corporation Service Company RSA OV SSL CA
|
||||
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
|
||||
* using HTTP/2
|
||||
* [HTTP/2] [1] OPENED stream for https://93.43.5.102/limsapi/api/authentication/authenticate
|
||||
* [HTTP/2] [1] [:method: POST]
|
||||
* [HTTP/2] [1] [:scheme: https]
|
||||
* [HTTP/2] [1] [:authority: 93.43.5.102]
|
||||
* [HTTP/2] [1] [:path: /limsapi/api/authentication/authenticate]
|
||||
* [HTTP/2] [1] [content-type: application/json]
|
||||
* [HTTP/2] [1] [accept: application/json]
|
||||
* [HTTP/2] [1] [user-agent: Mozilla/5.0 (compatible; PHP cURL)]
|
||||
* [HTTP/2] [1] [content-length: 51]
|
||||
> POST /limsapi/api/authentication/authenticate HTTP/2
|
||||
Host: 93.43.5.102
|
||||
Content-Type: application/json
|
||||
Accept: application/json
|
||||
User-Agent: Mozilla/5.0 (compatible; PHP cURL)
|
||||
Content-Length: 51
|
||||
|
||||
< HTTP/2 200
|
||||
< cache-control: max-age=0
|
||||
< content-type: application/json; charset=utf-8
|
||||
< server: Microsoft-IIS/10.0
|
||||
< strict-transport-security: max-age=2592000
|
||||
< x-powered-by: ASP.NET
|
||||
< x-content-type-options: nosniff
|
||||
< date: Tue, 03 Jun 2025 09:55:50 GMT
|
||||
<
|
||||
* Connection #0 to host 93.43.5.102 left intact
|
||||
18
public/userarea/curl_response.log
Normal file
@ -0,0 +1,18 @@
|
||||
HTTP Code: 200
|
||||
Response: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc0ODk1MTAyMSwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.KntKk8Up-9owFjy7onziK2BfncEnSNhizyNX9S-QHaw"
|
||||
|
||||
HTTP Code: 200
|
||||
Response: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc0ODk1MTEyNSwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.IWjzzBg0kQ3lq4aK2ByMlY7Bwzb7Qq-6ziXV8kkZ2J0"
|
||||
|
||||
HTTP Code: 200
|
||||
Response: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc0ODk1MTI2NSwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.UgVz6PTF9dmbFYdgyRZS0TcI0pvLEIQ3yMjPiicF1vs"
|
||||
|
||||
HTTP Code: 200
|
||||
Response: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc0ODk1MTMwNywiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.PolfU_FWuVMd-YfonBYTo0i0qIl6kn6nUkCWCEBvZuA"
|
||||
|
||||
HTTP Code: 200
|
||||
Response: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc0ODk1MTQ0OSwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.CGZ-9KbMmW19JYTVGfjIcbNscSsGB4dwoHCJkHHs_4M"
|
||||
|
||||
HTTP Code: 200
|
||||
Response: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQ5MiIsIlhhZlNlY3VyaXR5QXV0aFBhc3NlZCI6IlhhZlNlY3VyaXR5QXV0aFBhc3NlZCIsImh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3dzLzIwMDUvMDUvaWRlbnRpdHkvY2xhaW1zL25hbWUiOiJXZWJBcGlVc2VyIiwiWGFmU2VjdXJpdHkiOiJYYWZTZWN1cml0eSIsIlhhZkxvZ29uUGFyYW1zIjoicTFZS0xVNHQ4a3ZNVFZXeVVncFBUWElzeUFRSktPa29CU1FXRjVmbkY2VUF4Y3RUa3hJTE1rdUI0Z2FHU3JVQSIsImV4cCI6MTc0ODk1MTc1MCwiaXNzIjoiTXkiLCJhdWQiOiJodHRwOi8vbG9jYWxob3N0OjQyMDAifQ.FCAm5sWed1Q-QiIsctMgSBfEd4sfN3kfVR3Mqd3XQz0"
|
||||
|
||||
50
public/userarea/get_clienti.php
Normal file
@ -0,0 +1,50 @@
|
||||
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// Ottieni il token da auth_proxy.php
|
||||
$auth_url = 'http://localhost/auth_proxy.php'; // Assicurati che il percorso sia corretto
|
||||
$ch = curl_init($auth_url);
|
||||
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Disabilita verifica SSL
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // Disabilita verifica host
|
||||
|
||||
$response = curl_exec($ch);
|
||||
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
if ($http_code != 200) {
|
||||
echo json_encode(['error' => 'Errore nell\'autenticazione', 'http_code' => $http_code, 'response' => $response]);
|
||||
exit;
|
||||
}
|
||||
|
||||
$token = trim($response); // Rimuove spazi o newline dal token
|
||||
|
||||
// Usa il token per richiedere la lista dei clienti
|
||||
$clienti_url = 'https://93.43.5.102/limsapi/api/odata/Cliente';
|
||||
$ch = curl_init($clienti_url);
|
||||
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPGET, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Authorization: Bearer ' . $token,
|
||||
'Accept: application/json',
|
||||
'Host: iftm.it'
|
||||
]);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Disabilita verifica SSL
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // Disabilita verifica host
|
||||
|
||||
$response = curl_exec($ch);
|
||||
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
$curl_error = curl_error($ch);
|
||||
curl_close($ch);
|
||||
|
||||
if ($http_code != 200) {
|
||||
echo json_encode(['error' => 'Errore nella richiesta dei clienti', 'http_code' => $http_code, 'curl_error' => $curl_error, 'response' => $response]);
|
||||
} else {
|
||||
echo $response; // Restituisce la lista completa dei clienti in JSON
|
||||
}
|
||||
?>
|
||||
29
public/userarea/load_photo.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
include('include/headscript.php');
|
||||
|
||||
$dbHandler = DBHandlerSelect::getInstance();
|
||||
$pdo = $dbHandler->getConnection();
|
||||
|
||||
$iddatadb = $_GET['iddatadb'] ?? null;
|
||||
|
||||
if (!$iddatadb) {
|
||||
echo json_encode(['success' => false, 'message' => 'ID TRF mancante']);
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
$stmt = $pdo->prepare("SELECT file_path FROM datadb_photos WHERE iddatadb = :iddatadb LIMIT 1");
|
||||
$stmt->execute([':iddatadb' => $iddatadb]);
|
||||
$photo = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($photo && $photo['file_path']) {
|
||||
$fullPath = '../photostrf/' . $photo['file_path']; // Assumi che le foto siano nella cartella photostrf
|
||||
echo json_encode(['success' => true, 'file_path' => $fullPath]);
|
||||
} else {
|
||||
echo json_encode(['success' => false, 'message' => 'Nessuna foto trovata']);
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo json_encode(['success' => false, 'message' => 'Errore nel caricamento: ' . $e->getMessage()]);
|
||||
}
|
||||
@ -7,29 +7,47 @@
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<table class="table table-striped table-sm" id="partsTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Num. Parte</th>
|
||||
<th>Descrizione Parte</th>
|
||||
<th>Azioni</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="partsTableBody">
|
||||
<tr data-part-id="new">
|
||||
<td><input type="number" class="form-control form-control-sm part-number" value="1" style="width: 80px;"></td>
|
||||
<td><input type="text" class="form-control form-control-sm part-description" placeholder="Inserisci descrizione" style="width: 100%;"></td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-success btn-sm add-row" style="padding: 0.1rem 0.3rem; font-size: 0.8rem;"><i class="fas fa-plus fa-xs"></i></button>
|
||||
<button type="button" class="btn btn-danger btn-sm remove-row" style="padding: 0.1rem 0.3rem; font-size: 0.8rem; display: none;"><i class="fas fa-trash fa-xs"></i></button>
|
||||
<span class="save-status text-success" style="display: none; margin-left: 5px;"><i class="fas fa-check fa-xs"></i></span>
|
||||
<span class="save-loading text-warning" style="display: none; margin-left: 5px;"><i class="fas fa-spinner fa-spin fa-xs"></i></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h6>Elenco Parti</h6>
|
||||
<ul id="partsList" class="list-group"></ul>
|
||||
<table class="table table-striped table-sm mt-3" id="partsTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Num. Parte</th>
|
||||
<th>Descrizione Parte</th>
|
||||
<th>Azioni</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="partsTableBody">
|
||||
<tr data-part-id="new">
|
||||
<td><input type="number" class="form-control form-control-sm part-number" value="1" style="width: 80px;"></td>
|
||||
<td><input type="text" class="form-control form-control-sm part-description" placeholder="Inserisci descrizione" style="width: 100%;"></td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-success btn-sm add-row" style="padding: 0.1rem 0.3rem; font-size: 0.8rem;"><i class="fas fa-plus fa-xs"></i></button>
|
||||
<button type="button" class="btn btn-danger btn-sm remove-row" style="padding: 0.1rem 0.3rem; font-size: 0.8rem; display: none;"><i class="fas fa-trash fa-xs"></i></button>
|
||||
<span class="save-status text-success" style="display: none; margin-left: 5px;"><i class="fas fa-check fa-xs"></i></span>
|
||||
<span class="save-loading text-warning" style="display: none; margin-left: 5px;"><i class="fas fa-spinner fa-spin fa-xs"></i></span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<h6>Foto del Campione</h6>
|
||||
<div style="position: relative; width: 100%; min-height: 400px;">
|
||||
<img id="samplePhoto" src="" alt="Foto del campione" style="max-width: 100%; max-height: 100%; object-fit: contain; position: absolute; top: 0; left: 0;">
|
||||
<canvas id="photoCanvas" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></canvas>
|
||||
<div id="descriptionList" class="draggable-description" style="display: none;"></div>
|
||||
<div id="markerContainer"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary btn-sm" id="addDescriptionsBtn" style="padding: 0.1rem 0.5rem; font-size: 0.8rem;">Aggiungi Lista Descrizioni</button>
|
||||
<button type="button" class="btn btn-danger btn-sm" id="removeAnnotationsBtn" style="padding: 0.1rem 0.5rem; font-size: 0.8rem;">Rimuovi Annotazioni</button>
|
||||
<button type="button" class="btn btn-success btn-sm" id="savePhotoBtn" style="padding: 0.1rem 0.5rem; font-size: 0.8rem;">Salva Foto con Nome</button>
|
||||
<button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal" style="padding: 0.1rem 0.5rem; font-size: 0.8rem;">Chiudi</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -50,7 +68,6 @@
|
||||
#partsTable th {
|
||||
padding: 0.2rem;
|
||||
vertical-align: middle;
|
||||
/* Allinea verticalmente il contenuto */
|
||||
}
|
||||
|
||||
#partsTable input {
|
||||
@ -71,4 +88,49 @@
|
||||
width: 100% !important;
|
||||
max-width: 100% !important;
|
||||
}
|
||||
|
||||
#partsList .list-group-item {
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
#partsList .list-group-item:hover {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.draggable-description {
|
||||
position: absolute;
|
||||
background: rgba(255, 255, 255, 0.8);
|
||||
padding: 5px;
|
||||
font-size: 10px;
|
||||
font-family: Arial, sans-serif;
|
||||
color: #000000;
|
||||
cursor: move;
|
||||
user-select: none;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.draggable-marker {
|
||||
position: absolute;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background: rgba(255, 0, 0, 0.5);
|
||||
border: 1px solid #ff0000;
|
||||
border-radius: 50%;
|
||||
color: #ffffff;
|
||||
text-align: center;
|
||||
line-height: 16px;
|
||||
font-size: 8px;
|
||||
cursor: move;
|
||||
user-select: none;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
#markerContainer {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
@ -17,11 +17,55 @@ $(document).ready(function () {
|
||||
$("#trfHeader").text(`${iddatadb} - ${importRef} - ${description}`);
|
||||
$("#partsModal").data("iddatadb", iddatadb);
|
||||
|
||||
loadPhoto(iddatadb);
|
||||
loadExistingParts(iddatadb);
|
||||
|
||||
$("#partsModal").modal("show");
|
||||
});
|
||||
|
||||
function loadPhoto(iddatadb) {
|
||||
$.ajax({
|
||||
url: "load_photo.php",
|
||||
method: "GET",
|
||||
data: { iddatadb: iddatadb },
|
||||
success: function (response) {
|
||||
if (response.success && response.file_path) {
|
||||
const img = $("#samplePhoto");
|
||||
img.attr("src", response.file_path);
|
||||
img.on("load", function () {
|
||||
const container = img.parent();
|
||||
const canvas = document.getElementById("photoCanvas");
|
||||
const containerWidth = container.width();
|
||||
const containerHeight = container.height();
|
||||
const scaleX = containerWidth / img[0].naturalWidth;
|
||||
const scaleY = containerHeight / img[0].naturalHeight;
|
||||
const scale = Math.min(scaleX, scaleY);
|
||||
canvas.width = img[0].naturalWidth * scale;
|
||||
canvas.height = img[0].naturalHeight * scale;
|
||||
canvas.style.width = `${containerWidth}px`;
|
||||
canvas.style.height = `${containerHeight}px`;
|
||||
const ctx = canvas.getContext("2d");
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
ctx.drawImage(
|
||||
img.get(0),
|
||||
0,
|
||||
0,
|
||||
canvas.width,
|
||||
canvas.height,
|
||||
);
|
||||
updateMarkers();
|
||||
});
|
||||
} else {
|
||||
$("#samplePhoto").attr("src", "");
|
||||
alert("Nessuna foto trovata per questo TRF.");
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
alert("Errore nel caricamento della foto: " + error);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function addNewRow(nextPartNumber) {
|
||||
const newRow = `
|
||||
<tr data-part-id="new">
|
||||
@ -62,6 +106,7 @@ $(document).ready(function () {
|
||||
.get(),
|
||||
);
|
||||
addNewRow(maxPartNumber + 1);
|
||||
updatePartsList();
|
||||
});
|
||||
|
||||
$(document).on("click", ".remove-row", function (e) {
|
||||
@ -71,7 +116,8 @@ $(document).ready(function () {
|
||||
const partId = $row.data("part-id");
|
||||
console.log("ID parte da eliminare:", partId);
|
||||
|
||||
if (partId !== "new") {
|
||||
if (partId !== "new" && partId !== undefined && partId !== null) {
|
||||
console.log("Procedo con la cancellazione dal database");
|
||||
$.ajax({
|
||||
url: "delete_part.php",
|
||||
method: "POST",
|
||||
@ -88,6 +134,8 @@ $(document).ready(function () {
|
||||
if (response.success) {
|
||||
$row.remove();
|
||||
updateRowButtons();
|
||||
updatePartsList();
|
||||
clearCanvasMarkers();
|
||||
} else {
|
||||
alert("Errore nell'eliminazione: " + response.message);
|
||||
}
|
||||
@ -105,8 +153,12 @@ $(document).ready(function () {
|
||||
},
|
||||
});
|
||||
} else {
|
||||
console.log(
|
||||
'Riga non salvata nel database (partId = "new" o non definito), rimuovo solo visivamente',
|
||||
);
|
||||
$row.remove();
|
||||
updateRowButtons();
|
||||
updatePartsList();
|
||||
}
|
||||
});
|
||||
|
||||
@ -140,8 +192,16 @@ $(document).ready(function () {
|
||||
contentType: "application/json",
|
||||
success: function (response) {
|
||||
if (response.success) {
|
||||
if (response.part_id) {
|
||||
$row.data("part-id", response.part_id);
|
||||
console.log(
|
||||
"Aggiornato partId della riga:",
|
||||
response.part_id,
|
||||
);
|
||||
}
|
||||
$saveLoading.hide();
|
||||
$saveStatus.show();
|
||||
updatePartsList();
|
||||
setTimeout(() => $saveStatus.hide(), 2000);
|
||||
} else {
|
||||
alert("Errore nel salvataggio: " + response.message);
|
||||
@ -184,6 +244,7 @@ $(document).ready(function () {
|
||||
addNewRow(1);
|
||||
}
|
||||
updateRowButtons();
|
||||
updatePartsList();
|
||||
} else {
|
||||
alert(
|
||||
"Errore nel caricamento delle parti: " +
|
||||
@ -199,6 +260,308 @@ $(document).ready(function () {
|
||||
});
|
||||
}
|
||||
|
||||
function updatePartsList() {
|
||||
$("#partsList").empty();
|
||||
$("#partsTableBody tr").each(function () {
|
||||
const partNumber = $(this).find(".part-number").val();
|
||||
const partDescription = $(this).find(".part-description").val();
|
||||
if (partNumber && partDescription) {
|
||||
const listItem = `<li class="list-group-item" data-part-number="${partNumber}">${partNumber} - ${partDescription}</li>`;
|
||||
$("#partsList").append(listItem);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let selectedPartNumber = null;
|
||||
let markers = [];
|
||||
let descriptionPosition = { x: 10, y: 10 };
|
||||
let hasDescriptions = false;
|
||||
|
||||
$("#partsList").on("click", "li", function () {
|
||||
selectedPartNumber = $(this).data("part-number");
|
||||
console.log("Part number selezionato:", selectedPartNumber);
|
||||
$(this).addClass("active").siblings().removeClass("active");
|
||||
});
|
||||
|
||||
const canvas = document.getElementById("photoCanvas");
|
||||
const ctx = canvas.getContext("2d");
|
||||
|
||||
$("#markerContainer").on("click", function (e) {
|
||||
console.log("Click sul markerContainer rilevato"); // Debug
|
||||
if (selectedPartNumber !== null) {
|
||||
const img = $("#samplePhoto");
|
||||
const canvas = document.getElementById("photoCanvas");
|
||||
const rect = canvas.getBoundingClientRect();
|
||||
const container = img.parent();
|
||||
const containerWidth = container.width();
|
||||
const containerHeight = container.height();
|
||||
const scaleX = containerWidth / img.get(0).naturalWidth;
|
||||
const scaleY = containerHeight / img.get(0).naturalHeight;
|
||||
const scale = Math.min(scaleX, scaleY);
|
||||
const x = (e.clientX - rect.left) / scale;
|
||||
const y = (e.clientY - rect.top) / scale;
|
||||
|
||||
console.log("Coordinate cliccate (x, y):", x, y); // Debug
|
||||
|
||||
const existingMarker = markers.find(
|
||||
(m) => m.partNumber == selectedPartNumber,
|
||||
);
|
||||
if (existingMarker) {
|
||||
existingMarker.x = x;
|
||||
existingMarker.y = y;
|
||||
} else {
|
||||
markers.push({ partNumber: selectedPartNumber, x, y });
|
||||
}
|
||||
console.log("Markers aggiornati:", markers); // Debug
|
||||
updateMarkers();
|
||||
if (hasDescriptions) {
|
||||
drawDescriptions(descriptionPosition.x, descriptionPosition.y);
|
||||
}
|
||||
selectedPartNumber = null;
|
||||
$("#partsList li").removeClass("active");
|
||||
} else {
|
||||
console.log("Nessun part number selezionato"); // Debug
|
||||
}
|
||||
});
|
||||
function updateMarkers() {
|
||||
const img = $("#samplePhoto");
|
||||
const container = img.parent();
|
||||
const containerWidth = container.width();
|
||||
const containerHeight = container.height();
|
||||
const scaleX = containerWidth / img.get(0).naturalWidth;
|
||||
const scaleY = containerHeight / img.get(0).naturalHeight;
|
||||
const scale = Math.min(scaleX, scaleY);
|
||||
|
||||
const markerContainer = $("#markerContainer");
|
||||
markerContainer.empty();
|
||||
|
||||
markers.forEach((marker) => {
|
||||
const scaledX = marker.x * scale;
|
||||
const scaledY = marker.y * scale;
|
||||
console.log(
|
||||
"Aggiungo marker:",
|
||||
marker.partNumber,
|
||||
"a posizione (scaledX, scaledY):",
|
||||
scaledX,
|
||||
scaledY,
|
||||
); // Debug
|
||||
const $marker = $(
|
||||
`<div class="draggable-marker">${marker.partNumber}</div>`,
|
||||
).css({
|
||||
left: scaledX - 8 + "px",
|
||||
top: scaledY - 8 + "px",
|
||||
});
|
||||
markerContainer.append($marker);
|
||||
makeDraggable($marker, marker, scale);
|
||||
});
|
||||
}
|
||||
|
||||
function makeDraggable($element, item, scale) {
|
||||
let isDragging = false;
|
||||
let currentX = parseFloat($element.css("left")) || 0;
|
||||
let currentY = parseFloat($element.css("top")) || 0;
|
||||
let initialX, initialY;
|
||||
|
||||
$element.on("mousedown", function (e) {
|
||||
e.preventDefault();
|
||||
isDragging = true;
|
||||
initialX = e.clientX - currentX;
|
||||
initialY = e.clientY - currentY;
|
||||
$element.css("z-index", 1001);
|
||||
});
|
||||
|
||||
$(document).on("mousemove", function (e) {
|
||||
if (isDragging) {
|
||||
e.preventDefault();
|
||||
currentX = e.clientX - initialX;
|
||||
currentY = e.clientY - initialY;
|
||||
const container = $("#photoCanvas").parent();
|
||||
const containerWidth = container.width();
|
||||
const containerHeight = container.height();
|
||||
const maxX = containerWidth - $element.width();
|
||||
const maxY = containerHeight - $element.height();
|
||||
|
||||
currentX = Math.max(0, Math.min(currentX, maxX));
|
||||
currentY = Math.max(0, Math.min(currentY, maxY));
|
||||
|
||||
$element.css({
|
||||
left: currentX + "px",
|
||||
top: currentY + "px",
|
||||
});
|
||||
|
||||
if (item.partNumber) {
|
||||
// È un marker
|
||||
item.x = (currentX + 8) / scale;
|
||||
item.y = (currentY + 8) / scale;
|
||||
} else {
|
||||
// È la lista
|
||||
descriptionPosition.x = (currentX + 5) / scale;
|
||||
descriptionPosition.y = (currentY + 5) / scale;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on("mouseup", function () {
|
||||
isDragging = false;
|
||||
$element.css("z-index", 1000);
|
||||
});
|
||||
}
|
||||
|
||||
function drawDescriptions(x, y) {
|
||||
const img = $("#samplePhoto");
|
||||
const container = img.parent();
|
||||
const containerWidth = container.width();
|
||||
const containerHeight = container.height();
|
||||
const scaleX = containerWidth / img.get(0).naturalWidth;
|
||||
const scaleY = containerHeight / img.get(0).naturalHeight;
|
||||
const scale = Math.min(scaleX, scaleY);
|
||||
|
||||
const partsList = [];
|
||||
$("#partsTableBody tr").each(function () {
|
||||
const partNumber = $(this).find(".part-number").val();
|
||||
const partDescription = $(this).find(".part-description").val();
|
||||
if (partNumber && partDescription) {
|
||||
partsList.push(`${partNumber} ${partDescription}`);
|
||||
}
|
||||
});
|
||||
|
||||
const descriptionList = $("#descriptionList");
|
||||
descriptionList.empty();
|
||||
descriptionList.css({
|
||||
display: "block",
|
||||
top: y * scale + "px",
|
||||
left: x * scale + "px",
|
||||
width: "200px",
|
||||
});
|
||||
partsList.forEach((part) => {
|
||||
descriptionList.append(`<div>${part}</div>`);
|
||||
});
|
||||
|
||||
updateMarkers();
|
||||
}
|
||||
|
||||
function clearCanvasMarkers() {
|
||||
markers = [];
|
||||
hasDescriptions = false;
|
||||
$("#descriptionList").css("display", "none");
|
||||
$("#markerContainer").empty();
|
||||
const canvas = document.getElementById("photoCanvas");
|
||||
const img = $("#samplePhoto");
|
||||
const ctx = canvas.getContext("2d");
|
||||
const container = img.parent();
|
||||
const containerWidth = container.width();
|
||||
const containerHeight = container.height();
|
||||
const scaleX = containerWidth / img.get(0).naturalWidth;
|
||||
const scaleY = containerHeight / img.get(0).naturalHeight;
|
||||
const scale = Math.min(scaleX, scaleY);
|
||||
|
||||
canvas.width = img.get(0).naturalWidth * scale;
|
||||
canvas.height = img.get(0).naturalHeight * scale;
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
ctx.drawImage(img.get(0), 0, 0, canvas.width, canvas.height);
|
||||
}
|
||||
|
||||
$("#addDescriptionsBtn").on("click", function () {
|
||||
hasDescriptions = true;
|
||||
descriptionPosition = { x: 10, y: 10 };
|
||||
drawDescriptions(descriptionPosition.x, descriptionPosition.y);
|
||||
makeDraggable(
|
||||
$("#descriptionList"),
|
||||
descriptionPosition,
|
||||
Math.min(
|
||||
$("#photoCanvas").parent().width() /
|
||||
$("#samplePhoto").get(0).naturalWidth,
|
||||
$("#photoCanvas").parent().height() /
|
||||
$("#samplePhoto").get(0).naturalHeight,
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
$("#removeAnnotationsBtn").on("click", function () {
|
||||
clearCanvasMarkers();
|
||||
});
|
||||
|
||||
$("#savePhotoBtn").on("click", function () {
|
||||
const canvas = document.getElementById("photoCanvas");
|
||||
const img = $("#samplePhoto");
|
||||
const ctx = canvas.getContext("2d");
|
||||
|
||||
canvas.width = img.get(0).naturalWidth;
|
||||
canvas.height = img.get(0).naturalHeight;
|
||||
ctx.drawImage(img.get(0), 0, 0);
|
||||
|
||||
const partsList = [];
|
||||
$("#partsTableBody tr").each(function () {
|
||||
const partNumber = $(this).find(".part-number").val();
|
||||
const partDescription = $(this).find(".part-description").val();
|
||||
if (partNumber && partDescription) {
|
||||
partsList.push(`${partNumber} ${partDescription}`);
|
||||
}
|
||||
});
|
||||
|
||||
if (hasDescriptions) {
|
||||
ctx.fillStyle = "rgba(255, 255, 255, 0.8)";
|
||||
ctx.fillRect(
|
||||
descriptionPosition.x,
|
||||
descriptionPosition.y,
|
||||
200,
|
||||
partsList.length * 12 + 10,
|
||||
);
|
||||
ctx.fillStyle = "#000000";
|
||||
ctx.font = "10px Arial";
|
||||
partsList.forEach((part, index) => {
|
||||
ctx.fillText(
|
||||
part,
|
||||
descriptionPosition.x + 5,
|
||||
descriptionPosition.y + 12 + index * 12,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
markers.forEach((marker) => {
|
||||
ctx.beginPath();
|
||||
ctx.arc(marker.x, marker.y, 8, 0, 2 * Math.PI);
|
||||
ctx.fillStyle = "rgba(255, 0, 0, 0.5)";
|
||||
ctx.fill();
|
||||
ctx.strokeStyle = "#ff0000";
|
||||
ctx.lineWidth = 1;
|
||||
ctx.stroke();
|
||||
ctx.fillStyle = "#ffffff";
|
||||
ctx.font = "bold 8px Arial";
|
||||
ctx.textAlign = "center";
|
||||
ctx.textBaseline = "middle";
|
||||
ctx.fillText(marker.partNumber, marker.x, marker.y);
|
||||
});
|
||||
|
||||
const dataURL = canvas.toDataURL("image/png");
|
||||
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
||||
const defaultName = `photo_${$("#partsModal").data("iddatadb")}_${timestamp}.png`;
|
||||
const newName = prompt(
|
||||
"Inserisci il nome del file (senza estensione):",
|
||||
defaultName.split(".png")[0],
|
||||
);
|
||||
if (newName) {
|
||||
const finalName = newName + "_" + timestamp + ".png";
|
||||
$.ajax({
|
||||
url: "save_annotated_photo.php",
|
||||
method: "POST",
|
||||
data: { dataURL: dataURL, filename: finalName },
|
||||
success: function (response) {
|
||||
if (response.success) {
|
||||
alert(
|
||||
"Foto salvata con successo: " + response.file_path,
|
||||
);
|
||||
} else {
|
||||
alert("Errore nel salvataggio: " + response.message);
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
alert("Errore nel salvataggio della foto: " + error);
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on("mouseenter", "tr", function () {
|
||||
console.log("Mouse entrato su riga");
|
||||
});
|
||||
|
||||
25
public/userarea/save_annotated_photo.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
include('include/headscript.php');
|
||||
|
||||
$dataURL = $_POST['dataURL'] ?? null;
|
||||
$filename = $_POST['filename'] ?? null;
|
||||
|
||||
if (!$dataURL || !$filename) {
|
||||
echo json_encode(['success' => false, 'message' => 'Dati mancanti']);
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
$data = explode(',', $dataURL)[1];
|
||||
$decodedData = base64_decode($data);
|
||||
$filePath = '../photostrf/annotated/' . $filename; // Crea una sottocartella 'annotated' per le foto modificate
|
||||
if (!file_exists('../photostrf/annotated')) {
|
||||
mkdir('../photostrf/annotated', 0777, true);
|
||||
}
|
||||
file_put_contents($filePath, $decodedData);
|
||||
echo json_encode(['success' => true, 'file_path' => $filePath, 'message' => 'Foto salvata con successo']);
|
||||
} catch (Exception $e) {
|
||||
echo json_encode(['success' => false, 'message' => 'Errore nel salvataggio: ' . $e->getMessage()]);
|
||||
}
|
||||