remove btn styles from buttons. make groups, cycle, montage, montage review non-popups. Add datetime filters to montagereview. Fix dark skin

pull/2077/head
Isaac Connor 2017-09-30 14:19:32 -04:00
parent 6a0da487eb
commit 4be133ed09
25 changed files with 571 additions and 394 deletions

View File

@ -5,6 +5,7 @@ class Group {
public $defaults = array(
'Id' => null,
'Name' => '',
'ParentId' => null,
'MonitorIds' => '',
);
@ -53,10 +54,27 @@ public $defaults = array(
}
}
public static function find_all() {
public static function find_all( $parameters = null ) {
$filters = array();
$result = dbQuery( 'SELECT * FROM Groups ORDER BY Name');
$results = $result->fetchALL(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Group' );
$sql = 'SELECT * FROM Groups ';
$values = array();
if ( $parameters ) {
$fields = array();
$sql .= 'WHERE ';
foreach ( $parameters as $field => $value ) {
if ( $value == null ) {
$fields[] = $field.' IS NULL';
} else {
$fields[] = $field.'=?';
$values[] = $value;
}
}
$sql .= implode(' AND ', $fields );
}
$sql .= ' ORDER BY Name';
$result = dbQuery($sql, $values);
$results = $result->fetchALL(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Group');
foreach ( $results as $row => $obj ) {
$filters[] = $obj;
}
@ -83,6 +101,6 @@ public $defaults = array(
}
}
}
} # end class
} # end class Group
?>

View File

@ -605,11 +605,13 @@ Warning("Addterm");
if ( canEdit( 'Groups' ) ) {
if ( $action == 'group' ) {
# Should probably verfy that each monitor id is a valid monitor, that we have access to. HOwever at the moment, you have to have System permissions to do this
$monitors = empty( $_POST['newGroup']['MonitorIds'] ) ? NULL : implode(',', $_POST['newGroup']['MonitorIds']);
$monitors = empty( $_POST['newGroup']['MonitorIds'] ) ? '' : implode(',', $_POST['newGroup']['MonitorIds'] );
if ( !empty($_POST['gid']) ) {
dbQuery( "UPDATE Groups SET Name=?, MonitorIds=? WHERE Id=?", array($_POST['newGroup']['Name'], $monitors, $_POST['gid']) );
dbQuery( 'UPDATE Groups SET Name=?, ParentId=?, MonitorIds=? WHERE Id=?',
array($_POST['newGroup']['Name'], ( $_POST['newGroup']['ParentId'] == '' ? null : $_POST['newGroup']['ParentId'] ), $monitors, $_POST['gid']) );
} else {
dbQuery( "INSERT INTO Groups SET Name=?, MonitorIds=?", array( $_POST['newGroup']['Name'], $monitors ) );
dbQuery( 'INSERT INTO Groups SET Name=?, ParentId=?, MonitorIds=?',
array( $_POST['newGroup']['Name'], ( $_POST['newGroup']['ParentId'] == '' ? null : $_POST['newGroup']['ParentId'] ), $monitors ) );
}
$view = 'none';
}

View File

@ -127,6 +127,7 @@ function dbQuery( $sql, $params=NULL ) {
} else {
$result = $dbConn->query( $sql );
}
Warning("SQL: $sql");
} catch(PDOException $e) {
Fatal( "SQL-ERR '".$e->getMessage()."', statement was '".$sql."'" );
}

View File

@ -538,7 +538,7 @@ function makePopupButton( $url, $winName, $winSize, $buttonValue, $condition=1,
$popupParms = "'".$url."', '".$winName."', '".$winSize[0]."', ".$winSize[1].", ".$winSize[2];
else
$popupParms = "'".$url."', '".$winName."', '".$winSize."'";
$string = '<input class="btn btn-primary" type="button" value="'.$buttonValue.'" onclick="createPopup( '.$popupParms.' ); return( false );"'.($condition?'':' disabled="disabled"').($options?(' '.$options):'').'/>';
$string = '<input type="button" value="'.$buttonValue.'" onclick="createPopup( '.$popupParms.' ); return( false );"'.($condition?'':' disabled="disabled"').($options?(' '.$options):'').'/>';
return( $string );
}

View File

@ -48,6 +48,7 @@ require_once( 'includes/logger.php' );
require_once( 'includes/Server.php' );
require_once( 'includes/Storage.php' );
require_once( 'includes/Event.php' );
require_once( 'includes/Group.php' );
require_once( 'includes/Monitor.php' );
if ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ) {

View File

@ -645,8 +645,8 @@ $SLANG = array(
'ShowTimeline' => 'Show Timeline',
'SignalCheckColour' => 'Signal Check Colour',
'Size' => 'Size',
'SkinDescription' => 'Change the default skin for this computer',
'CSSDescription' => 'Change the default css for this computer',
'SkinDescription' => 'Change the skin for this session',
'CSSDescription' => 'Change the css for this session',
'Sleep' => 'Sleep',
'SortAsc' => 'Asc',
'SortBy' => 'Sort by',

View File

@ -492,16 +492,13 @@ input[type=submit]:disabled {
#consoleTable td, #consoleTable th {
padding: 5px;
border-bottom: 2px solid #f2f2f2;
border-bottom: 1px solid #000000;
}
#consoleTable input[type=button] {
margin-right: 3px !important;
}
#consoleTable tfoot {
background-color: #f2f2f2;
}
.navbar{
margin-bottom: 0 !important;
@ -537,3 +534,8 @@ input[type=submit]:disabled {
margin-left: 0;
}
.table-striped > tbody > tr:nth-of-type(2n+1) {
background: none;
}

View File

@ -94,17 +94,18 @@ label {
input,textarea,select,button {
border: 1px #ccc solid;
padding: 10px;
padding: 5px;
border-radius: 2px;
font-family: inherit;
font-weight: 400;
font-size: 100%;
color: #333333;
}
/*
input[type=text], input[type=password], input[type="url"], textarea, select {
padding: 1px;
}
*/
input.noborder {
border: 0;

View File

@ -10,6 +10,9 @@
#SpeedDiv label {
margin: 0;
}
#DateTimeDiv {
display: inline-flex;
}
#scaleslideroutput,
#speedslideroutput {
@ -29,7 +32,6 @@
#monitors {
position:relative;
background-color:black;
width:100%;
height:100%;
}

View File

@ -144,46 +144,12 @@ function xhtmlHeaders( $file, $title ) {
function getNavBarHTML() {
$group = NULL;
if ( ! empty($_COOKIE['zmGroup']) ) {
if ( $group = dbFetchOne( 'select * from Groups where Id = ?', NULL, array($_COOKIE['zmGroup'])) )
$groupIds = array_flip(explode( ',', $group['MonitorIds'] ));
}
$maxWidth = 0;
$maxHeight = 0;
# Used to determine if the Cycle button should be made available
$cycleCount = 0;
$monitors = dbFetchAll( "select * from Monitors order by Sequence asc" );
global $displayMonitors;
$displayMonitors = array();
for ( $i = 0; $i < count($monitors); $i++ ) {
if ( !visibleMonitor( $monitors[$i]['Id'] ) ) {
continue;
}
if ( $group && !empty($groupIds) && !array_key_exists( $monitors[$i]['Id'], $groupIds ) ) {
continue;
}
if ( $monitors[$i]['Function'] != 'None' ) {
$cycleCount++;
$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];
}
$cycleWidth = $maxWidth;
$cycleHeight = $maxHeight;
$versionClass = (ZM_DYN_DB_VERSION&&(ZM_DYN_DB_VERSION!=ZM_VERSION))?'errorText':'';
ob_start();
global $CLANG;
global $VLANG;
global $CLANG;
global $VLANG;
global $running;
if ( $running == null )
$running = daemonCheck();
@ -213,20 +179,19 @@ function getNavBarHTML() {
<?php if ( ZM_OPT_X10 && canView( 'Devices' ) ) { ?>
<li><a href="?view=devices">Devices</a></li>
<?php } ?>
<li><?php echo makePopupLink( '?view=groups', 'zmGroups', 'groups', 'Groups', canView( 'Groups' ) ); ?></li>
<li><a href="?view=filter">Filters</a></li>
<li><a href="?view=groups"><?php echo translate('Groups') ?></a></li>
<li><a href="?view=filter"><?php echo translate('Filters') ?></a></li>
<?php
$cycleGroup = isset($_COOKIE['zmGroup'])?$_COOKIE['zmGroup']:0;
if ( canView( 'Stream' ) && $cycleCount > 1 ) {
if ( canView( 'Stream' ) ) {
?>
<li><?php echo makePopupLink( '?view=cycle&amp;group='.$cycleGroup, 'zmCycle'.$cycleGroup, array( 'cycle', $cycleWidth, $cycleHeight ), translate('Cycle'), $running ) ?></li>
<li><?php echo makePopupLink( '?view=montage&amp;group='.$cycleGroup, 'zmMontage'.$cycleGroup, 'montage', translate('Montage'), $running ) ?></li>
<li><a href="?view=cycle"><?php echo translate('Cycle') ?></a></li>
<li><a href="?view=montage"><?php echo translate('Montage') ?></a></li>
<?php
}
if ( canView('Events') ) {
?>
<li><?php echo makePopupLink( '?view=montagereview&amp;group='.$cycleGroup, 'zmMontageReview'.$cycleGroup, 'montagereview', translate('MontageReview') ) ?></li>
<li><a href="?view=montagereview"><?php echo translate('MontageReview')?></a></li>
<?php
}
?>

View File

@ -293,3 +293,14 @@ function addVideoTimingTrack(video, LabelFormat, monitorName, duration, startTim
track.src = 'data:plain/text;charset=utf-8,'+encodeURIComponent(webvttdata);
video.appendChild(track);
}
function changeGroup() {
var group_id = $('group').get('value');
Cookie.write( 'zmGroup', group_id, { duration: 10*365 } );
window.location = window.location;
}
function changeSubGroup() {
var subgroup_id = $('subgroup').get('value');
Cookie.write( 'zmSubGroup', subgroup_id, { duration: 10*365 } );
window.location = window.location;
}

View File

@ -19,106 +19,80 @@
//
$servers = Server::find_all();
require_once('includes/Storage.php');
$storage_areas = Storage::find_all();
$show_storage_areas = count($storage_areas) > 1 and canEdit( 'System' ) ? 1 : 0;
if ( $running == null )
$running = daemonCheck();
$eventCounts = array(
array(
'title' => translate('Events'),
'filter' => array(
'Query' => array (
'terms' => array()
)
),
'total' => 0,
array(
'title' => translate('Events'),
'filter' => array(
'Query' => array (
'terms' => array()
)
),
array(
'title' => translate('Hour'),
'filter' => array(
'Query' => array(
'terms' => array(
array( 'attr' => 'DateTime', 'op' => '>=', 'val' => '-1 hour' ),
)
)
),
'total' => 0,
'total' => 0,
),
array(
'title' => translate('Hour'),
'filter' => array(
'Query' => array(
'terms' => array(
array( 'attr' => 'DateTime', 'op' => '>=', 'val' => '-1 hour' ),
)
)
),
array(
'title' => translate('Day'),
'filter' => array(
'Query' => array(
'terms' => array(
array( 'attr' => 'DateTime', 'op' => '>=', 'val' => '-1 day' ),
)
)
),
'total' => 0,
'total' => 0,
),
array(
'title' => translate('Day'),
'filter' => array(
'Query' => array(
'terms' => array(
array( 'attr' => 'DateTime', 'op' => '>=', 'val' => '-1 day' ),
)
)
),
array(
'title' => translate('Week'),
'filter' => array(
'Query' => array(
'terms' => array(
array( 'attr' => 'DateTime', 'op' => '>=', 'val' => '-7 day' ),
)
)
),
'total' => 0,
'total' => 0,
),
array(
'title' => translate('Week'),
'filter' => array(
'Query' => array(
'terms' => array(
array( 'attr' => 'DateTime', 'op' => '>=', 'val' => '-7 day' ),
)
)
),
array(
'title' => translate('Month'),
'filter' => array(
'Query' => array(
'terms' => array(
array( 'attr' => 'DateTime', 'op' => '>=', 'val' => '-1 month' ),
)
)
),
'total' => 0,
'total' => 0,
),
array(
'title' => translate('Month'),
'filter' => array(
'Query' => array(
'terms' => array(
array( 'attr' => 'DateTime', 'op' => '>=', 'val' => '-1 month' ),
)
)
),
array(
'title' => translate('Archived'),
'filter' => array(
'Query' => array(
'terms' => array(
array( 'attr' => 'Archived', 'op' => '=', 'val' => '1' ),
)
)
),
'total' => 0,
),
'total' => 0,
),
array(
'title' => translate('Archived'),
'filter' => array(
'Query' => array(
'terms' => array(
array( 'attr' => 'Archived', 'op' => '=', 'val' => '1' ),
)
)
),
'total' => 0,
),
);
$displayMonitors = NULL;
# Also populates displayMonitors
$navbar = getNavBarHTML();
$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";
$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'];
}
noCacheHeaders();
@ -137,6 +111,97 @@ 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
$group_id = 0;
if ( isset($_REQUEST['group']) ) {
$group_id = $_REQUEST['group'];
} else if ( isset($_COOKIE['zmGroup'] ) ) {
$group_id = $_COOKIE['zmGroup'];
}
$subgroup_id = 0;
if ( isset($_REQUEST['subgroup']) ) {
$subgroup_id = $_REQUEST['subgroup'];
} else if ( isset($_COOKIE['zmSubGroup'] ) ) {
$subgroup_id = $_COOKIE['zmSubGroup'];
}
$groups = array(0=>'All');
foreach ( Group::find_all( array('ParentId'=>null) ) as $Group ) {
$groups[$Group->Id()] = $Group->Name();
}
echo htmlSelect( 'group', $groups, $group_id, 'changeGroup(this);' );
$groups = array(0=>'All');
if ( $group_id ) {
foreach ( Group::find_all( array('ParentId'=>$group_id) ) as $Group ) {
$groups[$Group->Id()] = $Group->Name();
}
}
echo htmlSelect( 'subgroup', $groups, $subgroup_id, 'changeSubGroup(this);' );
$group = NULL;
if ( $group_id ) {
if ( $group = dbFetchOne( 'SELECT MonitorIds FROM Groups WHERE Id = ?', NULL, array($group_id) ) )
$groupIds = array_flip(explode( ',', $group['MonitorIds'] ));
if ( $subgroup_id ) {
if ( $group = dbFetchOne( 'SELECT MonitorIds FROM Groups WHERE Id = ?', NULL, array($subgroup_id) ) )
$groupIds = array_merge( $groupIds, array_flip(explode( ',', $group['MonitorIds'] ) ) );
} else {
foreach ( dbFetchAll( 'SELECT MonitorIds FROM Groups WHERE ParentId = ?', NULL, array($group_id) ) as $group )
$groupIds = array_merge( $groupIds, array_flip(explode( ',', $group['MonitorIds'] ) ) );
}
}
$maxWidth = 0;
$maxHeight = 0;
# Used to determine if the Cycle button should be made available
$monitors = dbFetchAll( 'SELECT * FROM Monitors ORDER BY Sequence ASC' );
$displayMonitors = array();
for ( $i = 0; $i < count($monitors); $i++ ) {
if ( !visibleMonitor( $monitors[$i]['Id'] ) ) {
continue;
}
if ( $group && !empty($groupIds) && !array_key_exists( $monitors[$i]['Id'], $groupIds ) ) {
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];
}
$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";
$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>
</div>
<div class="container-fluid">
<table class="table table-striped table-hover table-condensed" id="consoleTable">
@ -249,8 +314,8 @@ for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
<tfoot>
<tr>
<td class="colLeftButtons" colspan="<?php echo $left_columns ?>">
<input type="button" class="btn btn-primary" value="<?php echo translate('Refresh') ?>" onclick="location.reload(true);"/>
<input type="button" class="btn btn-primary" name="addBtn" value="<?php echo translate('AddNewMonitor') ?>" onclick="addMonitor( this )"/>
<input type="button" value="<?php echo translate('Refresh') ?>" onclick="location.reload(true);"/>
<input type="button" name="addBtn" value="<?php echo translate('AddNewMonitor') ?>" onclick="addMonitor( this )"/>
<!-- <?php echo makePopupButton( '?view=monitor', 'zmMonitor0', 'monitor', translate('AddNewMonitor'), (canEdit( 'Monitors' ) && !$user['MonitorIds']) ) ?> -->
<?php echo makePopupButton( '?view=filter&amp;filter[terms][0][attr]=DateTime&amp;filter[terms][0][op]=%3c&amp;filter[terms][0][val]=now', 'zmFilter', 'filter', translate('Filters'), canView( 'Events' ) ) ?>
<input type="button" name="editBtn" value="<?php echo translate('Edit') ?>" onclick="editMonitor( this )" disabled="disabled"/>

View File

@ -32,13 +32,38 @@ if ( empty($_REQUEST['mode']) ) {
$mode = validHtmlStr($_REQUEST['mode']);
}
$group = '';
$groupSql = '';
if ( !empty($_REQUEST['group']) ) {
$group = validInt($_REQUEST['group']);
$row = dbFetchOne( 'SELECT * FROM Groups WHERE Id = ?', NULL, array($group) );
$groupSql = " and find_in_set( Id, '".$row['MonitorIds']."' )";
$group_id = 0;
if ( isset($_REQUEST['group']) ) {
$group_id = $_REQUEST['group'];
} else if ( isset($_COOKIE['zmGroup'] ) ) {
$group_id = $_COOKIE['zmGroup'];
}
$subgroup_id = 0;
if ( isset($_REQUEST['subgroup']) ) {
$subgroup_id = $_REQUEST['subgroup'];
} else if ( isset($_COOKIE['zmSubGroup'] ) ) {
$subgroup_id = $_COOKIE['zmSubGroup'];
}
$groupIds = null;
if ( $group_id ) {
$groupIds = array();
if ( $group = dbFetchOne( 'SELECT MonitorIds FROM Groups WHERE Id = ?', NULL, array($group_id) ) )
if ( $group['MonitorIds'] )
$groupIds = explode( ',', $group['MonitorIds'] );
if ( $subgroup_id ) {
if ( $group = dbFetchOne( 'SELECT MonitorIds FROM Groups WHERE Id = ?', NULL, array($subgroup_id) ) )
if ( $group['MonitorIds'] )
$groupIds = array_merge( $groupIds, explode( ',', $group['MonitorIds'] ) );
} else {
foreach ( dbFetchAll( 'SELECT MonitorIds FROM Groups WHERE ParentId = ?', NULL, array($group_id) ) as $group )
if ( $group['MonitorIds'] )
$groupIds = array_merge( $groupIds, explode( ',', $group['MonitorIds'] ) );
}
}
$groupSql = '';
if ( $groupIds )
$groupSql = " and find_in_set( Id, '".implode( ',', $groupIds )."' )";
$sql = "SELECT * FROM Monitors WHERE Function != 'None'$groupSql ORDER BY Sequence";
$monitors = array();
@ -53,36 +78,58 @@ foreach( dbFetchAll( $sql ) as $row ) {
$monitors[] = new Monitor( $row );
}
$monitor = $monitors[$monIdx];
$nextMid = $monIdx==(count($monitors)-1)?$monitors[0]->Id():$monitors[$monIdx+1]->Id();
$montageWidth = $monitor->ScaledWidth();
$montageHeight = $monitor->ScaledHeight();
$widthScale = ($montageWidth*SCALE_BASE)/$monitor->Width();
$heightScale = ($montageHeight*SCALE_BASE)/$monitor->Height();
$scale = (int)(($widthScale<$heightScale)?$widthScale:$heightScale);
if ( $monitors ) {
$monitor = $monitors[$monIdx];
$nextMid = $monIdx==(count($monitors)-1)?$monitors[0]->Id():$monitors[$monIdx+1]->Id();
$montageWidth = $monitor->ScaledWidth();
$montageHeight = $monitor->ScaledHeight();
$widthScale = ($montageWidth*SCALE_BASE)/$monitor->Width();
$heightScale = ($montageHeight*SCALE_BASE)/$monitor->Height();
$scale = (int)(($widthScale<$heightScale)?$widthScale:$heightScale);
}
noCacheHeaders();
$focusWindow = true;
xhtmlHeaders(__FILE__, translate('CycleWatch') );
?>
<body>
<div id="page">
<?php echo $navbar = getNavBarHTML(); ?>
<div id="header">
<div id="headerButtons">
<?php if ( $mode == "stream" ) { ?>
<a href="?view=<?php echo $view ?>&amp;mode=still&amp;group=<?php echo $group ?>&amp;mid=<?php echo $monitor->Id() ?>"><?php echo translate('Stills') ?></a>
<a href="?view=<?php echo $view ?>&amp;mode=still&amp;mid=<?php echo $monitor ? $monitor->Id() : '' ?>"><?php echo translate('Stills') ?></a>
<?php } else { ?>
<a href="?view=<?php echo $view ?>&amp;mode=stream&amp;group=<?php echo $group ?>&amp;mid=<?php echo $monitor->Id() ?>"><?php echo translate('Stream') ?></a>
<a href="?view=<?php echo $view ?>&amp;mode=stream&amp;mid=<?php echo $monitor ? $monitor->Id() : '' ?>"><?php echo translate('Stream') ?></a>
<?php } ?>
<a href="#" onclick="closeWindow(); return( false );"><?php echo translate('Close') ?></a>
</div>
<h2><?php echo translate('Cycle') ?> - <?php echo validHtmlStr($monitor->Name()) ?></h2>
<div class="controlHeader">
<span id="groupControl"><label><?php echo translate('Group') ?>:</label>
<?php
$groups = array(0=>'All');
foreach ( Group::find_all( array('ParentId'=>null) ) as $Group ) {
$groups[$Group->Id()] = $Group->Name();
}
echo htmlSelect( 'group', $groups, $group_id, 'changeGroup(this);' );
$groups = array(0=>'All');
if ( $group_id ) {
foreach ( Group::find_all( array('ParentId'=>$group_id) ) as $Group ) {
$groups[$Group->Id()] = $Group->Name();
}
}
echo htmlSelect( 'subgroup', $groups, $subgroup_id, 'changeSubGroup(this);' );
?>
</div>
</div>
<div id="content">
<div id="imageFeed">
<?php echo getStreamHTML( $monitor, array( 'scale'=>$scale, 'mode'=>$mode ) ); ?>
<?php
if ( $monitor ) {
echo getStreamHTML( $monitor, array( 'scale'=>$scale, 'mode'=>$mode ) );
} else {
echo "There are no monitors to view.";
}
?>
</div>
</div>
</div>

View File

@ -18,17 +18,12 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
if ( !canView( 'Events' ) )
{
$view = "error";
return;
if ( !canView( 'Events' ) ) {
$view = 'error';
return;
}
# Must re-start session because we close it now in index.php to improve concurrency
session_start();
if ( isset($_SESSION['export']) )
{
if ( isset($_SESSION['export']) ) {
if ( isset($_SESSION['export']['detail']) )
$_REQUEST['exportDetail'] = $_SESSION['export']['detail'];
if ( isset($_SESSION['export']['frames']) )

View File

@ -29,6 +29,7 @@ if ( !empty($_REQUEST['gid']) ) {
$newGroup = array(
'Id' => '',
'Name' => 'New Group',
'ParentId' => '',
'MonitorIds' => ''
);
}
@ -54,12 +55,12 @@ xhtmlHeaders( __FILE__, translate('Group').' - '.$newGroup['Name'] );
<tr>
<th scope="row"><?php echo translate('ParentGroup') ?></th>
<td>
<select name="newGroup[ParentId][]"><option value="">None</option>
<select name="newGroup[ParentId]" onchange="configureButtons(this);"><option value="">None</option>
<?php
$groups = dbFetchAll( 'SELECT Id,Name from Groups WHERE Id!=? ORDER BY Name', null, array($newGroup['Id']) );
foreach ( $groups as $group ) {
?>
<option value="<?php echo $group['Id'] ?>"<?php if ( $group['Id'] == $newGroup['ParentId'] ) { ?> selected="selected"<?php } ?> onclick="configureButtons(this);"><?php echo validHtmlStr($group['Name']) ?></option>
<option value="<?php echo $group['Id'] ?>"<?php if ( $group['Id'] == $newGroup['ParentId'] ) { ?> selected="selected"<?php } ?>><?php echo validHtmlStr($group['Name']) ?></option>
<?php
}
?>
@ -69,14 +70,14 @@ xhtmlHeaders( __FILE__, translate('Group').' - '.$newGroup['Name'] );
<tr>
<th scope="row"><?php echo translate('Monitor') ?></th>
<td>
<select name="newGroup[MonitorIds][]" size="4" multiple="multiple">
<select name="newGroup[MonitorIds][]" size="4" multiple="multiple" onchange="configureButtons(this);">
<?php
$monitors = dbFetchAll( 'SELECT Id,Name FROM Monitors ORDER BY Sequence ASC' );
$monitorIds = array_flip( explode( ',', $newGroup['MonitorIds'] ) );
foreach ( $monitors as $monitor ) {
if ( visibleMonitor( $monitor['Id'] ) ) {
?>
<option value="<?php echo $monitor['Id'] ?>"<?php if ( array_key_exists( $monitor['Id'], $monitorIds ) ) { ?> selected="selected"<?php } ?> onclick="configureButtons(this);"><?php echo validHtmlStr($monitor['Name']) ?></option>
<option value="<?php echo $monitor['Id'] ?>"<?php if ( array_key_exists( $monitor['Id'], $monitorIds ) ) { ?> selected="selected"<?php } ?>><?php echo validHtmlStr($monitor['Name']) ?></option>
<?php
}
}

View File

@ -19,34 +19,36 @@
//
if ( !canView( 'Groups' ) ) {
$view = "error";
return;
$view = 'error';
return;
}
$sql = "select * from Groups order by Name";
$groups = array();
$sql = 'SELECT * FROM Groups ORDER BY Name';
$root_groups = array();
$sub_groups = array();
$selected = false;
foreach( dbFetchAll( $sql ) as $row )
{
if ( !empty($_COOKIE['zmGroup']) && ($row['Id'] == $_COOKIE['zmGroup']) )
{
$row['selected'] = true;
$selected = true;
foreach( dbFetchAll( $sql ) as $row ) {
if ( !empty($_COOKIE['zmGroup']) && ($row['Id'] == $_COOKIE['zmGroup']) ) {
$row['selected'] = true;
$selected = true;
} else {
$row['selected'] = false;
}
if ( $row['ParentId'] ) {
if ( ! isset( $sub_groups[$row['ParentId']] ) ) {
$sub_groups[$row['ParentId']] = array();
}
else
{
$row['selected'] = false;
}
$groups[] = $row;
$sub_groups[$row['ParentId']][] = $row;
} else {
$root_groups[] = $row;
}
}
xhtmlHeaders(__FILE__, translate('Groups') );
?>
<body>
<div id="page">
<div id="header">
<h2><?php echo translate('Groups') ?></h2>
</div>
<?php echo $navbar = getNavBarHTML(); ?>
<div id="content">
<form name="groupsForm" method="get" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<input type="hidden" name="view" value="none"/>
@ -55,31 +57,54 @@ xhtmlHeaders(__FILE__, translate('Groups') );
<thead>
<tr>
<th class="colName"><?php echo translate('Name') ?></th>
<th class="colIds"><?php echo translate('MonitorIds') ?></th>
<th class="colSelect"><?php echo translate('Select') ?></th>
<th class="colSubGroups"><?php echo translate('Subgroup') ?></th>
<th class="colIds"><?php echo translate('Monitors') ?></th>
<th class="colSelect"><?php echo translate('Mark') ?></th>
</tr>
</thead>
<tbody>
<tr class="highlight">
<td class="colName"><?php echo translate('NoGroup') ?></td>
<td class="colIds"><?php echo translate('All') ?></td>
<td class="colSelect"><input type="radio" name="gid" value="0"<?php echo !$selected?' checked="checked"':'' ?> onclick="configureButtons( this );"/></td>
</tr>
<?php foreach ( $groups as $group ) { ?>
<?php
foreach ( $root_groups as $group ) {
?>
<tr>
<td class="colName"><?php echo validHtmlStr($group['Name']) ?></td>
<td class="colName" colspan="2">
<?php
if ( canEdit('Groups') ) {
echo '<a href="#" onclick="editGroup('.$group['Id'].');">'. validHtmlStr($group['Name']).'</a>';
} else {
echo validHtmlStr($group['Name']);
}
?></td>
<td class="colIds"><?php echo monitorIdsToNames( $group['MonitorIds'], 30 ) ?></td>
<td class="colSelect"><input type="radio" name="gid" value="<?php echo $group['Id'] ?>"<?php echo $group['selected']?' checked="checked"':'' ?> onclick="configureButtons( this );"/></td>
<td class="colSelect"><input type="checkbox" name="gid" value="<?php echo $group['Id'] ?>"<?php echo $group['selected']?' checked="checked"':'' ?> onclick="configureButtons(this);"/></td>
</tr>
<?php } ?>
<?php
if ( isset( $sub_groups[$group['Id']] ) ) {
foreach ( $sub_groups[$group['Id']] as $group ) {
?>
<tr>
<td>&nbsp;</td>
<td class="colName">
<?php
if ( canEdit('Groups') ) {
echo '<a href="#" onclick="editGroup(this);">'. validHtmlStr($group['Name']).'</a>';
} else {
echo validHtmlStr($group['Name']);
}
?></td>
<td class="colIds"><?php echo monitorIdsToNames( $group['MonitorIds'], 30 ) ?></td>
<td class="colSelect"><input type="checkbox" name="gid" value="<?php echo $group['Id'] ?>"<?php echo $group['selected']?' checked="checked"':'' ?> onclick="configureButtons(this);"/></td>
</tr>
<?php
} # end foreach subgroup
} # end if has subgroups
} # end foreach root group
?>
</tbody>
</table>
<div id="contentButtons">
<input type="submit" value="<?php echo translate('Apply') ?>"/>
<input type="button" value="<?php echo translate('New') ?>" onclick="newGroup()"<?php echo canEdit('Groups')?'':' disabled="disabled"' ?>/>
<input type="button" name="editBtn" value="<?php echo translate('Edit') ?>" onclick="editGroup( this )"<?php echo $selected&&canEdit('Groups')?'':' disabled="disabled"' ?>/>
<input type="button" name="deleteBtn" value="<?php echo translate('Delete') ?>" onclick="deleteGroup( this )"<?php echo $selected&&canEdit('Groups')?'':' disabled="disabled"' ?>/>
<input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow();"/>
<input type="button" value="<?php echo translate('New') ?>" onclick="newGroup();"<?php echo canEdit('Groups')?'':' disabled="disabled"' ?>/>
<input type="button" name="deleteBtn" value="<?php echo translate('Delete') ?>" onclick="deleteGroup(this);"<?php echo $selected&&canEdit('Groups')?'':' disabled="disabled"' ?>/>
</div>
</form>
</div>

View File

@ -1,5 +1,5 @@
function nextCycleView() {
window.location.replace( '?view=cycle&group='+currGroup+'&mid='+nextMid+'&mode='+mode, cycleRefreshTimeout );
window.location.replace( '?view=cycle&mid='+nextMid+'&mode='+mode, cycleRefreshTimeout );
}
function initCycle() {

View File

@ -1,4 +1,3 @@
var currGroup = "<?php echo isset($_REQUEST['group'])?validJsStr($_REQUEST['group']):'' ?>";
var nextMid = "<?php echo isset($nextMid)?$nextMid:'' ?>";
var mode = "<?php echo $mode ?>";

View File

@ -9,7 +9,12 @@ if ( refreshParent ) {
function configureButtons( element ) {
if ( canEditGroups ) {
var form = element.form;
form.saveBtn.disabled = (element.value == 0);
var disabled = false;
if ( form.elements['newGroup[Name]'].value == '' ) {
disabled = true;
}
form.saveBtn.disabled = disabled;
}
}

View File

@ -2,20 +2,14 @@ function newGroup() {
createPopup( '?view=group', 'zmGroup', 'group' );
}
function editGroup( element ) {
function setGroup( element ) {
var form = element.form;
form.action.value = 'setgroup';
form.submit();
}
function editGroup( element ) {
var form = element.form;
for ( var i = 0; i < form.gid.length; i++ ) {
if ( form.gid[i].checked ) {
createPopup( '?view=group&gid='+form.gid[i].value, 'zmGroup', 'group' );
return;
}
}
function editGroup( gid ) {
createPopup( '?view=group&gid='+gid, 'zmGroup', 'group' );
}
function deleteGroup( element ) {
@ -29,7 +23,6 @@ function configureButtons( element ) {
if ( canEditGroups ) {
var form = element.form;
if ( element.checked ) {
form.editBtn.disabled = (element.value == 0);
form.deleteBtn.disabled = (element.value == 0);
}
}

View File

@ -209,12 +209,6 @@ function changeScale() {
Cookie.write( 'zmMontageHeight', '', { duration: 10*365 } );
}
function changeGroup() {
var group_id = $('group').get('value');
Cookie.write( 'zmMontageGroup', group_id, { duration: 10*365 } );
window.location = window.location;
}
var monitors = new Array();
function initPage() {
for ( var i = 0; i < monitorData.length; i++ ) {

View File

@ -289,16 +289,10 @@ function drawGraph()
return;
}
function redrawScreen()
{
if(fitMode==0) // if we fit, then monitors were absolutely positioned already (or will be) otherwise release them to float
{
for(var i=0; i<numMonitors; i++)
monitorCanvasObj[monitorPtr[i]].style.position="";
$('monitors').setStyle('height',"auto");
}
if(liveMode==1) // if we are not in live view switch to history -- this has to come before fit in case we re-establish the timeline
{
function redrawScreen() {
if ( liveMode == 1 ) {
// if we are not in live view switch to history -- this has to come before fit in case we re-establish the timeline
$('DateTimeDiv').style.display="none";
$('SpeedDiv').style.display="none";
$('timelinediv').style.display="none";
$('live').innerHTML="History";
@ -307,9 +301,9 @@ function redrawScreen()
$('panleft').style.display="none";
$('panright').style.display="none";
}
else // switch out of liveview mode
{
} else {
// switch out of liveview mode
$('DateTimeDiv').style.display="inline";
$('SpeedDiv').style.display="inline";
$('SpeedDiv').style.display="inline-flex";
$('timelinediv').style.display=null;
@ -324,8 +318,7 @@ function redrawScreen()
$('panright').style.display="inline-flex";
}
if(fitMode==1)
{
if ( fitMode == 1 ) {
$('ScaleDiv').style.display="none";
$('fit').innerHTML="Scale";
var vh=window.innerHeight;
@ -335,9 +328,12 @@ function redrawScreen()
$('monitors').setStyle('height',mh.toString() + "px"); // leave a small gap at bottom
if(maxfit2($('monitors').getSize().x,$('monitors').getSize().y) == 0) /// if we fail to fix we back out of fit mode -- ??? This may need some better handling
fitMode=1-fitMode;
}
else // switch out of fit mode
{
} else {
// switch out of fit mode
// if we fit, then monitors were absolutely positioned already (or will be) otherwise release them to float
for( var i=0; i<numMonitors; i++ )
monitorCanvasObj[monitorPtr[i]].style.position="";
$('monitors').setStyle('height',"auto");
$('ScaleDiv').style.display="inline";
$('ScaleDiv').style.display="inline-flex";
$('fit').innerHTML="Fit";
@ -349,15 +345,13 @@ function redrawScreen()
}
function outputUpdate(val)
{
drawSliderOnGraph(val);
for(var i=0; i<numMonitors; i++)
{
loadImage2Monitor(monitorPtr[i],SetImageSource(monitorPtr[i],val));
}
var currentTimeMS = new Date(val*1000);
currentTimeSecs=val;
function outputUpdate(val) {
drawSliderOnGraph(val);
for(var i=0; i<numMonitors; i++) {
loadImage2Monitor(monitorPtr[i],SetImageSource(monitorPtr[i],val));
}
var currentTimeMS = new Date(val*1000);
currentTimeSecs=val;
}
@ -398,16 +392,18 @@ function mmove(event) {
}
}
function secs2dbstr (s)
{
var st = (new Date(s * 1000)).format("%Y-%m-%d %H:%M:%S");
return st;
function secs2inputstr (s) {
var st = (new Date(s * 1000)).format("%Y-%m-%dT%H:%M:%S");
return st;
}
function secs2dbstr (s) {
var st = (new Date(s * 1000)).format("%Y-%m-%d %H:%M:%S");
return st;
}
function setFit(value)
{
fitMode=value;
redrawScreen();
function setFit(value) {
fitMode=value;
redrawScreen();
}
function showScale(newscale) // updates slider only
@ -455,19 +451,22 @@ function setLive(value)
function clicknav(minSecs,maxSecs,arch,live) {// we use the current time if we can
var now = new Date() / 1000;
var minStr="";
var maxStr="";
var currentStr="";
var minStr = "";
var maxStr = "";
var currentStr = "";
if ( minSecs > 0 ) {
if(maxSecs > now)
maxSecs = parseInt(now);
maxStr="&maxTime=" + secs2dbstr(maxSecs);
maxStr="&maxTime=" + secs2inputstr(maxSecs);
$('maxTime').value = secs2inputstr(maxSecs);
}
if ( minSecs > 0 ) {
$('minTime').value = secs2inputstr(minSecs);
minStr="&minTime=" + secs2inputstr(minSecs);
}
if ( maxSecs > 0 )
minStr="&minTime=" + secs2dbstr(minSecs);
if ( maxSecs == 0 && minSecs == 0 ) {
minStr="&minTime=01/01/1950 12:00:00";
maxStr="&maxTime=12/31/2035 12:00:00";
minStr="&minTime=01/01/1950T12:00:00";
maxStr="&maxTime=12/31/2035T12:00:00";
}
var intervalStr="&displayinterval=" + currentDisplayInterval.toString();
if ( minSecs && maxSecs ) {
@ -488,7 +487,7 @@ function clicknav(minSecs,maxSecs,arch,live) {// we use the current time if we c
if ( monitorZoomScale[monitorPtr[i]] < 0.99 || monitorZoomScale[monitorPtr[i]] > 1.01 ) // allow for some up/down changes and just treat as 1 of almost 1
zoomStr += "&z" + monitorPtr[i].toString() + "=" + monitorZoomScale[monitorPtr[i]].toFixed(2);
var uri = "?view=" + currentView + fitStr + groupStr + minStr + maxStr + currentStr + intervalStr + liveStr + zoomStr + "&scale=" + scale[$j("#scaleslider")[0].value] + "&speed=" + speeds[$j("#speedslider")[0].value];
var uri = "?view=" + currentView + fitStr + groupStr + minStr + maxStr + currentStr + intervalStr + liveStr + zoomStr + "&scale=" + $j("#scaleslider")[0].value + "&speed=" + speeds[$j("#speedslider")[0].value];
window.location = uri;
} // end function clickNav
@ -686,12 +685,8 @@ function clickMonitor(event,monId) {
return;
}
function changeGroup() {
var group_id = $('group').get('value');
Cookie.write( 'zmMontageReviewGroup', group_id, { duration: 10*365 } );
var url = window.location.href;
url = url.replace(/group=\d+/, 'group='+group_id);
window.location.href = url;
function changeDateTime(e) {
e.form.submit();
}
// >>>>>>>>> Initialization that runs on window load by being at the bottom

View File

@ -18,28 +18,43 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
if ( !canView( 'Stream' ) ) {
if ( !canView('Stream') ) {
$view = 'error';
return;
}
require_once( 'includes/Monitor.php' );
require_once( 'includes/Group.php' );
$groupSql = '';
$group_id = null;
if ( !empty($_REQUEST['group']) ) {
$group_id = 0;
if ( isset($_REQUEST['group']) ) {
$group_id = $_REQUEST['group'];
} elseif ( isset( $_COOKIE['zmMontageGroup'] ) ) {
$group_id = $_COOKIE['zmMontageGroup'];
} else if ( isset($_COOKIE['zmGroup'] ) ) {
$group_id = $_COOKIE['zmGroup'];
}
if ( $group_id ) {
$row = dbFetchOne( 'SELECT * FROM Groups WHERE Id = ?', NULL, array($group_id) );
$sql = "SELECT * FROM Monitors WHERE Function != 'None' AND find_in_set( Id, '".$row['MonitorIds']."' ) ORDER BY Sequence";
} else {
$sql = "SELECT * FROM Monitors WHERE Function != 'None' ORDER BY Sequence";
$subgroup_id = 0;
if ( isset($_REQUEST['subgroup']) ) {
$subgroup_id = $_REQUEST['subgroup'];
} else if ( isset($_COOKIE['zmSubGroup'] ) ) {
$subgroup_id = $_COOKIE['zmSubGroup'];
}
$groupIds = null;
if ( $group_id ) {
$groupIds = array();
if ( $group = dbFetchOne( 'SELECT MonitorIds FROM Groups WHERE Id = ?', NULL, array($group_id) ) )
if ( $group['MonitorIds'] )
$groupIds = explode( ',', $group['MonitorIds'] );
if ( $subgroup_id ) {
if ( $group = dbFetchOne( 'SELECT MonitorIds FROM Groups WHERE Id = ?', NULL, array($subgroup_id) ) )
if ( $group['MonitorIds'] )
$groupIds = array_merge( $groupIds, explode( ',', $group['MonitorIds'] ) );
} else {
foreach ( dbFetchAll( 'SELECT MonitorIds FROM Groups WHERE ParentId = ?', NULL, array($group_id) ) as $group )
if ( $group['MonitorIds'] )
$groupIds = array_merge( $groupIds, explode( ',', $group['MonitorIds'] ) );
}
}
$groupSql = '';
if ( $groupIds )
$groupSql = " and find_in_set( Id, '".implode( ',', $groupIds )."' )";
$showControl = false;
$showZones = false;
@ -76,6 +91,7 @@ if ( isset( $_REQUEST['scale'] ) ) {
if ( ! $scale )
$scale = 100;
$sql = "SELECT * FROM Monitors WHERE Function != 'None'$groupSql ORDER BY Sequence";
foreach( dbFetchAll( $sql ) as $row ) {
if ( !visibleMonitor( $row['Id'] ) ) {
continue;
@ -126,6 +142,7 @@ xhtmlHeaders(__FILE__, translate('Montage') );
?>
<body>
<div id="page">
<?php echo getNavBarHTML() ?>
<div id="header">
<div id="headerButtons">
<?php
@ -150,12 +167,18 @@ if ( $showZones ) {
<div id="headerControl">
<span id="groupControl"><label><?php echo translate('Group') ?>:</label>
<?php
$groups = array(0=>'All');
foreach ( Group::find_all() as $Group ) {
$groups[$Group->Id()] = $Group->Name();
}
echo htmlSelect( 'group', $groups, $group_id, 'changeGroup(this);' );
$groups = array(0=>'All');
foreach ( Group::find_all( array('ParentId'=>null) ) as $Group ) {
$groups[$Group->Id()] = $Group->Name();
}
echo htmlSelect( 'group', $groups, $group_id, 'changeGroup(this);' );
$groups = array(0=>'All');
if ( $group_id ) {
foreach ( Group::find_all( array('ParentId'=>$group_id) ) as $Group ) {
$groups[$Group->Id()] = $Group->Name();
}
}
echo htmlSelect( 'subgroup', $groups, $subgroup_id, 'changeSubGroup(this);' );
?>
</span>

View File

@ -54,24 +54,48 @@ if ( !canView( 'Events' ) ) {
return;
}
require_once( 'includes/Monitor.php' );
require_once( 'includes/Group.php' );
$groupSql = '';
$group_id = null;
if ( !empty($_REQUEST['group']) ) {
$group_id = 0;
if ( isset($_REQUEST['group']) ) {
$group_id = $_REQUEST['group'];
} elseif ( isset( $_COOKIE['zmMontageReviewGroup'] ) ) {
$group_id = $_COOKIE['zmMontageReviewGroup'];
} else if ( isset($_COOKIE['zmGroup'] ) ) {
$group_id = $_COOKIE['zmGroup'];
}
# FIXME THere is no way to select group at this time.
if ( isset( $group_id ) and $group_id ) {
$row = dbFetchOne( 'SELECT * FROM Groups WHERE Id = ?', NULL, array($group_id) );
$monitorsSql = "SELECT * FROM Monitors WHERE Function != 'None' AND find_in_set( Id, '".$row['MonitorIds']."' ) ";
} else {
$monitorsSql = "SELECT * FROM Monitors WHERE Function != 'None'";
$subgroup_id = 0;
if ( isset($_REQUEST['subgroup']) ) {
$subgroup_id = $_REQUEST['subgroup'];
} else if ( isset($_COOKIE['zmSubGroup'] ) ) {
$subgroup_id = $_COOKIE['zmSubGroup'];
}
$groupIds = null;
if ( $group_id ) {
$groupIds = array();
if ( $group = dbFetchOne( 'SELECT MonitorIds FROM Groups WHERE Id = ?', NULL, array($group_id) ) )
if ( $group['MonitorIds'] )
$groupIds = explode( ',', $group['MonitorIds'] );
if ( $subgroup_id ) {
if ( $group = dbFetchOne( 'SELECT MonitorIds FROM Groups WHERE Id = ?', NULL, array($subgroup_id) ) )
if ( $group['MonitorIds'] )
$groupIds = array_merge( $groupIds, explode( ',', $group['MonitorIds'] ) );
} else {
foreach ( dbFetchAll( 'SELECT MonitorIds FROM Groups WHERE ParentId = ?', NULL, array($group_id) ) as $group )
if ( $group['MonitorIds'] )
$groupIds = array_merge( $groupIds, explode( ',', $group['MonitorIds'] ) );
}
}
$groupSql = '';
if ( $groupIds )
$groupSql = " and find_in_set( Id, '".implode( ',', $groupIds )."' )";
session_start();
foreach ( array('minTime','maxTime') as $var ) {
if ( isset( $_REQUEST[$var] ) ) {
$_SESSION[$var] = $_REQUEST[$var];
}
}
session_write_close();
$monitorsSql = "SELECT * FROM Monitors WHERE Function != 'None'$groupSql";
// 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)
@ -132,6 +156,7 @@ if ( (strtotime($maxTime) - strtotime($minTime))/(365*24*3600) > 30 ) {
$maxTime = null;
}
$fitMode=1;
if (isset($_REQUEST['fit']) && $_REQUEST['fit']=='0' )
$fitMode = 0;
@ -198,59 +223,70 @@ input[type=range]::-ms-tooltip {
</style>
<body>
<div id="page">
<?php echo getNavBarHTML() ?>
<form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="get">
<input type="hidden" name="view" value="montagereview"/>
<div id="header">
<div id="headerButtons">
<a href="#" onclick="closeWindow();"><?php echo translate('Close') ?></a>
</div>
<h2><?php echo translate('MontageReview') ?></h2>
<div id="headerControl">
<span id="groupControl"><label><?php echo translate('Group') ?>:</label>
<?php
$groups = array(0=>'All');
foreach ( Group::find_all() as $Group ) {
foreach ( Group::find_all(array('ParentId'=>null)) as $Group ) {
$groups[$Group->Id()] = $Group->Name();
}
echo htmlSelect( 'group', $groups, $group_id, 'changeGroup(this);' );
$groups = array(0=>'All');
if ( $group_id ) {
foreach ( Group::find_all( array('ParentId'=>$group_id) ) as $Group ) {
$groups[$Group->Id()] = $Group->Name();
}
}
echo htmlSelect( 'subgroup', $groups, $subgroup_id, 'changeSubGroup(this);' );
?>
</span>
<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="maxTime" id="maxTime" value="<?php echo preg_replace('/ /', 'T', $maxTime ) ?>" onchange="changeDateTime(this);">
</div>
<div id="ScaleDiv">
<label for="scaleslider"><?php echo translate('Scale')?></label>
<input id="scaleslider" type="range" min="0.1" max="1.0" value="<?php echo $defaultScale ?>" step="0.10" onchange="setScale(this.value);" oninput="showScale(this.value);"/>
<span id="scaleslideroutput"><?php echo number_format((float)$defaultScale,2,'.','')?> x</span>
</div>
<div id="SpeedDiv">
<label for="speedslider"><?php echo translate('Speed') ?></label>
<input id="speedslider" type="range" min="0" max="<?php echo count($speeds)-1?>" value="<?php echo $speedIndex ?>" step="1" onchange="setSpeed(this.value);" oninput="showSpeed(this.value);"/>
<span id="speedslideroutput"><?php echo $speeds[$speedIndex] ?> fps</span>
</div>
<div style="display: inline-flex; border: 1px solid black; flex-flow: row wrap;">
<button type="button" id="panleft" onclick="panleft();" >&lt; <?php echo translate('Pan') ?></button>
<button type="button" id="zoomin" onclick="zoomin();" ><?php echo translate('In +') ?></button>
<button type="button" id="zoomout" onclick="zoomout();" ><?php echo translate('Out -') ?></button>
<button type="button" id="lasteight" onclick="lastEight();" ><?php echo translate('8 Hour') ?></button>
<button type="button" id="lasthour" onclick="lastHour();" ><?php echo translate('1 Hour') ?></button>
<button type="button" id="allof" onclick="allof();" ><?php echo translate('All Events') ?></button>
<button type="button" id="live" onclick="setLive(1-liveMode);"><?php echo translate('Live') ?></button>
<button type="button" id="fit" onclick="setFit(1-fitMode);" ><?php echo translate('Fit') ?></button>
<button type="button" id="panright" onclick="panright();" ><?php echo translate('Pan') ?> &gt;</button>
</div>
<div id="timelinediv">
<canvas id="timeline" onmousemove="mmove(event);" ontouchmove="tmove(event);" onmousedown="mdown(event);" onmouseup="mup(event);" onmouseout="mout(event);"></canvas>
<span id="scrubleft"></span>
<span id="scrubright"></span>
<span id="scruboutput"></span>
</div>
</div>
</div>
<div id="ScaleDiv">
<label for="scaleslider"><?php echo translate('Scale')?></label>
<input id="scaleslider" type="range" min="0.1" max="1.0" value="<?php echo $defaultScale ?>" step="0.10" onchange="setScale(this.value);" oninput="showScale(this.value);"/>
<span id="scaleslideroutput"><?php echo number_format((float)$defaultScale,2,'.','')?> x</span>
</div>
<div id="SpeedDiv">
<label for="speedslider"><?php echo translate('Speed') ?></label>
<input id="speedslider" type="range" min="0" max="<?php echo count($speeds)-1?>" value="<?php echo $speedIndex ?>" step="1" onchange="setSpeed(this.value);" oninput="showSpeed(this.value);"/>
<span id="speedslideroutput"><?php echo $speeds[$speedIndex] ?> fps</span>
</div>
<div style="display: inline-flex; border: 1px solid black; flex-flow: row wrap;">
<button type="button" id="panleft" onclick="panleft();" >&lt; <?php echo translate('Pan') ?></button>
<button type="button" id="zoomin" onclick="zoomin();" ><?php echo translate('In +') ?></button>
<button type="button" id="zoomout" onclick="zoomout();" ><?php echo translate('Out -') ?></button>
<button type="button" id="lasteight" onclick="lastEight();" ><?php echo translate('8 Hour') ?></button>
<button type="button" id="lasthour" onclick="lastHour();" ><?php echo translate('1 Hour') ?></button>
<button type="button" id="allof" onclick="allof();" ><?php echo translate('All Events') ?></button>
<button type="button" id="live" onclick="setLive(1-liveMode);"><?php echo translate('Live') ?></button>
<button type="button" id="fit" onclick="setFit(1-fitMode);" ><?php echo translate('Fit') ?></button>
<button type="button" id="panright" onclick="panright();" ><?php echo translate('Pan') ?> &gt;</button>
</div>
<div id="timelinediv">
<canvas id="timeline" onmousemove="mmove(event);" ontouchmove="tmove(event);" onmousedown="mdown(event);" onmouseup="mup(event);" onmouseout="mout(event);"></canvas>
<span id="scrubleft"></span>
<span id="scrubright"></span>
<span id="scruboutput"></span>
</div>
<div id="monitors">
</div>
</form>
<div id="monitors">
<?php
// Monitor images - these had to be loaded after the monitors used were determined (after loading events)
foreach ($monitors as $m) {
echo '<canvas width="' . $m->Width() * $defaultScale . 'px" height="' . $m->Height() * $defaultScale . 'px" id="Monitor' . $m->Id() . '" style="border:3px solid ' . $m->WebColour() . '" onclick="clickMonitor(event,' . $m->Id() . ')">No Canvas Support!!</canvas>';
}
// Monitor images - these had to be loaded after the monitors used were determined (after loading events)
foreach ($monitors as $m) {
echo '<canvas width="' . $m->Width() * $defaultScale . 'px" height="' . $m->Height() * $defaultScale . 'px" id="Monitor' . $m->Id() . '" style="border:3px solid ' . $m->WebColour() . '" onclick="clickMonitor(event,' . $m->Id() . ')">No Canvas Support!!</canvas>';
}
?>
</div>
<p id="fps">evaluating fps</p>
</div>
<p id="fps">evaluating fps</p>
</div>
</body>

View File

@ -18,10 +18,9 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
if ( !canView( 'System' ) )
{
$view = "error";
return;
if ( !canView( 'System' ) ) {
$view = 'error';
return;
}
$canEdit = canEdit( 'System' );
@ -45,9 +44,9 @@ $tabs['lowband'] = translate('LowBW');
$tabs['users'] = translate('Users');
if ( isset($_REQUEST['tab']) )
$tab = validHtmlStr($_REQUEST['tab']);
$tab = validHtmlStr($_REQUEST['tab']);
else
$tab = "system";
$tab = 'system';
$focusWindow = true;
@ -55,7 +54,7 @@ xhtmlHeaders( __FILE__, translate('Options') );
# Have to do this stuff up here before including header.php because fof the cookie setting
$skin_options = array_map( 'basename', glob('skins/*',GLOB_ONLYDIR) );
if($tab == 'skins') {
if ( $tab == 'skins' ) {
$current_skin = $_COOKIE['zmSkin'];
$reload = false;
if ( isset($_GET['skin-choice']) && ( $_GET['skin-choice'] != $current_skin ) ) {
@ -76,45 +75,42 @@ if($tab == 'skins') {
?>
<body>
<?php echo getNavBarHTML(); ?>
<div class="container-fluid">
<div class="row">
<div class="col-sm-2 sidebar">
<ul class="nav nav-pills nav-stacked">
<div class="container-fluid">
<div class="row">
<div class="col-sm-2 sidebar">
<ul class="nav nav-pills nav-stacked">
<?php
foreach ( $tabs as $name=>$value )
{
foreach ( $tabs as $name=>$value ) {
?>
<li<?php echo $tab == $name ? ' class="active"' : '' ?>><a href="?view=<?php echo $view ?>&amp;tab=<?php echo $name ?>"><?php echo $value ?></a></li>
<li<?php echo $tab == $name ? ' class="active"' : '' ?>><a href="?view=<?php echo $view ?>&amp;tab=<?php echo $name ?>"><?php echo $value ?></a></li>
<?php
}
?>
</ul>
</div>
<div class="col-sm-10 col-sm-offset-2">
<div id="options">
</ul>
</div>
<div class="col-sm-10 col-sm-offset-2">
<div id="options">
<?php
if($tab == 'skins') {
if ( $tab == 'skins' ) {
?>
<form name="optionsForm" class="form-horizontal" method="get" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<input type="hidden" name="view" value="<?php echo $view ?>"/>
<input type="hidden" name="tab" value="<?php echo $tab ?>"/>
<form name="optionsForm" class="form-horizontal" method="get" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<input type="hidden" name="view" value="<?php echo $view ?>"/>
<input type="hidden" name="tab" value="<?php echo $tab ?>"/>
<div class="form-group">
<label for="skin-choice" class="col-sm-3 control-label">SKIN</label>
<div class="col-sm-6">
<select name="skin-choice" class="form-control">
<?php
foreach($skin_options as $dir) {
echo '<option value="'.$dir.'" '.($current_skin==$dir ? 'SELECTED="SELECTED"' : '').'>'.$dir.'</option>';
}
?>
</select>
<span class="help-block"><?php echo translate('SkinDescription'); ?></span>
</div>
</div>
<div class="form-group">
<label for="skin-choice" class="col-sm-3 control-label">ZM_SKIN</label>
<div class="col-sm-6">
<select name="skin-choice" class="form-control">
<?php
foreach($skin_options as $dir) {
echo '<option value="'.$dir.'" '.($current_skin==$dir ? 'SELECTED="SELECTED"' : '').'>'.$dir.'</option>';
}
?>
</select>
<span class="help-block"><?php echo translate('SkinDescription'); ?></span>
</div>
</div>
<div class="form-group">
<label for="css-choice" class="col-sm-3 control-label">ZM_CSS</label>
<label for="css-choice" class="col-sm-3 control-label">CSS</label>
<div class="col-sm-6">
<select name="css-choice" class="form-control">
<?php