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.

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