You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

305 lines
7.7 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. require_once('../php/argus/server.php');
  4. if( $CUser->Data['id'] > 1 ){
  5. $EID = intval( $_POST['MID'] );
  6. $QS = "SELECT * FROM `modbus_modules` WHERE `id`={$EID}";
  7. $Result = $DATABASE->Query( $QS, false );
  8. if( count( $Result ) ){
  9. $SC = $Result[0];
  10. $CCCV = intval( $SC['values'] );
  11. if( ( $CCCV & 0x01 ) == 0x01 ) $P1 = 'true'; else $P1 = 'false';
  12. if( ( $CCCV & 0x02 ) == 0x02 ) $P2 = 'true'; else $P2 = 'false';
  13. if( ( $CCCV & 0x04 ) == 0x04 ) $P3 = 'true'; else $P3 = 'false';
  14. if( ( $CCCV & 0x08 ) == 0x08 ) $P4 = 'true'; else $P4 = 'false';
  15. $MODBUS=<<<DATA_BOUNDARY
  16. {
  17. xtype: 'form',
  18. labelWidth: 150,
  19. labelAlign: 'right',
  20. width: '100%',
  21. items:[{
  22. xtype: 'panel',
  23. border: false,
  24. frame: false,
  25. html: '<table width="100%" border=0><tr><td class="small_prop_logo" id="adam">&nbsp;</td><td class="small_prop_title" align="center">{$Labels->GetLabel('_MODBUS_RTU_')}:{$SC['label']}</td></tr></table>'
  26. },{
  27. xtype: 'textfield',
  28. id: 'sca_label',
  29. fieldLabel: '{$Labels->GetLabel('_NAME_LABEL_')}',
  30. maxlength: 64,
  31. value: '{$SC['label']}',
  32. listeners:{
  33. change: function( a, c, b ){
  34. doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 14, c, true );
  35. }
  36. }
  37. },{
  38. xtype: 'combo',
  39. id: 'sca_ena',
  40. fieldLabel: "{$Labels->GetLabel('_STATUS_')}",
  41. lazyRender: true,
  42. mode: 'local',
  43. forceSelection: true,
  44. triggerAction: 'all',
  45. editable: false,
  46. disableKeyFilter: true,
  47. store: new Ext.data.ArrayStore({
  48. fields: ['mode','mode_txt'],
  49. data: [
  50. ['D','{$Labels->GetLabel('__DISABLED__')}'],
  51. ['E','{$Labels->GetLabel('___ENABLED__')}']
  52. ]
  53. }),
  54. valueField: 'mode',
  55. displayField: 'mode_txt',
  56. value: '{$SC['wm']}',
  57. fwidth: 200,
  58. listeners:{
  59. select: function( a, c, b ){
  60. doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 17, b, true );
  61. }
  62. }
  63. },{
  64. xtype: 'textfield',
  65. id: 'sca_ip',
  66. fieldLabel: '{$Labels->GetLabel('_DEVICE_IP_')}',
  67. maxlength: 64,
  68. value: '{$SC['ip4']}',
  69. listeners:{
  70. change: function( a, c, b ){
  71. doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 15, c, true );
  72. }
  73. }
  74. },{
  75. xtype: 'textfield',
  76. id: 'sca_port',
  77. fieldLabel: '{$Labels->GetLabel('_DEVICE_PORT_')}',
  78. maxlength: 2,
  79. value: '{$SC['port']}',
  80. listeners:{
  81. change: function( a, c, b ){
  82. doPlatformOperation( {$SC['platform_id']}, 16, c, true );
  83. }
  84. }
  85. },{
  86. xtype: 'panel',
  87. layout: 'table',
  88. border: false,
  89. frame: false,
  90. width: '100%',
  91. defaults: {
  92. // applied to each contained panel
  93. bodyStyle:'padding:10px; text-align: center;'
  94. },
  95. layoutConfig: {
  96. // The total column count must be specified here
  97. columns: 4
  98. },
  99. items:[{
  100. xtype: 'panel',
  101. bodyCssClass:'_infoPanel', bodyStyle: 'background-color: #000; text-align: center;',
  102. html: 'Upper Track'
  103. },{
  104. xtype: 'panel',
  105. bodyCssClass:'_infoPanel', bodyStyle: 'background-color: #000; text-align: center;',
  106. html: 'Bottom Track'
  107. },{
  108. xtype: 'panel',
  109. bodyCssClass:'_infoPanel', bodyStyle: 'background-color: #000; text-align: center;',
  110. html: 'Health Signal'
  111. },{
  112. xtype: 'panel',
  113. bodyCssClass:'_infoPanel', bodyStyle: 'background-color: #000; text-align: center;',
  114. html: 'AUX Signal'
  115. },{
  116. xtype: 'combo',
  117. fieldLabel: "Upper Track",
  118. lazyRender: true,
  119. mode: 'local',
  120. forceSelection: true,
  121. triggerAction: 'all',
  122. editable: false,
  123. disableKeyFilter: true,
  124. store: new Ext.data.ArrayStore({
  125. fields: ['mode','mode_txt'],
  126. data: [
  127. [-1,'{$Labels->GetLabel('__DISABLED__')}'],
  128. [0,'Coil D1'],[1,'Coil D2'],[2,'Coil D3'],[3,'Coil D4']
  129. ]
  130. }),
  131. valueField: 'mode',
  132. displayField: 'mode_txt',
  133. value: '{$SC['crossbar_a']}',
  134. width: 100,
  135. listeners:{
  136. select: function( a, c, b ){
  137. //doPlatformOperation( {$SC['platform_id']}, 12, b, true );
  138. }
  139. }
  140. },{
  141. xtype: 'combo',
  142. fieldLabel: "Upper Track",
  143. lazyRender: true,
  144. mode: 'local',
  145. forceSelection: true,
  146. triggerAction: 'all',
  147. editable: false,
  148. disableKeyFilter: true,
  149. store: new Ext.data.ArrayStore({
  150. fields: ['mode','mode_txt'],
  151. data: [
  152. [-1,'{$Labels->GetLabel('__DISABLED__')}'],
  153. [0,'Coil D1'],[1,'Coil D2'],[2,'Coil D3'],[3,'Coil D4']
  154. ]
  155. }),
  156. valueField: 'mode',
  157. displayField: 'mode_txt',
  158. value: '{$SC['crossbar_b']}',
  159. width: 100,
  160. listeners:{
  161. select: function( a, c, b ){
  162. //doPlatformOperation( {$SC['platform_id']}, 12, b, true );
  163. }
  164. }
  165. },{
  166. xtype: 'combo',
  167. fieldLabel: "Upper Track",
  168. lazyRender: true,
  169. mode: 'local',
  170. forceSelection: true,
  171. triggerAction: 'all',
  172. editable: false,
  173. disableKeyFilter: true,
  174. store: new Ext.data.ArrayStore({
  175. fields: ['mode','mode_txt'],
  176. data: [
  177. [-1,'{$Labels->GetLabel('__DISABLED__')}'],
  178. [0,'Coil D1'],[1,'Coil D2'],[2,'Coil D3'],[3,'Coil D4']
  179. ]
  180. }),
  181. valueField: 'mode',
  182. displayField: 'mode_txt',
  183. value: '{$SC['crossbar_c']}',
  184. width: 100,
  185. listeners:{
  186. select: function( a, c, b ){
  187. //doPlatformOperation( {$SC['platform_id']}, 12, b, true );
  188. }
  189. }
  190. },{
  191. xtype: 'combo',
  192. fieldLabel: "Upper Track",
  193. lazyRender: true,
  194. mode: 'local',
  195. forceSelection: true,
  196. triggerAction: 'all',
  197. editable: false,
  198. disableKeyFilter: true,
  199. store: new Ext.data.ArrayStore({
  200. fields: ['mode','mode_txt'],
  201. data: [
  202. [-1,'{$Labels->GetLabel('__DISABLED__')}'],
  203. [0,'Coil D1'],[1,'Coil D2'],[2,'Coil D3'],[3,'Coil D4']
  204. ]
  205. }),
  206. valueField: 'mode',
  207. displayField: 'mode_txt',
  208. value: '{$SC['crossbar_d']}',
  209. width: 100,
  210. listeners:{
  211. select: function( a, c, b ){
  212. //doPlatformOperation( {$SC['platform_id']}, 12, b, true );
  213. }
  214. }
  215. },{
  216. xtype: 'spacer',
  217. height: 10,
  218. colspan: 4
  219. },{
  220. xtype: 'panel',
  221. colspan: 4,
  222. bodyCssClass:'_infoPanel', bodyStyle: 'background-color: #000; text-align: center;',
  223. html: 'TEST MODBUS MODULE COILS'
  224. },{
  225. xtype: 'spacer',
  226. height: 5,
  227. colspan: 4
  228. },{
  229. xtype: 'button',
  230. enableToggle: true,
  231. allowDepress: true,
  232. width: '80%',
  233. text: 'Test D1',
  234. pressed: {$P1},
  235. handler: function( b, e ){
  236. if( b.pressed ){
  237. doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} | 1 ), true );
  238. } else {
  239. doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} & ( ~1 ) ), true );
  240. };
  241. }
  242. },{
  243. xtype: 'button',
  244. width: '80%',
  245. enableToggle: true,
  246. allowDepress: true,
  247. text: 'Test D2',
  248. pressed: {$P2},
  249. handler: function( b, e ){
  250. if( b.pressed ){
  251. doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} | 2 ), true );
  252. } else {
  253. doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} & ( ~2 ) ), true );
  254. };
  255. }
  256. },{
  257. xtype: 'button',
  258. enableToggle: true,
  259. allowDepress: true,
  260. width: '80%',
  261. text: 'Test D3',
  262. pressed: {$P3},
  263. handler: function( b, e ){
  264. if( b.pressed ){
  265. doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} | 4 ), true );
  266. } else {
  267. doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} & ( ~4 ) ), true );
  268. };
  269. }
  270. },{
  271. xtype: 'button',
  272. enableToggle: true,
  273. allowDepress: true,
  274. width: '80%',
  275. text: 'Test D4',
  276. pressed: {$P4},
  277. handler: function( b, e ){
  278. if( b.pressed ){
  279. doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} | 8 ), true );
  280. } else {
  281. doPlatformOperation( {$SC['platform_id']}, 18, ({$CCCV} & ( ~8 ) ), true );
  282. };
  283. }
  284. }]
  285. },{
  286. xtype: 'spacer',
  287. height: 5,
  288. colspan: 4
  289. },{
  290. xtype: 'button',
  291. text: 'Remove this Scada Module',
  292. width: '100%',
  293. handler: function(){
  294. doScadaOperation( {$SC['platform_id']}, {$SC['id']}, 13, 'true', true );
  295. }
  296. }]
  297. }
  298. DATA_BOUNDARY;
  299. echo $MODBUS;
  300. } else {
  301. echo '{ xtype: \'panel\', html: \'Node '.$_POST['EID'].' Loadded\'}';
  302. };
  303. } else {
  304. header('location: /');
  305. };
  306. ?>