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.

3458 lines
96 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
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
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();//vermont 202 westlake
  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 addDetACamDialog = null;
  1443. var addDetCamWM = null;
  1444. function addDetectedAnalogCam(){
  1445. if( addDetACamDialog == null ){
  1446. addDetACamDialog = new Ext.Window({
  1447. modal: true,
  1448. title: '<?=$Labels->GetLabel('_ANAL_SOURCES_LST_');?>',
  1449. width: 800,
  1450. height: 600,
  1451. layout: 'fit',
  1452. closeAction: 'hide',
  1453. items:[{
  1454. xtype: 'grid',
  1455. frame: false,
  1456. border: false,
  1457. ds: cameraListStore,
  1458. cm: AnalogCameraListColModel,
  1459. sm: AnalogCameraListSelModel,
  1460. viewConfig: {
  1461. forceFit: true
  1462. }
  1463. }],
  1464. bbar: [{
  1465. text: '<?=$Labels->GetLabel('_CANCEL_');?>',
  1466. handler: function(){
  1467. addDetACamDialog.hide();
  1468. }
  1469. },'->',{
  1470. id: 'cha_an_strim_set',
  1471. text: '<?=$Labels->GetLabel('_SETTINGS_');?>',
  1472. disabled: ( SelectedSource == 0 ),
  1473. handler: function(){
  1474. editAnalogStream( SelectedSource );
  1475. }
  1476. },{
  1477. id: 'con_to_anal_src',
  1478. text: '<?=$Labels->GetLabel('_CONNECT_2_SEL_');?>',
  1479. disabled: ( SelectedSource == 0 ),
  1480. handler: function(){
  1481. //alert( 'Cam Type:'+SelectedCamTYPE );
  1482. showAnalCamPropDialog();
  1483. }
  1484. }]
  1485. });
  1486. };
  1487. addDetACamDialog.show();
  1488. cameraListStore.load({params:{cam_sources:'anal'}});
  1489. };
  1490. function addDetectedIPCam(){
  1491. if( addDetCamDialog == null ){
  1492. addDetCamDialog = new Ext.Window({
  1493. modal: true,
  1494. title: "<?=$Labels->GetLabel('_ADD_CAM_DIAL_TTL_');?>",
  1495. width: 400,
  1496. height: 187,
  1497. layout: 'form',
  1498. closeAction: 'hide',
  1499. labelWidth: 160,
  1500. labelAlign: 'right',
  1501. items:[{
  1502. xtype: 'spacer',
  1503. height: 8
  1504. },{
  1505. xtype: 'textfield',
  1506. id: 'ncam_ip',
  1507. fieldLabel: "<?=$Labels->GetLabel('_CAM_IP_ADDRESS_');?>",
  1508. value: ''
  1509. },{
  1510. xtype: 'textfield',
  1511. id: 'ncam_user',
  1512. fieldLabel: "<?=$Labels->GetLabel('_ACCESS_LOGIN_');?>",
  1513. value: ''
  1514. },{
  1515. xtype: 'textfield',
  1516. id: 'ncam_pwd',
  1517. inputType: 'password',
  1518. fieldLabel: "<?=$Labels->GetLabel('_ACCESS_PASSWORD_');?>",
  1519. value: ''
  1520. },{
  1521. xtype: 'combo',
  1522. id: 'ncam_auth_mode',
  1523. fieldLabel: "<?=$Labels->GetLabel('_AUTH_MODE_0_');?>",
  1524. lazyRender: true,
  1525. mode: 'local',
  1526. forceSelection: true,
  1527. triggerAction: 'all',
  1528. editable: false,
  1529. disableKeyFilter: true,
  1530. store: new Ext.data.ArrayStore({
  1531. fields: ['mode','mode_txt'],
  1532. data: [
  1533. [0,'BASIC'],
  1534. [1,'DIGEST'],
  1535. [2,'DIGEST_IE'],
  1536. [3,'BEARER'],
  1537. [4,'NEGOTIATE'],
  1538. [5,'NTLM'],
  1539. [6,'NTLM_WB'],
  1540. [7,'ANY'],
  1541. [8,'ANYSAFE'],
  1542. [9,'ONLY'],
  1543. [10,'AWS_SIGV4']
  1544. ]
  1545. }),
  1546. valueField: 'mode',
  1547. displayField: 'mode_txt',
  1548. value: 0,
  1549. width: 200
  1550. },{
  1551. xtype: 'spacer',
  1552. height: 8
  1553. },{
  1554. xtype:'button',
  1555. width: '100%',
  1556. text: 'Add Camera to List',
  1557. handler: function(){
  1558. addDetCamWM = new Ext.LoadMask( addDetCamDialog.getEl(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."});
  1559. addDetCamWM.show();
  1560. var NIP = Ext.getCmp('ncam_ip').getValue();
  1561. var NUU = Ext.getCmp('ncam_user').getValue();
  1562. var NPP = Ext.getCmp('ncam_pwd').getValue();
  1563. var NAM = Ext.getCmp('ncam_auth_mode').getValue();
  1564. Ext.Ajax.request({
  1565. url: '/lib/controller/doCameraOperation.php',
  1566. params: {
  1567. UID: <?=$UserID;?>,
  1568. SID: '<?=$Session;?>',
  1569. IP: NIP,
  1570. UU: NUU,
  1571. PP: NPP,
  1572. AU: NAM,
  1573. CMD: 3
  1574. },
  1575. success: function( response, opts ){
  1576. addDetCamWM.hide();
  1577. var data = Ext.decode(response.responseText);
  1578. if( data.status == 'ok' ){
  1579. loadDetectedCameras();
  1580. } else {
  1581. Ext.Msg.show({
  1582. title:'Error!',
  1583. msg: data.msg,
  1584. buttons: Ext.Msg.OK,
  1585. icon: Ext.MessageBox.WARNING
  1586. });
  1587. };
  1588. addDetCamDialog.hide();
  1589. },
  1590. failure: failureAJAXFunction
  1591. });
  1592. }
  1593. }]
  1594. });
  1595. };
  1596. addDetCamDialog.show();
  1597. };
  1598. var devUploadTimeout = null;
  1599. var devUploadID = -1;
  1600. function fetchDeviceUploadStatus(){
  1601. clearTimeout( devUploadTimeout );
  1602. if( devUploadID < 1 ) return;
  1603. Ext.Ajax.request({
  1604. url: '/lib/controller/getDeviceUploadStatus.php',
  1605. params: {
  1606. UID: <?=$UserID;?>,
  1607. SID: '<?=$Session;?>',
  1608. DID: devUploadID
  1609. },
  1610. success: function( response, opts ){
  1611. var data = Ext.decode(response.responseText);
  1612. var tT = Ext.getCmp('upp_ttext');
  1613. if( tT != undefined ){
  1614. if( data.count > 0 ){
  1615. devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 );
  1616. };
  1617. if( data.current != undefined ){
  1618. tT.update('<p class="UPTTEXT">Uploading '+data.count+' file(s)</p>');
  1619. document.getElementById('upp_ctext').innerHTML ='<p class="UPCTEXT">Current File: '+data.current+'</p>';
  1620. Ext.getCmp('upp_pbar').updateProgress( data.progress, Math.round( data.progress*100 )+'%', true );
  1621. devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 );
  1622. } else {
  1623. Ext.getCmp('upload_progres_panel').hide();
  1624. Ext.getCmp('uploaded_grid').show();
  1625. loadModuleFiles( devUploadID );
  1626. };
  1627. };
  1628. },
  1629. failure: failureAJAXFunction
  1630. });
  1631. };
  1632. function downloadSettings(){
  1633. ReportMask = new Ext.LoadMask(Ext.getBody(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."});
  1634. ReportMask.show();
  1635. const formData = new FormData();
  1636. formData.append("UID",<?=$UserID;?>);
  1637. formData.append("SID",'<?=$Session;?>');
  1638. fetch('/lib/controller/downloadSettings.php',{
  1639. method: "POST",
  1640. body: formData
  1641. })
  1642. .then(resp => resp.blob())
  1643. .then(blob => {
  1644. const url = window.URL.createObjectURL(blob);
  1645. const a = document.createElement('a');
  1646. a.style.display = 'none';
  1647. a.href = url;
  1648. var today=new Date();
  1649. var SY=1900+today.getYear();
  1650. var SMO=today.getMonth()+1;
  1651. var SD=today.getDate();
  1652. var SH = today.getHours();
  1653. var SM = today.getMinutes();
  1654. var SS = today.getSeconds();
  1655. a.download = 'backup_'+SY+'.'+SMO+'.'+SD+'_'+SH+'-'+SM+'-'+SS+'.db';
  1656. document.body.appendChild(a);
  1657. a.click();
  1658. window.URL.revokeObjectURL(url);
  1659. ReportMask.hide();
  1660. Ext.Msg.show({
  1661. title:'<?=$Labels->GetLabel('_SUCCESS_');?>',
  1662. msg: '<?=$Labels->GetLabel('_DB_FILE_HAS_DOWNLOADED_');?>',
  1663. buttons: Ext.Msg.OK,
  1664. icon: Ext.MessageBox.INFO
  1665. });
  1666. })
  1667. .catch(() => {
  1668. ReportMask.hide();
  1669. Ext.Msg.show({
  1670. title:'<?=$Labels->GetLabel('_REQ_FAILURE_');?>',
  1671. msg: '<?=$Labels->GetLabel('_AJX_REQFAILURE_');?>',
  1672. buttons: Ext.Msg.OK,
  1673. icon: Ext.MessageBox.ERROR
  1674. });
  1675. });
  1676. };
  1677. function showSettingsGeneral(){
  1678. stopStatusUpdater();
  1679. content_lvl1 = 1;
  1680. content_lvl2 = 0;
  1681. var tPanel = Ext.getCmp('main_content');
  1682. tPanel.removeAll( true );
  1683. <?php
  1684. //$QS="SELECT * FROM `servers` WHERE `id`=1";
  1685. //$SDD = $DATABASE->Query( $QS );
  1686. //$NData = $SDD[0];
  1687. $QS="SELECT * FROM `resources` WHERE `node_id`=1 AND ( `type`=101 OR `type`=102 )";
  1688. $CN = $DATABASE->Query( $QS );
  1689. $IL=array();
  1690. foreach( $CN as $N ){
  1691. $QS="SELECT * FROM `networks` WHERE `nif_id`={$N['aux_id']} AND `type`=0";
  1692. $NWD = $DATABASE->Query( $QS );
  1693. $NW = $NWD[0];
  1694. $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>";
  1695. };
  1696. $NIFO = '<table><tr>' . implode( '</tr><tr>', $IL ) . '</tr></table>';
  1697. ?>
  1698. tPanel.add({
  1699. xtype: 'tabpanel',
  1700. frame: false,
  1701. id: 'node_settings_content',
  1702. border: false,
  1703. activeTab: content_lvl3,
  1704. items: [{
  1705. xtype: 'panel',
  1706. id: 'gi_tab',
  1707. title: "<?=$Labels->GetLabel( '_GENERAL_NFO_' );?>",
  1708. layout: 'hbox',
  1709. items:[{
  1710. xtype: 'panel',
  1711. flex: 1,
  1712. height: PanelH-15,
  1713. autoScroll: false,
  1714. html: '<table width="100%" height="100%" border=0><tr><td height="290px" align="center" valign="middle"><div class="server_img_set"></div></td></tr>\
  1715. <tr><td height="100px"><table width="100%" border=0><tr>\
  1716. <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>\
  1717. <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>\
  1718. <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>\
  1719. <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>\
  1720. </tr></table></td></tr>\
  1721. <tr><td valign="top"><div class="setEd_infoPanel" id="INFO_SPS">\
  1722. <div class="sideInfo_item" id="SW_INFO"><?=$AP_DATA['build'];?></div>\
  1723. <div class="sideInfo_item" id="OS_INFO"><?=$AP_DATA['os_info'];?></div>\
  1724. <div class="sideInfo_item" id="HW_INFO"><?=$AP_DATA['hw_info'];?></div>\
  1725. </div></td></tr>\
  1726. <tr><td height="60%">&nbsp;</td></tr></table>'
  1727. },{
  1728. xtype: 'panel',
  1729. id: '_ed_small',
  1730. flex: 1,
  1731. height: PanelH-15,
  1732. autoScroll: false,
  1733. items:[
  1734. <?php if( $CUser->Data['access'] > 3 ){ ?>
  1735. {
  1736. xtype: 'panel',
  1737. baseCls:'servopInfo_item00',
  1738. id: 'servopPanel01',
  1739. items:[{
  1740. xtype: 'panel',
  1741. frame: false,
  1742. border: false,
  1743. unstyled: true,
  1744. html: "<p><?=$Labels->GetLabel('_SERV_RESTART_DESC_');?></p><br/>"
  1745. },{
  1746. xtype: 'button',
  1747. lazyRender: true,
  1748. iconCls: 'srv_op_restart',
  1749. text: "<?=$Labels->GetLabel('_SERV_RESTART_OP_');?>",
  1750. id: 'tbtn_sop01',
  1751. scale: 'large',
  1752. width: '95%',
  1753. disabled: true,
  1754. handler: function( bt ){
  1755. Ext.Msg.show({
  1756. title:"<?=$Labels->GetLabel('_SERV_RESTART_QT_');?>",
  1757. msg: "<?=$Labels->GetLabel('_SERV_RESTART_QM_');?>",
  1758. buttons: Ext.Msg.YESNO,
  1759. width: 400,
  1760. icon: Ext.MessageBox.INFO,
  1761. fn: function(btn, text){
  1762. if( btn == 'yes' ){
  1763. disableServOps();
  1764. doDeviceOperation( 1, 250,'', true );
  1765. };
  1766. }
  1767. });
  1768. }
  1769. }]
  1770. },{
  1771. xtype: 'spacer',
  1772. height: 8
  1773. }
  1774. <?php if( $CUser->Data['access'] > 4 ){ ?>
  1775. ,{
  1776. xtype: 'panel',
  1777. baseCls:'servopInfo_item10',
  1778. id: 'servopPanel02',
  1779. items:[{
  1780. xtype: 'panel',
  1781. frame: false,
  1782. border: false,
  1783. unstyled: true,
  1784. html: "<p><?=$Labels->GetLabel('_SERV_HW_DET_DESC_');?></p><br/>"
  1785. },{
  1786. xtype: 'button',
  1787. iconCls: 'srv_op_hw_init',
  1788. text: "<?=$Labels->GetLabel('_SERV_HW_DET_OP_');?>",
  1789. id: 'tbtn_sop02',
  1790. scale: 'large',
  1791. width: '95%',
  1792. disabled: true,
  1793. handler: function( bt ){
  1794. Ext.Msg.show({
  1795. title:"<?=$Labels->GetLabel('_SERV_HW_DET_QT_');?>",
  1796. msg: "<?=$Labels->GetLabel('_SERV_HW_DET_QM_');?>",
  1797. buttons: Ext.Msg.YESNO,
  1798. width: 400,
  1799. icon: Ext.MessageBox.INFO,
  1800. fn: function(btn, text){
  1801. if( btn == 'yes' ){
  1802. disableServOps();
  1803. doDeviceOperation( 1, 251,'', true );
  1804. };
  1805. }
  1806. });
  1807. }
  1808. }]
  1809. },{
  1810. xtype: 'spacer',
  1811. height: 8
  1812. }
  1813. <?php if( $CUser->Data['access'] > 5 ){ ?>
  1814. ,{
  1815. xtype: 'panel',
  1816. baseCls:'servopInfo_item20',
  1817. id: 'servopPanel03',
  1818. items:[{
  1819. xtype: 'panel',
  1820. frame: false,
  1821. border: false,
  1822. unstyled: true,
  1823. html: "<p><?=$Labels->GetLabel('_SERV_OSRESET_DESC_');?></p><br/>"
  1824. },{
  1825. xtype: 'button',
  1826. iconCls: 'srv_op_power_cycle',
  1827. text: "<?=$Labels->GetLabel('_SERV_OSRESET_OP_');?>",
  1828. id: 'tbtn_sop03',
  1829. scale: 'large',
  1830. width: '95%',
  1831. disabled: true,
  1832. handler: function( bt ){
  1833. Ext.Msg.show({
  1834. title: "<?=$Labels->GetLabel('_SERV_OSRESET_QT_');?>",
  1835. msg: "<?=$Labels->GetLabel('_SERV_OSRESET_QM_');?>",
  1836. buttons: Ext.Msg.YESNO,
  1837. width: 400,
  1838. icon: Ext.MessageBox.WARNING,
  1839. fn: function(btn, text){
  1840. if( btn == 'yes' ){
  1841. cleanupChangeNotifier();
  1842. } else {
  1843. loadEditor = false;
  1844. };
  1845. }
  1846. });
  1847. }
  1848. }]
  1849. },{
  1850. xtype: 'spacer',
  1851. height: 8
  1852. },{
  1853. xtype: 'panel',
  1854. baseCls:'servopInfo_item30',
  1855. id: 'servopPanel04',
  1856. items:[{
  1857. xtype: 'panel',
  1858. frame: false,
  1859. border: false,
  1860. unstyled: true,
  1861. html: "<p><?=$Labels->GetLabel('_SERV_FACTORY_DESC_');?></p><br/>"
  1862. },{
  1863. xtype: 'button',
  1864. iconCls: 'srv_op_factory_reset',
  1865. text: "<?=$Labels->GetLabel('_SERV_FACTORY_OP_');?>",
  1866. id: 'tbtn_sop04',
  1867. scale: 'large',
  1868. width: '95%',
  1869. disabled: true,
  1870. handler: function( bt ){
  1871. Ext.Msg.show({
  1872. title: "<?=$Labels->GetLabel('_SERV_FACTORY_QT_');?>",
  1873. msg: "<?=$Labels->GetLabel('_SERV_FACTORY_QM_');?>",
  1874. buttons: Ext.Msg.YESNO,
  1875. width: 400,
  1876. icon: Ext.MessageBox.ERROR,
  1877. fn: function(btn, text){
  1878. if( btn == 'yes' ){
  1879. disableServOps();
  1880. doDeviceOperation( 1, 254,'', true );
  1881. };
  1882. }
  1883. });
  1884. }
  1885. }]
  1886. }
  1887. <?php
  1888. };
  1889. };
  1890. }; ?>
  1891. ]
  1892. }]
  1893. }
  1894. <?php if( $CUser->Data['access'] > 4 ){ ?>
  1895. ,{
  1896. xtype: 'panel',
  1897. title: "<?=$Labels->GetLabel( '_RESOURCES_' );?>",
  1898. id: 'res_tab',
  1899. layout: 'hbox',
  1900. items:[{
  1901. xtype: 'panel',
  1902. id: 'resources_container',
  1903. flex: 1,
  1904. height: PanelH-15,
  1905. autoScroll: 'auto',
  1906. tbar:[{
  1907. text: "<?=$Labels->GetLabel( '_ADD_REMOTE_UART_' );?>",
  1908. handler: function(){
  1909. addEthernet2Uart();
  1910. }
  1911. }],
  1912. items:[]
  1913. },{
  1914. xtype: 'panel',
  1915. id: 'res_ed_small',
  1916. flex: 1,
  1917. height: PanelH-15,
  1918. layout: 'fit',
  1919. items:[{
  1920. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1921. }]
  1922. }]
  1923. },{
  1924. xtype: 'panel',
  1925. title: "<?=$Labels->GetLabel( '_SERVER_MODULES_' );?>",
  1926. id: 'mod_tab',
  1927. layout: 'hbox',
  1928. items:[{
  1929. xtype: 'panel',
  1930. id: 'modules_container',
  1931. flex: 1,
  1932. height: PanelH-15,
  1933. autoScroll: 'auto',
  1934. tbar:[{
  1935. text: "<?=$Labels->GetLabel( '_ADD_MODULE_' );?>",
  1936. handler: function(){
  1937. var addModuleWindow = new Ext.Window({
  1938. id: 'huha_boa',
  1939. title: "<?=$Labels->GetLabel( '_AS_MODULE_' );?>",
  1940. modal: true,
  1941. width: 400,
  1942. height: 300,
  1943. items:[{
  1944. xtype: 'form',
  1945. items: [{
  1946. xtype: 'combo',
  1947. fieldLabel: "<?=$Labels->GetLabel( 'MOD_TYPE' );?>",
  1948. id: 'mod_type',
  1949. lazyRender: true,
  1950. mode: 'local',
  1951. forceSelection: true,
  1952. triggerAction: 'all',
  1953. editable: false,
  1954. disableKeyFilter: true,
  1955. store: new Ext.data.ArrayStore({
  1956. fields: ['az_t','az_txt'],
  1957. data: [<?php
  1958. $QS = "SELECT * FROM `module_types`";
  1959. $MM = $DATABASE->Query( $QS );
  1960. $MIMO = array();
  1961. foreach( $MM as $M ) $MIMO[]="[{$M['id']},\"".$Labels->GetLabel($M['name'])."\"]";
  1962. echo implode( ',', $MIMO );
  1963. ?>]
  1964. }),
  1965. valueField: 'az_t',
  1966. displayField: 'az_txt',
  1967. value: 1,
  1968. listeners:{
  1969. select: function( t, r, i ){
  1970. var n = r.data.az_t;
  1971. Ext.Ajax.request({
  1972. url: '/lib/controller/getModuleInfo.php',
  1973. params: {
  1974. MID: n,
  1975. UID: <?=$UserID;?>,
  1976. SID: '<?=$Session;?>'
  1977. },
  1978. success: function( response, opts ){
  1979. Ext.getCmp('infopan').update( response.responseText );
  1980. }
  1981. });
  1982. }
  1983. }
  1984. },{
  1985. xtype: 'panel',
  1986. id: 'infopan',
  1987. html: ''
  1988. }]
  1989. }],
  1990. bbar:[{
  1991. text: '<?=$Labels->GetLabel( '_CANCEL_' );?>',
  1992. handler: function(){
  1993. addModuleWindow.close();
  1994. }
  1995. },{
  1996. text: '<?=$Labels->GetLabel( '_ADD_' );?>',
  1997. handler: function(){
  1998. var mtyp = Ext.getCmp('mod_type').getValue();
  1999. Ext.Ajax.request({
  2000. url: '/lib/controller/addModule.php',
  2001. params: {
  2002. SERVID: 1,
  2003. TYPE: mtyp,
  2004. UID: <?=$UserID;?>,
  2005. SID: '<?=$Session;?>'
  2006. },
  2007. success: function( response, opts ){
  2008. // If the response is JSON, you have to decode it
  2009. var data = Ext.decode(response.responseText);
  2010. if( data.status == 'ok' ){
  2011. addModuleWindow.close();
  2012. loadModules();
  2013. } else {
  2014. Ext.Msg.show({
  2015. title: "<?=$Labels->GetLabel("_INFO_MSG_");?>",
  2016. msg: data.message,
  2017. buttons: Ext.Msg.OK,//YESNOCANCEL,
  2018. fn: function(){
  2019. //SettingsLidar3D.hide();
  2020. },
  2021. icon: Ext.MessageBox.INFO //QUESTION
  2022. });
  2023. }
  2024. },
  2025. failure: failureAJAXFunction
  2026. });
  2027. }
  2028. }]
  2029. });
  2030. addModuleWindow.show();
  2031. }
  2032. }],
  2033. items:[]
  2034. },{
  2035. xtype: 'panel',
  2036. id: 'mod_ed_small',
  2037. flex: 1,
  2038. height: PanelH-15,
  2039. layout: 'fit',
  2040. items:[{
  2041. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  2042. }]
  2043. }]
  2044. },{
  2045. xtype: 'panel',
  2046. title: "<?=$Labels->GetLabel( '_TARGET_FILTERS_' );?>",
  2047. id: 'flt_tab',
  2048. layout: 'hbox',
  2049. items:[{
  2050. xtype: 'panel',
  2051. id: 'filters_container',
  2052. flex: 1,
  2053. height: PanelH-15,
  2054. autoScroll: 'auto',
  2055. tbar:[{
  2056. text: "<?=$Labels->GetLabel( '_ADD_FILTER_' );?>",
  2057. handler: function(){
  2058. var addFilterWindow = new Ext.Window({
  2059. id: 'fulu_boa',
  2060. title: "<?=$Labels->GetLabel( '_ADD_EVT_FILTER_' );?>",
  2061. modal: true,
  2062. width: 400,
  2063. height: 300,
  2064. items:[{
  2065. xtype: 'form',
  2066. items: [{
  2067. xtype: 'combo',
  2068. fieldLabel: "<?=$Labels->GetLabel( 'MOD_TYPE' );?>",
  2069. id: 'flt_type',
  2070. lazyRender: true,
  2071. mode: 'local',
  2072. forceSelection: true,
  2073. triggerAction: 'all',
  2074. editable: false,
  2075. disableKeyFilter: true,
  2076. store: new Ext.data.ArrayStore({
  2077. fields: ['az_t','az_txt'],
  2078. data: [<?php
  2079. $QS="SELECT `id`,`name` FROM `target_filter_types`";
  2080. $JIJI=$DATABASE->Query( $QS );
  2081. $OOP = array();
  2082. foreach( $JIJI as $JI ) $OOP[] = "[{$JI['id']},'".$Labels->getLabel($JI['name'])."']";
  2083. echo implode(',', $OOP );
  2084. ?>]
  2085. }),
  2086. valueField: 'az_t',
  2087. displayField: 'az_txt',
  2088. value: 1,
  2089. listeners:{
  2090. select: function( t, r, i ){
  2091. var n = r.data.az_t;
  2092. Ext.Ajax.request({
  2093. url: '/lib/controller/getFilterInfo.php',
  2094. params: {
  2095. FID: n,
  2096. UID: <?=$UserID;?>,
  2097. SID: '<?=$Session;?>'
  2098. },
  2099. success: function( response, opts ){
  2100. Ext.getCmp('filt_infopan').update( response.responseText );
  2101. }
  2102. });
  2103. }
  2104. }
  2105. },{
  2106. xtype: 'panel',
  2107. id: 'filt_infopan',
  2108. html: ''
  2109. }]
  2110. }],
  2111. bbar:[{
  2112. text: "<?=$Labels->GetLabel( '_CANCEL_' );?>",
  2113. handler: function(){
  2114. addFilterWindow.close();
  2115. }
  2116. },{
  2117. text: "<?=$Labels->GetLabel( '_ADD_' );?>",
  2118. handler: function(){
  2119. var mtyp = Ext.getCmp('flt_type').getValue();
  2120. Ext.Ajax.request({
  2121. url: '/lib/controller/addFilter.php',
  2122. params: {
  2123. SERVID: 1,
  2124. TYPE: mtyp,
  2125. UID: <?=$UserID;?>,
  2126. SID: '<?=$Session;?>'
  2127. },
  2128. success: function( response, opts ){
  2129. // If the response is JSON, you have to decode it
  2130. var data = Ext.decode(response.responseText);
  2131. if( data.status == 'ok' ){
  2132. addFilterWindow.close();
  2133. loadFilters();
  2134. } else {
  2135. Ext.Msg.show({
  2136. title: "<?=$Labels->GetLabel("_INFO_MSG_");?>",
  2137. msg: data.message,
  2138. buttons: Ext.Msg.OK,//YESNOCANCEL,
  2139. fn: function(){
  2140. //SettingsLidar3D.hide();
  2141. },
  2142. icon: Ext.MessageBox.INFO //QUESTION
  2143. });
  2144. }
  2145. },
  2146. failure: failureAJAXFunction
  2147. });
  2148. }
  2149. }]
  2150. });
  2151. addFilterWindow.show();
  2152. Ext.Ajax.request({
  2153. url: '/lib/controller/getFilterInfo.php',
  2154. params: {
  2155. FID: 1,
  2156. UID: <?=$UserID;?>,
  2157. SID: '<?=$Session;?>'
  2158. },
  2159. success: function( response, opts ){
  2160. Ext.getCmp('filt_infopan').update( response.responseText );
  2161. }
  2162. });
  2163. }
  2164. }],
  2165. items:[]
  2166. },{
  2167. xtype: 'panel',
  2168. id: 'flt_ed_small',
  2169. flex: 1,
  2170. height: PanelH-15,
  2171. layout: 'fit',
  2172. items:[{
  2173. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  2174. }]
  2175. }]
  2176. }
  2177. <?php }; ?>
  2178. ],
  2179. listeners:{
  2180. tabchange: function( tp, t ){
  2181. switch( t.getId() ){
  2182. case 'gi_tab': {
  2183. //content_lvl3=0;
  2184. updateServerStatus();
  2185. break;
  2186. };
  2187. case 'res_tab': {
  2188. //content_lvl3=1;
  2189. stopStatusUpdater();
  2190. loadRessources();
  2191. break;
  2192. };
  2193. case 'mod_tab':{
  2194. //content_lvl3=2;
  2195. stopStatusUpdater();
  2196. loadModules();
  2197. break;
  2198. };
  2199. case 'flt_tab':{
  2200. //content_lvl3=3;
  2201. stopStatusUpdater();
  2202. loadFilters();
  2203. break;
  2204. };
  2205. };
  2206. //updateUserContent();
  2207. },
  2208. afterrender: function(){
  2209. settingsAreChanged = false;
  2210. }
  2211. },
  2212. updateSettings: function(){
  2213. alert('Update Settings');
  2214. }
  2215. });
  2216. tPanel.doLayout();
  2217. updateServerStatus();
  2218. };
  2219. function showSettingsSensors(){
  2220. stopStatusUpdater();
  2221. content_lvl1 = 1;
  2222. content_lvl2 = 4;
  2223. var tPanel = Ext.getCmp('main_content');
  2224. tPanel.removeAll( true );
  2225. tPanel.add({
  2226. xtype: 'panel',
  2227. id: 'sen_set',
  2228. layout: 'hbox',
  2229. tbar:[{
  2230. text: "<?=$Labels->GetLabel( '_SMM_ADD_LSEN_' );?>",
  2231. handler: function(){
  2232. addSensor();
  2233. }
  2234. }],
  2235. items:[{
  2236. xtype: 'panel',
  2237. id: 'sens_container',
  2238. flex: 1,
  2239. height: PanelH-15,
  2240. autoScroll: 'auto',
  2241. items:[]
  2242. },{
  2243. xtype: 'panel',
  2244. id: 'sens_op_small',
  2245. flex: 1,
  2246. height: PanelH-15,
  2247. layout: 'fit',
  2248. items:[{
  2249. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  2250. }]
  2251. }]
  2252. });
  2253. tPanel.doLayout();
  2254. loadAttachedSensors();
  2255. };
  2256. function showSettingsDetection(){
  2257. stopStatusUpdater();
  2258. content_lvl1 = 1;
  2259. content_lvl2 = 4;
  2260. var tPanel = Ext.getCmp('main_content');
  2261. tPanel.removeAll( true );
  2262. tPanel.add({
  2263. xtype: 'panel',
  2264. id: 'sen_set',
  2265. layout: 'hbox',
  2266. tbar:[{
  2267. text: "<?=$Labels->GetLabel( '_SMM_ADD_LSEN_' );?>",
  2268. handler: function(){
  2269. addSensor();
  2270. }
  2271. }],
  2272. items:[{
  2273. xtype: 'panel',
  2274. id: 'sens_container',
  2275. flex: 1,
  2276. height: PanelH-15,
  2277. autoScroll: 'auto',
  2278. items:[]
  2279. },{
  2280. xtype: 'panel',
  2281. id: 'sens_op_small',
  2282. flex: 1,
  2283. height: PanelH-15,
  2284. layout: 'fit',
  2285. items:[{
  2286. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  2287. }]
  2288. }]
  2289. });
  2290. tPanel.doLayout();
  2291. loadAttachedSensors();
  2292. };
  2293. function editSensorHW( cid ){
  2294. SelectedSensor = cid;
  2295. Ext.Ajax.request({
  2296. url: '/lib/controller/getSensorEditor.php',
  2297. params: {
  2298. CID: SelectedSensor,
  2299. UID: <?=$UserID;?>,
  2300. SID: '<?=$Session;?>'
  2301. },
  2302. success: function( response, opts ){
  2303. var data = Ext.decode( response.responseText );
  2304. var tComp = Ext.getCmp('sens_op_small');
  2305. if( data.status == 'ok' ){
  2306. if( tComp!= null ){
  2307. var content = Ext.decode( data.content );
  2308. tComp.removeAll( true );
  2309. tComp.add( content );
  2310. tComp.doLayout();
  2311. };
  2312. } else {
  2313. if( tComp!= null ){
  2314. tComp.removeAll( true );
  2315. tComp.add( data );
  2316. tComp.doLayout();
  2317. };
  2318. };
  2319. },
  2320. failure: function(){
  2321. }
  2322. });
  2323. };
  2324. var cameraEditorContent = null;
  2325. function editCamera( cid, etyp ){
  2326. SelectedCam = cid;
  2327. switch( etyp ){
  2328. case 0: cameraEditorContent = Ext.getCmp('dcam_op_small'); break;
  2329. case 1: cameraEditorContent = Ext.getCmp('acam_op_small'); break;
  2330. };
  2331. Ext.Ajax.request({
  2332. url: '/lib/controller/getCameraEditor.php',
  2333. params: {
  2334. CID: SelectedCam,
  2335. UID: <?=$UserID;?>,
  2336. SID: '<?=$Session;?>'
  2337. },
  2338. success: function( response, opts ){
  2339. var data = Ext.decode( response.responseText );
  2340. if( data.status == 'ok' ){
  2341. if( cameraEditorContent!= null ){
  2342. var content = Ext.decode( data.content );
  2343. cameraEditorContent.removeAll( true );
  2344. cameraEditorContent.add( content );
  2345. cameraEditorContent.doLayout();
  2346. };
  2347. } else {
  2348. if( cameraEditorContent!= null ){
  2349. cameraEditorContent.removeAll( true );
  2350. cameraEditorContent.add( data );
  2351. cameraEditorContent.doLayout();
  2352. };
  2353. };
  2354. },
  2355. failure: function(){
  2356. }
  2357. });
  2358. };
  2359. function showSettingsVideo(){
  2360. stopStatusUpdater();
  2361. content_lvl1 = 1;
  2362. content_lvl2 = 4;
  2363. content_lvl3 = 0;
  2364. var tPanel = Ext.getCmp('main_content');
  2365. tPanel.removeAll( true );
  2366. tPanel.add({
  2367. xtype: 'tabpanel',
  2368. frame: false,
  2369. id: 'node_settings_content',
  2370. border: false,
  2371. activeTab: content_lvl3,
  2372. items: [{
  2373. xtype: 'panel',
  2374. id: 'cam_ass_tab',
  2375. title: "<?=$Labels->GetLabel('_CAM_ASS_LIST_');?>",
  2376. layout: 'hbox',
  2377. items:[{
  2378. xtype: 'panel',
  2379. id: 'acam_container',
  2380. flex: 1,
  2381. height: PanelH-15,
  2382. autoScroll: 'auto',
  2383. items:[]
  2384. },{
  2385. xtype: 'panel',
  2386. id: 'acam_op_small',
  2387. flex: 1,
  2388. height: PanelH-15,
  2389. layout: 'fit',
  2390. items:[{
  2391. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  2392. }]
  2393. }]
  2394. },{
  2395. xtype: 'panel',
  2396. title: "<?=$Labels->GetLabel('_CAM_DET_LIST_');?>",
  2397. id: 'cam_det_tab',
  2398. layout: 'hbox',
  2399. items:[{
  2400. xtype: 'panel',
  2401. id: 'dcam_container',
  2402. flex: 1,
  2403. height: PanelH-15,
  2404. autoScroll: 'auto',
  2405. tbar:[{
  2406. text: "<?=$Labels->GetLabel( '_MANUADD_CAMERA_' );?>",
  2407. handler: function(){
  2408. addDetectedIPCam();
  2409. }
  2410. },{
  2411. text: "<?=$Labels->GetLabel( '_MANUADD_ACAMERA_' );?>",
  2412. handler: function(){
  2413. addDetectedAnalogCam();
  2414. }
  2415. }],
  2416. items:[]
  2417. },{
  2418. xtype: 'panel',
  2419. id: 'dcam_op_small',
  2420. flex: 1,
  2421. height: PanelH-15,
  2422. layout: 'fit',
  2423. items:[{
  2424. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  2425. }]
  2426. }]
  2427. }],
  2428. listeners:{
  2429. tabchange: function( tp, t ){
  2430. switch( t.getId() ){
  2431. case 'cam_det_tab': {
  2432. content_lvl3=0;
  2433. stopStatusUpdater();
  2434. loadDetectedCameras();
  2435. break;
  2436. };
  2437. case 'cam_ass_tab': {
  2438. content_lvl3=1;
  2439. stopStatusUpdater();
  2440. loadAssignedCameras();
  2441. break;
  2442. };
  2443. case 'mod_tab':{
  2444. content_lvl3=2;
  2445. stopStatusUpdater();
  2446. loadModules();
  2447. break;
  2448. };
  2449. case 'net_tab':{
  2450. content_lvl3=3;
  2451. stopStatusUpdater();
  2452. break;
  2453. };
  2454. };
  2455. updateUserContent();
  2456. },
  2457. afterrender: function(){
  2458. settingsAreChanged = false;
  2459. }
  2460. }
  2461. });
  2462. tPanel.doLayout();
  2463. updateUserContent();
  2464. updateServerStatus();
  2465. };
  2466. function showSettingsApplication( ap_sid ){
  2467. stopStatusUpdater();
  2468. content_lvl1 = 1;
  2469. content_lvl2 = 3;
  2470. <?php if( $AP_DATA['type']!=1){ ?>
  2471. //Load Location
  2472. prepareMapData();
  2473. <?php };?>
  2474. if( ap_sid == undefined ) ap_sid = 0;
  2475. content_lvl3 = ap_sid;
  2476. var tPanel = Ext.getCmp('main_content');
  2477. tPanel.removeAll( true );
  2478. tPanel.add({
  2479. xtype: 'tabpanel',
  2480. frame: false,
  2481. id: 'settings_a_content',
  2482. border: false,
  2483. activeTab: 'aps_tab_'+content_lvl3,
  2484. items:[{
  2485. title: "<?=$Labels->GetLabel('_WORKING_MODE_');?>",
  2486. xtype: 'form',
  2487. id: 'aps_tab_0',
  2488. labelAlign: 'right',
  2489. labelWidth: 250,
  2490. height: PanelH - 30,
  2491. items:[]
  2492. },
  2493. <?php if( $AP_DATA['type']!=1){ ?>
  2494. {
  2495. title: "<?=$Labels->GetLabel('_GEO_LOCATION_');?>",
  2496. layout: 'column',
  2497. id: 'aps_tab_1',
  2498. items:[]
  2499. },
  2500. <?php };?>{
  2501. title: "<?=$Labels->GetLabel('_BACKUP_SETTINGS_');?>",
  2502. xtype: 'form',
  2503. id: 'aps_tab_2',
  2504. fileUpload: true,
  2505. labelAlign: 'right',
  2506. labelWidth: 180,
  2507. height: PanelH - 30,
  2508. items:[{
  2509. xtype: 'spacer',
  2510. height: 10
  2511. },{
  2512. xtype: 'button',
  2513. text: "<?=$Labels->GetLabel( '_DOWNLOAD_SETTINGS_' );?>",
  2514. width: 500,
  2515. handler: downloadSettings
  2516. },{
  2517. xtype: 'spacer',
  2518. height: 10
  2519. },{
  2520. xtype: 'fileuploadfield',
  2521. id: 'db_file',
  2522. emptyText: "<?=$Labels->GetLabel('_DB_BACKUP_');?>",
  2523. fieldLabel: "<?=$Labels->GetLabel('_SELE_DBBACKUP_');?>",
  2524. width: 300,
  2525. name: 'db_file',
  2526. buttonText: "<?=$Labels->GetLabel('_BROWSE_');?>"
  2527. },{
  2528. xtype: 'spacer',
  2529. height: 10
  2530. },{
  2531. xtype: 'button',
  2532. text: "<?=$Labels->GetLabel( '_APLY_DBBACKUP_' );?>",
  2533. width: 500,
  2534. handler: function(){
  2535. if( Ext.getCmp('as_dbbackup').getForm().isValid()){
  2536. Ext.getCmp('as_dbbackup').getForm().submit({
  2537. url: '/lib/controller/doDatabaseOperation.php',
  2538. waitMsg: "<?=$Labels->GetLabel('_DB_UPLOAD_BACKUP_');?>...",
  2539. encoding: 'multipart/form-data',
  2540. success: function(fp, o){
  2541. }
  2542. });
  2543. };
  2544. }
  2545. },{
  2546. xtype: 'spacer',
  2547. height: 10
  2548. }<?php
  2549. if( file_exists( '../../controller/data/factory.db' ) ){
  2550. ?>,{
  2551. xtype: 'button',
  2552. text: "<?=$Labels->GetLabel( '_FACTORY_RESET_' );?>",
  2553. width: 500,
  2554. handler: function(){
  2555. doDeviceOperation( 1, 254, '', true );
  2556. }
  2557. }<?php
  2558. };
  2559. ?>]
  2560. },{
  2561. title: "<?=$Labels->GetLabel('_REPORT_STORAGE_');?>",
  2562. xtype: 'form',
  2563. id: 'aps_tab_3',
  2564. labelAlign: 'right',
  2565. labelWidth: 180,
  2566. height: PanelH - 30,
  2567. items:[{
  2568. xtype: 'spacer',
  2569. height: 10
  2570. },{
  2571. xtype: 'numberfield',
  2572. id: 'stor_days',
  2573. fieldLabel: "<?=$Labels->GetLabel('_STORE_DAYS_');?>",
  2574. width: 300,
  2575. value: <?=intval($AP_DATA['report_cleanup']);?>,
  2576. name: 'stor_time',
  2577. listeners: {
  2578. change: function( t, b, o ){
  2579. doApplicationOperation( 4, b );
  2580. }
  2581. }
  2582. },{
  2583. xtype: 'spacer',
  2584. height: 10
  2585. },{
  2586. xtype: 'slider',
  2587. id: 'stor_space',
  2588. fieldLabel: "<?=$Labels->GetLabel('_STORE_EMPTY_SPACE_');?>",
  2589. value: <?=intval($AP_DATA['preserve_empty']);?>,
  2590. width: 300,
  2591. name: 'stor_space',
  2592. listeners: {
  2593. change: function( t, b, o ){
  2594. doApplicationOperation( 5, b );
  2595. }
  2596. }
  2597. },{
  2598. xtype: 'spacer',
  2599. height: 10
  2600. },{
  2601. xtype: 'button',
  2602. text: "<?=$Labels->GetLabel( '_APPLY_SETTINGS_' );?>",
  2603. width: 500,
  2604. handler: function(){
  2605. doDeviceOperation( 1, 250, '', true );
  2606. }
  2607. },{
  2608. xtype: 'spacer',
  2609. height: 10
  2610. }]
  2611. },{
  2612. title: "<?=$Labels->GetLabel('_MULTI_LAYOUT_');?>",
  2613. xtype: 'form',
  2614. id: 'aps_tab_4',
  2615. labelAlign: 'right',
  2616. labelWidth: 180,
  2617. height: PanelH - 30,
  2618. items:[]
  2619. }],
  2620. listeners:{
  2621. tabchange: function( tp, t ){
  2622. switch( t.getId() ){
  2623. case 'aps_tab_0': content_lvl3 = 0; break;
  2624. case 'aps_tab_1': content_lvl3 = 1; break;
  2625. case 'aps_tab_2': content_lvl3 = 2; break;
  2626. case 'aps_tab_3': content_lvl3 = 3; break;
  2627. case 'aps_tab_4': content_lvl3 = 4; break;
  2628. case 'aps_tab_5': content_lvl3 = 5; break;
  2629. };
  2630. loadApplicationSettings( content_lvl3 );
  2631. updateUserContent();
  2632. },
  2633. afterrender: function(){
  2634. //settingsAreChanged = false;
  2635. }
  2636. }
  2637. });
  2638. tPanel.doLayout();
  2639. loadApplicationSettings( content_lvl3 );
  2640. //updateUserContent();
  2641. };
  2642. function showMultyLayoutEditor(){
  2643. alert('KAKA');
  2644. };
  2645. function showSettingsUpgrade(){
  2646. stopStatusUpdater();
  2647. content_lvl1 = 1;
  2648. content_lvl2 = 4;
  2649. var tPanel = Ext.getCmp('main_content');
  2650. tPanel.removeAll( true );
  2651. initial_md5 = '';
  2652. tPanel.add({
  2653. columnWidth: 1.0,
  2654. frame: false,
  2655. border: false,
  2656. items: [{
  2657. frame: false,
  2658. border: false,
  2659. collapsible: false,
  2660. draggable: false,
  2661. layout: 'vbox',
  2662. //layoutConfig: {
  2663. // align : 'stretch',
  2664. // pack : 'start',
  2665. //},
  2666. height: PanelH,
  2667. items:[{
  2668. title: "<?=$Labels->getLabel('_MAP_MONITORING_');?>",
  2669. xtype: 'panel',
  2670. height: PanelH-300,
  2671. //flex: 1,
  2672. frame: true,
  2673. width: '100%',
  2674. border: false,
  2675. layout: {
  2676. type: 'table',
  2677. columns: 2,
  2678. tableAttrs: {
  2679. valign: 'top',
  2680. style: 'valign:top;width:100%;'
  2681. }
  2682. },
  2683. defaults: {
  2684. frame: true,
  2685. border: false,
  2686. height: ( PanelH-400 ) / 2,
  2687. style: 'margin: 5px;width:400px;display:block;'
  2688. },
  2689. items:[{
  2690. title: 'Current System Info',
  2691. width: '100%',
  2692. //flex: 1,
  2693. html: '<p>Current Web Version:&nbsp;<b><?=$ARGUS_WEB_VERSION;?></b></p>'
  2694. },{
  2695. title: 'Tasks',
  2696. //width: 400,
  2697. layout: 'vbox',
  2698. items:[{
  2699. xtype: 'button',
  2700. width: '100%',
  2701. text: 'Create Database Backup',
  2702. handler: function(){
  2703. createNewTask( 2 );
  2704. }
  2705. },{
  2706. xtype: 'button',
  2707. width: '100%',
  2708. text: 'Create Full Snapeshot',
  2709. handler: function(){
  2710. createNewTask( 255 );
  2711. }
  2712. }]
  2713. },{
  2714. title: 'Archives',
  2715. height: 250,
  2716. width: '100%',
  2717. tbar:[{
  2718. text: 'Restore',
  2719. id: 'ar_restore_btn',
  2720. handler: function(){
  2721. createNewTask(1, selectedArchiveRecord.data.file_name );
  2722. }
  2723. },{
  2724. text: 'Download',
  2725. id: 'ar_download_btn',
  2726. handler: function(){
  2727. if( selectedArchiveRecord!= null ){
  2728. window.open( '/lib/php/setup_toolkit/vault/'+selectedArchiveRecord.data.base_version + '/'+ selectedArchiveRecord.data.file_name );
  2729. };
  2730. }
  2731. },{
  2732. text: 'Delete',
  2733. id: 'ar_delete_btn',
  2734. handler: function(){
  2735. createNewTask(100, selectedArchiveRecord.data.file_name );
  2736. }
  2737. }],
  2738. items:[{
  2739. xtype: 'grid',
  2740. id: 'archives_grid',
  2741. border: false,
  2742. frame: false,
  2743. autoScroll: true,
  2744. //width: '100%',
  2745. lazyRender: true,
  2746. height: 210,
  2747. ds: archives_store,
  2748. cm: new Ext.grid.ColumnModel( archivesColModel_ops ),
  2749. sm: new Ext.grid.RowSelectionModel( archivesSelModel_ops ),
  2750. viewConfig: {
  2751. // forceFit: true
  2752. },
  2753. }]
  2754. },{
  2755. title: 'Task Status',
  2756. height: 250,
  2757. //flex: 1,
  2758. items:[{
  2759. xtype: 'spacer',
  2760. height: 4
  2761. },{
  2762. id: 'ctask_status',
  2763. border: true,
  2764. html: ''
  2765. },{
  2766. xtype: 'spacer',
  2767. height: 4
  2768. },{
  2769. xtype: 'textarea',
  2770. id: 'task_log',
  2771. height: ( PanelH-320 ) / 2 - 120,
  2772. style: 'font-size:9px;width:100%;margin-bottom:4px;',
  2773. readOnly: true,
  2774. autoScroll: true,
  2775. value: ''
  2776. },{
  2777. xtype: 'progress',
  2778. id: 'task_progress',
  2779. value: 1.0,
  2780. text: 'idle',
  2781. disabled: true
  2782. }],
  2783. tbar:[{
  2784. text: 'Cancel Task',
  2785. id: 'ch_ta_btn',
  2786. disabled: true,
  2787. handler: deleteNewTask
  2788. }]
  2789. }]
  2790. },{
  2791. title: '<?=$Labels->getLabel('_UPLOAD_PACKAGE_');?>',
  2792. xtype: 'panel',
  2793. height: 300,
  2794. //flex: 1,
  2795. frame: true,
  2796. border: false,
  2797. //layout: 'vbox',
  2798. items:[{
  2799. xtype:'button',
  2800. id: 'pickfiles',
  2801. width: '100%',
  2802. text: 'Choose File'
  2803. },{
  2804. height: 200,
  2805. xtype: 'grid',
  2806. id: 'upload_grid',
  2807. border: false,
  2808. frame: false,
  2809. mode: 'local',
  2810. lazyRender: true,
  2811. width: '100%',
  2812. autoScroll: true,
  2813. ds: uploads_store,
  2814. cm: new Ext.grid.ColumnModel( fileUploadsColModel_ops ),
  2815. sm: new Ext.grid.RowSelectionModel( fileUploadsSelModel_ops ),
  2816. viewConfig: {
  2817. forceFit: true
  2818. },
  2819. bbar: [{
  2820. text: 'Clear',
  2821. width: '100%',
  2822. handler: function(){
  2823. muploader.splice();
  2824. uploads_store.removeAll();
  2825. }
  2826. }]
  2827. },{
  2828. xtype:'button',
  2829. id: 'umpalumpa',
  2830. width: '100%',
  2831. disabled: true,
  2832. text: 'Upload',
  2833. handler: function(){
  2834. if( muploader!= null ){
  2835. muploader.start();
  2836. };
  2837. }
  2838. }],
  2839. listeners:{
  2840. afterrender: function(){
  2841. muploader = new plupload.Uploader({
  2842. runtimes : 'html5,html4',
  2843. browse_button : Ext.getDom('pickfiles'), // you can pass in id...
  2844. //container: document.getElementById('upupu'), // ... or DOM Element itself
  2845. max_file_size : '1000mb',
  2846. chunk_size: '200kb',
  2847. max_retries: 3,
  2848. multi_selection: false,
  2849. max_file_count: 1,
  2850. // Fake server response here
  2851. url: '/lib/php/setup_toolkit/upload.php',
  2852. //url: "/echo/json",
  2853. //flash_swf_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/flash/Moxie.cdn.swf',
  2854. //silverlight_xap_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/silverlight/Moxie.cdn.xap',
  2855. filters : [
  2856. //{title : "Image files", extensions : "jpg,gif,png"},
  2857. {title : "Archive files", extensions : "rar,zip,gz,bz2"}
  2858. ],
  2859. init: {
  2860. PostInit: function() {
  2861. //$('filelist').innerHTML = '';
  2862. //$('uploadfiles').onclick = function() {
  2863. // uploader.start();
  2864. // return false;
  2865. //};
  2866. },
  2867. FilesAdded: function( up, files ) {
  2868. Ext.getCmp('umpalumpa').enable();
  2869. plupload.each( files, function(file) {
  2870. uploads_store.loadData( [[ uploads_store_id, file.name, file.id, plupload.formatSize( file.size ), 0, 'N' ]], true );
  2871. uploads_store_id++;
  2872. Ext.getCmp('upload_grid').doLayout();
  2873. });
  2874. },
  2875. UploadProgress: function(up, file) {
  2876. var pb = Ext.getCmp( 'progress_'+file.id );
  2877. if( file.percent < 100 ){
  2878. pb.updateProgress( file.percent / 100, file.percent + '%', false );
  2879. } else {
  2880. pb.updateProgress( 1.0, 'Uploaded', false );
  2881. };
  2882. },
  2883. Error: function(up, err) {
  2884. Ext.Msg.show({
  2885. title:'Upload Status',
  2886. msg: "Error #" + err.code + ": " + err.message,
  2887. buttons: Ext.Msg.OK,
  2888. icon: Ext.MessageBox.ERROR
  2889. });
  2890. }
  2891. }
  2892. });
  2893. muploader.init();
  2894. }
  2895. }
  2896. }]
  2897. }]
  2898. });
  2899. muploader = null;
  2900. uploads_store.removeAll();
  2901. tPanel.doLayout();
  2902. archives_store.load();//{params:{start:0, limit:50, src: 'arch', fil: selecredActiveSourceFilter }});
  2903. updateTaskStatus();
  2904. tlInterval = window.setInterval( updateTaskStatus, 333 );
  2905. };
  2906. function loadSensorDetectionSettings( sensid ){
  2907. Ext.Ajax.request({
  2908. url: '/lib/controller/getSensorDetectionEditor.php',
  2909. params: {
  2910. UID: <?=$UserID;?>,
  2911. SID: '<?=$Session;?>',
  2912. SEN: sensid
  2913. },
  2914. success: function( response, opts ){
  2915. var data = Ext.decode( response.responseText );
  2916. var tComp = Ext.getCmp('main_content');
  2917. if( data.status == 'ok' ){
  2918. if( tComp!= null ){
  2919. var content = Ext.decode( data.content );
  2920. tComp.removeAll( true );
  2921. tComp.add( content );
  2922. tComp.doLayout();
  2923. };
  2924. } else {
  2925. if( tComp!= null ){
  2926. tComp.removeAll( true );
  2927. tComp.add( data );
  2928. tComp.doLayout();
  2929. };
  2930. };
  2931. },
  2932. failure: function(){
  2933. }
  2934. });
  2935. };
  2936. function initSettingsView(){
  2937. if( tlInterval!= null ){
  2938. window.clearInterval( tlInterval );
  2939. tlInterval = null;
  2940. timelineObj = null;
  2941. };
  2942. var tP = Ext.getCmp('left_side_menu');
  2943. //tP.doLayout();
  2944. //tP.setVisible( false );
  2945. tP.removeAll( true );
  2946. tP.add({
  2947. id: 'sme_inner',
  2948. layout:'accordion',
  2949. //height: PanelH,
  2950. frame: false,
  2951. border: false,
  2952. layoutConfig:{
  2953. animate: true//,
  2954. //activeOnTop: true
  2955. },
  2956. items:[]
  2957. });
  2958. tP.doLayout();
  2959. tP = Ext.getCmp('sme_inner');
  2960. <?php if( $CUser->Data['access'] > 3 ){ ?>
  2961. tP.add({
  2962. title: "<?=$Labels->GetLabel('_SYS_SETTINGS_');?>",
  2963. layout: 'vbox',
  2964. height: 120,
  2965. pack: 'center',
  2966. align : 'strech',
  2967. collapsed: ( content_lvl1 != 0 ),
  2968. items:[{
  2969. xtype: 'button',
  2970. width: '100%',
  2971. id:'sys_edit',
  2972. text: "<?=$Labels->GetLabel('_SYS_GENERAL_');?>",
  2973. enableToggle: true,
  2974. pressed: ( content_lvl2 == 0 && content_lvl1 == 0 ),
  2975. allowDepress: false,
  2976. toggleGroup: 'sys_settings',
  2977. handler: showSettingsGeneral
  2978. }
  2979. <?php if( $CUser->Data['access'] > 4 ){ ?>
  2980. ,{
  2981. xtype: 'button',
  2982. width: '100%',
  2983. id:'map_edit',
  2984. text: "<?=$Labels->GetLabel('_SENSOR_CONNECTION_');?>",
  2985. enableToggle: true,
  2986. pressed: ( content_lvl2 == 1 && content_lvl1 == 0 ),
  2987. allowDepress: false,
  2988. toggleGroup: 'sys_settings',
  2989. handler: showSettingsSensors
  2990. },{
  2991. xtype: 'button',
  2992. width: '100%',
  2993. id:'video_set',
  2994. text: "<?=$Labels->GetLabel('_CAMERA_MNGMNT_');?>",
  2995. enableToggle: true,
  2996. pressed: ( content_lvl2 == 2 && content_lvl1 == 0 ),
  2997. allowDepress: false,
  2998. toggleGroup: 'sys_settings',
  2999. handler: showSettingsVideo
  3000. },{
  3001. xtype: 'button',
  3002. width: '100%',
  3003. id:'app_set',
  3004. text: "<?=$Labels->GetLabel('_APPLICA_MNGMNT_');?>",
  3005. enableToggle: true,
  3006. pressed: ( content_lvl2 == 3 && content_lvl1 == 0 ),
  3007. allowDepress: false,
  3008. toggleGroup: 'sys_settings',
  3009. handler: function(){
  3010. showSettingsApplication( content_lvl3 );
  3011. }
  3012. }
  3013. <?php }; ?>
  3014. ]
  3015. });
  3016. <?php if( $CUser->Data['access'] > 4 ){ ?>
  3017. tP.add({
  3018. title: "<?=$Labels->GetLabel('_DET_SETTINGS_');?>",
  3019. layout: 'vbox',
  3020. height: 120,
  3021. pack: 'center',
  3022. align : 'strech',
  3023. collapsed: ( content_lvl1 != 1 ),
  3024. items:[<?php
  3025. if( $AP_DATA['type'] == 1 ){
  3026. ?>
  3027. {
  3028. xtype: 'button',
  3029. width: '100%',
  3030. id:'go_home',
  3031. text: "<?=$Labels->GetLabel('_UPPER_SENSOR_');?>",
  3032. enableToggle: true,
  3033. pressed: ( content_lvl2 == 0 && content_lvl1 == 1 ),
  3034. allowDepress: false,
  3035. toggleGroup: 'det_settings',
  3036. handler: loadMetroControlUpper
  3037. },{
  3038. xtype: 'button',
  3039. width: '100%',
  3040. id:'go_monitor',
  3041. text: "<?=$Labels->GetLabel('_BOTTOM_SENSOR_');?>",
  3042. enableToggle: true,
  3043. pressed: ( content_lvl2 == 1 && content_lvl1 == 1 ),
  3044. allowDepress: false,
  3045. toggleGroup: 'det_settings',
  3046. handler: loadMetroControlBottom
  3047. },{
  3048. xtype: 'button',
  3049. width: '100%',
  3050. id:'go_archive',
  3051. text: "<?=$Labels->GetLabel('_FUSION_ENGINE_');?>",
  3052. enableToggle: true,
  3053. pressed: ( content_lvl2 == 2 && content_lvl1 == 1 ),
  3054. allowDepress: false,
  3055. toggleGroup: 'det_settings',
  3056. handler: loadMetroControlFusion
  3057. }<?php
  3058. } else {
  3059. $QS = "SELECT `name`, `aux_id` FROM `nodes` WHERE `type`>0 AND `type`<5";
  3060. $RR = $DATABASE->Query( $QS );
  3061. if( count( $RR ) ){
  3062. foreach( $RR as $CR ){
  3063. ?>
  3064. {
  3065. xtype: 'button',
  3066. width: '100%',
  3067. text: '<?=$CR['name'];?>',
  3068. enableToggle: true,
  3069. pressed: ( content_lvl2 == 0 && content_lvl1 == 1 ),
  3070. allowDepress: false,
  3071. toggleGroup: 'det_settings',
  3072. handler: function(){
  3073. loadSensorDetectionSettings( <?=$CR['aux_id'];?> );
  3074. }
  3075. },
  3076. <?php
  3077. };
  3078. } else {
  3079. ?>
  3080. {
  3081. xtype: 'spacer',
  3082. html: "<?=$Labels->GetLabel('_NO_SENSORS_DEF_');?>",
  3083. height: 32
  3084. },
  3085. <?php
  3086. };
  3087. ?>
  3088. {
  3089. xtype: 'spacer',
  3090. height: 10
  3091. }<?php
  3092. };
  3093. ?>]
  3094. });
  3095. <?php };
  3096. }; ?>
  3097. tP.add({
  3098. title: "<?=$Labels->GetLabel('_PROF_SETTINGS_');?>",
  3099. items:[<?php
  3100. $ZIGA = array();
  3101. foreach( $Site_Languages as $SL ){
  3102. if( $SL['id'] == $CUser->Data['language'] ){
  3103. $ZIGA[] = "{ xtype:'button', text:'{$SL['name']}', width: '100%', enableToggle: true, pressed : true, handler: function(){ window.location = '/?Lang={$SL['id']}'; } }";
  3104. } else {
  3105. $ZIGA[] = "{ xtype:'button', text:'{$SL['name']}', width: '100%', handler: function(){ window.location = '/?Lang={$SL['id']}'; } }";
  3106. };
  3107. };
  3108. echo implode(',',$ZIGA );
  3109. ?>]
  3110. });
  3111. <?php if( $CUser->Data['access'] > 5 ){ ?>
  3112. tP.add({
  3113. title: "<?=$Labels->GetLabel('_ADM_SETTINGS_');?>",
  3114. collapsed: ( content_lvl1 != 3 ),
  3115. items:[{
  3116. xtype: 'button',
  3117. width: '100%',
  3118. id:'adm_acc',
  3119. text: "<?=$Labels->GetLabel('_USERS_MNGMT_');?>",
  3120. enableToggle: true,
  3121. pressed: ( content_lvl2 == 0 && content_lvl1 == 3 ),
  3122. allowDepress: false,
  3123. toggleGroup: 'adm_settings',
  3124. handler: function( b, e ){
  3125. loadUserEditor();
  3126. }
  3127. },{
  3128. xtype: 'button',
  3129. width: '100%',
  3130. id:'adm_acclog',
  3131. text: "<?=$Labels->GetLabel('_ACC_LOG_');?>",
  3132. enableToggle: true,
  3133. pressed: ( content_lvl2 == 1 && content_lvl1 == 3 ),
  3134. allowDepress: false,
  3135. toggleGroup: 'adm_settings',
  3136. handler: function( b, e ){
  3137. loadAccessLog();
  3138. }
  3139. },{
  3140. xtype: 'button',
  3141. width: '100%',
  3142. id:'adm_servlog',
  3143. text: "<?=$Labels->GetLabel('_SERV_LOG_');?>",
  3144. enableToggle: true,
  3145. pressed: ( content_lvl2 == 2 && content_lvl1 == 3 ),
  3146. allowDepress: false,
  3147. toggleGroup: 'adm_settings',
  3148. handler: function( b, e ){
  3149. loadServerLog();
  3150. }
  3151. }]
  3152. });
  3153. <?php
  3154. };
  3155. ?>
  3156. tP.setVisible( true );
  3157. tP.doLayout();
  3158. switch( content_lvl1 ){
  3159. default:{
  3160. switch( content_lvl2 ){
  3161. default: showSettingsGeneral(); break;
  3162. <?php if( $CUser->Data['access'] > 5 ){ ?>
  3163. case 1: showSettingsSensors(); break;
  3164. case 2: showSettingsVideo(); break;
  3165. case 3: showSettingsApplication(); break;
  3166. <?php }; ?>
  3167. //case 4: showSettingsUpgrade(); break;
  3168. };
  3169. };
  3170. case 1:{
  3171. switch( content_lvl2 ){
  3172. case 0: break;
  3173. };
  3174. break;
  3175. };
  3176. <?php if( $CUser->Data['access'] > 5 ){ ?>
  3177. case 3:{
  3178. switch( content_lvl2 ){
  3179. case 0: loadUserEditor(); break;
  3180. };
  3181. break;
  3182. };
  3183. <?php }; ?>
  3184. };
  3185. };
  3186. function zdonut(cx, cy, radius, data) {
  3187. function arcradius(cx, cy, radius, degrees) {
  3188. var radians = (degrees - 90) * Math.PI / 180.0;
  3189. return { x: cx + (radius * Math.cos(radians)), y: cy + (radius * Math.sin(radians)) };
  3190. }
  3191. var decimals = 4;
  3192. var total = 0;
  3193. var arr = [];
  3194. var beg = 0;
  3195. var end = 0;
  3196. var count = 0;
  3197. var half = radius / 2;
  3198. var midpoint = radius / 2.4;
  3199. for( var i = 0; i < data.length; i++) total += data[i].value;
  3200. for( var i = 0; i < data.length; i++) {
  3201. var item = data[i];
  3202. var tmp = {};
  3203. //var p = Math.floor((((item.value + 1) / total) * 100), decimals );
  3204. var p = (( item.value / total ) * 100.0 );
  3205. count += p;
  3206. if( i === length - 1 && count < 100 ) p = p + (100 - count);
  3207. end = beg + ((360 / 100) * p);
  3208. tmp.index = i;
  3209. tmp.value = item.value;
  3210. tmp.data = item;
  3211. var b = arcradius(cx, cy, radius, end);
  3212. var e = arcradius(cx, cy, radius, beg);
  3213. var la = (end - beg) <= 180 ? 0 : 1;
  3214. 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(' ');
  3215. arr.push(tmp);
  3216. beg = end;
  3217. };
  3218. return arr;
  3219. };
  3220. var selectedPresetsBackgroundSensor = 0;
  3221. function altPTZCmd( me ){
  3222. var name = me.target.id;
  3223. const myArray = name.split("_");
  3224. Ext.Ajax.request({
  3225. url: '/lib/controller/doCameraOperation.php',
  3226. params: {
  3227. UID: <?=$UserID;?>,
  3228. SID: '<?=$Session;?>',
  3229. CMD: 11,
  3230. CID: myArray[3],
  3231. MOV: myArray[2]
  3232. },
  3233. failure: failureAJAXFunction
  3234. });
  3235. };
  3236. function showCameraPresets( AA, camID ){
  3237. Ext.Ajax.request({
  3238. url: '/lib/controller/getCameraPresets.php',
  3239. params: {
  3240. CID: camID,
  3241. UID: <?=$UserID;?>,
  3242. SID: '<?=$Session;?>',
  3243. },
  3244. success: function( response, opts ){
  3245. var data = Ext.decode(response.responseText);
  3246. var hgy = Ext.getCmp('pres_count');
  3247. if( hgy!= undefined ) hgy.setValue( data.count );
  3248. var hgy = Ext.getCmp('pres_p_seg');
  3249. if( hgy!= undefined ) hgy.setValue( data.pres_cols );
  3250. var hgy = Ext.getCmp('pres_z_seg');
  3251. if( hgy!= undefined ) hgy.setValue( data.pres_rows );
  3252. if( data.special_iron != undefined ){
  3253. var hgy = Ext.getCmp('pres_iron');
  3254. if( hgy!= undefined ) hgy.setValue( data.special_iron );
  3255. var juja = document.getElementById('img_btn_035_'+camID );
  3256. if( juja != undefined ){
  3257. juja.classList.add('ptz_ctrl_btn');
  3258. juja.classList.remove('ptz_ctrl_btn_hdn');
  3259. juja.addEventListener( 'mousedown', altPTZCmd );
  3260. };
  3261. } else {
  3262. var juja = document.getElementById('img_btn_035_'+camID );
  3263. if( juja != undefined ){
  3264. juja.classList.add('ptz_ctrl_btn_hdn');
  3265. juja.classList.remove('ptz_ctrl_btn');
  3266. juja.removeEventListener( 'mousedown', altPTZCmd );
  3267. };
  3268. };
  3269. if( data.special_iroff != undefined ){
  3270. var hgy = Ext.getCmp('pres_iroff');
  3271. if( hgy!= undefined ) hgy.setValue( data.special_iroff );
  3272. var juja = document.getElementById('img_btn_036_'+camID );
  3273. if( juja != undefined ){
  3274. juja.classList.add('ptz_ctrl_btn');
  3275. juja.classList.remove('ptz_ctrl_btn_hdn');
  3276. juja.addEventListener( 'mousedown', altPTZCmd );
  3277. };
  3278. } else {
  3279. var juja = document.getElementById('img_btn_036_'+camID );
  3280. if( juja != undefined ){
  3281. juja.classList.add('ptz_ctrl_btn_hdn');
  3282. juja.classList.remove('ptz_ctrl_btn');
  3283. juja.removeEventListener( 'mousedown', altPTZCmd );
  3284. };
  3285. };
  3286. if( data.special_irauto != undefined ){
  3287. var hgy = Ext.getCmp('pres_irauto');
  3288. if( hgy!= undefined ) hgy.setValue( data.special_irauto );
  3289. };
  3290. if( data.special_wiper != undefined ){
  3291. var hgy = Ext.getCmp('pres_wiper');
  3292. if( hgy!= undefined ) hgy.setValue( data.special_wiper );
  3293. var juja = document.getElementById('img_btn_037_'+camID );
  3294. if( juja != undefined ){
  3295. juja.classList.add('ptz_ctrl_btn');
  3296. juja.classList.remove('ptz_ctrl_btn_hdn');
  3297. juja.addEventListener( 'mousedown', altPTZCmd );
  3298. };
  3299. } else {
  3300. var juja = document.getElementById('img_btn_037_'+camID );
  3301. if( juja != undefined ){
  3302. juja.classList.add('ptz_ctrl_btn_hdn');
  3303. juja.classList.remove('ptz_ctrl_btn');
  3304. juja.removeEventListener( 'mousedown', altPTZCmd );
  3305. };
  3306. };
  3307. var svg = document.getElementById( AA );
  3308. svg.innerHTML = "";
  3309. var centerX = svg.clientWidth / 2.0;
  3310. var centerY = svg.clientHeight / 2.0;
  3311. var radius = svg.clientHeight / 2.0 - (data.pres_rows*2.0);
  3312. var color = ['#F6BB42', '#8CC152', '#3BAFDA', '#967ADC', '#DA4453'];
  3313. var max_lines = data.pres_rows;
  3314. for( var cl = max_lines; cl > 0; cl--){
  3315. var segnum = data.pres_cols * Math.pow( 2, ( cl-1 ) );
  3316. var dta = [];
  3317. for( var j = 0; j< segnum; j++) dta[j]={ value: (180/segnum) };
  3318. var crad = cl * ( radius/(max_lines+1));
  3319. var arr = zdonut(centerX, centerY, crad, dta );
  3320. for (var i = 0; i < arr.length; i++) {
  3321. var item = arr[i];
  3322. var tP = document.createElementNS( 'http://www.w3.org/2000/svg', 'path' );
  3323. tP.setAttribute( 'd', item.d );
  3324. var test = false;
  3325. var ll = [];
  3326. if( data.presets.length ){
  3327. for( var z = 0; z < data.presets.length; z++)
  3328. if( data.presets[z].row == cl && data.presets[z].column == i ){
  3329. ll = data.presets[z];
  3330. test = true;
  3331. break;
  3332. };
  3333. };
  3334. if( test ){
  3335. tP.setAttribute( 'stroke', '#000000' );
  3336. tP.setAttribute( 'class', 'preset_ctrl_btn_a' );
  3337. tP.setAttribute( 'onclick', 'triggerPreset('+camID+','+ll.id+')' );
  3338. tP.setAttribute( 'oncontextmenu', 'removePreset('+camID+','+ll.id+')' );
  3339. } else {
  3340. tP.setAttribute( 'stroke', color[(i+cl)%5] );
  3341. tP.setAttribute( 'class', 'preset_ctrl_btn' );
  3342. tP.setAttribute( 'ondblclick', 'setPreset('+camID+','+i+','+cl+')' );
  3343. };
  3344. tP.setAttribute( 'fill', 'none' );
  3345. tP.setAttribute( 'stroke-width', ( radius/(max_lines+1)) );
  3346. svg.appendChild( tP );
  3347. }
  3348. };
  3349. if( selectedPresetsBackgroundSensor ) preview2DDraw( selectedPresetsBackgroundSensor, 'ptz_presets_');
  3350. },
  3351. failure: failureAJAXFunction
  3352. });
  3353. };
  3354. function triggerPreset( camID, presetID ){
  3355. //alert( "Call Preset["+presetID+"] for camera["+camID+"]" );
  3356. doCamOperation( camID, 30, presetID );
  3357. return false;
  3358. };
  3359. function removePreset( camID, presetID ){
  3360. //alert( "Remove Preset["+presetID+"] for camera["+camID+"]" );
  3361. doCamOperation( camID, 29, presetID );
  3362. window.setTimeout( "showCameraPresets( 'ptz_presets_0', "+camID+" );", 500 );
  3363. return false;
  3364. };
  3365. function setPreset( camID, colID, rowID ){
  3366. //alert( "Set new Preset for camera["+camID+"] x:"+colID+" y:"+rowID );
  3367. doCamOperation( camID, 28, colID+"_"+rowID );
  3368. window.setTimeout( "showCameraPresets( 'ptz_presets_0', "+camID+" );", 500 );
  3369. return false;
  3370. };