diff --git a/index.php b/index.php index 247e859..4174d42 100644 --- a/index.php +++ b/index.php @@ -15,7 +15,7 @@ 'mojo_monitoring.js', //'rgoose_sysmap_editor.js', 'rgoose_location_editor.js', - 'rgoose_dashboard.js', + 'mojo_dashboard.js', 'rgoose_users.js', 'rgoose_logs.js', 'rgoose_single_ipi.js', diff --git a/lib/controller/addModule.php b/lib/controller/addModule.php index dd92a54..347ded2 100644 --- a/lib/controller/addModule.php +++ b/lib/controller/addModule.php @@ -43,7 +43,7 @@ $DATABASE->Query( $QS ); break; }; - case 9:{ + case 8:{ //EmbedVido $QS = "INSERT INTO `module_eve`(`web_port`) VALUES(8972)"; $DATABASE->Query( $QS ); diff --git a/lib/controller/dash/node_10.js b/lib/controller/dash/node_10.js index 686568d..3e4558f 100644 --- a/lib/controller/dash/node_10.js +++ b/lib/controller/dash/node_10.js @@ -1,18 +1,39 @@ { id: 'db_node_%%%NODEID%%%', - xtype: 'portlet', - width: 258, - height: %%%HEIGHT%%%+40, + //xtype: 'portlet', + layout:'fit', + //width: 258, + //height: %%%HEIGHT%%%+40, tools: [{ id:'gear', handler: function(){ - editAnalogStream( %%%STREAMID%%%, 1 ); + //editAnalogStream( %%%STREAMID%%%, 1 ); } }], frame: true, + draggable: false, bodyStyle: 'padding: 0px;', title: '%%%NODENAME%%%', items:[{ - html: '', - }] + id: 'db_node_%%%NODEID%%%_pic', + html: '', + }], + sukaMineWidth: -1, + listeners:{ + resize: function( p, adjWidth, adjHeight, rawWidth, rawHeight ){ + if( rawWidth!= undefined ){ + if( p.sukaMineWidth != adjWidth ){ + p.sukaMineWidth = adjWidth; + var XX = 32 + p.sukaMineWidth * %%%HEIGHT%%% / %%%WIDTH%%%; + p.setHeight( XX ); + }; + }; + var z = Ext.getCmp('db_node_%%%NODEID%%%_pic'); + z.update(''); + }, + afterrender: function( p ){ + var xx = p.getWidth() * %%%HEIGHT%%% / %%%WIDTH%%%; + p.setHeight( xx+32 ); + } + } } \ No newline at end of file diff --git a/lib/controller/dash/node_13.js b/lib/controller/dash/node_13.js index fc880ef..d5d98f2 100644 --- a/lib/controller/dash/node_13.js +++ b/lib/controller/dash/node_13.js @@ -1,63 +1,21 @@ { id: 'db_node_%%%NODEID%%%', - //xxtype: 'panel', - xtype: 'portlet', - //columnWidth:.33, - //layout: 'fit', - width: 258, - height: %%%HEIGHT%%%+68, + layout:'vbox', tools: [{ id:'gear', handler: function(){ - Ext.Msg.alert('Message', 'The Settings tool was clicked.'); } }], frame: true, bodyStyle: 'padding: 0px;', plr: null, title: '%%%NODENAME%%%', + sukaMineWidth: -1, items:[{ - html: '', - },{ - xtype: 'spacer', - height: 5 - },{ - xtype: 'button', - id: 'ptz_btn_%%%NODEID%%%', + id: 'db_node_%%%NODEID%%%_pic', + border: true, width: '100%', - text: 'PTZ Control', - enableToggle: true, - handler: function(){ - var t = Ext.getCmp('db_node_%%%NODEID%%%'); - if( Ext.getCmp('ptz_btn_%%%NODEID%%%').pressed ){ - t.setSize( 258, %%%HEIGHT%%%+162 ); - document.getElementById('img_btn_010_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); - document.getElementById('img_btn_010_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); - document.getElementById('img_btn_011_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); - document.getElementById('img_btn_011_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); - document.getElementById('img_btn_027_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); - document.getElementById('img_btn_027_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); - document.getElementById('img_btn_028_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); - document.getElementById('img_btn_028_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); - document.getElementById('img_btn_029_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); - document.getElementById('img_btn_029_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); - document.getElementById('img_btn_030_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); - document.getElementById('img_btn_030_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); - document.getElementById('img_btn_031_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); - document.getElementById('img_btn_031_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); - document.getElementById('img_btn_032_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); - document.getElementById('img_btn_032_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); - document.getElementById('img_btn_033_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); - document.getElementById('img_btn_033_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); - document.getElementById('img_btn_034_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); - document.getElementById('img_btn_034_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); - document.getElementById('img_btn_020_%%%NODEID%%%').addEventListener( 'mousedown', makePtzStop ); - } else { - t.setSize( 258, %%%HEIGHT%%%+68 ); - //Ext.Msg.alert('Message', 'The 270 tool was clicked.'); - }; - t.doLayout(); - } + html: '' },{ xtype: 'spacer', height: 3 @@ -66,24 +24,46 @@ height: 90 }], listeners:{ - afterrender: function( t ){ - /* - t.plr = videojs.getPlayer('hls-%%%NODEID%%%'); - if( t.plr == null ){ - t.plr = videojs('hls-%%%NODEID%%%',{ - autoplay: 'muted', - controls: true, - controlBar: { - volumePanel: false, - playToggle: false, - pictureInPictureToggle: false - } - }); + resize: function( p, adjWidth, adjHeight, rawWidth, rawHeight ){ + if( rawWidth!= undefined ){ + if( p.sukaMineWidth != adjWidth ){ + p.sukaMineWidth = adjWidth; + var XX = p.sukaMineWidth * %%%HEIGHT%%% / %%%WIDTH%%%; + p.setHeight( XX + 120 ); + var z = Ext.getCmp('db_node_%%%NODEID%%%_pic'); + z.setHeight( XX ); + }; }; - t.plr.src({type: 'application/x-mpegURL', src: '%%%SELURL%%%'}); - */ - return true; - }, + var z = Ext.getCmp('db_node_%%%NODEID%%%_pic'); + z.update(''); + }, + afterrender: function( p ){ + var xx = p.getWidth() * %%%HEIGHT%%% / %%%WIDTH%%%; + p.setHeight( xx + 120 ); + var z = Ext.getCmp('db_node_%%%NODEID%%%_pic'); + z.setHeight( xx ); + document.getElementById('img_btn_010_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); + document.getElementById('img_btn_010_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); + document.getElementById('img_btn_011_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); + document.getElementById('img_btn_011_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); + document.getElementById('img_btn_027_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); + document.getElementById('img_btn_027_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); + document.getElementById('img_btn_028_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); + document.getElementById('img_btn_028_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); + document.getElementById('img_btn_029_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); + document.getElementById('img_btn_029_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); + document.getElementById('img_btn_030_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); + document.getElementById('img_btn_030_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); + document.getElementById('img_btn_031_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); + document.getElementById('img_btn_031_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); + document.getElementById('img_btn_032_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); + document.getElementById('img_btn_032_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); + document.getElementById('img_btn_033_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); + document.getElementById('img_btn_033_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); + document.getElementById('img_btn_034_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop ); + document.getElementById('img_btn_034_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove ); + document.getElementById('img_btn_020_%%%NODEID%%%').addEventListener( 'mousedown', makePtzStop ); + }, destroy: function( t ){ if( t.plr != null ) t.plr.dispose(); t.plr = null; diff --git a/lib/controller/data/factory.db b/lib/controller/data/factory.db index d6a8921..b9fa6ff 100644 Binary files a/lib/controller/data/factory.db and b/lib/controller/data/factory.db differ diff --git a/lib/controller/data/mysqlitedb.db b/lib/controller/data/mysqlitedb.db index 24d77d0..946c95c 100644 Binary files a/lib/controller/data/mysqlitedb.db and b/lib/controller/data/mysqlitedb.db differ diff --git a/lib/controller/data/reports/094c688e5e8dc1f8ef21d6e2db1f6a5f.mp4 b/lib/controller/data/reports/094c688e5e8dc1f8ef21d6e2db1f6a5f.mp4 deleted file mode 100644 index 2cf845b..0000000 Binary files a/lib/controller/data/reports/094c688e5e8dc1f8ef21d6e2db1f6a5f.mp4 and /dev/null differ diff --git a/lib/controller/data/reports/3d795f358a9132dbfcd9893d1da802ce.mp4 b/lib/controller/data/reports/3d795f358a9132dbfcd9893d1da802ce.mp4 deleted file mode 100644 index 2cf845b..0000000 Binary files a/lib/controller/data/reports/3d795f358a9132dbfcd9893d1da802ce.mp4 and /dev/null differ diff --git a/lib/controller/data/reports/5867808c7150d49c86fd81abb3eeeafe.mp4 b/lib/controller/data/reports/5867808c7150d49c86fd81abb3eeeafe.mp4 deleted file mode 100644 index 2cf845b..0000000 Binary files a/lib/controller/data/reports/5867808c7150d49c86fd81abb3eeeafe.mp4 and /dev/null differ diff --git a/lib/controller/data/reports/69c511bc894dffaae421028dc1906ef7.mp4 b/lib/controller/data/reports/69c511bc894dffaae421028dc1906ef7.mp4 deleted file mode 100644 index 2cf845b..0000000 Binary files a/lib/controller/data/reports/69c511bc894dffaae421028dc1906ef7.mp4 and /dev/null differ diff --git a/lib/controller/data/reports/863cc02857069ff580c79e1cb1647f71.mp4 b/lib/controller/data/reports/863cc02857069ff580c79e1cb1647f71.mp4 deleted file mode 100644 index 2cf845b..0000000 Binary files a/lib/controller/data/reports/863cc02857069ff580c79e1cb1647f71.mp4 and /dev/null differ diff --git a/lib/controller/data/reports/99f3f89ac1dfe06dd18f8d18ce0ca8ab.mp4 b/lib/controller/data/reports/99f3f89ac1dfe06dd18f8d18ce0ca8ab.mp4 deleted file mode 100644 index 2cf845b..0000000 Binary files a/lib/controller/data/reports/99f3f89ac1dfe06dd18f8d18ce0ca8ab.mp4 and /dev/null differ diff --git a/lib/controller/data/reports/9eb1ee93cb0fc840c852676d78acb131.mp4 b/lib/controller/data/reports/9eb1ee93cb0fc840c852676d78acb131.mp4 deleted file mode 100644 index 2cf845b..0000000 Binary files a/lib/controller/data/reports/9eb1ee93cb0fc840c852676d78acb131.mp4 and /dev/null differ diff --git a/lib/controller/data/reports/a821bcaac7313ef47ef3a9fd48dc153b.mp4 b/lib/controller/data/reports/a821bcaac7313ef47ef3a9fd48dc153b.mp4 deleted file mode 100644 index 2cf845b..0000000 Binary files a/lib/controller/data/reports/a821bcaac7313ef47ef3a9fd48dc153b.mp4 and /dev/null differ diff --git a/lib/controller/data/reports/cf2ae8197f26e5e0be501e364237a6c2.mp4 b/lib/controller/data/reports/cf2ae8197f26e5e0be501e364237a6c2.mp4 deleted file mode 100644 index 2cf845b..0000000 Binary files a/lib/controller/data/reports/cf2ae8197f26e5e0be501e364237a6c2.mp4 and /dev/null differ diff --git a/lib/controller/doCameraOperation.php b/lib/controller/doCameraOperation.php index fa26546..32e28f8 100644 --- a/lib/controller/doCameraOperation.php +++ b/lib/controller/doCameraOperation.php @@ -186,6 +186,57 @@ break; }; + case 7:{ + //Remove Camera + $QS ="SELECT * FROM `cameras` WHERE `id`={$CameraID}"; + $RR = $DATABASE->Query( $QS ); + if( count ( $RR ) ){ + $CCD = $RR[0]; + $QS ="DELETE FROM `nodes` WHERE `type` IN (10,11,12,13) AND `aux_id`={$CameraID}"; + $DATABASE->Query( $QS ); + if( $CCD['type'] < 12 ){//Analog + $QS="UPDATE `cameras` SET `status`=0 WHERE `id`={$CameraID}"; + $DATABASE->Query( $QS ); + } else { // IP + $QS ="DELETE FROM `media_streams` WHERE `source_id`={$CameraID}"; + $DATABASE->Query( $QS ); + $QS ="DELETE FROM `cameras` WHERE `id`={$CameraID}"; + $DATABASE->Query( $QS ); + }; + + $Data['status'] = 'ok'; + }; + break; + }; + case 8:{ + // Direct PTZ Controll + //$QS = "SELECT `aux_id` FROM `nodes` WHERE `id`={$CameraID}"; + //$RR = $DATABASE->Query( $QS ); + //$CameraID = intval( $RR[0]['aux_id'] ); + if( $CameraID && isset( $_POST['MOV'] ) ){ + $CCC = intval( $_POST['MOV'] ); + switch( $CCC ){ + case 0: $ACMD = 0x01; break; //Stop + case 10: $ACMD = 0x21; break; //Zoom In + case 11: $ACMD = 0x41; break; //Zoom Out + case 27: $ACMD = 0x03; break; // Right + case 28: $ACMD = 0x13; break; // RD + case 29: $ACMD = 0x11; break; // Down + case 30: $ACMD = 0x15; break; // LD + case 31: $ACMD = 0x05; break; // Left + case 32: $ACMD = 0x0d; break; // LU + case 33: $ACMD = 0x09; break; // Up + case 34: $ACMD = 0x0B; break; // RU + }; + echo $CameraID . " -> " .$ACMD; + if( $ACMD ){ + $QS = "INSERT INTO `nodes_qcq`(`cmd`,`node_id`,`status`) VALUES ({$ACMD},{$CameraID},0)"; + @$MEMDB = new SQLite_DB( '/dev/shm/argus/mem_db.db'); + $MEMDB->Query( $QS ); + }; + }; + break; + }; case 10:{ $OP = intval( $_POST['OPID'] ); switch( $OP ){ diff --git a/lib/controller/doNodeOperation.php b/lib/controller/doNodeOperation.php index acdce08..02edf62 100644 --- a/lib/controller/doNodeOperation.php +++ b/lib/controller/doNodeOperation.php @@ -2,32 +2,92 @@ require_once('../ajax_asm.php'); if( $CUser->Data['id'] > 1 ){ $Data = array(); - $Data['success'] = false; + $Data['status'] = 'na'; + if( isset( $_POST['CCMD'] ) ){ + $CCMD = intval( $_POST['CCMD'] ); + } else $CCMD = 0; if( isset( $_POST['NID'] ) ) { $NodeID = intval($_POST['NID']); } else $NodeID = 0; - if( isset( $_POST['CMD'] ) ){ - $CMD = intval( $_POST['CMD'] ); - } else { - $CMD = 0; - }; - if( isset( $_POST['PARAM'] ) ){ - $PARAM = $DATABASE->escape( $_POST['PARAM'] ); - } else { - $PARAM = ''; - }; - if( $NodeID > 0 && $CMD > 0 ){ - $Data['success'] = true; - $QS = "INSERT INTO `nodes_qcq`(`node_id`,`cmd`,`status`,`parameter`) VALUES({$NodeID},{$CMD},0,'{$PARAM}')"; - $Data['query'] = $QS ; - @$MEMDB = new SQLite_DB( '/dev/shm/argus/mem_db.db'); - $MEMDB->Query( $QS, false ); - $Data['operation_id'] = intval( $MEMDB->getLastInsertID() ); - } else { - $Data['msg']='Wrong Parameters'; + switch( $CCMD ){ + case 0:{ + // Default Op Mode ------> NCQ Commands + if( isset( $_POST['CMD'] ) ){ + $CMD = intval( $_POST['CMD'] ); + } else { + $CMD = 0; + }; + if( isset( $_POST['PARAM'] ) ){ + $PARAM = $DATABASE->escape( $_POST['PARAM'] ); + } else { + $PARAM = ''; + }; + if( $NodeID > 0 && $CMD > 0 ){ + $RBASE = new SQLite_DB( '/dev/shm/argus/mem_db.db'); + $Data['success'] = true; + $Data['status'] = 'ok'; + $QS = "INSERT INTO `nodes_qcq`(`node_id`,`cmd`,`status`,`parameter`) VALUES({$NodeID},{$CMD},0,'{$PARAM}')"; + $Data['query'] = $QS; + $RBASE->Query( $QS, false ); + $Data['operation_id'] = intval( $RBASE->getLastInsertID() ); + } else { + $Data['msg']='Wrong Parameters'; + }; + break; + }; + case 1:{ + // Add Sensor + if( isset( $_POST['SENSID'] ) ) { + $SensorID = intval($_POST['SENSID']); + } else $SensorID = 0; + $ETYP = intval( $_POST['TYPE'] ); + $EPROTOID = intval( $_POST['DEVID'] ); + $EUARTID = intval( $_POST['UART'] ); + $ERANGE = intval( $_POST['RANGE'] ); + if( $EUARTID ){ + $QS = "SELECT `id`, `device_id` FROM `lrf_sensors` WHERE `uart_id`={$EUARTID}"; + $RR = $DATABASE->Query( $QS ); + if( count( $RR ) ){ + if( $EPROTOID == 0 ){ + $Data['msg'] = 'Cannot Assign Protocol Device ID[0] on selected UART
Another devices already exists!
Device ID[0] May be set just in exclusive UART usage mode'; + } else { + foreach( $RR as $R ){ + if( $R['device_id'] == $EPROTOID ) { + $Data['msg'] = "On the selected UART line already exists sensor with selected Device ID[{$EPROTOID}]"; + }; + if( $R['device_id'] == 0 ){ + $Data['msg'] = "On the selected UART line already exists sensor with Device ID[0]
This UART can not be assigned to another sensor!"; + }; + }; + if( !isset( $Data['msg'] ) ){ + // All OK + $QS="INSERT INTO `lrf_sensors`(`type`,`data_status`,`uart_id`,`device_id`,`max_range`,`enabled_lrf`) VALUES({$ETYP},1,{$EUARTID},{$EPROTOID},{$ERANGE},255)"; + $DATABASE->Query( $QS ); + $SIID = $DATABASE->getLastInsertID(); + $NAME = 'SENSOR_'.$SIID; + $QS="INSERT INTO `nodes`(`type`,`aux_id`,`name`,`online`) VALUES({$ETYP},{$SIID},'{$NAME}',0)"; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok'; + }; + }; + } else { + // No device assigned with this UART + $QS="INSERT INTO `lrf_sensors`(`type`,`data_status`,`uart_id`,`device_id`,`max_range`,`enabled_lrf`) VALUES({$ETYP},1,{$EUARTID},{$EPROTOID},{$ERANGE},255)"; + $DATABASE->Query( $QS ); + $SIID = $DATABASE->getLastInsertID(); + $NAME = 'SENSOR_'.$SIID; + $QS="INSERT INTO `nodes`(`type`,`aux_id`,`name`,`online`) VALUES({$ETYP},{$SIID},'{$NAME}',0)"; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok'; + }; + } else { + $Data['msg'] = 'The UART Not Selected!'; + }; + break; + }; }; echo json_encode( $Data ); - exit(); - }; - header('location: /'); + } else { + header('location: /'); + }; ?> \ No newline at end of file diff --git a/lib/controller/getCameraEditor.php b/lib/controller/getCameraEditor.php index c193b8a..65a6fd3 100644 --- a/lib/controller/getCameraEditor.php +++ b/lib/controller/getCameraEditor.php @@ -57,7 +57,7 @@ $ATAB = 0; //v4l2-ctl -d /dev/video0 --stream-mmap --stream-count=1 --stream-to=output.jpg if( $CAM_IP ){ - $RESET_CREDENTIALS=<<GetLabel('_REMOVE_CAMERA_')}', handler: function(){ + Ext.Ajax.request({ + url: '/lib/controller/doCameraOperation.php', + params: { + UID: {$UserID}, + SID: '{$Session}', + CMD: 7, + CID: {$CID} + }, + success: function( response, opts ){ + var tData = Ext.decode(response.responseText); + if( tData.status == 'ok' ){ + loadAssignedCameras(); + } else { + Ext.Msg.show({ + title:'Error!', + msg: tData.msg, + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.ERROR + }); + }; + }, + failure: failureAJAXFunction + }); } } hhoiuyhetrkh; + }; $BBAR_BTN = $ADD_CAMERA; $TPL_SET_CREDS_IP=<<Query( $QS ); + $MODULE_DATA = $S[0]; + if( $Cam['status'] < 3 ){ + $FU = "/lib/controller/getCameraPreview.php?UID={$CUser->Data['id']}&SID={$Session}&FID="; + } else { + $FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='; + }; $TPL_CAM_EDITOR=<<' ); + if( tt!= undefined ){ + //tt.update( '
' ); + tt.update( '
' ); }; } } @@ -787,8 +823,7 @@ PZAKSJEJSDKGJHGASD; if( $CAM_IP ){ switch( $Cam['status'] ){ case 0: $Data['content'] = $TPL_SET_CREDS_IP; break; - case 1: $Data['content'] = $TPL_CAM_EDITOR; break; - case 2: $Data['content'] = $TPL_CAM_EDITOR; break; + default: $Data['content'] = $TPL_CAM_EDITOR; break; }; } else { $Data['content'] = $TPL_CAM_EDITOR; diff --git a/lib/controller/getCameraPreview.php b/lib/controller/getCameraPreview.php index e2f433c..dd885bc 100644 --- a/lib/controller/getCameraPreview.php +++ b/lib/controller/getCameraPreview.php @@ -22,7 +22,7 @@ $tmp = '/tmp/some_tmp_file_'.md5(time()).'.jpg'; $CMD_SET = "v4l2-ctl --device {$Result[0]['ip']} -set-fmt-video=width={$Result[0]['width']},height={$Result[0]['height'] },pixelformat=MJPG"; $A = `$CMD_SET`; - $CMD_GRAB = "ffmpeg -f video4linux2 -i {$Result[0]['ip']} -frames:v 3 -update 1 {$tmp}"; + $CMD_GRAB = "ffmpeg -f video4linux2 -i {$Result[0]['ip']} -frames:v 10 -update 1 -qscale:v 2 {$tmp}"; $B = `$CMD_GRAB`; if( file_exists( $tmp ) ){ $Data = file_get_contents( $tmp ); diff --git a/lib/controller/getDashBoardItems.php b/lib/controller/getDashBoardItems.php new file mode 100644 index 0000000..1bd317f --- /dev/null +++ b/lib/controller/getDashBoardItems.php @@ -0,0 +1,182 @@ +Data['id'] ); + $Data = ''; + if( $UID > 1 ){ + $QS = "SELECT * FROM `system_props` LIMIT 1"; + $SPD = $DATABASE->Query( $QS ); + if( count( $SPD ) ){ + $SP = $SPD[0]; + + $DUMM = array(); + $DUMM['camera']="{xtype:'panel',html:'NO CAMERA'}"; + $DUMM['sensor']="{xtype:'panel',html:'NO SENSOR'}"; + $DUMM['map']="{xtype:'panel',html:'NO MAP'}"; + $DUMM['log']="{xtype:'panel',html:'NO LOG'}"; + $STA = array(); + $END="]}"; + $STA[0]="{ columnWidth: 1, style:'padding:10px 0 10px 10px', items:["; + $STA[1]="{ columnWidth: 0.5, style:'padding:10px 0 10px 10px', items:["; + $STA[2]="{ columnWidth: 0.5, style:'padding:10px 0 10px 10px', items:["; + $STA[3]="{ columnWidth: 0.25, style:'padding:10px 0 10px 10px', items:["; + $STA[4]="{ columnWidth: 0.25, style:'padding:10px 0 10px 10px', items:["; + $STA[5]="{ columnWidth: 0.25, style:'padding:10px 0 10px 10px', items:["; + $STA[6]="{ columnWidth: 0.25, style:'padding:10px 0 10px 10px', items:["; + $MCOL = 7; + $P1="{ columnWidth: .25, style:'padding:10px 0 10px 10px', items:["; + $P2="]}"; + $QS = "SELECT * FROM nodes WHERE `type`> 0 "; + $result = $DATABASE->Query( $QS, false ); + if( count( $result ) > 0 ){ + $QS = "SELECT * FROM users_dash_layout WHERE user_id={$UID} ORDER BY x,y"; + $Lay = $DATABASE->Query( $QS, false ); + $AL = array(); + foreach( $Lay as $L ){ + $AL[$L['node_id']]=$L; + }; + $COLS = array(); + $Z = array(); + foreach( $result as $R ){ + if( isset( $AL[$R['id']] ) ){ + $COLS[intval($AL[$R['id']]['x'])][intval($AL[$R['id']]['y'])] = $R; + } else { + $Z[] = $R; + }; + }; + if( count( $Z ) ) foreach( $Z as $z ) $COLS[$MCOL-1][]=$z; + $STOL = array(); + for( $i=0; $i < $MCOL; $i++ ){ + $index = 0; + $TPL = array(); + $STOL[] = array(); + if( isset( $COLS[$i] ) ){ + foreach( $COLS[$i] as $R ){ + $TFN = 'dash/node_' . $R['type'] . '.js'; + if(!file_exists( $TFN )) continue; + $TPL[$index] = file_get_contents( $TFN ); + $TPL[$index] = str_replace('%%%NODEID%%%', ''.$R['id'] , $TPL[$index] ); + $TPL[$index] = str_replace('%%%NODENAME%%%', ''.$R['name'] , $TPL[$index] ); + switch( $R['type'] ){ + case ARGUS_SERVER:{ + $TPL[$index] = str_replace('%%%SYSSERVERNAME%%%', $Labels->getLabel( 'SYS_SERVNAME' ), $TPL[$index] ); + if( $R['online']== 1 ){ + $TPL[$index] = str_replace('%%%SERVERSTATUS%%%', $Labels->getLabel('SRV_STATUS_ON') , $TPL[$index]); + $TPL[$index] = str_replace('%%%SERVERSTATUSIMG%%%', 'accept.png' , $TPL[$index]); + } else { + $TPL[$index] = str_replace('%%%SERVERSTATUS%%%', $Labels->getLabel('SRV_STATUS_OFF') , $TPL[$index]); + $TPL[$index] = str_replace('%%%SERVERSTATUSIMG%%%', 'stop.png' , $TPL[$index]); + }; + $QS="SELECT * FROM `server_modules` WHERE `server_id`={$R['aux_id']}"; + $Z=$DATABASE->Query($QS); + $MODULES = array(); + if(count($Z)){ + foreach( $Z as $mod ){ + $QS="SELECT * FROM server_module_types WHERE id={$mod['type']}"; + $mtt=$DATABASE->Query( $QS ); + $CM['xtype'] = 'panel'; + if( $mod['enabled'] == 1 ){ + $CM['html'] = '

'.$Labels->getLabel( $mtt[0]['name'] ).'

'; + } else { + $CM['html'] = '

'.$Labels->getLabel( $mtt[0]['name'] ).'

'; + }; + $CM['height'] = 25; + $MODULES[] = $CM; + }; + $MODULES_CNT = json_encode( $MODULES ); + } else { + $MODULES_CNT = '[{ html: \'No Modules Defined\'}]'; + }; + $TPL[$index] = str_replace('%%%MODULES%%%', ''.$MODULES_CNT , $TPL[$index] ); + break; + }; + case ARGUS_LFS_SENSOR: + case ARGUS_PLS_200_SENSOR: + case ARGUS_PLS_360_SENSOR:{ + break; + }; + case ARGUS_3D_SENSOR:{ + break; + }; + case 10: + case 11: + case 12: + case ARGUS_IP_PTZ_CAMERA:{ + //$QS="SELECT * FROM cameras WHERE node_id={$R['id']}"; + $QS="SELECT * FROM `nodes` WHERE `id`={$R['id']}"; + $Z=$DATABASE->Query( $QS ); + $QS="SELECT * FROM `module_eve` WHERE `id`=1"; + $S=$DATABASE->Query( $QS ); + $MODULE_DATA = $S[0]; + $TPL[$index] = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL[$index] ); + $FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter']; + $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']'; + $TPL[$index] = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL[$index] ); + $TPL[$index] = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL[$index] ); + $TPL[$index] = str_replace( '%%%SELURL%%%', $FU, $TPL[$index] ); + $TPL[$index] = str_replace( '%%%STREAMID%%%', $R['aux_parameter'], $TPL[$index] ); + + $FK = $MODULE_DATA['height'] /$MODULE_DATA['width']; + $W = 244; + $H = $W * $FK; + + $TPL[$index] = str_replace( '%%%WIDTH%%%', $W, $TPL[$index] ); + $TPL[$index] = str_replace( '%%%HEIGHT%%%', $H, $TPL[$index] ); + /* + $QS="SELECT mss.*, ms.name, ms.img_width, ms.img_height FROM media_server_streams mss LEFT JOIN media_streams ms ON ( mss.media_stream_id = ms.id ) WHERE ms.source_id={$Z[0]['id']} AND mss.valid=1 AND mss.online=1"; + $S=$DATABASE->Query( $QS ); + + if( count( $S ) ){ + $CS = array(); + $FID = 0; + $FUL = ''; + foreach( $S as $sou ){ + $QS = "SELECT * FROM media_servers WHERE id = {$sou['media_server_id']}"; + $F = $DATABASE->Query( $QS ); + $FF=$F[0]; + if( $FF['ip']=='127.0.0.1'){ + //Localhost + $FF['ip'] = $_SERVER['SERVER_ADDR']; + }; + $ACC_URL='http://' . $FF['ip'] . ':' . $FF['REST_port']; + $CU = str_replace( $FF['virtual_host'], $ACC_URL, $sou['key'] ) . '/hls.m3u8'; + if( $FID == 0 ){ + // First URL as default + $FID = $sou['id']; + $FUL = $CU; + }; + $CS[] = '[' . $sou['id'] . ',\'[' . $sou['img_width'] . 'x' . $sou['img_height'] . '] '. $sou['name'].'\',\'' . $CU .'\']'; + }; + $TPL[$index] = str_replace( '%%%URLS%%%', '['. implode( ',', $CS ) . ']' , $TPL[$index] ); + $TPL[$index] = str_replace( '%%%SELID%%%', 'value: '. $FID .',', $TPL[$index] ); + $TPL[$index] = str_replace( '%%%SELURL%%%', $FUL, $TPL[$index] ); + } else { + // Handle No Video From Camera! + $TPL[$index] = str_replace( '%%%URLS%%%', '[]' , $TPL[$index] ); + $TPL[$index] = str_replace( '%%%SELID%%%', 'value: \'No Video Sources\',', $TPL[$index] ); + $TPL[$index] = str_replace( '%%%SELURL%%%','', $TPL[$index] ); + }; + */ + break; + }; + }; + $index++; + }; + }; + //if( $i == 0 ) $TPL[] = '{ id: \'db_node_22311232\', frame: false, colspan: 2, width: 516, height: 200, border: true, title: \'PIZDA\', items:[{ html: \'

Server

\'}]}'; + $STOL[$i] = $STA[$i] . implode( ',', $TPL ) . $END; + }; + //$STOL[] = "{ columnWidth: 0.5, style:'padding:10px 0 10px 10px', items:[]}"; + //$STOL[] = "{ columnWidth: 0.5, style:'padding:10px 0 10px 10px', items:[]}"; + //$STOL[] = "{ columnWidth: 1, style:'padding:10px 0 10px 10px', items:[]}"; + $Data = '[' . implode( ',' , $STOL ) . ']'; + }; + } else { + $Data = '[{columnWidth: 1, items:{html:"NO SYSTEM PROPS"}} ]'; + }; + }; + if( $Data != '' ) { + echo $Data; + } else { + echo '[]'; + }; +?> \ No newline at end of file diff --git a/lib/controller/getDashBoardStatus.php b/lib/controller/getDashBoardStatus.php new file mode 100644 index 0000000..decf5a3 --- /dev/null +++ b/lib/controller/getDashBoardStatus.php @@ -0,0 +1,59 @@ +Data['id'] > 1 ){ + $SiteID = intval( $_POST['SITE'] ); + $UID = intval( $CUser->Data['id'] ); + $Data = array(); + $Data['nodes'] = array(); + $QS = "SELECT * FROM nodes WHERE site_id = {$SiteID}"; + $result = $DATABASE->Query( $QS, false ); + if( count( $result ) > 0 ){ + foreach( $result as $R ){ + $CN = array(); + $CN['id'] = $R['id']; + $CN['status'] = intval($R['online']); + switch( $R['type'] ){ + case ARGUS_SERVER:{ + break; + }; + case ARGUS_ALS_SENSOR: + case ARGUS_LFS_SENSOR: + case ARGUS_PLS_200_SENSOR: + case ARGUS_PLS_360_SENSOR: + case ARGUS_NET_PLS_200:{ + if( $CN['status'] ){ + // check Targets + $CN['targets'] = array(); + $QS="SELECT * FROM events_cloud WHERE node_id={$CN['id']} AND ( evt_type=13 OR evt_type=14) ORDER BY id DESC LIMIT 32"; + //$QS="SELECT * FROM events_cloud WHERE node_id={$CN['id']} AND ( evt_type=13 OR evt_type=14) AND (UNIX_TIMESTAMP(NOW())-ts)<60 ORDER BY id DESC LIMIT 32"; + //$QS="SELECT * FROM events_cloud WHERE node_id={$CN['id']} AND ( evt_type=13 OR evt_type=14) ORDER BY ts, ts_ms DESC LIMIT 32"; + //echo $QS . "\n\n"; + $zult = $DATABASE->Query( $QS ); + if( count( $zult ) ){ + $CN['status'] = 2; // Alarmed + $CT = array(); + foreach( $zult as $Z ){ + $CT['digital'] = $Z['range_digital']; + $CT['az'] = $Z['azimuth']; + $CN['targets'][] = $CT; + }; + }; + }; + break; + }; + case ARGUS_3D_SENSOR:{ + break; + }; + case ARGUS_IP_PTZ_CAMERA:{ + break; + }; + }; + //$index++; + $Data['nodes'][] = $CN; + }; + }; + echo json_encode( $Data ); + } else { + echo '[]'; + }; +?> \ No newline at end of file diff --git a/lib/controller/zuza/getDeviceDraw.php b/lib/controller/getDeviceDraw.php similarity index 100% rename from lib/controller/zuza/getDeviceDraw.php rename to lib/controller/getDeviceDraw.php diff --git a/lib/controller/zuza/getDeviceMask.php b/lib/controller/getDeviceMask.php similarity index 100% rename from lib/controller/zuza/getDeviceMask.php rename to lib/controller/getDeviceMask.php diff --git a/lib/controller/zuza/getAnalogStreamCtrl.php b/lib/controller/getGrabberEritor.php similarity index 100% rename from lib/controller/zuza/getAnalogStreamCtrl.php rename to lib/controller/getGrabberEritor.php diff --git a/lib/controller/getResourceEditor.php b/lib/controller/getResourceEditor.php index 83d7a7a..3cd23da 100644 --- a/lib/controller/getResourceEditor.php +++ b/lib/controller/getResourceEditor.php @@ -173,6 +173,11 @@ END_TEMPLATE; return $TPL; }; + + + + + if( $CUser->Data['id'] > 1 ){ $EID = intval( $_POST['RID'] ); $QS = "SELECT * FROM resources WHERE id = {$EID}"; @@ -337,11 +342,220 @@ EFUFU; case 31: //Video In $R_name = 'Video Frame Grabber'; $R_dev = $CR['device']; - $QS="SELECT * FROM `media_streams` WHERE `id`={$CR['aux_id']}"; - $II = $DATABASE->Query( $QS ); - $CI = $II[0]; + $STREAM = $CR['aux_id']; + //$QS="SELECT * FROM `media_streams` WHERE `id`={$CR['aux_id']}"; + //$II = $DATABASE->Query( $QS ); + //$CI = $II[0]; $R_nfo = 'Frame Size: '.$CI['img_width'].'x'.$CI['img_height'].'
Driver: '.$CI['mrl_proto']; $R_image = 'RCA-Connector-Plug-icon.png'; + + $QS = "SELECT * FROM `media_streams` WHERE `id`={$STREAM}"; + $Result = $DATABASE->Query( $QS, false ); + if( count( $Result ) ){ + $CS = $Result[0]; + $R_nfo = 'Frame Size: '.$CS['img_width'].'x'.$CS['img_height'].'
Driver: '.$CS['mrl_proto']; + $R_image = 'RCA-Connector-Plug-icon.png'; + if( $CS['source_type'] == 'A' ){ + $Sizes = array(); + $Formats = array(); + //If Source not assigned or not active + if( $CS['source_id'] == 0 || $CR['active'] == 0 ){ + $CMD="v4l2-ctl -d {$CS['mrl']} --list-formats-ext"; + $Data = `$CMD`; + $TArr = explode( "\n", $Data ); + foreach( $TArr as $R ){ + $CL = trim( $R ); + if( stripos($CL,']:')!== false ){ + $ID = intval( substr( $CL, 1 ) ); + $FCC = substr( $CL, stripos( $CL, ':' ) + 3, 4 ); + $DSC = substr( $CL, stripos( $CL, ':' ) + 9 ); + $Formats[] = array('id'=>$ID, '4cc'=>$FCC, 'desc'=>$DSC ); + }; + if( stripos($CL,'Size:')!== false ){ + $TBarr=explode( ' ', $CL ); + if( intval( $TBarr[1] ) ){ + $ZArr = explode( 'x', $TBarr[1] ); + $Sizes[$TBarr[1]] = array( 'width'=>$ZArr[0], 'height'=>$ZArr[1], 'title'=>$TBarr[1] ); + } else { + $ZArr = explode( 'x', $TBarr[2] ); + $Sizes[$TBarr[2]] = array( 'width'=>$ZArr[0], 'height'=>$ZArr[1], 'title'=>$TBarr[2] ); + }; + }; + }; + }; + $CMD="v4l2-ctl -d {$CS['mrl']} --list-ctrls-menu"; + $Data = `$CMD`; + $TArr = explode( "\n", $Data ); + $Controls = array(); + $MFlag = false; + $MID = 0; + $id = 0; + foreach( $TArr as $R ){ + $CL = trim( $R ); + if( stripos( $CL, ':' ) !== false ){ + $ctrl = array(); + $RR = explode( ':', $CL ); + $TArr=explode( ' ', $CL ); + if( stripos( $CL, 'int' )!== false ){ + $ctrl['type'] = 'slider'; + $ctrl['name'] = trim( $TArr[0] ); + $ctrl['name_cod'] = md5( $ctrl['name'] ); + $ctrl['id'] = hexdec( $TArr[1] ); + + $TArr=explode( ' ', $RR[1] ); + $TBrr = explode( '=', $TArr[1] ); + $ctrl['min'] = intval( $TBrr[1] ); + $TBrr = explode( '=', $TArr[2] ); + $ctrl['max'] = intval( $TBrr[1] ); + $TBrr = explode( '=', $TArr[3] ); + $ctrl['step'] = intval( $TBrr[1] ); + $TBrr = explode( '=', $TArr[5] ); + $ctrl['value'] = intval( $TBrr[1] ); + $MFlag = false; + $Controls[$id] = $ctrl; + $id++; + } else if( stripos( $CL, 'bool' )!== false ){ + $ctrl['type'] = 'checkbox'; + $ctrl['name'] = trim( $TArr[0] ); + $ctrl['name_cod'] = md5( $ctrl['name'] ); + $ctrl['id'] = hexdec( $TArr[1] ); + $TArr=explode( ' ', $RR[1] ); + $TBrr = explode( '=', $TArr[2] ); + $ctrl['value'] = intval( $TBrr[1] ); + $MFlag = false; + $Controls[$id] = $ctrl; + $id++; + } else if( stripos( $CL, 'menu' )!== false ){ + $ctrl['type'] = 'combo'; + $ctrl['name'] = trim( $TArr[0] ); + $ctrl['name_cod'] = md5( $ctrl['name'] ); + $ctrl['id'] = hexdec( $TArr[1] ); + $TArr=explode( ' ', $RR[1] ); + $TBrr = explode( '=', $TArr[4] ); + $ctrl['value'] = intval( $TBrr[1] ); + $MFlag = true; + $MID = $id; + $Controls[$id] = $ctrl; + $id++; + } else { + if( $MFlag ){ + $ZV = explode( ':', $CL ); + $cmi= array(); + $cmi['id']=intval( $ZV[0] ); + $cmi['text']=trim( $ZV[1] ); + $Controls[$MID]['data'][]=$cmi; + }; + }; + }; + }; + $CCC = 0; + $OUT = array(); + if( count( $Formats ) ){ + $ll = "{ + xtype: 'combo', + fieldLabel: '". $Labels->GetLabel('_FRAME_FORMAT_') ."', + lazyRender: true, + id: 'frmt_id', + name: 'frame_format', + mode: 'local', + forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, + listeners:{ change: function(t,n,o){ changeASS( {$STREAM }, 'frmt_id'); }}, + store: new Ext.data.ArrayStore({ + fields: ['fmt','fmt_txt'], + data: ["; + $cl = array(); + foreach( $Formats as $F ){ + $cl[]="[{$F['id']},\"{$F['desc']}\"]"; + }; + $ll .= implode( ',', $cl ); + $ll .="] + }), + valueField: 'fmt', + displayField: 'fmt_txt' + }"; + $OUT[$CCC] = $ll; + $CCC++; + }; + if( count( $Sizes ) ){ + $ll = "{ + xtype: 'combo', + fieldLabel: '". $Labels->GetLabel('_FRAME_SIZE_') ."', + lazyRender: true, + id: 'sizes_id', + name: 'frame_size', + mode: 'local', + forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, + listeners:{ change: function(t,n,o){ changeASS( {$STREAM }, 'sizes_id'); }}, + store: new Ext.data.ArrayStore({ + fields: ['size','size_txt'], + data: ["; + $cl = array(); + $id = 0; + $csid = 0; + foreach( $Sizes as $Key=>$Val ){ + if( $Val['width'] == $CS['img_width'] && $Val['height'] == $CS['img_height'] ) $csid = $Key;//$id; + //$cl[]="[{$id},\"{$Key}\"]"; + $cl[]="[\"{$Key}\",\"{$Key}\"]"; + $id++; + }; + $ll .= implode( ',', $cl ); + $ll .="] + }), + valueField: 'size', + displayField: 'size_txt', + value: '{$csid}' + + }"; + $OUT[$CCC] = $ll; + $CCC++; + }; + //print_r( $Controls ); + if( count( $Controls )){ + foreach( $Controls as $CC ){ + $ll = "{ xtype: '{$CC['type']}', id: '{$CC['id']}', name: '{$CC['name']}', fieldLabel: '".$Labels->GetLabel($CC['name_cod'])."', value: {$CC['value']}, listeners:{ change: function(t,n,o){ changeASS( {$STREAM }, '{$CC['id']}' ); } }, "; + switch( $CC['type'] ){ + case 'slider':{ + $ll .= "minValue: {$CC['min']}, maxValue: {$CC['max']}, width: 235 }"; + break; + }; + case 'checkbox':{ + if( $CC['value'] == 1 ){ + $ll .= "checked: true }"; + } else { + $ll .= "checked: false }"; + }; + break; + }; + case 'combo':{ + $ll .= "lazyRender: true, mode: 'local', forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, store: new Ext.data.ArrayStore({ + fields: ['{$CC['id']}_id','{$CC['id']}_txt'], + data: ["; + $cl = array(); + foreach( $CC['data'] as $D ) $cl[]="[{$D['id']},\"{$D['text']}\"]"; + $ll .= implode(',', $cl ); + $ll .="] + }), + valueField: '{$CC['id']}_id', + displayField: '{$CC['id']}_txt' + }"; + break; + }; + }; + $OUT[$CCC] = $ll; + $CCC++; + }; + }; //https://www.waveshare.com/wiki/SIM7600E-H_4G_HAT + $CCA = implode( ',', $OUT ); + echo "{ xtype: 'form', id:'an_str_edit', frame: false, autoScroll: true, border: false, layout: 'form', labelAlign: 'right', labelWidth: 150, items: [". $CCA ."] }"; + } else { + echo "{ xtype: 'panel', html: '
Incorrect Stream
'}"; + }; + } else { + echo "{ xtype: 'panel', html: '
Incorrect Stream
'}"; + }; + + + break; case 101: // Ethernet $R_name = $Labels->GetLabel('_RES_ETHERNET_DESC_'); diff --git a/lib/controller/getSensors.php b/lib/controller/getSensors.php new file mode 100644 index 0000000..117f927 --- /dev/null +++ b/lib/controller/getSensors.php @@ -0,0 +1,32 @@ +Data['id'] ); + $ACCESS = intval( $CUser->Data['access'] ); + if( $UID > 1 ){ + $QS = "SELECT `sen`.*, `no`.`enable`, `no`.`name` FROM `lrf_sensors` `sen` LEFT JOIN `nodes` `no` ON( `no`.`aux_id`=`sen`.`id` AND `no`.`type`=`sen`.`type`)"; + $Result = $DATABASE->Query( $QS, false ); + if( count( $Result ) ){ + $SenPart = array(); + foreach( $Result as $R ){ + switch( $R['type'] ){ + case 1: $HWT = 'ALS ' . $R['max_range'] . ' meters'; break; + case 2: $HWT = 'LFS ' . $R['max_range'] . ' meters'; break; + case 3: $HWT = 'PLS200 ' . $R['max_range'] . ' meters'; break; + case 4: $HWT = 'PLS360 ' . $R['max_range'] . ' meters'; break; + }; + $SenPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \''.urldecode($R['name']).'['.$HWT.']\'}'; + }; + $Data['status']='ok'; + $Data['sensors'] = '['.implode( ',', $SenPart ) .']'; + } else { + $Data['status']='na'; + }; + $Data['messages'] = ob_get_clean(); + echo json_encode( $Data ); + } else { + header('location: /'); + }; + + +?> \ No newline at end of file diff --git a/lib/controller/zuza/getStatus.php b/lib/controller/getStatus.php similarity index 98% rename from lib/controller/zuza/getStatus.php rename to lib/controller/getStatus.php index 805d9c5..dd3b70d 100644 --- a/lib/controller/zuza/getStatus.php +++ b/lib/controller/getStatus.php @@ -28,6 +28,7 @@ if( $CN['status'] == 1 || $ServerIsOnLine ){ switch( $R['type'] ){ case ARGUS_SERVER:{ + /* $QS="SELECT * FROM `servers` WHERE `id`={$R['aux_id']}"; $zult = $DATABASE->Query( $QS ); if( $zult[0]['online'] == 1 ){ @@ -49,6 +50,7 @@ $CN['cpu15'] = intval( $zult[0]['stat_cpu15'] * 2.5 ); $CN['mem'] = intval( $zult[0]['stat_mem']*100 ); $CN['disk']= intval( $zult[0]['stat_disk']*100 ); + */ break; }; case ARGUS_ALS_SENSOR: @@ -162,7 +164,7 @@ $ST = $SR[0]; if( $ST['valid'] == 1 ){ $CN['valid'] = true; - $QS="SELECT * FROM `module_embed_video_settings` WHERE `id`=1"; + $QS="SELECT * FROM `module_eve` WHERE `id`=1"; $S=$DATABASE->Query( $QS ); $CN['src'] = 'http://' . $_SERVER['SERVER_ADDR'].':' . $S[0]['web_port'] .'/stream?id='. $R['aux_parameter']; break; diff --git a/lib/controller/zuza/setAnalogStreamCtrl.php b/lib/controller/setAnalogStreamCtrl.php similarity index 100% rename from lib/controller/zuza/setAnalogStreamCtrl.php rename to lib/controller/setAnalogStreamCtrl.php diff --git a/lib/controller/zuza/updateDashBoardItems.php b/lib/controller/updateDashBoardItems.php similarity index 61% rename from lib/controller/zuza/updateDashBoardItems.php rename to lib/controller/updateDashBoardItems.php index 9fbea42..740fb32 100644 --- a/lib/controller/zuza/updateDashBoardItems.php +++ b/lib/controller/updateDashBoardItems.php @@ -9,18 +9,18 @@ if( $NID > 0 ){ $COL = intval( $_POST['X'] ); $ROW = intval( $_POST['Y'] ); - $QS = "DELETE FROM users_dash_layout WHERE user_id={$UID} AND node_id={$NID}"; + $QS = "DELETE FROM `users_dash_layout` WHERE user_id={$UID} AND node_id={$NID}"; $DATABASE->Query( $QS, false ); - $QS = "SELECT * FROM users_dash_layout WHERE user_id={$UID} AND x={$COL}"; + $QS = "SELECT * FROM `users_dash_layout` WHERE user_id={$UID} AND x={$COL}"; $result = $DATABASE->Query( $QS, false ); foreach( $result as $R ){ if( $R['y'] >= $ROW ){ $R['y']++; - $QS = "UPDATE users_dash_layout SET y={$R['y']} WHERE id={$R['id']}"; + $QS = "UPDATE `users_dash_layout` SET y={$R['y']} WHERE id={$R['id']}"; $DATABASE->Query( $QS, false ); }; }; - $QS = "INSERT INTO users_dash_layout SET x={$COL}, y={$ROW}, node_id={$NID}, user_id={$UID}"; + $QS = "INSERT INTO `users_dash_layout`(`x`,`y`,`node_id`,`user_id`) VALUES({$COL},{$ROW},{$NID},{$UID})"; $DATABASE->Query( $QS, false ); }; }; diff --git a/lib/javascript/jsapi_dynamic/mojo_dashboard.js b/lib/javascript/jsapi_dynamic/mojo_dashboard.js new file mode 100644 index 0000000..7d027a6 --- /dev/null +++ b/lib/javascript/jsapi_dynamic/mojo_dashboard.js @@ -0,0 +1,1299 @@ +// + + + + +var serverToolBox = null; +var currentNodeID = 0; + + +//import * as THREE from 'three'; + +//let camera, scene, renderer; +var l3dMapOverlayTexture = new THREE.TextureLoader().load( '/lib/controller/data/assets/images/mask_3d.png' ); +var l3dMapOverlayMaterial = new THREE.MeshBasicMaterial( { map: l3dMapOverlayTexture, alphaTest: 0.7 } ); +var l3dMapOverlayGeometry = new THREE.SphereGeometry( 490, 60, 40 ); +// invert the geometry on the x-axis so that all of the faces point inward + l3dMapOverlayGeometry.scale( -1, 1, 1 ); +var l3dMapOverlayMesh = new THREE.Mesh( l3dMapOverlayGeometry, l3dMapOverlayMaterial ); + +function addl3dTarget( id, radius, az, el, color = 0xff0000 ){ + if( id > 0 ){ + var target = {}; + target.geometry = new THREE.BoxGeometry( 10, 10, 10 ); + //target.geometry = new THREE.OctahedronGeometry({ radius : 20 }); + //target.geometry.translate( x, y, z ); + + // Turn back into Cartesian coordinates + var fi = (Math.PI/2) - el; + var x = radius * Math.sin( fi) * Math.cos( az ); + var y = radius * Math.sin( fi ) * Math.sin( az ); + var z = radius * Math.cos( fi ); + + //alert( "Cords: "+x+" "+y+" "+z+" An:"+az+" "+el); + //target.geometry.position.set( x, y, z ); //translate( x, y, z ); + target.material = new THREE.MeshBasicMaterial( {color: color} ); + target.mesh = new THREE.Mesh( target.geometry, target.material ); + nodeTHREEviewers[id].scene.add( target.mesh ); + target.mesh.position.set( x, z, y ); + nodeTHREEviewers[id].targets.push( target ); + }; +}; + +function cleanup3DDraw( id ){ + if( typeof nodeTHREEviewers[id] !== 'undefined' ){ + if( typeof nodeTHREEviewers[id].targets !== 'undefined' ){ + for( var z=0; z < nodeTHREEviewers[id].targets.length; z++ ){ + nodeTHREEviewers[id].scene.remove( nodeTHREEviewers[id].targets[z].mesh ); + delete nodeTHREEviewers[id].targets[z].mesh; + delete nodeTHREEviewers[id].targets[z].material; + delete nodeTHREEviewers[id].targets[z].geometry; + delete nodeTHREEviewers[id].targets[z]; + }; + nodeTHREEviewers[id].targets = []; + //nodeTHREEviewers[id].renderer.render( nodeTHREEviewers[id].scene, nodeTHREEviewers[id].camera ); + }; + }; +}; + +function DrawClicker( id, event ){ + var x = event.offsetX-100; + var y = event.offsetY-100; + switch( drawZoomLevels[ id ] ){ + case 100:{ + var r = Math.round( 1024.0 / 98 * Math.sqrt( x*x + y*y ) ); + if( r > 1024 ) r = 1024; + break; + }; + case 50:{ + var r = Math.round( 512.0 / 98 * Math.sqrt( x*x + y*y ) ); + if( r > 512 ) r = 512; + break; + }; + case 25:{ + var r = Math.round( 256.0 / 98 * Math.sqrt( x*x + y*y ) ); + if( r > 256 ) r = 256; + break; + }; + case 12:{ + var r = Math.round( 128.0 / 98 * Math.sqrt( x*x + y*y ) ); + if( r > 128 ) r = 128; + break; + }; + default:{ + var r = -1; + break; + }; + }; + if( r > -1 ){ + var z = Math.round( -1.0 * Math.atan2(y, x) * 3000 / Math.PI ); + if( z < 0 ) z += 6000 ; + doDeviceOperation( id, 42, r+':'+z, true ); + }; +}; + +function Draw3DTargets( k, b ){ + cleanup3DDraw( k ); + for( var z = 0; z < b.length; z++ ){ + var az = b[z].az * ( Math.PI/180.0 ); + var el = b[z].el * ( Math.PI/180.0 ); + //addl3dTarget( k, b[z].range, az, el, b[z].color ); + addl3dTarget( k, 280, az, el, b[z].color ); + }; +}; + +let isUserInteracting = false, onPointerDownMouseX = 0, onPointerDownMouseY = 0, + lon = 0, onPointerDownLon = 0, + lat = 0, onPointerDownLat = 0, + phi = 0, theta = 0; + + function onWindowResize() { + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize( window.innerWidth, window.innerHeight ); + + }; + + function onPointerDown( event ) { + + if ( event.isPrimary === false ) return; + + isUserInteracting = true; + + onPointerDownMouseX = event.clientX; + onPointerDownMouseY = event.clientY; + + onPointerDownLon = lon; + onPointerDownLat = lat; + + document.addEventListener( 'pointermove', onPointerMove ); + document.addEventListener( 'pointerup', onPointerUp ); + + }; + + function onPointerMove( event ) { + + if ( event.isPrimary === false ) return; + + lon = ( onPointerDownMouseX - event.clientX ) * 0.1 + onPointerDownLon; + lat = ( event.clientY - onPointerDownMouseY ) * 0.1 + onPointerDownLat; + + }; + + function onPointerUp() { + + if ( event.isPrimary === false ) return; + + isUserInteracting = false; + + document.removeEventListener( 'pointermove', onPointerMove ); + document.removeEventListener( 'pointerup', onPointerUp ); + + }; + + function onDocumentMouseWheel( event ) { + var id = event.currentTarget.myVID; + if( id > 0 ){ + const fov = nodeTHREEviewers[id].camera.fov + event.deltaY * 0.05; + nodeTHREEviewers[id].camera.fov = THREE.MathUtils.clamp( fov, 10, 75 ); + nodeTHREEviewers[id].camera.updateProjectionMatrix(); + }; + }; + function reload3dTexture( id ){ + if( typeof nodeTHREEviewers[id] !== 'undefined' ){ + stopAnimation(); + //while( nodeTHREEviewers[id].scene.children.length > 0){ + // nodeTHREEviewers[id].scene.remove(nodeTHREEviewers[id].scene.children[0]); + //}; + nodeTHREEviewers[id].scene.remove( nodeTHREEviewers[id].mesh ); + //nodeTHREEviewers[id].mesh.geometry.dispose(); + //nodeTHREEviewers[id].mesh.material.dispose(); + delete nodeTHREEviewers[id].mesh; + delete nodeTHREEviewers[id].material; + delete nodeTHREEviewers[id].texture; + delete nodeTHREEviewers[id].geometry; + + nodeTHREEviewers[id].geometry = new THREE.SphereGeometry( 500, 60, 40 ); + nodeTHREEviewers[id].geometry.scale( -1, 1, 1 ); + nodeTHREEviewers[id].texture = new THREE.TextureLoader().load( '/lib/controller/getDeviceDraw.php?NID='+id ); + nodeTHREEviewers[id].material = new THREE.MeshBasicMaterial( { map: nodeTHREEviewers[id].texture } ); + nodeTHREEviewers[id].mesh = new THREE.Mesh( nodeTHREEviewers[id].geometry, nodeTHREEviewers[id].material ); + + nodeTHREEviewers[id].scene.add( nodeTHREEviewers[id].mesh ); + animate(); + //nodeTHREEviewers[id].material.map.needsUpdate = true; + //nodeTHREEviewers[id].material.needsUpdate = true + //alert( ' reloadded ' ); + }; + }; + function stopAnimation(){ + if( nodeTHREEanimationId > 0 ) cancelAnimationFrame( nodeTHREEanimationId ); + }; + function animate( ) { + if( nodeTHREEanimationId > 0 ) cancelAnimationFrame( nodeTHREEanimationId ); + nodeTHREEanimationId = requestAnimationFrame( animate ); + nodeTHREEviewers.forEach( function(element, index, array){ + if ( isUserInteracting === false ) { + + lon += 0.5; + + } + + lat = Math.max( - 85, Math.min( 85, lat ) ); + phi = THREE.MathUtils.degToRad( 90 - lat ); + theta = THREE.MathUtils.degToRad( lon ); + + const x = 500 * Math.sin( phi ) * Math.cos( theta ); + const y = 500 * Math.cos( phi ); + const z = 500 * Math.sin( phi ) * Math.sin( theta ); + + element.camera.lookAt( x, y, z ); + + element.renderer.render( element.scene, element.camera ); + }); + //update( id ); + }; + function animateTargets(){ + if( nodeTHREEanimationId > 0 ) cancelAnimationFrame( nodeTHREEanimationId ); + nodeTHREEanimationId = requestAnimationFrame( animateTargets ); + nodeTHREEviewers.forEach( function(element, index, array){ + if ( isUserInteracting === false ) { + + if( element.targetShowCopunter ){ + element.targetShowCopunter--; + } else { + element.camera.lookAt( element.targets[element.targetIndex].mesh.position ); + element.targetShowCopunter = 100; + element.renderer.render( element.scene, element.camera ); + element.targetIndex++; + if( element.targetIndex == element.targets.length ) element.targetIndex = 0; + }; + }; + }); + }; + function update() { + + if ( isUserInteracting === false ) { + + lon += 0.5; + + } + + lat = Math.max( - 85, Math.min( 85, lat ) ); + phi = THREE.MathUtils.degToRad( 90 - lat ); + theta = THREE.MathUtils.degToRad( lon ); + + const x = 500 * Math.sin( phi ) * Math.cos( theta ); + const y = 500 * Math.cos( phi ); + const z = 500 * Math.sin( phi ) * Math.sin( theta ); + + camera.lookAt( x, y, z ); + + renderer.render( scene, camera ); + + }; + + + +function Pie(cx, cy, radius, data) { + + var decimals = 4; + var total = 0; + var offset = 0; + var offset2; + var arr = []; + var x; + var y; + var la; + var radians; + + for (var i = 0; i < data.length; i++) + total += data[i].value; + + for (var i = 0; i < data.length; i++) { + + var item = data[i]; + var tmp = {}; + + tmp.index = i; + tmp.value = item.value; + radians = ((((item.value / total) * 360) * Math.PI) / 180).floor(decimals); + offset2 = ((offset / total) * 360).floor(decimals); + tmp.data = item; + + x = (cx + Math.sin(radians) * radius).floor(decimals); + y = (cy - Math.cos(radians) * radius).floor(decimals); + la = radians > Math.PI ? 1 : 0; + + // Arc + tmp.d = 'M{0} {1},L{0} {2},A{3} {3},0 {4} 1,{5} {6}Z'.format(cx, cy, cy - radius, radius, la, x, y); + tmp.transform = 'rotate({0}, {1}, {2})'.format(offset2, cx, cy); + + // Text + x = (cx + Math.sin(radians / 2) * radius / 2).floor(decimals); + y = (cy - Math.cos(radians / 2) * radius / 2).floor(decimals); + tmp.text = 'x="{0}" y="{1}" transform="rotate({2},{0},{1})"'.format(x, y, -offset2); + + offset += item.value; + arr.push(tmp); + } + + return arr; +} + +function Donut(cx, cy, radius, data) { + function arcradius(cx, cy, radius, degrees) { + var radians = (degrees - 90) * Math.PI / 180.0; + return { x: cx + (radius * Math.cos(radians)), y: cy + (radius * Math.sin(radians)) }; + } + + var decimals = 4; + var total = 0; + var arr = []; + var beg = 0; + var end = 0; + var count = 0; + + var half = radius / 2; + var midpoint = radius / 2.4; + + for (var i = 0; i < data.length; i++) + total += data[i].value; + + for (var i = 0; i < data.length; i++) { + var item = data[i]; + var tmp = {}; + + //var p = (((item.value + 1) / total) * 100).floor( 2 ); + var p = Math.floor(((item.value + 1) / total) * 100); + + count += p; + + if (i === length - 1 && count < 100) + p = p + (100 - count); + + end = beg + ((360 / 100) * p); + tmp.index = i; + tmp.value = item.value; + tmp.data = item; + + var b = arcradius(cx, cy, radius, end); + var e = arcradius(cx, cy, radius, beg); + var la = (end - beg) <= 180 ? 0 : 1; + + tmp.d = ['M', Math.floor( b.x ), Math.floor( b.y ), 'A', radius, radius, 0, la, 0, Math.floor( e.x ), Math.floor( e.y ) ].join(' '); + arr.push(tmp); + beg = end; + } + + return arr; +} + +//Pie Chart Usage +/* +var svg = $('#yoursvgelement'); +var data = [{ value: 33 }, { value: 20 }, { value: 80 }, { value: 48 }]; +var centerX = 300; +var centerY = 300; +var radius = 250; +var color = ['#F6BB42', '#8CC152', '#3BAFDA', '#967ADC', '#DA4453']; + +var arr = Pie(centerX, centerY, radius, data); +for (var i = 0; i < arr.length; i++) { + var item = arr[i]; + svg.asvg('{3}'.format(item.transform, item.d, item.text, item.value, color[i])); +} +*/ + +// Donut Chart Usage +/* +var svg = $('#yoursvgelement'); +var data = [{ value: 33 }, { value: 20 }, { value: 80 }, { value: 48 }]; +var centerX = 300; +var centerY = 300; +var radius = 250; +var color = ['#F6BB42', '#8CC152', '#3BAFDA', '#967ADC', '#DA4453']; + +var arr = Donut(centerX, centerY, radius, data); +for (var i = 0; i < arr.length; i++) { + var item = arr[i]; + svg.asvg(''.format(item.d, color[i])); +} +*/ + +function makePtzMove( me ){ + var name = me.target.id; + const myArray = name.split("_"); + Ext.Ajax.request({ + url: '/lib/controller/doCameraOperation.php', + params: { + UID: , + SID: '', + CMD: 8, + CID: myArray[3], + MOV: myArray[2] + }, + failure: failureAJAXFunction + }); +}; + +function ptzCtrl( a ){ + +}; + +function makePtzStop( me ){ + var name = me.target.id; + const myArray = name.split("_"); + Ext.Ajax.request({ + url: '/lib/controller/doCameraOperation.php', + params: { + SITE: , + UID: , + SID: '', + CMD: 8, + CID: myArray[3], + MOV: 0 + }, + failure: failureAJAXFunction + }); +}; + +function fullScreen( id = '' ){ + if( + id == '' || + document.fullscreenElement || + document.webkitFullscreenElement || + document.mozFullScreenElement || + document.msFullscreenElement + ){ + if( document.exitFullscreen ){ + document.exitFullscreen(); + }else if( document.mozCancelFullScreen ){ + document.mozCancelFullScreen(); + }else if( document.webkitExitFullscreen ){ + document.webkitExitFullscreen(); + }else if( document.msExitFullscreen ){ + document.msExitFullscreen(); + }; + }else{ + //element = $('#container').get(0); + var element = document.getElementById( id ); //Ext.getCmp( id ); + if( element.requestFullscreen ){ + element.requestFullscreen(); + }else if( element.mozRequestFullScreen ){ + element.mozRequestFullScreen(); + }else if( element.webkitRequestFullscreen ){ + element.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); + }else if( element.msRequestFullscreen ){ + element.msRequestFullscreen(); + }; + }; +}; + +function updateDashBoardItemLayout( id, x, y ){ + Ext.Ajax.request({ + url: '/lib/controller/updateDashBoardItems.php', + params: { + SITE: , + UID: , + SID: '', + PANEL: id, + X: x, + Y: y + }, + success: function( response, opts ){ + //var data = Ext.decode(response.responseText); + //var tPanel = Ext.getCmp('main_portal'); + //tPanel.removeAll(true); + //for( i=0; i < data.length; i++) tPanel.add( data[i] ); + //tPanel.doLayout(); + }, + failure: failureAJAXFunction + }); +}; + +var drawZoomLevels = Array(); + +function cleanup2DDraw( a ){ + var canvas = document.getElementById('targ_canvas_'+a ); + var img = document.getElementById('draw_img_'+a ); + if( canvas != 'undefined' ){ + canvas.style='display: block; cursor: crosshair;'; //cursor: auto; + img.style='display: none;'; + var ctx = canvas.getContext('2d'); + ctx.drawImage( img, 0, 0 ); + }; +}; + +function Draw2DTargets( k, b ){ + var canvas = document.getElementById('targ_canvas_'+k ); + var ctx = canvas.getContext('2d'); + var img = document.getElementById('draw_img_'+k ); + ctx.drawImage( img, 0, 0 ); + canvas.style='display: block;'; + img.style='display: none;'; + for( var i=0; i< b.length; i++ ){ + switch( drawZoomLevels[k] ){ + case 12:{ + if( b[i].digital < 256 ){ + var cc = 255 - i ;//* ( 255 / 33 ); + //ctx.fillStyle = "#" + cc.toString(16) + "0000"; + ctx.fillStyle = "rgba(255, 0, 0,"+((b.length - i)/ b.length )+")"; + //ctx.strokeStyle = "#FF0000"; + var r = (196 * b[i].digital)/ 512; + var a = -1.0 * b[i].az * ( Math.PI / 180 ); + var x = 100 + Math.cos( a ) * r; + var y = 100 + Math.sin( a ) * r; + ctx.fillRect( x, y, 24, 24 ); + }; + break; + }; + case 25:{ + if( b[i].digital < 512 ){ + var cc = 255 - i ;//* ( 255 / 33 ); + //ctx.fillStyle = "#" + cc.toString(16) + "0000"; + ctx.fillStyle = "rgba(255, 0, 0,"+((b.length - i)/ b.length )+")"; + //ctx.strokeStyle = "#FF0000"; + var r = (196 * b[i].digital)/ 1024; + var a = -1.0 * b[i].az * ( Math.PI / 180 ); + var x = 100 + Math.cos( a ) * r; + var y = 100 + Math.sin( a ) * r; + ctx.fillRect( x, y, 12, 12 ); + }; + break; + }; + case 50:{ + if( b[i].digital < 1024 ){ + var cc = 255 - i ;//* ( 255 / 33 ); + //ctx.fillStyle = "#" + cc.toString(16) + "0000"; + ctx.fillStyle = "rgba(255, 0, 0,"+((b.length - i)/ b.length )+")"; + //ctx.strokeStyle = "#FF0000"; + var r = (196 * b[i].digital) / 2048; + var a = -1.0 * b[i].az * ( Math.PI / 180 ); + var x = 100 + Math.cos( a ) * r; + var y = 100 + Math.sin( a ) * r; + ctx.fillRect( x, y, 6, 6 ); + }; + break; + }; + case 100:{ + var cc = 255 - i ;//* ( 255 / 33 ); + //ctx.fillStyle = "#" + cc.toString(16) + "0000"; + ctx.fillStyle = "rgba(255, 0, 0,"+((b.length - i)/ b.length )+")"; + //ctx.strokeStyle = "#FF0000"; + var r = (196 * b[i].digital)/ 4096; + var a = -1.0 * b[i].az * ( Math.PI / 180 ); + var x = 100 + Math.cos( a ) * r; + var y = 100 + Math.sin( a ) * r; + ctx.fillRect( x, y, 3, 3 ); + break; + }; + }; + }; +}; + +var lastNotificationID = 0; + +function setDonatStatus( node_id, param_id, value ){ + var val1D = document.getElementById('status_'+node_id+'_donut'+param_id+'_segment1'); + var val2D = document.getElementById('status_'+node_id+'_donut'+param_id+'_segment2'); + var val3D = document.getElementById('status_'+node_id+'_donut'+param_id+'_segment3'); + + var val1 = (value>-1)?value:0; + var val2 = (value>-1)?100 - val1:0;//data.nodes[i].cpu5 * 100; + var val3 = (value>-1)?0:100;//data.nodes[i].cpu15 * 100; + var totalValue = document.getElementById('status_'+node_id+'_totalValue'+param_id); + if( totalValue == undefined ) return; + var total = val1+val2+val3; + + var per1 = val1/total*100; + var per2 = val2/total*100; + var per3 = val3/total*100; + var offset = 25; + if( ( val1 != undefined ) && ( value > -1 ) ){ + totalValue.textContent = val1+'%'; + } else { + totalValue.textContent = 'No Data'; + }; + + val1D.style.transition = "stroke-dasharray 0.5s ease-in-out, stroke-dashoffset 0.5s ease-in-out"; + val1D.style.strokeDasharray = per1+" "+(100-per1); + val1D.style.strokeDashoffset = offset; + + val2D.style.transition = "stroke-dasharray 0.5s ease-in-out, stroke-dashoffset 0.5s ease-in-out"; + val2D.style.strokeDasharray = per2+" "+(100-per2); + val2D.style.strokeDashoffset = 100-per1+offset; + + val3D.style.transition = "stroke-dasharray 0.5s ease-in-out, stroke-dashoffset 0.5s ease-in-out"; + val3D.style.strokeDasharray = per3+" "+(100-per3); + val3D.style.strokeDashoffset = 100-(per1+per2)+offset; +}; + +function fetchSiteStatus(){ + Ext.Ajax.request({ + url: '/lib/controller/getStatus.php', + params: { + SITE: , + LNID: lastNotificationID, + SPID: StatusTS, + LOAT: LoadTS, + UID: , + SID: '' + }, + success: function( response, opts ){ + var data = Ext.decode(response.responseText); + StatusTS = data.CTS; + if( data.nodes.length > 0 ){ + for( i=0; i < data.nodes.length; i++ ){ + if( data.nodes[i].type == 0 ){ + //Handle Server Status + /*if ( data.nodes[i].status ){ + setDonatStatus( data.nodes[i].id, 0, data.nodes[i].cpu5 ); + setDonatStatus( data.nodes[i].id, 1, data.nodes[i].mem ); + setDonatStatus( data.nodes[i].id, 2, data.nodes[i].disk ); + document.getElementById('status_'+data.nodes[i].id+'_txt').innerHTML="Server is Online"; + document.getElementById('status_'+data.nodes[i].id+'_img').src = "/style/icons/icons/accept.png"; + } else { + setDonatStatus( data.nodes[i].id, 0, -1 ); + setDonatStatus( data.nodes[i].id, 1, -1 ); + setDonatStatus( data.nodes[i].id, 2, -1 ); + document.getElementById('status_'+data.nodes[i].id+'_txt').innerHTML="Server is Offline"; + document.getElementById('status_'+data.nodes[i].id+'_img').src = "/style/icons/icons/stop.png"; + };*/ + }; + // Sesors + if( data.nodes[i].type > 0 && data.nodes[i].type < 7 ){ + if( data.nodes[i].reload_draw ){ + reload3dTexture( data.nodes[i].id ); + LoadTS = StatusTS; + }; + }; + // Cameras + if( data.nodes[i].type > 9 && data.nodes[i].type < 14 ){ + var iel = document.getElementById('img-'+data.nodes[i].id ); + if( iel != null ){ + if( !data.nodes[i].valid ){ + if( iel.src != "/style/assets/no-signal.png" ) iel.src = "/style/assets/no-signal.png"; + } else { + if( data.nodes[i].src != iel.src ) iel.src = data.nodes[i].src; + }; + + }; + }; + var tt = Ext.getCmp('status_'+data.nodes[i].id ); + if( tt != undefined ){ + if( data.nodes[i].type < 5 && data.nodes[i].type > 0 ){ + if( data.nodes[i].status == 4 ){ + Draw2DTargets( data.nodes[i].id, data.nodes[i].targets ); + } else { + cleanup2DDraw( data.nodes[i].id ); + }; + }; + if( data.nodes[i].type == 5 ){//addl3dTarget( id, radius, az, el, color = 0xff0000 ) + if( data.nodes[i].status == 4 ){ + //DrawTargets( data.nodes[i].id, data.nodes[i].targets ); + //addl3dTarget( data.nodes[i].id, data.nodes[i].targets[0].digital, data.nodes[i].targets[0].az, data.nodes[i].targets[0].el ); + //addl3dTarget( data.nodes[i].id, 150, data.nodes[i].targets[0].az, data.nodes[i].targets[0].el ); + Draw3DTargets( data.nodes[i].id, data.nodes[i].targets ); + animateTargets(); + } else { + cleanup3DDraw( data.nodes[i].id ); + animate(); + }; + var ca = document.getElementById( 'status_canvas_' + data.nodes[i].id ); + var ctx = ca.getContext('2d'); + //if( stat_present ); + ca.style='display: block;'; + ctx.font = "10px Arial"; + ctx.fillStyle = "rgba(255, 255, 255, 255)"; + ctx.fillText( "Master:", 5, 8 ); + ctx.fillText( "Slave:", 5, 24 ); + //var cc = 255 - i ;//* ( 255 / 33 ); + //ctx.fillStyle = "#" + cc.toString(16) + "0000"; + //ctx.fillStyle = "rgba(255, 0, 0, 100)";//+((b.length - i)/ b.length )+")"; + if( data.nodes[i].master_present ){ + ctx.fillStyle = "rgba(0, 255, 0, 255)"; + } else { + ctx.fillStyle = "rgba(128, 0, 0, 255)"; + }; + ctx.fillRect( 43, 1, 8, 8 ); + if( data.nodes[i].stat_present ){ + ctx.strokeStyle = "#FFFF00"; + ctx.strokeRect( 43, 1, 8, 8 ); + ctx.beginPath(); + ctx.moveTo( 51, 5 ); + ctx.lineTo( 56, 5 ); + ctx.lineTo( 56, 2 ); + ctx.lineTo( 103, 2 ); + ctx.lineTo( 103, 5 ); + ctx.moveTo( 63, 5 ); + ctx.lineTo( 143, 5 ); + ctx.stroke(); + for( z=0; z < 8; z++ ){ + //ctx.strokeStyle = "#FFFF00"; + //ctx.fillStyle = "rgba(0, 255, 0, 255)"; + ctx.fillStyle = "rgba(20, 20, 20, 255)"; + h = 19 - ( 19 * data.nodes[i].runtime.mp[z] ); + ha = 19 - h; + ctx.fillRect( 64 + z*10, 7, 2, h ); + if( ha > 0 ) { + if( data.nodes[i].runtime.mp[z] > 0.8 ){ + ctx.fillStyle = "rgba(0, 255, 0, 255)"; + } else if ( data.nodes[i].runtime.mp[z] > 0.5 ){ + ctx.fillStyle = "rgba( 255, 255, 0, 255)"; + } else if ( data.nodes[i].runtime.mp[z] > 0.3 ){ + ctx.fillStyle = "rgba( 255, 128, 0, 255)"; + } else { + ctx.fillStyle = "rgba( 255, 0, 0, 255)"; + }; + ctx.fillRect( 64 + z*10, 7+h, 2, ha ); + }; + ctx.fillStyle = "rgba(20, 20, 20, 255)"; + h = 19 - ( 19 * data.nodes[i].runtime.gp[z] ); + ha = 19 - h; + ctx.fillRect( 67 + z*10, 7, 2, h ); + if( ha > 0 ) { + if( data.nodes[i].runtime.gp[z] > 0.8 ){ + ctx.fillStyle = "rgba(0, 255, 0, 255)"; + } else if ( data.nodes[i].runtime.gp[z] > 0.5 ){ + ctx.fillStyle = "rgba( 255, 255, 0, 255)"; + } else if ( data.nodes[i].runtime.gp[z] > 0.3 ){ + ctx.fillStyle = "rgba( 255, 128, 0, 255)"; + } else { + ctx.fillStyle = "rgba( 255, 0, 0, 255)"; + }; + ctx.fillRect( 67 + z*10, 7+h, 2, ha ); + }; + ctx.fillStyle = "rgba(20, 20, 20, 255)"; + h = 19 - ( 19 * data.nodes[i].runtime.wp[z] ); + ha = 19 - h; + ctx.fillRect( 70 + z*10, 7, 2, h ); + if( ha > 0 ){ + if( data.nodes[i].runtime.wp[z] > 0.8 ){ + ctx.fillStyle = "rgba(0, 255, 0, 255)"; + } else if ( data.nodes[i].runtime.wp[z] > 0.5 ){ + ctx.fillStyle = "rgba( 255, 255, 0, 255)"; + } else if ( data.nodes[i].runtime.wp[z] > 0.3 ){ + ctx.fillStyle = "rgba( 255, 128, 0, 255)"; + } else { + ctx.fillStyle = "rgba( 255, 0, 0, 255)"; + }; + ctx.fillRect( 70 + z*10, 7+h, 2, ha ); + }; + }; + //ffmpeg -f v4l2 -framerate -thread_queue_size 512 -i -f alsa -thread_queue_size 512 -i -t -c:v h264 -c:a aac -pix_fmt yuv420p + } else { + ctx.strokeStyle = "#808080"; + ctx.strokeRect( 43, 1, 8, 8 ); + ctx.beginPath(); + ctx.moveTo( 51, 5 ); + ctx.lineTo( 56, 5 ); + ctx.lineTo( 56, 2 ); + ctx.lineTo( 103, 2 ); + ctx.lineTo( 103, 5 ); + ctx.moveTo( 63, 5 ); + ctx.lineTo( 143, 5 ); + ctx.stroke(); + ctx.fillStyle = "rgba( 128, 0, 0, 255)"; + for( z=0; z < 8; z++ ){ + ctx.fillRect( 64 + z*10, 7, 2, 19 ); + ctx.fillRect( 67 + z*10, 7, 2, 19 ); + ctx.fillRect( 70 + z*10, 7, 2, 19 ); + //https://www.ebay.com/itm/304440983138 + }; + }; + if( data.nodes[i].slave_present ){ + ctx.strokeStyle = "#FFFF00"; + ctx.fillStyle = "rgba(0, 255, 0, 255)"; + } else { + ctx.strokeStyle = "#808080"; + ctx.fillStyle = "rgba(128, 0, 0, 255)"; + }; + ctx.fillRect( 43, 17, 8, 8 ); + ctx.strokeRect( 43, 17, 8, 8 ); + + ctx.beginPath(); + ctx.moveTo( 51, 21 ); + ctx.lineTo( 56, 21 ); + ctx.lineTo( 56, 31 ); + ctx.lineTo( 187, 31 ); + ctx.lineTo( 187, 28 ); + ctx.moveTo( 147, 28 ); + ctx.lineTo( 227, 28 ); + ctx.stroke(); + for( z=8; z < 16; z++ ){ + //ctx.strokeStyle = "#FFFF00"; + //ctx.fillStyle = "rgba(0, 255, 0, 255)"; + ctx.fillRect( 68 + z*10, 7, 2, 19 ); + ctx.fillRect( 71 + z*10, 7, 2, 19 ); + ctx.fillRect( 74 + z*10, 7, 2, 19 ); + //ctx.strokeRect( 43, 1, 8, 8 ); + }; + }; + if( typeof nodeDashboardStatuses[i] === 'undefined' || nodeDashboardStatuses[i] != data.nodes[i].status ){ + nodeDashboardStatuses[i] = data.nodes[i].status; + switch( data.nodes[i].status ){ + case 0:{ + if( data.nodes[i].type == 3 ) cleanup2DDraw( data.nodes[i].id ); + tt.update('
Offline
'); + break; + }; + case 1:{ + if( data.nodes[i].type == 3 ) cleanup2DDraw( data.nodes[i].id ); + tt.update('
Online
'); + break; + }; + case 2:{ + if( data.nodes[i].type == 3 ) cleanup2DDraw( data.nodes[i].id ); + tt.update('
Initializing
'); + break; + }; + case 3:{ + if( data.nodes[i].type == 3 ) cleanup2DDraw( data.nodes[i].id ); + tt.update('
Trouble
'); + break; + }; + case 4:{ + if( data.nodes[i].type == 3 ) cleanup2DDraw( data.nodes[i].id, data.nodes[i].targets ); + tt.update('
Alarm
'); + break; + }; + + }; + }; + }; + }; + }; + if( data.notifications.length > 0 ){ + sndExcl.play(); + for( i=0; i < data.notifications.length; i++ ){ + /*const not = PNotify.alert({ + title: 'You Will Receive a Side', + text: 'You have no choice.', + icon: 'fas fa-info-circle', + hide: false, + closer: false, + sticker: false, + destroy: true, + modules: new Map([ + ...PNotify.defaultModules, + [PNotifyConfirm, { + confirm: true, + buttons: [{ + text: 'Ok', + primary: true, + click: notice => notice.close() + }] + }] + ]) + }); + */ + const l = PNotify.alert({ + type: data.notifications[i].type, + text: data.notifications[i].msg, + textTrusted: true, + stack: NotificationStack, + title: data.notifications[i].action, + hide: data.notifications[i].hide, + closer: data.notifications[i].hide, + sticker: data.notifications[i].hide, + destroy: true, + modules: (data.notifications[i].react )? new Map([ + ...PNotify.defaultModules, + [PNotifyConfirm, { + confirm: true, + buttons: [{ + text: 'Ok', + primary: true, + click: ( notice, value, evt ) => { + notice.close(); + if( notice.title!='' ){ + resolveDeviceMistmatch( notice.title ); + }; + } + }] + }] + ]): null + }); + /* + if( data.notifications[i].react ){ + l.on('click', (notice, value) => { + notice.close(); + resolveDeviceMistmatch( notice.title ); + }); + }; + */ + lastNotificationID = data.notifications[i].id; + }; + }; + }, + failure: failureAJAXFunction + }); +}; + +function loadDashBoard(){ + if( tlInterval!= null ){ + window.clearInterval( tlInterval ); + tlInterval = null; + timelineObj = null; + }; + setUserContent( 0 ); + Ext.Ajax.request({ + url: '/lib/controller/getDashBoardItems.php', + params: { + SITE: , + UID: , + SID: '' + }, + success: function( response, opts ){ + var data = Ext.decode(response.responseText); + Ext.getCmp('main_content').setTitle( 'GetLabel('_SYS_DASHBOARD_');?>' ); + var tPanel = Ext.getCmp('main_portal'); + tPanel.removeAll(true); + nodeDashboardStatuses = new Array(); + for( i=0; i < data.length; i++) tPanel.add( data[i] ); + tPanel.doLayout(); + $('img[data-enlargeable]').addClass('img-enlargeable').click(function() { + var src = $(this).attr('src'); + var modal; + + function removeModal() { + modal.remove(); + $('body').off('keyup.modal-close'); + } + modal = $('
').css({ + background: 'RGBA(0,0,0,.5) url(' + src + ') no-repeat center', + backgroundSize: 'contain', + width: '100%', + height: '100%', + position: 'fixed', + zIndex: '10000', + top: '0', + left: '0', + cursor: 'zoom-out' + }).click(function() { + removeModal(); + }).appendTo('body'); + //handling ESC + $('body').on('keyup.modal-close', function(e) { + if (e.key === 'Escape') { + removeModal(); + } + }); + }); + tlInterval = window.setInterval( fetchSiteStatus, 333, selectedSite ); + }, + failure: failureAJAXFunction + }); +}; + +function showServerToolBox( ServerNodeId ){ + currentNodeID = ServerNodeId; + if( serverToolBox == null ){ + serverToolBox = new Ext.Window({ + title: 'GetLabel('_SERV_CTLPANEL_SHRT_');?>', + modal: true, + width: 400, + height: 328, + closeAction: 'hide', + items:[{ + xtype: 'button', + text: 'Restart', + width: '100%', + textAlign: 'left', + iconCls: 'server_btn_restart', + scale: 'large', + iconAlign: 'left', + handler: function(){ + doDeviceOperation( currentNodeID, 250,'', true ); + } + },{ + xtype: 'button', + text: 'Initialize Hardware', + width: '100%', + textAlign: 'left', + iconCls: 'server_btn_hwinit', + scale: 'large', + iconAlign: 'left', + handler: function(){ + doDeviceOperation( currentNodeID, 251,'', true ); + } + },{ + xtype: 'button', + text: 'Sync Time With Browser', + width: '100%', + textAlign: 'left', + iconCls: 'server_btn_timeinit', + scale: 'large', + iconAlign: 'left', + handler: function(){ + doDeviceOperation( currentNodeID, 252, ((new Date())/1000), true ); + } + }] + }); + }; + serverToolBox.show(); +}; + +var detectionProfileWindow = null; +var deviceCtrlNode = ''; +function showSensorToolBox( NodeID ){ + currentNodeID = NodeID; + deviceCtrlNode = NodeID + ':0'; + if( detectionProfileWindow == null ){ + detectionProfileWindow = new Ext.Window({ + title: 'GetLabel('_DEV_CTLPANEL_SHRT_');?>', + modal: true, + width: 340, + height: 328, + autoScroll: 'auto', + closeAction: 'hide', + resizable: false, + items:[{ + xtype: 'panel', + title: 'GetLabel('_SPEC_FUNCTI_');?>', + height: 95, + id: 'sf_panel', + frame: true, + flex: 1, + layout: 'vbox', + hidden: true, + items:[{ + xtype: 'button', + text: 'Resolve Trouble', + width: '100%', + iconCls: 'ctrl_panel_cog', + scale: 'large', + iconAlign: 'left', + handler: function(){ + detectionProfileWindow.hide(); + resolveDeviceMistmatch( deviceCtrlNode ); + } + }] + },{ + xtype: 'panel', + title: 'GetLabel('_DET_GENWORKS_');?>', + height: 193, + frame: true, + flex: 1, + layout: 'vbox', + items:[{ + xtype: 'button', + width: '100%', + text: 'Clear Alarm', + scale: 'large', + iconCls: 'ctrl_panel_clean', + iconAlign: 'left', + handler: function(){ + clearDeviceEvents( deviceCtrlNode ); + } + },{ + xtype: 'button', + width: '100%', + text: 'Draw Background', + scale: 'large', + iconCls: 'ctrl_panel_drawscan', + iconAlign: 'left', + handler: function(){ + doDeviceOperation( deviceCtrlNode, 3 ); + } + },{ + xtype: 'button', + width: '100%', + text: 'Force Study Background', + scale: 'large', + iconCls: 'ctrl_panel_study', + iconAlign: 'left', + handler: function(){ + doDeviceOperation( deviceCtrlNode, 2 ); + } + },{ + xtype: 'button', + width: '100%', + buttonAlign: 'left', + //text: '
Button 1
', + text: 'Force Reset Sensor', + scale: 'large', + iconCls: 'ctrl_panel_reset', + iconAlign: 'left', + handler: function(){ + doDeviceOperation( deviceCtrlNode, 1 ); + } + }] + },{ + xtype: 'panel', + title: 'Zone Masking Management', + height: 140, + frame: true, + flex: 1, + layout: 'vbox', + items:[{ + xtype: 'button', + text: 'Mask Editor', + id: 'DMED', + width: '100%', + handler: function(){ + showMaskEditor( true, 0, deviceCtrlNode ); + } + },{ + xtype: 'spacer', + height: 6 + },{ + xtype: 'panel', + frame: false, + border: false, + flex: 1, + width: '100%', + height: 40, + layout: 'hbox', + items:[{ + xtype: 'button', + enableToggle: true, + width: '20%', + scale: 'large', + id: 'mz_btn_0', + iconCls: 'mask_zone1_btn', + iconAlign: 'top', + pressed: false, + disabled: true, + handler: function(){ + Ext.getCmp('MAPPLY').enable(); + } + },{ + xtype: 'button', + enableToggle: true, + width: '20%', + scale: 'large', + id: 'mz_btn_1', + iconCls: 'mask_zone2_btn', + iconAlign: 'top', + pressed: false, + disabled: true, + handler: function(){ + Ext.getCmp('MAPPLY').enable(); + } + },{ + xtype: 'button', + enableToggle: true, + width: '20%', + scale: 'large', + id: 'mz_btn_2', + iconCls: 'mask_zone3_btn', + iconAlign: 'top', + pressed: false, + disabled: true, + handler: function(){ + Ext.getCmp('MAPPLY').enable(); + } + },{ + xtype: 'button', + enableToggle: true, + width: '20%', + scale: 'large', + id: 'mz_btn_3', + iconCls: 'mask_zone4_btn', + iconAlign: 'top', + pressed: false, + disabled: true, + handler: function(){ + Ext.getCmp('MAPPLY').enable(); + } + },{ + xtype: 'button', + enableToggle: true, + width: '20%', + scale: 'large', + id: 'mz_btn_4', + iconCls: 'mask_zone5_btn', + iconAlign: 'top', + pressed: false, + disabled: true, + handler: function(){ + Ext.getCmp('MAPPLY').enable(); + } + }] + },{ + xtype: 'spacer', + height: 6 + },{ + xtype: 'button', + text: 'Apply Zone Masks', + id: 'MAPPLY', + disabled: true, + width: '100%', + handler: function(){ + + } + }] + },{ + xtype: 'panel', + title: 'GetLabel('_DET_SENSITIVITY_');?>', + height: 95, + frame: true, + flex: 1, + layout: 'hbox', + items:[Data['access']>4 ){ + ?>{ + xtype: 'button', + text: 'Factory', + id: 'DDSPBTN0', + width: 80, + iconCls: 'detection_btn_factory', + enableToggle: true, + toggleGroup: 'det_sens_btn_grp', + disabled: true, + scale: 'large', + iconAlign: 'top' + },{ + xtype: 'button', + text: 'Low', + id: 'DDSPBTN1', + width: 80, + iconCls: 'detection_btn_low', + enableToggle: true, + toggleGroup: 'det_sens_btn_grp', + disabled: true, + scale: 'large', + iconAlign: 'top' + },{ + xtype: 'button', + text: 'Meduim', + id: 'DDSPBTN2', + width: 80, + iconCls: 'detection_btn_medium', + enableToggle: true, + toggleGroup: 'det_sens_btn_grp', + disabled: true, + scale: 'large', + iconAlign: 'top' + },{ + xtype: 'button', + text: 'High', + id: 'DDSPBTN3', + width: 80, + iconCls: 'detection_btn_high', + enableToggle: true, + toggleGroup: 'det_sens_btn_grp', + disabled: true, + scale: 'large', + iconAlign: 'top' + }] + }] + }); + }; + detectionProfileWindow.show(); + var myMask = new Ext.LoadMask( detectionProfileWindow.getEl(), {msg:"Please wait..."}); + myMask.show(); + + Ext.Ajax.request({ + url: '/lib/controller/getDetectionProfile.php', + params: { + SITE: SelectedSite, + UID: , + SID: '', + NID: NodeID + }, + success: function( response, opts ){ + var data = Ext.decode( response.responseText ); + myMask.hide(); + detectionProfileWindow.setTitle( '['+data.name + '] GetLabel('_DEV_CTLPANEL_SHRT_');?>'); + if(data.masks_array != 'undefined' ){ + for( i = 0; i < 5; i++ ){ + var cE = Ext.getCmp('mz_btn_'+i ); + if( data.masks_array[i]=='E'){ + cE.enable(); + cE.toggle( true, true ); + } else { + cE.toggle( false, true ); + if( data.masks_array[i]=='D' ){ + cE.enable(); + } else { + cE.disable(); + }; + }; + }; + }; + if( data.data_status == 3 ){ + if( data.profiles.length > 1 ){ + for( i=0; i < data.profiles.length; i++ ){ + Ext.getCmp('DDSPBTN'+i ).enable(); + if( i == data.profile_id ) Ext.getCmp('DDSPBTN'+i ).toggle( true, false ); + }; + } else { + Ext.getCmp('DDSPBTN0').toggle( true, false ); + Ext.getCmp('DDSPBTN0').disable(); + }; + } else if( data.data_status == 4 ){ + Ext.getCmp('sf_panel').show(); + }; + detectionProfileWindow.doLayout(); + }, + failure: failureAJAXFunction + }); +}; + diff --git a/lib/javascript/jsapi_dynamic/mojo_monitoring.js b/lib/javascript/jsapi_dynamic/mojo_monitoring.js index 299a62e..5a23cbb 100644 --- a/lib/javascript/jsapi_dynamic/mojo_monitoring.js +++ b/lib/javascript/jsapi_dynamic/mojo_monitoring.js @@ -1,12 +1,101 @@ // +function updateDashBoardItemLayout( id, x, y ){ + Ext.Ajax.request({ + url: '/lib/controller/updateDashBoardItems.php', + params: { + SITE: , + UID: , + SID: '', + PANEL: id, + X: x, + Y: y + }, + success: function( response, opts ){ + //var data = Ext.decode(response.responseText); + //var tPanel = Ext.getCmp('main_portal'); + //tPanel.removeAll(true); + //for( i=0; i < data.length; i++) tPanel.add( data[i] ); + //tPanel.doLayout(); + }, + failure: failureAJAXFunction + }); +}; + function initMonitoring(){ if( tlInterval!= null ){ window.clearInterval( tlInterval ); tlInterval = null; timelineObj = null; }; - var tPanel = Ext.getCmp('main_content'); - tPanel.removeAll( true ); - tPanel.doLayout(); + Ext.Ajax.request({ + url: '/lib/controller/getDashBoardItems.php', + params: { + SITE: , + UID: , + SID: '' + }, + success: function( response, opts ){ + var data = Ext.decode(response.responseText); + Ext.getCmp('main_content').setTitle( 'GetLabel('_SYS_DASHBOARD_');?>' ); + Ext.getCmp('main_content').removeAll(true); + Ext.getCmp('main_content').add({ + xtype: 'portal', + id: 'main_portal', + frame: false, + border: false, + items:{ + html: '' + }, + listeners:{ + drop: function( a ){ + updateDashBoardItemLayout( a.panel.id, a.columnIndex, a.position ); + } + } + }); + Ext.getCmp('main_content').doLayout(); + var tPanel = Ext.getCmp('main_portal'); + tPanel.removeAll(true); + nodeDashboardStatuses = new Array(); + for( i=0; i < data.length; i++) tPanel.add( data[i] ); + tPanel.doLayout(); + $('img[data-enlargeable]').addClass('img-enlargeable').click(function() { + var src = $(this).attr('src'); + var modal; + + function removeModal() { + modal.remove(); + $('body').off('keyup.modal-close'); + } + modal = $('
').css({ + background: 'RGBA(0,0,0,.5) url(' + src + ') no-repeat center', + backgroundSize: 'contain', + width: '100%', + height: '100%', + position: 'fixed', + zIndex: '10000', + top: '0', + left: '0', + cursor: 'zoom-out' + }).click(function() { + removeModal(); + }).appendTo('body'); + //handling ESC + $('body').on('keyup.modal-close', function(e) { + if (e.key === 'Escape') { + removeModal(); + } + }); + }); + tlInterval = window.setInterval( fetchSiteStatus, 333, selectedSite ); + }, + failure: failureAJAXFunction + }); + //var tPanel = Ext.getCmp('main_content'); + //tPanel.removeAll( true ); + //tPanel.add({ + // xtype: 'panel', + // html: 'KOKO' + //}); + //tPanel.doLayout(); }; \ No newline at end of file diff --git a/lib/javascript/jsapi_dynamic/mojo_settings.js b/lib/javascript/jsapi_dynamic/mojo_settings.js index f8340e0..3c6a0d0 100644 --- a/lib/javascript/jsapi_dynamic/mojo_settings.js +++ b/lib/javascript/jsapi_dynamic/mojo_settings.js @@ -93,13 +93,17 @@ function loadDetectedCameras(){ tPanel.removeAll( true ); tPanel.add( res ); tPanel.doLayout(); + var zPanel = Ext.getCmp('dcam_op_small'); + zPanel.removeAll( true ); + zPanel.add( { html:'
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
' } ); + zPanel.doLayout(); } else { tPanel.removeAll( true ); tPanel.doLayout(); - var tPanel = Ext.getCmp('mod_ed_small'); - tPanel.removeAll( true ); - tPanel.add( { html:'
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
' } ); - tPanel.doLayout(); + var zPanel = Ext.getCmp('dcam_op_small'); + zPanel.removeAll( true ); + zPanel.add( { html:'
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
' } ); + zPanel.doLayout(); }; }, failure: failureAJAXFunction @@ -107,9 +111,68 @@ function loadDetectedCameras(){ }; function loadAssignedCameras(){ - + Ext.Ajax.request({ + url: '/lib/controller/getCameras.php', + params: { + UID: , + TYP: 1, + SID: '', + }, + success: function( response, opts ){ + var tData = Ext.decode(response.responseText); + var tPanel = Ext.getCmp('acam_container'); + if( tData.status == 'ok' ){ + var res = Ext.decode( tData.cameras ); + tPanel.removeAll( true ); + tPanel.add( res ); + tPanel.doLayout(); + var zPanel = Ext.getCmp('acam_op_small'); + zPanel.removeAll( true ); + zPanel.add( { html:'
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
' } ); + zPanel.doLayout(); + } else { + tPanel.removeAll( true ); + tPanel.doLayout(); + var zPanel = Ext.getCmp('acam_op_small'); + zPanel.removeAll( true ); + zPanel.add( { html:'
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
' } ); + zPanel.doLayout(); + }; + }, + failure: failureAJAXFunction + }); +}; +function loadAttachedSensors(){ + Ext.Ajax.request({ + url: '/lib/controller/getSensors.php', + params: { + UID: , + SID: '', + }, + success: function( response, opts ){ + var tData = Ext.decode(response.responseText); + var tPanel = Ext.getCmp('sens_container'); + if( tData.status == 'ok' ){ + var res = Ext.decode( tData.sensors ); + tPanel.removeAll( true ); + tPanel.add( res ); + tPanel.doLayout(); + var zPanel = Ext.getCmp('sens_op_small'); + zPanel.removeAll( true ); + zPanel.add( { html:'
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
' } ); + zPanel.doLayout(); + } else { + tPanel.removeAll( true ); + tPanel.doLayout(); + var zPanel = Ext.getCmp('sens_op_small'); + zPanel.removeAll( true ); + zPanel.add( { html:'
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
' } ); + zPanel.doLayout(); + }; + }, + failure: failureAJAXFunction + }); }; - function editResource( rid ){ var loadEditor = true; if( settingsAreChanged ){ @@ -597,6 +660,164 @@ function addEthernet2Uart(){ addE2UDialog.show(); }; +var addSensorDialog = null; +var addSensWM = null; +function addSensor(){ + if( addSensorDialog == null ){ + addSensorDialog = new Ext.Window({ + modal: true, + title: 'GetLabel('_SMM_ADD_LSEN_');?>', + width: 500, + height: 438, + layout: 'form', + closeAction: 'hide', + labelWidth: 160, + labelAlign: 'right', + items:[{ + xtype: 'panel', + frame: false, + border: false, + html: '
' + },{ + xtype: 'spacer', + height: 8 + },{ + xtype: 'combo', + id: 'sens_type', + fieldLabel: "GetLabel('SENS_TYPE');?>", + lazyRender: true, + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['mode','mode_txt'], + data: [ + [1,'ALS Sensor'], + [2,'LFS Sensor'], + [3,'PLS 200 Sensor'], + [4,'PLS 360 Sensor'] + ] + }), + valueField: 'mode', + displayField: 'mode_txt', + value: 1, + width: 200 + },{ + xtype: 'combo', + id: 'sens_range', + fieldLabel: "GetLabel('SENS_RANGE');?>", + lazyRender: true, + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['range','range_txt'], + data: [ + [15,'15 Meters'], + [35,'35 Meters'], + [65,'65 Meters'], + [75,'75 Meters'], + [150,'150 Meters'], + [200,'200 Meters'], + [300,'300 Meters'] + ] + }), + valueField: 'range', + displayField: 'range_txt', + value: 15, + width: 200 + },{ + xtype: 'numberfield', + id: 'sens_id', + fieldLabel: 'GetLabel('_PROTO_DEVICE_ID_');?>', + width: 200, + value: 0 + },{ + xtype: 'combo', + fieldLabel: 'GetLabel('_UART_PORT_');?>', + lazyRender: true, + id: 'uart_id', + mode: 'local', + disabled: false, + forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['uart','uart_txt'], + data: [Query( $QS ); + if( count( $RR ) ){ + $RE=array(); + foreach( $RR as $R ){ + $RE[] = "[ {$R['aux_id']}, '{$R['device']}']"; + }; + echo implode( ',', $RE ); + } else { + echo "[0, \"".$Labels->GetLabel('_NO_UARTS_DEF_')."\"]"; + }; + ?>] + }), + valueField: 'uart', + displayField: 'uart_txt', + width: 200 + },{ + xtype:'button', + width: '100%', + text: 'GetLabel('_ADD_');?>', + handler: function(){ + var TYP = parseInt( Ext.getCmp('sens_type').getValue() ); + var RAN = parseInt( Ext.getCmp('sens_range').getValue() ); + var PID = parseInt( Ext.getCmp('sens_id').getValue() ); + var RTI = parseInt( Ext.getCmp('uart_id').getValue() ); + if( RTI > 0 ){ + addSensWM = new Ext.LoadMask( addSensorDialog.getEl(), {msg:"GetLabel('_Please_Wait_');?>..."}); + addSensWM.show(); + Ext.Ajax.request({ + url: '/lib/controller/doNodeOperation.php', + params: { + UID: , + SID: '', + TYPE: TYP, + DEVID: PID, + UART: RTI, + RANGE: RAN, + CCMD: 1 + }, + success: function( response, opts ){ + addSensWM.hide(); + var data = Ext.decode(response.responseText); + if( data.status == 'ok' ){ + loadAttachedSensors(); + } else { + Ext.Msg.show({ + title:'Error!', + msg: data.msg, + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.WARNING + }); + }; + addSensorDialog.hide(); + }, + failure: failureAJAXFunction + }); + } else { + Ext.Msg.show({ + title:'Error!', + msg: 'Please Choose UART Port', + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.WARNING + }); + }; + } + }] + }); + }; + addSensorDialog.show(); +}; + var addDetCamDialog = null; var addDetCamWM = null; function addDetectedIPCam(){ @@ -688,12 +909,6 @@ function addDetectedIPCam(){ addDetCamWM.hide(); var data = Ext.decode(response.responseText); if( data.status == 'ok' ){ - Ext.Msg.show({ - title:'Sucess!', - msg: data.msg, - buttons: Ext.Msg.OK, - icon: Ext.MessageBox.INFO - }); loadDetectedCameras(); } else { Ext.Msg.show({ @@ -718,7 +933,7 @@ function showSettingsGeneral(){ stopStatusUpdater(); content_lvl1 = 1; - content_lvl2 = 4; + content_lvl2 = 0; var tPanel = Ext.getCmp('main_content'); tPanel.removeAll( true ); GetLabel( '_SMM_ADD_LSEN_' );?>', + handler: function(){ + addSensor(); + } + }], + items:[{ + xtype: 'panel', + id: 'sens_container', + flex: 1, + height: PanelH-15, + autoScroll: 'auto', + items:[] + },{ + xtype: 'panel', + id: 'sens_op_small', + flex: 1, + height: PanelH-15, + layout: 'fit', + items:[{ + html:'
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
' + }] + }] + }); tPanel.doLayout(); - updateServerStatus(); + loadAttachedSensors(); }; -var cameraEditorContent = null; +function editSensorHW( cid ){ + SelectedSensor = cid; + Ext.Ajax.request({ + url: '/lib/controller/getSensorEditor.php', + params: { + CID: SelectedSensor, + UID: , + SID: '' + }, + success: function( response, opts ){ + var data = Ext.decode( response.responseText ); + var tComp = Ext.getCmp('sens_op_small'); + if( data.status == 'ok' ){ + if( tComp!= null ){ + var content = Ext.decode( data.content ); + tComp.removeAll( true ); + tComp.add( content ); + tComp.doLayout(); + }; + } else { + if( tComp!= null ){ + tComp.removeAll( true ); + tComp.add( data ); + tComp.doLayout(); + }; + }; + }, + failure: function(){ + } + }); + +}; +var cameraEditorContent = null; function editCamera( cid, etyp ){ SelectedCam = cid; switch( etyp ){ case 0: cameraEditorContent = Ext.getCmp('dcam_op_small'); break; + case 1: cameraEditorContent = Ext.getCmp('acam_op_small'); break; }; Ext.Ajax.request({ url: '/lib/controller/getCameraEditor.php', @@ -1157,15 +1433,7 @@ function editCamera( cid, etyp ){ }; }; }, - failure: function( response, opts ) { - //Ext.getCmp('cam_login').setValue(''); - Ext.getCmp('cam_password').setValue(''); - Ext.getCmp('cac_tab').enable(); - Ext.getCmp('str_tab').disable(); - Ext.getCmp('ptz_tab').disable(); - Ext.getCmp('loc_tab').disable(); - Ext.getCmp('coc_tabs').setActiveTab( 0 ); - sourceListStore.removeAll(); + failure: function(){ } }); @@ -1214,29 +1482,25 @@ function showSettingsVideo(){ }] },{ xtype: 'panel', - id: 'gi_tab', + id: 'cam_ass_tab', title: 'Assigned Cameras', layout: 'hbox', items:[{ xtype: 'panel', + id: 'acam_container', flex: 1, height: PanelH-15, - autoScroll: false, - html: '\ - \ - \ -
\ - \ - \ - \ - \ -
0CPU0MEM0DISK0TEMP
\ -
\ -
\ -
\ -
 
' + autoScroll: 'auto', + items:[] },{ - + xtype: 'panel', + id: 'acam_op_small', + flex: 1, + height: PanelH-15, + layout: 'fit', + items:[{ + html:'
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
' + }] }] }], listeners:{ @@ -1248,10 +1512,10 @@ function showSettingsVideo(){ loadDetectedCameras(); break; }; - case 'res_tab': { + case 'cam_ass_tab': { content_lvl3=1; stopStatusUpdater(); - loadRessources(); + loadAssignedCameras(); break; }; case 'mod_tab':{ @@ -1274,9 +1538,117 @@ function showSettingsVideo(){ } }); tPanel.doLayout(); + updateUserContent(); updateServerStatus(); }; - +function showSettingsApplication(){ + stopStatusUpdater(); + content_lvl1 = 1; + content_lvl2 = 3; + var tPanel = Ext.getCmp('main_content'); + tPanel.removeAll( true ); + tPanel.add({ + xtype: 'tabpanel', + frame: false, + id: 'settings_a_content', + border: false, + activeTab: 0, + items:[{ + title: 'GetLabel('_WORKING_MODE_');?>', + xtype: 'form', + labelAlign: 'right', + labelWidth: 180, + items:[{ + xtype: 'spacer', + height: 10 + },{ + xtype: 'combo', + fieldLabel: 'GetLabel('_DEBUGGING_MODE_');?>', + editable: false, + typeAhead: true, + triggerAction: 'all', + width: '100%', + lazyRender:true, + mode: 'local', + store: new Ext.data.ArrayStore({ + fields: ['sid', 'snam'], + data: [[0,'GetLabel('__DISABLED__');?>'], [1,'GetLabel('___ENABLED__');?>']] + }), + value: , + valueField: 'sid', + displayField: 'snam' + }] + },{ + title: '_MONIT_LAYOUT_', + layout:'table', + defaults: { + // applied to each contained panel + bodyStyle:'padding:20px' + }, + layoutConfig: { + // The total column count must be specified here + columns: 3 + }, + frame: false, + border: false, + height: 800, + items:[{ + xtype: 'spacer', + width: 100 + },{ + xtype: 'radio', + width: '100%', + name: 'layo_apa', + id: 'db_layout_0', + checked: true + },{ + frame: false, + border: false, + html: '' + },{ + xtype: 'spacer', + width: 100 + },{ + xtype: 'radio', + width: '100%', + name: 'layo_apa', + id: 'db_layout_1', + checked: true + },{ + frame: false, + border: false, + html: '' + },{ + xtype: 'spacer', + width: 100 + },{ + xtype: 'radio', + name: 'layo_apa', + id: 'db_layout_2', + checked: true + },{ + frame: false, + border: false, + html: '' + },{ + xtype: 'spacer', + width: 100 + },{ + xtype: 'radio', + width: '100%', + name: 'layo_apa', + id: 'db_layout_3', + checked: true + },{ + frame: false, + border: false, + html: '' + }] + }] + }); + tPanel.doLayout(); + updateUserContent(); +}; function showSettingsUpgrade(){ stopStatusUpdater(); @@ -1294,7 +1666,6 @@ function initSettingsView(){ tlInterval = null; timelineObj = null; }; - setUserContent( 210 ); var tP = Ext.getCmp('left_side_menu'); tP.doLayout(); tP.setVisible( false ); @@ -1315,7 +1686,7 @@ function initSettingsView(){ id:'go_home', text: 'GetLabel('_UPPER_SENSOR_');?>', enableToggle: true, - pressed: ( content_lvl2 == 0 ), + pressed: ( content_lvl2 == 0 && content_lvl1 == 0 ), allowDepress: false, toggleGroup: 'det_settings', handler: loadDashBoard @@ -1325,7 +1696,7 @@ function initSettingsView(){ id:'go_monitor', text: 'GetLabel('_BOTTOM_SENSOR_');?>', enableToggle: true, - pressed: ( content_lvl2 == 1 ), + pressed: ( content_lvl2 == 1 && content_lvl1 == 0 ), allowDepress: false, toggleGroup: 'det_settings', handler: loadMonitoring @@ -1335,7 +1706,7 @@ function initSettingsView(){ id:'go_archive', text: 'GetLabel('_FUSION_ENGINE_');?>', enableToggle: true, - pressed: ( content_lvl2 == 2 ), + pressed: ( content_lvl2 == 2 && content_lvl1 == 0 ), allowDepress: false, toggleGroup: 'det_settings', handler: loadArchive @@ -1350,7 +1721,7 @@ function initSettingsView(){ id:'go_singleIpi', text: 'GetLabel('_EVT_MONITOR_IPI_');?>', enableToggle: true, - pressed: ( content_lvl2 == 3 ), + pressed: ( content_lvl2 == 3 && content_lvl1 == 0 ), allowDepress: false, toggleGroup: 'det_settings', handler: loadSingleIPI @@ -1381,7 +1752,7 @@ function initSettingsView(){ id:'sys_edit', text: 'GetLabel('_SYS_GENERAL_');?>', enableToggle: true, - pressed: ( content_lvl2 == 4 ), + pressed: ( content_lvl2 == 0 && content_lvl1 == 1 ), allowDepress: false, toggleGroup: 'sys_settings', handler: showSettingsGeneral @@ -1391,7 +1762,7 @@ function initSettingsView(){ id:'map_edit', text: 'GetLabel('_SENSOR_CONNECTION_');?>', enableToggle: true, - pressed: ( content_lvl2 == 5 ), + pressed: ( content_lvl2 == 1 && content_lvl1 == 1 ), allowDepress: false, toggleGroup: 'sys_settings', handler: showSettingsSensors @@ -1401,17 +1772,27 @@ function initSettingsView(){ id:'video_set', text: 'GetLabel('_CAMERA_MNGMNT_');?>', enableToggle: true, - pressed: ( content_lvl2 == 6 ), + pressed: ( content_lvl2 == 2 && content_lvl1 == 1 ), allowDepress: false, toggleGroup: 'sys_settings', handler: showSettingsVideo + },{ + xtype: 'button', + width: '100%', + id:'app_set', + text: 'GetLabel('_APPLICA_MNGMNT_');?>', + enableToggle: true, + pressed: ( content_lvl2 == 3 && content_lvl1 == 1 ), + allowDepress: false, + toggleGroup: 'sys_settings', + handler: showSettingsApplication },{ xtype: 'button', width: '100%', id:'soft_update', text: 'GetLabel('_UPGRADE_MNGMNT_');?>', enableToggle: true, - pressed: ( content_lvl2 == 7 ), + pressed: ( content_lvl2 == 4 && content_lvl1 == 1 ), allowDepress: false, toggleGroup: 'sys_settings', handler: showSettingsUpgrade @@ -1425,7 +1806,7 @@ function initSettingsView(){ width: '100%', text: 'Ethernet', enableToggle: true, - pressed: ( content_lvl2 == 8 ), + pressed: ( content_lvl2 == 0 && content_lvl1 == 2 ), allowDepress: false, id:'ethernet', },{ @@ -1433,7 +1814,7 @@ function initSettingsView(){ width: '100%', text: 'WiFi', enableToggle: true, - pressed: ( content_lvl2 == 9 ), + pressed: ( content_lvl2 == 1 && content_lvl1 == 2 ), allowDepress: false, id:'wifi', },{ @@ -1441,7 +1822,7 @@ function initSettingsView(){ width: '100%', text: 'Integration', enableToggle: true, - pressed: ( content_lvl2 == 10 ), + pressed: ( content_lvl2 == 2 && content_lvl1 == 2 ), allowDepress: false, id:'api_serv', }] @@ -1494,5 +1875,22 @@ function initSettingsView(){ }; ?> tP.setVisible( true ); - tP.doLayout(); + tP.doLayout(); + switch( content_lvl1 ){ + case 0:{ + switch( content_lvl2 ){ + case 0: break; + }; + break; + }; + case 1:{ + switch( content_lvl2 ){ + case 0: showSettingsGeneral(); break; + case 1: showSettingsSensors(); break; + case 2: showSettingsVideo(); break; + case 3: showSettingsApplication(); break; + case 4: showSettingsUpgrade(); break; + }; + }; + }; }; \ No newline at end of file diff --git a/lib/javascript/jsapi_dynamic/rgoose_global_vars.js b/lib/javascript/jsapi_dynamic/rgoose_global_vars.js index 7f7cb9a..9ae65fe 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_global_vars.js +++ b/lib/javascript/jsapi_dynamic/rgoose_global_vars.js @@ -26,8 +26,21 @@ var nodeDashboardStatuses = new Array(); var nodeTHREEviewers = new Array(); var nodeTHREEanimationId = 0; var serverIsOnLine = false; +var SelectedSensor = 0; + +Data['ss_timeout']) ){ +?> +var ssEnabled = true; var ssTimer = null; -var ssTimeOut = 60000; //1min +var ssTimeOut = Data['ss_timeout']);?>; //1min var ssIsActive = false; var ssInterval = null; + +var ssEnabled = false; + diff --git a/lib/javascript/jsapi_dynamic/rgoose_main.js b/lib/javascript/jsapi_dynamic/rgoose_main.js index 47a515f..e30fc79 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_main.js +++ b/lib/javascript/jsapi_dynamic/rgoose_main.js @@ -156,7 +156,7 @@ function setUserContent( c_id ){ UID: , SID: '', SSS: 26, - CID: c_id + CID: initView }, failure: failureAJAXFunction }); @@ -164,7 +164,7 @@ function setUserContent( c_id ){ function updateUserContent(){ cid = content_lvl3 + content_lvl2 * 10 + content_lvl1*100 + content_lvl0*1000; - setUserContent( cid ); + if( initView != cid ) setUserContent( cid ); }; var gSessionValidatorInterval = null; @@ -279,14 +279,15 @@ Ext.onReady(function(){ //window.onresize = doCheckWindowSize; Ext.QuickTips.init(); - - ssSetupTimer(); - $(window).focus(function() { - ssResetTimer(); - }); - $(window).blur(function() { - ssStopTimer(); - }); + if( ssEnabled ){ + ssSetupTimer(); + $(window).focus(function() { + ssResetTimer(); + }); + $(window).blur(function() { + ssStopTimer(); + }); + }; var viewport = new Ext.Viewport({ @@ -299,24 +300,31 @@ Ext.onReady(function(){ region: 'north', baseCls: 'x-plain', height: 60, + //layout: 'fit', layout: 'hbox', frame: false, border: false, items:[{ xtype: 'panel', - width: 600, - layout: 'hbox', + width: '100%', + layout: 'table', baseCls: 'x-plain', + layoutConfig: { + columns: 11 + }, frame: false, - border: false, + border: true, margins: {top:10, right:10, bottom:10, left:10}, items:[{ xtype: 'panel', baseCls: 'x-plain', frame: false, border: false, - margins: {top:5, right:20, bottom:0, left:10}, + margins: {top:5, right:20, bottom:0, left:20}, html: '' + },{ + xtype: 'spacer', + width: 10 },{ xtype: 'button', text: 'GetLabel('_MONITORING_');?>', @@ -344,7 +352,10 @@ Ext.onReady(function(){ allowDepress: false, toggleGroup: 'gopa_gopa', toggleHandler: function( bt, state ){ - if( state ) showContent( 1000 ); + if( state ) { + content_lvl0 = 2000; + updateUserContent(); + }; } },{ xtype: 'spacer', @@ -356,56 +367,56 @@ Ext.onReady(function(){ iconCls: 'cog', scale: 'large', enableToggle: true, - //pressed: (Math.floor(initView/100)==2), allowDepress: false, toggleGroup: 'gopa_gopa', toggleHandler: function( bt, state ){ if( state ) showContent( 2000 ); } - }] - },{ - xtype: 'panel', - baseCls: 'x-plain', - frame: false, - border: false, - margins: {top:5, right:0, bottom:0, left:0}, - html: '

'+ap_title+'

', - flex: 1 - },{ - xtype: 'panel', - layout: 'fit', - baseCls: 'x-plain', - frame: false, - border: false, - margins: {top:10, right:10, bottom:10, left:10}, - items:['+ap_title+'

' + },{ + xtype: 'spacer', + width: 10 + },{ - xtype: 'button', - id: 'logout_btn', - text: 'Logout', - iconCls: 'lout', - scale: 'large', - handler: doLogout - }{ + xtype: 'button', + id: 'logout_btn', + text: 'Logout', + iconCls: 'lout', + scale: 'large', + style:'text-align: right;', + handler: doLogout + }{ - xtype: 'button', - id: 'snd_mode_btn', - text: 'Sound', - iconCls: 'snd'+SoundMode, - scale: 'large', - handler: function(){ - if( SoundMode == 0 ){ - SoundMode = 3; - } else { - SoundMode --; - }; - Ext.getCmp('snd_mode_btn').setIconClass( 'snd'+SoundMode ); - } + ?>{ + xtype: 'button', + id: 'snd_mode_btn', + text: 'Sound', + iconCls: 'snd'+SoundMode, + scale: 'large', + style:'text-align: right;', + handler: function(){ + if( SoundMode == 0 ){ + SoundMode = 3; + } else { + SoundMode --; + }; + Ext.getCmp('snd_mode_btn').setIconClass( 'snd'+SoundMode ); + } }] + }; + ?> + ] }] },{ xtype: 'panel', diff --git a/lib/php/db/SQLite_Class.php b/lib/php/db/SQLite_Class.php index 0bbd376..06d9f54 100644 --- a/lib/php/db/SQLite_Class.php +++ b/lib/php/db/SQLite_Class.php @@ -14,6 +14,10 @@ class SQLite_DB{ $this->DBENCRYPT=$encryptionKey; try{ $this->DBLink = new SQLite3( $this->DBFILE, $this->DBFLAGS, $this->DBENCRYPT ); + $this->DBLink->busyTimeout(5000); + // WAL mode has better control over concurrency. + // Source: https://www.sqlite.org/wal.html + $this->DBLink->exec('PRAGMA journal_mode = wal;'); $this->isConnected = true; }catch( Exception $e ){ echo $e->getMessage(); @@ -124,6 +128,7 @@ class SQLite_DB{ function __destruct(){ if( $this->isConnected ){ $this->DBLink->close(); + unset( $this->DBLink ); }; } } diff --git a/style/assets/ed-0.png b/style/assets/ed-0.png new file mode 100644 index 0000000..6e07b57 Binary files /dev/null and b/style/assets/ed-0.png differ diff --git a/style/assets/ed-1.png b/style/assets/ed-1.png new file mode 100644 index 0000000..63ca7b6 Binary files /dev/null and b/style/assets/ed-1.png differ diff --git a/style/assets/ed-1.psd b/style/assets/ed-1.psd new file mode 100644 index 0000000..3a938c7 Binary files /dev/null and b/style/assets/ed-1.psd differ diff --git a/style/assets/ed-2.png b/style/assets/ed-2.png new file mode 100644 index 0000000..21ca292 Binary files /dev/null and b/style/assets/ed-2.png differ diff --git a/style/assets/ed-3.png b/style/assets/ed-3.png new file mode 100644 index 0000000..2b4a8dd Binary files /dev/null and b/style/assets/ed-3.png differ