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.

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