Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3198 lines
87 KiB

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