Browse Source

SCADA TCC functionality

master
Evgeny Gagua 2 months ago
parent
commit
5301e21986
  1. 4
      files.list
  2. 2
      lib/1.json
  3. 115
      lib/controller/doPlatformOperations.php
  4. 263
      lib/controller/getPlatformEditor.php
  5. 108
      lib/controller/getScadaEditor.php
  6. 13
      lib/controller/getScadaModules.php
  7. 27
      lib/upgrade_database.php
  8. BIN
      style/assets/scada_fn_icons.psd
  9. BIN
      style/assets/scada_fn_l.png
  10. BIN
      style/assets/scada_fn_na.png
  11. BIN
      style/assets/scada_fn_r.png
  12. BIN
      style/assets/scada_fn_tcc.png

4
files.list

@ -3425,6 +3425,10 @@
./style/assets/igr.png ./style/assets/igr.png
./style/assets/sm_ico_w.png ./style/assets/sm_ico_w.png
./style/assets/sm_ico_gw.png ./style/assets/sm_ico_gw.png
./style/assets/scada_fn_tcc.png
./style/assets/scada_fn_l.png
./style/assets/scada_fn_r.png
./style/assets/scada_fn_na.png
./style/assets/1141811-512.png ./style/assets/1141811-512.png
./style/assets/ms_ul.png ./style/assets/ms_ul.png
./style/assets/sm_ico_rl.png ./style/assets/sm_ico_rl.png

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

115
lib/controller/doPlatformOperations.php

@ -281,15 +281,15 @@
case 13:{//Remove SCADA Module case 13:{//Remove SCADA Module
break; break;
}; };
case 14:{//Edit SCADA Module Name
case 14:{//Edit SCADA Module Function
$SCA = intval( $_POST['SCA'] ); $SCA = intval( $_POST['SCA'] );
if( $OID == 0 ) { if( $OID == 0 ) {
$Data['msg']='Wrong Parameters!'; $Data['msg']='Wrong Parameters!';
echo json_encode( $Data ); echo json_encode( $Data );
exit(); exit();
}; };
$NAME = $DATABASE->escape( $_POST['OPCODE'] );
$QS = "UPDATE `modbus_modules` SET `label`='{$NAME}' WHERE `platform_id`={$OID} AND `id`={$SCA}";
$FUNC = intval( $_POST['OPCODE'] );
$QS = "UPDATE `modbus_modules` SET `func`='{$FUNC}' WHERE `platform_id`={$OID} AND `id`={$SCA}";
$DATABASE->Query( $QS ); $DATABASE->Query( $QS );
$Data['success'] = true; $Data['success'] = true;
$LOG->reg_op( $_POST ); $LOG->reg_op( $_POST );
@ -406,6 +406,9 @@
echo json_encode( $Data ); echo json_encode( $Data );
exit(); exit();
}; };
$QS="SELECT `crossbar_a` FROM `modbus_modules` WHERE `platform_id`={$OID} AND `id`={$SCA}";
$RR = $DATABASE->Query( $QS, false );
$NMD = ( intval( $RR[0]['crossbar_a'] ) & 0xF0 ) | ( $NMD & 0x0F );
$QS="UPDATE `modbus_modules` SET `crossbar_a` = {$NMD} WHERE `platform_id`={$OID} AND `id`={$SCA}"; $QS="UPDATE `modbus_modules` SET `crossbar_a` = {$NMD} WHERE `platform_id`={$OID} AND `id`={$SCA}";
$DATABASE->Query( $QS ); $DATABASE->Query( $QS );
$Data['success'] = true; $Data['success'] = true;
@ -420,6 +423,9 @@
echo json_encode( $Data ); echo json_encode( $Data );
exit(); exit();
}; };
$QS="SELECT `crossbar_b` FROM `modbus_modules` WHERE `platform_id`={$OID} AND `id`={$SCA}";
$RR = $DATABASE->Query( $QS, false );
$NMD = ( intval( $RR[0]['crossbar_b'] ) & 0xF0 ) | ( $NMD & 0x0F );
$QS="UPDATE `modbus_modules` SET `crossbar_b` = {$NMD} WHERE `platform_id`={$OID} AND `id`={$SCA}"; $QS="UPDATE `modbus_modules` SET `crossbar_b` = {$NMD} WHERE `platform_id`={$OID} AND `id`={$SCA}";
$DATABASE->Query( $QS ); $DATABASE->Query( $QS );
$Data['success'] = true; $Data['success'] = true;
@ -433,7 +439,10 @@
$Data['msg']='Wrong Parameters!'; $Data['msg']='Wrong Parameters!';
echo json_encode( $Data ); echo json_encode( $Data );
exit(); exit();
};
};
$QS="SELECT `crossbar_c` FROM `modbus_modules` WHERE `platform_id`={$OID} AND `id`={$SCA}";
$RR = $DATABASE->Query( $QS, false );
$NMD = ( intval( $RR[0]['crossbar_c'] ) & 0xF0 ) | ( $NMD & 0x0F );
$QS="UPDATE `modbus_modules` SET `crossbar_c` = {$NMD} WHERE `platform_id`={$OID} AND `id`={$SCA}"; $QS="UPDATE `modbus_modules` SET `crossbar_c` = {$NMD} WHERE `platform_id`={$OID} AND `id`={$SCA}";
$DATABASE->Query( $QS ); $DATABASE->Query( $QS );
$Data['success'] = true; $Data['success'] = true;
@ -448,6 +457,104 @@
echo json_encode( $Data ); echo json_encode( $Data );
exit(); exit();
}; };
$QS="SELECT `crossbar_d` FROM `modbus_modules` WHERE `platform_id`={$OID} AND `id`={$SCA}";
$RR = $DATABASE->Query( $QS, false );
$NMD = ( intval( $RR[0]['crossbar_d'] ) & 0xF0 ) | ( $NMD & 0x0F );
$QS="UPDATE `modbus_modules` SET `crossbar_d` = {$NMD} WHERE `platform_id`={$OID} AND `id`={$SCA}";
$DATABASE->Query( $QS );
$Data['success'] = true;
$LOG->reg_op( $_POST );
break;
};
case 25:{ // Change Platform Left Side Name
if( $OID == 0 ) {
$Data['msg']='Wrong Parameters!';
echo json_encode( $Data );
exit();
};
$NAME = $DATABASE->escape( $_POST['OPCODE'] );
$QS = "UPDATE `metro_platforms` SET `left_side`='{$NAME}' WHERE `id`={$OID}";
$DATABASE->Query( $QS );
$Data['success'] = true;
$LOG->reg_op( $_POST );
break;
};
case 26:{ // Change Platform Left Side Name
if( $OID == 0 ) {
$Data['msg']='Wrong Parameters!';
echo json_encode( $Data );
exit();
};
$NAME = $DATABASE->escape( $_POST['OPCODE'] );
$QS = "UPDATE `metro_platforms` SET `right_side`='{$NAME}' WHERE `id`={$OID}";
$DATABASE->Query( $QS );
$Data['success'] = true;
$LOG->reg_op( $_POST );
break;
};
case 27:{ // Change Input Func crossbar A
$SCA = intval( $_POST['SCA'] );
$NMD = intval( $_POST['OPCODE'] ) * 16;
if( $OID == 0 ) {
$Data['msg']='Wrong Parameters!';
echo json_encode( $Data );
exit();
};
$QS="SELECT `crossbar_a` FROM `modbus_modules` WHERE `platform_id`={$OID} AND `id`={$SCA}";
$RR = $DATABASE->Query( $QS, false );
$NMD = ( intval( $RR[0]['crossbar_a'] ) & 0x0F ) | ( $NMD & 0xF0 );
$QS="UPDATE `modbus_modules` SET `crossbar_a` = {$NMD} WHERE `platform_id`={$OID} AND `id`={$SCA}";
$DATABASE->Query( $QS );
$Data['Q'] = $QS;
$Data['success'] = true;
$LOG->reg_op( $_POST );
break;
};
case 28:{ // Change Input Func crossbar A
$SCA = intval( $_POST['SCA'] );
$NMD = ( intval( $_POST['OPCODE'] ) << 4 );
if( $OID == 0 ) {
$Data['msg']='Wrong Parameters!';
echo json_encode( $Data );
exit();
};
$QS="SELECT `crossbar_b` FROM `modbus_modules` WHERE `platform_id`={$OID} AND `id`={$SCA}";
$RR = $DATABASE->Query( $QS, false );
$NMD = ( intval( $RR[0]['crossbar_b'] ) & 0x0F ) | ( $NMD & 0xF0 );
$QS="UPDATE `modbus_modules` SET `crossbar_b` = {$NMD} WHERE `platform_id`={$OID} AND `id`={$SCA}";
$DATABASE->Query( $QS );
$Data['success'] = true;
$LOG->reg_op( $_POST );
break;
};
case 29:{ // Change Input Func crossbar A
$SCA = intval( $_POST['SCA'] );
$NMD = ( intval( $_POST['OPCODE'] ) << 4 );
if( $OID == 0 ) {
$Data['msg']='Wrong Parameters!';
echo json_encode( $Data );
exit();
};
$QS="SELECT `crossbar_c` FROM `modbus_modules` WHERE `platform_id`={$OID} AND `id`={$SCA}";
$RR = $DATABASE->Query( $QS, false );
$NMD = ( intval( $RR[0]['crossbar_c'] ) & 0x0F ) | ( $NMD & 0xF0 );
$QS="UPDATE `modbus_modules` SET `crossbar_c` = {$NMD} WHERE `platform_id`={$OID} AND `id`={$SCA}";
$DATABASE->Query( $QS );
$Data['success'] = true;
$LOG->reg_op( $_POST );
break;
};
case 30:{ // Change Input Func crossbar A
$SCA = intval( $_POST['SCA'] );
$NMD = ( intval( $_POST['OPCODE'] ) << 4 );
if( $OID == 0 ) {
$Data['msg']='Wrong Parameters!';
echo json_encode( $Data );
exit();
};
$QS="SELECT `crossbar_d` FROM `modbus_modules` WHERE `platform_id`={$OID} AND `id`={$SCA}";
$RR = $DATABASE->Query( $QS, false );
$NMD = ( intval( $RR[0]['crossbar_d'] ) & 0x0F ) | ( $NMD & 0xF0 );
$QS="UPDATE `modbus_modules` SET `crossbar_d` = {$NMD} WHERE `platform_id`={$OID} AND `id`={$SCA}"; $QS="UPDATE `modbus_modules` SET `crossbar_d` = {$NMD} WHERE `platform_id`={$OID} AND `id`={$SCA}";
$DATABASE->Query( $QS ); $DATABASE->Query( $QS );
$Data['success'] = true; $Data['success'] = true;

263
lib/controller/getPlatformEditor.php

@ -79,7 +79,7 @@ JOJOKA;
}; };
$LINES.='</tr></table>'; $LINES.='</tr></table>';
}; };
$ROUTING = "{ xtype:'panel', width: '100%', layout: 'table', defaults: {margins: {top:10, right:10, bottom:10, left:10},padding:8},baseCls: 'x-plain', layoutConfig: {columns: 2},frame: false,border: false,items:[{xtype:'panel',border:false,frame:false,colspan:2,html:'{$Labels->GetLabel('_SMM_MET_ROUTE_')}'}";
$ROUTING = "{ xtype:'panel', width: '100%', layout: 'table', defaults: {margins: {top:10, right:10, bottom:10, left:10},padding:8},baseCls: 'x-plain', layoutConfig: {columns: 2},frame: false,border: false, height: PanelH - 500, items:[{xtype:'panel',border:false,frame:false,colspan:2,html:'{$Labels->GetLabel('_SMM_MET_ROUTE_')}'}";
foreach( $Sz as $Z ){ foreach( $Sz as $Z ){
$AS = 'false'; $AS = 'false';
for( $idx = 0; $idx < $PINFO['INFO_COUNT']; $idx++){ for( $idx = 0; $idx < $PINFO['INFO_COUNT']; $idx++){
@ -93,7 +93,7 @@ JOJOKA;
}; };
$ROUTING .= "]}"; $ROUTING .= "]}";
} else { } else {
$ROUTING = "{xtype:'spacer',height:0}";
$ROUTING = "{xtype:'spacer',height: PanelH - 500}";
}; };
$TOP ="<td><table width=\"100%\" border=0><tr><td><table border=0 width=\"100%\" style=\"border-collapse: collapse; border-spacing: 5px 5px;\">"; $TOP ="<td><table width=\"100%\" border=0><tr><td><table border=0 width=\"100%\" style=\"border-collapse: collapse; border-spacing: 5px 5px;\">";
if( $PINFO['PREV_IS_MULTI'] ){ if( $PINFO['PREV_IS_MULTI'] ){
@ -143,127 +143,160 @@ JOJOKA;
xtype: 'panel', xtype: 'panel',
title: '{$Labels->GetLabel('_GENERAL_')}', title: '{$Labels->GetLabel('_GENERAL_')}',
items: [{ items: [{
xtype: 'form',
height: PanelH - 283,
labelWidth: 150,
labelAlign: 'right',
margins: {top:10, right:10, bottom:10, left:10},
padding:8,
items: [{
xtype: 'combo',
id: 'sens_se',
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: '{$CR['status']}',
width: 200,
listeners:{
select: function( a, c, b ){
doPlatformOperation( {$CR['id']}, 2, b, true );
xtype: 'panel',
layout: 'table',
border: false,
frame: false,
width: '100%',
wdefaults: { bodyStyle:'padding:10px; text-align: center;'},
layoutConfig: { columns: 2 },
items:[{
xtype: 'form',
height: PanelH - 500,
labelWidth: 150,
labelAlign: 'right',
border: false,
frame: false,
margins: {top:10, right:10, bottom:10, left:10},
padding:8,
items: [{
xtype: 'combo',
id: 'sens_se',
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: '{$CR['status']}',
width: 200,
listeners:{
select: function( a, c, b ){
doPlatformOperation( {$CR['id']}, 2, b, true );
}
} }
}
},{
xtype: 'textfield',
id: 'plt_name',
fieldLabel: '{$Labels->GetLabel('_SMM_PAT_NAME_')}',
maxlength: 64,
value: '{$CR['name']}',
listeners:{
change: function( a, c, b ){
doPlatformOperation( {$CR['id']}, 6, c, true );
},{
xtype: 'textfield',
id: 'plt_name',
fieldLabel: '{$Labels->GetLabel('_SMM_PAT_NAME_')}',
maxlength: 64,
value: '{$CR['name']}',
listeners:{
change: function( a, c, b ){
doPlatformOperation( {$CR['id']}, 6, c, true );
}
} }
}
},{
xtype: 'textfield',
id: 'plt_lvl',
fieldLabel: '{$Labels->GetLabel('_SMM_PAT_LEVEL_')}',
maxlength: 2,
value: '{$CR['level']}',
listeners:{
change: function( a, c, b ){
doPlatformOperation( {$CR['id']}, 7, c, true );
},{
xtype: 'textfield',
id: 'plt_lvl',
fieldLabel: '{$Labels->GetLabel('_SMM_PAT_LEVEL_')}',
maxlength: 2,
value: '{$CR['level']}',
listeners:{
change: function( a, c, b ){
doPlatformOperation( {$CR['id']}, 7, c, true );
}
} }
}
},{
xtype: 'combo',
fieldLabel: "Platform Type",
id: 'pl_lay_A',
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}"/>&nbsp;{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: '{$CR['layout']}',
init_value: '{$CR['layout']}',
listeners:{
select: function( t, r, i ){
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 {
},{
xtype: 'textfield',
id: 'plt_lsname',
fieldLabel: '{$Labels->GetLabel('_SMM_PAT_LSNAME_')}',
maxlength: 2,
value: '{$CR['left_side']}',
listeners:{
change: function( a, c, b ){
doPlatformOperation( {$CR['id']}, 25, c, true );
}
}
},{
xtype: 'textfield',
id: 'plt_rsname',
fieldLabel: '{$Labels->GetLabel('_SMM_PAT_RSNAME_')}',
maxlength: 2,
value: '{$CR['right_side']}',
listeners:{
change: function( a, c, b ){
doPlatformOperation( {$CR['id']}, 26, c, true );
}
}
},{
xtype: 'combo',
fieldLabel: "Platform Type",
id: 'pl_lay_A',
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}"/>&nbsp;{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: '{$CR['layout']}',
init_value: '{$CR['layout']}',
listeners:{
select: function( t, r, i ){
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({ t.getEl().setStyle({
'background-image': 'url(' + r.data.icon + ')',
'background-repeat': 'no-repeat',
'background-image': 'url(' + t.store.data.items[t.store.findExact( 'abbr', t.value )].data.icon + ')',
'background-repeat': 'no-repeat',
'background-position': '3px center', 'background-position': '3px center',
'background-size': '16px 16px', 'background-size': '16px 16px',
'padding-left': '25px'
'padding-left': '25px'
}); });
doPlatformOperation( {$CR['id']}, 20, r.data.abbr, true );
};
},
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'
});
}
} }
}
}]
},{$ROUTING}] },{$ROUTING}]
}] }]
},{ },{

108
lib/controller/getScadaEditor.php

@ -12,6 +12,29 @@
if( ( $CCCV & 0x02 ) == 0x02 ) $P2 = 'true'; else $P2 = 'false'; if( ( $CCCV & 0x02 ) == 0x02 ) $P2 = 'true'; else $P2 = 'false';
if( ( $CCCV & 0x04 ) == 0x04 ) $P3 = 'true'; else $P3 = 'false'; if( ( $CCCV & 0x04 ) == 0x04 ) $P3 = 'true'; else $P3 = 'false';
if( ( $CCCV & 0x08 ) == 0x08 ) $P4 = 'true'; else $P4 = 'false'; if( ( $CCCV & 0x08 ) == 0x08 ) $P4 = 'true'; else $P4 = 'false';
$QS = "SELECT `left_side`,`right_side` FROM `metro_platforms` WHERE `id`={$SC['platform_id']}";
$ZZ = $DATABASE->Query( $QS, false );
$SN = $ZZ[0];
switch($SC['func']){
case 1: $FFF=$SN['left_side'] . ' ' . $Labels->GetLabel('___SIDE__'); break;
case 2: $FFF=$SN['right_side'] . ' ' . $Labels->GetLabel('___SIDE__'); break;
case 3: $FFF='TCC ' . $Labels->GetLabel('___MODULE__'); break;
default: $FFF='Not Assignet';
};
$QS="SELECT `short` FROM `metro_tracks` WHERE `side`='U' AND `platform_id`={$SC['platform_id']}";
$ZZ = $DATABASE->Query( $QS, false );
$UTN = $ZZ[0]['short'];
$QS="SELECT `short` FROM `metro_tracks` WHERE `side`='B' AND `platform_id`={$SC['platform_id']}";
$ZZ = $DATABASE->Query( $QS, false );
$BTN = $ZZ[0]['short'];
$CBOV_A =( intval($SC['crossbar_a']) & 0x0F );
$CBOV_B =( intval($SC['crossbar_a']) & 0x0F );
$CBOV_C =( intval($SC['crossbar_a']) & 0x0F );
$CBOV_D =( intval($SC['crossbar_a']) & 0x0F );
$CBIV_A =( intval($SC['crossbar_a']) >> 4 );
$CBIV_B =( intval($SC['crossbar_a']) >> 4 );
$CBIV_C =( intval($SC['crossbar_a']) >> 4 );
$CBIV_D =( intval($SC['crossbar_a']) >> 4 );
$MODBUS=<<<DATA_BOUNDARY $MODBUS=<<<DATA_BOUNDARY
{ {
xtype: 'panel', xtype: 'panel',
@ -44,19 +67,36 @@
xtype: 'panel', xtype: 'panel',
border: false, border: false,
frame: 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>'
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_')}:{$FFF}</td><td><img id="scae_onl_sts" src="/style/assets/bul_gray.png"></td></tr></table>'
},{ },{
xtype: 'spacer', xtype: 'spacer',
height: 5 height: 5
},{ },{
xtype: 'textfield',
id: 'sca_label',
fieldLabel: '{$Labels->GetLabel('_NAME_LABEL_')}',
maxlength: 64,
value: '{$SC['label']}',
xtype: 'combo',
id: 'sca_func',
fieldLabel: "{$Labels->GetLabel('_MO_FUNC_')}",
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
['0','{$Labels->GetLabel('__DEFAULT__')}'],
['1','{$SN['left_side']} {$Labels->GetLabel('___MODULE__')}'],
['2','{$SN['right_side']} {$Labels->GetLabel('___MODULE__')}'],
['3','TCC Module']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: '{$SC['func']}',
width: 200,
listeners:{ listeners:{
change: function( a, c, b ){
doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 14, c, true );
select: function( a, c, b ){
doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 14, b, true );
} }
} }
},{ },{
@ -120,11 +160,11 @@
items:[{ items:[{
xtype: 'panel', xtype: 'panel',
bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;', bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;',
html: 'Upper Track'
html: '{$UTN} {$Labels->GetLabel('_LBL_TRACK_')}'
},{ },{
xtype: 'panel', xtype: 'panel',
bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;', bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;',
html: 'Bottom Track'
html: '{$BTN} {$Labels->GetLabel('_LBL_TRACK_')}'
},{ },{
xtype: 'panel', xtype: 'panel',
bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;', bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;',
@ -146,12 +186,12 @@
fields: ['mode','mode_txt'], fields: ['mode','mode_txt'],
data: [ data: [
[0,'{$Labels->GetLabel('__DISABLED__')}'], [0,'{$Labels->GetLabel('__DISABLED__')}'],
[1,'Coil D1'],[2,'Coil D2'],[3,'Coil D3'],[4,'Coil D4']
[1,'Coil D0'],[2,'Coil D1'],[3,'Coil D2'],[4,'Coil D3']
] ]
}), }),
valueField: 'mode', valueField: 'mode',
displayField: 'mode_txt', displayField: 'mode_txt',
value: '0',
value: '{$CBOV_A}',
width: 120, width: 120,
listeners:{ listeners:{
select: function( a, c, b ){ select: function( a, c, b ){
@ -171,12 +211,12 @@
fields: ['mode','mode_txt'], fields: ['mode','mode_txt'],
data: [ data: [
[0,'{$Labels->GetLabel('__DISABLED__')}'], [0,'{$Labels->GetLabel('__DISABLED__')}'],
[1,'Coil D1'],[2,'Coil D2'],[3,'Coil D3'],[4,'Coil D4']
[1,'Coil D0'],[2,'Coil D1'],[3,'Coil D2'],[4,'Coil D3']
] ]
}), }),
valueField: 'mode', valueField: 'mode',
displayField: 'mode_txt', displayField: 'mode_txt',
value: '0',
value: '{$CBOV_B}',
width: 120, width: 120,
listeners:{ listeners:{
select: function( a, c, b ){ select: function( a, c, b ){
@ -196,12 +236,12 @@
fields: ['mode','mode_txt'], fields: ['mode','mode_txt'],
data: [ data: [
[0,'{$Labels->GetLabel('__DISABLED__')}'], [0,'{$Labels->GetLabel('__DISABLED__')}'],
[1,'Coil D1'],[2,'Coil D2'],[3,'Coil D3'],[4,'Coil D4']
[1,'Coil D0'],[2,'Coil D1'],[3,'Coil D2'],[4,'Coil D3']
] ]
}), }),
valueField: 'mode', valueField: 'mode',
displayField: 'mode_txt', displayField: 'mode_txt',
value: '0',
value: '{$CBOV_C}',
width: 120, width: 120,
listeners:{ listeners:{
select: function( a, c, b ){ select: function( a, c, b ){
@ -221,12 +261,12 @@
fields: ['mode','mode_txt'], fields: ['mode','mode_txt'],
data: [ data: [
[0,'{$Labels->GetLabel('__DISABLED__')}'], [0,'{$Labels->GetLabel('__DISABLED__')}'],
[1,'Coil D1'],[2,'Coil D2'],[3,'Coil D3'],[4,'Coil D4']
[1,'Coil D0'],[2,'Coil D1'],[3,'Coil D2'],[4,'Coil D3']
] ]
}), }),
valueField: 'mode', valueField: 'mode',
displayField: 'mode_txt', displayField: 'mode_txt',
value: '0',
value: '{$CBOV_D}',
width: 120, width: 120,
listeners:{ listeners:{
select: function( a, c, b ){ select: function( a, c, b ){
@ -243,7 +283,7 @@
enableToggle: true, enableToggle: true,
allowDepress: true, allowDepress: true,
width: '80%', width: '80%',
text: 'Test D1',
text: 'Test D0',
pressed: {$P1}, pressed: {$P1},
disabled: true, disabled: true,
handler: function( b, e ){ handler: function( b, e ){
@ -260,7 +300,7 @@
width: '80%', width: '80%',
enableToggle: true, enableToggle: true,
allowDepress: true, allowDepress: true,
text: 'Test D2',
text: 'Test D1',
pressed: {$P2}, pressed: {$P2},
disabled: true, disabled: true,
handler: function( b, e ){ handler: function( b, e ){
@ -277,7 +317,7 @@
enableToggle: true, enableToggle: true,
allowDepress: true, allowDepress: true,
width: '80%', width: '80%',
text: 'Test D3',
text: 'Test D2',
pressed: {$P3}, pressed: {$P3},
disabled: true, disabled: true,
handler: function( b, e ){ handler: function( b, e ){
@ -294,7 +334,7 @@
enableToggle: true, enableToggle: true,
allowDepress: true, allowDepress: true,
width: '80%', width: '80%',
text: 'Test D4',
text: 'Test D3',
pressed: {$P4}, pressed: {$P4},
disabled: true, disabled: true,
handler: function( b, e ){ handler: function( b, e ){
@ -342,16 +382,16 @@
fields: ['mode','mode_txt'], fields: ['mode','mode_txt'],
data: [ data: [
[0,'{$Labels->GetLabel('__DISABLED__')}'], [0,'{$Labels->GetLabel('__DISABLED__')}'],
[1,'Upper Track'],[2,'Bottom Track'],[3,'Both']
[1,'{$UTN} {$Labels->GetLabel('_LBL_TRACK_')}'],[2,'{$BTN} {$Labels->GetLabel('_LBL_TRACK_')}'],[3,'Both'],[4,'TCC AUX']
] ]
}), }),
valueField: 'mode', valueField: 'mode',
displayField: 'mode_txt', displayField: 'mode_txt',
value: '-1',
value: '{$CBIV_A}',
width: 120, width: 120,
listeners:{ listeners:{
select: function( a, c, b ){ select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true );
doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 27, b, false );
} }
} }
},{ },{
@ -367,16 +407,16 @@
fields: ['mode','mode_txt'], fields: ['mode','mode_txt'],
data: [ data: [
[0,'{$Labels->GetLabel('__DISABLED__')}'], [0,'{$Labels->GetLabel('__DISABLED__')}'],
[1,'Upper Track'],[2,'Bottom Track'],[3,'Both']
[1,'{$UTN} {$Labels->GetLabel('_LBL_TRACK_')}'],[2,'{$BTN} {$Labels->GetLabel('_LBL_TRACK_')}'],[3,'Both'],[4,'TCC AUX']
] ]
}), }),
valueField: 'mode', valueField: 'mode',
displayField: 'mode_txt', displayField: 'mode_txt',
value: '-1',
value: '{$CBIV_B}',
width: 120, width: 120,
listeners:{ listeners:{
select: function( a, c, b ){ select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true );
doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 28, b, false );
} }
} }
},{ },{
@ -392,16 +432,16 @@
fields: ['mode','mode_txt'], fields: ['mode','mode_txt'],
data: [ data: [
[0,'{$Labels->GetLabel('__DISABLED__')}'], [0,'{$Labels->GetLabel('__DISABLED__')}'],
[1,'Upper Track'],[2,'Bottom Track'],[3,'Both']
[1,'{$UTN} {$Labels->GetLabel('_LBL_TRACK_')}'],[2,'{$BTN} {$Labels->GetLabel('_LBL_TRACK_')}'],[3,'Both'],[4,'TCC AUX']
] ]
}), }),
valueField: 'mode', valueField: 'mode',
displayField: 'mode_txt', displayField: 'mode_txt',
value: '-1',
value: '{$CBIV_C}',
width: 120, width: 120,
listeners:{ listeners:{
select: function( a, c, b ){ select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true );
doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 29, b, false );
} }
} }
},{ },{
@ -417,16 +457,16 @@
fields: ['mode','mode_txt'], fields: ['mode','mode_txt'],
data: [ data: [
[0,'{$Labels->GetLabel('__DISABLED__')}'], [0,'{$Labels->GetLabel('__DISABLED__')}'],
[1,'Upper Track'],[2,'Bottom Track'],[3,'Both']
[1,'{$UTN} {$Labels->GetLabel('_LBL_TRACK_')}'],[2,'{$BTN} {$Labels->GetLabel('_LBL_TRACK_')}'],[3,'Both'],[4,'TCC AUX']
] ]
}), }),
valueField: 'mode', valueField: 'mode',
displayField: 'mode_txt', displayField: 'mode_txt',
value: '-1',
value: '{$CBIV_D}',
width: 120, width: 120,
listeners:{ listeners:{
select: function( a, c, b ){ select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true );
doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 30, b, false );
} }
} }
}] }]

13
lib/controller/getScadaModules.php

@ -6,11 +6,20 @@
$EID = intval( $_POST['PID'] ); $EID = intval( $_POST['PID'] );
$QS = "SELECT * FROM `modbus_modules` WHERE `platform_id`={$EID}"; $QS = "SELECT * FROM `modbus_modules` WHERE `platform_id`={$EID}";
$Result = $DATABASE->Query( $QS, false ); $Result = $DATABASE->Query( $QS, false );
if( count( $Result ) ){
if( count( $Result ) ){
$QS = "SELECT `left_side`, `right_side` FROM `metro_platforms` WHERE `id`={$EID}";
$ZZ = $DATABASE->Query( $QS, false );
$CP = $ZZ[0];
$SenPart = array(); $SenPart = array();
foreach( $Result as $R ){ foreach( $Result as $R ){
$AA = ($R['wm']=='E')?'active_green':'active_gray'; $AA = ($R['wm']=='E')?'active_green':'active_gray';
$SenPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item '.$AA.'" onclick="editScadaModule('.$R['id'].');">'.$R['ip4'].' '.urldecode($R['label']).'</a>\'}';
switch( $R['func'] ){
case 1: $IM = '/style/assets/scada_fn_l.png'; $FLAB = $CP['left_side'].' '.$Labels->GetLabel('___SIDE__'); break;
case 2: $IM = '/style/assets/scada_fn_r.png'; $FLAB = $CP['right_side'].' '.$Labels->GetLabel('___SIDE__'); break;
case 3: $IM = '/style/assets/scada_fn_tcc.png'; $FLAB = 'TCC ' . $Labels->GetLabel('___MODULE__'); break;
default: $IM = '/style/assets/scada_fn_na.png'; $FLAB = 'No Func.';break;
};
$SenPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a class="sideInfo_item '.$AA.'" onclick="editScadaModule('.$R['id'].');"><table width="100%"><tr><td>'.$R['ip4'].' '.urldecode($R['label']).' ['.$FLAB.']</td><td width="24px"><img src="'.$IM.'"></td></tr></table></a>\'}';
}; };
$Data['status']='ok'; $Data['status']='ok';
$Data['modules'] = '['.implode( ',', $SenPart ) .']'; $Data['modules'] = '['.implode( ',', $SenPart ) .']';

27
lib/upgrade_database.php

@ -73,6 +73,33 @@ DATA_BOUNDARY;
$QS = "INSERT INTO `session_statuses`(`lvl`,`label`,`min_access`,`class`) VALUES(1,'Dismiss by Station',3,'active_yellow')"; $QS = "INSERT INTO `session_statuses`(`lvl`,`label`,`min_access`,`class`) VALUES(1,'Dismiss by Station',3,'active_yellow')";
$DATABASE->Query( $QS ); $DATABASE->Query( $QS );
}; };
$QS = "SHOW COLUMNS FROM `metro_platforms` LIKE 'left_side'";
$R = $DATABASE->Query( $QS );
if( count( $R ) == 0 ){
$QS = "ALTER TABLE `metro_platforms` ADD `left_side` CHAR(16) DEFAULT ''";
$DATABASE->Query( $QS );
$UPGRADE = true;
};
$QS = "SHOW COLUMNS FROM `metro_platforms` LIKE 'right_side'";
$R = $DATABASE->Query( $QS );
if( count( $R ) == 0 ){
$QS = "ALTER TABLE `metro_platforms` ADD `right_side` CHAR(16) DEFAULT ''";
$DATABASE->Query( $QS );
$UPGRADE = true;
};
$QS = "SHOW COLUMNS FROM `modbus_modules` LIKE 'func'";
$R = $DATABASE->Query( $QS );
if( count( $R ) == 0 ){
$QS = "ALTER TABLE `modbus_modules` DROP COLUMN `label`";
$DATABASE->Query( $QS );
$QS = "ALTER TABLE `modbus_modules` ADD `func` TINYINT(3) UNSIGNED DEFAULT 0";
$DATABASE->Query( $QS );
$UPGRADE = true;
};
if( $UPGRADE ){ if( $UPGRADE ){
echo "Upgrade Done!\n\n"; echo "Upgrade Done!\n\n";
} else { } else {

BIN
style/assets/scada_fn_icons.psd

Binary file not shown.

BIN
style/assets/scada_fn_l.png

Binary file not shown.

After

Width: 22  |  Height: 11  |  Size: 2.8 KiB

BIN
style/assets/scada_fn_na.png

Binary file not shown.

After

Width: 22  |  Height: 11  |  Size: 2.7 KiB

BIN
style/assets/scada_fn_r.png

Binary file not shown.

After

Width: 22  |  Height: 11  |  Size: 2.8 KiB

BIN
style/assets/scada_fn_tcc.png

Binary file not shown.

After

Width: 22  |  Height: 11  |  Size: 2.8 KiB

Loading…
Cancel
Save