Switch to LONGTEXT FROM JSON type
This commit is contained in:
parent
25210b7ecf
commit
36e13039c7
|
@ -766,7 +766,8 @@ CREATE TABLE Maps (
|
||||||
CREATE TABLE MontageLayouts (
|
CREATE TABLE MontageLayouts (
|
||||||
`Id` int(10) unsigned NOT NULL auto_increment,
|
`Id` int(10) unsigned NOT NULL auto_increment,
|
||||||
`Name` TEXT NOT NULL,
|
`Name` TEXT NOT NULL,
|
||||||
`Positions` JSON,
|
`Positions` LONGTEXT,
|
||||||
|
/*`Positions` JSON,*/
|
||||||
PRIMARY KEY (`Id`)
|
PRIMARY KEY (`Id`)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ SET @s = (SELECT IF(
|
||||||
CREATE TABLE MontageLayouts (
|
CREATE TABLE MontageLayouts (
|
||||||
`Id` int(10) unsigned NOT NULL auto_increment,
|
`Id` int(10) unsigned NOT NULL auto_increment,
|
||||||
`Name` TEXT NOT NULL,
|
`Name` TEXT NOT NULL,
|
||||||
`Positions` JSON,
|
`Positions` LONGTEXT,
|
||||||
PRIMARY KEY (`Id`)
|
PRIMARY KEY (`Id`)
|
||||||
);
|
);
|
||||||
"
|
"
|
||||||
|
|
|
@ -76,6 +76,12 @@ $groupSql = Group::get_group_sql( $group_id );
|
||||||
$conditions[] = 'StorageId=?';
|
$conditions[] = 'StorageId=?';
|
||||||
$values[] = $_SESSION['StorageFilter'];
|
$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';
|
$sql = 'SELECT * FROM Monitors' . ( count($conditions) ? ' WHERE ' . implode(' AND ', $conditions ) : '' ).' ORDER BY Sequence ASC';
|
||||||
$monitors = dbFetchAll( $sql, null, $values );
|
$monitors = dbFetchAll( $sql, null, $values );
|
||||||
$displayMonitors = array();
|
$displayMonitors = array();
|
||||||
|
|
|
@ -293,10 +293,10 @@ function edit_layout(button) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
var position = getOffset( monitor_frame );
|
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('top', position.top+'px' );
|
||||||
monitor_frame.css('left', position.left+'px' );
|
monitor_frame.css('left', position.left+'px' );
|
||||||
|
monitor_frame.css('float','none');
|
||||||
|
monitor_frame.css('position','absolute');
|
||||||
} // end foreach monitor
|
} // end foreach monitor
|
||||||
|
|
||||||
$j('#monitors .monitorFrame').draggable({
|
$j('#monitors .monitorFrame').draggable({
|
||||||
|
|
|
@ -55,62 +55,10 @@ if ( !canView( 'Events' ) ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
# This will end up with the group_id of the deepest selection
|
include('_monitor_filters.php');
|
||||||
$group_id = Group::get_group_dropdowns();
|
$filter_bar = ob_get_contents();
|
||||||
$group_dropdowns = ob_get_contents();
|
|
||||||
ob_end_clean();
|
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
|
// 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)
|
// 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.
|
// 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
|
// 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'] ) ) {
|
if ( ! empty( $user['MonitorIds'] ) ) {
|
||||||
$eventsSql .= ' AND M.Id IN ('.$user['MonitorIds'].')';
|
$eventsSql .= ' AND M.Id IN ('.$user['MonitorIds'].')';
|
||||||
$monitorsSql .= ' AND Id IN ('.$user['MonitorIds'].')';
|
$frameSql .= ' AND E.MonitorId 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'].')';
|
|
||||||
}
|
}
|
||||||
if ( $monitor_id ) {
|
if ( $monitor_id ) {
|
||||||
$conditions[] = 'Id=?';
|
|
||||||
$values[] = $monitor_id;
|
|
||||||
$eventsSql .= ' AND M.Id='.$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.
|
// 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
|
// 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']) ) {
|
if ( !isset($_REQUEST['minTime']) && !isset($_REQUEST['maxTime']) ) {
|
||||||
$time = time();
|
$time = time();
|
||||||
$maxTime = strftime("%FT%T",$time);
|
$maxTime = strftime("%FT%T",$time);
|
||||||
|
@ -180,7 +121,7 @@ if ( (strtotime($maxTime) - strtotime($minTime))/(365*24*3600) > 30 ) {
|
||||||
$maxTime = null;
|
$maxTime = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fitMode=1;
|
$fitMode = 1;
|
||||||
if (isset($_REQUEST['fit']) && $_REQUEST['fit']=='0' )
|
if (isset($_REQUEST['fit']) && $_REQUEST['fit']=='0' )
|
||||||
$fitMode = 0;
|
$fitMode = 0;
|
||||||
|
|
||||||
|
@ -196,7 +137,7 @@ if ( isset($_REQUEST['speed']) )
|
||||||
else
|
else
|
||||||
$defaultSpeed = 1;
|
$defaultSpeed = 1;
|
||||||
|
|
||||||
$speedIndex=5; // default to 1x
|
$speedIndex = 5; // default to 1x
|
||||||
for ( $i = 0; $i < count($speeds); $i++ ) {
|
for ( $i = 0; $i < count($speeds); $i++ ) {
|
||||||
if ( $speeds[$i] == $defaultSpeed ) {
|
if ( $speeds[$i] == $defaultSpeed ) {
|
||||||
$speedIndex = $i;
|
$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';
|
$frameSql .= ' GROUP BY E.Id, E.MonitorId, F.TimeStamp, F.Delta ORDER BY E.MonitorId, F.TimeStamp ASC';
|
||||||
|
|
||||||
|
|
||||||
$monitors = array();
|
$monitors = array();
|
||||||
$monitorsSql = 'SELECT * FROM Monitors' . ( count($conditions) ? ' WHERE ' . implode(' AND ', $conditions ) : '' ).' ORDER BY Sequence ASC';
|
foreach( $displayMonitors as &$row ) {
|
||||||
foreach( dbFetchAll( $monitorsSql, null, $values ) as $row ) {
|
if ( $row['Function'] == 'None' )
|
||||||
|
continue;
|
||||||
$Monitor = new Monitor( $row );
|
$Monitor = new Monitor( $row );
|
||||||
$monitors[] = $Monitor;
|
$monitors[] = $Monitor;
|
||||||
}
|
}
|
||||||
|
@ -243,32 +184,7 @@ xhtmlHeaders(__FILE__, translate('MontageReview') );
|
||||||
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="get">
|
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="get">
|
||||||
<input type="hidden" name="view" value="montagereview"/>
|
<input type="hidden" name="view" value="montagereview"/>
|
||||||
<div id="header">
|
<div id="header">
|
||||||
<div id="headerControl">
|
<?php echo $filter_bar ?>
|
||||||
<span id="groupControl"><label><?php echo translate('Group') ?>:</label>
|
|
||||||
<?php echo $group_dropdowns; ?>
|
|
||||||
</span>
|
|
||||||
<span id="monitorControl"><label><?php echo translate('Monitor') ?>:</label>
|
|
||||||
<?php Group::get_monitors_dropdown( $groupSql ? array( 'groupSql'=>$groupSql) : null ); ?>
|
|
||||||
</span>
|
|
||||||
<?php
|
|
||||||
if ( count($ServersById) > 0 ) { ?>
|
|
||||||
<span class="ServerFilter"><label><?php echo translate('Server')?>:</label>
|
|
||||||
<?php
|
|
||||||
echo htmlSelect( 'ServerFilter', array(''=>'All')+$ServersById, (isset($_SESSION['ServerFilter'])?$_SESSION['ServerFilter']:''), array('onchange'=>'changeFilter(this);') );
|
|
||||||
?>
|
|
||||||
</span>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
if ( count($StorageById) > 0 ) { ?>
|
|
||||||
<span class="StorageFilter"><label><?php echo translate('Storage')?>:</label>
|
|
||||||
<?php
|
|
||||||
echo htmlSelect( 'StorageFilter', array(''=>'All')+$StorageById, (isset($_SESSION['StorageFilter'])?$_SESSION['StorageFilter']:''), array('onchange'=>'changeFilter(this);') );
|
|
||||||
?>
|
|
||||||
</span>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div id="DateTimeDiv">
|
<div id="DateTimeDiv">
|
||||||
<input type="datetime-local" name="minTime" id="minTime" value="<?php echo preg_replace('/ /', 'T', $minTime ) ?>" onchange="changeDateTime(this);"> to
|
<input type="datetime-local" name="minTime" id="minTime" value="<?php echo preg_replace('/ /', 'T', $minTime ) ?>" onchange="changeDateTime(this);"> to
|
||||||
<input type="datetime-local" name="maxTime" id="maxTime" value="<?php echo preg_replace('/ /', 'T', $maxTime ) ?>" onchange="changeDateTime(this);">
|
<input type="datetime-local" name="maxTime" id="maxTime" value="<?php echo preg_replace('/ /', 'T', $maxTime ) ?>" onchange="changeDateTime(this);">
|
||||||
|
|
Loading…
Reference in New Issue