diff --git a/lib/controller/data/mysqlitedb.db b/lib/controller/data/mysqlitedb.db
index 7af6d3f..7f7b133 100644
Binary files a/lib/controller/data/mysqlitedb.db and b/lib/controller/data/mysqlitedb.db differ
diff --git a/lib/controller/data/reports.db b/lib/controller/data/reports.db
index d1cb0ea..cddebee 100644
Binary files a/lib/controller/data/reports.db and b/lib/controller/data/reports.db differ
diff --git a/lib/controller/doCameraOperation.php b/lib/controller/doCameraOperation.php
index d068eef..95b9319 100644
--- a/lib/controller/doCameraOperation.php
+++ b/lib/controller/doCameraOperation.php
@@ -451,6 +451,13 @@
$Data['status'] = 'ok-19';
break;
};
+ case 20:{
+ $Param = $DATABASE->escape( $_POST['OPCODE'] );
+ $QS = "UPDATE `nodes` SET `name`='{$Param}' WHERE `type`>9 AND `type`<14 AND `aux_id`={$CameraID}";
+ $DATABASE->Query( $QS );
+ $Data['status'] = 'ok-20';
+ break;
+ };
};
break;
};
diff --git a/lib/controller/doSensorOperation.php b/lib/controller/doSensorOperation.php
index beaa1ee..97c98d2 100644
--- a/lib/controller/doSensorOperation.php
+++ b/lib/controller/doSensorOperation.php
@@ -175,7 +175,7 @@
$SUN = intval( $_POST['SUN'] );
$WIZ = intval( $_POST['WIZ'] );
$DEL = intval( $_POST['DEL'] );
- $QS = "UPDATE `lrf_detection_profiles` SET `order`={$ORD},`offset`={$OFF},`delta`={$DEL},`flip`={$FLI},`width`={$WIZ},`sst`={$SST},`sun`={$SUN} WHERE `aux_id`={$SNID} AND `profile_id`={$PID} AND `lrf_id`={$LRF} AND `master`=1";
+ $QS = "INSERT INTO `lrf_detection_profiles`(`aux_id`,`profile_id`,`master`,`order`,`offset`,`delta`,`flip`,`width`,`sst`,`sun`,`gp`,`spikes`) VALUES({$SNID},{$PID},1,{$ORD},{$OFF},{$DEL},{$FLI},{$WIZ},{$SST},{$SUN},16,1 ) ON CONFLICT(`aux_id`,`lrf_id`,`master`) DO UPDATE SET `order`={$ORD},`offset`={$OFF},`delta`={$DEL},`flip`={$FLI},`width`={$WIZ},`sst`={$SST},`sun`={$SUN}";
$DATABASE->Query( $QS, false );
//Parameter Send to device
$RBASE = new SQLite_DB( '/dev/shm/argus/mem_db.db');
diff --git a/lib/controller/getCameraEditor.php b/lib/controller/getCameraEditor.php
index 21f2441..cd56822 100644
--- a/lib/controller/getCameraEditor.php
+++ b/lib/controller/getCameraEditor.php
@@ -10,6 +10,9 @@
$STREAMS = array();
if( count( $Result ) ){
$Cam = $Result[0];
+ $QS="SELECT `name` FROM `nodes` WHERE `type`>9 AND `type`<14 AND `aux_id`={$CID}";
+ $JJ = $DATABASE->Query( $QS );
+ $Cam['node_name'] = $JJ[0]['name'];
$Cam['name']=urldecode( $Cam['name'] );
$TB = explode( ' ', $Cam['name'] );
$Cam['name'] = $TB[0];
@@ -931,6 +934,21 @@ CHUPAKABRA;
border: false
},
items:[{
+ width: 200,
+ html: 'Camera Label'
+ },{
+ xtype: 'textfield',
+ id: 'cam_label',
+ width: 200,
+ value: '{$Cam['node_name']}',
+ listeners:{
+ change: function( a, c, b ){
+ doCamOperation( {$CID}, 20, c );
+ }
+ }
+ },{
+ xtype: 'spacer'
+ },{
width: 200,
html: '{$Labels->GetLabel('_CAM_TRIGGERING_MODE_')}'
},{
diff --git a/lib/controller/getHistoryDates.php b/lib/controller/getHistoryDates.php
index b19a6b2..a29b4d2 100644
--- a/lib/controller/getHistoryDates.php
+++ b/lib/controller/getHistoryDates.php
@@ -1,15 +1,20 @@
Data['id'] > 1 ){
- $ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports.db');
- $QS = "SELECT count(`id`) as `cnt`, `ts`/86400 as `ts` FROM `events` GROUP BY `ts`/86400";
+ $ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports/stat.db');
+ $TZ = new DateTimeZone( date_default_timezone_get() );
+ $DT = new DateTime("now", $TZ );
+ $DIDI = $TZ->getOffset( $DT );
+ $QS = "SELECT * FROM `days`";
$RR = $ZIZI->Query( $QS );
if( count( $RR ) ){
$DD = array();
foreach( $RR as $R ){
- $CC = intval( $R['cnt'] );
+ $CC = intval( $R['session_count'] );
+ $DS = $R['year'] . '-' . $R['month'] . '-' . $R['day'] . ' 00:00:00';
+ $TS = strtotime( $DS );
if( $CC > 100 ) $CC = 100;
- $DD[] = '{"t": '.($R['ts']*86400000).',"v":'.$CC.'}';
+ $DD[] = '{"t": '.( $TS * 1000 ).',"v":'.$CC.'}';
//echo '[{"t": 1285891200000,"v": 20},{"t": 1285804800000,"v": 100},{"t": 1672249854000,"v": 50},{"t": 1672279854000,"v": 80}]';
};
echo "[" . implode(",", $DD ) . "]";
diff --git a/lib/controller/getHistoryDay.php b/lib/controller/getHistoryDay.php
index b221eca..f7d73a7 100644
--- a/lib/controller/getHistoryDay.php
+++ b/lib/controller/getHistoryDay.php
@@ -2,76 +2,60 @@
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$DTS = intval( $_POST['DTS'] );
- if( $DTS ){
- $ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports.db');
- $DS = $DTS;
- $DE = $DS + 86400; // -> 1 Day
- /*
- $QS ="SELECT DISTINCT `node_id` FROM `events` WHERE `ts` >= {$DS} AND `ts` <= {$DE}";
- $NDD = $ZIZI->Query( $QS );
- $lulu = true;
- $E = "]}";
- $NONO = array();
- foreach( $NDD as $NID ){
- $id = intval( $NID['node_id'] );
- $QS = "SELECT `name` FROM `nodes` WHERE `id`={$id}";
- $R = $DATABASE->Query( $QS );
- $Name = $R[0]['name'];
- if( $lulu ) {
- $S = "{ text: '{$Name}', leaf: false, expanded: true, children:[";
- $lulu = false;
- } else {
- $S = "{ text: '{$Name}', leaf: false, expanded: false, children:[";
- };
- $QS = "SELECT `ts`, `id` FROM `events` WHERE `node_id`={$id} AND `ts` >= {$DS} AND `ts` <= {$DE} AND ( `evt_type`=52 ) ORDER BY `ts`, `ts_ms`";
- //echo $QS;
- //exit();
- $JJJ = $ZIZI->Query( $QS );
- $JIGA = array();
- foreach( $JJJ as $J ){
- $TM = date( "H:i:s", $J['ts'] );
- $JIGA[] = "{ text: '{$TM}', leaf: true, ts: {$J['ts']}, nid: {$id} }";
- };
- $NONO[] = $S . implode( ",", $JIGA ) . $E;
- //echo "{expanded: true, children: [{ text: 'Menu Option 1', leaf: false, expanded: true, children:[{ text: '14:53', leaf: true }] },{ text: 'Menu Option 2', leaf: true },{ text: 'Menu Option 3', leaf: true}]}";
- };
- echo "{expanded: true, children: [".implode(",", $NONO )."]}";
- */
- $QS = "SELECT `id`, `ts`, `evt_type` FROM `events` WHERE `ts` >= {$DS} AND `ts` <= {$DE} AND ( `evt_type`=52 OR `evt_type`=53 OR `evt_type`=54 )";
- $NDD = $ZIZI->Query( $QS );
- if( count( $NDD ) ){
- $st_ignore = true;
- $DH = 0;
- $JIGA = array();
- foreach( $NDD as $N ){
- if( $st_ignore && $N['evt_type']!=52 ) continue;
- if( $st_ignore && $N['evt_type']==52 ) $st_ignore = false;
- if( $N['evt_type']==52 ) {
- $DH = 0;
- $BID = intval( $N['id'] );
- $BTM = date( "H:i:s", $N['ts'] );
- } else {
- $DH = 1;
- $EID = intval( $N['id'] );
+ if( $DTS ){
+ $Y = date("Y", $DTS );
+ $M = date("m", $DTS );
+ $D = date("d", $DTS );
+ $DS = date("Y/m/d", $DTS );
+ $NONO = '';
+ $MUMU = new SQLite_DB( '/srv/www/web/lib/controller/data/reports/stat.db' );
+ $QS = "SELECT * FROM `days` WHERE `year`={$Y} AND `month`={$M} AND `day`={$D}";
+ $LOLO = $MUMU->Query( $QS );
+ $S = 0;
+ $V = 0;
+ $E = 0;
+ if( count( $LOLO ) ){
+ $S = intval( $LOLO[0]['session_count'] );
+ $V = intval( $LOLO[0]['videos_count'] );
+ $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 );
+
+ if( count( $NDD ) ){
+ $st_ignore = true;
+ $DH = 0;
+ $JIGA = array();
+ foreach( $NDD as $N ){
+ if( $st_ignore && $N['evt_type']!=52 ) continue;
+ if( $st_ignore && $N['evt_type']==52 ) $st_ignore = false;
+ if( $N['evt_type']==52 ) {
+ $DH = 0;
+ $BID = intval( $N['id'] );
+ $BTM = date( "H:i:s", $N['ts'] );
+ } else {
+ $DH = 1;
+ $EID = intval( $N['id'] );
+ };
+ if( $DH == 1 ){
+ $JIGA[] = "{ text: '{$BTM}', leaf: true, bid: {$BID}, eid: {$EID} }";
+ };
};
- if( $DH == 1 ){
+ if( $DH == 0 ){
+ //Ongoing Event goes next day - must catch up
+ $QS = "SELECT `id`, `ts`, `evt_type` FROM `events` WHERE `id` > {$BID} AND ( `evt_type`=53 OR `evt_type`=54 ) LIMIT 1";
+ $NDD = $ZIZI->Query( $QS );
+ if( count( $NDD ) ){
+ $EID = intval( $NDD[0]['id'] );
+ } else {
+ $EID = 1000000000;//Infinity
+ };
$JIGA[] = "{ text: '{$BTM}', leaf: true, bid: {$BID}, eid: {$EID} }";
};
+ $NONO = "{ text: 'Events', leaf: false, expanded: true, children:[". implode( ",", $JIGA ) . "]}";
};
- if( $DH == 0 ){
- //Ongoing Event goes next day - must catch up
- $QS = "SELECT `id`, `ts`, `evt_type` FROM `events` WHERE `id` > {$BID} AND ( `evt_type`=53 OR `evt_type`=54 ) LIMIT 1";
- $NDD = $ZIZI->Query( $QS );
- if( count( $NDD ) ){
- $EID = intval( $NDD[0]['id'] );
- } else {
- $EID = 1000000000;//Infinity
- };
- $JIGA[] = "{ text: '{$BTM}', leaf: true, bid: {$BID}, eid: {$EID} }";
- };
- $NONO = "{ text: 'Events', leaf: false, expanded: true, children:[". implode( ",", $JIGA ) . "]}";
};
- echo "{expanded: true, children: [". $NONO ."]}";
+ echo "{expanded: true, children: [". $NONO ."], sessions:{$S}, events:{$E}, videos:{$V} }";
} else {
echo "[]";
};
diff --git a/lib/controller/getHistoryEvents.php b/lib/controller/getHistoryEvents.php
index 5aff574..b1d7bef 100644
--- a/lib/controller/getHistoryEvents.php
+++ b/lib/controller/getHistoryEvents.php
@@ -3,13 +3,15 @@
if( $CUser->Data['id'] > 1 ){
$BID = intval( $_POST['BID'] );
$EID = intval( $_POST['EID'] );
+ $DTS = intval( $_POST['TS'] );
if( $BID ){
$QS = "SELECT * FROM nodes";
$result = $DATABASE->Query( $QS, false );
$NodeNames = array();
foreach( $result as $R ) $NodeNames[$R['id']] = $R['name'];
- $QS = "SELECT `events`.*, `events_2_videos`.* FROM `events` LEFT JOIN `events_2_videos` ON( `events`.`id` = `events_2_videos`.`evt_id` ) WHERE `id` >= {$BID} AND `id`<={$EID} ORDER BY `ts` ASC, `ts_ms` ASC";
- $ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports.db');
+ $DS = date("Y/m/d", $DTS );
+ $QS = "SELECT `events`.*, `events_2_videos`.* FROM `events` LEFT JOIN `events_2_videos` ON( `events`.`id` = `events_2_videos`.`evt_id` ) WHERE `events`.`id` >= {$BID} AND `events`.`id`<={$EID} ORDER BY `ts` ASC, `ts_ms` ASC";
+ $ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports/'.$DS.'/report.db');
//$LREC = array_reverse( $ZIZI->Query( $QS ) );
$LREC = $ZIZI->Query( $QS );
$Data['log'] = array();
diff --git a/lib/controller/getSensorEditor.php b/lib/controller/getSensorEditor.php
index d2d1a3c..283923e 100644
--- a/lib/controller/getSensorEditor.php
+++ b/lib/controller/getSensorEditor.php
@@ -23,6 +23,7 @@ JOJOKA;
case 4: $NAME = ''.$CR['name'].'
PLS360 ' . $Labels->getLabel('SENSOR'); break;
default: $NAME = ''.$CR['name'].'
Unknown Sensor';
};
+ $NAME .='
communication errors per minute: '.$CR['com_epm'];
$INFO = '
| Serial: | '.(($CR['serial']!='')?$CR['serial']:'No Serial Defined').' |
| Version: | '.(($CR['version']!='')?$CR['version']:'No Version Info').' |
| {$NAME} | |
| {$INFO} | |
'+( new Date( ts * 1000)).toLocaleDateString()+'
', + html: ''+( new Date( ts * 1000)).toLocaleDateString()+'
'+data.sessions+'
'+data.events+'
'+data.videos+'
', frame: false, width: '100%', border: false @@ -1557,11 +1590,11 @@ function loadReportDayTree( ts ){ xtype: 'treepanel', autoScroll: true, width: '100%', -Data['access'] > 3 ){ ?> - height: PanelH-177, +Data['access'] > 3 ){ ?> + height: PanelH-260, - height: PanelH-130, - + height: PanelH-209, + border: true, frame: true, loader: new Ext.tree.TreeLoader(), @@ -1571,8 +1604,8 @@ function loadReportDayTree( ts ){ click: function(n) { if( n.attributes.leaf ){ Ext.getCmp('chu_adate').show(); - sPanel.doLayout(); - loadReportSegment( n.attributes.bid, n.attributes.eid ); + sPanel.doLayout(); + loadReportSegment( ts, n.attributes.bid, n.attributes.eid ); //Ext.Msg.alert('Navigation Tree Click', 'You clicked: "' + n.attributes.ts + '"'); }; } @@ -1613,6 +1646,24 @@ function loadReportDayTree( ts ){ }); }; +function hideVideo(){ + var juja = undefined; + for( i = 1; i++; i < 1000 ){ + var juja = document.getElementById( 'video-'+i ); + if( juja != undefined ) break; + }; + if( juja != undefined ) juja.style.display = "none"; +}; + +function showVideo(){ + var juja = undefined; + for( i = 1; i++; i < 1000 ){ + var juja = document.getElementById( 'video-'+i ); + if( juja != undefined ) break; + }; + if( juja != undefined ) juja.style.display = "block"; +}; + function initReportsView(){ ReportSelectionMode = 0; // All History if( tlInterval!= null ){ diff --git a/style/style.css b/style/style.css index 402f393..4770926 100644 --- a/style/style.css +++ b/style/style.css @@ -1309,3 +1309,45 @@ A.CalendarDS:hover { font-size: 16px!important; text-align: center; } +.cur_videos{ + font-weight: bold; + background-color: green; + border-radius: 4px; + padding: 5px; + margin-top: 3px; + margin-bottom: 1px; + font-size: 12px!important; + background-image: url(wicons/030.png); + background-size: 16px 16px; + background-repeat: no-repeat; + background-position: 6px 4px; + text-align: center; +} +.cur_sessions{ + font-weight: bold; + background-color: blue; + border-radius: 4px; + padding: 5px; + margin-top: 3px; + margin-bottom: 1px; + font-size: 12px!important; + background-image: url(wicons/050.png); + background-size: 16px 16px; + background-repeat: no-repeat; + background-position: 6px 4px; + text-align: center; +} +.cur_events{ + font-weight: bold; + background-color: red; + border-radius: 4px; + padding: 5px; + margin-top: 3px; + margin-bottom: 1px; + font-size: 12px!important; + background-image: url(wicons/046.png); + background-size: 16px 16px; + background-repeat: no-repeat; + background-position: 6px 4px; + text-align: center; +} diff --git a/style/wicons/050.png b/style/wicons/050.png index 50dc11d..71f1e4f 100644 Binary files a/style/wicons/050.png and b/style/wicons/050.png differ