diff --git a/web/skins/bootstrap/css/skin.css b/web/skins/bootstrap/css/skin.css index f351ae2bd..7bfb80c68 100644 --- a/web/skins/bootstrap/css/skin.css +++ b/web/skins/bootstrap/css/skin.css @@ -415,3 +415,24 @@ th.table-th-sort-rev span.table-th-sort-span { height: 240px; margin: 5px; } + +.event { + float: left; + width: 184px; + margin: 5px; +} + +.over { + position: relative; +} + +.info { + background: none repeat scroll 0% 0% rgba(0, 0, 0, 0.7); + color: #FFF; + position: absolute; + padding:0 1px; + bottom: 5px; + font-size: 12px; + width: 174px; + left: 5px; +} diff --git a/web/skins/bootstrap/js/app.js b/web/skins/bootstrap/js/app.js index 9d625990a..050cdd23b 100644 --- a/web/skins/bootstrap/js/app.js +++ b/web/skins/bootstrap/js/app.js @@ -62,6 +62,14 @@ ZoneMinder.factory('Footer', function($http) { }; }); +ZoneMinder.factory('Events', function($http) { + return { + getEvents: function() { + return $http.get('/api/events.json'); + } + }; +}); + ZoneMinder.factory('Event', function($http) { return { getEvent: function(eventId) { diff --git a/web/skins/bootstrap/js/controllers.js b/web/skins/bootstrap/js/controllers.js index e52170fae..5ce073277 100644 --- a/web/skins/bootstrap/js/controllers.js +++ b/web/skins/bootstrap/js/controllers.js @@ -23,6 +23,14 @@ ZoneMinder.controller('LogController', function($scope, Log) { }); }); +ZoneMinder.controller('EventsController', function($scope, Events) { + + Events.getEvents().then(function(results) { + $scope.events = results.data.events; + }); + +}); + ZoneMinder.controller('EventController', function($scope, $location, Event) { var eventId = $location.search().eid; diff --git a/web/skins/bootstrap/views/events.php b/web/skins/bootstrap/views/events.php index fc6a26fa5..3bb21bc5b 100644 --- a/web/skins/bootstrap/views/events.php +++ b/web/skins/bootstrap/views/events.php @@ -1,236 +1,39 @@ - -if ( !canView( 'Events' ) || (!empty($_REQUEST['execute']) && !canEdit('Events')) ) -{ - $view = "error"; - return; -} - -if ( !empty($_REQUEST['execute']) ) -{ - executeFilter( $tempFilterName ); -} - -$countSql = 'SELECT count(E.Id) AS EventCount FROM Monitors AS M INNER JOIN Events AS E ON (M.Id = E.MonitorId) WHERE'; -$eventsSql = 'SELECT E.Id,E.MonitorId,M.Name AS MonitorName,M.DefaultScale,E.Name,E.Width,E.Height,E.Cause,E.Notes,E.StartTime,E.Length,E.Frames,E.AlarmFrames,E.TotScore,E.AvgScore,E.MaxScore,E.Archived FROM Monitors AS M INNER JOIN Events AS E on (M.Id = E.MonitorId) WHERE'; -if ( $user['MonitorIds'] ) { - $user_monitor_ids = " M.Id in (".join( ",", preg_split( '/["\'\s]*,["\'\s]*/', $user['MonitorIds'] ) ).")"; - $countSql .= $user_monitor_ids; - $eventsSql .= $user_monitor_ids; -} else { - $countSql .= " 1"; - $eventsSql .= " 1"; -} - -parseSort(); -parseFilter( $_REQUEST['filter'] ); -$filterQuery = $_REQUEST['filter']['query']; - -if ( $_REQUEST['filter']['sql'] ) -{ - $countSql .= $_REQUEST['filter']['sql']; - $eventsSql .= $_REQUEST['filter']['sql']; -} -$eventsSql .= " ORDER BY $sortColumn $sortOrder"; - -if ( isset($_REQUEST['page']) ) - $page = validInt($_REQUEST['page']); -else - $page = 0; -if ( isset($_REQUEST['limit']) ) - $limit = validInt($_REQUEST['limit']); -else - $limit = 0; - -$nEvents = dbFetchOne( $countSql, 'EventCount' ); -if ( !empty($limit) && $nEvents > $limit ) -{ - $nEvents = $limit; -} -$pages = (int)ceil($nEvents/ZM_WEB_EVENTS_PER_PAGE); -if ( $pages > 1 ) { - if ( !empty($page) ) { - if ( $page < 0 ) - $page = 1; - if ( $page > $pages ) - $page = $pages; - } -} -if ( !empty($page) ) { - $limitStart = (($page-1)*ZM_WEB_EVENTS_PER_PAGE); - if ( empty( $limit ) ) - { - $limitAmount = ZM_WEB_EVENTS_PER_PAGE; - } - else - { - $limitLeft = $limit - $limitStart; - $limitAmount = ($limitLeft>ZM_WEB_EVENTS_PER_PAGE)?ZM_WEB_EVENTS_PER_PAGE:$limitLeft; - } - $eventsSql .= " limit $limitStart, $limitAmount"; -} elseif ( !empty( $limit ) ) { - $eventsSql .= " limit 0, ".$limit; -} - -$maxWidth = 0; -$maxHeight = 0; -$archived = false; -$unarchived = false; -$events = array(); -foreach ( dbFetchAll( $eventsSql ) as $event ) -{ - $events[] = $event; - $scale = max( reScale( SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE ), SCALE_BASE ); - $eventWidth = reScale( $event['Width'], $scale ); - $eventHeight = reScale( $event['Height'], $scale ); - if ( $maxWidth < $eventWidth ) $maxWidth = $eventWidth; - if ( $maxHeight < $eventHeight ) $maxHeight = $eventHeight; - if ( $event['Archived'] ) - $archived = true; - else - $unarchived = true; -} - -$maxShortcuts = 5; -$pagination = getPagination( $pages, $page, $maxShortcuts, $filterQuery.$sortQuery.'&limit='.$limit ); - -$focusWindow = true; - -xhtmlHeaders(__FILE__, $SLANG['Events'] ); - -?>
-