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.

713 lines
19 KiB

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