|
|
|
@ -27,7 +27,7 @@ require_once('includes/MontageLayout.php');
|
|
|
|
|
|
|
|
|
|
$showControl = false;
|
|
|
|
|
$showZones = false;
|
|
|
|
|
if ( isset( $_REQUEST['showZones'] ) ) {
|
|
|
|
|
if ( isset($_REQUEST['showZones']) ) {
|
|
|
|
|
if ( $_REQUEST['showZones'] == 1 ) {
|
|
|
|
|
$showZones = true;
|
|
|
|
|
}
|
|
|
|
@ -51,7 +51,7 @@ $scale = '100'; # actual
|
|
|
|
|
if ( isset( $_REQUEST['scale'] ) ) {
|
|
|
|
|
$scale = validInt($_REQUEST['scale']);
|
|
|
|
|
Logger::Debug("Setting scale from request to $scale");
|
|
|
|
|
} else if ( isset( $_COOKIE['zmMontageScale'] ) ) {
|
|
|
|
|
} else if ( isset($_COOKIE['zmMontageScale']) ) {
|
|
|
|
|
$scale = $_COOKIE['zmMontageScale'];
|
|
|
|
|
Logger::Debug("Setting scale from cookie to $scale");
|
|
|
|
|
}
|
|
|
|
@ -65,7 +65,6 @@ foreach ( $layouts as $l ) {
|
|
|
|
|
$layoutsById[$l->Id()] = $l;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
session_start();
|
|
|
|
|
|
|
|
|
|
$layout_id = '';
|
|
|
|
@ -80,28 +79,29 @@ $Layout = '';
|
|
|
|
|
$Positions = '';
|
|
|
|
|
if ( $layout_id and is_numeric($layout_id) and isset($layoutsById[$layout_id]) ) {
|
|
|
|
|
$Layout = $layoutsById[$layout_id];
|
|
|
|
|
$Positions = json_decode( $Layout->Positions(), true );
|
|
|
|
|
$Positions = json_decode($Layout->Positions(), true);
|
|
|
|
|
}
|
|
|
|
|
if ( $Layout and ( $Layout->Name() != 'Freeform' ) ) {
|
|
|
|
|
// Use layout instead of other options
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( isset($_COOKIE['zmMontageWidth']) and $_COOKIE['zmMontageWidth'] ) {
|
|
|
|
|
if ( isset($_COOKIE['zmMontageWidth']) and $_COOKIE['zmMontageWidth'] ) {
|
|
|
|
|
$_SESSION['zmMontageWidth'] = $options['width'] = $_COOKIE['zmMontageWidth'];
|
|
|
|
|
} elseif ( isset($_SESSION['zmMontageWidth']) and $_SESSION['zmMontageWidth'] ) {
|
|
|
|
|
} elseif ( isset($_SESSION['zmMontageWidth']) and $_SESSION['zmMontageWidth'] ) {
|
|
|
|
|
$options['width'] = $_SESSION['zmMontageWidth'];
|
|
|
|
|
} else
|
|
|
|
|
} else
|
|
|
|
|
$options['width'] = '';
|
|
|
|
|
|
|
|
|
|
if ( isset($_COOKIE['zmMontageHeight']) and $_COOKIE['zmMontageHeight'] )
|
|
|
|
|
if ( isset($_COOKIE['zmMontageHeight']) and $_COOKIE['zmMontageHeight'] )
|
|
|
|
|
$_SESSION['zmMontageHeight'] = $options['height'] = $_COOKIE['zmMontageHeight'];
|
|
|
|
|
else if ( isset($_SESSION['zmMontageHeight']) and $_SESSION['zmMontageHeight'] )
|
|
|
|
|
else if ( isset($_SESSION['zmMontageHeight']) and $_SESSION['zmMontageHeight'] )
|
|
|
|
|
$options['height'] = $_SESSION['zmMontageHeight'];
|
|
|
|
|
else
|
|
|
|
|
else
|
|
|
|
|
$options['height'] = '';
|
|
|
|
|
|
|
|
|
|
if ( $scale )
|
|
|
|
|
if ( $scale )
|
|
|
|
|
$options['scale'] = $scale;
|
|
|
|
|
|
|
|
|
|
session_write_close();
|
|
|
|
|
|
|
|
|
|
ob_start();
|
|
|
|
@ -120,16 +120,16 @@ foreach( $displayMonitors as &$row ) {
|
|
|
|
|
if ( ZM_OPT_CONTROL && $row['ControlId'] && $row['Controllable'] )
|
|
|
|
|
$showControl = true;
|
|
|
|
|
$row['connKey'] = generateConnKey();
|
|
|
|
|
if ( ! isset( $widths[$row['Width']] ) ) {
|
|
|
|
|
if ( ! isset($widths[$row['Width']]) ) {
|
|
|
|
|
$widths[$row['Width']] = $row['Width'];
|
|
|
|
|
}
|
|
|
|
|
if ( ! isset( $heights[$row['Height']] ) ) {
|
|
|
|
|
if ( ! isset($heights[$row['Height']]) ) {
|
|
|
|
|
$heights[$row['Height']] = $row['Height'];
|
|
|
|
|
}
|
|
|
|
|
$monitors[] = new Monitor( $row );
|
|
|
|
|
$monitors[] = new Monitor($row);
|
|
|
|
|
} # end foreach Monitor
|
|
|
|
|
|
|
|
|
|
xhtmlHeaders(__FILE__, translate('Montage') );
|
|
|
|
|
xhtmlHeaders(__FILE__, translate('Montage'));
|
|
|
|
|
?>
|
|
|
|
|
<body>
|
|
|
|
|
<div id="page">
|
|
|
|
@ -139,7 +139,7 @@ xhtmlHeaders(__FILE__, translate('Montage') );
|
|
|
|
|
<?php
|
|
|
|
|
if ( $showControl ) {
|
|
|
|
|
?>
|
|
|
|
|
<a href="#" onclick="createPopup( '?view=control', 'zmControl', 'control' )"><?php echo translate('Control') ?></a>
|
|
|
|
|
<a href="#" onclick="createPopup('?view=control', 'zmControl', 'control')"><?php echo translate('Control') ?></a>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
if ( $showZones ) {
|
|
|
|
@ -153,21 +153,30 @@ if ( $showZones ) {
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</div>
|
|
|
|
|
<form method="get">
|
|
|
|
|
<input type="hidden" name="view" value="montage"/>
|
|
|
|
|
<form method="get">
|
|
|
|
|
<input type="hidden" name="view" value="montage"/>
|
|
|
|
|
<?php echo $filterbar ?>
|
|
|
|
|
</form>
|
|
|
|
|
</form>
|
|
|
|
|
<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="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_id, array( 'onchange'=>'selectLayout(this);', 'id'=>'zmMontageLayout') ); ?>
|
|
|
|
|
<?php echo htmlSelect('zmMontageLayout', $layoutsById, $layout_id, 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);"/>
|
|
|
|
@ -187,7 +196,10 @@ foreach ( $monitors as $monitor ) {
|
|
|
|
|
?>
|
|
|
|
|
<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() ); ?> );">
|
|
|
|
|
<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
|
|
|
|
|
$monitor_options = $options;
|
|
|
|
|
if ( $Positions ) {
|
|
|
|
@ -204,59 +216,67 @@ foreach ( $monitors as $monitor ) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( $monitor->Type() == "WebSite" ) {
|
|
|
|
|
echo getWebSiteUrl( 'liveStream'.$monitor->Id(), $monitor->Path(), reScale( $monitor->Width(), $scale ), reScale( $monitor->Height(), $scale ), $monitor->Name() );
|
|
|
|
|
if ( $monitor->Type() == 'WebSite' ) {
|
|
|
|
|
echo getWebSiteUrl(
|
|
|
|
|
'liveStream'.$monitor->Id(),
|
|
|
|
|
$monitor->Path(),
|
|
|
|
|
reScale($monitor->Width(), $scale),
|
|
|
|
|
reScale($monitor->Height(), $scale),
|
|
|
|
|
$monitor->Name()
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
echo getStreamHTML( $monitor, $monitor_options );
|
|
|
|
|
echo getStreamHTML($monitor, $monitor_options);
|
|
|
|
|
}
|
|
|
|
|
if ( $showZones ) {
|
|
|
|
|
$height = null;
|
|
|
|
|
$width = null;
|
|
|
|
|
if ( $options['width'] ) {
|
|
|
|
|
$width = $options['width'];
|
|
|
|
|
if ( ! $options['height'] ) {
|
|
|
|
|
if ( !$options['height'] ) {
|
|
|
|
|
$scale = (int)( 100 * $options['width'] / $monitor->Width() );
|
|
|
|
|
$height = reScale( $monitor->Height(), $scale );
|
|
|
|
|
$height = reScale($monitor->Height(), $scale);
|
|
|
|
|
}
|
|
|
|
|
} else if ( $options['height'] ) {
|
|
|
|
|
$height = $options['height'];
|
|
|
|
|
if ( ! $options['width'] ) {
|
|
|
|
|
if ( !$options['width'] ) {
|
|
|
|
|
$scale = (int)( 100 * $options['height'] / $monitor->Height() );
|
|
|
|
|
$width = reScale( $monitor->Width(), $scale );
|
|
|
|
|
$width = reScale($monitor->Width(), $scale);
|
|
|
|
|
}
|
|
|
|
|
} else if ( $scale ) {
|
|
|
|
|
$width = reScale( $monitor->Width(), $scale );
|
|
|
|
|
$height = reScale( $monitor->Height(), $scale );
|
|
|
|
|
$width = reScale($monitor->Width(), $scale);
|
|
|
|
|
$height = reScale($monitor->Height(), $scale);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$zones = array();
|
|
|
|
|
foreach( dbFetchAll( 'SELECT * FROM Zones WHERE MonitorId=? ORDER BY Area DESC', NULL, array($monitor->Id()) ) as $row ) {
|
|
|
|
|
$row['Points'] = coordsToPoints( $row['Coords'] );
|
|
|
|
|
foreach( dbFetchAll('SELECT * FROM Zones WHERE MonitorId=? ORDER BY Area DESC', NULL, array($monitor->Id()) ) as $row ) {
|
|
|
|
|
$row['Points'] = coordsToPoints($row['Coords']);
|
|
|
|
|
|
|
|
|
|
if ( $scale ) {
|
|
|
|
|
limitPoints( $row['Points'], 0, 0, $monitor->Width(), $monitor->Height() );
|
|
|
|
|
scalePoints( $row['Points'], $scale );
|
|
|
|
|
limitPoints($row['Points'], 0, 0, $monitor->Width(), $monitor->Height());
|
|
|
|
|
scalePoints($row['Points'], $scale);
|
|
|
|
|
} else {
|
|
|
|
|
limitPoints( $row['Points'], 0, 0,
|
|
|
|
|
limitPoints($row['Points'], 0, 0,
|
|
|
|
|
( $width ? $width-1 : $monitor->Width()-1 ),
|
|
|
|
|
( $height ? $height-1 : $monitor->Height()-1 )
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
$row['Coords'] = pointsToCoords( $row['Points'] );
|
|
|
|
|
$row['AreaCoords'] = preg_replace( '/\s+/', ',', $row['Coords'] );
|
|
|
|
|
$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 ) {
|
|
|
|
|
<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 ) {
|
|
|
|
|
echo '<polygon points="'. $zone['AreaCoords'] .'" class="'. $zone['Type'].'" />';
|
|
|
|
|
} // end foreach zone
|
|
|
|
|
} // end foreach zone
|
|
|
|
|
?>
|
|
|
|
|
Sorry, your browser does not support inline SVG
|
|
|
|
|
</svg>
|
|
|
|
|
<?php } # end if showZones ?>
|
|
|
|
|
</svg>
|
|
|
|
|
<?php
|
|
|
|
|
} # end if showZones
|
|
|
|
|
?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
if ( (!ZM_WEB_COMPACT_MONTAGE) && ($monitor->Type() != 'WebSite') ) {
|
|
|
|
@ -268,7 +288,7 @@ foreach ( $monitors as $monitor ) {
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
} # end foreach monitor
|
|
|
|
|
?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|