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.

3044 lines
83 KiB

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