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.

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