Merge branch 'cookie_scale' into storageareas

This commit is contained in:
Isaac Connor 2016-09-27 10:05:16 -04:00
commit 167214cb01
5 changed files with 35 additions and 34 deletions

View File

@ -41,10 +41,14 @@ if ( isset( $_REQUEST['rate'] ) )
$rate = validInt($_REQUEST['rate']);
else
$rate = reScale( RATE_BASE, $event['DefaultRate'], ZM_WEB_DEFAULT_RATE );
if ( isset( $_REQUEST['scale'] ) )
$scale = validInt($_REQUEST['scale']);
else
$scale = reScale( SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
if ( isset( $_REQUEST['scale'] ) ) {
$scale = validInt($_REQUEST['scale']);
} else if ( isset( $_COOKIE['zmWatchScale'.$event['MonitorId'] ) ) {
$scale = $_COOKIE['zmEventScale'.$event['MonitorId'];
} else {
$scale = reScale( SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
}
$replayModes = array(
'single' => translate('ReplaySingle'),

View File

@ -4,23 +4,24 @@ function setButtonState( element, butClass )
element.disabled = (butClass != 'inactive');
}
function changeScale()
{
var scale = $('scale').get('value');
var baseWidth = eventData.Width;
var baseHeight = eventData.Height;
var newWidth = ( baseWidth * scale ) / SCALE_BASE;
var newHeight = ( baseHeight * scale ) / SCALE_BASE;
function changeScale() {
var scale = $('scale').get('value');
var baseWidth = eventData.Width;
var baseHeight = eventData.Height;
var newWidth = ( baseWidth * scale ) / SCALE_BASE;
var newHeight = ( baseHeight * scale ) / SCALE_BASE;
if(vid) {
if ( vid ) {
// Using video.js
vid.width = newWidth;
vid.height = newHeight;
} else {
streamScale( scale );
streamScale( scale );
var streamImg = document.getElementById('evtStream');
streamImg.style.width = newWidth + "px";
streamImg.style.height = newHeight + "px";
}
Cookie.write( 'zmEventScale'+eventData.monitorId, scale, { duration: 10*365 } );
}
function changeReplayMode()

View File

@ -27,6 +27,7 @@ var connKey = '<?php echo $connkey ?>';
var eventData = {
Id: '<?php echo $event['Id'] ?>',
MonitorId: '<?php echo $event{'MonitorId'] ?>',
Width: '<?php echo $event['Width'] ?>',
Height: '<?php echo $event['Height'] ?>',
Length: '<?php echo $event['Length'] ?>'

View File

@ -32,8 +32,7 @@ function changeScale()
var newWidth = ( monitorWidth * scale ) / SCALE_BASE;
var newHeight = ( monitorHeight * scale ) / SCALE_BASE;
// This causes FF3 to kill the stream now, ok with FF2
//streamCmdScale( scale );
Cookie.write( 'zmWatchScale'+monitorId, scale, { duration: 10*365 } );
/*Stream could be an applet so can't use moo tools*/
var streamImg = document.getElementById('liveStream'+monitorId);

View File

@ -28,18 +28,21 @@ if ( !canView( 'Stream' ) ) {
// This is for input sanitation
$mid = intval( $_REQUEST['mid'] );
if ( ! visibleMonitor( $mid ) ) {
$view = 'error';
return;
$view = 'error';
return;
}
$monitor = new Monitor( $mid );
$showPtzControls = ( ZM_OPT_CONTROL && $monitor->Controllable() && canView( 'Control' ) );
if ( isset( $_REQUEST['scale'] ) )
$scale = validInt($_REQUEST['scale']);
else
$scale = reScale( SCALE_BASE, $monitor->DefaultScale(), ZM_WEB_DEFAULT_SCALE );
if ( isset( $_REQUEST['scale'] ) ) {
$scale = validInt($_REQUEST['scale']);
} else if ( isset( $_COOKIE['zmWatchScale'.$mid] ) ) {
$scale = $_COOKIE['zmWatchScale'.$mid];
} else {
$scale = reScale( SCALE_BASE, $monitor->DefaultScale(), ZM_WEB_DEFAULT_SCALE );
}
$connkey = generateConnKey();
@ -58,8 +61,7 @@ xhtmlHeaders( __FILE__, $monitor->Name()." - ".translate('Feed') );
<div id="closeControl"><a href="#" onclick="closeWindow(); return( false );"><?php echo translate('Close') ?></a></div>
<div id="menuControls">
<?php
if ( canView( 'Control' ) && $monitor->Type() == 'Local' )
{
if ( canView( 'Control' ) && $monitor->Type() == 'Local' ) {
?>
<div id="settingsControl"><?php echo makePopupLink( '?view=settings&amp;mid='.$monitor->Id(), 'zmSettings'.$monitor->Id(), 'settings', translate('Settings'), true, 'id="settingsLink"' ) ?></div>
<?php
@ -103,8 +105,7 @@ if ( canEdit( 'Monitors' ) ) {
<span id="zoom"><?php echo translate('Zoom') ?>: <span id="zoomValue"></span>x</span>
</div>
<?php
if ( $showPtzControls )
{
if ( $showPtzControls ) {
foreach ( getSkinIncludes( 'includes/control_functions.php' ) as $includeFile )
require_once $includeFile;
?>
@ -113,8 +114,7 @@ if ( $showPtzControls )
</div>
<?php
}
if ( canView( 'Events' ) )
{
if ( canView( 'Events' ) ) {
?>
<div id="events">
<table id="eventList" cellspacing="0">
@ -135,14 +135,12 @@ if ( canView( 'Events' ) )
</div>
<?php
}
if ( ZM_WEB_SOUND_ON_ALARM )
{
if ( ZM_WEB_SOUND_ON_ALARM ) {
$soundSrc = ZM_DIR_SOUNDS.'/'.ZM_WEB_ALARM_SOUND;
?>
<div id="alarmSound" class="hidden">
<?php
if ( ZM_WEB_USE_OBJECT_TAGS && isWindows() )
{
if ( ZM_WEB_USE_OBJECT_TAGS && isWindows() ) {
?>
<object id="MediaPlayer" width="0" height="0"
classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
@ -159,9 +157,7 @@ if ( ZM_WEB_SOUND_ON_ALARM )
</embed>
</object>
<?php
}
else
{
} else {
?>
<embed src="<?php echo $soundSrc ?>"
autostart="true"