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']); $rate = validInt($_REQUEST['rate']);
else else
$rate = reScale( RATE_BASE, $event['DefaultRate'], ZM_WEB_DEFAULT_RATE ); $rate = reScale( RATE_BASE, $event['DefaultRate'], ZM_WEB_DEFAULT_RATE );
if ( isset( $_REQUEST['scale'] ) )
if ( isset( $_REQUEST['scale'] ) ) {
$scale = validInt($_REQUEST['scale']); $scale = validInt($_REQUEST['scale']);
else } else if ( isset( $_COOKIE['zmWatchScale'.$event['MonitorId'] ) ) {
$scale = $_COOKIE['zmEventScale'.$event['MonitorId'];
} else {
$scale = reScale( SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE ); $scale = reScale( SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
}
$replayModes = array( $replayModes = array(
'single' => translate('ReplaySingle'), 'single' => translate('ReplaySingle'),

View File

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

View File

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

View File

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

View File

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