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.

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