move objdetect image to a modal

This commit is contained in:
Andrew Bauer 2020-12-22 10:08:31 -06:00
parent cbe04674c5
commit ee45916526
2 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1,29 @@
<?php
// This is the HTML representing the Object Detection modal on the Events page
$eid = isset($_REQUEST['eid']) ? $_REQUEST['eid'] : '';
if ( !validInt($eid) ) {
ZM\Error("Invalid event id: $eid");
return;
}
?>
<div id="objdetectModal" class="modal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Object Detection</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<img src="?view=image&amp;eid='<?php echo $eid ?>'&amp;fid=objdetect">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>

View File

@ -61,7 +61,7 @@ function processRows(rows) {
if ( canEdit.Monitors ) row.Monitor = '<a href="?view=monitor&amp;mid=' + mid + '">' + row.Monitor + '</a>';
if ( canEdit.Events ) row.Cause = '<a href="#" title="' + row.Notes + '" class="eDetailLink" data-eid="' + eid + '">' + row.Cause + '</a>';
if ( row.Notes.indexOf('detected:') >= 0 ) {
row.Cause = row.Cause + '<a href="?view=image&amp;eid=' + eid + '&amp;fid=objdetect"><div class="small text-nowrap text-muted"><u>' + row.Notes + '</u></div></a>';
row.Cause = row.Cause + '<a href="#" data-on-click-this="objdetectModal" data-event-id=' +eid+ '><u>' + row.Notes + '</u></div></a>';
} else if ( row.Notes != 'Forced Web: ' ) {
row.Cause = row.Cause + '<br/><div class="small text-nowrap text-muted">' + row.Notes + '</div>';
}
@ -141,6 +141,17 @@ function getEventDetailModal(eid) {
.fail(logAjaxFail);
}
function objdetectModal( element ) {
var eid = element.getAttribute('data-event-id');
$j.getJSON(thisUrl + '?request=modal&modal=objdetect&eid=' + eid)
.done(function(data) {
insertModalHtml('objdetectModal', data.html);
$j('#objdetectModal').modal('show');
})
.fail(logAjaxFail);
}
function initPage() {
// Remove the thumbnail column from the DOM if thumbnails are off globally
if ( !WEB_LIST_THUMBS ) $j('th[data-field="Thumbnail"]').remove();
@ -303,6 +314,8 @@ function initPage() {
// Update table links each time after new data is loaded
table.on('post-body.bs.table', function(data) {
// Object detection inserts data-onclick-this links after DOM has loaded
dataOnClickThis();
// Manage the eventdetail links in the events list
$j(".eDetailLink").click(function(evt) {
evt.preventDefault();