click any row to load frame

This commit is contained in:
Andrew Bauer 2020-08-19 17:54:39 -05:00
parent b2a632a3f8
commit c9de30d427
2 changed files with 19 additions and 13 deletions

View File

@ -142,7 +142,8 @@ xhtmlHeaders(__FILE__, translate('Frames').' - '.$Event->Id());
<thead>
<!-- Row styling is handled by bootstrap-tables -->
<tr>
<th data-align="center" data-sortable="true" data-field="FramesId"><?php echo translate('Frame Id') ?></th>
<th data-align="center" data-sortable="false" data-field="EventId"><?php echo translate('EventId') ?></th>
<th data-align="center" data-sortable="true" data-field="FramesId"><?php echo translate('FrameId') ?></th>
<th data-align="center" data-sortable="true" data-field="FramesType"><?php echo translate('Type') ?></th>
<th data-align="center" data-sortable="true" data-field="FramesTimeStamp"><?php echo translate('TimeStamp') ?></th>
<th data-align="center" data-sortable="true" data-field="FramesDelta"><?php echo translate('TimeDelta') ?></th>
@ -150,7 +151,7 @@ xhtmlHeaders(__FILE__, translate('Frames').' - '.$Event->Id());
<?php
if ( ZM_WEB_LIST_THUMBS ) {
?>
<th data-align="center" data-sortable="true" data-field="Thumbnail"><?php echo translate('Thumbnail') ?></th>
<th data-align="center" data-sortable="false" data-field="Thumbnail"><?php echo translate('Thumbnail') ?></th>
<?php
}
?>
@ -163,15 +164,8 @@ if ( count($frames) ) {
$Frame = new ZM\Frame($frame);
?>
<tr<?php echo ( strtolower($frame['Type']) == "alarm" ) ? ' class="alarm"' : '' ?>>
<td><?php echo makePopupLink(
'?view=frame&amp;eid='.$Event->Id().'&amp;fid='.$frame['FrameId'], 'zmImage',
array(
'frame',
($scale ? $Event->Width()*$scale/100 : $Event->Width()),
($scale ? $Event->Height()*$scale/100 : $Event->Height())
),
$frame['FrameId'])
?></td>
<td><?php echo $frame['EventId'] ?></td>
<td><?php echo $frame['FrameId'] ?></td>
<td><?php echo $frame['Type'] ?></td>
<td><?php echo strftime(STRF_FMT_TIME, $frame['UnixTimeStamp']) ?></td>
<td><?php echo number_format( $frame['Delta'], 2 ) ?></td>
@ -194,7 +188,7 @@ if ( count($frames) ) {
$full_img_src = join('&amp;', array_filter(array($base_img_src, $thmb_fn)));
$frame_src = '?view=frame&amp;eid=' .$Event->Id(). '&amp;fid=' .$frame['FrameId'];
echo '<td class="colThumbnail zoom"><a href="' .$frame_src. '"><img src="' .$img_src. '" '.$thmb_width. ' ' .$thmb_height. 'img_src="' .$img_src. '" full_img_src="' .$full_img_src. '"></a></td>'.PHP_EOL;
echo '<td class="colThumbnail zoom"><img src="' .$img_src. '" '.$thmb_width. ' ' .$thmb_height. 'img_src="' .$img_src. '" full_img_src="' .$full_img_src. '"></td>'.PHP_EOL;
}
?>
</tr>

View File

@ -17,6 +17,11 @@ function initThumbAnimation() {
});
}
function gotoFrame(e, row, element) {
//alert('?view=frame&eid='+row.EventId+'&fid='+row.FramesId)
window.location.assign('?view=frame&eid='+row.EventId+'&fid='+row.FramesId);
}
function initPage() {
var backBtn = $j('#backBtn');
var table = $j('#framesTable');
@ -37,6 +42,11 @@ function initPage() {
// Init the bootstrap-table
table.bootstrapTable('destroy').bootstrapTable({icons: icons});
// Hide these columns on first run when no cookie is saved
if ( !getCookie("zmFramesTable.bs.table.columns") ) {
table.bootstrapTable('hideColumn', 'FrameId');
}
// Disable the back button if there is nothing to go back to
backBtn.prop('disabled', !document.referrer.length);
@ -46,12 +56,14 @@ function initPage() {
// Some toolbar events break the thumbnail animation, so re-init eventlistener
table.on('all.bs.table', initThumbAnimation);
// Load the associated frame image when the user clicks on a row
table.on('click-row.bs.table', gotoFrame);
// Manage the BACK button
document.getElementById("backBtn").addEventListener("click", function onBackClick(evt) {
evt.preventDefault();
window.history.back();
});
// Manage the REFRESH Button
document.getElementById("refreshBtn").addEventListener("click", function onRefreshClick(evt) {
evt.preventDefault();