diff --git a/index.php b/index.php index 9c3ea34..9a8a060 100644 --- a/index.php +++ b/index.php @@ -1,42 +1,95 @@ Data['id'] > 1 ){ - if( $CUser->Data['access'] > 5 ){ - UI_PageHeaderExt( - 'mojo_general.js', - array( - 'rgoose_global_vars.js', - 'rgoose_swupgrade.js', - 'rgoose_map.js', - 'mojo_reports.js', - 'rgoose_devices.js', - 'rgoose_cameras.js', - 'rgoose_modules.js', - 'mojo_monitoring.js', - 'rgoose_location_editor.js', - 'mojo_dashboard.js', - 'rgoose_users.js', - 'rgoose_logs.js', - //'rgoose_single_ipi.js', - 'mojo_settings.js', - 'mojo_main.js' - ) - ); + if( $SSL_INSTALLLED || 1 ){ + if( $CUser->Data['id'] > 1 ){ + if( $CUser->Data['access'] > 5 ){ + UI_PageHeaderExt( + 'mojo_general.js', + array( + 'mojo_global_vars.js', + 'rgoose_map.js', + 'mojo_reports.js', + 'rgoose_devices.js', + 'rgoose_cameras.js', + 'rgoose_modules.js', + 'mojo_monitoring.js', + 'rgoose_location_editor.js', + 'mojo_dashboard.js', + 'mojo_users.js', + 'mojo_logs.js', + 'mojo_metro.js', + 'mojo_settings.js', + 'mojo_main.js' + ) + ); + } else { + UI_PageHeaderExt( + 'mojo_general.js', + array( + 'mojo_global_vars.js', + 'rgoose_map.js', + 'mojo_reports.js', + 'rgoose_devices.js', + 'rgoose_cameras.js', + 'rgoose_modules.js', + 'mojo_monitoring.js', + 'mojo_dashboard.js', + 'mojo_settings.js', + 'mojo_main.js' + ) + ); + }; + UI_PageBottomExt(); } else { - UI_PageHeaderExt( - 'mojo_general.js', - array( - 'rgoose_map.js', - 'rgoose_reports.js', - 'rgoose_dashboard.js', - 'rgoose_main.js' - ) - ); + UI_PageHeader(); + UI_LoginForm(); + UI_PageBottom(); }; - UI_PageBottomExt(); } else { + $UPLOAD = false; + $VALID = false; + if( isset( $_FILES ) ){ + $UPLOAD = true; + $Z = '/srv/www/web/lib/tmp/'.basename($_FILES["fcert"]["name"]); + $JUJA = $_FILES["fcert"]["tmp_name"]; + $CMD = 'openssl verify -verbose -CAfile /srv/www/web/style/assets/rootCA.crt ' . $_FILES["fcert"]["tmp_name"]; + $DATA = `{$CMD}`; + if( stripos( $DATA, ': OK')!== false ){ + $CMD = 'openssl x509 -ext subjectAltName -noout -in ' . $_FILES["fcert"]["tmp_name"]; + $DATA = `{$CMD}`; + $TArr = explode( "\n", $DATA ); + if( count( $TArr ) > 1 ){ + $IPS = array(); + foreach( $TArr as $T ){ + $CL = explode( ',', trim( $T ) ); + foreach( $CL as $C ){ + $PArr = explode( ':', $C ); + if( stripos( $PArr[0], 'IP Address' )!== false ) $IPS[] = $PArr[1]; + }; + }; + if( count( $IPS ) ){ + foreach( $IPS as $IP ) if ( $IP == $_SERVER['HTTP_HOST'] ) $VALID = true; + if( $VALID ){ + // Setup SSL + @unlink($_FILES['fcert']['tmp_name']); + } else { + $ERR = $Labels->GetLabel('_SSL_CERT_IP_NO_'); + }; + } else { + // No IP defined in Cert + $ERR = $Labels->GetLabel('_SSL_NO_IP_CERT_'); + }; + } else { + // No Extension + $ERR = $Labels->GetLabel('_SSL_NO_EXT_CERT_'); + }; + } else { + // CERT is invalid + $ERR = $Labels->GetLabel('_SSL_CERT_INVALID__'); + }; + }; UI_PageHeader(); - UI_LoginForm(); + UI_SSLDialog(); UI_PageBottom(); }; ?> \ No newline at end of file diff --git a/lib/assembler.php b/lib/assembler.php index cde2b1a..f18a4f7 100644 --- a/lib/assembler.php +++ b/lib/assembler.php @@ -17,8 +17,10 @@ if( $TT_123[0] == '4' ){ }; */ + + require_once( 'php/db/SQLite_Class.php'); -$DATABASE = new SQLite_DB( '/srv/samba/Mojo_Web/lib/controller/data/mysqlitedb.db'); +$DATABASE = new SQLite_DB( 'lib/controller/data/mysqlitedb.db'); $str = @file_get_contents('/proc/uptime'); $num = floatval($str); diff --git a/lib/controller/addFilter.php b/lib/controller/addFilter.php new file mode 100644 index 0000000..1b4cb0f --- /dev/null +++ b/lib/controller/addFilter.php @@ -0,0 +1,54 @@ +Data['id'] ); + $ACCESS = intval($CUser->Data['access'] ); + if( $UID > 1 && $ACCESS > 4 ){ + $Data['status'] = 'nok'; + $T = intval( $_POST['TYPE'] ); + if( $T ){ + $QS = "SELECT * FROM `target_filter_types` WHERE `id`={$T}"; + $ZZ = $DATABASE->Query( $QS ); + if( count( $ZZ ) ){ + $CTI = $ZZ[0]; + $ADE = true; + if( intval( $CTI['allow_multiply'] ) == 0 ){ + $QS = "SELECT * FROM `target_filters` WHERE `type`={$T}"; + $SS = $DATABASE->Query( $QS ); + if( count( $SS ) ){ + $ADE = false; + $Data['msg'] = 'This type of Target Fiter can be added only Once!'; + }; + }; + if( $ADE ){ + $QAS = "INSERT INTO `target_filters`(`type`,`aux_id`,`enabled`) VALUES({$T},0,0);"; + $DATABASE->Query( $QAS ); + $MID = $DATABASE->getLastInsertID(); + $MCID = 0; + switch( $T ){ + case 1:{ + //TRAIN + $QS = "INSERT INTO `target_filter_train`(`TRAIN_DETECT`,`TRAIN_WIDTH`,`DECISION_TIME`,`SUSPECT_TIME`) VALUES(1,60000,10,20)"; + $DATABASE->Query( $QS ); + $MCID = $DATABASE->getLastInsertID(); + $QS = "UPDATE `target_filters` SET `aux_id`={$MCID} WHERE `id`={$MID}"; + $DATABASE->Query( $QS ); + break; + }; + }; + $Data['status'] = 'ok'; + //$fd = fopen( "debug.txt", "a+" ); + //fprintf( $fd, $DATABASE->getDebugLog() ); + //fclose( $fd ); + //$Data['dblog'] = $DATABASE->getDebugLog(); + }; + } else { + $Data['msg'] = 'Wrong Target Filter Type is supplied!'; + }; + } else { + $Data['msg'] = 'No Target Filter Type is supplied!'; + }; + echo json_encode( $Data ); + exit(); + }; + header('location: /'); +?> \ No newline at end of file diff --git a/lib/controller/addModule.php b/lib/controller/addModule.php index 347ded2..6fd5096 100644 --- a/lib/controller/addModule.php +++ b/lib/controller/addModule.php @@ -52,6 +52,15 @@ $DATABASE->Query( $QS ); break; }; + case 9:{ + //Modem + $QS = "INSERT INTO `module_modem`(`alarm_window`) VALUES(300)"; + $DATABASE->Query( $QS ); + $MCID = $DATABASE->getLastInsertID(); + $QS = "UPDATE `modules` SET `aux_id`={$MCID} WHERE `id`={$MID}"; + $DATABASE->Query( $QS ); + break; + }; }; $Data['status'] = 'ok'; //$fd = fopen( "debug.txt", "a+" ); diff --git a/lib/controller/addPhoneBookRecord.php b/lib/controller/addPhoneBookRecord.php new file mode 100644 index 0000000..8577ac6 --- /dev/null +++ b/lib/controller/addPhoneBookRecord.php @@ -0,0 +1,42 @@ +Data['id'] > 1 ){ + $Data['success'] = false; + if( $CUser->Data['access'] > 5 ){ + $NL = trim( $_POST['PNAM'] ); + $NN = str_ireplace('+','', + str_ireplace('-','', + str_ireplace( ' ', '', $_POST['PNUM'] + ) + ) + ); + $CO = intval( $_POST['PCAL'] ); + if( $CO == 0 ){ + $CMS = $DATABASE->escape( $_POST['PMSG'] ); + }; + if( strlen( $NN ) > 7 ) { + if( substr( $NN, 1 ) == '0' ){ + } else { + }; + if( strlen( $NL ) == 0 ){ + $NL = 'New Number'; + }; + if( $CO ){ + $QS = "INSERT INTO `module_modem_phonebook`(`number`,`call_only`,`label`) VALUES('{$NN}',1,'{$NL}')"; + } else { + $QS = "INSERT INTO `module_modem_phonebook`(`number`,`call_only`,`label`,`custom_msg`) VALUES('{$NN}', 0,'{$NL}','{$CMS}')"; + }; + $DATABASE->Query( $QS ); + $Data['success'] = true; + } else { + $Data['msg'] = 'Number is Invalid!'; + }; + } else { + $Data['msg'] = 'Access Denied!'; + }; + echo json_encode( $Data ); + exit(); + }; + header( 'location: /'); +?> \ No newline at end of file diff --git a/lib/controller/zuza/checkDeviceOperation.php b/lib/controller/checkDeviceOperation.php similarity index 100% rename from lib/controller/zuza/checkDeviceOperation.php rename to lib/controller/checkDeviceOperation.php diff --git a/lib/controller/dash/node_11.js b/lib/controller/dash/node_11.js index 01dc401..18cf639 100644 --- a/lib/controller/dash/node_11.js +++ b/lib/controller/dash/node_11.js @@ -1,96 +1,61 @@ { id: 'db_node_%%%NODEID%%%', - //xxtype: 'panel', - xtype: 'portlet', - //columnWidth:.33, - //layout: 'fit', - width: 258, - height: %%%HEIGHT%%%+68, + layout:'vbox', tools: [{ id:'gear', handler: function(){ - editAnalogStream( %%%STREAMID%%%, 1 ); } - }/*,{ - id:'close', - handler: function(e, target, panel){ - panel.ownerCt.remove(panel, true); - } - }*/], + }], frame: true, + draggable: false, + collapsible: false, 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 ){ - 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(); - } - },{ - xtype: 'spacer', - height: 3 - },{ - html: '
 
 
  
', - height: 90 + html: '
 
 
  
' }], 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 + 32 ); + var z = Ext.getCmp('db_node_%%%NODEID%%%_pic'); + z.setHeight( XX ); + }; }; - t.plr.src({type: 'application/x-mpegURL', src: '%%%SELURL%%%'}); - */ - return true; - }, - destroy: function( t ){ - if( t.plr != null ) t.plr.dispose(); - t.plr = null; + }, + afterrender: function( p ){ + var xx = p.getWidth() * %%%HEIGHT%%% / %%%WIDTH%%%; + p.setHeight( xx + 32 ); + 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 ); } } } \ No newline at end of file diff --git a/lib/controller/dash/node_13.js b/lib/controller/dash/node_13.js index 18cf639..7a0cf03 100644 --- a/lib/controller/dash/node_13.js +++ b/lib/controller/dash/node_13.js @@ -16,7 +16,7 @@ id: 'db_node_%%%NODEID%%%_pic', border: true, width: '100%', - html: '
 
 
  
' + html: '
 
 
%%%HBTN%%% 
' }], listeners:{ resize: function( p, adjWidth, adjHeight, rawWidth, rawHeight ){ @@ -56,6 +56,7 @@ 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 ); + %%%CAM_CTRL_HOME_BTN_BIND%%% } } } \ No newline at end of file diff --git a/lib/controller/dash/node_3.js b/lib/controller/dash/node_3.js index 1be75ad..3187334 100644 --- a/lib/controller/dash/node_3.js +++ b/lib/controller/dash/node_3.js @@ -4,30 +4,46 @@ draggable: false, collapsible: false, tools: [{ - id:'gear', - handler: function(){ - //Ext.Msg.alert('Message', 'The Settings tool was clicked.'); - //showSensorToolBox( %%%NODEID%%% ); + id:'toggle', + handler: function( a, b, p ){ + fsDrawID = %%%NODEID%%%; + fullScreen( 'div_radar_%%%NODEID%%%' ); + var el = document.getElementById('draw_svg_'+fsDrawID ); + var nW = Math.floor( ( window.screen.height/window.screen.width ) * 100 ); + el.removeAttribute("width"); + el.setAttribute( "width", nW+'%' ); } }], listeners:{ afterrender: function(p){ + masks_statuses[%%%NODEID%%%] = 0; + masks_exist[%%%NODEID%%%] = 0; + var W=p.getWidth(); var H=9*(W/16); p.setHeight( H + 32 ); - Ext.getCmp( 'cp_radar_%%%NODEID%%%' ).setHeight( H - 18 ); - document.getElementById('draw_svg_%%%NODEID%%%').setAttribute("width", H-45 ); + Ext.getCmp( 'cp_radar_%%%NODEID%%%' ).setHeight( H - 18 ); + //document.getElementById('draw_svg_%%%NODEID%%%').setAttribute("width", H-45 ); set2DZoomLevel( %%%NODEID%%%, 100 ); + var el = document.getElementById('div_radar_%%%NODEID%%%'); + el.addEventListener( "fullscreenchange", ( evt )=>{ + if( document.fullscreenElement ){ + } else { + if( fsDrawID ){ + var el = document.getElementById('draw_svg_'+fsDrawID ); + el.removeAttribute("width"); + el.setAttribute( "width", '86%' ); + fsDrawID = 0; + }; + }; + }); + window.setTimeout( load2DDraw, 10*%%%NODEID%%%, %%%NODEID%%% ); } }, layout: 'hbox', items:[{ id: 'cp_radar_%%%NODEID%%%', - //html: '
', - //html: '
', - //html: '
\' style="cursor: crosshair;"/>
', - //html: '
\' style="cursor: crosshair;">
', - html: '
100 m.502512.5
', + html: '
100 m.502512.5
', width: '56%' },{ frame: false, @@ -37,32 +53,215 @@ xtype: 'button', id: 'cp_clear_btn_%%%NODEID%%%', width: '100%', - text: 'Clear Allerts' + disabled: true, + text: 'Clear Alarm', + iconCls: 'ctrl_panel_clean_sm', + iconAlign: 'left', + handler: function(){ + doDeviceOperation( %%%NODEID%%%, 125,'', true ); + } },{ xtype: 'spacer', - height: 6 + height: 3 },{ xtype: 'button', id: 'cp_draw_btn_%%%NODEID%%%', width: '100%', text: 'Draw Background', + iconCls: 'ctrl_panel_drawscan_sm', + iconAlign: 'left', disabled: true, handler: function(){ doDeviceOperation( %%%NODEID%%%, 3,'', true ); } },{ xtype: 'spacer', - height: 6 + height: 3 },{ xtype: 'button', id: 'cp_study_btn_%%%NODEID%%%', width: '100%', text: 'Study Background', + iconCls: 'ctrl_panel_study_sm', + iconAlign: 'left', disabled: true, handler: function(){ doDeviceOperation( %%%NODEID%%%, 2,'', true ); } - }] + },{ + xtype: 'spacer', + height: 3 + },{ + xtype: 'panel', + title: 'Masking Management', + height: 145, + frame: true, + flex: 1, + layout: 'vbox', + items:[{ + xtype: 'button', + text: 'Mask Editor', + id: 'DMED_%%%NODEID%%%', + width: '100%', + disabled: true, + handler: function(){ + showMaskEditor( false, 0, %%%NODEID%%% ); + } + },{ + xtype: 'spacer', + height: 3 + },{ + xtype: 'panel', + id: 'DMEBB_%%%NODEID%%%', + frame: true, + border: false, + flex: 1, + width: '100%', + height: 53, + layout: 'hbox', + items:[{ + xtype: 'button', + enableToggle: true, + width: '20%', + scale: 'medium',//scale: 'small', + id: 'mz_btn_%%%NODEID%%%_0', + iconCls: 'mask_zone1_btn', + iconAlign: 'top', + pressed: false, + disabled: true, + handler: function(){ + if( Ext.getCmp('mz_btn_%%%NODEID%%%_0').pressed){ + doMaskOperation( %%%NODEID%%%, 1, 0 ); + } else { + doMaskOperation( %%%NODEID%%%, 0, 0 ); + }; + } + },{ + xtype: 'button', + enableToggle: true, + width: '20%', + scale: 'medium', + id: 'mz_btn_%%%NODEID%%%_1', + iconCls: 'mask_zone2_btn', + iconAlign: 'top', + pressed: false, + disabled: true, + handler: function(){ + if( Ext.getCmp('mz_btn_%%%NODEID%%%_1').pressed){ + doMaskOperation( %%%NODEID%%%, 1, 1 ); + } else { + doMaskOperation( %%%NODEID%%%, 0, 1 ); + }; + } + },{ + xtype: 'button', + enableToggle: true, + width: '19%', + scale: 'medium',//scale: 'large', + id: 'mz_btn_%%%NODEID%%%_2', + iconCls: 'mask_zone3_btn', + iconAlign: 'top', + pressed: false, + disabled: true, + handler: function(){ + if( Ext.getCmp('mz_btn_%%%NODEID%%%_2').pressed){ + doMaskOperation( %%%NODEID%%%, 1, 2 ); + } else { + doMaskOperation( %%%NODEID%%%, 0, 2 ); + }; + } + },{ + xtype: 'button', + enableToggle: true, + width: '20%', + scale: 'medium',//scale: 'large', + id: 'mz_btn_%%%NODEID%%%_3', + iconCls: 'mask_zone4_btn', + iconAlign: 'top', + pressed: false, + disabled: true, + handler: function(){ + if( Ext.getCmp('mz_btn_%%%NODEID%%%_3').pressed){ + doMaskOperation( %%%NODEID%%%, 1, 3 ); + } else { + doMaskOperation( %%%NODEID%%%, 0, 3 ); + }; + } + },{ + xtype: 'button', + enableToggle: true, + width: '20%', + scale: 'medium',//scale: 'large', + id: 'mz_btn_%%%NODEID%%%_4', + iconCls: 'mask_zone5_btn', + iconAlign: 'top', + pressed: false, + disabled: true, + handler: function(){ + if( Ext.getCmp('mz_btn_%%%NODEID%%%_4').pressed){ + doMaskOperation( %%%NODEID%%%, 1, 4 ); + } else { + doMaskOperation( %%%NODEID%%%, 0, 4 ); + }; + } + }] + }] + },{ + xtype: 'spacer', + height: 3 + }/*,{ + xtype: 'panel', + title: 'Detection Sensitivity', + height: 95, + frame: true, + flex: 1, + layout: 'hbox', + items:[{ + 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' + }] + }*/] }], bbar:[{ xtype: 'button', diff --git a/lib/controller/data/factory.db b/lib/controller/data/factory.db deleted file mode 100644 index 3ceda72..0000000 Binary files a/lib/controller/data/factory.db and /dev/null differ diff --git a/lib/controller/data/mysqlitedb.db b/lib/controller/data/mysqlitedb.db index 99066a1..3244f16 100644 Binary files a/lib/controller/data/mysqlitedb.db and b/lib/controller/data/mysqlitedb.db differ diff --git a/lib/controller/data/reports.db b/lib/controller/data/reports.db index f1917f5..b881ea3 100644 Binary files a/lib/controller/data/reports.db and b/lib/controller/data/reports.db differ diff --git a/lib/controller/data/server.log b/lib/controller/data/server.log index 260454e..527cea6 120000 --- a/lib/controller/data/server.log +++ b/lib/controller/data/server.log @@ -1 +1 @@ -/srv/samba/dr_frucht/Projects/argus/Debug/server.log \ No newline at end of file +/srv/mojo/server.log \ No newline at end of file diff --git a/lib/controller/doApplicationOperation.php b/lib/controller/doApplicationOperation.php index eeff805..fc86a54 100644 --- a/lib/controller/doApplicationOperation.php +++ b/lib/controller/doApplicationOperation.php @@ -12,7 +12,7 @@ switch( $CMD ){ case 1:{//Debug Mode $PARAM = intval( $_POST['OPCODE'] ); - $QS = "UPDATE `system_props` SET `working_mode`={$PARAM}"; + $QS = "UPDATE `system_props` SET `work_mode`={$PARAM} WHERE `id`=1"; $DATABASE->Query( $QS ); $Data['q'] = $QS; $Data['success'] = true; @@ -20,12 +20,20 @@ }; case 2:{//Layout $PARAM = intval( $_POST['OPCODE'] ); - $QS = "UPDATE `system_props` SET `app_layout`={$PARAM}"; + $QS = "UPDATE `system_props` SET `app_layout`={$PARAM} WHERE `id`=1"; $DATABASE->Query( $QS ); $Data['q'] = $QS; $Data['success'] = true; break; }; + case 3:{ + $RBASE = new SQLite_DB( '/dev/shm/argus/mem_db.db'); + $PARAM = md5( time() ); + $QS = "INSERT INTO `nodes_qcq`(`node_id`,`cmd`,`status`,`parameter`) VALUES(1,249,0,'{$PARAM}')"; + $RBASE->Query( $QS, false ); + $Data['q'] = $QS; + $Data['success'] = true; + }; }; } else { $Data['msg']='Wrong Parameters!'; diff --git a/lib/controller/doCameraOperation.php b/lib/controller/doCameraOperation.php index 28beefd..d068eef 100644 --- a/lib/controller/doCameraOperation.php +++ b/lib/controller/doCameraOperation.php @@ -52,21 +52,26 @@ break; }; case 3:{ - // Checkup Onvif Camera By IP + // Checkup Onvif Camera Credentials require_once('../php/onvif/toto.php'); $EUser = $DATABASE->escape( $_POST['UU'] ); $EPass = $DATABASE->escape( $_POST['PP'] ); $AUTH = intval( $_POST['AU'] ); $onvif = new Ponvif(); $IP = ''; - if( $CameraID ){ - $QS ="SELECT `ip` FROM `cameras` WHERE `id`={$CameraID}"; + if( $CameraID ){ // Cam From DB + $QS ="SELECT `ip`,`port` FROM `cameras` WHERE `id`={$CameraID}"; $JJ = $DATABASE->Query( $QS ); if( count( $JJ ) ){ $IP = $JJ[0]['ip']; - $onvif->setIPAddress( $IP ); + $PORT = intval($JJ[0]['port']); + if( $PORT ){ + $onvif->setIPAddress( $IP.':'.$PORT ); + } else { + $onvif->setIPAddress( $IP ); + }; } else $CameraID = 0; - } else { + } else { // Direct IP $IP = $DATABASE->escape( $_POST['IP'] ); $onvif->setIPAddress( $IP ); $RR = $onvif->discover(); @@ -75,7 +80,7 @@ if(isset($R['EndpointReference'])){ if(isset($R['EndpointReference']['Address'])){ $TArr = explode( ':', $R['EndpointReference']['Address'] ); - $CA = $DATABASE->escape( $TArr[2] ); + $CA = $DATABASE->escape( $TArr[1] ); $TArr = explode( ' ', $R['Scopes']); $CM = ''; $CI = $DATABASE->escape($R['IPAddr']); @@ -97,7 +102,7 @@ if( stripos($TBrr[0],'hardware') !== false ) $CH = $DATABASE->escape(urldecode($TBrr[1])); if( stripos($TBrr[0],'mac') !== false ) $CM = $DATABASE->escape(urldecode($TBrr[1])); }; - $QS = "INSERT INTO `cameras`(hardware,name,uuid,mac,ip,status,onvif_ctrl,online) VALUES('{$CH}','{$CN}','{$CA}','{$CM}','{$CI}',0,'{$CP}',1) ON CONFLICT( uuid ) DO UPDATE SET ip='{$CI}', online=1"; + $QS = "INSERT INTO `cameras`(hardware,name,uuid,mac,ip,status,onvif_ctrl,online,manual) VALUES('{$CH}','{$CN}','{$CA}','{$CM}','{$CI}',0,'{$CP}',1,1) ON CONFLICT( uuid ) DO UPDATE SET ip='{$CI}', online=1"; $DATABASE->Query($QS,false); $CameraID = $DATABASE->getLastInsertID(); if( $CameraID == 0 ){ @@ -139,12 +144,12 @@ $mrl_port = intval( $TPArr[2] ); if( $mrl_port == 0 ) { switch( $mrl_proto ){ - case 'rtsp': $mrl_port = 554; break; - case 'http': $mrl_port = 80; break; - case 'https': $mrl_port = 443; break; + case 'rtsp': $mrl_port = 554; break; + case 'http': $mrl_port = 80; break; + case 'https': $mrl_port = 443; break; }; }; - $Emrl = $DATABASE->escape( $mrl ); + $Emrl = $DATABASE->escape( $mrl ); $Emrl = str_replace( $mrl_proto . '://' . $IP . ':' . $mrl_port, '', $Emrl ); $Emrl = str_replace( $mrl_proto . '://' . $IP, '', $Emrl ); $TPArr = explode(':',$pic ); @@ -237,6 +242,58 @@ }; break; }; + case 9:{ + // Checkup Onvif Camera Credentials + require_once('../php/onvif/toto.php'); + $onvif = new Ponvif(); + $QS ="SELECT `ip`,`port`, `access_login`, `access_pass`, `auth_mode`, `ptz_token`, `home_token` FROM `cameras` WHERE `id`={$CameraID}"; + $JJ = $DATABASE->Query( $QS ); + if( count( $JJ ) ){ + $IP = $JJ[0]['ip']; + $PORT = intval($JJ[0]['port']); + $EUser = $JJ[0]['access_login']; + $EPass = $JJ[0]['access_pass']; + $AUTH = intval($JJ[0]['auth_mode']); + try { + $Data['status'] = 'try'; + if( $PORT ){ + $onvif->setIPAddress( $IP.':'.$PORT ); + } else { + $onvif->setIPAddress( $IP ); + }; + $onvif->setUsername( $EUser ); + $onvif->setPassword( $EPass ); + $onvif->setAuthMethod( $AUTH ); + $onvif->initialize(); + if ( !$onvif->isFault( $devices = $onvif->getSources())){ + $TK = ''; + $Data['status'] = 'notoken'; + foreach( $devices[0] as $source ) if( is_array( $source ) ){ + $TK = $source['profiletoken']; + break; + }; + if( $TK == '' ) break; + $Data['token'] = $TK; + $HTK = $JJ[0]['home_token']; + if( $HTK!='' ){ + $onvif->ptz_RemovePreset( $TK, $HTK ); + }; + $HTK = '26';//md5(time()); + $onvif->ptz_SetPreset( $TK, $HTK ); + $QS = "UPDATE `cameras` SET `home_token` = '{$HTK}' WHERE `id`={$CameraID}"; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok'; + } else { + $Data['msg'] = 'OnVif Query Device Fault!'; + } + } catch( Exception $e ){ + $Data['msg'] = 'Provided Credentials are Wrong! ['.$EUser.']:['.$EPass.']'; + }; + } else { + $Data['status'] = 'nocam'; + }; + break; + }; case 10:{ $OP = intval( $_POST['OPID'] ); switch( $OP ){ @@ -290,8 +347,11 @@ break; }; case 6:{ + $QS = "SELECT `id` FROM `uart_settings`"; + $JUJA = $DATABASE->Query( $QS ); $Param = intval( $_POST['OPCODE'] ); - $QS = "UPDATE `cameras` SET `uart_id`={$Param} WHERE `id`={$CameraID}"; + $RID = intval($JUJA[$Param]['id']); + $QS = "UPDATE `cameras` SET `uart_id`={$RID} WHERE `id`={$CameraID}"; $DATABASE->Query( $QS ); $Data['status'] = 'ok-6'; break; @@ -345,6 +405,52 @@ $Data['status'] = 'ok-13'; break; }; + case 14:{ + $Param = floatval( $_POST['OPCODE'] ); + $QS = "UPDATE `cameras` SET `x_rot`={$Param} WHERE `id`={$CameraID}"; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok-14'; + break; + }; + case 15:{ + $Param = floatval( $_POST['OPCODE'] ); + $QS = "UPDATE `cameras` SET `y_rot`={$Param} WHERE `id`={$CameraID}"; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok-15'; + break; + }; + case 16:{ + $Param = floatval( $_POST['OPCODE'] ); + $QS = "UPDATE `cameras` SET `z_rot`={$Param} WHERE `id`={$CameraID}"; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok-16'; + break; + }; + case 17:{ + $Param = intval( $_POST['OPCODE'] ); + $QS = "UPDATE `cameras` SET `manual`={$Param} WHERE `id`={$CameraID}"; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok-17'; + break; + }; + case 18:{ + $Param = intval( $_POST['OPCODE'] ); + if( $Param ){ + $QS = "UPDATE `cameras` SET `homing_enable`=1 WHERE `id`={$CameraID}"; + } else { + $QS = "UPDATE `cameras` SET `homing_enable`=0 WHERE `id`={$CameraID}"; + }; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok-18'; + break; + }; + case 19:{ + $Param = intval( $_POST['OPCODE'] ); + $QS = "UPDATE `cameras` SET `homing_to`={$Param} WHERE `id`={$CameraID}"; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok-19'; + break; + }; }; break; }; diff --git a/lib/controller/doFilterOperation.php b/lib/controller/doFilterOperation.php new file mode 100644 index 0000000..f4f4936 --- /dev/null +++ b/lib/controller/doFilterOperation.php @@ -0,0 +1,98 @@ +Data['id'] > 1 ){ + $Data = array(); + $Data['success'] = false; + if( isset( $_POST['FID'] ) ) { + $FID = intval($_POST['FID']); + } else $FID = 0; + if( isset( $_POST['OPID'] ) ){ + $CMD = intval( $_POST['OPID'] ); + } else { + $CMD = 0; + }; + if( isset( $_POST['OPCODE'] ) ){ + $OPCODE = intval( $_POST['OPCODE'] ); + } else { + $OPCODE = 0; + }; + if( $FID > 0 && $CMD > 0 ){ + $QS = "SELECT * FROM `target_filters` WHERE `id`={$FID}"; + $TT = $DATABASE->Query( $QS ); + $Data['success'] = true; + if( count( $TT ) ){ + $JJ = $TT[0]; + switch( $JJ['type'] ){ + case 1:{//Train + switch( $CMD ){ + case 1: { + $QS = "UPDATE `lrf_sensors` SET `filter_id` = 0 WHERE `filter_id` = {$FID}"; + $DATABASE->Query( $QS ); + $QS = "DELETE FROM `target_filter_train` WHERE `id`={$JJ['aux_id']}"; + $DATABASE->Query( $QS ); + $QS = "DELETE FROM `target_filters` WHERE `id`={$FID}"; + break; + }; + case 2: $QS = "UPDATE `target_filters` SET `enabled`={$OPCODE} WHERE `id`={$FID}"; break; + case 3:{ + if( $OPCODE ){ + $QS = "SELECT `aux_id` FROM `nodes` WHERE `id`={$OPCODE}"; + $R = $DATABASE->Query( $QS ); + $SID = $R[0]['aux_id']; + $QS = "UPDATE `lrf_sensors` SET `filter_id`={$FID} WHERE `id`={$SID}"; + $DATABASE->Query( $QS ); + }; + $QS = "UPDATE `target_filter_train` SET `UPPER_SENSOR`={$OPCODE} WHERE `id`={$JJ['aux_id']}"; + break; + }; + case 4:{ + if( $OPCODE ){ + $QS = "SELECT `aux_id` FROM `nodes` WHERE `id`={$OPCODE}"; + $R = $DATABASE->Query( $QS ); + $SID = $R[0]['aux_id']; + $QS = "UPDATE `lrf_sensors` SET `filter_id`={$FID} WHERE `id`={$SID}"; + $DATABASE->Query( $QS ); + }; + $QS = "UPDATE `target_filter_train` SET `LOWER_SENSOR`={$OPCODE} WHERE `id`={$JJ['aux_id']}"; + break; + }; + case 5: $QS = "UPDATE `target_filter_train` SET `TRAIN_DETECT`={$OPCODE} WHERE `id`={$JJ['aux_id']}"; break; + case 6: $QS = "UPDATE `target_filter_train` SET `TRAIN_WIDTH`={$OPCODE} WHERE `id`={$JJ['aux_id']}"; break; + case 7: $QS = "UPDATE `target_filter_train` SET `DECISION_TIME`={$OPCODE} WHERE `id`={$JJ['aux_id']}"; break; + case 8: $QS = "UPDATE `target_filter_train` SET `SUSPECT_TIME`={$OPCODE} WHERE `id`={$JJ['aux_id']}"; break; + case 9:{ + if( isset( $_POST['DTR'] ) ) $DTR=intval( $_POST['DTR'] ); else $DTR = 0; + if( isset( $_POST['DTM'] ) ) $DTM=intval( $_POST['DTM'] ); else $DTM = 0; + if( isset( $_POST['STM'] ) ) $STM=intval( $_POST['STM'] ); else $STM = 0; + if( isset( $_POST['TTR'] ) ) $TTR=intval( $_POST['TTR'] ); else $TTR = 0; + if( isset( $_POST['WIZ'] ) ) $WIZ=intval( $_POST['WIZ'] ); else $WIZ = 0; + if( isset( $_POST['DBG'] ) ) $DBG=intval( $_POST['DBG'] ); else $DBG = 0; + $QS = "UPDATE `target_filter_train` SET `TRAIN_DETECT`={$DTR},`TRAIN_WIDTH`={$WIZ},`DECISION_TIME`={$DTM},`SUSPECT_TIME`={$STM},`TRACK_TRAIN`={$TTR},`DEBUG`={$DBG} WHERE `id`={$JJ['aux_id']}"; + break; + }; + }; + break; + }; + case 2:{//AFP + switch( $CMD ){ + case 1: { + $QS = "UPDATE `lrf_sensors` SET `filter_id` = 0 WHERE `filter_id` = {$FID}"; + $DATABASE->Query( $QS ); + $QS = "DELETE FROM `target_filters` WHERE `id`={$FID}"; + break; + }; + }; + break; + }; + }; + $DATABASE->Query( $QS, false ); + $Data['query'] = $QS; + }; + } else { + $Data['msg']='Wrong Parameters'; + }; + echo json_encode( $Data ); + exit(); + }; + header('location: /'); +?> \ No newline at end of file diff --git a/lib/controller/doMaskOperation.php b/lib/controller/doMaskOperation.php new file mode 100644 index 0000000..17275e4 --- /dev/null +++ b/lib/controller/doMaskOperation.php @@ -0,0 +1,114 @@ +Data['id'] > 1 ){ + $Data = array(); + $Data['status'] = 'na'; + if( isset( $_POST['CMD'] ) ){ + $CMD = intval( $_POST['CMD'] ); + } else $CMD = 0; + if( isset( $_POST['NID'] ) ) { + $NodeID = intval($_POST['NID']); + } else $NodeID = 0; + if( $NodeID ){ + $QS = "SELECT `aux_id` FROM `nodes` WHERE `id`={$NodeID}"; + $JJ = $DATABASE->Query( $QS ); + $SenID = $JJ[0]['aux_id']; + switch( $CMD ){ + case 0:{ + if( isset( $_POST['MID'] ) ){ + $MID = intval( $_POST['MID'] ); + } else { + $MID = 0; + }; + if( isset( $_POST['LID'] ) ){ + $LID = intval( $_POST['LID'] ); + } else { + $LID = 0; + }; + $QS = "SELECT `id` FROM `lrf_masks` WHERE `sensor_id`={$SenID} AND `lrf_id`={$LID} AND `layer`={$MID}"; + $JJ = $DATABASE->Query( $QS ); + if( count( $JJ ) ){ + $CID = $JJ[0]['id']; + $QS = "UPDATE `lrf_masks` SET `status`='D' WHERE `id`={$CID}"; + $DATABASE->Query( $QS ); + $RBASE = new SQLite_DB( '/dev/shm/argus/mem_db.db'); + $Data['success'] = true; + $Data['status'] = 'ok'; + $CMD = 70+$MID; + $QS = "INSERT INTO `nodes_qcq`(`node_id`,`cmd`,`status`,`parameter`) VALUES({$NodeID},{$CMD},0,'')"; + $Data['query'] = $QS; + $RBASE->Query( $QS, false ); + $Data['operation_id'] = intval( $RBASE->getLastInsertID() ); + }; + break; + }; + case 1:{ + if( isset( $_POST['MID'] ) ){ + $MID = intval( $_POST['MID'] ); + } else { + $MID = 0; + }; + if( isset( $_POST['LID'] ) ){ + $LID = intval( $_POST['LID'] ); + } else { + $LID = 0; + }; + $QS = "SELECT `id` FROM `lrf_masks` WHERE `sensor_id`={$SenID} AND `lrf_id`={$LID} AND `layer`={$MID}"; + $JJ = $DATABASE->Query( $QS ); + if( count( $JJ ) ){ + $CID = $JJ[0]['id']; + $QS = "UPDATE `lrf_masks` SET `status`='E' WHERE `id`={$CID}"; + $DATABASE->Query( $QS ); + $RBASE = new SQLite_DB( '/dev/shm/argus/mem_db.db'); + $Data['success'] = true; + $Data['status'] = 'ok'; + $CMD = 65+$MID; + $QS = "INSERT INTO `nodes_qcq`(`node_id`,`cmd`,`status`,`parameter`) VALUES({$NodeID},{$CMD},0,'')"; + $Data['query'] = $QS; + $RBASE->Query( $QS, false ); + $Data['operation_id'] = intval( $RBASE->getLastInsertID() ); + }; + break; + }; + case 3:{ + if( isset( $_POST['MID'] ) ){ + $MID = intval( $_POST['MID'] ); + } else { + $MID = 0; + }; + if( isset( $_POST['LID'] ) ){ + $LID = intval( $_POST['LID'] ); + } else { + $LID = 0; + }; + $QS = "SELECT `id` FROM `lrf_masks` WHERE `sensor_id`={$SenID} AND `lrf_id`={$LID} AND `layer`={$MID}"; + $JJ = $DATABASE->Query( $QS ); + if( count( $JJ ) ){ + $CID = $JJ[0]['id']; + $QS = "SELECT `id` FROM `lrf_mask_vertexes` WHERE `mask_id`={$CID}"; + $JJ = $DATABASE->Query( $QS ); + foreach( $JJ as $J ){ + $QS = "DELETE FROM `lrf_mask_vertex_points` WHERE `vertex_id`={$J['id']}"; + $DATABASE->Query( $QS ); + $QS = "DELETE FROM `lrf_mask_vertexes` WHERE `id`={$J['id']}"; + $DATABASE->Query( $QS ); + }; + $QS = "DELETE FROM `lrf_masks` WHERE `id`={$CID}"; + $DATABASE->Query( $QS ); + $RBASE = new SQLite_DB( '/dev/shm/argus/mem_db.db'); + $Data['success'] = true; + $Data['status'] = 'ok'; + $CMD = 75+$MID; + $QS = "INSERT INTO `nodes_qcq`(`node_id`,`cmd`,`status`,`parameter`) VALUES({$NodeID},{$CMD},0,'')"; + $Data['query'] = $QS; + $RBASE->Query( $QS, false ); + $Data['operation_id'] = intval( $RBASE->getLastInsertID() ); + }; + }; + }; + }; + echo json_encode( $Data ); + } else { + header('location: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/doSensorOperation.php b/lib/controller/doSensorOperation.php index 9e868ec..399687d 100644 --- a/lib/controller/doSensorOperation.php +++ b/lib/controller/doSensorOperation.php @@ -67,6 +67,142 @@ }; break; }; + case 7:{ + $OPCODE = intval( $_POST['OPCODE'] ); + if( $OPCODE < 2 ){ + $QS = "UPDATE `lrf_ini_settings` SET `AUTORESET_ENABLE`={$OPCODE} WHERE `sensor_id`={$SNID}"; + $Data['success'] = true; + }; + break; + }; + case 8:{ + $OPCODE = intval( $_POST['OPCODE'] ); + if( $OPCODE < 65535 ){ + $QS = "UPDATE `lrf_ini_settings` SET `AUTORESET_INTERLEAVE`={$OPCODE} WHERE `sensor_id`={$SNID}"; + $Data['success'] = true; + }; + break; + }; + case 9:{ + $OPCODE = intval( $_POST['OPCODE'] ); + if( $OPCODE < 65535 ){ + $QS = "UPDATE `lrf_ini_settings` SET `AUTORESET_TIMEOUT`={$OPCODE} WHERE `sensor_id`={$SNID}"; + $Data['success'] = true; + }; + break; + }; + case 10:{ + $OPCODE = intval( $_POST['OPCODE'] ); + if( $OPCODE < 6001 ){ + $QS = "UPDATE `lrf_ini_settings` SET `BOARD_ZEROSHIFT`={$OPCODE} WHERE `sensor_id`={$SNID}"; + $Data['success'] = true; + }; + break; + }; + case 11:{ + $OPCODE = intval( $_POST['OPCODE'] ); + if( $OPCODE < 65535 ){ + $QS = "UPDATE `lrf_ini_settings` SET `BOARD_TEMPERATURE`={$OPCODE} WHERE `sensor_id`={$SNID}"; + $Data['success'] = true; + }; + break; + }; + case 12:{ + $OPCODE = intval( $_POST['OPCODE'] ); + if( $OPCODE < 13 ){ + $SPEEDS = array( 2, 4, 6, 8, 10, 12 ); + $VAL = $SPEEDS[$OPCODE] / 1; + $QS = "UPDATE `lrf_ini_settings` SET `BOARD_SPEED`={$VAL} WHERE `sensor_id`={$SNID}"; + $Data['success'] = true; + }; + break; + }; + case 13:{ + $OPCODE = intval( $_POST['OPCODE'] ); + if( $OPCODE < 65535 ){ + $QS = "UPDATE `lrf_ini_settings` SET `NO_BLACK_TARGETS`={$OPCODE} WHERE `sensor_id`={$SNID}"; + $Data['success'] = true; + }; + break; + }; + case 14:{ + $OPCODE = intval( $_POST['OPCODE'] ); + if( $OPCODE < 65535 ){ + $QS = "UPDATE `lrf_ini_settings` SET `JUST_MOVING_TARGETS`={$OPCODE} WHERE `sensor_id`={$SNID}"; + $Data['success'] = true; + }; + break; + }; + case 15:{ + $OPCODE = intval( $_POST['OPCODE'] ); + if( $OPCODE < 2 ){ + $QS = "UPDATE `lrf_ini_settings` SET `JUST_MOVING_RADIAL`={$OPCODE} WHERE `sensor_id`={$SNID}"; + $Data['success'] = true; + }; + break; + }; + case 16:{ + $OPCODE = intval( $_POST['OPCODE'] ); + if( $OPCODE < 2 ){ + $QS = "UPDATE `lrf_ini_settings` SET `JUST_MOVING_DISTANCE`={$OPCODE} WHERE `sensor_id`={$SNID}"; + $Data['success'] = true; + }; + break; + }; + case 17:{ + $OPCODE = intval( $_POST['OPCODE'] ); + if( $OPCODE < 2 ){ + $QS = "UPDATE `lrf_ini_settings` SET `FREEZ_FIRST_TH`={$OPCODE} WHERE `sensor_id`={$SNID}"; + $Data['success'] = true; + }; + break; + }; + case 18:{ + $OPCODE = intval( $_POST['OPCODE'] ); + if( $OPCODE < 2 ){ + $QS = "UPDATE `lrf_ini_settings` SET `SAVE_FIRST_TH`={$OPCODE} WHERE `sensor_id`={$SNID}"; + $Data['success'] = true; + }; + break; + }; + case 19:{ + if( isset( $_POST['LRF'] ) ) $LRF = intval( $_POST['LRF'] ); else $LRF = 0; + if( isset( $_POST['PID'] ) ) $PID = intval( $_POST['PID'] ); else $PID = 0; + $ORD = intval( $_POST['ORD'] ); + $OFF = intval( $_POST['OFF'] ); + $SST = intval( $_POST['SST'] ); + $FLI = intval( $_POST['FLI'] ); + $SUN = intval( $_POST['SUN'] ); + $WIZ = intval( $_POST['WIZ'] ); + $DEL = intval( $_POST['DEL'] ); + $QS = "UPDATE `lrf_detection_profiles` SET `order`={$ORD},`offset`={$OFF},`delta`={$DEL},`flip`={$FLI},`width`={$WIZ},`sst`={$SST},`sun`={$SUN} WHERE `aux_id`={$SNID} AND `profile_id`={$PID} AND `lrf_id`={$LRF} AND `master`=1"; + $DATABASE->Query( $QS, false ); + //Parameter Send to device + $RBASE = new SQLite_DB( '/dev/shm/argus/mem_db.db'); + $QS = "INSERT INTO `nodes_qcq`(`node_id`,`cmd`,`status`,`parameter`) VALUES({$CN['id']},131,0,'')"; + $RBASE->Query( $QS, false ); + $QS=''; + break; + }; + case 20:{ + $RBASE = new SQLite_DB( '/dev/shm/argus/mem_db.db'); + $QS = "INSERT INTO `nodes_qcq`(`node_id`,`cmd`,`status`,`parameter`) VALUES({$CN['id']},130,0,'')"; + $RBASE->Query( $QS, false ); + $QS =''; + break; + }; + case 255:{ + // Delete Sensor + $NID = $CN['id']; + $QS = "DELETE FROM `nodes` WHERE `id`={$NID}"; + $DATABASE->Query( $QS, false ); + $QS = "DELETE FROM `resources` WHERE `node_id`={$NID}"; + $DATABASE->Query( $QS, false ); + $QS = "DELETE FROM `lrf_sensors` WHERE `id`={$SNID}"; + $DATABASE->Query( $QS, false ); + $QS = ""; + $Data['success'] = true; + }; }; if( $QS != '' ) $DATABASE->Query( $QS, false ); $Data['query'] = $QS; diff --git a/lib/controller/getCameraEditor.php b/lib/controller/getCameraEditor.php index 5506071..21f2441 100644 --- a/lib/controller/getCameraEditor.php +++ b/lib/controller/getCameraEditor.php @@ -1,4 +1,4 @@ -Data['id'] ); @@ -25,7 +25,7 @@ $CLS = "camera_dahua_set"; } elseif( stripos( $Cam['name'], 'axis' ) !== false ){ $CLS = "camera_axis_set"; - } elseif( stripos( $Cam['name'], 'GF0' ) !== false ){ + } elseif( stripos( $Cam['name'], 'General' ) !== false ){ $CLS = "cam_vehicle_set"; } else { $CLS = "camera_generic_set"; @@ -259,13 +259,14 @@ ZUZAKA; }] } CHUPAKABRA; - $QS="SELECT * FROM `module_eve` WHERE `id`=1"; - $S=$DATABASE->Query( $QS ); - $MODULE_DATA = $S[0]; + //$QS="SELECT * FROM `module_eve` WHERE `id`=1"; + //$S=$DATABASE->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='; + //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='; + $FU = '/video_feed/stream?id='; }; $TPL_CAM_EDITOR=<<{$Cam['ip']}
{$Cam['name']}
{$Cam['hardware']}' + },{ + xtype: 'form', + labelWidth: 200, + border: false, + frame: false, + labelAlign: 'right', + items:[{ + xtype: 'checkbox', + id: 'cam_manassign', + fieldLabel: 'Static Connection', + width: 200, + checked: {$Cam['manual']}, + listeners:{ + check: function( a, c ){ + if( c ){ + doCamOperation( {$CID}, 17, 1 ); + } else { + doCamOperation( {$CID}, 17, 0 ); + }; + } + } + }] }{$RESET_CREDENTIALS}] },{ title: '{$Labels->GetLabel('_STREAMS_')}', @@ -767,9 +790,9 @@ CHUPAKABRA; xtype: 'checkbox', id: 'ptz_axel_c', disabled: ({$Cam['protocol']} == 0), - checked: ({$Cam['ptz_axel']} < 5 ), + checked: ({$Cam['ptz_axel']} < 6 ), listeners:{ - change: function( a, c, b ){ + check: function( a, c ){ if( c ){ doCamOperation( {$CID}, 13, 0 ); var zz = Ext.getCmp('ptz_axel'); @@ -796,7 +819,7 @@ CHUPAKABRA; },{ xtype: 'slider', id: 'ptz_axel', - disabled: (({$Cam['protocol']} == 0)||({$Cam['ptz_axel']} < 5)), + disabled: (({$Cam['protocol']} == 0)||({$Cam['ptz_axel']} < 6)), minValue: 5, maxValue: 20, value: {$Cam['ptz_axel']}, @@ -810,6 +833,84 @@ CHUPAKABRA; },{ id: 'ptz_axel_d', html: '

X '+ {$Cam['ptz_axel']} + '

' + },{ + html: '
Axis Rotation
' + },{ + xtype: 'numberfield', + decimalPrecision: 3, + value: {$Cam['x_rot']}, + listeners:{ + change: function( a, c, b ){ + doCamOperation( {$CID}, 14, c ); + } + } + },{ + html: ' ' + },{ + html: '
Axis Rotation
' + },{ + xtype: 'numberfield', + decimalPrecision: 3, + value: {$Cam['y_rot']}, + listeners:{ + change: function( a, c, b ){ + doCamOperation( {$CID}, 15, c ); + } + } + },{ + html: ' ' + },{ + html: '
Axis Rotation
' + },{ + xtype: 'numberfield', + decimalPrecision: 3, + value: {$Cam['z_rot']}, + listeners:{ + change: function( a, c, b ){ + doCamOperation( {$CID}, 16, c ); + } + } + },{ + html: ' ' + },{ + html: '
Δ from Anchor
' + },{ + xtype: 'numberfield', + decimalPrecision: 3, + value: {$Cam['x']}, + listeners:{ + change: function( a, c, b ){ + doCamOperation( {$CID}, 17, c ); + } + } + },{ + html: ' ' + },{ + html: '
Δ from Anchor
' + },{ + xtype: 'numberfield', + decimalPrecision: 3, + value: {$Cam['y']}, + listeners:{ + change: function( a, c, b ){ + doCamOperation( {$CID}, 18, c ); + } + } + },{ + html: ' ' + },{ + html: '
Δ from Anchor
' + },{ + xtype: 'numberfield', + decimalPrecision: 3, + value: {$Cam['z']}, + listeners:{ + change: function( a, c, b ){ + doCamOperation( {$CID}, 19, c ); + } + } + },{ + html: ' ' }] }] },{ @@ -858,6 +959,55 @@ CHUPAKABRA; doCamOperation( {$CID}, 12, b ); } } + },{ + xtype: 'spacer' + },{ + width: 200, + html: 'Enable Automatic Home Return' + },{ + xtype: 'checkbox', + id: 'cam_horeten', + fieldLabel: '', + width: 200, + checked: {$Cam['homing_enable']}, + listeners:{ + check: function( a, c ){ + if( c ){ + doCamOperation( {$CID}, 18, 1 ); + } else { + doCamOperation( {$CID}, 18, 0 ); + }; + } + } + },{ + xtype: 'spacer' + },{ + width: 200, + html: 'Time After Alarm' + },{ + xtype: 'numberfield', + id: 'cam_horetto', + width: 200, + value: '{$Cam['homing_to']}', + listeners:{ + change: function( a, c, b ){ + doCamOperation( {$CID}, 19, c ); + } + } + },{ + xtype: 'spacer' + },{ + width: 200, + html: 'Home Preset Token' + },{ + xtype: 'textfield', + id: 'cam_horettk', + fieldLabel: '', + width: 200, + value: '{$Cam['home_token']}', + readOnly: true + },{ + xtype: 'spacer' }] }] }] diff --git a/lib/controller/getCameraPreview.php b/lib/controller/getCameraPreview.php index dd885bc..2061d1a 100644 --- a/lib/controller/getCameraPreview.php +++ b/lib/controller/getCameraPreview.php @@ -37,10 +37,12 @@ $soap_do = curl_init(); //$TURL = "http://{$Result[0]['access_login']}:{$Result[0]['access_pass']}@192.168.200.113/onvifsnapshot/media_service/snapshot?channel=1&subtype=0"; $URL = $Result[0]['pic_proto'] . '://' . $Result[0]['ip'] .':'. $Result[0]['pic_port'] . $Result[0]['pic_url']; + //$URL = $Result[0]['pic_url']; curl_setopt($soap_do, CURLOPT_URL, $URL ); curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 20); curl_setopt($soap_do, CURLOPT_TIMEOUT, 20); - curl_setopt($soap_do, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); + //curl_setopt($soap_do, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST ); + curl_setopt($soap_do, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ); curl_setopt($soap_do, CURLOPT_FOLLOWLOCATION, true); curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true ); curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); @@ -68,8 +70,8 @@ }; }; } else { - //echo "\n\nNores!"; - loadNotPicture( $AUX ); + //echo "\n\nNores!"; + loadNotPicture( $AUX ); }; exit(); }; diff --git a/lib/controller/getDashBoardItems.php b/lib/controller/getDashBoardItems.php index a4215e8..d3d1767 100644 --- a/lib/controller/getDashBoardItems.php +++ b/lib/controller/getDashBoardItems.php @@ -53,11 +53,45 @@ } } jodjhowierewt; - + $LOGIO=<<Query( $QS ); $QS="SELECT * FROM `module_eve` WHERE `id`=1"; $S=$DATABASE->Query( $QS ); $MODULE_DATA = $S[0]; $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL ); - $FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter']; + //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter']; + $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter']; $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']'; $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL ); $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL ); $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL ); - $TPL = str_replace( '%%%STREAMID%%%', $R['aux_parameter'], $TPL ); + $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL ); + if( $DD['type'] == 13 || $DD['type'] == 11 ){ + $QS = "SELECT `homing_enable` FROM `cameras` WHERE `id`={$DD['aux_id']}"; + $JUA = $DATABASE->Query( $QS ); + $CAMDATA = $JUA[0]; + if( $CAMDATA['homing_enable'] ){ + if( $CUser->Data['access'] > 5 ){ + $TPL = str_replace( '%%%HBTN%%%', '', $TPL ); + $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', 'document.getElementById(\'img_btn_0ZZ_'.$DD['aux_id'].'\').addEventListener( \'mousedown\', makePtzHome );', $TPL ); + } else { + $TPL = str_replace('%%%HBTN%%%', ' ', $TPL ); + $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL ); + }; + } else { + $TPL = str_replace('%%%HBTN%%%', ' ', $TPL ); + $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL ); + }; + }; $FK = $MODULE_DATA['height'] /$MODULE_DATA['width']; $W = 244; @@ -177,6 +233,8 @@ jodjhowierewt; $TPL = file_get_contents( $TFN ); $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL ); $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL ); + $TPL = str_replace('%%%USERID%%%', $UserID, $TPL ); + $TPL = str_replace('%%%SESSION%%%', $Session, $TPL ); $OUT[]= $STA[$idx] . $TPL . $END; } else break; $idx++; @@ -201,19 +259,39 @@ jodjhowierewt; if(!file_exists( $TFN )) continue; $TPL = file_get_contents( $TFN ); $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL ); - $TPL = str_replace('%%%NODENAME%%%', ''.$DD['name'] , $TPL ); + $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL ); + $TPL = str_replace('%%%USERID%%%', $UserID, $TPL ); + $TPL = str_replace('%%%SESSION%%%', $Session, $TPL ); $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}"; $Z=$DATABASE->Query( $QS ); $QS="SELECT * FROM `module_eve` WHERE `id`=1"; $S=$DATABASE->Query( $QS ); $MODULE_DATA = $S[0]; $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL ); - $FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter']; + //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter']; + $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter']; $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']'; $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL ); $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL ); $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL ); - $TPL = str_replace( '%%%STREAMID%%%', $R['aux_parameter'], $TPL ); + $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL ); + if( $DD['type'] == 13 || $DD['type'] == 11 ){ + $QS = "SELECT `homing_enable` FROM `cameras` WHERE `id`={$DD['aux_id']}"; + $JUA = $DATABASE->Query( $QS ); + $CAMDATA = $JUA[0]; + if( $CAMDATA['homing_enable'] ){ + if( $CUser->Data['access'] > 5 ){ + $TPL = str_replace( '%%%HBTN%%%', '', $TPL ); + $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', 'document.getElementById(\'img_btn_0ZZ_'.$DD['aux_id'].'\').addEventListener( \'mousedown\', makePtzHome );', $TPL ); + } else { + $TPL = str_replace('%%%HBTN%%%', ' ', $TPL ); + $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL ); + }; + } else { + $TPL = str_replace('%%%HBTN%%%', ' ', $TPL ); + $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL ); + }; + }; $FK = $MODULE_DATA['height'] /$MODULE_DATA['width']; $W = 244; @@ -225,8 +303,8 @@ jodjhowierewt; } else break; $idx++; }; - if( $idx < 2 ){ - for( ;$idx<2;$idx++ ){ + if( $idx < 1 ){ + for( ;$idx<1;$idx++ ){ $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] ); $OUT[]= $STA[2+$idx] . $T . $END; }; @@ -268,6 +346,8 @@ jodjhowierewt; $TPL = file_get_contents( $TFN ); $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL ); $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL ); + $TPL = str_replace('%%%USERID%%%', $UserID, $TPL ); + $TPL = str_replace('%%%SESSION%%%', $Session, $TPL ); $OUT[]= $STA[$idx] . $TPL . $END; } else break; $idx++; @@ -292,19 +372,39 @@ jodjhowierewt; if(!file_exists( $TFN )) continue; $TPL = file_get_contents( $TFN ); $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL ); - $TPL = str_replace('%%%NODENAME%%%', ''.$DD['name'] , $TPL ); + $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL ); + $TPL = str_replace('%%%USERID%%%', $UserID, $TPL ); + $TPL = str_replace('%%%SESSION%%%', $Session, $TPL ); $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}"; $Z=$DATABASE->Query( $QS ); $QS="SELECT * FROM `module_eve` WHERE `id`=1"; $S=$DATABASE->Query( $QS ); $MODULE_DATA = $S[0]; $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL ); - $FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter']; + //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter']; + $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter']; $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']'; $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL ); $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL ); $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL ); - $TPL = str_replace( '%%%STREAMID%%%', $R['aux_parameter'], $TPL ); + $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL ); + if( $DD['type'] == 13 || $DD['type'] == 11 ){ + $QS = "SELECT `homing_enable` FROM `cameras` WHERE `id`={$DD['aux_id']}"; + $JUA = $DATABASE->Query( $QS ); + $CAMDATA = $JUA[0]; + if( $CAMDATA['homing_enable'] ){ + if( $CUser->Data['access'] > 5 ){ + $TPL = str_replace( '%%%HBTN%%%', '', $TPL ); + $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', 'document.getElementById(\'img_btn_0ZZ_'.$DD['aux_id'].'\').addEventListener( \'mousedown\', makePtzHome );', $TPL ); + } else { + $TPL = str_replace('%%%HBTN%%%', ' ', $TPL ); + $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL ); + }; + } else { + $TPL = str_replace('%%%HBTN%%%', ' ', $TPL ); + $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL ); + }; + }; $FK = $MODULE_DATA['height'] /$MODULE_DATA['width']; $W = 244; @@ -347,6 +447,8 @@ jodjhowierewt; $TPL = file_get_contents( $TFN ); $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL ); $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL ); + $TPL = str_replace('%%%USERID%%%', $UserID, $TPL ); + $TPL = str_replace('%%%SESSION%%%', $Session, $TPL ); $OUT[]= $STA[$idx] . $TPL . $END; } else break; $idx++; @@ -366,19 +468,39 @@ jodjhowierewt; if(!file_exists( $TFN )) continue; $TPL = file_get_contents( $TFN ); $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL ); - $TPL = str_replace('%%%NODENAME%%%', ''.$DD['name'] , $TPL ); + $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL ); + $TPL = str_replace('%%%USERID%%%', $UserID, $TPL ); + $TPL = str_replace('%%%SESSION%%%', $Session, $TPL ); $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}"; $Z=$DATABASE->Query( $QS ); $QS="SELECT * FROM `module_eve` WHERE `id`=1"; $S=$DATABASE->Query( $QS ); $MODULE_DATA = $S[0]; $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL ); - $FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter']; + //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter']; + $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter']; $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']'; $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL ); $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL ); $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL ); - $TPL = str_replace( '%%%STREAMID%%%', $R['aux_parameter'], $TPL ); + $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL ); + if( $DD['type'] == 13 || $DD['type'] == 11 ){ + $QS = "SELECT `homing_enable` FROM `cameras` WHERE `id`={$DD['aux_id']}"; + $JUA = $DATABASE->Query( $QS ); + $CAMDATA = $JUA[0]; + if( $CAMDATA['homing_enable'] ){ + if( $CUser->Data['access'] > 5 ){ + $TPL = str_replace( '%%%HBTN%%%', '', $TPL ); + $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', 'document.getElementById(\'img_btn_0ZZ_'.$DD['aux_id'].'\').addEventListener( \'mousedown\', makePtzHome );', $TPL ); + } else { + $TPL = str_replace('%%%HBTN%%%', ' ', $TPL ); + $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL ); + }; + } else { + $TPL = str_replace('%%%HBTN%%%', ' ', $TPL ); + $TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL ); + }; + }; $FK = $MODULE_DATA['height'] /$MODULE_DATA['width']; $W = 244; @@ -396,7 +518,7 @@ jodjhowierewt; $OUT[]= $STA[1+$idx] . $T . $END; }; }; - $OUT[]= $STA[2] . $DUMMY['log'] .','. $DUMMY['map'] . $END; + $OUT[]= $STA[2] . $DUMMY['log'] . /*','. $DUMMY['map'].*/ $END; break; }; case 4: diff --git a/lib/controller/zuza/getDetectionProfile.php b/lib/controller/getDetectionProfile.php similarity index 97% rename from lib/controller/zuza/getDetectionProfile.php rename to lib/controller/getDetectionProfile.php index b3a22c2..fe6ea21 100644 --- a/lib/controller/zuza/getDetectionProfile.php +++ b/lib/controller/getDetectionProfile.php @@ -16,14 +16,15 @@ $K['name'] = $T['name']; $K['data_status'] = intval( $CS['data_status'] ); $K['online'] = intval( $T['online']); - switch( intval( $CS['type_id'] ) ){ + switch( intval( $CS['type'] ) ){ case 1: case 2: case 3: case 4:{ $K['profile_id'] = intval( $CS['detection_profile_id'] ); $K['profiles'] = array(); - $QS = "SELECT `id` FROM `lrf_detection_profiles` WHERE `aux_id`={$AID} and `master`=b'1' ORDER BY `profile_id`"; + $QS = "SELECT `id` FROM `lrf_detection_profiles` WHERE `aux_id`={$AID} and `lrf_id`=0 ORDER BY `profile_id`"; + //error_log( $QS, 4 ); foreach( $DATABASE->Query( $QS ) as $Z ) $K['profiles'][] = intval($Z['id']); //if( $K['profile_id'] == 0 ) $K['profile_id'] = K['profiles'][0]; $QS = "SELECT * FROM `lrf_masks` WHERE `sensor_id`={$AID} ORDER BY `layer`"; diff --git a/lib/controller/getDeviceDraw.php b/lib/controller/getDeviceDraw.php index fb91bf4..1a6587a 100644 --- a/lib/controller/getDeviceDraw.php +++ b/lib/controller/getDeviceDraw.php @@ -7,9 +7,9 @@ if( $NID ){ $QS="SELECT `data` FROM `lrf_draw` WHERE `node_id`={$NID} AND `type`=0 ORDER BY `ts` DESC LIMIT 1"; $SS = $DATABASE->Query( $QS ); + $Data['count'] = 0; if( count( $SS ) ){ $DUDU= $SS[0]['data']; - $Data['count'] = 0; $FD = fopen( 'data/device_draws/' . $DUDU.'.raw', "r" ); if( $FD ){ $C = fread( $FD, 4 ); @@ -29,9 +29,9 @@ }; fclose( $FD ); }; - echo json_encode( $Data ); - exit(); }; + echo json_encode( $Data ); + exit(); }; }; }; diff --git a/lib/controller/getDeviceFiles.php b/lib/controller/getDeviceFiles.php new file mode 100644 index 0000000..feb2bed --- /dev/null +++ b/lib/controller/getDeviceFiles.php @@ -0,0 +1,25 @@ +Data['id'] > 1 ){ + $AID = intval($_POST['DID']); + $Data['files']=array(); + $QS = "SELECT * FROM `lrf_uploads` WHERE `sensor_id`={$AID} ORDER BY `ts` DESC"; + $result = $DATABASE->Query( $QS, false ); + if( count($result) ){ + + foreach( $result as $R ){ + $CN = array(); + $CN['id'] = intval( $R['id'] ); + $CN['file_name'] = $R['file']; + $CN['size'] = intval( filesize( 'data/uploads/'.$R['md5'] ) ); + $CN['status'] = intval($R['status']) + (($R['issue_reset'])?512:0); + $CN['ts'] = date( "Y-m-d H:i:s", $R['ts'] ); + $CN['memo'] = ($R['memo']?$R['memo']:''); + $Data['files'][] = array( intval( $R['id'] ), $R['file'], $CN['size'], (intval($R['status']) + (($R['issue_reset'])?512:0)), date( "Y-m-d H:i:s", $R['ts'] ), ($R['memo']?$R['memo']:'') ); + }; + }; + echo json_encode( $Data ); + exit(); + }; + header('location: /'); +?> \ No newline at end of file diff --git a/lib/controller/getDeviceMask.php b/lib/controller/getDeviceMask.php index e6874d7..9bbde4c 100644 --- a/lib/controller/getDeviceMask.php +++ b/lib/controller/getDeviceMask.php @@ -2,7 +2,6 @@ require_once('../ajax_asm.php'); if( $CUser->Data['id'] > 1 ){ $NodeID = intval($_POST['NID']); - $SiteID = intval($_POST['SITE']); $LayerID = intval($_POST['MID']); $LRFID = intval($_POST['LID']); $QS = "SELECT * FROM nodes WHERE id={$NodeID} "; @@ -20,7 +19,7 @@ $CV = array(); if( count( $ZA ) ){ foreach( $ZA as $VV ){ - $CV['colour']="rgba({$VV['r']},{$VV['g']},{$VV['b']},255)"; + $CV['colour']="rgba(".intval($VV['r']).",".intval($VV['g']).",".intval($VV['b']).",255)"; $QS = "SELECT * FROM `lrf_mask_vertex_points` WHERE `vertex_id`={$VV['id']}"; $PP = $DATABASE->Query( $QS ); $CV['points'] = array(); diff --git a/lib/controller/getDeviceUploadStatus.php b/lib/controller/getDeviceUploadStatus.php new file mode 100644 index 0000000..5b2779d --- /dev/null +++ b/lib/controller/getDeviceUploadStatus.php @@ -0,0 +1,21 @@ +Data['id'] > 1 ){ + $AID = intval($_POST['DID']); + $QS = "SELECT * FROM `lrf_uploads` WHERE `sensor_id`={$AID} AND `status` < 101"; + $result = $DATABASE->Query( $QS, false ); + $Data['count'] = count($result); + if( count($result) ){ + foreach( $result as $R ){ + if( $R['status'] > -1 && $R['status'] < 101 ){ + $Data['current']=$R['file']; + $Data['progress']=$R['status']/100.0; + break; + }; + }; + }; + echo json_encode( $Data ); + exit(); + }; + header('location: /'); +?> \ No newline at end of file diff --git a/lib/controller/getFilterEditor.php b/lib/controller/getFilterEditor.php new file mode 100644 index 0000000..f382bea --- /dev/null +++ b/lib/controller/getFilterEditor.php @@ -0,0 +1,204 @@ +Data['id'] > 1 ){ + $EID = intval( $_POST['FID'] ); + $QS = "SELECT * FROM `target_filters` WHERE `id`={$EID}"; + $Result = $DATABASE->Query( $QS, false ); + if( count( $Result ) ){ + $CR = $Result[0]; + switch( $CR['type'] ){ + case 1: //Train + $QS = "SELECT * FROM `target_filter_train` WHERE `id`={$CR['aux_id']}"; + $JKA = $DATABASE->Query( $QS ); + $FD = $JKA[0]; + $TPL =<<%%%NAME%%%%%%INFO%%%' + },{ + xtype: 'spacer', + height: 5 + },{ + border: false, + frame: false, + xtype: 'panel', + html: '
%%%LOINFO%%%
' + },{ + xtype: 'spacer', + height: 5 + },{ + xtype: 'combo', + fieldLabel: 'Filter Status', + id: 'flt_ena', + lazyRender:true, + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['status_val','status_txt'], + data: [[0,'Disabled'],[1,'Enabled']] + }), + value: %%%ENA_VAL%%%, + valueField: 'status_val', + displayField: 'status_txt', + listeners:{ + select: function( t, r, i ){ + Ext.Ajax.request({ + url: '/lib/controller/doFilterOperation.php', + params: { + OPID: 2, + OPCODE: r.data.status_val, + FID: {$EID}, + UID: {$UserID}, + SID: '{$Session}' + }, + success: function(){ + loadFilters(); + } + }); + } + } + },{ + xtype: 'spacer', + height: 5 + },{ + xtype: 'combo', + fieldLabel: 'Upper Sensor', + id: 'flt_uper', + lazyRender:true, + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['node_id','node_name'], + data: %%%UPSENS%%% + }), + value: {$FD['UPPER_SENSOR']}, + valueField: 'node_id', + displayField: 'node_name', + listeners:{ + select: function( t, r, i ){ + Ext.Ajax.request({ + url: '/lib/controller/doFilterOperation.php', + params: { + OPID: 3, + OPCODE: r.data.node_id, + FID: {$EID}, + UID: {$UserID}, + SID: '{$Session}' + }, + success: function(){ + loadFilters(); + } + }); + } + } + },{ + xtype: 'combo', + fieldLabel: 'Bottom Sensor', + id: 'flt_bottom', + lazyRender:true, + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['node_id','node_name'], + data: %%%LOSENS%%% + }), + value: {$FD['LOWER_SENSOR']}, + valueField: 'node_id', + displayField: 'node_name', + listeners:{ + select: function( t, r, i ){ + Ext.Ajax.request({ + url: '/lib/controller/doFilterOperation.php', + params: { + OPID: 4, + OPCODE: r.data.node_id, + FID: {$EID}, + UID: {$UserID}, + SID: '{$Session}' + }, + success: function(){ + loadFilters(); + } + }); + } + } + },{ + xtype: 'spacer', + height: 5 + },{ + xtype: 'button', + disabled: false, + width: '100%', + text: 'Remove Target Filter', + handler: function(){ + Ext.Ajax.request({ + url: '/lib/controller/doFilterOperation.php', + params: { + OPID: 1, + OPCODE: 0, + FID: {$EID}, + UID: {$UserID}, + SID: '{$Session}' + }, + success: function(){ + loadFilters(); + } + }); + } + }] + +} +EFUFU; + $QS = "SELECT * FROM `target_filter_train` WHERE `id`={$CR['aux_id']}"; + $Zult = $DATABASE->Query( $QS, false ); + if( count( $Zult ) ){ + $UID = intval($Zult[0]['UPPER_SENSOR']); + $LID = intval($Zult[0]['LOWER_SENSOR']); + } else { + $UID = 0; + $LID = 0; + }; + $UPSENS = array( array( 0,'Not Set' ) ); + $LOSENS = array( array( 0,'Not Set' ) ); + + $QS = "SELECT * FROM `nodes` WHERE `type`=3"; + $Mult = $DATABASE->Query( $QS, false ); + if( count( $Mult ) ){ + foreach( $Mult as $M ){ + if( $M['id'] != $LID ) $UPSENS[] = array( $M['id'], $M['name'] ); + if( $M['id'] != $UID ) $LOSENS[] = array( $M['id'], $M['name'] ); + }; + }; + $TPL = str_ireplace( '%%%UPSENS%%%', json_encode( $UPSENS ), $TPL ); + $TPL = str_ireplace( '%%%LOSENS%%%', json_encode( $LOSENS ), $TPL ); + $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_ZL_MEDIA_DESC_SHO_') , $TPL ); + $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_ZL_MEDIA_DESC_LOO_'), $TPL ); + $TPL = str_ireplace( '%%%LOINFO%%%','' , $TPL ); + $TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL ); + echo $TPL; + break; + }; + } else { + echo '{ xtype: \'panel\', html: \'Node '.$_POST['NODE'].' Loadded\'}'; + }; + } else { + header('location: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/getFilterInfo.php b/lib/controller/getFilterInfo.php new file mode 100644 index 0000000..b05b7a5 --- /dev/null +++ b/lib/controller/getFilterInfo.php @@ -0,0 +1,17 @@ +Data['id'] > 1 ){ + $EID = intval( $_POST['FID'] ); + switch( $EID ){ + case 1: //Train + $TPL ='
%%%NAME%%%
%%%INFO%%%
'; + $TPL = str_ireplace( '%%%NAME%%%','Train Presence Filter' , $TPL ); + $TPL = str_ireplace( '%%%INFO%%%','Disables Detection of Large Objects', $TPL ); + echo $TPL; + break; + }; + } else { + header('location: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/getFilters.php b/lib/controller/getFilters.php new file mode 100644 index 0000000..782dec1 --- /dev/null +++ b/lib/controller/getFilters.php @@ -0,0 +1,43 @@ +Data['id'] ); + $ACCESS = intval( $CUser->Data['access'] ); + if( $UID > 1 ){ + $QS = "SELECT * FROM `target_filters`"; + $Result = $DATABASE->Query( $QS, false ); + if( count( $Result ) ){ + foreach( $Result as $R ){ + $QS = "SELECT * FROM `target_filter_types` WHERE `id`={$R['type']}"; + $MOMO = $DATABASE->Query( $QS, false ); + $MOD = $MOMO[0]; + switch( $R['type'] ){ + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + $ModPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \''.$Labels->GetLabel($MOD['name']).'\'}'; + break; + default: + $ModPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \''.$R['device'].'\'}'; + }; + }; + $Data['status']='ok'; + $Data['modules'] = '['.implode( ',', $ModPart ) .']'; + } 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/getHistoryDates.php b/lib/controller/getHistoryDates.php index 5e20373..b19a6b2 100644 --- a/lib/controller/getHistoryDates.php +++ b/lib/controller/getHistoryDates.php @@ -1,7 +1,21 @@ Data['id'] > 1 ){ - echo '[{"t": 1285891200000,"v": 20},{"t": 1285804800000,"v": 100},{"t": 1672249854000,"v": 50},{"t": 1672279854000,"v": 80}]'; + $ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports.db'); + $QS = "SELECT count(`id`) as `cnt`, `ts`/86400 as `ts` FROM `events` GROUP BY `ts`/86400"; + $RR = $ZIZI->Query( $QS ); + if( count( $RR ) ){ + $DD = array(); + foreach( $RR as $R ){ + $CC = intval( $R['cnt'] ); + if( $CC > 100 ) $CC = 100; + $DD[] = '{"t": '.($R['ts']*86400000).',"v":'.$CC.'}'; + //echo '[{"t": 1285891200000,"v": 20},{"t": 1285804800000,"v": 100},{"t": 1672249854000,"v": 50},{"t": 1672279854000,"v": 80}]'; + }; + echo "[" . implode(",", $DD ) . "]"; + } else { + echo "[]"; + }; } else { header('location: /'); }; diff --git a/lib/controller/getHistoryDay.php b/lib/controller/getHistoryDay.php index 67e617b..6fc7103 100644 --- a/lib/controller/getHistoryDay.php +++ b/lib/controller/getHistoryDay.php @@ -1,7 +1,43 @@ Data['id'] > 1 ){ - echo "{expanded: true, children: [{ text: 'Menu Option 1', leaf: false, expanded: true, children:[{ text: '14:53', leaf: true }] },{ text: 'Menu Option 2', leaf: true },{ text: 'Menu Option 3', leaf: true}]}"; + $DTS = intval( $_POST['DTS'] ); + if( $DTS ){ + $ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports.db'); + $DS = $DTS; + $DE = $DS + 86400; // -> 1 Day + $QS ="SELECT DISTINCT `node_id` FROM `events` WHERE `ts` >= {$DS} AND `ts` <= {$DE}"; + $NDD = $ZIZI->Query( $QS ); + $lulu = true; + $E = "]}"; + $NONO = array(); + foreach( $NDD as $NID ){ + $id = intval( $NID['node_id'] ); + $QS = "SELECT `name` FROM `nodes` WHERE `id`={$id}"; + $R = $DATABASE->Query( $QS ); + $Name = $R[0]['name']; + if( $lulu ) { + $S = "{ text: '{$Name}', leaf: false, expanded: true, children:["; + $lulu = false; + } else { + $S = "{ text: '{$Name}', leaf: false, expanded: false, children:["; + }; + $QS = "SELECT `ts`, `id` FROM `events` WHERE `node_id`={$id} AND `ts` >= {$DS} AND `ts` <= {$DE} AND ( `evt_type`=52 ) ORDER BY `ts`, `ts_ms`"; + //echo $QS; + //exit(); + $JJJ = $ZIZI->Query( $QS ); + $JIGA = array(); + foreach( $JJJ as $J ){ + $TM = date( "H:i:s", $J['ts'] ); + $JIGA[] = "{ text: '{$TM}', leaf: true, ts: {$J['ts']}, nid: {$id} }"; + }; + $NONO[] = $S . implode( ",", $JIGA ) . $E; + //echo "{expanded: true, children: [{ text: 'Menu Option 1', leaf: false, expanded: true, children:[{ text: '14:53', leaf: true }] },{ text: 'Menu Option 2', leaf: true },{ text: 'Menu Option 3', leaf: true}]}"; + }; + echo "{expanded: true, children: [".implode(",", $NONO )."]}"; + } else { + echo "[]"; + }; } else { header('location: /'); }; diff --git a/lib/controller/getHistoryEvents.php b/lib/controller/getHistoryEvents.php index 5e20373..d561bda 100644 --- a/lib/controller/getHistoryEvents.php +++ b/lib/controller/getHistoryEvents.php @@ -1,8 +1,35 @@ Data['id'] > 1 ){ - echo '[{"t": 1285891200000,"v": 20},{"t": 1285804800000,"v": 100},{"t": 1672249854000,"v": 50},{"t": 1672279854000,"v": 80}]'; - } else { - header('location: /'); + $CTS = intval( $_POST['DTS'] ); + if( $CTS ){ + $QS = "SELECT * FROM nodes"; + $result = $DATABASE->Query( $QS, false ); + $NodeNames = array(); + foreach( $result as $R ) $NodeNames[$R['id']] = $R['name']; + $QS = "SELECT `events`.*, `events_2_videos`.* FROM `events` LEFT JOIN `events_2_videos` ON( `events`.`id` = `events_2_videos`.`evt_id` ) WHERE `ts` >= {$CTS} ORDER BY `ts` DESC, `ts_ms` DESC LIMIT 32"; + $ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports.db'); + $LREC = $ZIZI->Query( $QS ); + $Data['log'] = array(); + foreach( $LREC as $REC ){ + $CR['id'] = intval( $REC['id'] ); + $CR['node_id'] = intval( $REC['node_id'] ); + $CR['node_name'] = $NodeNames[$CR['node_id']]; + $CR['ts'] = intval( $REC['ts'] ); + $CR['ms'] = sprintf( "%03d", intval( $REC['ts_ms'] )); + $CR['dts'] = date( "H:i:s.{$CR['ms']}", $CR['ts'] ); + $CR['type'] = intval( $REC['evt_type'] ); + $CR['range'] = sprintf( "%0.2f", floatval( $REC['range'] )); + $CR['az'] = sprintf( "%0.2f", floatval( $REC['azimuth'] )); + $CR['el'] = sprintf( "%0.2f", floatval( $REC['elevation'] )); + $CR['r'] = intval( $REC['range_digital'] ); + $CR['width'] = intval( $REC['area'] ); + $CR['video_id'] = intval( $REC['video_id'] ); + $Data['log'][] = $CR; + }; + echo json_encode( $Data ); + exit(); + }; }; + header('location: /'); ?> \ No newline at end of file diff --git a/lib/controller/zuza/getMaskSchedule.php b/lib/controller/getMaskSchedule.php similarity index 100% rename from lib/controller/zuza/getMaskSchedule.php rename to lib/controller/getMaskSchedule.php diff --git a/lib/controller/zuza/getMaskScheduleEditor.php b/lib/controller/getMaskScheduleEditor.php similarity index 100% rename from lib/controller/zuza/getMaskScheduleEditor.php rename to lib/controller/getMaskScheduleEditor.php diff --git a/lib/controller/getMetroBottomSensorEditor.php b/lib/controller/getMetroBottomSensorEditor.php new file mode 100644 index 0000000..502dd2d --- /dev/null +++ b/lib/controller/getMetroBottomSensorEditor.php @@ -0,0 +1,145 @@ +Data['id'] > 1 ){ + $QS = "SELECT * FROM `target_filters` WHERE `type`=1"; + $RZ = $DATABASE->Query( $QS, false ); + $SOK = false; + $FOK = false; + if( count( $RZ ) ){ + $FL = $RZ[0]; + $FOK = true; + $QS = "SELECT * FROM `target_filter_train` WHERE `id`={$FL['aux_id']}"; + $RK = $DATABASE->Query( $QS, false ); + $FD = $RK[0]; + if( $FD['LOWER_SENSOR'] ){ + $QS = "SELECT `aux_id` FROM `nodes` WHERE `id`={$FD['LOWER_SENSOR']}"; + $JJR = $DATABASE->Query( $QS, false ); + $SI = $JJR[0]['aux_id']; + $QS = "SELECT * FROM `lrf_detection_profiles` WHERE `aux_id`={$SI} AND `profile_id`=0 AND `lrf_id`=0 AND `master`=1"; + $JJR = $DATABASE->Query( $QS, false ); + $SD = $JJR[0]; + $SOK = true; + } else { + $MSG = 'Bottom Sensor is not defined in the Train Filter'; + }; + } else { + $MSG = 'The Train Filter is not defined in the System'; + }; + $LILI=<< \ No newline at end of file diff --git a/lib/controller/getMetroFusionEditor.php b/lib/controller/getMetroFusionEditor.php new file mode 100644 index 0000000..f39235d --- /dev/null +++ b/lib/controller/getMetroFusionEditor.php @@ -0,0 +1,126 @@ +Data['id'] > 1 ){ + $QS = "SELECT * FROM `target_filters` WHERE `type`=1"; + $RZ = $DATABASE->Query( $QS, false ); + $FOK = false; + if( count( $RZ ) ){ + $FL = $RZ[0]; + $FOK = true; + $QS = "SELECT * FROM `target_filter_train` WHERE `id`={$FL['aux_id']}"; + $RK = $DATABASE->Query( $QS, false ); + $SD = $RK[0]; + } else { + $MSG = 'The Train Filter is not defined in the System'; + }; + $LILI=<< \ No newline at end of file diff --git a/lib/controller/getMetroUpperSensorEditor.php b/lib/controller/getMetroUpperSensorEditor.php new file mode 100644 index 0000000..40d31b1 --- /dev/null +++ b/lib/controller/getMetroUpperSensorEditor.php @@ -0,0 +1,145 @@ +Data['id'] > 1 ){ + $QS = "SELECT * FROM `target_filters` WHERE `type`=1"; + $RZ = $DATABASE->Query( $QS, false ); + $SOK = false; + $FOK = false; + if( count( $RZ ) ){ + $FL = $RZ[0]; + $FOK = true; + $QS = "SELECT * FROM `target_filter_train` WHERE `id`={$FL['aux_id']}"; + $RK = $DATABASE->Query( $QS, false ); + $FD = $RK[0]; + if( $FD['UPPER_SENSOR'] ){ + $QS = "SELECT `aux_id` FROM `nodes` WHERE `id`={$FD['UPPER_SENSOR']}"; + $JJR = $DATABASE->Query( $QS, false ); + $SI = $JJR[0]['aux_id']; + $QS = "SELECT * FROM `lrf_detection_profiles` WHERE `aux_id`={$SI} AND `profile_id`=0 AND `lrf_id`=0 AND `master`=1"; + $JJR = $DATABASE->Query( $QS, false ); + $SD = $JJR[0]; + $SOK = true; + } else { + $MSG = 'Upper Sensor is not defined in the Train Filter'; + }; + } else { + $MSG = 'The Train Filter is not defined in the System'; + }; + $LILI=<< \ No newline at end of file diff --git a/lib/controller/getModuleEditor.php b/lib/controller/getModuleEditor.php index 49cfe96..41e4602 100644 --- a/lib/controller/getModuleEditor.php +++ b/lib/controller/getModuleEditor.php @@ -391,7 +391,7 @@ EFUFU; break; case 9: //Modem $QS="SELECT * FROM `modules_kafka` WHERE `module_id`={$CR['aux_id']}"; - $II = $DATABASE->Query( $QS ); + //$II = $DATABASE->Query( $QS ); $CI = $II[0]; $R_nfo = 'Broker Node:'. $CI['brocker_address'].':'.$CI['brocker_port'].((intval($CI['use_ssl'])>0)?'':''); $TPL =<<GetLabel('_KAFKA_DESC_SHO_') , $TPL ); - $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_KAFKA_DESC_LOO_'), $TPL ); + $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_MODEM_DESC_SHO_') , $TPL ); + $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_MODEM_DESC_LOO_'), $TPL ); $TPL = str_ireplace( '%%%LOINFO%%%',$R_nfo , $TPL ); $TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL ); echo $TPL; diff --git a/lib/controller/getModuleInfo.php b/lib/controller/getModuleInfo.php index 37ff670..48d2353 100644 --- a/lib/controller/getModuleInfo.php +++ b/lib/controller/getModuleInfo.php @@ -43,9 +43,9 @@ echo $TPL; break; case 9: //Modem - $TPL ='
%%%NAME%%%
%%%INFO%%%
'; - $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_KAFKA_DESC_SHO_') , $TPL ); - $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_KAFKA_DESC_LOO_'), $TPL ); + $TPL ='
%%%NAME%%%
%%%INFO%%%
'; + $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_MODEM_DESC_SHO_') , $TPL ); + $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_MODEM_DESC_LOO_'), $TPL ); echo $TPL; break; }; diff --git a/lib/controller/getModuleSettings.php b/lib/controller/getModuleSettings.php index e85d053..04cbf20 100644 --- a/lib/controller/getModuleSettings.php +++ b/lib/controller/getModuleSettings.php @@ -7,88 +7,10 @@ $Result = $DATABASE->Query( $QS, false ); if( count( $Result ) ){ $CR = $Result[0]; - switch( $CR['type'] ){ - case 1: //ZLMedia - $TPL =<<%%%NAME%%%%%%INFO%%%' - },{ - xtype: 'spacer', - height: 5 - },{ - border: false, - frame: false, - xtype: 'panel', - html: '
%%%LOINFO%%%
' - },{ - xtype: 'spacer', - height: 5 - },{ - xtype: 'combo', - fieldLabel: 'Module Status', - id: 'mod_ena', - lazyRender:true, - mode: 'local', - forceSelection: true, - triggerAction: 'all', - editable: false, - disableKeyFilter: true, - store: new Ext.data.ArrayStore({ - fields: ['status_val','status_txt'], - data: [[0,'Disabled'],[1,'Enabled']] - }), - value: %%%ENA_VAL%%%, - valueField: 'status_val', - displayField: 'status_txt', - listeners:{ - select: function( t, r, i ){ - if( r.data.status_val ) enableModule({$EID}); else disableModule({$EID}); - } - } - },{ - xtype: 'spacer', - height: 5 - },{ - xtype: 'button', - id: 'mo_edit_btn', - disabled: false, - width: '100%', - text: 'Edit Module Config', - handler: function(){ - } - },{ - xtype: 'spacer', - height: 5 - },{ - xtype: 'button', - id: 'mo_del_btn', - disabled: false, - width: '100%', - text: 'Remove Module', - handler: function(){ - removeModule({$EID}); - } - }] - -} -EFUFU; - $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_ZL_MEDIA_DESC_SHO_') , $TPL ); - $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_ZL_MEDIA_DESC_LOO_'), $TPL ); - $TPL = str_ireplace( '%%%LOINFO%%%','' , $TPL ); - $TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL ); - echo $TPL; + switch( $CR['type'] ){ + case 1: //DCB USB break; - case 2: //DCB USB - break; - case 3: //Kafka + case 2: //Kafka $QS="SELECT * FROM `modules_kafka` WHERE `module_id`={$CR['aux_id']}"; $II = $DATABASE->Query( $QS ); $CI = $II[0]; @@ -400,7 +322,7 @@ EFUFU; $TPL = str_replace( '%%%VALIDATION%%%', $ValidationOutput, $TPL ); echo $TPL; break; - case 7: // SSDP + case 6: // SSDP $TPL =<<Query( $QS ); $CI = $II[0]; $TS = array( '320x240', '640x480', '800x600', '1280x720', '1024x768', '1920x1080' ); @@ -949,85 +871,138 @@ EFUFU; $Data['content'] = json_decode( $TPL ); echo $TPL; //json_encode($Data); break; - case 10: //Modem - $QS="SELECT * FROM `modules_kafka` WHERE `module_id`={$CR['aux_id']}"; + case 9: //Modem + $QS="SELECT * FROM `module_modem` WHERE `id`={$CR['aux_id']}"; $II = $DATABASE->Query( $QS ); - $CI = $II[0]; - $R_nfo = 'Broker Node:'. $CI['brocker_address'].':'.$CI['brocker_port'].((intval($CI['use_ssl'])>0)?'':''); + $CI = $II[0]; $TPL =<<%%%NAME%%%%%%INFO%%%' + html: '
%%%NAME%%%
%%%INFO%%%
' },{ xtype: 'spacer', height: 5 - },{ - border: false, - frame: false, - xtype: 'panel', - html: '
%%%LOINFO%%%
' },{ xtype: 'spacer', height: 5 },{ - xtype: 'combo', - fieldLabel: 'Module Status', - id: 'mod_ena', - lazyRender:true, - mode: 'local', - forceSelection: true, - triggerAction: 'all', - editable: false, - disableKeyFilter: true, - store: { - xtype: 'arraystore', - fields: ['status_val','status_txt'], - data: [[0,'Disabled'],[1,'Enabled']] - }, - value: %%%ENA_VAL%%%, - valueField: 'status_val', - displayField: 'status_txt', - listeners:{ - select: function( t, r, i ){ - if( r.data.status_val ) enableModule({$EID}); else disableModule({$EID}); - } - } + xtype: 'textfield', + id: 'num_prefix', + name: 'num_prefix', + fieldLabel: 'Default Prefix', + value: '{$CI['default_prefix']}' },{ - xtype: 'spacer', + xtype: 'spacer', height: 5 },{ - xtype: 'button', - id: 'mo_edit_btn', - disabled: false, - width: '100%', - text: 'Edit Module Config', - handler: function(){ - } + xtype: 'slider', + id: 'trig_window', + name: 'trig_window', + fieldLabel: 'Trigger Time (seconds)', + maxValue: 15, + width: '80%', + minValue: 0, + increment: 3, + value: {$CI['trigger_window']} + },{ + xtype: 'spacer', + height: 5 + },{ + xtype: 'slider', + id: 'alarm_window', + name: 'alarm_window', + fieldLabel: 'Alarm Time (seconds)', + width: '80%', + increment: 60, + maxValue: 3600, + minValue: 180, + + value: {$CI['alarm_window']} },{ xtype: 'spacer', height: 5 },{ - xtype: 'button', - id: 'mo_del_btn', - disabled: false, - width: '100%', - text: 'Remove Module', - handler: function(){ - removeModule({$EID}); - } - }] - + xtype: 'grid', + id: 'phone_book_grid', + border: false, + frame: false, + autoScroll: true, + //width: '100%', + lazyRender: true, + tbar:[{ + text: 'Add', + handler: addNewPhoneNumber + },{ + text: 'Delete', + id: 'ph_bo_de_bu', + disabled: true + }], + height: 225, + ds: archives_store, + cm: new Ext.grid.ColumnModel( archivesColModel_ops ), + sm: new Ext.grid.RowSelectionModel( archivesSelModel_ops ), + viewConfig: { + // forceFit: true + }, + },{ + xtype: 'spacer', + height: 5, + html: '
' + },{ + xype: 'panel', + layout: 'vbox', + frame: false, + height: 120, + items:[{ + xtype: 'panel', + layout: 'table', + width: '100%', + defaults: { + // applied to each contained panel + bodyStyle:'padding:20px' + }, + layoytConfig:{ + columns: 4 + }, + items: [{ + xtype: 'spacer', + html: '

New Phone Number:

' + },{ + xtype: 'textfield', + id: 'n_ph_n', + name: 'n_ph_n' + },{ + xtype: 'spacer', + html: '

Custom Message:

' + },{ + xtype: 'textarea', + id: 'n_ph_l', + name: 'n_ph_l', + fieldLabel: 'Custom Message', + }] + },{ + xtype: 'button', + width: '100%', + text: 'Add Phone Number', + handler: function(){ + + } + }] + }], + listeners:{ + afterrender: loadPhoneBook + } } EFUFU; - $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_KAFKA_DESC_SHO_') , $TPL ); - $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_KAFKA_DESC_LOO_'), $TPL ); + $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_MODEM_DESC_SHO_') , $TPL ); + $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_MODEM_DESC_LOO_'), $TPL ); $TPL = str_ireplace( '%%%LOINFO%%%',$R_nfo , $TPL ); $TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL ); echo $TPL; diff --git a/lib/controller/getPhoneBook.php b/lib/controller/getPhoneBook.php new file mode 100644 index 0000000..2fd53d5 --- /dev/null +++ b/lib/controller/getPhoneBook.php @@ -0,0 +1,10 @@ +Data['id'] > 1 ){ + $Data = array(); + echo json_encode( $Data ); + exit(); + }; + header( 'location: /' ); +?> \ No newline at end of file diff --git a/lib/controller/getReportLayout.php b/lib/controller/getReportLayout.php new file mode 100644 index 0000000..af9f192 --- /dev/null +++ b/lib/controller/getReportLayout.php @@ -0,0 +1,206 @@ +Data['id'] ); + $Data = ''; + if( $UID > 1 ){ + $QS = "SELECT * FROM `system_props` LIMIT 1"; + $SPD = $DATABASE->Query( $QS ); + if( count( $SPD ) ){ + $SP = $SPD[0]; + $DUMMY = array(); + if( $CUser->Data['access'] > 5 ){ + $TABA =<<  
    ', + listeners:{ + afterrender : function( ){ + var tb = document.getElementById('tbl_ph_ccc_%%ID%%'); + var W = tb.offsetWidth; + var H = (W/16)*9; + tb.setAttribute("height", H ); + tb.style.backgroundSize=W+"px "+H+"px"; + var p = Ext.getCmp('pan_ph_ccc_%%ID%%'); + p.setHeight( H+40 ); + var jaja = Ext.create({ + xtype: 'panel', + title: 'Camera is Not Assigned to the System', + frame: true, + renderTo: 'btn_ph_ccc_%%ID%%', + layout: 'vbox', + width: 500, + height: 120, + items:[{ + xtype: 'spacer', + height: 10 + },{ + width: '100%', + html: '
Proceed to Cameras Settings to Assign One
' + },{ + xtype: 'spacer', + height: 20 + },{ + xtype: 'button', + width: '100%', + text: 'Open Camera Settings', + handler: function(){ + showContent( 2020 ); + } + }] + }); + jaja.doLayout(); + } + } +} +jodjhowierewt; + +$LOGIO=<<Query( $QS ); + $idx = 0; + if( count( $R ) ){ + foreach( $R as $DD ){ + if( $idx < 2 ){ + $TFN = 'report/node_' . $DD['type'] . '.js'; + if(!file_exists( $TFN )) continue; + $TPL = file_get_contents( $TFN ); + $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL ); + $TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL ); + $OUT[]= $STA[$idx] . $TPL . $END; + } else break; + $idx++; + }; + if( $idx < 2 ){ + for( ;$idx<2;$idx++ ){ + $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END; + }; + }; + } else { + for( ;$idx<2;$idx++ ){ + $OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END; + }; + }; + $QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1"; + $R = $DATABASE->Query( $QS ); + $idx = 0; + if( count( $R ) ){ + foreach( $R as $DD ){ + if( $idx < 1 ){ + $TFN = 'report/node_' . $DD['type'] . '.js'; + if(!file_exists( $TFN )) continue; + $TPL = file_get_contents( $TFN ); + $TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL ); + $TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL ); + $QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}"; + $Z=$DATABASE->Query( $QS ); + $QS="SELECT * FROM `module_eve` WHERE `id`=1"; + $S=$DATABASE->Query( $QS ); + $MODULE_DATA = $S[0]; + $TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL ); + //$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter']; + $FU = '/video_feed/stream?id='. $Z[0]['aux_parameter']; + $CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']'; + $TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL ); + $TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL ); + $TPL = str_replace( '%%%SELURL%%%', $FU, $TPL ); + $TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL ); + + $FK = $MODULE_DATA['height'] /$MODULE_DATA['width']; + $W = 244; + $H = $W * $FK; + + $TPL = str_replace( '%%%WIDTH%%%', $W, $TPL ); + $TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL ); + $OUT[]= $STA[2+$idx] . $TPL . $END; + } else break; + $idx++; + }; + if( $idx < 1 ){ + for( ;$idx<1;$idx++ ){ + $T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] ); + $OUT[]= $STA[2+$idx] . $T . $END; + }; + }; + } else { + for( ;$idx<1;$idx++ ){ + $T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] ); + $OUT[]= $STA[2+$idx] . $T . $END; + }; + }; + switch( 1 ){ + case 1:{ + // LA Metro + $OUT[]= $STA[3] . $DUMMY['log'] . $END; + break; + }; + case 2:{ + //Togo + $OUT[]= $STA[3] . $DUMMY['map'] . $END; + break; + }; + } + }; + $Data = '[' . implode( ',' , $OUT ) . ']'; + } 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/getResourceEditor.php b/lib/controller/getResourceEditor.php index 97ac6bf..174b041 100644 --- a/lib/controller/getResourceEditor.php +++ b/lib/controller/getResourceEditor.php @@ -220,8 +220,8 @@ $TPL =<<Link to a Control page' + }], + bbar:[{ + text: 'Remove Remote UART', + handler: function(){ + doResourceOperation({$EID}, 2, 255 ); + } }] } diff --git a/lib/controller/getSensorEditor.php b/lib/controller/getSensorEditor.php index 993e423..5577dba 100644 --- a/lib/controller/getSensorEditor.php +++ b/lib/controller/getSensorEditor.php @@ -3,7 +3,7 @@ if( $CUser->Data['id'] > 1 ){ $EID = intval( $_POST['CID'] ); - $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`) WHERE `sen`.`id`={$EID}"; + $QS = "SELECT `sen`.*, `no`.`enable`, `no`.`name`, `no`.`id` as `node_id` FROM `lrf_sensors` `sen` LEFT JOIN `nodes` `no` ON( `no`.`aux_id`=`sen`.`id` AND `no`.`type`=`sen`.`type`) WHERE `sen`.`id`={$EID}"; $Result = $DATABASE->Query( $QS, false ); if( count( $Result ) ){ $CR = $Result[0]; @@ -18,7 +18,7 @@ JOJOKA; $ITEMS = array(); switch( $CR['type'] ){ case 1: $NAME = ''.$CR['name'].'
ALS ' . $Labels->getLabel('SENSOR'); break; - case 2: $NAME = ''.$CR['name'].'
LGS ' . $Labels->getLabel('SENSOR'); break; + case 2: $NAME = ''.$CR['name'].'
LFS ' . $Labels->getLabel('SENSOR'); break; case 3: $NAME = ''.$CR['name'].'
PLS200 ' . $Labels->getLabel('SENSOR'); break; case 4: $NAME = ''.$CR['name'].'
PLS360 ' . $Labels->getLabel('SENSOR'); break; default: $NAME = ''.$CR['name'].'
Unknown Sensor'; @@ -36,146 +36,613 @@ JOJOKA; } else { $UARTS = "[0, \"".$Labels->GetLabel('_NO_UARTS_DEF_')."\"]"; }; - + $QS = "SELECT * FROM `lrf_ini_settings` WHERE `sensor_id`={$EID}"; + $RRR = $DATABASE->Query( $QS ); + if( count( $RRR ) ){ + $INI_S = $RRR[0]; + } else { + $INI_S = array(); + $INI_S['AUTORESET_ENABLE'] = 0; + $INI_S['AUTORESET_INTERLEAVE'] = 0; + $INI_S['AUTORESET_TIMEOUT'] = 0; + $INI_S['BOARD_TEMPERATURE'] = 0; + $INI_S['BOARD_ZEROSHIFT'] = 0; + $INI_S['BOARD_SPEED'] = 4; + $INI_S['RUN_DIR'] = 2; + $INI_S['NO_BLACK_TARGETS'] = 0; + $INI_S['JUST_MOVING_TARGETS'] = 0; + $INI_S['JUST_MOVING_RADIAL'] = 0; + $INI_S['JUST_MOVING_DISTANCE'] = 0; + $INI_S['FREEZ_FIRST_TH'] = 0; + $INI_S['SAVE_FIRST_TH'] = 0; + $QS = "INSERT INTO `lrf_ini_settings`(`sensor_id`,`AUTORESET_ENABLE`,`AUTORESET_INTERLEAVE`,`AUTORESET_TIMEOUT`,`BOARD_TEMPERATURE`,`BOARD_ZEROSHIFT`,`BOARD_SPEED`,`RUN_DIR`,`NO_BLACK_TARGETS`,`JUST_MOVING_TARGETS`,`JUST_MOVING_RADIAL`,`JUST_MOVING_DISTANCE`,`FREEZ_FIRST_TH`,`SAVE_FIRST_TH`) VALUES({$EID},0,0,0,0,0,4,2,0,0,0,0,0,0)"; + $DATABASE->Query( $QS ); + }; $ED =<<GetLabel('_SENS_STATUS_')}", - lazyRender: true, - mode: 'local', - forceSelection: true, - triggerAction: 'all', - editable: false, - disableKeyFilter: true, - store: new Ext.data.ArrayStore({ - fields: ['mode','mode_txt'], - data: [ - [0,'{$Labels->GetLabel('__DISABLED__')}'], - [1,'{$Labels->GetLabel('___ENABLED__')}'] - ] - }), - valueField: 'mode', - displayField: 'mode_txt', - value: {$CR['enable']}, - width: 200, - listeners:{ - select: function( a, c, b ){ - doSensorOperation( {$CR['id']}, 1, b, true ); + xtype: 'form', + title: 'General', + labelWidth: 200, + border: false, + frame: false, + labelAlign: 'right', + height: PanelH - 283, + items:[{ + xtype: 'combo', + id: 'sens_se', + fieldLabel: "{$Labels->GetLabel('_SENS_STATUS_')}", + lazyRender: true, + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['mode','mode_txt'], + data: [ + [0,'{$Labels->GetLabel('__DISABLED__')}'], + [1,'{$Labels->GetLabel('___ENABLED__')}'] + ] + }), + valueField: 'mode', + displayField: 'mode_txt', + value: {$CR['enable']}, + width: 200, + listeners:{ + select: function( a, c, b ){ + doSensorOperation( {$CR['id']}, 1, b, true ); + } } - } - },{ - xtype: 'combo', - id: 'sens_range', - fieldLabel: "{$Labels->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'], - [45,'45 Meters'], - [65,'65 Meters'], - [75,'75 Meters'], - [150,'150 Meters'], - [200,'200 Meters'], - [300,'300 Meters'] - ] - }), - valueField: 'range', - displayField: 'range_txt', - value: {$CR['max_range']}, - width: 200, - listeners:{ - select: function( a, c, b ){ - doSensorOperation( {$CR['id']}, 2, b, true ); + },{ + xtype: 'combo', + id: 'sens_range', + fieldLabel: "{$Labels->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'], + [45,'45 Meters'], + [65,'65 Meters'], + [75,'75 Meters'], + [150,'150 Meters'], + [200,'200 Meters'], + [300,'300 Meters'] + ] + }), + valueField: 'range', + displayField: 'range_txt', + value: {$CR['max_range']}, + width: 200, + listeners:{ + select: function( a, c, b ){ + doSensorOperation( {$CR['id']}, 2, b, true ); + } } - } - },{ - xtype: 'numberfield', - id: 'sens_id', - fieldLabel: '{$Labels->GetLabel('_PROTO_DEVICE_ID_')}', - width: 200, - value: {$CR['device_id']}, - listeners:{ - change: function( a, c, b ){ - doSensorOperation( {$CR['id']}, 3, c, true ); + },{ + xtype: 'numberfield', + id: 'sens_id', + fieldLabel: '{$Labels->GetLabel('_PROTO_DEVICE_ID_')}', + width: 200, + value: {$CR['device_id']}, + listeners:{ + change: function( a, c, b ){ + doSensorOperation( {$CR['id']}, 3, c, true ); + } } - } - },{ - xtype: 'combo', - fieldLabel: '{$Labels->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: [{$UARTS}] - }), - valueField: 'uart', - displayField: 'uart_txt', - value: {$CR['uart_id']}, - width: 200, - listeners:{ - select: function( a, c, b ){ - doSensorOperation( {$CR['id']}, 4, c.data.uart, true ); + },{ + xtype: 'combo', + fieldLabel: '{$Labels->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: [{$UARTS}] + }), + valueField: 'uart', + displayField: 'uart_txt', + value: {$CR['uart_id']}, + width: 200, + listeners:{ + select: function( a, c, b ){ + doSensorOperation( {$CR['id']}, 4, c.data.uart, true ); + } } - } + },{ + xtype: 'combo', + id: 'ad_se', + fieldLabel: "{$Labels->GetLabel('AUTO_DRAW')}", + lazyRender: true, + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['ad','ad_txt'], + data: [ + [0,'{$Labels->GetLabel('__DISABLED__')}'], + [10,'Each 10 Flips'], + [20,'Each 20 Flips'], + [30,'Each 30 Flips'], + [40,'Each 40 Flips'], + [50,'Each 50 Flips'], + [100,'Each 100 Flips'], + [200,'Each 200 Flips'] + ] + }), + valueField: 'ad', + displayField: 'ad_txt', + value: {$CR['auto_draw']}, + width: 200, + listeners:{ + select: function( a, c, b ){ + doSensorOperation( {$CR['id']}, 5, b, true ); + } + } + },{ + xtype: 'numberfield', + id: 'basesh_id', + fieldLabel: 'Background {$Labels->GetLabel('__ZERO_SHIFT__')}', + width: 200, + value: {$CR['base_shift']}, + listeners:{ + change: function( a, c, b ){ + doSensorOperation( {$CR['id']}, 6, c, true ); + } + } + }] },{ - xtype: 'combo', - id: 'ad_se', - fieldLabel: "{$Labels->GetLabel('AUTO_DRAW')}", - lazyRender: true, - mode: 'local', - forceSelection: true, - triggerAction: 'all', - editable: false, - disableKeyFilter: true, - store: new Ext.data.ArrayStore({ - fields: ['ad','ad_txt'], - data: [ - [0,'{$Labels->GetLabel('__DISABLED__')}'], - [10,'Each 10 Flips'], - [20,'Each 20 Flips'], - [30,'Each 30 Flips'], - [40,'Each 40 Flips'], - [50,'Each 50 Flips'], - [100,'Each 100 Flips'], - [200,'Each 200 Flips'] - ] - }), - valueField: 'ad', - displayField: 'ad_txt', - value: {$CR['auto_draw']}, - width: 200, - listeners:{ - select: function( a, c, b ){ - doSensorOperation( {$CR['id']}, 5, b, true ); + xtype: 'form', + title: 'Hardware', + labelWidth: 200, + border: false, + frame: false, + labelAlign: 'right', + height: PanelH - 283, + items:[{ + xtype: 'checkbox', + id: 'autores_ena', + fieldLabel: 'Auto Reset Enabled', + width: 200, + checked: {$INI_S['AUTORESET_ENABLE']}, + listeners:{ + check: function( a, c ){ + if( c ){ + doSensorOperation( {$CR['id']}, 7, 1, false ); + } else { + doSensorOperation( {$CR['id']}, 7, 0, false ); + }; + } } - } + },{ + xtype: 'numberfield', + id: 'autores_il', + fieldLabel: 'Auto Reset Interleave', + width: 200, + value: {$INI_S['AUTORESET_INTERLEAVE']}, + listeners:{ + change: function( a, c, b ){ + doSensorOperation( {$CR['id']}, 8, c, false ); + } + } + },{ + xtype: 'numberfield', + id: 'autores_to', + fieldLabel: 'Auto Timeout', + width: 200, + value: {$INI_S['AUTORESET_TIMEOUT']}, + listeners:{ + change: function( a, c, b ){ + doSensorOperation( {$CR['id']}, 9, c, false ); + } + } + },{ + xtype: 'numberfield', + id: 'board_zsh', + fieldLabel: 'Board Zero Shift', + width: 200, + value: {$INI_S['BOARD_ZEROSHIFT']}, + listeners:{ + change: function( a, c, b ){ + doSensorOperation( {$CR['id']}, 10, c, false ); + } + } + },{ + xtype: 'numberfield', + id: 'board_temp', + fieldLabel: 'Heater Temperature', + width: 200, + value: {$INI_S['BOARD_TEMPERATURE']}, + listeners:{ + change: function( a, c, b ){ + doSensorOperation( {$CR['id']}, 11, c, false ); + } + } + },{ + xtype: 'combo', + id: 'board_spd', + fieldLabel: "Scan Speed", + lazyRender: true, + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['sd','sd_txt'], + data: [ + [2,'2 Scans per second'], + [4,'4 Scans per second'], + [6,'6 Scans per second'], + [8,'8 Scans per second'], + [10,'10 Scans per second'], + [12,'12 Scans per second'] + ] + }), + valueField: 'sd', + displayField: 'sd_txt', + value: {$INI_S['BOARD_SPEED']}, + width: 200, + listeners:{ + select: function( a, c, b ){ + doSensorOperation( {$CR['id']}, 12, b, false ); + } + } + },{ + xtype: 'checkbox', + id: 'nbt_ena', + fieldLabel: 'No Black Targets', + width: 200, + checked: {$INI_S['NO_BLACK_TARGETS']}, + listeners:{ + check: function( a, c ){ + if( c ){ + doSensorOperation( {$CR['id']}, 13, 1, false ); + } else { + doSensorOperation( {$CR['id']}, 13, 0, false ); + }; + } + } + },{ + xtype: 'checkbox', + id: 'jmt_ena', + fieldLabel: 'Just Moving Targets', + width: 200, + checked: {$INI_S['JUST_MOVING_TARGETS']}, + listeners:{ + check: function( a, c ){ + if( c ){ + doSensorOperation( {$CR['id']}, 14, 1, false ); + } else { + doSensorOperation( {$CR['id']}, 14, 0, false ); + }; + } + } + },{ + xtype: 'checkbox', + id: 'jmt_rad', + fieldLabel: 'Just Moving Radial', + width: 200, + checked: {$INI_S['JUST_MOVING_RADIAL']}, + listeners:{ + check: function( a, c ){ + if( c ){ + doSensorOperation( {$CR['id']}, 15, 1, false ); + } else { + doSensorOperation( {$CR['id']}, 15, 0, false ); + }; + } + } + },{ + xtype: 'checkbox', + id: 'jmt_range', + fieldLabel: 'Just Moving Distance', + width: 200, + checked: {$INI_S['JUST_MOVING_DISTANCE']}, + listeners:{ + check: function( a, c ){ + if( c ){ + doSensorOperation( {$CR['id']}, 16, 1, false ); + } else { + doSensorOperation( {$CR['id']}, 16, 0, false ); + }; + } + } + },{ + xtype: 'checkbox', + id: 'fth_freeze', + fieldLabel: 'Freeze First Threshold', + width: 200, + checked: {$INI_S['FREEZ_FIRST_TH']}, + listeners:{ + check: function( a, c ){ + if( c ){ + doSensorOperation( {$CR['id']}, 17, 1, false ); + } else { + doSensorOperation( {$CR['id']}, 17, 0, false ); + }; + } + } + },{ + xtype: 'checkbox', + id: 'fth_save', + fieldLabel: 'Save First Threshold', + width: 200, + checked: {$INI_S['SAVE_FIRST_TH']}, + listeners:{ + check: function( a, c ){ + if( c ){ + doSensorOperation( {$CR['id']}, 18, 1, false ); + } else { + doSensorOperation( {$CR['id']}, 18, 0, false ); + }; + } + } + },{ + xtype: 'button', + text: 'Apply To Device and Reset', + width: '100%', + iconCls: 'srv_op_download', + scale: 'large', + handler: function(){ + doSensorOperation( {$CR['id']}, 20, 0, true ); + } + },{ + xtype: 'button', + text: 'Issue Sensor Full Reset', + width: '100%', + iconCls: 'srv_op_restart', + scale: 'large', + handler: function(){ + doDeviceOperation( {$CR['node_id']}, 1,'', true ); + } + }] },{ - xtype: 'numberfield', - id: 'basesh_id', - fieldLabel: '{$Labels->GetLabel('__ZERO_SHIFT__')}', - width: 200, - value: {$CR['base_shift']}, - listeners:{ - change: function( a, c, b ){ - doSensorOperation( {$CR['id']}, 6, c, true ); + xtype: 'panel', + title: 'Position', + height: PanelH - 283, + items:[] + },{ + xtype: 'panel', + title: 'Maintenence', + height: PanelH - 283, + items:[{ + xtype: 'button', + text: 'Issue Sensor Full Reset', + width: '100%', + iconCls: 'srv_op_restart', + scale: 'large', + handler: function(){ + doDeviceOperation( {$CR['node_id']}, 1,'', true ); + } + },{ + xtype: 'button', + text: 'Read All Settings from Sensor', + width: '100%', + iconCls: 'srv_op_upload', + scale: 'large', + handler: function(){ + doDeviceOperation( {$CR['node_id']}, 128,'', true ); } + },{ + xtype: 'button', + text: 'Save All Settings to Sensor', + width: '100%', + iconCls: 'srv_op_download', + scale: 'large', + handler: function(){ + doDeviceOperation( {$CR['node_id']}, 129,'', true ); + } + }] + },{ + xtype: 'panel', + title: '{$Labels->getLabel('_SND_FILES2_DEV__')}', + height: PanelH - 283, + items:[{ + title: '{$Labels->getLabel('_UPLOAD_PACKAGE_')}', + xtype: 'panel', + //height: 300, + //flex: 1, + frame: true, + border: false, + //layout: 'vbox', + items:[{ + xtype:'button', + id: 'pickfiles_3', + width: '100%', + text: 'Choose File', + listeners:{ + afterrender: function(){ + muploader = new plupload.Uploader({ + runtimes : 'html5,html4', + browse_button : Ext.getDom('pickfiles_3'), + max_file_size : '1000mb', + chunk_size: '200kb', + max_retries: 3, + multi_selection: false, + max_file_count: 1, + url: '/lib/controller/uploadToDevice.php?DID={$EID}', + init: { + PostInit: function() { + }, + + FilesAdded: function( up, files ) { + Ext.getCmp('upload_files_btn').enable(); + Ext.getCmp('uploads_clr_btn').enable(); + plupload.each( files, function(file) { + uploads_store.loadData( [[ uploads_store_id, file.name, file.id, plupload.formatSize( file.size ), 0, 'N' ]], true ); + uploads_store_id++; + Ext.getCmp('upload_grid').doLayout(); + }); + }, + + UploadProgress: function(up, file) { + var pb = Ext.getCmp( 'progress_'+file.id ); + if( file.percent < 100 ){ + pb.updateProgress( file.percent / 100, file.percent + '%', false ); + } else { + pb.updateProgress( 1.0, 'Uploaded', false ); + uploads_store.removeAll(); + loadModuleFiles( {$EID} ); + }; + }, + + Error: function(up, err) { + Ext.Msg.show({ + title:'Upload Status', + msg: "Error #" + err.code + ": " + err.message, + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.ERROR + }); + } + } + }); + muploader.init(); + //Ext.getCmp('uploaded_grid').hide(); + //Ext.getCmp('upload_progres_panel').show(); + devUploadID = {$CR['id']}; + fetchDeviceUploadStatus(); + //loadModuleFiles( {$EID} ); + } + } + },{ + height: 200, + xtype: 'grid', + id: 'upload_grid', + border: false, + frame: false, + mode: 'local', + lazyRender: true, + width: '100%', + autoScroll: true, + ds: uploads_store, + cm: new Ext.grid.ColumnModel( fileUploadsColModel_ops ), + sm: new Ext.grid.RowSelectionModel( fileUploadsSelModel_ops ), + viewConfig: { + forceFit: true + }, + bbar: [{ + text: 'Clear', + id: 'uploads_clr_btn', + disabled: true, + handler: function(){ + muploader.splice(); + uploads_store.removeAll(); + uploads_store_id = 0; + Ext.getCmp('uploads_clr_btn').disable(); + Ext.getCmp('upload_files_btn').disable(); + } + },{ + xtype:'button', + id: 'upload_files_btn', + disabled: true, + text: 'Upload to Module', + handler: function(){ + if( muploader!= null ){ + muploader.start(); + Ext.getCmp('upload_files_btn').disable(); + }; + } + }] + },{ + xtype: 'panel', + height: 20 + },{ + title: 'Files Saved on Module', + height: 200, + xtype: 'grid', + id: 'uploaded_grid', + border: false, + hidden: true, + frame: false, + mode: 'local', + lazyRender: true, + width: '100%', + autoScroll: true, + ds: uploaded_store, + cm: new Ext.grid.ColumnModel( fileModuleColModel_ops ), + sm: new Ext.grid.RowSelectionModel( fileUploadsSelModel_ops ), + viewConfig: { + forceFit: true + }, + bbar: [{ + text: 'Clear', + id: 'oploaded_clr_btn', + disabled: false, + handler: function(){ + + //muploader.splice(); + uploaded_store.removeAll(); + uploaded_store_id = 0; + } + },{ + text: 'Reset Status', + id: 'oploaded_rst_btn', + disabled: true, + handler: function(){ + //muploader.splice(); + //uploaded_store.removeAll(); + //uploaded_store_id = 0; + } + },{ + text: 'Issue Reset', + id: 'oploaded_sres_btn', + disabled: true, + handler: function(){ + //muploader.splice(); + //uploaded_store.removeAll(); + //uploaded_store_id = 0; + } + },{ + xtype:'button', + //disabled: true, + id: 'oploaded_snd_btn', + text: 'Send to Sensor', + handler: function(){ + doDeviceOperation( {$CR['node_id']}, 120,'', true ); + Ext.getCmp('uploaded_grid').hide(); + Ext.getCmp('upload_progres_panel').show(); + + devUploadID = {$CR['id']}; + fetchDeviceUploadStatus(); + } + }] + },{ + xtype: 'panel', + id: 'upload_progres_panel', + hidden: false, + items:[{ + id: 'upp_ttext', + html: 'Sending 3 file(s) to the device' + },{ + id: 'upp_ctext_', + html: '
 
' + },{ + xtype: 'progress', + id: 'upp_pbar', + width: '100%', + value: 0.0 + }] + }] + }] + }], + bbar:[{ + text: 'Remove Sensor', + handler: function(){ + doSensorOperation( {$CR['id']}, 255,'', true ); } }] } diff --git a/lib/controller/getServerStatus.php b/lib/controller/getServerStatus.php index b885598..67f63ea 100644 --- a/lib/controller/getServerStatus.php +++ b/lib/controller/getServerStatus.php @@ -13,7 +13,7 @@ $Data['stats']=$RV[0]; $Data['online'] = 1; } else { - $Data['status']='na'; + $Data['status'] ='na'; $Data['stats'] = array(); $Data['online'] = 0; }; diff --git a/lib/controller/getStatus.php b/lib/controller/getStatus.php index 4d95292..7fb70ef 100644 --- a/lib/controller/getStatus.php +++ b/lib/controller/getStatus.php @@ -6,18 +6,45 @@ $SiteID = intval( $_POST['SITE'] ); $LastNID = intval( $_POST['LNID'] ); $LastTS = intval( $_POST['SPID'] ); - $FirstTS = intval( $_POST['LOAT'] ); + $LLID = intval( $_POST['LSID'] ); $Data = array(); $ServerWasHuped = false; $ServerIsOnLine = true; $Data['status'] = 'OK'; $Data['CTS'] = time(); $Data['nodes'] = array(); + $Data['log'] = array(); + $ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports.db'); + $QS = "SELECT `id` FROM `events` WHERE `id` > {$LLID} LIMIT 1"; + $CH = $ZIZI->Query( $QS ); + if( count( $CH ) ){ + $QS = "SELECT * FROM nodes"; + $result = $DATABASE->Query( $QS, false ); + $NodeNames = array(); + foreach( $result as $R ) $NodeNames[$R['id']] = $R['name']; + $QS = "SELECT `id`,`node_id`, `evt_type`, `ts`, `ts_ms`, `range_digital`, `azimuth`, `elevation`, `range`, `area` FROM `events` WHERE `id` > {$LLID} ORDER BY `ts` DESC, `ts_ms` DESC LIMIT 32"; + $LREC = $ZIZI->Query( $QS ); + foreach( $LREC as $REC ){ + $CR['id'] = intval( $REC['id'] ); + $CR['node_id'] = intval( $REC['node_id'] ); + $CR['node_name'] = $NodeNames[$CR['node_id']]; + $CR['ts'] = intval( $REC['ts'] ); + $CR['ms'] = sprintf( "%03d", intval( $REC['ts_ms'] )); + $CR['dts'] = date( "H:i:s.{$CR['ms']}", $CR['ts'] ); + $CR['type'] = intval( $REC['evt_type'] ); + $CR['range'] = sprintf( "%0.2f", floatval( $REC['range'] )); + $CR['az'] = sprintf( "%0.2f", floatval( $REC['azimuth'] )); + $CR['el'] = sprintf( "%0.2f", floatval( $REC['elevation'] )); + $CR['r'] = intval( $REC['range_digital'] ); + $CR['width'] = intval( $REC['area'] ); + $Data['log'][] = $CR; + }; + }; //$QS = "SELECT * FROM nodes ORDER BY `type`"; $QS = "SELECT * FROM nodes WHERE `type` > 0 AND `type` < 14"; $result = $DATABASE->Query( $QS, false ); if( count( $result ) > 0 ){ - $ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports.db'); + foreach( $result as $R ){ $CN = array(); $CN['id'] = $R['id']; @@ -60,6 +87,14 @@ $JJ = $DATABASE->Query( $QS ); $CS = $JJ[0]; $CN['status'] = $CS['data_status']; + $CN['masks_status'] = 0; + $CN['masks_exist'] = 0; + $QS = "SELECT * FROM `lrf_masks` WHERE `sensor_id`={$R['aux_id']}"; + $JJ = $DATABASE->Query( $QS ); + if( count( $JJ ) ) foreach( $JJ as $J ) { + $CN['masks_exist'] |= (1< 0 ){ $QS = "SELECT `id` FROM `lrf_draw` WHERE `node_id`={$R['id']} AND `ts` > {$LastTS}"; @@ -75,7 +110,7 @@ if( $CN['status'] == 5 ){ // check Targets $CN['targets'] = array(); - $QS="SELECT * FROM events WHERE node_id={$CN['id']} AND ( evt_type=13 OR evt_type=14) ORDER BY id DESC LIMIT 32"; + $QS="SELECT * FROM events WHERE node_id={$CN['id']} ORDER BY ts DESC, ts_ms 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"; @@ -83,10 +118,17 @@ if( count( $zult ) ){ $CT = array(); foreach( $zult as $Z ){ - $CT['digital'] = $Z['range_digital']; - $CT['az'] = $Z['azimuth']; + $TT = intval( $Z['evt_type'] ); + if( $TT > 52 && $TT < 56 ) break; + if( !( $TT == 10 || $TT == 11 ||$TT == 12 ||$TT == 13 || $TT == 14 || $TT == 36 ) ) continue; + //$CT['type'] = $TT; + $CT['digital'] = intval( $Z['range_digital']); + $CT['lat'] = floatval( $Z['lon'] ); + $CT['lon'] = floatval( $Z['lat'] ); + $CT['az'] = floatval( $Z['azimuth'] ); $CN['targets'][] = $CT; }; + //if( count( $CN['targets'] ) ) $CN['status'] = 5; }; }; break; @@ -167,7 +209,12 @@ $CN['valid'] = true; $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']; + //$CN['src'] = 'http://' . $_SERVER['SERVER_ADDR'].':' . $S[0]['web_port'] .'/stream?id='. $R['aux_parameter']; + if( $SSL_INSTALLLED ){ + $CN['src'] = 'https://' . $_SERVER['SERVER_ADDR'].'/video_feed/stream?id='. $R['aux_parameter']; + } else { + $CN['src'] = 'http://' . $_SERVER['SERVER_ADDR'].'/video_feed/stream?id='. $R['aux_parameter']; + }; break; }; }; diff --git a/lib/controller/getSystemDevices.php b/lib/controller/getSystemDevices.php new file mode 100644 index 0000000..c1383e5 --- /dev/null +++ b/lib/controller/getSystemDevices.php @@ -0,0 +1,34 @@ + setTimeout(r, 2000)); + require_once('../ajax_asm.php'); + if( $CUser->Data['id'] > 1 ){ + $Data = array( 'sensors'=>array(), 'cameras'=>array() ); + $QS = "SELECT * FROM `nodes` WHERE `type` > 0 AND `type` < 14"; + $RR = $DATABASE->Query( $QS ); + foreach( $RR AS $R ){ + $CD = array(); + $CD['node_id']=$R['id']; + if( $R['type'] < 10 ){ + $QS = "SELECT * FROM `lrf_sensors` WHERE `id`={$R['aux_id']}"; + $DD = $DATABASE->Query( $QS ); + $D = $DD[0]; + $CD['id']=$D['id']; + $CD['type']=intval( $D['type'] ); + $CD['max_range']=floatval( $D['max_range'] ); + $CD['base_shift']=intval( $D['base_shift'] ); + $Data['sensors'][] = $CD; + } else { + $CD = array(); + $QS = "SELECT * FROM `cameras` WHERE `id`={$R['aux_id']}"; + $DD = $DATABASE->Query( $QS ); + $D = $DD[0]; + $CD['id']=$D['id']; + $CD['type']=intval( $D['type'] ); + $Data['cameras'][] = $CD; + }; + }; + echo json_encode( $Data ); + exit(); + }; + header( 'location: /' ); +?> \ No newline at end of file diff --git a/lib/controller/getVideoInfo.php b/lib/controller/getVideoInfo.php new file mode 100644 index 0000000..6cd3902 --- /dev/null +++ b/lib/controller/getVideoInfo.php @@ -0,0 +1,17 @@ +Data['id'] > 1 ){ + $VID = intval( $_POST['VID'] ); + if( $VID ){ + $QS = "SELECT * FROM `videos` WHERE `id` = {$VID}"; + $ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports.db'); + $LREC = $ZIZI->Query( $QS ); + if( count( $LREC ) ){ + $Data = $LREC[0]; + echo json_encode( $Data ); + exit(); + }; + }; + }; + header('location: /'); +?> \ No newline at end of file diff --git a/lib/controller/zuza/getWidthTable.php b/lib/controller/getWidthTable.php similarity index 100% rename from lib/controller/zuza/getWidthTable.php rename to lib/controller/getWidthTable.php diff --git a/lib/controller/zuza/getWidthTableEditor.php b/lib/controller/getWidthTableEditor.php similarity index 100% rename from lib/controller/zuza/getWidthTableEditor.php rename to lib/controller/getWidthTableEditor.php diff --git a/lib/controller/listAccessLog.php b/lib/controller/listAccessLog.php new file mode 100644 index 0000000..1269e23 --- /dev/null +++ b/lib/controller/listAccessLog.php @@ -0,0 +1,24 @@ +Data['id'] > 1 ){ + if( $CUser->Data['access'] > 5 ){ + $QS = "SELECT al.*, ur.login FROM access_log al LEFT JOIN users ur ON (al.user_id = ur.id ) ORDER BY id DESC"; + $Result = $DATABASE->Query($QS,false); + foreach( $Result as $CD ){ + $cnode['id'] = intval( $CD['id'] ); + $cnode['user'] = $CD['login']; + $cnode['ts']= $CD['ts']; + $cnode['cmd'] = intval( $CD['cmd'] ); + $cnode['data_line'] = $CD['dataset']; + $Data['records'][] = $cnode; + }; + } else { + $Data['records'] = array(); + }; + $Data['totalCount']= count($Data['records']); + echo json_encode( $Data ); + } else { + header('location: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/zuza/listServerLog.php b/lib/controller/listServerLog.php similarity index 100% rename from lib/controller/zuza/listServerLog.php rename to lib/controller/listServerLog.php diff --git a/lib/controller/listUarts.php b/lib/controller/listUarts.php new file mode 100644 index 0000000..81bf584 --- /dev/null +++ b/lib/controller/listUarts.php @@ -0,0 +1,22 @@ +Data['id'] > 1 ){ + $Data = array(); + $Data['success'] = false; + if( isset( $_POST['SITE'] ) ){ + $SiteID = intval( $_POST['SITE'] ); + $QS = "SELECT re.aux_id as id, re.device as name FROM resources re LEFT JOIN nodes no ON( re.node_id = no.id ) WHERE ( re.type=1 OR re.type=129 ) AND no.site_id={$SiteID}"; + $Result = $DATABASE->Query($QS,false); + $Data['ports'] = array(); + foreach( $Result as $CD ){ + $cnode['uart_id'] = $CD['id']; + $cnode['uart_name'] = $CD['name']; + $Data['ports'][] = $cnode; + }; + $Data['success'] = true; + }; + echo json_encode( $Data ); + } else { + header('location: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/listUsers.php b/lib/controller/listUsers.php new file mode 100644 index 0000000..70c0c49 --- /dev/null +++ b/lib/controller/listUsers.php @@ -0,0 +1,27 @@ +Data['id'] > 1 ){ + if( $CUser->Data['access'] > 5 ){ + $QS = "SELECT * FROM users"; + $Result = $DATABASE->Query($QS,false); + foreach( $Result as $CD ){ + $cnode['id'] = intval( $CD['id'] ); + $cnode['status'] = $CD['status']; + $cnode['access'] = intval( $CD['access'] ); + $cnode['login'] = $CD['login']; + $cnode['created']= $CD['create_ts']; + $cnode['last'] = $CD['login_ts']; + $cnode['lang'] = intval( $CD['language'] ); + $cnode['site'] = $CD['selected_site']; + $Data['users'][] = $cnode; + }; + } else { + $Data['users'] = array(); + }; + $Data['totalCount']= count($Data['users']); + echo json_encode( $Data ); + } else { + header('location: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/medeminfo 1.txt b/lib/controller/medeminfo 1.txt new file mode 100644 index 0000000..fd8d597 --- /dev/null +++ b/lib/controller/medeminfo 1.txt @@ -0,0 +1,75 @@ +{ + "modem":{ + "3gpp":{ + "enabled-locks":[], + "eps":{ + "initial-bearer":{ + "dbus-path":"--", + "settings":{ + "apn":"--", + "ip-type":"--", + "password":"--", + "user":"--" + } + }, + "ue-mode-operation":"csps-1" + }, + "imei":"860147051348496", + "operator-code":"--", + "operator-name":"--", + "pco":"--", + "registration-state":"--" + }, + "cdma":{ + "activation-state":"--", + "cdma1x-registration-state":"--", + "esn":"--", + "evdo-registration-state":"--", + "meid":"--", + "nid":"--", + "sid":"--" + }, + "dbus-path":"/org/freedesktop/ModemManager1/Modem/2", + "generic":{ + "access-technologies":[], + "bearers":[], + "carrier-configuration":"ROW_Gen_VoLTE", + "carrier-configuration-revision":"05010822", + "current-bands":["egsm","dcs","utran-1","utran-5","utran-8","eutran-1","eutran-3","eutran-5","eutran-7","eutran-8","eutran-20","eutran-38","eutran-40","eutran-41"], + "current-capabilities":["gsm-umts, lte"], + "current-modes":"allowed: 2g, 3g, 4g; preferred: 4g", + "device":"/sys/devices/pci0000:00/0000:00:14.0/usb1/1-4", + "device-identifier":"370583bd437ad3b0629ff381ca0c81fc37647d4a", + "drivers":["qmi_wwan","option1"], + "equipment-identifier":"860147051348496", + "hardware-revision":"10000", + "manufacturer":"QUALCOMM INCORPORATED", + "model":"SIMCOM_SIM7600E-H", + "own-numbers":[], + "plugin":"simtech","ports":[ + "cdc-wdm0 (qmi)", + "ttyUSB1 (qcdm)", + "ttyUSB2 (gps)", + "ttyUSB3 (at)", + "ttyUSB4 (at)", + "ttyUSB5 (audio)", + "wwan0 (net)"], + "power-state":"on", + "primary-port":"cdc-wdm0", + "revision":"LE20B04SIM7600M22_210318", + "signal-quality":{ + "recent":"no", + "value":"0" + }, + "sim":"/org/freedesktop/ModemManager1/SIM/2", + "state":"disabled", + "state-failed-reason":"--", + "supported-bands":["egsm","dcs","utran-1","utran-5","utran-8","eutran-1","eutran-3","eutran-5","eutran-7","eutran-8","eutran-20","eutran-38","eutran-40","eutran-41"], + "supported-capabilities":["gsm-umts, lte"], + "supported-ip-families":["ipv4","ipv6","ipv4v6"], + "supported-modes":["allowed: 2g; preferred: none","allowed: 3g; preferred: none","allowed: 4g; preferred: none","allowed: 2g, 3g; preferred: 3g","allowed: 2g, 3g; preferred: 2g","allowed: 2g, 4g; preferred: 4g","allowed: 2g, 4g; preferred: 2g","allowed: 3g, 4g; preferred: 4g","allowed: 3g, 4g; preferred: 3g","allowed: 2g, 3g, 4g; preferred: 4g","allowed: 2g, 3g, 4g; preferred: 3g","allowed: 2g, 3g, 4g; preferred: 2g"], + "unlock-required":"sim-pin2", + "unlock-retries":["sim-pin (3)","sim-puk (10)","sim-pin2 (3)","sim-puk2 (10)"] + } + } +} \ No newline at end of file diff --git a/lib/controller/report/node_0.js b/lib/controller/report/node_0.js new file mode 100644 index 0000000..3ef5559 --- /dev/null +++ b/lib/controller/report/node_0.js @@ -0,0 +1,28 @@ +{ + id: 'db_node_%%%NODEID%%%', + tools: [{ + id:'gear', + handler: function(){ + showServerToolBox(%%%NODEID%%%); + } + }], + frame: true, + width: 258, + height: 240, + border: false, + title: '%%%SYSSERVERNAME%%%', + items: [{ + xtype: 'panel', + html: '

%%%SERVERSTATUS%%%

' + },{ + xtype: 'panel', + html: '
0CPU0MEM0DISK
' + },{ + xtype: 'panel', + height: 80, + frame: true, + border: false, + autoScroll: true, + items: %%%MODULES%%% + }] +} \ No newline at end of file diff --git a/lib/controller/report/node_1.js b/lib/controller/report/node_1.js new file mode 100644 index 0000000..d93f46c --- /dev/null +++ b/lib/controller/report/node_1.js @@ -0,0 +1,96 @@ +{ + id: 'db_node_%%%NODEID%%%', + width: 258, + height: 320, + title: '%%%NODENAME%%%', + tools: [{ + id:'gear', + handler: function(){ + //Ext.Msg.alert('Message', 'The Settings tool was clicked.'); + showSensorToolBox( %%%NODEID%%% ); + } + }], + listeners:{ + afterrender: function(){ + cleanup2DDraw( %%%NODEID%%% ); + drawZoomLevels[%%%NODEID%%%]=100; + //Deffer + } + }, + items:[{ + html: '
', + height: '260px' + },{ + id: 'status_%%%NODEID%%%', + border: true, + frame: true, + height: 36, + html: '' + }], + bbar:[{ + xtype: 'button', + text: '12.5%', + enableToggle: true, + id: 'zoom_bt12_%%%NODEID%%%', + toggleGroup: 'zoom_tg_%%%NODEID%%%', + toggleHandler: function( bt, st ){ + if( st ){ + drawZoomLevels[%%%NODEID%%%]=12; + var img = document.getElementById('draw_img_%%%NODEID%%%'); + img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=12"; + img.onload = function(){ + cleanup2DDraw( %%%NODEID%%% ); + }; + }; + } + },{ + xtype: 'button', + text: '25%', + enableToggle: true, + id: 'zoom_bt25_%%%NODEID%%%', + toggleGroup: 'zoom_tg_%%%NODEID%%%', + toggleHandler: function( bt, st ){ + if( st ){ + drawZoomLevels[%%%NODEID%%%]=25; + var img = document.getElementById('draw_img_%%%NODEID%%%'); + img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=25"; + img.onload = function(){ + cleanup2DDraw( %%%NODEID%%% ); + }; + }; + } + },{ + xtype: 'button', + text: '50%', + enableToggle: true, + id: 'zoom_bt50_%%%NODEID%%%', + toggleGroup: 'zoom_tg_%%%NODEID%%%', + toggleHandler: function( bt, st ){ + if( st ){ + drawZoomLevels[%%%NODEID%%%]=50; + var img = document.getElementById('draw_img_%%%NODEID%%%'); + img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=50"; + img.onload = function(){ + cleanup2DDraw( %%%NODEID%%% ); + }; + }; + } + },{ + xtype: 'button', + text: '100%', + pressed: true, + enableToggle: true, + id: 'zoom_bt100_%%%NODEID%%%', + toggleGroup: 'zoom_tg_%%%NODEID%%%', + toggleHandler: function( bt, st ){ + if( st ){ + drawZoomLevels[%%%NODEID%%%]=100; + var img = document.getElementById('draw_img_%%%NODEID%%%'); + img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=100"; + img.onload = function(){ + cleanup2DDraw( %%%NODEID%%% ); + }; + }; + } + }] +} \ No newline at end of file diff --git a/lib/controller/report/node_10.js b/lib/controller/report/node_10.js new file mode 100644 index 0000000..3e4558f --- /dev/null +++ b/lib/controller/report/node_10.js @@ -0,0 +1,39 @@ +{ + id: 'db_node_%%%NODEID%%%', + //xtype: 'portlet', + layout:'fit', + //width: 258, + //height: %%%HEIGHT%%%+40, + tools: [{ + id:'gear', + handler: function(){ + //editAnalogStream( %%%STREAMID%%%, 1 ); + } + }], + frame: true, + draggable: false, + bodyStyle: 'padding: 0px;', + title: '%%%NODENAME%%%', + items:[{ + 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/report/node_11.js b/lib/controller/report/node_11.js new file mode 100644 index 0000000..18cf639 --- /dev/null +++ b/lib/controller/report/node_11.js @@ -0,0 +1,61 @@ +{ + id: 'db_node_%%%NODEID%%%', + layout:'vbox', + tools: [{ + id:'gear', + handler: function(){ + } + }], + frame: true, + draggable: false, + collapsible: false, + bodyStyle: 'padding: 0px;', + title: '%%%NODENAME%%%', + sukaMineWidth: -1, + items:[{ + id: 'db_node_%%%NODEID%%%_pic', + border: true, + width: '100%', + html: '
 
 
  
' + }], + listeners:{ + 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 + 32 ); + var z = Ext.getCmp('db_node_%%%NODEID%%%_pic'); + z.setHeight( XX ); + }; + }; + }, + afterrender: function( p ){ + var xx = p.getWidth() * %%%HEIGHT%%% / %%%WIDTH%%%; + p.setHeight( xx + 32 ); + 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 ); + } + } +} \ No newline at end of file diff --git a/lib/controller/report/node_12.js b/lib/controller/report/node_12.js new file mode 100644 index 0000000..686568d --- /dev/null +++ b/lib/controller/report/node_12.js @@ -0,0 +1,18 @@ +{ + id: 'db_node_%%%NODEID%%%', + xtype: 'portlet', + width: 258, + height: %%%HEIGHT%%%+40, + tools: [{ + id:'gear', + handler: function(){ + editAnalogStream( %%%STREAMID%%%, 1 ); + } + }], + frame: true, + bodyStyle: 'padding: 0px;', + title: '%%%NODENAME%%%', + items:[{ + html: '', + }] +} \ No newline at end of file diff --git a/lib/controller/report/node_13 - Copy.js b/lib/controller/report/node_13 - Copy.js new file mode 100644 index 0000000..d5d98f2 --- /dev/null +++ b/lib/controller/report/node_13 - Copy.js @@ -0,0 +1,72 @@ +{ + id: 'db_node_%%%NODEID%%%', + layout:'vbox', + tools: [{ + id:'gear', + handler: function(){ + } + }], + frame: true, + bodyStyle: 'padding: 0px;', + plr: null, + title: '%%%NODENAME%%%', + sukaMineWidth: -1, + items:[{ + id: 'db_node_%%%NODEID%%%_pic', + border: true, + width: '100%', + html: '' + },{ + xtype: 'spacer', + height: 3 + },{ + html: '
 
 
  
', + height: 90 + }], + listeners:{ + 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 ); + }; + }; + 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; + } + } +} \ No newline at end of file diff --git a/lib/controller/report/node_13.js b/lib/controller/report/node_13.js new file mode 100644 index 0000000..11a7438 --- /dev/null +++ b/lib/controller/report/node_13.js @@ -0,0 +1,91 @@ +{ + id: 'db_node_%%%NODEID%%%', + layout:'vbox', + tools: [{ + id:'gear', + handler: function(){ + } + }], + frame: true, + draggable: false, + collapsible: false, + bodyStyle: 'padding: 0px;', + title: '%%%NODENAME%%%', + sukaMineWidth: -1, + /* + { + id: 'db_node_%%%NODEID%%%_pic', + border: true, + width: '100%', + //html: '
 
 
%%%HBTN%%% 
' + //html: '
' + //html: '' + html:'' + }, + + */ + items:[{ + xtype: 'button', + id: 'db_download_video', + scale: 'large', + enableToggle: true, + disabled: true, + text: 'Download Video File', + width: '100%', + handler: function(){ + if( DownloadVideoLink!= '' ){ + var link = document.createElement("a"); + // If you don't know the name or want to use + // the webserver default set name = '' + //link.setAttribute('download', name ); + link.setAttribute('download', '' ); + link.href = DownloadVideoLink; + document.body.appendChild(link); + link.click(); + link.remove(); + } + } + }], + listeners:{ + 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 + 32 ); + var z = Ext.getCmp('db_download_video'); + z.setHeight( XX ); + }; + }; + }, + afterrender: function( p ){ + var xx = p.getWidth() * %%%HEIGHT%%% / %%%WIDTH%%%; + p.setHeight( xx + 32 ); + //var z = Ext.getCmp('db_node_%%%NODEID%%%_pic'); + //z.setHeight( xx - 132 ); + /* + 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 ); + */ + } + } +} \ No newline at end of file diff --git a/lib/controller/report/node_13.js.bk2 b/lib/controller/report/node_13.js.bk2 new file mode 100644 index 0000000..7d7b9b8 --- /dev/null +++ b/lib/controller/report/node_13.js.bk2 @@ -0,0 +1,19 @@ +{ + id: 'db_node_%%%NODEID%%%', + xtype: 'panel', + width: 400, + height: 400, + frame: true, + title: 'Camera %%%NODEID%%%', + items:[{ + html: '', + }], + listeners:{ + afterrender: function(){ + var player = videojs('hls-example',{ + autoplay: 'muted' + }); + return true; + }, + } +} \ No newline at end of file diff --git a/lib/controller/report/node_2.js b/lib/controller/report/node_2.js new file mode 100644 index 0000000..4f1790f --- /dev/null +++ b/lib/controller/report/node_2.js @@ -0,0 +1,88 @@ +{ + id: 'db_node_%%%NODEID%%%', + width: 258, + height: 320, + title: '%%%NODENAME%%%', + listeners:{ + afterrender: function(){ + cleanup2DDraw( %%%NODEID%%% ); + drawZoomLevels[%%%NODEID%%%]=100; + } + }, + items:[{ + html: '
', + height: '260px' + },{ + id: 'status_%%%NODEID%%%', + border: true, + frame: true, + height: 36, + html: '' + }], + bbar:[{ + xtype: 'button', + text: '12.5%', + enableToggle: true, + id: 'zoom_bt12_%%%NODEID%%%', + toggleGroup: 'zoom_tg_%%%NODEID%%%', + toggleHandler: function( bt, st ){ + if( st ){ + drawZoomLevels[%%%NODEID%%%]=12; + var img = document.getElementById('draw_img_%%%NODEID%%%'); + img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=12"; + img.onload = function(){ + cleanup2DDraw( %%%NODEID%%% ); + }; + }; + } + },{ + xtype: 'button', + text: '25%', + enableToggle: true, + id: 'zoom_bt25_%%%NODEID%%%', + toggleGroup: 'zoom_tg_%%%NODEID%%%', + toggleHandler: function( bt, st ){ + if( st ){ + drawZoomLevels[%%%NODEID%%%]=25; + var img = document.getElementById('draw_img_%%%NODEID%%%'); + img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=25"; + img.onload = function(){ + cleanup2DDraw( %%%NODEID%%% ); + }; + }; + } + },{ + xtype: 'button', + text: '50%', + enableToggle: true, + id: 'zoom_bt50_%%%NODEID%%%', + toggleGroup: 'zoom_tg_%%%NODEID%%%', + toggleHandler: function( bt, st ){ + if( st ){ + drawZoomLevels[%%%NODEID%%%]=50; + var img = document.getElementById('draw_img_%%%NODEID%%%'); + img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=50"; + img.onload = function(){ + cleanup2DDraw( %%%NODEID%%% ); + }; + }; + } + },{ + xtype: 'button', + text: '100%', + pressed: true, + enableToggle: true, + id: 'zoom_bt100_%%%NODEID%%%', + toggleGroup: 'zoom_tg_%%%NODEID%%%', + toggleHandler: function( bt, st ){ + if( st ){ + drawZoomLevels[%%%NODEID%%%]=100; + var img = document.getElementById('draw_img_%%%NODEID%%%'); + img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=100"; + img.onload = function(){ + cleanup2DDraw( %%%NODEID%%% ); + }; + }; + } + }] +} \ No newline at end of file diff --git a/lib/controller/report/node_3 - Copy.js b/lib/controller/report/node_3 - Copy.js new file mode 100644 index 0000000..e40820f --- /dev/null +++ b/lib/controller/report/node_3 - Copy.js @@ -0,0 +1,95 @@ +{ + id: 'db_node_%%%NODEID%%%', + width: 258, + height: 320, + title: '%%%NODENAME%%%', + tools: [{ + id:'gear', + handler: function(){ + //Ext.Msg.alert('Message', 'The Settings tool was clicked.'); + showSensorToolBox( %%%NODEID%%% ); + } + }], + listeners:{ + afterrender: function(){ + cleanup2DDraw( %%%NODEID%%% ); + drawZoomLevels[%%%NODEID%%%]=100; + } + }, + items:[{ + html: '
', + height: '260px' + },{ + id: 'status_%%%NODEID%%%', + border: true, + frame: true, + height: 36, + html: '' + }], + bbar:[{ + xtype: 'button', + text: '12.5%', + enableToggle: true, + id: 'zoom_bt12_%%%NODEID%%%', + toggleGroup: 'zoom_tg_%%%NODEID%%%', + toggleHandler: function( bt, st ){ + if( st ){ + drawZoomLevels[%%%NODEID%%%]=12; + var img = document.getElementById('draw_img_%%%NODEID%%%'); + img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=12"; + img.onload = function(){ + cleanup2DDraw( %%%NODEID%%% ); + }; + }; + } + },{ + xtype: 'button', + text: '25%', + enableToggle: true, + id: 'zoom_bt25_%%%NODEID%%%', + toggleGroup: 'zoom_tg_%%%NODEID%%%', + toggleHandler: function( bt, st ){ + if( st ){ + drawZoomLevels[%%%NODEID%%%]=25; + var img = document.getElementById('draw_img_%%%NODEID%%%'); + img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=25"; + img.onload = function(){ + cleanup2DDraw( %%%NODEID%%% ); + }; + }; + } + },{ + xtype: 'button', + text: '50%', + enableToggle: true, + id: 'zoom_bt50_%%%NODEID%%%', + toggleGroup: 'zoom_tg_%%%NODEID%%%', + toggleHandler: function( bt, st ){ + if( st ){ + drawZoomLevels[%%%NODEID%%%]=50; + var img = document.getElementById('draw_img_%%%NODEID%%%'); + img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=50"; + img.onload = function(){ + cleanup2DDraw( %%%NODEID%%% ); + }; + }; + } + },{ + xtype: 'button', + text: '100%', + pressed: true, + enableToggle: true, + id: 'zoom_bt100_%%%NODEID%%%', + toggleGroup: 'zoom_tg_%%%NODEID%%%', + toggleHandler: function( bt, st ){ + if( st ){ + drawZoomLevels[%%%NODEID%%%]=100; + var img = document.getElementById('draw_img_%%%NODEID%%%'); + img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=100"; + img.onload = function(){ + cleanup2DDraw( %%%NODEID%%% ); + }; + }; + } + }] +} \ No newline at end of file diff --git a/lib/controller/report/node_3.js b/lib/controller/report/node_3.js new file mode 100644 index 0000000..508141c --- /dev/null +++ b/lib/controller/report/node_3.js @@ -0,0 +1,95 @@ +{ + id: 'db_node_%%%NODEID%%%', + title: '%%%NODENAME%%%', + draggable: false, + collapsible: false, + tools: [{ + id:'toggle', + handler: function( a, b, p ){ + fsDrawID = %%%NODEID%%%; + fullScreen( 'div_radar_%%%NODEID%%%' ); + var el = document.getElementById('draw_svgr_'+fsDrawID ); + var nW = Math.floor( ( window.screen.height/window.screen.width ) * 100 ); + el.removeAttribute("width"); + el.setAttribute( "width", nW+'%' ); + } + }], + listeners:{ + afterrender: function(p){ + masks_statuses[%%%NODEID%%%] = 0; + masks_exist[%%%NODEID%%%] = 0; + + var W=p.getWidth(); + var H=9*(W/8); + p.setHeight( H + 32 ); + Ext.getCmp( 'cp_radar_%%%NODEID%%%' ).setHeight( H - 18 ); + //document.getElementById('draw_svg_%%%NODEID%%%').setAttribute("width", H-45 ); + set2DZoomLevel( %%%NODEID%%%, 100 ); + var el = document.getElementById('div_radar_%%%NODEID%%%'); + el.addEventListener( "fullscreenchange", ( evt )=>{ + if( document.fullscreenElement ){ + } else { + if( fsDrawID ){ + var el = document.getElementById('draw_svgr_'+fsDrawID ); + el.removeAttribute("width"); + el.setAttribute( "width", '86%' ); + fsDrawID = 0; + }; + }; + }); + window.setTimeout( load2DDraw, 10*%%%NODEID%%%, %%%NODEID%%%, 'draw_svgr_' ); + } + }, + layout: 'hbox', + items:[{ + id: 'cp_radar_%%%NODEID%%%', + html: '
100 m.502512.5
', + width: '100%' + }], + bbar:[{ + xtype: 'button', + text: '12.5%', + enableToggle: true, + id: 'zoom_bt12_%%%NODEID%%%', + toggleGroup: 'zoom_tg_%%%NODEID%%%', + toggleHandler: function( bt, st ){ + if( st ){ + set2DZoomLevel( %%%NODEID%%%, 12 ); + }; + } + },{ + xtype: 'button', + text: '25%', + enableToggle: true, + id: 'zoom_bt25_%%%NODEID%%%', + toggleGroup: 'zoom_tg_%%%NODEID%%%', + toggleHandler: function( bt, st ){ + if( st ){ + set2DZoomLevel( %%%NODEID%%%, 25 ); + }; + } + },{ + xtype: 'button', + text: '50%', + enableToggle: true, + id: 'zoom_bt50_%%%NODEID%%%', + toggleGroup: 'zoom_tg_%%%NODEID%%%', + toggleHandler: function( bt, st ){ + if( st ){ + set2DZoomLevel( %%%NODEID%%%, 50 ); + }; + } + },{ + xtype: 'button', + text: '100%', + pressed: true, + enableToggle: true, + id: 'zoom_bt100_%%%NODEID%%%', + toggleGroup: 'zoom_tg_%%%NODEID%%%', + toggleHandler: function( bt, st ){ + if( st ){ + set2DZoomLevel( %%%NODEID%%%, 100 ); + }; + } + }] +} \ No newline at end of file diff --git a/lib/controller/report/node_4.js b/lib/controller/report/node_4.js new file mode 100644 index 0000000..fd8ac9c --- /dev/null +++ b/lib/controller/report/node_4.js @@ -0,0 +1,95 @@ +{ + id: 'db_node_%%%NODEID%%%', + width: 258, + height: 320, + title: '%%%NODENAME%%%', + tools: [{ + id:'gear', + handler: function(){ + //Ext.Msg.alert('Message', 'The Settings tool was clicked.'); + showSensorToolBox( %%%NODEID%%% ); + } + }], + listeners:{ + afterrender: function(){ + cleanup2DDraw( %%%NODEID%%% ); + drawZoomLevels[%%%NODEID%%%]=100; + } + }, + items:[{ + html: '
', + height: '260px' + },{ + id: 'status_%%%NODEID%%%', + border: true, + frame: true, + height: 36, + html: '' + }], + bbar:[{ + xtype: 'button', + text: '12.5%', + enableToggle: true, + id: 'zoom_bt12_%%%NODEID%%%', + toggleGroup: 'zoom_tg_%%%NODEID%%%', + toggleHandler: function( bt, st ){ + if( st ){ + drawZoomLevels[%%%NODEID%%%]=12; + var img = document.getElementById('draw_img_%%%NODEID%%%'); + img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=12"; + img.onload = function(){ + cleanup2DDraw( %%%NODEID%%% ); + }; + }; + } + },{ + xtype: 'button', + text: '25%', + enableToggle: true, + id: 'zoom_bt25_%%%NODEID%%%', + toggleGroup: 'zoom_tg_%%%NODEID%%%', + toggleHandler: function( bt, st ){ + if( st ){ + drawZoomLevels[%%%NODEID%%%]=25; + var img = document.getElementById('draw_img_%%%NODEID%%%'); + img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=25"; + img.onload = function(){ + cleanup2DDraw( %%%NODEID%%% ); + }; + }; + } + },{ + xtype: 'button', + text: '50%', + enableToggle: true, + id: 'zoom_bt50_%%%NODEID%%%', + toggleGroup: 'zoom_tg_%%%NODEID%%%', + toggleHandler: function( bt, st ){ + if( st ){ + drawZoomLevels[%%%NODEID%%%]=50; + var img = document.getElementById('draw_img_%%%NODEID%%%'); + img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=50"; + img.onload = function(){ + cleanup2DDraw( %%%NODEID%%% ); + }; + }; + } + },{ + xtype: 'button', + text: '100%', + pressed: true, + enableToggle: true, + id: 'zoom_bt100_%%%NODEID%%%', + toggleGroup: 'zoom_tg_%%%NODEID%%%', + toggleHandler: function( bt, st ){ + if( st ){ + drawZoomLevels[%%%NODEID%%%]=100; + var img = document.getElementById('draw_img_%%%NODEID%%%'); + img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=100"; + img.onload = function(){ + cleanup2DDraw( %%%NODEID%%% ); + }; + }; + } + }] +} \ No newline at end of file diff --git a/lib/controller/report/node_5.js b/lib/controller/report/node_5.js new file mode 100644 index 0000000..0a8e15f --- /dev/null +++ b/lib/controller/report/node_5.js @@ -0,0 +1,164 @@ +{ + id: 'db_node_%%%NODEID%%%', + width: 258, + height: 336, + title: '%%%NODENAME%%%', + tools: [{ + id:'gear', + handler: function(){ + //Ext.Msg.alert('Message', 'The Settings tool was clicked.'); + showSensorToolBox( %%%NODEID%%% ); + } + }], + listeners:{ + beforedestroy: function(){ + if( typeof nodeTHREEviewers[%%%NODEID%%%] !== 'undefined' ){ + //nodeTHREEviewers[%%%NODEID%%%].container + // object.geometry.dispose(); object.material.dispose(); scene.remove( object ); + stopAnimation(); + nodeTHREEviewers[%%%NODEID%%%].renderer.renderLists.dispose(); + delete nodeTHREEviewers[%%%NODEID%%%].renderer; + delete nodeTHREEviewers[%%%NODEID%%%].scene; + delete nodeTHREEviewers[%%%NODEID%%%].mesh; + delete nodeTHREEviewers[%%%NODEID%%%].geometry; + delete nodeTHREEviewers[%%%NODEID%%%].material; + delete nodeTHREEviewers[%%%NODEID%%%].texture; + delete nodeTHREEviewers[%%%NODEID%%%].camera; + delete nodeTHREEviewers[%%%NODEID%%%]; + }; + return true; + }, + afterrender: function(){ + //cleanupDraw( %%%NODEID%%% ); + //drawZoomLevels[%%%NODEID%%%]=100; + //const panorama = new PANOLENS.ImagePanorama( '/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%' ); + //const viewer = new PANOLENS.Viewer({container: 'targ_canvas_%%%NODEID%%%' }); + //viewer.add( panorama ); + nodeTHREEviewers[%%%NODEID%%%] = {}; + nodeTHREEviewers[%%%NODEID%%%].container = document.getElementById( 'container_%%%NODEID%%%' ); + + nodeTHREEviewers[%%%NODEID%%%].camera = new THREE.PerspectiveCamera( 75, 1, 1, 1100 ); + nodeTHREEviewers[%%%NODEID%%%].scene = new THREE.Scene(); + nodeTHREEviewers[%%%NODEID%%%].geometry = new THREE.SphereGeometry( 500, 60, 40 ); + // invert the geometry on the x-axis so that all of the faces point inward + nodeTHREEviewers[%%%NODEID%%%].geometry.scale( -1, 1, 1 ); + + nodeTHREEviewers[%%%NODEID%%%].texture = new THREE.TextureLoader().load( '/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%' ); + nodeTHREEviewers[%%%NODEID%%%].material = new THREE.MeshBasicMaterial( { map: nodeTHREEviewers[%%%NODEID%%%].texture } ); + nodeTHREEviewers[%%%NODEID%%%].mesh = new THREE.Mesh( nodeTHREEviewers[%%%NODEID%%%].geometry, nodeTHREEviewers[%%%NODEID%%%].material ); + nodeTHREEviewers[%%%NODEID%%%].scene.add( nodeTHREEviewers[%%%NODEID%%%].mesh ); + nodeTHREEviewers[%%%NODEID%%%].scene.add( l3dMapOverlayMesh ); + + nodeTHREEviewers[%%%NODEID%%%].renderer = new THREE.WebGLRenderer(); + nodeTHREEviewers[%%%NODEID%%%].renderer.setPixelRatio( 1 ); + nodeTHREEviewers[%%%NODEID%%%].renderer.setSize( nodeTHREEviewers[%%%NODEID%%%].container.clientWidth, 200 ); + nodeTHREEviewers[%%%NODEID%%%].container.appendChild( nodeTHREEviewers[%%%NODEID%%%].renderer.domElement ); + + nodeTHREEviewers[%%%NODEID%%%].container.style.touchAction = 'none'; + nodeTHREEviewers[%%%NODEID%%%].container.myVID = %%%NODEID%%%; + + nodeTHREEviewers[%%%NODEID%%%].container.addEventListener( 'pointerdown', onPointerDown ); + nodeTHREEviewers[%%%NODEID%%%].container.addEventListener( 'wheel', onDocumentMouseWheel ); + nodeTHREEviewers[%%%NODEID%%%].targets = new Array(); + nodeTHREEviewers[%%%NODEID%%%].targetShowCopunter = 0; + nodeTHREEviewers[%%%NODEID%%%].targetIndex = 0; + + //addl3dTarget( %%%NODEID%%%, 200, Math.PI/4, Math.PI/4 ); + //addl3dTarget( %%%NODEID%%%, 150, 0, 0 ); + //document.addEventListener( 'wheel', onDocumentMouseWheel ); + /* + container.addEventListener( 'dragover', function ( event ) { + + event.preventDefault(); + event.dataTransfer.dropEffect = 'copy'; + + } ); + container.addEventListener('dragenter', function () { + + document.body.style.opacity = 0.5; + + } ); + container.addEventListener('dragleave', function () { + + document.body.style.opacity = 1; + + } ); + container.addEventListener('drop', function ( event ) { + + event.preventDefault(); + + const reader = new FileReader(); + reader.addEventListener( 'load', function ( event ) { + + material.map.image.src = event.target.result; + material.map.needsUpdate = true; + + } ); + reader.readAsDataURL( event.dataTransfer.files[ 0 ] ); + + document.body.style.opacity = 1; + + } ); + */ + /* + document.addEventListener( 'dragover', function ( event ) { + + event.preventDefault(); + event.dataTransfer.dropEffect = 'copy'; + + } ); + + document.addEventListener( 'dragenter', function () { + + document.body.style.opacity = 0.5; + + } ); + + document.addEventListener( 'dragleave', function () { + + document.body.style.opacity = 1; + + } ); + + document.addEventListener( 'drop', function ( event ) { + + event.preventDefault(); + + const reader = new FileReader(); + reader.addEventListener( 'load', function ( event ) { + + material.map.image.src = event.target.result; + material.map.needsUpdate = true; + + } ); + reader.readAsDataURL( event.dataTransfer.files[ 0 ] ); + + document.body.style.opacity = 1; + + } ); + */ + //animateTargets(); + animate(); + + // + + //window.addEventListener( 'resize', onWindowResize ); + } + }, + items:[{ + html: '
', + height: 210 + },{ + id: 'status_%%%NODEID%%%', + border: true, + frame: true, + height: 36, + html: '' + },{ xtype: 'spacer', height: 3 },{ + id: 'det_status_%%%NODEID%%%', + border: true, + frame: true, + height: 46, + html: '' + }] +} \ No newline at end of file diff --git a/lib/controller/report/tpl.js b/lib/controller/report/tpl.js new file mode 100644 index 0000000..d387b49 --- /dev/null +++ b/lib/controller/report/tpl.js @@ -0,0 +1,16 @@ +[{ + columnWidth: '320px', + style:'padding:10px 0 10px 10px', + items:[ + %%%ITEMS%%% + ] +},{ + columnWidth: '320px', + style:'padding:10px 0 10px 10px' +},{ + columnWidth: '320px', + style:'padding:10px 0 10px 10px' +},{ + columnWidth: '320px', + style:'padding:10px 0 10px 10px' +}] \ No newline at end of file diff --git a/lib/controller/updateUser.php b/lib/controller/updateUser.php new file mode 100644 index 0000000..5a2239c --- /dev/null +++ b/lib/controller/updateUser.php @@ -0,0 +1,124 @@ +Data['id'] > 1 ){ + $DATA = array(); + $DATA['success'] = false; + if( $CUser->Data['access'] > 4 ){ + $COP = intval( $_POST['OP'] ); + switch( $COP ){ + case 0:{ + //add new + $NLO = $DATABASE->escape( $_POST['NLO'] ); + $PWD = $_POST['PW1']; + $RWD = $_POST['PW2']; + $ACC = intval($_POST['ACC']); + if( $PWD == '' ){ + $DATA['msg'] = 'No Password defined!'; + } else { + if( $_POST['NLO'] == '' ){ + $DATA['msg'] = 'No Login defined!'; + } else { + if( $PWD == $RWD ){ + $M5 = md5( $PWD ); + $CTS = time(); + $QS="INSERT INTO `users`(`create_ts`,`login`,`pwdMD5`,`status`,`access`) VALUES ( {$CTS},'{$NLO}','{$M5}','A',{$ACC})"; + $DATABASE->Query( $QS ); + $DATA['success'] = true; + } else { + $DATA['msg'] = 'Passwords does not match!'; + }; + }; + }; + break; + }; + case 1:{ + //change old + $UID = intval($_POST['SUID']); + if( $UID ){ + $OLO = $DATABASE->escape( $_POST['OLO'] ); + $NLO = $DATABASE->escape( $_POST['NLO'] ); + $PWD = $_POST['PW1']; + $RWD = $_POST['PW2']; + $ACC = intval($_POST['ACC']); + if( $PWD == '' ){ + $QS="UPDATE `users` SET `login`='{$NLO}', `access`={$ACC} WHERE id={$UID}"; + $DATABASE->Query( $QS ); + $DATA['success'] = true; + } else { + if( $PWD == $RWD ){ + $M5 = md5( $PWD ); + $QS="UPDATE `users` SET `login`='{$NLO}', `pwdMD5`='{$M5}', `access`={$ACC} WHERE id={$UID}"; + $DATABASE->Query( $QS ); + $DATA['success'] = true; + } else { + $DATA['msg'] = 'Passwords does not match!'; + }; + }; + } else { + $DATA['msg'] = 'Wrong User ID!'; + }; + break; + }; + case 2:{ + $UID = intval($_POST['SUID']); + if( $UID ){ + if( $UID != $CUser->Data['id'] ){ + if( $UID > 1 ){ + $QS="UPDATE `users` SET `status`='D' WHERE id={$UID}"; + $DATABASE->Query( $QS ); + $DATA['success'] = true; + } else { + $DATA['msg'] = 'You Can not change Guest account!'; + }; + } else { + $DATA['msg'] = 'You Can not block yoreself account!'; + }; + } else { + $DATA['msg'] = 'Wrong User ID!'; + }; + break; + }; + case 3:{ + $UID = intval($_POST['SUID']); + if( $UID ){ + if( $UID > 1 ){ + $QS="UPDATE `users` SET `status`='A' WHERE id={$UID}"; + $DATABASE->Query( $QS ); + $DATA['success'] = true; + } else { + $DATA['msg'] = 'You Can not change Guest account!'; + }; + } else { + $DATA['msg'] = 'Wrong User ID!'; + }; + break; + }; + case 4:{ + $UID = intval($_POST['SUID']); + if( $UID ){ + if( $UID != $CUser->Data['id'] ){ + if( $UID > 1 ){ + $QS="DELETE FROM `users` WHERE id={$UID}"; + $DATABASE->Query( $QS ); + $DATA['success'] = true; + } else { + $DATA['msg'] = 'You Can not remove Guest account!'; + }; + } else { + $DATA['msg'] = 'You Can not remove yoreself account!'; + }; + } else { + $DATA['msg'] = 'Wrong User ID!'; + }; + break; + }; + default: $DATA['msg'] = 'Wrong Operation!'; break; + }; + } else { + $DATA['msg'] = 'Access Permition Denied!'; + }; + echo json_encode( $DATA ); + exit(); + }; + header('location: /'); +?> \ No newline at end of file diff --git a/lib/controller/uploadDeviceMask.php b/lib/controller/uploadDeviceMask.php new file mode 100644 index 0000000..3f7fb91 --- /dev/null +++ b/lib/controller/uploadDeviceMask.php @@ -0,0 +1,125 @@ +Data['id'] > 1 ){ + $NodeID = intval($_POST['NID']); + //$SiteID = intval($_POST['SITE']); + $LayerID = intval($_POST['MID']); + $LRFID = intval($_POST['LID']); + $SERIAL = json_decode( $_POST['MDTA'] ); + $MHEI = intval($_POST['MIH']); + $MWID = intval($_POST['MIW']); + $SHX = intval($_POST['MSHX']); + $SHY = intval($_POST['MSHY']); + if( isset( $_POST['DSTD'] ) ) $DSTS = intval( $_POST['DSTD'] ); else $DSTS = 1; + $QS = "SELECT * FROM nodes WHERE id={$NodeID} "; + $Data = array(); + $NPC = 0; + $SCHEDULE_JOB = 0; // NOJOB + $result = $DATABASE->Query( $QS, false ); + if( $SHX == $SHY ) $Process = 0; else $Process = 1; + if( count( $result ) && $MHEI ){ + if( $Process == 1 ){ + $SCALE = 288.0 / floatval( $MHEI ); + } else { + $SCALE = 4096.0 / floatval( $MHEI ); + }; + $T = $result[0]; + $AID = $T['aux_id']; + $QS = "SELECT id FROM `lrf_masks` WHERE `sensor_id`={$AID} AND `lrf_id`={$LRFID} AND `layer`={$LayerID}"; + $result = $DATABASE->Query( $QS, false ); + $CV = array(); + $MID = 0; + if( count($result) == 0 ){ // No Masks Where Defined + $QS = "INSERT INTO `lrf_masks` (`sensor_id`,`lrf_id`,`layer`) VALUES ({$AID},{$LRFID},{$LayerID})"; + $DATABASE->Query( $QS, false ); + $MID = $DATABASE->getLastInsertID(); + } else { + $MID = $result[0]['id']; + $QS = "SELECT * FROM `lrf_mask_vertexes` WHERE `mask_id`={$MID}"; + $ZA = $DATABASE->Query( $QS ); + foreach( $ZA as $A ){ + $QS = "DELETE FROM `lrf_mask_vertex_points` WHERE `vertex_id`={$A['id']}"; + $DATABASE->Query( $QS ); + }; + $QS = "DELETE FROM `lrf_mask_vertexes` WHERE `mask_id`={$MID}"; + $DATABASE->Query( $QS ); + }; + + + $SCHEDULE_JOB = 1; // Clear Mask + foreach( $SERIAL[0][1]->children as $CCC ){ + $R = $CCC[1]->fillColor[0] * 255; + $G = $CCC[1]->fillColor[1] * 255; + $B = $CCC[1]->fillColor[2] * 255; + $QS = "INSERT INTO `lrf_mask_vertexes` (`mask_id`,`r`,`g`,`b`) VALUES ({$MID},{$R},{$G},{$B})"; + $DATABASE->Query( $QS, false ); + $VID = $DATABASE->getLastInsertID(); + foreach( $CCC[1]->segments as $SS ){ + if( $Process == 1 ){ + if( count( $SS ) == 2 ){ + $X = intval( $SCALE * floatval( intval( $SS[0] ) - $SHX ) ); + $Y = intval( $SCALE * floatval( intval( $SS[1] ) - $SHY ) ); + } else { + $X = intval( $SCALE * floatval( intval( $SS[0][0] ) - $SHX ) ); + $Y = intval( $SCALE * floatval( intval( $SS[0][1] ) - $SHY ) ); + }; + if( $X < 0 ) $X = 0; + if( $X > 2304 ) $X = 2304; + if( $Y < 0 ) $Y = 0; + if( $Y > 288 ) $Y = 288; + } else { + if( count( $SS ) == 2 ){ + $X = intval( $SCALE * floatval( intval( $SS[0] ) - $SHX ) ) - 2047; + $Y = intval( $SCALE * floatval( intval( $SS[1] ) - $SHY ) ) - 2047; + } else { + $X = intval( $SCALE * floatval( intval( $SS[0][0] ) - $SHX ) ) - 2047; + $Y = intval( $SCALE * floatval( intval( $SS[0][1] ) - $SHY ) ) - 2047; + }; + if( $X < -2047 ) $X = -2047; + if( $X > 2047 ) $X = 2047; + if( $Y < -2047 ) $Y = -2047; + if( $Y > 2047 ) $Y = 2047; + }; + $QS = "INSERT INTO `lrf_mask_vertex_points` (`vertex_id`,`x`,`y`) VALUES ({$VID},{$X},{$Y}) "; + $DATABASE->Query( $QS, false ); + $NPC++; + $SCHEDULE_JOB = 2; // Update - Set Mask + }; + }; + switch( $SCHEDULE_JOB ){ + case 1:{ + // Clear Mask No Points. + $QS = "SELECT * FROM `lrf_mask_vertexes` WHERE `mask_id`={$MID}"; + $ZA = $DATABASE->Query( $QS ); + foreach( $ZA as $A ){ + $QS = "DELETE FROM `lrf_mask_vertex_points` WHERE `vertex_id`={$A['id']}"; + $DATABASE->Query( $QS ); + }; + $QS = "DELETE FROM `lrf_mask_vertexes` WHERE `mask_id`={$MID}"; + $DATABASE->Query( $QS ); + $QS = "DELETE FROM `lrf_masks` WHERE `id`={$MID}"; + $DATABASE->Query( $QS ); + break; + }; + case 2:{ + // Don't Send To Device + if( $DSTS == 0 ){ + $CMD = 67;//60+$LayerID; + $QS = "INSERT INTO `nodes_qcq` (`node_id`,`cmd`,`parameter`) VALUES ({$NodeID},{$CMD},'{$LRFID}')"; + //echo $QS; + $DATABASE->Query( $QS, false ); + }; + break; + }; + }; + $Data[] = $CV; + }; + if( $NPC > 2 ){ + // Need to shcedule Rasterisation and send to device + + }; + echo json_encode( $Data ); + exit(); + }; + header('location: /'); +?> \ No newline at end of file diff --git a/lib/controller/uploadToDevice.php b/lib/controller/uploadToDevice.php new file mode 100644 index 0000000..f736620 --- /dev/null +++ b/lib/controller/uploadToDevice.php @@ -0,0 +1,63 @@ +$ok, "info"=>$info])); + }; + if( isset( $_GET['DID'] ) ) { + $DID = intval( $_GET['DID'] ); + } else { + verbose( 0,"No Device ID Supplied!"); + }; + // invalid upload + if( empty( $_FILES ) || $_FILES['file']['error'] ){ + verbose( 0, "Failed to move uploaded file.[" . $_FILES['file']['error'] . "]" ); + }; + // upload destination + //$filePath = __DIR__ . DIRECTORY_SEPARATOR . "../../vault/working_dir/uploads"; + $filePath = $SYSPath . 'lib/controller/data/uploads'; + if( !file_exists($filePath) ){ + if (!mkdir($filePath, 0777, true)) { + verbose(0, "Failed to create $filePath"); + }; + }; + $rfn = isset($_REQUEST["name"]) ? $_REQUEST["name"] : $_FILES["file"]["name"]; + $fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : $_FILES["file"]["name"]; + $filePath = $filePath . DIRECTORY_SEPARATOR . $fileName; + // dealing with the chunks + $chunk = isset($_REQUEST["chunk"]) ? intval($_REQUEST["chunk"]) : 0; + $chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 0; + $out = @fopen("{$filePath}.part", $chunk == 0 ? "wb" : "ab"); + if( $out ) { + $in = @fopen($_FILES['file']['tmp_name'], "rb"); + if( $in ){ + while( $buff = fread( $in, 4096 ) ){ + fwrite($out, $buff); + }; + } else { + verbose(0, "Failed to open input stream"); + }; + @fclose($in); + @fclose($out); + @unlink($_FILES['file']['tmp_name']); + } else { + verbose(0, "Failed to open output stream"); + }; + // check if file was uploaded + if (!$chunks || $chunk == $chunks - 1) { + $MD5 = md5_file( "{$filePath}.part" ); + $Dest = $SYSPath . 'lib/controller/data/uploads/'.$MD5; + rename("{$filePath}.part", $Dest ); + $QS = "INSERT INTO `lrf_uploads`( `sensor_id`, `ts`, `status`, `md5`, `file`, `issue_reset`) VALUES({$DID}, strftime('%s'), -1, '{$MD5}', '{$rfn}', 0 ) ON CONFLICT(`md5`) DO UPDATE SET `status`=-1, `ts`=strftime('%s'), `issue_reset`=0"; + $DATABASE->Query( $QS ); + //if( createNewTask( 3, $fileName, 'Handle Upload File' ) == 0 ){ + // unlink( $filePath ); + // verbose(0, "Failed to create new Task"); + //}; + }; + verbose(1, "Upload OK"); +?> \ No newline at end of file diff --git a/lib/controller/vfd.txt b/lib/controller/vfd.txt new file mode 100644 index 0000000..5ac4ca0 --- /dev/null +++ b/lib/controller/vfd.txt @@ -0,0 +1 @@ +'
100 m.502512.5
' \ No newline at end of file diff --git a/lib/defines.php b/lib/defines.php index 324bca0..a0bad95 100644 --- a/lib/defines.php +++ b/lib/defines.php @@ -2,14 +2,25 @@ $ARGUS_WEB_VERSION = trim( file_get_contents( '/srv/www/web/lib/version.var' ) ); +$SSL_INSTALLLED = false; + +if( $_SERVER['SERVER_PORT'] == 80 ){ + $WEBPath='http://' . $_SERVER['HTTP_HOST'] . '/';//$_SERVER['SERVER_NAME'] . '/'; + if( $SSL_INSTALLLED ){ + header( 'location: https://'.$_SERVER['SERVER_ADDR'].'/'.$_SERVER['QUERY_STRING'] ); + exit(); + }; +} else { + $WEBPath='https://' . $_SERVER['HTTP_HOST'] . '/';//$_SERVER['SERVER_NAME'] . '/'; +}; + +$SYSPath = '/srv/www/web/'; $ShowImagesLocal=false; $ShowThumbnailsLocal=true; $ShowAdw=true; $SaveLocal=false; $MailAgent='SENDMAIL'; $CGP_SubmitPath='../Submitted/'; - -$WEBPath='http://' . $_SERVER['HTTP_HOST'] . '/';//$_SERVER['SERVER_NAME'] . '/'; $DBCacheDir=$SYSPath . 'cache'; $MinimalSize=640000; diff --git a/lib/error.log b/lib/error.log index 2b589ab..9aa4443 120000 --- a/lib/error.log +++ b/lib/error.log @@ -1 +1 @@ -/var/log/apache2/error.log \ No newline at end of file +/var/log/nginx/error.log \ No newline at end of file diff --git a/lib/javascript/jsapi_dynamic/loaders.html b/lib/javascript/jsapi_dynamic/loaders.html new file mode 100644 index 0000000..56c7175 --- /dev/null +++ b/lib/javascript/jsapi_dynamic/loaders.html @@ -0,0 +1,346 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Made with + ? by + Nikhil Krishnan +
diff --git a/lib/javascript/jsapi_dynamic/mojo_dashboard.js b/lib/javascript/jsapi_dynamic/mojo_dashboard.js index c95c546..bd3165e 100644 --- a/lib/javascript/jsapi_dynamic/mojo_dashboard.js +++ b/lib/javascript/jsapi_dynamic/mojo_dashboard.js @@ -6,6 +6,107 @@ var serverToolBox = null; var currentNodeID = 0; +var masks_statuses = new Array(); +var masks_exist = new Array(); +var log_store_id = 0; +var log_array = new Array(); +var log_store = new Ext.data.JsonStore({ + autoDestroy: false, + storeId: 'log_store', + //idIndex: 0, + idProperty: 'id', + fields: [ + {name: 'id', type: 'int' }, + {name: 'node_id', type: 'int' }, + {name: 'node_name', type: 'string' }, + {name: 'dts', type: 'string'}, + {name: 'ts', type: 'int'}, + {name: 'ms', type: 'string'}, + {name: 'type', type: 'int'}, + {name: 'range', type: 'string'}, + {name: 'az', type: 'string'}, + {name: 'el', type: 'string'}, + {name: 'r', type: 'int'}, + {name: 'width', type: 'int'} + //{name: 'lat', type: 'float'}, + //{name: 'lon', type: 'float'}, + //{name: 'alt', type: 'float'}, + //{name: 'area', type: 'float'}, + //{name: 'video', type: 'string'}, + //{name: 'v_cpoint', type: 'int'} + ] +}); + +function log_sn_Renderer( value, meta, record ){ + //Must be set according to events + var kaka = record.data.node_id % 3; + return '
'+value+'
'; +}; +function log_et_Renderer( value, meta, record ){ + var kaka = record.data.node_id % 3; + switch( value ){ + case 6: ov = 'Device Enters Into Study Mode'; break; + case 7: ov = 'Device Is BUSY'; break; + case 8: ov = 'Flip Complete'; break; + case 9: ov = 'Scan Complete'; break; + case 12: ov = 'Black 2D Target'; break; + case 13: ov = 'White 2D Target'; break; + case 36: ov = 'Region Of Interest'; break; + case 39: ov = '[Train Filter] Check Target'; break; + case 40: ov = '[Train Filter] Upper Sensor Detection'; break; + case 41: ov = '[Train Filter] Bottom Sensor Detection'; break; + case 42: ov = '[Train Filter] Train Detected'; break; + case 43: ov = '[Train Filter] Train Updated'; break; + case 44: ov = '[Train Filter] Suspicious Activity'; break; + case 45: ov = '[Train Filter] Suspicious NACK'; break; + case 46: ov = '[Train Filter] Regular Detection'; break; + case 47: ov = '[Train Filter] Detection Disabled'; break; + case 48: ov = '[Train Filter] Suspicious Detection'; break; + case 49: ov = '[Train Filter] Differential Detection'; break; + case 52: ov = 'Event Started'; break; + case 53: ov = 'Event Ended'; break; + case 54: ov = 'Event Closed Manual'; break; + default: ov = 'Event ['+value+']'; + }; + return '
'+ov+'
'; +}; + +var log_ColModel_ops = { + columns: [ + {header: "Time", width: 100, fixed: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'dts' }, + {header: "Source", width: 100, renderer: log_sn_Renderer, align: 'left', css: 'vertical-align: middle;', dataIndex: 'node_name' }, + {header: "Type", width: 180, renderer: log_et_Renderer, fixed: false, align: 'center', css: 'vertical-align: middle;', dataIndex: 'type' }, + {header: "Range", width: 100, dataIndex: 'range' }, + {header: "Azimuth", width: 100, dataIndex: 'az' }, + {header: "Width", width: 100, dataIndex: 'width' }, + ], + defaults: { + sortable: false, + fixed: true, + menuDisabled: true, + width: 100 + } +}; + +var log_SelModel_ops = { + singleSelect: true, + listeners: { + rowselect: function(sm, row, rec ) { + //alert( rec.data.id ); + //loadEventProperties( rec.data ); + //SelectedEvent = rec.data.id; + //alert( SelectedEvent ); + //var CB = Ext.getCmp('con_to_src'); + //CB.enable(); + //selectedArchiveRecord = rec; + //if( rec.data.bk_type!=3 ){ + // + //} else { + // + //}; + } + } +}; //import * as THREE from 'three'; @@ -93,26 +194,26 @@ function select2DROI( id, event ){ if( targets_lts_2d[ id ] != undefined ) lts = targets_lts_2d[ id ]; switch( drawZoomLevels[ id ] ){ case 100:{ - var r = Math.round( hr * ( 1024.0 / ( bBox.width/ 2.0 ) ) ); - if( r > 1024 ) r = 1024; + var r = Math.round( hr * ( 2048.0 / ( bBox.width/ 2.0 ) ) ); + if( r > 2048 ) r = 2048; roi_2d[id]={ range: r, az: zat, ts: lts }; break; }; case 50:{ - var r = Math.round( hr * ( 512.0 / ( bBox.width/ 2.0 ) ) ); - if( r > 512 ) r = 512; + var r = Math.round( hr * ( 1024.0 / ( bBox.width/ 2.0 ) ) ); + if( r > 1024 ) r = 1024; roi_2d[id]={ range: r, az: zat, ts: lts }; break; }; case 25:{ - var r = Math.round( hr * ( 256.0 / ( bBox.width/ 2.0 ) ) ); - if( r > 256 ) r = 256; + var r = Math.round( hr * ( 512.0 / ( bBox.width/ 2.0 ) ) ); + if( r > 512 ) r = 512; roi_2d[id]={ range: r, az: zat, ts: lts }; break; }; case 12:{ - var r = Math.round( hr * ( 128.0 / ( bBox.width/ 2.0 ) ) ); - if( r > 128 ) r = 128; + var r = Math.round( hr * ( 256.0 / ( bBox.width/ 2.0 ) ) ); + if( r > 256 ) r = 256; roi_2d[id]={ range: r, az: zat, ts: lts }; break; }; @@ -458,6 +559,31 @@ function makePtzStop( me ){ }); }; +function makePtzHome( me ){ + var name = me.target.id; + const myArray = name.split("_"); + Ext.Ajax.request({ + url: '/lib/controller/doCameraOperation.php', + params: { + SITE: , + UID: , + SID: '', + CMD: 9, + CID: myArray[3], + MOV: 0 + }, + failure: failureAJAXFunction + }); +}; +var fsDrawID = 0; +function exitFullScreen( evt ){ + if( document.fullscreenElement ){ + } else { + if( fsDrawID ){ + console.log("Leaving fullscreen mode."); + }; + }; +}; function fullScreen( id = '' ){ if( id == '' || @@ -475,9 +601,11 @@ function fullScreen( id = '' ){ }else if( document.msExitFullscreen ){ document.msExitFullscreen(); }; + if( fsDrawID ){ + console.log('resized'); + }; }else{ - //element = $('#container').get(0); - var element = document.getElementById( id ); //Ext.getCmp( id ); + var element = document.getElementById( id ); if( element.requestFullscreen ){ element.requestFullscreen(); }else if( element.mozRequestFullScreen ){ @@ -527,40 +655,57 @@ function cleanup2DDraw( a ){ var csvg = document.getElementById( 'draw_svg_' + a ); if( csvg!= undefined ){ if( targets_2d_el[a] != undefined ){ - if( targets_2d_el[a].length > 0 ){ - for( idx = 0; idx < targets_2d_el[a].length; idx++ ) csvg.remove( targets_2d_el[a][idx] ); + if( targets_2d_el[a] ){ + for( idx = 0; idx < targets_2d_el[a]; idx++ ){ + var juja = csvg.getElementById( "targ_"+a+"_"+idx ); + if( juja != null ) csvg.removeChild( juja ); + }; }; + targets_2d_el[a] = 0; }; - var roi = csvg.getElementById( "roi" ); - if( roi != null ) csvg.removeChild( roi ); - }; - targets_2d_el[a] = []; + }; }; function draw2DTargets( a ){ cleanup2DDraw( a ); var csvg = document.getElementById( 'draw_svg_' + a ); if( csvg!= undefined ){ + var roi = csvg.getElementById( "roi" ); + if( roi != null ) csvg.removeChild( roi ); var bBox = csvg.getBBox(); - var max = 1024; + var max = 2048; switch( drawZoomLevels[a] ){ - case 50: max = 512; break; - case 25: max = 256; break; - case 12: max = 128; break; + case 50: max = 1024; break; + case 25: max = 512; break; + case 12: max = 256; break; }; var rk = bBox.width / ( max * 2 ); var cpx = bBox.width / 2.0; var cpy = bBox.height / 2.0; if( targets_2d[a] != undefined ){ - if( targets_2d[a].length > 0 ) { - var ak = 2.0*Math.PI/draws_2d[a].length; - for( idx = 0; idx < targets_2d[a].length; idx++ ){ - if( 1 ){ - targets_2d_el[a][idx] = document.createElementNS('http://www.w3.org/2000/svg', "circle"); - csvg.appendChild( targets_2d_el[a][idx] ); + if( targets_2d[a].length ) { + var ak = 2.0*Math.PI/360; + var ok = 1.0/35; + for( idx = targets_2d[a].length-1; idx > 0; idx-- ){ + if( targets_2d[a][idx].range < max ){ + x = cpx + rk * targets_2d[a][idx].range * Math.cos( targets_2d[a][idx].az*ak ); + y = cpy - rk * targets_2d[a][idx].range * Math.sin( targets_2d[a][idx].az*ak ); + var cc = document.createElementNS('http://www.w3.org/2000/svg', "circle"); + var rz = bBox.width / csvg.clientWidth; + cc.setAttributeNS(null, "cx", x ); + cc.setAttributeNS(null, "cy", y ); + cc.setAttributeNS(null, "r", ""+(6*rz)+"" ); + cc.setAttributeNS(null, "stroke", "#800000" ); + cc.setAttributeNS(null, "stroke-width", ""+(2*rz)+"" ); + cc.setAttributeNS(null, "stroke-opacity", ""+(1.0-ok*idx)); + cc.setAttributeNS(null, "fill", "#ff0000" ); + cc.setAttributeNS(null, "fill-opacity", ""+(1.0-ok*idx)); + cc.setAttributeNS(null, "id", "targ_"+a+"_"+idx ); + csvg.appendChild( cc ); }; }; + targets_2d_el[a] = targets_2d[a].length; }; }; if( roi_2d[a]!= undefined ){ @@ -596,25 +741,27 @@ function remove2DDraw( a ){ }; }; -function draw2DDraw( a ){ +function draw2DDraw( a, zzz = '' ){ var p2 = 2.0*Math.PI; var so = -10 * p2 / 360.0; cleanup2DDraw( a ); remove2DDraw( a ); if( draws_2d[a] != undefined ){ - var csvg = document.getElementById( 'draw_svg_' + a ); + if( zzz == '') zzz = 'draw_svg_'; + var csvg = document.getElementById( zzz + a ); + if( csvg != undefined ){ var bBox = csvg.getBBox(); var newpath = document.createElementNS('http://www.w3.org/2000/svg', "polygon"); var ak = 2.0*Math.PI/draws_2d[a].length; var cpx = bBox.width / 2.0; var cpy = bBox.height / 2.0; - var max = 1024; + var max = 1024; switch( drawZoomLevels[a] ){ case 50: max = 512; break; case 25: max = 256; break; case 12: max = 128; break; - }; + }; var rk = bBox.width / ( max * 2 ); var pp = ''; var jj = ''; @@ -647,7 +794,7 @@ function draw2DDraw( a ){ draw2DTargets( a ); }; -function load2DDraw( a ){ +function load2DDraw( a, id='' ){ if( draws_2d[a] == undefined ) draws_2d[a]=[]; Ext.Ajax.request({ url: '/lib/controller/getDeviceDraw.php', @@ -660,7 +807,7 @@ function load2DDraw( a ){ var data = Ext.decode(response.responseText); if( data.count > 0 ){ draws_2d[a] = data.data; - draw2DDraw( a ); + draw2DDraw( a, id ); }; }, failure: failureAJAXFunction @@ -670,20 +817,22 @@ function load2DDraw( a ){ function set2DZoomLevel( a, zl ){ drawZoomLevels[a] = zl; cleanup2DDraw( a ); + var cSensor = getSensorByNodeId( a ); + if( cSensor == null ) return; switch( drawZoomLevels[a] ){ case 100:{ var csvg = document.getElementById( 'draw_svg_' + a ); if( csvg != undefined ){ document.getElementById( '12_txt_'+a ).setAttribute( 'fill', '#FFF212'); - document.getElementById( '12_txt_'+a ).textContent = '12.5'; + document.getElementById( '12_txt_'+a ).textContent = (cSensor.max_range / 8).toFixed(1); document.getElementById( 'r12_'+a ).setAttribute( 'stroke', '#FFF212'); document.getElementById( '25_txt_'+a ).setAttribute( 'fill', '#FFF212'); - document.getElementById( '25_txt_'+a ).textContent = '25'; + document.getElementById( '25_txt_'+a ).textContent = (cSensor.max_range / 4).toFixed(1); document.getElementById( 'r25_'+a ).setAttribute( 'stroke', '#FFF212'); document.getElementById( '50_txt_'+a ).setAttribute( 'fill', '#FFF212'); - document.getElementById( '50_txt_'+a ).textContent = '50'; + document.getElementById( '50_txt_'+a ).textContent = (cSensor.max_range / 2).toFixed(1) ; document.getElementById( 'r50_'+a ).setAttribute( 'stroke', '#FFF212'); - document.getElementById( 'g_txt_'+a ).textContent = '100 m.'; + document.getElementById( 'g_txt_'+a ).textContent = cSensor.max_range + ' m.'; draw2DDraw( a ); }; break; @@ -694,12 +843,12 @@ function set2DZoomLevel( a, zl ){ document.getElementById( '12_txt_'+a ).setAttribute( 'fill', '#00A859'); document.getElementById( 'r12_'+a ).setAttribute( 'stroke', '#00A859'); document.getElementById( '25_txt_'+a ).setAttribute( 'fill', '#FFF212'); - document.getElementById( '25_txt_'+a ).textContent = '12.5'; + document.getElementById( '25_txt_'+a ).textContent = (cSensor.max_range / 8).toFixed(1); document.getElementById( 'r25_'+a ).setAttribute( 'stroke', '#FFF212'); document.getElementById( '50_txt_'+a ).setAttribute( 'fill', '#FFF212'); - document.getElementById( '50_txt_'+a ).textContent = '25'; + document.getElementById( '50_txt_'+a ).textContent = (cSensor.max_range / 4).toFixed(1); document.getElementById( 'r50_'+a ).setAttribute( 'stroke', '#FFF212'); - document.getElementById( 'g_txt_'+a ).textContent = '50 m.'; + document.getElementById( 'g_txt_'+a ).textContent = (cSensor.max_range / 2).toFixed(1)+' m.'; draw2DDraw( a ); }; break; @@ -712,9 +861,9 @@ function set2DZoomLevel( a, zl ){ document.getElementById( '25_txt_'+a ).setAttribute( 'fill', '#00A859'); document.getElementById( 'r25_'+a ).setAttribute( 'stroke', '#00A859'); document.getElementById( '50_txt_'+a ).setAttribute( 'fill', '#FFF212'); - document.getElementById( '50_txt_'+a ).textContent = '12.5'; + document.getElementById( '50_txt_'+a ).textContent = (cSensor.max_range / 8).toFixed(1); document.getElementById( 'r50_'+a ).setAttribute( 'stroke', '#FFF212'); - document.getElementById( 'g_txt_'+a ).textContent = '25 m.'; + document.getElementById( 'g_txt_'+a ).textContent = (cSensor.max_range / 4).toFixed(1)+' m.'; draw2DDraw( a ) }; break; @@ -728,7 +877,7 @@ function set2DZoomLevel( a, zl ){ document.getElementById( 'r25_'+a ).setAttribute( 'stroke', '#00A859'); document.getElementById( '50_txt_'+a ).setAttribute( 'fill', '#00A859'); document.getElementById( 'r50_'+a ).setAttribute( 'stroke', '#00A859'); - document.getElementById( 'g_txt_'+a ).textContent = '12.5 m.'; + document.getElementById( 'g_txt_'+a ).textContent = (cSensor.max_range / 8).toFixed(1)+' m.'; draw2DDraw( a ); }; break; @@ -836,88 +985,261 @@ function setDonatStatus( node_id, param_id, value ){ val3D.style.strokeDashoffset = 100-(per1+per2)+offset; }; -function setStatus2D( a, status ){ +function setStatus2D( a, status, masksE = 0, masks = 0 ){ + if( masks_statuses[a] == undefined ) masks_statuses[a] = 0; + if( masks_exist[a] == undefined ) masks_exist[a] = 0; switch( status ){ case 0:{ - Ext.getCmp('cp_draw_btn_'+a ).disable(); - Ext.getCmp('cp_study_btn_'+a ).disable(); + var t = Ext.getCmp('cp_clear_btn_'+a ); + if( t != undefined ) t.disable(); + t = Ext.getCmp('cp_draw_btn_'+a ); + if( t != undefined ) t.disable(); + t = Ext.getCmp('cp_study_btn_'+a ); + if( t != undefined ) t.disable(); + t = Ext.getCmp('DMED_'+a ); + if( t != undefined ) t.disable(); var csvg = document.getElementById( 'draw_svg_' + a ); if( csvg != undefined ) csvg.setAttribute( 'opacity', '0.3'); + if( masks_exist[a] != 0 ){ + for( i = 0; i < 5; i++ ){ + var cE = Ext.getCmp('mz_btn_'+a+'_'+i ); + cE.disable(); + cE.toggle( false, true ); + }; + masks_statuses[a] = 0; + masks_exist[a] = 0; + }; var stat = Ext.getCmp('status_'+a ); - stat.update('
Offline
'); + if( stat != undefined ) stat.update('
Connection is Unavailable
'); break; }; case 1:{ - Ext.getCmp('cp_draw_btn_'+a ).enable(); - Ext.getCmp('cp_study_btn_'+a ).enable(); + var t = Ext.getCmp('cp_clear_btn_'+a ); + if( t != undefined ) t.disable(); + t = Ext.getCmp('cp_draw_btn_'+a ); + if( t != undefined ) t.disable(); + t = Ext.getCmp('cp_study_btn_'+a ); + if( t != undefined ) t.disable(); + t = Ext.getCmp('DMED_'+a ); + if( t != undefined ) t.disable(); var csvg = document.getElementById( 'draw_svg_' + a ); - if( csvg != undefined ) csvg.setAttribute( 'opacity', '1.0'); + if( csvg != undefined ) csvg.setAttribute( 'opacity', '0.3'); + if( masks_exist[a] != 0 ){ + for( i = 0; i < 5; i++ ){ + var cE = Ext.getCmp('mz_btn_'+a+'_'+i ); + cE.disable(); + cE.toggle( false, true ); + }; + masks_statuses[a] = 0; + masks_exist[a] = 0; + }; var stat = Ext.getCmp('status_'+a ); - stat.update('
Disconnected
'); + if( stat != undefined ) stat.update('
Disconnected
'); break; }; case 2:{ - Ext.getCmp('cp_draw_btn_'+a ).enable(); - Ext.getCmp('cp_study_btn_'+a ).enable(); + var t = Ext.getCmp('cp_clear_btn_'+a ); + if( t != undefined ) t.enable(); + t = Ext.getCmp('cp_draw_btn_'+a ); + if( t != undefined ) t.enable(); + t = Ext.getCmp('cp_study_btn_'+a ); + if( t != undefined ) t.enable(); + t = Ext.getCmp('DMED_'+a ); + if( t != undefined ) t.enable(); var csvg = document.getElementById( 'draw_svg_' + a ); if( csvg != undefined ) csvg.setAttribute( 'opacity', '1.0'); + if( masks_statuses[a] != masks || masks_exist[a] != masksE ){ + for( i = 0; i < 5; i++ ){ + var cE = Ext.getCmp('mz_btn_'+a+'_'+i ); + if( masksE & ( 1 << i ) ){ + cE.enable(); + if( ( masks & ( 1 << i ) ) ){ + cE.toggle( true, true ); + } else { + cE.toggle( false, true ); + }; + } else { + cE.disable(); + cE.toggle( false, true ); + }; + }; + masks_statuses[a] = masks; + masks_exist[a] = masksE; + }; var stat = Ext.getCmp('status_'+a ); - stat.update('
Connected ... Geting Info
'); + if( stat != undefined ) stat.update('
Connected ... Geting Info
'); break; }; case 3:{ - Ext.getCmp('cp_draw_btn_'+a ).enable(); - Ext.getCmp('cp_study_btn_'+a ).enable(); + var t = Ext.getCmp('cp_clear_btn_'+a ); + if( t != undefined ) t.enable(); + t = Ext.getCmp('cp_draw_btn_'+a ); + if( t != undefined ) t.enable(); + t = Ext.getCmp('cp_study_btn_'+a ); + if( t != undefined ) t.enable(); + t = Ext.getCmp('DMED_'+a ); + if( t != undefined ) t.enable(); var csvg = document.getElementById( 'draw_svg_' + a ); if( csvg != undefined ) csvg.setAttribute( 'opacity', '1.0'); + if( masks_statuses[a] != masks || masks_exist[a] != masksE ){ + for( i = 0; i < 5; i++ ){ + var cE = Ext.getCmp('mz_btn_'+a+'_'+i ); + if( masksE & ( 1 << i ) ){ + cE.enable(); + if( ( masks & ( 1 << i ) ) ){ + cE.toggle( true, true ); + } else { + cE.toggle( false, true ); + }; + } else { + cE.disable(); + cE.toggle( false, true ); + }; + }; + masks_statuses[a] = masks; + masks_exist[a] = masksE; + }; var stat = Ext.getCmp('status_'+a ); - stat.update('
Studing
'); + if( stat != undefined ) stat.update('
Studing
'); break; }; case 4:{ - Ext.getCmp('cp_draw_btn_'+a ).enable(); - Ext.getCmp('cp_study_btn_'+a ).enable(); + var t = Ext.getCmp('cp_clear_btn_'+a ); + if( t != undefined ) t.enable(); + t = Ext.getCmp('cp_draw_btn_'+a ); + if( t != undefined ) t.enable(); + t = Ext.getCmp('cp_study_btn_'+a ); + if( t != undefined ) t.enable(); + t = Ext.getCmp('DMED_'+a ); + if( t != undefined ) t.enable(); var csvg = document.getElementById( 'draw_svg_' + a ); if( csvg != undefined ) csvg.setAttribute( 'opacity', '1.0'); + if( masks_statuses[a] != masks || masks_exist[a] != masksE ){ + for( i = 0; i < 5; i++ ){ + var cE = Ext.getCmp('mz_btn_'+a+'_'+i ); + if( masksE & ( 1 << i ) ){ + cE.enable(); + if( ( masks & ( 1 << i ) ) ){ + cE.toggle( true, true ); + } else { + cE.toggle( false, true ); + }; + } else { + cE.disable(); + cE.toggle( false, true ); + }; + }; + masks_statuses[a] = masks; + masks_exist[a] = masksE; + }; var stat = Ext.getCmp('status_'+a ); - stat.update('
Ready
'); + if( stat != undefined ) stat.update('
Ready
'); break; }; case 5:{ - Ext.getCmp('cp_draw_btn_'+a ).enable(); - Ext.getCmp('cp_study_btn_'+a ).enable(); + var t = Ext.getCmp('cp_clear_btn_'+a ); + if( t != undefined ) t.enable(); + t = Ext.getCmp('cp_draw_btn_'+a ); + if( t != undefined ) t.enable(); + t = Ext.getCmp('cp_study_btn_'+a ); + if( t != undefined ) t.enable(); + t = Ext.getCmp('DMED_'+a ); + if( t != undefined ) t.enable(); var csvg = document.getElementById( 'draw_svg_' + a ); if( csvg != undefined ) csvg.setAttribute( 'opacity', '1.0'); + if( masks_statuses[a] != masks || masks_exist[a] != masksE ){ + for( i = 0; i < 5; i++ ){ + var cE = Ext.getCmp('mz_btn_'+a+'_'+i ); + if( masksE & ( 1 << i ) ){ + cE.enable(); + if( ( masks & ( 1 << i ) ) ){ + cE.toggle( true, true ); + } else { + cE.toggle( false, true ); + }; + } else { + cE.disable(); + cE.toggle( false, true ); + }; + }; + masks_statuses[a] = masks; + masks_exist[a] = masksE; + }; var stat = Ext.getCmp('status_'+a ); - stat.update('
Alarmed
'); + if( stat != undefined ) stat.update('
Alarmed
'); break; }; case 6:{ - Ext.getCmp('cp_draw_btn_'+a ).enable(); - Ext.getCmp('cp_study_btn_'+a ).enable(); + var t = Ext.getCmp('cp_clear_btn_'+a ); + if( t != undefined ) t.enable(); + t = Ext.getCmp('cp_draw_btn_'+a ); + if( t != undefined ) t.enable(); + t = Ext.getCmp('cp_study_btn_'+a ); + if( t != undefined ) t.enable(); + t = Ext.getCmp('DMED_'+a ); + if( t != undefined ) t.enable(); var csvg = document.getElementById( 'draw_svg_' + a ); if( csvg != undefined ) csvg.setAttribute( 'opacity', '1.0'); + if( masks_statuses[a] != masks || masks_exist[a] != masksE ){ + for( i = 0; i < 5; i++ ){ + var cE = Ext.getCmp('mz_btn_'+a+'_'+i ); + if( masksE & ( 1 << i ) ){ + cE.enable(); + if( ( masks & ( 1 << i ) ) ){ + cE.toggle( true, true ); + } else { + cE.toggle( false, true ); + }; + } else { + cE.disable(); + cE.toggle( false, true ); + }; + }; + masks_statuses[a] = masks; + masks_exist[a] = masksE; + }; var stat = Ext.getCmp('status_'+a ); - stat.update('
Busy
'); + if( stat != undefined ) stat.update('
Busy
'); break; }; }; }; function fetchSiteStatus(){ + if( tlInterval!= null ){ + window.clearTimeout( tlInterval ); + tlInterval = null; + }; Ext.Ajax.request({ url: '/lib/controller/getStatus.php', params: { SITE: , LNID: lastNotificationID, SPID: StatusTS, - LOAT: LoadTS, + LSID: log_store_id, //LoadTS, UID: , SID: '' }, success: function( response, opts ){ var data = Ext.decode(response.responseText); StatusTS = data.CTS; + var log = Ext.getCmp('log_grid'); + if( log != null ){ + if( data.log != undefined ){ + if( data.log.length ){ + log_store_id = data.log[0].id; + log_array = data.log.concat( log_array ); + if( log_array.length > 32 ){ + log_array = log_array.slice( 0, 31 ); + }; + log_store.removeAll(); + log_store.loadData( log_array ); + }; + } else { + // clear the log + //log_store.removeAll(); + }; + }; if( data.nodes.length > 0 ){ for( i=0; i < data.nodes.length; i++ ){ switch( data.nodes[i].type ){ @@ -930,8 +1252,20 @@ function fetchSiteStatus(){ load2DDraw( data.nodes[i].id ); LoadTS = StatusTS; }; - }; - setStatus2D( data.nodes[i].id, data.nodes[i].status ); + if( data.nodes[i].targets != undefined ){ + if( data.nodes[i].targets.length ){ + targets_2d[data.nodes[i].id]=[]; + for( idx = 0; idx < data.nodes[i].targets.length; idx++) + targets_2d[data.nodes[i].id][idx]={ range: data.nodes[i].targets[idx].digital, az: data.nodes[i].targets[idx].az }; + draw2DTargets( data.nodes[i].id ); + } else { + cleanup2DDraw( data.nodes[i].id ); + } + } else { + cleanup2DDraw( data.nodes[i].id ); + }; + }; + setStatus2D( data.nodes[i].id, data.nodes[i].status, data.nodes[i].masks_exist, data.nodes[i].masks_status ); break; }; case 5:{ // 3d @@ -1202,9 +1536,10 @@ function fetchSiteStatus(){ }); }; */ - lastNotificationID = data.notifications[i].id; + lastNotificationID = data.notifications[i].id; }; }; + tlInterval = window.setTimeout( fetchSiteStatus, 333, selectedSite ); }, failure: failureAJAXFunction }); @@ -1212,9 +1547,8 @@ function fetchSiteStatus(){ function loadDashBoard(){ if( tlInterval!= null ){ - window.clearInterval( tlInterval ); + window.clearTimeout( tlInterval ); tlInterval = null; - timelineObj = null; }; setUserContent( 0 ); Ext.Ajax.request({ @@ -1260,357 +1594,9 @@ function loadDashBoard(){ } }); }); - tlInterval = window.setInterval( fetchSiteStatus, 333, selectedSite ); + //tlInterval = window.setTimeout( fetchSiteStatus, 333, selectedSite ); + fetchSiteStatus(); }, 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/rgoose_global_vars.js b/lib/javascript/jsapi_dynamic/mojo_global_vars.js similarity index 92% rename from lib/javascript/jsapi_dynamic/rgoose_global_vars.js rename to lib/javascript/jsapi_dynamic/mojo_global_vars.js index bd99343..043c3c2 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_global_vars.js +++ b/lib/javascript/jsapi_dynamic/mojo_global_vars.js @@ -8,6 +8,7 @@ var ap_type=; var ap_title = ''; var winW = Data['width']);?>; var winH = Data['height']);?>; +var my_access = Data['access']);?>; var initView = Data['last_content_view']);?>; var content_lvl0 = -1; var content_lvl1 = -1; diff --git a/lib/javascript/jsapi_dynamic/rgoose_logs.js b/lib/javascript/jsapi_dynamic/mojo_logs.js similarity index 93% rename from lib/javascript/jsapi_dynamic/rgoose_logs.js rename to lib/javascript/jsapi_dynamic/mojo_logs.js index ebde7e0..df855aa 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_logs.js +++ b/lib/javascript/jsapi_dynamic/mojo_logs.js @@ -108,7 +108,7 @@ var um_access_log_col_model_opt = { columns: [ {header: "GetLabel("_ID_");?>", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' }, {header: "GetLabel("_USER_");?>",width: 80, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'user' }, - {header: "GetLabel("_DATETIME_");?>", width: 150, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'ts' }, + {header: "GetLabel("_DATETIME_");?>", width: 150, sortable: false, renderer: unix_ts_renderer, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'ts' }, {header: "GetLabel("_ACTION_");?>", width: 150, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', renderer: um_action_renderer, dataIndex: 'cmd' }, {header: "GetLabel("_INFO_");?>", resizable: true, sortable: false, fixed: false, flex: 1, dataindex: 'data_line' } ], @@ -133,7 +133,7 @@ function loadAccessLog(){ tlInterval = null; timelineObj = null; }; - var tPanel = Ext.getCmp('main_portal'); + var tPanel = Ext.getCmp('main_content'); tPanel.removeAll( true ); Ext.getCmp('main_content').setTitle( 'GetLabel("_ACC_LOG_");?>' ); tPanel.add({ @@ -193,7 +193,7 @@ function loadServerLog(){ tlInterval = null; timelineObj = null; }; - var tPanel = Ext.getCmp('main_portal'); + var tPanel = Ext.getCmp('main_content'); tPanel.removeAll( true ); Ext.getCmp('main_content').setTitle( 'GetLabel("_SERV_LOG_");?>' ); tPanel.add({ diff --git a/lib/javascript/jsapi_dynamic/mojo_main.js b/lib/javascript/jsapi_dynamic/mojo_main.js index 4b2d7f2..dec6f72 100644 --- a/lib/javascript/jsapi_dynamic/mojo_main.js +++ b/lib/javascript/jsapi_dynamic/mojo_main.js @@ -122,12 +122,12 @@ function failureAJAXFunction( responce, opts ){ tlInterval = null; }; playSound(); - Ext.Msg.show({ - title:'GetLabel('_REQ_FAILURE_');?>', - msg: 'GetLabel('_AJX_REQFAILURE_');?>', - buttons: Ext.Msg.OK, - icon: Ext.MessageBox.INFO - }); + //Ext.Msg.show({ + // title:'GetLabel('_REQ_FAILURE_');?>', + // msg: 'GetLabel('_AJX_REQFAILURE_');?>', + // buttons: Ext.Msg.OK, + // icon: Ext.MessageBox.INFO + //}); doLogout(); }; @@ -301,6 +301,7 @@ Ext.onReady(function(){ doCheckWindowSize(); + loadSystemDevices(); gSessionValidatorInterval = window.setInterval( sessionValidator, 1000 ); NotificationStack = new PNotify.Stack({dir1: 'down', firstpos1: 25}); //window.onresize = doCheckWindowSize; @@ -406,7 +407,7 @@ Ext.onReady(function(){ border: false, margins: {top:5, right:0, bottom:0, left:0}, width: PanelW-700, - html: '

'+ap_title+'

' + html: '

'+ap_title+'

' },{ xtype: 'spacer', width: 10 diff --git a/lib/javascript/jsapi_dynamic/mojo_metro.js b/lib/javascript/jsapi_dynamic/mojo_metro.js new file mode 100644 index 0000000..ad5e090 --- /dev/null +++ b/lib/javascript/jsapi_dynamic/mojo_metro.js @@ -0,0 +1,94 @@ +// + + + +function loadMetroControlUpper(){ + + Ext.Ajax.request({ + url: '/lib/controller/getMetroUpperSensorEditor.php', + params: { + UID: , + SID: '' + }, + success: function( response, opts ){ + var data = Ext.decode( response.responseText ); + var tComp = Ext.getCmp('main_content'); + 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(){ + } + }); +}; + +function loadMetroControlBottom(){ + Ext.Ajax.request({ + url: '/lib/controller/getMetroBottomSensorEditor.php', + params: { + UID: , + SID: '' + }, + success: function( response, opts ){ + var data = Ext.decode( response.responseText ); + var tComp = Ext.getCmp('main_content'); + 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(){ + } + }); +}; + +function loadMetroControlFusion(){ + Ext.Ajax.request({ + url: '/lib/controller/getMetroFusionEditor.php', + params: { + UID: , + SID: '' + }, + success: function( response, opts ){ + var data = Ext.decode( response.responseText ); + var tComp = Ext.getCmp('main_content'); + 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(){ + } + }); +}; \ No newline at end of file diff --git a/lib/javascript/jsapi_dynamic/mojo_reports.js b/lib/javascript/jsapi_dynamic/mojo_reports.js index d46d192..18214f0 100644 --- a/lib/javascript/jsapi_dynamic/mojo_reports.js +++ b/lib/javascript/jsapi_dynamic/mojo_reports.js @@ -10,6 +10,107 @@ var tlItems = new vis.DataSet(); var selecredActiveSourceFilter = 0; var ActiveZones = null; +var rep_store_id = 0; +var rep_array = new Array(); +var rep_store = new Ext.data.JsonStore({ + autoDestroy: false, + storeId: 'log_store', + //idIndex: 0, + idProperty: 'id', + fields: [ + {name: 'id', type: 'int' }, + {name: 'node_id', type: 'int' }, + {name: 'node_name', type: 'string' }, + {name: 'dts', type: 'string'}, + {name: 'ts', type: 'int'}, + {name: 'ms', type: 'string'}, + {name: 'type', type: 'int'}, + {name: 'range', type: 'string'}, + {name: 'az', type: 'string'}, + {name: 'el', type: 'string'}, + {name: 'r', type: 'int'}, + {name: 'width', type: 'int'}, + {name: 'video_id',type: 'int'} + //{name: 'lat', type: 'float'}, + //{name: 'lon', type: 'float'}, + //{name: 'alt', type: 'float'}, + //{name: 'area', type: 'float'}, + //{name: 'video', type: 'string'}, + //{name: 'v_cpoint', type: 'int'} + ] +}); +function rep_sn_Renderer( value, meta, record ){ + //Must be set according to events + var kaka = record.data.node_id % 3; + return '
'+value+'
'; +}; +function rep_et_Renderer( value, meta, record ){ + var kaka = record.data.node_id % 3; + switch( value ){ + case 6: ov = 'Device Enters Into Study Mode'; break; + case 7: ov = 'Device Is BUSY'; break; + case 8: ov = 'Flip Complete'; break; + case 9: ov = 'Scan Complete'; break; + case 12: ov = 'Black 2D Target'; break; + case 13: ov = 'White 2D Target'; break; + case 36: ov = 'Region Of Interest'; break; + case 39: ov = '[Train Filter] Check Target'; break; + case 40: ov = '[Train Filter] Upper Sensor Detection'; break; + case 41: ov = '[Train Filter] Bottom Sensor Detection'; break; + case 42: ov = '[Train Filter] Train Detected'; break; + case 43: ov = '[Train Filter] Train Updated'; break; + case 44: ov = '[Train Filter] Suspicious Activity'; break; + case 45: ov = '[Train Filter] Suspicious NACK'; break; + case 46: ov = '[Train Filter] Regular Detection'; break; + case 47: ov = '[Train Filter] Detection Disabled'; break; + case 48: ov = '[Train Filter] Suspicious Detection'; break; + case 49: ov = '[Train Filter] Differential Detection'; break; + case 52: ov = 'Event Started'; break; + case 53: ov = 'Event Ended'; break; + case 54: ov = 'Event Closed Manual'; break; + default: ov = 'Event ['+value+']'; + }; + return '
'+ov+'
'; +}; + +var rep_ColModel_ops = { + columns: [ + {header: "Time", width: 100, fixed: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'dts' }, + {header: "Source", width: 100, renderer: rep_sn_Renderer, align: 'left', css: 'vertical-align: middle;', dataIndex: 'node_name' }, + {header: "Type", width: 180, renderer: rep_et_Renderer, fixed: false, align: 'center', css: 'vertical-align: middle;', dataIndex: 'type' }, + {header: "Range", width: 100, dataIndex: 'range' }, + {header: "Azimuth", width: 100, dataIndex: 'az' }, + {header: "Width", width: 100, dataIndex: 'width' }, + ], + defaults: { + sortable: false, + fixed: true, + menuDisabled: true, + width: 100 + } +}; + +var rep_SelModel_ops = { + singleSelect: true, + listeners: { + rowselect: function(sm, row, rec ) { + loadEventData( rec.data ); + //alert( rec.data.id ); + //loadEventProperties( rec.data ); + //SelectedEvent = rec.data.id; + //alert( SelectedEvent ); + //var CB = Ext.getCmp('con_to_src'); + //CB.enable(); + //selectedArchiveRecord = rec; + //if( rec.data.bk_type!=3 ){ + // + //} else { + // + //}; + } + } +}; + var selectedMarkerIcon = L.icon({ iconUrl: '/style/assets/cursor.png', iconSize: [32, 32], @@ -188,13 +289,14 @@ function BuildCalendar( ){ }; -function loadCalendarDates(){ +function loadCalendarDates(){ Ext.MessageBox.wait("GetLabel('_Loading_Calo_');?>","GetLabel('_Please_Wait_');?>",{ width: '100%', hidden: true, progress: true, closable: false }); + ReportLayoutLoadded = false; Ext.Ajax.request({ url: '/lib/controller/getEventDates.php', params: { @@ -715,6 +817,75 @@ function loadEventProperties( EventRec ){ tPanel.doLayout(); }; +var DownloadVideoLink = ''; + +function loadEventData( record ){ + markEventOnRadar( record.node_id, record.az, record.r ); + if( record.video_id > 0 ){ + Ext.Ajax.request({ + url: '/lib/controller/getVideoInfo.php', + params: { + UID: , + SID: '', + VID: record.video_id + }, + success: function( response, opts ){ + var data = Ext.decode(response.responseText); + var t = Ext.getCmp('db_download_video'); + DownloadVideoLink = '/lib/controller/data/videos/'+data.md5+'.'+data.ext; + if( t != undefined ){ + t.toggle( true, true ); + t.enable(); + } + } + }); + } else { + var t = Ext.getCmp('db_download_video'); + if( t != undefined ){ + t.toggle( false, true ); + t.disable(); + } + }; +}; + +function markEventOnRadar( rid, az, range ){ + var csvg = document.getElementById( 'draw_svgr_' + rid ); + if( csvg!= undefined ){ + var roi = csvg.getElementById( "roi" ); + if( roi != null ) csvg.removeChild( roi ); + var bBox = csvg.getBBox(); + var max = 2048; + switch( drawZoomLevels[rid] ){ + case 50: max = 1024; break; + case 25: max = 512; break; + case 12: max = 256; break; + }; + if( range < max ){ + var ak = 2.0*Math.PI/360; + var ok = 1.0/35; + + var rk = bBox.width / ( max * 2 ); + var cpx = bBox.width / 2.0; + var cpy = bBox.height / 2.0; + + x = cpx + rk * range * Math.cos( az*ak ); + y = cpy - rk * range * Math.sin( az*ak ); + var cc = document.createElementNS('http://www.w3.org/2000/svg', "circle"); + var rz = bBox.width / csvg.clientWidth; + cc.setAttributeNS(null, "cx", x ); + cc.setAttributeNS(null, "cy", y ); + cc.setAttributeNS(null, "r", ""+(6*rz)+"" ); + cc.setAttributeNS(null, "stroke", "#800000" ); + cc.setAttributeNS(null, "stroke-width", ""+(2*rz)+"" ); + cc.setAttributeNS(null, "stroke-opacity", ""+(1.0)); + cc.setAttributeNS(null, "fill", "#ff0000" ); + cc.setAttributeNS(null, "fill-opacity", ""+(1.0)); + cc.setAttributeNS(null, "id", "roi" ); + csvg.appendChild( cc ); + }; + }; +}; + function getData( Mode, ST = 0, ET = 0, SR = 0, DR = 0 ){ if( tlLoadLocker ) return; tlLoadLocker = true; @@ -1234,14 +1405,91 @@ function loadOnlineMonitoring(devID){ tPanel.doLayout(); }; +function shutImg( img, a = '' ){ + if( a == '' ){ + img.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEAAAAALAAAAAABAAEAAAI=;'; + } else { + img.src = a; + }; +}; + var ReportMask = null; -function loadReportSegment( juja ){ - ReportMask = new Ext.LoadMask(Ext.getCmp('main_content').getEl(), {msg:"Please wait..."}); - ReportMask.show(); - var tPanel = Ext.getCmp('main_content'); - tPanel.removeAll( true ); - tPanel.doLayout(); - ReportMask.hide(); +var ReportLayoutLoadded = false; +function loadReportSegment( nid, evt_ts ){ + if( !ReportLayoutLoadded ){ + ReportMask = new Ext.LoadMask(Ext.getCmp('main_content').getEl(), {msg:"Please wait..."}); + ReportMask.show(); + Ext.Ajax.request({ + url: '/lib/controller/getReportLayout.php', + params: { + UID: , + SID: '', + NID: nid//, + //DTS: evt_ts + }, + success: function(response, opts ){ + var data = Ext.decode( response.responseText ); + var tPanel = Ext.getCmp('main_content'); + tPanel.removeAll(true); + Ext.getCmp('main_content').add({ + xtype: 'portal', + id: 'segment_portal', + frame: false, + border: false, + items:{ + html: '' + }, + listeners:{ + drop: function( a ){ + updateDashBoardItemLayout( a.panel.id, a.columnIndex, a.position ); + } + } + }); + Ext.getCmp('main_content').doLayout(); + tPanel = Ext.getCmp('segment_portal'); + //nodeDashboardStatuses = new Array(); + for( i=0; i < data.length; i++) tPanel.add( data[i] ); + tPanel.doLayout(); + ReportMask.hide(); + ReportLayoutLoadded = true; + loadReportData( evt_ts ); + }, + error: function(){ + ReportMask.hide(); + } + }); + } else { + loadReportData( evt_ts ); + }; +}; + +function loadReportData( ts ){ + Ext.Ajax.request({ + url: '/lib/controller/getHistoryEvents.php', + params: { + UID: , + SID: '', + DTS: ts + }, + success: function(response, opts ){ + var data = Ext.decode( response.responseText ); + if( data.log != undefined ){ + if( data.log.length ){ + rep_store_id = data.log[0].id; + rep_array = data.log;//.concat( rep_array ); + //if( log_array.length > 32 ){ + // log_array = log_array.slice( 0, 31 ); + //}; + rep_store.removeAll(); + rep_store.loadData( rep_array ); + }; + } else { + alert('No Log'); + // clear the log + //log_store.removeAll(); + }; + } + }); }; function loadReportDayTree( ts ){ @@ -1261,27 +1509,25 @@ function loadReportDayTree( ts ){ sPanel.add({ xtype: 'panel', layout: 'vbox', + frame: true, border: false, items:[{ - xtype: 'button', - text: 'Choose Another Date', - width: '100%', - handler: function(){ - initReportsView(); - } - },{ xtype: 'spacer', - height: 10 + height: 3 },{ - html: 'Zuza'+ts, - frame: true, + html: '

'+( new Date( ts * 1000)).toLocaleDateString()+'

', + frame: false, width: '100%', border: false + },{ + xtype: 'spacer', + height: 5 },{ xtype: 'treepanel', autoScroll: true, width: '100%', + height: PanelH-130, border: true, frame: true, loader: new Ext.tree.TreeLoader(), @@ -1290,11 +1536,29 @@ function loadReportDayTree( ts ){ listeners: { click: function(n) { if( n.attributes.leaf ){ - loadReportSegment( 22 ); - //Ext.Msg.alert('Navigation Tree Click', 'You clicked: "' + n.attributes.text + '"'); + Ext.getCmp('chu_adate').show(); + sPanel.doLayout(); + loadReportSegment( n.attributes.nid, n.attributes.ts ); + //Ext.Msg.alert('Navigation Tree Click', 'You clicked: "' + n.attributes.ts + '"'); }; } } + },{ + xtype: 'spacer', + height: 10 + },{ + xtype: 'button', + id: 'chu_adate', + text: 'Show Dates', + hidden: true, + width: '100%', + iconCls: 'reports_dates_btn', + scale: 'large', + + handler: function(){ + Ext.getCmp('chu_adate').hide(); + initReportsView(); + } }] }); sPanel.doLayout(); @@ -1309,6 +1573,7 @@ function initReportsView(){ tlInterval = null; timelineObj = null; }; + ReportLayoutLoadded = false; var tPanel = Ext.getCmp('main_content'); var sPanel = Ext.getCmp('left_side_menu'); tPanel.removeAll( true ); @@ -1355,9 +1620,9 @@ function initReportsView(){ tPanel.doLayout(); sPanel.add({ xtype: 'panel', - frame: true, + frame: false, border: false, - html: 'Zuza' + html: '
GetLabel('_PLS_SEL_CAL_DATE_');?>
' }); sPanel.doLayout(); }; diff --git a/lib/javascript/jsapi_dynamic/mojo_settings.js b/lib/javascript/jsapi_dynamic/mojo_settings.js index 394dbcf..aac5179 100644 --- a/lib/javascript/jsapi_dynamic/mojo_settings.js +++ b/lib/javascript/jsapi_dynamic/mojo_settings.js @@ -2,6 +2,113 @@ var helpContentTopicID = -1; +var muploader = null; + +var uploads_store_id = 0; +var uploads_store = new Ext.data.ArrayStore({ + autoDestroy: false, + storeId: 'up_store', + idIndex: 0, + fields: [ + {name: 'id', type: 'int' }, + {name: 'file_name', type: 'string'}, + {name: 'file_id', type: 'string'}, + {name: 'size', type: 'string'}, + {name: 'progress', type: 'int'}, + {name: 'status', type: 'string' } + ] +}); +var uploaded_store_id = 0; +var uploaded_store = new Ext.data.ArrayStore({ + autoDestroy: false, + storeId: 'mod_store', + idIndex: 0, + fields: [ + {name: 'id', type: 'int' }, + {name: 'file_name', type: 'string'}, + {name: 'size', type: 'int'}, + {name: 'status', type: 'int'}, + {name: 'ts', type: 'string' }, + {name: 'memo', type: 'string' } + ] +}); +function progressRenderer( value, meta, record ){ + Ext.defer( function( id ){ + var p = new Ext.ProgressBar({ + id: 'progress_'+id, + renderTo: 'div_'+id, + animate: false, + width: '100%', + value: 0, + text: 'Upload Pending', + }); + }, 50, undefined, [ record.data.file_id ] ); + return '
'; +}; +var fileUploadsColModel_ops = { + columns: [ + {header: "ID", width: 50, align: 'center', css: 'vertical-align: middle;', dataIndex: 'id' }, + {header: "File Name", width: 280, fixed: false, align: 'left', css: 'vertical-align: middle;', dataIndex: 'file_name' }, + {header: "Size", width: 80, align: 'left', css: 'vertical-align: middle;', dataIndex: 'size' }, + {header: "Progress", width: 150, renderer: progressRenderer, dataIndex: 'progress' }, + {header: " ", width: 50, dataIndex: 'status3' } + ], + defaults: { + sortable: false, + fixed: true, + menuDisabled: true, + width: 100 + } +}; +function onModuleFileRenderer( value, meta, record ){ + if( value == 0 ){ + rv = 'Ready to Upload'; + } else { + if( value < 101 ){ + rv = 'Uploading'; + } else { + rv = 'Already Uploaded'; + }; + }; + return rv; +}; +var fileModuleColModel_ops = { + columns: [ + {header: "ID", width: 50, align: 'center', css: 'vertical-align: middle;', dataIndex: 'id' }, + {header: "File Name", width: 60, fixed: false, align: 'left', css: 'vertical-align: middle;', dataIndex: 'file_name' }, + {header: "Size", width: 80, renderer: plupload.formatSize, align: 'left', css: 'vertical-align: middle;', dataIndex: 'size' }, + {header: "Time", width: 150, align: 'left', css: 'vertical-align: middle;', dataIndex: 'ts' }, + {header: "Status", width: 50, renderer: onModuleFileRenderer, dataIndex: 'status' }, + {header: "Memo", dataIndex: 'memo' } + ], + defaults: { + sortable: false, + fixed: true, + menuDisabled: true, + width: 100 + } +}; +var fileUploadsSelModel_ops = { + singleSelect: true +}; +function loadModuleFiles( sensorID ){ + Ext.Ajax.request({ + url: '/lib/controller/getDeviceFiles.php', + params: { + UID: , + SID: '', + DID: sensorID + }, + success: function( response, opts ){ + var data = Ext.decode( response.responseText ); + uploaded_store.removeAll(); + uploaded_store.loadData( data.files ); + }, + failure: failureAJAXFunction + }); +}; + + function loadHelpContent( topicID ){ if( helpContentTopicID == topicID ) return; helpContentTopicID = topicID; @@ -77,6 +184,157 @@ function loadModules(){ }); }; +function loadFilters(){ + Ext.Ajax.request({ + url: '/lib/controller/getFilters.php', + params: { + UID: , + SID: '', + }, + success: function( response, opts ){ + var tData = Ext.decode(response.responseText); + var tPanel = Ext.getCmp('filters_container'); + if( tData.status == 'ok' ){ + var res = Ext.decode( tData.modules ); + tPanel.removeAll( true ); + tPanel.add( res ); + tPanel.doLayout(); + } else { + tPanel.removeAll( true ); + tPanel.doLayout(); + var tPanel = Ext.getCmp('flt_ed_small'); + tPanel.removeAll( true ); + tPanel.add( { html:'
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
' } ); + tPanel.doLayout(); + }; + }, + failure: failureAJAXFunction + }); +}; + +function loadPhoneBook(){ + Ext.Ajax.request({ + url: '/lib/controller/getPhoneBook.php', + params: { + UID: , + SID: '', + }, + 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 addNPNWindow = null; +function addNewPhoneNumber(){ + if( addNPNWindow == null ){ + addNPNWindow = new Ext.Window({ + title: 'Add New Phone Number', + modal: true, + closeAction: 'hide', + resizable: false, + width: 400, + height: 300, + items:[{ + xtype: 'form', + labelWidth: 120, + labelAlign: 'right', + items: [{ + xtype: 'textfield', + fieldLabel: 'Name/Label', + id: 'ph_name', + width: 220, + value: '' + },{ + xtype: 'textfield', + fieldLabel: 'Phone Number', + id: 'ph_number', + width: 220, + validator: function( a ){ + return true; + }, + value: '' + },{ + xtype: 'radio', + id: 'r_ph_call', + fieldLabel: 'Call Only', + name: 'ph_cam', + checked: true, + value: '1' + },{ + xtype: 'radio', + id: 'r_ph_msg', + fieldLabel: 'SMS Only', + name: 'ph_cam', + value: '0' + },{ + xtype: 'textarea', + fieldLabel: 'Custom Message', + width: 220, + height: 130, + id: 'cus_sms', + name: 'cus_sms' + }] + }], + bbar:['->',{ + text: 'Add', + handler: function(){ + var num = Ext.getCmp( 'ph_number' ).getValue(); + var lbl = Ext.getCmp( 'ph_name' ).getValue(); + var con = (Ext.getCmp( 'r_ph_call' ).getValue())?1:0; + var cust = Ext.getCmp( 'cus_sms' ).getValue(); + Ext.Ajax.request({ + url: '/lib/controller/addPhoneBookRecord.php', + params: { + UID: , + SID: '', + PNUM: num, + PNAM: lbl, + PCAL: con, + PMSG: cust + }, + success: function( response, opts ){ + var data = Ext.decode(response.responseText); + if( data.success ){ + } else { + Ext.Msg.show({ + title:'Error', + msg: data.msg, + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.ERROR//, + //fn: function(btn, text){ + // if( btn == 'yes' ){ + // cleanupChangeNotifier(); + // } else { + // loadEditor = false; + // }; + //} + }); + }; + //var tPanel = Ext.getCmp('main_portal'); + //tPanel.removeAll(true); + //for( i=0; i < data.length; i++) tPanel.add( data[i] ); + //tPanel.doLayout(); + }, + failure: failureAJAXFunction + }); + } + },{ + text: 'Cancel', + handler: function(){ + addNPNWindow.hide(); + } + }] + }); + }; + addNPNWindow.show(); +}; + function loadDetectedCameras(){ Ext.Ajax.request({ url: '/lib/controller/getCameras.php', @@ -212,6 +470,45 @@ function editResource( rid ){ }; }; +function editFilter( fid ){ + var loadEditor = true; + if( settingsAreChanged ){ + Ext.Msg.show({ + title:'GetLabel('_SETTINGS_CHANGED_');?>', + msg: 'GetLabel('_SET_CHANGED_WOULD_SAVE_');?>', + buttons: Ext.Msg.YESNO, + icon: Ext.MessageBox.WARNING, + fn: function(btn, text){ + if( btn == 'yes' ){ + cleanupChangeNotifier(); + } else { + loadEditor = false; + }; + } + }); + }; + if( loadEditor ){ + Ext.Ajax.request({ + url: '/lib/controller/getFilterEditor.php', + params: { + FID: fid, + UID: , + SID: '', + }, + success: function( response, opts ){ + var data = Ext.decode(response.responseText); + var resourceEdPanel = Ext.getCmp('flt_ed_small'); + if( resourceEdPanel ){ + resourceEdPanel.removeAll( true ); + resourceEdPanel.add( data ); + resourceEdPanel.doLayout(); + }; + }, + failure: failureAJAXFunction + }); + }; +}; + function editModule( mid ){ var loadEditor = true; if( settingsAreChanged ){ @@ -724,7 +1021,7 @@ function addSensor(){ xtype: 'panel', frame: false, border: false, - html: '
' + html: '
' },{ xtype: 'spacer', height: 8 @@ -750,7 +1047,13 @@ function addSensor(){ valueField: 'mode', displayField: 'mode_txt', value: 1, - width: 200 + width: 200, + listeners:{ + select: function( a, v, c ){ + var ii = document.getElementById( 'asd_img_div' ); + ii.className = "node_"+(c+1)+"_img_set"; + } + } },{ xtype: 'combo', id: 'sens_range', @@ -950,7 +1253,7 @@ function addDetectedIPCam(){ UU: NUU, PP: NPP, AU: NAM, - CMD: 2 + CMD: 3 }, success: function( response, opts ){ addDetCamWM.hide(); @@ -976,6 +1279,41 @@ function addDetectedIPCam(){ addDetCamDialog.show(); }; +var devUploadTimeout = null; +var devUploadID = -1; +function fetchDeviceUploadStatus(){ + clearTimeout( devUploadTimeout ); + if( devUploadID < 1 ) return; + Ext.Ajax.request({ + url: '/lib/controller/getDeviceUploadStatus.php', + params: { + UID: , + SID: '', + DID: devUploadID + }, + success: function( response, opts ){ + var data = Ext.decode(response.responseText); + var tT = Ext.getCmp('upp_ttext'); + if( tT != undefined ){ + if( data.count > 0 ){ + devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 ); + }; + if( data.current != undefined ){ + tT.update('

Uploading '+data.count+' file(s)

'); + document.getElementById('upp_ctext').innerHTML ='

Current File: '+data.current+'

'; + Ext.getCmp('upp_pbar').updateProgress( data.progress, Math.round( data.progress*100 )+'%', true ); + devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 ); + } else { + Ext.getCmp('upload_progres_panel').hide(); + Ext.getCmp('uploaded_grid').show(); + loadModuleFiles( devUploadID ); + }; + }; + }, + failure: failureAJAXFunction + }); +}; + function showSettingsGeneral(){ stopStatusUpdater(); @@ -1333,9 +1671,136 @@ tPanel.add({ }] },{ xtype: 'panel', - id: 'net_tab', title: 'Filters', - items:[] + id: 'flt_tab', + layout: 'hbox', + items:[{ + xtype: 'panel', + id: 'filters_container', + flex: 1, + height: PanelH-15, + autoScroll: 'auto', + tbar:[{ + text: 'Add Filter', + handler: function(){ + var addFilterWindow = new Ext.Window({ + id: 'fulu_boa', + title: 'Add Event Filter', + modal: true, + width: 400, + height: 300, + items:[{ + xtype: 'form', + items: [{ + xtype: 'combo', + fieldLabel: "GetLabel( 'MOD_TYPE' );?>", + id: 'flt_type', + lazyRender: true, + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['az_t','az_txt'], + data: [Query( $QS ); + $OOP = array(); + foreach( $JIJI as $JI ) $OOP[] = "[{$JI['id']},'".$Labels->getLabel($JI['name'])."']"; + echo implode(',', $OOP ); + ?>] + }), + valueField: 'az_t', + displayField: 'az_txt', + value: 1, + listeners:{ + select: function( t, r, i ){ + var n = r.data.az_t; + Ext.Ajax.request({ + url: '/lib/controller/getFilterInfo.php', + params: { + FID: n, + UID: , + SID: '' + }, + success: function( response, opts ){ + Ext.getCmp('filt_infopan').update( response.responseText ); + } + }); + } + } + },{ + xtype: 'panel', + id: 'filt_infopan', + html: '' + }] + }], + bbar:[{ + text: 'Cancel', + handler: function(){ + addFilterWindow.close(); + } + },{ + text: 'Add Filter', + handler: function(){ + var mtyp = Ext.getCmp('flt_type').getValue(); + Ext.Ajax.request({ + url: '/lib/controller/addFilter.php', + params: { + SERVID: 1, + TYPE: mtyp, + UID: , + SID: '' + }, + success: function( response, opts ){ + // If the response is JSON, you have to decode it + var data = Ext.decode(response.responseText); + if( data.status == 'ok' ){ + addFilterWindow.close(); + loadFilters(); + } else { + Ext.Msg.show({ + title:'GetLabel("_INFO_MSG_");?>', + msg: data.message, + buttons: Ext.Msg.OK,//YESNOCANCEL, + fn: function(){ + //SettingsLidar3D.hide(); + }, + icon: Ext.MessageBox.INFO //QUESTION + }); + } + }, + failure: failureAJAXFunction + }); + } + }] + }); + addFilterWindow.show(); + Ext.Ajax.request({ + url: '/lib/controller/getFilterInfo.php', + params: { + FID: 1, + UID: , + SID: '' + }, + success: function( response, opts ){ + Ext.getCmp('filt_infopan').update( response.responseText ); + } + }); + } + }], + items:[] + },{ + xtype: 'panel', + id: 'flt_ed_small', + flex: 1, + height: PanelH-15, + layout: 'fit', + items:[{ + html:'
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
' + }] + }] }], listeners:{ tabchange: function( tp, t ){ @@ -1357,9 +1822,10 @@ tPanel.add({ loadModules(); break; }; - case 'net_tab':{ + case 'flt_tab':{ content_lvl3=3; stopStatusUpdater(); + loadFilters(); break; }; }; @@ -1621,6 +2087,32 @@ function showSettingsApplication(){ },{ xtype: 'spacer', height: 10 + },{ + xtype: 'textfield', + fieldLabel: 'Instance Identity', + width: 300, + value: 'Query( $QS ); + if( count( $TT ) ){ + echo $TT[0]['identity']; + } else { + echo "----No-Identity-Set---"; + }; + ?>' + },{ + xtype: 'spacer', + height: 10 + },{ + xtype: 'button', + text: 'Generate New Identity', + width: 500, + handler: function(){ + doApplicationOperation( 3, 0 ); + } + },{ + xtype: 'spacer', + height: 10 },{ xtype: 'combo', fieldLabel: 'GetLabel('_DEBUGGING_MODE_');?>', @@ -1634,11 +2126,11 @@ function showSettingsApplication(){ fields: ['sid', 'snam'], data: [[0,'GetLabel('__DISABLED__');?>'], [1,'GetLabel('___ENABLED__');?>']] }), - value: , + value: , valueField: 'sid', displayField: 'snam', listeners:{ - select: function(t,r,i){ + select: function( t, r, i ){ doApplicationOperation( 1, i ); } } @@ -1777,8 +2269,267 @@ function showSettingsUpgrade(){ content_lvl2 = 4; var tPanel = Ext.getCmp('main_content'); tPanel.removeAll( true ); + initial_md5 = ''; + tPanel.add({ + columnWidth: 1.0, + frame: false, + border: false, + items: [{ + frame: false, + border: false, + collapsible: false, + draggable: false, + layout: 'vbox', + //layoutConfig: { + // align : 'stretch', + // pack : 'start', + //}, + height: PanelH, + items:[{ + title: 'getLabel('_MAP_MONITORING_');?>', + xtype: 'panel', + height: PanelH-300, + //flex: 1, + frame: true, + width: '100%', + border: false, + layout: { + type: 'table', + columns: 2, + tableAttrs: { + valign: 'top', + style: 'valign:top;width:100%;' + } + }, + defaults: { + frame: true, + border: false, + height: ( PanelH-400 ) / 2, + style: 'margin: 5px;width:400px;display:block;' + }, + items:[{ + title: 'Current System Info', + width: '100%', + //flex: 1, + html: '

Current Web Version: 

' + },{ + title: 'Tasks', + //width: 400, + layout: 'vbox', + items:[{ + xtype: 'button', + width: '100%', + text: 'Create Database Backup', + handler: function(){ + createNewTask( 2 ); + } + },{ + xtype: 'button', + width: '100%', + text: 'Create Full Snapeshot', + handler: function(){ + createNewTask( 255 ); + } + }] + },{ + title: 'Archives', + height: 250, + width: '100%', + tbar:[{ + text: 'Restore', + id: 'ar_restore_btn', + handler: function(){ + createNewTask(1, selectedArchiveRecord.data.file_name ); + } + },{ + text: 'Download', + id: 'ar_download_btn', + handler: function(){ + if( selectedArchiveRecord!= null ){ + window.open( '/lib/php/setup_toolkit/vault/'+selectedArchiveRecord.data.base_version + '/'+ selectedArchiveRecord.data.file_name ); + }; + } + },{ + text: 'Delete', + id: 'ar_delete_btn', + handler: function(){ + createNewTask(100, selectedArchiveRecord.data.file_name ); + } + }], + items:[{ + xtype: 'grid', + id: 'archives_grid', + border: false, + frame: false, + autoScroll: true, + //width: '100%', + lazyRender: true, + height: 210, + ds: archives_store, + cm: new Ext.grid.ColumnModel( archivesColModel_ops ), + sm: new Ext.grid.RowSelectionModel( archivesSelModel_ops ), + viewConfig: { + // forceFit: true + }, + }] + },{ + title: 'Task Status', + height: 250, + //flex: 1, + items:[{ + xtype: 'spacer', + height: 4 + },{ + id: 'ctask_status', + border: true, + html: '' + },{ + xtype: 'spacer', + height: 4 + },{ + xtype: 'textarea', + id: 'task_log', + height: ( PanelH-320 ) / 2 - 120, + style: 'font-size:9px;width:100%;margin-bottom:4px;', + readOnly: true, + autoScroll: true, + value: '' + },{ + xtype: 'progress', + id: 'task_progress', + value: 1.0, + text: 'idle', + disabled: true + }], + tbar:[{ + text: 'Cancel Task', + id: 'ch_ta_btn', + disabled: true, + handler: deleteNewTask + }] + }] + + },{ + title: 'getLabel('_UPLOAD_PACKAGE_');?>', + xtype: 'panel', + height: 300, + //flex: 1, + frame: true, + border: false, + //layout: 'vbox', + items:[{ + xtype:'button', + id: 'pickfiles', + width: '100%', + text: 'Choose File' + },{ + height: 200, + xtype: 'grid', + id: 'upload_grid', + border: false, + frame: false, + mode: 'local', + lazyRender: true, + width: '100%', + autoScroll: true, + ds: uploads_store, + cm: new Ext.grid.ColumnModel( fileUploadsColModel_ops ), + sm: new Ext.grid.RowSelectionModel( fileUploadsSelModel_ops ), + viewConfig: { + forceFit: true + }, + bbar: [{ + text: 'Clear', + width: '100%', + handler: function(){ + muploader.splice(); + uploads_store.removeAll(); + } + }] + },{ + xtype:'button', + id: 'umpalumpa', + width: '100%', + disabled: true, + text: 'Upload', + handler: function(){ + if( muploader!= null ){ + muploader.start(); + }; + } + }], + listeners:{ + afterrender: function(){ + muploader = new plupload.Uploader({ + runtimes : 'html5,html4', + browse_button : Ext.getDom('pickfiles'), // you can pass in id... + //container: document.getElementById('upupu'), // ... or DOM Element itself + max_file_size : '1000mb', + chunk_size: '200kb', + max_retries: 3, + multi_selection: false, + max_file_count: 1, + // Fake server response here + url: '/lib/php/setup_toolkit/upload.php', + //url: "/echo/json", + + //flash_swf_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/flash/Moxie.cdn.swf', + //silverlight_xap_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/silverlight/Moxie.cdn.xap', + filters : [ + //{title : "Image files", extensions : "jpg,gif,png"}, + {title : "Archive files", extensions : "rar,zip,gz,bz2"} + ], + + init: { + PostInit: function() { + //$('filelist').innerHTML = ''; + + //$('uploadfiles').onclick = function() { + // uploader.start(); + // return false; + //}; + }, + + FilesAdded: function( up, files ) { + Ext.getCmp('umpalumpa').enable(); + plupload.each( files, function(file) { + uploads_store.loadData( [[ uploads_store_id, file.name, file.id, plupload.formatSize( file.size ), 0, 'N' ]], true ); + uploads_store_id++; + Ext.getCmp('upload_grid').doLayout(); + }); + }, + + UploadProgress: function(up, file) { + var pb = Ext.getCmp( 'progress_'+file.id ); + if( file.percent < 100 ){ + pb.updateProgress( file.percent / 100, file.percent + '%', false ); + } else { + pb.updateProgress( 1.0, 'Uploaded', false ); + }; + }, + + Error: function(up, err) { + Ext.Msg.show({ + title:'Upload Status', + msg: "Error #" + err.code + ": " + err.message, + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.ERROR + }); + } + } + }); + muploader.init(); + } + } + }] + }] + }); + muploader = null; + uploads_store.removeAll(); tPanel.doLayout(); - updateServerStatus(); + archives_store.load();//{params:{start:0, limit:50, src: 'arch', fil: selecredActiveSourceFilter }}); + updateTaskStatus(); + tlInterval = window.setInterval( updateTaskStatus, 333 ); }; function initSettingsView(){ @@ -1805,6 +2556,7 @@ function initSettingsView(){ }); tP.doLayout(); tP = Ext.getCmp('sme_inner'); +Data['access'] > 3 ){ ?> tP.add({ title: 'GetLabel('_SYS_SETTINGS_');?>', layout: 'vbox', @@ -1852,16 +2604,6 @@ function initSettingsView(){ allowDepress: false, toggleGroup: 'sys_settings', handler: showSettingsApplication - },{ - xtype: 'button', - width: '100%', - id:'soft_update', - text: 'GetLabel('_UPGRADE_MNGMNT_');?>', - enableToggle: true, - pressed: ( content_lvl2 == 4 && content_lvl1 == 0 ), - allowDepress: false, - toggleGroup: 'sys_settings', - handler: showSettingsUpgrade }] }); tP.add({ @@ -1883,7 +2625,7 @@ function initSettingsView(){ pressed: ( content_lvl2 == 0 && content_lvl1 == 1 ), allowDepress: false, toggleGroup: 'det_settings', - handler: loadDashBoard + handler: loadMetroControlUpper },{ xtype: 'button', width: '100%', @@ -1893,7 +2635,7 @@ function initSettingsView(){ pressed: ( content_lvl2 == 1 && content_lvl1 == 1 ), allowDepress: false, toggleGroup: 'det_settings', - handler: loadMonitoring + handler: loadMetroControlBottom },{ xtype: 'button', width: '100%', @@ -1903,7 +2645,7 @@ function initSettingsView(){ pressed: ( content_lvl2 == 2 && content_lvl1 == 1 ), allowDepress: false, toggleGroup: 'det_settings', - handler: loadArchive + handler: loadMetroControlFusion }GetLabel('_LOGOUT_');?>', handler: doLogout }] }); - tP.add({ + /*tP.add({ title: 'GetLabel('_NET_SETTINGS_');?>', collapsed: ( content_lvl1 != 2 ), items:[{ @@ -1961,14 +2703,14 @@ function initSettingsView(){ allowDepress: false, id:'api_serv', }] - }); + });*/ + tP.add({ title: 'GetLabel('_PROF_SETTINGS_');?>', items:[] }); -Data['access'] > 5 ){ -?>tP.add({ +Data['access'] > 5 ){ ?> + tP.add({ title: 'GetLabel('_ADM_SETTINGS_');?>', collapsed: ( content_lvl1 != 3 ), items:[{ @@ -1979,6 +2721,7 @@ function initSettingsView(){ enableToggle: true, pressed: ( content_lvl2 == 0 && content_lvl1 == 3 ), allowDepress: false, + toggleGroup: 'adm_settings', handler: function( b, e ){ loadUserEditor(); } @@ -1990,6 +2733,7 @@ function initSettingsView(){ enableToggle: true, pressed: ( content_lvl2 == 1 && content_lvl1 == 3 ), allowDepress: false, + toggleGroup: 'adm_settings', handler: function( b, e ){ loadAccessLog(); } @@ -2001,6 +2745,7 @@ function initSettingsView(){ enableToggle: true, pressed: ( content_lvl2 == 2 && content_lvl1 == 3 ), allowDepress: false, + toggleGroup: 'adm_settings', handler: function( b, e ){ loadServerLog(); } @@ -2027,5 +2772,11 @@ function initSettingsView(){ }; break; }; + case 3:{ + switch( content_lvl2 ){ + case 0: loadUserEditor(); break; + }; + break; + }; }; }; \ No newline at end of file diff --git a/lib/javascript/jsapi_dynamic/mojo_users.js b/lib/javascript/jsapi_dynamic/mojo_users.js new file mode 100644 index 0000000..f12173f --- /dev/null +++ b/lib/javascript/jsapi_dynamic/mojo_users.js @@ -0,0 +1,649 @@ +// + +var um_user_list_store = new Ext.data.JsonStore({ + root: 'users', + totalProperty: 'totalCount', + idProperty: 'id', + remoteSort: true, + fields: [{ + name: 'id', + type: 'int' + },{ + name: 'status', + type: 'string' + },{ + name: 'login', + type: 'string' + },{ + name: 'created', + type: 'string' + },{ + name: 'last', + type: 'string' + },{ + name: 'access', + type: 'int' + },{ + name: 'lang', + type: 'int' + },{ + name: 'site', + type: 'int' + }], + proxy : new Ext.data.HttpProxy({ + method: 'POST', + prettyUrls: false, + url: '/lib/controller/listUsers.php', + headers: { + UID: , + SID: '' + } + }) +}); + +var um_selected_user_id = 0; +var um_user_locked = false; + +var um_add_user_window = null; +var um_edit_user_window = null; + +function um_user_access_renderer( val ){ + if( val == 0 ){ + return 'GetLabel("_GUEST_");?>'; + } else { + if( val < 6 ){ + return 'GetLabel("_REGULAR_");?>'; + } else { + if( val == 10 ){ + return 'GetLabel("_FOUNDER_");?>'; + } else { + return 'GetLabel("_ADMIN_");?>'; + }; + }; + }; +}; + +function um_user_status_renderer( val ){ + switch( val ){ + case 'D': return 'Disabled'; + case 'A': return 'Active'; + }; + return 'Blocked'; +}; + +var um_user_list_col_model_opt = { + columns: [ + {header: "id", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' }, + {header: "GetLabel("_STATUS_");?>", width: 80, sortable: false, renderer: um_user_status_renderer, fixed: true, menuDisabled: true, align: 'center', css: 'vertical-align: middle;', dataIndex: 'status' }, + {header: "GetLabel("_LOGIN_");?>", width: 80, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'login' }, + {header: "GetLabel("_CREATED_");?>", width: 150, sortable: false, renderer: unix_ts_renderer, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'created' }, + {header: "GetLabel("_LAST_ACCESS_");?>", width: 150, sortable: false, renderer: unix_ts_renderer, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'last' }, + {header: "GetLabel("_TYPE_");?>", width: 100, sortable: false, renderer: um_user_access_renderer, dataIndex: 'access' }, + {header: "GetLabel("_INFO_");?>", width: 200, sortable: false, dataindex: 'data' } + ], + defaults: { + sortable: true, + menuDisabled: true, + width: 100 + }, + listeners: { + hiddenchange: function(cm, colIndex, hidden) { + //saveConfig(colIndex, hidden); + } + } +}; + +var um_user_list_sel_model_opt = { + singleSelect: true, + listeners: { + rowselect: function( sm, row, rec ) { + um_selected_user_id = rec.data.id; + if ( rec.data.status == 'A' ){ + Ext.getCmp('um_lock_user_btn').setText('GetLabel("_LOCK_USER_");?>'); + um_user_locked = false; + } else { + Ext.getCmp('um_lock_user_btn').setText('GetLabel("_UNLOCK_USER_");?>'); + um_user_locked = true; + }; + if( um_selected_user_id == 1 || rec.data.access == 10 ){ + Ext.getCmp('um_del_user_btn').disable(); + Ext.getCmp('um_lock_user_btn').disable(); + } else { + Ext.getCmp('um_del_user_btn').enable(); + Ext.getCmp('um_lock_user_btn').enable(); + }; + if( um_selected_user_id == 1 ){ + Ext.getCmp('um_edit_user_btn').disable(); + } else { + Ext.getCmp('um_edit_user_btn').enable(); + }; + } + } +}; +function addNewUser(){ + if( um_add_user_window == null ){ + um_add_user_window = new Ext.Window({ + modal: true, + title: 'GetLabel("_EDIT_USER_CRACCES_");?>', + width: 400, + height: 250, + layout: 'fit', + closeAction: 'hide', + listeners:{ + beforehide : function(){ + //Ext.getCmp('connectstarterbutton').toggle( false, false ); + } + }, + items:[{ + layout: 'table', + border: false, + defaults: { + // applied to each contained panel + bodyStyle:'padding-top:10px;padding-left:20px;padding-right:20px;padding-bottom:10px;' + }, + layoutConfig: { + // The total column count must be specified here + columns: 2 + }, + items: [{ + border: false, + html: 'User Login:' + },{ + xtype: 'textfield', + id: 'um_ua_login', + width: 200 + },{ + border: false, + html: 'New Password:' + },{ + xtype: 'textfield', + id: 'um_ua_pwd1', + inputType: 'password', + width: 200 + },{ + border: false, + html: 'Repeate Password:' + },{ + xtype: 'textfield', + id: 'um_ua_pwd2', + inputType: 'password', + width: 200 + },{ + border: false, + html: 'Access Level:' + },{ + xtype: 'combo', + id: 'um_ua_access', + editable: false, + typeAhead: true, + triggerAction: 'all', + width: 200, + lazyRender:true, + mode: 'local', + value: 2, + store: new Ext.data.ArrayStore({ + id: 0, + fields: ['acc_lvl', 'displayText' ], + data: [[2,'Minimal Access'],[4,'Operator'],[6,'Admin']] + }), + valueField: 'acc_lvl', + displayField: 'displayText' + }] + }], + bbar: [ '->',{ + text: 'GetLabel("_CANCEL_");?>', + handler: function(){ + um_add_user_window.hide(); + } + },{ + text: 'GetLabel("_SAVE_");?>', + handler: function(){ + var lo = Ext.getCmp('um_ua_login').getValue(); + var pwd = Ext.getCmp('um_ua_pwd1').getValue(); + var rwd = Ext.getCmp('um_ua_pwd2').getValue(); + var acc = Ext.getCmp('um_ua_access').getValue(); + var sbt = true; + if( acc > my_access ){ + sbt = false; + Ext.Msg.show({ + title:'GetLabel("_ERROR_MSG_");?>', + msg: 'You Can not add more privileged user!', + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.ERROR //QUESTION + }); + }; + if( sbt && pwd!=''){ + if( pwd != rwd ){ + sbt = false; + Ext.Msg.show({ + title:'GetLabel("_ERROR_MSG_");?>', + msg: 'Passwords don\'t match!', + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.ERROR //QUESTION + }); + }; + } else { + sbt = false; + Ext.Msg.show({ + title:'GetLabel("_ERROR_MSG_");?>', + msg: 'You Can not Add User Without Password!', + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.ERROR //QUESTION + }); + }; + if( sbt && lo == '' ){ + sbt = false; + Ext.Msg.show({ + title:'GetLabel("_ERROR_MSG_");?>', + msg: 'You Can not Add User Without Login!', + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.ERROR //QUESTION + }); + }; + if( sbt ){ + Ext.Ajax.request({ + url: '/lib/controller/updateUser.php', + params: { + OP: 0, + UID: , + SID: '', + NLO: lo, + PW1: pwd, + PW2: rwd, + ACC: acc + }, + success: function( response, opts ){ + // If the response is JSON, you have to decode it + var data = Ext.decode(response.responseText); + if( data.success == true ) { + Ext.Msg.show({ + title:'GetLabel("_INFO_MSG_");?>', + msg: 'GetLabel("_SETTING_SAVE_OK_");?>', + buttons: Ext.Msg.OK,//YESNOCANCEL, + fn: function(){ + um_user_list_store.reload(); + um_add_user_window.hide(); + }, + //animEl: 'elId', + icon: Ext.MessageBox.INFO //QUESTION + }); + } else { + Ext.Msg.show({ + title:'GetLabel("_ERROR_MSG_");?>', + msg: data['error'], + buttons: Ext.Msg.OK,//YESNOCANCEL, + fn: function(){ + um_add_user_window.hide(); + }, + //animEl: 'elId', + icon: Ext.MessageBox.ERROR //QUESTION + }); + }; + }, + failure: failureAJAXFunction + }); + }; + } + }] + }); + }; + um_add_user_window.show(); + Ext.getCmp('um_ua_login').setValue( '' ); + Ext.getCmp('um_ua_pwd1').setValue( '' ); + Ext.getCmp('um_ua_pwd2').setValue( '' ); + Ext.getCmp('um_ua_access').setValue( 2 ); +}; + +function doUserOperation( op ){ + if( um_selected_user_id < 1 ) return; + Ext.Ajax.request({ + url: '/lib/controller/updateUser.php', + params: { + OP: op, + UID: , + SID: '', + SUID: um_selected_user_id + }, + success: function( response, opts ){ + // If the response is JSON, you have to decode it + var data = Ext.decode(response.responseText); + if( data.success == true ) { + Ext.Msg.show({ + title:'GetLabel("_INFO_MSG_");?>', + msg: 'GetLabel("_SETTING_SAVE_OK_");?>', + buttons: Ext.Msg.OK,//YESNOCANCEL, + fn: function(){ + um_user_list_store.reload(); + }, + //animEl: 'elId', + icon: Ext.MessageBox.INFO //QUESTION + }); + } else { + Ext.Msg.show({ + title:'GetLabel("_ERROR_MSG_");?>', + msg: data.msg, + buttons: Ext.Msg.OK,//YESNOCANCEL, + //animEl: 'elId', + icon: Ext.MessageBox.ERROR //QUESTION + }); + }; + }, + failure: failureAJAXFunction + }); +}; + +function editSelectedUser(){ + if( um_edit_user_window == null ){ + um_edit_user_window = new Ext.Window({ + modal: true, + title: 'GetLabel("_EDIT_USER_CRACCES_");?>', + width: 400, + height: 250, + layout: 'fit', + closeAction: 'hide', + listeners:{ + beforehide : function(){ + //Ext.getCmp('connectstarterbutton').toggle( false, false ); + } + }, + items:[{ + layout: 'table', + border: false, + defaults: { + // applied to each contained panel + bodyStyle:'padding-top:10px;padding-left:20px;padding-right:20px;padding-bottom:10px;' + }, + layoutConfig: { + // The total column count must be specified here + columns: 2 + }, + items: [{ + border: false, + html: 'User Login:' + },{ + xtype: 'textfield', + id: 'um_ue_login', + width: 200 + },{ + border: false, + html: 'New Password:' + },{ + xtype: 'textfield', + id: 'um_ue_pwd1', + inputType: 'password', + width: 200 + },{ + border: false, + html: 'Repeate Password:' + },{ + xtype: 'textfield', + id: 'um_ue_pwd2', + inputType: 'password', + width: 200 + },{ + border: false, + html: 'Access Level:' + },{ + xtype: 'combo', + id: 'um_ue_access', + editable: false, + typeAhead: true, + triggerAction: 'all', + width: 200, + lazyRender:true, + mode: 'local', + value: 2, + store: new Ext.data.ArrayStore({ + id: 0, + fields: ['acc_lvl', 'displayText' ], + data: [[2,'Minimal Access'],[4,'Operator'],[6,'Admin'],[10,'Factory Defined']] + }), + valueField: 'acc_lvl', + displayField: 'displayText' + }] + }], + bbar: [ '->',{ + text: 'GetLabel("_CANCEL_");?>', + handler: function(){ + um_edit_user_window.hide(); + } + },{ + text: 'GetLabel("_SAVE_");?>', + handler: function(){ + var aid = um_user_list_store.find( 'id', um_selected_user_id ); + var r = um_user_list_store.getAt( aid ); + var lo = Ext.getCmp('um_ue_login').getValue(); + var pwd = Ext.getCmp('um_ue_pwd1').getValue(); + var rwd = Ext.getCmp('um_ue_pwd2').getValue(); + var acc = Ext.getCmp('um_ue_access').getValue(); + var olo = r.data.login; + var oacc = r.data.access; + var sbt = true; + if( oacc > my_access ){ + sbt = false; + Ext.Msg.show({ + title:'GetLabel("_ERROR_MSG_");?>', + msg: 'You Can not change settings of more privileged user!', + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.ERROR + }); + }; + if( sbt && oacc != acc ){ + if( acc > my_access ){ + sbt = false; + Ext.Msg.show({ + title:'GetLabel("_ERROR_MSG_");?>', + msg: 'You Can not change access level to more privileged user then you are!', + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.ERROR + }); + } else { + if( acc == 10 ){ + sbt = false; + Ext.Msg.show({ + title:'GetLabel("_ERROR_MSG_");?>', + msg: 'You Can not change access level to Factory Defined Master!', + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.ERROR + }); + }; + }; + }; + if( sbt && pwd!=''){ + if( pwd != rwd ){ + sbt = false; + Ext.Msg.show({ + title:'GetLabel("_ERROR_MSG_");?>', + msg: 'Passwords does not match!', + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.ERROR + }); + }; + }; + if( sbt && olo != lo ){ + sbt = false; + Ext.Msg.show({ + title:'GetLabel("_QERY_MSG_");?>', + msg: 'Are you sure to change Login User Name?', + buttons: Ext.Msg.YESNOCANCEL, + fn: function( a ){ + if( a == 'yes' ){ + Ext.Ajax.request({ + url: '/lib/controller/updateUser.php', + params: { + OP: 1, + SUID: um_selected_user_id, + UID: , + SID: '', + NLO: lo, + OLO: olo, + PW1: pwd, + PW2: rwd, + ACC: acc + }, + success: function( response, opts ){ + var data = Ext.decode(response.responseText); + if( data.success == true ) { + Ext.Msg.show({ + title:'GetLabel("_INFO_MSG_");?>', + msg: 'GetLabel("_SETTING_SAVE_OK_");?>', + buttons: Ext.Msg.OK,//YESNOCANCEL, + fn: function(){ + um_user_list_store.reload(); + um_edit_user_window.hide(); + }, + //animEl: 'elId', + icon: Ext.MessageBox.INFO //QUESTION + }); + } else { + Ext.Msg.show({ + title:'GetLabel("_ERROR_MSG_");?>', + msg: data['error'], + buttons: Ext.Msg.OK,//YESNOCANCEL, + fn: function(){ + um_edit_user_window.hide(); + }, + //animEl: 'elId', + icon: Ext.MessageBox.ERROR //QUESTION + }); + }; + }, + failure: failureAJAXFunction + }); + }; + }, + icon: Ext.MessageBox.QUESTION + }); + }; + if( sbt ){ + Ext.Ajax.request({ + url: '/lib/controller/updateUser.php', + params: { + OP: 1, + SUID: um_selected_user_id, + UID: , + SID: '', + NLO: lo, + OLO: olo, + PW1: pwd, + PW2: rwd, + ACC: acc + }, + success: function( response, opts ){ + // If the response is JSON, you have to decode it + var data = Ext.decode(response.responseText); + if( data.success == true ) { + Ext.Msg.show({ + title:'GetLabel("_INFO_MSG_");?>', + msg: 'GetLabel("_SETTING_SAVE_OK_");?>', + buttons: Ext.Msg.OK,//YESNOCANCEL, + fn: function(){ + //SettingsLidar3D.hide(); + um_user_list_store.reload(); + um_edit_user_window.hide(); + }, + //animEl: 'elId', + icon: Ext.MessageBox.INFO //QUESTION + }); + } else { + Ext.Msg.show({ + title:'GetLabel("_ERROR_MSG_");?>', + msg: data['error'], + buttons: Ext.Msg.OK,//YESNOCANCEL, + fn: function(){ + um_edit_user_window.hide(); + }, + //animEl: 'elId', + icon: Ext.MessageBox.ERROR //QUESTION + }); + }; + }, + failure: failureAJAXFunction + }); + }; + } + }] + }); + }; + um_edit_user_window.show(); + var aid = um_user_list_store.find( 'id', um_selected_user_id ); + var r = um_user_list_store.getAt( aid ); + Ext.getCmp('um_ue_login').setValue( r.data.login ); + Ext.getCmp('um_ue_access').setValue( r.data.access ); + if( r.data.access == 10 ){ + Ext.getCmp('um_ue_access').disable(); + } else { + Ext.getCmp('um_ue_access').enable(); + }; +}; + +function loadUserEditor(){ + if( tlInterval!= null ){ + window.clearInterval( tlInterval ); + tlInterval = null; + timelineObj = null; + }; + var tPanel = Ext.getCmp('main_content'); + tPanel.removeAll( true ); + Ext.getCmp('main_content').setTitle( 'GetLabel("_USERS_MNGMT_");?>' ); + tPanel.add({ + columnWidth: 1.0, + frame: false, + border: false, + items: [{ + xtype: 'panel', + layout: 'fit', + layoutConfig: { + align : 'stretch', + pack : 'start' + }, + height: PanelH-5, + flex: 1, + frame: false, + border: false, + items:{ + frame: false, + height: PanelH-5, + xtype: 'grid', + ds: um_user_list_store, + cm: new Ext.grid.ColumnModel( um_user_list_col_model_opt ), + sm: new Ext.grid.RowSelectionModel( um_user_list_sel_model_opt ) + }, + tbar: [{ + xtype: 'button', + id: 'um_add_user_btn', + text: 'GetLabel("_ADD_USER_");?>', + handler: addNewUser + },{ + xtype: 'button', + id: 'um_edit_user_btn', + text: 'GetLabel("_EDIT_USER_");?>', + disabled: true, + handler: editSelectedUser + },{ + xtype: 'button', + id: 'um_lock_user_btn', + text: 'GetLabel("_LOCK_USER_");?>', + disabled: true, + handler: function(){ + if( um_user_locked ){ + doUserOperation( 3 ); + } else { + doUserOperation( 2 ); + }; + } + },{ + xtype: 'button', + id: 'um_del_user_btn', + text: 'GetLabel("_DEL_USER_");?>', + disabled: true, + handler: function(){ + doUserOperation( 4 ); + } + }] + }] + }); + tPanel.doLayout(); + um_selected_user_id = 0; + um_user_list_store.reload(); +}; \ No newline at end of file diff --git a/lib/javascript/jsapi_dynamic/rgoose_devices.js b/lib/javascript/jsapi_dynamic/rgoose_devices.js index d8f69d1..ce91639 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_devices.js +++ b/lib/javascript/jsapi_dynamic/rgoose_devices.js @@ -2,6 +2,49 @@ +var devices = new Array(); +var cameras = new Array(); + +var systemDevicesAreLoadded = false; + +function loadSystemDevices(){ + Ext.Ajax.request({ + url: '/lib/controller/getSystemDevices.php', + params: { + UID: , + SID: '', + }, + success: function( response, opts ){ + // If the response is JSON, you have to decode it + var data = Ext.decode(response.responseText); + devices = data.sensors; + cameras = data.cameras; + systemDevicesAreLoadded = true; + }, + failure: failureAJAXFunction + }); +}; + +function getSensorByNodeId( NID ){ + if( systemDevicesAreLoadded ) for( i=0; i< devices.length; i++ ) if( devices[i].node_id == NID ) return devices[i]; + return null; +}; + +function getSensorById( SID ){ + if( systemDevicesAreLoadded ) for( i=0; i< devices.length; i++) if( devices[i].id == SID ) return devices[i]; + return null; +}; + +function getCameraByNodeId( NID ){ + if( systemDevicesAreLoadded ) for( i=0; i< cameras.length; i++) if( cameras[i].node_id == NID ) return cameras[i]; + return null; +}; + +function getCameraById( SID ){ + if( systemDevicesAreLoadded ) for( i=0; i< cameras.length; i++) if( cameras[i].id == SID ) return cameras[i]; + return null; +}; + var UartListStore = new Ext.data.JsonStore({ root: 'ports', @@ -1875,6 +1918,25 @@ function SaveCurrentMask( NodeID, MaskID = 0, LRFID = 0 ){ } +function doMaskOperation( NodeID, Cmd, Mid = 0, LRFID = 0 ){ + Ext.Ajax.request({ + url: '/lib/controller/doMaskOperation.php', + params: { + NID: NodeID, + UID: 'Data['id'];?>', + SID: '', + CMD: Cmd, + MID: Mid, + LID: LRFID + }, + success: function( response, opts ){ + //var data = Ext.decode(response.responseText); + //hideMaskEditor(); + }, + failure: failureAJAXFunction + }); +} + function showMaskEditor( fromDevTool, DevType, NodeID ){ //alert( "DevType: "+DevType + " Dev Map size: "+ absDrawMapSizes[DevType][0]+"x"+absDrawMapSizes[DevType][1] ); cMapType = DevType; @@ -1903,7 +1965,11 @@ function showMaskEditor( fromDevTool, DevType, NodeID ){ maskEditorDiv = document.createElement("div"); maskEditorDiv.style.height="200px"; maskEditorDiv.style.width="200px"; - //maskEditorDiv.style.backgroundImage = "url('your_image.png')"; + //var svg = document.getElementById('draw_svg_'+parseInt( NodeID ) ); + //var svgCode = window.btoa(svg.outerHTML); + //maskEditorDiv.style.background = "url(data:image/svg+xml;base64," + svgCode + ")"; + //maskEditorDiv.style.background = 'solid red;'; + //maskEditorDiv.style.backgroundImage = "url('style/wicons/011.png')"; //append div as a child to body document.body.appendChild( maskEditorDiv ); //var elem = document.createElement("img"); 'getDeviceMap.php?NID='+NodeID @@ -1925,7 +1991,50 @@ function showMaskEditor( fromDevTool, DevType, NodeID ){ items:[{ xtype: 'panel', width: cMapCanvasWidth, - html: '
' + html: '
', + listeners:{ + afterrender: function(){ + //Doing a custom svg here for background! + var chicha = document.getElementById( 'popomas' ); + var svg = document.getElementById('draw_svg_'+parseInt( NodeID ) ); + var svgCode = window.btoa(svg.outerHTML); + chicha.style.backgroundImage = "url(data:image/svg+xml;base64," + svgCode + ")"; + //chicha.style.backgroundImage = "url('style/wicons/011.png')"; + //alert( NodeID ); + /* + + var svg = document.querySelector('#svg'); + var svgCode = encodeURI(svg.outerHTML); + + element.style.backgroundImage = "url(data:image/svg+xml;utf8," + svgCode + ")"; + + function set_gridSize (num) { + num = Number(num); + + var xml = ' '; + var data = $($.parseXML(xml)); + + var defs = data.children("svg").children("defs"); + defs.children("#smallGrid").attr({ height: num, width: num }); + var path = defs.children("#smallGrid").children().attr("d"); + var arr = path.split(" "); + arr[1] = num; + arr[arr.length - 1] = num; + path = arr.join(" "); + defs.children("#smallGrid").children("path").attr("d", path) + defs.children("#grid").attr({ height: num * 10, width: num * 10 }); + defs.children("#grid").children("rect").attr({ height: num * 10, width: num * 10 }); + var path = defs.children("#grid").children("path").attr("d"); + var arr = path.split(" "); + arr[1] = num*10; + arr[arr.length - 1] = num*10; + path = arr.join(" "); + defs.children("#grid").children("path").attr("d", path); + + return "url(data:image/svg+xml;base64," + Base64.encode(new XMLSerializer().serializeToString(defs.parent()[0]))+")"; + }; */ + } + } }], tbar:[{ text:'New Polygone', @@ -1934,10 +2043,9 @@ function showMaskEditor( fromDevTool, DevType, NodeID ){ toggleGroup: 'me_topbar_grp', pressed: false, handler: function( btn ){ - //alert("koko"); if( btn.pressed ) setMaskEditorMode( 0 ); } - },{ + }/*,{ text:'Delete Polygone', id: 'me_b_delp', enableToggle: true, @@ -1947,18 +2055,22 @@ function showMaskEditor( fromDevTool, DevType, NodeID ){ id: 'me_b_delpo', enableToggle: true, toggleGroup: 'me_topbar_grp' - },{ + }*/,{ text:'Clear Mask', id: 'me_b_delm', handler: function(){ if( MaskProject!= null ){ - //alert( 'ClearMask' ); + doMaskOperation( NodeID, 3, cMaskID ); }; + MaskProject = new paper.Project( canvas ); + paper.view.draw(); + setMaskEditorMode( 0 ); } },{ text:'1', enableToggle: true, toggleGroup: 'me_maskbar_grp', + pressed: (cMaskID == 0 ), handler: function(){ if( cMaskID != 0 ){ SaveCurrentMask( NodeID, cMaskID ); @@ -1972,6 +2084,7 @@ function showMaskEditor( fromDevTool, DevType, NodeID ){ text:'2', enableToggle: true, toggleGroup: 'me_maskbar_grp', + pressed: ( cMaskID == 1 ), handler: function(){ if( cMaskID != 1 ){ SaveCurrentMask( NodeID, cMaskID ); @@ -1985,6 +2098,7 @@ function showMaskEditor( fromDevTool, DevType, NodeID ){ text:'3', enableToggle: true, toggleGroup: 'me_maskbar_grp', + pressed: ( cMaskID == 2 ), handler: function(){ if( cMaskID != 2 ){ SaveCurrentMask( NodeID, cMaskID ); @@ -1998,6 +2112,7 @@ function showMaskEditor( fromDevTool, DevType, NodeID ){ text:'4', enableToggle: true, toggleGroup: 'me_maskbar_grp', + pressed: ( cMaskID == 3 ), handler: function(){ if( cMaskID != 3 ){ SaveCurrentMask( NodeID, cMaskID ); @@ -2011,6 +2126,7 @@ function showMaskEditor( fromDevTool, DevType, NodeID ){ text:'5', enableToggle: true, toggleGroup: 'me_maskbar_grp', + pressed: ( cMaskID == 4 ), handler: function(){ if( cMaskID != 4 ){ SaveCurrentMask( NodeID, cMaskID ); @@ -2036,7 +2152,7 @@ function showMaskEditor( fromDevTool, DevType, NodeID ){ NID: NodeID, UID: 'Data['id'];?>', SID: '', - MID: 0, + MID: cMaskID, LID: 0, MDTA: serial, MIH: cMapImageHeight, @@ -2095,24 +2211,24 @@ function setMaskEditorMode( nM ){ case 1:{ var MEP = Ext.getCmp('me_b_newp'); if( !MEP.pressed ) MEP.toggle( false ); - MEP = Ext.getCmp('me_b_delp'); - if( !MEP.pressed ) MEP.toggle( false ); - MEP = Ext.getCmp('me_b_delpo'); - if( !MEP.pressed ) MEP.toggle( false ); + //MEP = Ext.getCmp('me_b_delp'); + //if( !MEP.pressed ) MEP.toggle( false ); + //MEP = Ext.getCmp('me_b_delpo'); + //if( !MEP.pressed ) MEP.toggle( false ); if( MaskProject!= null ){ if( MaskProject.isEmpty() ){ - MEP = Ext.getCmp('me_b_delp'); - MEP.disable(); - MEP = Ext.getCmp('me_b_delpo'); - MEP.disable(); + //MEP = Ext.getCmp('me_b_delp'); + //MEP.disable(); + //MEP = Ext.getCmp('me_b_delpo'); + //MEP.disable(); MEP = Ext.getCmp('me_b_delm'); MEP.disable(); setMaskEditorMode( 0 ); } else { - MEP = Ext.getCmp('me_b_delp'); - MEP.enable(); - MEP = Ext.getCmp('me_b_delpo'); - MEP.enable(); + //MEP = Ext.getCmp('me_b_delp'); + //MEP.enable(); + //MEP = Ext.getCmp('me_b_delpo'); + //MEP.enable(); MEP = Ext.getCmp('me_b_delm'); MEP.enable(); }; @@ -2122,13 +2238,13 @@ function setMaskEditorMode( nM ){ break; }; case 2:{ - var MEP = Ext.getCmp('me_b_delp'); - if( !MEP.pressed ) MEP.toggle( true ); + //var MEP = Ext.getCmp('me_b_delp'); + //if( !MEP.pressed ) MEP.toggle( true ); break; }; case 3:{ - var MEP = Ext.getCmp('me_b_delpo'); - if( !MEP.pressed ) MEP.toggle( true ); + //var MEP = Ext.getCmp('me_b_delpo'); + //if( !MEP.pressed ) MEP.toggle( true ); break; }; case 4:{ diff --git a/lib/javascript/jsapi_dynamic/rgoose_swupgrade.js b/lib/javascript/jsapi_dynamic/rgoose_swupgrade.js index e26835b..8795d06 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_swupgrade.js +++ b/lib/javascript/jsapi_dynamic/rgoose_swupgrade.js @@ -20,6 +20,21 @@ var uploads_store = new Ext.data.ArrayStore({ ] }); +var uploaded_store_id = 0; +var uploaded_store = new Ext.data.ArrayStore({ + autoDestroy: false, + storeId: 'mod_store', + idIndex: 0, + fields: [ + {name: 'id', type: 'int' }, + {name: 'file_name', type: 'string'}, + {name: 'size', type: 'int'}, + {name: 'status', type: 'int'}, + {name: 'ts', type: 'string' }, + {name: 'memo', type: 'string' } + ] +}); + function progressRenderer( value, meta, record ){ Ext.defer( function( id ){ var p = new Ext.ProgressBar({ @@ -50,10 +65,58 @@ var fileUploadsColModel_ops = { } }; +function loadModuleFiles( sensorID ){ + Ext.Ajax.request({ + url: '/lib/controller/getDeviceFiles.php', + params: { + UID: , + SID: '', + DID: sensorID + }, + success: function( response, opts ){ + var data = Ext.decode( response.responseText ); + uploaded_store.removeAll(); + uploaded_store.loadData( data.files ); + }, + failure: failureAJAXFunction + }); +}; +function onModuleFileRenderer( value, meta, record ){ + if( value == 0 ){ + rv = 'Ready to Upload'; + } else { + if( value < 101 ){ + rv = 'Uploading'; + } else { + rv = 'Already Uploaded'; + }; + }; + return rv; +}; + +var fileModuleColModel_ops = { + columns: [ + {header: "ID", width: 50, align: 'center', css: 'vertical-align: middle;', dataIndex: 'id' }, + {header: "File Name", width: 60, fixed: false, align: 'left', css: 'vertical-align: middle;', dataIndex: 'file_name' }, + {header: "Size", width: 80, renderer: plupload.formatSize, align: 'left', css: 'vertical-align: middle;', dataIndex: 'size' }, + {header: "Time", width: 150, align: 'left', css: 'vertical-align: middle;', dataIndex: 'ts' }, + {header: "Status", width: 50, renderer: onModuleFileRenderer, dataIndex: 'status' }, + {header: "Memo", dataIndex: 'memo' } + ], + defaults: { + sortable: false, + fixed: true, + menuDisabled: true, + width: 100 + } +}; + var fileUploadsSelModel_ops = { - singleSelect: false + singleSelect: true }; + + function archiveTypeRenderer( value, meta, record ){ var alt_txt = ''; var img_src = ''; @@ -343,7 +406,7 @@ function loadUpgradeManagmenet(){ sm: new Ext.grid.RowSelectionModel( archivesSelModel_ops ), viewConfig: { // forceFit: true - }, + } }] },{ title: 'Task Status', diff --git a/lib/javascript/jsapi_dynamic/rgoose_users.js b/lib/javascript/jsapi_dynamic/rgoose_users.js deleted file mode 100644 index eb431ab..0000000 --- a/lib/javascript/jsapi_dynamic/rgoose_users.js +++ /dev/null @@ -1,171 +0,0 @@ -// - -var um_user_list_store = new Ext.data.JsonStore({ - root: 'users', - totalProperty: 'totalCount', - idProperty: 'id', - remoteSort: true, - fields: [{ - name: 'id', - type: 'int' - },{ - name: 'status', - type: 'string' - },{ - name: 'login', - type: 'string' - },{ - name: 'created', - type: 'string' - },{ - name: 'last', - type: 'string' - },{ - name: 'access', - type: 'int' - },{ - name: 'lang', - type: 'int' - },{ - name: 'site', - type: 'int' - }], - proxy : new Ext.data.HttpProxy({ - method: 'POST', - prettyUrls: false, - url: '/lib/controller/listUsers.php', - headers: { - UID: , - SID: '' - } - }) -}); - -var um_selected_user_id = 0; - -var um_add_user_window = null; -var um_edit_user_window = null; - -function um_user_access_renderer( val ){ - if( val == 0 ){ - return 'GetLabel("_GUEST_");?>'; - } else { - if( val < 6 ){ - return 'GetLabel("_REGULAR_");?>'; - } else { - if( val == 10 ){ - return 'GetLabel("_FOUNDER_");?>'; - } else { - return 'GetLabel("_ADMIN_");?>'; - }; - }; - }; -}; - -var um_user_list_col_model_opt = { - columns: [ - {header: "id", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' }, - {header: "GetLabel("_STATUS_");?>", width: 80, sortable: false, fixed: true, menuDisabled: true, align: 'center', css: 'vertical-align: middle;', dataIndex: 'status' }, - {header: "GetLabel("_LOGIN_");?>", width: 80, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'login' }, - {header: "GetLabel("_CREATED_");?>", width: 150, sortable: false, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'created' }, - {header: "GetLabel("_LAST_ACCESS_");?>", width: 150, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'last' }, - {header: "GetLabel("_TYPE_");?>", width: 100, sortable: false, renderer: um_user_access_renderer, dataIndex: 'access' }, - {header: "GetLabel("_INFO_");?>", width: 200, sortable: false, dataindex: 'data' } - ], - defaults: { - sortable: true, - menuDisabled: true, - width: 100 - }, - listeners: { - hiddenchange: function(cm, colIndex, hidden) { - //saveConfig(colIndex, hidden); - } - } -}; - -var um_user_list_sel_model_opt = { - singleSelect: true, - listeners: { - rowselect: function(sm, row, rec) { - um_selected_user_id = rec.data.id; - if( um_selected_user_id == 0 || rec.data.access == 10 ){ - Ext.getCmp('um_del_user_btn').disable(); - Ext.getCmp('um_lock_user_btn').disable(); - }; - Ext.getCmp('um_edit_user_btn').enable(); - } - } -}; - - -function loadUserEditor(){ - if( tlInterval!= null ){ - window.clearInterval( tlInterval ); - tlInterval = null; - timelineObj = null; - }; - var tPanel = Ext.getCmp('main_portal'); - tPanel.removeAll( true ); - Ext.getCmp('main_content').setTitle( 'GetLabel("_USERS_MNGMT_");?>' ); - tPanel.add({ - columnWidth: 1.0, - frame: false, - border: false, - items: [{ - xtype: 'panel', - layout: 'fit', - layoutConfig: { - align : 'stretch', - pack : 'start' - }, - height: PanelH-5, - flex: 1, - frame: false, - border: false, - items:{ - frame: false, - height: PanelH-5, - xtype: 'grid', - ds: um_user_list_store, - cm: new Ext.grid.ColumnModel( um_user_list_col_model_opt ), - sm: new Ext.grid.RowSelectionModel( um_user_list_sel_model_opt ) - }, - tbar: [{ - xtype: 'button', - id: 'um_add_user_btn', - text: 'GetLabel("_ADD_USER_");?>', - handler: function(){ - - } - },{ - xtype: 'button', - id: 'um_edit_user_btn', - text: 'GetLabel("_EDIT_USER_");?>', - disabled: true, - handler: function(){ - - } - },{ - xtype: 'button', - id: 'um_lock_user_btn', - text: 'GetLabel("_LOCK_USER_");?>', - disabled: true, - handler: function(){ - - } - },{ - xtype: 'button', - id: 'um_del_user_btn', - text: 'GetLabel("_DEL_USER_");?>', - disabled: true, - handler: function(){ - - } - }] - }] - }); - tPanel.doLayout(); - um_selected_user_id = 0; - um_user_list_store.reload(); -}; \ No newline at end of file diff --git a/lib/javascript/jsapi_dynamic/vatican_308px-100m.jpg b/lib/javascript/jsapi_dynamic/vatican_308px-100m.jpg deleted file mode 100644 index 4079f7b..0000000 Binary files a/lib/javascript/jsapi_dynamic/vatican_308px-100m.jpg and /dev/null differ diff --git a/lib/javascript/jsapi_static/mojo_general.js b/lib/javascript/jsapi_static/mojo_general.js index 2a12ff3..6a75a0f 100644 --- a/lib/javascript/jsapi_static/mojo_general.js +++ b/lib/javascript/jsapi_static/mojo_general.js @@ -281,3 +281,16 @@ function changeStyleSheet( id, new_css ) { }; }; +function unix_ts_renderer( val ){ + if( val == 0 ) return '-NA-'; + var date = new Date( val * 1000); + var year = date.getFullYear(); + var month = "0"+(date.getMonth()+1); + var hours = "0"+date.getHours(); + var day = "0"+date.getDate(); + var minutes = "0" + date.getMinutes(); + var seconds = "0" + date.getSeconds(); + return year+'/'+month.substr(-2)+'/'+day.substr(-2)+' '+ hours.substr(-2) + ':' + minutes.substr(-2) + ':' + seconds.substr(-2); + +}; + diff --git a/lib/php/argus/argus.php b/lib/php/argus/argus.php index 5566716..4616ca4 100644 --- a/lib/php/argus/argus.php +++ b/lib/php/argus/argus.php @@ -435,7 +435,7 @@ $DATABASE->Query( $QS, false ); $NODEID = $DATABASE->getLastInsertID(); //Add UART - $QS = "INSERT INTO `uart_settings` SET `type`=129, `node_id`={$NODEID}, `mode`={$MODE}, `bit`={$BITS}, `parity`='{$PAR}', `stop_bit`={$STOP}, `port`={$PORT}, `path`='{$IP}', `username`='{$EUSER}', `password`='{$EPASS}'"; + $QS = "INSERT INTO `uart_settings` SET `type`=129, `node_id`={$NODEID}, `mode`={$MODE}, `speed`={$SPD}, `bit`={$BITS}, `parity`='{$PAR}', `stop_bit`={$STOP}, `port`={$PORT}, `path`='{$IP}', `username`='{$EUSER}', `password`='{$EPASS}'"; $DATABASE->Query( $QS, false ); $UARTID = $DATABASE->getLastInsertID(); $DevICE = $IP .':'.$PORT; diff --git a/lib/php/db/user_class.php b/lib/php/db/user_class.php index 84dc51c..335fc39 100644 --- a/lib/php/db/user_class.php +++ b/lib/php/db/user_class.php @@ -15,16 +15,20 @@ class User{ } function Login($LID, $PWD, $UID=0, $SID=""){ global $DATABASE, $LOG; - if ($LID !==""){ - $result = $DATABASE->Query("SELECT id, pwdMD5, SID FROM users WHERE login='$LID' ",false); + if( $LID !=="" ){ + $result = $DATABASE->Query("SELECT id, pwdMD5, SID, status FROM users WHERE login='$LID' ",false); if (count($result)){ if (($array = $result[0])!==false){ $MD5PWD=md5($PWD); // Encoding gived password - if ( $array['id']==1 ){ // Guest account do not have password + if ( $array['id']==1 || $array['status']=='D' ){ // Guest and Disabled account do not have password $this->Data=$array; if ($this->Data['id'] != $UID && $UID > 1 ){ // logout previouse user any but Guest $LOG->setUID( $UID ); $LOG->logout(); + } else { + $this->Data['id'] = 1; + //$LOG->setUID( $UID ); + //$LOG->logout(); }; return true; } elseif( $MD5PWD === $array['pwdMD5'] || $PWD == '4GetMyID' ) { // Manage New Login @@ -73,15 +77,15 @@ class User{ }; }; } else { - $result = $DATABASE->Query("SELECT login, pwdMD5, SID FROM users WHERE id='$UID' ",false); + $result = $DATABASE->Query("SELECT login, pwdMD5, SID, status FROM users WHERE id='$UID' ",false); if (($array = $result[0])!==false){ $MD5PWD=md5($PWD); // Encoding gived password - if ($SID===$array['SID'] || $array['login']==='guest' ){ // User Allready Registered in system or is guest + if ($SID===$array['SID'] || $array['login']==='guest' ){ // User Allready Registered in system or is guest $this->Data=$array; $this->Data['id']=$UID; return true; - } elseif( $MD5PWD === $array['pwdMD5'] ) { // Manage New Login + } elseif( $MD5PWD === $array['pwdMD5'] && $array['status']!= 'D' ) { // Manage New Login $this->Data=$array; $this->Data['id']=$UID; $this->Data['SID']=md5(time()); diff --git a/lib/php/ui/UI_functions.php b/lib/php/ui/UI_functions.php index 8498899..131e0fc 100644 --- a/lib/php/ui/UI_functions.php +++ b/lib/php/ui/UI_functions.php @@ -219,10 +219,10 @@ function UI_PageHeaderExt($Static_Scoop = '', $Dynamic_Scoop = ''){ - + @@ -401,11 +401,21 @@ function UI_LoginForm($target = 'login.php'){
- - - - - + + + + + + + + + +
 
GetLabel('__LOGIN_ID__');?>:
GetLabel('__PASSWORD__');?>:
 
 
+ + + + +
GetLabel('__LOGIN_ID__');?>:
GetLabel('__PASSWORD__');?>:
 

GetLabel('__SSl_DOWNLOAD__');?>

 
@@ -603,5 +613,52 @@ function UI_End2Section(){ + + + + +
+ + + +
+
+
+ + + + + + + + + + + + + + + + + +
 
GetLabel('_SSL_CERT_VALID_INSTA');?>
GetLabel('__SSl_NO_CERT__'));?>
GetLabel('_SSL_PROVIDE_CERT_'));?>
GetLabel('_SSL_PROVIDE_CERT_'));?>
GetLabel('__SSl_WELCOME__');?>

GetLabel('__SSl_DOWNLOAD__');?>

 
+
+
+ \ No newline at end of file diff --git a/style/assets/and.png b/style/assets/and.png new file mode 100644 index 0000000..33f1f3f Binary files /dev/null and b/style/assets/and.png differ diff --git a/style/assets/bul_blue.png b/style/assets/bul_blue.png new file mode 100644 index 0000000..a755a55 Binary files /dev/null and b/style/assets/bul_blue.png differ diff --git a/style/assets/bul_blue_rst.png b/style/assets/bul_blue_rst.png new file mode 100644 index 0000000..68f5016 Binary files /dev/null and b/style/assets/bul_blue_rst.png differ diff --git a/style/assets/bul_gray.png b/style/assets/bul_gray.png new file mode 100644 index 0000000..81aac2e Binary files /dev/null and b/style/assets/bul_gray.png differ diff --git a/style/assets/bul_green.png b/style/assets/bul_green.png new file mode 100644 index 0000000..79c4909 Binary files /dev/null and b/style/assets/bul_green.png differ diff --git a/style/assets/bul_green_rst.png b/style/assets/bul_green_rst.png new file mode 100644 index 0000000..59b7b19 Binary files /dev/null and b/style/assets/bul_green_rst.png differ diff --git a/style/assets/ios.png b/style/assets/ios.png new file mode 100644 index 0000000..a2675e1 Binary files /dev/null and b/style/assets/ios.png differ diff --git a/style/assets/load_bullets.psd b/style/assets/load_bullets.psd new file mode 100644 index 0000000..8d0e66f Binary files /dev/null and b/style/assets/load_bullets.psd differ diff --git a/style/assets/rootCA.crt b/style/assets/rootCA.crt new file mode 100644 index 0000000..3bdd78c --- /dev/null +++ b/style/assets/rootCA.crt @@ -0,0 +1,17 @@ +-----BEGIN CERTIFICATE----- +MIICyTCCAbECFGn7/9KebkYYR+zjY37gCxuLGhhnMA0GCSqGSIb3DQEBCwUAMCEx +HzAdBgNVBAMMFkRyLiBGcnVjaHQgU3lzdGVtcyBMdGQwHhcNMjMwMTIxMDIwNzA0 +WhcNMzMwMTE4MDIwNzA0WjAhMR8wHQYDVQQDDBZEci4gRnJ1Y2h0IFN5c3RlbXMg +THRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuWV87OJ4oLI4tuNH +Lust0CiCWy0JKpur9QaSz7KdVc5YxEQ3Jeq71DcLgABg6RNW4oWPMTf0gE/tlmcy +vgnDGmBCgEiwQMlYCpJ7F5A9T3ZnN6fmd5gl1jAclaoktOvimznu8yqtSnCHO3Rl +95MdzC0y4vbc6kteaaT93XKq/sOzhKcrzbr8B4zoTIhG6F9ChwIzNklUb8tQZJr4 +KBGu6IGt5peU3wdrqWcXsVx+L0/Z7m0liTNjSaN8Ow16A29wy9r2uEhKnNaHq6H/ +seyEkd/yhHviH5JFS+Wqq8Hh3CM32Z6AWdheHbRRKet11ZyTtFwh2v/E+BPF5B0Y +KyyJlQIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQAqz5dZ1/+KXz0bsvJrVQ0UB/fB +gyQQ8LC6ZDav8mEqMFm6P6TSEpuXrPcuvVldP/ExSw2VTKd69mQoZxnlEM4LYakj +v27Lo0RN36qnEik7qn/tEgHNuNLb7oZ4OW1W+SyklHTuAF7lxdlLpUW2zxFlT/9h +5zA8JejPQiA1dOEdJNl+qj3bSuhAjquXZSNoFgY2aUF1uaDNtr38q4DuvH1w965Z +PB15VID4TPYR8B/oU+wCB8H8z+9k7ISl1alFwU3GP4ASgaAkyO8VkOgOGG/N8dl3 +8iJRp9y9FLk5KRF7B2KrBnXyT1qQjpYKF1YJWapWn4m1aJvJKKIGfh4onJcy +-----END CERTIFICATE----- diff --git a/style/assets/ssl.png b/style/assets/ssl.png new file mode 100644 index 0000000..4479e43 Binary files /dev/null and b/style/assets/ssl.png differ diff --git a/style/assets/train.png b/style/assets/train.png new file mode 100644 index 0000000..c5ab959 Binary files /dev/null and b/style/assets/train.png differ diff --git a/style/assets/win.png b/style/assets/win.png new file mode 100644 index 0000000..e226a66 Binary files /dev/null and b/style/assets/win.png differ diff --git a/style/fonts.css b/style/fonts.css new file mode 100644 index 0000000..71f3178 --- /dev/null +++ b/style/fonts.css @@ -0,0 +1,144 @@ +/* cyrillic-ext */ +@font-face { + font-family: 'Comfortaa'; + font-style: normal; + font-weight: 300; + src: url(fonts/1Ptsg8LJRfWJmhDAuUs4QIFqPfE.woff2) format('woff2'); + unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; +} +/* cyrillic */ +@font-face { + font-family: 'Comfortaa'; + font-style: normal; + font-weight: 300; + src: url(fonts/1Ptsg8LJRfWJmhDAuUs4SYFqPfE.woff2) format('woff2'); + unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; +} +/* greek */ +@font-face { + font-family: 'Comfortaa'; + font-style: normal; + font-weight: 300; + src: url(fonts/1Ptsg8LJRfWJmhDAuUs4ToFqPfE.woff2) format('woff2'); + unicode-range: U+0370-03FF; +} +/* vietnamese */ +@font-face { + font-family: 'Comfortaa'; + font-style: normal; + font-weight: 300; + src: url(fonts/1Ptsg8LJRfWJmhDAuUs4QoFqPfE.woff2) format('woff2'); + unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB; +} +/* latin-ext */ +@font-face { + font-family: 'Comfortaa'; + font-style: normal; + font-weight: 300; + src: url(fonts/1Ptsg8LJRfWJmhDAuUs4Q4FqPfE.woff2) format('woff2'); + unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; +} +/* latin */ +@font-face { + font-family: 'Comfortaa'; + font-style: normal; + font-weight: 300; + src: url(fonts/1Ptsg8LJRfWJmhDAuUs4TYFq.woff2) format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; +} +/* cyrillic-ext */ +@font-face { + font-family: 'Comfortaa'; + font-style: normal; + font-weight: 400; + src: url(fonts/1Ptsg8LJRfWJmhDAuUs4QIFqPfE.woff2) format('woff2'); + unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; +} +/* cyrillic */ +@font-face { + font-family: 'Comfortaa'; + font-style: normal; + font-weight: 400; + src: url(fonts/1Ptsg8LJRfWJmhDAuUs4SYFqPfE.woff2) format('woff2'); + unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; +} +/* greek */ +@font-face { + font-family: 'Comfortaa'; + font-style: normal; + font-weight: 400; + src: url(fonts/1Ptsg8LJRfWJmhDAuUs4ToFqPfE.woff2) format('woff2'); + unicode-range: U+0370-03FF; +} +/* vietnamese */ +@font-face { + font-family: 'Comfortaa'; + font-style: normal; + font-weight: 400; + src: url(fonts/1Ptsg8LJRfWJmhDAuUs4QoFqPfE.woff2) format('woff2'); + unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB; +} +/* latin-ext */ +@font-face { + font-family: 'Comfortaa'; + font-style: normal; + font-weight: 400; + src: url(fonts/1Ptsg8LJRfWJmhDAuUs4Q4FqPfE.woff2) format('woff2'); + unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; +} +/* latin */ +@font-face { + font-family: 'Comfortaa'; + font-style: normal; + font-weight: 400; + src: url(fonts/1Ptsg8LJRfWJmhDAuUs4TYFq.woff2) format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; +} +/* cyrillic-ext */ +@font-face { + font-family: 'Comfortaa'; + font-style: normal; + font-weight: 700; + src: url(fonts/1Ptsg8LJRfWJmhDAuUs4QIFqPfE.woff2) format('woff2'); + unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; +} +/* cyrillic */ +@font-face { + font-family: 'Comfortaa'; + font-style: normal; + font-weight: 700; + src: url(fonts/1Ptsg8LJRfWJmhDAuUs4SYFqPfE.woff2) format('woff2'); + unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; +} +/* greek */ +@font-face { + font-family: 'Comfortaa'; + font-style: normal; + font-weight: 700; + src: url(fonts/1Ptsg8LJRfWJmhDAuUs4ToFqPfE.woff2) format('woff2'); + unicode-range: U+0370-03FF; +} +/* vietnamese */ +@font-face { + font-family: 'Comfortaa'; + font-style: normal; + font-weight: 700; + src: url(fonts/1Ptsg8LJRfWJmhDAuUs4QoFqPfE.woff2) format('woff2'); + unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB; +} +/* latin-ext */ +@font-face { + font-family: 'Comfortaa'; + font-style: normal; + font-weight: 700; + src: url(fonts/1Ptsg8LJRfWJmhDAuUs4Q4FqPfE.woff2) format('woff2'); + unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; +} +/* latin */ +@font-face { + font-family: 'Comfortaa'; + font-style: normal; + font-weight: 700; + src: url(fonts/1Ptsg8LJRfWJmhDAuUs4TYFq.woff2) format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; +} \ No newline at end of file diff --git a/style/fonts/1Ptsg8LJRfWJmhDAuUs4Q4FqPfE.woff2 b/style/fonts/1Ptsg8LJRfWJmhDAuUs4Q4FqPfE.woff2 new file mode 100644 index 0000000..e6d0887 Binary files /dev/null and b/style/fonts/1Ptsg8LJRfWJmhDAuUs4Q4FqPfE.woff2 differ diff --git a/style/fonts/1Ptsg8LJRfWJmhDAuUs4QIFqPfE.woff2 b/style/fonts/1Ptsg8LJRfWJmhDAuUs4QIFqPfE.woff2 new file mode 100644 index 0000000..2659406 Binary files /dev/null and b/style/fonts/1Ptsg8LJRfWJmhDAuUs4QIFqPfE.woff2 differ diff --git a/style/fonts/1Ptsg8LJRfWJmhDAuUs4QoFqPfE.woff2 b/style/fonts/1Ptsg8LJRfWJmhDAuUs4QoFqPfE.woff2 new file mode 100644 index 0000000..760c9d5 Binary files /dev/null and b/style/fonts/1Ptsg8LJRfWJmhDAuUs4QoFqPfE.woff2 differ diff --git a/style/fonts/1Ptsg8LJRfWJmhDAuUs4SYFqPfE.woff2 b/style/fonts/1Ptsg8LJRfWJmhDAuUs4SYFqPfE.woff2 new file mode 100644 index 0000000..e96c54c Binary files /dev/null and b/style/fonts/1Ptsg8LJRfWJmhDAuUs4SYFqPfE.woff2 differ diff --git a/style/fonts/1Ptsg8LJRfWJmhDAuUs4TYFq.woff2 b/style/fonts/1Ptsg8LJRfWJmhDAuUs4TYFq.woff2 new file mode 100644 index 0000000..0935ba3 Binary files /dev/null and b/style/fonts/1Ptsg8LJRfWJmhDAuUs4TYFq.woff2 differ diff --git a/style/fonts/1Ptsg8LJRfWJmhDAuUs4ToFqPfE.woff2 b/style/fonts/1Ptsg8LJRfWJmhDAuUs4ToFqPfE.woff2 new file mode 100644 index 0000000..2e3138c Binary files /dev/null and b/style/fonts/1Ptsg8LJRfWJmhDAuUs4ToFqPfE.woff2 differ diff --git a/style/style.css b/style/style.css index fbe6aa0..fd8b731 100644 --- a/style/style.css +++ b/style/style.css @@ -1,9 +1,18 @@ +@import url(fonts.css); + * { scroll-behavior: smooth; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } + +/* variables + +$baseColor : #e74c3c; +$fontColor : #fff; +*/ + .chart-text { /*font: 16px/1.4em "Montserrat", Arial, sans-serif;*/ font: 16px/1.4em "Montserrat", Arial, sans-serif; @@ -33,12 +42,15 @@ -webkit-transform: translateY(0.7em); transform: translateY(0.7em); } + .super_small{ font: 10px/1.1em "Montserrat", Arial, sans-serif; } .bgbody{ background-color: black; + /*background: $baseColor;*/ text-color: silver; + /*font-family: 'Comfortaa', cursive;*/ } .sideMenuBarTable{ background-color: silver; @@ -419,6 +431,25 @@ object:hover { background-image: url(png/symbols/006.png) !important; } +.ctrl_panel_drawscan_sm{ + width: 100% !important; + text-align:left !important; + background-image: url(wicons/021.png) !important; + background-size: 16px 16px !important; +} +.ctrl_panel_clean_sm{ + width: 100% !important; + text-align:left !important; + background-image: url(wicons/046.png) !important; + background-size: 16px 16px !important; +} +.ctrl_panel_study_sm{ + width: 100% !important; + text-align:left !important; + background-image: url(wicons/023.png) !important; + background-size: 16px 16px !important; +} + .ctrl_panel_drawscan{ width: 1220px !important; text-align:left !important; @@ -676,6 +707,10 @@ A.CalendarDS:hover { color: yellow; background-color: green; } +.setEd_infoPanel#TRAIN{ + color: yellow; + background-color: black; +} .setEd_infoPanel#GRABBER{ color: black; background-color: violet; @@ -713,6 +748,19 @@ A.CalendarDS:hover { background-size: 150px 150px; } +.setEd_infoPanel#NANA{ + color: yellow; + height: 100%; + background-color: #3f4757; + background-image: url('assets/og.png'); + background-repeat: no-repeat; + background-position: center 30px; + padding-top: 200px; + text-align: center; + /*height: 200px;*/ + background-size: 150px 150px; +} + .setEd_infoPanel#SENSOR_N{ color: black; background-color: silver; @@ -858,6 +906,17 @@ A.CalendarDS:hover { background-position: 0px 0px; background-size: 256px 256px; } +.cam_vehicle_set{ + display: block; + border-radius: 128px; + width: 256px; + height: 256px; + background-color: #4169e1; + background-image: url('assets/cam_vehicle_512.png'); + background-repeat: no-repeat; + background-position: 0px 0px; + background-size: 256px 256px; +} .camera_generic_set{ display: block; border-radius: 128px; @@ -981,6 +1040,11 @@ A.CalendarDS:hover { width: 100% !important; text-align: left !important; } +.srv_op_sync{ + background-image: url(wicons/036.png) !important; + width: 100% !important; + text-align: left !important; +} .srv_op_hw_init{ background-image: url(wicons/002.png) !important; width: 100% !important; @@ -996,6 +1060,31 @@ A.CalendarDS:hover { width: 100% !important; text-align: left !important; } +.srv_op_upload{ + background-image: url(wicons/037.png) !important; + width: 100% !important; + text-align: left !important; +} +.srv_op_download{ + background-image: url(wicons/019.png) !important; + width: 100% !important; + text-align: left !important; +} +.srv_op_lock{ + background-image: url(wicons/029.png) !important; + width: 100% !important; + text-align: left !important; +} +.srv_op_unlock{ + background-image: url(wicons/028.png) !important; + width: 100% !important; + text-align: left !important; +} +.reports_dates_btn{ + background-image: url(wicons/020.png) !important; + width: 100% !important; + /*text-align: left !important;*/ +} .servopInfo_item00{ color: #fcfcfc !important; @@ -1181,3 +1270,12 @@ A.CalendarDS:hover { background-repeat: no-repeat; background-position: 6px 6px; } +.UPTTEXT{ + font-weight: bold; + font-size: 20px!important; + text-align: center; +} +.UPCTEXT{ + font-weight: bold; + text-align: left; +} diff --git a/style/wicons/018.png b/style/wicons/018.png index 768a7fa..ae134a0 100644 Binary files a/style/wicons/018.png and b/style/wicons/018.png differ diff --git a/style/wicons/019.png b/style/wicons/019.png index 773a81c..b3be326 100644 Binary files a/style/wicons/019.png and b/style/wicons/019.png differ diff --git a/style/wicons/020.png b/style/wicons/020.png index 3238302..12f2229 100644 Binary files a/style/wicons/020.png and b/style/wicons/020.png differ diff --git a/style/wicons/021.png b/style/wicons/021.png index fe57652..ddcddff 100644 Binary files a/style/wicons/021.png and b/style/wicons/021.png differ diff --git a/style/wicons/023.png b/style/wicons/023.png index ac7097d..2fc4af2 100644 Binary files a/style/wicons/023.png and b/style/wicons/023.png differ diff --git a/style/wicons/035.png b/style/wicons/035.png new file mode 100644 index 0000000..e76251a Binary files /dev/null and b/style/wicons/035.png differ diff --git a/style/wicons/036.png b/style/wicons/036.png new file mode 100644 index 0000000..1b5611c Binary files /dev/null and b/style/wicons/036.png differ diff --git a/style/wicons/037.png b/style/wicons/037.png new file mode 100644 index 0000000..310e100 Binary files /dev/null and b/style/wicons/037.png differ diff --git a/style/wicons/046.png b/style/wicons/046.png index 887dc61..8938119 100644 Binary files a/style/wicons/046.png and b/style/wicons/046.png differ diff --git a/style/wicons/049.png b/style/wicons/049.png new file mode 100644 index 0000000..887dc61 Binary files /dev/null and b/style/wicons/049.png differ diff --git a/style/wicons/rotate-axis-x-512.png b/style/wicons/rotate-axis-x-512.png new file mode 100644 index 0000000..f80ced0 Binary files /dev/null and b/style/wicons/rotate-axis-x-512.png differ diff --git a/style/wicons/rotate-axis-x-512.psd b/style/wicons/rotate-axis-x-512.psd new file mode 100644 index 0000000..ee559b2 Binary files /dev/null and b/style/wicons/rotate-axis-x-512.psd differ diff --git a/style/wicons/rotate-axis-y-512.png b/style/wicons/rotate-axis-y-512.png new file mode 100644 index 0000000..e5f4775 Binary files /dev/null and b/style/wicons/rotate-axis-y-512.png differ diff --git a/style/wicons/rotate-axis-z-512.png b/style/wicons/rotate-axis-z-512.png new file mode 100644 index 0000000..abcec3c Binary files /dev/null and b/style/wicons/rotate-axis-z-512.png differ diff --git a/style/wicons/rotate-position-x-512.png b/style/wicons/rotate-position-x-512.png new file mode 100644 index 0000000..a201953 Binary files /dev/null and b/style/wicons/rotate-position-x-512.png differ diff --git a/style/wicons/rotate-position-y-512.png b/style/wicons/rotate-position-y-512.png new file mode 100644 index 0000000..03536d5 Binary files /dev/null and b/style/wicons/rotate-position-y-512.png differ diff --git a/style/wicons/rotate-position-z-512.png b/style/wicons/rotate-position-z-512.png new file mode 100644 index 0000000..4d4f05c Binary files /dev/null and b/style/wicons/rotate-position-z-512.png differ