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.

3404 lines
95 KiB

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