Fixed event and frame navigation.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1581 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
7257cb5f9d
commit
bdc7931ee4
|
@ -759,7 +759,7 @@ function deScale( $dimension, $dummy )
|
|||
return( $dimension );
|
||||
}
|
||||
|
||||
function parseSort( $save_to_session=false )
|
||||
function parseSort( $save_to_session=false, $term_sep='&' )
|
||||
{
|
||||
global $sort_field, $sort_asc; // Inputs
|
||||
global $sort_query, $sort_column, $sort_order; // Outputs
|
||||
|
@ -815,7 +815,7 @@ function parseSort( $save_to_session=false )
|
|||
}
|
||||
$sort_order = $sort_asc?"asc":"desc";
|
||||
if ( !$sort_asc ) $sort_asc = 0;
|
||||
$sort_query = "&sort_field=$sort_field&sort_asc=$sort_asc";
|
||||
$sort_query = $term_sep."sort_field=".$sort_field.$term_sep."sort_asc=".$sort_asc;
|
||||
if ( $save_to_session )
|
||||
{
|
||||
$_SESSION['sort_field'] = $sort_field;
|
||||
|
@ -823,7 +823,7 @@ function parseSort( $save_to_session=false )
|
|||
}
|
||||
}
|
||||
|
||||
function parseFilter( $save_to_session=false )
|
||||
function parseFilter( $save_to_session=false, $term_sep='&' )
|
||||
{
|
||||
global $trms; // Inputs
|
||||
global $filter_query, $filter_sql, $filter_fields; // Outputs
|
||||
|
@ -842,7 +842,7 @@ function parseFilter( $save_to_session=false )
|
|||
{
|
||||
$_SESSION['trms'] = $trms;
|
||||
}
|
||||
$filter_query .= "&trms=$trms";
|
||||
$filter_query .= $term_sep."trms=".$trms;
|
||||
$filter_fields .= '<input type="hidden" name="trms" value="'.$trms.'"/>'."\n";
|
||||
|
||||
for ( $i = 1; $i <= $trms; $i++ )
|
||||
|
@ -858,7 +858,7 @@ function parseFilter( $save_to_session=false )
|
|||
|
||||
if ( isset($$conjunction_name) )
|
||||
{
|
||||
$filter_query .= "&$conjunction_name=".$$conjunction_name;
|
||||
$filter_query .= $term_sep.$conjunction_name."=".$$conjunction_name;
|
||||
$filter_sql .= " ".$$conjunction_name." ";
|
||||
$filter_fields .= '<input type="hidden" name="'.$conjunction_name.'" value="'.$$conjunction_name.'"/>'."\n";
|
||||
if ( $save_to_session )
|
||||
|
@ -868,7 +868,7 @@ function parseFilter( $save_to_session=false )
|
|||
}
|
||||
if ( isset($$obracket_name) )
|
||||
{
|
||||
$filter_query .= "&$obracket_name=".$$obracket_name;
|
||||
$filter_query .= $term_sep.$obracket_name."=".$$obracket_name;
|
||||
$filter_sql .= str_repeat( "(", $$obracket_name );
|
||||
$filter_fields .= '<input type="hidden" name="'.$obracket_name.'" value="'.$$obracket_name.'"/>'."\n";
|
||||
if ( $save_to_session )
|
||||
|
@ -878,7 +878,7 @@ function parseFilter( $save_to_session=false )
|
|||
}
|
||||
if ( isset($$attr_name) )
|
||||
{
|
||||
$filter_query .= "&$attr_name=".$$attr_name;
|
||||
$filter_query .= $term_sep.$attr_name."=".$$attr_name;
|
||||
$filter_fields .= '<input type="hidden" name="'.$attr_name.'" value="'.$$attr_name.'"/>'."\n";
|
||||
switch ( $$attr_name )
|
||||
{
|
||||
|
@ -972,9 +972,9 @@ function parseFilter( $save_to_session=false )
|
|||
break;
|
||||
}
|
||||
|
||||
$filter_query .= "&$op_name=".urlencode($$op_name);
|
||||
$filter_query .= $term_sep.$op_name."=".urlencode($$op_name);
|
||||
$filter_fields .= '<input type="hidden" name="'.$op_name.'" value="'.$$op_name.'"/>'."\n";
|
||||
$filter_query .= "&$value_name=".urlencode($$value_name);
|
||||
$filter_query .= $term_sep.$value_name."=".urlencode($$value_name);
|
||||
$filter_fields .= '<input type="hidden" name="'.$value_name.'" value="'.$$value_name.'"/>'."\n";
|
||||
if ( $save_to_session )
|
||||
{
|
||||
|
@ -985,7 +985,7 @@ function parseFilter( $save_to_session=false )
|
|||
}
|
||||
if ( isset($$cbracket_name) )
|
||||
{
|
||||
$filter_query .= "&$cbracket_name=".$$cbracket_name;
|
||||
$filter_query .= $term_sep.$cbracket_name."=".$$cbracket_name;
|
||||
$filter_sql .= str_repeat( ")", $$cbracket_name );
|
||||
$filter_fields .= '<input type="hidden" name="'.$cbracket_name.'" value="'.$$cbracket_name.'"/>'."\n";
|
||||
if ( $save_to_session )
|
||||
|
|
|
@ -268,9 +268,14 @@ function viewEvents( form, name )
|
|||
|
||||
if ( $page > 1 )
|
||||
{
|
||||
if ( false && $page > 2 )
|
||||
{
|
||||
?>
|
||||
<a href="<?= $PHP_SELF ?>?view=<?= $view ?>&page=1<?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?>"><<</a>
|
||||
<a href="<?= $PHP_SELF ?>?view=<?= $view ?>&page=<?= $page - 1 ?><?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?>"><</a>
|
||||
<a href="<?= $PHP_SELF ?>?view=<?= $view ?>&page=1<?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?>"><<</a>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<a href="<?= $PHP_SELF ?>?view=<?= $view ?>&page=<?= $page - 1 ?><?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?>"><</a>
|
||||
<?php
|
||||
$new_pages = array();
|
||||
$pages_used = array();
|
||||
|
@ -324,9 +329,14 @@ function viewEvents( form, name )
|
|||
<?php
|
||||
}
|
||||
?>
|
||||
<a href="<?= $PHP_SELF ?>?view=<?= $view ?>&page=<?= $page + 1 ?><?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?>">></a>
|
||||
<a href="<?= $PHP_SELF ?>?view=<?= $view ?>&page=<?= $pages ?><?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?>">>></a>
|
||||
<a href="<?= $PHP_SELF ?>?view=<?= $view ?>&page=<?= $page + 1 ?><?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?>">></a>
|
||||
<?php
|
||||
if ( false && $page < ($pages-1) )
|
||||
{
|
||||
?>
|
||||
<a href="<?= $PHP_SELF ?>?view=<?= $view ?>&page=<?= $pages ?><?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?>">>></a>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
|
|
@ -1157,9 +1157,9 @@ div.zoom {
|
|||
<div id="ImageNav">
|
||||
<div id="Image"><img id="ImageSrc" src="graphics/spacer.gif" height="<?= $chart['image']['height'] ?>"/></div>
|
||||
<div id="RightNav">
|
||||
<a href="<?= $PHP_SELF ?>?view=<?= $view ?><?= $filter_query ?>&mid_time=<?= urlencode($min_time) ?>&range=<?= $range ?>"><<</a>
|
||||
<a href="<?= $PHP_SELF ?>?view=<?= $view ?><?= $filter_query ?>&mid_time=<?= urlencode($min_time) ?>&range=<?= $range ?>"><</a>
|
||||
<a href="<?= $PHP_SELF ?>?view=<?= $view ?><?= $filter_query ?>&mid_time=<?= urlencode($mid_time) ?>&range=<?= (int)($range*$maj_x_scale['zoomout']) ?>">-</a>
|
||||
<a href="<?= $PHP_SELF ?>?view=<?= $view ?><?= $filter_query ?>&min_time=<?= urlencode($mid_time) ?>&range=<?= $range ?>">>></a>
|
||||
<a href="<?= $PHP_SELF ?>?view=<?= $view ?><?= $filter_query ?>&min_time=<?= urlencode($mid_time) ?>&range=<?= $range ?>">></a>
|
||||
</div>
|
||||
<div id="ImageText">No Event</div>
|
||||
<div id="Key">
|
||||
|
|
|
@ -60,8 +60,8 @@ elseif ( isset( $fid ) )
|
|||
$fid = $frame['FrameId'];
|
||||
}
|
||||
|
||||
parseSort();
|
||||
parseFilter();
|
||||
parseSort( true, '&' );
|
||||
parseFilter( true, '&' );
|
||||
|
||||
$sql = "select E.* from Events as E inner join Monitors as M on E.MonitorId = M.Id where $sort_column ".($sort_order=='asc'?'<=':'>=')." '".$event[$sort_field]."'$filter_sql$mid_sql order by $sort_column ".($sort_order=='asc'?'desc':'asc');
|
||||
$result = mysql_query( $sql );
|
||||
|
@ -127,8 +127,13 @@ if ( $paged && !empty($page) )
|
|||
|
||||
if ( $page > 1 )
|
||||
{
|
||||
if ( false && $page > 2 )
|
||||
{
|
||||
?>
|
||||
<td align="center" class="text"><a href="<?= $PHP_SELF ?>?view=event&mode=still&eid=<?= $eid ?><?= $filter_query ?><?= $sort_query ?>&page=1"><<</a></td>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<td align="center" class="text"><a href="<?= $PHP_SELF ?>?view=event&mode=still&eid=<?= $eid ?><?= $filter_query ?><?= $sort_query ?>&page=<?= $page-1 ?>"><</a></td>
|
||||
<?php
|
||||
$new_pages = array();
|
||||
|
@ -183,8 +188,13 @@ if ( $paged && !empty($page) )
|
|||
}
|
||||
?>
|
||||
<td align="center" class="text"><a href="<?= $PHP_SELF ?>?view=event&mode=still&eid=<?= $eid ?><?= $filter_query ?><?= $sort_query ?>&page=<?= $page+1 ?>">></a></td>
|
||||
<?php
|
||||
if ( false && $page < ($pages-1) )
|
||||
{
|
||||
?>
|
||||
<td align="center" class="text"><a href="<?= $PHP_SELF ?>?view=event&mode=still&eid=<?= $eid ?><?= $filter_query ?><?= $sort_query ?>&page=<?= $pages ?>">>></a></td>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
|
|
|
@ -69,8 +69,8 @@ else
|
|||
$events_sql .= " 1";
|
||||
}
|
||||
|
||||
parseSort( true );
|
||||
parseFilter( true );
|
||||
parseSort( true, '&' );
|
||||
parseFilter( true, '&' );
|
||||
|
||||
if ( $filter_sql )
|
||||
{
|
||||
|
@ -127,14 +127,15 @@ if ( !empty($limit) && $n_events > $limit )
|
|||
</table>
|
||||
<?php
|
||||
$pages = (int)ceil($n_events/$device_lines);
|
||||
$max_shortcuts = 3;
|
||||
if ( $pages > 1 )
|
||||
{
|
||||
if ( $page )
|
||||
{
|
||||
?>
|
||||
<p align="center">
|
||||
<table style="width:100%">
|
||||
<tr>
|
||||
<?php
|
||||
$max_shortcuts = 2;
|
||||
if ( !empty($page) )
|
||||
{
|
||||
if ( $page < 0 )
|
||||
$page = 1;
|
||||
if ( $page > $pages )
|
||||
|
@ -142,6 +143,15 @@ if ( !empty($limit) && $n_events > $limit )
|
|||
|
||||
if ( $page > 1 )
|
||||
{
|
||||
if ( false && $page > 2 )
|
||||
{
|
||||
?>
|
||||
<td align="center" class="text"><a href="<?= $PHP_SELF ?>?view=<?= $view ?>&limit=<?= $limit ?><?= $filter_query ?><?= $sort_query ?>&page=1"><<</a></td>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<td align="center" class="text"><a href="<?= $PHP_SELF ?>?view=<?= $view ?>&limit=<?= $limit ?><?= $filter_query ?><?= $sort_query ?>&page=<?= $page-1 ?>"><</a></td>
|
||||
<?php
|
||||
$new_pages = array();
|
||||
$pages_used = array();
|
||||
$lo_exp = max(2,log($page-1)/log($max_shortcuts));
|
||||
|
@ -161,12 +171,12 @@ if ( !empty($limit) && $n_events > $limit )
|
|||
foreach ( $new_pages as $new_page )
|
||||
{
|
||||
?>
|
||||
<a href="<?= $PHP_SELF ?>?view=<?= $view ?>&page=<?= $new_page ?>&limit=<?= $limit ?>"><?= $new_page ?></a>
|
||||
<td align="center" class="text"><a href="<?= $PHP_SELF ?>?view=<?= $view ?>&limit=<?= $limit ?><?= $filter_query ?><?= $sort_query ?>&page=<?= $new_page ?>"><?= $new_page ?></a></td>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
- <?= $page ?> -
|
||||
<td align="center" class="text"><?= $page ?></td>
|
||||
<?php
|
||||
if ( $page < $pages )
|
||||
{
|
||||
|
@ -189,14 +199,24 @@ if ( !empty($limit) && $n_events > $limit )
|
|||
foreach ( $new_pages as $new_page )
|
||||
{
|
||||
?>
|
||||
<a href="<?= $PHP_SELF ?>?view=<?= $view ?>&page=<?= $new_page ?>&limit=<?= $limit ?>"><?= $new_page ?></a>
|
||||
<td align="center" class="text"><a href="<?= $PHP_SELF ?>?view=<?= $view ?>&limit=<?= $limit ?><?= $filter_query ?><?= $sort_query ?>&page=<?= $new_page ?>"><?= $new_page ?></a></td>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<td align="center" class="text"><a href="<?= $PHP_SELF ?>?view=<?= $view ?>&limit=<?= $limit ?><?= $filter_query ?><?= $sort_query ?>&page=<?= $page+1 ?>">></a></td>
|
||||
<?php
|
||||
if ( false && $page < ($pages-1) )
|
||||
{
|
||||
?>
|
||||
<td align="center" class="text"><a href="<?= $PHP_SELF ?>?view=<?= $view ?>&limit=<?= $limit ?><?= $filter_query ?><?= $sort_query ?>&page=<?= $pages ?>">>></a></td>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<table bgcolor="#7F7FB2">
|
||||
|
|
Loading…
Reference in New Issue