fix client connet redirect to scheda on page - migrazione localization

This commit is contained in:
test
2026-08-31 12:19:24 +02:00
parent 47af0c6bad
commit f849a069f8
10 changed files with 38 additions and 79 deletions
+6
View File
@@ -2,6 +2,12 @@
## Ultima modifica: 31/08/2026
## 31/08/2026 — Rinominate le tab della scheda Server + grafica Missing (solo UI/testi)
- **Rinominazione tab** (`front/server.form.php:118,123,128`): "Linked clients"→**"Managed clients" / Clienti gestiti** (asset GLPI con agent installato e collegamento attivo); "Unlinked clients"→**"Linkable clients" / Clienti Collegabili** (asset con agent installato ma non collegato a un asset GLPI); "Missing clients"→**"Clients to manage" / Clienti da gestire** (asset GLPI nella sede del server SENZA agent installato — "Connect" crea il link ma va poi installato il client). Aggiornate le traduzioni it/de/en (`.po`+`.mo` ricompilati con msgfmt) e rimosse le vecchie stringhe "Linked/Unlinked/Missing clients" dal catalogo.
- **Grafica tab Missing** (`src/Server.php` `showMissingClientsTab`): rimossi il campo di ricerca `#missing-search`, gli header `class="sortable"`+`<span class="sort-arrow">` (stile non definito in CSS), l'id `missing-table` e tutto il blocco JS ordinamento/filtro → la tabella ora usa lo stesso `<table class="table table-striped table-hover">` delle tab Linked/Unlinked.
- **Redirect "Connect"** (`front/server.form.php:31`): dopo il link_asset la pagina riapre sulla scheda "Clienti non collegati" (Unlinked/Clients to manage) aggiungendo `#tab-unlinked` al redirect (il JS già presente riattiva la tab dall'hash).
- Nessun bump versione (nessuna modifica DB, regola 6). Verifiche IA: `php -l` OK, msgfmt OK, git diff autorevisione OK. **Verifica UI utente OBBLIGATORIA**: controllare etichette traduczione, grafica Missing uniforme, redirect su scheda corretta.
## 31/08/2026 — Audit statico: fix 7 bug (solo UI/codice, nessuna modifica DB)
Audit statico (IA) + confronto contro sorgente C++ del backend UrBackup e core GLPI 11. Nessun bug di classe critico (crash/XSS/SQLi), ma diversi output errati corretti.
1. **Bug 1 — Livello log sempre vuoto** (`AssetTab.php:728`): l'API `livelog` restituisce `loglevel` (int 1=ERROR,2=WARNING,3=INFO,4=DEBUG), il codice leggeva `level`/`severity` (mai presenti). Aggiunto `formatLogLevel()` che mappa `loglevel`→stringa.
+1
View File
@@ -118,6 +118,7 @@ plugin_urbackup/
- Fixed the inverted IP lookup JOIN (`glpi_networknames``glpi_ipaddresses`) so the IP column in Linked/Missing clients is correct
- Made the missing/unlinked clients queries server-scoped (`plugin_urbackup_servers_id`) and the API data session cache key unique per asset (itemtype+id)
- `server_test.ajax.php`: entity-aware `check()` authorization; added `public/js/urbackup.js` (registered via `ADD_JAVASCRIPT`) that sends the `X-Glpi-Csrf-Token` header on plugin AJAX POSTs; `dropdown_host.ajax.php` now requires READ right
- Renamed the server form client tabs to be clearer: "Linked clients" → "Managed clients", "Unlinked clients" → "Linkable clients", "Missing clients" → "Clients to manage"; removed the sort/search on the missing clients table to match the other tab layouts; updated it_IT/de_DE/en_GB translations and recompiled locales
### 0.7.2
- UrBackup on Computer is now configurable: new `enable_computer` setting on the plugin configuration page (previously always enabled, hardcoded)
+3 -3
View File
@@ -115,17 +115,17 @@ if ($ID > 0) {
</li>
<li class="nav-item">
<a class="nav-link" data-bs-toggle="tab" href="#tab-linked">
<?php echo htmlspecialchars(__('Linked clients', 'urbackup')); ?>
<?php echo htmlspecialchars(__('Managed clients', 'urbackup')); ?>
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-bs-toggle="tab" href="#tab-unlinked">
<?php echo htmlspecialchars(__('Unlinked clients', 'urbackup')); ?>
<?php echo htmlspecialchars(__('Linkable clients', 'urbackup')); ?>
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-bs-toggle="tab" href="#tab-missing">
<?php echo htmlspecialchars(__('Missing clients', 'urbackup')); ?>
<?php echo htmlspecialchars(__('Clients to manage', 'urbackup')); ?>
</a>
</li>
</ul>
BIN
View File
Binary file not shown.
+6 -6
View File
@@ -306,8 +306,8 @@ msgstr "Stufe"
msgid "Linked assets"
msgstr "Verknüpfte Assets"
msgid "Linked clients"
msgstr "Verknüpfte Clients"
msgid "Managed clients"
msgstr "Verwaltete Clients"
msgid "Linked server"
msgstr "Verknüpfter Server"
@@ -324,8 +324,8 @@ msgstr "Nachricht"
msgid "Method not allowed"
msgstr "Methode nicht erlaubt"
msgid "Missing clients"
msgstr "Fehlende Clients"
msgid "Clients to manage"
msgstr "Zu verwaltende Clients"
msgid "Name"
msgstr "Name"
@@ -504,8 +504,8 @@ msgstr "cURL konnte nicht initialisiert werden."
msgid "Unknown"
msgstr "Unbekannt"
msgid "Unlinked clients"
msgstr "Nicht verknüpfte Clients"
msgid "Linkable clients"
msgstr "Verknüpfbare Clients"
msgid "Update"
msgstr "Aktualisieren"
BIN
View File
Binary file not shown.
+6 -6
View File
@@ -301,8 +301,8 @@ msgstr "Level"
msgid "Linked assets"
msgstr "Linked assets"
msgid "Linked clients"
msgstr "Linked clients"
msgid "Managed clients"
msgstr "Managed clients"
msgid "Linked server"
msgstr "Linked server"
@@ -319,8 +319,8 @@ msgstr "Message"
msgid "Method not allowed"
msgstr "Method not allowed"
msgid "Missing clients"
msgstr "Missing clients"
msgid "Clients to manage"
msgstr "Clients to manage"
msgid "Name"
msgstr "Name"
@@ -496,8 +496,8 @@ msgstr "Unable to initialize cURL."
msgid "Unknown"
msgstr "Unknown"
msgid "Unlinked clients"
msgstr "Unlinked clients"
msgid "Linkable clients"
msgstr "Linkable clients"
msgid "Update"
msgstr "Update"
BIN
View File
Binary file not shown.
+6 -6
View File
@@ -306,8 +306,8 @@ msgstr "Livello"
msgid "Linked assets"
msgstr "Asset collegati"
msgid "Linked clients"
msgstr "Clienti collegati"
msgid "Managed clients"
msgstr "Clienti gestiti"
msgid "Linked server"
msgstr "Server collegato"
@@ -324,8 +324,8 @@ msgstr "Messaggio"
msgid "Method not allowed"
msgstr "Metodo non consentito"
msgid "Missing clients"
msgstr "Client mancanti"
msgid "Clients to manage"
msgstr "Clienti da gestire"
msgid "Name"
msgstr "Nome"
@@ -505,8 +505,8 @@ msgstr "Impossibile inizializzare cURL."
msgid "Unknown"
msgstr "Sconosciuto"
msgid "Unlinked clients"
msgstr "Clienti non collegati"
msgid "Linkable clients"
msgstr "Clienti Collegabili"
msgid "Update"
msgstr "Aggiorna"
+10 -58
View File
@@ -1372,24 +1372,20 @@ class Server extends CommonDBTM
return;
}
echo '<div class="d-flex justify-content-end mb-2">';
echo '<input type="text" id="missing-search" class="form-control form-control-sm" placeholder="' . htmlspecialchars(__('Search...', 'urbackup')) . '" style="width:250px">';
echo '</div>';
$formAction = PLUGIN_URBACKUP_WEB_DIR . '/front/server.form.php';
echo '<table id="missing-table" class="table table-striped table-hover">';
echo '<table class="table table-striped table-hover">';
echo '<thead><tr>';
echo '<th class="sortable" data-col="0">' . htmlspecialchars(__('Name')) . ' <span class="sort-arrow"></span></th>';
echo '<th class="sortable" data-col="1">' . htmlspecialchars(Entity::getTypeName(1)) . ' <span class="sort-arrow"></span></th>';
echo '<th class="sortable" data-col="2">' . htmlspecialchars(Location::getTypeName(1)) . ' <span class="sort-arrow"></span></th>';
echo '<th class="sortable" data-col="3">' . htmlspecialchars(__('Inventory number')) . ' <span class="sort-arrow"></span></th>';
echo '<th class="sortable" data-col="4">' . htmlspecialchars(__('IP address', 'urbackup')) . ' <span class="sort-arrow"></span></th>';
echo '<th class="sortable" data-col="5">' . htmlspecialchars(State::getTypeName(1)) . ' <span class="sort-arrow"></span></th>';
echo '<th class="sortable" data-col="6">' . htmlspecialchars(User::getTypeName(1)) . ' <span class="sort-arrow"></span></th>';
echo '<th class="sortable" data-col="7">' . htmlspecialchars(Group::getTypeName(1)) . ' <span class="sort-arrow"></span></th>';
echo '<th>' . htmlspecialchars(__('Name')) . '</th>';
echo '<th>' . htmlspecialchars(Entity::getTypeName(1)) . '</th>';
echo '<th>' . htmlspecialchars(Location::getTypeName(1)) . '</th>';
echo '<th>' . htmlspecialchars(__('Inventory number')) . '</th>';
echo '<th>' . htmlspecialchars(__('IP address', 'urbackup')) . '</th>';
echo '<th>' . htmlspecialchars(State::getTypeName(1)) . '</th>';
echo '<th>' . htmlspecialchars(User::getTypeName(1)) . '</th>';
echo '<th>' . htmlspecialchars(Group::getTypeName(1)) . '</th>';
if ($canWrite) {
echo '<th data-col="8">' . htmlspecialchars(__('Actions', 'urbackup')) . '</th>';
echo '<th>' . htmlspecialchars(__('Actions', 'urbackup')) . '</th>';
}
echo '</tr></thead>';
echo '<tbody>';
@@ -1434,50 +1430,6 @@ class Server extends CommonDBTM
echo '</tbody>';
echo '</table>';
echo <<<'JAVASCRIPT'
<script>
$(function () {
var sortDir = {};
$('#missing-table th.sortable').on('click', function () {
var col = parseInt($(this).data('col'));
var $table = $('#missing-table');
var $tbody = $table.find('tbody');
var rows = $tbody.find('tr').get();
var dir = sortDir[col] === 'asc' ? 'desc' : 'asc';
sortDir[col] = dir;
rows.sort(function (a, b) {
var aVal = $(a).children('td').eq(col).text().trim().toLowerCase();
var bVal = $(b).children('td').eq(col).text().trim().toLowerCase();
if (aVal < bVal) return dir === 'asc' ? -1 : 1;
if (aVal > bVal) return dir === 'asc' ? 1 : -1;
return 0;
});
$.each(rows, function (i, row) { $tbody.append(row); });
$table.find('th .sort-arrow').text('');
$(this).find('.sort-arrow').text(dir === 'asc' ? '\u25B2' : '\u25BC');
});
$('#missing-search').on('keyup', function () {
var val = $(this).val().toLowerCase();
$('#missing-table tbody tr').each(function () {
var match = false;
$(this).children('td').each(function () {
if ($(this).text().toLowerCase().indexOf(val) > -1) {
match = true;
return false;
}
});
$(this).toggle(match);
});
});
});
</script>
JAVASCRIPT;
}
private static function getCachedName(string $classname, int $id, array &$cache): string