Merge branch 'storageareas' of github.com:/ConnorTechnology/ZoneMinder into storageareas

This commit is contained in:
Isaac Connor 2017-05-19 13:49:57 -04:00
commit 4dc5f0060f
46 changed files with 2055 additions and 2818 deletions

View File

@ -331,12 +331,12 @@ function getVideoStreamHTML( $id, $src, $width, $height, $format, $title="" ) {
</embed>';
}
function outputImageStream( $id, $src, $width, $height, $title="" ) {
function outputImageStream( $id, $src, $width, $height, $title='' ) {
echo getImageStream( $id, $src, $width, $height, $title );
}
function getImageStream( $id, $src, $width, $height, $title="" ) {
function getImageStream( $id, $src, $width, $height, $title='' ) {
if ( canStreamIframe() ) {
return '<iframe id="'.$id.'" src="'.$src.'" alt="'. validHtmlStr($title) .'" '.($width? ' width="'. validInt($width).'"' : '').($height?' height="'.validInt($height).'"' : '' ).'/>';
} else {

View File

@ -175,9 +175,9 @@ foreach ( getSkinIncludes( 'skin.php' ) as $includeFile )
if ( ZM_OPT_USE_AUTH && ZM_AUTH_HASH_LOGINS ) {
if ( empty($user) && ! empty($_REQUEST['auth']) ) {
Debug("Getting user from auth hash");
Logger::Debug("Getting user from auth hash");
if ( $authUser = getAuthUser( $_REQUEST['auth'] ) ) {
Debug("Success Getting user from auth hash");
Logger::Debug("Success Getting user from auth hash");
userLogin( $authUser['Username'], $authUser['Password'], true );
}
} else if ( ! empty($user) ) {
@ -205,7 +205,7 @@ require_once( 'includes/actions.php' );
# If I put this here, it protects all views and popups, but it has to go after actions.php because actions.php does the actual logging in.
if ( ZM_OPT_USE_AUTH && ! isset($user) ) {
Debug("Redirecting to login" );
Logger::Debug("Redirecting to login" );
$view = 'login';
}

View File

@ -45,11 +45,11 @@
*/
.ptzControls .controlsPanel .upBtn {
background: url("../../graphics/arrow-l-u.gif") no-repeat 0 0;
background: url("../../graphics/arrow-l-u.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .downBtn {
background: url("../../graphics/arrow-l-d.gif") no-repeat 0 0;
background: url("../../graphics/arrow-l-d.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .focusControls {
@ -92,39 +92,39 @@
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .upLeftBtn {
background: url("../../graphics/arrow-ul.gif") no-repeat 0 0;
background: url("../../graphics/arrow-ul.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .upBtn {
background: url("../../graphics/arrow-u.gif") no-repeat 0 0;
background: url("../../graphics/arrow-u.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .upRightBtn {
background: url("../../graphics/arrow-ur.gif") no-repeat 0 0;
background: url("../../graphics/arrow-ur.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .leftBtn {
background: url("../../graphics/arrow-l.gif") no-repeat 0 0;
background: url("../../graphics/arrow-l.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .centerBtn {
background: url("../../graphics/center.gif") no-repeat 0 0;
background: url("../../graphics/center.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .rightBtn {
background: url("../../graphics/arrow-r.gif") no-repeat 0 0;
background: url("../../graphics/arrow-r.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .downLeftBtn {
background: url("../../graphics/arrow-dl.gif") no-repeat 0 0;
background: url("../../graphics/arrow-dl.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .downBtn {
background: url("../../graphics/arrow-d.gif") no-repeat 0 0;
background: url("../../graphics/arrow-d.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .downRightBtn {
background: url("../../graphics/arrow-dr.gif") no-repeat 0 0;
background: url("../../graphics/arrow-dr.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .powerControls {

View File

@ -45,11 +45,11 @@
*/
.ptzControls .controlsPanel .upBtn {
background: url("../../graphics/arrow-l-u.gif") no-repeat 0 0;
background: url("../../graphics/arrow-l-u.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .downBtn {
background: url("../../graphics/arrow-l-d.gif") no-repeat 0 0;
background: url("../../graphics/arrow-l-d.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .focusControls {
@ -92,39 +92,39 @@
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .upLeftBtn {
background: url("../../graphics/arrow-ul.gif") no-repeat 0 0;
background: url("../../graphics/arrow-ul.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .upBtn {
background: url("../../graphics/arrow-u.gif") no-repeat 0 0;
background: url("../../graphics/arrow-u.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .upRightBtn {
background: url("../../graphics/arrow-ur.gif") no-repeat 0 0;
background: url("../../graphics/arrow-ur.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .leftBtn {
background: url("../../graphics/arrow-l.gif") no-repeat 0 0;
background: url("../../graphics/arrow-l.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .centerBtn {
background: url("../../graphics/center.gif") no-repeat 0 0;
background: url("../../graphics/center.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .rightBtn {
background: url("../../graphics/arrow-r.gif") no-repeat 0 0;
background: url("../../graphics/arrow-r.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .downLeftBtn {
background: url("../../graphics/arrow-dl.gif") no-repeat 0 0;
background: url("../../graphics/arrow-dl.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .downBtn {
background: url("../../graphics/arrow-d.gif") no-repeat 0 0;
background: url("../../graphics/arrow-d.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .downRightBtn {
background: url("../../graphics/arrow-dr.gif") no-repeat 0 0;
background: url("../../graphics/arrow-dr.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .powerControls {

View File

@ -45,11 +45,11 @@
*/
.ptzControls .controlsPanel .upBtn {
background: url("../../graphics/arrow-l-u.gif") no-repeat 0 0;
background: url("../../graphics/arrow-l-u.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .downBtn {
background: url("../../graphics/arrow-l-d.gif") no-repeat 0 0;
background: url("../../graphics/arrow-l-d.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .focusControls {
@ -92,39 +92,39 @@
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .upLeftBtn {
background: url("../../graphics/arrow-ul.gif") no-repeat 0 0;
background: url("../../graphics/arrow-ul.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .upBtn {
background: url("../../graphics/arrow-u.gif") no-repeat 0 0;
background: url("../../graphics/arrow-u.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .upRightBtn {
background: url("../../graphics/arrow-ur.gif") no-repeat 0 0;
background: url("../../graphics/arrow-ur.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .leftBtn {
background: url("../../graphics/arrow-l.gif") no-repeat 0 0;
background: url("../../graphics/arrow-l.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .centerBtn {
background: url("../../graphics/center.gif") no-repeat 0 0;
background: url("../../graphics/center.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .rightBtn {
background: url("../../graphics/arrow-r.gif") no-repeat 0 0;
background: url("../../graphics/arrow-r.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .downLeftBtn {
background: url("../../graphics/arrow-dl.gif") no-repeat 0 0;
background: url("../../graphics/arrow-dl.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .downBtn {
background: url("../../graphics/arrow-d.gif") no-repeat 0 0;
background: url("../../graphics/arrow-d.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .pantiltPanel .pantiltControls .downRightBtn {
background: url("../../graphics/arrow-dr.gif") no-repeat 0 0;
background: url("../../graphics/arrow-dr.png") no-repeat 0 0;
}
.ptzControls .controlsPanel .powerControls {

View File

@ -10,8 +10,9 @@ table.filterTable {
}
#fieldsTable input[type=button] {
width: 1.6em;
width: 1.8em;
margin-left: 2px;
padding: 5px;
text-align: center;
}

View File

@ -22,8 +22,7 @@
// Don't load in additional JS to these views
$bad_views = array('monitor', 'log');
function xhtmlHeaders( $file, $title )
{
function xhtmlHeaders( $file, $title ) {
global $css;
global $skin;
$skinCssFile = getSkinFile( 'css/'.$css.'/skin.css' );
@ -55,14 +54,12 @@ function xhtmlHeaders( $file, $title )
<link rel="stylesheet" href="css/bootstrap.min.css" type="text/css"/>
<link rel="stylesheet" href="<?php echo $skinCssFile ?>" type="text/css" media="screen"/>
<?php
if ( $viewCssFile )
{
if ( $viewCssFile ) {
?>
<link rel="stylesheet" href="<?php echo $viewCssFile ?>" type="text/css" media="screen"/>
<?php
}
if ( $viewCssPhpFile )
{
if ( $viewCssPhpFile ) {
?>
<style type="text/css">
/*<![CDATA[*/
@ -102,10 +99,8 @@ var $j = jQuery.noConflict();
<script src="skins/<?php echo $skin ?>/js/video.js"></script>
<script src="./js/videojs.zoomrotate.js"></script>
<script src="skins/<?php echo $skin ?>/js/moment.min.js"></script>
<?php
}
if ( $skinJsPhpFile )
{
<?php }
if ( $skinJsPhpFile ) {
?>
<script type="text/javascript">
//<![CDATA[
@ -118,8 +113,7 @@ var $j = jQuery.noConflict();
</script>
<?php
}
if ( $viewJsPhpFile )
{
if ( $viewJsPhpFile ) {
?>
<script type="text/javascript">
//<![CDATA[
@ -139,8 +133,7 @@ var $j = jQuery.noConflict();
<script type="text/javascript" src="<?php echo $skinJsFile ?>"></script>
<script type="text/javascript" src="js/logger.js"></script>
<?php
if ( $viewJsFile )
{
if ( $viewJsFile ) {
?>
<script type="text/javascript" src="<?php echo $viewJsFile ?>"></script>
<?php

View File

@ -127,7 +127,8 @@ if ( canEdit( 'Events' ) ) {
<div id="editEvent"><a href="#" onclick="editEvent()"><?php echo translate('Edit') ?></a></div>
<div id="archiveEvent" class="hidden"><a href="#" onclick="archiveEvent()"><?php echo translate('Archive') ?></a></div>
<div id="unarchiveEvent" class="hidden"><a href="#" onclick="unarchiveEvent()"><?php echo translate('Unarchive') ?></a></div>
<?php if ( $Event->DefaultVideo() ) { ?>
<?php
if ( $Event->DefaultVideo() ) { ?>
<div id="downloadEventFile"><a href="<?php echo $Event->getStreamSrc()?>">Download MP4</a></div>
<?php
} // end if Event->DefaultVideo
@ -169,14 +170,14 @@ if ( $Event->DefaultVideo() ) {
<div id="imageFeed" <?php if ( $Event->DefaultVideo() ) { ?>class="hidden"<?php } ?> >
<?php
if ( ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT ) {
$streamSrc = getStreamSrc( array( "source=event", "mode=mpeg", "event=".$eid, "frame=".$fid, "scale=".$scale, "rate=".$rate, "bitrate=".ZM_WEB_VIDEO_BITRATE, "maxfps=".ZM_WEB_VIDEO_MAXFPS, "format=".ZM_MPEG_REPLAY_FORMAT, "replay=".$replayMode ) );
outputVideoStream( "evtStream", $streamSrc, reScale( $Event->Width(), $scale ), reScale( $Event->Height(), $scale ), ZM_MPEG_LIVE_FORMAT );
$streamSrc = getStreamSrc( array( 'source=event', 'mode=mpeg', 'event='.$eid, 'frame='.$fid, 'scale='.$scale, 'rate='.$rate, 'bitrate='.ZM_WEB_VIDEO_BITRATE, 'maxfps='.ZM_WEB_VIDEO_MAXFPS, 'format='.ZM_MPEG_REPLAY_FORMAT, 'replay='.$replayMode ) );
outputVideoStream( 'evtStream', $streamSrc, reScale( $Event->Width(), $scale ), reScale( $Event->Height(), $scale ), ZM_MPEG_LIVE_FORMAT );
} else {
$streamSrc = getStreamSrc( array( "source=event", "mode=jpeg", "event=".$eid, "frame=".$fid, "scale=".$scale, "rate=".$rate, "maxfps=".ZM_WEB_VIDEO_MAXFPS, "replay=".$replayMode) );
$streamSrc = getStreamSrc( array( 'source=event', 'mode=jpeg', 'event='.$eid, 'frame='.$fid, 'scale='.$scale, 'rate='.$rate, 'maxfps='.ZM_WEB_VIDEO_MAXFPS, 'replay='.$replayMode) );
if ( canStreamNative() ) {
outputImageStream( "evtStream", $streamSrc, reScale( $Event->Width(), $scale ), reScale( $Event->Height(), $scale ), validHtmlStr($Event->Name()) );
outputImageStream( 'evtStream', $streamSrc, reScale( $Event->Width(), $scale ), reScale( $Event->Height(), $scale ), validHtmlStr($Event->Name()) );
} else {
outputHelperStream( "evtStream", $streamSrc, reScale( $Event->Width(), $scale ), reScale( $Event->Height(), $scale ) );
outputHelperStream( 'evtStream', $streamSrc, reScale( $Event->Width(), $scale ), reScale( $Event->Height(), $scale ) );
}
} // end if stream method
?>

View File

@ -1,16 +1,12 @@
var jsTranslatedAddText;
var jsTranslatedCloneText;
function setButtonStates( element )
{
function setButtonStates( element ) {
var form = element.form;
var checked = 0;
for ( var i = 0; i < form.elements.length; i++ )
{
if ( form.elements[i].type == "checkbox" )
{
if ( form.elements[i].checked )
{
for ( var i = 0; i < form.elements.length; i++ ) {
if ( form.elements[i].type == "checkbox" ) {
if ( form.elements[i].checked ) {
if ( checked++ > 1 )
break;
}
@ -23,20 +19,15 @@ function setButtonStates( element )
form.deleteBtn.disabled = (checked==0);
}
function addMonitor( element)
{
function addMonitor( element) {
var form = element.form;
var dupParam;
var monitorId=-1;
if (form.addBtn.value == jsTranslatedCloneText)
{
if (form.addBtn.value == jsTranslatedCloneText) {
// get the value of the first checkbox
for ( var i = 0; i < form.elements.length; i++ )
{
if ( form.elements[i].type == "checkbox" )
{
if ( form.elements[i].checked )
{
for ( var i = 0; i < form.elements.length; i++ ) {
if ( form.elements[i].type == "checkbox" ) {
if ( form.elements[i].checked ) {
monitorId = form.elements[i].value;
break;
}
@ -47,15 +38,11 @@ function addMonitor( element)
createPopup( '?view=monitor'+dupParam, 'zmMonitor0', 'monitor' );
}
function editMonitor( element )
{
function editMonitor( element ) {
var form = element.form;
for ( var i = 0; i < form.elements.length; i++ )
{
if ( form.elements[i].type == "checkbox" )
{
if ( form.elements[i].checked )
{
for ( var i = 0; i < form.elements.length; i++ ) {
if ( form.elements[i].type == "checkbox" ) {
if ( form.elements[i].checked ) {
var monitorId = form.elements[i].value;
createPopup( '?view=monitor&mid='+monitorId, 'zmMonitor'+monitorId, 'monitor' );
form.elements[i].checked = false;
@ -67,23 +54,19 @@ function editMonitor( element )
}
}
function deleteMonitor( element )
{
if ( confirm( 'Warning, deleting a monitor also deletes all events and database entries associated with it.\nAre you sure you wish to delete?' ) )
{
function deleteMonitor( element ) {
if ( confirm( 'Warning, deleting a monitor also deletes all events and database entries associated with it.\nAre you sure you wish to delete?' ) ) {
var form = element.form;
form.elements['action'].value = 'delete';
form.submit();
}
}
function reloadWindow()
{
function reloadWindow() {
window.location.replace( thisUrl );
}
function initPage()
{
function initPage() {
jsTranslatedAddText = translatedAddText;
jsTranslatedCloneText = translatedCloneText;
reloadWindow.periodical( consoleRefreshTimeout );

View File

@ -1,23 +1,15 @@
var consoleRefreshTimeout = <?php echo 1000*ZM_WEB_REFRESH_MAIN ?>;
<?php
if ( ZM_CHECK_FOR_UPDATES && canEdit('System') && ZM_DYN_LAST_VERSION && ( verNum(ZM_VERSION) < verNum(ZM_DYN_LAST_VERSION) ) && ( verNum(ZM_DYN_CURR_VERSION) < verNum(ZM_DYN_LAST_VERSION) ) && ( ZM_DYN_NEXT_REMINDER < time() ) )
{
if ( ZM_CHECK_FOR_UPDATES && canEdit('System') && ZM_DYN_LAST_VERSION && ( verNum(ZM_VERSION) < verNum(ZM_DYN_LAST_VERSION) ) && ( verNum(ZM_DYN_CURR_VERSION) < verNum(ZM_DYN_LAST_VERSION) ) && ( ZM_DYN_NEXT_REMINDER < time() ) ) {
$showVersionPopup = true;
}
elseif ( ZM_DYN_SHOW_DONATE_REMINDER )
{
if ( canEdit('System') )
{
if ( ZM_DYN_DONATE_REMINDER_TIME > 0 )
{
if ( ZM_DYN_DONATE_REMINDER_TIME < time() )
{
} elseif ( ZM_DYN_SHOW_DONATE_REMINDER ) {
if ( canEdit('System') ) {
if ( ZM_DYN_DONATE_REMINDER_TIME > 0 ) {
if ( ZM_DYN_DONATE_REMINDER_TIME < time() ) {
$showDonatePopup = true;
}
}
else
{
} else {
$nextReminder = time() + 30*24*60*60;
dbQuery( "update Config set Value = '".$nextReminder."' where Name = 'ZM_DYN_DONATE_REMINDER_TIME'" );
}

View File

@ -1,22 +1,18 @@
var controlParms = "view=request&request=control";
var controlReq = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, onSuccess: getControlResponse } );
function getControlResponse( respObj, respText )
{
function getControlResponse( respObj, respText ) {
if ( !respObj )
return;
//console.log( respText );
if ( respObj.result != 'Ok' )
{
if ( respObj.result != 'Ok' ) {
alert( "Control response was status = "+respObj.status+"\nmessage = "+respObj.message );
}
}
function controlCmd( control, event, xtell, ytell )
{
function controlCmd( control, event, xtell, ytell ) {
var locParms = "&id="+$('mid').get('value');
if ( event && (xtell || ytell) )
{
if ( event && (xtell || ytell) ) {
var xEvent = new Event( event );
var target = xEvent.target;
var coords = $(target).getCoordinates();
@ -26,8 +22,7 @@ function controlCmd( control, event, xtell, ytell )
var x = xEvent.page.x - l;
var y = xEvent.page.y - t;
if ( xtell )
{
if ( xtell ) {
var xge = parseInt( (x*100)/coords.width );
if ( xtell == -1 )
xge = 100 - xge;
@ -35,8 +30,7 @@ function controlCmd( control, event, xtell, ytell )
xge = 2*(50 - xge);
locParms += "&xge="+xge;
}
if ( ytell )
{
if ( ytell ) {
var yge = parseInt( (y*100)/coords.height );
if ( ytell == -1 )
yge = 100 - yge;

View File

@ -1,12 +1,8 @@
function updateLabel()
{
function updateLabel() {
var presetIndex = $('contentForm').preset.getValue();
if ( labels[presetIndex] )
{
if ( labels[presetIndex] ) {
$('contentForm').newLabel.value = labels[presetIndex];
}
else
{
} else {
$('contentForm').newLabel.value = "";
}
}

View File

@ -1,10 +1,8 @@
function nextCycleView()
{
function nextCycleView() {
window.location.replace( '?view=cycle&group='+currGroup+'&mid='+nextMid+'&mode='+mode, cycleRefreshTimeout );
}
function initCycle()
{
function initCycle() {
nextCycleView.periodical( cycleRefreshTimeout );
}

View File

@ -1,5 +1,4 @@
function switchDeviceOn( element, key )
{
function switchDeviceOn( element, key ) {
var form = element.form;
form.view.value = currentView;
form.action.value = 'device';
@ -8,8 +7,7 @@ function switchDeviceOn( element, key )
form.submit();
}
function switchDeviceOff( element, key )
{
function switchDeviceOff( element, key ) {
var form = element.form;
form.view.value = currentView;
form.action.value = 'device';
@ -18,24 +16,19 @@ function switchDeviceOff( element, key )
form.submit();
}
function deleteDevice( element )
{
function deleteDevice( element ) {
var form = element.form;
form.view.value = currentView;
form.action.value = 'delete';
form.submit();
}
function configureButtons( element, name )
{
function configureButtons( element, name ) {
var form = element.form;
var checked = false;
for (var i = 0; i < form.elements.length; i++)
{
if ( form.elements[i].name.indexOf(name) == 0)
{
if ( form.elements[i].checked )
{
for (var i = 0; i < form.elements.length; i++) {
if ( form.elements[i].name.indexOf(name) == 0) {
if ( form.elements[i].checked ) {
checked = true;
break;
}

View File

@ -1,5 +1,4 @@
function submitForm( element )
{
function submitForm( element ) {
var form = element.form;
if ( form.option.selectedIndex == 0 )
form.view.value = currentView;
@ -8,7 +7,6 @@ function submitForm( element )
form.submit();
}
if ( action == "donate" && option == "go" )
{
if ( action == "donate" && option == "go" ) {
zmWindow();
}

View File

@ -1,13 +1,11 @@
function closeWindows()
{
function closeWindows() {
window.close();
// This is a hack. The only way to close an existing window is to try and open it!
var filterWindow = window.open( thisUrl+'?view=none', 'zmFilter', 'width=1,height=1' );
filterWindow.close();
}
function toggleCheckbox( element, name )
{
function toggleCheckbox( element, name ) {
var form = element.form;
var checked = element.checked;
for (var i = 0; i < form.elements.length; i++)
@ -21,18 +19,13 @@ function toggleCheckbox( element, name )
form.deleteBtn.disabled = !checked;
}
function configureButton( element, name )
{
function configureButton( element, name ) {
var form = element.form;
var checked = element.checked;
if ( !checked )
{
for (var i = 0; i < form.elements.length; i++)
{
if ( form.elements[i].name.indexOf(name) == 0)
{
if ( form.elements[i].checked )
{
if ( !checked ) {
for (var i = 0; i < form.elements.length; i++) {
if ( form.elements[i].name.indexOf(name) == 0) {
if ( form.elements[i].checked ) {
checked = true;
break;
}
@ -49,41 +42,31 @@ function configureButton( element, name )
form.deleteBtn.disabled = !checked;
}
function deleteEvents( element, name )
{
function deleteEvents( element, name ) {
var form = element.form;
var count = 0;
for (var i = 0; i < form.elements.length; i++)
{
if (form.elements[i].name.indexOf(name) == 0)
{
if ( form.elements[i].checked )
{
for (var i = 0; i < form.elements.length; i++) {
if (form.elements[i].name.indexOf(name) == 0) {
if ( form.elements[i].checked ) {
count++;
break;
}
}
}
if ( count > 0 )
{
if ( confirm( confirmDeleteEventsString ) )
{
if ( count > 0 ) {
if ( confirm( confirmDeleteEventsString ) ) {
form.action.value = 'delete';
form.submit();
}
}
}
function editEvents( element, name )
{
function editEvents( element, name ) {
var form = element.form;
var eids = new Array();
for (var i = 0; i < form.elements.length; i++)
{
if (form.elements[i].name.indexOf(name) == 0)
{
if ( form.elements[i].checked )
{
for (var i = 0; i < form.elements.length; i++) {
if (form.elements[i].name.indexOf(name) == 0) {
if ( form.elements[i].checked ) {
eids[eids.length] = 'eids[]='+form.elements[i].value;
}
}
@ -91,16 +74,12 @@ function editEvents( element, name )
createPopup( '?view=eventdetail&'+eids.join( '&' ), 'zmEventDetail', 'eventdetail' );
}
function exportEvents( element, name )
{
function exportEvents( element, name ) {
var form = element.form;
var eids = new Array();
for (var i = 0; i < form.elements.length; i++)
{
if (form.elements[i].name.indexOf(name) == 0)
{
if ( form.elements[i].checked )
{
for (var i = 0; i < form.elements.length; i++) {
if (form.elements[i].name.indexOf(name) == 0) {
if ( form.elements[i].checked ) {
eids[eids.length] = 'eids[]='+form.elements[i].value;
}
}
@ -108,42 +87,34 @@ function exportEvents( element, name )
createPopup( '?view=export&'+eids.join( '&' ), 'zmExport', 'export' );
}
function viewEvents( element, name )
{
function viewEvents( element, name ) {
var form = element.form;
var events = new Array();
for (var i = 0; i < form.elements.length; i++)
{
if ( form.elements[i].name.indexOf(name) == 0)
{
if ( form.elements[i].checked )
{
for (var i = 0; i < form.elements.length; i++) {
if ( form.elements[i].name.indexOf(name) == 0) {
if ( form.elements[i].checked ) {
events[events.length] = form.elements[i].value;
}
}
}
if ( events.length > 0 )
{
if ( events.length > 0 ) {
createPopup( '?view=event&eid='+events[0]+'&filter[terms][0][attr]=Id&&filter[terms][0][op]=%3D%5B%5D&&filter[terms][0][val]='+events.join('%2C')+sortQuery+'&page=1&play=1', 'zmEvent', 'event', maxWidth, maxHeight );
}
}
function archiveEvents( element, name )
{
function archiveEvents( element, name ) {
var form = element.form;
form.action.value = 'archive';
form.submit();
}
function unarchiveEvents( element, name )
{
function unarchiveEvents( element, name ) {
var form = element.form;
form.action.value = 'unarchive';
form.submit();
}
if ( openFilterWindow )
{
if ( openFilterWindow ) {
//opener.location.reload(true);
createPopup( '?view=filter&page='+thisPage+filterQuery, 'zmFilter', 'filter' );
location.replace( '?view='+currentView+'&page='+thisPage+filterQuery );

View File

@ -1,26 +1,24 @@
function configureExportButton( element )
{
function configureExportButton( element ) {
var form = element.form;
var checkCount = 0;
var radioCount = 0;
for ( var i = 0; i < form.elements.length; i++ )
for ( var i = 0; i < form.elements.length; i++ ) {
if ( form.elements[i].type == "checkbox" && form.elements[i].checked )
checkCount++;
else if ( form.elements[i].type == "radio" && form.elements[i].checked )
radioCount++;
}
form.elements['exportButton'].disabled = (checkCount == 0 || radioCount == 0);
}
function startDownload( exportFile )
{
function startDownload( exportFile ) {
window.location.replace( exportFile );
}
var exportTimer = null;
function exportProgress()
{
function exportProgress() {
var tickerText = $('exportProgressTicker').get('text');
if ( tickerText.length < 1 || tickerText.length > 4 )
$('exportProgressTicker').set( 'text', '.' );
@ -28,13 +26,11 @@ function exportProgress()
$('exportProgressTicker').appendText( '.' );
}
function exportResponse( respObj, respText )
{
function exportResponse( respObj, respText ) {
window.location.replace( thisUrl+'?view='+currentView+'&'+eidParm+'&exportFile='+respObj.exportFile+'&generated='+((respObj.result=='Ok')?1:0) );
}
function exportEvent( form )
{
function exportEvent( form ) {
var parms = 'view=request&request=event&action=export';
parms += '&'+$(form).toQueryString();
var query = new Request.JSON( { url: thisUrl, method: 'post', data: parms, onSuccess: exportResponse } );
@ -46,11 +42,9 @@ function exportEvent( form )
exportTimer = exportProgress.periodical( 500 );
}
function initPage()
{
function initPage() {
configureExportButton( $('exportButton') );
if ( exportReady )
{
if ( exportReady ) {
startDownload.pass( exportFile ).delay( 1500 );
}
}

View File

@ -1,15 +1,12 @@
<?php
if ( isset($_REQUEST['eids']) )
{
if ( isset($_REQUEST['eids']) ) {
$eidParms = array();
foreach ( $_REQUEST['eids'] as $eid )
$eidParms[] = "eids[]=".validInt($eid);
?>
var eidParm = '<?php echo join( '&', $eidParms ) ?>';
<?php
}
else
{
} else {
?>
var eidParm = 'eid=<?php echo validInt($_REQUEST['eid']) ?>';
<?php

View File

@ -1,11 +1,9 @@
function updateButtons( element )
{
function updateButtons( element ) {
var form = element.form;
if ( element.type == 'checkbox' && element.checked )
if ( element.type == 'checkbox' && element.checked ) {
form.elements['executeButton'].disabled = false;
else
{
} else {
var canExecute = false;
if ( form.elements['AutoArchive'].checked )
canExecute = true;
@ -25,15 +23,13 @@ function updateButtons( element )
}
}
function clearValue( element, line )
{
function clearValue( element, line ) {
var form = element.form;
var val = form.elements['filter[terms]['+line+'][val]'];
val.value = '';
}
function submitToFilter( element, reload )
{
function submitToFilter( element, reload ) {
var form = element.form;
form.target = window.name;
form.view.value = 'filter';
@ -41,11 +37,9 @@ function submitToFilter( element, reload )
form.submit();
}
function submitToEvents( element )
{
function submitToEvents( element ) {
var form = element.form;
if ( validateForm( form ) )
{
if ( validateForm( form ) ) {
form.target = 'zmEvents';
form.view.value = 'events';
form.action.value = '';
@ -54,11 +48,9 @@ function submitToEvents( element )
}
}
function executeFilter( element )
{
function executeFilter( element ) {
var form = element.form;
if ( validateForm( form ) )
{
if ( validateForm( form ) ) {
form.target = 'zmEvents';
form.view.value = 'events';
form.action.value = 'filter';
@ -67,8 +59,7 @@ function executeFilter( element )
}
}
function saveFilter( element )
{
function saveFilter( element ) {
var form = element.form;
var popupName = 'zmEventsFilterSave';
@ -79,18 +70,16 @@ function saveFilter( element )
form.submit();
}
function deleteFilter( element, id, name )
{
if ( confirm( deleteSavedFilterString+" '"+name+"'?" ) )
{
function deleteFilter( element, name ) {
if ( confirm( deleteSavedFilterString+" '"+name+"'" ) ) {
var form = element.form;
form.action.value = 'delete';
submitToFilter( element, 0 );
form.fid.value = name;
submitToFilter( element, 1 );
}
}
function addTerm( element, line )
{
function addTerm( element, line ) {
var form = element.form;
form.target = window.name;
form.view.value = currentView;
@ -100,8 +89,7 @@ function addTerm( element, line )
form.submit();
}
function delTerm( element, line )
{
function delTerm( element, line ) {
var form = element.form;
form.target = window.name;
form.view.value = currentView;
@ -111,8 +99,7 @@ function delTerm( element, line )
form.submit();
}
function init()
{
function init() {
updateButtons( $('executeButton') );
}

View File

@ -1,14 +1,11 @@
var deleteSavedFilterString = "<?php echo translate('DeleteSavedFilter') ?>";
function validateForm( form )
{
function validateForm( form ) {
<?php
if ( isset ($_REQUEST['filter']) && count($_REQUEST['filter']['terms']) > 2 )
{
if ( isset ($_REQUEST['filter']) && count($_REQUEST['filter']['terms']) > 2 ) {
?>
var bracket_count = 0;
<?php
for ( $i = 0; $i < count($_REQUEST['filter']['terms']); $i++ )
{
for ( $i = 0; $i < count($_REQUEST['filter']['terms']); $i++ ) {
?>
var obr = form.elements['filter[terms][<?php echo $i ?>][obr]'];
var cbr = form.elements['filter[terms][<?php echo $i ?>][cbr]'];
@ -17,8 +14,7 @@ for ( $i = 0; $i < count($_REQUEST['filter']['terms']); $i++ )
<?php
}
?>
if ( bracket_count )
{
if ( bracket_count ) {
alert( "<?php echo translate('ErrorBrackets') ?>" );
return( false );
}
@ -26,12 +22,10 @@ for ( $i = 0; $i < count($_REQUEST['filter']['terms']); $i++ )
}
?>
<?php
for ( $i = 0; isset($_REQUEST['filter']) && $i < count($_REQUEST['filter']['terms']); $i++ )
{
for ( $i = 0; isset($_REQUEST['filter']) && $i < count($_REQUEST['filter']['terms']); $i++ ) {
?>
var val = form.elements['filter[terms][<?php echo $i ?>][val]'];
if ( val.value == '' )
{
if ( val.value == '' ) {
alert( "<?php echo translate('ErrorValidValue') ?>" );
return( false );
}
@ -41,8 +35,7 @@ for ( $i = 0; isset($_REQUEST['filter']) && $i < count($_REQUEST['filter']['term
return( true );
}
<?php
if ( !empty($hasCal) )
{
if ( !empty($hasCal) ) {
?>
</script>
<style type="text/css">@import url(tools/jscalendar/calendar-win2k-1.css);</style>

View File

@ -1,10 +1,8 @@
function selectMonitors()
{
function selectMonitors() {
createPopup( '?view=monitorselect&callForm=groupForm&callField=newGroup[MonitorIds]', 'zmMonitors', 'monitorselect' );
}
if ( refreshParent )
{
if ( refreshParent ) {
opener.location.reload(true);
}

View File

@ -1,43 +1,34 @@
function newGroup()
{
function newGroup() {
createPopup( '?view=group', 'zmGroup', 'group' );
}
function editGroup( element )
{
function editGroup( element ) {
var form = element.form;
form.action.value = 'setgroup';
form.submit();
}
function editGroup( element )
{
function editGroup( element ) {
var form = element.form;
for ( var i = 0; i < form.gid.length; i++ )
{
if ( form.gid[i].checked )
{
for ( var i = 0; i < form.gid.length; i++ ) {
if ( form.gid[i].checked ) {
createPopup( '?view=group&gid='+form.gid[i].value, 'zmGroup', 'group' );
return;
}
}
}
function deleteGroup( element )
{
function deleteGroup( element ) {
var form = element.form;
form.view.value = currentView;
form.action.value = 'delete';
form.submit();
}
function configureButtons( element )
{
if ( canEditGroups )
{
function configureButtons( element ) {
if ( canEditGroups ) {
var form = element.form;
if ( element.checked )
{
if ( element.checked ) {
form.editBtn.disabled = (element.value == 0);
form.deleteBtn.disabled = (element.value == 0);
}

View File

@ -25,45 +25,37 @@ var sortReversed = false;
var filterFields = ['Component', 'ServerId', 'Pid', 'Level', 'File', 'Line'];
var options = {};
function buildFetchParms( parms )
{
function buildFetchParms( parms ) {
var fetchParms = logParms+'&limit='+maxLogFetch;
if ( parms )
fetchParms += '&'+parms;
Object.each(filter,
function( value, key )
{
function( value, key ) {
fetchParms += '&filter['+key+']='+value;
}
);
return( fetchParms );
}
function fetchNextLogs()
{
function fetchNextLogs() {
logReq.send( buildFetchParms( 'minTime='+maxLogTime ) );
}
function fetchPrevLogs()
{
function fetchPrevLogs() {
logReq.send( buildFetchParms( 'maxTime='+minLogTime ) );
}
function logResponse( respObj )
{
function logResponse( respObj ) {
if ( logTimer )
logTimer = clearTimeout( logTimer );
if ( respObj.result == 'Ok' )
{
if ( respObj.logs.length > 0 )
{
if ( respObj.result == 'Ok' ) {
if ( respObj.logs.length > 0 ) {
logTimeout = minSampleTime;
logCount += respObj.logs.length;
try {
respObj.logs.each(
function( log )
{
function( log ) {
if ( !maxLogTime || log.TimeKey > maxLogTime )
maxLogTime = log.TimeKey;
if ( !minLogTime || log.TimeKey < minLogTime )
@ -79,8 +71,7 @@ function logResponse( respObj )
row.tr.addClass( 'log-war' );
else if ( log.Level > 0 )
row.tr.addClass( 'log-dbg' );
if ( !firstLoad )
{
if ( !firstLoad ) {
var color = document.defaultView.getComputedStyle(row.tr, null).getPropertyValue('color');
var colorParts = color.match(/^rgb.*\((\d+),\s*(\d+),\s*(\d+)/);
rowOrigColor = '#' + parseInt(colorParts[1]).toString(16) + parseInt(colorParts[2]).toString(16) + parseInt(colorParts[3]).toString(16);
@ -99,23 +90,18 @@ function logResponse( respObj )
$('totalLogs').set('text', respObj.total);
$('availLogs').set('text', respObj.available);
$('displayLogs').set('text', logCount);
if ( firstLoad )
{
if ( firstLoad ) {
if ( logCount < displayLimit )
fetchPrevLogs();
}
logTable.reSort();
}
catch( e )
{
} catch( e ) {
console.error( e );
}
logTimeout /= 2;
if ( logTimeout < minSampleTime )
logTimeout = minSampleTime;
}
else
{
} else {
firstLoad = false;
logTimeout *= 2;
if ( logTimeout > maxSampleTime )
@ -125,8 +111,7 @@ function logResponse( respObj )
logTimer = fetchNextLogs.delay( logTimeout );
}
function refreshLog()
{
function refreshLog() {
options = {};
logTable.empty();
firstLoad = true;
@ -138,14 +123,12 @@ function refreshLog()
fetchNextLogs();
}
function expandLog()
{
function expandLog() {
displayLimit += maxLogFetch;
fetchPrevLogs();
}
function clearLog()
{
function clearLog() {
logReq.cancel();
minLogTime = 0;
logCount = 0;
@ -156,12 +139,10 @@ function clearLog()
logTable.empty();
}
function filterLog()
{
function filterLog() {
filter = {};
filterFields.each(
function( field )
{
function( field ) {
var selector = $('filter['+field+']');
if ( ! selector ) {
if ( window.console && window.console.log ) {
@ -177,62 +158,51 @@ function filterLog()
refreshLog();
}
function resetLog()
{
function resetLog() {
filter = {};
refreshLog();
}
var exportFormValidator;
function exportLog()
{
function exportLog() {
exportFormValidator.reset();
$('exportLog').overlayShow();
}
function exportResponse( response )
{
function exportResponse( response ) {
$('exportLog').unspin();
if ( response.result == 'Ok' )
{
if ( response.result == 'Ok' ) {
window.location.replace( thisUrl+'?view=request&request=log&task=download&key='+response.key+'&format='+response.format );
}
}
function exportFail( request )
{
function exportFail( request ) {
$('exportLog').unspin();
$('exportErrorText').set('text', request.status+" / "+request.statusText );
$('exportError').show();
Error( "Export request failed: "+request.status+" / "+request.statusText );
}
function exportRequest()
{
function exportRequest() {
var form = $('exportForm');
$('exportErrorText').set('text', "" );
$('exportError').hide();
if ( form.validate() )
{
if ( form.validate() ) {
var exportParms = "view=request&request=log&task=export";
var exportReq = new Request.JSON( { url: thisUrl, method: 'post', link: 'cancel', onSuccess: exportResponse, onFailure: exportFail } );
var selection = form.getElement('input[name=selector]:checked').get('value');
if ( selection == 'filter' || selection == 'current' )
{
if ( selection == 'filter' || selection == 'current' ) {
$$('#filters select').each(
function( select )
{
function( select ) {
exportParms += "&"+select.get('id')+"="+select.get('value');
}
);
}
if ( selection == 'current' )
{
if ( selection == 'current' ) {
var tbody = $(logTable).getElement( 'tbody' );
var rows = tbody.getElements( 'tr' );
if ( rows )
{
if ( rows ) {
var minTime = rows[0].getElement('td').get('text');
exportParms += "&minTime="+encodeURIComponent(minTime);
var maxTime = rows[rows.length-1].getElement('td').get('text');
@ -244,11 +214,9 @@ function exportRequest()
}
}
function updateFilterSelectors()
{
function updateFilterSelectors() {
Object.each(options,
function( values, key )
{
function( values, key ) {
var selector = $('filter['+key+']');
if ( ! selector ) {
if ( window.console && window.console.log ) {
@ -257,29 +225,21 @@ function updateFilterSelectors()
return;
}
selector.options.length = 1;
if ( key == 'Level' )
{
if ( key == 'Level' ) {
Object.each(values,
function( value, label )
{
function( value, label ) {
selector.options[selector.options.length] = new Option( value, label );
}
);
}
else if ( key == 'ServerId' )
{
} else if ( key == 'ServerId' ) {
Object.each(values,
function( value, label )
{
function( value, label ) {
selector.options[selector.options.length] = new Option( value, label );
}
);
}
else
{
} else {
values.each(
function( value )
{
function( value ) {
selector.options[selector.options.length] = new Option( value );
}
);
@ -290,8 +250,7 @@ function updateFilterSelectors()
);
}
function initPage()
{
function initPage() {
displayLimit = initialDisplayLimit;
for ( var i = 1; i <= 9; i++ )
logCodes[''+i] = 'DB'+i;
@ -302,27 +261,24 @@ function initPage()
sortReverse: true
}
);
logTable.addEvent( 'sort', function( tbody, index )
{
logTable.addEvent( 'sort', function( tbody, index ) {
var header = tbody.getParent( 'table' ).getElement( 'thead' );
var columns = header.getElement( 'tr' ).getElements( 'th' );
var column = columns[index];
sortReversed = column.hasClass( 'table-th-sort-rev' );
if ( logCount > displayLimit )
{
if ( logCount > displayLimit ) {
var rows = tbody.getElements( 'tr' );
var startIndex;
if ( sortReversed )
startIndex = displayLimit;
else
startIndex = 0;
for ( var i = startIndex; logCount > displayLimit; i++ )
{
for ( var i = startIndex; logCount > displayLimit; i++ ) {
rows[i].destroy();
logCount--;
}
$('displayLogs').set('text', logCount);
}
} // end if loCount > displayLimit
}
);
exportFormValidator = new Form.Validator.Inline($('exportForm'), {

View File

@ -1,15 +1,12 @@
function updateMonitorDimensions( element )
{
function updateMonitorDimensions( element ) {
var form = element.form;
var widthFactor = parseInt( defaultAspectRatio.replace( /:.*$/, '' ) );
var heightFactor = parseInt( defaultAspectRatio.replace( /^.*:/, '' ) );
if ( form.elements['preserveAspectRatio'].checked )
{
if ( form.elements['preserveAspectRatio'].checked ) {
var monitorWidth = parseInt(form.elements['newMonitor[Width]'].value);
var monitorHeight = parseInt(form.elements['newMonitor[Height]'].value);
switch( element.name )
{
switch( element.name ) {
case 'newMonitor[Width]':
if ( monitorWidth >= 0 )
form.elements['newMonitor[Height]'].value = Math.round((monitorWidth * heightFactor) / widthFactor);
@ -27,8 +24,7 @@ function updateMonitorDimensions( element )
return( false );
}
function loadLocations( element )
{
function loadLocations( element ) {
var form = element.form;
var controlIdSelect = form.elements['newMonitor[ControlId]'];
var returnLocationSelect = form.elements['newMonitor[ReturnLocation]'];
@ -37,17 +33,14 @@ function loadLocations( element )
//returnLocationSelect.options[0] = new Option( noneString, -1 );
var returnLocationOptions = controlOptions[controlIdSelect.selectedIndex];
if ( returnLocationOptions )
{
for ( var i = 0; i < returnLocationOptions.length; i++ )
{
if ( returnLocationOptions ) {
for ( var i = 0; i < returnLocationOptions.length; i++ ) {
returnLocationSelect.options[returnLocationSelect.options.length] = new Option( returnLocationOptions[i], i );
}
}
}
function initPage()
{
function initPage() {
//var protocolSelector = $('contentForm').elements['newMonitor[Protocol]'];
//if ( $(protocolSelector).getTag() == 'select' )
//updateMethods( $(protocolSelector) );

View File

@ -2,8 +2,7 @@ var optControl = <?php echo ZM_OPT_CONTROL ?>;
var defaultAspectRatio = '<?php echo ZM_DEFAULT_ASPECT_RATIO ?>';
<?php
if ( ZM_OPT_CONTROL )
{
if ( ZM_OPT_CONTROL ) {
?>
var controlOptions = new Object();
<?php
@ -12,26 +11,21 @@ var controlOptions = new Object();
# Temporary workaround to show all ptz control types regardless of monitor source type
# $sql = "select * from Controls where Type = '".$newMonitor['Type']."'";
$sql = "select * from Controls";
foreach( dbFetchAll( $sql ) as $row )
{
foreach( dbFetchAll( $sql ) as $row ) {
$controlTypes[$row['Id']] = $row['Name'];
?>
controlOptions[<?php echo $row['Id'] ?>] = new Array();
<?php
if ( $row['HasHomePreset'] )
{
if ( $row['HasHomePreset'] ) {
?>
controlOptions[<?php echo $row['Id'] ?>][0] = '<?php echo translate('Home') ?>';
<?php
}
else
{
} else {
?>
controlOptions[<?php echo $row['Id'] ?>][0] = null;
<?php
}
for ( $i = 1; $i <= $row['NumPresets']; $i++ )
{
for ( $i = 1; $i <= $row['NumPresets']; $i++ ) {
?>
controlOptions[<?php echo $row['Id'] ?>][<?php echo $i ?>] = '<?php echo translate('Preset').' '.$i ?>';
<?php
@ -41,13 +35,11 @@ controlOptions[<?php echo $row['Id'] ?>][<?php echo $i ?>] = '<?php echo transla
?>
<?php
if ( empty($_REQUEST['mid']) )
{
if ( empty($_REQUEST['mid']) ) {
?>
var monitorNames = new Object();
<?php
foreach ( dbFetchAll( "select Name from Monitors order by Name asc", "Name" ) as $name )
{
foreach ( dbFetchAll( "select Name from Monitors order by Name asc", "Name" ) as $name ) {
?>
monitorNames['<?php echo validJsStr($name) ?>'] = true;
<?php
@ -55,8 +47,7 @@ monitorNames['<?php echo validJsStr($name) ?>'] = true;
}
?>
function validateForm( form )
{
function validateForm( form ) {
var errors = new Array();
if ( form.elements['newMonitor[Name]'].value.search( /[^\w- ]/ ) >= 0 )
@ -72,8 +63,7 @@ function validateForm( form )
errors[errors.length] = "<?php echo translate('BadAlarmMaxFPS') ?>";
if ( !form.elements['newMonitor[RefBlendPerc]'].value || (parseInt(form.elements['newMonitor[RefBlendPerc]'].value) > 100 ) || (parseInt(form.elements['newMonitor[RefBlendPerc]'].value) < 0 ) )
errors[errors.length] = "<?php echo translate('BadRefBlendPerc') ?>";
if ( form.elements['newMonitor[Type]'].value == 'Local' )
{
if ( form.elements['newMonitor[Type]'].value == 'Local' ) {
if ( !form.elements['newMonitor[Palette]'].value || !form.elements['newMonitor[Palette]'].value.match( /^\d+$/ ) )
errors[errors.length] = "<?php echo translate('BadPalette') ?>";
if ( !form.elements['newMonitor[Device]'].value )
@ -82,18 +72,14 @@ function validateForm( form )
errors[errors.length] = "<?php echo translate('BadChannel') ?>";
if ( !form.elements['newMonitor[Format]'].value || !form.elements['newMonitor[Format]'].value.match( /^\d+$/ ) )
errors[errors.length] = "<?php echo translate('BadFormat') ?>";
}
else if ( form.elements['newMonitor[Type]'].value == 'Remote' )
{
} else if ( form.elements['newMonitor[Type]'].value == 'Remote' ) {
//if ( !form.elements['newMonitor[Host]'].value || !form.elements['newMonitor[Host]'].value.match( /^[0-9a-zA-Z_.:@-]+$/ ) )
//errors[errors.length] = "<?php echo translate('BadHost') ?>";
if ( form.elements['newMonitor[Port]'].value && !form.elements['newMonitor[Port]'].value.match( /^\d+$/ ) )
errors[errors.length] = "<?php echo translate('BadPort') ?>";
//if ( !form.elements['newMonitor[Path]'].value )
//errors[errors.length] = "<?php echo translate('BadPath') ?>";
}
else if ( form.elements['newMonitor[Type]'].value == 'File' )
{
} else if ( form.elements['newMonitor[Type]'].value == 'File' ) {
if ( !form.elements['newMonitor[Path]'].value )
errors[errors.length] = "<?php echo translate('BadPath') ?>";
}
@ -135,16 +121,14 @@ function validateForm( form )
if ( !form.elements['newMonitor[WebColour]'].value || !form.elements['newMonitor[WebColour]'].value.match( /^[#0-9a-zA-Z]+$/ ) )
errors[errors.length] = "<?php echo translate('BadWebColour') ?>";
if ( errors.length )
{
if ( errors.length ) {
alert( errors.join( "\n" ) );
return( false );
}
return( true );
}
function updateLinkedMonitors( element )
{
function updateLinkedMonitors( element ) {
var form = element.form;
var monitorIds = new Array();
for ( var i = 0; i < element.options.length; i++ )
@ -153,20 +137,17 @@ function updateLinkedMonitors( element )
form.elements['newMonitor[LinkedMonitors]'].value = monitorIds.join( ',' );
}
function updateMethods( element )
{
function updateMethods( element ) {
var form = element.form;
var origMethod = form.elements['origMethod'];
var methodSelector = form.elements['newMonitor[Method]'];
methodSelector.options.length = 0;
switch ( element.value )
{
switch ( element.value ) {
case 'http' :
{
<?php
foreach( $httpMethods as $value=>$label )
{
foreach( $httpMethods as $value=>$label ) {
?>
methodSelector.options[methodSelector.options.length] = new Option( "<?php echo htmlspecialchars($label) ?>", "<?php echo $value ?>" );
if ( origMethod.value == "<?php echo $value ?>" )
@ -179,8 +160,7 @@ foreach( $httpMethods as $value=>$label )
case 'rtsp' :
{
<?php
foreach( $rtspMethods as $value=>$label )
{
foreach( $rtspMethods as $value=>$label ) {
?>
methodSelector.options[methodSelector.options.length] = new Option( "<?php echo htmlspecialchars($label) ?>", "<?php echo $value ?>" );
if ( origMethod.value == "<?php echo $value ?>" )

View File

@ -1,5 +1,4 @@
function submitPreset( element )
{
function submitPreset( element ) {
var form = element.form;
form.target = opener.name;
form.view.value = 'monitor';
@ -7,8 +6,7 @@ function submitPreset( element )
closeWindow.delay( 250 );
}
function configureButtons( element )
{
function configureButtons( element ) {
var form = element.form;
form.saveBtn.disabled = (form.preset.selectedIndex==0);
}

View File

@ -1,5 +1,4 @@
function submitCamera( element )
{
function submitCamera( element ) {
var form = element.form;
form.target = opener.name;
form.view.value = 'monitor';
@ -7,8 +6,7 @@ function submitCamera( element )
closeWindow.delay( 250 );
}
function configureButtons( element )
{
function configureButtons( element ) {
var form = element.form;
form.saveBtn.disabled = (form.probe.selectedIndex==0);
}

View File

@ -1,7 +1,6 @@
var requestQueue = new Request.Queue( { concurrent: 2 } );
function Monitor( monitorData )
{
function Monitor( monitorData ) {
this.id = monitorData.id;
this.connKey = monitorData.connKey;
this.server_url = monitorData.server_url;
@ -11,15 +10,12 @@ function Monitor( monitorData )
this.streamCmdParms = "view=request&request=stream&connkey="+this.connKey;
this.streamCmdTimer = null;
this.start = function( delay )
{
this.start = function( delay ) {
this.streamCmdTimer = this.streamCmdQuery.delay( delay, this );
};
this.setStateClass = function( element, stateClass )
{
if ( !element.hasClass( stateClass ) )
{
this.setStateClass = function( element, stateClass ) {
if ( !element.hasClass( stateClass ) ) {
if ( stateClass != 'alarm' )
element.removeClass( 'alarm' );
if ( stateClass != 'alert' )
@ -30,14 +26,12 @@ function Monitor( monitorData )
}
};
this.getStreamCmdResponse = function( respObj, respText )
{
this.getStreamCmdResponse = function( respObj, respText ) {
if ( this.streamCmdTimer )
this.streamCmdTimer = clearTimeout( this.streamCmdTimer );
var stream = document.getElementById( "liveStream"+this.id );
if ( respObj.result == 'Ok' )
{
if ( respObj.result == 'Ok' ) {
this.status = respObj.status;
this.alarmState = this.status.state;
@ -49,8 +43,7 @@ function Monitor( monitorData )
else
stateClass = "idle";
if ( !COMPACT_MONTAGE )
{
if ( !COMPACT_MONTAGE ) {
$('fpsValue'+this.id).set( 'text', this.status.fps );
$('stateValue'+this.id).set( 'text', stateStrings[this.alarmState] );
this.setStateClass( $('monitorState'+this.id), stateClass );
@ -66,22 +59,17 @@ function Monitor( monitorData )
var newAlarm = ( isAlarmed && !wasAlarmed );
var oldAlarm = ( !isAlarmed && wasAlarmed );
if ( newAlarm )
{
if ( false && SOUND_ON_ALARM )
{
if ( newAlarm ) {
if ( false && SOUND_ON_ALARM ) {
// Enable the alarm sound
$('alarmSound').removeClass( 'hidden' );
}
if ( POPUP_ON_ALARM )
{
if ( POPUP_ON_ALARM ) {
windowToFront();
}
}
if ( false && SOUND_ON_ALARM )
{
if ( oldAlarm )
{
if ( false && SOUND_ON_ALARM ) {
if ( oldAlarm ) {
// Disable alarm sound
$('alarmSound').addClass( 'hidden' );
}
@ -92,9 +80,7 @@ function Monitor( monitorData )
stream.src = stream.src.replace( /auth=\w+/i, 'auth='+this.status.auth );
console.log("Changed auth to " + this.status.auth );
} // end if haev a new auth hash
}
else
{
} else {
console.error( respObj.message );
// Try to reload the image stream.
if ( stream )
@ -107,8 +93,7 @@ function Monitor( monitorData )
this.lastAlarmState = this.alarmState;
};
this.streamCmdQuery = function( resent )
{
this.streamCmdQuery = function( resent ) {
//if ( resent )
//console.log( this.connKey+": Resending" );
//this.streamCmdReq.cancel();
@ -120,8 +105,7 @@ function Monitor( monitorData )
requestQueue.addRequest( "cmdReq"+this.id, this.streamCmdReq );
}
function selectLayout( element )
{
function selectLayout( element ) {
var cssFile = skinPath+'/css/'+Cookie.read('zmCSS')+'/views/'+$(element).get('value');
if ( $('dynamicStyles') )
$('dynamicStyles').destroy();
@ -195,10 +179,8 @@ function changeScale() {
var monitors = new Array();
function initPage()
{
for ( var i = 0; i < monitorData.length; i++ )
{
function initPage() {
for ( var i = 0; i < monitorData.length; i++ ) {
monitors[i] = new Monitor( monitorData[i] );
var delay = Math.round( (Math.random()+0.5)*statusRefreshTimeout );
monitors[i].start( delay );

View File

@ -28,8 +28,7 @@ var canStreamNative = <?php echo canStreamNative()?'true':'false' ?>;
var monitorData = new Array();
<?php
foreach ( $monitors as $monitor )
{
foreach ( $monitors as $monitor ) {
?>
monitorData[monitorData.length] = {
'id': <?php echo $monitor->Id() ?>,

View File

@ -1,5 +1,4 @@
function submitCamera( element )
{
function submitCamera( element ) {
var form = element.form;
form.target = opener.name;
form.view.value = 'monitor';
@ -7,8 +6,7 @@ function submitCamera( element )
closeWindow.delay( 250 );
}
function gotoStep1( element )
{
function gotoStep1( element ) {
var form = element.form;
form.target = self.name;
form.view.value = 'onvifprobe';
@ -16,8 +14,7 @@ function gotoStep1( element )
form.submit();
}
function gotoStep2( element )
{
function gotoStep2( element ) {
var form = element.form;
form.target = self.name;
form.view.value = 'onvifprobe';
@ -25,8 +22,7 @@ function gotoStep2( element )
form.submit();
}
function configureButtons( element )
{
function configureButtons( element ) {
var form = element.form;
if (form.elements.namedItem("nextBtn")) {
form.nextBtn.disabled = (form.probe.selectedIndex==0) ||

View File

@ -1,5 +1,4 @@
var restartWarning = <?php echo empty($restartWarning)?'false':'true' ?>;
if ( restartWarning )
{
if ( restartWarning ) {
alert( "<?php echo translate('OptionRestartWarning') ?>" );
}

View File

@ -1,28 +1,21 @@
function validateForm( form )
{
function validateForm( form ) {
return( true );
}
function submitForm( form )
{
function submitForm( form ) {
form.submit();
}
function limitRange( field, minValue, maxValue )
{
if ( parseInt(field.value) < parseInt(minValue) )
{
function limitRange( field, minValue, maxValue ) {
if ( parseInt(field.value) < parseInt(minValue) ) {
field.value = minValue;
}
else if ( parseInt(field.value) > parseInt(maxValue) )
{
} else if ( parseInt(field.value) > parseInt(maxValue) ) {
field.value = maxValue;
}
}
function initPage()
{
function initPage() {
return( true );
}

View File

@ -9,8 +9,7 @@
?>
(
function ()
{
function () {
// Append '?(GET query)' to URL if the GET query is not empty.
var querySuffix = "<?php
if (!empty($_POST["postLoginQuery"])) {

View File

@ -1,4 +1,3 @@
<<<<<<< HEAD
$j(document).ready(function() {
// Enable or disable the Delete button depending on the selected run state
$j("#runState").change(function() {
@ -62,64 +61,6 @@ $j(document).ready(function() {
location.reload();
});
}
});
=======
function checkState( element )
{
var form = element.form;
var minIndex = running?2:1;
if ( form.runState.selectedIndex < minIndex )
{
form.saveBtn.disabled = true;
form.deleteBtn.disabled = true;
}
else
{
form.saveBtn.disabled = false;
form.deleteBtn.disabled = false;
}
if ( form.newState.value != '' )
form.saveBtn.disabled = false;
// PP if we are in 'default' state, disable delete
// you can still save
if (element.value.toLowerCase() == 'default' )
{
form.saveBtn.disabled = false;
form.deleteBtn.disabled = true;
}
}
function saveState( element )
{
var form = element.form;
form.view.value = currentView;
form.action.value = 'save';
form.submit();
}
function deleteState( element )
{
var form = element.form;
form.view.value = currentView;
form.action.value = 'delete';
form.submit();
}
if ( applying )
{
function submitForm()
{
$('contentForm').submit();
}
window.addEvent( 'domready', function() { submitForm.delay( 1000 ); } );
}
>>>>>>> master

View File

@ -1,34 +1,24 @@
function validateForm( form, newUser )
{
function validateForm( form, newUser ) {
var errors = new Array();
if ( !form.elements['newUser[Username]'].value )
{
if ( !form.elements['newUser[Username]'].value ) {
errors[errors.length] = "You must supply a username";
}
if ( form.elements['newUser[Password]'].value )
{
if ( !form.conf_password.value )
{
if ( form.elements['newUser[Password]'].value ) {
if ( !form.conf_password.value ) {
errors[errors.length] = "You must confirm the password";
}
else if ( form.elements['newUser[Password]'].value != form.conf_password.value )
{
} else if ( form.elements['newUser[Password]'].value != form.conf_password.value ) {
errors[errors.length] = "The new and confirm passwords are different";
}
}
else if ( newUser )
{
} else if ( newUser ) {
errors[errors.length] = "You must supply a password";
}
var monitorIds = new Array();
for ( var i = 0; i < form.elements['monitorIds'].options.length; i++ )
{
for ( var i = 0; i < form.elements['monitorIds'].options.length; i++ ) {
if ( form.elements['monitorIds'].options[i].selected )
monitorIds[monitorIds.length] = form.elements['monitorIds'].options[i].value;
}
form.elements['newUser[MonitorIds]'].value = monitorIds.join( ',' );
if ( errors.length )
{
if ( errors.length ) {
alert( errors.join( "\n" ) );
return( false );
}

View File

@ -1,18 +1,13 @@
function submitForm( element )
{
function submitForm( element ) {
var form = element.form;
if ( form.option.selectedIndex == 0 )
{
if ( form.option.selectedIndex == 0 ) {
form.view.value = currentView;
}
else
{
} else {
form.view.value = 'none';
}
}
if ( openZmWindow )
{
if ( openZmWindow ) {
zmWindow();
}

View File

@ -1,17 +1,14 @@
function deleteVideo( index )
{
function deleteVideo( index ) {
window.location.replace( thisUrl+'?view='+currentView+'&eid='+eventId+'&deleteIndex='+index );
}
function downloadVideo( index )
{
function downloadVideo( index ) {
window.location.replace( thisUrl+'?view='+currentView+'&eid='+eventId+'&downloadIndex='+index );
}
var generateVideoTimer = null;
function generateVideoProgress()
{
function generateVideoProgress() {
var tickerText = $('videoProgressTicker').get('text');
if ( tickerText.length < 1 || tickerText.length > 4 )
$('videoProgressTicker').set( 'text', '.' );
@ -19,13 +16,11 @@ function generateVideoProgress()
$('videoProgressTicker').appendText( '.' );
}
function generateVideoResponse( respObj, respText )
{
function generateVideoResponse( respObj, respText ) {
window.location.replace( thisUrl+'?view='+currentView+'&eid='+eventId+'&generated='+((respObj.result=='Ok')?1:0) );
}
function generateVideo( form )
{
function generateVideo( form ) {
var parms = 'view=request&request=event&action=video';
parms += '&'+$(form).toQueryString();
var query = new Request.JSON( { url: thisUrl, method: 'post', data: parms, onSuccess: generateVideoResponse } );

View File

@ -1,4 +1,3 @@
<<<<<<< HEAD
function setButtonState( element, butClass ) {
element.className = butClass;
element.disabled = (butClass != 'inactive');
@ -41,54 +40,6 @@ function changeScale() {
} else {
console.error("No element found for liveStream.");
}
=======
function setButtonState( element, butClass )
{
element.className = butClass;
element.disabled = (butClass != 'inactive');
}
function showEvents()
{
$('ptzControls').addClass( 'hidden' );
$('events').removeClass( 'hidden' );
if ( $('eventsControl') )
$('eventsControl').addClass('hidden');
if ( $('controlControl') )
$('controlControl').removeClass('hidden');
showMode = "events";
}
function showPtzControls()
{
$('events').addClass( 'hidden' );
$('ptzControls').removeClass( 'hidden' );
if ( $('eventsControl') )
$('eventsControl').removeClass('hidden');
if ( $('controlControl') )
$('controlControl').addClass('hidden');
showMode = "control";
}
function changeScale()
{
var scale = $('scale').get('value');
var newWidth = ( monitorWidth * scale ) / SCALE_BASE;
var newHeight = ( monitorHeight * scale ) / SCALE_BASE;
Cookie.write( 'zmWatchScale'+monitorId, scale, { duration: 10*365 } );
/*Stream could be an applet so can't use moo tools*/
var streamImg = document.getElementById('liveStream');
if ( streamImg ) {
streamImg.style.width = newWidth + "px";
streamImg.style.height = newHeight + "px";
streamImg.src = streamImg.src.replace(/scale=\d+/i, 'scale='+scale);
} else {
console.error("No element found for liveStream.");
}
>>>>>>> master
}
var alarmState = STATE_IDLE;
@ -192,64 +143,10 @@ function getStreamCmdResponse( respObj, respText ) {
if ( streamStatus.rate < 1 )
streamCmdSlowFwd( false );
else
<<<<<<< HEAD
streamCmdFastFwd( false );
} else {
if ( streamStatus.rate > -1 )
streamCmdSlowRev( false );
=======
$('levelValue').className = "ok";
var delayString = secsToTime( streamStatus.delay );
if ( streamStatus.paused == true )
{
$('modeValue').set( 'text', "Paused" );
$('rate').addClass( 'hidden' );
$('delayValue').set( 'text', delayString );
$('delay').removeClass( 'hidden' );
$('level').removeClass( 'hidden' );
streamCmdPause( false );
}
else if ( streamStatus.delayed == true )
{
$('modeValue').set( 'text', "Replay" );
$('rateValue').set( 'text', streamStatus.rate );
$('rate').removeClass( 'hidden' );
$('delayValue').set( 'text', delayString );
$('delay').removeClass( 'hidden' );
$('level').removeClass( 'hidden' );
if ( streamStatus.rate == 1 )
{
streamCmdPlay( false );
}
else if ( streamStatus.rate > 0 )
{
if ( streamStatus.rate < 1 )
streamCmdSlowFwd( false );
else
streamCmdFastFwd( false );
}
else
{
if ( streamStatus.rate > -1 )
streamCmdSlowRev( false );
else
streamCmdFastRev( false );
}
}
else
{
$('modeValue').set( 'text', "Live" );
$('rate').addClass( 'hidden' );
$('delay').addClass( 'hidden' );
$('level').addClass( 'hidden' );
streamCmdPlay( false );
}
$('zoomValue').set( 'text', streamStatus.zoom );
if ( streamStatus.zoom == "1.0" )
setButtonState( $('zoomOutBtn'), 'unavail' );
>>>>>>> master
else
streamCmdFastRev( false );
} // rate
@ -304,7 +201,6 @@ function getStreamCmdResponse( respObj, respText ) {
} else {
console.log("Unable to find streamImg liveStream");
}
<<<<<<< HEAD
}
var streamCmdTimeout = statusRefreshTimeout;
@ -312,21 +208,6 @@ function getStreamCmdResponse( respObj, respText ) {
streamCmdTimeout = streamCmdTimeout/5;
streamCmdTimer = streamCmdQuery.delay( streamCmdTimeout );
}
=======
else {
checkStreamForErrors("getStreamCmdResponse", respObj);//log them
// Try to reload the image stream.
var streamImg = document.getElementById('liveStream');
if ( streamImg )
streamImg.src = streamImg.src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) ));
}
var streamCmdTimeout = statusRefreshTimeout;
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
streamCmdTimeout = streamCmdTimeout/5;
streamCmdTimer = streamCmdQuery.delay( streamCmdTimeout );
}
>>>>>>> master
function streamCmdPause( action ) {
setButtonState( $('pauseBtn'), 'active' );
@ -355,7 +236,6 @@ function streamCmdPlay( action ) {
setButtonState( $('slowFwdBtn'), 'unavail' );
setButtonState( $('slowRevBtn'), 'unavail' );
setButtonState( $('fastRevBtn'), 'unavail' );
<<<<<<< HEAD
}
if ( action )
streamCmdReq.send( streamCmdParms+"&command="+CMD_PLAY );
@ -446,94 +326,6 @@ function streamCmdPan( x, y ) {
function streamCmdQuery() {
streamCmdReq.send( streamCmdParms+"&command="+CMD_QUERY );
}
=======
if ( action )
streamCmdReq.send( streamCmdParms+"&command="+CMD_STOP );
setButtonState( $('stopBtn'), 'unavail' );
setButtonState( $('playBtn'), 'active' );
}
function streamCmdFastFwd( action )
{
setButtonState( $('pauseBtn'), 'inactive' );
setButtonState( $('playBtn'), 'inactive' );
setButtonState( $('stopBtn'), 'inactive' );
setButtonState( $('fastFwdBtn'), 'inactive' );
setButtonState( $('slowFwdBtn'), 'inactive' );
setButtonState( $('slowRevBtn'), 'inactive' );
setButtonState( $('fastRevBtn'), 'inactive' );
if ( action )
streamCmdReq.send( streamCmdParms+"&command="+CMD_FASTFWD );
}
function streamCmdSlowFwd( action )
{
setButtonState( $('pauseBtn'), 'inactive' );
setButtonState( $('playBtn'), 'inactive' );
setButtonState( $('stopBtn'), 'inactive' );
setButtonState( $('fastFwdBtn'), 'inactive' );
setButtonState( $('slowFwdBtn'), 'active' );
setButtonState( $('slowRevBtn'), 'inactive' );
setButtonState( $('fastRevBtn'), 'inactive' );
if ( action )
streamCmdReq.send( streamCmdParms+"&command="+CMD_SLOWFWD );
setButtonState( $('pauseBtn'), 'active' );
setButtonState( $('slowFwdBtn'), 'inactive' );
}
function streamCmdSlowRev( action )
{
setButtonState( $('pauseBtn'), 'inactive' );
setButtonState( $('playBtn'), 'inactive' );
setButtonState( $('stopBtn'), 'inactive' );
setButtonState( $('fastFwdBtn'), 'inactive' );
setButtonState( $('slowFwdBtn'), 'inactive' );
setButtonState( $('slowRevBtn'), 'active' );
setButtonState( $('fastRevBtn'), 'inactive' );
if ( action )
streamCmdReq.send( streamCmdParms+"&command="+CMD_SLOWREV );
setButtonState( $('pauseBtn'), 'active' );
setButtonState( $('slowRevBtn'), 'inactive' );
}
function streamCmdFastRev( action )
{
setButtonState( $('pauseBtn'), 'inactive' );
setButtonState( $('playBtn'), 'inactive' );
setButtonState( $('stopBtn'), 'inactive' );
setButtonState( $('fastFwdBtn'), 'inactive' );
setButtonState( $('slowFwdBtn'), 'inactive' );
setButtonState( $('slowRevBtn'), 'inactive' );
setButtonState( $('fastRevBtn'), 'inactive' );
if ( action )
streamCmdReq.send( streamCmdParms+"&command="+CMD_FASTREV );
}
function streamCmdZoomIn( x, y )
{
streamCmdReq.send( streamCmdParms+"&command="+CMD_ZOOMIN+"&x="+x+"&y="+y );
}
function streamCmdZoomOut()
{
streamCmdReq.send( streamCmdParms+"&command="+CMD_ZOOMOUT );
}
function streamCmdScale( scale )
{
streamCmdReq.send( streamCmdParms+"&command="+CMD_SCALE+"&scale="+scale );
}
function streamCmdPan( x, y )
{
streamCmdReq.send( streamCmdParms+"&command="+CMD_PAN+"&x="+x+"&y="+y );
}
function streamCmdQuery()
{
streamCmdReq.send( streamCmdParms+"&command="+CMD_QUERY );
}
>>>>>>> master
var statusCmdParms = "view=request&request=status&entity=monitor&id="+monitorId+"&element[]=Status&element[]=FrameRate";
if ( auth_hash )
@ -541,21 +333,16 @@ if ( auth_hash )
var statusCmdReq = new Request.JSON( { url: monitorUrl+thisUrl, method: 'get', data: statusCmdParms, timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getStatusCmdResponse } );
var statusCmdTimer = null;
<<<<<<< HEAD
function getStatusCmdResponse( respObj, respText ) {
console.log("Got statusCmdQuery");
watchdogOk("status");
if ( statusCmdTimer )
statusCmdTimer = clearTimeout( statusCmdTimer );
if ( respObj.result == 'Ok' ) {
console.log("Got ok for status");
$('fpsValue').set( 'text', respObj.monitor.FrameRate );
setAlarmState( respObj.monitor.Status );
} else {
console.log("Got bad response for status");
} else
checkStreamForErrors("getStatusCmdResponse", respObj);
}
var statusCmdTimeout = statusRefreshTimeout;
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
@ -564,35 +351,8 @@ console.log("Got ok for status");
}
function statusCmdQuery() {
console.log("Sending statusCmdQuery");
statusCmdReq.send();
}
=======
function getStatusCmdResponse( respObj, respText )
{
watchdogOk("status");
if ( statusCmdTimer )
statusCmdTimer = clearTimeout( statusCmdTimer );
if ( respObj.result == 'Ok' )
{
$('fpsValue').set( 'text', respObj.monitor.FrameRate );
setAlarmState( respObj.monitor.Status );
}
else
checkStreamForErrors("getStatusCmdResponse", respObj);
var statusCmdTimeout = statusRefreshTimeout;
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
statusCmdTimeout = statusCmdTimeout/5;
statusCmdTimer = statusCmdQuery.delay( statusCmdTimeout );
}
function statusCmdQuery()
{
statusCmdReq.send();
}
>>>>>>> master
var alarmCmdParms = "view=request&request=alarm&id="+monitorId;
if ( auth_hash )
@ -600,14 +360,8 @@ if ( auth_hash )
var alarmCmdReq = new Request.JSON( { url: monitorUrl+thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getAlarmCmdResponse, onTimeout: streamCmdQuery } );
var alarmCmdFirst = true;
<<<<<<< HEAD
function getAlarmCmdResponse( respObj, respText ) {
checkStreamForErrors("getAlarmCmdResponse", respObj);
=======
function getAlarmCmdResponse( respObj, respText )
{
checkStreamForErrors("getAlarmCmdResponse", respObj);
>>>>>>> master
}
function cmdDisableAlarms() {
@ -649,7 +403,6 @@ var eventCmdReq = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJA
var eventCmdTimer = null;
var eventCmdFirst = true;
<<<<<<< HEAD
function highlightRow( row ) {
$(row).toggleClass( 'highlight' );
}
@ -712,87 +465,6 @@ function getEventCmdResponse( respObj, respText ) {
row.inject( $(eventListBody), 'top' );
if ( !eventCmdFirst )
row.addClass( 'recent' );
=======
function highlightRow( row )
{
$(row).toggleClass( 'highlight' );
}
function getEventCmdResponse( respObj, respText )
{
watchdogOk("event");
if ( eventCmdTimer )
eventCmdTimer = clearTimeout( eventCmdTimer );
if ( respObj.result == 'Ok' )
{
var dbEvents = respObj.events.reverse();
var eventList = $('eventList');
var eventListBody = $(eventList).getElement( 'tbody' );
var eventListRows = $(eventListBody).getElements( 'tr' );
eventListRows.each( function( row ) { row.removeClass( 'updated' ); } );
for ( var i = 0; i < dbEvents.length; i++ )
{
var event = dbEvents[i];
var row = $('event'+event.Id);
var newEvent = (row == null ? true : false);
if ( newEvent )
{
row = new Element( 'tr', { 'id': 'event'+event.Id } );
new Element( 'td', { 'class': 'colId' } ).inject( row );
new Element( 'td', { 'class': 'colName' } ).inject( row );
new Element( 'td', { 'class': 'colTime' } ).inject( row );
new Element( 'td', { 'class': 'colSecs' } ).inject( row );
new Element( 'td', { 'class': 'colFrames' } ).inject( row );
new Element( 'td', { 'class': 'colScore' } ).inject( row );
new Element( 'td', { 'class': 'colDelete' } ).inject( row );
var cells = row.getElements( 'td' );
var link = new Element( 'a', { 'href': '#', 'events': { 'click': createEventPopup.pass( [event.Id, '&trms=1&attr1=MonitorId&op1=%3d&val1='+monitorId+'&page=1', event.Width, event.Height] ) } });
link.set( 'text', event.Id );
link.inject( row.getElement( 'td.colId' ) );
link = new Element( 'a', { 'href': '#', 'events': { 'click': createEventPopup.pass( [event.Id, '&trms=1&attr1=MonitorId&op1=%3d&val1='+monitorId+'&page=1', event.Width, event.Height] ) } });
link.set( 'text', event.Name );
link.inject( row.getElement( 'td.colName' ) );
row.getElement( 'td.colTime' ).set( 'text', event.StartTime );
row.getElement( 'td.colSecs' ).set( 'text', event.Length );
link = new Element( 'a', { 'href': '#', 'events': { 'click': createFramesPopup.pass( [event.Id, event.Width, event.Height] ) } });
link.set( 'text', event.Frames+'/'+event.AlarmFrames );
link.inject( row.getElement( 'td.colFrames' ) );
link = new Element( 'a', { 'href': '#', 'events': { 'click': createFramePopup.pass( [event.Id, '0', event.Width, event.Height] ) } });
link.set( 'text', event.AvgScore+'/'+event.MaxScore );
link.inject( row.getElement( 'td.colScore' ) );
link = new Element( 'a', { 'href': '#', 'title': deleteString, 'events': { 'click': function( e ) { deleteEvent( e, event.Id ); }, 'mouseover': highlightRow.pass( row ), 'mouseout': highlightRow.pass( row ) } });
link.set( 'text', 'X' );
link.inject( row.getElement( 'td.colDelete' ) );
if ( i == 0 )
row.inject( $(eventListBody) );
else
{
row.inject( $(eventListBody), 'top' );
if ( !eventCmdFirst )
row.addClass( 'recent' );
}
}
else
{
row.getElement( 'td.colName a' ).set( 'text', event.Name );
row.getElement( 'td.colSecs' ).set( 'text', event.Length );
row.getElement( 'td.colFrames a' ).set( 'text', event.Frames+'/'+event.AlarmFrames );
row.getElement( 'td.colScore a' ).set( 'text', event.AvgScore+'/'+event.MaxScore );
row.removeClass( 'recent' );
}
row.addClass( 'updated' );
>>>>>>> master
}
} else {
row.getElement( 'td.colName a' ).set( 'text', event.Name );
@ -812,17 +484,12 @@ function getEventCmdResponse( respObj, respText )
i--;
}
}
<<<<<<< HEAD
while ( rows.length > maxDisplayEvents ) {
rows[rows.length-1].destroy();
rows.length--;
}
} else
checkStreamForErrors("getEventCmdResponse", respObj);
=======
else
checkStreamForErrors("getEventCmdResponse", respObj);
>>>>>>> master
var eventCmdTimeout = eventsRefreshTimeout;
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
@ -871,7 +538,6 @@ function controlCmd( control, event, xtell, ytell ) {
xge = 2*(50 - xge);
locParms += "&xge="+xge;
}
<<<<<<< HEAD
if ( ytell ) {
var yge = parseInt( (y*100)/coords.height );
if ( ytell == -1 )
@ -879,42 +545,6 @@ function controlCmd( control, event, xtell, ytell ) {
else if ( ytell == 2 )
yge = 2*(50 - yge);
locParms += "&yge="+yge;
=======
}
function controlCmd( control, event, xtell, ytell )
{
var locParms = "";
if ( event && (xtell || ytell) )
{
var xEvent = new Event( event );
var target = xEvent.target;
var coords = $(target).getCoordinates();
var l = coords.left;
var t = coords.top;
var x = xEvent.page.x - l;
var y = xEvent.page.y - t;
if ( xtell )
{
var xge = parseInt( (x*100)/coords.width );
if ( xtell == -1 )
xge = 100 - xge;
else if ( xtell == 2 )
xge = 2*(50 - xge);
locParms += "&xge="+xge;
}
if ( ytell )
{
var yge = parseInt( (y*100)/coords.height );
if ( ytell == -1 )
yge = 100 - yge;
else if ( ytell == 2 )
yge = 2*(50 - yge);
locParms += "&yge="+yge;
}
>>>>>>> master
}
}
controlReq.send( controlParms+"&control="+control+locParms );
@ -927,7 +557,6 @@ function controlCmdImage( x, y ) {
imageControlParms += "&scale="+scale;
imageControlParms += "&control="+imageControlMode;
<<<<<<< HEAD
controlReq.send( imageControlParms+"&x="+x+"&y="+y );
if ( streamMode == "single" )
fetchImage.pass( $('imageFeed').getElement('img') ).delay( 1000 );
@ -935,40 +564,6 @@ function controlCmdImage( x, y ) {
function fetchImage( streamImage ) {
streamImage.src = streamImage.src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) ));
=======
controlReq.send( imageControlParms+"&x="+x+"&y="+y );
if ( streamMode == "single" )
fetchImage.pass( $('imageFeed').getElement('img') ).delay( 1000 );
}
var tempImage = null;
function fetchImage( streamImage )
{
var now = new Date();
if ( !tempImage )
tempImage = new Element( 'img' );
tempImage.setProperty( 'src', streamSrc+'&'+now.getTime() );
$(streamImage).setProperty( 'src', tempImage.getProperty( 'src' ) );
}
function handleClick( event )
{
var target = event.target;
var x = event.page.x - $(target).getLeft();
var y = event.page.y - $(target).getTop();
if ( showMode == "events" || !imageControlMode )
{
if ( event.shift )
streamCmdPan( x, y );
else
streamCmdZoomIn( x, y );
}
else
{
controlCmdImage( x, y );
}
>>>>>>> master
}
function handleClick( event ) {
@ -1017,7 +612,6 @@ function watchdogCheck( type ) {
console.log( "Detected streamWatch of type: " + type + " stopped, restarting" );
watchdogFunctions[type]();
watchdogInactive[type] = false;
<<<<<<< HEAD
} else {
watchdogInactive[type] = true;
}
@ -1052,42 +646,6 @@ function initPage() {
if ( refreshApplet && appletRefreshTime )
appletRefresh.delay( appletRefreshTime*1000 );
=======
}
function initPage()
{
if ( streamMode == "single" )
{
statusCmdTimer = statusCmdQuery.delay( (Math.random()+0.1)*statusRefreshTimeout );
watchdogCheck.pass('status').periodical(statusRefreshTimeout*2);
}
else
{
streamCmdTimer = streamCmdQuery.delay( (Math.random()+0.1)*statusRefreshTimeout );
watchdogCheck.pass('stream').periodical(statusRefreshTimeout*2);
}
eventCmdTimer = eventCmdQuery.delay( (Math.random()+0.1)*statusRefreshTimeout );
watchdogCheck.pass('event').periodical(eventsRefreshTimeout*2);
if ( canStreamNative || streamMode == "single" )
{
var streamImg = $('imageFeed').getElement('img');
if ( !streamImg )
streamImg = $('imageFeed').getElement('object');
if ( streamMode == "single" )
{
streamImg.addEvent( 'click', fetchImage.pass( streamImg ) );
fetchImage.pass( streamImg ).periodical( imageRefreshTimeout );
}
else
streamImg.addEvent( 'click', function( event ) { handleClick( event ); } );
}
if ( refreshApplet && appletRefreshTime )
appletRefresh.delay( appletRefreshTime*1000 );
>>>>>>> master
}
// Kick everything off

View File

@ -319,12 +319,7 @@ function delPoint( index ) {
drawZonePoints();
}
<<<<<<< HEAD
function limitPointValue( point, loVal, hiVal ) {
=======
function limitPointValue( point, loVal, hiVal )
{
>>>>>>> master
point.value = constrainValue(point.value, loVal, hiVal);
}
@ -454,10 +449,8 @@ function setAlarmState( currentAlarmState ) {
var newAlarm = ( isAlarmed && !wasAlarmed );
var oldAlarm = ( !isAlarmed && wasAlarmed );
if ( newAlarm )
{
if ( SOUND_ON_ALARM )
{
if ( newAlarm ) {
if ( SOUND_ON_ALARM ) {
// Enable the alarm sound
if ( !canPlayPauseAudio )
$('alarmSound').removeClass( 'hidden' );
@ -465,10 +458,8 @@ function setAlarmState( currentAlarmState ) {
$('MediaPlayer').Play();
}
}
if ( SOUND_ON_ALARM )
{
if ( oldAlarm )
{
if ( SOUND_ON_ALARM ) {
if ( oldAlarm ) {
// Disable alarm sound
if ( !canPlayPauseAudio )
$('alarmSound').addClass( 'hidden' );
@ -498,8 +489,7 @@ function getStreamCmdResponse( respObj, respText ) {
var delayString = secsToTime( streamStatus.delay );
if ( streamStatus.paused == true )
{
if ( streamStatus.paused == true ) {
streamCmdPause( false );
} else if ( streamStatus.delayed == true && streamStatus.rate == 1 ) {
streamCmdPlay( false );
@ -537,8 +527,7 @@ function streamCmdPause( action ) {
streamCmdReq.send( streamCmdParms+"&command="+CMD_PAUSE );
}
function streamCmdPlay( action )
{
function streamCmdPlay( action ) {
if ( action )
streamCmdReq.send( streamCmdParms+"&command="+CMD_PLAY );
}
@ -561,12 +550,10 @@ function getStatusCmdResponse( respObj, respText ) {
if ( statusCmdTimer )
statusCmdTimer = clearTimeout( statusCmdTimer );
if ( respObj.result == 'Ok' )
{
if ( respObj.result == 'Ok' ) {
$('fpsValue').set( 'text', respObj.monitor.FrameRate );
setAlarmState( respObj.monitor.Status );
}
else
} else
checkStreamForErrors("getStatusCmdResponse", respObj);
var statusCmdTimeout = statusRefreshTimeout;

View File

@ -1,7 +1,6 @@
var presets = new Object();
<?php
foreach ( $presets as $preset )
{
foreach ( $presets as $preset ) {
?>
presets[<?php echo $preset['Id'] ?>] = {
'UnitsIndex': <?php echo $preset['UnitsIndex'] ?>,
@ -38,8 +37,7 @@ var zone = {
zone['Points'] = new Array();
<?php
for ( $i = 0; $i < count($newZone['Points']); $i++ )
{
for ( $i = 0; $i < count($newZone['Points']); $i++ ) {
?>
zone['Points'][<?php echo $i ?>] = { 'x': <?php echo $newZone['Points'][$i]['x'] ?>, 'y': <?php echo $newZone['Points'][$i]['y'] ?> };
<?php

View File

@ -66,9 +66,9 @@ $mouseover = true;
if ( !isset($mouseover) )
$mouseover = true;
$mode = "overlay";
$mode = 'overlay';
if ( !isset($mode) )
$mode = "overlay";
$mode = 'overlay';
$minEventWidth = 3;
$maxEventWidth = 6;
@ -130,7 +130,7 @@ $chart = array(
);
$monitors = array();
$monitorsSql = "select * from Monitors order by Sequence asc";
$monitorsSql = 'SELECT * FROM Monitors ORDER BY Sequence ASC';
//srand( 97981 );
foreach( dbFetchAll( $monitorsSql ) as $row ) {
//if ( empty($row['WebColour']) )
@ -140,8 +140,9 @@ foreach( dbFetchAll( $monitorsSql ) as $row ) {
$monitors[$row['Id']] = $row;
}
$rangeSql = 'SELECT min(StartTime) AS MinTime, max(EndTime) AS MaxTime FROM Events WHERE NOT isnull(StartTime) AND NOT isnull(EndTime)';
$eventsSql = 'SELECT * FROM Events WHERE NOT isnull(StartTime)';
# The as E, and joining with Monitors is required for the filterSQL filters.
$rangeSql = 'SELECT min(E.StartTime) AS MinTime, max(E.EndTime) AS MaxTime FROM Events AS E INNER JOIN Monitors AS M ON (E.MonitorId = M.Id) WHERE NOT isnull(E.StartTime) AND NOT isnull(E.EndTime)';
$eventsSql = 'SELECT * FROM Events AS E WHERE NOT isnull(StartTime)';
if ( !empty($user['MonitorIds']) ) {
$monFilterSql = ' AND MonitorId IN ('.$user['MonitorIds'].')';
@ -351,12 +352,12 @@ foreach( dbFetchAll( $eventsSql ) as $event ) {
}
if ( $event['MaxScore'] > 0 ) {
if ( $startIndex == $endIndex ) {
$framesSql = "select FrameId,Score from Frames where EventId = ? and Score > 0 order by Score desc limit 1";
$framesSql = 'SELECT FrameId,Score FROM Frames WHERE EventId = ? AND Score > 0 ORDER BY Score DESC LIMIT 1';
$frame = dbFetchOne( $framesSql, NULL, array($event['Id']) );
$i = $startIndex;
if ( !isset($currFrameSlots[$i]) ) {
$currFrameSlots[$i] = array( "count"=>1, "value"=>$event['MaxScore'], "event"=>$event, "frame"=>$frame );
$currFrameSlots[$i] = array( 'count'=>1, 'value'=>$event['MaxScore'], 'event'=>$event, 'frame'=>$frame );
} else {
$currFrameSlots[$i]['count']++;
if ( $event['MaxScore'] > $currFrameSlots[$i]['value'] ) {
@ -369,7 +370,7 @@ foreach( dbFetchAll( $eventsSql ) as $event ) {
$chart['data']['y']['hi'] = $event['MaxScore'];
}
} else {
$framesSql = "select FrameId,Delta,unix_timestamp(TimeStamp) as TimeT,Score from Frames where EventId = ? and Score > 0";
$framesSql = 'SELECT FrameId,Delta,unix_timestamp(TimeStamp) AS TimeT,Score FROM Frames WHERE EventId = ? AND Score > 0';
$result = dbQuery( $framesSql, array( $event['Id'] ) );
while( $frame = dbFetchNext( $result ) ) {
if ( $frame['Score'] == 0 )
@ -383,7 +384,7 @@ foreach( dbFetchAll( $eventsSql ) as $event ) {
continue;
if ( !isset($currFrameSlots[$frameIndex]) ) {
$currFrameSlots[$frameIndex] = array( "count"=>1, "value"=>$frame['Score'], "event"=>$event, "frame"=>$frame );
$currFrameSlots[$frameIndex] = array( 'count'=>1, 'value'=>$frame['Score'], 'event'=>$event, 'frame'=>$frame );
} else {
$currFrameSlots[$frameIndex]['count']++;
if ( $frame['Score'] > $currFrameSlots[$frameIndex]['value'] ) {
@ -496,7 +497,7 @@ for ( $i = 0; $i < $chart['graph']['width']; $i++ ) {
$frameSlots[$i][] = &$currFrameSlots[$i];
}
}
}
} # end foreach MonitorId
}
//print_r( $monEventSlots );
@ -505,7 +506,7 @@ for ( $i = 0; $i < $chart['graph']['width']; $i++ ) {
$graphHeight = $chart['graph']['height'];
if ( $mode == "overlay" ) {
if ( $mode == 'overlay' ) {
$minEventBarHeight = 10;
$maxEventBarHeight = 40;
@ -527,7 +528,7 @@ if ( $mode == "overlay" ) {
$chart['eventBars'][$monitorId] = array( 'top' => $top );
$top += $chart['graph']['eventBarHeight']+1;
}
} elseif ( $mode == "split" ) {
} else if ( $mode == 'split' ) {
$minActivityBarHeight = 30;
$minEventBarHeight = 10;
$maxEventBarHeight = 40;
@ -547,14 +548,11 @@ if ( $mode == "overlay" ) {
}
$chart['data']['y']['density'] = $chart['data']['y']['range']/$chart['graph']['activityBarHeight'];
?>
<?php
$chart['activityBars'] = array();
$chart['eventBars'] = array();
$top = 0;
$barCount = 1;
foreach ( array_keys($monitorIds) as $monitorId )
{
foreach ( array_keys($monitorIds) as $monitorId ) {
$chart['eventBars'][$monitorId] = array( 'top' => $top );
$chart['eventBars'][$monitorId] = array( 'top' => $top+$chart['graph']['activityBarHeight']+1 );
$top += $chart['graph']['activityBarHeight']+1+$chart['graph']['eventBarHeight']+1;
@ -579,6 +577,7 @@ if ( $startMatches[1] != $endMatches[1] ) {
}
function drawXGrid( $chart, $scale, $labelClass, $tickClass, $gridClass, $zoomClass=false ) {
$html = '';
ob_start();
$labelCount = 0;
$lastTick = 0;
@ -624,10 +623,11 @@ function drawXGrid( $chart, $scale, $labelClass, $tickClass, $gridClass, $zoomCl
<?php
}
$lastTick = $i;
}
} # end if $lastLabel
}
$lastLabel = $label;
}
} # end foreach width segment
if ( $zoomClass ) {
$zoomMinTime = strftime( STRF_FMT_DATETIME_DB, (int)($chart['data']['x']['lo'] + ($lastTick * $chart['data']['x']['density'])) );
$zoomMaxTime = strftime( STRF_FMT_DATETIME_DB, (int)($chart['data']['x']['lo'] + ($i * $chart['data']['x']['density'])) );
@ -639,7 +639,7 @@ function drawXGrid( $chart, $scale, $labelClass, $tickClass, $gridClass, $zoomCl
</div>
<?php
return( ob_get_clean() );
}
} # end function drawXGrid
function drawYGrid( $chart, $scale, $labelClass, $tickClass, $gridClass ) {
ob_start();
@ -664,13 +664,12 @@ function drawYGrid( $chart, $scale, $labelClass, $tickClass, $gridClass ) {
<div class="<?php echo $gridClass ?>" style="top: <?php echo $chart['graph']['height']-($y+2) ?>px;<?php echo $i <= 0?' border-top: solid 1px black;':'' ?>"></div>
<?php
}
}
} # end foreach line segment
?>
</div>
<?php
return( ob_get_clean() );
}
} # end function drawYGrid
function getSlotPreviewEventBehaviour( $slot ) {
return( "previewEvent( '".$slot['event']['Id']."', '".getSlotFrame( $slot )."' )" );
@ -736,12 +735,12 @@ o-->
<div id="chartPanel">
<div id="chart" class="graphSize">
<?php
if ( $mode == "overlay" ) {
echo drawYGrid( $chart, $majYScale, "majLabelY", "majTickY", "majGridY graphWidth" );
if ( $mode == 'overlay' ) {
echo drawYGrid( $chart, $majYScale, 'majLabelY', 'majTickY', 'majGridY graphWidth' );
}
echo drawXGrid( $chart, $majXScale, "majLabelX", "majTickX", "majGridX graphHeight", "zoom graphHeight" );
echo drawXGrid( $chart, $majXScale, 'majLabelX', 'majTickX', 'majGridX graphHeight', 'zoom graphHeight' );
if ( $mode == "overlay" ) {
if ( $mode == 'overlay' ) {
?>
<div id="activity" class="activitySize">
<?php
@ -770,7 +769,7 @@ if ( $mode == "overlay" ) {
?>
</div>
<?php
} elseif ( $mode == "split" ) {
} elseif ( $mode == 'split' ) {
foreach( array_keys($monFrameSlots) as $monitorId ) {
?>
<div id="activity<?php echo $monitorId ?>">
@ -796,11 +795,11 @@ if ( $mode == "overlay" ) {
?>
<div class="activity activity<?php echo $slot['event']['MonitorId'] ?>" style="left: <?php echo $index ?>px; height: <?php echo $slotHeight ?>px;" <?php echo join( " ", $behaviours ) ?>></div>
<?php
}
} # end foreach $currFrameSlots
?>
</div>
<?php
}
} # end foreach $MonitorId
}
foreach( array_keys($monEventSlots) as $monitorId ) {
?>
@ -830,8 +829,8 @@ foreach( array_keys($monEventSlots) as $monitorId ) {
?>
<div class="event eventsHeight monitorColour<?php echo $monitorId ?>" style="left: <?php echo $i ?>px; width: <?php echo $slot['width'] ?>px;" <?php echo join( " ", $behaviours ) ?>></div>
<?php
}
}
} # end if isset($currEventSlots[$i])
} # end foreach width segment
?>
</div>
<?php

View File

@ -34,6 +34,7 @@ if ( ! visibleMonitor( $mid ) ) {
$monitor = new Monitor( $mid );
#Whether to show the controls button
$showPtzControls = ( ZM_OPT_CONTROL && $monitor->Controllable() && canView( 'Control' ) );
if ( isset( $_REQUEST['scale'] ) ) {

View File

@ -92,7 +92,7 @@ if ( empty($_REQUEST['path']) ) {
$output = array();
$retval = 0;
exec( $command, $output, $retval );
Logger::Debug("Retval: $retval, output: " . implode("\n", $output));
Logger::Debug("Command: $command, retval: $retval, output: " . implode("\n", $output));
if ( ! file_exists( $path ) ) {
header('HTTP/1.0 404 Not Found');
Fatal("Can't create frame images from video for this event (".$Event->DefaultVideo() );

View File

@ -40,7 +40,7 @@ $Event = null;
if ( ! empty($_REQUEST['eid'] ) ) {
$Event = new Event( $_REQUEST['eid'] );
$path = $Event->Path().'/'.$Event->DefaultVideo();
Debug("Path: $path");
Logger::Debug("Path: $path");
} else {
$errorText = 'No video path';
}
@ -64,14 +64,14 @@ $end = $size-1;
$length = $size;
if ( isset( $_SERVER['HTTP_RANGE'] ) ) {
Debug("Using Range " . $_SERVER['HTTP_RANGE'] );
Logger::Debug("Using Range " . $_SERVER['HTTP_RANGE'] );
if ( preg_match( '/bytes=\h*(\d+)-(\d*)[\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches) ) {
$begin = intval( $matches[1] );
if ( ! empty( $matches[2]) ) {
$end = intval( $matches[2] );
}
$length = $end - $begin + 1;
Debug("Using Range $begin $end size: $size, length: $length");
Logger::Debug("Using Range $begin $end size: $size, length: $length");
}
} # end if HTTP_RANGE