2 Commits

  1. 1
      files.list
  2. 2
      lib/1.json
  3. 87
      lib/controller/doModuleOperations.php
  4. 43
      lib/controller/doPlatformOperations.php
  5. 178
      lib/controller/getAddModuleWindow.php
  6. 15
      lib/controller/getModuleEditor.php
  7. 57
      lib/controller/getPlatformEditor.php
  8. 486
      lib/controller/getScadaEditor.php
  9. 36
      lib/controller/getScadaStatus.php
  10. 59
      lib/javascript/jsapi_dynamic/argus_settings.js

1
files.list

@ -3581,6 +3581,7 @@
./lib/install.php
./lib/controller
./lib/controller/getLines.php
./lib/controller/getScadaStatus.php
./lib/controller/doSessionOperations.php
./lib/controller/getMonitoringModuleView.php
./lib/controller/getApplicationSettings.php

2
lib/1.json
File diff suppressed because it is too large
View File

87
lib/controller/doModuleOperations.php

@ -143,6 +143,12 @@
$DATABASE->Query( $QS );
exit();
};
case 15:{
$EIP = $DATABASE->escape( $_POST['OPCODE'] );
$QS = "UPDATE `metro_modules` SET `name`='{$EIP}' WHERE `id`={$ModuleID}";
$DATABASE->Query( $QS );
exit();
};
case 200:{ // Delete Module
$QS = "SELECT * FROM `metro_modules` WHERE `id`={$ModuleID}";
$RR = $DATABASE->Query( $QS );
@ -181,9 +187,9 @@
if( count( $RR ) ){
$DATA['status']='ok';
$TID = intval( $RR[0]['id'] );
if( $PLO == 'C' ){//Regular Island
if( $PLOC == 'B' ){//Bottom Track
if( $TLOC == 'R' ){//Right
switch( $PLO ){
case 'A':{
if( $TLOC == 'L' ){//Left
$QS = "INSERT INTO `metro_modules` SET `track_id`={$TID}, `side`='F', `status`='D', `name`='$NAME', `IP4`='$IP4', `identity`='{$IDENT}'";
$DATABASE->Query( $QS );
$MID = $DATABASE->getLastInsertID();
@ -196,8 +202,10 @@
$QS = "UPDATE `metro_tracks` SET `near_module_id`={$MID} WHERE `id`={$TID}";
$DATABASE->Query( $QS );
};
} else {
if( $TLOC == 'L' ){//Left
break;
};
case 'B':{
if( $TLOC == 'R' ){//Right
$QS = "INSERT INTO `metro_modules` SET `track_id`={$TID}, `side`='F', `status`='D', `name`='$NAME', `IP4`='$IP4', `identity`='{$IDENT}'";
$DATABASE->Query( $QS );
$MID = $DATABASE->getLastInsertID();
@ -210,7 +218,74 @@
$QS = "UPDATE `metro_tracks` SET `near_module_id`={$MID} WHERE `id`={$TID}";
$DATABASE->Query( $QS );
};
};
break;
};
case 'E':
case 'C':{//Regular Island
if( $PLOC == 'B' ){//Bottom Track
if( $TLOC == 'R' ){//Right
$QS = "INSERT INTO `metro_modules` SET `track_id`={$TID}, `side`='F', `status`='D', `name`='$NAME', `IP4`='$IP4', `identity`='{$IDENT}'";
$DATABASE->Query( $QS );
$MID = $DATABASE->getLastInsertID();
$QS = "UPDATE `metro_tracks` SET `far_module_id`={$MID} WHERE `id`={$TID}";
$DATABASE->Query( $QS );
} else {
$QS = "INSERT INTO `metro_modules` SET `track_id`={$TID}, `side`='N', `status`='D', `name`='$NAME', `IP4`='$IP4', `identity`='{$IDENT}'";
$DATABASE->Query( $QS );
$MID = $DATABASE->getLastInsertID();
$QS = "UPDATE `metro_tracks` SET `near_module_id`={$MID} WHERE `id`={$TID}";
$DATABASE->Query( $QS );
};
} else {
if( $TLOC == 'L' ){//Left
$QS = "INSERT INTO `metro_modules` SET `track_id`={$TID}, `side`='F', `status`='D', `name`='$NAME', `IP4`='$IP4', `identity`='{$IDENT}'";
$DATABASE->Query( $QS );
$MID = $DATABASE->getLastInsertID();
$QS = "UPDATE `metro_tracks` SET `far_module_id`={$MID} WHERE `id`={$TID}";
$DATABASE->Query( $QS );
} else {
$QS = "INSERT INTO `metro_modules` SET `track_id`={$TID}, `side`='N', `status`='D', `name`='$NAME', `IP4`='$IP4', `identity`='{$IDENT}'";
$DATABASE->Query( $QS );
$MID = $DATABASE->getLastInsertID();
$QS = "UPDATE `metro_tracks` SET `near_module_id`={$MID} WHERE `id`={$TID}";
$DATABASE->Query( $QS );
};
};
break;
};
case 'F':
case 'D':{//Regular Island - RHD
if( $PLOC == 'B' ){//Bottom Track
if( $TLOC == 'L' ){//Left
$QS = "INSERT INTO `metro_modules` SET `track_id`={$TID}, `side`='F', `status`='D', `name`='$NAME', `IP4`='$IP4', `identity`='{$IDENT}'";
$DATABASE->Query( $QS );
$MID = $DATABASE->getLastInsertID();
$QS = "UPDATE `metro_tracks` SET `far_module_id`={$MID} WHERE `id`={$TID}";
$DATABASE->Query( $QS );
} else {
$QS = "INSERT INTO `metro_modules` SET `track_id`={$TID}, `side`='N', `status`='D', `name`='$NAME', `IP4`='$IP4', `identity`='{$IDENT}'";
$DATABASE->Query( $QS );
$MID = $DATABASE->getLastInsertID();
$QS = "UPDATE `metro_tracks` SET `near_module_id`={$MID} WHERE `id`={$TID}";
$DATABASE->Query( $QS );
};
} else {
if( $TLOC == 'R' ){//Right
$QS = "INSERT INTO `metro_modules` SET `track_id`={$TID}, `side`='F', `status`='D', `name`='$NAME', `IP4`='$IP4', `identity`='{$IDENT}'";
$DATABASE->Query( $QS );
$MID = $DATABASE->getLastInsertID();
$QS = "UPDATE `metro_tracks` SET `far_module_id`={$MID} WHERE `id`={$TID}";
$DATABASE->Query( $QS );
} else {
$QS = "INSERT INTO `metro_modules` SET `track_id`={$TID}, `side`='N', `status`='D', `name`='$NAME', `IP4`='$IP4', `identity`='{$IDENT}'";
$DATABASE->Query( $QS );
$MID = $DATABASE->getLastInsertID();
$QS = "UPDATE `metro_tracks` SET `near_module_id`={$MID} WHERE `id`={$TID}";
$DATABASE->Query( $QS );
};
};
break;
};
};
} else {
$DATA['msg']='Wrong Track ID Provided!';

43
lib/controller/doPlatformOperations.php

@ -31,7 +31,7 @@
$PID = $DATABASE->getLastInsertID();
if( $PID ){
if( $LAY == 'A' || $LAY == 'B' ){
$QS = "INSERT INTO `metro_tracks`(`platform_id`,`name`,`short`) VALUES({$PID},{$UP_TRN},{$UP_TRA})";
$QS = "INSERT INTO `metro_tracks`(`platform_id`,`side`,`name`,`short`) VALUES({$PID},'U','{$UP_TRN}','{$UP_TRA}')";
$DATABASE->Query( $QS );
} else {
$QS = "INSERT INTO `metro_tracks`(`platform_id`,`side`,`name`,`short`) VALUES({$PID},'U','{$UP_TRN}','{$UP_TRA}')";
@ -39,8 +39,8 @@
$QS = "INSERT INTO `metro_tracks`(`platform_id`,`side`,`name`,`short`) VALUES({$PID},'B','{$BT_TRN}','{$BT_TRA}')";
$DATABASE->Query( $QS );
};
$QS="INSERT INTO `modbus_modules` SET `platform_id`={$PID}";
$DATABASE->Query( $QS );
//$QS="INSERT INTO `modbus_modules` SET `platform_id`={$PID}";
//$DATABASE->Query( $QS );
$Data['success'] = true;
$LOG->reg_op( $_POST );
};
@ -372,7 +372,20 @@
$LOG->reg_op( $_POST );
break;
};
case 19:{ // Change Layout
case 19:{//Delete Scada Module
$SCA = intval( $_POST['SCA'] );
if( $OID == 0 ) {
$Data['msg']='Wrong Parameters!';
echo json_encode( $Data );
exit();
};
$QS="DELETE FROM `modbus_modules` WHERE `platform_id`={$OID} AND `id`={$SCA}";
$DATABASE->Query( $QS );
$Data['success'] = true;
$LOG->reg_op( $_POST );
break;
};
case 20:{ // Change Layout
if( $OID == 0 ) {
$Data['msg']='Wrong Parameters!';
echo json_encode( $Data );
@ -385,6 +398,28 @@
$LOG->reg_op( $_POST );
break;
};
case 200:{ //Remove Platform
if( $OID ){
$QS = "SELECT `id` FROM `metro_tracks` WHERE `platform_id`={$OID}";
$RR = $DATABASE->Query( $QS, false );
foreach( $RR as $R ){
$QS = "DELETE FROM `metro_modules` WHERE `track_id`={$R['id']}";
$DATABASE->Query( $QS );
$QS = "DELETE FROM `sessions` WHERE `track_id`={$R['id']}";
$DATABASE->Query( $QS );
//Remove Report Folder for that track id
};
$QS = "DELETE FROM `metro_tracks` WHERE `platform_id`={$OID}";
$DATABASE->Query( $QS );
$QS = "DELETE FROM `metro_platforms` WHERE `id`={$OID}";
$DATABASE->Query( $QS );
$Data['success'] = true;
$LOG->reg_op( $_POST );
};
break;
};
};
} else {
$Data['msg']='Wrong Parameters!';

178
lib/controller/getAddModuleWindow.php

@ -164,7 +164,183 @@ DATA_BOUNDARY;
};
echo $WTPL;
} else {
echo '{ xtype: \'panel\', html: \'No Tracks On Platform!\'}';
$QS = "SELECT * FROM `metro_platforms` WHERE `id`={$PID}";
$RR = $DATABASE->Query( $QS, false );
$UP_TRN = "Platform_{$PID}_UTR";
$BT_TRN = "Platform_{$PID}_BTR";
$UP_TRA = "{$PID}_UTR";
$BT_TRA = "{$PID}_BTR";
if( $RR[0]['layout'] == 'A' || $LAY == 'B' ){
$QS = "INSERT INTO `metro_tracks`(`platform_id`,`side`,`name`,`short`) VALUES({$PID},'U','{$UP_TRN}','{$UP_TRA}')";
$DATABASE->Query( $QS );
} else {
$QS = "INSERT INTO `metro_tracks`(`platform_id`,`side`,`name`,`short`) VALUES({$PID},'U','{$UP_TRN}','{$UP_TRA}')";
$DATABASE->Query( $QS );
$QS = "INSERT INTO `metro_tracks`(`platform_id`,`side`,`name`,`short`) VALUES({$PID},'B','{$BT_TRN}','{$BT_TRA}')";
$DATABASE->Query( $QS );
};
$QS = "SELECT * FROM `metro_tracks` WHERE `platform_id`={$PID}";
$RR = $DATABASE->Query( $QS, false );
if( count( $RR ) ){
$MODS = array();
$ATN = '';
$ATS = '';
$BTN = '';
$BTS = '';
foreach( $RR as $CT ){
if( $CT['side'] == 'U' ){
$FID = intval( $CT['far_module_id'] );
$NID = intval( $CT['near_module_id'] );
if( !$FID ) $MODS['UL']=$CT['id'];
if( !$NID ) $MODS['UR']=$CT['id'];
$ATN = $CT['name'];
$ATS = $CT['short'];
} else {
$FID = intval( $CT['far_module_id'] );
$NID = intval( $CT['near_module_id'] );
if( !$FID ) $MODS['BR']=$CT['id'];
if( !$NID ) $MODS['BL']=$CT['id'];
$BTN = $CT['name'];
$BTS = $CT['short'];
};
};
//If no mods = all are defined
if( count( $MODS ) ){
$PAPA = array();
$LOCK = count( $MODS );
$CVAL = '';
foreach( $MODS as $KEY=>$VALUE ){
$PAPA[] = "['".$KEY . "','" .$Labels->GetLabel( 'MOD_LOC_'.$KEY ) . "','" .'/style/assets/ms_'.strtolower( $KEY ).".png']";
if( $CVAL == '' ) $CVAL = $KEY;
};
$CDATA = implode(',', $PAPA );
$WTPL =<<<DATA_BOUNDARY
{
id: 'huba_buba',
title: "{$Labels->GetLabel( '_ADD_MODULE_' )}",
modal: true,
resizable: false,
width: 450,
height: 290,
items:[{
xtype: 'form',
labelWidth: 150,
labelAlign: 'right',
items: [{
xtype: 'textfield',
fieldLabel: "{$Labels->GetLabel( 'MOD_NAME' )}",
id: 'mod_name',
width: 200,
},{
xtype: 'textfield',
fieldLabel: "{$Labels->GetLabel( 'MOD_IP' )}",
id: 'mod_ip',
width: 200,
},{
xtype: 'textfield',
fieldLabel: "{$Labels->GetLabel( 'MOD_IDENT' )}",
id: 'mod_id',
width: 200,
},{
xtype: 'combo',
fieldLabel: "{$Labels->GetLabel( 'MOD_LOCATION' )}",
id: 'mod_loc',
width: 200,
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
readOnly: ({$LOCK}==1),
disableKeyFilter: true,
tpl:'<tpl for="."><div class="x-combo-list-item"><img width="16px" src="{icon}"/>&nbsp;{name}</div></tpl>',
store: new Ext.data.ArrayStore({
fields: ['abbr','name','icon'],
data: [{$CDATA}]
}),
valueField: 'abbr',
displayField: 'name',
value: '{$CVAL}',
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'
});
},
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: 'panel',
id: 'infopan',
html: '<table width="100%" border=1><tr><td class="mod_sch_ucell">{$ATN}[{$ATS}]</td></tr><tr><td class="mod_sch_bcell">{$BTN}[{$BTS}]</td></tr></table>'
}]
}],
bbar:[{
text: '{$Labels->GetLabel( '_CANCEL_' )}',
handler: function(){
var tt = Ext.getCmp('huba_buba');
tt.close();
}
},{
text: '{$Labels->GetLabel( '_ADD_' )}',
handler: function(){
var name = Ext.getCmp('mod_name').getValue();
var addr = Ext.getCmp('mod_ip').getValue();
var iden = Ext.getCmp('mod_id').getValue();
var loca = Ext.getCmp('mod_loc').getValue();
Ext.Ajax.request({
url: '/lib/controller/doModuleOperations.php',
params: {
OPID: 300,
NAM: name,
I4P: addr,
PID: {$PID},
IDT: iden,
LOC: loca,
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' ){
addModuleWindow.close();
loadModules();
} else {
Ext.Msg.show({
title: "{$Labels->GetLabel("_INFO_MSG_")}",
msg: data.msg,
buttons: Ext.Msg.OK,//YESNOCANCEL,
fn: function(){
//SettingsLidar3D.hide();
},
icon: Ext.MessageBox.INFO //QUESTION
});
}
},
failure: failureAJAXFunction
});
}
}]
}
DATA_BOUNDARY;
};
echo $WTPL;
} else {
echo '{ xtype: \'panel\', html: \'Error Creating Tracks On Platform (to fix)!\'}';
};
};
} else {
header('location: /');

15
lib/controller/getModuleEditor.php

@ -23,6 +23,7 @@
fn: function(btn){
if( btn == 'yes' ){
SelectedModule = 0;
oSelectedModule = 0;
doModuleOperation( {$CR['id']}, 200, '', true );
};
},
@ -43,7 +44,21 @@ DATA_BOUNDARY;
activeTab: 0,
items:[{
title: 'General',
xtype: 'form',
labelWidth: 200,
border: false,
frame: false,
labelAlign: 'right',
items:[{
xtype: 'textfield',
fieldLabel: 'Module Label',
value: '{$CR['name']}',
listeners:{
change: function( a, c, b ){
doModuleOperation( {$CR['id']}, 15, c, true );
}
}
},{
xtype: 'button',
text: '{$Labels->GetLabel('_OP_MODULE_CTRL_')}',
width: '100%',

57
lib/controller/getPlatformEditor.php

@ -13,17 +13,18 @@
border: false,
frame: false,
tbar:[{
id: 'btn_del_station',
id: 'btn_del_platform',
text: '{$Labels->GetLabel('_SMM_DEL_PLATFORM_')}',
handler: function(){
Ext.Msg.show({
title:'{$Labels->GetLabel('_REMOVE_MODULE_')}?',
msg: '{$Labels->GetLabel('_REMOVE_MODU_QUES_')}?',
title:'{$Labels->GetLabel('_REMOVE_PLATFORM_')}?',
msg: '{$Labels->GetLabel('_REMOVE_PLAT_QUES_')}?',
buttons: Ext.Msg.OKCANCEL,
fn: function(btn){
if( btn == 'ok' ){
SelectedModule = 0;
doModuleOperation( {$CR['id']}, 200, '', true );
SelectedPlatform = 0;
oSelectedPlatform = 0;
doPlatformOperation( {$CR['id']}, 200, '', true );
};
},
icon: Ext.MessageBox.QUESTION
@ -62,7 +63,7 @@ JOJOKA;
if( $COS ) $COS = "rowspan={$COS} "; else $COS="";
$TRB = "<td width=\"120px\" {$COS} class=\"_infoPanel\" style=\"color:#fff; font-weight: bold; background-color:#000; text-align: center;\">&nbsp;</td>";
};
$INFO = '<table width="100%" border=0><tr><td width="130px" align="right">'.$Labels->GetLabel('_SMM_PAT_LEVEL_').':</td><td><div class="level_label">'.$CR['level'].'</div></td></tr><tr><td width="130px" align="right">'.$Labels->GetLabel('_LBL_TRACKS_').':</td><td>'.$TCO.'</td></tr><tr><td align="right">'.$Labels->GetLabel('_MODULES_').':</td><td>'. ( $TCO * 2 ) .'</td></tr></table>';
$INFO = '<table width="100%" border=0><tr><td width="130px" align="right">'.$Labels->GetLabel('_SMM_PAT_LEVEL_').':</td><td><div class="level_label">'.$CR['level'].'</div></td><!--/tr><tr--><td width="130px" align="right">'.$Labels->GetLabel('_LBL_TRACKS_').':</td><td>'.$TCO.'</td><!--/tr><tr--><td align="right">'.$Labels->GetLabel('_MODULES_').':</td><td>'. ( $TCO * 2 ) .'</td></tr></table>';
$QS = "SELECT `sl`.`line_id`, `ln`.`short`,`ln`.`color`,`ln`.`name`,`sl`.`index` FROM `metro_lines` `ln` LEFT JOIN `metro_stations_2_lines` `sl` ON ( `ln`.`id`=`sl`.`line_id` ) WHERE `sl`.`station_id`={$CR['station_id']} ORDER BY `ln`.`short`";
$Sz = $DATABASE->Query( $QS, false );
@ -199,7 +200,7 @@ JOJOKA;
},{
xtype: 'combo',
fieldLabel: "Platform Type",
id: 'pl_lay',
id: 'pl_lay_A',
width: 200,
lazyRender: true,
mode: 'local',
@ -216,16 +217,42 @@ JOJOKA;
valueField: 'abbr',
displayField: 'name',
value: '{$CR['layout']}',
init_value: '{$CR['layout']}',
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'
});
doPlatformOperation( {$CR['id']}, 19, r.data.abbr, true );
if( r.data.abbr < 'C' && t.init_value > 'B' ){
Ext.Msg.show({
title:'{$Labels->GetLabel('_REMOVE_PLATFORM_')}?',
msg: '{$Labels->GetLabel('_REMOVE_PLAT_QUES_')}?',
buttons: Ext.Msg.OKCANCEL,
fn: function(btn){
if( btn == 'ok' ){
doPlatformOperation( {$CR['id']}, 20, r.data.abbr, true );
} else {
t.suspendEvents();
t.setValue( t.init_value, true );
t.resumeEvents();
t.getEl().setStyle({
'background-image': 'url(' + t.store.data.items[t.store.findExact( 'abbr', t.init_value )].data.icon + ')',
'background-repeat': 'no-repeat',
'background-position': '3px center',
'background-size': '16px 16px',
'padding-left': '25px'
});
};
},
icon: Ext.MessageBox.QUESTION
});
} else {
t.getEl().setStyle({
'background-image': 'url(' + r.data.icon + ')',
'background-repeat': 'no-repeat',
'background-position': '3px center',
'background-size': '16px 16px',
'padding-left': '25px'
});
doPlatformOperation( {$CR['id']}, 20, r.data.abbr, true );
};
},
afterrender: function( t ){
t.getEl().setStyle({

486
lib/controller/getScadaEditor.php

@ -15,149 +15,50 @@
$MODBUS=<<<DATA_BOUNDARY
{
xtype: 'panel',
layout: 'table',
l00ayout: 'table',
border: false,
frame: false,
width: '100%',
defaults: {
// applied to each contained panel
bodyStyle:'padding:10px; text-align: center;'
},
layoutConfig: {
// The total column count must be specified here
columns: 2
},
items:[{
xtype: 'panel',
layout: 'table',
border: false,
frame: false,
rowspan: 2,
html: '<table width="100%" border=0><tr><td class="small_prop_logo" id="adam">&nbsp;</td></tr></table>'
},{
xtype: 'form',
labelWidth: 150,
labelAlign: 'right',
width: '100%',
defaults: { bodyStyle:'padding:10px; text-align: center;'},
layoutConfig: { columns: 2 },
items:[{
xtype: 'panel',
border: false,
frame: false,
html: '<table width="100%" border=0><tr><td class="small_prop_title" align="center" style="font-size: 14px; font-weight: bold;">{$Labels->GetLabel('_MODBUS_RTU_')}:{$SC['label']}</td></tr></table>'
},{
xtype: 'textfield',
id: 'sca_label',
fieldLabel: '{$Labels->GetLabel('_NAME_LABEL_')}',
maxlength: 64,
value: '{$SC['label']}',
listeners:{
change: function( a, c, b ){
doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 14, c, true );
}
}
},{
xtype: 'combo',
id: 'sca_ena',
fieldLabel: "{$Labels->GetLabel('_STATUS_')}",
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
['D','{$Labels->GetLabel('__DISABLED__')}'],
['E','{$Labels->GetLabel('___ENABLED__')}']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: '{$SC['wm']}',
fwidth: 200,
listeners:{
select: function( a, c, b ){
doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 17, b, true );
}
}
},{
xtype: 'textfield',
id: 'sca_ip',
fieldLabel: '{$Labels->GetLabel('_DEVICE_IP_')}',
maxlength: 64,
value: '{$SC['ip4']}',
listeners:{
change: function( a, c, b ){
doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 15, c, true );
}
}
},{
xtype: 'textfield',
id: 'sca_port',
fieldLabel: '{$Labels->GetLabel('_DEVICE_PORT_')}',
maxlength: 2,
value: '{$SC['port']}',
listeners:{
change: function( a, c, b ){
doPlatformOperation( {$SC['platform_id']}, 16, c, true );
}
}
html: '<table width="100%" border=0><tr><td class="small_prop_logo" id="adam">&nbsp;</td></tr></table>'
},{
xtype: 'panel',
layout: 'table',
xtype: 'form',
border: false,
frame: false,
labelWidth: 150,
labelAlign: 'right',
width: '100%',
defaults: {
// applied to each contained panel
bodyStyle:'padding:10px; text-align: center;'
},
layoutConfig: {
// The total column count must be specified here
columns: 4
},
items:[{
xtype: 'panel',
bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;',
html: 'Upper Track'
},{
xtype: 'panel',
bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;',
html: 'Bottom Track'
border: false,
frame: false,
html: '<table width="100%" border=0><tr><td class="small_prop_title" align="center" style="font-size: 14px; font-weight: bold;">{$Labels->GetLabel('_MODBUS_RTU_')}:{$SC['label']}</td><td><img id="scae_onl_sts" src="/style/assets/bul_gray.png"></td></tr></table>'
},{
xtype: 'panel',
bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;',
html: 'Health Signal'
},{
xtype: 'panel',
bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;',
html: 'AUX Signal'
},{
xtype: 'combo',
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
[-1,'{$Labels->GetLabel('__DISABLED__')}'],
[0,'Coil D1'],[1,'Coil D2'],[2,'Coil D3'],[3,'Coil D4']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: '{$SC['crossbar_a']}',
width: 100,
xtype: 'textfield',
id: 'sca_label',
fieldLabel: '{$Labels->GetLabel('_NAME_LABEL_')}',
maxlength: 64,
value: '{$SC['label']}',
listeners:{
select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true );
change: function( a, c, b ){
doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 14, c, true );
}
}
},{
xtype: 'combo',
id: 'sca_ena',
fieldLabel: "{$Labels->GetLabel('_STATUS_')}",
lazyRender: true,
mode: 'local',
forceSelection: true,
@ -167,150 +68,265 @@
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
[-1,'{$Labels->GetLabel('__DISABLED__')}'],
[0,'Coil D1'],[1,'Coil D2'],[2,'Coil D3'],[3,'Coil D4']
['D','{$Labels->GetLabel('__DISABLED__')}'],
['E','{$Labels->GetLabel('___ENABLED__')}']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: '{$SC['crossbar_b']}',
width: 100,
value: '{$SC['wm']}',
width: 200,
listeners:{
select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true );
doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 17, b, true );
}
}
},{
xtype: 'combo',
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
[-1,'{$Labels->GetLabel('__DISABLED__')}'],
[0,'Coil D1'],[1,'Coil D2'],[2,'Coil D3'],[3,'Coil D4']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: '{$SC['crossbar_c']}',
width: 100,
xtype: 'textfield',
id: 'sca_ip',
fieldLabel: '{$Labels->GetLabel('_DEVICE_IP_')}',
maxlength: 64,
value: '{$SC['ip4']}',
listeners:{
select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true );
change: function( a, c, b ){
doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 15, c, true );
}
}
},{
xtype: 'combo',
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
[-1,'{$Labels->GetLabel('__DISABLED__')}'],
[0,'Coil D1'],[1,'Coil D2'],[2,'Coil D3'],[3,'Coil D4']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: '{$SC['crossbar_d']}',
width: 100,
xtype: 'textfield',
id: 'sca_port',
fieldLabel: '{$Labels->GetLabel('_DEVICE_PORT_')}',
maxlength: 2,
value: '{$SC['port']}',
listeners:{
select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true );
change: function( a, c, b ){
doPlatformOperation( {$SC['platform_id']}, 16, c, true );
}
}
},{
xtype: 'spacer',
height: 10,
colspan: 4
},{
xtype: 'panel',
colspan: 4,
bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;',
html: 'TEST MODBUS MODULE COILS'
},{
xtype: 'spacer',
height: 5,
colspan: 4
},{
xtype: 'button',
enableToggle: true,
allowDepress: true,
width: '80%',
text: 'Test D1',
pressed: {$P1},
handler: function( b, e ){
if( b.pressed ){
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} | 1 ), true );
} else {
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} & ( ~1 ) ), true );
};
}]
}]
},{
xtype: 'panel',
layout: 'table',
border: true,
frame: false,
width: '100%',
defaults: { bodyStyle:'padding:10px; text-align: center;' },
layoutConfig: { columns: 4 },
items:[{
xtype: 'panel',
bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;',
html: 'Upper Track'
},{
xtype: 'panel',
bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;',
html: 'Bottom Track'
},{
xtype: 'panel',
bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;',
html: 'Health Signal'
},{
xtype: 'panel',
bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;',
html: 'AUX Signal'
},{
xtype: 'combo',
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
[-1,'{$Labels->GetLabel('__DISABLED__')}'],
[0,'Coil D1'],[1,'Coil D2'],[2,'Coil D3'],[3,'Coil D4']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: '{$SC['crossbar_a']}',
width: 120,
listeners:{
select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true );
}
},{
xtype: 'button',
width: '80%',
enableToggle: true,
allowDepress: true,
text: 'Test D2',
pressed: {$P2},
handler: function( b, e ){
if( b.pressed ){
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} | 2 ), true );
} else {
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} & ( ~2 ) ), true );
};
}
},{
xtype: 'combo',
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
[-1,'{$Labels->GetLabel('__DISABLED__')}'],
[0,'Coil D1'],[1,'Coil D2'],[2,'Coil D3'],[3,'Coil D4']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: '{$SC['crossbar_b']}',
width: 120,
listeners:{
select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true );
}
},{
xtype: 'button',
enableToggle: true,
allowDepress: true,
width: '80%',
text: 'Test D3',
pressed: {$P3},
handler: function( b, e ){
if( b.pressed ){
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} | 4 ), true );
} else {
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} & ( ~4 ) ), true );
};
}
},{
xtype: 'combo',
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
[-1,'{$Labels->GetLabel('__DISABLED__')}'],
[0,'Coil D1'],[1,'Coil D2'],[2,'Coil D3'],[3,'Coil D4']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: '{$SC['crossbar_c']}',
width: 120,
listeners:{
select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true );
}
},{
xtype: 'button',
enableToggle: true,
allowDepress: true,
width: '80%',
text: 'Test D4',
pressed: {$P4},
handler: function( b, e ){
if( b.pressed ){
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} | 8 ), true );
} else {
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} & ( ~8 ) ), true );
};
}
},{
xtype: 'combo',
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
[-1,'{$Labels->GetLabel('__DISABLED__')}'],
[0,'Coil D1'],[1,'Coil D2'],[2,'Coil D3'],[3,'Coil D4']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: '{$SC['crossbar_d']}',
width: 120,
listeners:{
select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true );
}
}]
}
},{
xtype: 'spacer',
height: 10,
colspan: 4
},{
xtype: 'panel',
colspan: 4,
bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;',
html: 'TEST MODBUS MODULE COILS'
},{
xtype: 'spacer',
height: 5,
colspan: 4
},{
xtype: 'button',
text: 'Remove this Scada Module',
width: '100%',
handler: function(){
doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 13, 'true', true );
id: 'sc_tbtn_1',
enableToggle: true,
allowDepress: true,
width: '80%',
text: 'Test D1',
pressed: {$P1},
handler: function( b, e ){
b.disable();
if( b.pressed ){
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} | 1 ), false );
} else {
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} & ( ~1 ) ), false );
};
}
},{
xtype: 'button',
id: 'sc_tbtn_2',
width: '80%',
enableToggle: true,
allowDepress: true,
text: 'Test D2',
pressed: {$P2},
handler: function( b, e ){
b.disable();
if( b.pressed ){
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} | 2 ), false );
} else {
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} & ( ~2 ) ), false );
};
}
},{
xtype: 'button',
id: 'sc_tbtn_3',
enableToggle: true,
allowDepress: true,
width: '80%',
text: 'Test D3',
pressed: {$P3},
handler: function( b, e ){
b.disable();
if( b.pressed ){
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} | 4 ), false );
} else {
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} & ( ~4 ) ), false );
};
}
},{
xtype: 'button',
id: 'sc_tbtn_4',
enableToggle: true,
allowDepress: true,
width: '80%',
text: 'Test D4',
pressed: {$P4},
handler: function( b, e ){
b.disable();
if( b.pressed ){
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} | 8 ), false );
} else {
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} & ( ~8 ) ), false );
};
}
}]
}]
},{
xtype: 'spacer',
height: 5,
colspan: 4
},{
xtype: 'button',
text: 'Remove this Scada Module',
width: '100%',
handler: function(){
doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 19, 'true', true );
}
}],
listeners: {
afterrender: function( panel ){
console.log('Panel is Rendered');
},
beforedestroy: function(panel) {
// Return false to halt destruction
console.log('Panel is about to be destroyed');
},
destroy: function(panel) {
console.log('Panel has been destroyed');
}
}
}
DATA_BOUNDARY;
echo $MODBUS;

36
lib/controller/getScadaStatus.php

@ -0,0 +1,36 @@
<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$Data['status'] = 'error';
if( $CUser->Data['access'] > 5 ){
if( isset( $_POST['MODE'] ) ){
$MODE = intval( $_POST['MODE'] );
switch( $MODE ){
case 0:{
$Data['msg']='Module ID not Defined!';
if( isset( $_POST['MID'] ) ){
$MID = intval( $_POST['MID'] );
if( $MID ){
unset( $Data['msg'] );
$Data['status'] = 'ok';
$QS = "SELECT `status`, `values`, `crossbar_a`,`crossbar_b`,`crossbar_c`,`crossbar_d` WHERE `id`={$MID}";
$RR = $DATABASE->Query( $QS, false );
$VV = intval( $RR[0]['values'];
$VO = $VV & 0xFF;
$VI = ($VV >> 8 ) & 0xFF;
};
};
break;
};
};
} else $Data['msg']='Mode not Defined!';
} else {
$Data['msg']='Access Denied!';
};
echo json_encode( $Data );
} else {
header('location: /');
};
?>

59
lib/javascript/jsapi_dynamic/argus_settings.js

@ -509,6 +509,10 @@ function loadMetroStationPlatforms( station_id, suse ){
});
};
function loadModules(){
loadMetroPlatformModules( SelectedPlatform, SelectedModule );
};
function loadMetroPlatformModules( platform_id, suse ){
if( suse == undefined ){
suse = 0;
@ -862,9 +866,11 @@ function editFilter( fid ){
function editModule( s_id ){
if( oSelectedModule ){
var tt = document.getElementById('MODULE_TAG_'+oSelectedModule );
tt.classList.remove('selected_green');
tt.classList.add('active_green');
};
if( tt != null ){
tt.classList.remove('selected_green');
tt.classList.add('active_green');
} else oSelectedModule = 0;
};
var tt = document.getElementById('MODULE_TAG_'+s_id );
if( tt!= undefined ){
tt.classList.remove('active_green');
@ -1176,6 +1182,44 @@ function serverStatusUpdater(){
});
};
var scadaEditorStatusTimeout = null;
function stopScadaEditorStatusUpdate(){
if( scadaEditorStatusTimeout != null ) clearTimeout( scadaEditorStatusTimeout );
};
function fetchScadaEditorStatus(){
clearTimeout( scadaEditorStatusTimeout );
scadaEditorStatusTimeout = null;
Ext.Ajax.request({
url: '/lib/controller/getScadaStatus.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 ){
scadaEditorStatusTimeout = setTimeout( fetchScadaEditorStatus, 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 );
scadaEditorStatusTimeout = setTimeout( fetchScadaEditorStatus, 1000 );
} else {
Ext.getCmp('upload_progres_panel').hide();
Ext.getCmp('uploaded_grid').show();
loadModuleFiles( devUploadID );
};
};
},
failure: failureAJAXFunction
});
};
var devUploadTimeout = null;
var devUploadID = -1;
function fetchDeviceUploadStatus(){
@ -1257,6 +1301,7 @@ function downloadSettings(){
});
});
};
var addModuleWindow = null;
function addModule(){
Ext.Ajax.request({
url: '/lib/controller/getAddModuleWindow.php',
@ -1267,7 +1312,7 @@ function addModule(){
},
success: function( response, opts ){
var data = Ext.decode(response.responseText);
var addModuleWindow = new Ext.Window( data );
addModuleWindow = new Ext.Window( data );
addModuleWindow.show();
},
failure: failureAJAXFunction
@ -1772,8 +1817,10 @@ function inintGisEditor( map_id, Lat, Lon ){
function editPlatform( s_id ){
if( oSelectedPlatform ){
var tt = document.getElementById('PLATFORM_TAG_'+oSelectedPlatform );
tt.classList.remove('selected_green');
tt.classList.add('active_green');
if( tt!= null ){
tt.classList.remove('selected_green');
tt.classList.add('active_green');
} else oSelectedPlatform = 0;
};
var tt = document.getElementById('PLATFORM_TAG_'+s_id );
if( tt!= undefined ){

Loading…
Cancel
Save