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.

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