Merge branch 'storageareas' of github.com:connortechnology/ZoneMinder into storageareas
commit
33771f92e9
|
@ -776,6 +776,8 @@ INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES ('3 Wide', '{ "default":{
|
|||
INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES ('4 Wide', '{ "default":{"float":"left", "width":"24.5%"} }' );
|
||||
INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES ('5 Wide', '{ "default":{"float":"left", "width":"19%"} }' );
|
||||
|
||||
INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES ('Fixed', '{ "default":{"float":"none", "position":"absolute"} }' );
|
||||
|
||||
--
|
||||
-- Apply the initial configuration
|
||||
--
|
||||
|
|
|
@ -25,15 +25,15 @@ EXECUTE stmt;
|
|||
SET @s = ( SELECT IF(
|
||||
(SELECT COUNT(*) FROM MontageLayouts WHERE Name='Freeform') > 0,
|
||||
"SELECT 'Freeform already in layouts'",
|
||||
"INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES ('Freeform', '{ "default":{"float":"left"} }' );"
|
||||
'INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES (\'Freeform\', \'{"default":{"float":"left","position":"relative"}}\');'
|
||||
) );
|
||||
PREPARE stmt FROM @s;
|
||||
EXECUTE stmt;
|
||||
|
||||
SET @s = ( SELECT IF(
|
||||
(SELECT COUNT(*) FROM MontageLayouts WHERE Name='2 Wide') > 0,
|
||||
"SELECT '2 Wide already in layouts'",
|
||||
"INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES ('2 Wide', '{ "default":{"float":"left", "width":"49%"} }' );";
|
||||
"SELECT '2 Wide already in layouts'",
|
||||
'INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES (\'2 Wide\', \'{"default":{"float":"left","position":"relative","width":"49%"}}\');'
|
||||
) );
|
||||
PREPARE stmt FROM @s;
|
||||
EXECUTE stmt;
|
||||
|
@ -41,7 +41,7 @@ EXECUTE stmt;
|
|||
SET @s = ( SELECT IF(
|
||||
(SELECT COUNT(*) FROM MontageLayouts WHERE Name='3 Wide') > 0,
|
||||
"SELECT '3 Wide already in layouts'",
|
||||
"INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES ('3 Wide', '{ "default":{"float":"left", "width":"33%"} }' );"
|
||||
'INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES (\'3 Wide\', \'{"default":{"float":"left","position":"relative","width":"33%"}}\');'
|
||||
) );
|
||||
PREPARE stmt FROM @s;
|
||||
EXECUTE stmt;
|
||||
|
@ -49,15 +49,16 @@ EXECUTE stmt;
|
|||
SET @s = ( SELECT IF(
|
||||
(SELECT COUNT(*) FROM MontageLayouts WHERE Name='4 Wide') > 0,
|
||||
"SELECT '4 Wide already in layouts'",
|
||||
"INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES ('4 Wide', '{ "default":{"float":"left", "width":"24.5%"} }' );"
|
||||
'INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES (\'4 Wide\', \'{"default":{"float":"left","position":"relative","width":"24.5%"}}\');'
|
||||
) );
|
||||
|
||||
PREPARE stmt FROM @s;
|
||||
EXECUTE stmt;
|
||||
|
||||
SET @s = ( SELECT IF(
|
||||
(SELECT COUNT(*) FROM MontageLayouts WHERE Name='5 Wide') > 0,
|
||||
"SELECT '5 Wide already in layouts'",
|
||||
"INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES ('5 Wide', '{ "default":{"float":"left", "width":"19%"} }' );"
|
||||
'INSERT INTO MontageLayouts (`Name`,`Positions`) VALUES (\'5 Wide\', \'{"default":{"float":"left","position":"relative","width":"19%"}}\' );'
|
||||
) );
|
||||
|
||||
PREPARE stmt FROM @s;
|
||||
|
|
|
@ -111,10 +111,17 @@ class MontageLayout {
|
|||
$this->{$k} = $v;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'UPDATE MontageLayouts SET '.implode(', ', array_map( function($field) {return $field.'=?';}, array_keys( $this->defaults ) ) ) . ' WHERE Id=?';
|
||||
$values = array_map( function($field){return $this->{$field};}, $this->fields );
|
||||
$values[] = $this->{'Id'};
|
||||
|
||||
$fields = array_values( array_filter( array_keys($this->defaults), function($field){return $field != 'Id';} ) );
|
||||
$values = null;
|
||||
if ( isset($this->{'Id'}) ) {
|
||||
$sql = 'UPDATE MontageLayouts SET '.implode(', ', array_map( function($field) {return $field.'=?';}, $fields ) ) . ' WHERE Id=?';
|
||||
$values = array_map( function($field){return $this->{$field};}, $fields );
|
||||
$values[] = $this->{'Id'};
|
||||
} else {
|
||||
$sql = 'INSERT INTO MontageLayouts ('.implode( ',', $fields ).') VALUES ('.implode(',',array_map( function(){return '?';}, $fields ) ).')';
|
||||
$values = array_map( function($field){return $this->{$field};}, $fields );
|
||||
}
|
||||
dbQuery( $sql, $values );
|
||||
} // end function save
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -122,15 +122,24 @@ function dbQuery( $sql, $params=NULL ) {
|
|||
$result = NULL;
|
||||
try {
|
||||
if ( isset($params) ) {
|
||||
$result = $dbConn->prepare( $sql );
|
||||
$result->execute( $params );
|
||||
if ( ! $result = $dbConn->prepare( $sql ) ) {
|
||||
Error("SQL: Error preparing $sql: " . $pdo->errorInfo);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ( ! $result->execute( $params ) ) {
|
||||
Error("SQL: Error executing $sql: " . implode(',', $result->errorInfo() ) );
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
$result = $dbConn->query( $sql );
|
||||
}
|
||||
if ( 0 ) {
|
||||
if ( $params )
|
||||
Warning("SQL: $sql" . implode(',',$params));
|
||||
Warning("SQL: $sql" . implode(',',$params) . ' rows: '.$result->rowCount() );
|
||||
else
|
||||
Warning("SQL: $sql" );
|
||||
Warning("SQL: $sql: rows:" . $result->rowCount() );
|
||||
}
|
||||
} catch(PDOException $e) {
|
||||
Error( "SQL-ERR '".$e->getMessage()."', statement was '".$sql."' params:" . implode(',',$params) );
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -113,7 +113,7 @@ if ( !file_exists( ZM_SKIN_PATH ) )
|
|||
$skinBase[] = $skin;
|
||||
|
||||
$currentCookieParams = session_get_cookie_params();
|
||||
Logger::Debug('Setting cookie parameters to lifetime('.$currentCookieParams['lifetime'].') path('.$currentCookieParams['path'].') domain ('.$currentCookieParams['domain'].') secure('.$currentCookieParams['secure'].') httpOnly(1)');
|
||||
//Logger::Debug('Setting cookie parameters to lifetime('.$currentCookieParams['lifetime'].') path('.$currentCookieParams['path'].') domain ('.$currentCookieParams['domain'].') secure('.$currentCookieParams['secure'].') httpOnly(1)');
|
||||
session_set_cookie_params(
|
||||
$currentCookieParams['lifetime'],
|
||||
$currentCookieParams['path'],
|
||||
|
@ -175,9 +175,7 @@ foreach ( getSkinIncludes( 'skin.php' ) as $includeFile )
|
|||
|
||||
if ( ZM_OPT_USE_AUTH && ZM_AUTH_HASH_LOGINS ) {
|
||||
if ( empty($user) && ! empty($_REQUEST['auth']) ) {
|
||||
Logger::Debug("Getting user from auth hash");
|
||||
if ( $authUser = getAuthUser( $_REQUEST['auth'] ) ) {
|
||||
Logger::Debug("Success Getting user from auth hash");
|
||||
userLogin( $authUser['Username'], $authUser['Password'], true );
|
||||
}
|
||||
} else if ( ! empty($user) ) {
|
||||
|
|
|
@ -302,6 +302,7 @@ $SLANG = array(
|
|||
'DuplicateMonitorName' => 'Duplicate Monitor Name',
|
||||
'Duration' => 'Duration',
|
||||
'Edit' => 'Edit',
|
||||
'EditLayout' => 'Edit Layout',
|
||||
'Email' => 'Email',
|
||||
'EnableAlarms' => 'Enable Alarms',
|
||||
'Enabled' => 'Enabled',
|
||||
|
|
|
@ -0,0 +1,144 @@
|
|||
<?php
|
||||
//
|
||||
// ZoneMinder web console file, $Date$, $Revision$
|
||||
// Copyright (C) 2001-2008 Philip Coombes
|
||||
//
|
||||
// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
//
|
||||
|
||||
$servers = Server::find_all();
|
||||
$ServersById = array();
|
||||
foreach ( $servers as $S ) {
|
||||
$ServersById[$S->Id()] = $S;
|
||||
}
|
||||
session_start();
|
||||
foreach ( array('ServerFilter','StorageFilter','StatusFilter','MonitorId') 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();
|
||||
|
||||
$storage_areas = Storage::find_all();
|
||||
$StorageById = array();
|
||||
foreach ( $storage_areas as $S ) {
|
||||
$StorageById[$S->Id()] = $S;
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="controlHeader">
|
||||
<span id="groupControl"><label><?php echo translate('Group') ?>:</label>
|
||||
<?php
|
||||
# This will end up with the group_id of the deepest selection
|
||||
$group_id = Group::get_group_dropdowns();
|
||||
$groupSql = Group::get_group_sql( $group_id );
|
||||
?>
|
||||
</span>
|
||||
<span id="monitorControl"><label><?php echo translate('Monitor') ?>:</label>
|
||||
<?php
|
||||
|
||||
$monitor_id = isset($_SESSION['MonitorId']) ? $_SESSION['MonitorId'] : 0;
|
||||
|
||||
# Used to determine if the Cycle button should be made available
|
||||
|
||||
$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'];
|
||||
}
|
||||
$sql = 'SELECT * FROM Monitors' . ( count($conditions) ? ' WHERE ' . implode(' AND ', $conditions ) : '' ).' ORDER BY Sequence ASC';
|
||||
$monitors = dbFetchAll( $sql, null, $values );
|
||||
$displayMonitors = array();
|
||||
$monitors_dropdown = array(''=>'All');
|
||||
|
||||
if ( $monitor_id ) {
|
||||
$found_selected_monitor = false;
|
||||
|
||||
for ( $i = 0; $i < count($monitors); $i++ ) {
|
||||
if ( !visibleMonitor( $monitors[$i]['Id'] ) ) {
|
||||
continue;
|
||||
}
|
||||
$monitors_dropdown[$monitors[$i]['Id']] = $monitors[$i]['Name'];
|
||||
if ( $monitors[$i]['Id'] == $monitor_id ) {
|
||||
$found_selected_monitor = true;
|
||||
}
|
||||
}
|
||||
if ( ! $found_selected_monitor ) {
|
||||
$monitor_id = '';
|
||||
}
|
||||
}
|
||||
for ( $i = 0; $i < count($monitors); $i++ ) {
|
||||
if ( !visibleMonitor( $monitors[$i]['Id'] ) ) {
|
||||
continue;
|
||||
}
|
||||
$monitors_dropdown[$monitors[$i]['Id']] = $monitors[$i]['Name'];
|
||||
|
||||
if ( $monitor_id and ( $monitors[$i]['Id'] != $monitor_id ) ) {
|
||||
continue;
|
||||
}
|
||||
$displayMonitors[] = $monitors[$i];
|
||||
}
|
||||
echo htmlSelect( 'MonitorId', $monitors_dropdown, $monitor_id, array('onchange'=>'changeMonitor(this);') );
|
||||
?>
|
||||
</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
|
||||
}
|
||||
?>
|
||||
<span class="StatusFilter"><label><?php echo translate('Status')?>:</label>
|
||||
<?php
|
||||
$status_options = array(
|
||||
''=>'All',
|
||||
'Unknown' => translate('Unknown'),
|
||||
'NotRunning' => translate('NotRunning'),
|
||||
'Running' => translate('Running'),
|
||||
);
|
||||
echo htmlSelect( 'StatusFilter', $status_options, ( isset($_SESSION['StatusFilter']) ? $_SESSION['StatusFilter'] : '' ), array('onchange'=>'changeFilter(this);') );
|
||||
?>
|
||||
</span>
|
||||
</div>
|
|
@ -18,36 +18,6 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
//
|
||||
|
||||
$servers = Server::find_all();
|
||||
$ServersById = array();
|
||||
foreach ( $servers as $S ) {
|
||||
$ServersById[$S->Id()] = $S;
|
||||
}
|
||||
session_start();
|
||||
foreach ( array('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();
|
||||
|
||||
$storage_areas = Storage::find_all();
|
||||
$StorageById = array();
|
||||
foreach ( $storage_areas as $S ) {
|
||||
$StorageById[$S->Id()] = $S;
|
||||
}
|
||||
|
||||
$show_storage_areas = count($storage_areas) > 1 and canEdit( 'System' ) ? 1 : 0;
|
||||
if ( $running == null )
|
||||
$running = daemonCheck();
|
||||
|
||||
|
@ -120,6 +90,45 @@ $eventCounts = array(
|
|||
|
||||
|
||||
$navbar = getNavBarHTML();
|
||||
ob_start();
|
||||
include('_monitor_filters.php');
|
||||
$filterbar = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$show_storage_areas = count($storage_areas) > 1 and canEdit( 'System' ) ? 1 : 0;
|
||||
$maxWidth = 0;
|
||||
$maxHeight = 0;
|
||||
$zoneCount = 0;
|
||||
for ( $i = 0; $i < count($displayMonitors); $i++ ) {
|
||||
$monitor = &$displayMonitors[$i];
|
||||
if ( $monitor['Function'] != 'None' ) {
|
||||
$scaleWidth = reScale( $monitor['Width'], $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
|
||||
$scaleHeight = reScale( $monitor['Height'], $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
|
||||
if ( $maxWidth < $scaleWidth ) $maxWidth = $scaleWidth;
|
||||
if ( $maxHeight < $scaleHeight ) $maxHeight = $scaleHeight;
|
||||
}
|
||||
$monitor['zmc'] = zmcStatus( $monitor );
|
||||
$monitor['zma'] = zmaStatus( $monitor );
|
||||
$monitor['ZoneCount'] = dbFetchOne( 'select count(Id) as ZoneCount from Zones where MonitorId = ?', 'ZoneCount', array($monitor['Id']) );
|
||||
$zoneCount += $monitor['ZoneCount'];
|
||||
|
||||
$counts = array();
|
||||
for ( $j = 0; $j < count($eventCounts); $j += 1 ) {
|
||||
$filter = addFilterTerm( $eventCounts[$j]['filter'], count($eventCounts[$j]['filter']['Query']['terms']), array( 'cnj' => 'and', 'attr' => 'MonitorId', 'op' => '=', 'val' => $monitor['Id'] ) );
|
||||
parseFilter( $filter );
|
||||
$counts[] = 'count(if(1'.$filter['sql'].",1,NULL)) AS EventCount$j, SUM(if(1".$filter['sql'].",DiskSpace,NULL)) As DiskSpace$j";
|
||||
$monitor['eventCounts'][$j]['filter'] = $filter;
|
||||
}
|
||||
$sql = 'SELECT '.join($counts,', ').' FROM Events as E where MonitorId = ?';
|
||||
$counts = dbFetchOne( $sql, NULL, array($monitor['Id']) );
|
||||
if ( $counts )
|
||||
$displayMonitors[$i] = $monitor = array_merge( $monitor, $counts );
|
||||
for ( $j = 0; $j < count($eventCounts); $j += 1 ) {
|
||||
$eventCounts[$j]['total'] += $monitor['EventCount'.$j];
|
||||
}
|
||||
}
|
||||
$cycleWidth = $maxWidth;
|
||||
$cycleHeight = $maxHeight;
|
||||
|
||||
noCacheHeaders();
|
||||
|
||||
|
@ -137,139 +146,7 @@ xhtmlHeaders( __FILE__, translate('Console') );
|
|||
<input type="hidden" name="action" value=""/>
|
||||
|
||||
<?php echo $navbar ?>
|
||||
<div class="controlHeader">
|
||||
<span id="groupControl"><label><?php echo translate('Group') ?>:</label>
|
||||
<?php
|
||||
# This will end up with the group_id of the deepest selection
|
||||
$group_id = Group::get_group_dropdowns();
|
||||
$groupSql = Group::get_group_sql( $group_id );
|
||||
?>
|
||||
</span>
|
||||
<span id="monitorControl"><label><?php echo translate('Monitor') ?>:</label>
|
||||
<?php
|
||||
|
||||
$monitor_id = 0;
|
||||
if ( isset( $_REQUEST['monitor_id'] ) ) {
|
||||
$monitor_id = $_REQUEST['monitor_id'];
|
||||
} else if ( isset($_COOKIE['zmMonitorId']) ) {
|
||||
$monitor_id = $_COOKIE['zmMonitorId'];
|
||||
}
|
||||
|
||||
$maxWidth = 0;
|
||||
$maxHeight = 0;
|
||||
# Used to determine if the Cycle button should be made available
|
||||
|
||||
$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'];
|
||||
}
|
||||
$sql = 'SELECT * FROM Monitors' . ( count($conditions) ? ' WHERE ' . implode(' AND ', $conditions ) : '' ).' ORDER BY Sequence ASC';
|
||||
$monitors = dbFetchAll( $sql, null, $values );
|
||||
$displayMonitors = array();
|
||||
$monitors_dropdown = array(''=>'All');
|
||||
|
||||
if ( $monitor_id ) {
|
||||
$found_selected_monitor = false;
|
||||
|
||||
for ( $i = 0; $i < count($monitors); $i++ ) {
|
||||
if ( !visibleMonitor( $monitors[$i]['Id'] ) ) {
|
||||
continue;
|
||||
}
|
||||
$monitors_dropdown[$monitors[$i]['Id']] = $monitors[$i]['Name'];
|
||||
if ( $monitors[$i]['Id'] == $monitor_id ) {
|
||||
$found_selected_monitor = true;
|
||||
}
|
||||
}
|
||||
if ( ! $found_selected_monitor ) {
|
||||
$monitor_id = '';
|
||||
}
|
||||
}
|
||||
for ( $i = 0; $i < count($monitors); $i++ ) {
|
||||
if ( !visibleMonitor( $monitors[$i]['Id'] ) ) {
|
||||
continue;
|
||||
}
|
||||
$monitors_dropdown[$monitors[$i]['Id']] = $monitors[$i]['Name'];
|
||||
|
||||
if ( $monitor_id and ( $monitors[$i]['Id'] != $monitor_id ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( $monitors[$i]['Function'] != 'None' ) {
|
||||
$scaleWidth = reScale( $monitors[$i]['Width'], $monitors[$i]['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
|
||||
$scaleHeight = reScale( $monitors[$i]['Height'], $monitors[$i]['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
|
||||
if ( $maxWidth < $scaleWidth ) $maxWidth = $scaleWidth;
|
||||
if ( $maxHeight < $scaleHeight ) $maxHeight = $scaleHeight;
|
||||
}
|
||||
$displayMonitors[] = $monitors[$i];
|
||||
}
|
||||
|
||||
|
||||
echo htmlSelect( 'monitor_id', $monitors_dropdown, $monitor_id, array('onchange'=>'changeMonitor(this);') );
|
||||
|
||||
$cycleWidth = $maxWidth;
|
||||
$cycleHeight = $maxHeight;
|
||||
$zoneCount = 0;
|
||||
|
||||
for( $i = 0; $i < count($displayMonitors); $i += 1 ) {
|
||||
$monitor = $displayMonitors[$i];
|
||||
$monitor['zmc'] = zmcStatus( $monitor );
|
||||
$monitor['zma'] = zmaStatus( $monitor );
|
||||
$monitor['ZoneCount'] = dbFetchOne( 'select count(Id) as ZoneCount from Zones where MonitorId = ?', 'ZoneCount', array($monitor['Id']) );
|
||||
$counts = array();
|
||||
for ( $j = 0; $j < count($eventCounts); $j += 1 ) {
|
||||
$filter = addFilterTerm( $eventCounts[$j]['filter'], count($eventCounts[$j]['filter']['Query']['terms']), array( 'cnj' => 'and', 'attr' => 'MonitorId', 'op' => '=', 'val' => $monitor['Id'] ) );
|
||||
parseFilter( $filter );
|
||||
$counts[] = 'count(if(1'.$filter['sql'].",1,NULL)) AS EventCount$j, SUM(if(1".$filter['sql'].",DiskSpace,NULL)) As DiskSpace$j";
|
||||
$monitor['eventCounts'][$j]['filter'] = $filter;
|
||||
}
|
||||
$sql = 'SELECT '.join($counts,', ').' FROM Events as E where MonitorId = ?';
|
||||
$counts = dbFetchOne( $sql, NULL, array($monitor['Id']) );
|
||||
if ( $counts )
|
||||
$displayMonitors[$i] = $monitor = array_merge( $monitor, $counts );
|
||||
for ( $j = 0; $j < count($eventCounts); $j += 1 ) {
|
||||
$eventCounts[$j]['total'] += $monitor['EventCount'.$j];
|
||||
}
|
||||
$zoneCount += $monitor['ZoneCount'];
|
||||
}
|
||||
?>
|
||||
</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
|
||||
}
|
||||
?>
|
||||
<span class="StatusFilter"><label><?php echo translate('Status')?>:</label>
|
||||
<?php
|
||||
$status_options = array(
|
||||
''=>'All',
|
||||
'Unknown' => translate('Unknown'),
|
||||
'NotRunning' => translate('NotRunning'),
|
||||
'Running' => translate('Running'),
|
||||
);
|
||||
echo htmlSelect( 'StatusFilter', $status_options, ( isset($_SESSION['StatusFilter']) ? $_SESSION['StatusFilter'] : '' ), array('onchange'=>'changeFilter(this);') );
|
||||
?>
|
||||
</span>
|
||||
</div>
|
||||
<?php echo $filterbar ?>
|
||||
|
||||
<div class="container-fluid">
|
||||
<table class="table table-striped table-hover table-condensed" id="consoleTable">
|
||||
|
|
|
@ -32,7 +32,7 @@ function Monitor( monitorData ) {
|
|||
if ( this.streamCmdTimer )
|
||||
this.streamCmdTimer = clearTimeout( this.streamCmdTimer );
|
||||
|
||||
var stream = $j('#liveStream'+this.id )[0];
|
||||
var stream = $j('#liveStream'+this.id)[0];
|
||||
if ( respObj.result == 'Ok' ) {
|
||||
this.status = respObj.status;
|
||||
this.alarmState = this.status.state;
|
||||
|
@ -81,9 +81,10 @@ function Monitor( monitorData ) {
|
|||
// Try to reload the image stream.
|
||||
if ( stream )
|
||||
stream.src = stream.src.replace( /auth=\w+/i, 'auth='+this.status.auth );
|
||||
console.log("Changed auth to " + this.status.auth );
|
||||
console.log("Changed auth from " + auth_hash + " to " + this.status.auth );
|
||||
auth_hash = this.status.auth;
|
||||
}
|
||||
} // end if haev a new auth hash
|
||||
} // end if have a new auth hash
|
||||
} else {
|
||||
console.error( respObj.message );
|
||||
// Try to reload the image stream.
|
||||
|
@ -93,7 +94,7 @@ function Monitor( monitorData ) {
|
|||
} else {
|
||||
console.log( 'No stream to reload?' );
|
||||
}
|
||||
}
|
||||
} // end if Ok or not
|
||||
var streamCmdTimeout = statusRefreshTimeout;
|
||||
if ( this.alarmState == STATE_ALARM || this.alarmState == STATE_ALERT )
|
||||
streamCmdTimeout = streamCmdTimeout/5;
|
||||
|
@ -114,11 +115,11 @@ function Monitor( monitorData ) {
|
|||
}
|
||||
|
||||
function selectLayout( element ) {
|
||||
layout = $(element).get('value');
|
||||
layout = $j(element).val();
|
||||
|
||||
if ( layout_id = parseInt(layout) ) {
|
||||
layout = layouts[layout];
|
||||
console.log("Have layout # " + layout_id);
|
||||
console.log(layout);
|
||||
|
||||
for ( var i = 0; i < monitors.length; i++ ) {
|
||||
monitor = monitors[i];
|
||||
|
@ -131,20 +132,23 @@ console.log("Have layout # " + layout_id);
|
|||
}
|
||||
|
||||
// Apply default layout options, like float left
|
||||
if ( layout.default ) {
|
||||
styles = layout.default;
|
||||
if ( layout.Positions['default'] ) {
|
||||
styles = layout.Positions['default'];
|
||||
for ( style in styles ) {
|
||||
console.log("applying " + style + ': ' + styles[style]);
|
||||
monitor_frame.css(style, styles[style]);
|
||||
}
|
||||
} else {
|
||||
console.log("No default styles to apply" + layout.Positions);
|
||||
} // end if default styles
|
||||
|
||||
if ( layout[monitor.id] ) {
|
||||
styles = layout[monitor.id];
|
||||
if ( layout.Positions['mId'+monitor.id] ) {
|
||||
styles = layout.Positions['mId'+monitor.id];
|
||||
for ( style in styles ) {
|
||||
console.log("applying " + style + ': ' + styles[style]);
|
||||
monitor_frame.css(style, styles[style]);
|
||||
console.log("Applying " + style + ' : ' + styles[style] );
|
||||
}
|
||||
} else {
|
||||
console.log("No Monitor styles to apply");
|
||||
} // end if specific monitor style
|
||||
} // end foreach monitor
|
||||
} // end if a stored layout
|
||||
|
@ -152,7 +156,7 @@ console.log("applying " + style + ': ' + styles[style]);
|
|||
return;
|
||||
}
|
||||
Cookie.write( 'zmMontageLayout', layout_id, { duration: 10*365 } );
|
||||
if ( layout_id != 1 ) { // 'montage_freeform.css' ) {
|
||||
if ( layouts[layout_id].Name != 'Freeform' ) { // 'montage_freeform.css' ) {
|
||||
Cookie.write( 'zmMontageScale', '', { duration: 10*365 } );
|
||||
$('scale').set('value', '' );
|
||||
$('width').set('value', '');
|
||||
|
@ -260,51 +264,84 @@ function changeScale() {
|
|||
Cookie.write( 'zmMontageHeight', '', { duration: 10*365 } );
|
||||
}
|
||||
|
||||
function toGrid(value) {
|
||||
return Math.round(value / 80) * 80;
|
||||
}
|
||||
|
||||
function getOffset( el ) {
|
||||
var _x = 0;
|
||||
var _y = 0;
|
||||
while( el && !isNaN( el.offsetLeft ) && !isNaN( el.offsetTop ) ) {
|
||||
_x += el.offsetLeft - el.scrollLeft;
|
||||
_y += el.offsetTop - el.scrollTop;
|
||||
el = el.offsetParent;
|
||||
}
|
||||
return { top: _y, left: _x };
|
||||
}
|
||||
|
||||
// Makes monitorFrames draggable.
|
||||
function edit_layout(button) {
|
||||
console.log("edit click");
|
||||
|
||||
for ( var x = 0; x < monitors.length; x++ ) {
|
||||
var monitor = monitors[x];
|
||||
|
||||
// Scale the frame
|
||||
monitor_frame = $j('#monitorFrame'+monitor.id);
|
||||
if ( ! monitor_frame ) {
|
||||
console.log("Error finding frame for " + monitor.id );
|
||||
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' );
|
||||
} // end foreach monitor
|
||||
|
||||
$j('#monitors .monitorFrame').draggable({
|
||||
cursor: 'crosshair',
|
||||
//revert: 'invalid'
|
||||
});
|
||||
$j('#SaveLayout').show();
|
||||
$j('#EditLayout').hide();
|
||||
} // end function edit_layout
|
||||
|
||||
function save_layout(button) {
|
||||
var form=button.form;
|
||||
var Positions = {};
|
||||
for ( var i = 0; i < monitors.length; i++ ) {
|
||||
var monitor = monitors[i];
|
||||
monitor_frame = $j('#monitorFrame'+monitor.id);
|
||||
|
||||
Positions['mId'+monitor.id] = {
|
||||
width: monitor_frame.css('width'),
|
||||
height: monitor_frame.css('height'),
|
||||
top: monitor_frame.css('top'),
|
||||
bottom: monitor_frame.css('bottom'),
|
||||
left: monitor_frame.css('left'),
|
||||
right: monitor_frame.css('right'),
|
||||
position: monitor_frame.css('position'),
|
||||
float: monitor_frame.css('float'),
|
||||
};
|
||||
} // end foreach monitor
|
||||
form.Positions.value = JSON.stringify( Positions );
|
||||
form.submit();
|
||||
}
|
||||
function cancel_layout(button) {
|
||||
$j('#SaveLayout').hide();
|
||||
$j('#EditLayout').show();
|
||||
}
|
||||
|
||||
var monitors = new Array();
|
||||
function initPage() {
|
||||
for ( var i = 0; i < monitorData.length; i++ ) {
|
||||
monitors[i] = new Monitor( monitorData[i] );
|
||||
var delay = Math.round( (Math.random()+0.5)*statusRefreshTimeout );
|
||||
monitors[i].start( delay );
|
||||
monitors[i] = new Monitor(monitorData[i]);
|
||||
var delay = Math.round( (Math.random()+0.75)*statusRefreshTimeout );
|
||||
console.log("delay: " + delay);
|
||||
monitors[i].start(delay);
|
||||
}
|
||||
selectLayout($('layout'));
|
||||
|
||||
$j('#monitors .monitorFrame').draggable({
|
||||
cursor: 'crosshair',
|
||||
revert: 'invalid'
|
||||
});
|
||||
|
||||
function toGrid(value) {
|
||||
return Math.round(value / 80) * 80;
|
||||
}
|
||||
|
||||
$j('#monitors').droppable({
|
||||
accept: '#monitors .monitorFrame',
|
||||
drop: function(event, ui) {
|
||||
//console.log(event);
|
||||
$j(this).removeClass('border over');
|
||||
$j(ui.draggable).detach().
|
||||
appendTo($j(this).find('ul')).
|
||||
draggable({
|
||||
containment: '.fw-content',
|
||||
cursor: 'help',
|
||||
grid: [ 80, 80 ]
|
||||
}).
|
||||
css({
|
||||
position: 'absolute',
|
||||
left: toGrid(event.clientX - $j('#monitors').offset().left),
|
||||
top: toGrid(event.clientY - $j('#monitors').offset().top)
|
||||
});
|
||||
},
|
||||
over: function(event, elem) {
|
||||
console.log('over');
|
||||
$j(this).addClass('over');
|
||||
},
|
||||
out: function(event, elem) {
|
||||
$j(this).removeClass('over');
|
||||
}
|
||||
});
|
||||
selectLayout('#zmMontageLayout');
|
||||
}
|
||||
|
||||
// Kick everything off
|
||||
window.addEvent( 'domready', initPage );
|
||||
|
|
|
@ -45,7 +45,7 @@ layouts[0] = {}; // reserved, should hold which fields to clear when transitioni
|
|||
<?php
|
||||
foreach ( $layouts as $layout ) {
|
||||
?>
|
||||
layouts[<?php echo $layout->Id() ?>] = <?php echo $layout->Positions() ?>;
|
||||
layouts[<?php echo $layout->Id() ?>] = {"Name":"<?php echo $layout->Name()?>","Positions":<?php echo $layout->Positions() ?>};
|
||||
<?php
|
||||
} // end foreach layout
|
||||
?>
|
||||
|
|
|
@ -59,20 +59,6 @@ if ( isset( $_REQUEST['scale'] ) ) {
|
|||
if ( ! $scale )
|
||||
$scale = 100;
|
||||
|
||||
$focusWindow = true;
|
||||
|
||||
/*
|
||||
$layouts = array(
|
||||
'montage_freeform.css' => translate('MtgDefault'),
|
||||
'montage_2wide.css' => translate('Mtg2widgrd'),
|
||||
'montage_3wide.css' => translate('Mtg3widgrd'),
|
||||
'montage_4wide.css' => translate('Mtg4widgrd'),
|
||||
'montage_3wide50enlarge.css' => translate('Mtg3widgrx'),
|
||||
);
|
||||
foreach ( MontageLayout::find() as $Layout ) {
|
||||
$layouts[$Layout->Id()] = $Layout->Name();
|
||||
}
|
||||
*/
|
||||
$layouts = MontageLayout::find(NULL, array('order'=>"lower('Name')"));
|
||||
$layoutsById = array();
|
||||
foreach ( $layouts as $l ) {
|
||||
|
@ -83,103 +69,34 @@ $layout = '';
|
|||
if ( isset($_COOKIE['zmMontageLayout']) )
|
||||
$layout = $_COOKIE['zmMontageLayout'];
|
||||
|
||||
session_start();
|
||||
$options = array();
|
||||
if ( isset($_COOKIE['zmMontageWidth']) and $_COOKIE['zmMontageWidth'] )
|
||||
$options['width'] = $_COOKIE['zmMontageWidth'];
|
||||
else
|
||||
if ( isset($_COOKIE['zmMontageWidth']) and $_COOKIE['zmMontageWidth'] ) {
|
||||
$_SESSION['zmMontageWidth'] = $options['width'] = $_COOKIE['zmMontageWidth'];
|
||||
} elseif ( isset($_SESSION['zmMontageWidth']) and $_SESSION['zmMontageWidth'] ) {
|
||||
$options['width'] = $_SESSION['zmMontageWidth'];
|
||||
} else
|
||||
$options['width'] = '';
|
||||
|
||||
if ( isset($_COOKIE['zmMontageHeight']) and $_COOKIE['zmMontageHeight'] )
|
||||
$options['height'] = $_COOKIE['zmMontageHeight'];
|
||||
$_SESSION['zmMontageHeight'] = $options['height'] = $_COOKIE['zmMontageHeight'];
|
||||
else if ( isset($_SESSION['zmMontageHeight']) and $_SESSION['zmMontageHeight'] )
|
||||
$options['height'] = $_SESSION['zmMontageHeight'];
|
||||
else
|
||||
$options['height'] = '';
|
||||
session_write_close();
|
||||
|
||||
if ( $scale )
|
||||
$options['scale'] = $scale;
|
||||
|
||||
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');
|
||||
$filterbar = 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;
|
||||
}
|
||||
session_start();
|
||||
foreach ( array('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();
|
||||
|
||||
$storage_areas = Storage::find_all();
|
||||
$StorageById = array();
|
||||
foreach ( $storage_areas as $S ) {
|
||||
$StorageById[$S->Id()] = $S;
|
||||
}
|
||||
|
||||
$monitor_id = 0;
|
||||
if ( isset( $_REQUEST['monitor_id'] ) ) {
|
||||
$monitor_id = $_REQUEST['monitor_id'];
|
||||
} else if ( isset($_COOKIE['zmMonitorId']) ) {
|
||||
$monitor_id = $_COOKIE['zmMonitorId'];
|
||||
}
|
||||
|
||||
$monitors = array();
|
||||
$monitors_dropdown = array( '' => 'All' );
|
||||
$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'];
|
||||
}
|
||||
$sql = 'SELECT * FROM Monitors' . ( count($conditions) ? ' WHERE ' . implode(' AND ', $conditions ) : '' ).' ORDER BY Sequence ASC';
|
||||
$monitor_rows = dbFetchAll( $sql, null, $values );
|
||||
|
||||
if ( $monitor_id ) {
|
||||
$found_selected_monitor = false;
|
||||
|
||||
for ( $i = 0; $i < count($monitor_rows); $i++ ) {
|
||||
if ( !visibleMonitor( $monitor_rows[$i]['Id'] ) ) {
|
||||
continue;
|
||||
}
|
||||
$monitors_dropdown[$monitor_rows[$i]['Id']] = $monitor_rows[$i]['Name'];
|
||||
if ( $monitor_rows[$i]['Id'] == $monitor_id ) {
|
||||
$found_selected_monitor = true;
|
||||
}
|
||||
}
|
||||
if ( ! $found_selected_monitor ) {
|
||||
$monitor_id = '';
|
||||
}
|
||||
}
|
||||
|
||||
$monitors = array();
|
||||
foreach( $monitor_rows as $row ) {
|
||||
if ( !visibleMonitor( $row['Id'] ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( $monitor_id and $row['Id'] != $monitor_id )
|
||||
foreach( $displayMonitors as &$row ) {
|
||||
if ( $row['Function'] == 'None' )
|
||||
continue;
|
||||
|
||||
$row['Scale'] = $scale;
|
||||
|
@ -188,14 +105,13 @@ foreach( $monitor_rows as $row ) {
|
|||
if ( ZM_OPT_CONTROL && $row['ControlId'] && $row['Controllable'] )
|
||||
$showControl = true;
|
||||
$row['connKey'] = generateConnKey();
|
||||
$Monitor = $monitors[] = new Monitor( $row );
|
||||
$monitors_dropdown[$Monitor->Id()] = $Monitor->Name();
|
||||
if ( ! isset( $widths[$row['Width']] ) ) {
|
||||
$widths[$row['Width']] = $row['Width'];
|
||||
}
|
||||
if ( ! isset( $heights[$row['Height']] ) ) {
|
||||
$heights[$row['Height']] = $row['Height'];
|
||||
}
|
||||
$monitors[] = new Monitor( $row );
|
||||
} # end foreach Monitor
|
||||
|
||||
xhtmlHeaders(__FILE__, translate('Montage') );
|
||||
|
@ -222,38 +138,27 @@ if ( $showZones ) {
|
|||
}
|
||||
?>
|
||||
</div>
|
||||
<div id="headerControl">
|
||||
<span id="groupControl"><label><?php echo translate('Group') ?>:</label>
|
||||
<?php echo $group_dropdowns; ?>
|
||||
</span>
|
||||
<span id="monitorControl"><label><?php echo translate('Monitor') ?>:</label>
|
||||
<?php echo htmlSelect( 'monitor_id', $monitors_dropdown, $monitor_id, array('onchange'=>'changeMonitor(this);') ); ?>
|
||||
</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
|
||||
}
|
||||
?>
|
||||
<br/>
|
||||
<span id="widthControl"><label><?php echo translate('Width') ?>:</label><?php echo htmlSelect( 'width', $widths, $options['width'], 'changeSize(this);' ); ?></span>
|
||||
<span id="heightControl"><label><?php echo translate('Height') ?>:</label><?php echo htmlSelect( 'height', $heights, $options['height'], 'changeSize(this);' ); ?></span>
|
||||
<span id="scaleControl"><label><?php echo translate('Scale') ?>:</label><?php echo htmlSelect( 'scale', $scales, $scale, 'changeScale(this);' ); ?></span>
|
||||
<span id="layoutControl">
|
||||
<label for="layout"><?php echo translate('Layout') ?>:</label>
|
||||
<?php echo htmlSelect( 'layout', $layoutsById, $layout, 'selectLayout(this);' )?>
|
||||
</span>
|
||||
<?php echo $filterbar ?>
|
||||
<div id="sizeControl">
|
||||
<form action="index.php?view=montage" method="post">
|
||||
<input type="hidden" name="object" value="MontageLayout"/>
|
||||
<input type="hidden" name="action" value="Save"/>
|
||||
|
||||
<span id="widthControl"><label><?php echo translate('Width') ?>:</label><?php echo htmlSelect( 'width', $widths, $options['width'], 'changeSize(this);' ); ?></span>
|
||||
<span id="heightControl"><label><?php echo translate('Height') ?>:</label><?php echo htmlSelect( 'height', $heights, $options['height'], 'changeSize(this);' ); ?></span>
|
||||
<span id="scaleControl"><label><?php echo translate('Scale') ?>:</label><?php echo htmlSelect( 'scale', $scales, $scale, 'changeScale(this);' ); ?></span>
|
||||
<span id="layoutControl">
|
||||
<label for="layout"><?php echo translate('Layout') ?>:</label>
|
||||
<?php echo htmlSelect( 'zmMontageLayout', $layoutsById, $layout, array( 'onchange'=>'selectLayout(this);', 'id'=>'zmMontageLayout') ); ?>
|
||||
</span>
|
||||
<input type="hidden" name="Positions"/>
|
||||
<input type="button" id="EditLayout" value="<?php echo translate('EditLayout') ?>" onclick="edit_layout(this);"/>
|
||||
<span id="SaveLayout" style="display:none;">
|
||||
<input type="text" name="Name" placeholder="Enter new name for layout if desired" />
|
||||
<input type="button" value="<?php echo translate('Save') ?>" onclick="save_layout(this);"/>
|
||||
<input type="button" value="Cancel" onclick="cancel_layout(this);"/>
|
||||
</span>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div id="content">
|
||||
|
@ -262,7 +167,7 @@ echo htmlSelect( 'StorageFilter', array(''=>'All')+$StorageById, (isset($_SESSIO
|
|||
foreach ( $monitors as $monitor ) {
|
||||
$connkey = $monitor->connKey(); // Minor hack
|
||||
?>
|
||||
<div id="monitorFrame<?php echo $monitor->Id() ?>" class="monitorFrame" title="<?php echo $monitor->Id() . ' ' .$monitor->Name() ?>">
|
||||
<div id="monitorFrame<?php echo $monitor->Id() ?>" class="monitorFrame" title="<?php echo $monitor->Id() . ' ' .$monitor->Name() ?>" style="<?php echo $options['width'] ? 'width:'.$options['width'].'px;':''?>">
|
||||
<div id="monitor<?php echo $monitor->Id() ?>" class="monitor idle">
|
||||
<div id="imageFeed<?php echo $monitor->Id() ?>" class="imageFeed" onclick="createPopup( '?view=watch&mid=<?php echo $monitor->Id() ?>', 'zmWatch<?php echo $monitor->Id() ?>', 'watch', <?php echo reScale( $monitor->Width(), $monitor->PopupScale() ); ?>, <?php echo reScale( $monitor->Height(), $monitor->PopupScale() ); ?> );">
|
||||
<?php
|
||||
|
@ -303,16 +208,13 @@ foreach ( $monitors as $monitor ) {
|
|||
$row['Coords'] = pointsToCoords( $row['Points'] );
|
||||
$row['AreaCoords'] = preg_replace( '/\s+/', ',', $row['Coords'] );
|
||||
$zones[] = $row;
|
||||
}
|
||||
|
||||
} // end foreach Zone
|
||||
?>
|
||||
|
||||
<svg class="zones" id="zones<?php echo $monitor->Id() ?>" style="position:absolute; top: 0; left: 0; background: none; width: <?php echo $width ?>px; height: <?php echo $height ?>px;">
|
||||
<?php
|
||||
foreach( array_reverse($zones) as $zone ) {
|
||||
?>
|
||||
<polygon points="<?php echo $zone['AreaCoords'] ?>" class="<?php echo $zone['Type']?>" />
|
||||
<?php
|
||||
echo '<polygon points="'. $zone['AreaCoords'] .'" class="'. $zone['Type'].'" />';
|
||||
} // end foreach zone
|
||||
?>
|
||||
Sorry, your browser does not support inline SVG
|
||||
|
|
Loading…
Reference in New Issue