diff --git a/web/ajax/events.php b/web/ajax/events.php index 7b852c559..16c777ebf 100644 --- a/web/ajax/events.php +++ b/web/ajax/events.php @@ -16,10 +16,10 @@ if ( canEdit('Events') ) { switch ( $_REQUEST['action'] ) { case 'archive' : case 'unarchive' : - $archiveVal = ($_REQUEST['action'] == 'archive')?1:0; + $archiveVal = ($_REQUEST['action'] == 'archive') ? 1 : 0; dbQuery( 'UPDATE Events SET Archived = ? WHERE Id = ?', - array($archiveVal, $_REQUEST['id']) + array($archiveVal, $eid) ); break; case 'delete' : diff --git a/web/ajax/modal.php b/web/ajax/modal.php index 3b204495c..8f5cb8ac9 100644 --- a/web/ajax/modal.php +++ b/web/ajax/modal.php @@ -25,6 +25,16 @@ switch ( $modal ) { if ( empty($_REQUEST['ohndx']) ) ajaxError('Option Help Index Not Provided'); $data['html'] = getOptionHelpHTML($_REQUEST['ohndx'], $OLANG); break; + case 'enoperm' : + $data['html'] = getENoPermHTML(); + break; + case 'delconfirm' : + $data['html'] = getDelConfirmHTML(); + break; + case 'storage' : + if ( !isset($_REQUEST['id']) ) ajaxError('Storage Id Not Provided'); + $data['html'] = getStorageModalHTML($_REQUEST['id']); + break; default : // Maybe don't need both ZM\Warning('Unknown modal '.$modal); diff --git a/web/ajax/stats.php b/web/ajax/stats.php new file mode 100644 index 000000000..3789ff448 --- /dev/null +++ b/web/ajax/stats.php @@ -0,0 +1,24 @@ + diff --git a/web/includes/actions/storage.php b/web/includes/actions/storage.php index 49b5de3de..69ebfae0b 100644 --- a/web/includes/actions/storage.php +++ b/web/includes/actions/storage.php @@ -24,7 +24,7 @@ if ( !canEdit('System') ) { return; } -if ( $action == 'Save' ) { +if ( $action == 'save' ) { $storage = new ZM\Storage($_REQUEST['id']); $changes = $storage->changes($_REQUEST['newStorage']); @@ -33,7 +33,7 @@ if ( $action == 'Save' ) { $storage->save($changes); $refreshParent = true; } - $view = 'none'; + $redirect = '?view=options&tab=storage'; } else { ZM\Error("Unknown action $action in saving Storage"); } diff --git a/web/skins/classic/includes/functions.php b/web/skins/classic/includes/functions.php index c2fc0c93a..8facb1f80 100644 --- a/web/skins/classic/includes/functions.php +++ b/web/skins/classic/includes/functions.php @@ -790,6 +790,232 @@ function getOptionHelpHTML($optionHelpIndex, $OLANG) { return $result; } +// Return an Error No Permissions Modal +function getENoPermHTML() { + $result = ''; + + $result .= '
'.PHP_EOL; + + return $result; +} + +function getStatsTableHTML($eid, $fid, $row='') { + if ( !canView('Events') ) return; + $result = ''; + + $sql = 'SELECT S.*,E.*,Z.Name AS ZoneName,Z.Units,Z.Area,M.Name AS MonitorName FROM Stats AS S LEFT JOIN Events AS E ON S.EventId = E.Id LEFT JOIN Zones AS Z ON S.ZoneId = Z.Id LEFT JOIN Monitors AS M ON E.MonitorId = M.Id WHERE S.EventId = ? AND S.FrameId = ? ORDER BY S.ZoneId'; + $stats = dbFetchAll( $sql, NULL, array( $eid, $fid ) ); + + $result .= '' .translate('Zone'). ' | '.PHP_EOL; + $result .= '' .translate('PixelDiff'). ' | '.PHP_EOL; + $result .= '' .translate('AlarmPx'). ' | '.PHP_EOL; + $result .= '' .translate('FilterPx'). ' | '.PHP_EOL; + $result .= '' .translate('BlobPx'). ' | '.PHP_EOL; + $result .= '' .translate('Blobs'). ' | '.PHP_EOL; + $result .= '' .translate('BlobSizes'). ' | '.PHP_EOL; + $result .= '' .translate('AlarmLimits'). ' | '.PHP_EOL; + $result .= '' .translate('Score'). ' | '.PHP_EOL; + $result .= '|
---|---|---|---|---|---|---|---|---|---|
' .validHtmlStr($stat['ZoneName']). ' | '.PHP_EOL; + $result .= '' .validHtmlStr($stat['PixelDiff']). ' | '.PHP_EOL; + $result .= '' .sprintf( "%d (%d%%)", $stat['AlarmPixels'], (100*$stat['AlarmPixels']/$stat['Area']) ). ' | '.PHP_EOL; + $result .= '' .sprintf( "%d (%d%%)", $stat['FilterPixels'], (100*$stat['FilterPixels']/$stat['Area']) ).' | '.PHP_EOL; + $result .= '' .sprintf( "%d (%d%%)", $stat['BlobPixels'], (100*$stat['BlobPixels']/$stat['Area']) ). ' | '.PHP_EOL; + $result .= '' .validHtmlStr($stat['Blobs']). ' | '.PHP_EOL; + + if ( $stat['Blobs'] > 1 ) { + $result .= '' .sprintf( "%d-%d (%d%%-%d%%)", $stat['MinBlobSize'], $stat['MaxBlobSize'], (100*$stat['MinBlobSize']/$stat['Area']), (100*$stat['MaxBlobSize']/$stat['Area']) ). ' | '.PHP_EOL; + } else { + $result .= '' .sprintf( "%d (%d%%)", $stat['MinBlobSize'], 100*$stat['MinBlobSize']/$stat['Area'] ). ' | '.PHP_EOL; + } + + $result .= '' .validHtmlStr($stat['MinX'].",".$stat['MinY']."-".$stat['MaxX'].",".$stat['MaxY']). ' | '.PHP_EOL; + $result .= '' .$stat['Score']. ' | '.PHP_EOL; + } + } else { + $result .= '
' .translate('NoStatisticsRecorded'). ' | '.PHP_EOL; + $result .= '
- | - | - | - | - | - | - | - | - | |
---|---|---|---|---|---|---|---|---|---|
- | - | - | - | - | - 1 ) { -?> - | - - | - - | - | - |
- |