Merge branch 'storageareas' of github.com:/ConnorTechnology/ZoneMinder into storageareas
This commit is contained in:
commit
4dc5f0060f
|
@ -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 {
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -10,8 +10,9 @@ table.filterTable {
|
|||
}
|
||||
|
||||
#fieldsTable input[type=button] {
|
||||
width: 1.6em;
|
||||
width: 1.8em;
|
||||
margin-left: 2px;
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
|
|
@ -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[*/
|
||||
|
@ -98,14 +95,12 @@ var $j = jQuery.noConflict();
|
|||
<script src='https://www.google.com/recaptcha/api.js'></script>
|
||||
<?php } else if ( $title == 'Event' ) {
|
||||
?>
|
||||
<link href="skins/<?php echo $skin ?>/js/video-js.css" rel="stylesheet">
|
||||
<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 )
|
||||
{
|
||||
<link href="skins/<?php echo $skin ?>/js/video-js.css" rel="stylesheet">
|
||||
<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 ) {
|
||||
?>
|
||||
<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
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
//
|
||||
|
||||
if ( !canView( 'Events' ) ) {
|
||||
$view = 'error';
|
||||
return;
|
||||
$view = 'error';
|
||||
return;
|
||||
}
|
||||
|
||||
$eid = validInt( $_REQUEST['eid'] );
|
||||
|
@ -37,9 +37,9 @@ if ( $user['MonitorIds'] ) {
|
|||
}
|
||||
|
||||
if ( isset( $_REQUEST['rate'] ) )
|
||||
$rate = validInt($_REQUEST['rate']);
|
||||
$rate = validInt($_REQUEST['rate']);
|
||||
else
|
||||
$rate = reScale( RATE_BASE, $Monitor->DefaultRate(), ZM_WEB_DEFAULT_RATE );
|
||||
$rate = reScale( RATE_BASE, $Monitor->DefaultRate(), ZM_WEB_DEFAULT_RATE );
|
||||
|
||||
if ( isset( $_REQUEST['scale'] ) ) {
|
||||
$scale = validInt($_REQUEST['scale']);
|
||||
|
@ -56,14 +56,14 @@ $replayModes = array(
|
|||
);
|
||||
|
||||
if ( isset( $_REQUEST['streamMode'] ) )
|
||||
$streamMode = validHtmlStr($_REQUEST['streamMode']);
|
||||
$streamMode = validHtmlStr($_REQUEST['streamMode']);
|
||||
else
|
||||
$streamMode = 'video';
|
||||
$streamMode = 'video';
|
||||
|
||||
if ( isset( $_REQUEST['replayMode'] ) )
|
||||
$replayMode = validHtmlStr($_REQUEST['replayMode']);
|
||||
$replayMode = validHtmlStr($_REQUEST['replayMode']);
|
||||
if ( isset( $_COOKIE['replayMode']) && preg_match('#^[a-z]+$#', $_COOKIE['replayMode']) )
|
||||
$replayMode = validHtmlStr($_COOKIE['replayMode']);
|
||||
$replayMode = validHtmlStr($_COOKIE['replayMode']);
|
||||
else {
|
||||
$keys = array_keys( $replayModes );
|
||||
$replayMode = array_shift( $keys );
|
||||
|
@ -73,10 +73,10 @@ else {
|
|||
$Zoom = 1;
|
||||
$Rotation = 0;
|
||||
if ( $Monitor->VideoWriter() == '2' ) {
|
||||
# Passthrough
|
||||
$Rotation = $Event->Orientation();
|
||||
if ( in_array($Event->Orientation(),array('90','270')) )
|
||||
$Zoom = $Event->Height()/$Event->Width();
|
||||
# Passthrough
|
||||
$Rotation = $Event->Orientation();
|
||||
if ( in_array($Event->Orientation(),array('90','270')) )
|
||||
$Zoom = $Event->Height()/$Event->Width();
|
||||
}
|
||||
|
||||
parseSort();
|
||||
|
@ -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,15 +170,15 @@ 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) );
|
||||
if ( canStreamNative() ) {
|
||||
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 ) );
|
||||
}
|
||||
$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()) );
|
||||
} else {
|
||||
outputHelperStream( 'evtStream', $streamSrc, reScale( $Event->Width(), $scale ), reScale( $Event->Height(), $scale ) );
|
||||
}
|
||||
} // end if stream method
|
||||
?>
|
||||
</div>
|
||||
|
@ -206,7 +207,7 @@ if ( ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT ) {
|
|||
</div>
|
||||
</div>
|
||||
<?php
|
||||
if ($Event->SaveJPEGs() & 3) { // frames or analysis
|
||||
if ( $Event->SaveJPEGs() & 3 ) { // frames or analysis
|
||||
?>
|
||||
<div id="eventStills" class="hidden">
|
||||
<div id="eventThumbsPanel">
|
||||
|
|
|
@ -1,96 +1,79 @@
|
|||
var jsTranslatedAddText;
|
||||
var jsTranslatedCloneText;
|
||||
|
||||
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 )
|
||||
{
|
||||
if ( checked++ > 1 )
|
||||
break;
|
||||
}
|
||||
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 ) {
|
||||
if ( checked++ > 1 )
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$(element).closest("tr").toggleClass("danger");
|
||||
form.editBtn.disabled = (checked!=1);
|
||||
form.addBtn.value = (checked==1) ? jsTranslatedCloneText:jsTranslatedAddText;
|
||||
|
||||
form.deleteBtn.disabled = (checked==0);
|
||||
}
|
||||
|
||||
function addMonitor( element) {
|
||||
var form = element.form;
|
||||
var dupParam;
|
||||
var monitorId=-1;
|
||||
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 ) {
|
||||
monitorId = form.elements[i].value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$(element).closest("tr").toggleClass("danger");
|
||||
form.editBtn.disabled = (checked!=1);
|
||||
form.addBtn.value = (checked==1) ? jsTranslatedCloneText:jsTranslatedAddText;
|
||||
|
||||
form.deleteBtn.disabled = (checked==0);
|
||||
}
|
||||
dupParam = (monitorId == -1 ) ? '': '&dupId='+monitorId;
|
||||
createPopup( '?view=monitor'+dupParam, 'zmMonitor0', 'monitor' );
|
||||
}
|
||||
|
||||
function addMonitor( 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 ) {
|
||||
var monitorId = form.elements[i].value;
|
||||
createPopup( '?view=monitor&mid='+monitorId, 'zmMonitor'+monitorId, 'monitor' );
|
||||
form.elements[i].checked = false;
|
||||
setButtonStates( form.elements[i] );
|
||||
//$(form.elements[i]).getParent( 'tr' ).removeClass( 'highlight' );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
var dupParam;
|
||||
var monitorId=-1;
|
||||
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 )
|
||||
{
|
||||
monitorId = form.elements[i].value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dupParam = (monitorId == -1 ) ? '': '&dupId='+monitorId;
|
||||
createPopup( '?view=monitor'+dupParam, 'zmMonitor0', 'monitor' );
|
||||
form.elements['action'].value = 'delete';
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
var monitorId = form.elements[i].value;
|
||||
createPopup( '?view=monitor&mid='+monitorId, 'zmMonitor'+monitorId, 'monitor' );
|
||||
form.elements[i].checked = false;
|
||||
setButtonStates( form.elements[i] );
|
||||
//$(form.elements[i]).getParent( 'tr' ).removeClass( 'highlight' );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
function reloadWindow() {
|
||||
window.location.replace( thisUrl );
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
window.location.replace( thisUrl );
|
||||
}
|
||||
|
||||
function initPage()
|
||||
{
|
||||
jsTranslatedAddText = translatedAddText;
|
||||
jsTranslatedCloneText = translatedCloneText;
|
||||
reloadWindow.periodical( consoleRefreshTimeout );
|
||||
if ( showVersionPopup )
|
||||
createPopup( '?view=version', 'zmVersion', 'version' );
|
||||
if ( showDonatePopup )
|
||||
createPopup( '?view=donate', 'zmDonate', 'donate' );
|
||||
function initPage() {
|
||||
jsTranslatedAddText = translatedAddText;
|
||||
jsTranslatedCloneText = translatedCloneText;
|
||||
reloadWindow.periodical( consoleRefreshTimeout );
|
||||
if ( showVersionPopup )
|
||||
createPopup( '?view=version', 'zmVersion', 'version' );
|
||||
if ( showDonatePopup )
|
||||
createPopup( '?view=donate', 'zmDonate', 'donate' );
|
||||
}
|
||||
|
||||
function applySort(event, ui) {
|
||||
|
|
|
@ -1,27 +1,19 @@
|
|||
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() ) )
|
||||
{
|
||||
$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() )
|
||||
{
|
||||
$showDonatePopup = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$nextReminder = time() + 30*24*60*60;
|
||||
dbQuery( "update Config set Value = '".$nextReminder."' where Name = 'ZM_DYN_DONATE_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() ) {
|
||||
$showDonatePopup = true;
|
||||
}
|
||||
} else {
|
||||
$nextReminder = time() + 30*24*60*60;
|
||||
dbQuery( "update Config set Value = '".$nextReminder."' where Name = 'ZM_DYN_DONATE_REMINDER_TIME'" );
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
var showVersionPopup = <?php echo isset($showVersionPopup )?'true':'false' ?>;
|
||||
|
|
|
@ -1,49 +1,43 @@
|
|||
var controlParms = "view=request&request=control";
|
||||
var controlReq = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, onSuccess: getControlResponse } );
|
||||
|
||||
function getControlResponse( respObj, respText )
|
||||
{
|
||||
if ( !respObj )
|
||||
return;
|
||||
//console.log( respText );
|
||||
if ( respObj.result != 'Ok' )
|
||||
{
|
||||
alert( "Control response was status = "+respObj.status+"\nmessage = "+respObj.message );
|
||||
}
|
||||
function getControlResponse( respObj, respText ) {
|
||||
if ( !respObj )
|
||||
return;
|
||||
//console.log( respText );
|
||||
if ( respObj.result != 'Ok' ) {
|
||||
alert( "Control response was status = "+respObj.status+"\nmessage = "+respObj.message );
|
||||
}
|
||||
}
|
||||
|
||||
function controlCmd( control, event, xtell, ytell )
|
||||
{
|
||||
var locParms = "&id="+$('mid').get('value');
|
||||
if ( event && (xtell || ytell) )
|
||||
{
|
||||
var xEvent = new Event( event );
|
||||
var target = xEvent.target;
|
||||
var coords = $(target).getCoordinates();
|
||||
function controlCmd( control, event, xtell, ytell ) {
|
||||
var locParms = "&id="+$('mid').get('value');
|
||||
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;
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
controlReq.send( controlParms+"&control="+control+locParms );
|
||||
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;
|
||||
}
|
||||
}
|
||||
controlReq.send( controlParms+"&control="+control+locParms );
|
||||
}
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
function validateForm( form ) {
|
||||
var errors = new Array();
|
||||
var errors = new Array();
|
||||
|
||||
// If "Can Move" is enabled, then the end user must also select at least one of the other check boxes (excluding Can Move Diagonally)
|
||||
if ( form.elements['newControl[CanMove]'].checked ) {
|
||||
if ( !(form.elements['newControl[CanMoveCon]'].checked || form.elements['newControl[CanMoveRel]'].checked || form.elements['newControl[CanMoveAbs]'].checked || form.elements['newControl[CanMoveMap]'].checked) ) {
|
||||
errors[errors.length] = "In addition to \"Can Move\", you also must select at least one of: \"Can Move Mapped\", \"Can Move Absolute\", \"Can Move Relative\", or \"Can Move Continuous\"";
|
||||
}
|
||||
} else {
|
||||
// If "Can Move" is enabled, then the end user must also select at least one of the other check boxes (excluding Can Move Diagonally)
|
||||
if ( form.elements['newControl[CanMove]'].checked ) {
|
||||
if ( !(form.elements['newControl[CanMoveCon]'].checked || form.elements['newControl[CanMoveRel]'].checked || form.elements['newControl[CanMoveAbs]'].checked || form.elements['newControl[CanMoveMap]'].checked) ) {
|
||||
errors[errors.length] = "In addition to \"Can Move\", you also must select at least one of: \"Can Move Mapped\", \"Can Move Absolute\", \"Can Move Relative\", or \"Can Move Continuous\"";
|
||||
}
|
||||
} else {
|
||||
// Now lets check for the opposite condition. If any of the boxes below Can Move are checked, but Can Move is not checked then signal an error
|
||||
|
||||
if ( form.elements['newControl[CanMoveCon]'].checked || form.elements['newControl[CanMoveRel]'].checked || form.elements['newControl[CanMoveAbs]'].checked || form.elements['newControl[CanMoveMap]'].checked || form.elements['newControl[CanMoveDiag]'].checked ) {
|
||||
errors[errors.length] = "\"Can Move\" must also be selected if any one of the movement types are sleceted";
|
||||
}
|
||||
if ( form.elements['newControl[CanMoveCon]'].checked || form.elements['newControl[CanMoveRel]'].checked || form.elements['newControl[CanMoveAbs]'].checked || form.elements['newControl[CanMoveMap]'].checked || form.elements['newControl[CanMoveDiag]'].checked ) {
|
||||
errors[errors.length] = "\"Can Move\" must also be selected if any one of the movement types are sleceted";
|
||||
}
|
||||
}
|
||||
|
||||
if ( errors.length ) {
|
||||
alert( errors.join( "\n" ) );
|
||||
return( false );
|
||||
}
|
||||
return( true );
|
||||
if ( errors.length ) {
|
||||
alert( errors.join( "\n" ) );
|
||||
return( false );
|
||||
}
|
||||
return( true );
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
function updateLabel()
|
||||
{
|
||||
var presetIndex = $('contentForm').preset.getValue();
|
||||
if ( labels[presetIndex] )
|
||||
{
|
||||
$('contentForm').newLabel.value = labels[presetIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
$('contentForm').newLabel.value = "";
|
||||
}
|
||||
function updateLabel() {
|
||||
var presetIndex = $('contentForm').preset.getValue();
|
||||
if ( labels[presetIndex] ) {
|
||||
$('contentForm').newLabel.value = labels[presetIndex];
|
||||
} else {
|
||||
$('contentForm').newLabel.value = "";
|
||||
}
|
||||
}
|
||||
|
||||
window.addEvent( 'domready', updateLabel );
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
function nextCycleView()
|
||||
{
|
||||
window.location.replace( '?view=cycle&group='+currGroup+'&mid='+nextMid+'&mode='+mode, cycleRefreshTimeout );
|
||||
function nextCycleView() {
|
||||
window.location.replace( '?view=cycle&group='+currGroup+'&mid='+nextMid+'&mode='+mode, cycleRefreshTimeout );
|
||||
}
|
||||
|
||||
function initCycle()
|
||||
{
|
||||
nextCycleView.periodical( cycleRefreshTimeout );
|
||||
function initCycle() {
|
||||
nextCycleView.periodical( cycleRefreshTimeout );
|
||||
}
|
||||
|
||||
window.addEvent( 'domready', initCycle );
|
||||
|
|
|
@ -1,47 +1,40 @@
|
|||
function switchDeviceOn( element, key )
|
||||
{
|
||||
var form = element.form;
|
||||
form.view.value = currentView;
|
||||
form.action.value = 'device';
|
||||
form.command.value = 'on';
|
||||
form.key.value = key;
|
||||
form.submit();
|
||||
function switchDeviceOn( element, key ) {
|
||||
var form = element.form;
|
||||
form.view.value = currentView;
|
||||
form.action.value = 'device';
|
||||
form.command.value = 'on';
|
||||
form.key.value = key;
|
||||
form.submit();
|
||||
}
|
||||
|
||||
function switchDeviceOff( element, key )
|
||||
{
|
||||
var form = element.form;
|
||||
form.view.value = currentView;
|
||||
form.action.value = 'device';
|
||||
form.command.value = 'off';
|
||||
form.key.value = key;
|
||||
form.submit();
|
||||
function switchDeviceOff( element, key ) {
|
||||
var form = element.form;
|
||||
form.view.value = currentView;
|
||||
form.action.value = 'device';
|
||||
form.command.value = 'off';
|
||||
form.key.value = key;
|
||||
form.submit();
|
||||
}
|
||||
|
||||
function deleteDevice( element )
|
||||
{
|
||||
var form = element.form;
|
||||
form.view.value = currentView;
|
||||
form.action.value = 'delete';
|
||||
form.submit();
|
||||
function deleteDevice( element ) {
|
||||
var form = element.form;
|
||||
form.view.value = currentView;
|
||||
form.action.value = 'delete';
|
||||
form.submit();
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
checked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
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 ) {
|
||||
checked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
form.deleteBtn.disabled = !checked;
|
||||
}
|
||||
form.deleteBtn.disabled = !checked;
|
||||
}
|
||||
|
||||
window.focus();
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
function submitForm( element )
|
||||
{
|
||||
var form = element.form;
|
||||
if ( form.option.selectedIndex == 0 )
|
||||
form.view.value = currentView;
|
||||
else
|
||||
form.view.value = 'none';
|
||||
form.submit();
|
||||
function submitForm( element ) {
|
||||
var form = element.form;
|
||||
if ( form.option.selectedIndex == 0 )
|
||||
form.view.value = currentView;
|
||||
else
|
||||
form.view.value = 'none';
|
||||
form.submit();
|
||||
}
|
||||
|
||||
if ( action == "donate" && option == "go" )
|
||||
{
|
||||
zmWindow();
|
||||
if ( action == "donate" && option == "go" ) {
|
||||
zmWindow();
|
||||
}
|
||||
|
|
|
@ -1,150 +1,121 @@
|
|||
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 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 )
|
||||
{
|
||||
var form = element.form;
|
||||
var checked = element.checked;
|
||||
for (var i = 0; i < form.elements.length; i++)
|
||||
if (form.elements[i].name.indexOf(name) == 0)
|
||||
form.elements[i].checked = checked;
|
||||
form.viewBtn.disabled = !checked;
|
||||
form.editBtn.disabled = !checked;
|
||||
form.archiveBtn.disabled = unarchivedEvents?!checked:true;
|
||||
form.unarchiveBtn.disabled = archivedEvents?!checked:true;
|
||||
form.exportBtn.disabled = !checked;
|
||||
form.deleteBtn.disabled = !checked;
|
||||
function toggleCheckbox( element, name ) {
|
||||
var form = element.form;
|
||||
var checked = element.checked;
|
||||
for (var i = 0; i < form.elements.length; i++)
|
||||
if (form.elements[i].name.indexOf(name) == 0)
|
||||
form.elements[i].checked = checked;
|
||||
form.viewBtn.disabled = !checked;
|
||||
form.editBtn.disabled = !checked;
|
||||
form.archiveBtn.disabled = unarchivedEvents?!checked:true;
|
||||
form.unarchiveBtn.disabled = archivedEvents?!checked:true;
|
||||
form.exportBtn.disabled = !checked;
|
||||
form.deleteBtn.disabled = !checked;
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
checked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
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 ) {
|
||||
checked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( !element.checked )
|
||||
form.toggleCheck.checked = false;
|
||||
form.viewBtn.disabled = !checked;
|
||||
form.editBtn.disabled = !checked;
|
||||
form.archiveBtn.disabled = (!checked)||(!unarchivedEvents);
|
||||
form.unarchiveBtn.disabled = (!checked)||(!archivedEvents);
|
||||
form.exportBtn.disabled = !checked;
|
||||
form.deleteBtn.disabled = !checked;
|
||||
}
|
||||
if ( !element.checked )
|
||||
form.toggleCheck.checked = false;
|
||||
form.viewBtn.disabled = !checked;
|
||||
form.editBtn.disabled = !checked;
|
||||
form.archiveBtn.disabled = (!checked)||(!unarchivedEvents);
|
||||
form.unarchiveBtn.disabled = (!checked)||(!archivedEvents);
|
||||
form.exportBtn.disabled = !checked;
|
||||
form.deleteBtn.disabled = !checked;
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
count++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
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 ) {
|
||||
count++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( count > 0 )
|
||||
{
|
||||
if ( confirm( confirmDeleteEventsString ) )
|
||||
{
|
||||
form.action.value = 'delete';
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
if ( count > 0 ) {
|
||||
if ( confirm( confirmDeleteEventsString ) ) {
|
||||
form.action.value = 'delete';
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
eids[eids.length] = 'eids[]='+form.elements[i].value;
|
||||
}
|
||||
}
|
||||
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 ) {
|
||||
eids[eids.length] = 'eids[]='+form.elements[i].value;
|
||||
}
|
||||
}
|
||||
createPopup( '?view=eventdetail&'+eids.join( '&' ), 'zmEventDetail', 'eventdetail' );
|
||||
}
|
||||
createPopup( '?view=eventdetail&'+eids.join( '&' ), 'zmEventDetail', 'eventdetail' );
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
eids[eids.length] = 'eids[]='+form.elements[i].value;
|
||||
}
|
||||
}
|
||||
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 ) {
|
||||
eids[eids.length] = 'eids[]='+form.elements[i].value;
|
||||
}
|
||||
}
|
||||
createPopup( '?view=export&'+eids.join( '&' ), 'zmExport', 'export' );
|
||||
}
|
||||
createPopup( '?view=export&'+eids.join( '&' ), 'zmExport', 'export' );
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
events[events.length] = form.elements[i].value;
|
||||
}
|
||||
}
|
||||
}
|
||||
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 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 ) {
|
||||
events[events.length] = form.elements[i].value;
|
||||
}
|
||||
}
|
||||
}
|
||||
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 )
|
||||
{
|
||||
var form = element.form;
|
||||
form.action.value = 'archive';
|
||||
form.submit();
|
||||
function archiveEvents( element, name ) {
|
||||
var form = element.form;
|
||||
form.action.value = 'archive';
|
||||
form.submit();
|
||||
}
|
||||
|
||||
function unarchiveEvents( element, name )
|
||||
{
|
||||
var form = element.form;
|
||||
form.action.value = 'unarchive';
|
||||
form.submit();
|
||||
function unarchiveEvents( element, name ) {
|
||||
var form = element.form;
|
||||
form.action.value = 'unarchive';
|
||||
form.submit();
|
||||
}
|
||||
|
||||
if ( openFilterWindow )
|
||||
{
|
||||
//opener.location.reload(true);
|
||||
createPopup( '?view=filter&page='+thisPage+filterQuery, 'zmFilter', 'filter' );
|
||||
location.replace( '?view='+currentView+'&page='+thisPage+filterQuery );
|
||||
if ( openFilterWindow ) {
|
||||
//opener.location.reload(true);
|
||||
createPopup( '?view=filter&page='+thisPage+filterQuery, 'zmFilter', 'filter' );
|
||||
location.replace( '?view='+currentView+'&page='+thisPage+filterQuery );
|
||||
}
|
||||
|
|
|
@ -1,58 +1,52 @@
|
|||
function configureExportButton( element )
|
||||
{
|
||||
var form = element.form;
|
||||
function configureExportButton( element ) {
|
||||
var form = element.form;
|
||||
|
||||
var checkCount = 0;
|
||||
var radioCount = 0;
|
||||
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);
|
||||
var checkCount = 0;
|
||||
var radioCount = 0;
|
||||
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 )
|
||||
{
|
||||
window.location.replace( exportFile );
|
||||
function startDownload( exportFile ) {
|
||||
window.location.replace( exportFile );
|
||||
}
|
||||
|
||||
var exportTimer = null;
|
||||
|
||||
function exportProgress()
|
||||
{
|
||||
var tickerText = $('exportProgressTicker').get('text');
|
||||
if ( tickerText.length < 1 || tickerText.length > 4 )
|
||||
$('exportProgressTicker').set( 'text', '.' );
|
||||
else
|
||||
$('exportProgressTicker').appendText( '.' );
|
||||
function exportProgress() {
|
||||
var tickerText = $('exportProgressTicker').get('text');
|
||||
if ( tickerText.length < 1 || tickerText.length > 4 )
|
||||
$('exportProgressTicker').set( 'text', '.' );
|
||||
else
|
||||
$('exportProgressTicker').appendText( '.' );
|
||||
}
|
||||
|
||||
function exportResponse( respObj, respText )
|
||||
{
|
||||
window.location.replace( thisUrl+'?view='+currentView+'&'+eidParm+'&exportFile='+respObj.exportFile+'&generated='+((respObj.result=='Ok')?1:0) );
|
||||
function exportResponse( respObj, respText ) {
|
||||
window.location.replace( thisUrl+'?view='+currentView+'&'+eidParm+'&exportFile='+respObj.exportFile+'&generated='+((respObj.result=='Ok')?1:0) );
|
||||
}
|
||||
|
||||
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 } );
|
||||
query.send();
|
||||
$('exportProgress').removeClass( 'hidden' );
|
||||
$('exportProgress').setProperty( 'class', 'warnText' );
|
||||
$('exportProgressText').set( 'text', exportProgressString );
|
||||
exportProgress();
|
||||
exportTimer = exportProgress.periodical( 500 );
|
||||
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 } );
|
||||
query.send();
|
||||
$('exportProgress').removeClass( 'hidden' );
|
||||
$('exportProgress').setProperty( 'class', 'warnText' );
|
||||
$('exportProgressText').set( 'text', exportProgressString );
|
||||
exportProgress();
|
||||
exportTimer = exportProgress.periodical( 500 );
|
||||
}
|
||||
|
||||
function initPage()
|
||||
{
|
||||
configureExportButton( $('exportButton') );
|
||||
if ( exportReady )
|
||||
{
|
||||
startDownload.pass( exportFile ).delay( 1500 );
|
||||
}
|
||||
function initPage() {
|
||||
configureExportButton( $('exportButton') );
|
||||
if ( exportReady ) {
|
||||
startDownload.pass( exportFile ).delay( 1500 );
|
||||
}
|
||||
}
|
||||
|
||||
window.addEvent( 'domready', initPage );
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
<?php
|
||||
if ( isset($_REQUEST['eids']) )
|
||||
{
|
||||
$eidParms = array();
|
||||
foreach ( $_REQUEST['eids'] as $eid )
|
||||
$eidParms[] = "eids[]=".validInt($eid);
|
||||
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
|
||||
|
|
|
@ -1,119 +1,106 @@
|
|||
function updateButtons( element )
|
||||
{
|
||||
var form = element.form;
|
||||
function updateButtons( element ) {
|
||||
var form = element.form;
|
||||
|
||||
if ( element.type == 'checkbox' && element.checked )
|
||||
form.elements['executeButton'].disabled = false;
|
||||
else
|
||||
{
|
||||
var canExecute = false;
|
||||
if ( form.elements['AutoArchive'].checked )
|
||||
canExecute = true;
|
||||
else if ( typeof ZM_OPT_FFMPEG !== "undefined" && form.elements['AutoVideo'].checked )
|
||||
canExecute = true;
|
||||
else if ( typeof ZM_OPT_UPLOAD !== "undefined" && form.elements['AutoUpload'].checked )
|
||||
canExecute = true;
|
||||
else if ( typeof ZM_OPT_EMAIL !== "undefined" && form.elements['AutoEmail'].checked )
|
||||
canExecute = true;
|
||||
else if ( typeof ZM_OPT_MESSAGE !== "undefined" && form.elements['AutoMessage'].checked )
|
||||
canExecute = true;
|
||||
else if ( form.elements['AutoExecute'].checked && form.elements['AutoExecuteCmd'].value != '' )
|
||||
canExecute = true;
|
||||
else if ( form.elements['AutoDelete'].checked )
|
||||
canExecute = true;
|
||||
form.elements['executeButton'].disabled = !canExecute;
|
||||
}
|
||||
if ( element.type == 'checkbox' && element.checked ) {
|
||||
form.elements['executeButton'].disabled = false;
|
||||
} else {
|
||||
var canExecute = false;
|
||||
if ( form.elements['AutoArchive'].checked )
|
||||
canExecute = true;
|
||||
else if ( typeof ZM_OPT_FFMPEG !== "undefined" && form.elements['AutoVideo'].checked )
|
||||
canExecute = true;
|
||||
else if ( typeof ZM_OPT_UPLOAD !== "undefined" && form.elements['AutoUpload'].checked )
|
||||
canExecute = true;
|
||||
else if ( typeof ZM_OPT_EMAIL !== "undefined" && form.elements['AutoEmail'].checked )
|
||||
canExecute = true;
|
||||
else if ( typeof ZM_OPT_MESSAGE !== "undefined" && form.elements['AutoMessage'].checked )
|
||||
canExecute = true;
|
||||
else if ( form.elements['AutoExecute'].checked && form.elements['AutoExecuteCmd'].value != '' )
|
||||
canExecute = true;
|
||||
else if ( form.elements['AutoDelete'].checked )
|
||||
canExecute = true;
|
||||
form.elements['executeButton'].disabled = !canExecute;
|
||||
}
|
||||
}
|
||||
|
||||
function clearValue( element, line )
|
||||
{
|
||||
var form = element.form;
|
||||
var val = form.elements['filter[terms]['+line+'][val]'];
|
||||
val.value = '';
|
||||
function clearValue( element, line ) {
|
||||
var form = element.form;
|
||||
var val = form.elements['filter[terms]['+line+'][val]'];
|
||||
val.value = '';
|
||||
}
|
||||
|
||||
function submitToFilter( element, reload )
|
||||
{
|
||||
var form = element.form;
|
||||
form.target = window.name;
|
||||
form.view.value = 'filter';
|
||||
form.reload.value = reload;
|
||||
function submitToFilter( element, reload ) {
|
||||
var form = element.form;
|
||||
form.target = window.name;
|
||||
form.view.value = 'filter';
|
||||
form.reload.value = reload;
|
||||
form.submit();
|
||||
}
|
||||
|
||||
function submitToEvents( element ) {
|
||||
var form = element.form;
|
||||
if ( validateForm( form ) ) {
|
||||
form.target = 'zmEvents';
|
||||
form.view.value = 'events';
|
||||
form.action.value = '';
|
||||
form.execute.value = 0;
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
|
||||
function submitToEvents( element )
|
||||
{
|
||||
var form = element.form;
|
||||
if ( validateForm( form ) )
|
||||
{
|
||||
form.target = 'zmEvents';
|
||||
form.view.value = 'events';
|
||||
form.action.value = '';
|
||||
form.execute.value = 0;
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
|
||||
function executeFilter( element )
|
||||
{
|
||||
var form = element.form;
|
||||
if ( validateForm( form ) )
|
||||
{
|
||||
form.target = 'zmEvents';
|
||||
form.view.value = 'events';
|
||||
form.action.value = 'filter';
|
||||
form.execute.value = 1;
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
|
||||
function saveFilter( element )
|
||||
{
|
||||
var form = element.form;
|
||||
|
||||
var popupName = 'zmEventsFilterSave';
|
||||
createPopup( thisUrl, popupName, 'filtersave' );
|
||||
|
||||
form.target = popupName;
|
||||
form.view.value = 'filtersave';
|
||||
form.submit();
|
||||
}
|
||||
|
||||
function deleteFilter( element, id, name )
|
||||
{
|
||||
if ( confirm( deleteSavedFilterString+" '"+name+"'?" ) )
|
||||
{
|
||||
var form = element.form;
|
||||
form.action.value = 'delete';
|
||||
submitToFilter( element, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
function addTerm( element, line )
|
||||
{
|
||||
var form = element.form;
|
||||
form.target = window.name;
|
||||
form.view.value = currentView;
|
||||
function executeFilter( element ) {
|
||||
var form = element.form;
|
||||
if ( validateForm( form ) ) {
|
||||
form.target = 'zmEvents';
|
||||
form.view.value = 'events';
|
||||
form.action.value = 'filter';
|
||||
form.subaction.value = 'addterm';
|
||||
form.line.value = line;
|
||||
form.execute.value = 1;
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
|
||||
function delTerm( element, line )
|
||||
{
|
||||
function saveFilter( element ) {
|
||||
var form = element.form;
|
||||
|
||||
var popupName = 'zmEventsFilterSave';
|
||||
createPopup( thisUrl, popupName, 'filtersave' );
|
||||
|
||||
form.target = popupName;
|
||||
form.view.value = 'filtersave';
|
||||
form.submit();
|
||||
}
|
||||
|
||||
function deleteFilter( element, name ) {
|
||||
if ( confirm( deleteSavedFilterString+" '"+name+"'" ) ) {
|
||||
var form = element.form;
|
||||
form.target = window.name;
|
||||
form.view.value = currentView;
|
||||
form.action.value = 'filter';
|
||||
form.subaction.value = 'delterm';
|
||||
form.line.value = line;
|
||||
form.submit();
|
||||
form.action.value = 'delete';
|
||||
form.fid.value = name;
|
||||
submitToFilter( element, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
function init()
|
||||
{
|
||||
updateButtons( $('executeButton') );
|
||||
function addTerm( element, line ) {
|
||||
var form = element.form;
|
||||
form.target = window.name;
|
||||
form.view.value = currentView;
|
||||
form.action.value = 'filter';
|
||||
form.subaction.value = 'addterm';
|
||||
form.line.value = line;
|
||||
form.submit();
|
||||
}
|
||||
|
||||
function delTerm( element, line ) {
|
||||
var form = element.form;
|
||||
form.target = window.name;
|
||||
form.view.value = currentView;
|
||||
form.action.value = 'filter';
|
||||
form.subaction.value = 'delterm';
|
||||
form.line.value = line;
|
||||
form.submit();
|
||||
}
|
||||
|
||||
function init() {
|
||||
updateButtons( $('executeButton') );
|
||||
}
|
||||
|
||||
window.addEvent( 'domready', init );
|
||||
|
|
|
@ -1,48 +1,41 @@
|
|||
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;
|
||||
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]'];
|
||||
bracket_count += parseInt(obr.options[obr.selectedIndex].value);
|
||||
bracket_count -= parseInt(cbr.options[cbr.selectedIndex].value);
|
||||
var obr = form.elements['filter[terms][<?php echo $i ?>][obr]'];
|
||||
var cbr = form.elements['filter[terms][<?php echo $i ?>][cbr]'];
|
||||
bracket_count += parseInt(obr.options[obr.selectedIndex].value);
|
||||
bracket_count -= parseInt(cbr.options[cbr.selectedIndex].value);
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
if ( bracket_count )
|
||||
{
|
||||
alert( "<?php echo translate('ErrorBrackets') ?>" );
|
||||
return( false );
|
||||
}
|
||||
if ( bracket_count ) {
|
||||
alert( "<?php echo translate('ErrorBrackets') ?>" );
|
||||
return( false );
|
||||
}
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<?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 == '' )
|
||||
{
|
||||
alert( "<?php echo translate('ErrorValidValue') ?>" );
|
||||
return( false );
|
||||
}
|
||||
var val = form.elements['filter[terms][<?php echo $i ?>][val]'];
|
||||
if ( val.value == '' ) {
|
||||
alert( "<?php echo translate('ErrorValidValue') ?>" );
|
||||
return( false );
|
||||
}
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
return( true );
|
||||
return( true );
|
||||
}
|
||||
<?php
|
||||
if ( !empty($hasCal) )
|
||||
{
|
||||
if ( !empty($hasCal) ) {
|
||||
?>
|
||||
</script>
|
||||
<style type="text/css">@import url(tools/jscalendar/calendar-win2k-1.css);</style>
|
||||
|
|
|
@ -1,18 +1,16 @@
|
|||
function selectMonitors()
|
||||
{
|
||||
createPopup( '?view=monitorselect&callForm=groupForm&callField=newGroup[MonitorIds]', 'zmMonitors', 'monitorselect' );
|
||||
function selectMonitors() {
|
||||
createPopup( '?view=monitorselect&callForm=groupForm&callField=newGroup[MonitorIds]', 'zmMonitors', 'monitorselect' );
|
||||
}
|
||||
|
||||
if ( refreshParent )
|
||||
{
|
||||
opener.location.reload(true);
|
||||
if ( refreshParent ) {
|
||||
opener.location.reload(true);
|
||||
}
|
||||
|
||||
function configureButtons( element ) {
|
||||
if ( canEditGroups ) {
|
||||
var form = element.form;
|
||||
form.saveBtn.disabled = (element.value == 0);
|
||||
}
|
||||
if ( canEditGroups ) {
|
||||
var form = element.form;
|
||||
form.saveBtn.disabled = (element.value == 0);
|
||||
}
|
||||
}
|
||||
|
||||
window.focus();
|
||||
|
|
|
@ -1,47 +1,38 @@
|
|||
function newGroup()
|
||||
{
|
||||
createPopup( '?view=group', 'zmGroup', 'group' );
|
||||
function newGroup() {
|
||||
createPopup( '?view=group', 'zmGroup', 'group' );
|
||||
}
|
||||
|
||||
function editGroup( element )
|
||||
{
|
||||
var form = element.form;
|
||||
form.action.value = 'setgroup';
|
||||
form.submit();
|
||||
function editGroup( element ) {
|
||||
var form = element.form;
|
||||
form.action.value = 'setgroup';
|
||||
form.submit();
|
||||
}
|
||||
|
||||
function editGroup( element )
|
||||
{
|
||||
var form = element.form;
|
||||
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 editGroup( element ) {
|
||||
var form = element.form;
|
||||
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 ) {
|
||||
var form = element.form;
|
||||
form.view.value = currentView;
|
||||
form.action.value = 'delete';
|
||||
form.submit();
|
||||
}
|
||||
|
||||
function configureButtons( element )
|
||||
{
|
||||
if ( canEditGroups )
|
||||
{
|
||||
var form = element.form;
|
||||
if ( element.checked )
|
||||
{
|
||||
form.editBtn.disabled = (element.value == 0);
|
||||
form.deleteBtn.disabled = (element.value == 0);
|
||||
}
|
||||
if ( element.checked ) {
|
||||
form.editBtn.disabled = (element.value == 0);
|
||||
form.deleteBtn.disabled = (element.value == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window.focus();
|
||||
|
|
|
@ -25,313 +25,269 @@ var sortReversed = false;
|
|||
var filterFields = ['Component', 'ServerId', 'Pid', 'Level', 'File', 'Line'];
|
||||
var options = {};
|
||||
|
||||
function buildFetchParms( parms )
|
||||
{
|
||||
var fetchParms = logParms+'&limit='+maxLogFetch;
|
||||
if ( parms )
|
||||
fetchParms += '&'+parms;
|
||||
Object.each(filter,
|
||||
function( value, key )
|
||||
{
|
||||
fetchParms += '&filter['+key+']='+value;
|
||||
}
|
||||
);
|
||||
return( fetchParms );
|
||||
function buildFetchParms( parms ) {
|
||||
var fetchParms = logParms+'&limit='+maxLogFetch;
|
||||
if ( parms )
|
||||
fetchParms += '&'+parms;
|
||||
Object.each(filter,
|
||||
function( value, key ) {
|
||||
fetchParms += '&filter['+key+']='+value;
|
||||
}
|
||||
);
|
||||
return( fetchParms );
|
||||
}
|
||||
|
||||
function fetchNextLogs()
|
||||
{
|
||||
logReq.send( buildFetchParms( 'minTime='+maxLogTime ) );
|
||||
function fetchNextLogs() {
|
||||
logReq.send( buildFetchParms( 'minTime='+maxLogTime ) );
|
||||
}
|
||||
|
||||
function fetchPrevLogs()
|
||||
{
|
||||
logReq.send( buildFetchParms( 'maxTime='+minLogTime ) );
|
||||
function fetchPrevLogs() {
|
||||
logReq.send( buildFetchParms( 'maxTime='+minLogTime ) );
|
||||
}
|
||||
|
||||
function logResponse( respObj )
|
||||
{
|
||||
if ( logTimer )
|
||||
logTimer = clearTimeout( logTimer );
|
||||
function logResponse( respObj ) {
|
||||
if ( logTimer )
|
||||
logTimer = clearTimeout( logTimer );
|
||||
|
||||
if ( respObj.result == 'Ok' )
|
||||
{
|
||||
if ( respObj.logs.length > 0 )
|
||||
{
|
||||
logTimeout = minSampleTime;
|
||||
logCount += respObj.logs.length;
|
||||
try {
|
||||
respObj.logs.each(
|
||||
function( log )
|
||||
{
|
||||
if ( !maxLogTime || log.TimeKey > maxLogTime )
|
||||
maxLogTime = log.TimeKey;
|
||||
if ( !minLogTime || log.TimeKey < minLogTime )
|
||||
minLogTime = log.TimeKey;
|
||||
var row = logTable.push( [{ content: log.DateTime, properties: { style: 'white-space: nowrap' }}, log.Component, log.Server, log.Pid, log.Code, log.Message, log.File, log.Line] );
|
||||
delete log.Message;
|
||||
row.tr.store( 'log', log );
|
||||
if ( log.Level <= -3 )
|
||||
row.tr.addClass( 'log-fat' );
|
||||
else if ( log.Level <= -2 )
|
||||
row.tr.addClass( 'log-err' );
|
||||
else if ( log.Level <= -1 )
|
||||
row.tr.addClass( 'log-war' );
|
||||
else if ( log.Level > 0 )
|
||||
row.tr.addClass( 'log-dbg' );
|
||||
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);
|
||||
new Fx.Tween( row.tr, { duration: 10000, transition: Fx.Transitions.Sine } ).start( 'color', '#6495ED', rowOrigColor );
|
||||
}
|
||||
}
|
||||
);
|
||||
options = respObj.options;
|
||||
updateFilterSelectors();
|
||||
$('lastUpdate').set('text', respObj.updated);
|
||||
$('logState').set('text', respObj.state);
|
||||
$('logState').removeClass('ok');
|
||||
$('logState').removeClass('alert');
|
||||
$('logState').removeClass('alarm');
|
||||
$('logState').addClass(respObj.state);
|
||||
$('totalLogs').set('text', respObj.total);
|
||||
$('availLogs').set('text', respObj.available);
|
||||
$('displayLogs').set('text', logCount);
|
||||
if ( firstLoad )
|
||||
{
|
||||
if ( logCount < displayLimit )
|
||||
fetchPrevLogs();
|
||||
}
|
||||
logTable.reSort();
|
||||
if ( respObj.result == 'Ok' ) {
|
||||
if ( respObj.logs.length > 0 ) {
|
||||
logTimeout = minSampleTime;
|
||||
logCount += respObj.logs.length;
|
||||
try {
|
||||
respObj.logs.each(
|
||||
function( log ) {
|
||||
if ( !maxLogTime || log.TimeKey > maxLogTime )
|
||||
maxLogTime = log.TimeKey;
|
||||
if ( !minLogTime || log.TimeKey < minLogTime )
|
||||
minLogTime = log.TimeKey;
|
||||
var row = logTable.push( [{ content: log.DateTime, properties: { style: 'white-space: nowrap' }}, log.Component, log.Server, log.Pid, log.Code, log.Message, log.File, log.Line] );
|
||||
delete log.Message;
|
||||
row.tr.store( 'log', log );
|
||||
if ( log.Level <= -3 )
|
||||
row.tr.addClass( 'log-fat' );
|
||||
else if ( log.Level <= -2 )
|
||||
row.tr.addClass( 'log-err' );
|
||||
else if ( log.Level <= -1 )
|
||||
row.tr.addClass( 'log-war' );
|
||||
else if ( log.Level > 0 )
|
||||
row.tr.addClass( 'log-dbg' );
|
||||
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);
|
||||
new Fx.Tween( row.tr, { duration: 10000, transition: Fx.Transitions.Sine } ).start( 'color', '#6495ED', rowOrigColor );
|
||||
}
|
||||
}
|
||||
catch( e )
|
||||
{
|
||||
console.error( e );
|
||||
}
|
||||
logTimeout /= 2;
|
||||
if ( logTimeout < minSampleTime )
|
||||
logTimeout = minSampleTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
firstLoad = false;
|
||||
logTimeout *= 2;
|
||||
if ( logTimeout > maxSampleTime )
|
||||
logTimeout = maxSampleTime;
|
||||
);
|
||||
options = respObj.options;
|
||||
updateFilterSelectors();
|
||||
$('lastUpdate').set('text', respObj.updated);
|
||||
$('logState').set('text', respObj.state);
|
||||
$('logState').removeClass('ok');
|
||||
$('logState').removeClass('alert');
|
||||
$('logState').removeClass('alarm');
|
||||
$('logState').addClass(respObj.state);
|
||||
$('totalLogs').set('text', respObj.total);
|
||||
$('availLogs').set('text', respObj.available);
|
||||
$('displayLogs').set('text', logCount);
|
||||
if ( firstLoad ) {
|
||||
if ( logCount < displayLimit )
|
||||
fetchPrevLogs();
|
||||
}
|
||||
logTable.reSort();
|
||||
} catch( e ) {
|
||||
console.error( e );
|
||||
}
|
||||
logTimeout /= 2;
|
||||
if ( logTimeout < minSampleTime )
|
||||
logTimeout = minSampleTime;
|
||||
} else {
|
||||
firstLoad = false;
|
||||
logTimeout *= 2;
|
||||
if ( logTimeout > maxSampleTime )
|
||||
logTimeout = maxSampleTime;
|
||||
}
|
||||
logTimer = fetchNextLogs.delay( logTimeout );
|
||||
}
|
||||
logTimer = fetchNextLogs.delay( logTimeout );
|
||||
}
|
||||
|
||||
function refreshLog()
|
||||
{
|
||||
options = {};
|
||||
logTable.empty();
|
||||
firstLoad = true;
|
||||
maxLogTime = 0;
|
||||
minLogTime = 0;
|
||||
logCount = 0;
|
||||
logTimeout = maxSampleTime;
|
||||
displayLimit = initialDisplayLimit;
|
||||
fetchNextLogs();
|
||||
function refreshLog() {
|
||||
options = {};
|
||||
logTable.empty();
|
||||
firstLoad = true;
|
||||
maxLogTime = 0;
|
||||
minLogTime = 0;
|
||||
logCount = 0;
|
||||
logTimeout = maxSampleTime;
|
||||
displayLimit = initialDisplayLimit;
|
||||
fetchNextLogs();
|
||||
}
|
||||
|
||||
function expandLog()
|
||||
{
|
||||
displayLimit += maxLogFetch;
|
||||
fetchPrevLogs();
|
||||
function expandLog() {
|
||||
displayLimit += maxLogFetch;
|
||||
fetchPrevLogs();
|
||||
}
|
||||
|
||||
function clearLog()
|
||||
{
|
||||
logReq.cancel();
|
||||
minLogTime = 0;
|
||||
logCount = 0;
|
||||
logTimeout = maxSampleTime;
|
||||
displayLimit = initialDisplayLimit;
|
||||
$('displayLogs').set('text', logCount);
|
||||
options = {};
|
||||
logTable.empty();
|
||||
function clearLog() {
|
||||
logReq.cancel();
|
||||
minLogTime = 0;
|
||||
logCount = 0;
|
||||
logTimeout = maxSampleTime;
|
||||
displayLimit = initialDisplayLimit;
|
||||
$('displayLogs').set('text', logCount);
|
||||
options = {};
|
||||
logTable.empty();
|
||||
}
|
||||
|
||||
function filterLog()
|
||||
{
|
||||
filter = {};
|
||||
filterFields.each(
|
||||
function( field )
|
||||
{
|
||||
var selector = $('filter['+field+']');
|
||||
if ( ! selector ) {
|
||||
if ( window.console && window.console.log ) {
|
||||
window.console.log("No selector found for " + field );
|
||||
}
|
||||
return;
|
||||
}
|
||||
var value = selector.get('value');
|
||||
if ( value )
|
||||
filter[field] = value;
|
||||
function filterLog() {
|
||||
filter = {};
|
||||
filterFields.each(
|
||||
function( field ) {
|
||||
var selector = $('filter['+field+']');
|
||||
if ( ! selector ) {
|
||||
if ( window.console && window.console.log ) {
|
||||
window.console.log("No selector found for " + field );
|
||||
}
|
||||
return;
|
||||
}
|
||||
);
|
||||
refreshLog();
|
||||
var value = selector.get('value');
|
||||
if ( value )
|
||||
filter[field] = value;
|
||||
}
|
||||
);
|
||||
refreshLog();
|
||||
}
|
||||
|
||||
function resetLog()
|
||||
{
|
||||
filter = {};
|
||||
refreshLog();
|
||||
function resetLog() {
|
||||
filter = {};
|
||||
refreshLog();
|
||||
}
|
||||
|
||||
var exportFormValidator;
|
||||
|
||||
function exportLog()
|
||||
{
|
||||
exportFormValidator.reset();
|
||||
$('exportLog').overlayShow();
|
||||
function exportLog() {
|
||||
exportFormValidator.reset();
|
||||
$('exportLog').overlayShow();
|
||||
}
|
||||
|
||||
function exportResponse( response )
|
||||
{
|
||||
$('exportLog').unspin();
|
||||
if ( response.result == 'Ok' )
|
||||
{
|
||||
window.location.replace( thisUrl+'?view=request&request=log&task=download&key='+response.key+'&format='+response.format );
|
||||
function exportResponse( response ) {
|
||||
$('exportLog').unspin();
|
||||
if ( response.result == 'Ok' ) {
|
||||
window.location.replace( thisUrl+'?view=request&request=log&task=download&key='+response.key+'&format='+response.format );
|
||||
}
|
||||
}
|
||||
|
||||
function exportFail( request ) {
|
||||
$('exportLog').unspin();
|
||||
$('exportErrorText').set('text', request.status+" / "+request.statusText );
|
||||
$('exportError').show();
|
||||
Error( "Export request failed: "+request.status+" / "+request.statusText );
|
||||
}
|
||||
|
||||
function exportRequest() {
|
||||
var form = $('exportForm');
|
||||
$('exportErrorText').set('text', "" );
|
||||
$('exportError').hide();
|
||||
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' ) {
|
||||
$$('#filters select').each(
|
||||
function( select ) {
|
||||
exportParms += "&"+select.get('id')+"="+select.get('value');
|
||||
}
|
||||
);
|
||||
}
|
||||
if ( selection == 'current' ) {
|
||||
var tbody = $(logTable).getElement( 'tbody' );
|
||||
var rows = tbody.getElements( 'tr' );
|
||||
if ( rows ) {
|
||||
var minTime = rows[0].getElement('td').get('text');
|
||||
exportParms += "&minTime="+encodeURIComponent(minTime);
|
||||
var maxTime = rows[rows.length-1].getElement('td').get('text');
|
||||
exportParms += "&maxTime="+encodeURIComponent(maxTime);
|
||||
}
|
||||
}
|
||||
exportReq.send( exportParms+"&"+form.toQueryString() );
|
||||
$('exportLog').spin();
|
||||
}
|
||||
}
|
||||
|
||||
function exportFail( request )
|
||||
{
|
||||
$('exportLog').unspin();
|
||||
$('exportErrorText').set('text', request.status+" / "+request.statusText );
|
||||
$('exportError').show();
|
||||
Error( "Export request failed: "+request.status+" / "+request.statusText );
|
||||
}
|
||||
|
||||
function exportRequest()
|
||||
{
|
||||
var form = $('exportForm');
|
||||
$('exportErrorText').set('text', "" );
|
||||
$('exportError').hide();
|
||||
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' )
|
||||
{
|
||||
$$('#filters select').each(
|
||||
function( select )
|
||||
{
|
||||
exportParms += "&"+select.get('id')+"="+select.get('value');
|
||||
function updateFilterSelectors() {
|
||||
Object.each(options,
|
||||
function( values, key ) {
|
||||
var selector = $('filter['+key+']');
|
||||
if ( ! selector ) {
|
||||
if ( window.console && window.console.log ) {
|
||||
window.console.log("No selector found for " + key );
|
||||
}
|
||||
return;
|
||||
}
|
||||
selector.options.length = 1;
|
||||
if ( key == 'Level' ) {
|
||||
Object.each(values,
|
||||
function( value, label ) {
|
||||
selector.options[selector.options.length] = new Option( value, label );
|
||||
}
|
||||
);
|
||||
}
|
||||
if ( selection == 'current' )
|
||||
{
|
||||
var tbody = $(logTable).getElement( 'tbody' );
|
||||
var rows = tbody.getElements( 'tr' );
|
||||
if ( rows )
|
||||
{
|
||||
var minTime = rows[0].getElement('td').get('text');
|
||||
exportParms += "&minTime="+encodeURIComponent(minTime);
|
||||
var maxTime = rows[rows.length-1].getElement('td').get('text');
|
||||
exportParms += "&maxTime="+encodeURIComponent(maxTime);
|
||||
}
|
||||
}
|
||||
exportReq.send( exportParms+"&"+form.toQueryString() );
|
||||
$('exportLog').spin();
|
||||
}
|
||||
}
|
||||
|
||||
function updateFilterSelectors()
|
||||
{
|
||||
Object.each(options,
|
||||
function( values, key )
|
||||
{
|
||||
var selector = $('filter['+key+']');
|
||||
if ( ! selector ) {
|
||||
if ( window.console && window.console.log ) {
|
||||
window.console.log("No selector found for " + key );
|
||||
}
|
||||
return;
|
||||
}
|
||||
selector.options.length = 1;
|
||||
if ( key == 'Level' )
|
||||
{
|
||||
Object.each(values,
|
||||
function( value, label )
|
||||
{
|
||||
selector.options[selector.options.length] = new Option( value, label );
|
||||
}
|
||||
);
|
||||
}
|
||||
else if ( key == 'ServerId' )
|
||||
{
|
||||
Object.each(values,
|
||||
function( value, label )
|
||||
{
|
||||
selector.options[selector.options.length] = new Option( value, label );
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
values.each(
|
||||
function( value )
|
||||
{
|
||||
selector.options[selector.options.length] = new Option( value );
|
||||
}
|
||||
);
|
||||
}
|
||||
if ( filter[key] )
|
||||
selector.set('value', filter[key]);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function initPage()
|
||||
{
|
||||
displayLimit = initialDisplayLimit;
|
||||
for ( var i = 1; i <= 9; i++ )
|
||||
logCodes[''+i] = 'DB'+i;
|
||||
logTable = new HtmlTable( $('logTable'),
|
||||
{
|
||||
zebra: true,
|
||||
sortable: true,
|
||||
sortReverse: true
|
||||
}
|
||||
);
|
||||
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 )
|
||||
{
|
||||
var rows = tbody.getElements( 'tr' );
|
||||
var startIndex;
|
||||
if ( sortReversed )
|
||||
startIndex = displayLimit;
|
||||
else
|
||||
startIndex = 0;
|
||||
for ( var i = startIndex; logCount > displayLimit; i++ )
|
||||
{
|
||||
rows[i].destroy();
|
||||
logCount--;
|
||||
} else if ( key == 'ServerId' ) {
|
||||
Object.each(values,
|
||||
function( value, label ) {
|
||||
selector.options[selector.options.length] = new Option( value, label );
|
||||
}
|
||||
$('displayLogs').set('text', logCount);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
values.each(
|
||||
function( value ) {
|
||||
selector.options[selector.options.length] = new Option( value );
|
||||
}
|
||||
);
|
||||
}
|
||||
if ( filter[key] )
|
||||
selector.set('value', filter[key]);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function initPage() {
|
||||
displayLimit = initialDisplayLimit;
|
||||
for ( var i = 1; i <= 9; i++ )
|
||||
logCodes[''+i] = 'DB'+i;
|
||||
logTable = new HtmlTable( $('logTable'),
|
||||
{
|
||||
zebra: true,
|
||||
sortable: true,
|
||||
sortReverse: true
|
||||
}
|
||||
);
|
||||
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 ) {
|
||||
var rows = tbody.getElements( 'tr' );
|
||||
var startIndex;
|
||||
if ( sortReversed )
|
||||
startIndex = displayLimit;
|
||||
else
|
||||
startIndex = 0;
|
||||
for ( var i = startIndex; logCount > displayLimit; i++ ) {
|
||||
rows[i].destroy();
|
||||
logCount--;
|
||||
}
|
||||
);
|
||||
exportFormValidator = new Form.Validator.Inline($('exportForm'), {
|
||||
useTitles: true,
|
||||
warningPrefix: "",
|
||||
errorPrefix: ""
|
||||
});
|
||||
new Asset.css( "/css/spinner.css" );
|
||||
fetchNextLogs();
|
||||
$('displayLogs').set('text', logCount);
|
||||
} // end if loCount > displayLimit
|
||||
}
|
||||
);
|
||||
exportFormValidator = new Form.Validator.Inline($('exportForm'), {
|
||||
useTitles: true,
|
||||
warningPrefix: "",
|
||||
errorPrefix: ""
|
||||
});
|
||||
new Asset.css( "/css/spinner.css" );
|
||||
fetchNextLogs();
|
||||
}
|
||||
|
||||
// Kick everything off
|
||||
|
|
|
@ -1,56 +1,49 @@
|
|||
function updateMonitorDimensions( element )
|
||||
{
|
||||
var form = element.form;
|
||||
var widthFactor = parseInt( defaultAspectRatio.replace( /:.*$/, '' ) );
|
||||
var heightFactor = parseInt( defaultAspectRatio.replace( /^.*:/, '' ) );
|
||||
function updateMonitorDimensions( element ) {
|
||||
var form = element.form;
|
||||
var widthFactor = parseInt( defaultAspectRatio.replace( /:.*$/, '' ) );
|
||||
var heightFactor = parseInt( defaultAspectRatio.replace( /^.*:/, '' ) );
|
||||
|
||||
if ( form.elements['preserveAspectRatio'].checked )
|
||||
{
|
||||
var monitorWidth = parseInt(form.elements['newMonitor[Width]'].value);
|
||||
var monitorHeight = parseInt(form.elements['newMonitor[Height]'].value);
|
||||
switch( element.name )
|
||||
{
|
||||
case 'newMonitor[Width]':
|
||||
if ( monitorWidth >= 0 )
|
||||
form.elements['newMonitor[Height]'].value = Math.round((monitorWidth * heightFactor) / widthFactor);
|
||||
else
|
||||
form.elements['newMonitor[Height]'].value = '';
|
||||
break;
|
||||
case 'newMonitor[Height]':
|
||||
if ( monitorHeight >= 0 )
|
||||
form.elements['newMonitor[Width]'].value = Math.round((monitorHeight * widthFactor) / heightFactor);
|
||||
else
|
||||
form.elements['newMonitor[Width]'].value = '';
|
||||
break;
|
||||
}
|
||||
if ( form.elements['preserveAspectRatio'].checked ) {
|
||||
var monitorWidth = parseInt(form.elements['newMonitor[Width]'].value);
|
||||
var monitorHeight = parseInt(form.elements['newMonitor[Height]'].value);
|
||||
switch( element.name ) {
|
||||
case 'newMonitor[Width]':
|
||||
if ( monitorWidth >= 0 )
|
||||
form.elements['newMonitor[Height]'].value = Math.round((monitorWidth * heightFactor) / widthFactor);
|
||||
else
|
||||
form.elements['newMonitor[Height]'].value = '';
|
||||
break;
|
||||
case 'newMonitor[Height]':
|
||||
if ( monitorHeight >= 0 )
|
||||
form.elements['newMonitor[Width]'].value = Math.round((monitorHeight * widthFactor) / heightFactor);
|
||||
else
|
||||
form.elements['newMonitor[Width]'].value = '';
|
||||
break;
|
||||
}
|
||||
return( false );
|
||||
}
|
||||
return( false );
|
||||
}
|
||||
|
||||
function loadLocations( element )
|
||||
{
|
||||
var form = element.form;
|
||||
var controlIdSelect = form.elements['newMonitor[ControlId]'];
|
||||
var returnLocationSelect = form.elements['newMonitor[ReturnLocation]'];
|
||||
function loadLocations( element ) {
|
||||
var form = element.form;
|
||||
var controlIdSelect = form.elements['newMonitor[ControlId]'];
|
||||
var returnLocationSelect = form.elements['newMonitor[ReturnLocation]'];
|
||||
|
||||
returnLocationSelect.options.length = 1;
|
||||
//returnLocationSelect.options[0] = new Option( noneString, -1 );
|
||||
returnLocationSelect.options.length = 1;
|
||||
//returnLocationSelect.options[0] = new Option( noneString, -1 );
|
||||
|
||||
var returnLocationOptions = controlOptions[controlIdSelect.selectedIndex];
|
||||
if ( returnLocationOptions )
|
||||
{
|
||||
for ( var i = 0; i < returnLocationOptions.length; i++ )
|
||||
{
|
||||
returnLocationSelect.options[returnLocationSelect.options.length] = new Option( returnLocationOptions[i], i );
|
||||
}
|
||||
var returnLocationOptions = controlOptions[controlIdSelect.selectedIndex];
|
||||
if ( returnLocationOptions ) {
|
||||
for ( var i = 0; i < returnLocationOptions.length; i++ ) {
|
||||
returnLocationSelect.options[returnLocationSelect.options.length] = new Option( returnLocationOptions[i], i );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function initPage()
|
||||
{
|
||||
//var protocolSelector = $('contentForm').elements['newMonitor[Protocol]'];
|
||||
//if ( $(protocolSelector).getTag() == 'select' )
|
||||
//updateMethods( $(protocolSelector) );
|
||||
function initPage() {
|
||||
//var protocolSelector = $('contentForm').elements['newMonitor[Protocol]'];
|
||||
//if ( $(protocolSelector).getTag() == 'select' )
|
||||
//updateMethods( $(protocolSelector) );
|
||||
}
|
||||
|
||||
window.addEvent( 'domready', initPage );
|
||||
|
|
|
@ -2,194 +2,174 @@ 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
|
||||
global $controlTypes;
|
||||
$controlTypes = array( ''=>translate('None') );
|
||||
# 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 )
|
||||
{
|
||||
$controlTypes[$row['Id']] = $row['Name'];
|
||||
global $controlTypes;
|
||||
$controlTypes = array( ''=>translate('None') );
|
||||
# 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 ) {
|
||||
$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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<?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
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
function validateForm( form )
|
||||
{
|
||||
var errors = new Array();
|
||||
function validateForm( form ) {
|
||||
var errors = new Array();
|
||||
|
||||
if ( form.elements['newMonitor[Name]'].value.search( /[^\w- ]/ ) >= 0 )
|
||||
errors[errors.length] = "<?php echo translate('BadNameChars') ?>";
|
||||
else if ( form.elements.mid.value == 0 && monitorNames[form.elements['newMonitor[Name]'].value] )
|
||||
errors[errors.length] = "<?php echo translate('DuplicateMonitorName') ?>";
|
||||
if ( form.elements['newMonitor[Name]'].value.search( /[^\w- ]/ ) >= 0 )
|
||||
errors[errors.length] = "<?php echo translate('BadNameChars') ?>";
|
||||
else if ( form.elements.mid.value == 0 && monitorNames[form.elements['newMonitor[Name]'].value] )
|
||||
errors[errors.length] = "<?php echo translate('DuplicateMonitorName') ?>";
|
||||
|
||||
if ( form.elements['newMonitor[AnalysisFPS]'].value && !(parseFloat(form.elements['newMonitor[AnalysisFPS]'].value) > 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadAnalysisFPS') ?>";
|
||||
if ( form.elements['newMonitor[MaxFPS]'].value && !(parseFloat(form.elements['newMonitor[MaxFPS]'].value) > 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadMaxFPS') ?>";
|
||||
if ( form.elements['newMonitor[AlarmMaxFPS]'].value && !(parseFloat(form.elements['newMonitor[AlarmMaxFPS]'].value) > 0 ) )
|
||||
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[Palette]'].value || !form.elements['newMonitor[Palette]'].value.match( /^\d+$/ ) )
|
||||
errors[errors.length] = "<?php echo translate('BadPalette') ?>";
|
||||
if ( !form.elements['newMonitor[Device]'].value )
|
||||
errors[errors.length] = "<?php echo translate('BadDevice') ?>";
|
||||
if ( !form.elements['newMonitor[Channel]'].value || !form.elements['newMonitor[Channel]'].value.match( /^\d+$/ ) )
|
||||
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' )
|
||||
{
|
||||
//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' )
|
||||
{
|
||||
if ( !form.elements['newMonitor[Path]'].value )
|
||||
errors[errors.length] = "<?php echo translate('BadPath') ?>";
|
||||
}
|
||||
if ( !form.elements['newMonitor[Colours]'].value || (parseInt(form.elements['newMonitor[Colours]'].value) != 1 && parseInt(form.elements['newMonitor[Colours]'].value) != 3 && parseInt(form.elements['newMonitor[Colours]'].value) != 4 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadColours') ?>";
|
||||
if ( !form.elements['newMonitor[Width]'].value || !(parseInt(form.elements['newMonitor[Width]'].value) > 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadWidth') ?>";
|
||||
if ( !form.elements['newMonitor[Height]'].value || !(parseInt(form.elements['newMonitor[Height]'].value) > 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadHeight') ?>";
|
||||
if ( !form.elements['newMonitor[LabelX]'].value || !(parseInt(form.elements['newMonitor[LabelX]'].value) >= 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadLabelX') ?>";
|
||||
if ( !form.elements['newMonitor[LabelY]'].value || !(parseInt(form.elements['newMonitor[LabelY]'].value) >= 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadLabelY') ?>";
|
||||
if ( !form.elements['newMonitor[ImageBufferCount]'].value || !(parseInt(form.elements['newMonitor[ImageBufferCount]'].value) >= 10 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadImageBufferCount') ?>";
|
||||
if ( !form.elements['newMonitor[WarmupCount]'].value || !(parseInt(form.elements['newMonitor[WarmupCount]'].value) >= 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadWarmupCount') ?>";
|
||||
if ( !form.elements['newMonitor[PreEventCount]'].value || !(parseInt(form.elements['newMonitor[PreEventCount]'].value) > 0 ) || (parseInt(form.elements['newMonitor[PreEventCount]'].value) > parseInt(form.elements['newMonitor[ImageBufferCount]'].value)) )
|
||||
errors[errors.length] = "<?php echo translate('BadPreEventCount') ?>";
|
||||
if ( !form.elements['newMonitor[PostEventCount]'].value || !(parseInt(form.elements['newMonitor[PostEventCount]'].value) >= 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadPostEventCount') ?>";
|
||||
if ( !form.elements['newMonitor[StreamReplayBuffer]'].value || !(parseInt(form.elements['newMonitor[StreamReplayBuffer]'].value) >= 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadStreamReplayBuffer') ?>";
|
||||
if ( !form.elements['newMonitor[AlarmFrameCount]'].value || !(parseInt(form.elements['newMonitor[AlarmFrameCount]'].value) > 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadAlarmFrameCount') ?>";
|
||||
if ( !form.elements['newMonitor[SectionLength]'].value || !(parseInt(form.elements['newMonitor[SectionLength]'].value) >= 30 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadSectionLength') ?>";
|
||||
if ( !form.elements['newMonitor[AnalysisUpdateDelay]'].value || !(parseInt(form.elements['newMonitor[AnalysisUpdateDelay]'].value) >= 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadAnalysisUpdateDelay') ?>";
|
||||
if ( !form.elements['newMonitor[FPSReportInterval]'].value || !(parseInt(form.elements['newMonitor[FPSReportInterval]'].value) >= 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadFPSReportInterval') ?>";
|
||||
if ( !form.elements['newMonitor[FrameSkip]'].value || !(parseInt(form.elements['newMonitor[FrameSkip]'].value) >= 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadFrameSkip') ?>";
|
||||
if ( !form.elements['newMonitor[MotionFrameSkip]'].value || !(parseInt(form.elements['newMonitor[MotionFrameSkip]'].value) >= 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadMotionFrameSkip') ?>";
|
||||
if ( form.elements['newMonitor[Type]'].value == 'Local' )
|
||||
if ( !form.elements['newMonitor[SignalCheckColour]'].value || !form.elements['newMonitor[SignalCheckColour]'].value.match( /^[#0-9a-zA-Z]+$/ ) )
|
||||
errors[errors.length] = "<?php echo translate('BadSignalCheckColour') ?>";
|
||||
if ( !form.elements['newMonitor[WebColour]'].value || !form.elements['newMonitor[WebColour]'].value.match( /^[#0-9a-zA-Z]+$/ ) )
|
||||
errors[errors.length] = "<?php echo translate('BadWebColour') ?>";
|
||||
if ( form.elements['newMonitor[AnalysisFPS]'].value && !(parseFloat(form.elements['newMonitor[AnalysisFPS]'].value) > 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadAnalysisFPS') ?>";
|
||||
if ( form.elements['newMonitor[MaxFPS]'].value && !(parseFloat(form.elements['newMonitor[MaxFPS]'].value) > 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadMaxFPS') ?>";
|
||||
if ( form.elements['newMonitor[AlarmMaxFPS]'].value && !(parseFloat(form.elements['newMonitor[AlarmMaxFPS]'].value) > 0 ) )
|
||||
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[Palette]'].value || !form.elements['newMonitor[Palette]'].value.match( /^\d+$/ ) )
|
||||
errors[errors.length] = "<?php echo translate('BadPalette') ?>";
|
||||
if ( !form.elements['newMonitor[Device]'].value )
|
||||
errors[errors.length] = "<?php echo translate('BadDevice') ?>";
|
||||
if ( !form.elements['newMonitor[Channel]'].value || !form.elements['newMonitor[Channel]'].value.match( /^\d+$/ ) )
|
||||
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' ) {
|
||||
//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' ) {
|
||||
if ( !form.elements['newMonitor[Path]'].value )
|
||||
errors[errors.length] = "<?php echo translate('BadPath') ?>";
|
||||
}
|
||||
if ( !form.elements['newMonitor[Colours]'].value || (parseInt(form.elements['newMonitor[Colours]'].value) != 1 && parseInt(form.elements['newMonitor[Colours]'].value) != 3 && parseInt(form.elements['newMonitor[Colours]'].value) != 4 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadColours') ?>";
|
||||
if ( !form.elements['newMonitor[Width]'].value || !(parseInt(form.elements['newMonitor[Width]'].value) > 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadWidth') ?>";
|
||||
if ( !form.elements['newMonitor[Height]'].value || !(parseInt(form.elements['newMonitor[Height]'].value) > 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadHeight') ?>";
|
||||
if ( !form.elements['newMonitor[LabelX]'].value || !(parseInt(form.elements['newMonitor[LabelX]'].value) >= 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadLabelX') ?>";
|
||||
if ( !form.elements['newMonitor[LabelY]'].value || !(parseInt(form.elements['newMonitor[LabelY]'].value) >= 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadLabelY') ?>";
|
||||
if ( !form.elements['newMonitor[ImageBufferCount]'].value || !(parseInt(form.elements['newMonitor[ImageBufferCount]'].value) >= 10 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadImageBufferCount') ?>";
|
||||
if ( !form.elements['newMonitor[WarmupCount]'].value || !(parseInt(form.elements['newMonitor[WarmupCount]'].value) >= 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadWarmupCount') ?>";
|
||||
if ( !form.elements['newMonitor[PreEventCount]'].value || !(parseInt(form.elements['newMonitor[PreEventCount]'].value) > 0 ) || (parseInt(form.elements['newMonitor[PreEventCount]'].value) > parseInt(form.elements['newMonitor[ImageBufferCount]'].value)) )
|
||||
errors[errors.length] = "<?php echo translate('BadPreEventCount') ?>";
|
||||
if ( !form.elements['newMonitor[PostEventCount]'].value || !(parseInt(form.elements['newMonitor[PostEventCount]'].value) >= 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadPostEventCount') ?>";
|
||||
if ( !form.elements['newMonitor[StreamReplayBuffer]'].value || !(parseInt(form.elements['newMonitor[StreamReplayBuffer]'].value) >= 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadStreamReplayBuffer') ?>";
|
||||
if ( !form.elements['newMonitor[AlarmFrameCount]'].value || !(parseInt(form.elements['newMonitor[AlarmFrameCount]'].value) > 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadAlarmFrameCount') ?>";
|
||||
if ( !form.elements['newMonitor[SectionLength]'].value || !(parseInt(form.elements['newMonitor[SectionLength]'].value) >= 30 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadSectionLength') ?>";
|
||||
if ( !form.elements['newMonitor[AnalysisUpdateDelay]'].value || !(parseInt(form.elements['newMonitor[AnalysisUpdateDelay]'].value) >= 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadAnalysisUpdateDelay') ?>";
|
||||
if ( !form.elements['newMonitor[FPSReportInterval]'].value || !(parseInt(form.elements['newMonitor[FPSReportInterval]'].value) >= 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadFPSReportInterval') ?>";
|
||||
if ( !form.elements['newMonitor[FrameSkip]'].value || !(parseInt(form.elements['newMonitor[FrameSkip]'].value) >= 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadFrameSkip') ?>";
|
||||
if ( !form.elements['newMonitor[MotionFrameSkip]'].value || !(parseInt(form.elements['newMonitor[MotionFrameSkip]'].value) >= 0 ) )
|
||||
errors[errors.length] = "<?php echo translate('BadMotionFrameSkip') ?>";
|
||||
if ( form.elements['newMonitor[Type]'].value == 'Local' )
|
||||
if ( !form.elements['newMonitor[SignalCheckColour]'].value || !form.elements['newMonitor[SignalCheckColour]'].value.match( /^[#0-9a-zA-Z]+$/ ) )
|
||||
errors[errors.length] = "<?php echo translate('BadSignalCheckColour') ?>";
|
||||
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 )
|
||||
{
|
||||
alert( errors.join( "\n" ) );
|
||||
return( false );
|
||||
}
|
||||
return( true );
|
||||
if ( errors.length ) {
|
||||
alert( errors.join( "\n" ) );
|
||||
return( false );
|
||||
}
|
||||
return( true );
|
||||
}
|
||||
|
||||
function updateLinkedMonitors( element )
|
||||
{
|
||||
var form = element.form;
|
||||
var monitorIds = new Array();
|
||||
for ( var i = 0; i < element.options.length; i++ )
|
||||
if ( element.options[i].selected )
|
||||
monitorIds[monitorIds.length] = element.options[i].value;
|
||||
form.elements['newMonitor[LinkedMonitors]'].value = monitorIds.join( ',' );
|
||||
function updateLinkedMonitors( element ) {
|
||||
var form = element.form;
|
||||
var monitorIds = new Array();
|
||||
for ( var i = 0; i < element.options.length; i++ )
|
||||
if ( element.options[i].selected )
|
||||
monitorIds[monitorIds.length] = element.options[i].value;
|
||||
form.elements['newMonitor[LinkedMonitors]'].value = monitorIds.join( ',' );
|
||||
}
|
||||
|
||||
function updateMethods( element )
|
||||
{
|
||||
var form = element.form;
|
||||
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 )
|
||||
{
|
||||
case 'http' :
|
||||
{
|
||||
<?php
|
||||
foreach( $httpMethods as $value=>$label )
|
||||
{
|
||||
?>
|
||||
methodSelector.options[methodSelector.options.length] = new Option( "<?php echo htmlspecialchars($label) ?>", "<?php echo $value ?>" );
|
||||
var origMethod = form.elements['origMethod'];
|
||||
var methodSelector = form.elements['newMonitor[Method]'];
|
||||
methodSelector.options.length = 0;
|
||||
switch ( element.value ) {
|
||||
case 'http' :
|
||||
{
|
||||
<?php
|
||||
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 ?>" )
|
||||
methodSelector.selectedIndex = methodSelector.options.length-1;
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
break;
|
||||
}
|
||||
case 'rtsp' :
|
||||
{
|
||||
<?php
|
||||
foreach( $rtspMethods as $value=>$label )
|
||||
{
|
||||
?>
|
||||
methodSelector.options[methodSelector.options.length] = new Option( "<?php echo htmlspecialchars($label) ?>", "<?php echo $value ?>" );
|
||||
methodSelector.selectedIndex = methodSelector.options.length-1;
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
break;
|
||||
}
|
||||
case 'rtsp' :
|
||||
{
|
||||
<?php
|
||||
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 ?>" )
|
||||
methodSelector.selectedIndex = form.elements['newMonitor[Method]'].options.length-1;
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
break;
|
||||
}
|
||||
}
|
||||
return( true );
|
||||
methodSelector.selectedIndex = form.elements['newMonitor[Method]'].options.length-1;
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
break;
|
||||
}
|
||||
}
|
||||
return( true );
|
||||
}
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
function submitPreset( element )
|
||||
{
|
||||
var form = element.form;
|
||||
form.target = opener.name;
|
||||
form.view.value = 'monitor';
|
||||
form.submit();
|
||||
closeWindow.delay( 250 );
|
||||
function submitPreset( element ) {
|
||||
var form = element.form;
|
||||
form.target = opener.name;
|
||||
form.view.value = 'monitor';
|
||||
form.submit();
|
||||
closeWindow.delay( 250 );
|
||||
}
|
||||
|
||||
function configureButtons( element )
|
||||
{
|
||||
var form = element.form;
|
||||
form.saveBtn.disabled = (form.preset.selectedIndex==0);
|
||||
function configureButtons( element ) {
|
||||
var form = element.form;
|
||||
form.saveBtn.disabled = (form.preset.selectedIndex==0);
|
||||
}
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
function submitCamera( element )
|
||||
{
|
||||
var form = element.form;
|
||||
form.target = opener.name;
|
||||
form.view.value = 'monitor';
|
||||
form.submit();
|
||||
closeWindow.delay( 250 );
|
||||
function submitCamera( element ) {
|
||||
var form = element.form;
|
||||
form.target = opener.name;
|
||||
form.view.value = 'monitor';
|
||||
form.submit();
|
||||
closeWindow.delay( 250 );
|
||||
}
|
||||
|
||||
function configureButtons( element )
|
||||
{
|
||||
var form = element.form;
|
||||
form.saveBtn.disabled = (form.probe.selectedIndex==0);
|
||||
function configureButtons( element ) {
|
||||
var form = element.form;
|
||||
form.saveBtn.disabled = (form.probe.selectedIndex==0);
|
||||
}
|
||||
|
|
|
@ -1,209 +1,191 @@
|
|||
var requestQueue = new Request.Queue( { concurrent: 2 } );
|
||||
|
||||
function Monitor( monitorData )
|
||||
{
|
||||
this.id = monitorData.id;
|
||||
this.connKey = monitorData.connKey;
|
||||
this.server_url = monitorData.server_url;
|
||||
this.status = null;
|
||||
this.alarmState = STATE_IDLE;
|
||||
this.lastAlarmState = STATE_IDLE;
|
||||
this.streamCmdParms = "view=request&request=stream&connkey="+this.connKey;
|
||||
this.streamCmdTimer = null;
|
||||
function Monitor( monitorData ) {
|
||||
this.id = monitorData.id;
|
||||
this.connKey = monitorData.connKey;
|
||||
this.server_url = monitorData.server_url;
|
||||
this.status = null;
|
||||
this.alarmState = STATE_IDLE;
|
||||
this.lastAlarmState = STATE_IDLE;
|
||||
this.streamCmdParms = "view=request&request=stream&connkey="+this.connKey;
|
||||
this.streamCmdTimer = null;
|
||||
|
||||
this.start = function( delay )
|
||||
{
|
||||
this.streamCmdTimer = this.streamCmdQuery.delay( delay, this );
|
||||
};
|
||||
this.start = function( delay ) {
|
||||
this.streamCmdTimer = this.streamCmdQuery.delay( delay, this );
|
||||
};
|
||||
|
||||
this.setStateClass = function( element, stateClass )
|
||||
{
|
||||
if ( !element.hasClass( stateClass ) )
|
||||
{
|
||||
if ( stateClass != 'alarm' )
|
||||
element.removeClass( 'alarm' );
|
||||
if ( stateClass != 'alert' )
|
||||
element.removeClass( 'alert' );
|
||||
if ( stateClass != 'idle' )
|
||||
element.removeClass( 'idle' );
|
||||
element.addClass( stateClass );
|
||||
this.setStateClass = function( element, stateClass ) {
|
||||
if ( !element.hasClass( stateClass ) ) {
|
||||
if ( stateClass != 'alarm' )
|
||||
element.removeClass( 'alarm' );
|
||||
if ( stateClass != 'alert' )
|
||||
element.removeClass( 'alert' );
|
||||
if ( stateClass != 'idle' )
|
||||
element.removeClass( 'idle' );
|
||||
element.addClass( stateClass );
|
||||
}
|
||||
};
|
||||
|
||||
this.getStreamCmdResponse = function( respObj, respText ) {
|
||||
if ( this.streamCmdTimer )
|
||||
this.streamCmdTimer = clearTimeout( this.streamCmdTimer );
|
||||
|
||||
var stream = document.getElementById( "liveStream"+this.id );
|
||||
if ( respObj.result == 'Ok' ) {
|
||||
this.status = respObj.status;
|
||||
this.alarmState = this.status.state;
|
||||
|
||||
var stateClass = "";
|
||||
if ( this.alarmState == STATE_ALARM )
|
||||
stateClass = "alarm";
|
||||
else if ( this.alarmState == STATE_ALERT )
|
||||
stateClass = "alert";
|
||||
else
|
||||
stateClass = "idle";
|
||||
|
||||
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 );
|
||||
}
|
||||
this.setStateClass( $('monitor'+this.id), stateClass );
|
||||
|
||||
/*Stream could be an applet so can't use moo tools*/
|
||||
stream.className = stateClass;
|
||||
|
||||
var isAlarmed = ( this.alarmState == STATE_ALARM || this.alarmState == STATE_ALERT );
|
||||
var wasAlarmed = ( this.lastAlarmState == STATE_ALARM || this.lastAlarmState == STATE_ALERT );
|
||||
|
||||
var newAlarm = ( isAlarmed && !wasAlarmed );
|
||||
var oldAlarm = ( !isAlarmed && wasAlarmed );
|
||||
|
||||
if ( newAlarm ) {
|
||||
if ( false && SOUND_ON_ALARM ) {
|
||||
// Enable the alarm sound
|
||||
$('alarmSound').removeClass( 'hidden' );
|
||||
}
|
||||
};
|
||||
|
||||
this.getStreamCmdResponse = function( respObj, respText )
|
||||
{
|
||||
if ( this.streamCmdTimer )
|
||||
this.streamCmdTimer = clearTimeout( this.streamCmdTimer );
|
||||
|
||||
var stream = document.getElementById( "liveStream"+this.id );
|
||||
if ( respObj.result == 'Ok' )
|
||||
{
|
||||
this.status = respObj.status;
|
||||
this.alarmState = this.status.state;
|
||||
|
||||
var stateClass = "";
|
||||
if ( this.alarmState == STATE_ALARM )
|
||||
stateClass = "alarm";
|
||||
else if ( this.alarmState == STATE_ALERT )
|
||||
stateClass = "alert";
|
||||
else
|
||||
stateClass = "idle";
|
||||
|
||||
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 );
|
||||
}
|
||||
this.setStateClass( $('monitor'+this.id), stateClass );
|
||||
|
||||
/*Stream could be an applet so can't use moo tools*/
|
||||
stream.className = stateClass;
|
||||
|
||||
var isAlarmed = ( this.alarmState == STATE_ALARM || this.alarmState == STATE_ALERT );
|
||||
var wasAlarmed = ( this.lastAlarmState == STATE_ALARM || this.lastAlarmState == STATE_ALERT );
|
||||
|
||||
var newAlarm = ( isAlarmed && !wasAlarmed );
|
||||
var oldAlarm = ( !isAlarmed && wasAlarmed );
|
||||
|
||||
if ( newAlarm )
|
||||
{
|
||||
if ( false && SOUND_ON_ALARM )
|
||||
{
|
||||
// Enable the alarm sound
|
||||
$('alarmSound').removeClass( 'hidden' );
|
||||
}
|
||||
if ( POPUP_ON_ALARM )
|
||||
{
|
||||
windowToFront();
|
||||
}
|
||||
}
|
||||
if ( false && SOUND_ON_ALARM )
|
||||
{
|
||||
if ( oldAlarm )
|
||||
{
|
||||
// Disable alarm sound
|
||||
$('alarmSound').addClass( 'hidden' );
|
||||
}
|
||||
}
|
||||
if ( this.status.auth ) {
|
||||
// Try to reload the image stream.
|
||||
if ( stream )
|
||||
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
|
||||
if ( POPUP_ON_ALARM ) {
|
||||
windowToFront();
|
||||
}
|
||||
else
|
||||
{
|
||||
console.error( respObj.message );
|
||||
// Try to reload the image stream.
|
||||
if ( stream )
|
||||
stream.src = stream.src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) ));
|
||||
}
|
||||
if ( false && SOUND_ON_ALARM ) {
|
||||
if ( oldAlarm ) {
|
||||
// Disable alarm sound
|
||||
$('alarmSound').addClass( 'hidden' );
|
||||
}
|
||||
var streamCmdTimeout = statusRefreshTimeout;
|
||||
if ( this.alarmState == STATE_ALARM || this.alarmState == STATE_ALERT )
|
||||
streamCmdTimeout = streamCmdTimeout/5;
|
||||
this.streamCmdTimer = this.streamCmdQuery.delay( streamCmdTimeout, this );
|
||||
this.lastAlarmState = this.alarmState;
|
||||
};
|
||||
}
|
||||
if ( this.status.auth ) {
|
||||
// Try to reload the image stream.
|
||||
if ( stream )
|
||||
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 {
|
||||
console.error( respObj.message );
|
||||
// Try to reload the image stream.
|
||||
if ( stream )
|
||||
stream.src = stream.src.replace(/rand=\d+/i, 'rand='+Math.floor((Math.random() * 1000000) ));
|
||||
}
|
||||
var streamCmdTimeout = statusRefreshTimeout;
|
||||
if ( this.alarmState == STATE_ALARM || this.alarmState == STATE_ALERT )
|
||||
streamCmdTimeout = streamCmdTimeout/5;
|
||||
this.streamCmdTimer = this.streamCmdQuery.delay( streamCmdTimeout, this );
|
||||
this.lastAlarmState = this.alarmState;
|
||||
};
|
||||
|
||||
this.streamCmdQuery = function( resent )
|
||||
{
|
||||
//if ( resent )
|
||||
//console.log( this.connKey+": Resending" );
|
||||
//this.streamCmdReq.cancel();
|
||||
this.streamCmdReq.send( this.streamCmdParms+"&command="+CMD_QUERY );
|
||||
};
|
||||
this.streamCmdQuery = function( resent ) {
|
||||
//if ( resent )
|
||||
//console.log( this.connKey+": Resending" );
|
||||
//this.streamCmdReq.cancel();
|
||||
this.streamCmdReq.send( this.streamCmdParms+"&command="+CMD_QUERY );
|
||||
};
|
||||
|
||||
this.streamCmdReq = new Request.JSON( { url: this.server_url, method: 'get', timeout: AJAX_TIMEOUT, onSuccess: this.getStreamCmdResponse.bind( this ), onTimeout: this.streamCmdQuery.bind( this, true ), link: 'cancel' } );
|
||||
this.streamCmdReq = new Request.JSON( { url: this.server_url, method: 'get', timeout: AJAX_TIMEOUT, onSuccess: this.getStreamCmdResponse.bind( this ), onTimeout: this.streamCmdQuery.bind( this, true ), link: 'cancel' } );
|
||||
|
||||
requestQueue.addRequest( "cmdReq"+this.id, this.streamCmdReq );
|
||||
requestQueue.addRequest( "cmdReq"+this.id, this.streamCmdReq );
|
||||
}
|
||||
|
||||
function selectLayout( element )
|
||||
{
|
||||
var cssFile = skinPath+'/css/'+Cookie.read('zmCSS')+'/views/'+$(element).get('value');
|
||||
if ( $('dynamicStyles') )
|
||||
$('dynamicStyles').destroy();
|
||||
new Asset.css( cssFile, { id: 'dynamicStyles' } );
|
||||
Cookie.write( 'zmMontageLayout', $(element).get('value'), { duration: 10*365 } );
|
||||
function selectLayout( element ) {
|
||||
var cssFile = skinPath+'/css/'+Cookie.read('zmCSS')+'/views/'+$(element).get('value');
|
||||
if ( $('dynamicStyles') )
|
||||
$('dynamicStyles').destroy();
|
||||
new Asset.css( cssFile, { id: 'dynamicStyles' } );
|
||||
Cookie.write( 'zmMontageLayout', $(element).get('value'), { duration: 10*365 } );
|
||||
}
|
||||
|
||||
function changeWidth() {
|
||||
var width = $('width').get('value');
|
||||
var width = $('width').get('value');
|
||||
|
||||
for ( var x = 0; x < monitors.length; x++ ) {
|
||||
var monitor = monitors[x];
|
||||
/*Stream could be an applet so can't use moo tools*/
|
||||
var streamImg = document.getElementById( 'liveStream'+monitor.id );
|
||||
if ( streamImg ) {
|
||||
streamImg.src = streamImg.src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) ));
|
||||
streamImg.style.width = width + "px";
|
||||
streamImg.style.height = '';
|
||||
}
|
||||
for ( var x = 0; x < monitors.length; x++ ) {
|
||||
var monitor = monitors[x];
|
||||
/*Stream could be an applet so can't use moo tools*/
|
||||
var streamImg = document.getElementById( 'liveStream'+monitor.id );
|
||||
if ( streamImg ) {
|
||||
streamImg.src = streamImg.src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) ));
|
||||
streamImg.style.width = width + "px";
|
||||
streamImg.style.height = '';
|
||||
}
|
||||
$('scale').set('value', '' );
|
||||
Cookie.write( 'zmMontageScale', '', { duration: 10*365 } );
|
||||
Cookie.write( 'zmMontageWidth', width, { duration: 10*365 } );
|
||||
}
|
||||
$('scale').set('value', '' );
|
||||
Cookie.write( 'zmMontageScale', '', { duration: 10*365 } );
|
||||
Cookie.write( 'zmMontageWidth', width, { duration: 10*365 } );
|
||||
} // end function changeWidth()
|
||||
|
||||
function changeHeight() {
|
||||
var height = $('height').get('value');
|
||||
var height = $('height').get('value');
|
||||
|
||||
for ( var x = 0; x < monitors.length; x++ ) {
|
||||
var monitor = monitors[x];
|
||||
/*Stream could be an applet so can't use moo tools*/
|
||||
var streamImg = document.getElementById( 'liveStream'+monitor.id );
|
||||
if ( streamImg ) {
|
||||
streamImg.src = streamImg.src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) ));
|
||||
streamImg.style.height = height + "px";
|
||||
}
|
||||
for ( var x = 0; x < monitors.length; x++ ) {
|
||||
var monitor = monitors[x];
|
||||
/*Stream could be an applet so can't use moo tools*/
|
||||
var streamImg = document.getElementById( 'liveStream'+monitor.id );
|
||||
if ( streamImg ) {
|
||||
streamImg.src = streamImg.src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) ));
|
||||
streamImg.style.height = height + "px";
|
||||
}
|
||||
$('scale').set('value', '' );
|
||||
Cookie.write( 'zmMontageHeight', height, { duration: 10*365 } );
|
||||
Cookie.write( 'zmMontageScale', '', { duration: 10*365 } );
|
||||
}
|
||||
$('scale').set('value', '' );
|
||||
Cookie.write( 'zmMontageHeight', height, { duration: 10*365 } );
|
||||
Cookie.write( 'zmMontageScale', '', { duration: 10*365 } );
|
||||
} // end function changeHeight()
|
||||
|
||||
function changeScale() {
|
||||
var scale = $('scale').get('value');
|
||||
var scale = $('scale').get('value');
|
||||
|
||||
for ( var x = 0; x < monitors.length; x++ ) {
|
||||
var monitor = monitors[x];
|
||||
var newWidth = ( monitorData[x].width * scale ) / SCALE_BASE;
|
||||
var newHeight = ( monitorData[x].height * scale ) / SCALE_BASE;
|
||||
/*Stream could be an applet so can't use moo tools*/
|
||||
var streamImg = document.getElementById( 'liveStream'+monitor.id );
|
||||
if ( streamImg ) {
|
||||
var src = streamImg.src;
|
||||
streamImg.src='';
|
||||
for ( var x = 0; x < monitors.length; x++ ) {
|
||||
var monitor = monitors[x];
|
||||
var newWidth = ( monitorData[x].width * scale ) / SCALE_BASE;
|
||||
var newHeight = ( monitorData[x].height * scale ) / SCALE_BASE;
|
||||
/*Stream could be an applet so can't use moo tools*/
|
||||
var streamImg = document.getElementById( 'liveStream'+monitor.id );
|
||||
if ( streamImg ) {
|
||||
var src = streamImg.src;
|
||||
streamImg.src='';
|
||||
|
||||
streamImg.style.width = newWidth + "px";
|
||||
streamImg.style.height = newHeight + "px";
|
||||
//src = src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) ));
|
||||
src = src.replace(/scale=[\.\d]+/i,'scale='+ scale );
|
||||
src = src.replace(/width=[\.\d]+/i,'width='+newWidth );
|
||||
src = src.replace(/height=[\.\d]+/i,'height='+newHeight );
|
||||
streamImg.src = src;
|
||||
}
|
||||
streamImg.style.width = newWidth + "px";
|
||||
streamImg.style.height = newHeight + "px";
|
||||
//src = src.replace(/rand=\d+/i,'rand='+Math.floor((Math.random() * 1000000) ));
|
||||
src = src.replace(/scale=[\.\d]+/i,'scale='+ scale );
|
||||
src = src.replace(/width=[\.\d]+/i,'width='+newWidth );
|
||||
src = src.replace(/height=[\.\d]+/i,'height='+newHeight );
|
||||
streamImg.src = src;
|
||||
}
|
||||
$('width').set('value', '');
|
||||
$('height').set('value', '');
|
||||
Cookie.write( 'zmMontageScale', scale, { duration: 10*365 } );
|
||||
Cookie.write( 'zmMontageWidth', '', { duration: 10*365 } );
|
||||
Cookie.write( 'zmMontageHeight', '', { duration: 10*365 } );
|
||||
}
|
||||
$('width').set('value', '');
|
||||
$('height').set('value', '');
|
||||
Cookie.write( 'zmMontageScale', scale, { duration: 10*365 } );
|
||||
Cookie.write( 'zmMontageWidth', '', { duration: 10*365 } );
|
||||
Cookie.write( 'zmMontageHeight', '', { duration: 10*365 } );
|
||||
}
|
||||
|
||||
|
||||
var monitors = new Array();
|
||||
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 );
|
||||
}
|
||||
selectLayout( $('layout') );
|
||||
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 );
|
||||
}
|
||||
selectLayout( $('layout') );
|
||||
}
|
||||
|
||||
// Kick everything off
|
||||
|
|
|
@ -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() ?>,
|
||||
|
|
|
@ -1,39 +1,35 @@
|
|||
function submitCamera( element )
|
||||
{
|
||||
var form = element.form;
|
||||
form.target = opener.name;
|
||||
form.view.value = 'monitor';
|
||||
form.submit();
|
||||
closeWindow.delay( 250 );
|
||||
function submitCamera( element ) {
|
||||
var form = element.form;
|
||||
form.target = opener.name;
|
||||
form.view.value = 'monitor';
|
||||
form.submit();
|
||||
closeWindow.delay( 250 );
|
||||
}
|
||||
|
||||
function gotoStep1( element )
|
||||
{
|
||||
var form = element.form;
|
||||
form.target = self.name;
|
||||
form.view.value = 'onvifprobe';
|
||||
form.step.value = '1';
|
||||
form.submit();
|
||||
function gotoStep1( element ) {
|
||||
var form = element.form;
|
||||
form.target = self.name;
|
||||
form.view.value = 'onvifprobe';
|
||||
form.step.value = '1';
|
||||
form.submit();
|
||||
}
|
||||
|
||||
function gotoStep2( element )
|
||||
{
|
||||
var form = element.form;
|
||||
form.target = self.name;
|
||||
form.view.value = 'onvifprobe';
|
||||
form.step.value = '2';
|
||||
form.submit();
|
||||
function gotoStep2( element ) {
|
||||
var form = element.form;
|
||||
form.target = self.name;
|
||||
form.view.value = 'onvifprobe';
|
||||
form.step.value = '2';
|
||||
form.submit();
|
||||
}
|
||||
|
||||
function configureButtons( element )
|
||||
{
|
||||
var form = element.form;
|
||||
if(form.elements.namedItem("nextBtn")) {
|
||||
form.nextBtn.disabled = (form.probe.selectedIndex==0) ||
|
||||
(form.username == "") || (form.username == null) ||
|
||||
(form.password == "") || (form.password == null);
|
||||
}
|
||||
if(form.elements.namedItem("saveBtn")) {
|
||||
form.saveBtn.disabled = (form.probe.selectedIndex==0);
|
||||
}
|
||||
function configureButtons( element ) {
|
||||
var form = element.form;
|
||||
if (form.elements.namedItem("nextBtn")) {
|
||||
form.nextBtn.disabled = (form.probe.selectedIndex==0) ||
|
||||
(form.username == "") || (form.username == null) ||
|
||||
(form.password == "") || (form.password == null);
|
||||
}
|
||||
if(form.elements.namedItem("saveBtn")) {
|
||||
form.saveBtn.disabled = (form.probe.selectedIndex==0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
var restartWarning = <?php echo empty($restartWarning)?'false':'true' ?>;
|
||||
if ( restartWarning )
|
||||
{
|
||||
alert( "<?php echo translate('OptionRestartWarning') ?>" );
|
||||
if ( restartWarning ) {
|
||||
alert( "<?php echo translate('OptionRestartWarning') ?>" );
|
||||
}
|
||||
|
|
|
@ -1,29 +1,22 @@
|
|||
function validateForm( form )
|
||||
{
|
||||
return( true );
|
||||
function validateForm( form ) {
|
||||
return( true );
|
||||
}
|
||||
|
||||
function submitForm( form )
|
||||
{
|
||||
form.submit();
|
||||
function submitForm( form ) {
|
||||
form.submit();
|
||||
}
|
||||
|
||||
|
||||
function limitRange( field, minValue, maxValue )
|
||||
{
|
||||
if ( parseInt(field.value) < parseInt(minValue) )
|
||||
{
|
||||
field.value = minValue;
|
||||
}
|
||||
else if ( parseInt(field.value) > parseInt(maxValue) )
|
||||
{
|
||||
field.value = maxValue;
|
||||
}
|
||||
function limitRange( field, minValue, maxValue ) {
|
||||
if ( parseInt(field.value) < parseInt(minValue) ) {
|
||||
field.value = minValue;
|
||||
} else if ( parseInt(field.value) > parseInt(maxValue) ) {
|
||||
field.value = maxValue;
|
||||
}
|
||||
}
|
||||
|
||||
function initPage()
|
||||
{
|
||||
return( true );
|
||||
function initPage() {
|
||||
return( true );
|
||||
}
|
||||
|
||||
window.addEvent( 'domready', initPage );
|
||||
|
|
|
@ -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"])) {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
function validateForm( form, newServer ) {
|
||||
var errors = new Array();
|
||||
if ( !form.elements['newServer[Name]'].value ) {
|
||||
errors[errors.length] = "You must supply a name";
|
||||
}
|
||||
if ( errors.length ) {
|
||||
alert( errors.join( "\n" ) );
|
||||
return( false );
|
||||
}
|
||||
return( true );
|
||||
var errors = new Array();
|
||||
if ( !form.elements['newServer[Name]'].value ) {
|
||||
errors[errors.length] = "You must supply a name";
|
||||
}
|
||||
if ( errors.length ) {
|
||||
alert( errors.join( "\n" ) );
|
||||
return( false );
|
||||
}
|
||||
return( true );
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,36 +1,26 @@
|
|||
function validateForm( form, newUser )
|
||||
{
|
||||
var errors = new Array();
|
||||
if ( !form.elements['newUser[Username]'].value )
|
||||
{
|
||||
errors[errors.length] = "You must supply a username";
|
||||
function validateForm( form, newUser ) {
|
||||
var errors = new Array();
|
||||
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 ) {
|
||||
errors[errors.length] = "You must confirm the password";
|
||||
} else if ( form.elements['newUser[Password]'].value != form.conf_password.value ) {
|
||||
errors[errors.length] = "The new and confirm passwords are different";
|
||||
}
|
||||
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 )
|
||||
{
|
||||
errors[errors.length] = "The new and confirm passwords are different";
|
||||
}
|
||||
}
|
||||
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++ )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
alert( errors.join( "\n" ) );
|
||||
return( false );
|
||||
}
|
||||
return( true );
|
||||
} 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++ ) {
|
||||
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 ) {
|
||||
alert( errors.join( "\n" ) );
|
||||
return( false );
|
||||
}
|
||||
return( true );
|
||||
}
|
||||
|
|
|
@ -1,18 +1,13 @@
|
|||
function submitForm( element )
|
||||
{
|
||||
var form = element.form;
|
||||
if ( form.option.selectedIndex == 0 )
|
||||
{
|
||||
form.view.value = currentView;
|
||||
}
|
||||
else
|
||||
{
|
||||
form.view.value = 'none';
|
||||
}
|
||||
function submitForm( element ) {
|
||||
var form = element.form;
|
||||
if ( form.option.selectedIndex == 0 ) {
|
||||
form.view.value = currentView;
|
||||
} else {
|
||||
form.view.value = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
if ( openZmWindow )
|
||||
{
|
||||
zmWindow();
|
||||
if ( openZmWindow ) {
|
||||
zmWindow();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,38 +1,33 @@
|
|||
function deleteVideo( index )
|
||||
{
|
||||
window.location.replace( thisUrl+'?view='+currentView+'&eid='+eventId+'&deleteIndex='+index );
|
||||
function deleteVideo( index ) {
|
||||
window.location.replace( thisUrl+'?view='+currentView+'&eid='+eventId+'&deleteIndex='+index );
|
||||
}
|
||||
|
||||
function downloadVideo( index )
|
||||
{
|
||||
window.location.replace( thisUrl+'?view='+currentView+'&eid='+eventId+'&downloadIndex='+index );
|
||||
function downloadVideo( index ) {
|
||||
window.location.replace( thisUrl+'?view='+currentView+'&eid='+eventId+'&downloadIndex='+index );
|
||||
}
|
||||
|
||||
var generateVideoTimer = null;
|
||||
|
||||
function generateVideoProgress()
|
||||
{
|
||||
var tickerText = $('videoProgressTicker').get('text');
|
||||
if ( tickerText.length < 1 || tickerText.length > 4 )
|
||||
$('videoProgressTicker').set( 'text', '.' );
|
||||
else
|
||||
$('videoProgressTicker').appendText( '.' );
|
||||
function generateVideoProgress() {
|
||||
var tickerText = $('videoProgressTicker').get('text');
|
||||
if ( tickerText.length < 1 || tickerText.length > 4 )
|
||||
$('videoProgressTicker').set( 'text', '.' );
|
||||
else
|
||||
$('videoProgressTicker').appendText( '.' );
|
||||
}
|
||||
|
||||
function generateVideoResponse( respObj, respText )
|
||||
{
|
||||
window.location.replace( thisUrl+'?view='+currentView+'&eid='+eventId+'&generated='+((respObj.result=='Ok')?1:0) );
|
||||
function generateVideoResponse( respObj, respText ) {
|
||||
window.location.replace( thisUrl+'?view='+currentView+'&eid='+eventId+'&generated='+((respObj.result=='Ok')?1:0) );
|
||||
}
|
||||
|
||||
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 } );
|
||||
query.send();
|
||||
$('videoProgress').removeClass( 'hidden' );
|
||||
$('videoProgress').setProperty( 'class', 'warnText' );
|
||||
$('videoProgressText').set( 'text', videoGenProgressString );
|
||||
generateVideoProgress();
|
||||
generateVideoTimer = generateVideoProgress.periodical( 500 );
|
||||
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 } );
|
||||
query.send();
|
||||
$('videoProgress').removeClass( 'hidden' );
|
||||
$('videoProgress').setProperty( 'class', 'warnText' );
|
||||
$('videoProgressText').set( 'text', videoGenProgressString );
|
||||
generateVideoProgress();
|
||||
generateVideoTimer = generateVideoProgress.periodical( 500 );
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
function setButtonState( element, butClass ) {
|
||||
element.className = butClass;
|
||||
element.disabled = (butClass != 'inactive');
|
||||
|
@ -37,58 +36,10 @@ function changeScale() {
|
|||
streamImg.style.width = newWidth + "px";
|
||||
streamImg.style.height = newHeight + "px";
|
||||
|
||||
streamImg.src = streamImg.src.replace(/scale=\d+/i,'scale='+scale);
|
||||
streamImg.src = streamImg.src.replace(/scale=\d+/i, 'scale='+scale);
|
||||
} 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,29 +201,13 @@ function getStreamCmdResponse( respObj, respText ) {
|
|||
} else {
|
||||
console.log("Unable to find streamImg liveStream");
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
|
||||
var streamCmdTimeout = statusRefreshTimeout;
|
||||
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
|
||||
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 );
|
||||
|
@ -445,169 +325,43 @@ 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 )
|
||||
statusCmdParms += '&auth='+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");
|
||||
checkStreamForErrors("getStatusCmdResponse",respObj);
|
||||
}
|
||||
} else
|
||||
checkStreamForErrors("getStatusCmdResponse", respObj);
|
||||
|
||||
var statusCmdTimeout = statusRefreshTimeout;
|
||||
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
|
||||
statusCmdTimeout = statusCmdTimeout/5;
|
||||
statusCmdTimer = statusCmdQuery.delay( statusCmdTimeout );
|
||||
}
|
||||
}
|
||||
|
||||
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 )
|
||||
alarmCmdParms += '&auth='+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
|
||||
checkStreamForErrors("getAlarmCmdResponse", respObj);
|
||||
}
|
||||
|
||||
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
|
||||
checkStreamForErrors("getEventCmdResponse", respObj);
|
||||
|
||||
var eventCmdTimeout = eventsRefreshTimeout;
|
||||
if ( alarmState == STATE_ALARM || alarmState == STATE_ALERT )
|
||||
|
@ -863,7 +530,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;
|
||||
|
@ -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
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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
|
||||
|
|
|
@ -18,12 +18,12 @@
|
|||
//
|
||||
|
||||
if ( !canView( 'Events' ) ) {
|
||||
$view = 'error';
|
||||
return;
|
||||
$view = 'error';
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ( getSkinIncludes( 'includes/timeline_functions.php' ) as $includeFile )
|
||||
require_once $includeFile;
|
||||
require_once $includeFile;
|
||||
|
||||
//
|
||||
// Date/time formats used in charts
|
||||
|
@ -64,11 +64,11 @@ define( "STRF_TL_AXIS_LABEL_SECOND", "%S" );
|
|||
|
||||
$mouseover = true;
|
||||
if ( !isset($mouseover) )
|
||||
$mouseover = true;
|
||||
$mouseover = true;
|
||||
|
||||
$mode = "overlay";
|
||||
$mode = 'overlay';
|
||||
if ( !isset($mode) )
|
||||
$mode = "overlay";
|
||||
$mode = 'overlay';
|
||||
|
||||
$minEventWidth = 3;
|
||||
$maxEventWidth = 6;
|
||||
|
@ -77,74 +77,75 @@ $chart = array(
|
|||
"width"=>700,
|
||||
"height"=>460,
|
||||
"image" => array(
|
||||
"width"=>264,
|
||||
"height"=>220,
|
||||
"topOffset"=>20,
|
||||
),
|
||||
"width"=>264,
|
||||
"height"=>220,
|
||||
"topOffset"=>20,
|
||||
),
|
||||
"imageText" => array(
|
||||
"width"=>400,
|
||||
"height"=>30,
|
||||
"topOffset"=>20,
|
||||
),
|
||||
"width"=>400,
|
||||
"height"=>30,
|
||||
"topOffset"=>20,
|
||||
),
|
||||
"graph" => array(
|
||||
"width"=>600,
|
||||
"height"=>160,
|
||||
"topOffset"=>30,
|
||||
),
|
||||
"width"=>600,
|
||||
"height"=>160,
|
||||
"topOffset"=>30,
|
||||
),
|
||||
"title" => array(
|
||||
"topOffset"=>50
|
||||
),
|
||||
"topOffset"=>50
|
||||
),
|
||||
"key" => array(
|
||||
"topOffset"=>50
|
||||
),
|
||||
),
|
||||
"axes" => array(
|
||||
"x" => array(
|
||||
"height" => 20,
|
||||
),
|
||||
"height" => 20,
|
||||
),
|
||||
"y" => array(
|
||||
"width" => 30,
|
||||
"width" => 30,
|
||||
),
|
||||
),
|
||||
),
|
||||
"grid" => array(
|
||||
"x" => array(
|
||||
"major" => array(
|
||||
"max" => 12,
|
||||
"min" => 4,
|
||||
"major" => array(
|
||||
"max" => 12,
|
||||
"min" => 4,
|
||||
),
|
||||
"minor" => array(
|
||||
"max" => 48,
|
||||
"min" => 12,
|
||||
"minor" => array(
|
||||
"max" => 48,
|
||||
"min" => 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
"y" => array(
|
||||
"major" => array(
|
||||
"max" => 8,
|
||||
"min" => 1,
|
||||
"major" => array(
|
||||
"max" => 8,
|
||||
"min" => 1,
|
||||
),
|
||||
"minor" => array(
|
||||
"max" => 0,
|
||||
"min" => 0,
|
||||
"minor" => array(
|
||||
"max" => 0,
|
||||
"min" => 0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$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']) )
|
||||
//{
|
||||
//$row['WebColour'] = sprintf( "#%02x%02x%02x", rand( 0, 255 ), rand( 0, 255), rand( 0, 255 ) );
|
||||
//$row['WebColour'] = sprintf( "#%02x%02x%02x", rand( 0, 255 ), rand( 0, 255), rand( 0, 255 ) );
|
||||
//}
|
||||
$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'].')';
|
||||
$monFilterSql = ' AND MonitorId IN ('.$user['MonitorIds'].')';
|
||||
|
||||
$rangeSql .= $monFilterSql;
|
||||
$eventsSql .= $monFilterSql;
|
||||
|
@ -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['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;
|
||||
|
@ -565,123 +563,124 @@ preg_match( '/^(\d+)-(\d+)-(\d+) (\d+):(\d+)/', $minTime, $startMatches );
|
|||
preg_match( '/^(\d+)-(\d+)-(\d+) (\d+):(\d+)/', $maxTime, $endMatches );
|
||||
|
||||
if ( $startMatches[1] != $endMatches[1] ) {
|
||||
// Different years
|
||||
$title = strftime( STRF_TL_AXIS_RANGE_YEAR1, $chart['data']['x']['lo'] )." - ".strftime( STRF_TL_AXIS_RANGE_YEAR2, $chart['data']['x']['hi'] );
|
||||
// Different years
|
||||
$title = strftime( STRF_TL_AXIS_RANGE_YEAR1, $chart['data']['x']['lo'] )." - ".strftime( STRF_TL_AXIS_RANGE_YEAR2, $chart['data']['x']['hi'] );
|
||||
} elseif ( $startMatches[2] != $endMatches[2] ) {
|
||||
// Different months
|
||||
$title = strftime( STRF_TL_AXIS_RANGE_MONTH1, $chart['data']['x']['lo'] )." - ".strftime( STRF_TL_AXIS_RANGE_MONTH2, $chart['data']['x']['hi'] );
|
||||
// Different months
|
||||
$title = strftime( STRF_TL_AXIS_RANGE_MONTH1, $chart['data']['x']['lo'] )." - ".strftime( STRF_TL_AXIS_RANGE_MONTH2, $chart['data']['x']['hi'] );
|
||||
} elseif ( $startMatches[3] != $endMatches[3] ) {
|
||||
// Different dates
|
||||
$title = strftime( STRF_TL_AXIS_RANGE_DAY1, $chart['data']['x']['lo'] )." - ".strftime( STRF_TL_AXIS_RANGE_DAY2, $chart['data']['x']['hi'] );
|
||||
// Different dates
|
||||
$title = strftime( STRF_TL_AXIS_RANGE_DAY1, $chart['data']['x']['lo'] )." - ".strftime( STRF_TL_AXIS_RANGE_DAY2, $chart['data']['x']['hi'] );
|
||||
} else {
|
||||
// Different times
|
||||
$title = strftime( STRF_TL_AXIS_RANGE_TIME1, $chart['data']['x']['lo'] )." - ".strftime( STRF_TL_AXIS_RANGE_TIME2, $chart['data']['x']['hi'] );
|
||||
// Different times
|
||||
$title = strftime( STRF_TL_AXIS_RANGE_TIME1, $chart['data']['x']['lo'] )." - ".strftime( STRF_TL_AXIS_RANGE_TIME2, $chart['data']['x']['hi'] );
|
||||
}
|
||||
|
||||
function drawXGrid( $chart, $scale, $labelClass, $tickClass, $gridClass, $zoomClass=false ) {
|
||||
ob_start();
|
||||
$labelCount = 0;
|
||||
$lastTick = 0;
|
||||
unset( $lastLabel );
|
||||
$labelCheck = isset($scale['labelCheck'])?$scale['labelCheck']:$scale['label'];
|
||||
$html = '';
|
||||
ob_start();
|
||||
$labelCount = 0;
|
||||
$lastTick = 0;
|
||||
unset( $lastLabel );
|
||||
$labelCheck = isset($scale['labelCheck'])?$scale['labelCheck']:$scale['label'];
|
||||
?>
|
||||
<div id="xScale">
|
||||
<?php
|
||||
for ( $i = 0; $i < $chart['graph']['width']; $i++ ) {
|
||||
$x = $i - 1;
|
||||
$timeOffset = (int)($chart['data']['x']['lo'] + ($i * $chart['data']['x']['density']));
|
||||
if ( $scale['align'] > 1 ) {
|
||||
$label = (int)(strftime( $labelCheck, $timeOffset )/$scale['align']);
|
||||
} else {
|
||||
$label = strftime( $labelCheck, $timeOffset );
|
||||
}
|
||||
if ( !isset($lastLabel) || ($lastLabel != $label) ) {
|
||||
$labelCount++;
|
||||
}
|
||||
if ( $labelCount >= $scale['divisor'] ) {
|
||||
$labelCount = 0;
|
||||
if ( isset($lastLabel) ) {
|
||||
if ( $labelClass ) {
|
||||
?>
|
||||
<div class="<?php echo $labelClass ?>" style="left: <?php echo $x-25 ?>px;"><?php echo strftime( $scale['label'], $timeOffset ); ?></div>
|
||||
<?php
|
||||
}
|
||||
if ( $tickClass ) {
|
||||
?>
|
||||
<div class="<?php echo $tickClass ?>" style="left: <?php echo $x ?>px;"></div>
|
||||
<?php
|
||||
}
|
||||
if ( $gridClass ) {
|
||||
?>
|
||||
<div class="<?php echo $gridClass ?>" style="left: <?php echo $x ?>px;"></div>
|
||||
<?php
|
||||
}
|
||||
if ( $scale['name'] != 'second' && $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'])) );
|
||||
?>
|
||||
<div class="<?php echo $zoomClass ?>" style="left: <?php echo $lastTick-1 ?>px; width: <?php echo $i-$lastTick ?>px;" title="<?php echo translate('ZoomIn') ?>" onclick="tlZoomBounds( '<?php echo $zoomMinTime ?>', '<?php echo $zoomMaxTime ?>' )"></div>
|
||||
<?php
|
||||
}
|
||||
$lastTick = $i;
|
||||
}
|
||||
}
|
||||
$lastLabel = $label;
|
||||
for ( $i = 0; $i < $chart['graph']['width']; $i++ ) {
|
||||
$x = $i - 1;
|
||||
$timeOffset = (int)($chart['data']['x']['lo'] + ($i * $chart['data']['x']['density']));
|
||||
if ( $scale['align'] > 1 ) {
|
||||
$label = (int)(strftime( $labelCheck, $timeOffset )/$scale['align']);
|
||||
} else {
|
||||
$label = strftime( $labelCheck, $timeOffset );
|
||||
}
|
||||
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'])) );
|
||||
?>
|
||||
<div class="<?php echo $zoomClass ?>" style="left: <?php echo $lastTick-1 ?>px; width: <?php echo $i-$lastTick ?>px;" title="<?php echo translate('ZoomIn') ?>" onclick="tlZoomBounds( '<?php echo $zoomMinTime ?>', '<?php echo $zoomMaxTime ?>' )"></div>
|
||||
<?php
|
||||
if ( !isset($lastLabel) || ($lastLabel != $label) ) {
|
||||
$labelCount++;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
return( ob_get_clean() );
|
||||
}
|
||||
|
||||
function drawYGrid( $chart, $scale, $labelClass, $tickClass, $gridClass ) {
|
||||
ob_start();
|
||||
?>
|
||||
<div id="yScale">
|
||||
<?php
|
||||
for ( $i = 0; $i < $scale['lines']; $i++ ) {
|
||||
$label = (int)($i * $scale['divisor']);
|
||||
$y = $chart['graph']['eventsHeight']+(int)(($i * $scale['divisor'])/$chart['data']['y']['density'])-1;
|
||||
if ( $labelCount >= $scale['divisor'] ) {
|
||||
$labelCount = 0;
|
||||
if ( isset($lastLabel) ) {
|
||||
if ( $labelClass ) {
|
||||
?>
|
||||
<div class="<?php echo $labelClass ?>" style="top: <?php echo $chart['graph']['height']-($y+8) ?>px;"><?php echo $label ?></div>
|
||||
<div class="<?php echo $labelClass ?>" style="left: <?php echo $x-25 ?>px;"><?php echo strftime( $scale['label'], $timeOffset ); ?></div>
|
||||
<?php
|
||||
}
|
||||
if ( $tickClass ) {
|
||||
?>
|
||||
<div class="<?php echo $tickClass ?>" style="top: <?php echo $chart['graph']['height']-($y+2) ?>px;"></div>
|
||||
<div class="<?php echo $tickClass ?>" style="left: <?php echo $x ?>px;"></div>
|
||||
<?php
|
||||
}
|
||||
if ( $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>
|
||||
<div class="<?php echo $gridClass ?>" style="left: <?php echo $x ?>px;"></div>
|
||||
<?php
|
||||
}
|
||||
if ( $scale['name'] != 'second' && $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'])) );
|
||||
?>
|
||||
<div class="<?php echo $zoomClass ?>" style="left: <?php echo $lastTick-1 ?>px; width: <?php echo $i-$lastTick ?>px;" title="<?php echo translate('ZoomIn') ?>" onclick="tlZoomBounds( '<?php echo $zoomMinTime ?>', '<?php echo $zoomMaxTime ?>' )"></div>
|
||||
<?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'])) );
|
||||
?>
|
||||
<div class="<?php echo $zoomClass ?>" style="left: <?php echo $lastTick-1 ?>px; width: <?php echo $i-$lastTick ?>px;" title="<?php echo translate('ZoomIn') ?>" onclick="tlZoomBounds( '<?php echo $zoomMinTime ?>', '<?php echo $zoomMaxTime ?>' )"></div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
return( ob_get_clean() );
|
||||
} # end function drawXGrid
|
||||
|
||||
return( ob_get_clean() );
|
||||
}
|
||||
function drawYGrid( $chart, $scale, $labelClass, $tickClass, $gridClass ) {
|
||||
ob_start();
|
||||
?>
|
||||
<div id="yScale">
|
||||
<?php
|
||||
for ( $i = 0; $i < $scale['lines']; $i++ ) {
|
||||
$label = (int)($i * $scale['divisor']);
|
||||
$y = $chart['graph']['eventsHeight']+(int)(($i * $scale['divisor'])/$chart['data']['y']['density'])-1;
|
||||
if ( $labelClass ) {
|
||||
?>
|
||||
<div class="<?php echo $labelClass ?>" style="top: <?php echo $chart['graph']['height']-($y+8) ?>px;"><?php echo $label ?></div>
|
||||
<?php
|
||||
}
|
||||
if ( $tickClass ) {
|
||||
?>
|
||||
<div class="<?php echo $tickClass ?>" style="top: <?php echo $chart['graph']['height']-($y+2) ?>px;"></div>
|
||||
<?php
|
||||
}
|
||||
if ( $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 )."' )" );
|
||||
return( "previewEvent( '".$slot['event']['Id']."', '".getSlotFrame( $slot )."' )" );
|
||||
}
|
||||
|
||||
function getSlotShowEventBehaviour( $slot ) {
|
||||
global $monitors;
|
||||
global $monitors;
|
||||
|
||||
$monitor = &$monitors[$slot['event']['MonitorId']];
|
||||
$monitor = &$monitors[$slot['event']['MonitorId']];
|
||||
|
||||
return( "showEvent( '".$slot['event']['Id']."', '".getSlotFrame( $slot )."', '".reScale( $monitor['Width'], $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE )."', '".reScale( $monitor['Height'], $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE )."' )" );
|
||||
return( "showEvent( '".$slot['event']['Id']."', '".getSlotFrame( $slot )."', '".reScale( $monitor['Width'], $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE )."', '".reScale( $monitor['Height'], $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE )."' )" );
|
||||
}
|
||||
|
||||
$focusWindow = true;
|
||||
|
@ -713,7 +712,7 @@ Your browser does not support the video tag.
|
|||
</video>
|
||||
o-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="dataPanel">
|
||||
<div id="textPanel">
|
||||
|
@ -736,102 +735,102 @@ 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
|
||||
foreach ( $frameSlots as $index=>$slots ) {
|
||||
foreach ( $slots as $slot ) {
|
||||
$slotHeight = (int)($slot['value']/$chart['data']['y']['density']);
|
||||
|
||||
if ( $slotHeight <= 0 )
|
||||
continue;
|
||||
|
||||
if ( $mouseover ) {
|
||||
$behaviours = array(
|
||||
'onclick="'.getSlotShowEventBehaviour( $slot ).'"',
|
||||
'onmouseover="'.getSlotPreviewEventBehaviour( $slot ).'"'
|
||||
);
|
||||
} else {
|
||||
$behaviours = array(
|
||||
'onclick="'.getSlotPreviewEventBehaviour( $slot ).'"'
|
||||
);
|
||||
}
|
||||
foreach ( $slots as $slot ) {
|
||||
$slotHeight = (int)($slot['value']/$chart['data']['y']['density']);
|
||||
|
||||
if ( $slotHeight <= 0 )
|
||||
continue;
|
||||
|
||||
if ( $mouseover ) {
|
||||
$behaviours = array(
|
||||
'onclick="'.getSlotShowEventBehaviour( $slot ).'"',
|
||||
'onmouseover="'.getSlotPreviewEventBehaviour( $slot ).'"'
|
||||
);
|
||||
} else {
|
||||
$behaviours = array(
|
||||
'onclick="'.getSlotPreviewEventBehaviour( $slot ).'"'
|
||||
);
|
||||
}
|
||||
?>
|
||||
<div class="activity monitorColour<?php echo $slot['event']['MonitorId'] ?>" style="left: <?php echo $index ?>px; height: <?php echo $slotHeight ?>px;" <?php echo join( " ", $behaviours ) ?>></div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
} elseif ( $mode == "split" ) {
|
||||
foreach( array_keys($monFrameSlots) as $monitorId ) {
|
||||
} elseif ( $mode == 'split' ) {
|
||||
foreach( array_keys($monFrameSlots) as $monitorId ) {
|
||||
?>
|
||||
<div id="activity<?php echo $monitorId ?>">
|
||||
<div id="activity<?php echo $monitorId ?>">
|
||||
<?php
|
||||
unset( $currFrameSlots );
|
||||
$currFrameSlots = &$monFrameSlots[$monitorId];
|
||||
foreach ( $currFrameSlots as $index=>$slot ) {
|
||||
$slotHeight = (int)($slot['value']/$chart['data']['y']['density']);
|
||||
|
||||
if ( $slotHeight <= 0 )
|
||||
continue;
|
||||
|
||||
if ( $mouseover ) {
|
||||
$behaviours = array(
|
||||
'onclick="'.getSlotShowEventBehaviour( $slot ).'"',
|
||||
'onmouseover="'.getSlotPreviewEventBehaviour( $slot ).'"'
|
||||
);
|
||||
} else {
|
||||
$behaviours = array(
|
||||
'onclick="'.getSlotPreviewEventBehaviour( $slot ).'"'
|
||||
);
|
||||
}
|
||||
?>
|
||||
<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
|
||||
}
|
||||
unset( $currFrameSlots );
|
||||
$currFrameSlots = &$monFrameSlots[$monitorId];
|
||||
foreach ( $currFrameSlots as $index=>$slot ) {
|
||||
$slotHeight = (int)($slot['value']/$chart['data']['y']['density']);
|
||||
|
||||
if ( $slotHeight <= 0 )
|
||||
continue;
|
||||
|
||||
if ( $mouseover ) {
|
||||
$behaviours = array(
|
||||
'onclick="'.getSlotShowEventBehaviour( $slot ).'"',
|
||||
'onmouseover="'.getSlotPreviewEventBehaviour( $slot ).'"'
|
||||
);
|
||||
} else {
|
||||
$behaviours = array(
|
||||
'onclick="'.getSlotPreviewEventBehaviour( $slot ).'"'
|
||||
);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<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 ) {
|
||||
?>
|
||||
<div id="events<?php echo $monitorId ?>" class="events eventsSize eventsPos<?php echo $monitorId ?>">
|
||||
<?php
|
||||
unset( $currEventSlots );
|
||||
$currEventSlots = &$monEventSlots[$monitorId];
|
||||
$monitorMouseover = $mouseover;
|
||||
if ($monitors[$monitorId]['SaveJPEGs'] == 2) {
|
||||
$monitorMouseover = false;
|
||||
}
|
||||
for ( $i = 0; $i < $chart['graph']['width']; $i++ ) {
|
||||
if ( isset($currEventSlots[$i]) ) {
|
||||
unset( $slot );
|
||||
$slot = &$currEventSlots[$i];
|
||||
unset( $currEventSlots );
|
||||
$currEventSlots = &$monEventSlots[$monitorId];
|
||||
$monitorMouseover = $mouseover;
|
||||
if ($monitors[$monitorId]['SaveJPEGs'] == 2) {
|
||||
$monitorMouseover = false;
|
||||
}
|
||||
for ( $i = 0; $i < $chart['graph']['width']; $i++ ) {
|
||||
if ( isset($currEventSlots[$i]) ) {
|
||||
unset( $slot );
|
||||
$slot = &$currEventSlots[$i];
|
||||
|
||||
if ( $monitorMouseover ) {
|
||||
$behaviours = array(
|
||||
'onclick="'.getSlotShowEventBehaviour( $slot ).'"',
|
||||
'onmouseover="'.getSlotPreviewEventBehaviour( $slot ).'"'
|
||||
);
|
||||
} else {
|
||||
$behaviours = array(
|
||||
'onclick="'.getSlotPreviewEventBehaviour( $slot ).'"'
|
||||
);
|
||||
}
|
||||
if ( $monitorMouseover ) {
|
||||
$behaviours = array(
|
||||
'onclick="'.getSlotShowEventBehaviour( $slot ).'"',
|
||||
'onmouseover="'.getSlotPreviewEventBehaviour( $slot ).'"'
|
||||
);
|
||||
} else {
|
||||
$behaviours = array(
|
||||
'onclick="'.getSlotPreviewEventBehaviour( $slot ).'"'
|
||||
);
|
||||
}
|
||||
?>
|
||||
<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
|
||||
|
|
|
@ -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'] ) ) {
|
||||
|
|
|
@ -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() );
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue