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.

3191 lines
87 KiB

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