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.

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