From 79328df0e6cc3575b53a7332da8efc00b4c08283 Mon Sep 17 00:00:00 2001 From: Evgeny Gagua Date: Mon, 27 May 2024 09:53:39 -0400 Subject: [PATCH] Fixed Reports Fetching Videos (dates) and Mask Editor Draw --- lib/controller/getHistoryDay.php | 18 ++++++++++++------ lib/controller/getHistoryEvents.php | 3 ++- lib/javascript/jsapi_dynamic/mojo_reports.js | 8 ++------ lib/javascript/jsapi_dynamic/rgoose_devices.js | 2 +- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/lib/controller/getHistoryDay.php b/lib/controller/getHistoryDay.php index a2dc68a..fc3b13b 100644 --- a/lib/controller/getHistoryDay.php +++ b/lib/controller/getHistoryDay.php @@ -24,11 +24,13 @@ $E = intval( $LOLO[0]['evt_count'] ); $ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports/' . $DS . '/report.db' ); $QS = "SELECT `id`, `ts`, `evt_type` FROM `events` WHERE ( `evt_type`=52 OR `evt_type`=53 OR `evt_type`=54 )"; - $NDD = $ZIZI->Query( $QS ); - + $NDD = $ZIZI->Query( $QS ); if( count( $NDD ) ){ $st_ignore = true; $DH = 0; + $BID = 0; + $EID = 0; + $BTM = 0; $JIGA = array(); foreach( $NDD as $N ){ if( $st_ignore && $N['evt_type']!=52 ) continue; @@ -41,7 +43,7 @@ $DH = 1; $EID = intval( $N['id'] ); }; - if( $DH == 1 ){ + if( $st_ignore == false && $DH == 1 ){ $JIGA[] = "{ text: '{$BTM}', leaf: true, bid: {$BID}, eid: {$EID} }"; }; }; @@ -56,7 +58,11 @@ }; $JIGA[] = "{ text: '{$BTM}', leaf: true, bid: {$BID}, eid: {$EID} }"; }; - $NONO = "{ text: 'Sessions', leaf: false, expanded: true, children:[". implode( ",", $JIGA ) . "]}"; + if( count( $JIGA ) ){ + $NONO = "{ text: 'Sessions', leaf: false, expanded: true, children:[". implode( ",", $JIGA ) . "]}"; + } else { + $NONO = "{ text: 'No Sessions', leaf: true }"; + }; }; $QS = "SELECT DISTINCT `ts`/3600 AS JUJA FROM `events`"; $NDD = $ZIZI->Query( $QS ); @@ -67,13 +73,13 @@ foreach( $NDD as $N ){ $BTS = intval($N['JUJA'])*3600; $DADA = date( "H:i", $BTS ); - $ETS = $BTS+3599; + $ETS = $BTS+3600; $BID = 0; $EID = 0; $QS="SELECT `id` FROM `events` WHERE `ts`>({$BTS}-1) LIMIT 1"; $KK = $ZIZI->Query( $QS ); if( count( $KK ) ) $BID = $KK[0]['id']; - $QS="SELECT `id` FROM `events` WHERE `ts`>({$ETS}-1) LIMIT 1"; + $QS="SELECT `id` FROM `events` WHERE `ts`<({$ETS}-1) ORDER BY `id` DESC LIMIT 1"; $KK = $ZIZI->Query( $QS ); if( count( $KK ) ) $EID = $KK[0]['id']; else $EID = $BID; if( $BID && $EID ){ diff --git a/lib/controller/getHistoryEvents.php b/lib/controller/getHistoryEvents.php index 629c45d..7ca0a00 100644 --- a/lib/controller/getHistoryEvents.php +++ b/lib/controller/getHistoryEvents.php @@ -4,7 +4,7 @@ $BID = intval( $_POST['BID'] ); $EID = intval( $_POST['EID'] ); $DTS = intval( $_POST['TS'] ); - if( $BID ){ + if( 1 || $BID ){ $QS = "SELECT * FROM `system_props` LIMIT 1"; $SPD = $DATABASE->Query( $QS ); $SP = $SPD[0]; @@ -24,6 +24,7 @@ $CR['id'] = intval( $REC['id'] ); $CR['node_id'] = intval( $REC['node_id'] ); $CR['node_name'] = $NodeNames[$CR['node_id']]; + $CR['rts'] = $DTS; $CR['ts'] = intval( $REC['ts'] ); $CR['ms'] = intval( $REC['ts_ms'] ); $CR['dts'] = date( "Y-m-d H:i:s.{$CR['ms']}", $CR['ts'] ); diff --git a/lib/javascript/jsapi_dynamic/mojo_reports.js b/lib/javascript/jsapi_dynamic/mojo_reports.js index 59cef94..96aafc7 100644 --- a/lib/javascript/jsapi_dynamic/mojo_reports.js +++ b/lib/javascript/jsapi_dynamic/mojo_reports.js @@ -23,6 +23,7 @@ var rep_store = new Ext.data.JsonStore({ {name: 'geo', type: 'bool' }, {name: 'node_name', type: 'string' }, {name: 'dts', type: 'string'}, + {name: 'rts', type: 'int'}, {name: 'ts', type: 'int'}, {name: 'ms', type: 'string'}, {name: 'type', type: 'int'}, @@ -31,14 +32,9 @@ var rep_store = new Ext.data.JsonStore({ {name: 'el', type: 'string'}, {name: 'r', type: 'int'}, {name: 'width', type: 'int'}, - //{name: 'video_id',type: 'int'}, {name: 'video',type: 'int'}, {name: 'lat', type: 'float'}, {name: 'lon', type: 'float'} - //{name: 'alt', type: 'float'}, - //{name: 'area', type: 'float'}, - //{name: 'video', type: 'string'}, - //{name: 'v_cpoint', type: 'int'} ] }); function rep_sn_Renderer( value, meta, record ){ @@ -706,7 +702,7 @@ function loadEventData( record ){ params: { UID: , SID: '', - TS: record.ts, + TS: record.rts, ID: record.id }, success: function( response, opts ){ diff --git a/lib/javascript/jsapi_dynamic/rgoose_devices.js b/lib/javascript/jsapi_dynamic/rgoose_devices.js index c01ca0a..469db0c 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_devices.js +++ b/lib/javascript/jsapi_dynamic/rgoose_devices.js @@ -2296,7 +2296,7 @@ function loadMaskDraw( a ){ if( draw != null ) csvg.removeChild( draw ); var p2 = 2.0*Math.PI; - var so = -10 * p2 / 360.0; + var so = 0;//-10 * p2 / 360.0; var bBox = csvg.getBBox(); var newpath = document.createElementNS('http://www.w3.org/2000/svg', "polygon");