diff --git a/db/zm_create.sql.in b/db/zm_create.sql.in index f509c070f..e2f661bfd 100644 --- a/db/zm_create.sql.in +++ b/db/zm_create.sql.in @@ -766,7 +766,8 @@ CREATE TABLE Maps ( CREATE TABLE MontageLayouts ( `Id` int(10) unsigned NOT NULL auto_increment, `Name` TEXT NOT NULL, - `Positions` JSON, + `Positions` LONGTEXT, + /*`Positions` JSON,*/ PRIMARY KEY (`Id`) ); diff --git a/db/zm_update-1.31.12.sql b/db/zm_update-1.31.12.sql index 733541c85..f20ccff2e 100644 --- a/db/zm_update-1.31.12.sql +++ b/db/zm_update-1.31.12.sql @@ -13,7 +13,7 @@ SET @s = (SELECT IF( CREATE TABLE MontageLayouts ( `Id` int(10) unsigned NOT NULL auto_increment, `Name` TEXT NOT NULL, - `Positions` JSON, + `Positions` LONGTEXT, PRIMARY KEY (`Id`) ); " diff --git a/web/skins/classic/views/_monitor_filters.php b/web/skins/classic/views/_monitor_filters.php index e1063b484..231e4bdce 100644 --- a/web/skins/classic/views/_monitor_filters.php +++ b/web/skins/classic/views/_monitor_filters.php @@ -76,6 +76,12 @@ $groupSql = Group::get_group_sql( $group_id ); $conditions[] = 'StorageId=?'; $values[] = $_SESSION['StorageFilter']; } + if ( ! empty( $user['MonitorIds'] ) ) { + $ids = explode(',', $user['MonitorIds'] ); + $conditions[] = 'Id IN ('.implode(',',array_map( function(){return '?';}, $ids) ).')'; + $values += $ids; + } + $sql = 'SELECT * FROM Monitors' . ( count($conditions) ? ' WHERE ' . implode(' AND ', $conditions ) : '' ).' ORDER BY Sequence ASC'; $monitors = dbFetchAll( $sql, null, $values ); $displayMonitors = array(); diff --git a/web/skins/classic/views/js/montage.js b/web/skins/classic/views/js/montage.js index e5801a2d2..1d8f867be 100644 --- a/web/skins/classic/views/js/montage.js +++ b/web/skins/classic/views/js/montage.js @@ -293,10 +293,10 @@ function edit_layout(button) { continue; } var position = getOffset( monitor_frame ); - monitor_frame.css('float','none'); - monitor_frame.css('position','absolute'); monitor_frame.css('top', position.top+'px' ); monitor_frame.css('left', position.left+'px' ); + monitor_frame.css('float','none'); + monitor_frame.css('position','absolute'); } // end foreach monitor $j('#monitors .monitorFrame').draggable({ diff --git a/web/skins/classic/views/montagereview.php b/web/skins/classic/views/montagereview.php index 2aeac465a..69a5c2921 100644 --- a/web/skins/classic/views/montagereview.php +++ b/web/skins/classic/views/montagereview.php @@ -55,62 +55,10 @@ if ( !canView( 'Events' ) ) { } ob_start(); -# This will end up with the group_id of the deepest selection -$group_id = Group::get_group_dropdowns(); -$group_dropdowns = ob_get_contents(); +include('_monitor_filters.php'); +$filter_bar = ob_get_contents(); ob_end_clean(); -$groupSql = Group::get_group_sql( $group_id ); - -$servers = Server::find_all(); -$ServersById = array(); -foreach ( $servers as $S ) { - $ServersById[$S->Id()] = $S; -} -$storage_areas = Storage::find_all(); -$StorageById = array(); -foreach ( $storage_areas as $S ) { - $StorageById[$S->Id()] = $S; -} -session_start(); -foreach ( array('minTime','maxTime','ServerFilter','StorageFilter') as $var ) { - if ( isset( $_REQUEST[$var] ) ) { - if ( $_REQUEST[$var] != '' ) { - $_SESSION[$var] = $_REQUEST[$var]; - } else { - unset( $_SESSION[$var] ); - } - } else if ( isset( $_COOKIE[$var] ) ) { - if ( $_COOKIE[$var] != '' ) { - $_SESSION[$var] = $_COOKIE[$var]; - } else { - unset($_SESSION[$var]); - } - } -} -session_write_close(); - -$monitor_id = 0; -if ( isset( $_REQUEST['monitor_id'] ) ) { - $monitor_id = $_REQUEST['monitor_id']; -} else if ( isset($_COOKIE['zmMonitorId']) ) { - $monitor_id = $_COOKIE['zmMonitorId']; -} - - $conditions = array(); - $values = array(); - - if ( $groupSql ) - $conditions[] = $groupSql; - if ( isset($_SESSION['ServerFilter']) ) { - $conditions[] = 'ServerId=?'; - $values[] = $_SESSION['ServerFilter']; - } - if ( isset($_SESSION['StorageFilter']) ) { - $conditions[] = 'StorageId=?'; - $values[] = $_SESSION['StorageFilter']; - } - // Note that this finds incomplete events as well, and any frame records written, but still cannot "see" to the end frame // if the bulk record has not been written - to be able to include more current frames reduce bulk frame sizes (event size can be large) // Note we round up just a bit on the end time as otherwise you get gaps, like 59.78 to 00 in the next second, which can give blank frames when moved through slowly. @@ -141,18 +89,12 @@ $frameSql = ' // This program only calls itself with the time range involved -- it does all monitors (the user can see, in the called group) all the time if ( ! empty( $user['MonitorIds'] ) ) { - $eventsSql .= ' AND M.Id IN ('.$user['MonitorIds'].')'; - $monitorsSql .= ' AND Id IN ('.$user['MonitorIds'].')'; - $monitor_ids = explode(',',$user['MonitorIds']); - $conditions[] .= 'Id IN ('.array_map( function(){return '?';}, $monitor_ids ) . ')'; - array_push( $values, $monitor_ids ); - $frameSql .= ' AND E.MonitorId IN ('.$user['MonitorIds'].')'; + $eventsSql .= ' AND M.Id IN ('.$user['MonitorIds'].')'; + $frameSql .= ' AND E.MonitorId IN ('.$user['MonitorIds'].')'; } if ( $monitor_id ) { - $conditions[] = 'Id=?'; - $values[] = $monitor_id; $eventsSql .= ' AND M.Id='.$monitor_id; - $frameSql .= ' AND E.MonitorId='.$monitor_id; + $frameSql .= ' AND E.MonitorId='.$monitor_id; } // Parse input parameters -- note for future, validate/clean up better in case we don't get called from self. @@ -160,7 +102,6 @@ if ( $monitor_id ) { // The default (nothing at all specified) is for 1 hour so we do not read the whole database - if ( !isset($_REQUEST['minTime']) && !isset($_REQUEST['maxTime']) ) { $time = time(); $maxTime = strftime("%FT%T",$time); @@ -180,7 +121,7 @@ if ( (strtotime($maxTime) - strtotime($minTime))/(365*24*3600) > 30 ) { $maxTime = null; } -$fitMode=1; +$fitMode = 1; if (isset($_REQUEST['fit']) && $_REQUEST['fit']=='0' ) $fitMode = 0; @@ -196,7 +137,7 @@ if ( isset($_REQUEST['speed']) ) else $defaultSpeed = 1; -$speedIndex=5; // default to 1x +$speedIndex = 5; // default to 1x for ( $i = 0; $i < count($speeds); $i++ ) { if ( $speeds[$i] == $defaultSpeed ) { $speedIndex = $i; @@ -225,10 +166,10 @@ if ( isset($minTime) && isset($maxTime) ) { } $frameSql .= ' GROUP BY E.Id, E.MonitorId, F.TimeStamp, F.Delta ORDER BY E.MonitorId, F.TimeStamp ASC'; - $monitors = array(); -$monitorsSql = 'SELECT * FROM Monitors' . ( count($conditions) ? ' WHERE ' . implode(' AND ', $conditions ) : '' ).' ORDER BY Sequence ASC'; -foreach( dbFetchAll( $monitorsSql, null, $values ) as $row ) { +foreach( $displayMonitors as &$row ) { + if ( $row['Function'] == 'None' ) + continue; $Monitor = new Monitor( $row ); $monitors[] = $Monitor; } @@ -243,32 +184,7 @@ xhtmlHeaders(__FILE__, translate('MontageReview') );