Merge branch '2.4' of github.com:MISP/MISP into 2.4

pull/5705/head
Alexandre Dulaunoy 2020-03-09 22:52:40 +01:00
commit f5f7fad1a8
No known key found for this signature in database
GPG Key ID: 09E2CD4944E6CBCD
2 changed files with 49 additions and 26 deletions

View File

@ -392,7 +392,7 @@ class LogsController extends AppController
// re-get pagination
$this->{$this->defaultModel}->recursive = 0;
$this->paginate = $this->Session->read('paginate_conditions_log');
$this->paginate = array_merge_recursive($this->Session->read('paginate_conditions_log'), $this->paginate);
if (!isset($this->paginate['order'])) {
$this->paginate['order'] = array('Log.id' => 'DESC');
}

View File

@ -12,34 +12,57 @@
'meta' => 'icon'
));
$randomNumber = rand();
if (empty($data['colour_scale'])) {
$data['colour_scale'] = json_encode(array(
'#003FBF','#0063BF','#0087BF','#00ACBF','#00BFAD','#00BF89','#00BF64',
'#00BF40','#00BF1C','#08BF00','#2CBF00','#51BF00','#75BF00','#99BF00',
'#BEBF00','#BF9B00','#BF7700','#BF5200','#BF2E00','#BF0900'
), true);
}
?>
<div id="world-map-<?= $randomNumber ?>" style="width: 600px; height: 400px"></div>
<script>
var mapData = <?= json_encode($data['data']); ?>;
$('#world-map-<?= $randomNumber ?>').vectorMap({
map: 'world_mill',
series: {
regions: [{
values: mapData,
scale: ['#F08080', '#8B0000'],
normalizeFunction: 'polynomial'
}]
},
onRegionTipShow: function(e, el, code) {
el.html(el.html()+' (<?= h($data['scope']) ?> - '+mapData[code]+')');
}
});
var container_<?= $randomNumber ?> = $('#world-map-<?= $randomNumber ?>').parent().parent();
(function() { // variables and functions have their own scope (no override)
'use strict';
var randomNumber = "<?= $randomNumber ?>";
var scope = "<?= h($data['scope']) ?>";
var resize_timeout;
var mapData = <?= json_encode($data['data']); ?>;
var $worldmap = $('#world-map-'+randomNumber);
var $container = $worldmap.closest('div.widgetContent');
$worldmap.vectorMap({
map: 'world_mill',
series: {
regions: [{
values: mapData,
scale:
<?= $data['colour_scale'] ?>, // gradient blue->green->yellow->red
normalizeFunction: 'polynomial'
}]
},
onRegionTipShow: function(e, el, code) {
var amount = mapData[code] !== undefined ? mapData[code] : 0; // no data defaulted to 0
el.html(el.html()+' (' + scope + ' - '+amount+')');
}
});
function resizeDashboardWorldMap(id) {
var width = eval('container_' + id + '.width()');
var height = eval('container_' + id + '.height() - 60');
$('#world-map-' + id).css('width', width + 'px');
$('#world-map-' + id).css('height', height + 'px');
$('#world-map-' + id).vectorMap('get','mapObject').updateSize();
}
$(document).ready(function() {
resizeDashboardWorldMap(<?= $randomNumber ?>);
});
function resizeDashboardWorldMap() {
var width = $container.width();
var height = $container.height();
$worldmap
.css('width', width + 'px')
.css('height', height + 'px')
.vectorMap('get','mapObject').updateSize();
}
$(document).ready(function() {
resizeDashboardWorldMap();
window.addEventListener("resize", function() {
if (resize_timeout !== undefined) {
clearTimeout(resize_timeout);
}
resize_timeout = setTimeout(function() { resizeDashboardWorldMap() }, 500); // redraw after 500ms
});
});
}());
</script>