2003-07-11 17:27:56 +08:00
< ? php
2004-01-08 19:45:57 +08:00
//
// ZoneMinder web events view file, $Date$, $Revision$
2006-01-17 19:32:47 +08:00
// Copyright (C) 2003, 2004, 2005, 2006 Philip Coombes
2004-01-08 19:45:57 +08:00
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
2003-07-11 17:27:56 +08:00
2006-10-23 23:32:22 +08:00
if ( ! canView ( 'Events' ) || ( $execute && ! canEdit ( 'Events' )) )
2004-01-08 19:45:57 +08:00
{
$view = " error " ;
return ;
}
2004-02-16 03:42:00 +08:00
2006-10-23 23:32:22 +08:00
if ( $execute )
{
executeFilter ( $temp_filter_name );
}
2004-02-16 03:42:00 +08:00
$count_sql = " select count(E.Id) as EventCount from Monitors as M inner join Events as E on (M.Id = E.MonitorId) where " ;
2005-10-20 00:52:28 +08:00
$events_sql = " select E.Id,E.MonitorId,M.Name As MonitorName,M.Width,M.Height,M.DefaultScale,E.Name,E.Cause,E.StartTime,E.Length,E.Frames,E.AlarmFrames,E.TotScore,E.AvgScore,E.MaxScore,E.Archived,E.LearnState from Monitors as M inner join Events as E on (M.Id = E.MonitorId) where " ;
2004-02-16 03:42:00 +08:00
if ( $user [ 'MonitorIds' ] )
{
$count_sql .= " M.Id in ( " . join ( " , " , preg_split ( '/["\'\s]*,["\'\s]*/' , $user [ 'MonitorIds' ] ) ) . " ) " ;
$events_sql .= " M.Id in ( " . join ( " , " , preg_split ( '/["\'\s]*,["\'\s]*/' , $user [ 'MonitorIds' ] ) ) . " ) " ;
}
else
{
$count_sql .= " 1 " ;
$events_sql .= " 1 " ;
}
2004-03-10 22:23:22 +08:00
parseSort ();
parseFilter ();
2004-02-16 03:42:00 +08:00
2004-01-08 19:45:57 +08:00
if ( $filter_sql )
{
2004-03-10 22:23:22 +08:00
$count_sql .= $filter_sql ;
$events_sql .= $filter_sql ;
2004-01-08 19:45:57 +08:00
}
$events_sql .= " order by $sort_column $sort_order " ;
2003-07-11 17:27:56 +08:00
?>
2004-12-29 03:22:23 +08:00
<! DOCTYPE HTML PUBLIC " -//W3C//DTD HTML 4.01 Transitional//EN " >
2003-07-11 17:27:56 +08:00
< html >
< head >
2005-05-06 20:24:57 +08:00
< title >< ? = ZM_WEB_TITLE_PREFIX ?> - <?= $zmSlangEvents ?></title>
2004-12-29 02:20:11 +08:00
< link rel = " stylesheet " href = " zm_html_styles.css " type = " text/css " >
2004-12-29 03:29:43 +08:00
< script type = " text/javascript " >
2003-07-11 17:27:56 +08:00
function newWindow ( Url , Name , Width , Height )
{
2005-11-21 23:32:04 +08:00
var Win = window . open ( Url , Name , " resizable,scrollbars,width= " + Width + " ,height= " + Height );
2003-07-11 17:27:56 +08:00
}
2004-02-16 03:42:00 +08:00
function eventWindow ( Url , Name , Width , Height )
2003-07-11 17:27:56 +08:00
{
2005-11-21 23:32:04 +08:00
var Win = window . open ( Url , Name , " resizable,width= " + Width + " ,height= " + Height );
2003-07-11 17:27:56 +08:00
}
function filterWindow ( Url , Name )
{
2005-11-21 23:32:04 +08:00
var Win = window . open ( Url , Name , " resizable,scrollbars,width=<?= $jws['filter'] ['w'] ?>,height=<?= $jws['filter'] ['h'] ?> " );
2003-07-11 17:27:56 +08:00
}
2005-10-02 00:21:49 +08:00
function timelineWindow ( Url , Name )
{
2005-11-21 23:32:04 +08:00
var Win = window . open ( Url , Name , " resizable,scrollbars,width=<?= $jws['timeline'] ['w'] ?>,height=<?= $jws['timeline'] ['h'] ?> " );
2005-10-02 00:21:49 +08:00
}
2003-07-11 17:27:56 +08:00
function closeWindow ()
{
window . close ();
// This is a hack. The only way to close an existing window is to try and open it!
2004-02-16 03:42:00 +08:00
var filterWindow = window . open ( " <?= $PHP_SELF ?>?view=none " , 'zmFilter' , 'width=1,height=1' );
2003-07-11 17:27:56 +08:00
filterWindow . close ();
}
2004-09-24 06:21:05 +08:00
< ? php
if ( isset ( $filter ) )
{
?>
//opener.location.reload(true);
filterWindow ( '<?= $PHP_SELF ?>?view=filter&page=<?= $page ?><?= $filter_query ?>' , 'zmFilter' );
location . replace ( '<?= $PHP_SELF ?>?view=<?= $view ?>&page=<?= $page ?><?= $filter_query ?>' );
</ script >
</ head >
</ html >
< ? php
}
else
{
if ( ! ( $result = mysql_query ( $count_sql )) )
die ( mysql_error () );
$row = mysql_fetch_assoc ( $result );
2006-01-15 21:09:30 +08:00
mysql_free_result ( $result );
2004-09-24 06:21:05 +08:00
$n_events = $row [ 'EventCount' ];
if ( ! empty ( $limit ) && $n_events > $limit )
{
$n_events = $limit ;
}
2006-03-31 21:42:31 +08:00
$pages = ( int ) ceil ( $n_events / ZM_WEB_EVENTS_PER_PAGE );
if ( $pages > 1 )
{
if ( $page )
{
if ( $page < 0 )
$page = 1 ;
if ( $page > $pages )
$page = $pages ;
}
}
if ( $page )
{
$limit_start = (( $page - 1 ) * ZM_WEB_EVENTS_PER_PAGE );
if ( empty ( $limit ) )
{
$limit_amount = ZM_WEB_EVENTS_PER_PAGE ;
}
else
{
$limit_left = $limit - $limit_start ;
$limit_amount = ( $limit_left > ZM_WEB_EVENTS_PER_PAGE ) ? ZM_WEB_EVENTS_PER_PAGE : $limit_left ;
}
$events_sql .= " limit $limit_start , $limit_amount " ;
}
elseif ( ! empty ( $limit ) )
{
$events_sql .= " limit 0, $limit " ;
}
2004-09-24 06:21:05 +08:00
if ( ! ( $result = mysql_query ( $events_sql )) )
die ( mysql_error () );
$max_width = 0 ;
$max_height = 0 ;
2005-05-16 23:16:36 +08:00
$archived = false ;
$unarchived = false ;
2004-09-24 06:21:05 +08:00
$events = array ();
while ( $event = mysql_fetch_assoc ( $result ) )
{
$events [] = $event ;
2006-01-18 01:07:13 +08:00
$scale = max ( reScale ( SCALE_BASE , $event [ 'DefaultScale' ], ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
2005-10-20 00:52:28 +08:00
$event_width = reScale ( $event [ 'Width' ], $scale );
2006-01-18 05:11:49 +08:00
$event_height = reScale ( $event [ 'Height' ], $scale );
2005-10-20 00:52:28 +08:00
if ( $max_width < $event_width ) $max_width = $event_width ;
if ( $max_height < $event_height ) $max_height = $event_height ;
2005-05-16 23:16:36 +08:00
if ( $event [ 'Archived' ] )
$archived = true ;
else
$unarchived = true ;
2004-09-24 06:21:05 +08:00
}
2006-01-15 21:09:30 +08:00
mysql_free_result ( $result );
2004-09-24 06:21:05 +08:00
?>
2005-11-21 23:32:04 +08:00
function toggleCheck ( element , name )
2003-07-11 17:27:56 +08:00
{
2005-11-21 23:32:04 +08:00
var form = element . form ;
var checked = element . checked ;
2003-07-11 17:27:56 +08:00
for ( var i = 0 ; i < form . elements . length ; i ++ )
if ( form . elements [ i ] . name . indexOf ( name ) == 0 )
2005-11-21 23:32:04 +08:00
form . elements [ i ] . checked = checked ;
form . view_btn . disabled = ! checked ;
form . edit_btn . disabled = ! checked ;
form . archive_btn . disabled = < ? = $unarchived ? " !checked " : " true " ?> ;
form . unarchive_btn . disabled = < ? = $archived ? " !checked " : " true " ?> ;
form . export_btn . disabled = ! checked ;
form . delete_btn . disabled = ! checked ;
2003-07-11 17:27:56 +08:00
< ? php if ( LEARN_MODE ) { ?>
2005-11-21 23:32:04 +08:00
form . learn_btn . disabled = ! checked ;
form . learn_state . disabled = ! checked ;
2003-07-11 17:27:56 +08:00
< ? php } ?>
}
2005-11-21 23:32:04 +08:00
function configureButton ( element , name )
2003-07-11 17:27:56 +08:00
{
2005-11-21 23:32:04 +08:00
var form = element . form ;
var checked = element . checked ;
if ( ! checked )
2003-07-11 17:27:56 +08:00
{
2005-11-21 23:32:04 +08:00
for ( var i = 0 ; i < form . elements . length ; i ++ )
2003-07-11 17:27:56 +08:00
{
2005-11-21 23:32:04 +08:00
if ( form . elements [ i ] . name . indexOf ( name ) == 0 )
2003-07-11 17:27:56 +08:00
{
2005-11-21 23:32:04 +08:00
if ( form . elements [ i ] . checked )
{
checked = true ;
break ;
}
2003-07-11 17:27:56 +08:00
}
}
}
2005-11-21 23:32:04 +08:00
if ( ! element . checked )
form . toggle_check . checked = false ;
2004-09-24 06:21:05 +08:00
form . view_btn . disabled = ! checked ;
2005-05-16 23:16:36 +08:00
form . edit_btn . disabled = ! checked ;
form . archive_btn . disabled = ( ! checked ) ||< ? = $unarchived ? " false " : " true " ?> ;
form . unarchive_btn . disabled = ( ! checked ) ||< ? = $archived ? " false " : " true " ?> ;
2005-05-18 05:51:39 +08:00
form . export_btn . disabled = ! checked ;
2003-07-11 17:27:56 +08:00
form . delete_btn . disabled = ! checked ;
< ? php if ( LEARN_MODE ) { ?>
form . learn_btn . disabled = ! checked ;
form . learn_state . disabled = ! checked ;
< ? php } ?>
}
2006-04-01 00:02:27 +08:00
function deleteEvents ( form , name )
{
var count = 0 ;
for ( var i = 0 ; i < form . elements . length ; i ++ )
{
if ( form . elements [ i ] . name . indexOf ( name ) == 0 )
{
if ( form . elements [ i ] . checked )
{
count ++ ;
break ;
}
}
}
if ( count > 0 )
{
if ( confirm ( " <?= $zmSlangConfirmDeleteEvents ?> " ) )
{
form . action . value = 'delete' ;
form . submit ();
}
}
}
2005-05-16 23:16:36 +08:00
function editEvents ( form , name )
{
var eids = new Array ();
for ( var i = 0 ; i < form . elements . length ; i ++ )
{
if ( form . elements [ i ] . name . indexOf ( name ) == 0 )
{
if ( form . elements [ i ] . checked )
{
eids [ eids . length ] = 'eids[]=' + form . elements [ i ] . value ;
}
}
}
2005-11-21 23:32:04 +08:00
var Win = newWindow ( '<?= $PHP_SELF ?>?view=eventdetail&' + eids . join ( '&' ), 'zmEventDetail' , < ? = $jws [ 'eventdetail' ][ 'w' ] ?> , <?= $jws['eventdetail']['h'] ?> );
2005-05-16 23:16:36 +08:00
}
2005-05-18 05:51:39 +08:00
function exportEvents ( form , name )
{
var eids = new Array ();
for ( var i = 0 ; i < form . elements . length ; i ++ )
{
if ( form . elements [ i ] . name . indexOf ( name ) == 0 )
{
if ( form . elements [ i ] . checked )
{
eids [ eids . length ] = 'eids[]=' + form . elements [ i ] . value ;
}
}
}
2005-11-21 23:32:04 +08:00
var Win = newWindow ( '<?= $PHP_SELF ?>?view=export&' + eids . join ( '&' ), 'zmExport' , < ? = $jws [ 'export' ][ 'w' ] ?> , <?= $jws['export']['h'] ?> );
2005-05-18 05:51:39 +08:00
}
2004-09-24 06:21:05 +08:00
function viewEvents ( form , name )
2004-01-08 19:45:57 +08:00
{
2004-09-24 06:21:05 +08:00
var events = new Array ();
for ( var i = 0 ; i < form . elements . length ; i ++ )
2004-04-21 17:20:28 +08:00
{
2004-09-24 06:21:05 +08:00
if ( form . elements [ i ] . name . indexOf ( name ) == 0 )
{
if ( form . elements [ i ] . checked )
{
events [ events . length ] = form . elements [ i ] . value ;
}
}
2004-04-21 17:20:28 +08:00
}
2004-09-24 06:21:05 +08:00
if ( events . length > 0 )
{
eventWindow ( '<?= $PHP_SELF ?>?view=event&eid=' + events [ 0 ] + '&trms=1&attr1=Id&op1=%3D%5B%5D&val1=' + events . join ( '%2C' ) + '<?= $sort_query ?>&page=1&play=1' , 'zmEvent' , < ? = $max_width + $jws [ 'event' ][ 'w' ] ?> , <?= $max_height+$jws['event']['h'] ?> );
}
}
2003-07-11 17:27:56 +08:00
</ script >
</ head >
< body >
< form name = " event_form " method = " post " action = " <?= $PHP_SELF ?> " >
< input type = " hidden " name = " view " value = " <?= $view ?> " >
< input type = " hidden " name = " action " value = " " >
2003-10-08 21:03:47 +08:00
< input type = " hidden " name = " page " value = " <?= $page ?> " >
2004-04-21 17:20:28 +08:00
< ? = $filter_fields ?>
< input type = " hidden " name = " sort_field " value = " <?= $sort_field ?> " >
< input type = " hidden " name = " sort_asc " value = " <?= $sort_asc ?> " >
< input type = " hidden " name = " limit " value = " <?= $limit ?> " >
2003-07-11 17:27:56 +08:00
< center >< table width = " 96% " align = " center " border = " 0 " cellspacing = " 1 " cellpadding = " 0 " >
< tr >
< td valign = " top " >< table border = " 0 " cellspacing = " 0 " cellpadding = " 0 " width = " 100% " >
< tr >
2004-02-16 03:42:00 +08:00
< td align = " left " class = " text " width = " 20% " >< b >< ? = sprintf ( $zmClangEventCount , $n_events , zmVlang ( $zmVlangEvent , $n_events ) ) ?> </b></td>
2003-10-08 21:03:47 +08:00
< ? php
2004-09-23 20:06:21 +08:00
$pages = ( int ) ceil ( $n_events / ZM_WEB_EVENTS_PER_PAGE );
2004-01-08 19:45:57 +08:00
if ( $pages <= 1 )
{
2003-10-08 21:03:47 +08:00
?>
2005-10-03 02:33:38 +08:00
< td align = " center " class = " text " width = " 40% " >& nbsp ; </ td >
< td align = " center " class = " text " width = " 25% " >& nbsp ; </ td >
2003-10-08 21:03:47 +08:00
< ? php
2004-01-08 19:45:57 +08:00
}
else
{
if ( $page )
2003-10-08 21:03:47 +08:00
{
2004-01-08 19:45:57 +08:00
$max_shortcuts = 5 ;
2003-10-08 21:03:47 +08:00
?>
2005-10-03 02:33:38 +08:00
< td align = " center " class = " text " width = " 40% " >
2003-10-08 21:03:47 +08:00
< ? php
2004-01-08 19:45:57 +08:00
if ( $page < 0 )
$page = 1 ;
if ( $page > $pages )
$page = $pages ;
2003-10-08 21:03:47 +08:00
2004-01-08 19:45:57 +08:00
if ( $page > 1 )
{
2005-11-09 01:57:41 +08:00
if ( false && $page > 2 )
{
?>
< a href = " <?= $PHP_SELF ?>?view=<?= $view ?>&page=1<?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?> " >& lt ; & lt ; </ a >
< ? php
}
2004-09-23 20:06:21 +08:00
?>
2005-11-09 01:57:41 +08:00
< a href = " <?= $PHP_SELF ?>?view=<?= $view ?>&page=<?= $page - 1 ?><?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?> " >& lt ; </ a >
2004-09-23 20:06:21 +08:00
< ? php
2004-01-08 19:45:57 +08:00
$new_pages = array ();
$pages_used = array ();
$lo_exp = max ( 2 , log ( $page - 1 ) / log ( $max_shortcuts ));
for ( $i = 0 ; $i < $max_shortcuts ; $i ++ )
2003-10-08 21:03:47 +08:00
{
2004-01-08 19:45:57 +08:00
$new_page = round ( $page - pow ( $lo_exp , $i ));
if ( isset ( $pages_used [ $new_page ]) )
continue ;
if ( $new_page <= 1 )
break ;
$pages_used [ $new_page ] = true ;
array_unshift ( $new_pages , $new_page );
}
if ( ! isset ( $pages_used [ 1 ]) )
array_unshift ( $new_pages , 1 );
2003-10-08 21:03:47 +08:00
2004-01-08 19:45:57 +08:00
foreach ( $new_pages as $new_page )
{
2003-10-08 21:03:47 +08:00
?>
2004-04-21 17:20:28 +08:00
< a href = " <?= $PHP_SELF ?>?view=<?= $view ?>&page=<?= $new_page ?><?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?> " >< ? = $new_page ?> </a>
2003-10-08 21:03:47 +08:00
< ? php
}
2004-09-23 20:06:21 +08:00
2004-01-08 19:45:57 +08:00
}
2003-10-08 21:03:47 +08:00
?>
-& nbsp ; < ? = $page ?> -
< ? php
2004-01-08 19:45:57 +08:00
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 ++ )
2003-10-08 21:03:47 +08:00
{
2004-01-08 19:45:57 +08:00
$new_page = round ( $page + pow ( $hi_exp , $i ));
if ( isset ( $pages_used [ $new_page ]) )
continue ;
if ( $new_page > $pages )
break ;
$pages_used [ $new_page ] = true ;
array_push ( $new_pages , $new_page );
}
if ( ! isset ( $pages_used [ $pages ]) )
array_push ( $new_pages , $pages );
2003-10-08 21:03:47 +08:00
2004-01-08 19:45:57 +08:00
foreach ( $new_pages as $new_page )
{
2003-10-08 21:03:47 +08:00
?>
2004-04-21 17:20:28 +08:00
& nbsp ; < a href = " <?= $PHP_SELF ?>?view=<?= $view ?>&page=<?= $new_page ?><?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?> " >< ? = $new_page ?> </a>
2003-10-08 21:03:47 +08:00
< ? php
}
2004-09-23 20:06:21 +08:00
?>
2005-11-09 01:57:41 +08:00
< a href = " <?= $PHP_SELF ?>?view=<?= $view ?>&page=<?= $page + 1 ?><?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?> " >& gt ; </ a >
2004-09-23 20:06:21 +08:00
< ? php
2005-11-09 01:57:41 +08:00
if ( false && $page < ( $pages - 1 ) )
{
?>
< a href = " <?= $PHP_SELF ?>?view=<?= $view ?>&page=<?= $pages ?><?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?> " >& gt ; & gt ; </ a >
< ? php
}
2004-01-08 19:45:57 +08:00
}
2003-10-08 21:03:47 +08:00
?>
</ td >
2005-10-03 02:33:38 +08:00
< td align = " right " class = " text " width = " 25% " >< a href = " <?= $PHP_SELF ?>?view=<?= $view ?>&page=0<?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?> " >< ? = $zmSlangViewAll ?> </a></td>
2003-10-08 21:03:47 +08:00
< ? php
2004-01-08 19:45:57 +08:00
}
else
{
2003-10-08 21:03:47 +08:00
?>
2005-10-02 00:21:49 +08:00
< td align = " center " class = " text " width = " 40% " >& nbsp ; </ td >
< td align = " center " class = " text " width = " 25% " >< a href = " <?= $PHP_SELF ?>?view=<?= $view ?>&page=1<?= $filter_query ?><?= $sort_query ?>&limit=<?= $limit ?> " >< ? = $zmSlangViewPaged ?> </a></td>
2003-10-08 21:03:47 +08:00
< ? php
}
2004-01-08 19:45:57 +08:00
}
2003-10-08 21:03:47 +08:00
?>
2005-10-02 00:21:49 +08:00
< td align = " right " class = " text " width = " 15% " >< a href = " javascript: closeWindow(); " >< ? = $zmSlangClose ?> </a></td>
2003-07-11 17:27:56 +08:00
</ tr >
2003-10-08 21:03:47 +08:00
< tr >< td colspan = " 4 " class = " text " >& nbsp ; </ td ></ tr >
2003-07-11 17:27:56 +08:00
< tr >
2006-04-24 19:50:02 +08:00
< td align = " left " class = " text " >< a href = " javascript: location.reload(true); " >< ? = $zmSlangRefresh ?> </a></td>
2005-10-02 00:21:49 +08:00
< td colspan = " 1 " align = " center " class = " text " >< a href = " javascript: filterWindow( '<?= $PHP_SELF ?>?view=filter&page=<?= $page ?><?= $filter_query ?>', 'zmFilter' ); " >< ? = $zmSlangShowFilterWindow ?> </a></td>
2006-04-24 19:50:02 +08:00
< td colspan = " 2 " align = " right " class = " text " >< a href = " javascript: timelineWindow( '<?= $PHP_SELF ?>?view=timeline<?= $filter_query ?>', 'zmTimeline' ); " >< ? = $zmSlangShowTimeline ?> </a></td>
2003-07-11 17:27:56 +08:00
</ tr >
2003-10-08 21:03:47 +08:00
< tr >< td colspan = " 4 " class = " text " >& nbsp ; </ td ></ tr >
< tr >< td colspan = " 4 " >< table border = " 0 " cellspacing = " 1 " cellpadding = " 0 " width = " 100% " bgcolor = " #7F7FB2 " >
2003-07-11 17:27:56 +08:00
< ? php
2004-01-08 19:45:57 +08:00
flush ();
$count = 0 ;
2004-09-24 06:21:05 +08:00
foreach ( $events as $event )
2004-01-08 19:45:57 +08:00
{
2004-09-23 20:06:21 +08:00
if ( ( $count ++% ZM_WEB_EVENTS_PER_PAGE ) == 0 )
2003-09-23 17:52:45 +08:00
{
2003-07-11 17:27:56 +08:00
?>
< tr align = " center " bgcolor = " #FFFFFF " >
2005-05-16 23:16:36 +08:00
< td class = " text " >< a href = " <?= $PHP_SELF ?>?view=<?= $view ?>&page=1<?= $filter_query ?>&sort_field=Id&sort_asc=<?= $sort_field == 'Id'?! $sort_asc :0 ?>&limit=<?= $limit ?> " >< ? = $zmSlangId ?> <?php if ( $sort_field == "Id" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
< td class = " text " >< a href = " <?= $PHP_SELF ?>?view=<?= $view ?>&page=1<?= $filter_query ?>&sort_field=Name&sort_asc=<?= $sort_field == 'Name'?! $sort_asc :0 ?>&limit=<?= $limit ?> " >< ? = $zmSlangName ?> <?php if ( $sort_field == "Name" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
< td class = " text " >< a href = " <?= $PHP_SELF ?>?view=<?= $view ?>&page=1<?= $filter_query ?>&sort_field=MonitorName&sort_asc=<?= $sort_field == 'MonitorName'?! $sort_asc :0 ?>&limit=<?= $limit ?> " >< ? = $zmSlangMonitor ?> <?php if ( $sort_field == "MonitorName" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
< td class = " text " >< a href = " <?= $PHP_SELF ?>?view=<?= $view ?>&page=1<?= $filter_query ?>&sort_field=Cause&sort_asc=<?= $sort_field == 'Cause'?! $sort_asc :0 ?>&limit=<?= $limit ?> " >< ? = $zmSlangCause ?> <?php if ( $sort_field == "Cause" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
< td class = " text " >< a href = " <?= $PHP_SELF ?>?view=<?= $view ?>&page=1<?= $filter_query ?>&sort_field=StartTime&sort_asc=<?= $sort_field == 'StartTime'?! $sort_asc :0 ?>&limit=<?= $limit ?> " >< ? = $zmSlangTime ?> <?php if ( $sort_field == "StartTime" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
< td class = " text " >< a href = " <?= $PHP_SELF ?>?view=<?= $view ?>&page=1<?= $filter_query ?>&sort_field=Length&sort_asc=<?= $sort_field == 'Length'?! $sort_asc :0 ?>&limit=<?= $limit ?> " >< ? = $zmSlangDuration ?> <?php if ( $sort_field == "Length" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
< td class = " text " >< a href = " <?= $PHP_SELF ?>?view=<?= $view ?>&page=1<?= $filter_query ?>&sort_field=Frames&sort_asc=<?= $sort_field == 'Frames'?! $sort_asc :0 ?>&limit=<?= $limit ?> " >< ? = $zmSlangFrames ?> <?php if ( $sort_field == "Frames" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
< td class = " text " >< a href = " <?= $PHP_SELF ?>?view=<?= $view ?>&page=1<?= $filter_query ?>&sort_field=AlarmFrames&sort_asc=<?= $sort_field == 'AlarmFrames'?! $sort_asc :0 ?>&limit=<?= $limit ?> " >< ? = $zmSlangAlarmBrFrames ?> <?php if ( $sort_field == "AlarmFrames" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
< td class = " text " >< a href = " <?= $PHP_SELF ?>?view=<?= $view ?>&page=1<?= $filter_query ?>&sort_field=TotScore&sort_asc=<?= $sort_field == 'TotScore'?! $sort_asc :0 ?>&limit=<?= $limit ?> " >< ? = $zmSlangTotalBrScore ?> <?php if ( $sort_field == "TotScore" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
< td class = " text " >< a href = " <?= $PHP_SELF ?>?view=<?= $view ?>&page=1<?= $filter_query ?>&sort_field=AvgScore&sort_asc=<?= $sort_field == 'AvgScore'?! $sort_asc :0 ?>&limit=<?= $limit ?> " >< ? = $zmSlangAvgBrScore ?> <?php if ( $sort_field == "AvgScore" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
< td class = " text " >< a href = " <?= $PHP_SELF ?>?view=<?= $view ?>&page=1<?= $filter_query ?>&sort_field=MaxScore&sort_asc=<?= $sort_field == 'MaxScore'?! $sort_asc :0 ?>&limit=<?= $limit ?> " >< ? = $zmSlangMaxBrScore ?> <?php if ( $sort_field == "MaxScore" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
2004-09-23 20:06:21 +08:00
< ? php
if ( ZM_WEB_LIST_THUMBS )
{
?>
< td class = " text " >< ? = $zmSlangThumbnail ?> </td>
< ? php
}
?>
2005-11-21 23:32:04 +08:00
< td class = " text " >< input type = " checkbox " name = " toggle_check " value = " 1 " onClick = " toggleCheck( this, 'mark_eids' ); " < ? php if ( ! canEdit ( 'Events' ) ) { ?> disabled<?php } ?>></td>
2003-07-11 17:27:56 +08:00
</ tr >
< ? php
2004-01-08 19:45:57 +08:00
}
if ( $event [ 'LearnState' ] == '+' )
$bgcolor = " #98FB98 " ;
elseif ( $event [ 'LearnState' ] == '-' )
$bgcolor = " #FFC0CB " ;
else
unset ( $bgcolor );
2005-10-20 00:52:28 +08:00
2006-01-18 01:07:13 +08:00
$scale = max ( reScale ( SCALE_BASE , $event [ 'DefaultScale' ], ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
2003-07-11 17:27:56 +08:00
?>
2004-01-08 18:09:35 +08:00
< tr < ? = ' bgcolor="' . ( isset ( $bgcolor ) ? $bgcolor : " #FFFFFF " ) . '"' ?> >
2005-10-20 00:52:28 +08:00
< td align = " center " class = " text " >< a href = " javascript: eventWindow( '<?= $PHP_SELF ?>?view=event&eid=<?= $event['Id'] ?><?= $filter_query ?><?= $sort_query ?>&page=1', 'zmEvent', <?= reScale( $event['Width'] , $scale )+ $jws['event'] ['w'] ?>, <?= reScale( $event['Height'] , $scale )+ $jws['event'] ['h'] ?> ); " >< ? = $event [ 'Id' ] ?> <?php if ( $event['Archived'] ) echo "*" ?></a></td>
< td align = " center " class = " text " >< a href = " javascript: eventWindow( '<?= $PHP_SELF ?>?view=event&eid=<?= $event['Id'] ?><?= $filter_query ?><?= $sort_query ?>&page=1', 'zmEvent', <?= reScale( $event['Width'] , $event['DefaultScale'] , ZM_WEB_DEFAULT_SCALE )+ $jws['event'] ['w'] ?>, <?= reScale( $event['Height'] , $event['DefaultScale'] , ZM_WEB_DEFAULT_SCALE )+ $jws['event'] ['h'] ?> ); " >< ? = $event [ 'Name' ] ?> <?php if ( $event['Archived'] ) echo "*" ?></a></td>
2004-02-16 03:42:00 +08:00
< td align = " center " class = " text " >< ? = $event [ 'MonitorName' ] ?> </td>
2005-05-16 20:03:28 +08:00
< td align = " center " class = " text " >< ? = makeLink ( " javascript: newWindow( ' $PHP_SELF ?view=eventdetail&eid= " . $event [ 'Id' ] . " ', 'zmEventDetail', " . $jws [ 'eventdetail' ][ 'w' ] . " , " . $jws [ 'eventdetail' ][ 'h' ] . " ); " , $event [ 'Cause' ], canEdit ( 'Events' ) ) ?> </td>
2006-03-28 06:01:33 +08:00
< td align = " center " class = " text " >< ? = strftime ( STRF_FMT_DATETIME_SHORTER , strtotime ( $event [ 'StartTime' ]) ) ?> </td>
2004-01-08 18:09:35 +08:00
< td align = " center " class = " text " >< ? = $event [ 'Length' ] ?> </td>
2004-02-16 03:42:00 +08:00
< td align = " center " class = " text " >< a href = " javascript: newWindow( '<?= $PHP_SELF ?>?view=frames&eid=<?= $event['Id'] ?>', 'zmFrames', <?= $jws['frames'] ['w'] ?>, <?= $jws['frames'] ['h'] ?> ); " >< ? = $event [ 'Frames' ] ?> </a></td>
< td align = " center " class = " text " >< a href = " javascript: newWindow( '<?= $PHP_SELF ?>?view=frames&eid=<?= $event['Id'] ?>', 'zmFrames', <?= $jws['frames'] ['w'] ?>, <?= $jws['frames'] ['h'] ?> ); " >< ? = $event [ 'AlarmFrames' ] ?> </a></td>
2004-01-08 18:09:35 +08:00
< td align = " center " class = " text " >< ? = $event [ 'TotScore' ] ?> </td>
< td align = " center " class = " text " >< ? = $event [ 'AvgScore' ] ?> </td>
2005-10-20 00:52:28 +08:00
< td align = " center " class = " text " >< a href = " javascript: newWindow( '<?= $PHP_SELF ?>?view=frame&eid=<?= $event['Id'] ?>&fid=0', 'zmImage', <?= reScale( $event['Width'] , $scale )+ $jws['image'] ['w'] ?>, <?= reScale( $event['Height'] , $scale )+ $jws['image'] ['h'] ?> ); " >< ? = $event [ 'MaxScore' ] ?> </a></td>
2004-09-23 20:06:21 +08:00
< ? php
if ( ZM_WEB_LIST_THUMBS )
{
$thumb_data = createListThumbnail ( $event );
?>
2005-10-20 00:52:28 +08:00
< td align = " center " class = " text " >< a href = " javascript: newWindow( '<?= $PHP_SELF ?>?view=frame&eid=<?= $event['Id'] ?>&fid=<?= $thumb_data['FrameId'] ?>', 'zmImage', <?= reScale( $event['Width'] , $scale )+ $jws['image'] ['w'] ?>, <?= reScale( $event['Height'] , $scale )+ $jws['image'] ['h'] ?> ); " >< img src = " <?= $thumb_data['Path'] ?> " width = " <?= $thumb_data['Width'] ?> " height = " <?= $thumb_data['Height'] ?> " border = " 0 " alt = " <?= $thumb_data['FrameId'] ?>/<?= $event['MaxScore'] ?> " ></ a ></ td >
2004-09-23 20:06:21 +08:00
< ? php
}
?>
2005-11-21 23:32:04 +08:00
< td align = " center " class = " text " >< input type = " checkbox " name = " mark_eids[] " value = " <?= $event['Id'] ?> " onClick = " configureButton( this, 'mark_eids' ); " < ? php if ( ! canEdit ( 'Events' ) ) { ?> disabled<?php } ?>></td>
2003-07-11 17:27:56 +08:00
</ tr >
< ? php
2004-01-08 19:45:57 +08:00
}
2003-07-11 17:27:56 +08:00
?>
</ table ></ td ></ tr >
</ table ></ td >
</ tr >
2005-05-16 23:16:36 +08:00
< ? php if ( true || canEdit ( 'Events' ) ) { ?>
< tr >< td align = " right " >
< ? php if ( LEARN_MODE ) { ?> <select name="learn_state" class="form" disabled><option value=""><?= $zmSlangIgnore ?></option><option value="-"><?= $zmSlangExclude ?></option><option value="+"><?= $zmSlangInclude ?></option></select> <input type="button" name="learn_btn" value="<?= $zmSlangSetLearnPrefs ?>" class="form" onClick="document.event_form.action.value = 'learn'; document.event_form.submit();" disabled> <?php } ?>
< input type = " button " name = " view_btn " value = " <?= $zmSlangView ?> " class = " form " onClick = " viewEvents( document.event_form, 'mark_eids' ); " disabled >
& nbsp ; & nbsp ; < input type = " button " name = " archive_btn " value = " <?= $zmSlangArchive ?> " class = " form " onClick = " document.event_form.action.value = 'archive'; document.event_form.submit(); " disabled >
& nbsp ; & nbsp ; < input type = " button " name = " unarchive_btn " value = " <?= $zmSlangUnarchive ?> " class = " form " onClick = " document.event_form.action.value = 'unarchive'; document.event_form.submit(); " disabled >
& nbsp ; & nbsp ; < input type = " button " name = " edit_btn " value = " <?= $zmSlangEdit ?> " class = " form " onClick = " editEvents( document.event_form, 'mark_eids' ) " disabled >
2005-05-18 05:51:39 +08:00
& nbsp ; & nbsp ; < input type = " button " name = " export_btn " value = " <?= $zmSlangExport ?> " class = " form " onClick = " exportEvents( document.event_form, 'mark_eids' ) " disabled >
2006-04-01 00:02:27 +08:00
& nbsp ; & nbsp ; < input type = " button " name = " delete_btn " value = " <?= $zmSlangDelete ?> " class = " form " onClick = " deleteEvents( document.event_form, 'mark_eids' ); " disabled >
2005-05-16 23:16:36 +08:00
</ td ></ tr >
< ? php } ?>
2003-07-11 17:27:56 +08:00
</ table ></ center >
</ form >
2006-05-24 21:42:41 +08:00
< script type = " text/javascript " >
window . setTimeout ( " window.focus() " , 500 );
</ script >
2003-07-11 17:27:56 +08:00
</ body >
</ html >
2003-09-23 17:52:45 +08:00
< ? php
2004-01-08 19:45:57 +08:00
}
2003-09-23 17:52:45 +08:00
?>