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.

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