Browse Source

Platform Removal Functionality

master
Evgeny Gagua 2 months ago
parent
commit
18208e8508
  1. 1
      files.list
  2. 2
      lib/1.json
  3. 77
      lib/controller/doModuleOperations.php
  4. 37
      lib/controller/doPlatformOperations.php
  5. 15
      lib/controller/getModuleEditor.php
  6. 43
      lib/controller/getPlatformEditor.php
  7. 86
      lib/controller/getScadaEditor.php
  8. 36
      lib/controller/getScadaStatus.php
  9. 49
      lib/javascript/jsapi_dynamic/argus_settings.js

1
files.list

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

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

77
lib/controller/doModuleOperations.php

@ -143,6 +143,12 @@
$DATABASE->Query( $QS ); $DATABASE->Query( $QS );
exit(); 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 case 200:{ // Delete Module
$QS = "SELECT * FROM `metro_modules` WHERE `id`={$ModuleID}"; $QS = "SELECT * FROM `metro_modules` WHERE `id`={$ModuleID}";
$RR = $DATABASE->Query( $QS ); $RR = $DATABASE->Query( $QS );
@ -181,7 +187,41 @@
if( count( $RR ) ){ if( count( $RR ) ){
$DATA['status']='ok'; $DATA['status']='ok';
$TID = intval( $RR[0]['id'] ); $TID = intval( $RR[0]['id'] );
if( $PLO == 'C' ){//Regular Island
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();
$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 '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();
$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 'E':
case 'C':{//Regular Island
if( $PLOC == 'B' ){//Bottom Track if( $PLOC == 'B' ){//Bottom Track
if( $TLOC == 'R' ){//Right if( $TLOC == 'R' ){//Right
$QS = "INSERT INTO `metro_modules` SET `track_id`={$TID}, `side`='F', `status`='D', `name`='$NAME', `IP4`='$IP4', `identity`='{$IDENT}'"; $QS = "INSERT INTO `metro_modules` SET `track_id`={$TID}, `side`='F', `status`='D', `name`='$NAME', `IP4`='$IP4', `identity`='{$IDENT}'";
@ -211,6 +251,41 @@
$DATABASE->Query( $QS ); $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 { } else {
$DATA['msg']='Wrong Track ID Provided!'; $DATA['msg']='Wrong Track ID Provided!';

37
lib/controller/doPlatformOperations.php

@ -372,7 +372,20 @@
$LOG->reg_op( $_POST ); $LOG->reg_op( $_POST );
break; 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 ) { if( $OID == 0 ) {
$Data['msg']='Wrong Parameters!'; $Data['msg']='Wrong Parameters!';
echo json_encode( $Data ); echo json_encode( $Data );
@ -385,6 +398,28 @@
$LOG->reg_op( $_POST ); $LOG->reg_op( $_POST );
break; 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 { } else {
$Data['msg']='Wrong Parameters!'; $Data['msg']='Wrong Parameters!';

15
lib/controller/getModuleEditor.php

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

43
lib/controller/getPlatformEditor.php

@ -13,17 +13,18 @@
border: false, border: false,
frame: false, frame: false,
tbar:[{ tbar:[{
id: 'btn_del_station',
id: 'btn_del_platform',
text: '{$Labels->GetLabel('_SMM_DEL_PLATFORM_')}', text: '{$Labels->GetLabel('_SMM_DEL_PLATFORM_')}',
handler: function(){ handler: function(){
Ext.Msg.show({ 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, buttons: Ext.Msg.OKCANCEL,
fn: function(btn){ fn: function(btn){
if( btn == 'ok' ){ if( btn == 'ok' ){
SelectedModule = 0;
doModuleOperation( {$CR['id']}, 200, '', true );
SelectedPlatform = 0;
oSelectedPlatform = 0;
doPlatformOperation( {$CR['id']}, 200, '', true );
}; };
}, },
icon: Ext.MessageBox.QUESTION icon: Ext.MessageBox.QUESTION
@ -62,7 +63,7 @@ JOJOKA;
if( $COS ) $COS = "rowspan={$COS} "; else $COS=""; 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>"; $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`"; $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 ); $Sz = $DATABASE->Query( $QS, false );
@ -199,7 +200,7 @@ JOJOKA;
},{ },{
xtype: 'combo', xtype: 'combo',
fieldLabel: "Platform Type", fieldLabel: "Platform Type",
id: 'pl_lay',
id: 'pl_lay_A',
width: 200, width: 200,
lazyRender: true, lazyRender: true,
mode: 'local', mode: 'local',
@ -216,8 +217,33 @@ JOJOKA;
valueField: 'abbr', valueField: 'abbr',
displayField: 'name', displayField: 'name',
value: '{$CR['layout']}', value: '{$CR['layout']}',
init_value: '{$CR['layout']}',
listeners:{ listeners:{
select: function( t, r, i ){ 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({ t.getEl().setStyle({
'background-image': 'url(' + r.data.icon + ')', 'background-image': 'url(' + r.data.icon + ')',
'background-repeat': 'no-repeat', 'background-repeat': 'no-repeat',
@ -225,7 +251,8 @@ JOJOKA;
'background-size': '16px 16px', 'background-size': '16px 16px',
'padding-left': '25px' 'padding-left': '25px'
}); });
doPlatformOperation( {$CR['id']}, 19, r.data.abbr, true );
doPlatformOperation( {$CR['id']}, 20, r.data.abbr, true );
};
}, },
afterrender: function( t ){ afterrender: function( t ){
t.getEl().setStyle({ t.getEl().setStyle({

86
lib/controller/getScadaEditor.php

@ -14,27 +14,28 @@
if( ( $CCCV & 0x08 ) == 0x08 ) $P4 = 'true'; else $P4 = 'false'; if( ( $CCCV & 0x08 ) == 0x08 ) $P4 = 'true'; else $P4 = 'false';
$MODBUS=<<<DATA_BOUNDARY $MODBUS=<<<DATA_BOUNDARY
{ {
xtype: 'panel',
l00ayout: 'table',
border: false,
frame: false,
width: '100%',
items:[{
xtype: 'panel', xtype: 'panel',
layout: 'table', layout: 'table',
border: false, border: false,
frame: false, frame: false,
width: '100%', 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
},
defaults: { bodyStyle:'padding:10px; text-align: center;'},
layoutConfig: { columns: 2 },
items:[{ items:[{
xtype: 'panel', xtype: 'panel',
border: false, border: false,
frame: false, frame: false,
rowspan: 2,
html: '<table width="100%" border=0><tr><td class="small_prop_logo" id="adam">&nbsp;</td></tr></table>' html: '<table width="100%" border=0><tr><td class="small_prop_logo" id="adam">&nbsp;</td></tr></table>'
},{ },{
xtype: 'form', xtype: 'form',
border: false,
frame: false,
labelWidth: 150, labelWidth: 150,
labelAlign: 'right', labelAlign: 'right',
width: '100%', width: '100%',
@ -42,7 +43,7 @@
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></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_')}:{$SC['label']}</td><td><img id="scae_onl_sts" src="/style/assets/bul_gray.png"></td></tr></table>'
},{ },{
xtype: 'textfield', xtype: 'textfield',
id: 'sca_label', id: 'sca_label',
@ -74,7 +75,7 @@
valueField: 'mode', valueField: 'mode',
displayField: 'mode_txt', displayField: 'mode_txt',
value: '{$SC['wm']}', value: '{$SC['wm']}',
fwidth: 200,
width: 200,
listeners:{ listeners:{
select: function( a, c, b ){ select: function( a, c, b ){
doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 17, b, true ); doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 17, b, true );
@ -102,20 +103,16 @@
doPlatformOperation( {$SC['platform_id']}, 16, c, true ); doPlatformOperation( {$SC['platform_id']}, 16, c, true );
} }
} }
}]
}]
},{ },{
xtype: 'panel', xtype: 'panel',
layout: 'table', layout: 'table',
border: false,
border: true,
frame: false, frame: false,
width: '100%', 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
},
defaults: { bodyStyle:'padding:10px; text-align: center;' },
layoutConfig: { columns: 4 },
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;',
@ -150,7 +147,7 @@
valueField: 'mode', valueField: 'mode',
displayField: 'mode_txt', displayField: 'mode_txt',
value: '{$SC['crossbar_a']}', value: '{$SC['crossbar_a']}',
width: 100,
width: 120,
listeners:{ listeners:{
select: function( a, c, b ){ select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true ); //doPlatformOperation( {$SC['platform_id']}, 12, b, true );
@ -174,7 +171,7 @@
valueField: 'mode', valueField: 'mode',
displayField: 'mode_txt', displayField: 'mode_txt',
value: '{$SC['crossbar_b']}', value: '{$SC['crossbar_b']}',
width: 100,
width: 120,
listeners:{ listeners:{
select: function( a, c, b ){ select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true ); //doPlatformOperation( {$SC['platform_id']}, 12, b, true );
@ -198,7 +195,7 @@
valueField: 'mode', valueField: 'mode',
displayField: 'mode_txt', displayField: 'mode_txt',
value: '{$SC['crossbar_c']}', value: '{$SC['crossbar_c']}',
width: 100,
width: 120,
listeners:{ listeners:{
select: function( a, c, b ){ select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true ); //doPlatformOperation( {$SC['platform_id']}, 12, b, true );
@ -222,7 +219,7 @@
valueField: 'mode', valueField: 'mode',
displayField: 'mode_txt', displayField: 'mode_txt',
value: '{$SC['crossbar_d']}', value: '{$SC['crossbar_d']}',
width: 100,
width: 120,
listeners:{ listeners:{
select: function( a, c, b ){ select: function( a, c, b ){
//doPlatformOperation( {$SC['platform_id']}, 12, b, true ); //doPlatformOperation( {$SC['platform_id']}, 12, b, true );
@ -243,58 +240,66 @@
colspan: 4 colspan: 4
},{ },{
xtype: 'button', xtype: 'button',
id: 'sc_tbtn_1',
enableToggle: true, enableToggle: true,
allowDepress: true, allowDepress: true,
width: '80%', width: '80%',
text: 'Test D1', text: 'Test D1',
pressed: {$P1}, pressed: {$P1},
handler: function( b, e ){ handler: function( b, e ){
b.disable();
if( b.pressed ){ if( b.pressed ){
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} | 1 ), true );
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} | 1 ), false );
} else { } else {
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} & ( ~1 ) ), true );
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} & ( ~1 ) ), false );
}; };
} }
},{ },{
xtype: 'button', xtype: 'button',
id: 'sc_tbtn_2',
width: '80%', width: '80%',
enableToggle: true, enableToggle: true,
allowDepress: true, allowDepress: true,
text: 'Test D2', text: 'Test D2',
pressed: {$P2}, pressed: {$P2},
handler: function( b, e ){ handler: function( b, e ){
b.disable();
if( b.pressed ){ if( b.pressed ){
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} | 2 ), true );
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} | 2 ), false );
} else { } else {
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} & ( ~2 ) ), true );
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} & ( ~2 ) ), false );
}; };
} }
},{ },{
xtype: 'button', xtype: 'button',
id: 'sc_tbtn_3',
enableToggle: true, enableToggle: true,
allowDepress: true, allowDepress: true,
width: '80%', width: '80%',
text: 'Test D3', text: 'Test D3',
pressed: {$P3}, pressed: {$P3},
handler: function( b, e ){ handler: function( b, e ){
b.disable();
if( b.pressed ){ if( b.pressed ){
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} | 4 ), true );
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} | 4 ), false );
} else { } else {
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} & ( ~4 ) ), true );
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} & ( ~4 ) ), false );
}; };
} }
},{ },{
xtype: 'button', xtype: 'button',
id: 'sc_tbtn_4',
enableToggle: true, enableToggle: true,
allowDepress: true, allowDepress: true,
width: '80%', width: '80%',
text: 'Test D4', text: 'Test D4',
pressed: {$P4}, pressed: {$P4},
handler: function( b, e ){ handler: function( b, e ){
b.disable();
if( b.pressed ){ if( b.pressed ){
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} | 8 ), true );
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} | 8 ), false );
} else { } else {
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} & ( ~8 ) ), true );
doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} & ( ~8 ) ), false );
}; };
} }
}] }]
@ -307,10 +312,21 @@
text: 'Remove this Scada Module', text: 'Remove this Scada Module',
width: '100%', width: '100%',
handler: function(){ handler: function(){
doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 13, 'true', true );
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; DATA_BOUNDARY;
echo $MODBUS; 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: /');
};
?>

49
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 ){ function loadMetroPlatformModules( platform_id, suse ){
if( suse == undefined ){ if( suse == undefined ){
suse = 0; suse = 0;
@ -862,8 +866,10 @@ function editFilter( fid ){
function editModule( s_id ){ function editModule( s_id ){
if( oSelectedModule ){ if( oSelectedModule ){
var tt = document.getElementById('MODULE_TAG_'+oSelectedModule ); var tt = document.getElementById('MODULE_TAG_'+oSelectedModule );
if( tt != null ){
tt.classList.remove('selected_green'); tt.classList.remove('selected_green');
tt.classList.add('active_green'); tt.classList.add('active_green');
} else oSelectedModule = 0;
}; };
var tt = document.getElementById('MODULE_TAG_'+s_id ); var tt = document.getElementById('MODULE_TAG_'+s_id );
if( tt!= undefined ){ if( tt!= undefined ){
@ -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 devUploadTimeout = null;
var devUploadID = -1; var devUploadID = -1;
function fetchDeviceUploadStatus(){ function fetchDeviceUploadStatus(){
@ -1257,6 +1301,7 @@ function downloadSettings(){
}); });
}); });
}; };
var addModuleWindow = null;
function addModule(){ function addModule(){
Ext.Ajax.request({ Ext.Ajax.request({
url: '/lib/controller/getAddModuleWindow.php', url: '/lib/controller/getAddModuleWindow.php',
@ -1267,7 +1312,7 @@ function addModule(){
}, },
success: function( response, opts ){ success: function( response, opts ){
var data = Ext.decode(response.responseText); var data = Ext.decode(response.responseText);
var addModuleWindow = new Ext.Window( data );
addModuleWindow = new Ext.Window( data );
addModuleWindow.show(); addModuleWindow.show();
}, },
failure: failureAJAXFunction failure: failureAJAXFunction
@ -1772,8 +1817,10 @@ function inintGisEditor( map_id, Lat, Lon ){
function editPlatform( s_id ){ function editPlatform( s_id ){
if( oSelectedPlatform ){ if( oSelectedPlatform ){
var tt = document.getElementById('PLATFORM_TAG_'+oSelectedPlatform ); var tt = document.getElementById('PLATFORM_TAG_'+oSelectedPlatform );
if( tt!= null ){
tt.classList.remove('selected_green'); tt.classList.remove('selected_green');
tt.classList.add('active_green'); tt.classList.add('active_green');
} else oSelectedPlatform = 0;
}; };
var tt = document.getElementById('PLATFORM_TAG_'+s_id ); var tt = document.getElementById('PLATFORM_TAG_'+s_id );
if( tt!= undefined ){ if( tt!= undefined ){

Loading…
Cancel
Save