diff --git a/index.php b/index.php index 3f80b6e..079bfda 100644 --- a/index.php +++ b/index.php @@ -8,25 +8,25 @@ UI_PageBottomExt(); } else { UI_PageHeader(); - if( $RTL_SITE ){ - UI_Begin2Section(); - } else { - UI_Begin2Section('120px'); - UI_SideMenu(); - UI_SectionDelimiter(); - }; + //if( $RTL_SITE ){ + // UI_Begin2Section(); + //} else { + // UI_Begin2Section('120px'); + // UI_SideMenu(); + // UI_SectionDelimiter(); + //}; //Main Content - if( $CUser->Data[id] > 1 ){ - UI_MainDashBoard(); - } else { + //if( $CUser->Data[id] > 1 ){ + // UI_MainDashBoard(); + //} else { UI_LoginForm(); - }; + //}; - if( $RTL_SITE ){ - UI_SectionDelimiter('120px'); - UI_SideMenu(); - } - UI_End2Section(); + //if( $RTL_SITE ){ + // UI_SectionDelimiter('120px'); + // UI_SideMenu(); + //} + // UI_End2Section(); UI_PageBottom(); }; diff --git a/lib/controller/addConnection.php b/lib/controller/addConnection.php index 354041d..235d72d 100644 --- a/lib/controller/addConnection.php +++ b/lib/controller/addConnection.php @@ -33,14 +33,28 @@ // $QS="UPDATE media_streams SET binded=1, destination_id={$a1} WHERE id={$a2}"; //$DATABASE->Query( $QS, false ); $QS="INSERT INTO `media_server_streams` SET `site_id`={$SiteID}, `media_server_id`={$a1}, `media_stream_id`={$a2}"; - $DATABASE->Query( $QS, false ); } else { // 2 is Media Server //$QS="UPDATE media_streams SET binded=1, destination_id={$a2} WHERE id={$a1}"; //$DATABASE->Query( $QS, false ); $QS="INSERT INTO `media_server_streams` SET `site_id`={$SiteID}, `media_server_id`={$a2}, `media_stream_id`={$a1}"; - $DATABASE->Query( $QS, false ); }; + $DATABASE->Query( $QS, false ); + }; + $QS="SELECT * FROM `nodes` WHERE `id`={$node1['node_id']}"; + $RR=$DATABASE->Query( $QS, false ); + $Z1=$RR[0]; + $QS="SELECT * FROM `nodes` WHERE `id`={$node2['node_id']}"; + $RR=$DATABASE->Query( $QS, false ); + $Z2=$RR[0]; + if( ( $Z1['type']==20 && $Z2['type']< 5 ) || ( $Z1['type'] < 5 && $Z2['type'] == 20 ) ){ + // Bind LRF Sensor to Ethernet UART + if( $Z1['type'] == 20 ){ + $QS = "UPDATE `lrf_sensors` SET `uart_id`={$a1} WHERE `id`={$a2}"; + } else { + $QS = "UPDATE `lrf_sensors` SET `uart_id`={$a2} WHERE `id`={$a1}"; + }; + $DATABASE->Query( $QS, false ); }; if( $d1==0 ){ $QS="UPDATE `sockets` SET `binded`=1 WHERE id={$SSID}"; diff --git a/lib/controller/addNetworkNode.php b/lib/controller/addNetworkNode.php index 1d90758..9bbe9b1 100644 --- a/lib/controller/addNetworkNode.php +++ b/lib/controller/addNetworkNode.php @@ -3,31 +3,64 @@ if( $CUser->Data['id'] > 1 ){ $SiteID = intval($_POST['NID']); $NodeType = intval($_POST['TYPE']); + $Data['success'] = false; if( $NodeType ){ - $QS = "INSERT INTO nodes SET type={$NodeType}, site_id={$SiteID}"; - $DATABASE->Query( $QS, false ); - $DevID = $DATABASE->getLastInsertID(); - if( $DevID ){ switch( $NodeType ){ case 1://Als case 2://Lfs case 3://Pls case 4://pls + $QS = "INSERT INTO `lrf_sensors` SET `type_id`={$NodeType}, `site_id`={$SiteID}"; + $DATABASE->Query( $QS, false ); + $DevID = $DATABASE->getLastInsertID(); + $QS = "INSERT INTO `nodes` SET `type`={$NodeType}, `site_id`={$SiteID}, `aux_id`={$DevID}"; + $DATABASE->Query( $QS, false ); + $NODEID = $DATABASE->getLastInsertID(); $MM = md5(microtime()); - $QS = "INSERT INTO sockets SET node_id={$DevID}, `mode`=" . COM_MODE_IN . ", `type`=" . COM_TYPE_UART . ", binded=0, md5='{$MM}', `name`='Device Control Line'"; + $QS = "INSERT INTO sockets SET node_id={$NODEID}, `aux_id`={$DevID}, `mode`=" . COM_MODE_IN . ", `type`=" . COM_TYPE_UART . ", binded=0, md5='{$MM}', `name`='Device Control Line'"; $DATABASE->Query( $QS, false ); $MM = md5(microtime()); - $QS = "INSERT INTO sockets SET node_id={$DevID}, `mode`=" . COM_MODE_OUT . ", `type`=" . COM_TYPE_UART . ", binded=0, md5='{$MM}', `name`='Camera Control Line'"; + $QS = "INSERT INTO sockets SET node_id={$NODEID}, `aux_id`={$DevID}, `mode`=" . COM_MODE_OUT . ", `type`=" . COM_TYPE_UART . ", binded=0, md5='{$MM}', `name`='Camera Control Line'"; $DATABASE->Query( $QS, false ); + $Data['success'] = true; break; case 5://3D + $QS = "INSERT INTO `lrf_sensors` SET `type_id`={$NodeType}, `site_id`={$SiteID}"; + $DATABASE->Query( $QS, false ); + $DevID = $DATABASE->getLastInsertID(); + $QS = "INSERT INTO `nodes` SET `type`={$NodeType}, `site_id`={$SiteID}, `aux_id`={$DevID}"; + $DATABASE->Query( $QS, false ); + $NODEID = $DATABASE->getLastInsertID(); + $MM = md5(microtime()); + $QS = "INSERT INTO sockets SET node_id={$NODEID}, `aux_id`={$DevID}, `mode`=" . COM_MODE_INOUT . ", `type`=" . COM_TYPE_TCP . ", binded=0, md5='{$MM}', `name`='Network Connection'"; + $DATABASE->Query( $QS, false ); + $Data['success'] = true; + break; + case 20://IpUart + $SPD = intval( $_POST['UART_SPEED'] ); + $BITS = intval( $_POST['UART_BITS'] ); + $STOP = floatval( $_POST['UART_STOP'] ); + $PAR = strtoupper( substr($_POST['UART_PAR'],0,1) ); + $MODE = intval( $_POST['UART_MODE'] ); + $IP = $DATABASE->escape( $_POST['UART_IP'] ); + $PORT = intval( $_POST['UART_PORT'] ); + $QS = "INSERT INTO uart_settings SET `type`=2, `socket_id`=0, `mode`={$MODE}, `bit`={$BITS}, `parity`='{$PAR}', `stop_bit`={$STOP}, `port`={$PORT}, `path`='{$IP}'"; + $DATABASE->Query( $QS, false ); + $DevID = $DATABASE->getLastInsertID(); + $QS = "INSERT INTO nodes SET `type`={$NodeType}, `aux_id`={$DevID}, `site_id`={$SiteID}"; + $DATABASE->Query( $QS, false ); + $NODEID = $DATABASE->getLastInsertID(); + $MM = md5(microtime()); + $QS = "INSERT INTO sockets SET node_id={$NODEID}, `aux_id`={$DevID}, `mode`=" . COM_MODE_INOUT . ", `type`=" . COM_TYPE_TCP . ", binded=0, md5='{$MM}', `name`='Network Connection'"; + $DATABASE->Query( $QS, false ); $MM = md5(microtime()); - $QS = "INSERT INTO sockets SET node_id={$DevID}, `mode`=" . COM_MODE_INOUT . ", `type`=" . COM_TYPE_TCP . ", binded=0, md5='{$MM}', `name`='Network Connection'"; + $QS = "INSERT INTO sockets SET node_id={$NODEID}, `aux_id`={$DevID}, `mode`=" . COM_MODE_INOUT . ", `type`=" . COM_TYPE_UART . ", binded=0, md5='{$MM}', `name`='UART Connection'"; $DATABASE->Query( $QS, false ); + $Data['success'] = true; break; }; - }; }; + echo json_encode( $Data ); } else { header('location: /'); }; diff --git a/lib/controller/clearEventCloud.php b/lib/controller/clearEventCloud.php new file mode 100644 index 0000000..dd9533e --- /dev/null +++ b/lib/controller/clearEventCloud.php @@ -0,0 +1,11 @@ +Data['id'] > 1 ){ + $QS = "INSERT INTO `events_archive` (`node_id`,`uuid`,`ts`,`ts_ms`,`evt_type`,`range_digital`,`azimuth`,`elevation`,`range`,`area`,`lat`,`lon`,`alt`,`custom`) SELECT `node_id`,`uuid`,`ts`,`ts_ms`,`evt_type`,`range_digital`,`azimuth`,`elevation`,`range`,`area`,`lat`,`lon`,`alt`,`custom` FROM `events_cloud`"; + $DATABASE->Query( $QS, false ); + $QS = "DELETE FROM events_cloud"; + $DATABASE->Query( $QS, false ); + } else { + header('location: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/getDashBoardItems.php b/lib/controller/getDashBoardItems.php index 493644b..473f0ba 100644 --- a/lib/controller/getDashBoardItems.php +++ b/lib/controller/getDashBoardItems.php @@ -82,7 +82,7 @@ }; $index++; }; - if( $i == 0 ) $TPL[] = '{ id: \'db_node_22311232\', frame: false, colspan: 2, width: 516, height: 200, border: true, title: \'PIZDA\', items:[{ html: \'
Server
\'}]}'; + //if( $i == 0 ) $TPL[] = '{ id: \'db_node_22311232\', frame: false, colspan: 2, width: 516, height: 200, border: true, title: \'PIZDA\', items:[{ html: \'Server
\'}]}'; $STOL[$i] = $P1 . implode( ',', $TPL ) . $P2; }; $Data = '[' . implode( ',' , $STOL ) . ']'; diff --git a/lib/controller/getEventProps.php b/lib/controller/getEventProps.php new file mode 100644 index 0000000..f94e109 --- /dev/null +++ b/lib/controller/getEventProps.php @@ -0,0 +1,31 @@ +Data['id'] > 1 ){ + $EID = intval( $_POST['EVENT'] ); + $QS = "SELECT * FROM events_cloud WHERE id = {$EID}"; + $Result = $DATABASE->Query( $QS, false ); + if( count( $Result ) ){ + $Props = $Result[0]; + $QS="SELECT * FROM nodes WHERE id={$Props['node_id']}"; + $RR = $DATABASE->Query( $QS ); + $CC = $RR[0]; + $Type = intval( $Props['type'] ); + $TName = 'props/event_prop.js'; + $Data = file_get_contents( $TName ); + $Data = str_replace('%%%NODEID%%%', $Props['node_id'], $Data ); + $Data = str_replace('%%%TYPE%%%', $CC['type'], $Data ); + $Data = str_replace('%%%NAME%%%', $CC['name'], $Data ); + $Data = str_replace('%%%AZIMUTH%%%', sprintf( "%0.2f", $Props['azimuth']), $Data ); + $Data = str_replace('%%%ELEVETION%%%', sprintf( "%0.2f", $Props['elevation']), $Data ); + $Data = str_replace('%%%RANGE%%%', sprintf( "%0.2f", $Props['range']), $Data ); + $Data = str_replace('%%%LON%%%', sprintf( "%0.8f", $Props['lon']), $Data ); + $Data = str_replace('%%%LAT%%%', sprintf( "%0.8f", $Props['lat']), $Data ); + $Data = str_replace('%%%ALT%%%', sprintf( "%0.1f", $Props['alt']), $Data ); + echo $Data; + } else { + echo '{ html: \'Node '.$_POST['NODE'].' Loadded\'}'; + }; + } else { + header('location: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/getEventRecords.php b/lib/controller/getEventRecords.php new file mode 100644 index 0000000..e2a4447 --- /dev/null +++ b/lib/controller/getEventRecords.php @@ -0,0 +1,94 @@ +Query( $QS ); + if( count( $RV ) ){ + return $RV[0]['name']; + }; + return '-NoName-'; + } else { + return 'Argus Server'; + }; + }; + if( $CUser->Data['id'] > 1 ){ + $Data = array(); + $GID = intval($_POST['NID']); + $QS = "SELECT * FROM events_cloud ORDER BY id DESC LIMIT 20"; + $Result = $DATABASE->Query( $QS, false ); + date_default_timezone_set('UTC'); + //foreach( array_reverse ( $Result ) as $CD ){ + foreach( $Result as $CD ){ + $cnode['has_target'] = false; + $cnode['has_geo'] = false; + switch( intval( $CD['evt_type'] ) ){ + case 0:// NoInit + case 1:// Ready + case 2:// Alarm + case 3:// Command + case 4:// Key + case 5:// Joystick + continue; break; + case 6:// STUDY + $cnode['event']='Device Enters Into Study Mode'; + break; + case 7:// BUSY + $cnode['event']='Device Is BUSY'; + break; + case 8:// FLIP + $cnode['event']='Flip Complete'; + break; + case 9:// SCAN + $cnode['event']='Scan Complete'; + break; + case 10:// Target 1D + case 11:// Target 3DW + case 12:// Target 3DB + case 13:// Target 2DW + case 14:// Target 2DB + $cnode['event']='Target'; + $cnode['data'] = sprintf("AZ: %0.2f El: %0.2f R: %0.2f", floatval($CD['azimuth']), floatval($CD['elevation']), floatval($CD['range'])); + $cnode['has_target'] = true; + $cnode['has_geo'] = true; + break; + case 15:// Capture Start + case 16:// Capture End + case 17:// Capture Done + case 18:// Mission Begin + case 19:// Cancel Action + case 20:// Fly To + case 21:// WayPoint + case 22:// Dest Reached + case 23:// Jaming Begin + case 24:// Jamer On + case 25:// Jamer Off + case 26:// Target Locked + case 27:// Intercept Begin + case 28:// Intercept OK + case 29:// Intercept NOK + case 20:// Mission End + case 31:// Landed + case 32:// FH Busy + case 33:// Camera DM + case 34:// Error + default: + continue; + break; + }; + $cnode['id'] = intval( $CD['id'] ); + $uts = intval($CD['ts']); + $cnode['date'] = date( "m.d.y", $uts ); + $cnode['time'] = date( "H:m:s", $uts ); + $cnode['device'] = getNodeName( $CD['node_id'] ); + $Data[] = $cnode; + }; + $RA['log']=$Data; + $RA['totalCount'] = count( $Data ); + echo json_encode( $RA ); + } else { + header('location: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/getLocationNodeProps.php b/lib/controller/getLocationNodeProps.php index 4f2602f..a51d0df 100644 --- a/lib/controller/getLocationNodeProps.php +++ b/lib/controller/getLocationNodeProps.php @@ -12,19 +12,40 @@ $Data = str_replace('%%%NODEID%%%', ''.$Node, $Data ); $Data = str_replace('%%%TYPE%%%', $Type, $Data ); switch( $Type ){ + case 1: + case 2: + case 3: + case 4: case ARGUS_3D_SENSOR:{ + $QS = "SELECT * FROM lrf_sensors WHERE id={$Props['aux_id']}"; + $RR = $DATABASE->Query( $QS ); + $C = $RR[0]; + $Data = str_replace('%%%NODEID%%%', ''.$Node, $Data ); - $Data = str_replace('%%%NODENAME%%%', $Props['name'] , $Data ); + $Data = str_replace('%%%NAME%%%', $Props['name'] , $Data ); + //Loc + $LAT = floatval( $C['lat'] ); + $LON = floatval( $C['lon'] ); + $ALT = floatval( $C['alt'] ); + $ROLL = floatval( $C['roll'] ); + $PITCH = floatval( $C['pitch'] ); + $YAW = floatval( $C['yaw'] ); + $Data = str_replace( '%%%LAT%%%', $LAT, $Data ); + $Data = str_replace( '%%%LON%%%', $LON, $Data ); + $Data = str_replace( '%%%ALT%%%', $ALT, $Data ); + $Data = str_replace( '%%%ROLL%%%', $ROLL, $Data ); + $Data = str_replace( '%%%PITCH%%%', $PITCH, $Data ); + $Data = str_replace( '%%%YAW%%%', $YAW, $Data ); //Info $InfoData = ''; $InfoParts = array(); $InfoParts[] = '{ xtype: \'panel\', html: \'
%%%DEV_LABEL%%%
Range: %%%MAX_RANGE%%%
' + },{ + xtype: 'panel', + html: 'Dev Address: %%%DEVICE_ID%%%
' + }] + },{ + xtype: 'button', + text: 'Change Settings', + width: '100%', + handler: function(){ + var wAddSocket = new Ext.Window({ + title: 'Sensor Settings', + width: 450, + //height: 480, + items:[{ + xtype: 'form', + labelWidth: 120, // label settings here cascade unless overridden + frame: false, + bodyStyle:'padding:5px 5px 0', + defaultType: 'textfield', + items:[{ + fieldLabel: 'Device Name', + id: 'ued_name' + },{ + fieldLabel: 'Device Address', + id: 'ued_address' + },{ + fieldLabel: 'Maximal Range', + id: 'ued_range' + }] + }], + buttons:[{ + text: 'Cancel', + handler: function(){ + wAddSocket.close(); + wAddSocket = null; + } + },{ + text: 'Apply Settings', + handler: function(){ + var val_name = Ext.getCmp('ued_name').getValue(); + var val_addr = Ext.getCmp('ued_address').getValue(); + var val_range = Ext.getCmp('ued_range').getValue(); + Ext.Ajax.request({ + url: '/lib/controller/updateLrfSettings.php', + params: { + SENSOR: %%%LRF_ID%%%, + SADDR: val_addr, + SNAME: val_name, + SRANGE: val_range + }, + success: function( response, opts ){ + wAddSocket.close(); + wAddSocket = null; + loadNodeProperties( %%%NODEID%%% ); + }, + failure: function( response, opts ) { + + } + }); + } + }] + }); + wAddSocket.show(); + Ext.getCmp('ued_name').setValue( Ext.getCmp('dev_name').getValue()); + Ext.getCmp('ued_address').setValue( Ext.getCmp('dev_id').getValue()); + Ext.getCmp('ued_range').setValue( Ext.getCmp('max_range').getValue()); + } + },{ + xtype:'fieldset', + title: 'Master LRF', + collapsible: true, + autoHeight: true, + defaults: { + //width: 168 + }, + items :[{ + xtype: 'panel', + html: 'Order: %%%M_ORDER%%%
' + },{ + xtype: 'panel', + html: 'Offset: %%%M_OFFSET%%%
' + },{ + xtype: 'panel', + html: 'Width: %%%M_WIDTH%%%
' + },{ + xtype: 'panel', + html: 'SST: %%%M_SST%%%
' + }] + },{ + xtype:'fieldset', + title: 'Slave LRF', + collapsible: true, + autoHeight: true, + defaults: { + //width: 168 + }, + items :[{ + xtype: 'panel', + html: 'Order: %%%S_ORDER%%%
' + },{ + xtype: 'panel', + html: 'Offset: %%%S_OFFSET%%%
' + },{ + xtype: 'panel', + html: 'Width: %%%S_WIDTH%%%
' + },{ + xtype: 'panel', + html: 'SST: %%%S_SST%%%
' + }] + }] +} \ No newline at end of file diff --git a/lib/controller/props/20_node_prop.js b/lib/controller/props/20_node_prop.js new file mode 100644 index 0000000..19c382e --- /dev/null +++ b/lib/controller/props/20_node_prop.js @@ -0,0 +1,224 @@ +{ + xtype: 'form', + labelWidth: 40, // label settings here cascade unless overridden + frame: false, + bodyStyle:'padding:5px 5px 0', + defaultType: 'textfield', + items: [{ + xtype: 'panel', + height: 100, + html: '
Ethernet2Serial
%%%CON_TYPE%%%
' + },{ + xtype: 'panel', + html: '%%%ADR_IP%%%
' + },{ + xtype: 'panel', + html: '%%%ADDR_PORT%%%
' + }] + },{ + xtype:'fieldset', + title: 'UART', + collapsible: true, + autoHeight:true, + defaults: { + //width: 168 + }, + items :[{ + xtype: 'hidden', + id: 'uart_speed', + name: 'uart_speed', + value: %%%UART_SPEED%%% + },{ + xtype: 'hidden', + id: 'uart_bit', + name: 'uart_bit', + value: %%%UART_BIT%%% + },{ + xtype: 'hidden', + id: 'uart_parity', + name: 'uart_parity', + value: '%%%UART_PARITY%%%' + },{ + xtype: 'hidden', + id: 'uart_stops', + name: 'uart_stops', + value: %%%UART_STOP%%% + },{ + xtype: 'panel', + html: '%%%UART_SPEED%%%
' + },{ + xtype: 'panel', + html: '%%%UART_BIT%%%
' + },{ + xtype: 'panel', + html: '%%%UART_PARITY%%%
' + },{ + xtype: 'panel', + html: '%%%UART_STOP%%%
' + }] + },{ + xtype: 'button', + text: 'Change Settings', + width: '100%', + handler: function(){ + var wAddSocket = new Ext.Window({ + title: 'UART Settings', + width: 450, + //height: 480, + items:[{ + xtype: 'form', + labelWidth: 120, // label settings here cascade unless overridden + frame: false, + bodyStyle:'padding:5px 5px 0', + defaultType: 'textfield', + items:[{ + xtype: 'combo', + fieldLabel: 'Speed', + id: 'ued_speed', + lazyRender:true, + mode: 'local', + store: new Ext.data.ArrayStore({ + fields: ['speed'], + data: [[19200], [115200]] + }), + valueField: 'speed', + displayField: 'speed' + },{ + xtype: 'combo', + fieldLabel: 'Bits', + id: 'ued_bit', + lazyRender:true, + mode: 'local', + store: new Ext.data.ArrayStore({ + fields: ['bits'], + data: [[5],[6],[7],[8],[9]] + }), + valueField: 'bits', + displayField: 'bits' + },{ + xtype: 'combo', + fieldLabel: 'Stop Bit', + lazyRender:true, + id: 'ued_stops', + mode: 'local', + store: new Ext.data.ArrayStore({ + fields: ['stops'], + data: [[1],[1.5],[2]] + }), + valueField: 'stops', + displayField: 'stops' + },{ + xtype: 'combo', + fieldLabel: 'Parity', + lazyRender:true, + id: 'ued_parity', + mode: 'local', + store: new Ext.data.ArrayStore({ + fields: ['parity'], + data: [['Odd'], ['Even'],['None']] + }), + valueField: 'parity', + displayField: 'parity' + },{ + xtype: 'combo', + fieldLabel: 'Working Mode', + lazyRender: true, + id: 'ued_mode', + mode: 'local', + store: new Ext.data.ArrayStore({ + fields: ['mode','mode_txt'], + data: [[0,'UDP Client'], [1,'TCP Client'], [2,'UDP Server'], [3,'TCP Server']] + }), + valueField: 'mode', + displayField: 'mode_txt' + },{ + fieldLabel: 'IP Address', + id: 'ued_ip' + },{ + fieldLabel: 'IP Port', + id: 'ued_port' + }] + }], + buttons:[{ + text: 'Cancel', + handler: function(){ + wAddSocket.close(); + wAddSocket = null; + } + },{ + text: 'Apply Settings', + handler: function(){ + var val_uart_speed = Ext.getCmp('ued_speed').getValue(); + var val_uart_bit = Ext.getCmp('ued_bit').getValue(); + var val_uart_stops = Ext.getCmp('ued_stops').getValue(); + var val_uart_parity = Ext.getCmp('ued_parity').getValue(); + var val_uart_ip = Ext.getCmp('ued_ip').getValue(); + var val_uart_port = Ext.getCmp('ued_port').getValue(); + var val_uart_mode = Ext.getCmp('ued_mode').getValue(); + Ext.Ajax.request({ + url: '/lib/controller/updateUartSettings.php', + params: { + UART: %%%UART_ID%%%, + USPD: val_uart_speed, + UBIT: val_uart_bit, + USTP: val_uart_stops, + UPAR: val_uart_parity, + UADR: val_uart_ip, + UPOR: val_uart_port, + UMOD: val_uart_mode + }, + success: function( response, opts ){ + wAddSocket.close(); + wAddSocket = null; + loadNodeProperties( %%%NODE_ID%%% ); + }, + failure: function( response, opts ) { + + } + }); + } + }] + }); + wAddSocket.show(); + Ext.getCmp('ued_speed').setValue( Ext.getCmp('uart_speed').getValue()); + Ext.getCmp('ued_bit').setValue( Ext.getCmp('uart_bit').getValue()); + Ext.getCmp('ued_stops').setValue( Ext.getCmp('uart_stops').getValue()); + switch( Ext.getCmp('uart_parity').getValue() ){ + case 'E': Ext.getCmp('ued_parity').setValue( 'Even' ); break; + case 'O': Ext.getCmp('ued_parity').setValue( 'Odd' ); break; + case 'N': Ext.getCmp('ued_parity').setValue( 'None' ); break; + }; + Ext.getCmp('ued_ip').setValue( Ext.getCmp('uart_ip').getValue()); + Ext.getCmp('ued_port').setValue( Ext.getCmp('uart_port').getValue()); + Ext.getCmp('ued_mode').setValue( Ext.getCmp('uart_mode').getValue()); + } + }] +} \ No newline at end of file diff --git a/lib/controller/props/2_node_prop.js b/lib/controller/props/2_node_prop.js new file mode 100644 index 0000000..238ccad --- /dev/null +++ b/lib/controller/props/2_node_prop.js @@ -0,0 +1,149 @@ +{ + xtype: 'form', + labelWidth: 40, // label settings here cascade unless overridden + frame: false, + bodyStyle:'padding:5px 5px 0', + defaultType: 'textfield', + items: [{ + xtype: 'panel', + height: 100, + html: '
%%%DEV_LABEL%%%
Range: %%%MAX_RANGE%%%
' + },{ + xtype: 'panel', + html: 'Dev Address: %%%DEVICE_ID%%%
' + }] + },{ + xtype: 'button', + text: 'Change Settings', + width: '100%', + handler: function(){ + var wAddSocket = new Ext.Window({ + title: 'Sensor Settings', + width: 450, + //height: 480, + items:[{ + xtype: 'form', + labelWidth: 120, // label settings here cascade unless overridden + frame: false, + bodyStyle:'padding:5px 5px 0', + defaultType: 'textfield', + items:[{ + fieldLabel: 'Device Name', + id: 'ued_name' + },{ + fieldLabel: 'Device Address', + id: 'ued_address' + },{ + fieldLabel: 'Maximal Range', + id: 'ued_range' + }] + }], + buttons:[{ + text: 'Cancel', + handler: function(){ + wAddSocket.close(); + wAddSocket = null; + } + },{ + text: 'Apply Settings', + handler: function(){ + var val_name = Ext.getCmp('ued_name').getValue(); + var val_addr = Ext.getCmp('ued_address').getValue(); + var val_range = Ext.getCmp('ued_range').getValue(); + Ext.Ajax.request({ + url: '/lib/controller/updateLrfSettings.php', + params: { + SENSOR: %%%LRF_ID%%%, + SADDR: val_addr, + SNAME: val_name, + SRANGE: val_range + }, + success: function( response, opts ){ + wAddSocket.close(); + wAddSocket = null; + loadNodeProperties( %%%NODEID%%% ); + }, + failure: function( response, opts ) { + + } + }); + } + }] + }); + wAddSocket.show(); + Ext.getCmp('ued_name').setValue( Ext.getCmp('dev_name').getValue()); + Ext.getCmp('ued_address').setValue( Ext.getCmp('dev_id').getValue()); + Ext.getCmp('ued_range').setValue( Ext.getCmp('max_range').getValue()); + } + },{ + xtype:'fieldset', + title: 'Master LRF', + collapsible: true, + autoHeight: true, + defaults: { + //width: 168 + }, + items :[{ + xtype: 'panel', + html: 'Order: %%%M_ORDER%%%
' + },{ + xtype: 'panel', + html: 'Offset: %%%M_OFFSET%%%
' + },{ + xtype: 'panel', + html: 'Width: %%%M_WIDTH%%%
' + },{ + xtype: 'panel', + html: 'SST: %%%M_SST%%%
' + }] + },{ + xtype:'fieldset', + title: 'Slave LRF', + collapsible: true, + autoHeight: true, + defaults: { + //width: 168 + }, + items :[{ + xtype: 'panel', + html: 'Order: %%%S_ORDER%%%
' + },{ + xtype: 'panel', + html: 'Offset: %%%S_OFFSET%%%
' + },{ + xtype: 'panel', + html: 'Width: %%%S_WIDTH%%%
' + },{ + xtype: 'panel', + html: 'SST: %%%S_SST%%%
' + }] + }] +} \ No newline at end of file diff --git a/lib/controller/props/3_node_prop.js b/lib/controller/props/3_node_prop.js new file mode 100644 index 0000000..416a53f --- /dev/null +++ b/lib/controller/props/3_node_prop.js @@ -0,0 +1,149 @@ +{ + xtype: 'form', + labelWidth: 40, // label settings here cascade unless overridden + frame: false, + bodyStyle:'padding:5px 5px 0', + defaultType: 'textfield', + items: [{ + xtype: 'panel', + height: 100, + html: '
%%%DEV_LABEL%%%
Range: %%%MAX_RANGE%%%
' + },{ + xtype: 'panel', + html: 'Dev Address: %%%DEVICE_ID%%%
' + }] + },{ + xtype: 'button', + text: 'Change Settings', + width: '100%', + handler: function(){ + var wAddSocket = new Ext.Window({ + title: 'Sensor Settings', + width: 450, + //height: 480, + items:[{ + xtype: 'form', + labelWidth: 120, // label settings here cascade unless overridden + frame: false, + bodyStyle:'padding:5px 5px 0', + defaultType: 'textfield', + items:[{ + fieldLabel: 'Device Name', + id: 'ued_name' + },{ + fieldLabel: 'Device Address', + id: 'ued_address' + },{ + fieldLabel: 'Maximal Range', + id: 'ued_range' + }] + }], + buttons:[{ + text: 'Cancel', + handler: function(){ + wAddSocket.close(); + wAddSocket = null; + } + },{ + text: 'Apply Settings', + handler: function(){ + var val_name = Ext.getCmp('ued_name').getValue(); + var val_addr = Ext.getCmp('ued_address').getValue(); + var val_range = Ext.getCmp('ued_range').getValue(); + Ext.Ajax.request({ + url: '/lib/controller/updateLrfSettings.php', + params: { + SENSOR: %%%LRF_ID%%%, + SADDR: val_addr, + SNAME: val_name, + SRANGE: val_range + }, + success: function( response, opts ){ + wAddSocket.close(); + wAddSocket = null; + loadNodeProperties( %%%NODEID%%% ); + }, + failure: function( response, opts ) { + + } + }); + } + }] + }); + wAddSocket.show(); + Ext.getCmp('ued_name').setValue( Ext.getCmp('dev_name').getValue()); + Ext.getCmp('ued_address').setValue( Ext.getCmp('dev_id').getValue()); + Ext.getCmp('ued_range').setValue( Ext.getCmp('max_range').getValue()); + } + },{ + xtype:'fieldset', + title: 'Master LRF', + collapsible: true, + autoHeight: true, + defaults: { + //width: 168 + }, + items :[{ + xtype: 'panel', + html: 'Order: %%%M_ORDER%%%
' + },{ + xtype: 'panel', + html: 'Offset: %%%M_OFFSET%%%
' + },{ + xtype: 'panel', + html: 'Width: %%%M_WIDTH%%%
' + },{ + xtype: 'panel', + html: 'SST: %%%M_SST%%%
' + }] + },{ + xtype:'fieldset', + title: 'Slave LRF', + collapsible: true, + autoHeight: true, + defaults: { + //width: 168 + }, + items :[{ + xtype: 'panel', + html: 'Order: %%%S_ORDER%%%
' + },{ + xtype: 'panel', + html: 'Offset: %%%S_OFFSET%%%
' + },{ + xtype: 'panel', + html: 'Width: %%%S_WIDTH%%%
' + },{ + xtype: 'panel', + html: 'SST: %%%S_SST%%%
' + }] + }] +} \ No newline at end of file diff --git a/lib/controller/props/4_node_prop.js b/lib/controller/props/4_node_prop.js new file mode 100644 index 0000000..55dcc5e --- /dev/null +++ b/lib/controller/props/4_node_prop.js @@ -0,0 +1,149 @@ +{ + xtype: 'form', + labelWidth: 40, // label settings here cascade unless overridden + frame: false, + bodyStyle:'padding:5px 5px 0', + defaultType: 'textfield', + items: [{ + xtype: 'panel', + height: 100, + html: '
%%%DEV_LABEL%%%
Range: %%%MAX_RANGE%%%
' + },{ + xtype: 'panel', + html: 'Dev Address: %%%DEVICE_ID%%%
' + }] + },{ + xtype: 'button', + text: 'Change Settings', + width: '100%', + handler: function(){ + var wAddSocket = new Ext.Window({ + title: 'Sensor Settings', + width: 450, + //height: 480, + items:[{ + xtype: 'form', + labelWidth: 120, // label settings here cascade unless overridden + frame: false, + bodyStyle:'padding:5px 5px 0', + defaultType: 'textfield', + items:[{ + fieldLabel: 'Device Name', + id: 'ued_name' + },{ + fieldLabel: 'Device Address', + id: 'ued_address' + },{ + fieldLabel: 'Maximal Range', + id: 'ued_range' + }] + }], + buttons:[{ + text: 'Cancel', + handler: function(){ + wAddSocket.close(); + wAddSocket = null; + } + },{ + text: 'Apply Settings', + handler: function(){ + var val_name = Ext.getCmp('ued_name').getValue(); + var val_addr = Ext.getCmp('ued_address').getValue(); + var val_range = Ext.getCmp('ued_range').getValue(); + Ext.Ajax.request({ + url: '/lib/controller/updateLrfSettings.php', + params: { + SENSOR: %%%LRF_ID%%%, + SADDR: val_addr, + SNAME: val_name, + SRANGE: val_range + }, + success: function( response, opts ){ + wAddSocket.close(); + wAddSocket = null; + loadNodeProperties( %%%NODEID%%% ); + }, + failure: function( response, opts ) { + + } + }); + } + }] + }); + wAddSocket.show(); + Ext.getCmp('ued_name').setValue( Ext.getCmp('dev_name').getValue()); + Ext.getCmp('ued_address').setValue( Ext.getCmp('dev_id').getValue()); + Ext.getCmp('ued_range').setValue( Ext.getCmp('max_range').getValue()); + } + },{ + xtype:'fieldset', + title: 'Master LRF', + collapsible: true, + autoHeight: true, + defaults: { + //width: 168 + }, + items :[{ + xtype: 'panel', + html: 'Order: %%%M_ORDER%%%
' + },{ + xtype: 'panel', + html: 'Offset: %%%M_OFFSET%%%
' + },{ + xtype: 'panel', + html: 'Width: %%%M_WIDTH%%%
' + },{ + xtype: 'panel', + html: 'SST: %%%M_SST%%%
' + }] + },{ + xtype:'fieldset', + title: 'Slave LRF', + collapsible: true, + autoHeight: true, + defaults: { + //width: 168 + }, + items :[{ + xtype: 'panel', + html: 'Order: %%%S_ORDER%%%
' + },{ + xtype: 'panel', + html: 'Offset: %%%S_OFFSET%%%
' + },{ + xtype: 'panel', + html: 'Width: %%%S_WIDTH%%%
' + },{ + xtype: 'panel', + html: 'SST: %%%S_SST%%%
' + }] + }] +} \ No newline at end of file diff --git a/lib/controller/props/5_node_prop.js b/lib/controller/props/5_node_prop.js index 6593f91..e4ab9f7 100644 --- a/lib/controller/props/5_node_prop.js +++ b/lib/controller/props/5_node_prop.js @@ -1,54 +1,149 @@ { xtype: 'form', - labelWidth: 75, // label settings here cascade unless overridden + labelWidth: 40, // label settings here cascade unless overridden frame: false, bodyStyle:'padding:5px 5px 0', - width: 190, - defaults: { - width: 190 - }, defaultType: 'textfield', - items: [ - { - xtype: 'panel', - height: 100, - html: '
%%%NODENAME%%%

%%%DEV_LABEL%%%
IPv4: %%%IP_ADDRESS%%%
' + },{ + xtype: 'panel', + html: 'Port: %%%IP_PORT%%%
' + }] + },{ + xtype: 'button', + text: 'Change Settings', + width: '100%', + handler: function(){ + var wAddSocket = new Ext.Window({ + title: 'Sensor Settings', + width: 450, + //height: 480, + items:[{ + xtype: 'form', + labelWidth: 120, // label settings here cascade unless overridden + frame: false, + bodyStyle:'padding:5px 5px 0', + defaultType: 'textfield', + items:[{ + fieldLabel: 'Label', + id: 'ued_name' + },{ + fieldLabel: 'IP Address', + id: 'ued_address' + },{ + fieldLabel: 'Port', + value: 2222, + readOnly: true, + id: 'ued_port' + }] + }], + buttons:[{ + text: 'Cancel', + handler: function(){ + wAddSocket.close(); + wAddSocket = null; + } + },{ + text: 'Apply Settings', + handler: function(){ + var val_addr = Ext.getCmp('ued_address').getValue(); + var val_name = Ext.getCmp('ued_name').getValue(); + Ext.Ajax.request({ + url: '/lib/controller/updateLrfSettings.php', + params: { + SENSOR: %%%LRF_ID%%%, + SNAME: val_name, + SIPADDR: val_addr + }, + success: function( response, opts ){ + wAddSocket.close(); + wAddSocket = null; + loadNodeProperties( %%%NODEID%%% ); + }, + failure: function( response, opts ) { + + } + }); + } + }] + }); + wAddSocket.show(); + Ext.getCmp('ued_name').setValue( Ext.getCmp('dev_name').getValue()); + Ext.getCmp('ued_address').setValue( Ext.getCmp('dev_ip').getValue()); + Ext.getCmp('ued_port').setValue( Ext.getCmp('dev_port').getValue()); + } + },{ + xtype:'fieldset', + title: 'Master LRF', + collapsible: true, + autoHeight: true, + defaults: { + //width: 168 + }, + items :[{ + xtype: 'panel', + html: 'Order: %%%M_ORDER%%%
' + },{ + xtype: 'panel', + html: 'Offset: %%%M_OFFSET%%%
' + },{ + xtype: 'panel', + html: 'Width: %%%M_WIDTH%%%
' + },{ + xtype: 'panel', + html: 'SST: %%%M_SST%%%
' + }] + },{ + xtype:'fieldset', + title: 'Slave LRF', + collapsible: true, + autoHeight: true, + defaults: { + //width: 168 + }, + items :[{ + xtype: 'panel', + html: 'Order: %%%S_ORDER%%%
' + },{ + xtype: 'panel', + html: 'Offset: %%%S_OFFSET%%%
' + },{ + xtype: 'panel', + html: 'Width: %%%S_WIDTH%%%
' + },{ + xtype: 'panel', + html: 'SST: %%%S_SST%%%
' + }] }] } \ No newline at end of file diff --git a/lib/controller/props/event_prop.js b/lib/controller/props/event_prop.js new file mode 100644 index 0000000..9969e21 --- /dev/null +++ b/lib/controller/props/event_prop.js @@ -0,0 +1,58 @@ +{ + xtype: 'form', + labelWidth: 75, // label settings here cascade unless overridden + frame: false, + bodyStyle:'padding:5px 5px 0', + defaultType: 'textfield', + items: [{ + xtype: 'panel', + height: 100, + html: '
%%%NAME%%%
Azimuth: %%%AZIMUTH%%%
' + },{ + xtype: 'panel', + html: 'Elevation: %%%ELEVETION%%%
' + },{ + xtype: 'panel', + html: 'Range: %%%RANGE%%%
' + }] + },{ + xtype:'fieldset', + //checkboxToggle:true, + collapsible: true, + title: 'Location', + autoHeight: true, + defaults: { + //width: 180 + }, + defaultType: 'textfield', + collapsed: false, + items :[{ + xtype: 'panel', + //html: '' + html: '' + },{ + xtype: 'panel', + html: 'Lat: %%%LAT%%%
' + },{ + xtype: 'panel', + html: 'Lon: %%%LON%%%
' + },{ + xtype: 'panel', + html: 'Alt: %%%ALT%%%
' + }] + }], +/* + buttons: [{ + text: 'Update', + width: '100%', + handler: updateLocationOrientation + }] +*/ +} \ No newline at end of file diff --git a/lib/controller/props/loc_prop.js b/lib/controller/props/loc_prop.js index 2638147..8f66c6b 100644 --- a/lib/controller/props/loc_prop.js +++ b/lib/controller/props/loc_prop.js @@ -71,10 +71,9 @@ text: 'Edit Orientation', handler: orientationEditor }] - }], - - buttons: [{ - text: 'Update', + },{ + xtype: 'button', + text: 'Update', width: '100%', handler: updateLocationOrientation }] diff --git a/lib/controller/removeNode.php b/lib/controller/removeNode.php new file mode 100644 index 0000000..777d55b --- /dev/null +++ b/lib/controller/removeNode.php @@ -0,0 +1,68 @@ +Data['id'] > 1 ){ + $NID = intval($_POST['NID']); + $Data = array(); + if( $NID ){ + $QS = "SELECT * FROM nodes WHERE id={$NID}"; + $result = $DATABASE->Query( $QS, false ); + if( count( $result ) ){ + $T = $result[0]; + $AID = intval( $T['aux_id'] ); + $TYP = intval( $T['type'] ); + $QS = "DELETE FROM `sockets` WHERE `node_id`={$NID}"; + $DATABASE->Query( $QS ); + $QS = "DELETE FROM `connections` WHERE `from`={$NID} OR `to`={$NID}"; + $DATABASE->Query( $QS ); + switch( $TYP ){ + case 1: + case 2: + case 3: + case 4: + case 5:{ + // Sensor + $QS = "DELETE FROM `lrf_sensors` WHERE `id`={$AID}"; + $DATABASE->Query( $QS ); + break; + }; + case 13:{ + // Camera + $QS = "SELECT * FROM `media_streams` WHERE `source_id`={$AID}"; + $RR = $DATABASE->Query( $QS ); + if( count( $RR ) ){ + foreach( $RR as $R ){ + $QS = "DELETE FROM `media_server_streams` WHERE `media_stream_id`={$R['id']}"; + $DATABASE->Query( $QS ); + }; + $QS = "DELETE FROM `media_streams` WHERE `source_id`={$AID}"; + $DATABASE->Query( $QS ); + }; + $QS = "UPDATE `cameras` SET `status`=0 WHERE `id`={$AID}"; + $DATABASE->Query( $QS ); + break; + }; + case 20:{ + // EthernetUART + $QS = "DELETE FROM `uart_settings` WHERE `id`={$AID}"; + $DATABASE->Query( $QS ); + $QS = "UPDATE `cameras` SET `uart_id`=0 WHERE `uart_id`={$AID}"; + $DATABASE->Query( $QS ); + $QS = "UPDATE `lrf_sensors` SET `uart_id`=0 WHERE `uart_id`={$AID}"; + $DATABASE->Query( $QS ); + break; + }; + }; + $QS = "DELETE FROM `nodes` WHERE `id`={$NID}"; + $DATABASE->Query( $QS ); + $Data['success'] = true; + } else { + $Data['error'] = 'Unknown Node ID Provided!'; + }; + } else { + $Data['error'] = 'Unknown Node ID Provided!'; + }; + echo json_encode( $Data ); + exit(); + }; + header('location: /'); +?> \ No newline at end of file diff --git a/lib/controller/updateLocation.php b/lib/controller/updateLocation.php index 4f270c9..1eb1b25 100644 --- a/lib/controller/updateLocation.php +++ b/lib/controller/updateLocation.php @@ -16,7 +16,7 @@ }; }; if( $TYP == 1 ){ - $QS="UPDATE sites SET lat={$LAT}, lon={$LON}, alt={$ALT} WHERE id ={$SITE}"; + $QS="UPDATE sites SET anchor_lat={$LAT}, anchor_lon={$LON}, anchor_alt={$ALT} WHERE id ={$SITE}"; } else { $QS = "SELECT * FROM nodes WHERE id ={$NID}"; $Result = $DATABASE->Query( $QS, false ); diff --git a/lib/controller/updateLrfSettings.php b/lib/controller/updateLrfSettings.php new file mode 100644 index 0000000..16c0da6 --- /dev/null +++ b/lib/controller/updateLrfSettings.php @@ -0,0 +1,24 @@ +Data['id'] > 1 ){ + if( isset( $_POST['SENSOR'] ) ){ + $S_ID = intval($_POST['SENSOR']); + if( $S_ID ){ + $NAME = $DATABASE->escape($_POST['SNAME']); + if(isset($_POST['SADDR'])){ + $ADDR = intval($_POST['SADDR']); + $RANGE = floatval($_POST['SRANGE']); + $QS="UPDATE `lrf_sensors` SET `device_id`={$ADDR}, `max_range`={$RANGE}, `label`='{$NAME}' WHERE id={$S_ID}"; + $DATABASE->Query( $QS ); + } else { + $IP= $DATABASE->escape($_POST['SIPADDR']); + $NAME = $DATABASE->escape($_POST['SNAME']); + $QS="UPDATE `lrf_sensors` SET `ip_address`='{$IP}', `label`='{$NAME}' WHERE id={$S_ID}"; + $DATABASE->Query( $QS ); + }; + $QS="UPDATE `nodes` SET `name`='{$NAME}' WHERE `aux_id`={$S_ID}"; + $DATABASE->Query( $QS ); + }; + }; + }; +?> \ No newline at end of file diff --git a/lib/controller/updateUartSettings.php b/lib/controller/updateUartSettings.php new file mode 100644 index 0000000..b6dfdda --- /dev/null +++ b/lib/controller/updateUartSettings.php @@ -0,0 +1,26 @@ +Data['id'] > 1 ){ + if( isset( $_POST['UART'] ) ){ + $UART_ID = intval($_POST['UART']); + if( $UART_ID ){ + $UART_SPEED = intval($_POST['USPD']); + $UART_BIT = intval($_POST['UBIT']); + $UART_STOP = floatval($_POST['USTP']); + switch( strtoupper( substr( $_POST['UPAR'], 1 ) ) ){ + case 'E': $UART_PARITY = 'E'; break; + case 'O': $UART_PARITY = 'O'; break; + default: + $UART_PARITY = 'N'; + }; + $UART_IP = $DATABASE->escape( $_POST['UADR'] ); + $UART_PORT = intval( $_POST['UPOR'] ); + $UART_MODE = intval( $_POST['UMOD'] ); + if( $UART_PORT > 0 ){ + $QS="UPDATE `uart_settings` SET `speed`={$UART_SPEED}, `bit`={$UART_BIT}, `parity`='{$UART_PARITY}', `stop_bit`={$UART_STOP}, `port`={$UART_PORT}, `path`='{$UART_IP}', `mode`={$UART_MODE} WHERE id ={$UART_ID}"; + $DATABASE->Query( $QS ); + }; + }; + }; + }; +?> \ No newline at end of file diff --git a/lib/controller/updateUserSettings.php b/lib/controller/updateUserSettings.php new file mode 100644 index 0000000..f599243 --- /dev/null +++ b/lib/controller/updateUserSettings.php @@ -0,0 +1,17 @@ +Data['id'] > 1 ){ + if( isset( $_POST['SSS'] ) ){ + $SETTING_ID = intval($_POST['SSS']); + switch( $SETTING_ID ){ + case 15:{ + $WIDTH = intval($_POST['WID']); + $HEIGHT = intval($_POST['HEI']); + $QS="UPDATE `users` SET `width`={$WIDTH}, `height`={$HEIGHT} WHERE id={$CUser->Data['id']}"; + $DATABASE->Query( $QS ); + break; + }; + }; + }; + }; +?> \ No newline at end of file diff --git a/lib/javascript/jsapi_dynamic/rgoose_camera_editor.js b/lib/javascript/jsapi_dynamic/rgoose_camera_editor.js index c472bc8..f503e4f 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_camera_editor.js +++ b/lib/javascript/jsapi_dynamic/rgoose_camera_editor.js @@ -481,24 +481,142 @@ function addEthernet2Uart(){ addE2UDialog = new Ext.Window({ modal: true, title: 'Add Ethernet To Serial Adapter', - width: 800, - height: 600, + width: 400, + height: 300, layout: 'fit', closeAction: 'hide', - items:{ - html: 'koko
', - bbar: [{ + items:[{ + xtype: 'form', + labelWidth: 120, // label settings here cascade unless overridden + frame: false, + bodyStyle:'padding:5px 5px 0', + defaultType: 'textfield', + items:[{ + xtype: 'combo', + fieldLabel: 'Speed', + id: 'ued_speed', + lazyRender:true, + mode: 'local', + store: new Ext.data.ArrayStore({ + fields: ['speed'], + data: [[19200], [115200]] + }), + valueField: 'speed', + displayField: 'speed' + },{ + xtype: 'combo', + fieldLabel: 'Bits', + id: 'ued_bit', + lazyRender:true, + mode: 'local', + store: new Ext.data.ArrayStore({ + fields: ['bits'], + data: [[5],[6],[7],[8],[9]] + }), + valueField: 'bits', + displayField: 'bits' + },{ + xtype: 'combo', + fieldLabel: 'Stop Bit', + lazyRender:true, + id: 'ued_stops', + mode: 'local', + store: new Ext.data.ArrayStore({ + fields: ['stops'], + data: [[1],[1.5],[2]] + }), + valueField: 'stops', + displayField: 'stops' + },{ + xtype: 'combo', + fieldLabel: 'Parity', + lazyRender:true, + id: 'ued_parity', + mode: 'local', + store: new Ext.data.ArrayStore({ + fields: ['parity'], + data: [['Odd'], ['Even'],['None']] + }), + valueField: 'parity', + displayField: 'parity' + },{ + xtype: 'combo', + fieldLabel: 'Working Mode', + lazyRender: true, + id: 'ued_mode', + mode: 'local', + store: new Ext.data.ArrayStore({ + fields: ['mode','mode_txt'], + data: [[0,'UDP Client'], [1,'TCP Client'], [2,'UDP Server'], [3,'TCP Server']] + }), + valueField: 'mode', + displayField: 'mode_txt' + },{ + fieldLabel: 'IP Address', + id: 'ued_ip' + },{ + fieldLabel: 'IP Port', + id: 'ued_port' + }], + bbar: [{ text: 'Cancel', handler: function(){//discoverOnvifSources - addDialog.hide(); + addE2UDialog.hide(); } - },'->',{ + },'->',{ id: 'con_to_src', - text: 'Connect To Selected', - disabled: ( SelectedCam == 0 ), - handler: connectToSeleced - }] - } + text: 'Add Adapter to Site', + disabled: false, + handler: function(){ + var SPD = Ext.getCmp('ued_speed').getValue(); + var BIT = Ext.getCmp('ued_bit').getValue(); + var STP = Ext.getCmp('ued_stops').getValue(); + var PAR = Ext.getCmp('ued_parity').getValue(); + var MOD = Ext.getCmp('ued_mode').getValue(); + var IP = Ext.getCmp('ued_ip').getValue(); + var PORT= Ext.getCmp('ued_port').getValue(); + Ext.Ajax.request({ + url: '/lib/controller/addNetworkNode.php', + params: { + NID: =$SiteID;?>, + TYPE: 20, + UART_SPEED: SPD, + UART_BITS: BIT, + UART_STOP: STP, + UART_PAR: PAR, + UART_MODE: MOD, + UART_IP: IP, + UART_PORT: PORT, + UID: =$UserID;?>, + SID: '=$Session;?>' + }, + success: function( response, opts ){ + var data = Ext.decode(response.responseText); + if( data.sucess == false ){ + Ext.Msg.show({ + title:'Request Failure!', + msg: data.error, + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.INFO + }); + } else { + loadSystemEditor(); + }; + addE2UDialog.hide(); + }, + failure: function( response, opts ) { + Ext.Msg.show({ + title:'Request Failure!', + msg: 'Ajax Request failed!', + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.INFO + }); + addE2UDialog.hide(); + } + }); + } + }] + }] }); }; addE2UDialog.show(); diff --git a/lib/javascript/jsapi_dynamic/rgoose_location_editor.js b/lib/javascript/jsapi_dynamic/rgoose_location_editor.js index 544d8f4..8562895 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_location_editor.js +++ b/lib/javascript/jsapi_dynamic/rgoose_location_editor.js @@ -429,6 +429,7 @@ Cube.prototype.sideChange = function() { } Cube.prototype.set = function( A, B, C ) { + //C = C + 90.0; this.viewport.setDirect( A, B, C ); } @@ -685,6 +686,7 @@ var bk_upd = false; function setCubeOrientation( A, B, C ){ + if( bk_upd ) return; bk_upd = true; curX = A; curY = B; @@ -701,7 +703,7 @@ function setCubeOrientation( A, B, C ){ t.setValue( C ); t = Ext.getCmp('yaw'); t.setValue( C ); - if( cube!= null ) cube.set( curX, curY, curZ ); + if( cube != null ) cube.set( curX, curY, curZ ); bk_upd = false; }; @@ -730,13 +732,7 @@ function orientationEditor(){ value: 30.0029, listeners:{ change: function( sl, nv, tt ){ - if( bk_upd ) return; - bk_upd = true; - var t = Ext.getCmp('roll_sld'); - t.setValue( nv ); - curX = nv; - if( cube!= null ) cube.set( curX, curY, curZ ); - bk_upd = false; + setCubeOrientation( nv / 1.0, curY, curZ ); } } },{ @@ -748,13 +744,7 @@ function orientationEditor(){ maxValue: 180.0, listeners:{ change: function( sl, nv, tt ){ - if( bk_upd ) return; - bk_upd = true; - var t = Ext.getCmp('roll'); - t.setValue( nv ); - curX = nv; - if( cube!= null ) cube.set( curX, curY, curZ ); - bk_upd = false; + setCubeOrientation( nv, curY, curZ ); } } },{ @@ -766,13 +756,7 @@ function orientationEditor(){ value: 30.0029, listeners:{ change: function( sl, nv, tt ){ - if( bk_upd ) return; - bk_upd = true; - var t = Ext.getCmp('pitch_sld'); - t.setValue( nv ); - curY = nv; - if( cube!= null ) cube.set( curX, curY, curZ ); - bk_upd = false; + setCubeOrientation( curX, nv / 1.0, curZ ); } } },{ @@ -784,13 +768,7 @@ function orientationEditor(){ maxValue: 180.0, listeners:{ change: function( sl, nv, tt ){ - if( bk_upd ) return; - bk_upd = true; - var t = Ext.getCmp('pitch'); - t.setValue( nv ); - curY = nv; - if( cube!= null ) cube.set( curX, curY, curZ ); - bk_upd = false; + setCubeOrientation( curX, nv, curZ ); } } },{ @@ -802,13 +780,8 @@ function orientationEditor(){ value: 30.0029, listeners:{ change: function( sl, nv, tt ){ - if( bk_upd ) return; - bk_upd = true; - var t = Ext.getCmp('yaw_sld'); - t.setValue( nv ); - curZ = nv; - if( cube!= null ) cube.set( curX, curY, curZ ); - bk_upd = false; + //alert( nv ); + setCubeOrientation( curX, curY, nv / 1.0 ); } } },{ @@ -820,13 +793,7 @@ function orientationEditor(){ maxValue: 180.0, listeners:{ change: function( sl, nv, tt ){ - if( bk_upd ) return; - bk_upd = true; - var t = Ext.getCmp('yaw'); - t.setValue( nv ); - curZ = nv; - if( cube!= null ) cube.set( curX, curY, curZ ); - bk_upd = false; + setCubeOrientation( curX, curY, nv ); } } }] @@ -916,7 +883,7 @@ function loadLocationEditor(){ border: false, items: [{ layout: 'fit', - height: 700, + height: PanelH-150, flex: 1, //border: true, items:{ diff --git a/lib/javascript/jsapi_dynamic/rgoose_main.js b/lib/javascript/jsapi_dynamic/rgoose_main.js index a8c5aa1..8d986a5 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_main.js +++ b/lib/javascript/jsapi_dynamic/rgoose_main.js @@ -1,6 +1,68 @@ // + +var winW = =0+$CUser->Data['width'];?>; +var winH = =0+$CUser->Data['height'];?>; + +var PanelH = winH-90; + +function Refresh(){ + window.location="/?t="+123; +}; + +function updateUserScreenResolution( x, y ){ + Ext.Ajax.request({ + url: '/lib/controller/updateUserSettings.php', + params: { + SAID: =$SiteID;?>, + UID: =$UserID;?>, + SID: '=$Session;?>', + SSS: 15, + WID: x, + HEI: y + }, + success: function( response, opts ){ + Refresh(); + }, + failure: function( response, opts ) { + Ext.Msg.show({ + title:'Request Failure!', + msg: 'Ajax Request failed!', + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.INFO + }); + } + }); +}; + +function CheckWindowSize(delay){ + if (parseInt(navigator.appVersion)>3) { + if (navigator.appName=="Netscape") { + winW2 = window.innerWidth; + winH2 = window.innerHeight; + if ( winH2<700 ) winH2=700; + }; + if (navigator.appName.indexOf("Microsoft")!=-1) { + winW2 = document.body.offsetWidth; + winH2 = document.body.offsetHeight; + if ( winH2<700 ) winH2=700; + }; + }; + + //alert(winW2+':'+winW+' '+winH2+':'+winH); + + if ( winW2 != winW || winH2!=winH ){ + updateUserScreenResolution( winW2, winH2 ); + }; +}; + + + Ext.onReady(function(){ + //Check Screen Size + //alert( winW + 'x' + winH ); + CheckWindowSize(); + var viewport = new Ext.Viewport({ id: 'main_viewport', layout:'border', diff --git a/lib/javascript/jsapi_dynamic/rgoose_sysmap_editor.js b/lib/javascript/jsapi_dynamic/rgoose_sysmap_editor.js index 3ee99fd..38aaa1c 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_sysmap_editor.js +++ b/lib/javascript/jsapi_dynamic/rgoose_sysmap_editor.js @@ -414,7 +414,6 @@ function loadServerProperties( NodeID ){ }*/ }); }; - function loadSystemEditor(){ if( tlInterval!= null ){ window.clearInterval( tlInterval ); @@ -437,7 +436,7 @@ function loadSystemEditor(){ //padding:'5', //align:'middle' }, - height: 700, + height: PanelH-5, flex: 1, frame: false, border: false, @@ -534,8 +533,29 @@ function loadSystemEditor(){ text: 'Add Connection', enableToggle : undefined, handler: function(){ - Ext.getCmp('connectstarterbutton').toggle( true, true ); - startCreateConnection(1); + if( InConnectEditMode ){ + Ext.getCmp('connectstarterbutton').toggle( false, false ); + InConnectEditMode = false; + stopCreateConnection(); + } else { + Ext.getCmp('connectstarterbutton').toggle( true, true ); + InConnectEditMode = true; + startCreateConnection(); + }; + } + },{ + xtype: 'button', + id: 'deletecomponentbutton', + text: 'Remove Component', + enableToggle: true, + handler: function(){ + if( InComponentRemoveMode ){ + Ext.getCmp('deletecomponentbutton').toggle( false, false ); + InComponentRemoveMode = false; + } else { + Ext.getCmp('deletecomponentbutton').toggle( true, true ); + InComponentRemoveMode = true; + }; } }] }] @@ -572,6 +592,7 @@ function loadSystemEditor(){ networkObj = new vis.Network(container, netwodkData, networkOpts ); networkObj.on("click", function (params) { //if(!connectionAddMode){ + if( !InComponentRemoveMode ){ if( params.nodes.length > 0 ){ if( netwodkData.nodes.get(params.nodes[0]).role == 'server' ){ loadServerProperties( params.nodes[0] ); @@ -582,18 +603,80 @@ function loadSystemEditor(){ selectedConnection = netwodkData.edges.get(params.edges[0]); loadLinkProperties( params.edges[0], selectedConnection.from, selectedConnection.to ); }; + } else { + if( params.nodes.length > 0 ){ + if( netwodkData.nodes.get(params.nodes[0]).role == 'server' ){ + Ext.Msg.show({ + title:'Remove Server Component!', + msg: 'You can not remove Server component!', + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.INFO + }); + } else { + Ext.Msg.show({ + title:'Remove Component?', + msg: 'You are about to remove.
';
+ } else {
+ p1 = '
';
+ };
+ if( ( val & 2 ) == 2 ){
+ p2 = '
';
+ } else {
+ p2 = '
';
+ };
+ if( ( val & 4 ) == 4 ){
+ p3 = '
';
+ } else {
+ p3 = '
';
+ };
+ return p1+p2+p3;
+};
+
+function LocRenderer( val ){
+ if( val ){
+ return '
+
| ||