new: Show file sizes on the export page, fixes #1640

pull/1641/head
Iglocska 2016-11-01 13:41:53 +01:00
parent 17ed6f9309
commit aa141fb54b
2 changed files with 20 additions and 0 deletions

View File

@ -1610,6 +1610,7 @@ class EventsController extends AppController {
}
public function export() {
$filesize_units = array('B', 'KB', 'MB', 'GB', 'TB');
if ($this->_isSiteAdmin()) $this->Session->setFlash('Warning, you are logged in as a site admin, any export that you generate will contain the FULL UNRESTRICTED data-set. If you would like to generate an export for your own organisation, please log in with a different user.');
// Check if the background jobs are enabled - if not, fall back to old export page.
if (Configure::read('MISP.background_jobs')) {
@ -1667,6 +1668,13 @@ class EventsController extends AppController {
$this->Event->export_types[$k]['recommendation'] = 1;
}
} else {
$filesize = $file->size();
$filesize_unit_index = 0;
while ($filesize > 1024) {
$filesize_unit_index++;
$filesize = $filesize / 1024;
}
$this->Event->export_types[$k]['filesize'] = round($filesize, 1) . $filesize_units[$filesize_unit_index];
$fileChange = $file->lastChange();
$lastModified = $this->__timeDifference($now, $fileChange);
if (empty($tempNewestEvent) || $fileChange > $tempNewestEvent['Event']['timestamp']) {

View File

@ -26,6 +26,7 @@
<th style="text-align:center;">Last Update</th>
<th style="text-align:center;">Description</th>
<th style="text-align:center;">Outdated</th>
<th style="text-align:center;">Filesize</th>
<th style="text-align:center;">Progress</th>
<th style="text-align:center;">Actions</th>
</tr>
@ -58,6 +59,17 @@
}
?>
</td>
<td class="short" style="text-align:right;">
<?php
if (isset($type['filesize'])):
echo h($type['filesize']);
else:
?>
<span class="red">N/A</span>
<?php
endif;
?>
</td>
<td style="width:150px;">
<div id="barFrame<?php echo $i; ?>" class="progress progress-striped active" style="margin-bottom: 0px;display:none;">
<div id="bar<?php echo $i; ?>" class="bar" style="width: <?php echo $type['progress']; ?>%;">