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.

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