|
|
//<?php require_once('../../js_asm.php'); ?>
var selectedSite = <?=$SiteID;?>;
var SettingsLidar3D = null;var SelectedNodeID = 0;function loadSettingsLidar3D( NodeID, Master ){ SelectedNodeID = NodeID; Ext.Ajax.request({ url: '/lib/controller/getSettingsLidsr3D.php', params: { NID: NodeID, MST: ((Master)?1:0), UID: <?=$UserID;?>, SID: '<?=$Session;?>', }, success: function( response, opts ){ // If the response is JSON, you have to decode it
var data = Ext.decode(response.responseText); Ext.getCmp('setting_master_ip').setValue( data.ip_address ); Ext.getCmp('setting_master_port').setValue( data.port ); Ext.getCmp('setting_slave_ip').setValue( data.aux_ip_address ); Ext.getCmp('setting_slave_port').setValue( data.aux_port ); Ext.getCmp('setting_lat').setValue( data.lat ); Ext.getCmp('setting_lon').setValue( data.lon ); Ext.getCmp('setting_alt').setValue( data.alt ); Ext.getCmp('setting_roll').setValue( data.roll ); Ext.getCmp('setting_pitch').setValue( data.pitch ); Ext.getCmp('setting_yaw').setValue( data.yaw ); }, failure: function( response, opts ) { //Ext.fly('some_div').update('Fail!');
}/*, callback: function(options,success,response){ // use this if you need to perform your own success/failure checking
}*/ });};
function SaveSettingsLidar3D( ){ if( SelectedNodeID == 0 ) return; t1 = Ext.getCmp('setting_master_ip').getValue(); t2 = Ext.getCmp('setting_master_port').getValue(); t3 = Ext.getCmp('setting_slave_ip').getValue(); t4 = Ext.getCmp('setting_slave_port').getValue(); t5 = Ext.getCmp('setting_lat').getValue(); t6 = Ext.getCmp('setting_lon').getValue(); t7 = Ext.getCmp('setting_alt').getValue(); t8 = Ext.getCmp('setting_roll').getValue(); t9 = Ext.getCmp('setting_pitch').getValue(); t10 = Ext.getCmp('setting_yaw').getValue(); Ext.Ajax.request({ url: '/lib/controller/setSettingsLidsr3D.php', params: { NID: SelectedNodeID, UID: <?=$UserID;?>, SID: '<?=$Session;?>', MIP: t1, MPP: t2, SIP: t3, SPP: t4, LAT: t5, LON: t6, ALT: t7, ROL: t8, PCH: t9, YAW: t10 }, 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:'Info Message', msg: 'Settings are sucessfully saved.', buttons: Ext.Msg.OK,//YESNOCANCEL,
fn: function(){ SettingsLidar3D.hide(); }, //animEl: 'elId',
icon: Ext.MessageBox.INFO //QUESTION
}); } else { Ext.Msg.show({ title:'Error Message', msg: data['error'], buttons: Ext.Msg.OK,//YESNOCANCEL,
fn: function(){ SettingsLidar3D.hide(); }, //animEl: 'elId',
icon: Ext.MessageBox.ERROR //QUESTION
}); }; }, failure: function( response, opts ) { //Ext.fly('some_div').update('Fail!');
}/*, callback: function(options,success,response){ // use this if you need to perform your own success/failure checking
}*/ });};
function editSettingsLidar3D( NodeID, Master ){ if( SettingsLidar3D == null ){ SettingsLidar3D = new Ext.Window({ modal: true, title: '<?=$Labels->GetLabel("_EDIT_LRF3D_SETTINGS_");?>', width: 773, height: 600, 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: 4 }, items: [{ border: false, html: 'Master IP Address:' },{ xtype: 'textfield', id: 'setting_master_ip', width: '70%' },{ border: false, html: 'Port:' },{ xtype: 'textfield', id: 'setting_master_port', width: '30%' },{ border: false, html: 'Slave IP Address:' },{ xtype: 'textfield', id: 'setting_slave_ip', width: '70%' },{ border: false, html: 'Port:' },{ xtype: 'textfield', id: 'setting_slave_port', width: '30%' },{ border: false, html: 'Position Lat/Lon/Alt:' },{ xtype: 'textfield', id: 'setting_lat', width: '30%' },{ xtype: 'textfield', id: 'setting_lon', width: '30%' },{ xtype: 'textfield', id: 'setting_alt', width: '30%' },{ border: false, html: 'Orientation Roll/Pitch/Yaw:' },{ xtype: 'textfield', id: 'setting_roll', width: '30%' },{ xtype: 'textfield', id: 'setting_pitch', width: '30%' },{ xtype: 'textfield', id: 'setting_yaw', width: '30%' }] }], bbar: [{ text: '<?=$Labels->GetLabel("_CANCEL_");?>', handler: function(){ SettingsLidar3D.hide(); } },{ text: '<?=$Labels->GetLabel("_SAVE_");?>', handler: SaveSettingsLidar3D }] }); }; SettingsLidar3D.show(); loadSettingsLidar3D( NodeID, Master );};
function reloadNetworkData(){ Ext.Ajax.request({ url: '/lib/controller/getNetwork.php', params: { NID: <?=$SiteID;?>, UID: <?=$UserID;?>, SID: '<?=$Session;?>', }, success: function( response, opts ){ // If the response is JSON, you have to decode it
var data = Ext.decode(response.responseText); netwodkData.nodes = new vis.DataSet( data.nodes ); netwodkData.edges = new vis.DataSet( data.edges ); networkObj.setData( netwodkData ); networkObj.redraw(); }, failure: function( response, opts ) { //Ext.fly('some_div').update('Fail!');
}/*, callback: function(options,success,response){ // use this if you need to perform your own success/failure checking
}*/ });};
function createNode( STYPE ){ Ext.Ajax.request({ url: '/lib/controller/addNetworkNode.php', params: { NID: <?=$SiteID;?>, UID: <?=$UserID;?>, SID: '<?=$Session;?>', TYPE: STYPE }, success: function( response, opts ){ // If the response is JSON, you have to decode it
reloadNetworkData( <?=$SiteID;?> ); }, failure: function( response, opts ) { //Ext.fly('some_div').update('Fail!');
}/*, callback: function(options,success,response){ // use this if you need to perform your own success/failure checking
}*/ });};
function loadNodeSockets( NID, store ){ Ext.Ajax.request({ url: '/lib/controller/listNodeSockets.php', params: { NID: <?=$SiteID;?>, UID: <?=$UserID;?>, SID: '<?=$Session;?>', DID: NID }, success: function( response, opts ){ var data = Ext.decode( response.responseText ); if( data['success'] == true ){ store.loadData( data, false ); } else { Ext.Msg.show({ title:'Error Message', msg: data['error'], buttons: Ext.Msg.OK,//YESNOCANCEL,
//fn: processResult,
//animEl: 'elId',
icon: Ext.MessageBox.ERROR //QUESTION
}); }; //Ext.getCmp('zigzag').getEl().unmask();
}, failure: function( response, opts ) { //Ext.fly('some_div').update('Fail!');
}/*, callback: function(options,success,response){ // use this if you need to perform your own success/failure checking
}*/ });};
function createConnection( SID, EID, CTY ){ if( addConnectionDialog == null ){ addConnectionDialog = new Ext.Window({ modal: true, title: '<?=$Labels->GetLabel("_ADD_CONNECTION_");?>', width: 773, height: 600, layout: 'hbox', closeAction: 'hide', listeners:{ beforehide : function(){ Ext.getCmp('connectstarterbutton').toggle( false, false ); } }, items:[{ xtype: 'grid', width: 380, height: 400, ds: A_socketsListStore, cm: socketListColModel, sm: A_socketSelModel },{ xtype: 'grid', width: 380, height: 400, ds: B_socketsListStore, cm: socketListColModel, sm: B_socketSelModel }], bbar: [{ text: '<?=$Labels->GetLabel("_CANCEL_");?>', handler: function(){ addConnectionDialog.hide(); } },{ id: 'con_to_src', text: '<?=$Labels->GetLabel("_ADD_");?>', disabled: true, handler: function(){ if( selected_A_socket != null && selected_B_socket != null ){ Ext.Ajax.request({ url: '/lib/controller/addConnection.php', params: { NID: <?=$SiteID;?>, SNID: SID, SOSID: selected_A_socket.id, ENID: EID, SOEID: selected_B_socket.id, UID: <?=$UserID;?>, SID: '<?=$Session;?>' }, success: function( response, opts ){ var data = Ext.decode(response.responseText); if( data.status ){ //reloadNetworkData( NID );
netwodkData.edges.add( data.edge ); } else { startCreateConnection(); //alert( data.message );
}; Ext.getCmp('connectstarterbutton').toggle( false, false ); }, failure: function( response, opts ) { //Ext.fly('some_div').update('Fail!');
}/*, callback: function(options,success,response){ // use this if you need to perform your own success/failure checking
}*/ }); }; } }] }); }; loadNodeSockets( SID, A_socketsListStore ); loadNodeSockets( EID, B_socketsListStore ); addConnectionDialog.show();};
function loadNodeProperties( NodeID ){ //alert( 'Node: ' + NodeID );
Ext.Ajax.request({ url: '/lib/controller/getNetworkNodeProps.php', params: { NID: <?=$SiteID;?>, UID: <?=$UserID;?>, SID: '<?=$Session;?>', NODE: NodeID }, success: function( response, opts ){ // If the response is JSON, you have to decode it
var data = Ext.decode(response.responseText); var tPanel = Ext.getCmp('prop_content'); tPanel.remove(0); tPanel.add( data ); tPanel.doLayout(); }, failure: function( response, opts ) { //Ext.fly('some_div').update('Fail!');
}/*, callback: function(options,success,response){ // use this if you need to perform your own success/failure checking
}*/ });};
function loadServerProperties( NodeID ){ Ext.Ajax.request({ url: '/lib/controller/getNetworkServerProps.php', params: { NID: <?=$SiteID;?>, UID: <?=$UserID;?>, SID: '<?=$Session;?>', NODE: NodeID }, success: function( response, opts ){ var data = Ext.decode(response.responseText); var tPanel = Ext.getCmp('prop_content'); tPanel.remove(0); tPanel.add( data ); tPanel.doLayout(); }, failure: function( response, opts ) { //Ext.fly('some_div').update('Fail!');
}/*, callback: function(options,success,response){ // use this if you need to perform your own success/failure checking
}*/ });};
function loadSystemEditor(){ if( tlInterval!= null ){ window.clearInterval( tlInterval ); tlInterval = null; timelineObj = null; }; var tPanel = Ext.getCmp('main_portal'); tPanel.removeAll( true ); Ext.getCmp('main_content').setTitle( 'System Map' ); tPanel.add({ //title: 'System Map',
//id: 'main_content',
columnWidth: 0.83, //xtype: 'panel',
//region:'center',
////id: 'sys_map',
frame: false, border: false, ////layout: 'column', // Specifies that the items will now be arranged in columns
//layout: 'vbox',
/* layoutConfig: { align : 'stretch', pack : 'start', //padding:'5',
//align:'middle'
},*/ items: [{ xtype: 'panel', layout: 'fit', layoutConfig: { align : 'stretch', pack : 'start' //padding:'5',
//align:'middle'
}, height: 700, flex: 1, frame: false, border: false, items:{ id: 'sys_map' }, tbar: [{ xtype: 'splitbutton', text: 'Add Laser Sensor', split: true, enableToggle : undefined, menu : { items: [{ text:'ALS', icon: '/style/assets/!cid_ii_jvmzuzrq10.png', handler: function(){ createNode( 1 ); } },{ text:'LFS', icon: '/style/assets/!cid_ii_jvmzuzpt0.png', handler: function(){ createNode( 2 ); } },{ text:'PLS-200', icon: '/style/assets/!cid_ii_jvmzuzql4.png', handler: function(){ createNode( 3 ); } },{ text:'PLS-360', icon: '/style/assets/!cid_ii_jvmzuzr87.png', handler: function(){ createNode( 4 ); } },{ text:'3DLIDAR', icon: '/style/assets/unnamed34.png', handler: function(){ createNode( 5 ); } }] } },{ xtype: 'splitbutton', text: 'Add Additional Equipment', split: true, enableToggle : true, menu : { items: [{ text:'Static Analog Camera', icon: '/style/assets/11_node.png' },{ text:'PTZ Analog Camera', icon: '/style/assets/12_node.png' },{ text:'Static IP Camera', icon: '/style/assets/11_node.png', handler: function(){ SelectedCamPTZ = false; addIpCam(); } },{ text:'PTZ IP Camera', icon: '/style/assets/12_node.png', handler: function(){ SelectedCamPTZ = true; addIpCam(); } },{ text:'DVR/Video Server/Streamer', icon: '/style/assets/videoServer.png', handler: function(){ addMediaServer(); } },{ text:'Network Video Recorder', icon: '/style/assets/15_node.png' },{ text:'Ethernet to UART transeiver', icon: '/style/assets/eth2uart.png', handler: function(){ addEthernet2Uart(); } },{ text:'DC to Ethernet (ADAM)', icon: '/style/assets/adam-1.png', }] } },{ xtype: 'button', id: 'connectstarterbutton', text: 'Add Connection', enableToggle : undefined, handler: function(){ Ext.getCmp('connectstarterbutton').toggle( true, true ); startCreateConnection(1); } }] }] }); tPanel.add({ title: 'Properties', xtype: 'panel', flex: 1, height: 700, //width: 210,
columnWidth: 0.17, layout: 'fit', //frame: true,
id: 'prop_content', // border: true
items:{ html: 'Select Item From Map' } }); tPanel.doLayout(); Ext.Ajax.request({ url: '/lib/controller/getNetwork.php', params: { NID: selectedSite, UID: <?=$UserID;?>, SID: '<?=$Session;?>' }, success: function( response, opts ){ // If the response is JSON, you have to decode it
var data = Ext.decode(response.responseText); netwodkData.nodes = new vis.DataSet( data.nodes ); netwodkData.edges = new vis.DataSet( data.edges ); var container = document.getElementById(Ext.getCmp('sys_map').body.id); networkObj = new vis.Network(container, netwodkData, networkOpts ); networkObj.on("click", function (params) { //if(!connectionAddMode){
if( params.nodes.length > 0 ){ if( netwodkData.nodes.get(params.nodes[0]).role == 'server' ){ loadServerProperties( params.nodes[0] ); } else { loadNodeProperties( params.nodes[0] ); }; } else if( params.edges.length > 0 ){ selectedConnection = netwodkData.edges.get(params.edges[0]); loadLinkProperties( params.edges[0], selectedConnection.from, selectedConnection.to ); }; //};
}); networkObj.on("doubleClick", function (params) { //if(!connectionAddMode){
if( params.nodes.length > 0 ){ loadNodeProperties( params.nodes[0] ); } else if( params.edges.length > 0 ){ selectedConnection = netwodkData.edges.get(params.edges[0]); loadLinkProperties( params.edges[0], selectedConnection.from, selectedConnection.to ); }; //};
}); /* networkObj.on("dragStart", function (params) { if( connectionAddMode ){ var tID = this.getNodeAt(params.pointer.DOM); if( tID != undefined ){ newConnectionStart = tID; }; }; }); networkObj.on("dragEnd", function (params) { if( connectionAddMode ){ var tID = this.getNodeAt(params.pointer.DOM); if( tID != undefined ){ newConnectionEnd = tID; //selectedConnection = netwodkData.edges[netwodkData.edges.length];
//selectedConnection.color = {
// color: '#ff0000',
// opacity: 0.3,
// highlight: 'blue'
//};
//networkObj.addEdgeMode(0);
createConnection( newConnectionStart, newConnectionEnd ); connectionAddMode = false; }; }; }); */ }, failure: function( response, opts ) { //Ext.fly('some_div').update('Fail!');
}/*, callback: function(options,success,response){ // use this if you need to perform your own success/failure checking
}*/ });};
|