|
|
//<?php require_once('../../js_asm.php'); ?>
var resourceInfoWindow = null;
function showResourceInfo( rid ){ Ext.Ajax.request({ url: '/lib/controller/getResourceInfo.php', params: { RID: rid, UID: <?=$UserID;?>, SID: '<?=$Session;?>', }, success: function( response, opts ){ // If the response is JSON, you have to decode it
var data = Ext.decode(response.responseText); if( resourceInfoWindow == null ){ resourceInfoWindow = new Ext.Window({ title: 'Resource Info', modal: true, width: 800, height: 400, layout: 'fit', closeAction: 'hide', items: [], buttons:[{ text: `close` }] }); }; resourceInfoWindow.removeAll( true ); resourceInfoWindow.add( data ); resourceInfoWindow.show(); }, failure: failureAJAXFunction });};
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: failureAJAXFunction });};
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: failureAJAXFunction });};
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: SelectedSite,//<?=$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: failureAJAXFunction });};
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: failureAJAXFunction });};
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: failureAJAXFunction });};
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 );
SelectedNodeID = 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: failureAJAXFunction });};
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: failureAJAXFunction });};
var mp_FlyHunterWindow = null;
function module_prop_FlyHunter( module_id ){ if( mp_FlyHunterWindow == null ){ mp_FlyHunterWindow = new Ext.Window({ modal: true, title: '<?=$Labels->GetLabel("_FHM_PROPS_");?>', width: 773, height: 600, layout: 'table', closeAction: 'hide', flex: 1, defaults: { bodyStyle:'padding:20px' }, layoutConfig: { // The total column count must be specified here
columns: 2 }, items:[{ html: 'Radio LINK UART Port' },{ xtype: 'combo', editable: false, typeAhead: true, triggerAction: 'all', lazyRender:true, mode: 'local', store: new Ext.data.ArrayStore({ id: 0, fields: ['myId', 'displayText' ], data: [ <?php $QS="SELECT aux_id, device FROM resources WHERE ( type=1 OR type=129 ) AND site_id={$SiteID} "; $RR=$DATABASE->Query( $QS ); if( count( $RR ) ){ $RE=array(); foreach( $RR as $R ){ $RE[] = "[ {$R['aux_id']}, '{$R['device']}']"; }; echo implode( ',', $RE ); } else { echo "[0, 'No UARTS DEFINED']"; }; ?>] }), valueField: 'myId', displayField: 'displayText' },{ html: 'ChakaLaka DC Channel' },{ xtype: 'combo', editable: false, typeAhead: true, triggerAction: 'all', lazyRender:true, mode: 'local', store: new Ext.data.ArrayStore({ id: 1, fields: ['myId', 'displayText' ], data: [ <?php $QS="SELECT ca.id, ca.channel_id, dcb.serial_id FROM module_dcr_chanels ca LEFT JOIN modules_dcr dcb ON( ca.dcr_id = dcb.id ) WHERE dcb.site_id={$SiteID}"; $RR=$DATABASE->Query( $QS ); if( count( $RR ) ){ $RE=array(); foreach( $RR as $R ){ $RE[] = "[ {$R['id']}, '{$R['serial_id']}_{$R['channel_id']}']"; }; echo implode( ',', $RE ); } else { echo "[0, 'No DCB Connected']"; }; ?>] }), valueField: 'myId', displayField: 'displayText' }], bbar:[{ text:'cancel' },{ text:'submit' }] }); }; mp_FlyHunterWindow.show(); Ext.Ajax.request({ url: '/lib/controller/getModuleProps.php', params: { NID: <?=$SiteID;?>, UID: <?=$UserID;?>, SID: '<?=$Session;?>', MODULE: module_id }, 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 ) { } });};
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( '<?=$Labels->GetLabel('_SYS_MAP_');?>' ); tPanel.add({ columnWidth: 0.83, frame: false, border: false, items: [{ xtype: 'panel', layout: 'fit', layoutConfig: { align : 'stretch', pack : 'start' //padding:'5',
//align:'middle'
}, height: PanelH-5, flex: 1, frame: false, border: false, items:{ id: 'sys_map' }, tbar: [{ xtype: 'splitbutton', text: '<?=$Labels->GetLabel('_SMM_ADD_LSEN_');?>', 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: '<?=$Labels->GetLabel('_SMM_ADD_ADDIT_');?>', split: true, enableToggle : true, menu : { items: [{ text:'Static Analog Camera', icon: '/style/assets/11_node.png', handler: function(){ SelectedCamTYPE = 10; } },{ text:'PTZ Analog Camera', icon: '/style/assets/12_node.png', handler: function(){ SelectedCamTYPE = 11; } },{ text:'Static IP Camera', icon: '/style/assets/11_node.png', handler: function(){ SelectedCamTYPE = 12; addIpCam(); } },{ text:'PTZ IP Camera', icon: '/style/assets/12_node.png', handler: function(){ SelectedCamTYPE = 13; 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: '<?=$Labels->GetLabel('_ADD_CONNECTION_');?>', enableToggle : undefined, handler: function(){ 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; }; } }] }] }); tPanel.add({ title: '<?=$Labels->GetLabel('_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( !InComponentRemoveMode ){ 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 ); }; } 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.<br/>Are you sure to do so?', buttons: Ext.Msg.YESNOCANCEL, fn: function( result ){ if( result=='yes' ){ Ext.Ajax.request({ url: '/lib/controller/removeNode.php', params: { SAID: <?=$SiteID;?>, NID: params.nodes[0], 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 { stopCreateConnection(); InComponentRemoveMode = false; loadSystemEditor(); }; }, failure: function( response, opts ) { Ext.Msg.show({ title:'Request Failure!', msg: 'Ajax Request failed!', buttons: Ext.Msg.OK, icon: Ext.MessageBox.INFO }); } }); }; }, //animEl: 'elId',
icon: Ext.MessageBox.QUESTION }); }; }; }; //};
}); /* networkObj.on("doubleClick", function (params) { //if(!connectionAddMode){
if( !InComponentRemoveMode ){ 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 ); }; } else { alert( 'Remove' ); }; //};
}); */ /* 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: failureAJAXFunction });};
|