Merge branch 'fix/check-box' into fix/columns-width
# Conflicts: # gui/bastille_manager_gui.php
This commit is contained in:
@@ -366,7 +366,34 @@ $pgtitle = [gtext("Extensions"), gtext('Bastille'), gtext('Manager')];
|
|||||||
include 'fbegin.inc';
|
include 'fbegin.inc';
|
||||||
?>
|
?>
|
||||||
<style>
|
<style>
|
||||||
/* Refresh button style */
|
|
||||||
|
#refresh-spinner {
|
||||||
|
display: inline-block;
|
||||||
|
position: absolute;
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
border: 2px solid #ccc;
|
||||||
|
border-top-color: #007bff;
|
||||||
|
border-radius: 50%;
|
||||||
|
animation: spin 1s linear infinite;
|
||||||
|
margin-right: 5px;
|
||||||
|
right: 115px;
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
to { transform: rotate(360deg); }
|
||||||
|
}
|
||||||
|
|
||||||
|
.area_data_selection tbody td img {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lcelc {
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
#refresh-now {
|
#refresh-now {
|
||||||
appearance: none;
|
appearance: none;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
@@ -383,10 +410,9 @@ include 'fbegin.inc';
|
|||||||
filter: brightness(150%);
|
filter: brightness(150%);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --- ESTILOS DE RESIZE SIMPLE --- */
|
/* --- SIMPLE RESIZE STYLES --- */
|
||||||
table.area_data_selection {
|
table.area_data_selection {
|
||||||
table-layout: fixed; /* Mantiene la cordura del navegador */
|
table-layout: fixed;
|
||||||
/*width: auto; IMPORTANTE: Auto para empezar */
|
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,7 +424,7 @@ table.area_data_selection th {
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* El tirador visible */
|
/* The visible handle */
|
||||||
.resizer {
|
.resizer {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
@@ -469,8 +495,11 @@ $(window).on("load", function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// --- INITIALIZE MANUAL RESIZE ---
|
|
||||||
initSimpleResize();
|
initSimpleResize();
|
||||||
|
|
||||||
|
$(document).on('click', "input[name='<?=$checkbox_member_name;?>[]']", function() {
|
||||||
|
controlactionbuttons(this, '<?=$checkbox_member_name;?>[]');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function disableactionbuttons(ab_disable) {
|
function disableactionbuttons(ab_disable) {
|
||||||
@@ -481,19 +510,10 @@ function disableactionbuttons(ab_disable) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function controlactionbuttons(ego, triggerbyname) {
|
function controlactionbuttons(ego, triggerbyname) {
|
||||||
var a_trigger = document.getElementsByName(triggerbyname);
|
// Use jQuery selector to count checked checkboxes directly
|
||||||
var n_trigger = a_trigger.length;
|
var $checkedCheckboxes = $("input[name='" + triggerbyname + "']:checked");
|
||||||
var ab_disable = true;
|
var ab_disable = ($checkedCheckboxes.length === 0); // If no checkboxes are checked, disable buttons
|
||||||
var i = 0;
|
disableactionbuttons(ab_disable);
|
||||||
for (; i < n_trigger; i++) {
|
|
||||||
if (a_trigger[i].type == 'checkbox') {
|
|
||||||
if (a_trigger[i].checked) {
|
|
||||||
ab_disable = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
disableactionbuttons(ab_disable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- AUTO-REFRESH JS ---
|
// --- AUTO-REFRESH JS ---
|
||||||
@@ -509,9 +529,11 @@ var autoRefresh = {
|
|||||||
function updateJailTable() {
|
function updateJailTable() {
|
||||||
if (autoRefresh.isUpdating) return;
|
if (autoRefresh.isUpdating) return;
|
||||||
autoRefresh.isUpdating = true;
|
autoRefresh.isUpdating = true;
|
||||||
$("#refresh-status").text('Updating...');
|
|
||||||
|
|
||||||
// Backup de checkboxes marcados para persistencia
|
// Activar spinner
|
||||||
|
$("#refresh-spinner").show();
|
||||||
|
|
||||||
|
// Backup of checked checkboxes for persistence
|
||||||
autoRefresh.selectedJails = [];
|
autoRefresh.selectedJails = [];
|
||||||
$("input[name='<?=$checkbox_member_name;?>[]']:checked").each(function() {
|
$("input[name='<?=$checkbox_member_name;?>[]']:checked").each(function() {
|
||||||
autoRefresh.selectedJails.push($(this).val());
|
autoRefresh.selectedJails.push($(this).val());
|
||||||
@@ -530,8 +552,8 @@ function updateJailTable() {
|
|||||||
.attr('name', '<?=$checkbox_member_name;?>[]')
|
.attr('name', '<?=$checkbox_member_name;?>[]')
|
||||||
.attr('value', jail.jailname)
|
.attr('value', jail.jailname)
|
||||||
.attr('id', jail.jailname)
|
.attr('id', jail.jailname)
|
||||||
.prop('checked', autoRefresh.selectedJails.includes(jail.jailname))
|
.prop('checked', autoRefresh.selectedJails.includes(jail.jailname));
|
||||||
.click(function() { controlactionbuttons(this, '<?=$checkbox_member_name;?>[]'); });
|
|
||||||
checkCell.append(cb);
|
checkCell.append(cb);
|
||||||
row.append(checkCell);
|
row.append(checkCell);
|
||||||
|
|
||||||
@@ -563,7 +585,8 @@ function updateJailTable() {
|
|||||||
tbody.append(row);
|
tbody.append(row);
|
||||||
});
|
});
|
||||||
autoRefresh.lastUpdate = Date.now();
|
autoRefresh.lastUpdate = Date.now();
|
||||||
$("#refresh-status").text('Last update: just now');
|
|
||||||
|
// Restore button state
|
||||||
controlactionbuttons(null, '<?=$checkbox_member_name;?>[]');
|
controlactionbuttons(null, '<?=$checkbox_member_name;?>[]');
|
||||||
|
|
||||||
// Reapply saved column widths after updating the table
|
// Reapply saved column widths after updating the table
|
||||||
@@ -571,11 +594,11 @@ function updateJailTable() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error('Error fetching jail data:', error);
|
console.error('Error fetching jail data: ', error);
|
||||||
$("#refresh-status").text('Update failed');
|
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
autoRefresh.isUpdating = false;
|
autoRefresh.isUpdating = false;
|
||||||
|
$("#refresh-spinner").hide();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -730,8 +753,8 @@ $document->render();
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div id="refresh-controls" style="text-align: right; display: none;">
|
<div id="refresh-controls" style="text-align: right; display: none; position: relative;">
|
||||||
<span id="refresh-status" style="font-style: italic; margin-right: 15px; color: #666;">Last update: just now</span>
|
<span id="refresh-spinner" style="display: none;"></span>
|
||||||
<button type="button" id="refresh-now" class="formbtn">Refresh</button>
|
<button type="button" id="refresh-now" class="formbtn">Refresh</button>
|
||||||
<select id="refresh-interval" class="formfld">
|
<select id="refresh-interval" class="formfld">
|
||||||
<option value="5000">5s</option>
|
<option value="5000">5s</option>
|
||||||
@@ -746,7 +769,8 @@ $document->render();
|
|||||||
<colgroup>
|
<colgroup>
|
||||||
<col style="width:2%">
|
<col style="width:2%">
|
||||||
<col style="width:3%">
|
<col style="width:3%">
|
||||||
<col style="width:12%">
|
<col style="width:10%">
|
||||||
|
<!-- <col style="width:10%"> Description -->
|
||||||
<col style="width:4%">
|
<col style="width:4%">
|
||||||
<col style="width:4%">
|
<col style="width:4%">
|
||||||
<col style="width:4%">
|
<col style="width:4%">
|
||||||
@@ -754,7 +778,7 @@ $document->render();
|
|||||||
<col style="width:12%">
|
<col style="width:12%">
|
||||||
<col style="width:12%">
|
<col style="width:12%">
|
||||||
<col style="width:7%">
|
<col style="width:7%">
|
||||||
<col style="width:12%">
|
<col style="width:10%">
|
||||||
<col style="width:4%">
|
<col style="width:4%">
|
||||||
<col style="width:4%">
|
<col style="width:4%">
|
||||||
<col style="width:10%">
|
<col style="width:10%">
|
||||||
|
|||||||
Reference in New Issue
Block a user