Web Interface For Lite Argus Control modules
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.

466 lines
13 KiB

​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
3 years ago
​
3 years ago
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
3 years ago
​
​
​
​
3 years ago
​
5 months ago
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
3 years ago
3 years ago
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. function inject_labels( $TPL ){
  4. global $Labels;
  5. $TPL = str_replace('%%%LABEL%%%TOOLBOX%%%', $Labels->GetLabel('_TOOLBOX_') , $TPL );
  6. $TPL = str_replace('%%%LABEL%%%CLEALARM%%%', $Labels->GetLabel('_CLEAR_ALARM_') , $TPL );
  7. $TPL = str_replace('%%%LABEL%%%DRABACKGROUND%%%', $Labels->GetLabel('_DRAW_BACKGROUND_') , $TPL );
  8. $TPL = str_replace('%%%LABEL%%%STUBACKGROUND%%%', $Labels->GetLabel('_STUDY_BACKGROUND_') , $TPL );
  9. $TPL = str_replace('%%%LABEL%%%MASKEDITOR%%%', $Labels->GetLabel('_MASK_EDITOR_') , $TPL );
  10. $TPL = str_replace('%%%LABEL%%%MASKMNGR%%%', $Labels->GetLabel('_MASK_MANAGER_') , $TPL );
  11. $TPL = str_replace('%%%LABEL%%%ACKNOLAGE%%%', $Labels->GetLabel('_DEV_ACK_BTN_') , $TPL );
  12. $TPL = str_replace('%%%LABEL%%%FREZBUBLE%%%', $Labels->GetLabel('_DEV_FRZ_BBL_BTN_') , $TPL );
  13. $TPL = str_replace('%%%LABEL%%%DELBUBLE%%%', $Labels->GetLabel('_DEV_DEL_BBL_BTN_') , $TPL );
  14. return $TPL;
  15. };
  16. if( $CUser->Data['id'] > 1 ){
  17. $SI = 0;
  18. $SOK = false;
  19. $FOK = false;
  20. if( isset( $_POST['SEN'] ) ) $SI = intval( $_POST['SEN'] );
  21. if( $SI ){
  22. $FOK = true;
  23. $QS = "SELECT `ls`.*, `no`.`id` as `node_id`, `no`.`name` FROM `lrf_sensors` `ls` LEFT JOIN `nodes` `no` ON ( `no`.`type`=`ls`.`type` AND `no`.`aux_id` = `ls`.`id` ) WHERE `ls`.`id`={$SI}";
  24. $JJR = $DATABASE->Query( $QS, false );
  25. $DUDU = false;
  26. if( count( $JJR ) ){
  27. $DD = $JJR[0];
  28. //$QS = "SELECT * FROM `lrf_detection_profiles` WHERE `aux_id`={$SI} AND `profile_id`=0 AND `lrf_id`=0 AND `master`=1";
  29. $QS = "SELECT * FROM `lrf_detection_profiles` WHERE `aux_id`={$SI} AND `profile_id`=0 AND `lrf_id`=0 ORDER BY `master` DESC";
  30. $JJR = $DATABASE->Query( $QS, false );
  31. $SD = $JJR[0];
  32. if( $DD['type'] == 1 ){
  33. // Dual LRF Device (ALS)
  34. $AD = $JJR[1];
  35. $DUDU = true;
  36. };
  37. $DD['dc_auto'] = intval( $DD['dc_auto'] );
  38. $DD['dc_no'] = intval( $DD['dc_no'] );
  39. $DD['dc_window'] = intval( $DD['dc_window'] );
  40. $SOK = true;
  41. } else {
  42. $MSG = 'The Sensor ID is Wrong!';
  43. };
  44. } else {
  45. $MSG = 'The Sensor ID not Set!';
  46. };
  47. $LILI=<<<_DATA_BOUNDARY
  48. ,listeners:{
  49. afterrender: function(){
  50. Ext.Msg.show({
  51. title: '{$Labels->GetLabel('_INFO_')}',
  52. msg: '{$MSG}',
  53. buttons: Ext.Msg.OK,
  54. fn: function(){
  55. var tt = Ext.getCmp('up_se_popanel');
  56. tt.removeAll( true );
  57. tt.doLayout();
  58. },
  59. icon: Ext.MessageBox.INFO
  60. });
  61. }
  62. }
  63. _DATA_BOUNDARY;
  64. $SLRFDET=<<<_DATA_BOUNDARY
  65. ,{
  66. xtype: 'panel',
  67. id: 'up_sse_popanel',
  68. border: true,
  69. title: '{$Labels->GetLabel('_SLV_LRF_DET_SET_')}',
  70. frame: false,
  71. labelWidth: 150,
  72. labelAlign: 'right',
  73. layout: 'form',
  74. height: PanelH-10,
  75. bbar:[{
  76. text: 'Apply Settings',
  77. handler: function(){
  78. var moder = Ext.getCmp('m_order').getValue();
  79. var moset = Ext.getCmp('m_offset').getValue();
  80. var model = Ext.getCmp('m_delta').getValue();
  81. var mofli = Ext.getCmp('m_flip').getValue();
  82. var mowid = Ext.getCmp('m_width').getValue();
  83. var mosst = Ext.getCmp('m_sst').getValue();
  84. var mosun = Ext.getCmp('m_sun').getValue();
  85. %%%SLAVE_VARS%%%
  86. Ext.Ajax.request({
  87. url: '/lib/controller/doSensorOperation.php',
  88. params: {
  89. UID: {$UserID},
  90. SID: '{$Session}',
  91. SNID: '{$SI}',
  92. OPID: 19,
  93. MOFF: moset,
  94. MORD: moder,
  95. MDEL: model,
  96. MFLI: mofli,
  97. MWIZ: mowid,
  98. MSST: mosst,
  99. MSUN: mosun
  100. %%%SLAVE_DEFS%%%
  101. },
  102. success: function( response, opts ){
  103. Ext.Msg.show({
  104. title: '{$Labels->GetLabel('_INFO_')}',
  105. msg: '{$Labels->GetLabel('_SARE_SAVED_')}',
  106. buttons: Ext.Msg.OK,
  107. icon: Ext.MessageBox.INFO
  108. });
  109. },
  110. failure: failureAJAXFunction
  111. });
  112. }
  113. }],
  114. items:[{
  115. xtype: 'numberfield',
  116. id: 's_order',
  117. fieldLabel: 'Order',
  118. value: '{$AD['order']}'
  119. },{
  120. xtype: 'numberfield',
  121. id: 's_offset',
  122. fieldLabel: 'Offset',
  123. value: '{$AD['offset']}'
  124. },{
  125. xtype: 'numberfield',
  126. id: 's_delta',
  127. fieldLabel: 'Delta',
  128. value: '{$AD['delta']}'
  129. },{
  130. xtype: 'numberfield',
  131. id: 's_flip',
  132. fieldLabel: 'Flip',
  133. value: '{$AD['flip']}'
  134. },{
  135. xtype: 'numberfield',
  136. id: 's_width',
  137. fieldLabel: 'Width',
  138. value: '{$AD['width']}'
  139. },{
  140. xtype: 'numberfield',
  141. id: 's_sst',
  142. fieldLabel: 'SST',
  143. value: '{$AD['sst']}'
  144. },{
  145. xtype: 'numberfield',
  146. id: 's_sun',
  147. fieldLabel: 'Sun',
  148. value: '{$AD['sun']}'
  149. }]
  150. }
  151. _DATA_BOUNDARY;
  152. $SLRFVARS=<<<_DATA_BOUNDARY
  153. var soder = Ext.getCmp('s_order').getValue();
  154. var soset = Ext.getCmp('s_offset').getValue();
  155. var sodel = Ext.getCmp('s_delta').getValue();
  156. var sofli = Ext.getCmp('s_flip').getValue();
  157. var sowid = Ext.getCmp('s_width').getValue();
  158. var sosst = Ext.getCmp('s_sst').getValue();
  159. var sosun = Ext.getCmp('s_sun').getValue();
  160. _DATA_BOUNDARY;
  161. $SLRFDEFS=<<<_DATA_BOUNDARY
  162. ,
  163. SOFF: soset,
  164. SORD: soder,
  165. SDEL: sodel,
  166. SFLI: sofli,
  167. SWIZ: sowid,
  168. SSST: sosst,
  169. SSUN: sosun
  170. _DATA_BOUNDARY;
  171. $DEV_TAB='{ html: " DEV PL" }';
  172. $TFN = 'settings/node_' . $DD['type'] . '.js';
  173. if( file_exists( $TFN )){
  174. $DEV_TAB = file_get_contents( $TFN );
  175. $DEV_TAB = inject_labels( $DEV_TAB );
  176. $DEV_TAB = str_replace('%%%NODEID%%%', ''.$DD['node_id'] , $DEV_TAB );
  177. $DEV_TAB = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $DEV_TAB );
  178. $DEV_TAB = str_replace('%%%USERID%%%', $UserID, $DEV_TAB );
  179. $DEV_TAB = str_replace('%%%SESSION%%%', $Session, $DEV_TAB );
  180. //$DEV_TAB = str_replace('%%%APPTYPE%%%', $SP['type'], $DEV_TAB );
  181. $DEV_TAB = str_replace('%%%APPTYPE%%%', 0, $DEV_TAB );
  182. };
  183. $TPL=<<<_DATA_BOUNDARY
  184. {
  185. xtype: 'tabpanel',
  186. activeTab: 0,
  187. frame: true,
  188. border: false,
  189. items:[{
  190. xtype: 'panel',
  191. id: 'up_sse_panel',
  192. border: false,
  193. title: '{$Labels->GetLabel('_MAS_LRF_DEV_SET_')}',
  194. height: PanelH-10,
  195. items: [{$DEV_TAB}]
  196. },{
  197. xtype: 'panel',
  198. id: 'up_se_popanel',
  199. border: true,
  200. title: '{$Labels->GetLabel('_MAS_LRF_DET_SET_')}',
  201. frame: false,
  202. labelWidth: 150,
  203. labelAlign: 'right',
  204. layout: 'form',
  205. height: PanelH-10,
  206. items:[{
  207. xtype: 'numberfield',
  208. id: 'm_order',
  209. fieldLabel: 'Order',
  210. value: '{$SD['order']}'
  211. },{
  212. xtype: 'numberfield',
  213. id: 'm_offset',
  214. fieldLabel: 'Offset',
  215. value: '{$SD['offset']}'
  216. },{
  217. xtype: 'numberfield',
  218. id: 'm_delta',
  219. fieldLabel: 'Delta',
  220. value: '{$SD['delta']}'
  221. },{
  222. xtype: 'numberfield',
  223. id: 'm_flip',
  224. fieldLabel: 'Flip',
  225. value: '{$SD['flip']}'
  226. },{
  227. xtype: 'numberfield',
  228. id: 'm_width',
  229. fieldLabel: 'Width',
  230. value: '{$SD['width']}'
  231. },{
  232. xtype: 'numberfield',
  233. id: 'm_sst',
  234. fieldLabel: 'SST',
  235. value: '{$SD['sst']}'
  236. },{
  237. xtype: 'numberfield',
  238. id: 'm_sun',
  239. fieldLabel: 'Sun',
  240. value: '{$SD['sun']}'
  241. }],
  242. bbar:[{
  243. text: 'Apply Settings',
  244. handler: function(){
  245. var moder = Ext.getCmp('m_order').getValue();
  246. var moset = Ext.getCmp('m_offset').getValue();
  247. var model = Ext.getCmp('m_delta').getValue();
  248. var mofli = Ext.getCmp('m_flip').getValue();
  249. var mowid = Ext.getCmp('m_width').getValue();
  250. var mosst = Ext.getCmp('m_sst').getValue();
  251. var mosun = Ext.getCmp('m_sun').getValue();
  252. %%%SLAVE_VARS%%%
  253. Ext.Ajax.request({
  254. url: '/lib/controller/doSensorOperation.php',
  255. params: {
  256. UID: {$UserID},
  257. SID: '{$Session}',
  258. SNID: '{$SI}',
  259. OPID: 19,
  260. MOFF: moset,
  261. MORD: moder,
  262. MDEL: model,
  263. MFLI: mofli,
  264. MWIZ: mowid,
  265. MSST: mosst,
  266. MSUN: mosun
  267. %%%SLAVE_DEFS%%%
  268. },
  269. success: function( response, opts ){
  270. Ext.Msg.show({
  271. title: '{$Labels->GetLabel('_INFO_')}',
  272. msg: '{$Labels->GetLabel('_SARE_SAVED_')}',
  273. buttons: Ext.Msg.OK,
  274. icon: Ext.MessageBox.INFO
  275. });
  276. },
  277. failure: failureAJAXFunction
  278. });
  279. }
  280. }]
  281. }%%%SLAVE_LRF_DET%%%,{
  282. title: '{$Labels->GetLabel('_DET_SET_WIDTH_T_')}',
  283. height: PanelH-10,
  284. tbar:[{
  285. text: '{$Labels->GetLabel('_EDIT_')}',
  286. id: 'edit_btn_width_table',
  287. disabled: true,
  288. handler: editWidthTableRecord
  289. }],
  290. layout:'fit',
  291. bbar:[{
  292. text: 'Apply Settings',
  293. handler: function(){
  294. var moder = Ext.getCmp('m_order').getValue();
  295. var moset = Ext.getCmp('m_offset').getValue();
  296. var model = Ext.getCmp('m_delta').getValue();
  297. var mofli = Ext.getCmp('m_flip').getValue();
  298. var mowid = Ext.getCmp('m_width').getValue();
  299. var mosst = Ext.getCmp('m_sst').getValue();
  300. var mosun = Ext.getCmp('m_sun').getValue();
  301. %%%SLAVE_VARS%%%
  302. Ext.Ajax.request({
  303. url: '/lib/controller/doSensorOperation.php',
  304. params: {
  305. UID: {$UserID},
  306. SID: '{$Session}',
  307. SNID: '{$SI}',
  308. OPID: 19,
  309. MOFF: moset,
  310. MORD: moder,
  311. MDEL: model,
  312. MFLI: mofli,
  313. MWIZ: mowid,
  314. MSST: mosst,
  315. MSUN: mosun
  316. %%%SLAVE_DEFS%%%
  317. },
  318. success: function( response, opts ){
  319. Ext.Msg.show({
  320. title: '{$Labels->GetLabel('_INFO_')}',
  321. msg: '{$Labels->GetLabel('_SARE_SAVED_')}',
  322. buttons: Ext.Msg.OK,
  323. icon: Ext.MessageBox.INFO
  324. });
  325. },
  326. failure: failureAJAXFunction
  327. });
  328. }
  329. }],
  330. items:{
  331. xtype: 'grid',
  332. border: false,
  333. frame: false,
  334. autoScroll: true,
  335. //width: '100%',
  336. lazyRender: true,
  337. //height: 210,
  338. ds: targetWidthTable_store,
  339. cm: new Ext.grid.ColumnModel( targetWidthTableColModel_ops ),
  340. sm: new Ext.grid.RowSelectionModel( widthTableSelModel_ops ),
  341. viewConfig: {
  342. // forceFit: true
  343. },
  344. },
  345. listeners:{
  346. afterrender: function(){
  347. loadWidthTable({$SI});
  348. }
  349. }
  350. },{
  351. title: '{$Labels->GetLabel('_DC_CONTROL_SET_')}',
  352. height: PanelH-10,
  353. labelWidth: 200,
  354. labelAlign: 'right',
  355. layout: 'form',
  356. bbar:[{
  357. text: 'Apply Settings',
  358. handler: function(){
  359. var moder = Ext.getCmp('m_order').getValue();
  360. var moset = Ext.getCmp('m_offset').getValue();
  361. var model = Ext.getCmp('m_delta').getValue();
  362. var mofli = Ext.getCmp('m_flip').getValue();
  363. var mowid = Ext.getCmp('m_width').getValue();
  364. var mosst = Ext.getCmp('m_sst').getValue();
  365. var mosun = Ext.getCmp('m_sun').getValue();
  366. %%%SLAVE_VARS%%%
  367. Ext.Ajax.request({
  368. url: '/lib/controller/doSensorOperation.php',
  369. params: {
  370. UID: {$UserID},
  371. SID: '{$Session}',
  372. SNID: '{$SI}',
  373. OPID: 19,
  374. MOFF: moset,
  375. MORD: moder,
  376. MDEL: model,
  377. MFLI: mofli,
  378. MWIZ: mowid,
  379. MSST: mosst,
  380. MSUN: mosun
  381. %%%SLAVE_DEFS%%%
  382. },
  383. success: function( response, opts ){
  384. Ext.Msg.show({
  385. title: '{$Labels->GetLabel('_INFO_')}',
  386. msg: '{$Labels->GetLabel('_SARE_SAVED_')}',
  387. buttons: Ext.Msg.OK,
  388. icon: Ext.MessageBox.INFO
  389. });
  390. },
  391. failure: failureAJAXFunction
  392. });
  393. }
  394. }],
  395. items:[{
  396. xtype: 'checkbox',
  397. id: 'dc_ena',
  398. fieldLabel: '{$Labels->GetLabel('_DC_AUTO_ENA_')}',
  399. checked: {$DD['dc_auto']},
  400. listeners:{
  401. check: function( a, c ){
  402. if( c ){
  403. doSensorOperation( {$SI}, 27, 1, true );
  404. } else {
  405. doSensorOperation( {$SI}, 27, 0, true );
  406. };
  407. }
  408. }
  409. },{
  410. xtype: 'combo',
  411. fieldLabel: '{$Labels->GetLabel('_DC_WORK_MODE_')}',
  412. id: 'dc_mode',
  413. editable: false,
  414. typeAhead: true,
  415. triggerAction: 'all',
  416. width: '100%',
  417. lazyRender:true,
  418. mode: 'local',
  419. store: new Ext.data.ArrayStore({
  420. fields: ['sid', 'snam'],
  421. data: [[0,'{$Labels->GetLabel('_DC_WM_NC_')}'], [1,'{$Labels->GetLabel('_DC_WM_NO_')}']]
  422. }),
  423. value: {$DD['dc_no']},
  424. valueField: 'sid',
  425. displayField: 'snam',listeners:{
  426. select: function( a, c, b ){
  427. doSensorOperation( {$SI}, 28, b, true );
  428. }
  429. }
  430. },{
  431. xtype: 'numberfield',
  432. id: 'dc_window',
  433. fieldLabel: '{$Labels->GetLabel('_DC_TIME_WINDOW_')}',
  434. value: {$DD['dc_window']},
  435. listeners:{
  436. change: function( a, c, b ){
  437. doSensorOperation( {$SI}, 29, c, true );
  438. }
  439. }
  440. }]
  441. }]
  442. %%%JUMPAPA%%%
  443. }
  444. _DATA_BOUNDARY;
  445. if( $DUDU ){
  446. $TPL = str_replace('%%%SLAVE_LRF_DET%%%', $SLRFDET, $TPL );
  447. $TPL = str_replace('%%%SLAVE_VARS%%%', $SLRFVARS, $TPL );
  448. $TPL = str_replace('%%%SLAVE_DEFS%%%', $SLRFDEFS, $TPL );
  449. } else {
  450. $TPL = str_replace('%%%SLAVE_LRF_DET%%%', '', $TPL );
  451. $TPL = str_replace('%%%SLAVE_VARS%%%', '', $TPL );
  452. $TPL = str_replace('%%%SLAVE_DEFS%%%', '', $TPL );
  453. };
  454. if( $FOK && $SOK ){
  455. $TPL = str_replace('%%%JUMPAPA%%%', '', $TPL );
  456. } else {
  457. $TPL = str_replace('%%%JUMPAPA%%%', $LILI, $TPL );
  458. };
  459. echo $TPL;
  460. } else {
  461. header('location: /');
  462. };
  463. ?>