Merge branch 'master' into storageareas

This commit is contained in:
Isaac Connor 2017-12-11 11:39:42 -05:00
commit dd69bc3d7b
5 changed files with 50 additions and 26 deletions

View File

@ -700,6 +700,7 @@ INSERT INTO `Controls` VALUES (NULL,'Netcat ONVIF','Ffmpeg','Netcat',0,0,1,1,0,0
INSERT INTO `Controls` VALUES (NULL,'Keekoon','Remote','Keekoon', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 6, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
INSERT INTO `Controls` VALUES (NULL,'HikVision','Local','',0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,20,1,1,1,1,0,0,0,1,1,0,0,0,0,1,1,100,0,0,1,0,0,0,0,1,1,100,1,0,0,0);
INSERT INTO `Controls` VALUES (NULL,'Maginon Supra IPC','cURL','MaginonIPC',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,4,0,1,1,1,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0);
INSERT INTO `Controls` VALUES (NULL,'Floureon 1080P','Ffmpeg','Floureon',0,0,0,1,0,0,0,1,1,18,1,1,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,20,0,1,1,1,0,0,0,1,1,0,0,0,0,1,1,8,0,0,1,0,0,0,0,1,1,8,0,0,0,0);
--
-- Add some monitor preset values

View File

@ -38,6 +38,10 @@ if [ "$1" = "configure" ]; then
zmupdate.pl --nointeractive
zmupdate.pl --nointeractive -f
# Add any new PTZ control configurations to the database (will not overwrite)
zmcamtool.pl --import >/dev/null 2>&1
else
echo 'NOTE: mysql not running, please start mysql and run dpkg-reconfigure zoneminder when it is running.'
fi

View File

@ -73,6 +73,9 @@ if [ "$dbc_install" = "true" ] && [ "$1" = "configure" ]; then
# Run the ZoneMinder update tool
zmupdate.pl --nointeractive
# Add any new PTZ control configurations to the database (will not overwrite)
zmcamtool.pl --import >/dev/null 2>&1
fi
#DEBHELPER#

View File

@ -40,6 +40,10 @@ if [ "$1" = "configure" ]; then
zmupdate.pl --nointeractive
zmupdate.pl --nointeractive -f
# Add any new PTZ control configurations to the database (will not overwrite)
zmcamtool.pl --import >/dev/null 2>&1
else
echo 'NOTE: mysql not running, please start mysql and run dpkg-reconfigure zoneminder when it is running.'
fi

View File

@ -84,11 +84,10 @@ class EventsController extends AppController {
$this->Paginator->settings = $settings;
$events = $this->Paginator->paginate('Event');
// For each event, get its thumbnail data (path, width, height)
// For each event, get the frameID which has the largest score
foreach ($events as $key => $value) {
//$thumbData = $this->createThumbnail($value['Event']['Id']);
$thumbData = "";
$events[$key]['thumbData'] = $thumbData;
$maxScoreFrameId = $this->getMaxScoreAlarmFrameId($value['Event']['Id']);
$events[$key]['Event']['MaxScoreFrameId'] = $maxScoreFrameId;
}
$this->set(compact('events'));
@ -115,12 +114,9 @@ class EventsController extends AppController {
$allowedMonitors=preg_split ('@,@', $this->Session->Read('allowedMonitors'),NULL, PREG_SPLIT_NO_EMPTY);
if (!empty($allowedMonitors))
{
if (!empty($allowedMonitors)) {
$mon_options = array('Event.MonitorId' => $allowedMonitors);
}
else
{
} else {
$mon_options='';
}
@ -157,8 +153,7 @@ class EventsController extends AppController {
*/
public function add() {
if ($this->Session->Read('eventPermission') != 'Edit')
{
if ($this->Session->Read('eventPermission') != 'Edit') {
throw new UnauthorizedException(__('Insufficient privileges'));
return;
}
@ -182,8 +177,7 @@ class EventsController extends AppController {
*/
public function edit($id = null) {
if ($this->Session->Read('eventPermission') != 'Edit')
{
if ($this->Session->Read('eventPermission') != 'Edit') {
throw new UnauthorizedException(__('Insufficient privileges'));
return;
}
@ -214,8 +208,7 @@ class EventsController extends AppController {
* @return void
*/
public function delete($id = null) {
if ($this->Session->Read('eventPermission') != 'Edit')
{
if ($this->Session->Read('eventPermission') != 'Edit') {
throw new UnauthorizedException(__('Insufficient privileges'));
return;
}
@ -231,7 +224,7 @@ class EventsController extends AppController {
} else {
return $this->flash(__('The event could not be deleted. Please, try again.'), array('action' => 'index'));
}
}
} // end public function delete
public function search() {
$this->Event->recursive = -1;
@ -255,9 +248,7 @@ class EventsController extends AppController {
'results' => $results,
'_serialize' => array('results')
));
}
} // end public function search
// format expected:
// you can changed AlarmFrames to any other named params
@ -321,7 +312,7 @@ class EventsController extends AppController {
'ZM_WEB_LIST_THUMB_HEIGHT',
'ZM_EVENT_IMAGE_DIGITS',
'ZM_DIR_IMAGES',
"$thumbs",
$thumbs,
'ZM_DIR_EVENTS'
)
)),
@ -335,13 +326,11 @@ class EventsController extends AppController {
$thumbWidth = $config['ZM_WEB_LIST_THUMB_WIDTH'];
$scale = (100 * $thumbWidth) / $event['Event']['Width'];
$thumbHeight = $this->Scaler->reScale( $event['Event']['Height'], $scale );
}
elseif ( $config['ZM_WEB_LIST_THUMB_HEIGHT'] ) {
} elseif ( $config['ZM_WEB_LIST_THUMB_HEIGHT'] ) {
$thumbHeight = $config['ZM_WEB_LIST_THUMB_HEIGHT'];
$scale = (100*$thumbHeight)/$event['Event']['Height'];
$thumbWidth = $this->Scaler->reScale( $event['Event']['Width'], $scale );
}
else {
} else {
throw new NotFoundException(__('No thumbnail width or height specified, please check in Options->Web'));
}
@ -351,7 +340,6 @@ class EventsController extends AppController {
$thumbData['Height'] = (int)$thumbHeight;
return( $thumbData );
}
public function archive($id = null) {
@ -378,4 +366,28 @@ class EventsController extends AppController {
));
}
}
public function getMaxScoreAlarmFrameId($id = null) {
$this->Event->recursive = -1;
if (!$this->Event->exists($id)) {
throw new NotFoundException(__('Invalid event'));
}
$event = $this->Event->find('first', array(
'conditions' => array('Id' => $id)
));
// Find the max Frame for this Event. Error out otherwise.
$this->loadModel('Frame');
if (! $frame = $this->Frame->find('first', array(
'conditions' => array(
'EventId' => $event['Event']['Id'],
'Score' => $event['Event']['MaxScore']
)
))) {
throw new NotFoundException(__("Can not find Frame for Event " . $event['Event']['Id']));
}
return $frame['Frame']['Id'];
}
} // end class EventsController