Merge branch 'master' of github.com:ZoneMinder/zoneminder
This commit is contained in:
commit
3f0bdf6332
|
@ -5,6 +5,12 @@ set +e
|
||||||
create_db () {
|
create_db () {
|
||||||
echo "Checking for db"
|
echo "Checking for db"
|
||||||
mysqladmin --defaults-file=/etc/mysql/debian.cnf -f reload
|
mysqladmin --defaults-file=/etc/mysql/debian.cnf -f reload
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Cannot talk to database. You will have to create the db manually with something like:";
|
||||||
|
echo "cat /usr/share/zoneminder/db/zm_create.sql | mysql -u root";
|
||||||
|
return;
|
||||||
|
fi
|
||||||
|
|
||||||
# test if database if already present...
|
# test if database if already present...
|
||||||
if ! $(echo quit | mysql --defaults-file=/etc/mysql/debian.cnf zm > /dev/null 2> /dev/null) ; then
|
if ! $(echo quit | mysql --defaults-file=/etc/mysql/debian.cnf zm > /dev/null 2> /dev/null) ; then
|
||||||
echo "Creating zm db"
|
echo "Creating zm db"
|
||||||
|
|
|
@ -720,7 +720,7 @@ sub CopyTo {
|
||||||
} # end foreach file.
|
} # end foreach file.
|
||||||
} # end if ! moved
|
} # end if ! moved
|
||||||
|
|
||||||
return $error if $error;
|
return $error;
|
||||||
} # end sub CopyTo
|
} # end sub CopyTo
|
||||||
|
|
||||||
sub MoveTo {
|
sub MoveTo {
|
||||||
|
@ -744,11 +744,11 @@ sub MoveTo {
|
||||||
$$self{StorageId} = $$NewStorage{Id};
|
$$self{StorageId} = $$NewStorage{Id};
|
||||||
$self->Storage($NewStorage);
|
$self->Storage($NewStorage);
|
||||||
$error .= $self->save();
|
$error .= $self->save();
|
||||||
if ($error) {
|
|
||||||
$ZoneMinder::Database::dbh->commit() if !$was_in_transaction;
|
# Going to leave it to upper layer as to whether we rollback or not
|
||||||
return $error;
|
|
||||||
}
|
|
||||||
$ZoneMinder::Database::dbh->commit() if !$was_in_transaction;
|
$ZoneMinder::Database::dbh->commit() if !$was_in_transaction;
|
||||||
|
return $error if $error;
|
||||||
|
|
||||||
$self->delete_files($OldStorage);
|
$self->delete_files($OldStorage);
|
||||||
return $error;
|
return $error;
|
||||||
} # end sub MoveTo
|
} # end sub MoveTo
|
||||||
|
|
|
@ -663,6 +663,7 @@ bool EventStream::checkEventLoaded() {
|
||||||
else
|
else
|
||||||
curr_frame_id = 1;
|
curr_frame_id = 1;
|
||||||
Debug(2, "New frame id = %ld", curr_frame_id);
|
Debug(2, "New frame id = %ld", curr_frame_id);
|
||||||
|
start = std::chrono::system_clock::now();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
Debug(2, "No next event loaded using %s. Pausing", sql.c_str());
|
Debug(2, "No next event loaded using %s. Pausing", sql.c_str());
|
||||||
|
@ -957,18 +958,20 @@ void EventStream::runStream() {
|
||||||
static_cast<int64>(std::chrono::duration_cast<Microseconds>(delta).count()));
|
static_cast<int64>(std::chrono::duration_cast<Microseconds>(delta).count()));
|
||||||
|
|
||||||
// if effective > base we should speed up frame delivery
|
// if effective > base we should speed up frame delivery
|
||||||
delta = std::chrono::duration_cast<Microseconds>((delta * base_fps) / effective_fps);
|
if (base_fps < effective_fps) {
|
||||||
Debug(3, "delta %" PRIi64 " us = base_fps (%f) / effective_fps (%f)",
|
delta = std::chrono::duration_cast<Microseconds>((delta * base_fps) / effective_fps);
|
||||||
|
Debug(3, "delta %" PRIi64 " us = base_fps (%f) / effective_fps (%f)",
|
||||||
static_cast<int64>(std::chrono::duration_cast<Microseconds>(delta).count()),
|
static_cast<int64>(std::chrono::duration_cast<Microseconds>(delta).count()),
|
||||||
base_fps,
|
base_fps,
|
||||||
effective_fps);
|
effective_fps);
|
||||||
|
|
||||||
// but must not exceed maxfps
|
// but must not exceed maxfps
|
||||||
delta = std::max(delta, Microseconds(lround(Microseconds::period::den / maxfps)));
|
delta = std::max(delta, Microseconds(lround(Microseconds::period::den / maxfps)));
|
||||||
Debug(3, "delta %" PRIi64 " us = base_fps (%f) /effective_fps (%f) from 30fps",
|
Debug(3, "delta %" PRIi64 " us = base_fps (%f) / effective_fps (%f) from 30fps",
|
||||||
static_cast<int64>(std::chrono::duration_cast<Microseconds>(delta).count()),
|
static_cast<int64>(std::chrono::duration_cast<Microseconds>(delta).count()),
|
||||||
base_fps,
|
base_fps,
|
||||||
effective_fps);
|
effective_fps);
|
||||||
|
}
|
||||||
|
|
||||||
// +/- 1? What if we are skipping frames?
|
// +/- 1? What if we are skipping frames?
|
||||||
curr_frame_id += (replay_rate>0) ? frame_mod : -1*frame_mod;
|
curr_frame_id += (replay_rate>0) ? frame_mod : -1*frame_mod;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
if (empty($_REQUEST['eid'])) ajaxError('Event Id Not Provided');
|
||||||
if ( empty($_REQUEST['eid']) ) ajaxError('Event Id Not Provided');
|
if (empty($_REQUEST['fid'])) ajaxError('Frame Id Not Provided');
|
||||||
if ( empty($_REQUEST['fid']) ) ajaxError('Frame Id Not Provided');
|
|
||||||
|
|
||||||
$eid = $_REQUEST['eid'];
|
$eid = $_REQUEST['eid'];
|
||||||
$fid = $_REQUEST['fid'];
|
$fid = $_REQUEST['fid'];
|
||||||
|
@ -9,32 +8,26 @@ $row = ( isset($_REQUEST['row']) ) ? $_REQUEST['row'] : '';
|
||||||
$raw = isset($_REQUEST['raw']);
|
$raw = isset($_REQUEST['raw']);
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
// Not sure if this is required
|
if ($raw) {
|
||||||
if ( ZM_OPT_USE_AUTH && (ZM_AUTH_RELAY == 'hashed') ) {
|
$sql = 'SELECT S.*,E.*,Z.Name AS ZoneName,Z.Units,Z.Area,M.Name AS MonitorName
|
||||||
$auth_hash = generateAuthHash(ZM_AUTH_HASH_IPS);
|
FROM Stats AS S LEFT JOIN Events AS E ON S.EventId = E.Id LEFT JOIN Zones AS Z ON S.ZoneId = Z.Id LEFT JOIN Monitors AS M ON E.MonitorId = M.Id
|
||||||
if ( isset($_REQUEST['auth']) and ($_REQUEST['auth'] != $auth_hash) ) {
|
WHERE S.EventId = ? AND S.FrameId = ? ORDER BY S.ZoneId';
|
||||||
$data['auth'] = $auth_hash;
|
$stats = dbFetchAll($sql, NULL, array($eid, $fid));
|
||||||
}
|
foreach ($stats as $stat) {
|
||||||
}
|
|
||||||
|
|
||||||
if ( $raw ) {
|
|
||||||
$sql = 'SELECT S.*,E.*,Z.Name AS ZoneName,Z.Units,Z.Area,M.Name AS MonitorName FROM Stats AS S LEFT JOIN Events AS E ON S.EventId = E.Id LEFT JOIN Zones AS Z ON S.ZoneId = Z.Id LEFT JOIN Monitors AS M ON E.MonitorId = M.Id WHERE S.EventId = ? AND S.FrameId = ? ORDER BY S.ZoneId';
|
|
||||||
$stat = dbFetchOne( $sql, NULL, array( $eid, $fid ) );
|
|
||||||
if ( $stat ) {
|
|
||||||
$stat['ZoneName'] = validHtmlStr($stat['ZoneName']);
|
$stat['ZoneName'] = validHtmlStr($stat['ZoneName']);
|
||||||
$stat['PixelDiff'] = validHtmlStr($stat['PixelDiff']);
|
$stat['PixelDiff'] = validHtmlStr($stat['PixelDiff']);
|
||||||
$stat['AlarmPixels'] = sprintf( "%d (%d%%)", $stat['AlarmPixels'], (100*$stat['AlarmPixels']/$stat['Area']) );
|
$stat['AlarmPixels'] = sprintf('%d (%d%%)', $stat['AlarmPixels'], (100*$stat['AlarmPixels']/$stat['Area']));
|
||||||
$stat['FilterPixels'] = sprintf( "%d (%d%%)", $stat['FilterPixels'], (100*$stat['FilterPixels']/$stat['Area']) );
|
$stat['FilterPixels'] = sprintf('%d (%d%%)', $stat['FilterPixels'], (100*$stat['FilterPixels']/$stat['Area']));
|
||||||
$stat['BlobPixels'] = sprintf( "%d (%d%%)", $stat['BlobPixels'], (100*$stat['BlobPixels']/$stat['Area']) );
|
$stat['BlobPixels'] = sprintf('%d (%d%%)', $stat['BlobPixels'], (100*$stat['BlobPixels']/$stat['Area']));
|
||||||
$stat['Blobs'] = validHtmlStr($stat['Blobs']);
|
$stat['Blobs'] = validHtmlStr($stat['Blobs']);
|
||||||
if ( $stat['Blobs'] > 1 ) {
|
if ($stat['Blobs'] > 1) {
|
||||||
$stat['BlobSizes'] = sprintf( "%d-%d (%d%%-%d%%)", $stat['MinBlobSize'], $stat['MaxBlobSize'], (100*$stat['MinBlobSize']/$stat['Area']), (100*$stat['MaxBlobSize']/$stat['Area']) );
|
$stat['BlobSizes'] = sprintf('%d-%d (%d%%-%d%%)', $stat['MinBlobSize'], $stat['MaxBlobSize'], (100*$stat['MinBlobSize']/$stat['Area']), (100*$stat['MaxBlobSize']/$stat['Area']));
|
||||||
} else {
|
} else {
|
||||||
$stat['BlobSizes'] = sprintf( "%d (%d%%)", $stat['MinBlobSize'], 100*$stat['MinBlobSize']/$stat['Area'] );
|
$stat['BlobSizes'] = sprintf('%d (%d%%)', $stat['MinBlobSize'], 100*$stat['MinBlobSize']/$stat['Area']);
|
||||||
}
|
}
|
||||||
$stat['AlarmLimits'] = validHtmlStr($stat['MinX'].",".$stat['MinY']."-".$stat['MaxX'].",".$stat['MaxY']);
|
$stat['AlarmLimits'] = validHtmlStr($stat['MinX'].','.$stat['MinY'].'-'.$stat['MaxX'].','.$stat['MaxY']);
|
||||||
}
|
$data['raw'][] = $stat;
|
||||||
$data['raw'] = $stat;
|
} # end foreach stat/zone
|
||||||
} else {
|
} else {
|
||||||
$data['html'] = getStatsTableHTML($eid, $fid, $row);
|
$data['html'] = getStatsTableHTML($eid, $fid, $row);
|
||||||
$data['id'] = '#contentStatsTable' .$row;
|
$data['id'] = '#contentStatsTable' .$row;
|
||||||
|
|
|
@ -18,30 +18,28 @@
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
//
|
//
|
||||||
|
|
||||||
if ( !canView('Events') ) {
|
|
||||||
$view = 'error';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once('includes/Frame.php');
|
require_once('includes/Frame.php');
|
||||||
|
|
||||||
$eid = validInt($_REQUEST['eid']);
|
$eid = validInt($_REQUEST['eid']);
|
||||||
$fid = empty($_REQUEST['fid']) ? 0 : validInt($_REQUEST['fid']);
|
$fid = empty($_REQUEST['fid']) ? 0 : validInt($_REQUEST['fid']);
|
||||||
|
|
||||||
$Event = new ZM\Event($eid);
|
$Event = new ZM\Event($eid);
|
||||||
|
if (!$Event->canView()) {
|
||||||
|
$view = 'error';
|
||||||
|
return;
|
||||||
|
}
|
||||||
$Monitor = $Event->Monitor();
|
$Monitor = $Event->Monitor();
|
||||||
|
|
||||||
# This is kinda weird.. so if we pass fid=0 or some other non-integer, then it loads max score
|
# This is kinda weird.. so if we pass fid=0 or some other non-integer, then it loads max score
|
||||||
# perhaps we should consider being explicit, like fid = maxscore
|
# perhaps we should consider being explicit, like fid = maxscore
|
||||||
if ( !empty($fid) ) {
|
if (!empty($fid)) {
|
||||||
$sql = 'SELECT * FROM Frames WHERE EventId = ? AND FrameId = ?';
|
$sql = 'SELECT * FROM Frames WHERE EventId=? AND FrameId=?';
|
||||||
if ( !($frame = dbFetchOne($sql, NULL, array($eid, $fid))) )
|
if (!($frame = dbFetchOne($sql, NULL, array($eid, $fid))))
|
||||||
$frame = array('EventId'=>$eid, 'FrameId'=>$fid, 'Type'=>'Normal', 'Score'=>0);
|
$frame = array('EventId'=>$eid, 'FrameId'=>$fid, 'Type'=>'Normal', 'Score'=>0);
|
||||||
} else {
|
} else {
|
||||||
$frame = dbFetchOne('SELECT * FROM Frames WHERE EventId = ? AND Score = ?', NULL, array($eid, $Event->MaxScore()));
|
$frame = dbFetchOne('SELECT * FROM Frames WHERE EventId=? AND Score=?', NULL, array($eid, $Event->MaxScore()));
|
||||||
}
|
}
|
||||||
$Frame = new ZM\Frame($frame);
|
$Frame = new ZM\Frame($frame);
|
||||||
|
|
||||||
$maxFid = $Event->Frames();
|
$maxFid = $Event->Frames();
|
||||||
|
|
||||||
$firstFid = 1;
|
$firstFid = 1;
|
||||||
|
@ -51,11 +49,11 @@ $lastFid = $maxFid;
|
||||||
|
|
||||||
$alarmFrame = ( $Frame->Type() == 'Alarm' ) ? 1 : 0;
|
$alarmFrame = ( $Frame->Type() == 'Alarm' ) ? 1 : 0;
|
||||||
|
|
||||||
if ( isset($_REQUEST['scale']) ) {
|
if (isset($_REQUEST['scale'])) {
|
||||||
$scale = validNum($_REQUEST['scale']);
|
$scale = validNum($_REQUEST['scale']);
|
||||||
} else if ( isset($_COOKIE['zmWatchScale'.$Monitor->Id()]) ) {
|
} else if (isset($_COOKIE['zmWatchScale'.$Monitor->Id()])) {
|
||||||
$scale = validNum($_COOKIE['zmWatchScale'.$Monitor->Id()]);
|
$scale = validNum($_COOKIE['zmWatchScale'.$Monitor->Id()]);
|
||||||
} else if ( isset($_COOKIE['zmWatchScale']) ) {
|
} else if (isset($_COOKIE['zmWatchScale'])) {
|
||||||
$scale = validNum($_COOKIE['zmWatchScale']);
|
$scale = validNum($_COOKIE['zmWatchScale']);
|
||||||
} else {
|
} else {
|
||||||
$scale = max(reScale(SCALE_BASE, $Monitor->DefaultScale(), ZM_WEB_DEFAULT_SCALE), SCALE_BASE);
|
$scale = max(reScale(SCALE_BASE, $Monitor->DefaultScale(), ZM_WEB_DEFAULT_SCALE), SCALE_BASE);
|
||||||
|
@ -63,7 +61,7 @@ if ( isset($_REQUEST['scale']) ) {
|
||||||
$scale = $scale ? $scale : 0;
|
$scale = $scale ? $scale : 0;
|
||||||
|
|
||||||
$imageData = $Event->getImageSrc($frame, $scale, 0);
|
$imageData = $Event->getImageSrc($frame, $scale, 0);
|
||||||
if ( !$imageData ) {
|
if (!$imageData) {
|
||||||
ZM\Error("No data found for Event $eid frame $fid");
|
ZM\Error("No data found for Event $eid frame $fid");
|
||||||
$imageData = array();
|
$imageData = array();
|
||||||
}
|
}
|
||||||
|
@ -92,78 +90,80 @@ xhtmlHeaders(__FILE__, translate('Frame').' - '.$Event->Id().' - '.$Frame->Frame
|
||||||
<div id="page p-0">
|
<div id="page p-0">
|
||||||
<div class="d-flex flex-row justify-content-between px-3 pt-1">
|
<div class="d-flex flex-row justify-content-between px-3 pt-1">
|
||||||
<div id="toolbar" >
|
<div id="toolbar" >
|
||||||
<button id="backBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Back') ?>" disabled><i class="fa fa-arrow-left"></i></button>
|
<button type="button" id="backBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Back') ?>" disabled><i class="fa fa-arrow-left"></i></button>
|
||||||
<button id="refreshBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Refresh') ?>" ><i class="fa fa-refresh"></i></button>
|
<button type="button" id="refreshBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Refresh') ?>" ><i class="fa fa-refresh"></i></button>
|
||||||
<button id="statsBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Stats') ?>" ><i class="fa fa-info"></i></button>
|
<button type="button" id="statsBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Stats') ?>" ><i class="fa fa-info"></i></button>
|
||||||
<button id="statsViewBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Stats').' '.translate('View') ?>" ><i class="fa fa-table"></i></button>
|
<button type="button" id="statsViewBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Stats').' '.translate('View') ?>" ><i class="fa fa-table"></i></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2><?php echo translate('Frame') ?> <?php echo $Event->Id().'-'.$Frame->FrameId().' ('.$Frame->Score().')' ?></h2>
|
<h2><?php echo translate('Frame') ?> <?php echo $Event->Id().'-'.$Frame->FrameId().' ('.$Frame->Score().')' ?></h2>
|
||||||
|
|
||||||
<form>
|
<form>
|
||||||
<div id="scaleControl"><label for="scale"><?php echo translate('Scale') ?></label><?php echo htmlSelect('scale', $scales, $scale, array('data-on-change'=>'changeScale','id'=>'scale')); ?></div>
|
<div id="scaleControl">
|
||||||
|
<label for="scale"><?php echo translate('Scale') ?></label>
|
||||||
|
<?php echo htmlSelect('scale', $scales, $scale, array('data-on-change'=>'changeScale','id'=>'scale')); ?>
|
||||||
|
</div>
|
||||||
<input type="hidden" name="base_width" id="base_width" value="<?php echo $Event->Width(); ?>"/>
|
<input type="hidden" name="base_width" id="base_width" value="<?php echo $Event->Width(); ?>"/>
|
||||||
<input type="hidden" name="base_height" id="base_height" value="<?php echo $Event->Height(); ?>"/>
|
<input type="hidden" name="base_height" id="base_height" value="<?php echo $Event->Height(); ?>"/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="content" class="d-flex flex-row justify-content-center">
|
<div id="content" class="d-flex flex-row justify-content-center">
|
||||||
|
<table id="frameStatsTable" class="table-sm table-borderless pr-3">
|
||||||
|
<!-- FRAME STATISTICS POPULATED BY AJAX -->
|
||||||
<table id="frameStatsTable" class="table-sm table-borderless pr-3">
|
</table>
|
||||||
<!-- FRAME STATISTICS POPULATED BY AJAX -->
|
<div>
|
||||||
</table>
|
<p id="image">
|
||||||
|
<?php
|
||||||
<div>
|
if ( $imageData['hasAnalImage'] ) {
|
||||||
<p id="image">
|
echo sprintf('<a href="?view=frame&eid=%d&fid=%d&scale=%d&show=%s">', $Event->Id(), $Frame->FrameId(), $scale, ( $show=='anal'?'capt':'anal' ) );
|
||||||
<?php if ( $imageData['hasAnalImage'] ) {
|
}
|
||||||
echo sprintf('<a href="?view=frame&eid=%d&fid=%d&scale=%d&show=%s">', $Event->Id(), $Frame->FrameId(), $scale, ( $show=='anal'?'capt':'anal' ) );
|
?>
|
||||||
} ?>
|
|
||||||
<img id="frameImg"
|
<img id="frameImg"
|
||||||
src="<?php echo validHtmlStr($Frame->getImageSrc($show=='anal'?'analyse':'capture')) ?>"
|
src="<?php echo validHtmlStr($Frame->getImageSrc($show=='anal'?'analyse':'capture')) ?>"
|
||||||
width="<?php echo reScale($Event->Width(), $Monitor->DefaultScale(), $scale) ?>"
|
width="<?php echo reScale($Event->Width(), $Monitor->DefaultScale(), $scale) ?>"
|
||||||
height="<?php echo reScale( $Event->Height(), $Monitor->DefaultScale(), $scale ) ?>"
|
height="<?php echo reScale($Event->Height(), $Monitor->DefaultScale(), $scale) ?>"
|
||||||
alt="<?php echo $Frame->EventId().'-'.$Frame->FrameId() ?>"
|
alt="<?php echo $Frame->EventId().'-'.$Frame->FrameId() ?>"
|
||||||
class="<?php echo $imageData['imageClass'] ?>"
|
class="<?php echo $imageData['imageClass'] ?>"
|
||||||
/>
|
/>
|
||||||
<?php if ( $imageData['hasAnalImage'] ) { ?></a><?php } ?>
|
<?php
|
||||||
|
if ($imageData['hasAnalImage']) { ?></a><?php } ?>
|
||||||
</p>
|
</p>
|
||||||
<?php
|
<?php
|
||||||
$frame_url_base = '?view=frame&eid='.$Event->Id().'&scale='.$scale.'&show='.$show.'&fid=';
|
$frame_url_base = '?view=frame&eid='.$Event->Id().'&scale='.$scale.'&show='.$show.'&fid=';
|
||||||
?>
|
?>
|
||||||
<p id="controls">
|
<p id="controls">
|
||||||
<a id="firstLink" <?php echo (( $Frame->FrameId() > 1 ) ? 'href="'.$frame_url_base.$firstFid.'" class="btn-primary"' : 'class="btn-primary disabled"') ?>><?php echo translate('First') ?></a>
|
<a id="firstLink" <?php echo (( $Frame->FrameId() > 1 ) ? 'href="'.$frame_url_base.$firstFid.'" class="btn-primary"' : 'class="btn-primary disabled"') ?>><?php echo translate('First') ?></a>
|
||||||
<a id="prevLink" <?php echo ( $Frame->FrameId() > 1 ) ? 'href="'.$frame_url_base.$prevFid.'" class="btn-primary"' : 'class="btn-primary disabled"' ?>><?php echo translate('Prev') ?></a>
|
<a id="prevLink" <?php echo ( $Frame->FrameId() > 1 ) ? 'href="'.$frame_url_base.$prevFid.'" class="btn-primary"' : 'class="btn-primary disabled"' ?>><?php echo translate('Prev') ?></a>
|
||||||
<a id="nextLink" <?php echo ( $Frame->FrameId() < $maxFid ) ? 'href="'.$frame_url_base.$nextFid.'" class="btn-primary"' : 'class="btn-primary disabled"' ?>><?php echo translate('Next') ?></a>
|
<a id="nextLink" <?php echo ( $Frame->FrameId() < $maxFid ) ? 'href="'.$frame_url_base.$nextFid.'" class="btn-primary"' : 'class="btn-primary disabled"' ?>><?php echo translate('Next') ?></a>
|
||||||
<a id="lastLink" <?php echo ( $Frame->FrameId() < $maxFid ) ? 'href="'.$frame_url_base.$lastFid .'" class="btn-primary"' : 'class="btn-primary disabled"' ?>><?php echo translate('Last') ?></a>
|
<a id="lastLink" <?php echo ( $Frame->FrameId() < $maxFid ) ? 'href="'.$frame_url_base.$lastFid .'" class="btn-primary"' : 'class="btn-primary disabled"' ?>><?php echo translate('Last') ?></a>
|
||||||
</p>
|
</p>
|
||||||
<?php
|
<?php
|
||||||
if ( file_exists($dImagePath) ) {
|
if (file_exists($dImagePath)) {
|
||||||
?>
|
?>
|
||||||
<p id="diagImagePath"><?php echo $dImagePath ?></p>
|
<p id="diagImagePath"><?php echo $dImagePath ?></p>
|
||||||
<p id="diagImage">
|
<p id="diagImage">
|
||||||
<img
|
<img
|
||||||
src="<?php echo viewImagePath($dImagePath) ?>"
|
src="<?php echo viewImagePath($dImagePath) ?>"
|
||||||
width="<?php echo reScale($Event->Width(), $Monitor->DefaultScale(), $scale) ?>"
|
width="<?php echo reScale($Event->Width(), $Monitor->DefaultScale(), $scale) ?>"
|
||||||
height="<?php echo reScale($Event->Height(), $Monitor->DefaultScale(), $scale) ?>"
|
height="<?php echo reScale($Event->Height(), $Monitor->DefaultScale(), $scale) ?>"
|
||||||
class="<?php echo $imageData['imageClass'] ?>"
|
class="<?php echo $imageData['imageClass'] ?>"
|
||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
if ( file_exists($rImagePath) ) {
|
if (file_exists($rImagePath)) {
|
||||||
?>
|
?>
|
||||||
<p id="refImagePath"><?php echo $rImagePath ?></p>
|
<p id="refImagePath"><?php echo $rImagePath ?></p>
|
||||||
<p id="refImage">
|
<p id="refImage">
|
||||||
<img
|
<img
|
||||||
src="<?php echo viewImagePath($rImagePath) ?>"
|
src="<?php echo viewImagePath($rImagePath) ?>"
|
||||||
width="<?php echo reScale($Event->Width(), $Monitor->DefaultScale(), $scale) ?>"
|
width="<?php echo reScale($Event->Width(), $Monitor->DefaultScale(), $scale) ?>"
|
||||||
height="<?php echo reScale($Event->Height(), $Monitor->DefaultScale(), $scale) ?>"
|
height="<?php echo reScale($Event->Height(), $Monitor->DefaultScale(), $scale) ?>"
|
||||||
class="<?php echo $imageData['imageClass'] ?>"
|
class="<?php echo $imageData['imageClass'] ?>"
|
||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -167,7 +167,6 @@ function submitToExport(element) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitAction(button) {
|
function submitAction(button) {
|
||||||
console.log(button.value);
|
|
||||||
var form = button.form;
|
var form = button.form;
|
||||||
form.elements['action'].value = button.value;
|
form.elements['action'].value = button.value;
|
||||||
form.submit();
|
form.submit();
|
||||||
|
@ -175,7 +174,6 @@ function submitAction(button) {
|
||||||
|
|
||||||
function deleteFilter(element) {
|
function deleteFilter(element) {
|
||||||
var form = element.form;
|
var form = element.form;
|
||||||
console.log(form);
|
|
||||||
if (confirm(deleteSavedFilterString+" '"+form.elements['filter[Name]'].value+"'?")) {
|
if (confirm(deleteSavedFilterString+" '"+form.elements['filter[Name]'].value+"'?")) {
|
||||||
form.elements['action'].value = 'delete';
|
form.elements['action'].value = 'delete';
|
||||||
form.submit();
|
form.submit();
|
||||||
|
@ -384,7 +382,6 @@ function debugFilter() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function manageModalBtns(id) {
|
function manageModalBtns(id) {
|
||||||
console.log(id);
|
|
||||||
// Manage the CANCEL modal button
|
// Manage the CANCEL modal button
|
||||||
var cancelBtn = document.getElementById(id+"CancelBtn");
|
var cancelBtn = document.getElementById(id+"CancelBtn");
|
||||||
if ( cancelBtn ) {
|
if ( cancelBtn ) {
|
||||||
|
|
|
@ -12,10 +12,10 @@ function changeScale() {
|
||||||
last: $j('#lastLink')
|
last: $j('#lastLink')
|
||||||
};
|
};
|
||||||
|
|
||||||
if ( img ) {
|
if (img) {
|
||||||
var baseWidth = $j('#base_width').val();
|
var baseWidth = $j('#base_width').val();
|
||||||
var baseHeight = $j('#base_height').val();
|
var baseHeight = $j('#base_height').val();
|
||||||
if ( ! parseInt(scale) ) {
|
if (!parseInt(scale)) {
|
||||||
var newSize = scaleToFit(baseWidth, baseHeight, img, $j('#controls'));
|
var newSize = scaleToFit(baseWidth, baseHeight, img, $j('#controls'));
|
||||||
newWidth = newSize.width;
|
newWidth = newSize.width;
|
||||||
newHeight = newSize.height;
|
newHeight = newSize.height;
|
||||||
|
@ -30,7 +30,7 @@ function changeScale() {
|
||||||
}
|
}
|
||||||
setCookie('zmWatchScale', scale, 3600);
|
setCookie('zmWatchScale', scale, 3600);
|
||||||
$j.each(controlsLinks, function(k, anchor) { //Make frames respect scale choices
|
$j.each(controlsLinks, function(k, anchor) { //Make frames respect scale choices
|
||||||
if ( anchor ) {
|
if (anchor) {
|
||||||
anchor.prop('href', anchor.prop('href').replace(/scale=.*&/, 'scale=' + scale + '&'));
|
anchor.prop('href', anchor.prop('href').replace(/scale=.*&/, 'scale=' + scale + '&'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -39,11 +39,11 @@ function changeScale() {
|
||||||
onStatsResize(newWidth);
|
onStatsResize(newWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFrmStatsCookie() {
|
function getFrameStatsCookie() {
|
||||||
var cookie = 'zmFrameStats';
|
var cookie = 'zmFrameStats';
|
||||||
var stats = getCookie(cookie);
|
var stats = getCookie(cookie);
|
||||||
|
|
||||||
if ( !stats ) {
|
if (!stats) {
|
||||||
stats = 'on';
|
stats = 'on';
|
||||||
setCookie(cookie, stats, 10*365);
|
setCookie(cookie, stats, 10*365);
|
||||||
}
|
}
|
||||||
|
@ -53,29 +53,33 @@ function getFrmStatsCookie() {
|
||||||
function getStat(params) {
|
function getStat(params) {
|
||||||
$j.getJSON(thisUrl + '?view=request&request=stats&raw=true', params)
|
$j.getJSON(thisUrl + '?view=request&request=stats&raw=true', params)
|
||||||
.done(function(data) {
|
.done(function(data) {
|
||||||
var stat = data.raw;
|
var stats = data.raw;
|
||||||
|
|
||||||
|
|
||||||
$j('#frameStatsTable').empty().append('<tbody>');
|
$j('#frameStatsTable').empty().append('<tbody>');
|
||||||
$j.each( statHeaderStrings, function( key ) {
|
for (const stat of stats) {
|
||||||
var th = $j('<th>').addClass('text-right').text(statHeaderStrings[key]);
|
$j.each(statHeaderStrings, function(key) {
|
||||||
var tdString;
|
var th = $j('<th>').addClass('text-right').text(statHeaderStrings[key]);
|
||||||
|
var tdString;
|
||||||
|
|
||||||
switch (stat ? key : 'n/a') {
|
switch (stat ? key : 'n/a') {
|
||||||
case 'FrameId':
|
case 'FrameId':
|
||||||
tdString = '<a href="?view=stats&eid=' + params.eid + '&fid=' + params.fid + '">' + stat[key] + '</a>';
|
case 'EventId':
|
||||||
break;
|
//tdString = '<a href="?view=stats&eid=' + params.eid + '&fid=' + params.fid + '">' + stat[key] + '</a>';
|
||||||
case 'n/a':
|
break;
|
||||||
tdString = 'n/a';
|
case 'n/a':
|
||||||
break;
|
tdString = 'n/a';
|
||||||
default:
|
break;
|
||||||
tdString = stat[key];
|
default:
|
||||||
}
|
tdString = stat[key];
|
||||||
|
}
|
||||||
|
|
||||||
var td = $j('<td>').html(tdString);
|
var td = $j('<td>').html(tdString);
|
||||||
var row = $j('<tr>').append(th, td);
|
var row = $j('<tr>').append(th, td);
|
||||||
|
|
||||||
$j('#frameStatsTable tbody').append(row);
|
$j('#frameStatsTable tbody').append(row);
|
||||||
});
|
});
|
||||||
|
} // end foreach stat
|
||||||
})
|
})
|
||||||
.fail(logAjaxFail);
|
.fail(logAjaxFail);
|
||||||
}
|
}
|
||||||
|
@ -85,16 +89,16 @@ function onStatsResize(vidwidth) {
|
||||||
var width = $j(window).width() - vidwidth;
|
var width = $j(window).width() - vidwidth;
|
||||||
|
|
||||||
// Hide the stats table if we have run out of room to show it properly
|
// Hide the stats table if we have run out of room to show it properly
|
||||||
if ( width < minWidth ) {
|
if (width < minWidth) {
|
||||||
statsBtn.prop('disabled', true);
|
statsBtn.prop('disabled', true);
|
||||||
if ( table.is(':visible') ) {
|
if (table.is(':visible')) {
|
||||||
table.toggle(false);
|
table.toggle(false);
|
||||||
wasHidden = true;
|
wasHidden = true;
|
||||||
}
|
}
|
||||||
// Show the stats table if we hid it previously and sufficient room becomes available
|
// Show the stats table if we hid it previously and sufficient room becomes available
|
||||||
} else if ( width >= minWidth ) {
|
} else if (width >= minWidth) {
|
||||||
statsBtn.prop('disabled', false);
|
statsBtn.prop('disabled', false);
|
||||||
if ( !table.is(':visible') && wasHidden ) {
|
if (!table.is(':visible') && wasHidden) {
|
||||||
table.toggle(true);
|
table.toggle(true);
|
||||||
wasHidden = false;
|
wasHidden = false;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +106,7 @@ function onStatsResize(vidwidth) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function initPage() {
|
function initPage() {
|
||||||
if ( scale == '0' || scale == 'auto' ) changeScale();
|
if (scale == '0' || scale == 'auto') changeScale();
|
||||||
|
|
||||||
// Don't enable the back button if there is no previous zm page to go back to
|
// Don't enable the back button if there is no previous zm page to go back to
|
||||||
backBtn.prop('disabled', !document.referrer.length);
|
backBtn.prop('disabled', !document.referrer.length);
|
||||||
|
@ -125,7 +129,7 @@ function initPage() {
|
||||||
var cookie = 'zmFrameStats';
|
var cookie = 'zmFrameStats';
|
||||||
|
|
||||||
// Toggle the visiblity of the stats table and write an appropriate cookie
|
// Toggle the visiblity of the stats table and write an appropriate cookie
|
||||||
if ( table.is(':visible') ) {
|
if (table.is(':visible')) {
|
||||||
setCookie(cookie, 'off', 10*365);
|
setCookie(cookie, 'off', 10*365);
|
||||||
table.toggle(false);
|
table.toggle(false);
|
||||||
} else {
|
} else {
|
||||||
|
@ -143,7 +147,7 @@ function initPage() {
|
||||||
// Load the frame stats
|
// Load the frame stats
|
||||||
getStat({eid: eid, fid: fid});
|
getStat({eid: eid, fid: fid});
|
||||||
|
|
||||||
if ( getFrmStatsCookie() != 'on' ) {
|
if (getFrameStatsCookie() != 'on') {
|
||||||
table.toggle(false);
|
table.toggle(false);
|
||||||
} else {
|
} else {
|
||||||
onStatsResize($j('#base_width').val() * scale / SCALE_BASE);
|
onStatsResize($j('#base_width').val() * scale / SCALE_BASE);
|
||||||
|
|
Loading…
Reference in New Issue