Merge branch 'leiweibau-merge-2022-07-24' into pr/37

This commit is contained in:
jokob-sk
2022-07-24 10:21:25 +10:00
34 changed files with 1195 additions and 62 deletions

View File

@@ -594,7 +594,42 @@ input[type="password"]::-webkit-caps-lock-indicator {
}
/*** Additional fixes For Pi.Alert UI ***/
.small-box {
border-radius: 10px;
border-top: 0px;
}
.pa-small-box-aqua .inner {
background-color: rgb(45,108,133);
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.pa-small-box-green .inner {
background-color: rgb(31,76,46);
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.pa-small-box-yellow .inner {
background-color: rgb(151,104,37);
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.pa-small-box-red .inner {
background-color: rgb(120,50,38);
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.pa-small-box-gray .inner {
background-color: #777;
/* color: rgba(20,20,20,30%); */
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.pa-small-box-gray .inner h3 {
color: #bbb;
}
.text-gray-20 {
color: rgba(220,220,220,30%);
}
.bg-gray {
background-color: #888888 !important;
}
@@ -629,24 +664,6 @@ input[type="password"]::-webkit-caps-lock-indicator {
margin: auto;
}
.nav-tabs-custom > .nav-tabs > li:hover > a, .nav-tabs-custom > .nav-tabs > li.active:hover > a {
background-color: #272c30;
color: #bec5cb;
}
.nav-tabs-custom > .nav-tabs > li.active > a, .nav-tabs-custom > .nav-tabs > li.active:hover > a {
border-left-color: #30383f;
border-right-color: #30383f;
background-color: #272c30;
color: #bec5cb;
}
.nav-tabs-custom .tab-content {
background-color: #272c30;
}
.top_small_box_gray_text {
color: white !important;
}
/* remove white border that appears on mobile screen sizes */
.box-body {
border: 0px;
@@ -667,4 +684,21 @@ input[type="password"]::-webkit-caps-lock-indicator {
.login-box-body {
color: #bec5cb;
background-color: #272c30;
}
}
/* Add border radius to bottom of the status boxes*/
.pa-small-box-footer {
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
.small-box > .inner h3, .small-box > .inner p {
margin-bottom: 0px;
margin-left: 0px;
}
.small-box:hover .icon {
font-size: 3.74em;
}
.small-box .icon {
top: 0.01em;
font-size: 3.25em;
}

View File

@@ -114,7 +114,7 @@ if ($_SESSION["login"] != 1)
<div class="col-md-12">
<div class="box" id="clients">
<div class="box-header with-border">
<h3 class="box-title"><?php echo $pia_lang['Device_Shortcut_OnlineChart_a'];?> <span class="maxlogage-interval">12</span> <?php echo $pia_lang['Device_Shortcut_OnlineChart_b'];?></h3>
<h3 class="box-title"><?php echo $pia_lang['Device_Shortcut_OnlineChart'];?> </h3>
</div>
<div class="box-body">
<div class="chart">
@@ -237,6 +237,12 @@ function main () {
// -----------------------------------------------------------------------------
function initializeDatatable () {
// If the device has a small width (mobile) only show name, ip, and status columns.
if (window.screen.width < 400) {
var tableColumnShow = [10,11,12,1,2,3,4,5,6,8];
} else {
var tableColumnShow = [10, 11, 12];
};
var table=
$('#tableDevices').DataTable({
'paging' : true,
@@ -254,7 +260,7 @@ function initializeDatatable () {
// 'order' : [[3,'desc'], [0,'asc']],
'columnDefs' : [
{visible: false, targets: [10, 11, 12] },
{visible: false, targets: tableColumnShow },
{className: 'text-center', targets: [3, 8, 9] },
{width: '80px', targets: [5, 6] },
{width: '0px', targets: 9 },

View File

@@ -332,6 +332,9 @@ if (submit && isset($_POST['langselector_set'])) {
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-red dbtools-button" id="btnPiaPurgeDBBackups" onclick="askPiaPurgeDBBackups()"><?php echo $pia_lang['Maintenance_Tool_purgebackup'];?></button>
</div>
<div class="db_tools_table_cell_b"><?php echo $pia_lang['Maintenance_Tool_purgebackup_text'];?></div>
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-red dbtools-button" id="btnUpgadeDatabase" style="border-top: solid 3px #dd4b39;" onclick="askUpgradeDatabase()"><?php echo $pia_lang['Maintenance_Tool_upgrade_database_noti'];?></button>
</div>
<div class="db_tools_table_cell_b"><?php echo $pia_lang['Maintenance_Tool_upgrade_database_text'];?></div>
</div>
</div>
</div>
@@ -483,6 +486,20 @@ function PiaToggleArpScan()
});
}
// upgrade DB
function askUpgradeDatabase () {
// Ask
showModalWarning('<?php echo $pia_lang['Maintenance_Tool_upgrade_database_noti'];?>', '<?php echo $pia_lang['Maintenance_Tool_upgrade_database_noti_text'];?>',
'Cancel', 'Upgrade', 'upgradeDatabase');
}
function upgradeDatabase()
{
// Upgrade DB
$.get('php/server/devices.php?action=upgradeDatabase', function(msg) {
showMessage (msg);
});
}
</script>

View File

@@ -36,6 +36,7 @@ if (strlen($pia_lang_selected) == 0) {$pia_lang_selected = 'en_us';}
case 'setDeviceData': setDeviceData(); break;
case 'deleteDevice': deleteDevice(); break;
case 'deleteAllWithEmptyMACs': deleteAllWithEmptyMACs(); break;
case 'upgradeDatabase': upgradeDB(); break;
case 'createBackupDB': createBackupDB(); break;
case 'restoreBackupDB': restoreBackupDB(); break;
case 'deleteAllDevices': deleteAllDevices(); break;
@@ -212,6 +213,36 @@ function deleteAllWithEmptyMACs() {
}
}
//------------------------------------------------------------------------------
// Upgrade the database to enable new functionality
//------------------------------------------------------------------------------
function upgradeDB() {
global $db;
global $pia_lang;
// sql
$sql = '
-- Online_History definition
CREATE TABLE "Online_History" (
"Index" INTEGER,
"Scan_Date" TEXT,
"Online_Devices" INTEGER,
"Down_Devices" INTEGER,
"All_Devices" INTEGER,
PRIMARY KEY("Index" AUTOINCREMENT)
);';
// execute sql
$result = $db->query($sql);
// check result
if ($result == TRUE) {
echo $pia_lang['BackDevices_DBTools_Upgrade'];
} else {
echo $pia_lang['BackDevices_DBTools_UpgradeError']."\n\n$sql \n\n". $db->lastErrorMsg();
}
}
//------------------------------------------------------------------------------
// Delete all devices with empty MAC addresses
//------------------------------------------------------------------------------

View File

@@ -102,6 +102,12 @@ if ($ENABLED_DARKMODE === True) {
<!-- Servertime to the right of the hostname -->
<script>
<?php
$conf_file = '../config/version.conf';
$conf_data = parse_ini_file($conf_file);
# set timezone for server time in header
date_default_timezone_set($conf_data['TZ']);
?>
var pia_servertime = new Date(<?php echo date("Y, n, j, G, i, s") ?>);
function show_pia_servertime() {
@@ -228,7 +234,6 @@ function show_pia_servertime() {
<li class=" <?php if (in_array (basename($_SERVER['SCRIPT_NAME']), array('maintenance.php') ) ){ echo 'active'; } ?>">
<a href="maintenance.php"><i class="fa fa-cog"></i> <span><?php echo $pia_lang['Navigation_Maintenance'];?></span></a>
</li>
<!--
<li class="treeview">
<a href="#"><i class="fa fa-link"></i> <span>Config</span>

View File

@@ -15,8 +15,7 @@ $pia_lang['Device_Shortcut_NewDevices'] = 'Neue Geräte';
$pia_lang['Device_Shortcut_DownAlerts'] = 'Down Meldungen';
$pia_lang['Device_Shortcut_Archived'] = 'Archiviert';
$pia_lang['Device_Shortcut_Devices'] = 'Geräte';
$pia_lang['Device_Shortcut_OnlineChart_a'] = 'Netzwerkaktivität über die letzten';
$pia_lang['Device_Shortcut_OnlineChart_b'] = 'Stunden';
$pia_lang['Device_Shortcut_OnlineChart'] = 'Gerätepräsenz im Laufe der Zeit';
$pia_lang['Device_TableHead_Name'] = 'Name';
$pia_lang['Device_TableHead_Owner'] = 'Eigentümer';
$pia_lang['Device_TableHead_Type'] = 'Typ';

View File

@@ -15,8 +15,7 @@ $pia_lang['Device_Shortcut_NewDevices'] = 'New Devices';
$pia_lang['Device_Shortcut_DownAlerts'] = 'Down Alerts';
$pia_lang['Device_Shortcut_Archived'] = 'Archived';
$pia_lang['Device_Shortcut_Devices'] = 'Devices';
$pia_lang['Device_Shortcut_OnlineChart_a'] = 'Network activity over last';
$pia_lang['Device_Shortcut_OnlineChart_b'] = 'hours';
$pia_lang['Device_Shortcut_OnlineChart'] = 'Device presence over time';
$pia_lang['Device_TableHead_Name'] = 'Name';
$pia_lang['Device_TableHead_Owner'] = 'Owner';
$pia_lang['Device_TableHead_Type'] = 'Type';

View File

@@ -15,8 +15,7 @@ $pia_lang['Device_Shortcut_NewDevices'] = 'Nuevo(s)';
$pia_lang['Device_Shortcut_DownAlerts'] = 'Alerta(s) de caída(s)';
$pia_lang['Device_Shortcut_Archived'] = 'Archivado(s)';
$pia_lang['Device_Shortcut_Devices'] = 'Dispositivos';
$pia_lang['Device_Shortcut_OnlineChart_a'] = 'Actividad de la red durante las últimas';
$pia_lang['Device_Shortcut_OnlineChart_b'] = 'horas';
$pia_lang['Device_Shortcut_OnlineChart'] = 'Presencia del dispositivo a lo largo del tiempo';
$pia_lang['Device_TableHead_Name'] = 'Nombre';
$pia_lang['Device_TableHead_Owner'] = 'Propietario';
$pia_lang['Device_TableHead_Type'] = 'Tipo';

View File

@@ -114,7 +114,7 @@ if ($_SESSION["login"] != 1)
<div class="col-md-12">
<div class="box" id="clients">
<div class="box-header with-border">
<h3 class="box-title"><?php echo $pia_lang['Device_Shortcut_OnlineChart_a'];?> <span class="maxlogage-interval">12</span> <?php echo $pia_lang['Device_Shortcut_OnlineChart_b'];?></h3>
<h3 class="box-title"><?php echo $pia_lang['Device_Shortcut_OnlineChart'];?></h3>
</div>
<div class="box-body">
<div class="chart">