csv export/import

This commit is contained in:
jokob-sk
2022-08-05 22:56:48 +10:00
parent 8650c68801
commit 5a1c1036dd
6 changed files with 207 additions and 4 deletions

View File

@@ -344,6 +344,18 @@ if (submit && isset($_POST['langselector_set'])) {
</div>
<div class="db_tools_table_cell_b"><?php echo $pia_lang['Maintenance_Tool_purgebackup_text'];?></div>
</div>
<div class="db_info_table_row">
<div class="db_tools_table_cell_a" style="">
<button type="button" class="btn btn-default pa-btn bg-green dbtools-button" id="btnExportCSV" onclick="askExportCSV()"><?php echo $pia_lang['Maintenance_Tool_ExportCSV'];?></button>
</div>
<div class="db_tools_table_cell_b"><?php echo $pia_lang['Maintenance_Tool_ExportCSV_text'];?></div>
</div>
<div class="db_info_table_row">
<div class="db_tools_table_cell_a" style="">
<button type="button" class="btn btn-default pa-btn pa-btn-delete bg-red dbtools-button" id="btnImportCSV" onclick="askImportCSV()"><?php echo $pia_lang['Maintenance_Tool_ImportCSV'];?></button>
</div>
<div class="db_tools_table_cell_b"><?php echo $pia_lang['Maintenance_Tool_ImportCSV_text'];?></div>
</div>
</div>
</div>
</div>
@@ -491,6 +503,32 @@ function PiaPurgeDBBackups()
});
}
// Export CSV
function askExportCSV() {
// Ask
showModalWarning('<?php echo $pia_lang['Maintenance_Tool_ExportCSV_noti'];?>', '<?php echo $pia_lang['Maintenance_Tool_ExportCSV_noti_text'];?>',
'<?php echo $pia_lang['Gen_Cancel'];?>', '<?php echo $pia_lang['Gen_Okay'];?>', 'ExportCSV');
}
function ExportCSV()
{
// Execute
openInNewTab(window.location.origin + "/php/server/devices.php?action=ExportCSV")
}
// Import CSV
function askImportCSV() {
// Ask
showModalWarning('<?php echo $pia_lang['Maintenance_Tool_ImportCSV_noti'];?>', '<?php echo $pia_lang['Maintenance_Tool_ImportCSV_noti_text'];?>',
'<?php echo $pia_lang['Gen_Cancel'];?>', '<?php echo $pia_lang['Gen_Okay'];?>', 'ImportCSV');
}
function ImportCSV()
{
// Execute
$.get('/php/server/devices.php?action=ImportCSV', function(msg) {
showMessage (msg);
});
}
// Switch Darkmode
function askPiaEnableDarkmode() {
// Ask