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