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.

715 lines
19 KiB

​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
4 years ago
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../ajax_asm.php');
  3. if( $CUser->Data['id'] > 1 ){
  4. $EID = intval( $_POST['CID'] );
  5. $QS = "SELECT `sen`.*, `no`.`enable`, `no`.`name`, `no`.`id` as `node_id` FROM `lrf_sensors` `sen` LEFT JOIN `nodes` `no` ON( `no`.`aux_id`=`sen`.`id` AND `no`.`type`=`sen`.`type`) WHERE `sen`.`id`={$EID}";
  6. $Result = $DATABASE->Query( $QS, false );
  7. if( count( $Result ) ){
  8. $CR = $Result[0];
  9. $TTPL=<<<JOJOKA
  10. {
  11. xtype: 'panel',
  12. border: false,
  13. frame: false,
  14. items:[%%%ITEMS%%%]
  15. }
  16. JOJOKA;
  17. $ITEMS = array();
  18. switch( $CR['type'] ){
  19. case 1: $NAME = '<b>'.$CR['name'].'</b><br/>ALS ' . $Labels->getLabel('SENSOR'); break;
  20. case 2: $NAME = '<b>'.$CR['name'].'</b><br/>LFS ' . $Labels->getLabel('SENSOR'); break;
  21. case 3: $NAME = '<b>'.$CR['name'].'</b><br/>PLS200 ' . $Labels->getLabel('SENSOR'); break;
  22. case 4: $NAME = '<b>'.$CR['name'].'</b><br/>PLS360 ' . $Labels->getLabel('SENSOR'); break;
  23. default: $NAME = '<b>'.$CR['name'].'</b><br/>Unknown Sensor';
  24. };
  25. $NAME .='<br/>communication errors per minute: '.$CR['com_epm'];
  26. $INFO = '<table width="100%" border=0 style="font-weight: bold;"><tr><td width="130px" align="right">Serial:</td><td>'.(($CR['serial']!='')?$CR['serial']:'No Serial Defined').'</td></tr><tr><td align="right">Version:</td><td>'.(($CR['version']!='')?$CR['version']:'No Version Info').'</td></tr></table>';
  27. $ITEMS[0]="{ xtype:'panel', border: false, frame: false, html: '<table width=\"100%\" border=0 class=\"setEd_infoPanel\" id=\"SENSOR_".(($CR['enable']==1)?'A':'N')."\"><tr><td width=\"200px\"><div class=\"node_".$CR['type']."_img_sset\"></div></td><td valign=\"middle\">{$NAME}</td></tr><tr><td colspan=2>{$INFO}</td></tr></table><br/>'}";
  28. $QS="SELECT aux_id, device FROM resources WHERE ( type=1 OR type=129 )";
  29. $RR=$DATABASE->Query( $QS );
  30. if( count( $RR ) ){
  31. $RE=array();
  32. foreach( $RR as $R ){
  33. $RE[] = "[ {$R['aux_id']}, '{$R['device']}']";
  34. };
  35. $UARTS = implode( ',', $RE );
  36. } else {
  37. $UARTS = "[0, \"".$Labels->GetLabel('_NO_UARTS_DEF_')."\"]";
  38. };
  39. $QS = "SELECT * FROM `lrf_ini_settings` WHERE `sensor_id`={$EID}";
  40. $RRR = $DATABASE->Query( $QS );
  41. if( count( $RRR ) ){
  42. $INI_S = $RRR[0];
  43. } else {
  44. $INI_S = array();
  45. $INI_S['AUTORESET_ENABLE'] = 0;
  46. $INI_S['AUTORESET_INTERLEAVE'] = 2000;
  47. $INI_S['AUTORESET_TIMEOUT'] = 60000;
  48. $INI_S['BOARD_TEMPERATURE'] = 1;
  49. $INI_S['BOARD_ZEROSHIFT'] = 0;
  50. $INI_S['BOARD_SPEED'] = 4;
  51. $INI_S['RUN_DIR'] = 2;
  52. $INI_S['NO_BLACK_TARGETS'] = 1;
  53. $INI_S['JUST_MOVING_TARGETS'] = 0;
  54. $INI_S['JUST_MOVING_RADIAL'] = 0;
  55. $INI_S['JUST_MOVING_DISTANCE'] = 0;
  56. if( stripos( $CR['version'], 'FF' )!== false ) {
  57. $INI_S['FREEZ_FIRST_TH'] = 1;
  58. $INI_S['SAVE_FIRST_TH'] = 1;
  59. } else if( stripos( $CR['version'], 'FS' )!== false ){
  60. $INI_S['FREEZ_FIRST_TH'] = 1;
  61. $INI_S['SAVE_FIRST_TH'] = 1;
  62. } else if( stripos( $CR['version'], 'FD' )!== false ){
  63. $INI_S['FREEZ_FIRST_TH'] = 0;
  64. $INI_S['SAVE_FIRST_TH'] = 0;
  65. } else {
  66. $INI_S['FREEZ_FIRST_TH'] = 0;
  67. $INI_S['SAVE_FIRST_TH'] = 0;
  68. };
  69. $QS = "INSERT INTO `lrf_ini_settings`(`sensor_id`,`AUTORESET_ENABLE`,`AUTORESET_INTERLEAVE`,`AUTORESET_TIMEOUT`,`BOARD_TEMPERATURE`,`BOARD_ZEROSHIFT`,`BOARD_SPEED`,`RUN_DIR`,`NO_BLACK_TARGETS`,`JUST_MOVING_TARGETS`,`JUST_MOVING_RADIAL`,`JUST_MOVING_DISTANCE`,`FREEZ_FIRST_TH`,`SAVE_FIRST_TH`) VALUES({$EID},0,0,0,0,0,4,2,0,0,0,0,{$INI_S['FREEZ_FIRST_TH']},{$INI_S['SAVE_FIRST_TH']})";
  70. $DATABASE->Query( $QS );
  71. };
  72. if( ( stripos( $CR['version'], 'FD' )!== false ) || ( stripos( $CR['version'], 'FS' )!== false ) || ( stripos( $CR['version'], 'FF' )!== false ) ){
  73. //Frozen TH
  74. if( stripos( $CR['version'], 'FD' )!== false ){
  75. $THF_OPERATION = ",{
  76. xtype: 'button',
  77. text: 'Enable Frozen Threshold',
  78. width: '100%',
  79. iconCls: 'srv_op_fth_ble',
  80. scale: 'large',
  81. handler: function(){
  82. doSensorOperation( {$CR['id']}, 21, 0, true );
  83. }
  84. }";
  85. } else {
  86. if( stripos( $CR['version'], 'FS' )!== false ){
  87. $THF_OPERATION = ",{
  88. xtype: 'button',
  89. text: 'Finish Frozen Threshold Study',
  90. width: '100%',
  91. iconCls: 'srv_op_fth_study',
  92. scale: 'large',
  93. handler: function(){
  94. doSensorOperation( {$CR['id']}, 24, 0, true );
  95. }
  96. }";
  97. };
  98. if( stripos( $CR['version'], 'FF' )!== false ){
  99. $THF_OPERATION = ",{
  100. xtype: 'button',
  101. text: 'Delete Frozen Threshold',
  102. width: '100%',
  103. iconCls: 'srv_op_fth_frozen',
  104. scale: 'large',
  105. handler: function(){
  106. doSensorOperation( {$CR['id']}, 23, 0, true );
  107. }
  108. }";
  109. };
  110. $THF_OPERATION .= ",{
  111. xtype: 'button',
  112. text: 'Disable Frozen Threshold',
  113. width: '100%',
  114. iconCls: 'srv_op_fth_ble',
  115. scale: 'large',
  116. handler: function(){
  117. doSensorOperation( {$CR['id']}, 22, 0, true );
  118. }
  119. }";
  120. };
  121. } else {
  122. $THF_OPERATION = '';
  123. }
  124. $ED =<<<kokakskhkajhskr
  125. {
  126. xtype: 'tabpanel',
  127. activeTab: 0,
  128. items:[{
  129. xtype: 'form',
  130. title: 'General',
  131. labelWidth: 200,
  132. border: false,
  133. frame: false,
  134. labelAlign: 'right',
  135. height: PanelH - 283,
  136. items:[{
  137. xtype: 'combo',
  138. id: 'sens_se',
  139. fieldLabel: "{$Labels->GetLabel('_SENS_STATUS_')}",
  140. lazyRender: true,
  141. mode: 'local',
  142. forceSelection: true,
  143. triggerAction: 'all',
  144. editable: false,
  145. disableKeyFilter: true,
  146. store: new Ext.data.ArrayStore({
  147. fields: ['mode','mode_txt'],
  148. data: [
  149. [0,'{$Labels->GetLabel('__DISABLED__')}'],
  150. [1,'{$Labels->GetLabel('___ENABLED__')}']
  151. ]
  152. }),
  153. valueField: 'mode',
  154. displayField: 'mode_txt',
  155. value: {$CR['enable']},
  156. width: 200,
  157. listeners:{
  158. select: function( a, c, b ){
  159. doSensorOperation( {$CR['id']}, 1, b, true );
  160. }
  161. }
  162. },{
  163. xtype: 'combo',
  164. id: 'sens_range',
  165. fieldLabel: "{$Labels->GetLabel('SENS_RANGE')}",
  166. lazyRender: true,
  167. mode: 'local',
  168. forceSelection: true,
  169. triggerAction: 'all',
  170. editable: false,
  171. disableKeyFilter: true,
  172. store: new Ext.data.ArrayStore({
  173. fields: ['range','range_txt'],
  174. data: [
  175. [15,'15 Meters'],
  176. [35,'35 Meters'],
  177. [45,'45 Meters'],
  178. [65,'65 Meters'],
  179. [75,'75 Meters'],
  180. [150,'150 Meters'],
  181. [200,'200 Meters'],
  182. [300,'300 Meters'],
  183. [350,'350 Meters']
  184. ]
  185. }),
  186. valueField: 'range',
  187. displayField: 'range_txt',
  188. value: {$CR['max_range']},
  189. width: 200,
  190. listeners:{
  191. select: function( a, c, b ){
  192. doSensorOperation( {$CR['id']}, 2, b, true );
  193. }
  194. }
  195. },{
  196. xtype: 'numberfield',
  197. id: 'sens_id',
  198. fieldLabel: '{$Labels->GetLabel('_PROTO_DEVICE_ID_')}',
  199. width: 200,
  200. value: {$CR['device_id']},
  201. listeners:{
  202. change: function( a, c, b ){
  203. doSensorOperation( {$CR['id']}, 3, c, true );
  204. }
  205. }
  206. },{
  207. xtype: 'combo',
  208. fieldLabel: '{$Labels->GetLabel('_UART_PORT_')}',
  209. lazyRender: true,
  210. id: 'uart_id',
  211. mode: 'local',
  212. disabled: false,
  213. forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true,
  214. store: new Ext.data.ArrayStore({
  215. fields: ['uart','uart_txt'],
  216. data: [{$UARTS}]
  217. }),
  218. valueField: 'uart',
  219. displayField: 'uart_txt',
  220. value: {$CR['uart_id']},
  221. width: 200,
  222. listeners:{
  223. select: function( a, c, b ){
  224. doSensorOperation( {$CR['id']}, 4, c.data.uart, true );
  225. }
  226. }
  227. },{
  228. xtype: 'combo',
  229. id: 'ad_se',
  230. fieldLabel: "{$Labels->GetLabel('AUTO_DRAW')}",
  231. lazyRender: true,
  232. mode: 'local',
  233. forceSelection: true,
  234. triggerAction: 'all',
  235. editable: false,
  236. disableKeyFilter: true,
  237. store: new Ext.data.ArrayStore({
  238. fields: ['ad','ad_txt'],
  239. data: [
  240. [0,'{$Labels->GetLabel('__DISABLED__')}'],
  241. [10,'Each 10 Flips'],
  242. [20,'Each 20 Flips'],
  243. [30,'Each 30 Flips'],
  244. [40,'Each 40 Flips'],
  245. [50,'Each 50 Flips'],
  246. [100,'Each 100 Flips'],
  247. [200,'Each 200 Flips']
  248. ]
  249. }),
  250. valueField: 'ad',
  251. displayField: 'ad_txt',
  252. value: {$CR['auto_draw']},
  253. width: 200,
  254. listeners:{
  255. select: function( a, c, b ){
  256. doSensorOperation( {$CR['id']}, 5, b, true );
  257. }
  258. }
  259. },{
  260. xtype: 'numberfield',
  261. id: 'basesh_id',
  262. fieldLabel: 'Background {$Labels->GetLabel('__ZERO_SHIFT__')}',
  263. width: 200,
  264. value: {$CR['base_shift']},
  265. listeners:{
  266. change: function( a, c, b ){
  267. doSensorOperation( {$CR['id']}, 6, c, true );
  268. }
  269. }
  270. }]
  271. },{
  272. xtype: 'form',
  273. title: 'Hardware',
  274. labelWidth: 200,
  275. border: false,
  276. frame: false,
  277. labelAlign: 'right',
  278. height: PanelH - 283,
  279. items:[{
  280. xtype: 'checkbox',
  281. id: 'autores_ena',
  282. fieldLabel: 'Auto Reset Enabled',
  283. width: 200,
  284. checked: {$INI_S['AUTORESET_ENABLE']},
  285. listeners:{
  286. check: function( a, c ){
  287. if( c ){
  288. doSensorOperation( {$CR['id']}, 7, 1, false );
  289. } else {
  290. doSensorOperation( {$CR['id']}, 7, 0, false );
  291. };
  292. }
  293. }
  294. },{
  295. xtype: 'numberfield',
  296. id: 'autores_il',
  297. fieldLabel: 'Auto Reset Interleave',
  298. width: 200,
  299. value: {$INI_S['AUTORESET_INTERLEAVE']},
  300. listeners:{
  301. change: function( a, c, b ){
  302. doSensorOperation( {$CR['id']}, 8, c, false );
  303. }
  304. }
  305. },{
  306. xtype: 'numberfield',
  307. id: 'autores_to',
  308. fieldLabel: 'Auto Timeout',
  309. width: 200,
  310. value: {$INI_S['AUTORESET_TIMEOUT']},
  311. listeners:{
  312. change: function( a, c, b ){
  313. doSensorOperation( {$CR['id']}, 9, c, false );
  314. }
  315. }
  316. },{
  317. xtype: 'numberfield',
  318. id: 'board_zsh',
  319. fieldLabel: 'Board Zero Shift',
  320. width: 200,
  321. value: {$INI_S['BOARD_ZEROSHIFT']},
  322. listeners:{
  323. change: function( a, c, b ){
  324. doSensorOperation( {$CR['id']}, 10, c, false );
  325. }
  326. }
  327. },{
  328. xtype: 'numberfield',
  329. id: 'board_temp',
  330. fieldLabel: 'Heater Temperature',
  331. width: 200,
  332. value: {$INI_S['BOARD_TEMPERATURE']},
  333. listeners:{
  334. change: function( a, c, b ){
  335. doSensorOperation( {$CR['id']}, 11, c, false );
  336. }
  337. }
  338. },{
  339. xtype: 'combo',
  340. id: 'board_spd',
  341. fieldLabel: "Scan Speed",
  342. lazyRender: true,
  343. mode: 'local',
  344. forceSelection: true,
  345. triggerAction: 'all',
  346. editable: false,
  347. disableKeyFilter: true,
  348. store: new Ext.data.ArrayStore({
  349. fields: ['sd','sd_txt'],
  350. data: [
  351. [2,'2 Scans per second'],
  352. [4,'4 Scans per second'],
  353. [6,'6 Scans per second'],
  354. [8,'8 Scans per second'],
  355. [10,'10 Scans per second'],
  356. [12,'12 Scans per second']
  357. ]
  358. }),
  359. valueField: 'sd',
  360. displayField: 'sd_txt',
  361. value: {$INI_S['BOARD_SPEED']},
  362. width: 200,
  363. listeners:{
  364. select: function( a, c, b ){
  365. doSensorOperation( {$CR['id']}, 12, b, false );
  366. }
  367. }
  368. },{
  369. xtype: 'checkbox',
  370. id: 'nbt_ena',
  371. fieldLabel: 'No Black Targets',
  372. width: 200,
  373. checked: {$INI_S['NO_BLACK_TARGETS']},
  374. listeners:{
  375. check: function( a, c ){
  376. if( c ){
  377. doSensorOperation( {$CR['id']}, 13, 1, false );
  378. } else {
  379. doSensorOperation( {$CR['id']}, 13, 0, false );
  380. };
  381. }
  382. }
  383. },{
  384. xtype: 'checkbox',
  385. id: 'jmt_ena',
  386. fieldLabel: 'Just Moving Targets',
  387. width: 200,
  388. checked: {$INI_S['JUST_MOVING_TARGETS']},
  389. listeners:{
  390. check: function( a, c ){
  391. if( c ){
  392. doSensorOperation( {$CR['id']}, 14, 1, false );
  393. } else {
  394. doSensorOperation( {$CR['id']}, 14, 0, false );
  395. };
  396. }
  397. }
  398. },{
  399. xtype: 'checkbox',
  400. id: 'jmt_rad',
  401. fieldLabel: 'Just Moving Radial',
  402. width: 200,
  403. checked: {$INI_S['JUST_MOVING_RADIAL']},
  404. listeners:{
  405. check: function( a, c ){
  406. if( c ){
  407. doSensorOperation( {$CR['id']}, 15, 1, false );
  408. } else {
  409. doSensorOperation( {$CR['id']}, 15, 0, false );
  410. };
  411. }
  412. }
  413. },{
  414. xtype: 'checkbox',
  415. id: 'jmt_range',
  416. fieldLabel: 'Just Moving Distance',
  417. width: 200,
  418. checked: {$INI_S['JUST_MOVING_DISTANCE']},
  419. listeners:{
  420. check: function( a, c ){
  421. if( c ){
  422. doSensorOperation( {$CR['id']}, 16, 1, false );
  423. } else {
  424. doSensorOperation( {$CR['id']}, 16, 0, false );
  425. };
  426. }
  427. }
  428. },{
  429. xtype: 'checkbox',
  430. id: 'fth_freeze',
  431. fieldLabel: 'Freeze First Threshold',
  432. width: 200,
  433. checked: {$INI_S['FREEZ_FIRST_TH']},
  434. listeners:{
  435. check: function( a, c ){
  436. if( c ){
  437. doSensorOperation( {$CR['id']}, 17, 1, false );
  438. } else {
  439. doSensorOperation( {$CR['id']}, 17, 0, false );
  440. };
  441. }
  442. }
  443. },{
  444. xtype: 'checkbox',
  445. id: 'fth_save',
  446. fieldLabel: 'Save First Threshold',
  447. width: 200,
  448. checked: {$INI_S['SAVE_FIRST_TH']},
  449. listeners:{
  450. check: function( a, c ){
  451. if( c ){
  452. doSensorOperation( {$CR['id']}, 18, 1, false );
  453. } else {
  454. doSensorOperation( {$CR['id']}, 18, 0, false );
  455. };
  456. }
  457. }
  458. },{
  459. xtype: 'button',
  460. text: 'Apply To Device and Reset',
  461. width: '100%',
  462. iconCls: 'srv_op_download',
  463. scale: 'large',
  464. handler: function(){
  465. doSensorOperation( {$CR['id']}, 20, 0, true );
  466. }
  467. }]
  468. },{
  469. xtype: 'panel',
  470. title: 'Position',
  471. height: PanelH - 283,
  472. items:[]
  473. },{
  474. xtype: 'panel',
  475. title: 'Maintenence',
  476. height: PanelH - 283,
  477. items:[{
  478. xtype: 'button',
  479. text: 'Issue Sensor Full Reset',
  480. width: '100%',
  481. iconCls: 'srv_op_restart',
  482. scale: 'large',
  483. handler: function(){
  484. doDeviceOperation( {$CR['node_id']}, 1,'', true );
  485. }
  486. },{
  487. xtype: 'button',
  488. text: 'Read All Settings from Sensor',
  489. width: '100%',
  490. iconCls: 'srv_op_upload',
  491. scale: 'large',
  492. handler: function(){
  493. doDeviceOperation( {$CR['node_id']}, 128,'', true );
  494. }
  495. },{
  496. xtype: 'button',
  497. text: 'Save All Settings to Sensor',
  498. width: '100%',
  499. iconCls: 'srv_op_download',
  500. scale: 'large',
  501. handler: function(){
  502. doDeviceOperation( {$CR['node_id']}, 129,'', true );
  503. }
  504. }{$THF_OPERATION}]
  505. },{
  506. xtype: 'panel',
  507. title: '{$Labels->getLabel('_SND_FILES2_DEV__')}',
  508. height: PanelH - 283,
  509. items:[{
  510. title: '{$Labels->getLabel('_UPLOAD_PACKAGE_')}',
  511. xtype: 'panel',
  512. //height: 300,
  513. //flex: 1,
  514. frame: true,
  515. border: false,
  516. //layout: 'vbox',
  517. items:[{
  518. xtype:'button',
  519. id: 'pickfiles_3',
  520. width: '100%',
  521. text: 'Choose File',
  522. listeners:{
  523. afterrender: function(){
  524. muploader = new plupload.Uploader({
  525. runtimes : 'html5,html4',
  526. browse_button : Ext.getDom('pickfiles_3'),
  527. max_file_size : '1000mb',
  528. chunk_size: '200kb',
  529. max_retries: 3,
  530. multi_selection: false,
  531. max_file_count: 1,
  532. url: '/lib/controller/uploadToDevice.php?DID={$EID}',
  533. init: {
  534. PostInit: function() {
  535. },
  536. FilesAdded: function( up, files ) {
  537. Ext.getCmp('upload_files_btn').enable();
  538. Ext.getCmp('uploads_clr_btn').enable();
  539. plupload.each( files, function(file) {
  540. uploads_store.loadData( [[ uploads_store_id, file.name, file.id, plupload.formatSize( file.size ), 0, 'N' ]], true );
  541. uploads_store_id++;
  542. Ext.getCmp('upload_grid').doLayout();
  543. });
  544. },
  545. UploadProgress: function(up, file) {
  546. var pb = Ext.getCmp( 'progress_'+file.id );
  547. if( file.percent < 100 ){
  548. pb.updateProgress( file.percent / 100, file.percent + '%', false );
  549. } else {
  550. pb.updateProgress( 1.0, 'Uploaded', false );
  551. uploads_store.removeAll();
  552. loadModuleFiles( {$EID} );
  553. };
  554. },
  555. Error: function(up, err) {
  556. Ext.Msg.show({
  557. title:'Upload Status',
  558. msg: "Error #" + err.code + ": " + err.message,
  559. buttons: Ext.Msg.OK,
  560. icon: Ext.MessageBox.ERROR
  561. });
  562. }
  563. }
  564. });
  565. muploader.init();
  566. //Ext.getCmp('uploaded_grid').hide();
  567. //Ext.getCmp('upload_progres_panel').show();
  568. devUploadID = {$CR['id']};
  569. fetchDeviceUploadStatus();
  570. //loadModuleFiles( {$EID} );
  571. }
  572. }
  573. },{
  574. height: 200,
  575. xtype: 'grid',
  576. id: 'upload_grid',
  577. border: false,
  578. frame: false,
  579. mode: 'local',
  580. lazyRender: true,
  581. width: '100%',
  582. autoScroll: true,
  583. ds: uploads_store,
  584. cm: new Ext.grid.ColumnModel( fileUploadsColModel_ops ),
  585. sm: new Ext.grid.RowSelectionModel( fileUploadsSelModel_ops ),
  586. viewConfig: {
  587. forceFit: true
  588. },
  589. bbar: [{
  590. text: 'Clear',
  591. id: 'uploads_clr_btn',
  592. disabled: true,
  593. handler: function(){
  594. muploader.splice();
  595. uploads_store.removeAll();
  596. uploads_store_id = 0;
  597. Ext.getCmp('uploads_clr_btn').disable();
  598. Ext.getCmp('upload_files_btn').disable();
  599. }
  600. },{
  601. xtype:'button',
  602. id: 'upload_files_btn',
  603. disabled: true,
  604. text: 'Upload to Module',
  605. handler: function(){
  606. if( muploader!= null ){
  607. muploader.start();
  608. Ext.getCmp('upload_files_btn').disable();
  609. };
  610. }
  611. }]
  612. },{
  613. xtype: 'panel',
  614. height: 20
  615. },{
  616. title: 'Files Saved on Module',
  617. height: 200,
  618. xtype: 'grid',
  619. id: 'uploaded_grid',
  620. border: false,
  621. hidden: true,
  622. frame: false,
  623. mode: 'local',
  624. lazyRender: true,
  625. width: '100%',
  626. autoScroll: true,
  627. ds: uploaded_store,
  628. cm: new Ext.grid.ColumnModel( fileModuleColModel_ops ),
  629. sm: new Ext.grid.RowSelectionModel( fileUploadsSelModel_ops ),
  630. viewConfig: {
  631. forceFit: true
  632. },
  633. bbar: [{
  634. text: 'Clear',
  635. id: 'oploaded_clr_btn',
  636. disabled: false,
  637. handler: function(){
  638. //muploader.splice();
  639. uploaded_store.removeAll();
  640. uploaded_store_id = 0;
  641. }
  642. },{
  643. text: 'Reset Status',
  644. id: 'oploaded_rst_btn',
  645. disabled: true,
  646. handler: function(){
  647. //muploader.splice();
  648. //uploaded_store.removeAll();
  649. //uploaded_store_id = 0;
  650. }
  651. },{
  652. text: 'Issue Reset',
  653. id: 'oploaded_sres_btn',
  654. disabled: true,
  655. handler: function(){
  656. //muploader.splice();
  657. //uploaded_store.removeAll();
  658. //uploaded_store_id = 0;
  659. }
  660. },{
  661. xtype:'button',
  662. //disabled: true,
  663. id: 'oploaded_snd_btn',
  664. text: 'Send to Sensor',
  665. handler: function(){
  666. doDeviceOperation( {$CR['node_id']}, 120,'', true );
  667. Ext.getCmp('uploaded_grid').hide();
  668. Ext.getCmp('upload_progres_panel').show();
  669. devUploadID = {$CR['id']};
  670. fetchDeviceUploadStatus();
  671. }
  672. }]
  673. },{
  674. xtype: 'panel',
  675. id: 'upload_progres_panel',
  676. hidden: false,
  677. items:[{
  678. id: 'upp_ttext',
  679. html: 'Sending 3 file(s) to the device'
  680. },{
  681. id: 'upp_ctext_',
  682. html: '<table width="100%" height="50" border=0><tr><td width="100">&nbsp;</td><td width="50" align="right" height="50"><svg version="1.1" id="L3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" enable-background="new 0 0 0 0" xml:space="preserve"><circle fill="none" stroke="#fff" stroke-width="4" cx="50" cy="50" r="44" style="opacity:0.5;"/><circle fill="#fff" stroke="#e74c3c" stroke-width="3" cx="8" cy="54" r="6" ><animateTransform attributeName="transform" dur="2s" type="rotate" from="0 50 48" to="360 50 52" repeatCount="indefinite" /></circle></svg></td><td align="left" id="upp_ctext"></td></tr></table>'
  683. },{
  684. xtype: 'progress',
  685. id: 'upp_pbar',
  686. width: '100%',
  687. value: 0.0
  688. }]
  689. }]
  690. }]
  691. }],
  692. bbar:[{
  693. text: 'Remove Sensor',
  694. handler: function(){
  695. doSensorOperation( {$CR['id']}, 255,'', true );
  696. }
  697. }]
  698. }
  699. kokakskhkajhskr;
  700. $ITEMS[1] = $ED;
  701. $CONTENT = implode(',',$ITEMS);
  702. $TTPL = str_ireplace( '%%%ITEMS%%%', $CONTENT, $TTPL );
  703. echo $TTPL;
  704. } else {
  705. echo '{ xtype: \'panel\', html: \'Node '.$_POST['NODE'].' Loadded\'}';
  706. };
  707. } else {
  708. header('location: /');
  709. };
  710. ?>