diff --git a/files.list b/files.list index 95d9dd1..0ded38b 100644 --- a/files.list +++ b/files.list @@ -3424,6 +3424,7 @@ ./style/assets/vspc-icon-256.png ./style/assets/igr.png ./style/assets/sm_ico_w.png +./style/assets/sm_ico_gw.png ./style/assets/1141811-512.png ./style/assets/ms_ul.png ./style/assets/sm_ico_rl.png diff --git a/lib/controller/doPlatformOperations.php b/lib/controller/doPlatformOperations.php index efaf641..61a96e9 100644 --- a/lib/controller/doPlatformOperations.php +++ b/lib/controller/doPlatformOperations.php @@ -398,6 +398,62 @@ $LOG->reg_op( $_POST ); break; }; + case 21:{ // change Crossbar Output 'A' + $SCA = intval( $_POST['SCA'] ); + $NMD = intval( $_POST['OPCODE'] ); + if( $OID == 0 ) { + $Data['msg']='Wrong Parameters!'; + echo json_encode( $Data ); + exit(); + }; + $QS="UPDATE `modbus_modules` SET `crossbar_a` = {$NMD} WHERE `platform_id`={$OID} AND `id`={$SCA}"; + $DATABASE->Query( $QS ); + $Data['success'] = true; + $LOG->reg_op( $_POST ); + break; + }; + case 22:{ // change Crossbar Output 'A' + $SCA = intval( $_POST['SCA'] ); + $NMD = intval( $_POST['OPCODE'] ); + if( $OID == 0 ) { + $Data['msg']='Wrong Parameters!'; + echo json_encode( $Data ); + exit(); + }; + $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 23:{ // change Crossbar Output 'A' + $SCA = intval( $_POST['SCA'] ); + $NMD = intval( $_POST['OPCODE'] ); + if( $OID == 0 ) { + $Data['msg']='Wrong Parameters!'; + echo json_encode( $Data ); + exit(); + }; + $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 24:{ // change Crossbar Output 'A' + $SCA = intval( $_POST['SCA'] ); + $NMD = intval( $_POST['OPCODE'] ); + if( $OID == 0 ) { + $Data['msg']='Wrong Parameters!'; + echo json_encode( $Data ); + exit(); + }; + $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 200:{ //Remove Platform if( $OID ){ $QS = "SELECT `id` FROM `metro_tracks` WHERE `platform_id`={$OID}"; diff --git a/lib/controller/getScadaEditor.php b/lib/controller/getScadaEditor.php index 39389ed..50c8c3c 100644 --- a/lib/controller/getScadaEditor.php +++ b/lib/controller/getScadaEditor.php @@ -31,12 +31,13 @@ xtype: 'panel', border: false, frame: false, - html: '
' + width: 160, + html: '
' },{ xtype: 'form', border: false, frame: false, - labelWidth: 150, + labelWidth: 100, labelAlign: 'right', width: '100%', items:[{ @@ -44,6 +45,9 @@ border: false, frame: false, html: '
{$Labels->GetLabel('_MODBUS_RTU_')}:{$SC['label']}
' + },{ + xtype: 'spacer', + height: 5 },{ xtype: 'textfield', id: 'sca_label', @@ -100,7 +104,7 @@ value: '{$SC['port']}', listeners:{ change: function( a, c, b ){ - doPlatformOperation( {$SC['platform_id']}, 16, c, true ); + doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 16, c, true ); } } }] @@ -131,6 +135,7 @@ html: 'AUX Signal' },{ xtype: 'combo', + id: 'sce_cb_o_1', lazyRender: true, mode: 'local', forceSelection: true, @@ -140,21 +145,22 @@ 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'] + [0,'{$Labels->GetLabel('__DISABLED__')}'], + [1,'Coil D1'],[2,'Coil D2'],[3,'Coil D3'],[4,'Coil D4'] ] }), valueField: 'mode', displayField: 'mode_txt', - value: '{$SC['crossbar_a']}', + value: '0', width: 120, listeners:{ select: function( a, c, b ){ - //doPlatformOperation( {$SC['platform_id']}, 12, b, true ); + doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 21, b, false ); } } },{ xtype: 'combo', + id: 'sce_cb_o_2', lazyRender: true, mode: 'local', forceSelection: true, @@ -164,21 +170,22 @@ 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'] + [0,'{$Labels->GetLabel('__DISABLED__')}'], + [1,'Coil D1'],[2,'Coil D2'],[3,'Coil D3'],[4,'Coil D4'] ] }), valueField: 'mode', displayField: 'mode_txt', - value: '{$SC['crossbar_b']}', + value: '0', width: 120, listeners:{ select: function( a, c, b ){ - //doPlatformOperation( {$SC['platform_id']}, 12, b, true ); + doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 22, b, false ); } } },{ xtype: 'combo', + id: 'sce_cb_o_3', lazyRender: true, mode: 'local', forceSelection: true, @@ -188,21 +195,22 @@ 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'] + [0,'{$Labels->GetLabel('__DISABLED__')}'], + [1,'Coil D1'],[2,'Coil D2'],[3,'Coil D3'],[4,'Coil D4'] ] }), valueField: 'mode', displayField: 'mode_txt', - value: '{$SC['crossbar_c']}', + value: '0', width: 120, listeners:{ select: function( a, c, b ){ - //doPlatformOperation( {$SC['platform_id']}, 12, b, true ); + doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 23, b, false ); } } },{ xtype: 'combo', + id: 'sce_cb_o_4', lazyRender: true, mode: 'local', forceSelection: true, @@ -212,32 +220,23 @@ 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'] + [0,'{$Labels->GetLabel('__DISABLED__')}'], + [1,'Coil D1'],[2,'Coil D2'],[3,'Coil D3'],[4,'Coil D4'] ] }), valueField: 'mode', displayField: 'mode_txt', - value: '{$SC['crossbar_d']}', + value: '0', width: 120, listeners:{ select: function( a, c, b ){ - //doPlatformOperation( {$SC['platform_id']}, 12, b, true ); + doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 24, b, false ); } } },{ 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', id: 'sc_tbtn_1', @@ -246,6 +245,7 @@ width: '80%', text: 'Test D1', pressed: {$P1}, + disabled: true, handler: function( b, e ){ b.disable(); if( b.pressed ){ @@ -262,6 +262,7 @@ allowDepress: true, text: 'Test D2', pressed: {$P2}, + disabled: true, handler: function( b, e ){ b.disable(); if( b.pressed ){ @@ -278,6 +279,7 @@ width: '80%', text: 'Test D3', pressed: {$P3}, + disabled: true, handler: function( b, e ){ b.disable(); if( b.pressed ){ @@ -294,6 +296,7 @@ width: '80%', text: 'Test D4', pressed: {$P4}, + disabled: true, handler: function( b, e ){ b.disable(); if( b.pressed ){ @@ -302,6 +305,130 @@ doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} & ( ~8 ) ), false ); }; } + },{ + xtype: 'spacer', + height: 5, + colspan: 4 + },{ + xtype: 'panel', + bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;', + html: 'DI 0 ' + },{ + xtype: 'panel', + bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;', + html: 'DI 1 ' + },{ + xtype: 'panel', + bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;', + html: 'DI 2 ' + },{ + xtype: 'panel', + bodyCssClass:'_infoPanel', bodyStyle: 'font-size: 10px; background-color: #000; text-align: center;', + html: 'DI 3 ' + },{ + xtype: 'spacer', + height: 5, + colspan: 4 + },{ + xtype: 'combo', + id: 'sce_cb_i_1', + 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('__DISABLED__')}'], + [1,'Upper Track'],[2,'Bottom Track'],[3,'Both'] + ] + }), + valueField: 'mode', + displayField: 'mode_txt', + value: '-1', + width: 120, + listeners:{ + select: function( a, c, b ){ + //doPlatformOperation( {$SC['platform_id']}, 12, b, true ); + } + } + },{ + xtype: 'combo', + id: 'sce_cb_i_2', + 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('__DISABLED__')}'], + [1,'Upper Track'],[2,'Bottom Track'],[3,'Both'] + ] + }), + valueField: 'mode', + displayField: 'mode_txt', + value: '-1', + width: 120, + listeners:{ + select: function( a, c, b ){ + //doPlatformOperation( {$SC['platform_id']}, 12, b, true ); + } + } + },{ + xtype: 'combo', + id: 'sce_cb_i_3', + 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('__DISABLED__')}'], + [1,'Upper Track'],[2,'Bottom Track'],[3,'Both'] + ] + }), + valueField: 'mode', + displayField: 'mode_txt', + value: '-1', + width: 120, + listeners:{ + select: function( a, c, b ){ + //doPlatformOperation( {$SC['platform_id']}, 12, b, true ); + } + } + },{ + xtype: 'combo', + id: 'sce_cb_i_4', + 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('__DISABLED__')}'], + [1,'Upper Track'],[2,'Bottom Track'],[3,'Both'] + ] + }), + valueField: 'mode', + displayField: 'mode_txt', + value: '-1', + width: 120, + listeners:{ + select: function( a, c, b ){ + //doPlatformOperation( {$SC['platform_id']}, 12, b, true ); + } + } }] },{ xtype: 'spacer', @@ -317,14 +444,10 @@ }], listeners: { afterrender: function( panel ){ - console.log('Panel is Rendered'); + fetchScadaEditorStatus(); }, 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'); + stopScadaEditorStatusUpdate(); } } } diff --git a/lib/controller/getScadaStatus.php b/lib/controller/getScadaStatus.php index 01dcd1c..f078505 100644 --- a/lib/controller/getScadaStatus.php +++ b/lib/controller/getScadaStatus.php @@ -14,12 +14,40 @@ if( $MID ){ unset( $Data['msg'] ); $Data['status'] = 'ok'; - $QS = "SELECT `status`, `values`, `crossbar_a`,`crossbar_b`,`crossbar_c`,`crossbar_d` WHERE `id`={$MID}"; + $QS = "SELECT `wm`, `status`, `values`, `crossbar_a`,`crossbar_b`,`crossbar_c`,`crossbar_d` FROM `modbus_modules` WHERE `id`={$MID}"; $RR = $DATABASE->Query( $QS, false ); - $VV = intval( $RR[0]['values']; - $VO = $VV & 0xFF; - $VI = ($VV >> 8 ) & 0xFF; - + if( $RR[0]['wm'] == 'E' ){ + $Data['online'] = (intval($RR[0]['status']))?true:false; + if( $Data['online'] ){ + $VV = intval( $RR[0]['values'] ); + $VO = $VV & 0xFF; + $Data['outputs']=array(); + $Data['outputs'][] = ($VO & 1)?true:false; + $Data['outputs'][] = ($VO & 2)?true:false; + $Data['outputs'][] = ($VO & 4)?true:false; + $Data['outputs'][] = ($VO & 8)?true:false; + $VI = ($VV >> 8 ) & 0xFF; + $Data['inputs']=array(); + $Data['inputs'][] = ($VI & 1)?true:false; + $Data['inputs'][] = ($VI & 2)?true:false; + $Data['inputs'][] = ($VI & 4)?true:false; + $Data['inputs'][] = ($VI & 8)?true:false; + }; + } else { + $Data['online'] = false; + }; + $VV = intval( $RR[0]['crossbar_a'] ); + $Data['cb_out_a'] = $VV & 0x0F; + $Data['cb_in_a'] = ( $VV >> 4 ) & 0x0F; + $VV = intval( $RR[0]['crossbar_b'] ); + $Data['cb_out_b'] = $VV & 0x0F; + $Data['cb_in_b'] = ( $VV >> 4 ) & 0x0F; + $VV = intval( $RR[0]['crossbar_c'] ); + $Data['cb_out_c'] = $VV & 0x0F; + $Data['cb_in_c'] = ( $VV >> 4 ) & 0x0F; + $VV = intval( $RR[0]['crossbar_d'] ); + $Data['cb_out_d'] = $VV & 0x0F; + $Data['cb_in_d'] = ( $VV >> 4 ) & 0x0F; }; }; break; diff --git a/lib/javascript/jsapi_dynamic/argus_settings.js b/lib/javascript/jsapi_dynamic/argus_settings.js index 2415ee8..79a7c3f 100644 --- a/lib/javascript/jsapi_dynamic/argus_settings.js +++ b/lib/javascript/jsapi_dynamic/argus_settings.js @@ -1188,32 +1188,165 @@ function stopScadaEditorStatusUpdate(){ }; function fetchScadaEditorStatus(){ - clearTimeout( scadaEditorStatusTimeout ); + if( scadaEditorStatusTimeout != null ) clearTimeout( scadaEditorStatusTimeout ); scadaEditorStatusTimeout = null; Ext.Ajax.request({ url: '/lib/controller/getScadaStatus.php', params: { UID: , SID: '', - DID: devUploadID + MODE: 0, + MID: SelectedScadaModule }, 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('

Uploading '+data.count+' file(s)

'); - document.getElementById('upp_ctext').innerHTML ='

Current File: '+data.current+'

'; - Ext.getCmp('upp_pbar').updateProgress( data.progress, Math.round( data.progress*100 )+'%', true ); - scadaEditorStatusTimeout = setTimeout( fetchScadaEditorStatus, 1000 ); + var data = Ext.decode(response.responseText); + if( data.status == 'ok' ){ + if( data.online ){ + var lt = document.getElementById('scae_onl_sts'); + if( lt != undefined ) lt.src = "/style/assets/bul_green.png"; + lt = document.getElementById('sce_in_1_img'); + if( data.inputs[0] ){ + if( lt != undefined ) lt.src = "/style/assets/sm_ico_o.png"; + } else { + if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png"; + }; + lt = document.getElementById('sce_in_2_img'); + if( data.inputs[1] ){ + if( lt != undefined ) lt.src = "/style/assets/sm_ico_o.png"; + } else { + if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png"; + }; + lt = document.getElementById('sce_in_3_img'); + if( data.inputs[2] ){ + if( lt != undefined ) lt.src = "/style/assets/sm_ico_o.png"; + } else { + if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png"; + }; + lt = document.getElementById('sce_in_4_img'); + if( data.inputs[3] ){ + if( lt != undefined ) lt.src = "/style/assets/sm_ico_o.png"; + } else { + if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png"; + }; + var tT = Ext.getCmp('sc_tbtn_1'); + if( tT != undefined ){ + tT.enable(); + tT.suspendEvents(); + tT.toggle( data.outputs[0] ); + tT.resumeEvents(); + }; + tT = Ext.getCmp('sc_tbtn_2'); + if( tT != undefined ){ + tT.enable(); + tT.suspendEvents(); + tT.toggle( data.outputs[1] ); + tT.resumeEvents(); + }; + tT = Ext.getCmp('sc_tbtn_3'); + if( tT != undefined ){ + tT.enable(); + tT.suspendEvents(); + tT.toggle( data.outputs[2] ); + tT.resumeEvents(); + }; + tT = Ext.getCmp('sc_tbtn_4'); + if( tT != undefined ){ + tT.enable(); + tT.suspendEvents(); + tT.toggle( data.outputs[3] ); + tT.resumeEvents(); + }; } else { - Ext.getCmp('upload_progres_panel').hide(); - Ext.getCmp('uploaded_grid').show(); - loadModuleFiles( devUploadID ); + var lt = document.getElementById('scae_onl_sts'); + if( lt != undefined ) lt.src = "/style/assets/bul_gray.png"; + lt = document.getElementById('sce_in_1_img'); + if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png"; + lt = document.getElementById('sce_in_2_img'); + if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png"; + lt = document.getElementById('sce_in_3_img'); + if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png"; + lt = document.getElementById('sce_in_4_img'); + if( lt != undefined ) lt.src = "/style/assets/sm_ico_gw.png"; + var tT = Ext.getCmp('sc_tbtn_1'); + if( tT != undefined ){ + tT.disable(); + tT.suspendEvents(); + tT.toggle( false ); + tT.resumeEvents(); + }; + tT = Ext.getCmp('sc_tbtn_2'); + if( tT != undefined ){ + tT.disable(); + tT.suspendEvents(); + tT.toggle( false ); + tT.resumeEvents(); + }; + tT = Ext.getCmp('sc_tbtn_3'); + if( tT != undefined ){ + tT.disable(); + tT.suspendEvents(); + tT.toggle( false ); + tT.resumeEvents(); + }; + tT = Ext.getCmp('sc_tbtn_4'); + if( tT != undefined ){ + tT.disable(); + tT.suspendEvents(); + tT.toggle( false ); + tT.resumeEvents(); + }; }; + var tT = Ext.getCmp('sce_cb_o_1'); + if( tT != undefined ){ + tT.suspendEvents(); + tT.setValue( data.cb_out_a ); + tT.resumeEvents(); + }; + tT = Ext.getCmp('sce_cb_o_2'); + if( tT != undefined ){ + tT.suspendEvents(); + tT.setValue( data.cb_out_b ); + tT.resumeEvents(); + }; + tT = Ext.getCmp('sce_cb_o_3'); + if( tT != undefined ){ + tT.suspendEvents(); + tT.setValue( data.cb_out_c ); + tT.resumeEvents(); + }; + tT = Ext.getCmp('sce_cb_o_4'); + if( tT != undefined ){ + tT.suspendEvents(); + tT.setValue( data.cb_out_d ); + tT.resumeEvents(); + }; + tT = Ext.getCmp('sce_cb_i_1'); + if( tT != undefined ){ + tT.suspendEvents(); + tT.setValue( data.cb_in_a ); + tT.resumeEvents(); + }; + tT = Ext.getCmp('sce_cb_i_2'); + if( tT != undefined ){ + tT.suspendEvents(); + tT.setValue( data.cb_in_b ); + tT.resumeEvents(); + }; + tT = Ext.getCmp('sce_cb_i_3'); + if( tT != undefined ){ + tT.suspendEvents(); + tT.setValue( data.cb_in_c ); + tT.resumeEvents(); + }; + tT = Ext.getCmp('sce_cb_i_4'); + if( tT != undefined ){ + tT.suspendEvents(); + tT.setValue( data.cb_in_d ); + tT.resumeEvents(); + }; + scadaEditorStatusTimeout = setTimeout( fetchScadaEditorStatus, 1000 ); + } else { + //show error msg }; }, failure: failureAJAXFunction diff --git a/style/assets/sm_ico_gw.png b/style/assets/sm_ico_gw.png new file mode 100644 index 0000000..c1d1898 Binary files /dev/null and b/style/assets/sm_ico_gw.png differ diff --git a/style/style.css b/style/style.css index e667d6e..b53de5f 100644 --- a/style/style.css +++ b/style/style.css @@ -2316,6 +2316,19 @@ input[type="range"]:focus::-moz-range-thumb { background-image: url("assets/adam-1.png")!important; } +.medium_prop_logo{ + width: 128px; + height: 128px; + border-radius: 64px; +} +.medium_prop_logo#adam{ + background-color: orange; + background-repeat: no-repeat; + background-position: 12px 12px; + background-size: 100px 100px; + background-image: url("assets/adam-1.png")!important; +} + .small_vd_btn{ cursor: pointer; background-color: yellow;