Merge branch 'master' of github.com:ZoneMinder/zoneminder
This commit is contained in:
commit
cdab6701c2
|
@ -129,15 +129,6 @@ function queryRequest($filter, $search, $advsearch, $sort, $offset, $order, $lim
|
||||||
ZM\Fatal('Invalid sort field: ' . $sort);
|
ZM\Fatal('Invalid sort field: ' . $sort);
|
||||||
}
|
}
|
||||||
|
|
||||||
$col_str = '';
|
|
||||||
foreach ( $columns as $key => $col ) {
|
|
||||||
if ( $col == 'Name' ) {
|
|
||||||
$columns[$key] = 'M.'.$col;
|
|
||||||
} else {
|
|
||||||
$columns[$key] = 'E.'.$col;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$col_str = implode(', ', $columns);
|
|
||||||
$data = array();
|
$data = array();
|
||||||
$query = array();
|
$query = array();
|
||||||
$query['values'] = array();
|
$query['values'] = array();
|
||||||
|
@ -173,8 +164,10 @@ function queryRequest($filter, $search, $advsearch, $sort, $offset, $order, $lim
|
||||||
if ( $where )
|
if ( $where )
|
||||||
$where = ' WHERE '.$where;
|
$where = ' WHERE '.$where;
|
||||||
|
|
||||||
$col_str = 'E.*';
|
$sort = $sort == "Monitor" ? 'M.Name' : 'E.'.$sort;
|
||||||
$query['sql'] = 'SELECT ' .$col_str. ' FROM `' .$table. '` AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id'.$where.' ORDER BY LENGTH(' .$sort. '), ' .$sort. ' ' .$order. ' LIMIT ?, ?';
|
$col_str = 'E.*, M.Name AS Monitor';
|
||||||
|
//$query['sql'] = 'SELECT ' .$col_str. ' FROM `' .$table. '` AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id'.$where.' ORDER BY LENGTH(' .$sort. '), ' .$sort. ' ' .$order. ' LIMIT ?, ?';
|
||||||
|
$query['sql'] = 'SELECT ' .$col_str. ' FROM `' .$table. '` AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id'.$where.' ORDER BY ' .$sort. ' ' .$order. ' LIMIT ?, ?';
|
||||||
array_push($query['values'], $offset, $limit);
|
array_push($query['values'], $offset, $limit);
|
||||||
|
|
||||||
ZM\Warning('Calling the following sql query: ' .$query['sql']);
|
ZM\Warning('Calling the following sql query: ' .$query['sql']);
|
||||||
|
@ -192,12 +185,6 @@ function queryRequest($filter, $search, $advsearch, $sort, $offset, $order, $lim
|
||||||
$StorageById[$S->Id()] = $S;
|
$StorageById[$S->Id()] = $S;
|
||||||
}
|
}
|
||||||
|
|
||||||
$monitor_names = ZM\Monitor::find();
|
|
||||||
$MonitorById = array();
|
|
||||||
foreach ( $monitor_names as $S ) {
|
|
||||||
$MonitorById[$S->Id()] = $S;
|
|
||||||
}
|
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
foreach ( dbFetchAll($query['sql'], NULL, $query['values']) as $row ) {
|
foreach ( dbFetchAll($query['sql'], NULL, $query['values']) as $row ) {
|
||||||
ZM\Debug("row".print_r($row,true));
|
ZM\Debug("row".print_r($row,true));
|
||||||
|
@ -212,14 +199,13 @@ function queryRequest($filter, $search, $advsearch, $sort, $offset, $order, $lim
|
||||||
$row['Name'] = validHtmlStr($row['Name']);
|
$row['Name'] = validHtmlStr($row['Name']);
|
||||||
$row['Archived'] = $row['Archived'] ? translate('Yes') : translate('No');
|
$row['Archived'] = $row['Archived'] ? translate('Yes') : translate('No');
|
||||||
$row['Emailed'] = $row['Emailed'] ? translate('Yes') : translate('No');
|
$row['Emailed'] = $row['Emailed'] ? translate('Yes') : translate('No');
|
||||||
//$row['Monitor'] = ( $row['MonitorId'] and isset($MonitorById[$row['MonitorId']]) ) ? $MonitorById[$row['MonitorId']]->Name() : '';
|
|
||||||
$row['Cause'] = validHtmlStr($row['Cause']);
|
$row['Cause'] = validHtmlStr($row['Cause']);
|
||||||
$row['StartTime'] = strftime(STRF_FMT_DATETIME_SHORTER, strtotime($row['StartTime']));
|
$row['StartTime'] = strftime(STRF_FMT_DATETIME_SHORTER, strtotime($row['StartTime']));
|
||||||
$row['EndTime'] = strftime(STRF_FMT_DATETIME_SHORTER, strtotime($row['StartTime']));
|
$row['EndTime'] = strftime(STRF_FMT_DATETIME_SHORTER, strtotime($row['StartTime']));
|
||||||
$row['Length'] = gmdate('H:i:s', $row['Length'] );
|
$row['Length'] = gmdate('H:i:s', $row['Length'] );
|
||||||
$row['Storage'] = ( $row['StorageId'] and isset($StorageById[$row['StorageId']]) ) ? $StorageById[$row['StorageId']]->Name() : 'Default';
|
$row['Storage'] = ( $row['StorageId'] and isset($StorageById[$row['StorageId']]) ) ? $StorageById[$row['StorageId']]->Name() : 'Default';
|
||||||
$row['Notes'] = htmlspecialchars($row['Notes']);
|
$row['Notes'] = htmlspecialchars($row['Notes']);
|
||||||
$row['DiskSpace'] = human_filesize($row['DiskSpace']);
|
$row['DiskSpace'] = human_filesize($event->DiskSpace());
|
||||||
$rows[] = $row;
|
$rows[] = $row;
|
||||||
}
|
}
|
||||||
$data['rows'] = $rows;
|
$data['rows'] = $rows;
|
||||||
|
|
|
@ -147,7 +147,7 @@ class Session {
|
||||||
$now = time();
|
$now = time();
|
||||||
$old = $now - $max;
|
$old = $now - $max;
|
||||||
ZM\Debug('doing session gc ' . $now . '-' . $max. '='.$old);
|
ZM\Debug('doing session gc ' . $now . '-' . $max. '='.$old);
|
||||||
$sth = $this->db->prepare('DELETE * FROM Sessions WHERE access < :old');
|
$sth = $this->db->prepare('DELETE FROM Sessions WHERE access < :old');
|
||||||
$sth->bindParam(':old', $old, PDO::PARAM_INT);
|
$sth->bindParam(':old', $old, PDO::PARAM_INT);
|
||||||
return $sth->execute() ? true : false;
|
return $sth->execute() ? true : false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,10 @@ var params =
|
||||||
|
|
||||||
// Called by bootstrap-table to retrieve zm event data
|
// Called by bootstrap-table to retrieve zm event data
|
||||||
function ajaxRequest(params) {
|
function ajaxRequest(params) {
|
||||||
console.log(params);
|
if ( params.data && params.data.filter ) {
|
||||||
|
params.data.advsearch = params.data.filter;
|
||||||
|
delete params.data.filter;
|
||||||
|
}
|
||||||
$j.getJSON(thisUrl + '?view=request&request=events&task=query'+filterQuery, params.data)
|
$j.getJSON(thisUrl + '?view=request&request=events&task=query'+filterQuery, params.data)
|
||||||
.done(function(data) {
|
.done(function(data) {
|
||||||
var rows = processRows(data.rows);
|
var rows = processRows(data.rows);
|
||||||
|
@ -55,7 +58,7 @@ function processRows(rows) {
|
||||||
row.Id = '<a href="?view=event&eid=' + eid + filterQuery + sortQuery + '&page=1">' + eid + '</a>';
|
row.Id = '<a href="?view=event&eid=' + eid + filterQuery + sortQuery + '&page=1">' + eid + '</a>';
|
||||||
row.Name = '<a href="?view=event&eid=' + eid + filterQuery + sortQuery + '&page=1">' + row.Name + '</a>'
|
row.Name = '<a href="?view=event&eid=' + eid + filterQuery + sortQuery + '&page=1">' + row.Name + '</a>'
|
||||||
+ '<br/><div class="small text-nowrap text-muted">' + archived + emailed + '</div>';
|
+ '<br/><div class="small text-nowrap text-muted">' + archived + emailed + '</div>';
|
||||||
if ( canEditMonitors ) row.Name = '<a href="?view=monitor&mid=' + mid + '">' + row.Name + '</a>';
|
if ( canEditMonitors ) row.Monitor = '<a href="?view=monitor&mid=' + mid + '">' + row.Monitor + '</a>';
|
||||||
if ( canEditEvents ) row.Cause = '<a href="#" title="' + row.Notes + '" class="eDetailLink" data-eid="' + eid + '">' + row.Cause + '</a>';
|
if ( canEditEvents ) row.Cause = '<a href="#" title="' + row.Notes + '" class="eDetailLink" data-eid="' + eid + '">' + row.Cause + '</a>';
|
||||||
if ( row.Notes.indexOf('detected:') >= 0 ) {
|
if ( row.Notes.indexOf('detected:') >= 0 ) {
|
||||||
row.Cause = row.Cause + '<a href="#?view=image&eid=' + eid + '&fid=objdetect"><div class="small text-nowrap text-muted"><u>' + row.Notes + '</u></div></a>';
|
row.Cause = row.Cause + '<a href="#?view=image&eid=' + eid + '&fid=objdetect"><div class="small text-nowrap text-muted"><u>' + row.Notes + '</u></div></a>';
|
||||||
|
|
|
@ -102,7 +102,7 @@ getBodyTopHTML();
|
||||||
<th data-sortable="true" data-field="Name"><?php echo translate('Name') ?></th>
|
<th data-sortable="true" data-field="Name"><?php echo translate('Name') ?></th>
|
||||||
<th data-sortable="true" data-field="Archived"><?php echo translate('Archived') ?></th>
|
<th data-sortable="true" data-field="Archived"><?php echo translate('Archived') ?></th>
|
||||||
<th data-sortable="true" data-field="Emailed"><?php echo translate('Emailed') ?></th>
|
<th data-sortable="true" data-field="Emailed"><?php echo translate('Emailed') ?></th>
|
||||||
<th data-sortable="true" data-field="Name"><?php echo translate('Monitor') ?></th>
|
<th data-sortable="true" data-field="Monitor"><?php echo translate('Monitor') ?></th>
|
||||||
<th data-sortable="true" data-field="Cause"><?php echo translate('Cause') ?></th>
|
<th data-sortable="true" data-field="Cause"><?php echo translate('Cause') ?></th>
|
||||||
<th data-sortable="true" data-field="StartTime"><?php echo translate('AttrStartTime') ?></th>
|
<th data-sortable="true" data-field="StartTime"><?php echo translate('AttrStartTime') ?></th>
|
||||||
<th data-sortable="true" data-field="EndTime"><?php echo translate('AttrEndTime') ?></th>
|
<th data-sortable="true" data-field="EndTime"><?php echo translate('AttrEndTime') ?></th>
|
||||||
|
|
Loading…
Reference in New Issue