Merge branch 'master' into add_manufacturer_model_to_monitors

This commit is contained in:
Isaac Connor 2021-11-15 09:47:34 -05:00
commit 71c29afa7b
5 changed files with 42 additions and 22 deletions

View File

@ -141,7 +141,6 @@ Event::Event(
if (monitor->ServerId()) if (monitor->ServerId())
sql += stringtf(" AND ServerId=%u", monitor->ServerId()); sql += stringtf(" AND ServerId=%u", monitor->ServerId());
Debug(1, "%s", sql.c_str());
storage = nullptr; storage = nullptr;
MYSQL_RES *result = zmDbFetch(sql); MYSQL_RES *result = zmDbFetch(sql);
@ -218,6 +217,8 @@ Event::Event(
Debug(1, "Video file is %s", video_file.c_str()); Debug(1, "Video file is %s", video_file.c_str());
} }
} // end if GetOptVideoWriter } // end if GetOptVideoWriter
if (storage != monitor->getStorage())
delete storage;
} }
Event::~Event() { Event::~Event() {

View File

@ -47,7 +47,7 @@ void Logger::usrHandler(int sig) {
logger->level(logger->level()+1); logger->level(logger->level()+1);
else if (sig == SIGUSR2) else if (sig == SIGUSR2)
logger->level(logger->level()-1); logger->level(logger->level()-1);
Info("Logger - Level changed to %d", logger->level()); Info("Logger - Level changed to %d %s", logger->level(), smCodes[logger->level()].c_str());
} }
Logger::Logger() : Logger::Logger() :

View File

@ -650,6 +650,23 @@ class Event extends ZM_Object {
} }
return false; return false;
} }
function canEdit($u=null) {
global $user;
if (!$u) $u=$user;
if (!$u) {
# auth turned on and not logged in
return false;
}
if (!empty($u['MonitorIds']) ) {
if (!in_array($this->{'MonitorId'}, explode(',', $u['MonitorIds']))) {
return false;
}
}
if ($u['Events'] != 'Edit') {
return false;
}
return true;
}
} # end class } # end class
?> ?>

View File

@ -150,6 +150,7 @@ if ( $Event->Id() and !file_exists($Event->Path()) )
<button id="editBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Edit') ?>" disabled><i class="fa fa-pencil"></i></button> <button id="editBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Edit') ?>" disabled><i class="fa fa-pencil"></i></button>
<button id="exportBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Export') ?>"><i class="fa fa-external-link"></i></button> <button id="exportBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Export') ?>"><i class="fa fa-external-link"></i></button>
<a id="downloadBtn" class="btn btn-normal" href="<?php echo $Event->getStreamSrc(array('mode'=>'mp4'),'&amp;')?>" <a id="downloadBtn" class="btn btn-normal" href="<?php echo $Event->getStreamSrc(array('mode'=>'mp4'),'&amp;')?>"
title="<?php echo translate('Download'). ' ' . $Event->DefaultVideo() ?>"
download download
<?php echo $Event->DefaultVideo() ? '' : 'style="display:none;"' ?> <?php echo $Event->DefaultVideo() ? '' : 'style="display:none;"' ?>
><i class="fa fa-download"></i></a> ><i class="fa fa-download"></i></a>

View File

@ -657,6 +657,7 @@ function getFrameResponse(respObj, respText) {
function frameQuery(eventId, frameId, loadImage) { function frameQuery(eventId, frameId, loadImage) {
var data = {}; var data = {};
if (auth_hash) data.auth = auth_hash;
data.loopback = loadImage; data.loopback = loadImage;
data.id = {eventId, frameId}; data.id = {eventId, frameId};