Merge branch 'master' of github.com:/ZoneMinder/zoneminder

pull/3072/head
Isaac Connor 2020-10-29 09:40:49 -04:00
commit 75ec13871d
2 changed files with 22 additions and 19 deletions

View File

@ -155,11 +155,9 @@ function queryRequest($filter, $search, $advsearch, $sort, $offset, $order, $lim
foreach ( $advsearch as $col=>$text ) {
if ( in_array($col, $columns) ) {
//$text = '%' .$text. '%';
array_push($likes, 'E.'.$col.' LIKE ?');
array_push($query['values'], $text);
} else if ( in_array($col, $col_alt) ) {
//$text = '%' .$text. '%';
array_push($likes, 'M.'.$col.' LIKE ?');
array_push($query['values'], $text);
} else {
@ -198,7 +196,6 @@ function queryRequest($filter, $search, $advsearch, $sort, $offset, $order, $lim
$rows = array();
foreach ( dbFetchAll($query['sql'], NULL, $query['values']) as $row ) {
ZM\Debug("row".print_r($row,true));
$event = new ZM\Event($row);
if ( !$filter->test_post_sql_conditions($event) ) {
$event->remove_from_cache();
@ -207,7 +204,7 @@ function queryRequest($filter, $search, $advsearch, $sort, $offset, $order, $lim
$scale = intval(5*100*ZM_WEB_LIST_THUMB_WIDTH / $event->Width());
$imgSrc = $event->getThumbnailSrc(array(),'&');
$streamSrc = $event->getStreamSrc(array(
'mode'=>'jpeg', 'scale'=>$scale, 'maxfps'=>ZM_WEB_VIDEO_MAXFPS, 'replay'=>'single', 'rate'=>'400'), '&');
'mode'=>'jpeg', 'scale'=>$scale, 'maxfps'=>ZM_WEB_VIDEO_MAXFPS, 'replay'=>'single', 'rate'=>'400'), '&');
// Modify the row data as needed
$row['imgHtml'] = '<img id="thumbnail' .$event->Id(). '" src="' .$imgSrc. '" alt="' .validHtmlStr('Event ' .$event->Id()). '" style="width:' .validInt($event->ThumbnailWidth()). 'px;height:' .validInt($event->ThumbnailHeight()).'px;" stream_src="' .$streamSrc. '" still_src="' .$imgSrc. '"/>';
@ -225,8 +222,9 @@ function queryRequest($filter, $search, $advsearch, $sort, $offset, $order, $lim
}
$data['rows'] = $rows;
$data['totalNotFiltered'] = dbFetchOne('SELECT count(*) AS Total FROM ' .$table. ' AS E'. ($filter->sql() ? ' WHERE '.$filter->sql():''), 'Total');
$data['total'] = count($rows);
# total has to be the # of available rows. Not sure what totalNotFiltered is actually used for yet.
$data['totalNotFiltered'] = $data['total'] = dbFetchOne('SELECT count(*) AS Total FROM ' .$table. ' AS E'. ($filter->sql() ? ' WHERE '.$filter->sql():''), 'Total');
#$data['total'] = count($rows);
return $data;
}
?>

View File

@ -279,17 +279,23 @@ foreach ( array_map('basename', glob('skins/'.$skin.'/css/*', GLOB_ONLYDIR)) as
<tbody>
<?php
foreach( ZM\Storage::find( null, array('order'=>'lower(Name)') ) as $Storage ) {
$filter = new ZM\Filter();
$filter->addTerm(array('attr'=>'StorageId','op'=>'=','val'=>$Storage->Id()));
if ( $user['MonitorIds'] ) {
$filter = $filter->addTerm(array('cnj'=>'and', 'attr'=>'MonitorId', 'op'=>'IN', 'val'=>$user['MonitorIds']));
}
$str_opt = 'class="storageCol" data-sid="'.$Storage->Id().'"';
?>
<tr>
<td class="colId"><?php echo makeLink('#', validHtmlStr($Storage->Id()), $canEdit, $str_opt ) ?></td>
<td class="colName"><?php echo makeLink('#', validHtmlStr($Storage->Name()), $canEdit, $str_opt ) ?></td>
<td class="colPath"><?php echo makeLink('#', validHtmlStr($Storage->Path()), $canEdit, $str_opt ) ?></td>
<td class="colType"><?php echo makeLink('#', validHtmlStr($Storage->Type()), $canEdit, $str_opt ) ?></td>
<td class="colScheme"><?php echo makeLink('#', validHtmlStr($Storage->Scheme()), $canEdit, $str_opt ) ?></td>
<td class="colServer"><?php echo makeLink('#', validHtmlStr($Storage->Server()->Name()), $canEdit, $str_opt ) ?></td>
<td class="colId"><?php echo makeLink('#', validHtmlStr($Storage->Id()), $canEdit, $str_opt) ?></td>
<td class="colName"><?php echo makeLink('#', validHtmlStr($Storage->Name()), $canEdit, $str_opt) ?></td>
<td class="colPath"><?php echo makeLink('#', validHtmlStr($Storage->Path()), $canEdit, $str_opt) ?></td>
<td class="colType"><?php echo makeLink('#', validHtmlStr($Storage->Type()), $canEdit, $str_opt) ?></td>
<td class="colScheme"><?php echo makeLink('#', validHtmlStr($Storage->Scheme()), $canEdit, $str_opt) ?></td>
<td class="colServer"><?php echo makeLink('#', validHtmlStr($Storage->Server()->Name()), $canEdit, $str_opt) ?></td>
<td class="colDiskSpace"><?php echo human_filesize($Storage->disk_used_space()) . ' of ' . human_filesize($Storage->disk_total_space()) ?></td>
<td class="ColEvents"><?php echo $Storage->EventCount().' using '.human_filesize($Storage->event_disk_space()) ?></td>
<td class="ColEvents"><?php echo makeLink('?view=events'.$filter->querystring(), $Storage->EventCount().' using '.human_filesize($Storage->event_disk_space()) ); ?></td>
<td class="colMark"><input type="checkbox" name="markIds[]" value="<?php echo $Storage->Id() ?>" data-on-click-this="configureDeleteButton"<?php if ( $Storage->EventCount() or !$canEdit ) { ?> disabled="disabled"<?php } ?><?php echo $Storage->EventCount() ? ' title="Can\'t delete as long as there are events stored here."' : ''?>/></td>
</tr>
<?php } #end foreach Server ?>
@ -302,13 +308,12 @@ foreach ( array_map('basename', glob('skins/'.$skin.'/css/*', GLOB_ONLYDIR)) as
</form>
<?php
} else if ($tab == 'API') {
} else if ( $tab == 'API' ) {
$apiEnabled = dbFetchOne("SELECT Value FROM Config WHERE Name='ZM_OPT_USE_API'");
if ($apiEnabled['Value']!='1') {
echo "<div class='errorText'>APIs are disabled. To enable, please turn on OPT_USE_API in Options->System</div>";
}
else {
$apiEnabled = dbFetchOne('SELECT Value FROM Config WHERE Name=\'ZM_OPT_USE_API\'');
if ( $apiEnabled['Value'] != '1' ) {
echo '<div class="errorText">APIs are disabled. To enable, please turn on OPT_USE_API in Options->System</div>';
} else {
?>
<form name="userForm" method="post" action="?">