Added paged event frame images.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@691 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
20d8af0b0c
commit
35efc7d6ad
|
@ -40,6 +40,8 @@ define( "ZMU_PATH", ZM_PATH_BIN."/zmu" ); // Local path to the ZoneMinder Uti
|
|||
//
|
||||
define( "MAX_EVENTS", 10 ); // The maximum number of events to show in the monitor event listing
|
||||
define( "EVENT_HEADER_LINES", 25 ); // How many events are listed in the event window before a new header is inserted
|
||||
define( "EVENT_FRAMES_PER_LINE", 4 ); // How many images per line in the event image view
|
||||
define( "EVENT_FRAME_LINES", 4 ); // How many lines of images to show in paged mode
|
||||
define( "LEARN_MODE", false ); // Currently unimplemented, do not change
|
||||
|
||||
$rates = array(
|
||||
|
|
|
@ -31,6 +31,10 @@
|
|||
$rate = 1;
|
||||
if ( !isset( $scale ) )
|
||||
$scale = 1;
|
||||
|
||||
$frames_per_page = EVENT_FRAMES_PER_LINE * EVENT_FRAME_LINES;
|
||||
|
||||
$paged = $event[Frames] > $frames_per_page;
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
|
@ -104,7 +108,15 @@ Scale: <?= buildSelect( "scale", $scales, "document.view_form.submit();" ); ?>
|
|||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" class="text"><a href="javascript: refreshWindow();">Refresh</a></td>
|
||||
<?php if ( $mode == "stream" ) { ?>
|
||||
<td align="center" class="text"><a href="javascript: refreshWindow();">Replay</a></td>
|
||||
<?php } elseif ( $paged && $page ) { ?>
|
||||
<td align="center" class="text"><a href="<?= $PHP_SELF ?>?view=event&mode=still&mid=<?= $mid ?>&eid=<?= $eid ?>&page=0">All</a></td>
|
||||
<?php } elseif ( $paged && !$page ) { ?>
|
||||
<td align="center" class="text"><a href="<?= $PHP_SELF ?>?view=event&mode=still&mid=<?= $mid ?>&eid=<?= $eid ?>&page=1">Paged</a></td>
|
||||
<?php } else { ?>
|
||||
<td align="center" class="text"> </td>
|
||||
<?php } ?>
|
||||
<td align="center" class="text"><?php if ( canEdit( 'Events' ) ) { ?><a href="<?= $PHP_SELF ?>?view=none&action=delete&mid=<?= $mid ?>&mark_eid=<?= $eid ?>">Delete</a><?php } else { ?> <?php } ?></td>
|
||||
<?php if ( $event[Archived] ) { ?>
|
||||
<td align="center" class="text"><?php if ( canEdit( 'Events' ) ) { ?><a href="<?= $PHP_SELF ?>?view=<?= $view ?>&action=unarchive&mid=<?= $mid ?>&eid=<?= $eid ?>">Unarchive</a><?php } else { ?> <?php } ?></td>
|
||||
|
@ -112,7 +124,7 @@ Scale: <?= buildSelect( "scale", $scales, "document.view_form.submit();" ); ?>
|
|||
<td align="center" class="text"><?php if ( canEdit( 'Events' ) ) { ?><a href="<?= $PHP_SELF ?>?view=<?= $view ?>&action=archive&mid=<?= $mid ?>&eid=<?= $eid ?>">Archive</a><?php } else { ?> <?php } ?></td>
|
||||
<?php } ?>
|
||||
<?php if ( $mode == "stream" ) { ?>
|
||||
<td align="center" class="text"><a href="<?= $PHP_SELF ?>?view=event&mode=still&mid=<?= $mid ?>&eid=<?= $eid ?>">Stills</a></td>
|
||||
<td align="center" class="text"><a href="<?= $PHP_SELF ?>?view=event&mode=still&mid=<?= $mid ?>&eid=<?= $eid ?>&page=1">Stills</a></td>
|
||||
<?php } elseif ( canStream() ) { ?>
|
||||
<td align="center" class="text"><a href="<?= $PHP_SELF ?>?view=event&mode=stream&mid=<?= $mid ?>&eid=<?= $eid ?>">Stream</a></td>
|
||||
<?php } else { ?>
|
||||
|
@ -125,6 +137,79 @@ Scale: <?= buildSelect( "scale", $scales, "document.view_form.submit();" ); ?>
|
|||
<?php } ?>
|
||||
<td align="right" class="text"><a href="javascript: closeWindow();">Close</a></td>
|
||||
</tr>
|
||||
<?php
|
||||
if ( $mode == "still" && $paged && $page )
|
||||
{
|
||||
?>
|
||||
<?php
|
||||
$pages = (int)ceil($event[Frames]/$frames_per_page);
|
||||
$max_shortcuts = 5;
|
||||
?>
|
||||
<tr><td colspan="6" align="center" class="text">
|
||||
<?php
|
||||
if ( $page < 0 )
|
||||
$page = 1;
|
||||
if ( $page > $pages )
|
||||
$page = $pages;
|
||||
|
||||
if ( $page > 1 )
|
||||
{
|
||||
$new_pages = array();
|
||||
$pages_used = array();
|
||||
$lo_exp = max(2,log($page-1)/log($max_shortcuts));
|
||||
for ( $i = 0; $i < $max_shortcuts; $i++ )
|
||||
{
|
||||
$new_page = round($page-pow($lo_exp,$i));
|
||||
if ( $pages_used[$new_page] )
|
||||
continue;
|
||||
if ( $new_page <= 1 )
|
||||
break;
|
||||
$pages_used[$new_page] = true;
|
||||
array_unshift( $new_pages, $new_page );
|
||||
}
|
||||
if ( !$pages_used[1] )
|
||||
array_unshift( $new_pages, 1 );
|
||||
|
||||
foreach ( $new_pages as $new_page )
|
||||
{
|
||||
?>
|
||||
<a href="<?= $PHP_SELF ?>?view=event&mode=still&mid=<?= $mid ?>&eid=<?= $eid ?>&page=<?= $new_page ?>"><?= $new_page ?></a>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
- <?= $page ?> -
|
||||
<?php
|
||||
if ( $page < $pages )
|
||||
{
|
||||
$new_pages = array();
|
||||
$pages_used = array();
|
||||
$hi_exp = max(2,log($pages-$page)/log($max_shortcuts));
|
||||
for ( $i = 0; $i < $max_shortcuts; $i++ )
|
||||
{
|
||||
$new_page = round($page+pow($hi_exp,$i));
|
||||
if ( $pages_used[$new_page] )
|
||||
continue;
|
||||
if ( $new_page > $pages )
|
||||
break;
|
||||
$pages_used[$new_page] = true;
|
||||
array_push( $new_pages, $new_page );
|
||||
}
|
||||
if ( !$pages_used[$pages] )
|
||||
array_push( $new_pages, $pages );
|
||||
|
||||
foreach ( $new_pages as $new_page )
|
||||
{
|
||||
?>
|
||||
<a href="<?= $PHP_SELF ?>?view=event&mode=still&mid=<?= $mid ?>&eid=<?= $eid ?>&page=<?= $new_page ?>"><?= $new_page ?></a>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td></tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if ( $mode == "stream" )
|
||||
{
|
||||
|
@ -144,7 +229,10 @@ Scale: <?= buildSelect( "scale", $scales, "document.view_form.submit();" ); ?>
|
|||
}
|
||||
else
|
||||
{
|
||||
$result = mysql_query( "select * from Frames where EventID = '$eid' order by Id" );
|
||||
$sql = "select * from Frames where EventID = '$eid' order by Id";
|
||||
if ( $paged && $page )
|
||||
$sql .= " limit ".(($page-1)*$frames_per_page).", ".$frames_per_page;
|
||||
$result = mysql_query( $sql );
|
||||
if ( !$result )
|
||||
die( mysql_error() );
|
||||
?>
|
||||
|
|
|
@ -364,8 +364,8 @@ location.replace( '<?= $PHP_SELF ?>?view=events&mid=<?= $mid ?>&page=<?= $page ?
|
|||
unset( $bgcolor );
|
||||
?>
|
||||
<tr<?= ' bgcolor="'.($bgcolor?$bgcolor:"#FFFFFF").'"' ?> >
|
||||
<td align="center" class="text"><a href="javascript: eventWindow( '<?= $PHP_SELF ?>?view=event&mid=<?= $mid ?>&eid=<?= $event[Id] ?>', 'zmEvent' );"><span class="<?= $textclass ?>"><?= "$event[Id]" ?><?php if ( $event[Archived] ) echo "*" ?></span></a></td>
|
||||
<td align="center" class="text"><a href="javascript: eventWindow( '<?= $PHP_SELF ?>?view=event&mid=<?= $mid ?>&eid=<?= $event[Id] ?>', 'zmEvent' );"><span class="<?= $textclass ?>"><?= "$event[Name]" ?><?php if ( $event[Archived] ) echo "*" ?></span></a></td>
|
||||
<td align="center" class="text"><a href="javascript: eventWindow( '<?= $PHP_SELF ?>?view=event&mid=<?= $mid ?>&eid=<?= $event[Id] ?>&page=1', 'zmEvent' );"><span class="<?= $textclass ?>"><?= "$event[Id]" ?><?php if ( $event[Archived] ) echo "*" ?></span></a></td>
|
||||
<td align="center" class="text"><a href="javascript: eventWindow( '<?= $PHP_SELF ?>?view=event&mid=<?= $mid ?>&eid=<?= $event[Id] ?>&page=1', 'zmEvent' );"><span class="<?= $textclass ?>"><?= "$event[Name]" ?><?php if ( $event[Archived] ) echo "*" ?></span></a></td>
|
||||
<td align="center" class="text"><?= strftime( "%m/%d %H:%M:%S", strtotime($event[StartTime]) ) ?></td>
|
||||
<td align="center" class="text"><?= $event[Length] ?></td>
|
||||
<td align="center" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=frames&mid=<?= $mid ?>&eid=<?= $event[Id] ?>', 'zmFrames', <?= $jws['frames']['w'] ?>, <?= $jws['frames']['h'] ?> );"><?= $event[Frames] ?></a></td>
|
||||
|
|
|
@ -132,8 +132,8 @@ window.setTimeout( "window.location.replace( '<?= "$PHP_SELF?view=watchevents&mi
|
|||
{
|
||||
?>
|
||||
<tr bgcolor="#FFFFFF">
|
||||
<td align="center" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=event&mid=<?= $mid ?>&eid=<?= $event[Id] ?>', 'zmEvent', <?= $jws['event']['w'] ?>, <?= $jws['event']['h'] ?> );"><?= $event[Id] ?></a></td>
|
||||
<td align="center" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=event&mid=<?= $mid ?>&eid=<?= $event[Id] ?>', 'zmEvent', <?= $jws['event']['w'] ?>, <?= $jws['event']['h'] ?> );"><?= $event[Name] ?></a></td>
|
||||
<td align="center" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=event&mid=<?= $mid ?>&eid=<?= $event[Id] ?>&page=1', 'zmEvent', <?= $jws['event']['w'] ?>, <?= $jws['event']['h'] ?> );"><?= $event[Id] ?></a></td>
|
||||
<td align="center" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=event&mid=<?= $mid ?>&eid=<?= $event[Id] ?>&page=1', 'zmEvent', <?= $jws['event']['w'] ?>, <?= $jws['event']['h'] ?> );"><?= $event[Name] ?></a></td>
|
||||
<td align="center" class="text"><?= strftime( "%m/%d %H:%M:%S", strtotime($event[StartTime]) ) ?></td>
|
||||
<td align="center" class="text"><?= $event[Length] ?></td>
|
||||
<td align="center" class="text"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=frames&mid=<?= $mid ?>&eid=<?= $event[Id] ?>', 'zmFrames', <?= $jws['frames']['w'] ?>, <?= $jws['frames']['h'] ?> );"><?= $event[Frames] ?>/<?= $event[AlarmFrames] ?></a></td>
|
||||
|
|
Loading…
Reference in New Issue