You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2318 lines
63 KiB
2318 lines
63 KiB
//<?php require_once('../../js_asm.php'); ?>
|
|
|
|
|
|
var helpContentTopicID = -1;
|
|
var SelectedPlatform = 0;
|
|
var oSelectedPlatform = 0;
|
|
var SelectedStation = 0;
|
|
var oSelectedStation = 0;
|
|
var SelectedLine = 0;
|
|
var oSelectedLine = 0;
|
|
var SelectedTrack = 0;
|
|
var oSelectedTrack = 0;
|
|
var SelectedModule = 0;
|
|
var oSelectedModule = 0;
|
|
var muploader = null;
|
|
var uploads_store_id = 0;
|
|
|
|
var uploads_store = new Ext.data.ArrayStore({
|
|
autoDestroy: false,
|
|
storeId: 'up_store',
|
|
idIndex: 0,
|
|
fields: [
|
|
{name: 'id', type: 'int' },
|
|
{name: 'file_name', type: 'string'},
|
|
{name: 'file_id', type: 'string'},
|
|
{name: 'size', type: 'string'},
|
|
{name: 'progress', type: 'int'},
|
|
{name: 'status', type: 'string' }
|
|
]
|
|
});
|
|
var uploaded_store_id = 0;
|
|
var uploaded_store = new Ext.data.ArrayStore({
|
|
autoDestroy: false,
|
|
storeId: 'mod_store',
|
|
idIndex: 0,
|
|
fields: [
|
|
{name: 'id', type: 'int' },
|
|
{name: 'file_name', type: 'string'},
|
|
{name: 'size', type: 'int'},
|
|
{name: 'status', type: 'int'},
|
|
{name: 'ts', type: 'string' },
|
|
{name: 'memo', type: 'string' }
|
|
]
|
|
});
|
|
function progressRenderer( value, meta, record ){
|
|
Ext.defer( function( id ){
|
|
var p = new Ext.ProgressBar({
|
|
id: 'progress_'+id,
|
|
renderTo: 'div_'+id,
|
|
animate: false,
|
|
width: '100%',
|
|
value: 0,
|
|
text: 'Upload Pending',
|
|
});
|
|
}, 50, undefined, [ record.data.file_id ] );
|
|
return '<div id="div_' + record.data.file_id + '"></div>';
|
|
};
|
|
var fileUploadsColModel_ops = {
|
|
columns: [
|
|
{header: "ID", width: 50, align: 'center', css: 'vertical-align: middle;', dataIndex: 'id' },
|
|
{header: "<?=$Labels->GetLabel('_FILE_NAME_');?>", width: 280, fixed: false, align: 'left', css: 'vertical-align: middle;', dataIndex: 'file_name' },
|
|
{header: "<?=$Labels->GetLabel('_SIZE_');?>", width: 80, align: 'left', css: 'vertical-align: middle;', dataIndex: 'size' },
|
|
{header: "<?=$Labels->GetLabel('_PROGRESS_');?>", width: 150, renderer: progressRenderer, dataIndex: 'progress' },
|
|
{header: " ", width: 50, dataIndex: 'status3' }
|
|
],
|
|
defaults: {
|
|
sortable: false,
|
|
fixed: true,
|
|
menuDisabled: true,
|
|
width: 100
|
|
}
|
|
};
|
|
function onModuleFileRenderer( value, meta, record ){
|
|
if( value == 0 ){
|
|
rv = '<img title="<?=$Labels->GetLabel('_READY_TO_UPLO_');?>" alt="<?=$Labels->GetLabel('_READY_TO_UPLO_');?>" src="/style/assets/bul_green.png">';
|
|
} else {
|
|
if( value < 101 ){
|
|
rv = '<img title="<?=$Labels->GetLabel('_UPLO_IN_PROGRESS_');?>" alt="<?=$Labels->GetLabel('_UPLO_IN_PROGRESS_');?>" src="/style/assets/bul_gray.png">';
|
|
} else {
|
|
rv = '<img title="<?=$Labels->GetLabel('_UPLO_DONE_');?>" alt="<?=$Labels->GetLabel('_UPLO_DONE_');?>" src="/style/assets/bul_blue.png">';
|
|
};
|
|
};
|
|
return rv;
|
|
};
|
|
var fileModuleColModel_ops = {
|
|
columns: [
|
|
{header: "ID", width: 50, align: 'center', css: 'vertical-align: middle;', dataIndex: 'id' },
|
|
{header: "<?=$Labels->GetLabel('_FILE_NAME_');?>", width: 60, fixed: false, align: 'left', css: 'vertical-align: middle;', dataIndex: 'file_name' },
|
|
{header: "<?=$Labels->GetLabel('_SIZE_');?>", width: 80, /*renderer: plupload.formatSize,*/ align: 'left', css: 'vertical-align: middle;', dataIndex: 'size' },
|
|
{header: "<?=$Labels->GetLabel('_TIME_');?>", width: 150, align: 'left', css: 'vertical-align: middle;', dataIndex: 'ts' },
|
|
{header: "<?=$Labels->GetLabel('_STATUS_');?>", width: 50, renderer: onModuleFileRenderer, dataIndex: 'status' },
|
|
{header: "<?=$Labels->GetLabel('_MEMO_');?>", dataIndex: 'memo' }
|
|
],
|
|
defaults: {
|
|
sortable: false,
|
|
fixed: true,
|
|
menuDisabled: true,
|
|
width: 100
|
|
}
|
|
};
|
|
var fileUploadsSelModel_ops = {
|
|
singleSelect: true
|
|
};
|
|
var targetWidthTable_store = new Ext.data.ArrayStore({
|
|
autoDestroy: false,
|
|
storeId: 'width_table_store',
|
|
idIndex: 0,
|
|
fields: [
|
|
{name: 'id', type: 'int' },
|
|
{name: 'width', type: 'int'},
|
|
{name: 'range', type: 'sting'},
|
|
{name: 'range_m', type: 'sting'}
|
|
]
|
|
});
|
|
var cWTRowSelected = null;
|
|
var cWTRowSelectedRange = 0;
|
|
var cWTRowSelectedRangeP = 0;
|
|
var WTSelectedSensor = 0;
|
|
var widthTableSelModel_ops = {
|
|
singleSelect: true,
|
|
listeners: {
|
|
rowselect: function( sm, row, rec ) {
|
|
cWTRowSelected = rec.data.id;
|
|
cWTRowSelectedRange = rec.data.range_m;
|
|
cWTRowSelectedRangeP = rec.data.range;
|
|
//todo
|
|
Ext.getCmp('edit_btn_width_table').enable();
|
|
}
|
|
}
|
|
};
|
|
|
|
function deleteWTRow(){
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/delWidthTableRecord.php',
|
|
params: {
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>',
|
|
DID: WTSelectedSensor,
|
|
RID: cWTRowSelected
|
|
},
|
|
success: function( response, opts ){
|
|
Ext.getCmp('del_btn_width_table').disable();
|
|
loadWidthTable( WTSelectedSensor );
|
|
},
|
|
failure: failureAJAXFunction
|
|
});
|
|
};
|
|
|
|
var targetWidthTableColModel_ops = {
|
|
columns: [
|
|
{header: "<?=$Labels->GetLabel('_WIDTH_CORRECT_');?> (%)", width: 250, align: 'center', css: 'vertical-align: middle;', dataIndex: 'width' },
|
|
{header: "<?=$Labels->GetLabel('_RANGE_');?> (%)", width: 150, align: 'center', css: 'vertical-align: middle;', dataIndex: 'range' },
|
|
{header: "<?=$Labels->GetLabel('_RANGE_').' ('.$Labels->GetLabel('_METERS_') . ')';?>", width: 150, align: 'center', css: 'vertical-align: middle;', dataIndex: 'range_m' },
|
|
],
|
|
defaults: {
|
|
sortable: false,
|
|
fixed: true,
|
|
menuDisabled: true
|
|
}
|
|
};
|
|
|
|
|
|
function loadModuleFiles( sensorID ){
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getDeviceFiles.php',
|
|
params: {
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>',
|
|
DID: sensorID
|
|
},
|
|
success: function( response, opts ){
|
|
var data = Ext.decode( response.responseText );
|
|
uploaded_store.removeAll();
|
|
uploaded_store.loadData( data.files );
|
|
},
|
|
failure: failureAJAXFunction
|
|
});
|
|
};
|
|
|
|
|
|
function loadHelpContent( topicID ){
|
|
if( helpContentTopicID == topicID ) return;
|
|
helpContentTopicID = topicID;
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getHelpTopic.php',
|
|
params: {
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>',
|
|
TID: topicID
|
|
},
|
|
success: function( response, opts ){
|
|
var tData = Ext.decode(response.responseText);
|
|
var tPanel = Ext.getCmp('help_content');
|
|
tPanel.removeAll( true );
|
|
tPanel.add( tData );
|
|
tPanel.doLayout();
|
|
},
|
|
failure: failureAJAXFunction
|
|
});
|
|
};
|
|
|
|
function moveStation( station_id, dir ){
|
|
doStationOperation( station_id, 5, JSON.stringify( { DIR: dir, LINE: SelectedLine } ), true );
|
|
};
|
|
var moduleControlWindow = null;
|
|
function moduleControl(){
|
|
if( moduleControlWindow == null ){
|
|
moduleControlWindow = new Ext.Window({
|
|
title: 'Module Control',
|
|
height: Ext.getBody().getViewSize().height*0.9,
|
|
width: Ext.getBody().getViewSize().width*0.9,
|
|
modal: true,
|
|
items:[{
|
|
html:'<iframe frameBorder=0 width="100%" height="'+(Ext.getBody().getViewSize().height*0.9-32)+'" src="/lib/controller/doModuleOperations.php?OPID=1&MID='+SelectedModule+'"></iframe>'
|
|
}],
|
|
listeners:{
|
|
beforedestroy: function(){
|
|
moduleControlWindow = null;
|
|
}
|
|
}
|
|
});
|
|
};
|
|
moduleControlWindow.show();
|
|
};
|
|
function moduleCamControl(){
|
|
if( moduleControlWindow == null ){
|
|
moduleControlWindow = new Ext.Window({
|
|
title: 'Module Control',
|
|
height: Ext.getBody().getViewSize().height*0.9,
|
|
width: Ext.getBody().getViewSize().width*0.9,
|
|
modal: true,
|
|
items:[{
|
|
html:'<iframe frameBorder=0 width="100%" height="'+(Ext.getBody().getViewSize().height*0.9-32)+'" src="/lib/controller/doModuleOperations.php?OPID=3&MID='+SelectedModule+'"></iframe>'
|
|
}],
|
|
listeners:{
|
|
beforedestroy: function(){
|
|
moduleControlWindow = null;
|
|
}
|
|
}
|
|
});
|
|
};
|
|
moduleControlWindow.show();
|
|
};
|
|
function moduleHostControl(){
|
|
if( moduleControlWindow == null ){
|
|
moduleControlWindow = new Ext.Window({
|
|
title: 'Module Control',
|
|
height: Ext.getBody().getViewSize().height*0.9,
|
|
width: Ext.getBody().getViewSize().width*0.9,
|
|
modal: true,
|
|
items:[{
|
|
html:'<iframe frameBorder=0 width="100%" height="'+(Ext.getBody().getViewSize().height*0.9-32)+'" src="/lib/controller/doModuleOperations.php?OPID=2&MID='+SelectedModule+'"></iframe>'
|
|
}],
|
|
listeners:{
|
|
beforedestroy: function(){
|
|
moduleControlWindow = null;
|
|
}
|
|
}
|
|
});
|
|
};
|
|
moduleControlWindow.show();
|
|
};
|
|
|
|
function bindStationToLine( station_id ){
|
|
doStationOperation( station_id, 3, SelectedLine, true );
|
|
};
|
|
|
|
function clearHelpContent(){
|
|
helpContentTopicID = -1;
|
|
};
|
|
function loadApplicationSettings(){
|
|
contentView.l[3] = {v:2,p:''};
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getApplicationSettings.php',
|
|
params: {
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>',
|
|
},
|
|
success: function( response, opts ){
|
|
var data = Ext.decode(response.responseText);
|
|
if( data.status == 'ok' ){
|
|
var tPanel = Ext.getCmp('application_settings_container');
|
|
var res = Ext.decode( data.content );
|
|
tPanel.removeAll( true );
|
|
tPanel.add( res );
|
|
tPanel.doLayout();
|
|
tPanel = Ext.getCmp('application_op_small');
|
|
tPanel.removeAll( true );
|
|
tPanel.add({
|
|
html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
|
|
});
|
|
tPanel.doLayout();
|
|
} else {
|
|
Ext.Msg.show({
|
|
title:'<?=$Labels->GetLabel('_ERROR_MSG_');?>',
|
|
msg: data.msg,
|
|
buttons: Ext.Msg.OK,
|
|
icon: Ext.MessageBox.ERROR
|
|
});
|
|
};
|
|
},
|
|
failure: failureAJAXFunction
|
|
});
|
|
};
|
|
function loadHistorySettings(){
|
|
contentView.l[3] = {v:3,p:''};
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getHistorySettings.php',
|
|
params: {
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>',
|
|
},
|
|
success: function( response, opts ){
|
|
var data = Ext.decode(response.responseText);
|
|
if( data.status == 'ok' ){
|
|
var tPanel = Ext.getCmp('history_settings_container');
|
|
var res = Ext.decode( data.content );
|
|
tPanel.removeAll( true );
|
|
tPanel.add( res );
|
|
tPanel.doLayout();
|
|
tPanel = Ext.getCmp('history_op_small');
|
|
tPanel.removeAll( true );
|
|
tPanel.add({
|
|
html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
|
|
});
|
|
tPanel.doLayout();
|
|
} else {
|
|
Ext.Msg.show({
|
|
title:'<?=$Labels->GetLabel('_ERROR_MSG_');?>',
|
|
msg: data.msg,
|
|
buttons: Ext.Msg.OK,
|
|
icon: Ext.MessageBox.ERROR
|
|
});
|
|
};
|
|
},
|
|
failure: failureAJAXFunction
|
|
});
|
|
};
|
|
function loadMediaSettings(){
|
|
contentView.l[3] = {v:1,p:''};
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getMediaSettings.php',
|
|
params: {
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>',
|
|
},
|
|
success: function( response, opts ){
|
|
var data = Ext.decode(response.responseText);
|
|
if( data.status == 'ok' ){
|
|
var tPanel = Ext.getCmp('media_settings_container');
|
|
var res = Ext.decode( data.content );
|
|
tPanel.removeAll( true );
|
|
tPanel.add( res );
|
|
tPanel.doLayout();
|
|
tPanel = Ext.getCmp('encoder_op_small');
|
|
tPanel.removeAll( true );
|
|
tPanel.add({
|
|
html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
|
|
});
|
|
tPanel.doLayout();
|
|
} else {
|
|
Ext.Msg.show({
|
|
title:'<?=$Labels->GetLabel('_ERROR_MSG_');?>',
|
|
msg: data.msg,
|
|
buttons: Ext.Msg.OK,
|
|
icon: Ext.MessageBox.ERROR
|
|
});
|
|
};
|
|
},
|
|
failure: failureAJAXFunction
|
|
});
|
|
};
|
|
|
|
function loadMetroLines( suse ){
|
|
if( suse == undefined ){
|
|
suse = 0;
|
|
};
|
|
oSelectedLine = 0;
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getLines.php',
|
|
params: {
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>',
|
|
},
|
|
success: function( response, opts ){
|
|
var tData = Ext.decode(response.responseText);
|
|
var tPanel = Ext.getCmp('lines_container');
|
|
if( tData.status == 'ok' ){
|
|
var res = Ext.decode( tData.lines );
|
|
tPanel.removeAll( true );
|
|
tPanel.add( res );
|
|
tPanel.doLayout();
|
|
if( suse == 0 ){
|
|
var zPanel = Ext.getCmp('line_op_small');
|
|
zPanel.removeAll( true );
|
|
zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
|
|
zPanel.doLayout();
|
|
var tComp = Ext.getCmp('stations_tab');
|
|
tComp.setDisabled( true );
|
|
} else {
|
|
editLine( suse );
|
|
};
|
|
} else {
|
|
tPanel.removeAll( true );
|
|
tPanel.doLayout();
|
|
var zPanel = Ext.getCmp('line_op_small');
|
|
zPanel.removeAll( true );
|
|
zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
|
|
zPanel.doLayout();
|
|
var tComp = Ext.getCmp('stations_tab');
|
|
tComp.setDisabled( true );
|
|
};
|
|
},
|
|
failure: failureAJAXFunction
|
|
});
|
|
};
|
|
|
|
function loadMetroStations( line_id, suse ){
|
|
if( suse == undefined ){
|
|
suse = 0;
|
|
};
|
|
oSelectedStation = 0;
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getStations.php',
|
|
params: {
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>',
|
|
LID: line_id
|
|
},
|
|
success: function( response, opts ){
|
|
var tData = Ext.decode(response.responseText);
|
|
var tPanel = Ext.getCmp('stations_container');
|
|
if( tData.status == 'ok' ){
|
|
tPanel.removeAll( true );
|
|
var res = Ext.decode( tData.line_tag );
|
|
tPanel.add( res );
|
|
res = Ext.decode( tData.stations );
|
|
tPanel.add( res );
|
|
tPanel.doLayout();
|
|
if( suse == 0 ){
|
|
var zPanel = Ext.getCmp('station_op_small');
|
|
zPanel.removeAll( true );
|
|
zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
|
|
zPanel.doLayout();
|
|
var tComp = Ext.getCmp('platform_tab');
|
|
tComp.setDisabled( true );
|
|
} else {
|
|
editStation( suse );
|
|
};
|
|
} else {
|
|
tPanel.removeAll( true );
|
|
tPanel.doLayout();
|
|
var zPanel = Ext.getCmp('station_op_small');
|
|
zPanel.removeAll( true );
|
|
zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
|
|
zPanel.doLayout();
|
|
var tComp = Ext.getCmp('platform_tab');
|
|
tComp.setDisabled( true );
|
|
};
|
|
},
|
|
failure: failureAJAXFunction
|
|
});
|
|
};
|
|
|
|
function loadMetroStationPlatforms( station_id, suse ){
|
|
if( suse == undefined ){
|
|
suse = 0;
|
|
};
|
|
oSelectedPlatform = 0;
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getPlatforms.php',
|
|
params: {
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>',
|
|
OID: station_id
|
|
},
|
|
success: function( response, opts ){
|
|
var tData = Ext.decode(response.responseText);
|
|
var tPanel = Ext.getCmp('platform_container');
|
|
if( tData.status == 'ok' ){
|
|
tPanel.removeAll( true );
|
|
var res = Ext.decode( tData.line_tag );
|
|
tPanel.add( res );
|
|
res = Ext.decode( tData.platforms );
|
|
tPanel.add( res );
|
|
tPanel.doLayout();
|
|
if( suse == 0 ){
|
|
var zPanel = Ext.getCmp('platform_op_small');
|
|
zPanel.removeAll( true );
|
|
zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
|
|
zPanel.doLayout();
|
|
var tComp = Ext.getCmp('modules_tab');
|
|
tComp.setDisabled( true );
|
|
} else {
|
|
editPlatform( suse );
|
|
};
|
|
} else {
|
|
tPanel.removeAll( true );
|
|
tPanel.doLayout();
|
|
var zPanel = Ext.getCmp('platform_op_small');
|
|
zPanel.removeAll( true );
|
|
zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
|
|
zPanel.doLayout();
|
|
var tComp = Ext.getCmp('modules_tab');
|
|
tComp.setDisabled( true );
|
|
};
|
|
},
|
|
failure: failureAJAXFunction
|
|
});
|
|
};
|
|
|
|
function loadMetroPlatformModules( platform_id, suse ){
|
|
if( suse == undefined ){
|
|
suse = 0;
|
|
};
|
|
oSelectedPlatform = 0;
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getModules.php',
|
|
params: {
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>',
|
|
OID: platform_id
|
|
},
|
|
success: function( response, opts ){
|
|
var tData = Ext.decode(response.responseText);
|
|
var tPanel = Ext.getCmp('module_container');
|
|
if( tData.b_a_b ) Ext.getCmp('mod_add_btn').disable(); else Ext.getCmp('mod_add_btn').enable();
|
|
if( tData.status == 'ok' ){
|
|
tPanel.removeAll( true );
|
|
//var res = Ext.decode( tData.line_tag );
|
|
//tPanel.add( res );
|
|
res = Ext.decode( tData.modules );
|
|
tPanel.add( res );
|
|
tPanel.doLayout();
|
|
if( suse == 0 ){
|
|
var zPanel = Ext.getCmp('module_op_small');
|
|
zPanel.removeAll( true );
|
|
zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
|
|
zPanel.doLayout();
|
|
} else {
|
|
editModule( suse );
|
|
};
|
|
} else {
|
|
tPanel.removeAll( true );
|
|
tPanel.doLayout();
|
|
var zPanel = Ext.getCmp('module_op_small');
|
|
zPanel.removeAll( true );
|
|
zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
|
|
zPanel.doLayout();
|
|
};
|
|
},
|
|
failure: failureAJAXFunction
|
|
});
|
|
};
|
|
|
|
var addMetroStationPlatformWindow = null;
|
|
|
|
function addStationPlatform( station_id ){
|
|
if( addMetroStationPlatformWindow == null ){
|
|
addMetroStationPlatformWindow = new Ext.Window({
|
|
title: 'Add Platform',
|
|
width: 480,
|
|
height: 405,
|
|
modal: true,
|
|
resizable: false,
|
|
items:[{
|
|
xtype: 'form',
|
|
fzrame: false,
|
|
bzorder: false,
|
|
labelWidth: 150,
|
|
labelAlign: 'right',
|
|
items: [{
|
|
xtype: 'textfield',
|
|
fieldLabel: "Platform Name",
|
|
id: 'pl_name',
|
|
width: 200,
|
|
},{
|
|
xtype: 'textfield',
|
|
fieldLabel: "Platform Level",
|
|
id: 'pl_lvl',
|
|
width: 50,
|
|
},{
|
|
xtype: 'combo',
|
|
fieldLabel: "Platform Type",
|
|
id: 'pl_lay',
|
|
width: 200,
|
|
lazyRender: true,
|
|
mode: 'local',
|
|
forceSelection: true,
|
|
triggerAction: 'all',
|
|
editable: false,
|
|
readOnly: false,
|
|
disableKeyFilter: true,
|
|
tpl:'<tpl for="."><div class="x-combo-list-item"><img width="16px" src="{icon}"/> {name}</div></tpl>',
|
|
store: new Ext.data.ArrayStore({
|
|
fields: ['abbr','name','icon'],
|
|
data: [['A','Layout A','/style/assets/pt_layout_A.png'],['B','Layout B','/style/assets/pt_layout_B.png'],['C','Layout C','/style/assets/pt_layout_C.png'],['D','Layout D','/style/assets/pt_layout_D.png'],['E','Layout E','/style/assets/pt_layout_E.png'],['F','Layout F','/style/assets/pt_layout_F.png']]
|
|
}),
|
|
valueField: 'abbr',
|
|
displayField: 'name',
|
|
value: 'A',
|
|
listeners:{
|
|
select: function( t, r, i ){
|
|
t.getEl().setStyle({
|
|
'background-image': 'url(' + r.data.icon + ')',
|
|
'background-repeat': 'no-repeat',
|
|
'background-position': '3px center',
|
|
'background-size': '16px 16px',
|
|
'padding-left': '25px'
|
|
});
|
|
tt = document.getElementById('lp_preview');
|
|
tt.src = r.data.icon;
|
|
if( r.data.abbr == 'A' || r.data.abbr == 'B' ){
|
|
Ext.getCmp('up_tr_name').el.up('.x-form-item', 10, true).child('.x-form-item-label').update('Track Name');
|
|
Ext.getCmp('up_tr_abbr').el.up('.x-form-item', 10, true).child('.x-form-item-label').update('Track Abbr.');
|
|
Ext.getCmp('bot_tr_name').hide();
|
|
Ext.getCmp('bot_tr_abbr').hide();
|
|
} else {
|
|
Ext.getCmp('up_tr_name').el.up('.x-form-item', 10, true).child('.x-form-item-label').update('Upper Track Name');
|
|
Ext.getCmp('up_tr_abbr').el.up('.x-form-item', 10, true).child('.x-form-item-label').update('Upper Track Abbr.');
|
|
Ext.getCmp('bot_tr_name').show();
|
|
Ext.getCmp('bot_tr_abbr').show();
|
|
}
|
|
},
|
|
afterrender: function( t ){
|
|
t.getEl().setStyle({
|
|
'background-image': 'url(' + t.store.data.items[t.store.findExact( 'abbr', t.value )].data.icon + ')',
|
|
'background-repeat': 'no-repeat',
|
|
'background-position': '3px center',
|
|
'background-size': '16px 16px',
|
|
'padding-left': '25px'
|
|
});
|
|
}
|
|
}
|
|
},{
|
|
xtype: 'spacer',
|
|
height: 10
|
|
},{
|
|
xtype: 'spacer',
|
|
html: '<center><img style="border: 1px solid yellow;" id="lp_preview" src="/style/assets/pt_layout_A.png" width="120"></center>'
|
|
},{
|
|
xtype: 'spacer',
|
|
height: 10
|
|
},{
|
|
xtype: 'textfield',
|
|
fieldLabel: "Track Name",
|
|
id: 'up_tr_name',
|
|
width: 200,
|
|
},{
|
|
xtype: 'textfield',
|
|
fieldLabel: "Track Abbr.",
|
|
id: 'up_tr_abbr',
|
|
width: 50,
|
|
},{
|
|
xtype: 'textfield',
|
|
fieldLabel: "Bottom Track Name",
|
|
hidden: true,
|
|
id: 'bot_tr_name',
|
|
width: 200,
|
|
},{
|
|
xtype: 'textfield',
|
|
fieldLabel: "Bottom Track Abbr.",
|
|
hidden: true,
|
|
id: 'bot_tr_abbr',
|
|
width: 50,
|
|
},{
|
|
xtype: 'spacer',
|
|
height: 300
|
|
}]
|
|
}],
|
|
bbar:['->',{
|
|
text: 'Cancel',
|
|
handler: function(){
|
|
addMetroStationPlatformWindow.close();
|
|
}
|
|
},{
|
|
text: 'Add',
|
|
handler: function(){
|
|
var tt = {
|
|
name: Ext.getCmp('pl_name').getValue(),
|
|
level: Ext.getCmp('pl_lvl').getValue(),
|
|
layout: Ext.getCmp('pl_lay').getValue(),
|
|
up_trn: Ext.getCmp('up_tr_name').getValue(),
|
|
up_tra: Ext.getCmp('up_tr_abbr').getValue(),
|
|
bt_trn: Ext.getCmp('bot_tr_name').getValue(),
|
|
bt_tra: Ext.getCmp('bot_tr_abbr').getValue()
|
|
};
|
|
SelectedPlatform = 0;
|
|
doPlatformOperation( SelectedStation, 1, JSON.stringify(tt), true );
|
|
addMetroStationPlatformWindow.close();
|
|
}
|
|
}],
|
|
listeners:{
|
|
beforedestroy: function(){
|
|
addMetroStationPlatformWindow = null;
|
|
}
|
|
}
|
|
});
|
|
};
|
|
addMetroStationPlatformWindow.show();
|
|
};
|
|
|
|
var addMetroStationWindow = null;
|
|
|
|
function addMetroStation( line_id ){
|
|
if( addMetroStationWindow == null ){
|
|
//debugger;
|
|
addMetroStationWindow = new Ext.Window({
|
|
title: 'Add Station',
|
|
width: 800,
|
|
height: 600,
|
|
items:[{
|
|
xtype: 'tabpanel',
|
|
frame: false,
|
|
id: 'jjua_content',
|
|
border: false,
|
|
activeTab: 0,
|
|
items:[{
|
|
xtype: 'panel',
|
|
flex: 1,
|
|
title: 'Assign Existed Station',
|
|
items:[{
|
|
xtype: 'spacer',
|
|
height: 10
|
|
},{
|
|
xtype: 'textfield',
|
|
id: 'zizi',
|
|
width: '100%',
|
|
enableKeyEvents : true,
|
|
emptyText: 'Start Type Station Name Here',
|
|
value: '',
|
|
listeners:{
|
|
keyup: function( t, e ){
|
|
nv = t.getRawValue();
|
|
if( nv.length > 2 ){
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getStations.php',
|
|
params: {
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>',
|
|
LID: SelectedLine,
|
|
ABQ: nv
|
|
},
|
|
success: function( response, opts ){
|
|
var tData = Ext.decode(response.responseText);
|
|
var tPanel = Ext.getCmp('ex_station_container');
|
|
if( tData.status == 'ok' ){
|
|
tPanel.removeAll( true );
|
|
var res = Ext.decode( tData.stations );
|
|
tPanel.add( res );
|
|
tPanel.doLayout();
|
|
} else {
|
|
tPanel.removeAll( true );
|
|
tPanel.doLayout();
|
|
};
|
|
},
|
|
failure: failureAJAXFunction
|
|
});
|
|
};
|
|
}
|
|
}
|
|
},{
|
|
xtype: 'spacer',
|
|
height: 10
|
|
},{
|
|
xtype: 'panel',
|
|
id: 'ex_station_container',
|
|
flex: 1,
|
|
height: 500,
|
|
items:[]
|
|
}]
|
|
}]
|
|
}],
|
|
listeners:{
|
|
beforedestroy: function(){
|
|
addMetroStationWindow = null;
|
|
}
|
|
}
|
|
});
|
|
};
|
|
addMetroStationWindow.show();
|
|
};
|
|
|
|
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 editFilter( fid ){
|
|
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/getFilterEditor.php',
|
|
params: {
|
|
FID: fid,
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>',
|
|
},
|
|
success: function( response, opts ){
|
|
var data = Ext.decode(response.responseText);
|
|
var resourceEdPanel = Ext.getCmp('flt_ed_small');
|
|
if( resourceEdPanel ){
|
|
resourceEdPanel.removeAll( true );
|
|
resourceEdPanel.add( data );
|
|
resourceEdPanel.doLayout();
|
|
};
|
|
},
|
|
failure: failureAJAXFunction
|
|
});
|
|
};
|
|
};
|
|
|
|
function editModule( s_id ){
|
|
if( oSelectedModule ){
|
|
var tt = document.getElementById('MODULE_TAG_'+oSelectedModule );
|
|
tt.classList.remove('selected_green');
|
|
tt.classList.add('active_green');
|
|
};
|
|
var tt = document.getElementById('MODULE_TAG_'+s_id );
|
|
if( tt!= undefined ){
|
|
tt.classList.remove('active_green');
|
|
tt.classList.add('selected_green');
|
|
};
|
|
if( oSelectedModule == s_id ) return;
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getModuleEditor.php',
|
|
params: {
|
|
MID: s_id,
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>'
|
|
},
|
|
success: function( response, opts ){
|
|
var data = Ext.decode( response.responseText );
|
|
var tComp = Ext.getCmp('module_op_small');
|
|
if( tComp!= null ){
|
|
tComp.removeAll( true );
|
|
tComp.add( data );
|
|
tComp.doLayout();
|
|
};
|
|
oSelectedModule = s_id;
|
|
if( SelectedModule != s_id ){
|
|
SelectedModule = s_id;
|
|
//tComp = Ext.getCmp('btn_unb_station');
|
|
//tComp.setDisabled( false );
|
|
//tComp = Ext.getCmp('btn_del_station');
|
|
//tComp.setDisabled( false );
|
|
//tComp = Ext.getCmp('modules_tab');
|
|
//tComp.setDisabled( false );
|
|
};
|
|
}
|
|
});
|
|
};
|
|
|
|
function enableModule( ID ){
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/doModuleOperation.php',
|
|
params: {
|
|
OPID: 2,
|
|
OPCODE: 1,
|
|
MID: ID,
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>'
|
|
},
|
|
success: function(){
|
|
//showSettings( SelectedNodeID, 2 );
|
|
loadModules();
|
|
}
|
|
});
|
|
};
|
|
|
|
function disableModule( ID ){
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/doModuleOperation.php',
|
|
params: {
|
|
OPID: 2,
|
|
OPCODE: 0,
|
|
MID: ID,
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>'
|
|
},
|
|
success: function(){
|
|
//showSettings( SelectedNodeID, 2 );
|
|
loadModules();
|
|
}
|
|
});
|
|
};
|
|
//cursor: url('data:image/svg+xml;utf8,<svg fill="%23FF0000" height="48" viewBox="0 0 24 24" width="48" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h24v24H0z" fill="none"/><path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/></svg>') 24 24, auto;
|
|
|
|
function doApplicationOperation( op, param, reload = false ){
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/doApplicationOperation.php',
|
|
params: {
|
|
OPID: op,
|
|
OPCODE: param,
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>'
|
|
},
|
|
success: function(){
|
|
//if( reload ) loadDetectedCameras();
|
|
//if( reload ) loadAssignedCameras();
|
|
}
|
|
});
|
|
};
|
|
|
|
function doModuleOperation( moduleid, op, param, reload = false ){
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/doModuleOperations.php',
|
|
params: {
|
|
MID: moduleid,
|
|
OPID: op,
|
|
OPCODE: param,
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>'
|
|
},
|
|
success: function(){
|
|
if( reload ) loadMetroPlatformModules( SelectedPlatform, SelectedModule );
|
|
}
|
|
});
|
|
};
|
|
|
|
function doLineOperation( lineID, operation, param, reload ){
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/doLineOperations.php',
|
|
params: {
|
|
ID: lineID,
|
|
OPID: operation,
|
|
OPCODE: param,
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>'
|
|
},
|
|
success: function(){
|
|
oSelectedLine = 0;
|
|
if( reload ) loadMetroLines( SelectedLine );
|
|
}
|
|
});
|
|
};
|
|
|
|
function doStationOperation( StationID, operation, param, reload ){
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/doStationOperations.php',
|
|
params: {
|
|
ID: StationID,
|
|
OPID: operation,
|
|
OPCODE: param,
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>'
|
|
},
|
|
success: function(){
|
|
if( reload ) loadMetroStations( SelectedLine, SelectedStation );
|
|
}
|
|
});
|
|
};
|
|
|
|
function doPlatformOperation( PlatformID, operation, param, reload ){
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/doPlatformOperations.php',
|
|
params: {
|
|
ID: PlatformID,
|
|
OPID: operation,
|
|
OPCODE: param,
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>'
|
|
},
|
|
success: function(){
|
|
if( reload ) loadMetroStationPlatforms( SelectedStation, SelectedPlatform );
|
|
}
|
|
});
|
|
};
|
|
|
|
|
|
function removeModule( ID ){
|
|
Ext.Msg.show({
|
|
title: "<?=$Labels->GetLabel('_PLS_CONFIRM_');?>",
|
|
msg: "<?=$Labels->GetLabel('_RUS_DELETE_MODULE_');?>",
|
|
buttons: Ext.Msg.YESNOCANCEL,
|
|
fn: function( btn, text ){
|
|
if( btn == 'yes' ){
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/doModuleOperation.php',
|
|
params: {
|
|
OPID: 1,
|
|
MID: ID,
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>'
|
|
},
|
|
success: function(){
|
|
//showSettings( SelectedNodeID, 2 );
|
|
loadModules();
|
|
}
|
|
});
|
|
};
|
|
},
|
|
icon: Ext.MessageBox.QUESTION
|
|
});
|
|
};
|
|
|
|
function disableServOps(){
|
|
var tC = Ext.getCmp('servopPanel01');
|
|
tC.removeClass('servopInfo_item01');
|
|
tC.addClass('servopInfo_item00');
|
|
tC.disable();
|
|
Ext.getCmp('tbtn_sop01').disable();
|
|
//tC.doLayout();
|
|
tC = Ext.getCmp('servopPanel02');
|
|
tC.removeClass('servopInfo_item11');
|
|
tC.addClass('servopInfo_item10');
|
|
tC.disable();
|
|
Ext.getCmp('tbtn_sop02').disable();
|
|
//tC.doLayout();
|
|
tC = Ext.getCmp('servopPanel03');
|
|
tC.removeClass('servopInfo_item21');
|
|
tC.addClass('servopInfo_item20');
|
|
tC.disable();
|
|
Ext.getCmp('tbtn_sop03').disable();
|
|
//tC.doLayout();
|
|
tC = Ext.getCmp('servopPanel04');
|
|
tC.removeClass('servopInfo_item31');
|
|
tC.addClass('servopInfo_item30');
|
|
tC.disable();
|
|
Ext.getCmp('tbtn_sop04').disable();
|
|
//tC.doLayout();
|
|
};
|
|
|
|
function enableServOps(){
|
|
var tC = Ext.getCmp('servopPanel01');
|
|
if( tC != undefined ){
|
|
tC.removeClass('servopInfo_item00');
|
|
tC.addClass('servopInfo_item01');
|
|
Ext.getCmp('tbtn_sop01').enable();
|
|
tC.enable();
|
|
};
|
|
//tC.doLayout();
|
|
tC = Ext.getCmp('servopPanel02');
|
|
if( tC != undefined ){
|
|
tC.removeClass('servopInfo_item10');
|
|
tC.addClass('servopInfo_item11');
|
|
tC.enable();
|
|
Ext.getCmp('tbtn_sop02').enable();
|
|
};
|
|
//tC.doLayout();
|
|
tC = Ext.getCmp('servopPanel03');
|
|
if( tC != undefined ){
|
|
tC.removeClass('servopInfo_item20');
|
|
tC.addClass('servopInfo_item21');
|
|
tC.enable();
|
|
Ext.getCmp('tbtn_sop03').enable();
|
|
};
|
|
//tC.doLayout();
|
|
tC = Ext.getCmp('servopPanel04');
|
|
if( tC != undefined ){
|
|
tC.removeClass('servopInfo_item30');
|
|
tC.addClass('servopInfo_item31');
|
|
tC.enable();
|
|
Ext.getCmp('tbtn_sop04').enable();
|
|
};
|
|
//tC.doLayout();
|
|
};
|
|
|
|
function serverStatusUpdater(){
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getServerStatus.php',
|
|
params: {
|
|
SERVID: 1,
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>'
|
|
},
|
|
success: function( response, opts ){
|
|
// If the response is JSON, you have to decode it
|
|
var sps = document.getElementById("INFO_SPS");
|
|
if( sps == undefined ) return;
|
|
var data = Ext.decode(response.responseText);
|
|
if( data.status == 'ok' ){
|
|
serverIsOnLine = true;
|
|
enableServOps();
|
|
document.getElementById('HW_INFO').innerHTML = data.hw_info;
|
|
document.getElementById('OS_INFO').innerHTML = data.os_info;
|
|
document.getElementById('SW_INFO').innerHTML = data.build;
|
|
setDonatStatus( 1, 0, data.stats.stat_cpu15 );
|
|
setDonatStatus( 1, 1, data.stats.stat_mem );
|
|
setDonatStatus( 1, 2, data.stats.stat_disk );
|
|
setDonatStatus( 1, 3, data.stats.temp0 );
|
|
|
|
sps.classList.remove('setEd_infoPanel');
|
|
sps.classList.add('setEl_infoPanel');
|
|
} else {
|
|
serverIsOnLine = false;
|
|
disableServOps();
|
|
if( data.status == 'na' ){
|
|
setDonatStatus( 1, 0, -1 );
|
|
setDonatStatus( 1, 1, -1 );
|
|
setDonatStatus( 1, 2, -1 );
|
|
setDonatStatus( 1, 3, -1 );
|
|
sps.classList.remove('setEl_infoPanel');
|
|
sps.classList.add('setEd_infoPanel');
|
|
} else {
|
|
Ext.Msg.show({
|
|
title: "<?=$Labels->GetLabel("_INFO_MSG_");?>",
|
|
msg: data.messages,
|
|
buttons: Ext.Msg.OK,//YESNOCANCEL,
|
|
fn: function(){
|
|
},
|
|
icon: Ext.MessageBox.INFO //QUESTION
|
|
});
|
|
};
|
|
};
|
|
if( tlInterval == null ){
|
|
tlInterval = window.setInterval( serverStatusUpdater, 1200, selectedSite );
|
|
};
|
|
},
|
|
failure: failureAJAXFunction
|
|
});
|
|
};
|
|
|
|
var devUploadTimeout = null;
|
|
var devUploadID = -1;
|
|
function fetchDeviceUploadStatus(){
|
|
clearTimeout( devUploadTimeout );
|
|
if( devUploadID < 1 ) return;
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getDeviceUploadStatus.php',
|
|
params: {
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>',
|
|
DID: devUploadID
|
|
},
|
|
success: function( response, opts ){
|
|
var data = Ext.decode(response.responseText);
|
|
var tT = Ext.getCmp('upp_ttext');
|
|
if( tT != undefined ){
|
|
if( data.count > 0 ){
|
|
devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 );
|
|
};
|
|
if( data.current != undefined ){
|
|
tT.update('<p class="UPTTEXT">Uploading '+data.count+' file(s)</p>');
|
|
document.getElementById('upp_ctext').innerHTML ='<p class="UPCTEXT">Current File: '+data.current+'</p>';
|
|
Ext.getCmp('upp_pbar').updateProgress( data.progress, Math.round( data.progress*100 )+'%', true );
|
|
devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 );
|
|
} else {
|
|
Ext.getCmp('upload_progres_panel').hide();
|
|
Ext.getCmp('uploaded_grid').show();
|
|
loadModuleFiles( devUploadID );
|
|
};
|
|
};
|
|
},
|
|
failure: failureAJAXFunction
|
|
});
|
|
};
|
|
|
|
|
|
function downloadSettings(){
|
|
ReportMask = new Ext.LoadMask(Ext.getBody(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."});
|
|
ReportMask.show();
|
|
const formData = new FormData();
|
|
formData.append("UID",<?=$UserID;?>);
|
|
formData.append("SID",'<?=$Session;?>');
|
|
fetch('/lib/controller/downloadSettings.php',{
|
|
method: "POST",
|
|
body: formData
|
|
})
|
|
.then(resp => resp.blob())
|
|
.then(blob => {
|
|
const url = window.URL.createObjectURL(blob);
|
|
const a = document.createElement('a');
|
|
a.style.display = 'none';
|
|
a.href = url;
|
|
var today=new Date();
|
|
var SY=1900+today.getYear();
|
|
var SMO=today.getMonth()+1;
|
|
var SD=today.getDate();
|
|
var SH = today.getHours();
|
|
var SM = today.getMinutes();
|
|
var SS = today.getSeconds();
|
|
a.download = 'backup_'+SY+'.'+SMO+'.'+SD+'_'+SH+'-'+SM+'-'+SS+'.db';
|
|
document.body.appendChild(a);
|
|
a.click();
|
|
window.URL.revokeObjectURL(url);
|
|
ReportMask.hide();
|
|
Ext.Msg.show({
|
|
title:'<?=$Labels->GetLabel('_SUCCESS_');?>',
|
|
msg: '<?=$Labels->GetLabel('_DB_FILE_HAS_DOWNLOADED_');?>',
|
|
buttons: Ext.Msg.OK,
|
|
icon: Ext.MessageBox.INFO
|
|
});
|
|
})
|
|
.catch(() => {
|
|
ReportMask.hide();
|
|
Ext.Msg.show({
|
|
title:'<?=$Labels->GetLabel('_REQ_FAILURE_');?>',
|
|
msg: '<?=$Labels->GetLabel('_AJX_REQFAILURE_');?>',
|
|
buttons: Ext.Msg.OK,
|
|
icon: Ext.MessageBox.ERROR
|
|
});
|
|
});
|
|
};
|
|
function addModule(){
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getAddModuleWindow.php',
|
|
params: {
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>',
|
|
PID: SelectedPlatform
|
|
},
|
|
success: function( response, opts ){
|
|
var data = Ext.decode(response.responseText);
|
|
var addModuleWindow = new Ext.Window( data );
|
|
addModuleWindow.show();
|
|
},
|
|
failure: failureAJAXFunction
|
|
});
|
|
};
|
|
|
|
function addFilter(){
|
|
var addFilterWindow = new Ext.Window({
|
|
id: 'fulu_boa',
|
|
title: "<?=$Labels->GetLabel( '_ADD_EVT_FILTER_' );?>",
|
|
modal: true,
|
|
width: 400,
|
|
height: 300,
|
|
items:[{
|
|
xtype: 'form',
|
|
items: [{
|
|
xtype: 'combo',
|
|
fieldLabel: "<?=$Labels->GetLabel( 'MOD_TYPE' );?>",
|
|
id: 'flt_type',
|
|
lazyRender: true,
|
|
mode: 'local',
|
|
forceSelection: true,
|
|
triggerAction: 'all',
|
|
editable: false,
|
|
disableKeyFilter: true,
|
|
store: new Ext.data.ArrayStore({
|
|
fields: ['az_t','az_txt'],
|
|
data: [<?php
|
|
$QS="SELECT `id`,`name` FROM `target_filter_types`";
|
|
//$JIJI=$DATABASE->Query( $QS );
|
|
$OOP = array();
|
|
foreach( $JIJI as $JI ) $OOP[] = "[{$JI['id']},'".$Labels->getLabel($JI['name'])."']";
|
|
echo implode(',', $OOP );
|
|
?>]
|
|
}),
|
|
valueField: 'az_t',
|
|
displayField: 'az_txt',
|
|
value: 1,
|
|
listeners:{
|
|
select: function( t, r, i ){
|
|
var n = r.data.az_t;
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getFilterInfo.php',
|
|
params: {
|
|
FID: n,
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>'
|
|
},
|
|
success: function( response, opts ){
|
|
Ext.getCmp('filt_infopan').update( response.responseText );
|
|
}
|
|
});
|
|
}
|
|
}
|
|
},{
|
|
xtype: 'panel',
|
|
id: 'filt_infopan',
|
|
html: ''
|
|
}]
|
|
}],
|
|
bbar:[{
|
|
text: "<?=$Labels->GetLabel( '_CANCEL_' );?>",
|
|
handler: function(){
|
|
addFilterWindow.close();
|
|
}
|
|
},{
|
|
text: "<?=$Labels->GetLabel( '_ADD_' );?>",
|
|
handler: function(){
|
|
var mtyp = Ext.getCmp('flt_type').getValue();
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/addFilter.php',
|
|
params: {
|
|
SERVID: 1,
|
|
TYPE: mtyp,
|
|
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( data.status == 'ok' ){
|
|
addFilterWindow.close();
|
|
loadFilters();
|
|
} else {
|
|
Ext.Msg.show({
|
|
title: "<?=$Labels->GetLabel("_INFO_MSG_");?>",
|
|
msg: data.message,
|
|
buttons: Ext.Msg.OK,//YESNOCANCEL,
|
|
fn: function(){
|
|
//SettingsLidar3D.hide();
|
|
},
|
|
icon: Ext.MessageBox.INFO //QUESTION
|
|
});
|
|
}
|
|
},
|
|
failure: failureAJAXFunction
|
|
});
|
|
}
|
|
}]
|
|
});
|
|
addFilterWindow.show();
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getFilterInfo.php',
|
|
params: {
|
|
FID: 1,
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>'
|
|
},
|
|
success: function( response, opts ){
|
|
Ext.getCmp('filt_infopan').update( response.responseText );
|
|
}
|
|
});
|
|
};
|
|
|
|
function showSettingsServer(){
|
|
stopStatusUpdater();
|
|
if( contentView.l[3] == undefined ){
|
|
contentView.l[3] = {v:0,p:''};
|
|
};
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getServerSettings.php',
|
|
params: {
|
|
UID: <?=$UserID;?>,
|
|
TYP: contentView.l[3].v,
|
|
SID: '<?=$Session;?>',
|
|
},
|
|
success: function( response, opts ){
|
|
var tData = Ext.decode(response.responseText);
|
|
var tPanel = Ext.getCmp('main_content');
|
|
tPanel.removeAll( true );
|
|
tPanel.add(Ext.decode(tData.content));
|
|
tPanel.doLayout();
|
|
if( contentView.l[3].v == 0 ) serverStatusUpdater();
|
|
},
|
|
failure: failureAJAXFunction
|
|
});
|
|
};
|
|
|
|
function showSettingsInfrastructure(){
|
|
stopStatusUpdater();
|
|
if( contentView.l[3] == undefined ){
|
|
contentView.l[3] = {v:0,p:''};
|
|
};
|
|
var tPanel = Ext.getCmp('main_content');
|
|
tPanel.removeAll( true );
|
|
tPanel.add({
|
|
xtype: 'tabpanel',
|
|
frame: false,
|
|
id: 'node_settings_content',
|
|
border: false,
|
|
activeTab: contentView.l[3].v,
|
|
listeners:{
|
|
tabchange: function( tp, t ){
|
|
switch( t.getId() ){
|
|
case 'lines_tab': {
|
|
stopStatusUpdater();
|
|
loadMetroLines( SelectedLine );
|
|
break;
|
|
};
|
|
case 'stations_tab': {
|
|
stopStatusUpdater();
|
|
loadMetroStations( SelectedLine, SelectedStation );
|
|
break;
|
|
};
|
|
case 'platform_tab':{
|
|
stopStatusUpdater();
|
|
loadMetroStationPlatforms( SelectedStation, SelectedPlatform );
|
|
break;
|
|
};
|
|
case 'modules_tab':{
|
|
stopStatusUpdater();
|
|
loadMetroPlatformModules( SelectedPlatform, SelectedModule );
|
|
break;
|
|
};
|
|
};
|
|
}
|
|
},
|
|
items: [{
|
|
xtype: 'panel',
|
|
id: 'lines_tab',
|
|
title: "<?=$Labels->GetLabel( '_LBL_LINES_' );?>",
|
|
layout: 'hbox',
|
|
items:[{
|
|
xtype: 'panel',
|
|
id: 'lines_container',
|
|
tbar:[{
|
|
text: "<?=$Labels->GetLabel( '_SMM_ADD_LINE_' );?>",
|
|
handler: function(){}
|
|
}],
|
|
flex: 1,
|
|
height: PanelH-15,
|
|
autoScroll: 'auto',
|
|
items:[]
|
|
},{
|
|
xtype: 'panel',
|
|
id: 'line_op_small',
|
|
flex: 1,
|
|
height: PanelH-15,
|
|
layout: 'fit',
|
|
items:[{
|
|
html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
|
|
}]
|
|
}]
|
|
},{
|
|
xtype: 'panel',
|
|
id: 'stations_tab',
|
|
disabled: (SelectedLine == 0 ),
|
|
title: "<?=$Labels->GetLabel( '_LBL_STATIONS_' );?>",
|
|
layout: 'hbox',
|
|
items:[{
|
|
xtype: 'panel',
|
|
id: 'stations_container',
|
|
tbar:[{
|
|
text: "<?=$Labels->GetLabel( '_SMM_ADD_STATION_' );?>",
|
|
handler: addMetroStation
|
|
}],
|
|
flex: 1,
|
|
height: PanelH-15,
|
|
autoScroll: 'auto',
|
|
items:[]
|
|
},{
|
|
xtype: 'panel',
|
|
id: 'station_op_small',
|
|
flex: 1,
|
|
height: PanelH-15,
|
|
layout: 'fit',
|
|
items:[{
|
|
html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
|
|
}]
|
|
}]
|
|
},{
|
|
xtype: 'panel',
|
|
id: 'platform_tab',
|
|
disabled: (SelectedStation == 0),
|
|
title: "<?=$Labels->GetLabel( '_LBL_PLATFORMS_' );?>",
|
|
layout: 'hbox',
|
|
items:[{
|
|
xtype: 'panel',
|
|
id: 'platform_container',
|
|
tbar:[{
|
|
text: "<?=$Labels->GetLabel( '_SMM_ADD_PLATFORM_' );?>",
|
|
handler: addStationPlatform
|
|
}],
|
|
flex: 1,
|
|
height: PanelH-15,
|
|
autoScroll: 'auto',
|
|
items:[]
|
|
},{
|
|
xtype: 'panel',
|
|
id: 'platform_op_small',
|
|
flex: 1,
|
|
height: PanelH-15,
|
|
layout: 'fit',
|
|
items:[{
|
|
html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
|
|
}]
|
|
}]
|
|
},{
|
|
xtype: 'panel',
|
|
id: 'modules_tab',
|
|
disabled: ( SelectedPlatform==0 ),
|
|
title: "<?=$Labels->GetLabel('_MODULES_');?>",
|
|
layout: 'hbox',
|
|
items:[{
|
|
xtype: 'panel',
|
|
id: 'module_container',
|
|
tbar:[{
|
|
id: 'mod_add_btn',
|
|
text: "<?=$Labels->GetLabel( '_ADD_MODULE_' );?>",
|
|
handler: addModule
|
|
}],
|
|
flex: 1,
|
|
height: PanelH-15,
|
|
autoScroll: 'auto',
|
|
items:[]
|
|
},{
|
|
xtype: 'panel',
|
|
id: 'module_op_small',
|
|
flex: 1,
|
|
height: PanelH-15,
|
|
layout: 'fit',
|
|
items:[{
|
|
html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
|
|
}]
|
|
}]
|
|
}]
|
|
});
|
|
tPanel.doLayout();
|
|
oSelectedLine = 0;
|
|
loadMetroLines( SelectedLine );
|
|
};
|
|
|
|
var SNAPE_Icon = L.icon({
|
|
iconUrl: '/style/assets/cursor.png',
|
|
iconSize: [32, 32], // size of the icon
|
|
iconAnchor: [16, 16], // point of the icon which will correspond to marker's location
|
|
popupAnchor: [0, -15] // point from which the popup should open relative to the iconAnchor
|
|
//shadowUrl: 'leaf-shadow.png',
|
|
//shadowSize: [50, 64], // size of the shadow
|
|
//shadowAnchor: [4, 62], // the same for the shadow
|
|
});
|
|
function updateSchemeLocation( e ){
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/doStationOperations.php',
|
|
params: {
|
|
STATION: SelectedStation,
|
|
OPID: 11,
|
|
TYPE: 0,
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>',
|
|
Y: e.target._latlng.lat,
|
|
X: e.target._latlng.lng
|
|
},
|
|
failure: failureAJAXFunction
|
|
});
|
|
};
|
|
function updateGisLocation( e ){
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/doStationOperations.php',
|
|
params: {
|
|
STATION: SelectedStation,
|
|
OPID: 11,
|
|
TYPE: 1,
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>',
|
|
LAT: e.target._latlng.lat,
|
|
LON: e.target._latlng.lng
|
|
},
|
|
failure: failureAJAXFunction
|
|
});
|
|
};
|
|
|
|
var schematic_editor = null;
|
|
function inintSchematicEditor( map_id, x, y ){
|
|
var mapLayers = [];
|
|
if( schematic_editor != null ){
|
|
schematic_editor.off();
|
|
schematic_editor.remove();
|
|
schematic_editor = null;
|
|
};
|
|
schematic_editor = L.map( map_id,{
|
|
crs: L.CRS.Simple,
|
|
attributionControl: false,
|
|
preferCanvas: true,
|
|
zoomControl: true,
|
|
center: [x,y],
|
|
zoom: 0,
|
|
minZoom: -3,
|
|
maxZoom: 0,
|
|
keyboard: false
|
|
});
|
|
var bounds = [[SCHEMATIC_SET.bounds_lx,SCHEMATIC_SET.bounds_ly], [SCHEMATIC_SET.bounds_rx,SCHEMATIC_SET.bounds_ry]];
|
|
var image = L.imageOverlay( SCHEMATIC_SET.layer_url, bounds ).addTo( schematic_editor );
|
|
L.marker([x, y], { draggable: true, icon: SNAPE_Icon, zIndexOffset: 1000, mycustomid: SelectedStation } ).addTo( schematic_editor ).on('dragend', updateSchemeLocation );
|
|
};
|
|
|
|
var gis_editor = null;
|
|
function inintGisEditor( map_id, Lat, Lon ){
|
|
var mapLayers = [];
|
|
if( gis_editor != null ){
|
|
//ToDo: must be moved to Upper Menu changer
|
|
gis_editor.off();
|
|
gis_editor.remove();
|
|
gis_editor = null;
|
|
};
|
|
gis_editor = L.map( map_id,{
|
|
attributionControl: false,
|
|
preferCanvas: true,
|
|
zoomControl: true,
|
|
center: [Lat, Lon],
|
|
/*zoomControl: false,
|
|
zoom: 17,
|
|
minZoom: 17,
|
|
maxZoom: 17,*/
|
|
keyboard: false
|
|
});
|
|
gis_editor.setView([Lat, Lon], 17 );
|
|
//mapLayers[ MAP_SET.name ] = L.tileLayer( MAP_SET.layer_url, {
|
|
// attribution: MAP_SET.attribution,
|
|
// maxNativeZoom: MAP_SET.maxNativeZoom,
|
|
// maxZoom: MAP_SET.maxZoom
|
|
//});
|
|
L.tileLayer( MAP_SET.layer_url, {
|
|
attribution: MAP_SET.attribution,
|
|
attributionControl: false,
|
|
maxNativeZoom: MAP_SET.maxNativeZoom,
|
|
//minZoom: 0,
|
|
maxZoom: MAP_SET.maxZoom
|
|
}).addTo( gis_editor );
|
|
L.marker([Lat, Lon], { draggable: true, icon: SNAPE_Icon, zIndexOffset: 1000, mycustomid: SelectedStation } ).addTo( gis_editor ).on('dragend', updateGisLocation );
|
|
};
|
|
|
|
function editPlatform( s_id ){
|
|
if( oSelectedPlatform ){
|
|
var tt = document.getElementById('PLATFORM_TAG_'+oSelectedPlatform );
|
|
tt.classList.remove('selected_green');
|
|
tt.classList.add('active_green');
|
|
};
|
|
var tt = document.getElementById('PLATFORM_TAG_'+s_id );
|
|
if( tt!= undefined ){
|
|
tt.classList.remove('active_green');
|
|
tt.classList.add('selected_green');
|
|
};
|
|
if( oSelectedPlatform == s_id ) return;
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getPlatformEditor.php',
|
|
params: {
|
|
PID: s_id,
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>'
|
|
},
|
|
success: function( response, opts ){
|
|
var data = Ext.decode( response.responseText );
|
|
var tComp = Ext.getCmp('platform_op_small');
|
|
if( tComp!= null ){
|
|
tComp.removeAll( true );
|
|
tComp.add( data );
|
|
tComp.doLayout();
|
|
};
|
|
oSelectedPlatform = s_id;
|
|
if( SelectedPlatform != s_id ){
|
|
SelectedPlatform = s_id;
|
|
//tComp = Ext.getCmp('btn_unb_station');
|
|
//tComp.setDisabled( false );
|
|
//tComp = Ext.getCmp('btn_del_station');
|
|
//tComp.setDisabled( false );
|
|
tComp = Ext.getCmp('modules_tab');
|
|
tComp.setDisabled( false );
|
|
};
|
|
}
|
|
});
|
|
};
|
|
|
|
function editStation( s_id ){
|
|
if( oSelectedStation ){
|
|
var tt = document.getElementById('STATION_TAG_'+oSelectedStation );
|
|
tt.classList.remove('selected_green');
|
|
tt.classList.add('active_green');
|
|
};
|
|
var tt = document.getElementById('STATION_TAG_'+s_id );
|
|
if( tt!= undefined ){
|
|
tt.classList.remove('active_green');
|
|
tt.classList.add('selected_green');
|
|
};
|
|
if( oSelectedStation == s_id ) return;
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getStationEditor.php',
|
|
params: {
|
|
CID: s_id,
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>'
|
|
},
|
|
success: function( response, opts ){
|
|
var data = Ext.decode( response.responseText );
|
|
var tComp = Ext.getCmp('station_op_small');
|
|
if( tComp!= null ){
|
|
tComp.removeAll( true );
|
|
tComp.add( data );
|
|
tComp.doLayout();
|
|
};
|
|
tComp = Ext.getCmp('btn_unb_station');
|
|
tComp.setDisabled( false );
|
|
tComp = Ext.getCmp('btn_del_station');
|
|
tComp.setDisabled( false );
|
|
oSelectedStation = s_id;
|
|
if( SelectedStation != s_id ){
|
|
SelectedStation = s_id;
|
|
SelectedPlatform = 0;
|
|
SelectedModule = 0;
|
|
tComp = Ext.getCmp('platform_tab');
|
|
tComp.setDisabled( false );
|
|
tComp = Ext.getCmp('modules_tab');
|
|
tComp.setDisabled( true );
|
|
};
|
|
},
|
|
failure: function(){
|
|
}
|
|
});
|
|
};
|
|
|
|
function editLine( l_id ){
|
|
if( oSelectedLine ){
|
|
var tt = document.getElementById('LINE_TAG_'+oSelectedLine );
|
|
if( tt.classList.contains('selected_blue') ){
|
|
tt.classList.remove('selected_blue');
|
|
tt.classList.add('active_blue');
|
|
};
|
|
if( tt.classList.contains('selected_gray') ){
|
|
tt.classList.remove('selected_gray');
|
|
tt.classList.add('active_gray');
|
|
};
|
|
};
|
|
var tt = document.getElementById('LINE_TAG_'+l_id );
|
|
if( tt!= undefined ){
|
|
if( tt.classList.contains('active_blue') ){
|
|
tt.classList.remove('active_blue');
|
|
tt.classList.add('selected_blue');
|
|
};
|
|
if( tt.classList.contains('active_gray') ){
|
|
tt.classList.remove('active_gray');
|
|
tt.classList.add('selected_gray');
|
|
};
|
|
};
|
|
if( oSelectedLine == l_id ) return;
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getLineEditor.php',
|
|
params: {
|
|
LID: l_id,
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>'
|
|
},
|
|
success: function( response, opts ){
|
|
var data = Ext.decode( response.responseText );
|
|
var tComp = Ext.getCmp('line_op_small');
|
|
if( tComp!= null ){
|
|
tComp.removeAll( true );
|
|
tComp.add( data );
|
|
tComp.doLayout();
|
|
};
|
|
tComp = Ext.getCmp('stations_tab');
|
|
tComp.setDisabled( false );
|
|
oSelectedLine = l_id;
|
|
if( SelectedLine != l_id ){
|
|
SelectedLine = l_id;
|
|
SelectedStation = 0;
|
|
SelectedPlatform = 0;
|
|
SelectedModule = 0;
|
|
tComp = Ext.getCmp('platform_tab');
|
|
tComp.setDisabled( true );
|
|
tComp = Ext.getCmp('modules_tab');
|
|
tComp.setDisabled( true );
|
|
};
|
|
}
|
|
});
|
|
};
|
|
|
|
function editSensorHW( cid ){
|
|
SelectedSensor = cid;
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getSensorEditor.php',
|
|
params: {
|
|
CID: SelectedSensor,
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>'
|
|
},
|
|
success: function( response, opts ){
|
|
var data = Ext.decode( response.responseText );
|
|
var tComp = Ext.getCmp('sens_op_small');
|
|
if( data.status == 'ok' ){
|
|
if( tComp!= null ){
|
|
var content = Ext.decode( data.content );
|
|
tComp.removeAll( true );
|
|
tComp.add( content );
|
|
tComp.doLayout();
|
|
};
|
|
} else {
|
|
if( tComp!= null ){
|
|
tComp.removeAll( true );
|
|
tComp.add( data );
|
|
tComp.doLayout();
|
|
};
|
|
};
|
|
},
|
|
failure: function(){
|
|
}
|
|
});
|
|
|
|
};
|
|
|
|
var cameraEditorContent = null;
|
|
function editCamera( cid, etyp ){
|
|
SelectedCam = cid;
|
|
switch( etyp ){
|
|
case 0: cameraEditorContent = Ext.getCmp('dcam_op_small'); break;
|
|
case 1: cameraEditorContent = Ext.getCmp('acam_op_small'); break;
|
|
};
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getCameraEditor.php',
|
|
params: {
|
|
CID: SelectedCam,
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>'
|
|
},
|
|
success: function( response, opts ){
|
|
var data = Ext.decode( response.responseText );
|
|
if( data.status == 'ok' ){
|
|
if( cameraEditorContent!= null ){
|
|
var content = Ext.decode( data.content );
|
|
cameraEditorContent.removeAll( true );
|
|
cameraEditorContent.add( content );
|
|
cameraEditorContent.doLayout();
|
|
};
|
|
} else {
|
|
if( cameraEditorContent!= null ){
|
|
cameraEditorContent.removeAll( true );
|
|
cameraEditorContent.add( data );
|
|
cameraEditorContent.doLayout();
|
|
};
|
|
};
|
|
},
|
|
failure: function(){
|
|
}
|
|
});
|
|
|
|
};
|
|
|
|
function showSettingsUpgrade(){
|
|
stopStatusUpdater();
|
|
|
|
content_lvl1 = 1;
|
|
content_lvl2 = 4;
|
|
var tPanel = Ext.getCmp('main_content');
|
|
tPanel.removeAll( true );
|
|
initial_md5 = '';
|
|
tPanel.add({
|
|
columnWidth: 1.0,
|
|
frame: false,
|
|
border: false,
|
|
items: [{
|
|
frame: false,
|
|
border: false,
|
|
collapsible: false,
|
|
draggable: false,
|
|
layout: 'vbox',
|
|
//layoutConfig: {
|
|
// align : 'stretch',
|
|
// pack : 'start',
|
|
//},
|
|
height: PanelH,
|
|
items:[{
|
|
title: "<?=$Labels->getLabel('_MAP_MONITORING_');?>",
|
|
xtype: 'panel',
|
|
height: PanelH-300,
|
|
//flex: 1,
|
|
frame: true,
|
|
width: '100%',
|
|
border: false,
|
|
layout: {
|
|
type: 'table',
|
|
columns: 2,
|
|
tableAttrs: {
|
|
valign: 'top',
|
|
style: 'valign:top;width:100%;'
|
|
}
|
|
},
|
|
defaults: {
|
|
frame: true,
|
|
border: false,
|
|
height: ( PanelH-400 ) / 2,
|
|
style: 'margin: 5px;width:400px;display:block;'
|
|
},
|
|
items:[{
|
|
title: 'Current System Info',
|
|
width: '100%',
|
|
//flex: 1,
|
|
html: '<p>Current Web Version: <b><?=$ARGUS_WEB_VERSION;?></b></p>'
|
|
},{
|
|
title: 'Tasks',
|
|
//width: 400,
|
|
layout: 'vbox',
|
|
items:[{
|
|
xtype: 'button',
|
|
width: '100%',
|
|
text: 'Create Database Backup',
|
|
handler: function(){
|
|
createNewTask( 2 );
|
|
}
|
|
},{
|
|
xtype: 'button',
|
|
width: '100%',
|
|
text: 'Create Full Snapeshot',
|
|
handler: function(){
|
|
createNewTask( 255 );
|
|
}
|
|
}]
|
|
},{
|
|
title: 'Archives',
|
|
height: 250,
|
|
width: '100%',
|
|
tbar:[{
|
|
text: 'Restore',
|
|
id: 'ar_restore_btn',
|
|
handler: function(){
|
|
createNewTask(1, selectedArchiveRecord.data.file_name );
|
|
}
|
|
},{
|
|
text: 'Download',
|
|
id: 'ar_download_btn',
|
|
handler: function(){
|
|
if( selectedArchiveRecord!= null ){
|
|
window.open( '/lib/php/setup_toolkit/vault/'+selectedArchiveRecord.data.base_version + '/'+ selectedArchiveRecord.data.file_name );
|
|
};
|
|
}
|
|
},{
|
|
text: 'Delete',
|
|
id: 'ar_delete_btn',
|
|
handler: function(){
|
|
createNewTask(100, selectedArchiveRecord.data.file_name );
|
|
}
|
|
}],
|
|
items:[{
|
|
xtype: 'grid',
|
|
id: 'archives_grid',
|
|
border: false,
|
|
frame: false,
|
|
autoScroll: true,
|
|
//width: '100%',
|
|
lazyRender: true,
|
|
height: 210,
|
|
ds: archives_store,
|
|
cm: new Ext.grid.ColumnModel( archivesColModel_ops ),
|
|
sm: new Ext.grid.RowSelectionModel( archivesSelModel_ops ),
|
|
viewConfig: {
|
|
// forceFit: true
|
|
},
|
|
}]
|
|
},{
|
|
title: 'Task Status',
|
|
height: 250,
|
|
//flex: 1,
|
|
items:[{
|
|
xtype: 'spacer',
|
|
height: 4
|
|
},{
|
|
id: 'ctask_status',
|
|
border: true,
|
|
html: ''
|
|
},{
|
|
xtype: 'spacer',
|
|
height: 4
|
|
},{
|
|
xtype: 'textarea',
|
|
id: 'task_log',
|
|
height: ( PanelH-320 ) / 2 - 120,
|
|
style: 'font-size:9px;width:100%;margin-bottom:4px;',
|
|
readOnly: true,
|
|
autoScroll: true,
|
|
value: ''
|
|
},{
|
|
xtype: 'progress',
|
|
id: 'task_progress',
|
|
value: 1.0,
|
|
text: 'idle',
|
|
disabled: true
|
|
}],
|
|
tbar:[{
|
|
text: 'Cancel Task',
|
|
id: 'ch_ta_btn',
|
|
disabled: true,
|
|
handler: deleteNewTask
|
|
}]
|
|
}]
|
|
|
|
},{
|
|
title: '<?=$Labels->getLabel('_UPLOAD_PACKAGE_');?>',
|
|
xtype: 'panel',
|
|
height: 300,
|
|
//flex: 1,
|
|
frame: true,
|
|
border: false,
|
|
//layout: 'vbox',
|
|
items:[{
|
|
xtype:'button',
|
|
id: 'pickfiles',
|
|
width: '100%',
|
|
text: 'Choose File'
|
|
},{
|
|
height: 200,
|
|
xtype: 'grid',
|
|
id: 'upload_grid',
|
|
border: false,
|
|
frame: false,
|
|
mode: 'local',
|
|
lazyRender: true,
|
|
width: '100%',
|
|
autoScroll: true,
|
|
ds: uploads_store,
|
|
cm: new Ext.grid.ColumnModel( fileUploadsColModel_ops ),
|
|
sm: new Ext.grid.RowSelectionModel( fileUploadsSelModel_ops ),
|
|
viewConfig: {
|
|
forceFit: true
|
|
},
|
|
bbar: [{
|
|
text: 'Clear',
|
|
width: '100%',
|
|
handler: function(){
|
|
muploader.splice();
|
|
uploads_store.removeAll();
|
|
}
|
|
}]
|
|
},{
|
|
xtype:'button',
|
|
id: 'umpalumpa',
|
|
width: '100%',
|
|
disabled: true,
|
|
text: 'Upload',
|
|
handler: function(){
|
|
if( muploader!= null ){
|
|
muploader.start();
|
|
};
|
|
}
|
|
}],
|
|
listeners:{
|
|
afterrender: function(){
|
|
muploader = new plupload.Uploader({
|
|
runtimes : 'html5,html4',
|
|
browse_button : Ext.getDom('pickfiles'), // you can pass in id...
|
|
//container: document.getElementById('upupu'), // ... or DOM Element itself
|
|
max_file_size : '1000mb',
|
|
chunk_size: '200kb',
|
|
max_retries: 3,
|
|
multi_selection: false,
|
|
max_file_count: 1,
|
|
// Fake server response here
|
|
url: '/lib/php/setup_toolkit/upload.php',
|
|
//url: "/echo/json",
|
|
|
|
//flash_swf_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/flash/Moxie.cdn.swf',
|
|
//silverlight_xap_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/silverlight/Moxie.cdn.xap',
|
|
filters : [
|
|
//{title : "Image files", extensions : "jpg,gif,png"},
|
|
{title : "Archive files", extensions : "rar,zip,gz,bz2"}
|
|
],
|
|
|
|
init: {
|
|
PostInit: function() {
|
|
//$('filelist').innerHTML = '';
|
|
|
|
//$('uploadfiles').onclick = function() {
|
|
// uploader.start();
|
|
// return false;
|
|
//};
|
|
},
|
|
|
|
FilesAdded: function( up, files ) {
|
|
Ext.getCmp('umpalumpa').enable();
|
|
plupload.each( files, function(file) {
|
|
uploads_store.loadData( [[ uploads_store_id, file.name, file.id, plupload.formatSize( file.size ), 0, 'N' ]], true );
|
|
uploads_store_id++;
|
|
Ext.getCmp('upload_grid').doLayout();
|
|
});
|
|
},
|
|
|
|
UploadProgress: function(up, file) {
|
|
var pb = Ext.getCmp( 'progress_'+file.id );
|
|
if( file.percent < 100 ){
|
|
pb.updateProgress( file.percent / 100, file.percent + '%', false );
|
|
} else {
|
|
pb.updateProgress( 1.0, 'Uploaded', false );
|
|
};
|
|
},
|
|
|
|
Error: function(up, err) {
|
|
Ext.Msg.show({
|
|
title:'Upload Status',
|
|
msg: "Error #" + err.code + ": " + err.message,
|
|
buttons: Ext.Msg.OK,
|
|
icon: Ext.MessageBox.ERROR
|
|
});
|
|
}
|
|
}
|
|
});
|
|
muploader.init();
|
|
}
|
|
}
|
|
}]
|
|
}]
|
|
});
|
|
muploader = null;
|
|
uploads_store.removeAll();
|
|
tPanel.doLayout();
|
|
archives_store.load();//{params:{start:0, limit:50, src: 'arch', fil: selecredActiveSourceFilter }});
|
|
updateTaskStatus();
|
|
tlInterval = window.setInterval( updateTaskStatus, 333 );
|
|
};
|
|
|
|
function loadSensorDetectionSettings( sensid ){
|
|
|
|
Ext.Ajax.request({
|
|
url: '/lib/controller/getSensorDetectionEditor.php',
|
|
params: {
|
|
UID: <?=$UserID;?>,
|
|
SID: '<?=$Session;?>',
|
|
SEN: sensid
|
|
},
|
|
success: function( response, opts ){
|
|
var data = Ext.decode( response.responseText );
|
|
var tComp = Ext.getCmp('main_content');
|
|
if( data.status == 'ok' ){
|
|
if( tComp!= null ){
|
|
var content = Ext.decode( data.content );
|
|
tComp.removeAll( true );
|
|
tComp.add( content );
|
|
tComp.doLayout();
|
|
};
|
|
} else {
|
|
if( tComp!= null ){
|
|
tComp.removeAll( true );
|
|
tComp.add( data );
|
|
tComp.doLayout();
|
|
};
|
|
};
|
|
},
|
|
failure: function(){
|
|
}
|
|
});
|
|
};
|
|
|
|
function initSettingsView(){
|
|
if( tlInterval!= null ){
|
|
window.clearInterval( tlInterval );
|
|
tlInterval = null;
|
|
timelineObj = null;
|
|
};
|
|
var tP = Ext.getCmp('left_side_menu');
|
|
//tP.doLayout();
|
|
//tP.setVisible( false );
|
|
tP.removeAll( true );
|
|
tP.add({
|
|
id: 'sme_inner',
|
|
layout:'accordion',
|
|
//height: PanelH,
|
|
frame: false,
|
|
border: false,
|
|
layoutConfig:{
|
|
animate: true//,
|
|
//activeOnTop: true
|
|
},
|
|
items:[]
|
|
});
|
|
tP.doLayout();
|
|
tP = Ext.getCmp('sme_inner');
|
|
<?php if( $CUser->Data['access'] > 3 ){ ?>
|
|
tP.add({
|
|
title: "<?=$Labels->GetLabel('_SYS_SETTINGS_');?>",
|
|
layout: 'vbox',
|
|
height: 120,
|
|
pack: 'center',
|
|
align : 'strech',
|
|
collapsed: ( contentView.l[1].v != 0 ),
|
|
items:[{
|
|
xtype: 'button',
|
|
width: '100%',
|
|
id:'sys_edit',
|
|
text: "<?=$Labels->GetLabel('_SRV_SETTINGS_');?>",
|
|
enableToggle: true,
|
|
pressed: ( contentView.l[2].v == 0 && contentView.l[1].v == 0 ),
|
|
allowDepress: false,
|
|
toggleGroup: 'sys_settings',
|
|
handler: function(){
|
|
changeContent( 2, 0, '' );
|
|
updateUserContent();
|
|
showSettingsServer();
|
|
}
|
|
}
|
|
<?php if( $CUser->Data['access'] > 4 ){ ?>
|
|
,{
|
|
xtype: 'button',
|
|
width: '100%',
|
|
id:'map_edit',
|
|
text: "<?=$Labels->GetLabel('_IFR_STRUCT_');?>",
|
|
enableToggle: true,
|
|
pressed: ( contentView.l[2].v == 1 && contentView.l[1].v == 0 ),
|
|
allowDepress: false,
|
|
toggleGroup: 'sys_settings',
|
|
handler: function(){
|
|
changeContent( 2, 1, '' );
|
|
updateUserContent();
|
|
showSettingsInfrastructure();
|
|
}
|
|
}
|
|
<?php }; ?>
|
|
]
|
|
});
|
|
|
|
<?php
|
|
}; ?>
|
|
tP.add({
|
|
title: "<?=$Labels->GetLabel('_PROF_SETTINGS_');?>",
|
|
items:[<?php
|
|
$ZIGA = array();
|
|
foreach( $Site_Languages as $SL ){
|
|
if( $SL['id'] == $CUser->Data['language'] ){
|
|
$ZIGA[] = "{ xtype:'button', text:'{$SL['name']}', width: '100%', enableToggle: true, pressed : true, handler: function(){ window.location = '/?Lang={$SL['id']}'; } }";
|
|
} else {
|
|
$ZIGA[] = "{ xtype:'button', text:'{$SL['name']}', width: '100%', handler: function(){ window.location = '/?Lang={$SL['id']}'; } }";
|
|
};
|
|
};
|
|
echo implode(',',$ZIGA );
|
|
?>]
|
|
});
|
|
<?php if( $CUser->Data['access'] > 5 ){ ?>
|
|
tP.add({
|
|
title: "<?=$Labels->GetLabel('_ADM_SETTINGS_');?>",
|
|
collapsed: ( contentView.l[1].v != 3 ),
|
|
items:[{
|
|
xtype: 'button',
|
|
width: '100%',
|
|
id:'adm_acc',
|
|
text: "<?=$Labels->GetLabel('_USERS_MNGMT_');?>",
|
|
enableToggle: true,
|
|
pressed: ( contentView.l[2].v == 0 && contentView.l[1].v == 3 ),
|
|
allowDepress: false,
|
|
toggleGroup: 'adm_settings',
|
|
handler: function( b, e ){
|
|
loadUserEditor();
|
|
}
|
|
},{
|
|
xtype: 'button',
|
|
width: '100%',
|
|
id:'adm_acclog',
|
|
text: "<?=$Labels->GetLabel('_ACC_LOG_');?>",
|
|
enableToggle: true,
|
|
pressed: ( contentView.l[2].v == 1 && contentView.l[1].v == 3 ),
|
|
allowDepress: false,
|
|
toggleGroup: 'adm_settings',
|
|
handler: function( b, e ){
|
|
loadAccessLog();
|
|
}
|
|
},{
|
|
xtype: 'button',
|
|
width: '100%',
|
|
id:'adm_servlog',
|
|
text: "<?=$Labels->GetLabel('_SERV_LOG_');?>",
|
|
enableToggle: true,
|
|
pressed: ( contentView.l[2].v == 2 && contentView.l[1].v == 3 ),
|
|
allowDepress: false,
|
|
toggleGroup: 'adm_settings',
|
|
handler: function( b, e ){
|
|
loadServerLog();
|
|
}
|
|
}]
|
|
});
|
|
<?php
|
|
};
|
|
?>
|
|
tP.setVisible( true );
|
|
tP.doLayout();
|
|
switch( contentView.l[1].v ){
|
|
default:{
|
|
switch( contentView.l[2].v ){
|
|
default: showSettingsServer(); break;
|
|
<?php if( $CUser->Data['access'] > 5 ){ ?>
|
|
case 1: showSettingsInfrastructure(); break;
|
|
<?php }; ?>
|
|
//case 4: showSettingsUpgrade(); break;
|
|
};
|
|
};
|
|
case 1:{
|
|
switch( contentView.l[2].v ){
|
|
case 0: break;
|
|
};
|
|
break;
|
|
};
|
|
<?php if( $CUser->Data['access'] > 5 ){ ?>
|
|
case 3:{
|
|
switch( contentView.l[2].v ){
|
|
case 0: loadUserEditor(); break;
|
|
};
|
|
break;
|
|
};
|
|
<?php }; ?>
|
|
};
|
|
};
|