whitespace corrections and ensure that options[width] and options[height] are defined

This commit is contained in:
Isaac Connor 2017-03-20 12:10:28 -04:00
parent eba6cec7a1
commit 70246ce55a
1 changed files with 42 additions and 38 deletions

View File

@ -27,55 +27,55 @@ require_once( 'includes/Monitor.php' );
$groupSql = '';
if ( !empty($_REQUEST['group']) ) {
$row = dbFetchOne( 'select * from Groups where Id = ?', NULL, array($_REQUEST['group']) );
$sql = "select * from Monitors where Function != 'None' and find_in_set( Id, '".$row['MonitorIds']."' ) order by Sequence";
$row = dbFetchOne( 'select * from Groups where Id = ?', NULL, array($_REQUEST['group']) );
$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";
$sql = "select * from Monitors where Function != 'None' order by Sequence";
}
$showControl = false;
$monitors = array();
$widths = array(
'' => 'auto',
160 => 160,
320 => 320,
352 => 352,
640 => 640,
1280 => 1280 );
'' => 'auto',
160 => 160,
320 => 320,
352 => 352,
640 => 640,
1280 => 1280 );
$heights = array(
'' => 'auto',
240 => 240,
480 => 480,
'' => 'auto',
240 => 240,
480 => 480,
);
foreach( dbFetchAll( $sql ) as $row ) {
if ( !visibleMonitor( $row['Id'] ) ) {
continue;
}
if ( !visibleMonitor( $row['Id'] ) ) {
continue;
}
$scale = null;
if ( isset( $_REQUEST['scale'] ) )
$scale = validInt($_REQUEST['scale']);
else if ( isset( $_COOKIE['zmMontageScale'] ) )
$scale = $_COOKIE['zmMontageScale'];
#else
#$scale = reScale( SCALE_BASE, $row['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
if ( isset( $_REQUEST['scale'] ) )
$scale = validInt($_REQUEST['scale']);
else if ( isset( $_COOKIE['zmMontageScale'] ) )
$scale = $_COOKIE['zmMontageScale'];
#else
#$scale = reScale( SCALE_BASE, $row['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
$row['Scale'] = $scale;
$row['PopupScale'] = reScale( SCALE_BASE, $row['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
$row['Scale'] = $scale;
$row['PopupScale'] = reScale( SCALE_BASE, $row['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
if ( ZM_OPT_CONTROL && $row['ControlId'] )
$showControl = true;
$row['connKey'] = generateConnKey();
$monitors[] = new Monitor( $row );
if ( ! isset( $widths[$row['Width']] ) ) {
$widths[$row['Width']] = $row['Width'];
}
if ( ! isset( $heights[$row['Height']] ) ) {
$heights[$row['Height']] = $row['Height'];
}
if ( ZM_OPT_CONTROL && $row['ControlId'] )
$showControl = true;
$row['connKey'] = generateConnKey();
$monitors[] = new Monitor( $row );
if ( ! isset( $widths[$row['Width']] ) ) {
$widths[$row['Width']] = $row['Width'];
}
if ( ! isset( $heights[$row['Height']] ) ) {
$heights[$row['Height']] = $row['Height'];
}
}
$focusWindow = true;
@ -94,8 +94,12 @@ if ( isset($_COOKIE['zmMontageLayout']) )
$options = array();
if ( isset($_COOKIE['zmMontageWidth']) and $_COOKIE['zmMontageWidth'] )
$options['width'] = $_COOKIE['zmMontageWidth'];
else
$options['width'] = '';
if ( isset($_COOKIE['zmMontageHeight']) and $_COOKIE['zmMontageHeight'] )
$options['height'] = $_COOKIE['zmMontageHeight'];
$options['height'] = $_COOKIE['zmMontageHeight'];
else
$options['height'] = '';
if ( $scale )
$options['scale'] = $scale;
@ -116,8 +120,8 @@ if ( $showControl ) {
</div>
<h2><?php echo translate('Montage') ?></h2>
<div id="headerControl">
<span id="widthControl"><label><?php echo translate('Width') ?>:</label><?php echo htmlSelect( 'width', $widths, $options['width'], 'changeWidth(this);' ); ?></span>
<span id="heightControl"><label><?php echo translate('Height') ?>:</label><?php echo htmlSelect( 'height', $heights, $options['height'], 'changeHeight(this);' ); ?></span>
<span id="widthControl"><label><?php echo translate('Width') ?>:</label><?php echo htmlSelect( 'width', $widths, $options['width'], 'changeWidth(this);' ); ?></span>
<span id="heightControl"><label><?php echo translate('Height') ?>:</label><?php echo htmlSelect( 'height', $heights, $options['height'], 'changeHeight(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', $layouts, $layout, 'selectLayout(this);' )?></span>
</div>
@ -131,7 +135,7 @@ foreach ( $monitors as $monitor ) {
<div id="monitorFrame<?php echo $monitor->Id() ?>" class="monitorFrame" title="<?php echo $monitor->Id() . ' ' .$monitor->Name() ?>">
<div id="monitor<?php echo $monitor->Id() ?>" class="monitor idle">
<div id="imageFeed<?php echo $monitor->Id() ?>" class="imageFeed" onclick="createPopup( '?view=watch&amp;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 echo getStreamHTML( $monitor, $options ); ?>
<?php echo getStreamHTML( $monitor, $options ); ?>
</div>
<?php
if ( !ZM_WEB_COMPACT_MONTAGE ) {