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.

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