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.

3590 lines
99 KiB

​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
4 years ago
​
4 years ago
4 years ago
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
3 years ago
3 years ago
​
3 years ago
3 years ago
3 years ago
​
3 years ago
​
​
​
3 years ago
​
3 years ago
3 years ago
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
3 years ago
​
​
​
​
​
​
3 years ago
​
​
​
​
​
3 years ago
​
3 years ago
3 years ago
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
3 years ago
​
​
3 years ago
​
​
​
3 years ago
​
​
​
​
​
​
​
3 years ago
​
​
3 years ago
​
3 years ago
​
​
​
​
​
​
​
​
​
3 years ago
3 years ago
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
2 years ago
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
2 years ago
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
4 years ago
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
4 years ago
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
3 years ago
3 years ago
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
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
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
4 years ago
​
​
​
​
​
​
​
2 years ago
​
​
​
​
4 years ago
​
4 years ago
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
3 years ago
​
​
​
​
3 years ago
​
​
​
​
​
3 years ago
​
​
3 years ago
​
​
​
3 years ago
3 years ago
​
3 years ago
3 years ago
​
​
3 years ago
​
​
​
3 years ago
​
​
​
​
​
3 years ago
3 years ago
​
​
​
​
​
​
​
​
​
​
3 years ago
3 years ago
​
3 years ago
3 years ago
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
3 years ago
​
3 years ago
​
​
​
​
3 years ago
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
3 years ago
​
3 years ago
3 years ago
​
​
3 years ago
​
​
​
​
​
3 years ago
​
​
​
​
​
3 years ago
3 years ago
​
​
​
​
3 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
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //<?php require_once('../../js_asm.php'); ?>
  2. var helpContentTopicID = -1;
  3. var muploader = null;
  4. var uploads_store_id = 0;
  5. var uploads_store = new Ext.data.ArrayStore({
  6. autoDestroy: false,
  7. storeId: 'up_store',
  8. idIndex: 0,
  9. fields: [
  10. {name: 'id', type: 'int' },
  11. {name: 'file_name', type: 'string'},
  12. {name: 'file_id', type: 'string'},
  13. {name: 'size', type: 'string'},
  14. {name: 'progress', type: 'int'},
  15. {name: 'status', type: 'string' }
  16. ]
  17. });
  18. var uploaded_store_id = 0;
  19. var uploaded_store = new Ext.data.ArrayStore({
  20. autoDestroy: false,
  21. storeId: 'mod_store',
  22. idIndex: 0,
  23. fields: [
  24. {name: 'id', type: 'int' },
  25. {name: 'file_name', type: 'string'},
  26. {name: 'size', type: 'int'},
  27. {name: 'status', type: 'int'},
  28. {name: 'ts', type: 'string' },
  29. {name: 'memo', type: 'string' }
  30. ]
  31. });
  32. function progressRenderer( value, meta, record ){
  33. Ext.defer( function( id ){
  34. var p = new Ext.ProgressBar({
  35. id: 'progress_'+id,
  36. renderTo: 'div_'+id,
  37. animate: false,
  38. width: '100%',
  39. value: 0,
  40. text: 'Upload Pending',
  41. });
  42. }, 50, undefined, [ record.data.file_id ] );
  43. return '<div id="div_' + record.data.file_id + '"></div>';
  44. };
  45. var fileUploadsColModel_ops = {
  46. columns: [
  47. {header: "ID", width: 50, align: 'center', css: 'vertical-align: middle;', dataIndex: 'id' },
  48. {header: "<?=$Labels->GetLabel('_FILE_NAME_');?>", width: 280, fixed: false, align: 'left', css: 'vertical-align: middle;', dataIndex: 'file_name' },
  49. {header: "<?=$Labels->GetLabel('_SIZE_');?>", width: 80, align: 'left', css: 'vertical-align: middle;', dataIndex: 'size' },
  50. {header: "<?=$Labels->GetLabel('_PROGRESS_');?>", width: 150, renderer: progressRenderer, dataIndex: 'progress' },
  51. {header: " ", width: 50, dataIndex: 'status3' }
  52. ],
  53. defaults: {
  54. sortable: false,
  55. fixed: true,
  56. menuDisabled: true,
  57. width: 100
  58. }
  59. };
  60. function onModuleFileRenderer( value, meta, record ){
  61. if( value == 0 ){
  62. rv = '<img title="<?=$Labels->GetLabel('_READY_TO_UPLO_');?>" alt="<?=$Labels->GetLabel('_READY_TO_UPLO_');?>" src="/style/assets/bul_green.png">';
  63. } else {
  64. if( value < 101 ){
  65. rv = '<img title="<?=$Labels->GetLabel('_UPLO_IN_PROGRESS_');?>" alt="<?=$Labels->GetLabel('_UPLO_IN_PROGRESS_');?>" src="/style/assets/bul_gray.png">';
  66. } else {
  67. rv = '<img title="<?=$Labels->GetLabel('_UPLO_DONE_');?>" alt="<?=$Labels->GetLabel('_UPLO_DONE_');?>" src="/style/assets/bul_blue.png">';
  68. };
  69. };
  70. return rv;
  71. };
  72. var fileModuleColModel_ops = {
  73. columns: [
  74. {header: "ID", width: 50, align: 'center', css: 'vertical-align: middle;', dataIndex: 'id' },
  75. {header: "<?=$Labels->GetLabel('_FILE_NAME_');?>", width: 60, fixed: false, align: 'left', css: 'vertical-align: middle;', dataIndex: 'file_name' },
  76. {header: "<?=$Labels->GetLabel('_SIZE_');?>", width: 80, renderer: plupload.formatSize, align: 'left', css: 'vertical-align: middle;', dataIndex: 'size' },
  77. {header: "<?=$Labels->GetLabel('_TIME_');?>", width: 150, align: 'left', css: 'vertical-align: middle;', dataIndex: 'ts' },
  78. {header: "<?=$Labels->GetLabel('_STATUS_');?>", width: 50, renderer: onModuleFileRenderer, dataIndex: 'status' },
  79. {header: "<?=$Labels->GetLabel('_MEMO_');?>", dataIndex: 'memo' }
  80. ],
  81. defaults: {
  82. sortable: false,
  83. fixed: true,
  84. menuDisabled: true,
  85. width: 100
  86. }
  87. };
  88. var fileUploadsSelModel_ops = {
  89. singleSelect: true
  90. };
  91. var targetWidthTable_store = new Ext.data.ArrayStore({
  92. autoDestroy: false,
  93. storeId: 'width_table_store',
  94. idIndex: 0,
  95. fields: [
  96. {name: 'id', type: 'int' },
  97. {name: 'width', type: 'int'},
  98. {name: 'range', type: 'sting'},
  99. {name: 'range_m', type: 'sting'}
  100. ]
  101. });
  102. var cWTRowSelected = null;
  103. var cWTRowSelectedRange = 0;
  104. var cWTRowSelectedRangeP = 0;
  105. var WTSelectedSensor = 0;
  106. var widthTableSelModel_ops = {
  107. singleSelect: true,
  108. listeners: {
  109. rowselect: function( sm, row, rec ) {
  110. cWTRowSelected = rec.data.id;
  111. cWTRowSelectedRange = rec.data.range_m;
  112. cWTRowSelectedRangeP = rec.data.range;
  113. //todo
  114. Ext.getCmp('edit_btn_width_table').enable();
  115. }
  116. }
  117. };
  118. function deleteWTRow(){
  119. Ext.Ajax.request({
  120. url: '/lib/controller/delWidthTableRecord.php',
  121. params: {
  122. UID: <?=$UserID;?>,
  123. SID: '<?=$Session;?>',
  124. DID: WTSelectedSensor,
  125. RID: cWTRowSelected
  126. },
  127. success: function( response, opts ){
  128. Ext.getCmp('del_btn_width_table').disable();
  129. loadWidthTable( WTSelectedSensor );
  130. },
  131. failure: failureAJAXFunction
  132. });
  133. };
  134. var targetWidthTableColModel_ops = {
  135. columns: [
  136. {header: "<?=$Labels->GetLabel('_WIDTH_CORRECT_');?> (%)", width: 250, align: 'center', css: 'vertical-align: middle;', dataIndex: 'width' },
  137. {header: "<?=$Labels->GetLabel('_RANGE_');?> (%)", width: 150, align: 'center', css: 'vertical-align: middle;', dataIndex: 'range' },
  138. {header: "<?=$Labels->GetLabel('_RANGE_').' ('.$Labels->GetLabel('_METERS_') . ')';?>", width: 150, align: 'center', css: 'vertical-align: middle;', dataIndex: 'range_m' },
  139. ],
  140. defaults: {
  141. sortable: false,
  142. fixed: true,
  143. menuDisabled: true
  144. }
  145. };
  146. var widthTableEditDialog = null;
  147. function editWidthTableRecord(){
  148. if( widthTableEditDialog == null ){
  149. widthTableEditDialog = new Ext.Window({
  150. title: '<?=$Labels->GetLabel('_EDIT_WTR_');?>',
  151. modal: true,
  152. layout: 'form',
  153. labelWidth: 200,
  154. closeAction: 'hide',
  155. labelAlign: 'right',
  156. items:[{
  157. xtype: 'textfield',
  158. id: 'wt_ad_range_val',
  159. readOnly: true,
  160. fieldLabel: '<?=$Labels->GetLabel('_RANGE_');?> (%)',
  161. value: cWTRowSelectedRangeP
  162. },{
  163. xtype: 'textfield',
  164. id: 'wt_ad_rangea_val',
  165. readOnly: true,
  166. fieldLabel: '<?=$Labels->GetLabel('_RANGE_');?> (<?=$Labels->GetLabel('_METERS_');?>)',
  167. value: cWTRowSelectedRange
  168. },{
  169. xtype: 'numberfield',
  170. id: 'wt_ad_width_val',
  171. fieldLabel: '<?=$Labels->GetLabel('_WIDTH_');?> (%)',
  172. value: '100'
  173. },{
  174. xtype: 'button',
  175. width: '100%',
  176. text: '<?=$Labels->GetLabel('_APPLY_CHANGES_');?>',
  177. handler: function(){
  178. var tWidth = Ext.getCmp('wt_ad_width_val').getValue();
  179. Ext.Ajax.request({
  180. url: '/lib/controller/updateWidthTableRecord.php',
  181. params: {
  182. UID: <?=$UserID;?>,
  183. SID: '<?=$Session;?>',
  184. DID: WTSelectedSensor,
  185. RID: cWTRowSelected,
  186. NWW: tWidth
  187. },
  188. success: function( response, opts ){
  189. widthTableEditDialog.hide();
  190. loadWidthTable( WTSelectedSensor );
  191. },
  192. failure: failureAJAXFunction
  193. });
  194. }
  195. }]
  196. });
  197. };
  198. Ext.getCmp('wt_ad_range_val').setValue( cWTRowSelectedRangeP );
  199. Ext.getCmp('wt_ad_rangea_val').setValue( cWTRowSelectedRange );
  200. widthTableEditDialog.show();
  201. };
  202. function loadWidthTable( SensorID ){
  203. WTSelectedSensor = SensorID;
  204. Ext.Ajax.request({
  205. url: '/lib/controller/getWidthTable.php',
  206. params: {
  207. UID: <?=$UserID;?>,
  208. SID: '<?=$Session;?>',
  209. DID: SensorID
  210. },
  211. success: function( response, opts ){
  212. var data = Ext.decode( response.responseText );
  213. targetWidthTable_store.removeAll();
  214. targetWidthTable_store.loadData( data.rows );
  215. },
  216. failure: failureAJAXFunction
  217. });
  218. };
  219. function loadModuleFiles( sensorID ){
  220. Ext.Ajax.request({
  221. url: '/lib/controller/getDeviceFiles.php',
  222. params: {
  223. UID: <?=$UserID;?>,
  224. SID: '<?=$Session;?>',
  225. DID: sensorID
  226. },
  227. success: function( response, opts ){
  228. var data = Ext.decode( response.responseText );
  229. uploaded_store.removeAll();
  230. uploaded_store.loadData( data.files );
  231. },
  232. failure: failureAJAXFunction
  233. });
  234. };
  235. function loadHelpContent( topicID ){
  236. if( helpContentTopicID == topicID ) return;
  237. helpContentTopicID = topicID;
  238. Ext.Ajax.request({
  239. url: '/lib/controller/getHelpTopic.php',
  240. params: {
  241. UID: <?=$UserID;?>,
  242. SID: '<?=$Session;?>',
  243. TID: topicID
  244. },
  245. success: function( response, opts ){
  246. var tData = Ext.decode(response.responseText);
  247. var tPanel = Ext.getCmp('help_content');
  248. tPanel.removeAll( true );
  249. tPanel.add( tData );
  250. tPanel.doLayout();
  251. },
  252. failure: failureAJAXFunction
  253. });
  254. };
  255. function clearHelpContent(){
  256. helpContentTopicID = -1;
  257. };
  258. function loadRessources(){
  259. Ext.Ajax.request({
  260. url: '/lib/controller/getResources.php',
  261. params: {
  262. UID: <?=$UserID;?>,
  263. SID: '<?=$Session;?>',
  264. },
  265. success: function( response, opts ){
  266. var tData = Ext.decode(response.responseText);
  267. var tPanel = Ext.getCmp('resources_container');
  268. if( tData.status == 'ok' ){
  269. var res = Ext.decode( tData.resources );
  270. tPanel.removeAll( true );
  271. tPanel.add( res );
  272. tPanel.doLayout();
  273. } else {
  274. };
  275. },
  276. failure: failureAJAXFunction
  277. });
  278. };
  279. function loadModules(){
  280. Ext.Ajax.request({
  281. url: '/lib/controller/getModules.php',
  282. params: {
  283. UID: <?=$UserID;?>,
  284. SID: '<?=$Session;?>',
  285. },
  286. success: function( response, opts ){
  287. var tData = Ext.decode(response.responseText);
  288. var tPanel = Ext.getCmp('modules_container');
  289. if( tData.status == 'ok' ){
  290. var res = Ext.decode( tData.modules );
  291. tPanel.removeAll( true );
  292. tPanel.add( res );
  293. tPanel.doLayout();
  294. } else {
  295. tPanel.removeAll( true );
  296. tPanel.doLayout();
  297. var tPanel = Ext.getCmp('mod_ed_small');
  298. tPanel.removeAll( true );
  299. tPanel.add( { html:"<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  300. tPanel.doLayout();
  301. };
  302. },
  303. failure: failureAJAXFunction
  304. });
  305. };
  306. function loadFilters(){
  307. Ext.Ajax.request({
  308. url: '/lib/controller/getFilters.php',
  309. params: {
  310. UID: <?=$UserID;?>,
  311. SID: '<?=$Session;?>',
  312. },
  313. success: function( response, opts ){
  314. var tData = Ext.decode(response.responseText);
  315. var tPanel = Ext.getCmp('filters_container');
  316. if( tData.status == 'ok' ){
  317. var res = Ext.decode( tData.modules );
  318. tPanel.removeAll( true );
  319. tPanel.add( res );
  320. tPanel.doLayout();
  321. } else {
  322. tPanel.removeAll( true );
  323. tPanel.doLayout();
  324. var tPanel = Ext.getCmp('flt_ed_small');
  325. tPanel.removeAll( true );
  326. tPanel.add( { html:"<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  327. tPanel.doLayout();
  328. };
  329. },
  330. failure: failureAJAXFunction
  331. });
  332. };
  333. var modem_pb_store = new Ext.data.JsonStore({
  334. autoDestroy: false,
  335. storeId: 'pb_store',
  336. idIndex: 0,
  337. fields: [
  338. {name: 'id', type: 'int' },
  339. {name: 'number', type: 'string'},
  340. {name: 'mode', type: 'int'},
  341. {name: 'trig_special', type: 'int'},
  342. {name: 'label', type: 'string'},
  343. {name: 'custom_msg', type: 'string'}
  344. ]
  345. });
  346. var modem_pb_ColModel_ops = {
  347. columns: [
  348. {header: "<?=$Labels->GetLabel('_MODE_');?>", width: 100, dataIndex: 'mode' },
  349. {header: "<?=$Labels->GetLabel('_PHONE_NUM_');?>", width: 200, align: 'left', css: 'vertical-align: middle;', dataIndex: 'number' },
  350. {header: "<?=$Labels->GetLabel('_LABEL_');?>", width: 200, fixed: false, align: 'center', css: 'vertical-align: middle;', dataIndex: 'label' },
  351. {header: "<?=$Labels->GetLabel('_CUSTOM_MSG_');?>", dataIndex: 'custom_msg' }
  352. ],
  353. defaults: {
  354. sortable: false,
  355. fixed: true,
  356. menuDisabled: true,
  357. width: 100
  358. }
  359. };
  360. var selected_pb_id = 0;
  361. var modem_pb_SelModel_ops = {
  362. singleSelect: true,
  363. listeners: {
  364. rowselect: function(sm, row, rec ) {
  365. //alert( rec.data.id );
  366. //loadEventProperties( rec.data );
  367. selected_pb_id = rec.data.id;
  368. Ext.getCmp( 'ph_bo_de_bu' ).enable();
  369. //alert( SelectedEvent );
  370. //var CB = Ext.getCmp('con_to_src');
  371. //CB.enable();
  372. //selectedArchiveRecord = rec;
  373. //if( rec.data.bk_type!=3 ){
  374. //
  375. //} else {
  376. //
  377. //};
  378. }
  379. }
  380. };
  381. function loadPhoneBook(){
  382. Ext.Ajax.request({
  383. url: '/lib/controller/getPhoneBook.php',
  384. params: {
  385. UID: <?=$UserID;?>,
  386. SID: '<?=$Session;?>',
  387. },
  388. success: function( response, opts ){
  389. var data = Ext.decode(response.responseText);
  390. modem_pb_store.loadData( data );
  391. Ext.getCmp( 'ph_bo_de_bu' ).disable();
  392. selected_pb_id = 0;
  393. //var tPanel = Ext.getCmp('main_portal');
  394. //tPanel.removeAll(true);
  395. //for( i=0; i < data.length; i++) tPanel.add( data[i] );
  396. //tPanel.doLayout();
  397. },
  398. failure: failureAJAXFunction
  399. });
  400. };
  401. var addNPNWindow = null;
  402. function addNewPhoneNumber(){
  403. if( addNPNWindow == null ){
  404. addNPNWindow = new Ext.Window({
  405. title: '<?=$Labels->GetLabel('_ADD_NEW_PHN_');?>',
  406. modal: true,
  407. closeAction: 'hide',
  408. resizable: false,
  409. width: 400,
  410. height: 300,
  411. items:[{
  412. xtype: 'form',
  413. labelWidth: 120,
  414. labelAlign: 'right',
  415. items: [{
  416. xtype: 'textfield',
  417. fieldLabel: '<?=$Labels->GetLabel('_NAME_LABEL_');?>',
  418. id: 'ph_name',
  419. width: 220,
  420. value: ''
  421. },{
  422. xtype: 'textfield',
  423. fieldLabel: '<?=$Labels->GetLabel('_PHONE_NUMBER_');?>',
  424. id: 'ph_number',
  425. width: 220,
  426. validator: function( a ){
  427. return true;
  428. },
  429. value: ''
  430. },{
  431. xtype: 'radio',
  432. id: 'r_ph_call',
  433. fieldLabel: '<?=$Labels->GetLabel('_CALL_ONLY_');?>',
  434. name: 'ph_cam',
  435. checked: true,
  436. value: '1'
  437. },{
  438. xtype: 'radio',
  439. id: 'r_ph_msg',
  440. fieldLabel: '<?=$Labels->GetLabel('_SMS_ONLY_');?>',
  441. name: 'ph_cam',
  442. value: '0'
  443. },{
  444. xtype: 'textarea',
  445. fieldLabel: '<?=$Labels->GetLabel('_CUSTOM_MSG_');?>',
  446. width: 220,
  447. height: 130,
  448. id: 'cus_sms',
  449. name: 'cus_sms'
  450. }]
  451. }],
  452. bbar:['->',{
  453. text: 'Add',
  454. handler: function(){
  455. var num = Ext.getCmp( 'ph_number' ).getValue();
  456. var lbl = Ext.getCmp( 'ph_name' ).getValue();
  457. var con = (Ext.getCmp( 'r_ph_call' ).getValue())?1:0;
  458. var cust = Ext.getCmp( 'cus_sms' ).getValue();
  459. Ext.Ajax.request({
  460. url: '/lib/controller/addPhoneBookRecord.php',
  461. params: {
  462. UID: <?=$UserID;?>,
  463. SID: '<?=$Session;?>',
  464. PNUM: num,
  465. PNAM: lbl,
  466. PCAL: con,
  467. PMSG: cust
  468. },
  469. success: function( response, opts ){
  470. var data = Ext.decode(response.responseText);
  471. if( data.success ){
  472. loadPhoneBook();
  473. addNPNWindow.hide();
  474. } else {
  475. Ext.Msg.show({
  476. title:'<?=$Labels->GetLabel('_ERROR_');?>',
  477. msg: data.msg,
  478. buttons: Ext.Msg.OK,
  479. icon: Ext.MessageBox.ERROR//,
  480. //fn: function(btn, text){
  481. // if( btn == 'yes' ){
  482. // cleanupChangeNotifier();
  483. // } else {
  484. // loadEditor = false;
  485. // };
  486. //}
  487. });
  488. };
  489. //var tPanel = Ext.getCmp('main_portal');
  490. //tPanel.removeAll(true);
  491. //for( i=0; i < data.length; i++) tPanel.add( data[i] );
  492. //tPanel.doLayout();
  493. },
  494. failure: failureAJAXFunction
  495. });
  496. }
  497. },{
  498. text: 'Cancel',
  499. handler: function(){
  500. addNPNWindow.hide();
  501. }
  502. }]
  503. });
  504. };
  505. addNPNWindow.show();
  506. };
  507. function deletePhoneNumber(){
  508. if( selected_pb_id ){
  509. };
  510. };
  511. function loadDetectedCameras(){
  512. Ext.Ajax.request({
  513. url: '/lib/controller/getCameras.php',
  514. params: {
  515. UID: <?=$UserID;?>,
  516. TYP: 0,
  517. SID: '<?=$Session;?>',
  518. },
  519. success: function( response, opts ){
  520. var tData = Ext.decode(response.responseText);
  521. var tPanel = Ext.getCmp('dcam_container');
  522. if( tData.status == 'ok' ){
  523. var res = Ext.decode( tData.cameras );
  524. tPanel.removeAll( true );
  525. tPanel.add( res );
  526. tPanel.doLayout();
  527. var zPanel = Ext.getCmp('dcam_op_small');
  528. zPanel.removeAll( true );
  529. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  530. zPanel.doLayout();
  531. } else {
  532. tPanel.removeAll( true );
  533. tPanel.doLayout();
  534. var zPanel = Ext.getCmp('dcam_op_small');
  535. zPanel.removeAll( true );
  536. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  537. zPanel.doLayout();
  538. };
  539. },
  540. failure: failureAJAXFunction
  541. });
  542. };
  543. function loadAssignedCameras(){
  544. Ext.Ajax.request({
  545. url: '/lib/controller/getCameras.php',
  546. params: {
  547. UID: <?=$UserID;?>,
  548. TYP: 1,
  549. SID: '<?=$Session;?>',
  550. },
  551. success: function( response, opts ){
  552. var tData = Ext.decode(response.responseText);
  553. var tPanel = Ext.getCmp('acam_container');
  554. if( tData.status == 'ok' ){
  555. var res = Ext.decode( tData.cameras );
  556. tPanel.removeAll( true );
  557. tPanel.add( res );
  558. tPanel.doLayout();
  559. var zPanel = Ext.getCmp('acam_op_small');
  560. zPanel.removeAll( true );
  561. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  562. zPanel.doLayout();
  563. } else {
  564. tPanel.removeAll( true );
  565. tPanel.doLayout();
  566. var zPanel = Ext.getCmp('acam_op_small');
  567. zPanel.removeAll( true );
  568. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  569. zPanel.doLayout();
  570. };
  571. },
  572. failure: failureAJAXFunction
  573. });
  574. };
  575. function loadAttachedSensors(){
  576. Ext.Ajax.request({
  577. url: '/lib/controller/getSensors.php',
  578. params: {
  579. UID: <?=$UserID;?>,
  580. SID: '<?=$Session;?>',
  581. },
  582. success: function( response, opts ){
  583. var tData = Ext.decode(response.responseText);
  584. var tPanel = Ext.getCmp('sens_container');
  585. if( tData.status == 'ok' ){
  586. var res = Ext.decode( tData.sensors );
  587. tPanel.removeAll( true );
  588. tPanel.add( res );
  589. tPanel.doLayout();
  590. var zPanel = Ext.getCmp('sens_op_small');
  591. zPanel.removeAll( true );
  592. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  593. zPanel.doLayout();
  594. } else {
  595. tPanel.removeAll( true );
  596. tPanel.doLayout();
  597. var zPanel = Ext.getCmp('sens_op_small');
  598. zPanel.removeAll( true );
  599. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  600. zPanel.doLayout();
  601. };
  602. },
  603. failure: failureAJAXFunction
  604. });
  605. };
  606. function editResource( rid ){
  607. var loadEditor = true;
  608. if( settingsAreChanged ){
  609. Ext.Msg.show({
  610. title:'<?=$Labels->GetLabel('_SETTINGS_CHANGED_');?>',
  611. msg: '<?=$Labels->GetLabel('_SET_CHANGED_WOULD_SAVE_');?>',
  612. buttons: Ext.Msg.YESNO,
  613. icon: Ext.MessageBox.WARNING,
  614. fn: function(btn, text){
  615. if( btn == 'yes' ){
  616. cleanupChangeNotifier();
  617. } else {
  618. loadEditor = false;
  619. };
  620. }
  621. });
  622. };
  623. if( loadEditor ){
  624. Ext.Ajax.request({
  625. url: '/lib/controller/getResourceEditor.php',
  626. params: {
  627. RID: rid,
  628. UID: <?=$UserID;?>,
  629. SID: '<?=$Session;?>',
  630. },
  631. success: function( response, opts ){
  632. var data = Ext.decode(response.responseText);
  633. var resourceEdPanel = Ext.getCmp('res_ed_small');
  634. if( resourceEdPanel ){
  635. resourceEdPanel.removeAll( true );
  636. resourceEdPanel.add( data );
  637. resourceEdPanel.doLayout();
  638. };
  639. },
  640. failure: failureAJAXFunction
  641. });
  642. };
  643. };
  644. function editFilter( fid ){
  645. var loadEditor = true;
  646. if( settingsAreChanged ){
  647. Ext.Msg.show({
  648. title: "<?=$Labels->GetLabel('_SETTINGS_CHANGED_');?>",
  649. msg: "<?=$Labels->GetLabel('_SET_CHANGED_WOULD_SAVE_');?>",
  650. buttons: Ext.Msg.YESNO,
  651. icon: Ext.MessageBox.WARNING,
  652. fn: function(btn, text){
  653. if( btn == 'yes' ){
  654. cleanupChangeNotifier();
  655. } else {
  656. loadEditor = false;
  657. };
  658. }
  659. });
  660. };
  661. if( loadEditor ){
  662. Ext.Ajax.request({
  663. url: '/lib/controller/getFilterEditor.php',
  664. params: {
  665. FID: fid,
  666. UID: <?=$UserID;?>,
  667. SID: '<?=$Session;?>',
  668. },
  669. success: function( response, opts ){
  670. var data = Ext.decode(response.responseText);
  671. var resourceEdPanel = Ext.getCmp('flt_ed_small');
  672. if( resourceEdPanel ){
  673. resourceEdPanel.removeAll( true );
  674. resourceEdPanel.add( data );
  675. resourceEdPanel.doLayout();
  676. };
  677. },
  678. failure: failureAJAXFunction
  679. });
  680. };
  681. };
  682. function editModule( mid ){
  683. var loadEditor = true;
  684. if( settingsAreChanged ){
  685. Ext.Msg.show({
  686. title: "<?=$Labels->GetLabel('_SETTINGS_CHANGED_');?>",
  687. msg: "<?=$Labels->GetLabel('_SET_CHANGED_WOULD_SAVE_');?>",
  688. buttons: Ext.Msg.YESNO,
  689. icon: Ext.MessageBox.WARNING,
  690. fn: function(btn, text){
  691. if( btn == 'yes' ){
  692. cleanupChangeNotifier();
  693. } else {
  694. loadEditor = false;
  695. };
  696. }
  697. });
  698. };
  699. if( loadEditor ){
  700. Ext.Ajax.request({
  701. url: '/lib/controller/getModuleEditor.php',
  702. params: {
  703. MID: mid,
  704. UID: <?=$UserID;?>,
  705. SID: '<?=$Session;?>',
  706. },
  707. success: function( response, opts ){
  708. var data = Ext.decode(response.responseText);
  709. var moduleEdPanel = Ext.getCmp('mod_ed_small');
  710. if( moduleEdPanel ){
  711. moduleEdPanel.removeAll( true );
  712. moduleEdPanel.add( data );
  713. moduleEdPanel.doLayout();
  714. };
  715. },
  716. failure: failureAJAXFunction
  717. });
  718. };
  719. };
  720. function doModuleOperation( ID, OPO, OPCO, reload ){
  721. Ext.Ajax.request({
  722. url: '/lib/controller/doModuleOperation.php',
  723. params: {
  724. OPID: OPO,
  725. OPCODE: OPCO,
  726. MID: ID,
  727. UID: <?=$UserID;?>,
  728. SID: '<?=$Session;?>'
  729. },
  730. success: function(){
  731. if( reload ) loadModules();
  732. }
  733. });
  734. };
  735. function enableModule( ID ){
  736. doModuleOperation( ID, 2, 1, true );
  737. };
  738. function disableModule( ID ){
  739. doModuleOperation( ID, 2, 0, true );
  740. };
  741. //cursor: url('data:image/svg+xml;utf8,<svg fill="%23FF0000" height="48" viewBox="0 0 24 24" width="48" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h24v24H0z" fill="none"/><path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/></svg>') 24 24, auto;
  742. function doCamOperation( cid, op, param, reload = false ){
  743. Ext.Ajax.request({
  744. url: '/lib/controller/doCameraOperation.php',
  745. params: {
  746. CID: cid,
  747. CMD: 10,
  748. OPID: op,
  749. OPCODE: param,
  750. UID: <?=$UserID;?>,
  751. SID: '<?=$Session;?>'
  752. },
  753. success: function(){
  754. if( reload ) loadDetectedCameras();
  755. if( reload ) loadAssignedCameras();
  756. }
  757. });
  758. };
  759. function doApplicationOperation( op, param, reload = false ){
  760. Ext.Ajax.request({
  761. url: '/lib/controller/doApplicationOperation.php',
  762. params: {
  763. OPID: op,
  764. OPCODE: param,
  765. UID: <?=$UserID;?>,
  766. SID: '<?=$Session;?>'
  767. },
  768. success: function(){
  769. //if( reload ) loadDetectedCameras();
  770. //if( reload ) loadAssignedCameras();
  771. }
  772. });
  773. };
  774. function doSensorOperation( sensorid, op, param, reload = false ){
  775. Ext.Ajax.request({
  776. url: '/lib/controller/doSensorOperation.php',
  777. params: {
  778. SNID: sensorid,
  779. CMD: op,
  780. OPID: op,
  781. OPCODE: param,
  782. UID: <?=$UserID;?>,
  783. SID: '<?=$Session;?>'
  784. },
  785. success: function(){
  786. if( reload ) loadAttachedSensors();
  787. }
  788. });
  789. };
  790. function doResourceOperation( resourceid, op, param, value, reload = false ){
  791. Ext.Ajax.request({
  792. url: '/lib/controller/doResourceOperation.php',
  793. params: {
  794. RID: resourceid,
  795. OPID: op,
  796. OPCODE: param,
  797. OPVAL: value,
  798. UID: <?=$UserID;?>,
  799. SID: '<?=$Session;?>'
  800. },
  801. success: function(){
  802. if( reload ) loadAttachedSensors();
  803. }
  804. });
  805. };
  806. function removeModule( ID ){
  807. Ext.Msg.show({
  808. title: "<?=$Labels->GetLabel('_PLS_CONFIRM_');?>",
  809. msg: "<?=$Labels->GetLabel('_RUS_DELETE_MODULE_');?>",
  810. buttons: Ext.Msg.YESNOCANCEL,
  811. fn: function( btn, text ){
  812. if( btn == 'yes' ){
  813. Ext.Ajax.request({
  814. url: '/lib/controller/doModuleOperation.php',
  815. params: {
  816. OPID: 1,
  817. MID: ID,
  818. UID: <?=$UserID;?>,
  819. SID: '<?=$Session;?>'
  820. },
  821. success: function(){
  822. //showSettings( SelectedNodeID, 2 );
  823. loadModules();
  824. }
  825. });
  826. };
  827. },
  828. icon: Ext.MessageBox.QUESTION
  829. });
  830. };
  831. function disableServOps(){
  832. var tC = Ext.getCmp('servopPanel01');
  833. tC.removeClass('servopInfo_item01');
  834. tC.addClass('servopInfo_item00');
  835. tC.disable();
  836. Ext.getCmp('tbtn_sop01').disable();
  837. //tC.doLayout();
  838. tC = Ext.getCmp('servopPanel02');
  839. tC.removeClass('servopInfo_item11');
  840. tC.addClass('servopInfo_item10');
  841. tC.disable();
  842. Ext.getCmp('tbtn_sop02').disable();
  843. //tC.doLayout();
  844. tC = Ext.getCmp('servopPanel03');
  845. tC.removeClass('servopInfo_item21');
  846. tC.addClass('servopInfo_item20');
  847. tC.disable();
  848. Ext.getCmp('tbtn_sop03').disable();
  849. //tC.doLayout();
  850. tC = Ext.getCmp('servopPanel04');
  851. tC.removeClass('servopInfo_item31');
  852. tC.addClass('servopInfo_item30');
  853. tC.disable();
  854. Ext.getCmp('tbtn_sop04').disable();
  855. //tC.doLayout();
  856. };
  857. function enableServOps(){
  858. var tC = Ext.getCmp('servopPanel01');
  859. if( tC != undefined ){
  860. tC.removeClass('servopInfo_item00');
  861. tC.addClass('servopInfo_item01');
  862. Ext.getCmp('tbtn_sop01').enable();
  863. tC.enable();
  864. };
  865. //tC.doLayout();
  866. tC = Ext.getCmp('servopPanel02');
  867. if( tC != undefined ){
  868. tC.removeClass('servopInfo_item10');
  869. tC.addClass('servopInfo_item11');
  870. tC.enable();
  871. Ext.getCmp('tbtn_sop02').enable();
  872. };
  873. //tC.doLayout();
  874. tC = Ext.getCmp('servopPanel03');
  875. if( tC != undefined ){
  876. tC.removeClass('servopInfo_item20');
  877. tC.addClass('servopInfo_item21');
  878. tC.enable();
  879. Ext.getCmp('tbtn_sop03').enable();
  880. };
  881. //tC.doLayout();
  882. tC = Ext.getCmp('servopPanel04');
  883. if( tC != undefined ){
  884. tC.removeClass('servopInfo_item30');
  885. tC.addClass('servopInfo_item31');
  886. tC.enable();
  887. Ext.getCmp('tbtn_sop04').enable();
  888. };
  889. //tC.doLayout();
  890. };
  891. function updateServerStatus(){
  892. Ext.Ajax.request({
  893. url: '/lib/controller/getServerStatus.php',
  894. params: {
  895. SERVID: 1,
  896. UID: <?=$UserID;?>,
  897. SID: '<?=$Session;?>'
  898. },
  899. success: function( response, opts ){
  900. // If the response is JSON, you have to decode it
  901. var sps = document.getElementById("INFO_SPS");
  902. if( sps == undefined ) return;
  903. var data = Ext.decode(response.responseText);
  904. if( data.status == 'ok' ){
  905. serverIsOnLine = true;
  906. enableServOps();
  907. //document.getElementById('HW_NFO').innerHTML = data.stats.hw_info;
  908. //document.getElementById('OS_NFO').innerHTML = data.stats.os_info;
  909. //document.getElementById('BLD_NFO').innerHTML = data.stats.build;
  910. setDonatStatus( 1, 0, data.stats.stat_cpu15 );
  911. setDonatStatus( 1, 1, data.stats.stat_mem );
  912. setDonatStatus( 1, 2, data.stats.stat_disk );
  913. setDonatStatus( 1, 3, data.stats.temp0 );
  914. sps.classList.remove('setEd_infoPanel');
  915. sps.classList.add('setEl_infoPanel');
  916. } else {
  917. serverIsOnLine = false;
  918. disableServOps();
  919. if( data.status == 'na' ){
  920. setDonatStatus( 1, 0, -1 );
  921. setDonatStatus( 1, 1, -1 );
  922. setDonatStatus( 1, 2, -1 );
  923. setDonatStatus( 1, 3, -1 );
  924. sps.classList.remove('setEl_infoPanel');
  925. sps.classList.add('setEd_infoPanel');
  926. } else {
  927. Ext.Msg.show({
  928. title: "<?=$Labels->GetLabel("_INFO_MSG_");?>",
  929. msg: data.messages,
  930. buttons: Ext.Msg.OK,//YESNOCANCEL,
  931. fn: function(){
  932. },
  933. icon: Ext.MessageBox.INFO //QUESTION
  934. });
  935. };
  936. };
  937. if( tlInterval == null ){
  938. tlInterval = window.setInterval( updateServerStatus, 1200, selectedSite );
  939. };
  940. },
  941. failure: failureAJAXFunction
  942. });
  943. };
  944. var addE2UDialog = null;
  945. function addEthernet2Uart(){
  946. if( addE2UDialog == null ){
  947. addE2UDialog = new Ext.Window({
  948. modal: true,
  949. title: "<?=$Labels->GetLabel('_ADD_E2U_DIAL_TTL_');?>",
  950. width: 400,
  951. height: 560,
  952. layout: 'fit',
  953. closeAction: 'hide',
  954. items:[{
  955. xtype: 'form',
  956. labelWidth: 120, // label settings here cascade unless overridden
  957. frame: false,
  958. width: 400,
  959. labelAlign: 'right',
  960. //bodyStyle:'padding:5px 5px 0',
  961. defaultType: 'textfield',
  962. items:[{
  963. xtype: 'panel',
  964. height: 200,
  965. frame: false,
  966. border: false,
  967. html: '<center><img width="200px" src="/style/assets/eth2uart.png"></center>'
  968. },/*{
  969. fieldLabel: 'Name',
  970. id: 'ued_name'
  971. },{
  972. xtype: 'combo',
  973. fieldLabel: '<?=$Labels->GetLabel('_CONNECT_2_');?>',
  974. id: 'ued_servid',
  975. editable: false,
  976. typeAhead: true,
  977. triggerAction: 'all',
  978. width: '100%',
  979. lazyRender:true,
  980. mode: 'local',
  981. store: new Ext.data.ArrayStore({
  982. <?php
  983. $QS = "SELECT `id`, `name` FROM `nodes` WHERE `type`=0";
  984. $Servers = $DATABASE->Query( $QS );
  985. $SLIST = array();
  986. $SSID = 0;
  987. if( count( $Servers ) ){
  988. foreach( $Servers as $A ) $SLIST[] = '['.$A['id'].',\''.$A['name'].'\']';
  989. $SSID = intval( $Servers[0]['id'] );
  990. };
  991. //[1,'Server Node'], [2,'Aux Server']
  992. ?>
  993. fields: ['sid', 'snam'],
  994. data: [<?=implode(',',$SLIST);?>]
  995. }),
  996. value: <?=$SSID;?>,
  997. valueField: 'sid',
  998. displayField: 'snam'
  999. },*/{
  1000. xtype: 'combo',
  1001. fieldLabel: "<?=$Labels->GetLabel('UART_COM_SPEED');?>",
  1002. id: 'ued_speed',
  1003. editable: false,
  1004. typeAhead: true,
  1005. triggerAction: 'all',
  1006. width: '100%',
  1007. lazyRender:true,
  1008. mode: 'local',
  1009. store: new Ext.data.ArrayStore({
  1010. fields: ['speed'],
  1011. data: [[19200], [115200]]
  1012. }),
  1013. value: 19200,
  1014. valueField: 'speed',
  1015. displayField: 'speed'
  1016. },{
  1017. xtype: 'combo',
  1018. fieldLabel: "<?=$Labels->GetLabel('UART_COM_BITS');?>",
  1019. id: 'ued_bit',
  1020. editable: false,
  1021. typeAhead: true,
  1022. triggerAction: 'all',
  1023. width: '100%',
  1024. lazyRender:true,
  1025. mode: 'local',
  1026. store: new Ext.data.ArrayStore({
  1027. fields: ['bits'],
  1028. data: [[5],[6],[7],[8],[9]]
  1029. }),
  1030. value: 8,
  1031. valueField: 'bits',
  1032. displayField: 'bits'
  1033. },{
  1034. xtype: 'combo',
  1035. fieldLabel: "<?=$Labels->GetLabel('UART_COM_SBITS');?>",
  1036. id: 'ued_stops',
  1037. editable: false,
  1038. typeAhead: true,
  1039. triggerAction: 'all',
  1040. width: '100%',
  1041. lazyRender:true,
  1042. mode: 'local',
  1043. store: new Ext.data.ArrayStore({
  1044. fields: ['stops'],
  1045. data: [[1],[1.5],[2]]
  1046. }),
  1047. value: 1,
  1048. valueField: 'stops',
  1049. displayField: 'stops'
  1050. },{
  1051. xtype: 'combo',
  1052. fieldLabel: "<?=$Labels->GetLabel('UART_COM_PARITY');?>",
  1053. id: 'ued_parity',
  1054. editable: false,
  1055. typeAhead: true,
  1056. triggerAction: 'all',
  1057. width: '100%',
  1058. lazyRender:true,
  1059. mode: 'local',
  1060. store: new Ext.data.ArrayStore({
  1061. fields: ['parity'],
  1062. data: [['Odd'], ['Even'],['None']]
  1063. }),
  1064. value: 'None',
  1065. valueField: 'parity',
  1066. displayField: 'parity'
  1067. },{
  1068. xtype: 'combo',
  1069. fieldLabel: "<?=$Labels->GetLabel('_WORKING_MODE_');?>",
  1070. id: 'ued_mode',
  1071. editable: false,
  1072. typeAhead: true,
  1073. triggerAction: 'all',
  1074. width: '100%',
  1075. lazyRender:true,
  1076. mode: 'local',
  1077. store: new Ext.data.ArrayStore({
  1078. fields: ['mode','mode_txt'],
  1079. data: [[0,"<?=$Labels->GetLabel('_UDP_CLIENT_');?>"], [1,"<?=$Labels->GetLabel('_TCP_CLIENT_');?>"], [2,"<?=$Labels->GetLabel('_UDP_SERVER_');?>"], [3,"<?=$Labels->GetLabel('_TCP_SERVER_');?>"]]
  1080. }),
  1081. value: 3,
  1082. valueField: 'mode',
  1083. displayField: 'mode_txt'
  1084. },{
  1085. fieldLabel: "<?=$Labels->GetLabel('_DEVICE_IP_');?>",
  1086. id: 'ued_ip'
  1087. },{
  1088. fieldLabel: "<?=$Labels->GetLabel('_DEVICE_PORT_');?>",
  1089. value: 8234,
  1090. id: 'ued_port'
  1091. }],
  1092. bbar: [{
  1093. text: 'Cancel',
  1094. handler: function(){//discoverOnvifSources
  1095. addE2UDialog.hide();
  1096. }
  1097. },'->',{
  1098. id: 'con_to_src',
  1099. text: 'Add Adapter to Site',
  1100. disabled: false,
  1101. handler: function(){
  1102. var SPD = Ext.getCmp('ued_speed').getValue();
  1103. var BIT = Ext.getCmp('ued_bit').getValue();
  1104. var STP = Ext.getCmp('ued_stops').getValue();
  1105. var PAR = Ext.getCmp('ued_parity').getValue();
  1106. var MOD = Ext.getCmp('ued_mode').getValue();
  1107. var IP = Ext.getCmp('ued_ip').getValue();
  1108. var PORT= Ext.getCmp('ued_port').getValue();
  1109. var MAC = '';//Ext.getCmp('ued_mac').getValue();
  1110. //var NAME= Ext.getCmp('ued_name').getValue();
  1111. //var SRV = Ext.getCmp('ued_servid').getValue();
  1112. Ext.Ajax.request({
  1113. url: '/lib/controller/addNode.php',
  1114. params: {
  1115. TYPE: 20,
  1116. UART_SPEED: SPD,
  1117. UART_BITS: BIT,
  1118. UART_STOP: STP,
  1119. UART_PAR: PAR,
  1120. UART_MODE: MOD,
  1121. UART_IP: IP,
  1122. UART_PORT: PORT,
  1123. UART_MAC: MAC,
  1124. //UART_NAME: NAME,
  1125. UID: <?=$UserID;?>,
  1126. //SRVID: SRV,
  1127. SID: '<?=$Session;?>'
  1128. },
  1129. success: function( response, opts ){
  1130. var data = Ext.decode(response.responseText);
  1131. if( data.sucess == false ){
  1132. Ext.Msg.show({
  1133. title:'Request Failure!',
  1134. msg: data.error,
  1135. buttons: Ext.Msg.OK,
  1136. icon: Ext.MessageBox.INFO
  1137. });
  1138. } else {
  1139. loadRessources();
  1140. };
  1141. addE2UDialog.hide();
  1142. },
  1143. failure: function( response, opts ) {
  1144. failureAJAXFunction( response, opts );
  1145. addE2UDialog.hide();
  1146. }
  1147. });
  1148. }
  1149. }]
  1150. }]
  1151. });
  1152. };
  1153. addE2UDialog.show();
  1154. };
  1155. var addSensorDialog = null;
  1156. var addSensWM = null;
  1157. function addSensor(){
  1158. if( addSensorDialog == null ){
  1159. addSensorDialog = new Ext.Window({
  1160. modal: true,
  1161. title: '<?=$Labels->GetLabel('_SMM_ADD_LSEN_');?>',
  1162. width: 500,
  1163. height: 438,
  1164. layout: 'form',
  1165. closeAction: 'hide',
  1166. labelWidth: 160,
  1167. labelAlign: 'right',
  1168. items:[{
  1169. xtype: 'panel',
  1170. frame: false,
  1171. border: false,
  1172. html: '<table width="100%" border=0><tr><td align="center" valign="middle"><div id="asd_img_div" class="node_1_img_set"></div></td></tr></table>'
  1173. },{
  1174. xtype: 'spacer',
  1175. height: 8
  1176. },{
  1177. xtype: 'combo',
  1178. id: 'sens_type',
  1179. fieldLabel: "<?=$Labels->GetLabel('SENS_TYPE');?>",
  1180. lazyRender: true,
  1181. mode: 'local',
  1182. forceSelection: true,
  1183. triggerAction: 'all',
  1184. editable: false,
  1185. disableKeyFilter: true,
  1186. store: new Ext.data.ArrayStore({
  1187. fields: ['mode','mode_txt'],
  1188. data: [
  1189. [1,"ALS <?=$Labels->GetLabel('_SENSOR_');?>"],
  1190. [2,"LFS <?=$Labels->GetLabel('_SENSOR_');?>"],
  1191. [3,"PLS 200 <?=$Labels->GetLabel('_SENSOR_');?>"],
  1192. [4,"PLS 360 <?=$Labels->GetLabel('_SENSOR_');?>"],
  1193. [5,"3D <?=$Labels->GetLabel('_SENSOR_');?>"]
  1194. ]
  1195. }),
  1196. valueField: 'mode',
  1197. displayField: 'mode_txt',
  1198. value: 1,
  1199. width: 200,
  1200. listeners:{
  1201. select: function( a, v, c ){
  1202. var ii = document.getElementById( 'asd_img_div' );
  1203. ii.className = "node_"+(c+1)+"_img_set";
  1204. if( c == 4 ){
  1205. Ext.getCmp('sens_id').hide();
  1206. Ext.getCmp('uart_id').hide();
  1207. Ext.getCmp('sens_port').show();
  1208. Ext.getCmp('sens_ip').show();
  1209. } else {
  1210. Ext.getCmp('sens_id').show();
  1211. Ext.getCmp('uart_id').show();
  1212. Ext.getCmp('sens_port').hide();
  1213. Ext.getCmp('sens_ip').hide();
  1214. };
  1215. }
  1216. }
  1217. },{
  1218. xtype: 'combo',
  1219. id: 'sens_range',
  1220. fieldLabel: "<?=$Labels->GetLabel('SENS_RANGE');?>",
  1221. lazyRender: true,
  1222. mode: 'local',
  1223. forceSelection: true,
  1224. triggerAction: 'all',
  1225. editable: false,
  1226. disableKeyFilter: true,
  1227. store: new Ext.data.ArrayStore({
  1228. fields: ['range','range_txt'],
  1229. data: [
  1230. [15,"15 <?=$Labels->GetLabel('_METERS_RANGE_');?>"],
  1231. [35,"35 <?=$Labels->GetLabel('_METERS_RANGE_');?>"],
  1232. [65,"65 <?=$Labels->GetLabel('_METERS_RANGE_');?>"],
  1233. [75,"75 <?=$Labels->GetLabel('_METERS_RANGE_');?>"],
  1234. [150,"150 <?=$Labels->GetLabel('_METERS_RANGE_');?>"],
  1235. [200,"200 <?=$Labels->GetLabel('_METERS_RANGE_');?>"],
  1236. [300,"300 <?=$Labels->GetLabel('_METERS_RANGE_');?>"],
  1237. [350,"350 <?=$Labels->GetLabel('_METERS_RANGE_');?>"]
  1238. ]
  1239. }),
  1240. valueField: 'range',
  1241. displayField: 'range_txt',
  1242. value: 15,
  1243. width: 200
  1244. },{
  1245. xtype: 'numberfield',
  1246. id: 'sens_id',
  1247. fieldLabel: "<?=$Labels->GetLabel('_PROTO_DEVICE_ID_');?>",
  1248. width: 200,
  1249. value: 0
  1250. },{
  1251. xtype: 'combo',
  1252. fieldLabel: "<?=$Labels->GetLabel('_UART_PORT_');?>",
  1253. lazyRender: true,
  1254. id: 'uart_id',
  1255. mode: 'local',
  1256. disabled: false,
  1257. forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true,
  1258. store: new Ext.data.ArrayStore({
  1259. fields: ['uart','uart_txt'],
  1260. data: [<?php
  1261. $QS="SELECT aux_id, device FROM resources WHERE ( type=1 OR type=129 )";
  1262. $RR=$DATABASE->Query( $QS );
  1263. if( count( $RR ) ){
  1264. $RE=array();
  1265. foreach( $RR as $R ){
  1266. $RE[] = "[ {$R['aux_id']}, '{$R['device']}']";
  1267. };
  1268. echo implode( ',', $RE );
  1269. } else {
  1270. echo "[0, \"".$Labels->GetLabel('_NO_UARTS_DEF_')."\"]";
  1271. };
  1272. ?>]
  1273. }),
  1274. valueField: 'uart',
  1275. displayField: 'uart_txt',
  1276. width: 200
  1277. },{
  1278. xtype: 'textfield',
  1279. id: 'sens_ip',
  1280. hidden: true,
  1281. fieldLabel: "<?=$Labels->GetLabel('_DEVICE_IP_');?>",
  1282. width: 200,
  1283. value: '192.168.200.105'
  1284. },{
  1285. xtype: 'numberfield',
  1286. id: 'sens_port',
  1287. hidden: true,
  1288. fieldLabel: "<?=$Labels->GetLabel('_DEVICE_PORT_');?>",
  1289. width: 200,
  1290. value: 2222
  1291. },{
  1292. xtype:'button',
  1293. width: '100%',
  1294. text: "<?=$Labels->GetLabel('_ADD_');?>",
  1295. handler: function(){
  1296. var TYP = parseInt( Ext.getCmp('sens_type').getValue() );
  1297. var RAN = parseInt( Ext.getCmp('sens_range').getValue() );
  1298. if( TYP > 4 ){
  1299. var RIP = Ext.getCmp('sens_ip').getValue();
  1300. var RPP = parseInt( Ext.getCmp('sens_port').getValue() );
  1301. addSensWM = new Ext.LoadMask( addSensorDialog.getEl(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."});
  1302. addSensWM.show();
  1303. Ext.Ajax.request({
  1304. url: '/lib/controller/doNodeOperation.php',
  1305. params: {
  1306. UID: <?=$UserID;?>,
  1307. SID: '<?=$Session;?>',
  1308. TYPE: TYP,
  1309. RANGE: RAN,
  1310. ADDR: RIP,
  1311. PORT: RPP,
  1312. CCMD: 1
  1313. },
  1314. success: function( response, opts ){
  1315. addSensWM.hide();
  1316. var data = Ext.decode(response.responseText);
  1317. if( data.status == 'ok' ){
  1318. loadAttachedSensors();
  1319. } else {
  1320. Ext.Msg.show({
  1321. title:'Error!',
  1322. msg: data.msg,
  1323. buttons: Ext.Msg.OK,
  1324. icon: Ext.MessageBox.WARNING
  1325. });
  1326. };
  1327. addSensorDialog.hide();
  1328. },
  1329. failure: failureAJAXFunction
  1330. });
  1331. } else {
  1332. var RTI = parseInt( Ext.getCmp('uart_id').getValue() );
  1333. if( RTI > 0 ){
  1334. var PID = parseInt( Ext.getCmp('sens_id').getValue() );
  1335. addSensWM = new Ext.LoadMask( addSensorDialog.getEl(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."});
  1336. addSensWM.show();
  1337. Ext.Ajax.request({
  1338. url: '/lib/controller/doNodeOperation.php',
  1339. params: {
  1340. UID: <?=$UserID;?>,
  1341. SID: '<?=$Session;?>',
  1342. TYPE: TYP,
  1343. DEVID: PID,
  1344. UART: RTI,
  1345. RANGE: RAN,
  1346. CCMD: 1
  1347. },
  1348. success: function( response, opts ){
  1349. addSensWM.hide();
  1350. var data = Ext.decode(response.responseText);
  1351. if( data.status == 'ok' ){
  1352. loadAttachedSensors();
  1353. } else {
  1354. Ext.Msg.show({
  1355. title:'Error!',
  1356. msg: data.msg,
  1357. buttons: Ext.Msg.OK,
  1358. icon: Ext.MessageBox.WARNING
  1359. });
  1360. };
  1361. addSensorDialog.hide();
  1362. },
  1363. failure: failureAJAXFunction
  1364. });
  1365. } else {
  1366. Ext.Msg.show({
  1367. title:'Error!',
  1368. msg: 'Please Choose UART Port',
  1369. buttons: Ext.Msg.OK,
  1370. icon: Ext.MessageBox.WARNING
  1371. });
  1372. };
  1373. };
  1374. }
  1375. }]
  1376. });
  1377. };
  1378. addSensorDialog.show();
  1379. };
  1380. var addDetCamDialog = null;
  1381. var addDetCamWM = null;
  1382. function addDetectedIPCam(){
  1383. if( addDetCamDialog == null ){
  1384. addDetCamDialog = new Ext.Window({
  1385. modal: true,
  1386. title: "<?=$Labels->GetLabel('_ADD_CAM_DIAL_TTL_');?>",
  1387. width: 400,
  1388. height: 187,
  1389. layout: 'form',
  1390. closeAction: 'hide',
  1391. labelWidth: 160,
  1392. labelAlign: 'right',
  1393. items:[{
  1394. xtype: 'spacer',
  1395. height: 8
  1396. },{
  1397. xtype: 'textfield',
  1398. id: 'ncam_ip',
  1399. fieldLabel: "<?=$Labels->GetLabel('_CAM_IP_ADDRESS_');?>",
  1400. value: ''
  1401. },{
  1402. xtype: 'textfield',
  1403. id: 'ncam_user',
  1404. fieldLabel: "<?=$Labels->GetLabel('_ACCESS_LOGIN_');?>",
  1405. value: ''
  1406. },{
  1407. xtype: 'textfield',
  1408. id: 'ncam_pwd',
  1409. inputType: 'password',
  1410. fieldLabel: "<?=$Labels->GetLabel('_ACCESS_PASSWORD_');?>",
  1411. value: ''
  1412. },{
  1413. xtype: 'combo',
  1414. id: 'ncam_auth_mode',
  1415. fieldLabel: "<?=$Labels->GetLabel('_AUTH_MODE_0_');?>",
  1416. lazyRender: true,
  1417. mode: 'local',
  1418. forceSelection: true,
  1419. triggerAction: 'all',
  1420. editable: false,
  1421. disableKeyFilter: true,
  1422. store: new Ext.data.ArrayStore({
  1423. fields: ['mode','mode_txt'],
  1424. data: [
  1425. [0,'BASIC'],
  1426. [1,'DIGEST'],
  1427. [2,'DIGEST_IE'],
  1428. [3,'BEARER'],
  1429. [4,'NEGOTIATE'],
  1430. [5,'NTLM'],
  1431. [6,'NTLM_WB'],
  1432. [7,'ANY'],
  1433. [8,'ANYSAFE'],
  1434. [9,'ONLY'],
  1435. [10,'AWS_SIGV4']
  1436. ]
  1437. }),
  1438. valueField: 'mode',
  1439. displayField: 'mode_txt',
  1440. value: 0,
  1441. width: 200
  1442. },{
  1443. xtype: 'spacer',
  1444. height: 8
  1445. },{
  1446. xtype:'button',
  1447. width: '100%',
  1448. text: 'Add Camera to List',
  1449. handler: function(){
  1450. addDetCamWM = new Ext.LoadMask( addDetCamDialog.getEl(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."});
  1451. addDetCamWM.show();
  1452. var NIP = Ext.getCmp('ncam_ip').getValue();
  1453. var NUU = Ext.getCmp('ncam_user').getValue();
  1454. var NPP = Ext.getCmp('ncam_pwd').getValue();
  1455. var NAM = Ext.getCmp('ncam_auth_mode').getValue();
  1456. Ext.Ajax.request({
  1457. url: '/lib/controller/doCameraOperation.php',
  1458. params: {
  1459. UID: <?=$UserID;?>,
  1460. SID: '<?=$Session;?>',
  1461. IP: NIP,
  1462. UU: NUU,
  1463. PP: NPP,
  1464. AU: NAM,
  1465. CMD: 3
  1466. },
  1467. success: function( response, opts ){
  1468. addDetCamWM.hide();
  1469. var data = Ext.decode(response.responseText);
  1470. if( data.status == 'ok' ){
  1471. loadDetectedCameras();
  1472. } else {
  1473. Ext.Msg.show({
  1474. title:'Error!',
  1475. msg: data.msg,
  1476. buttons: Ext.Msg.OK,
  1477. icon: Ext.MessageBox.WARNING
  1478. });
  1479. };
  1480. addDetCamDialog.hide();
  1481. },
  1482. failure: failureAJAXFunction
  1483. });
  1484. }
  1485. }]
  1486. });
  1487. };
  1488. addDetCamDialog.show();
  1489. };
  1490. var devUploadTimeout = null;
  1491. var devUploadID = -1;
  1492. function fetchDeviceUploadStatus(){
  1493. clearTimeout( devUploadTimeout );
  1494. if( devUploadID < 1 ) return;
  1495. Ext.Ajax.request({
  1496. url: '/lib/controller/getDeviceUploadStatus.php',
  1497. params: {
  1498. UID: <?=$UserID;?>,
  1499. SID: '<?=$Session;?>',
  1500. DID: devUploadID
  1501. },
  1502. success: function( response, opts ){
  1503. var data = Ext.decode(response.responseText);
  1504. var tT = Ext.getCmp('upp_ttext');
  1505. if( tT != undefined ){
  1506. if( data.count > 0 ){
  1507. devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 );
  1508. };
  1509. if( data.current != undefined ){
  1510. tT.update('<p class="UPTTEXT">Uploading '+data.count+' file(s)</p>');
  1511. document.getElementById('upp_ctext').innerHTML ='<p class="UPCTEXT">Current File: '+data.current+'</p>';
  1512. Ext.getCmp('upp_pbar').updateProgress( data.progress, Math.round( data.progress*100 )+'%', true );
  1513. devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 );
  1514. } else {
  1515. Ext.getCmp('upload_progres_panel').hide();
  1516. Ext.getCmp('uploaded_grid').show();
  1517. loadModuleFiles( devUploadID );
  1518. };
  1519. };
  1520. },
  1521. failure: failureAJAXFunction
  1522. });
  1523. };
  1524. function downloadSettings(){
  1525. ReportMask = new Ext.LoadMask(Ext.getBody(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."});
  1526. ReportMask.show();
  1527. const formData = new FormData();
  1528. formData.append("UID",<?=$UserID;?>);
  1529. formData.append("SID",'<?=$Session;?>');
  1530. fetch('/lib/controller/downloadSettings.php',{
  1531. method: "POST",
  1532. body: formData
  1533. })
  1534. .then(resp => resp.blob())
  1535. .then(blob => {
  1536. const url = window.URL.createObjectURL(blob);
  1537. const a = document.createElement('a');
  1538. a.style.display = 'none';
  1539. a.href = url;
  1540. var today=new Date();
  1541. var SY=1900+today.getYear();
  1542. var SMO=today.getMonth()+1;
  1543. var SD=today.getDate();
  1544. var SH = today.getHours();
  1545. var SM = today.getMinutes();
  1546. var SS = today.getSeconds();
  1547. a.download = 'backup_'+SY+'.'+SMO+'.'+SD+'_'+SH+'-'+SM+'-'+SS+'.db';
  1548. document.body.appendChild(a);
  1549. a.click();
  1550. window.URL.revokeObjectURL(url);
  1551. ReportMask.hide();
  1552. Ext.Msg.show({
  1553. title:'<?=$Labels->GetLabel('_SUCCESS_');?>',
  1554. msg: '<?=$Labels->GetLabel('_DB_FILE_HAS_DOWNLOADED_');?>',
  1555. buttons: Ext.Msg.OK,
  1556. icon: Ext.MessageBox.INFO
  1557. });
  1558. })
  1559. .catch(() => {
  1560. ReportMask.hide();
  1561. Ext.Msg.show({
  1562. title:'<?=$Labels->GetLabel('_REQ_FAILURE_');?>',
  1563. msg: '<?=$Labels->GetLabel('_AJX_REQFAILURE_');?>',
  1564. buttons: Ext.Msg.OK,
  1565. icon: Ext.MessageBox.ERROR
  1566. });
  1567. });
  1568. };
  1569. function showSettingsGeneral(){
  1570. stopStatusUpdater();
  1571. content_lvl1 = 1;
  1572. content_lvl2 = 0;
  1573. var tPanel = Ext.getCmp('main_content');
  1574. tPanel.removeAll( true );
  1575. <?php
  1576. //$QS="SELECT * FROM `servers` WHERE `id`=1";
  1577. //$SDD = $DATABASE->Query( $QS );
  1578. //$NData = $SDD[0];
  1579. $QS="SELECT * FROM `resources` WHERE `node_id`=1 AND ( `type`=101 OR `type`=102 )";
  1580. $CN = $DATABASE->Query( $QS );
  1581. $IL=array();
  1582. foreach( $CN as $N ){
  1583. $QS="SELECT * FROM `networks` WHERE `nif_id`={$N['aux_id']} AND `type`=0";
  1584. $NWD = $DATABASE->Query( $QS );
  1585. $NW = $NWD[0];
  1586. $IL[]="<td width=\"50px\"><img width=\"32\" src=\"/style/assets/".(($N['type']==101)?'NICs.png':'wifi-icon.png')."\"></td><td align=\"right\"><b>{$N['device']}:</b></td><td><b>{$NW['address']}</b></td>";
  1587. };
  1588. $NIFO = '<table><tr>' . implode( '</tr><tr>', $IL ) . '</tr></table>';
  1589. ?>
  1590. tPanel.add({
  1591. xtype: 'tabpanel',
  1592. frame: false,
  1593. id: 'node_settings_content',
  1594. border: false,
  1595. activeTab: content_lvl3,
  1596. items: [{
  1597. xtype: 'panel',
  1598. id: 'gi_tab',
  1599. title: "<?=$Labels->GetLabel( '_GENERAL_NFO_' );?>",
  1600. layout: 'hbox',
  1601. items:[{
  1602. xtype: 'panel',
  1603. flex: 1,
  1604. height: PanelH-15,
  1605. autoScroll: false,
  1606. html: '<table width="100%" height="100%" border=0><tr><td height="290px" align="center" valign="middle"><div class="server_img_set"></div></td></tr>\
  1607. <tr><td height="100px"><table width="100%" border=0><tr>\
  1608. <td align="center"><svg class="donut" width="80" height="100%" viewBox="0 0 42 42"><circle id="status_1_donut0_segment2" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#b1c94e" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut0_segment3" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#aaddff" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut0_segment1" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#ce4b99" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><g class="chart-text"><text x="50%" y="50%" class="chart-number" id="status_1_totalValue0">0</text><text x="50%" y="50%" class="chart-label">CPU</text></g></svg></td>\
  1609. <td align="center"><svg class="donut" width="80" height="100%" viewBox="0 0 42 42"><circle id="status_1_donut1_segment2" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#b1c94e" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut1_segment3" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#aaddff" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut1_segment1" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#ce4b99" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><g class="chart-text"><text x="50%" y="50%" class="chart-number" id="status_1_totalValue1">0</text><text x="50%" y="50%" class="chart-label">MEM</text></g></svg></td>\
  1610. <td align="center"><svg class="donut" width="80" height="100%" viewBox="0 0 42 42"><circle id="status_1_donut2_segment2" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#b1c94e" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut2_segment3" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#aaddff" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut2_segment1" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#ce4b99" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><g class="chart-text"><text x="50%" y="50%" class="chart-number" id="status_1_totalValue2">0</text><text x="50%" y="50%" class="chart-label">DISK</text></g></svg></td>\
  1611. <td align="center"><svg class="donut" width="80" height="100%" viewBox="0 0 42 42"><circle id="status_1_donut3_segment2" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#b1c94e" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut3_segment3" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#aaddff" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_1_donut3_segment1" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#ce4b99" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><g class="chart-text"><text x="50%" y="50%" class="chart-number" id="status_1_totalValue3">0</text><text x="50%" y="50%" class="chart-label">TEMP</text></g></svg></td>\
  1612. </tr></table></td></tr>\
  1613. <tr><td valign="top"><div class="setEd_infoPanel" id="INFO_SPS">\
  1614. <div class="sideInfo_item" id="SW_INFO"><?=$AP_DATA['build'];?></div>\
  1615. <div class="sideInfo_item" id="OS_INFO"><?=$AP_DATA['os_info'];?></div>\
  1616. <div class="sideInfo_item" id="HW_INFO"><?=$AP_DATA['hw_info'];?></div>\
  1617. </div></td></tr>\
  1618. <tr><td height="60%">&nbsp;</td></tr></table>'
  1619. },{
  1620. xtype: 'panel',
  1621. id: '_ed_small',
  1622. flex: 1,
  1623. height: PanelH-15,
  1624. autoScroll: false,
  1625. items:[
  1626. <?php if( $CUser->Data['access'] > 3 ){ ?>
  1627. {
  1628. xtype: 'panel',
  1629. baseCls:'servopInfo_item00',
  1630. id: 'servopPanel01',
  1631. items:[{
  1632. xtype: 'panel',
  1633. frame: false,
  1634. border: false,
  1635. unstyled: true,
  1636. html: "<p><?=$Labels->GetLabel('_SERV_RESTART_DESC_');?></p><br/>"
  1637. },{
  1638. xtype: 'button',
  1639. lazyRender: true,
  1640. iconCls: 'srv_op_restart',
  1641. text: "<?=$Labels->GetLabel('_SERV_RESTART_OP_');?>",
  1642. id: 'tbtn_sop01',
  1643. scale: 'large',
  1644. width: '95%',
  1645. disabled: true,
  1646. handler: function( bt ){
  1647. Ext.Msg.show({
  1648. title:"<?=$Labels->GetLabel('_SERV_RESTART_QT_');?>",
  1649. msg: "<?=$Labels->GetLabel('_SERV_RESTART_QM_');?>",
  1650. buttons: Ext.Msg.YESNO,
  1651. width: 400,
  1652. icon: Ext.MessageBox.INFO,
  1653. fn: function(btn, text){
  1654. if( btn == 'yes' ){
  1655. disableServOps();
  1656. doDeviceOperation( 1, 250,'', true );
  1657. };
  1658. }
  1659. });
  1660. }
  1661. }]
  1662. },{
  1663. xtype: 'spacer',
  1664. height: 8
  1665. }
  1666. <?php if( $CUser->Data['access'] > 4 ){ ?>
  1667. ,{
  1668. xtype: 'panel',
  1669. baseCls:'servopInfo_item10',
  1670. id: 'servopPanel02',
  1671. items:[{
  1672. xtype: 'panel',
  1673. frame: false,
  1674. border: false,
  1675. unstyled: true,
  1676. html: "<p><?=$Labels->GetLabel('_SERV_HW_DET_DESC_');?></p><br/>"
  1677. },{
  1678. xtype: 'button',
  1679. iconCls: 'srv_op_hw_init',
  1680. text: "<?=$Labels->GetLabel('_SERV_HW_DET_OP_');?>",
  1681. id: 'tbtn_sop02',
  1682. scale: 'large',
  1683. width: '95%',
  1684. disabled: true,
  1685. handler: function( bt ){
  1686. Ext.Msg.show({
  1687. title:"<?=$Labels->GetLabel('_SERV_HW_DET_QT_');?>",
  1688. msg: "<?=$Labels->GetLabel('_SERV_HW_DET_QM_');?>",
  1689. buttons: Ext.Msg.YESNO,
  1690. width: 400,
  1691. icon: Ext.MessageBox.INFO,
  1692. fn: function(btn, text){
  1693. if( btn == 'yes' ){
  1694. disableServOps();
  1695. doDeviceOperation( 1, 251,'', true );
  1696. };
  1697. }
  1698. });
  1699. }
  1700. }]
  1701. },{
  1702. xtype: 'spacer',
  1703. height: 8
  1704. }
  1705. <?php if( $CUser->Data['access'] > 5 ){ ?>
  1706. ,{
  1707. xtype: 'panel',
  1708. baseCls:'servopInfo_item20',
  1709. id: 'servopPanel03',
  1710. items:[{
  1711. xtype: 'panel',
  1712. frame: false,
  1713. border: false,
  1714. unstyled: true,
  1715. html: "<p><?=$Labels->GetLabel('_SERV_OSRESET_DESC_');?></p><br/>"
  1716. },{
  1717. xtype: 'button',
  1718. iconCls: 'srv_op_power_cycle',
  1719. text: "<?=$Labels->GetLabel('_SERV_OSRESET_OP_');?>",
  1720. id: 'tbtn_sop03',
  1721. scale: 'large',
  1722. width: '95%',
  1723. disabled: true,
  1724. handler: function( bt ){
  1725. Ext.Msg.show({
  1726. title: "<?=$Labels->GetLabel('_SERV_OSRESET_QT_');?>",
  1727. msg: "<?=$Labels->GetLabel('_SERV_OSRESET_QM_');?>",
  1728. buttons: Ext.Msg.YESNO,
  1729. width: 400,
  1730. icon: Ext.MessageBox.WARNING,
  1731. fn: function(btn, text){
  1732. if( btn == 'yes' ){
  1733. cleanupChangeNotifier();
  1734. } else {
  1735. loadEditor = false;
  1736. };
  1737. }
  1738. });
  1739. }
  1740. }]
  1741. },{
  1742. xtype: 'spacer',
  1743. height: 8
  1744. },{
  1745. xtype: 'panel',
  1746. baseCls:'servopInfo_item30',
  1747. id: 'servopPanel04',
  1748. items:[{
  1749. xtype: 'panel',
  1750. frame: false,
  1751. border: false,
  1752. unstyled: true,
  1753. html: "<p><?=$Labels->GetLabel('_SERV_FACTORY_DESC_');?></p><br/>"
  1754. },{
  1755. xtype: 'button',
  1756. iconCls: 'srv_op_factory_reset',
  1757. text: "<?=$Labels->GetLabel('_SERV_FACTORY_OP_');?>",
  1758. id: 'tbtn_sop04',
  1759. scale: 'large',
  1760. width: '95%',
  1761. disabled: true,
  1762. handler: function( bt ){
  1763. Ext.Msg.show({
  1764. title: "<?=$Labels->GetLabel('_SERV_FACTORY_QT_');?>",
  1765. msg: "<?=$Labels->GetLabel('_SERV_FACTORY_QM_');?>",
  1766. buttons: Ext.Msg.YESNO,
  1767. width: 400,
  1768. icon: Ext.MessageBox.ERROR,
  1769. fn: function(btn, text){
  1770. if( btn == 'yes' ){
  1771. disableServOps();
  1772. doDeviceOperation( 1, 254,'', true );
  1773. };
  1774. }
  1775. });
  1776. }
  1777. }]
  1778. }
  1779. <?php
  1780. };
  1781. };
  1782. }; ?>
  1783. ]
  1784. }]
  1785. }
  1786. <?php if( $CUser->Data['access'] > 4 ){ ?>
  1787. ,{
  1788. xtype: 'panel',
  1789. title: "<?=$Labels->GetLabel( '_RESOURCES_' );?>",
  1790. id: 'res_tab',
  1791. layout: 'hbox',
  1792. items:[{
  1793. xtype: 'panel',
  1794. id: 'resources_container',
  1795. flex: 1,
  1796. height: PanelH-15,
  1797. autoScroll: 'auto',
  1798. tbar:[{
  1799. text: "<?=$Labels->GetLabel( '_ADD_REMOTE_UART_' );?>",
  1800. handler: function(){
  1801. addEthernet2Uart();
  1802. }
  1803. }],
  1804. items:[]
  1805. },{
  1806. xtype: 'panel',
  1807. id: 'res_ed_small',
  1808. flex: 1,
  1809. height: PanelH-15,
  1810. layout: 'fit',
  1811. items:[{
  1812. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1813. }]
  1814. }]
  1815. },{
  1816. xtype: 'panel',
  1817. title: "<?=$Labels->GetLabel( '_SERVER_MODULES_' );?>",
  1818. id: 'mod_tab',
  1819. layout: 'hbox',
  1820. items:[{
  1821. xtype: 'panel',
  1822. id: 'modules_container',
  1823. flex: 1,
  1824. height: PanelH-15,
  1825. autoScroll: 'auto',
  1826. tbar:[{
  1827. text: "<?=$Labels->GetLabel( '_ADD_MODULE_' );?>",
  1828. handler: function(){
  1829. var addModuleWindow = new Ext.Window({
  1830. id: 'huha_boa',
  1831. title: "<?=$Labels->GetLabel( '_AS_MODULE_' );?>",
  1832. modal: true,
  1833. width: 400,
  1834. height: 300,
  1835. items:[{
  1836. xtype: 'form',
  1837. items: [{
  1838. xtype: 'combo',
  1839. fieldLabel: "<?=$Labels->GetLabel( 'MOD_TYPE' );?>",
  1840. id: 'mod_type',
  1841. lazyRender: true,
  1842. mode: 'local',
  1843. forceSelection: true,
  1844. triggerAction: 'all',
  1845. editable: false,
  1846. disableKeyFilter: true,
  1847. store: new Ext.data.ArrayStore({
  1848. fields: ['az_t','az_txt'],
  1849. data: [<?php
  1850. $QS = "SELECT * FROM `module_types`";
  1851. $MM = $DATABASE->Query( $QS );
  1852. $MIMO = array();
  1853. foreach( $MM as $M ) $MIMO[]="[{$M['id']},\"".$Labels->GetLabel($M['name'])."\"]";
  1854. echo implode( ',', $MIMO );
  1855. ?>]
  1856. }),
  1857. valueField: 'az_t',
  1858. displayField: 'az_txt',
  1859. value: 1,
  1860. listeners:{
  1861. select: function( t, r, i ){
  1862. var n = r.data.az_t;
  1863. Ext.Ajax.request({
  1864. url: '/lib/controller/getModuleInfo.php',
  1865. params: {
  1866. MID: n,
  1867. UID: <?=$UserID;?>,
  1868. SID: '<?=$Session;?>'
  1869. },
  1870. success: function( response, opts ){
  1871. Ext.getCmp('infopan').update( response.responseText );
  1872. }
  1873. });
  1874. }
  1875. }
  1876. },{
  1877. xtype: 'panel',
  1878. id: 'infopan',
  1879. html: ''
  1880. }]
  1881. }],
  1882. bbar:[{
  1883. text: '<?=$Labels->GetLabel( '_CANCEL_' );?>',
  1884. handler: function(){
  1885. addModuleWindow.close();
  1886. }
  1887. },{
  1888. text: '<?=$Labels->GetLabel( '_ADD_' );?>',
  1889. handler: function(){
  1890. var mtyp = Ext.getCmp('mod_type').getValue();
  1891. Ext.Ajax.request({
  1892. url: '/lib/controller/addModule.php',
  1893. params: {
  1894. SERVID: 1,
  1895. TYPE: mtyp,
  1896. UID: <?=$UserID;?>,
  1897. SID: '<?=$Session;?>'
  1898. },
  1899. success: function( response, opts ){
  1900. // If the response is JSON, you have to decode it
  1901. var data = Ext.decode(response.responseText);
  1902. if( data.status == 'ok' ){
  1903. addModuleWindow.close();
  1904. loadModules();
  1905. } else {
  1906. Ext.Msg.show({
  1907. title: "<?=$Labels->GetLabel("_INFO_MSG_");?>",
  1908. msg: data.message,
  1909. buttons: Ext.Msg.OK,//YESNOCANCEL,
  1910. fn: function(){
  1911. //SettingsLidar3D.hide();
  1912. },
  1913. icon: Ext.MessageBox.INFO //QUESTION
  1914. });
  1915. }
  1916. },
  1917. failure: failureAJAXFunction
  1918. });
  1919. }
  1920. }]
  1921. });
  1922. addModuleWindow.show();
  1923. }
  1924. }],
  1925. items:[]
  1926. },{
  1927. xtype: 'panel',
  1928. id: 'mod_ed_small',
  1929. flex: 1,
  1930. height: PanelH-15,
  1931. layout: 'fit',
  1932. items:[{
  1933. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1934. }]
  1935. }]
  1936. },{
  1937. xtype: 'panel',
  1938. title: "<?=$Labels->GetLabel( '_TARGET_FILTERS_' );?>",
  1939. id: 'flt_tab',
  1940. layout: 'hbox',
  1941. items:[{
  1942. xtype: 'panel',
  1943. id: 'filters_container',
  1944. flex: 1,
  1945. height: PanelH-15,
  1946. autoScroll: 'auto',
  1947. tbar:[{
  1948. text: "<?=$Labels->GetLabel( '_ADD_FILTER_' );?>",
  1949. handler: function(){
  1950. var addFilterWindow = new Ext.Window({
  1951. id: 'fulu_boa',
  1952. title: "<?=$Labels->GetLabel( '_ADD_EVT_FILTER_' );?>",
  1953. modal: true,
  1954. width: 400,
  1955. height: 300,
  1956. items:[{
  1957. xtype: 'form',
  1958. items: [{
  1959. xtype: 'combo',
  1960. fieldLabel: "<?=$Labels->GetLabel( 'MOD_TYPE' );?>",
  1961. id: 'flt_type',
  1962. lazyRender: true,
  1963. mode: 'local',
  1964. forceSelection: true,
  1965. triggerAction: 'all',
  1966. editable: false,
  1967. disableKeyFilter: true,
  1968. store: new Ext.data.ArrayStore({
  1969. fields: ['az_t','az_txt'],
  1970. data: [<?php
  1971. $QS="SELECT `id`,`name` FROM `target_filter_types`";
  1972. $JIJI=$DATABASE->Query( $QS );
  1973. $OOP = array();
  1974. foreach( $JIJI as $JI ) $OOP[] = "[{$JI['id']},'".$Labels->getLabel($JI['name'])."']";
  1975. echo implode(',', $OOP );
  1976. ?>]
  1977. }),
  1978. valueField: 'az_t',
  1979. displayField: 'az_txt',
  1980. value: 1,
  1981. listeners:{
  1982. select: function( t, r, i ){
  1983. var n = r.data.az_t;
  1984. Ext.Ajax.request({
  1985. url: '/lib/controller/getFilterInfo.php',
  1986. params: {
  1987. FID: n,
  1988. UID: <?=$UserID;?>,
  1989. SID: '<?=$Session;?>'
  1990. },
  1991. success: function( response, opts ){
  1992. Ext.getCmp('filt_infopan').update( response.responseText );
  1993. }
  1994. });
  1995. }
  1996. }
  1997. },{
  1998. xtype: 'panel',
  1999. id: 'filt_infopan',
  2000. html: ''
  2001. }]
  2002. }],
  2003. bbar:[{
  2004. text: "<?=$Labels->GetLabel( '_CANCEL_' );?>",
  2005. handler: function(){
  2006. addFilterWindow.close();
  2007. }
  2008. },{
  2009. text: "<?=$Labels->GetLabel( '_ADD_' );?>",
  2010. handler: function(){
  2011. var mtyp = Ext.getCmp('flt_type').getValue();
  2012. Ext.Ajax.request({
  2013. url: '/lib/controller/addFilter.php',
  2014. params: {
  2015. SERVID: 1,
  2016. TYPE: mtyp,
  2017. UID: <?=$UserID;?>,
  2018. SID: '<?=$Session;?>'
  2019. },
  2020. success: function( response, opts ){
  2021. // If the response is JSON, you have to decode it
  2022. var data = Ext.decode(response.responseText);
  2023. if( data.status == 'ok' ){
  2024. addFilterWindow.close();
  2025. loadFilters();
  2026. } else {
  2027. Ext.Msg.show({
  2028. title: "<?=$Labels->GetLabel("_INFO_MSG_");?>",
  2029. msg: data.message,
  2030. buttons: Ext.Msg.OK,//YESNOCANCEL,
  2031. fn: function(){
  2032. //SettingsLidar3D.hide();
  2033. },
  2034. icon: Ext.MessageBox.INFO //QUESTION
  2035. });
  2036. }
  2037. },
  2038. failure: failureAJAXFunction
  2039. });
  2040. }
  2041. }]
  2042. });
  2043. addFilterWindow.show();
  2044. Ext.Ajax.request({
  2045. url: '/lib/controller/getFilterInfo.php',
  2046. params: {
  2047. FID: 1,
  2048. UID: <?=$UserID;?>,
  2049. SID: '<?=$Session;?>'
  2050. },
  2051. success: function( response, opts ){
  2052. Ext.getCmp('filt_infopan').update( response.responseText );
  2053. }
  2054. });
  2055. }
  2056. }],
  2057. items:[]
  2058. },{
  2059. xtype: 'panel',
  2060. id: 'flt_ed_small',
  2061. flex: 1,
  2062. height: PanelH-15,
  2063. layout: 'fit',
  2064. items:[{
  2065. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  2066. }]
  2067. }]
  2068. }
  2069. <?php }; ?>
  2070. ],
  2071. listeners:{
  2072. tabchange: function( tp, t ){
  2073. switch( t.getId() ){
  2074. case 'gi_tab': {
  2075. //content_lvl3=0;
  2076. updateServerStatus();
  2077. break;
  2078. };
  2079. case 'res_tab': {
  2080. //content_lvl3=1;
  2081. stopStatusUpdater();
  2082. loadRessources();
  2083. break;
  2084. };
  2085. case 'mod_tab':{
  2086. //content_lvl3=2;
  2087. stopStatusUpdater();
  2088. loadModules();
  2089. break;
  2090. };
  2091. case 'flt_tab':{
  2092. //content_lvl3=3;
  2093. stopStatusUpdater();
  2094. loadFilters();
  2095. break;
  2096. };
  2097. };
  2098. //updateUserContent();
  2099. },
  2100. afterrender: function(){
  2101. settingsAreChanged = false;
  2102. }
  2103. },
  2104. updateSettings: function(){
  2105. alert('Update Settings');
  2106. }
  2107. });
  2108. tPanel.doLayout();
  2109. updateServerStatus();
  2110. };
  2111. function showSettingsSensors(){
  2112. stopStatusUpdater();
  2113. content_lvl1 = 1;
  2114. content_lvl2 = 4;
  2115. var tPanel = Ext.getCmp('main_content');
  2116. tPanel.removeAll( true );
  2117. tPanel.add({
  2118. xtype: 'panel',
  2119. id: 'sen_set',
  2120. layout: 'hbox',
  2121. tbar:[{
  2122. text: "<?=$Labels->GetLabel( '_SMM_ADD_LSEN_' );?>",
  2123. handler: function(){
  2124. addSensor();
  2125. }
  2126. }],
  2127. items:[{
  2128. xtype: 'panel',
  2129. id: 'sens_container',
  2130. flex: 1,
  2131. height: PanelH-15,
  2132. autoScroll: 'auto',
  2133. items:[]
  2134. },{
  2135. xtype: 'panel',
  2136. id: 'sens_op_small',
  2137. flex: 1,
  2138. height: PanelH-15,
  2139. layout: 'fit',
  2140. items:[{
  2141. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  2142. }]
  2143. }]
  2144. });
  2145. tPanel.doLayout();
  2146. loadAttachedSensors();
  2147. };
  2148. function showSettingsDetection(){
  2149. stopStatusUpdater();
  2150. content_lvl1 = 1;
  2151. content_lvl2 = 4;
  2152. var tPanel = Ext.getCmp('main_content');
  2153. tPanel.removeAll( true );
  2154. tPanel.add({
  2155. xtype: 'panel',
  2156. id: 'sen_set',
  2157. layout: 'hbox',
  2158. tbar:[{
  2159. text: "<?=$Labels->GetLabel( '_SMM_ADD_LSEN_' );?>",
  2160. handler: function(){
  2161. addSensor();
  2162. }
  2163. }],
  2164. items:[{
  2165. xtype: 'panel',
  2166. id: 'sens_container',
  2167. flex: 1,
  2168. height: PanelH-15,
  2169. autoScroll: 'auto',
  2170. items:[]
  2171. },{
  2172. xtype: 'panel',
  2173. id: 'sens_op_small',
  2174. flex: 1,
  2175. height: PanelH-15,
  2176. layout: 'fit',
  2177. items:[{
  2178. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  2179. }]
  2180. }]
  2181. });
  2182. tPanel.doLayout();
  2183. loadAttachedSensors();
  2184. };
  2185. function editSensorHW( cid ){
  2186. SelectedSensor = cid;
  2187. Ext.Ajax.request({
  2188. url: '/lib/controller/getSensorEditor.php',
  2189. params: {
  2190. CID: SelectedSensor,
  2191. UID: <?=$UserID;?>,
  2192. SID: '<?=$Session;?>'
  2193. },
  2194. success: function( response, opts ){
  2195. var data = Ext.decode( response.responseText );
  2196. var tComp = Ext.getCmp('sens_op_small');
  2197. if( data.status == 'ok' ){
  2198. if( tComp!= null ){
  2199. var content = Ext.decode( data.content );
  2200. tComp.removeAll( true );
  2201. tComp.add( content );
  2202. tComp.doLayout();
  2203. };
  2204. } else {
  2205. if( tComp!= null ){
  2206. tComp.removeAll( true );
  2207. tComp.add( data );
  2208. tComp.doLayout();
  2209. };
  2210. };
  2211. },
  2212. failure: function(){
  2213. }
  2214. });
  2215. };
  2216. var cameraEditorContent = null;
  2217. function editCamera( cid, etyp ){
  2218. SelectedCam = cid;
  2219. switch( etyp ){
  2220. case 0: cameraEditorContent = Ext.getCmp('dcam_op_small'); break;
  2221. case 1: cameraEditorContent = Ext.getCmp('acam_op_small'); break;
  2222. };
  2223. Ext.Ajax.request({
  2224. url: '/lib/controller/getCameraEditor.php',
  2225. params: {
  2226. CID: SelectedCam,
  2227. UID: <?=$UserID;?>,
  2228. SID: '<?=$Session;?>'
  2229. },
  2230. success: function( response, opts ){
  2231. var data = Ext.decode( response.responseText );
  2232. if( data.status == 'ok' ){
  2233. if( cameraEditorContent!= null ){
  2234. var content = Ext.decode( data.content );
  2235. cameraEditorContent.removeAll( true );
  2236. cameraEditorContent.add( content );
  2237. cameraEditorContent.doLayout();
  2238. };
  2239. } else {
  2240. if( cameraEditorContent!= null ){
  2241. cameraEditorContent.removeAll( true );
  2242. cameraEditorContent.add( data );
  2243. cameraEditorContent.doLayout();
  2244. };
  2245. };
  2246. },
  2247. failure: function(){
  2248. }
  2249. });
  2250. };
  2251. function showSettingsVideo(){
  2252. stopStatusUpdater();
  2253. content_lvl1 = 1;
  2254. content_lvl2 = 4;
  2255. content_lvl3 = 0;
  2256. var tPanel = Ext.getCmp('main_content');
  2257. tPanel.removeAll( true );
  2258. tPanel.add({
  2259. xtype: 'tabpanel',
  2260. frame: false,
  2261. id: 'node_settings_content',
  2262. border: false,
  2263. activeTab: content_lvl3,
  2264. items: [{
  2265. xtype: 'panel',
  2266. id: 'cam_ass_tab',
  2267. title: "<?=$Labels->GetLabel('_CAM_ASS_LIST_');?>",
  2268. layout: 'hbox',
  2269. items:[{
  2270. xtype: 'panel',
  2271. id: 'acam_container',
  2272. flex: 1,
  2273. height: PanelH-15,
  2274. autoScroll: 'auto',
  2275. items:[]
  2276. },{
  2277. xtype: 'panel',
  2278. id: 'acam_op_small',
  2279. flex: 1,
  2280. height: PanelH-15,
  2281. layout: 'fit',
  2282. items:[{
  2283. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  2284. }]
  2285. }]
  2286. },{
  2287. xtype: 'panel',
  2288. title: "<?=$Labels->GetLabel('_CAM_DET_LIST_');?>",
  2289. id: 'cam_det_tab',
  2290. layout: 'hbox',
  2291. items:[{
  2292. xtype: 'panel',
  2293. id: 'dcam_container',
  2294. flex: 1,
  2295. height: PanelH-15,
  2296. autoScroll: 'auto',
  2297. tbar:[{
  2298. text: "<?=$Labels->GetLabel( '_MANUADD_CAMERA_' );?>",
  2299. handler: function(){
  2300. addDetectedIPCam();
  2301. }
  2302. }],
  2303. items:[]
  2304. },{
  2305. xtype: 'panel',
  2306. id: 'dcam_op_small',
  2307. flex: 1,
  2308. height: PanelH-15,
  2309. layout: 'fit',
  2310. items:[{
  2311. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  2312. }]
  2313. }]
  2314. }],
  2315. listeners:{
  2316. tabchange: function( tp, t ){
  2317. switch( t.getId() ){
  2318. case 'cam_det_tab': {
  2319. content_lvl3=0;
  2320. stopStatusUpdater();
  2321. loadDetectedCameras();
  2322. break;
  2323. };
  2324. case 'cam_ass_tab': {
  2325. content_lvl3=1;
  2326. stopStatusUpdater();
  2327. loadAssignedCameras();
  2328. break;
  2329. };
  2330. case 'mod_tab':{
  2331. content_lvl3=2;
  2332. stopStatusUpdater();
  2333. loadModules();
  2334. break;
  2335. };
  2336. case 'net_tab':{
  2337. content_lvl3=3;
  2338. stopStatusUpdater();
  2339. break;
  2340. };
  2341. };
  2342. updateUserContent();
  2343. },
  2344. afterrender: function(){
  2345. settingsAreChanged = false;
  2346. }
  2347. }
  2348. });
  2349. tPanel.doLayout();
  2350. updateUserContent();
  2351. updateServerStatus();
  2352. };
  2353. function showSettingsApplication(){
  2354. stopStatusUpdater();
  2355. content_lvl1 = 1;
  2356. content_lvl2 = 3;
  2357. //Load Location
  2358. prepareMapData();
  2359. var tPanel = Ext.getCmp('main_content');
  2360. tPanel.removeAll( true );
  2361. tPanel.add({
  2362. xtype: 'tabpanel',
  2363. frame: false,
  2364. id: 'settings_a_content',
  2365. border: false,
  2366. activeTab: 0,
  2367. items:[{
  2368. title: "<?=$Labels->GetLabel('_WORKING_MODE_');?>",
  2369. xtype: 'form',
  2370. labelAlign: 'right',
  2371. labelWidth: 250,
  2372. height: PanelH - 30,
  2373. items:[{
  2374. xtype: 'spacer',
  2375. height: 10
  2376. },{
  2377. xtype: 'panel',
  2378. frame: false,
  2379. border: true,
  2380. bodyStyle: 'background-color: white;',
  2381. <?php
  2382. echo "html: '<center><img height=\"120px\" src=\"/style/assets/{$AP_DATA['oem_logo']}.png\"></center>',";
  2383. ?>
  2384. height: 130
  2385. },{
  2386. xtype: 'spacer',
  2387. height: 10
  2388. },{
  2389. xtype: 'textfield',
  2390. fieldLabel: "<?=$Labels->GetLabel( '_INSTANCE_ID_' );?>",
  2391. width: 300,
  2392. value: '<?php
  2393. $QS = "SELECT `identity` FROM `servers` LIMIT 1";
  2394. $TT = $DATABASE->Query( $QS );
  2395. if( count( $TT ) ){
  2396. echo $TT[0]['identity'];
  2397. } else {
  2398. echo "----No-Identity-Set---";
  2399. };
  2400. ?>'
  2401. },{
  2402. xtype: 'spacer',
  2403. height: 10
  2404. },{
  2405. xtype: 'button',
  2406. text: "<?=$Labels->GetLabel( '_GEN_INSTANCE_ID_' );?>",
  2407. width: 550,
  2408. handler: function(){
  2409. doApplicationOperation( 3, 0 );
  2410. }
  2411. },{
  2412. xtype: 'spacer',
  2413. height: 10
  2414. },{
  2415. xtype: 'combo',
  2416. fieldLabel: "<?=$Labels->GetLabel('_DEBUGGING_MODE_');?>",
  2417. editable: false,
  2418. typeAhead: true,
  2419. width: 300,
  2420. triggerAction: 'all',
  2421. lazyRender:true,
  2422. mode: 'local',
  2423. store: new Ext.data.ArrayStore({
  2424. fields: ['sid', 'snam'],
  2425. data: [[0,"<?=$Labels->GetLabel('__DISABLED__');?>"], [1,"<?=$Labels->GetLabel('___ENABLED__');?>"]]
  2426. }),
  2427. value: <?=$AP_DATA['work_mode'];?>,
  2428. valueField: 'sid',
  2429. displayField: 'snam',
  2430. listeners:{
  2431. select: function( t, r, i ){
  2432. doApplicationOperation( 1, i );
  2433. }
  2434. }
  2435. },{
  2436. xtype: 'spacer',
  2437. height: 10
  2438. },{
  2439. xtype: 'textfield',
  2440. fieldLabel: "<?=$Labels->GetLabel('_REMOTE_SERVER_ADDRESS_');?>",
  2441. width: 300,
  2442. value: '<?=$AP_DATA['remote_ip'];?>',
  2443. listeners:{
  2444. change: function( a, c, b ){
  2445. doApplicationOperation( 8, c );
  2446. }
  2447. }
  2448. },{
  2449. xtype: 'spacer',
  2450. height: 10
  2451. },{
  2452. xtype: 'numberfield',
  2453. fieldLabel: "<?=$Labels->GetLabel('_REMOTE_SERVER_PORT_');?>",
  2454. width: 300,
  2455. value: <?=intval($AP_DATA['remote_port']);?>,
  2456. listeners:{
  2457. change: function( a, c, b ){
  2458. doApplicationOperation( 9, c );
  2459. }
  2460. }
  2461. },{
  2462. xtype: 'spacer',
  2463. height: 10
  2464. },{
  2465. xtype: 'combo',
  2466. fieldLabel: "<?=$Labels->GetLabel('_USE_REMOTE_SERVER_');?>",
  2467. editable: false,
  2468. typeAhead: true,
  2469. width: 300,
  2470. triggerAction: 'all',
  2471. lazyRender:true,
  2472. mode: 'local',
  2473. store: new Ext.data.ArrayStore({
  2474. fields: ['sid', 'snam'],
  2475. data: [[0,"<?=$Labels->GetLabel('__DISABLED__');?>"], [1,"<?=$Labels->GetLabel('___ENABLED__');?>"]]
  2476. }),
  2477. value: <?=intval($AP_DATA['use_remote_server']);?>,
  2478. valueField: 'sid',
  2479. displayField: 'snam',
  2480. listeners:{
  2481. select: function( t, r, i ){
  2482. doApplicationOperation( 10, i );
  2483. }
  2484. }
  2485. },{
  2486. xtype: 'spacer',
  2487. height: 10
  2488. },{
  2489. xtype: 'combo',
  2490. fieldLabel: "<?=$Labels->GetLabel('_SKIP_LOCAL_REPORTS_');?>",
  2491. editable: false,
  2492. typeAhead: true,
  2493. width: 300,
  2494. triggerAction: 'all',
  2495. lazyRender:true,
  2496. mode: 'local',
  2497. store: new Ext.data.ArrayStore({
  2498. fields: ['sid', 'snam'],
  2499. data: [[0,"<?=$Labels->GetLabel('__DISABLED__');?>"], [1,"<?=$Labels->GetLabel('___ENABLED__');?>"]]
  2500. }),
  2501. value: <?=intval($AP_DATA['skip_local_report']);?>,
  2502. valueField: 'sid',
  2503. displayField: 'snam',
  2504. listeners:{
  2505. select: function( t, r, i ){
  2506. doApplicationOperation( 11, i );
  2507. }
  2508. }
  2509. }]
  2510. },
  2511. <?php if( $AP_DATA['type']!=1){ ?>
  2512. {
  2513. title: "<?=$Labels->GetLabel('_GEO_LOCATION_');?>",
  2514. layout: 'column',
  2515. items:[{
  2516. columnWidth: 0.83,
  2517. frame: false,
  2518. border: false,
  2519. items: [{
  2520. //layout: 'fit',
  2521. //height: PanelH-150,
  2522. //flex: 1,
  2523. //border: true,
  2524. //items:{
  2525. xtype: 'panel',
  2526. id: 'sys_location_map',
  2527. height: PanelH-170,
  2528. html: '&nbsp;',
  2529. listeners:{
  2530. afterrender: function( t, state ){
  2531. loadLocationEditor('sys_location_map');
  2532. }
  2533. }
  2534. //}
  2535. },{
  2536. layout: 'table',
  2537. title: "<?=$Labels->GetLabel('_SITE_PROP_LBL_');?>",
  2538. flex: 1,
  2539. defaults: {
  2540. bodyStyle:'padding:20px'
  2541. },
  2542. layoutConfig: {
  2543. // The total column count must be specified here
  2544. columns: 8,
  2545. textAlign: 'center'
  2546. },
  2547. items:[{
  2548. border: false,
  2549. id: 'lab_123',
  2550. html: "<?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?> "+((MAP_IS_LOCAL)?'Pos X':"<?=$Labels->GetLabel('_LON_SHORT_LBL_');?>")+':'
  2551. },{
  2552. xtype: 'numberfield',
  2553. width: 100,
  2554. decimalPrecision: 8,
  2555. id: 'siteLon',
  2556. value: SiteLon
  2557. },{
  2558. border: false,
  2559. id: 'lab_124',
  2560. html: ((MAP_IS_LOCAL)?'Pos Y':"<?=$Labels->GetLabel('_LAT_SHORT_LBL_');?>")+':'
  2561. },{
  2562. xtype: 'numberfield',
  2563. id: 'siteLat',
  2564. decimalPrecision: 8,
  2565. width: 100,
  2566. value: SiteLat
  2567. },{
  2568. border: false,
  2569. html: "<?=$Labels->GetLabel('_ALT_SHORT_LBL_');?>:"
  2570. },{
  2571. xtype: 'numberfield',
  2572. decimalPrecision: 2,
  2573. width: 100,
  2574. id: 'siteAlt',
  2575. value: SiteAlt
  2576. },{
  2577. xtype: 'button',
  2578. text: "<?=$Labels->GetLabel('_UPDATE_LBL_');?>",
  2579. handler: updateSiteAnchor
  2580. },{
  2581. xtype: 'panel',
  2582. frame: false,
  2583. border: false,
  2584. rowspan: 2,
  2585. html: ((MAP_IS_LOCAL)?'<img id="lab_125" height="64px" src="/style/assets/map_mode_decart.png">':'<img id="lab_125" height="64px" src="/style/assets/map_mode_wgs84.png">')
  2586. },{
  2587. border: false,
  2588. html: "<?=$Labels->GetLabel('_MAP_TYP_LBL_');?>:"
  2589. },/*{
  2590. xtype: 'radio',
  2591. name: 'map_type',
  2592. boxLabel: '<?=$Labels->GetLabel('_MAP_REG_LBL_');?>',
  2593. checked: true,
  2594. value: 0
  2595. },{
  2596. xtype: 'radio',
  2597. name: 'map_type',
  2598. boxLabel: '<?=$Labels->GetLabel('_MAP_CUST_LBL_');?>',
  2599. colspan: 2,
  2600. value: 1
  2601. },*/{
  2602. xtype: 'combo',
  2603. disabled: false,
  2604. typeAhead: true,
  2605. triggerAction: 'all',
  2606. id: 'siteMap',
  2607. lazyRender:true,
  2608. colspan: 3,
  2609. mode: 'local',
  2610. store: mapListStore /*new Ext.data.ArrayStore({
  2611. id: 0,
  2612. fields: ['map_id', 'map_text' ],
  2613. data: [[1, 'OpenStreetMap'], [2, 'OpenTopoMap'], [3, 'EsriSat'], [4, 'EsriStreet'], [5, 'EsriTopo']]
  2614. })*/,
  2615. value: MAP_ID,
  2616. valueField: 'map_id',
  2617. displayField: 'map_name',
  2618. listeners:{
  2619. select: function(){
  2620. updateSiteMap();
  2621. LoadNodesList();
  2622. }
  2623. }
  2624. }/*,{
  2625. xtype: 'button',
  2626. disabled: false,
  2627. text: '<?=$Labels->GetLabel('_EDIT_');?>',
  2628. handler: function(){
  2629. editCurrentMap();
  2630. }
  2631. }*/,{
  2632. xtype: 'button',
  2633. disabled: false,
  2634. text: "<?=$Labels->GetLabel('_DELETE_');?>",
  2635. handler: function(){
  2636. deleteCurrentMap();
  2637. }
  2638. },{
  2639. xtype: 'button',
  2640. id: 'add-c_map-btn',
  2641. disabled: false,
  2642. text: "<?=$Labels->GetLabel('_CREATE_NEW_LBL_');?>",
  2643. handler: function(){
  2644. createNewMap();
  2645. }
  2646. }]
  2647. }]
  2648. },{
  2649. //title: 'Properties',
  2650. frame: true,
  2651. border: false,
  2652. xtype: 'panel',
  2653. flex: 1,
  2654. height: PanelH,
  2655. columnWidth: 0.17,
  2656. layout: 'fit',
  2657. id: 'prop_content',
  2658. items:[{
  2659. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  2660. }]
  2661. }]
  2662. },
  2663. <?php };?>{
  2664. title: "<?=$Labels->GetLabel('_BACKUP_SETTINGS_');?>",
  2665. xtype: 'form',
  2666. id: 'as_dbbackup',
  2667. fileUpload: true,
  2668. labelAlign: 'right',
  2669. labelWidth: 180,
  2670. height: PanelH - 30,
  2671. items:[{
  2672. xtype: 'spacer',
  2673. height: 10
  2674. },{
  2675. xtype: 'button',
  2676. text: "<?=$Labels->GetLabel( '_DOWNLOAD_SETTINGS_' );?>",
  2677. width: 500,
  2678. handler: downloadSettings
  2679. },{
  2680. xtype: 'spacer',
  2681. height: 10
  2682. },{
  2683. xtype: 'fileuploadfield',
  2684. id: 'db_file',
  2685. emptyText: "<?=$Labels->GetLabel('_DB_BACKUP_');?>",
  2686. fieldLabel: "<?=$Labels->GetLabel('_SELE_DBBACKUP_');?>",
  2687. width: 300,
  2688. name: 'db_file',
  2689. buttonText: "<?=$Labels->GetLabel('_BROWSE_');?>"
  2690. },{
  2691. xtype: 'spacer',
  2692. height: 10
  2693. },{
  2694. xtype: 'button',
  2695. text: "<?=$Labels->GetLabel( '_APLY_DBBACKUP_' );?>",
  2696. width: 500,
  2697. handler: function(){
  2698. if( Ext.getCmp('as_dbbackup').getForm().isValid()){
  2699. Ext.getCmp('as_dbbackup').getForm().submit({
  2700. url: '/lib/controller/doDatabaseOperation.php',
  2701. waitMsg: "<?=$Labels->GetLabel('_DB_UPLOAD_BACKUP_');?>...",
  2702. encoding: 'multipart/form-data',
  2703. success: function(fp, o){
  2704. }
  2705. });
  2706. };
  2707. }
  2708. },{
  2709. xtype: 'spacer',
  2710. height: 10
  2711. }<?php
  2712. if( file_exists( '../../controller/data/factory.db' ) ){
  2713. ?>,{
  2714. xtype: 'button',
  2715. text: "<?=$Labels->GetLabel( '_FACTORY_RESET_' );?>",
  2716. width: 500,
  2717. handler: function(){
  2718. doDeviceOperation( 1, 254, '', true );
  2719. }
  2720. }<?php
  2721. };
  2722. ?>]
  2723. },{
  2724. title: "<?=$Labels->GetLabel('_REPORT_STORAGE_');?>",
  2725. xtype: 'form',
  2726. id: 'as_reposit',
  2727. labelAlign: 'right',
  2728. labelWidth: 180,
  2729. height: PanelH - 30,
  2730. items:[{
  2731. xtype: 'spacer',
  2732. height: 10
  2733. },{
  2734. xtype: 'numberfield',
  2735. id: 'stor_days',
  2736. fieldLabel: "<?=$Labels->GetLabel('_STORE_DAYS_');?>",
  2737. width: 300,
  2738. value: <?=intval($AP_DATA['report_cleanup']);?>,
  2739. name: 'stor_time',
  2740. listeners: {
  2741. change: function( t, b, o ){
  2742. doApplicationOperation( 4, b );
  2743. }
  2744. }
  2745. },{
  2746. xtype: 'spacer',
  2747. height: 10
  2748. },{
  2749. xtype: 'slider',
  2750. id: 'stor_space',
  2751. fieldLabel: "<?=$Labels->GetLabel('_STORE_EMPTY_SPACE_');?>",
  2752. value: <?=intval($AP_DATA['preserve_empty']);?>,
  2753. width: 300,
  2754. name: 'stor_space',
  2755. listeners: {
  2756. change: function( t, b, o ){
  2757. doApplicationOperation( 5, b );
  2758. }
  2759. }
  2760. },{
  2761. xtype: 'spacer',
  2762. height: 10
  2763. },{
  2764. xtype: 'button',
  2765. text: "<?=$Labels->GetLabel( '_APPLY_SETTINGS_' );?>",
  2766. width: 500,
  2767. handler: function(){
  2768. doDeviceOperation( 1, 250, '', true );
  2769. }
  2770. },{
  2771. xtype: 'spacer',
  2772. height: 10
  2773. }]
  2774. }]
  2775. });
  2776. tPanel.doLayout();
  2777. updateUserContent();
  2778. };
  2779. function showSettingsUpgrade(){
  2780. stopStatusUpdater();
  2781. content_lvl1 = 1;
  2782. content_lvl2 = 4;
  2783. var tPanel = Ext.getCmp('main_content');
  2784. tPanel.removeAll( true );
  2785. initial_md5 = '';
  2786. tPanel.add({
  2787. columnWidth: 1.0,
  2788. frame: false,
  2789. border: false,
  2790. items: [{
  2791. frame: false,
  2792. border: false,
  2793. collapsible: false,
  2794. draggable: false,
  2795. layout: 'vbox',
  2796. //layoutConfig: {
  2797. // align : 'stretch',
  2798. // pack : 'start',
  2799. //},
  2800. height: PanelH,
  2801. items:[{
  2802. title: "<?=$Labels->getLabel('_MAP_MONITORING_');?>",
  2803. xtype: 'panel',
  2804. height: PanelH-300,
  2805. //flex: 1,
  2806. frame: true,
  2807. width: '100%',
  2808. border: false,
  2809. layout: {
  2810. type: 'table',
  2811. columns: 2,
  2812. tableAttrs: {
  2813. valign: 'top',
  2814. style: 'valign:top;width:100%;'
  2815. }
  2816. },
  2817. defaults: {
  2818. frame: true,
  2819. border: false,
  2820. height: ( PanelH-400 ) / 2,
  2821. style: 'margin: 5px;width:400px;display:block;'
  2822. },
  2823. items:[{
  2824. title: 'Current System Info',
  2825. width: '100%',
  2826. //flex: 1,
  2827. html: '<p>Current Web Version:&nbsp;<b><?=$ARGUS_WEB_VERSION;?></b></p>'
  2828. },{
  2829. title: 'Tasks',
  2830. //width: 400,
  2831. layout: 'vbox',
  2832. items:[{
  2833. xtype: 'button',
  2834. width: '100%',
  2835. text: 'Create Database Backup',
  2836. handler: function(){
  2837. createNewTask( 2 );
  2838. }
  2839. },{
  2840. xtype: 'button',
  2841. width: '100%',
  2842. text: 'Create Full Snapeshot',
  2843. handler: function(){
  2844. createNewTask( 255 );
  2845. }
  2846. }]
  2847. },{
  2848. title: 'Archives',
  2849. height: 250,
  2850. width: '100%',
  2851. tbar:[{
  2852. text: 'Restore',
  2853. id: 'ar_restore_btn',
  2854. handler: function(){
  2855. createNewTask(1, selectedArchiveRecord.data.file_name );
  2856. }
  2857. },{
  2858. text: 'Download',
  2859. id: 'ar_download_btn',
  2860. handler: function(){
  2861. if( selectedArchiveRecord!= null ){
  2862. window.open( '/lib/php/setup_toolkit/vault/'+selectedArchiveRecord.data.base_version + '/'+ selectedArchiveRecord.data.file_name );
  2863. };
  2864. }
  2865. },{
  2866. text: 'Delete',
  2867. id: 'ar_delete_btn',
  2868. handler: function(){
  2869. createNewTask(100, selectedArchiveRecord.data.file_name );
  2870. }
  2871. }],
  2872. items:[{
  2873. xtype: 'grid',
  2874. id: 'archives_grid',
  2875. border: false,
  2876. frame: false,
  2877. autoScroll: true,
  2878. //width: '100%',
  2879. lazyRender: true,
  2880. height: 210,
  2881. ds: archives_store,
  2882. cm: new Ext.grid.ColumnModel( archivesColModel_ops ),
  2883. sm: new Ext.grid.RowSelectionModel( archivesSelModel_ops ),
  2884. viewConfig: {
  2885. // forceFit: true
  2886. },
  2887. }]
  2888. },{
  2889. title: 'Task Status',
  2890. height: 250,
  2891. //flex: 1,
  2892. items:[{
  2893. xtype: 'spacer',
  2894. height: 4
  2895. },{
  2896. id: 'ctask_status',
  2897. border: true,
  2898. html: ''
  2899. },{
  2900. xtype: 'spacer',
  2901. height: 4
  2902. },{
  2903. xtype: 'textarea',
  2904. id: 'task_log',
  2905. height: ( PanelH-320 ) / 2 - 120,
  2906. style: 'font-size:9px;width:100%;margin-bottom:4px;',
  2907. readOnly: true,
  2908. autoScroll: true,
  2909. value: ''
  2910. },{
  2911. xtype: 'progress',
  2912. id: 'task_progress',
  2913. value: 1.0,
  2914. text: 'idle',
  2915. disabled: true
  2916. }],
  2917. tbar:[{
  2918. text: 'Cancel Task',
  2919. id: 'ch_ta_btn',
  2920. disabled: true,
  2921. handler: deleteNewTask
  2922. }]
  2923. }]
  2924. },{
  2925. title: '<?=$Labels->getLabel('_UPLOAD_PACKAGE_');?>',
  2926. xtype: 'panel',
  2927. height: 300,
  2928. //flex: 1,
  2929. frame: true,
  2930. border: false,
  2931. //layout: 'vbox',
  2932. items:[{
  2933. xtype:'button',
  2934. id: 'pickfiles',
  2935. width: '100%',
  2936. text: 'Choose File'
  2937. },{
  2938. height: 200,
  2939. xtype: 'grid',
  2940. id: 'upload_grid',
  2941. border: false,
  2942. frame: false,
  2943. mode: 'local',
  2944. lazyRender: true,
  2945. width: '100%',
  2946. autoScroll: true,
  2947. ds: uploads_store,
  2948. cm: new Ext.grid.ColumnModel( fileUploadsColModel_ops ),
  2949. sm: new Ext.grid.RowSelectionModel( fileUploadsSelModel_ops ),
  2950. viewConfig: {
  2951. forceFit: true
  2952. },
  2953. bbar: [{
  2954. text: 'Clear',
  2955. width: '100%',
  2956. handler: function(){
  2957. muploader.splice();
  2958. uploads_store.removeAll();
  2959. }
  2960. }]
  2961. },{
  2962. xtype:'button',
  2963. id: 'umpalumpa',
  2964. width: '100%',
  2965. disabled: true,
  2966. text: 'Upload',
  2967. handler: function(){
  2968. if( muploader!= null ){
  2969. muploader.start();
  2970. };
  2971. }
  2972. }],
  2973. listeners:{
  2974. afterrender: function(){
  2975. muploader = new plupload.Uploader({
  2976. runtimes : 'html5,html4',
  2977. browse_button : Ext.getDom('pickfiles'), // you can pass in id...
  2978. //container: document.getElementById('upupu'), // ... or DOM Element itself
  2979. max_file_size : '1000mb',
  2980. chunk_size: '200kb',
  2981. max_retries: 3,
  2982. multi_selection: false,
  2983. max_file_count: 1,
  2984. // Fake server response here
  2985. url: '/lib/php/setup_toolkit/upload.php',
  2986. //url: "/echo/json",
  2987. //flash_swf_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/flash/Moxie.cdn.swf',
  2988. //silverlight_xap_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/silverlight/Moxie.cdn.xap',
  2989. filters : [
  2990. //{title : "Image files", extensions : "jpg,gif,png"},
  2991. {title : "Archive files", extensions : "rar,zip,gz,bz2"}
  2992. ],
  2993. init: {
  2994. PostInit: function() {
  2995. //$('filelist').innerHTML = '';
  2996. //$('uploadfiles').onclick = function() {
  2997. // uploader.start();
  2998. // return false;
  2999. //};
  3000. },
  3001. FilesAdded: function( up, files ) {
  3002. Ext.getCmp('umpalumpa').enable();
  3003. plupload.each( files, function(file) {
  3004. uploads_store.loadData( [[ uploads_store_id, file.name, file.id, plupload.formatSize( file.size ), 0, 'N' ]], true );
  3005. uploads_store_id++;
  3006. Ext.getCmp('upload_grid').doLayout();
  3007. });
  3008. },
  3009. UploadProgress: function(up, file) {
  3010. var pb = Ext.getCmp( 'progress_'+file.id );
  3011. if( file.percent < 100 ){
  3012. pb.updateProgress( file.percent / 100, file.percent + '%', false );
  3013. } else {
  3014. pb.updateProgress( 1.0, 'Uploaded', false );
  3015. };
  3016. },
  3017. Error: function(up, err) {
  3018. Ext.Msg.show({
  3019. title:'Upload Status',
  3020. msg: "Error #" + err.code + ": " + err.message,
  3021. buttons: Ext.Msg.OK,
  3022. icon: Ext.MessageBox.ERROR
  3023. });
  3024. }
  3025. }
  3026. });
  3027. muploader.init();
  3028. }
  3029. }
  3030. }]
  3031. }]
  3032. });
  3033. muploader = null;
  3034. uploads_store.removeAll();
  3035. tPanel.doLayout();
  3036. archives_store.load();//{params:{start:0, limit:50, src: 'arch', fil: selecredActiveSourceFilter }});
  3037. updateTaskStatus();
  3038. tlInterval = window.setInterval( updateTaskStatus, 333 );
  3039. };
  3040. function loadSensorDetectionSettings( sensid ){
  3041. Ext.Ajax.request({
  3042. url: '/lib/controller/getSensorDetectionEditor.php',
  3043. params: {
  3044. UID: <?=$UserID;?>,
  3045. SID: '<?=$Session;?>',
  3046. SEN: sensid
  3047. },
  3048. success: function( response, opts ){
  3049. var data = Ext.decode( response.responseText );
  3050. var tComp = Ext.getCmp('main_content');
  3051. if( data.status == 'ok' ){
  3052. if( tComp!= null ){
  3053. var content = Ext.decode( data.content );
  3054. tComp.removeAll( true );
  3055. tComp.add( content );
  3056. tComp.doLayout();
  3057. };
  3058. } else {
  3059. if( tComp!= null ){
  3060. tComp.removeAll( true );
  3061. tComp.add( data );
  3062. tComp.doLayout();
  3063. };
  3064. };
  3065. },
  3066. failure: function(){
  3067. }
  3068. });
  3069. };
  3070. function initSettingsView(){
  3071. if( tlInterval!= null ){
  3072. window.clearInterval( tlInterval );
  3073. tlInterval = null;
  3074. timelineObj = null;
  3075. };
  3076. var tP = Ext.getCmp('left_side_menu');
  3077. //tP.doLayout();
  3078. //tP.setVisible( false );
  3079. tP.removeAll( true );
  3080. tP.add({
  3081. id: 'sme_inner',
  3082. layout:'accordion',
  3083. //height: PanelH,
  3084. frame: false,
  3085. border: false,
  3086. layoutConfig:{
  3087. animate: true//,
  3088. //activeOnTop: true
  3089. },
  3090. items:[]
  3091. });
  3092. tP.doLayout();
  3093. tP = Ext.getCmp('sme_inner');
  3094. <?php if( $CUser->Data['access'] > 3 ){ ?>
  3095. tP.add({
  3096. title: "<?=$Labels->GetLabel('_SYS_SETTINGS_');?>",
  3097. layout: 'vbox',
  3098. height: 120,
  3099. pack: 'center',
  3100. align : 'strech',
  3101. collapsed: ( content_lvl1 != 0 ),
  3102. items:[{
  3103. xtype: 'button',
  3104. width: '100%',
  3105. id:'sys_edit',
  3106. text: "<?=$Labels->GetLabel('_SYS_GENERAL_');?>",
  3107. enableToggle: true,
  3108. pressed: ( content_lvl2 == 0 && content_lvl1 == 0 ),
  3109. allowDepress: false,
  3110. toggleGroup: 'sys_settings',
  3111. handler: showSettingsGeneral
  3112. }
  3113. <?php if( $CUser->Data['access'] > 4 ){ ?>
  3114. ,{
  3115. xtype: 'button',
  3116. width: '100%',
  3117. id:'map_edit',
  3118. text: "<?=$Labels->GetLabel('_SENSOR_CONNECTION_');?>",
  3119. enableToggle: true,
  3120. pressed: ( content_lvl2 == 1 && content_lvl1 == 0 ),
  3121. allowDepress: false,
  3122. toggleGroup: 'sys_settings',
  3123. handler: showSettingsSensors
  3124. },{
  3125. xtype: 'button',
  3126. width: '100%',
  3127. id:'video_set',
  3128. text: "<?=$Labels->GetLabel('_CAMERA_MNGMNT_');?>",
  3129. enableToggle: true,
  3130. pressed: ( content_lvl2 == 2 && content_lvl1 == 0 ),
  3131. allowDepress: false,
  3132. toggleGroup: 'sys_settings',
  3133. handler: showSettingsVideo
  3134. },{
  3135. xtype: 'button',
  3136. width: '100%',
  3137. id:'app_set',
  3138. text: "<?=$Labels->GetLabel('_APPLICA_MNGMNT_');?>",
  3139. enableToggle: true,
  3140. pressed: ( content_lvl2 == 3 && content_lvl1 == 0 ),
  3141. allowDepress: false,
  3142. toggleGroup: 'sys_settings',
  3143. handler: showSettingsApplication
  3144. }
  3145. <?php }; ?>
  3146. ]
  3147. });
  3148. <?php if( $CUser->Data['access'] > 4 ){ ?>
  3149. tP.add({
  3150. title: "<?=$Labels->GetLabel('_DET_SETTINGS_');?>",
  3151. layout: 'vbox',
  3152. height: 120,
  3153. pack: 'center',
  3154. align : 'strech',
  3155. collapsed: ( content_lvl1 != 1 ),
  3156. items:[<?php
  3157. if( $AP_DATA['type'] == 1 ){
  3158. ?>
  3159. {
  3160. xtype: 'button',
  3161. width: '100%',
  3162. id:'go_home',
  3163. text: "<?=$Labels->GetLabel('_UPPER_SENSOR_');?>",
  3164. enableToggle: true,
  3165. pressed: ( content_lvl2 == 0 && content_lvl1 == 1 ),
  3166. allowDepress: false,
  3167. toggleGroup: 'det_settings',
  3168. handler: loadMetroControlUpper
  3169. },{
  3170. xtype: 'button',
  3171. width: '100%',
  3172. id:'go_monitor',
  3173. text: "<?=$Labels->GetLabel('_BOTTOM_SENSOR_');?>",
  3174. enableToggle: true,
  3175. pressed: ( content_lvl2 == 1 && content_lvl1 == 1 ),
  3176. allowDepress: false,
  3177. toggleGroup: 'det_settings',
  3178. handler: loadMetroControlBottom
  3179. },{
  3180. xtype: 'button',
  3181. width: '100%',
  3182. id:'go_archive',
  3183. text: "<?=$Labels->GetLabel('_FUSION_ENGINE_');?>",
  3184. enableToggle: true,
  3185. pressed: ( content_lvl2 == 2 && content_lvl1 == 1 ),
  3186. allowDepress: false,
  3187. toggleGroup: 'det_settings',
  3188. handler: loadMetroControlFusion
  3189. }<?php
  3190. } else {
  3191. $QS = "SELECT `name`, `aux_id` FROM `nodes` WHERE `type`>0 AND `type`<5";
  3192. $RR = $DATABASE->Query( $QS );
  3193. if( count( $RR ) ){
  3194. foreach( $RR as $CR ){
  3195. ?>
  3196. {
  3197. xtype: 'button',
  3198. width: '100%',
  3199. text: '<?=$CR['name'];?>',
  3200. enableToggle: true,
  3201. pressed: ( content_lvl2 == 0 && content_lvl1 == 1 ),
  3202. allowDepress: false,
  3203. toggleGroup: 'det_settings',
  3204. handler: function(){
  3205. loadSensorDetectionSettings( <?=$CR['aux_id'];?> );
  3206. }
  3207. },
  3208. <?php
  3209. };
  3210. } else {
  3211. ?>
  3212. {
  3213. xtype: 'spacer',
  3214. html: "<?=$Labels->GetLabel('_NO_SENSORS_DEF_');?>",
  3215. height: 32
  3216. },
  3217. <?php
  3218. };
  3219. ?>
  3220. {
  3221. xtype: 'spacer',
  3222. height: 10
  3223. }<?php
  3224. };
  3225. ?>]
  3226. });
  3227. <?php };
  3228. }; ?>
  3229. tP.add({
  3230. title: "<?=$Labels->GetLabel('_PROF_SETTINGS_');?>",
  3231. items:[<?php
  3232. $ZIGA = array();
  3233. foreach( $Site_Languages as $SL ){
  3234. if( $SL['id'] == $CUser->Data['language'] ){
  3235. $ZIGA[] = "{ xtype:'button', text:'{$SL['name']}', width: '100%', enableToggle: true, pressed : true, handler: function(){ window.location = '/?Lang={$SL['id']}'; } }";
  3236. } else {
  3237. $ZIGA[] = "{ xtype:'button', text:'{$SL['name']}', width: '100%', handler: function(){ window.location = '/?Lang={$SL['id']}'; } }";
  3238. };
  3239. };
  3240. echo implode(',',$ZIGA );
  3241. ?>]
  3242. });
  3243. <?php if( $CUser->Data['access'] > 5 ){ ?>
  3244. tP.add({
  3245. title: "<?=$Labels->GetLabel('_ADM_SETTINGS_');?>",
  3246. collapsed: ( content_lvl1 != 3 ),
  3247. items:[{
  3248. xtype: 'button',
  3249. width: '100%',
  3250. id:'adm_acc',
  3251. text: "<?=$Labels->GetLabel('_USERS_MNGMT_');?>",
  3252. enableToggle: true,
  3253. pressed: ( content_lvl2 == 0 && content_lvl1 == 3 ),
  3254. allowDepress: false,
  3255. toggleGroup: 'adm_settings',
  3256. handler: function( b, e ){
  3257. loadUserEditor();
  3258. }
  3259. },{
  3260. xtype: 'button',
  3261. width: '100%',
  3262. id:'adm_acclog',
  3263. text: "<?=$Labels->GetLabel('_ACC_LOG_');?>",
  3264. enableToggle: true,
  3265. pressed: ( content_lvl2 == 1 && content_lvl1 == 3 ),
  3266. allowDepress: false,
  3267. toggleGroup: 'adm_settings',
  3268. handler: function( b, e ){
  3269. loadAccessLog();
  3270. }
  3271. },{
  3272. xtype: 'button',
  3273. width: '100%',
  3274. id:'adm_servlog',
  3275. text: "<?=$Labels->GetLabel('_SERV_LOG_');?>",
  3276. enableToggle: true,
  3277. pressed: ( content_lvl2 == 2 && content_lvl1 == 3 ),
  3278. allowDepress: false,
  3279. toggleGroup: 'adm_settings',
  3280. handler: function( b, e ){
  3281. loadServerLog();
  3282. }
  3283. }]
  3284. });
  3285. <?php
  3286. };
  3287. ?>
  3288. tP.setVisible( true );
  3289. tP.doLayout();
  3290. switch( content_lvl1 ){
  3291. default:{
  3292. switch( content_lvl2 ){
  3293. default: showSettingsGeneral(); break;
  3294. <?php if( $CUser->Data['access'] > 5 ){ ?>
  3295. case 1: showSettingsSensors(); break;
  3296. case 2: showSettingsVideo(); break;
  3297. case 3: showSettingsApplication(); break;
  3298. <?php }; ?>
  3299. //case 4: showSettingsUpgrade(); break;
  3300. };
  3301. };
  3302. case 1:{
  3303. switch( content_lvl2 ){
  3304. case 0: break;
  3305. };
  3306. break;
  3307. };
  3308. <?php if( $CUser->Data['access'] > 5 ){ ?>
  3309. case 3:{
  3310. switch( content_lvl2 ){
  3311. case 0: loadUserEditor(); break;
  3312. };
  3313. break;
  3314. };
  3315. <?php }; ?>
  3316. };
  3317. };
  3318. function zdonut(cx, cy, radius, data) {
  3319. function arcradius(cx, cy, radius, degrees) {
  3320. var radians = (degrees - 90) * Math.PI / 180.0;
  3321. return { x: cx + (radius * Math.cos(radians)), y: cy + (radius * Math.sin(radians)) };
  3322. }
  3323. var decimals = 4;
  3324. var total = 0;
  3325. var arr = [];
  3326. var beg = 0;
  3327. var end = 0;
  3328. var count = 0;
  3329. var half = radius / 2;
  3330. var midpoint = radius / 2.4;
  3331. for( var i = 0; i < data.length; i++) total += data[i].value;
  3332. for( var i = 0; i < data.length; i++) {
  3333. var item = data[i];
  3334. var tmp = {};
  3335. //var p = Math.floor((((item.value + 1) / total) * 100), decimals );
  3336. var p = (( item.value / total ) * 100.0 );
  3337. count += p;
  3338. if( i === length - 1 && count < 100 ) p = p + (100 - count);
  3339. end = beg + ((360 / 100) * p);
  3340. tmp.index = i;
  3341. tmp.value = item.value;
  3342. tmp.data = item;
  3343. var b = arcradius(cx, cy, radius, end);
  3344. var e = arcradius(cx, cy, radius, beg);
  3345. var la = (end - beg) <= 180 ? 0 : 1;
  3346. tmp.d = ['M', Math.floor( b.x, decimals ), Math.floor( b.y, decimals ), 'A', radius, radius, 0, la, 0, Math.floor( e.x, decimals ), Math.floor( e.y, decimals ) ].join(' ');
  3347. arr.push(tmp);
  3348. beg = end;
  3349. };
  3350. return arr;
  3351. };
  3352. var selectedPresetsBackgroundSensor = 0;
  3353. function altPTZCmd( me ){
  3354. var name = me.target.id;
  3355. const myArray = name.split("_");
  3356. Ext.Ajax.request({
  3357. url: '/lib/controller/doCameraOperation.php',
  3358. params: {
  3359. UID: <?=$UserID;?>,
  3360. SID: '<?=$Session;?>',
  3361. CMD: 11,
  3362. CID: myArray[3],
  3363. MOV: myArray[2]
  3364. },
  3365. failure: failureAJAXFunction
  3366. });
  3367. };
  3368. function showCameraPresets( AA, camID ){
  3369. Ext.Ajax.request({
  3370. url: '/lib/controller/getCameraPresets.php',
  3371. params: {
  3372. CID: camID,
  3373. UID: <?=$UserID;?>,
  3374. SID: '<?=$Session;?>',
  3375. },
  3376. success: function( response, opts ){
  3377. var data = Ext.decode(response.responseText);
  3378. var hgy = Ext.getCmp('pres_count');
  3379. if( hgy!= undefined ) hgy.setValue( data.count );
  3380. var hgy = Ext.getCmp('pres_p_seg');
  3381. if( hgy!= undefined ) hgy.setValue( data.pres_cols );
  3382. var hgy = Ext.getCmp('pres_z_seg');
  3383. if( hgy!= undefined ) hgy.setValue( data.pres_rows );
  3384. if( data.special_iron != undefined ){
  3385. var hgy = Ext.getCmp('pres_iron');
  3386. if( hgy!= undefined ) hgy.setValue( data.special_iron );
  3387. var juja = document.getElementById('img_btn_035_'+camID );
  3388. if( juja != undefined ){
  3389. juja.classList.add('ptz_ctrl_btn');
  3390. juja.classList.remove('ptz_ctrl_btn_hdn');
  3391. juja.addEventListener( 'mousedown', altPTZCmd );
  3392. };
  3393. } else {
  3394. var juja = document.getElementById('img_btn_035_'+camID );
  3395. if( juja != undefined ){
  3396. juja.classList.add('ptz_ctrl_btn_hdn');
  3397. juja.classList.remove('ptz_ctrl_btn');
  3398. juja.removeEventListener( 'mousedown', altPTZCmd );
  3399. };
  3400. };
  3401. if( data.special_iroff != undefined ){
  3402. var hgy = Ext.getCmp('pres_iroff');
  3403. if( hgy!= undefined ) hgy.setValue( data.special_iroff );
  3404. var juja = document.getElementById('img_btn_036_'+camID );
  3405. if( juja != undefined ){
  3406. juja.classList.add('ptz_ctrl_btn');
  3407. juja.classList.remove('ptz_ctrl_btn_hdn');
  3408. juja.addEventListener( 'mousedown', altPTZCmd );
  3409. };
  3410. } else {
  3411. var juja = document.getElementById('img_btn_036_'+camID );
  3412. if( juja != undefined ){
  3413. juja.classList.add('ptz_ctrl_btn_hdn');
  3414. juja.classList.remove('ptz_ctrl_btn');
  3415. juja.removeEventListener( 'mousedown', altPTZCmd );
  3416. };
  3417. };
  3418. if( data.special_irauto != undefined ){
  3419. var hgy = Ext.getCmp('pres_irauto');
  3420. if( hgy!= undefined ) hgy.setValue( data.special_irauto );
  3421. };
  3422. if( data.special_wiper != undefined ){
  3423. var hgy = Ext.getCmp('pres_wiper');
  3424. if( hgy!= undefined ) hgy.setValue( data.special_wiper );
  3425. var juja = document.getElementById('img_btn_037_'+camID );
  3426. if( juja != undefined ){
  3427. juja.classList.add('ptz_ctrl_btn');
  3428. juja.classList.remove('ptz_ctrl_btn_hdn');
  3429. juja.addEventListener( 'mousedown', altPTZCmd );
  3430. };
  3431. } else {
  3432. var juja = document.getElementById('img_btn_037_'+camID );
  3433. if( juja != undefined ){
  3434. juja.classList.add('ptz_ctrl_btn_hdn');
  3435. juja.classList.remove('ptz_ctrl_btn');
  3436. juja.removeEventListener( 'mousedown', altPTZCmd );
  3437. };
  3438. };
  3439. var svg = document.getElementById( AA );
  3440. svg.innerHTML = "";
  3441. var centerX = svg.clientWidth / 2.0;
  3442. var centerY = svg.clientHeight / 2.0;
  3443. var radius = svg.clientHeight / 2.0 - (data.pres_rows*2.0);
  3444. var color = ['#F6BB42', '#8CC152', '#3BAFDA', '#967ADC', '#DA4453'];
  3445. var max_lines = data.pres_rows;
  3446. for( var cl = max_lines; cl > 0; cl--){
  3447. var segnum = data.pres_cols * Math.pow( 2, ( cl-1 ) );
  3448. var dta = [];
  3449. for( var j = 0; j< segnum; j++) dta[j]={ value: (180/segnum) };
  3450. var crad = cl * ( radius/(max_lines+1));
  3451. var arr = zdonut(centerX, centerY, crad, dta );
  3452. for (var i = 0; i < arr.length; i++) {
  3453. var item = arr[i];
  3454. var tP = document.createElementNS( 'http://www.w3.org/2000/svg', 'path' );
  3455. tP.setAttribute( 'd', item.d );
  3456. var test = false;
  3457. var ll = [];
  3458. if( data.presets.length ){
  3459. for( var z = 0; z < data.presets.length; z++)
  3460. if( data.presets[z].row == cl && data.presets[z].column == i ){
  3461. ll = data.presets[z];
  3462. test = true;
  3463. break;
  3464. };
  3465. };
  3466. if( test ){
  3467. tP.setAttribute( 'stroke', '#000000' );
  3468. tP.setAttribute( 'class', 'preset_ctrl_btn_a' );
  3469. tP.setAttribute( 'onclick', 'triggerPreset('+camID+','+ll.id+')' );
  3470. tP.setAttribute( 'oncontextmenu', 'removePreset('+camID+','+ll.id+')' );
  3471. } else {
  3472. tP.setAttribute( 'stroke', color[(i+cl)%5] );
  3473. tP.setAttribute( 'class', 'preset_ctrl_btn' );
  3474. tP.setAttribute( 'ondblclick', 'setPreset('+camID+','+i+','+cl+')' );
  3475. };
  3476. tP.setAttribute( 'fill', 'none' );
  3477. tP.setAttribute( 'stroke-width', ( radius/(max_lines+1)) );
  3478. svg.appendChild( tP );
  3479. }
  3480. };
  3481. if( selectedPresetsBackgroundSensor ) preview2DDraw( selectedPresetsBackgroundSensor, 'ptz_presets_');
  3482. },
  3483. failure: failureAJAXFunction
  3484. });
  3485. };
  3486. function triggerPreset( camID, presetID ){
  3487. //alert( "Call Preset["+presetID+"] for camera["+camID+"]" );
  3488. doCamOperation( camID, 30, presetID );
  3489. return false;
  3490. };
  3491. function removePreset( camID, presetID ){
  3492. //alert( "Remove Preset["+presetID+"] for camera["+camID+"]" );
  3493. doCamOperation( camID, 29, presetID );
  3494. window.setTimeout( "showCameraPresets( 'ptz_presets_0', "+camID+" );", 500 );
  3495. return false;
  3496. };
  3497. function setPreset( camID, colID, rowID ){
  3498. //alert( "Set new Preset for camera["+camID+"] x:"+colID+" y:"+rowID );
  3499. doCamOperation( camID, 28, colID+"_"+rowID );
  3500. window.setTimeout( "showCameraPresets( 'ptz_presets_0', "+camID+" );", 500 );
  3501. return false;
  3502. };