From 35efc7d6ade9762b39e72ac1bf0e86aada199a75 Mon Sep 17 00:00:00 2001 From: stan Date: Fri, 14 Nov 2003 10:28:17 +0000 Subject: [PATCH] Added paged event frame images. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@691 e3e1d417-86f3-4887-817a-d78f3d33393f --- web/zm_config.php.z | 2 + web/zm_html_view_event.php | 94 +++++++++++++++++++++++++++++++- web/zm_html_view_events.php | 4 +- web/zm_html_view_watchevents.php | 4 +- 4 files changed, 97 insertions(+), 7 deletions(-) diff --git a/web/zm_config.php.z b/web/zm_config.php.z index 90d248fd0..7033544a8 100644 --- a/web/zm_config.php.z +++ b/web/zm_config.php.z @@ -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( diff --git a/web/zm_html_view_event.php b/web/zm_html_view_event.php index 726f18913..89f8f506c 100644 --- a/web/zm_html_view_event.php +++ b/web/zm_html_view_event.php @@ -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; ?> @@ -104,7 +108,15 @@ Scale: -Refresh + +Replay + +All + +Paged + +  + Delete  Unarchive  @@ -112,7 +124,7 @@ Scale: Archive  -Stills +Stills Stream @@ -125,6 +137,79 @@ Scale: Close + + + + $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 ) + { +?> +  + +-  - + $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 ) + { +?> +  + + + } 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() ); ?> diff --git a/web/zm_html_view_events.php b/web/zm_html_view_events.php index 258053659..f9387ec5c 100644 --- a/web/zm_html_view_events.php +++ b/web/zm_html_view_events.php @@ -364,8 +364,8 @@ location.replace( '?view=events&mid=&page= > - - + + diff --git a/web/zm_html_view_watchevents.php b/web/zm_html_view_watchevents.php index 2740e84d3..b7b6cd48c 100644 --- a/web/zm_html_view_watchevents.php +++ b/web/zm_html_view_watchevents.php @@ -132,8 +132,8 @@ window.setTimeout( "window.location.replace( ' - - + + /