diff --git a/web/ajax/stats.php b/web/ajax/stats.php index 06ce9d733..9226814b4 100644 --- a/web/ajax/stats.php +++ b/web/ajax/stats.php @@ -1,7 +1,6 @@ 1 ) { - $stat['BlobSizes'] = sprintf( "%d-%d (%d%%-%d%%)", $stat['MinBlobSize'], $stat['MaxBlobSize'], (100*$stat['MinBlobSize']/$stat['Area']), (100*$stat['MaxBlobSize']/$stat['Area']) ); + if ($stat['Blobs'] > 1) { + $stat['BlobSizes'] = sprintf('%d-%d (%d%%-%d%%)', $stat['MinBlobSize'], $stat['MaxBlobSize'], (100*$stat['MinBlobSize']/$stat['Area']), (100*$stat['MaxBlobSize']/$stat['Area'])); } else { - $stat['BlobSizes'] = sprintf( "%d (%d%%)", $stat['MinBlobSize'], 100*$stat['MinBlobSize']/$stat['Area'] ); + $stat['BlobSizes'] = sprintf('%d (%d%%)', $stat['MinBlobSize'], 100*$stat['MinBlobSize']/$stat['Area']); } - $stat['AlarmLimits'] = validHtmlStr($stat['MinX'].",".$stat['MinY']."-".$stat['MaxX'].",".$stat['MaxY']); - } - $data['raw'] = $stat; + $stat['AlarmLimits'] = validHtmlStr($stat['MinX'].','.$stat['MinY'].'-'.$stat['MaxX'].','.$stat['MaxY']); + $data['raw'][] = $stat; + } # end foreach stat/zone } else { $data['html'] = getStatsTableHTML($eid, $fid, $row); $data['id'] = '#contentStatsTable' .$row; diff --git a/web/skins/classic/views/js/frame.js b/web/skins/classic/views/js/frame.js index c10b6e87a..1040d5a48 100644 --- a/web/skins/classic/views/js/frame.js +++ b/web/skins/classic/views/js/frame.js @@ -12,10 +12,10 @@ function changeScale() { last: $j('#lastLink') }; - if ( img ) { + if (img) { var baseWidth = $j('#base_width').val(); var baseHeight = $j('#base_height').val(); - if ( ! parseInt(scale) ) { + if (!parseInt(scale)) { var newSize = scaleToFit(baseWidth, baseHeight, img, $j('#controls')); newWidth = newSize.width; newHeight = newSize.height; @@ -30,7 +30,7 @@ function changeScale() { } setCookie('zmWatchScale', scale, 3600); $j.each(controlsLinks, function(k, anchor) { //Make frames respect scale choices - if ( anchor ) { + if (anchor) { anchor.prop('href', anchor.prop('href').replace(/scale=.*&/, 'scale=' + scale + '&')); } }); @@ -39,11 +39,11 @@ function changeScale() { onStatsResize(newWidth); } -function getFrmStatsCookie() { +function getFrameStatsCookie() { var cookie = 'zmFrameStats'; var stats = getCookie(cookie); - if ( !stats ) { + if (!stats) { stats = 'on'; setCookie(cookie, stats, 10*365); } @@ -53,29 +53,33 @@ function getFrmStatsCookie() { function getStat(params) { $j.getJSON(thisUrl + '?view=request&request=stats&raw=true', params) .done(function(data) { - var stat = data.raw; + var stats = data.raw; + $j('#frameStatsTable').empty().append('
'); - $j.each( statHeaderStrings, function( key ) { - var th = $j('