//
var resourceInfoWindow = null;
var settingsAreChanged = false;
var settingsChanged = [];
function settingsChangeNotifier( A ){
settingsAreChanged = true;
if( !settingsChanged.includes( A ) ){
settingsChanged[settingsChanged.length] = A;
};
};
function cleanupChangeNotifier(){
settingsAreChanged = false;
settingsChanged = [];
};
function removeAllFromSite(){
Ext.Msg.show({
title:'=$Labels->GetLabel('_CLEAR_SITE_');?>',
msg: '=$Labels->GetLabel('_SITE_DEL_ALL_ABO_');?>',
buttons: Ext.Msg.YESNO,
icon: Ext.MessageBox.WARNING,
fn: function(btn, text){
if (btn == 'yes'){
Ext.Ajax.request({
url: '/lib/controller/resetAllSettings.php',
params: {
SAID: SelectedSite,
UID: =$UserID;?>,
SID: '=$Session;?>'
},
success: function( response, opts ){
doRefresh();
},
failure: failureAJAXFunction
});
};
}
});
};
function showResourceInfo( rid ){
Ext.Ajax.request({
url: '/lib/controller/getResourceInfo.php',
params: {
RID: rid,
UID: =$UserID;?>,
SID: '=$Session;?>',
},
success: function( response, opts ){
var data = Ext.decode(response.responseText);
if( resourceInfoWindow == null ){
resourceInfoWindow = new Ext.Window({
title: '=$Labels->GetLabel('_RES_INFO_');?>',
modal: true,
width: 800,
height: 400,
resizable: false,
layout: 'fit',
closeAction: 'hide',
items: [],
buttons:[{
text: `close`,
handler: function(){
resourceInfoWindow.hide();
}
}]
});
};
resourceInfoWindow.removeAll( true );
resourceInfoWindow.add( data );
resourceInfoWindow.show();
},
failure: failureAJAXFunction
});
};
var settingsWindow = null;
function showSettings( nid ){
Ext.Ajax.request({
url: '/lib/controller/getNodeSettings.php',
params: {
NID: nid,
UID: =$UserID;?>,
SID: '=$Session;?>',
},
success: function( response, opts ){
var data = Ext.decode( response.responseText );
if( settingsWindow == null ){
settingsWindow = new Ext.Window({
title: '=$Labels->GetLabel('_SETTINGS_');?>',
modal: true,
resizable: false,
width: 800,
height: 400,
layout: 'fit',
closeAction: 'hide',
items: [],
buttons:[{
text: `=$Labels->GetLabel('_CLOSE_');?>`,
handler: function(){
if( settingsAreChanged ){
Ext.Msg.show({
title:'=$Labels->GetLabel('_SETTINGS_CHANGED_');?>',
msg: '=$Labels->GetLabel('_SET_CHANGED_WOULD_SAVE_');?>',
buttons: Ext.Msg.YESNO,
icon: Ext.MessageBox.WARNING,
fn: function(btn, text){
if( btn == 'yes' ){
cleanupChangeNotifier();
settingsWindow.hide();
} else {
var TT = Ext.getCmp('node_settings_content');
TT.updateSettings();
};
}
});
} else {
settingsWindow.hide();
};
}
}]
});
};
settingsWindow.removeAll( true );
settingsWindow.add( data );
settingsWindow.show();
},
failure: failureAJAXFunction
});
};
function editResource( rid ){
var loadEditor = true;
if( settingsAreChanged ){
Ext.Msg.show({
title:'=$Labels->GetLabel('_SETTINGS_CHANGED_');?>',
msg: '=$Labels->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/getResourceEditor.php',
params: {
RID: rid,
UID: =$UserID;?>,
SID: '=$Session;?>',
},
success: function( response, opts ){
var data = Ext.decode(response.responseText);
var resourceEdPanel = Ext.getCmp('res_ed_small');
if( resourceEdPanel ){
resourceEdPanel.removeAll( true );
resourceEdPanel.add( data );
resourceEdPanel.doLayout();
};
},
failure: failureAJAXFunction
});
};
};
function editModule( mid ){
var loadEditor = true;
if( settingsAreChanged ){
Ext.Msg.show({
title:'=$Labels->GetLabel('_SETTINGS_CHANGED_');?>',
msg: '=$Labels->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/getModuleEditor.php',
params: {
MID: mid,
UID: =$UserID;?>,
SID: '=$Session;?>',
},
success: function( response, opts ){
var data = Ext.decode(response.responseText);
var moduleEdPanel = Ext.getCmp('mod_ed_small');
if( moduleEdPanel ){
moduleEdPanel.removeAll( true );
moduleEdPanel.add( data );
moduleEdPanel.doLayout();
};
},
failure: failureAJAXFunction
});
};
};
function reloadNetworkData(){
Ext.Ajax.request({
url: '/lib/controller/getNetwork.php',
params: {
NID: SelectedSite,
UID: =$UserID;?>,
SID: '=$Session;?>',
},
success: function( response, opts ){
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 ){
reloadNetworkData( =$SiteID;?> );
},
failure: failureAJAXFunction
});
};
var addSensor_window = null;
function addSerialSensor( sensorType ){
if( addSensor_window!= null ){
addSensor_window.hide();
addSensor_window.destroy();
addSensor_window = null;
};
var TTL = '';
var IMG = '';
switch( sensorType ){
case 1: TTL = '=$Labels->GetLabel("_DLG_ADD_ALS_");?>'; IMG = '/style/assets/!cid_ii_jvmzuzrm9.png'; break;
case 2: TTL = '=$Labels->GetLabel("_DLG_ADD_LFS_");?>'; IMG = '/style/assets/!cid_ii_jvmzuzqb2.png'; break;
case 3: TTL = '=$Labels->GetLabel("_DLG_ADD_PLS200_");?>'; IMG = '/style/assets/!cid_ii_jvmzuzqh3.png'; break;
case 4: TTL = '=$Labels->GetLabel("_DLG_ADD_PLS360_");?>'; IMG = '/style/assets/!cid_ii_jvmzuzqx6.png'; break;
};
addSensor_window = new Ext.Window({
modal: true,
title: TTL,
width: 400,
height: 400,
layout: 'fit',
closeAction: 'hide',
items:[{
xtype: 'form',
frame: false,
border: false,
hideLabels: false,
labelAlign: 'right', // or 'right' or 'top'
//labelSeparator: '>>', // takes precedence over layoutConfig value
labelWidth: 160, // defaults to 100
labelPad: 8, // defaults to 5, must specify labelWidth to be honored
items:[{
xtype:'panel',
frame: false,
border: false,
html: '
',
height: '200px'
},{
html: ' ',
frame: false,
border: false,
},{
fieldLabel: '=$Labels->GetLabel('_DEVICE_NAME_');?>',
xtype: 'textfield',
width: 200,
id: 'p200_dev_name',
allowBlank: false
},{
xtype: 'combo',
fieldLabel: '=$Labels->GetLabel('_SENSOR_MAX_RANGE_');?>',
lazyRender: true,
id: 'p200_range',
width: 200,
mode: 'local',
disabled: false,
forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['range','range_txt'],
data: [[35,'35'],[60,'60'],[120,'120'],[150,'150'],[160,'160'],[200,'200'],[300,'300']]
}),
valueField: 'range',
displayField: 'range_txt'
},{
xtype: 'combo',
fieldLabel: '=$Labels->GetLabel('_UART_PORT_');?>',
lazyRender: true,
id: 'p200_uart_id',
width: 200,
disabled: false,
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: UartListStore,
valueField: 'uart_id',
displayField: 'uart_name'
},{
fieldLabel: '=$Labels->GetLabel('_PROTO_DEVICE_ID_');?>',
xtype: 'numberfield',
id: 'p200_dev_id',
width: 200,
allowBlank: false,
allowNegative: false,
minValue: 0,
maxValue: 255
}],
bbar:[ '->',{
text: '=$Labels->GetLabel('_CANCEL_');?>',
handler: function(){
addSensor_window.hide();
}
},{
text: '=$Labels->GetLabel('_ADD_');?>',
handler: function(){
var uart_id_val = Ext.getCmp('p200_uart_id').getValue();
var dev_id_val = Ext.getCmp('p200_dev_id').getValue();
var sname = Ext.getCmp('p200_dev_name').getValue();
var range = parseInt( Ext.getCmp('p200_range').getValue());
if( sname != '' && uart_id_val != '' && range > 0 ){
var uart_id = parseInt( uart_id_val );
var dev_id = parseInt( dev_id_val );
Ext.Ajax.request({
url: '/lib/controller/addNetworkNode.php',
params: {
SITEID: =$SiteID;?>,
UID: =$UserID;?>,
SID: '=$Session;?>',
TYPE: sensorType,
SNAME: sname,
RANGE: range,
UART: uart_id,
DEVID: dev_id
},
success: function( response, opts ){
addSensor_window.hide();
reloadNetworkData( =$SiteID;?> );
},
failure: failureAJAXFunction
});
} else {
playSound();
Ext.Msg.show({
title:'=$Labels->GetLabel('_WRO_VALUES_');?>',
msg: '=$Labels->GetLabel('_WRO_VAL_MSG_');?>',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
};
}
}]
}]
});
if( addSensor_window != null ){
addSensor_window.show();
};
};
var add3D_window = null;
function addSensor_3D(){
if( add3D_window == null ){
add3D_window = new Ext.Window({
modal: true,
title: '=$Labels->GetLabel("_DLG_ADD_3DSENS_");?>',
width: 400,
height: 400,
layout: 'fit',
closeAction: 'hide',
items:[{
xtype: 'form',
frame: false,
border: false,
hideLabels: false,
labelAlign: 'right', // or 'right' or 'top'
//labelSeparator: '>>', // takes precedence over layoutConfig value
labelWidth: 160, // defaults to 100
labelPad: 8, // defaults to 5, must specify labelWidth to be honored
items:[{
xtype:'panel',
frame: false,
border: false,
html: '
',
height: '200px'
},{
html: ' ',
frame: false,
border: false,
},{
fieldLabel: '=$Labels->GetLabel('_DEVICE_NAME_');?>',
xtype: 'textfield',
width: 200,
id: 's3d_dev_name',
allowBlank: false
},{
xtype: 'combo',
fieldLabel: '=$Labels->GetLabel('_DLG_CON_SEVER_NODE_');?>',
lazyRender: true,
id: 's3d_server',
width: 200,
disabled: false,
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: ServerListStore,
valueField: 'server_id',
displayField: 'server_name'
},{
fieldLabel: '=$Labels->GetLabel('_DEVICE_IP_');?>',
xtype: 'textfield',
id: 's3d_dev_addr',
width: 200,
allowBlank: false
},{
fieldLabel: '=$Labels->GetLabel('_DEVICE_PORT_');?>',
xtype: 'numberfield',
id: 's3d_dev_port',
width: 200,
allowBlank: false,
allowNegative: false,
value: 2222,
minValue: 1000,
maxValue: 65535
}],
bbar:[ '->',{
text: '=$Labels->GetLabel('_CANCEL_');?>',
handler: function(){
add3D_window.hide();
}
},{
text: '=$Labels->GetLabel('_ADD_');?>',
handler: function(){
var dev_addr = Ext.getCmp('s3d_dev_addr').getValue();
var dev_port = parseInt( Ext.getCmp('s3d_dev_port').getValue() );
var dev_server = parseInt( Ext.getCmp('s3d_server').getValue() );
var dev_name = Ext.getCmp('s3d_dev_name').getValue();
if( dev_name != '' && dev_addr != '' && dev_port > 0 && dev_server > 0 ){
Ext.Ajax.request({
url: '/lib/controller/addNetworkNode.php',
params: {
SITEID: =$SiteID;?>,
UID: =$UserID;?>,
SID: '=$Session;?>',
TYPE: 5,
SNAME: dev_name,
PORT: dev_port,
ADDR: dev_addr,
SERVER: dev_server
},
success: function( response, opts ){
add3D_window.hide();
// If the response is JSON, you have to decode it
reloadNetworkData( =$SiteID;?> );
},
failure: failureAJAXFunction
});
} else {
playSound();
Ext.Msg.show({
title:'=$Labels->GetLabel('_WRO_VALUES_');?>',
msg: '=$Labels->GetLabel('_WRO_VAL_MSG_');?>',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
};
}
}]
}]
});
};
add3D_window.show();
};
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: '=$Labels->GetLabel('_ERROR_MSG_TITLE_');?>',
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: failureAJAXFunction
});
};
}
}]
});
};
loadNodeSockets( SID, A_socketsListStore );
loadNodeSockets( EID, B_socketsListStore );
addConnectionDialog.show();
};
function loadNodeProperties( NodeID ){
SelectedNodeID = NodeID;
Ext.Ajax.request({
url: '/lib/controller/getNetworkNodeProps.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: [ Query( $QS );
if( count( $RR ) ){
$RE=array();
foreach( $RR as $R ){
$RE[] = "[ {$R['aux_id']}, '{$R['device']}']";
};
echo implode( ',', $RE );
} else {
echo "[0, '".$Labels->GetLabel('_NO_UARTS_DEF_')."']";
};
?>]
}),
valueField: '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: [ 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, '".$Labels->GetLabel('_NO_DCB_DEF_')."']";
};
?>]
}),
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: failureAJAXFunction
});
};
function loadSystemEditor(){
if( tlInterval!= null ){
window.clearInterval( tlInterval );
tlInterval = null;
timelineObj = null;
};
setUserContent( 3 );
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(){
addSerialSensor( 1 );
}
},{
text:'LFS',
icon: '/style/assets/!cid_ii_jvmzuzpt0.png',
handler: function(){
addSerialSensor( 2 );
}
},{
text:'PLS-200',
icon: '/style/assets/!cid_ii_jvmzuzql4.png',
handler: function(){
addSerialSensor( 3 );
}
},{
text:'PLS-360',
icon: '/style/assets/!cid_ii_jvmzuzr87.png',
handler: function(){
addSerialSensor( 4 );
}
},{
text:'3DLIDAR',
icon: '/style/assets/unnamed34.png',
handler: function(){
addSensor_3D();
}
}]
}
},{
xtype: 'splitbutton',
text: '=$Labels->GetLabel('_SMM_ADD_ADDIT_');?>',
split: true,
enableToggle : true,
menu : {
items: [{
text:'Argus Event Server',
icon: '/style/assets/0_node.png',
handler: function(){
addServer();
}
},{
text:'Static Analog Camera',
icon: '/style/assets/11_node.png',
handler: function(){
SelectedCamTYPE = 10;
addAnalogCam();
}
},{
text:'PTZ Analog Camera',
icon: '/style/assets/12_node.png',
handler: function(){
SelectedCamTYPE = 11;
addAnalogCam();
}
},{
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: '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;
};
}
},{
xtype: 'button',
id:'deleteallcomponents',
text: '=$Labels->GetLabel('_CLEAR_SITE_');?>',
handler: removeAllFromSite
}]
}]
});
tPanel.add({
title: '=$Labels->GetLabel('_PROPERTIES_');?>',
xtype: 'panel',
flex: 1,
height: PanelH-5,
//width: 210,
columnWidth: 0.17,
layout: 'fit',
frame: false,
id: 'prop_content',
border: false,
items:[{
html:'=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?>
'
}]
});
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 ){
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.
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: failureAJAXFunction
});
};
},
//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
});
};