From 638a05b2079a5787858f67ee7fb686cab0dc7901 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 29 Oct 2020 09:39:48 -0400 Subject: [PATCH 1/2] Fix totalrows in pagination. Still figuring this out. --- web/ajax/events.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/web/ajax/events.php b/web/ajax/events.php index 850628109..d5eb80d24 100644 --- a/web/ajax/events.php +++ b/web/ajax/events.php @@ -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'] = '' .validHtmlStr('Event ' .$event->Id()). ''; @@ -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; } ?> From 97f4d9e7a2edbbb54602c8da5ab3e2ea45535137 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 29 Oct 2020 09:40:14 -0400 Subject: [PATCH 2/2] Make the event count and diskspace in the storage row be a link to events for that storage area. --- web/skins/classic/views/options.php | 31 +++++++++++++++++------------ 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/web/skins/classic/views/options.php b/web/skins/classic/views/options.php index cc8b0b568..a52aca15d 100644 --- a/web/skins/classic/views/options.php +++ b/web/skins/classic/views/options.php @@ -279,17 +279,23 @@ foreach ( array_map('basename', glob('skins/'.$skin.'/css/*', GLOB_ONLYDIR)) as '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().'"'; ?> - Id()), $canEdit, $str_opt ) ?> - Name()), $canEdit, $str_opt ) ?> - Path()), $canEdit, $str_opt ) ?> - Type()), $canEdit, $str_opt ) ?> - Scheme()), $canEdit, $str_opt ) ?> - Server()->Name()), $canEdit, $str_opt ) ?> + Id()), $canEdit, $str_opt) ?> + Name()), $canEdit, $str_opt) ?> + Path()), $canEdit, $str_opt) ?> + Type()), $canEdit, $str_opt) ?> + Scheme()), $canEdit, $str_opt) ?> + Server()->Name()), $canEdit, $str_opt) ?> disk_used_space()) . ' of ' . human_filesize($Storage->disk_total_space()) ?> - EventCount().' using '.human_filesize($Storage->event_disk_space()) ?> + querystring(), $Storage->EventCount().' using '.human_filesize($Storage->event_disk_space()) ); ?> EventCount() or !$canEdit ) { ?> disabled="disabled"EventCount() ? ' title="Can\'t delete as long as there are events stored here."' : ''?>/> @@ -302,13 +308,12 @@ foreach ( array_map('basename', glob('skins/'.$skin.'/css/*', GLOB_ONLYDIR)) as APIs are disabled. To enable, please turn on OPT_USE_API in Options->System"; - } - else { + $apiEnabled = dbFetchOne('SELECT Value FROM Config WHERE Name=\'ZM_OPT_USE_API\''); + if ( $apiEnabled['Value'] != '1' ) { + echo '
APIs are disabled. To enable, please turn on OPT_USE_API in Options->System
'; + } else { ?>