Download wait message

This commit is contained in:
Calvo 2022-12-02 15:40:47 +01:00
parent e0afcd0b85
commit 718be360d5
10 changed files with 25 additions and 7 deletions

View File

@ -124,6 +124,8 @@ if (!empty($groups)) {
if (!empty($downtimes)) {
ob_clean();
// Show contentype header
// Set cookie for download control.
setDownloadCookieToken();
header('Content-type: text/csv');
header('Content-Disposition: attachment; filename="pandora_planned_downtime_'.date('Y/m/d H:i:s').'.csv"');
@ -161,7 +163,7 @@ if (!empty($downtimes)) {
if (!empty($downtime_agents)) {
foreach ($downtime_agents as $downtime_agent) {
$downtime_items = [];
$downtime_items[] = $downtime_agent[alias];
$downtime_items[] = $downtime_agent['alias'];
if (!$downtime_agent['all_modules']) {
$agent_id = $downtime_agent['agent_id'];

View File

@ -907,7 +907,7 @@ if ($downtimes === false && $filter_performed === false) {
__('Export to CSV'),
'csv_export',
false,
'location.href="godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'"',
'blockResubmit($(this)); location.href=\'godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'\'',
'class="sub next"'
);
echo '</div>';

View File

@ -189,6 +189,8 @@ if ($export_profile) {
}
}
// Set cookie for download control.
setDownloadCookieToken();
// Send headers to tell the browser we're sending a file
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename='.preg_replace('/\s/', '_', $profile_info['name']).'.csv');
@ -285,7 +287,7 @@ foreach ($result as $row) {
]
);
$data[3] = '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&delete_profile=1&delete_profile='.$row['id_np'].'" '.'onclick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']).'</a>';
$data[3] .= '<a href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&export_profile='.$row['id_np'].'">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV'), 'class' => 'invert_filter']).'</a>';
$data[3] .= '<a onclick="blockResubmit($(this))" href="index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates'.'&export_profile='.$row['id_np'].'">'.html_print_image('images/csv.png', true, ['title' => __('Export to CSV'), 'class' => 'invert_filter']).'</a>';
array_push($table->data, $data);
}

View File

@ -141,8 +141,9 @@ class Diagnostics extends Wizard
'images/pdf.png',
true,
[
'title' => __('Export to PDF'),
'class' => 'invert_filter',
'title' => __('Export to PDF'),
'class' => 'invert_filter',
'onclick' => 'blockResubmit($(this))',
]
);
$header_buttons = [

View File

@ -86,6 +86,9 @@ if (!empty($module)) {
while (@ob_end_clean()) {
}
// Set cookie for download control.
setDownloadCookieToken();
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename=export_'.date('Ymd', $start).'_'.date('Ymd', $end).'.'.$extension);
header('Pragma: no-cache');

View File

@ -85,6 +85,9 @@ if (!empty($module)) {
while (@ob_end_clean()) {
}
// Set cookie for download control.
setDownloadCookieToken();
header('Content-type: application/octet-stream');
header('Content-Disposition: attachment; filename=export_'.date('Ymd', $start).'_'.date('Ymd', $end).'.'.$extension);
header('Pragma: no-cache');

View File

@ -402,9 +402,11 @@ ui_require_jquery_file('bgiframe');
switch (type) {
case 'csv':
blockResubmit($(this));
f.action = "operation/agentes/exportdata.csv.php";
break;
case 'excel':
blockResubmit($(this));
f.action = "operation/agentes/exportdata.excel.php";
break;
case 'avg':

View File

@ -111,6 +111,9 @@ $filename = 'tickets_export-'.date('Ymd').'-'.date('His').'.csv';
ob_clean();
// Set cookie for download control.
setDownloadCookieToken();
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename='.$filename);

View File

@ -428,7 +428,7 @@ $integria_incidents_form .= '<div class="float-right mrgn_lft_5px">'.html_print_
__('Export to CSV'),
'csv_export',
false,
"location.href='operation/incidents/integriaims_export_csv.php?tickets_filters=$decode_csv'",
"blockResubmit($(this)); location.href='operation/incidents/integriaims_export_csv.php?tickets_filters=$decode_csv'",
'class="sub next"',
true
).'</div>';

View File

@ -140,7 +140,7 @@ $table->data['1']['2'] .= html_print_submit_button(
__('Export to CSV'),
'export_csv',
false,
'class="sub next"',
'class="sub next" onclick="blockResumit($(this))"',
true
);
@ -221,6 +221,8 @@ if (get_parameter('export_csv')) {
ob_end_clean();
}
// Set cookie for download control.
setDownloadCookieToken();
// Write metadata.
header('Content-type: text/csv;');
header('Content-Disposition: attachment; filename="network_data.csv"');