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.

3639 lines
102 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
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
​
​
​
​
​
​
​
​
​
​
5 months ago
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months 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
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 months ago
5 months ago
5 months ago
​
​
​
​
​
​
5 months 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. };
  325. var tPanel = Ext.getCmp('flt_ed_small');
  326. tPanel.removeAll( true );
  327. tPanel.add( { html:"<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  328. tPanel.doLayout();
  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('servopPanel00');
  894. tC.removeClass('servopInfo_item00');
  895. tC.addClass('servopInfo_item00');
  896. tC.disable();
  897. Ext.getCmp('tbtn_sop00').disable();
  898. tC = Ext.getCmp('servopPanel01');
  899. tC.removeClass('servopInfo_item01');
  900. tC.addClass('servopInfo_item00');
  901. tC.disable();
  902. Ext.getCmp('tbtn_sop01').disable();
  903. //tC.doLayout();
  904. tC = Ext.getCmp('servopPanel02');
  905. tC.removeClass('servopInfo_item11');
  906. tC.addClass('servopInfo_item10');
  907. tC.disable();
  908. Ext.getCmp('tbtn_sop02').disable();
  909. //tC.doLayout();
  910. tC = Ext.getCmp('servopPanel03');
  911. tC.removeClass('servopInfo_item21');
  912. tC.addClass('servopInfo_item20');
  913. tC.disable();
  914. Ext.getCmp('tbtn_sop03').disable();
  915. //tC.doLayout();
  916. tC = Ext.getCmp('servopPanel04');
  917. tC.removeClass('servopInfo_item31');
  918. tC.addClass('servopInfo_item30');
  919. tC.disable();
  920. Ext.getCmp('tbtn_sop04').disable();
  921. //tC.doLayout();
  922. };
  923. function enableServOps(){
  924. var tC = Ext.getCmp('servopPanel00');
  925. if( tC != undefined ){
  926. tC.removeClass('servopInfo_item00');
  927. tC.addClass('servopInfo_item01');
  928. Ext.getCmp('tbtn_sop00').enable();
  929. tC.enable();
  930. };
  931. tC = Ext.getCmp('servopPanel01');
  932. if( tC != undefined ){
  933. tC.removeClass('servopInfo_item00');
  934. tC.addClass('servopInfo_item01');
  935. Ext.getCmp('tbtn_sop01').enable();
  936. tC.enable();
  937. };
  938. //tC.doLayout();
  939. tC = Ext.getCmp('servopPanel02');
  940. if( tC != undefined ){
  941. tC.removeClass('servopInfo_item10');
  942. tC.addClass('servopInfo_item11');
  943. tC.enable();
  944. Ext.getCmp('tbtn_sop02').enable();
  945. };
  946. //tC.doLayout();
  947. tC = Ext.getCmp('servopPanel03');
  948. if( tC != undefined ){
  949. tC.removeClass('servopInfo_item20');
  950. tC.addClass('servopInfo_item21');
  951. tC.enable();
  952. Ext.getCmp('tbtn_sop03').enable();
  953. };
  954. //tC.doLayout();
  955. tC = Ext.getCmp('servopPanel04');
  956. if( tC != undefined ){
  957. tC.removeClass('servopInfo_item30');
  958. tC.addClass('servopInfo_item31');
  959. tC.enable();
  960. Ext.getCmp('tbtn_sop04').enable();
  961. };
  962. //tC.doLayout();
  963. };
  964. function updateServerStatus(){
  965. Ext.Ajax.request({
  966. url: '/lib/controller/getServerStatus.php',
  967. params: {
  968. SERVID: 1,
  969. UID: <?=$UserID;?>,
  970. SID: '<?=$Session;?>'
  971. },
  972. success: function( response, opts ){
  973. // If the response is JSON, you have to decode it
  974. var sps = document.getElementById("INFO_SPS");
  975. if( sps == undefined ) return;
  976. var data = Ext.decode(response.responseText);
  977. if( data.status == 'ok' ){
  978. serverIsOnLine = true;
  979. enableServOps();
  980. //document.getElementById('HW_NFO').innerHTML = data.stats.hw_info;
  981. //document.getElementById('OS_NFO').innerHTML = data.stats.os_info;
  982. //document.getElementById('BLD_NFO').innerHTML = data.stats.build;
  983. setDonatStatus( 1, 0, data.stats.stat_cpu15 );
  984. setDonatStatus( 1, 1, data.stats.stat_mem );
  985. setDonatStatus( 1, 2, data.stats.stat_disk );
  986. setDonatStatus( 1, 3, data.stats.temp0 );
  987. sps.classList.remove('setEd_infoPanel');
  988. sps.classList.add('setEl_infoPanel');
  989. } else {
  990. serverIsOnLine = false;
  991. disableServOps();
  992. if( data.status == 'na' ){
  993. setDonatStatus( 1, 0, -1 );
  994. setDonatStatus( 1, 1, -1 );
  995. setDonatStatus( 1, 2, -1 );
  996. setDonatStatus( 1, 3, -1 );
  997. sps.classList.remove('setEl_infoPanel');
  998. sps.classList.add('setEd_infoPanel');
  999. } else {
  1000. Ext.Msg.show({
  1001. title: "<?=$Labels->GetLabel("_INFO_MSG_");?>",
  1002. msg: data.messages,
  1003. buttons: Ext.Msg.OK,//YESNOCANCEL,
  1004. fn: function(){
  1005. },
  1006. icon: Ext.MessageBox.INFO //QUESTION
  1007. });
  1008. };
  1009. };
  1010. if( tlInterval == null ){
  1011. tlInterval = window.setInterval( updateServerStatus, 1200, selectedSite );
  1012. };
  1013. },
  1014. failure: failureAJAXFunction
  1015. });
  1016. };
  1017. var addE2UDialog = null;
  1018. function addEthernet2Uart(){
  1019. if( addE2UDialog == null ){
  1020. addE2UDialog = new Ext.Window({
  1021. modal: true,
  1022. title: "<?=$Labels->GetLabel('_ADD_E2U_DIAL_TTL_');?>",
  1023. width: 400,
  1024. height: 560,
  1025. layout: 'fit',
  1026. closeAction: 'hide',
  1027. items:[{
  1028. xtype: 'form',
  1029. labelWidth: 120, // label settings here cascade unless overridden
  1030. frame: false,
  1031. width: 400,
  1032. labelAlign: 'right',
  1033. //bodyStyle:'padding:5px 5px 0',
  1034. defaultType: 'textfield',
  1035. items:[{
  1036. xtype: 'panel',
  1037. height: 200,
  1038. frame: false,
  1039. border: false,
  1040. html: '<center><img width="200px" src="/style/assets/eth2uart.png"></center>'
  1041. },/*{
  1042. fieldLabel: 'Name',
  1043. id: 'ued_name'
  1044. },{
  1045. xtype: 'combo',
  1046. fieldLabel: '<?=$Labels->GetLabel('_CONNECT_2_');?>',
  1047. id: 'ued_servid',
  1048. editable: false,
  1049. typeAhead: true,
  1050. triggerAction: 'all',
  1051. width: '100%',
  1052. lazyRender:true,
  1053. mode: 'local',
  1054. store: new Ext.data.ArrayStore({
  1055. <?php
  1056. $QS = "SELECT `id`, `name` FROM `nodes` WHERE `type`=0";
  1057. $Servers = $DATABASE->Query( $QS );
  1058. $SLIST = array();
  1059. $SSID = 0;
  1060. if( count( $Servers ) ){
  1061. foreach( $Servers as $A ) $SLIST[] = '['.$A['id'].',\''.$A['name'].'\']';
  1062. $SSID = intval( $Servers[0]['id'] );
  1063. };
  1064. //[1,'Server Node'], [2,'Aux Server']
  1065. ?>
  1066. fields: ['sid', 'snam'],
  1067. data: [<?=implode(',',$SLIST);?>]
  1068. }),
  1069. value: <?=$SSID;?>,
  1070. valueField: 'sid',
  1071. displayField: 'snam'
  1072. },*/{
  1073. xtype: 'combo',
  1074. fieldLabel: "<?=$Labels->GetLabel('UART_COM_SPEED');?>",
  1075. id: 'ued_speed',
  1076. editable: false,
  1077. typeAhead: true,
  1078. triggerAction: 'all',
  1079. width: '100%',
  1080. lazyRender:true,
  1081. mode: 'local',
  1082. store: new Ext.data.ArrayStore({
  1083. fields: ['speed'],
  1084. data: [[19200], [115200]]
  1085. }),
  1086. value: 19200,
  1087. valueField: 'speed',
  1088. displayField: 'speed'
  1089. },{
  1090. xtype: 'combo',
  1091. fieldLabel: "<?=$Labels->GetLabel('UART_COM_BITS');?>",
  1092. id: 'ued_bit',
  1093. editable: false,
  1094. typeAhead: true,
  1095. triggerAction: 'all',
  1096. width: '100%',
  1097. lazyRender:true,
  1098. mode: 'local',
  1099. store: new Ext.data.ArrayStore({
  1100. fields: ['bits'],
  1101. data: [[5],[6],[7],[8],[9]]
  1102. }),
  1103. value: 8,
  1104. valueField: 'bits',
  1105. displayField: 'bits'
  1106. },{
  1107. xtype: 'combo',
  1108. fieldLabel: "<?=$Labels->GetLabel('UART_COM_SBITS');?>",
  1109. id: 'ued_stops',
  1110. editable: false,
  1111. typeAhead: true,
  1112. triggerAction: 'all',
  1113. width: '100%',
  1114. lazyRender:true,
  1115. mode: 'local',
  1116. store: new Ext.data.ArrayStore({
  1117. fields: ['stops'],
  1118. data: [[1],[1.5],[2]]
  1119. }),
  1120. value: 1,
  1121. valueField: 'stops',
  1122. displayField: 'stops'
  1123. },{
  1124. xtype: 'combo',
  1125. fieldLabel: "<?=$Labels->GetLabel('UART_COM_PARITY');?>",
  1126. id: 'ued_parity',
  1127. editable: false,
  1128. typeAhead: true,
  1129. triggerAction: 'all',
  1130. width: '100%',
  1131. lazyRender:true,
  1132. mode: 'local',
  1133. store: new Ext.data.ArrayStore({
  1134. fields: ['parity'],
  1135. data: [['Odd'], ['Even'],['None']]
  1136. }),
  1137. value: 'None',
  1138. valueField: 'parity',
  1139. displayField: 'parity'
  1140. },{
  1141. xtype: 'combo',
  1142. fieldLabel: "<?=$Labels->GetLabel('_WORKING_MODE_');?>",
  1143. id: 'ued_mode',
  1144. editable: false,
  1145. typeAhead: true,
  1146. triggerAction: 'all',
  1147. width: '100%',
  1148. lazyRender:true,
  1149. mode: 'local',
  1150. store: new Ext.data.ArrayStore({
  1151. fields: ['mode','mode_txt'],
  1152. data: [[0,"<?=$Labels->GetLabel('_UDP_CLIENT_');?>"], [1,"<?=$Labels->GetLabel('_TCP_CLIENT_');?>"], [2,"<?=$Labels->GetLabel('_UDP_SERVER_');?>"], [3,"<?=$Labels->GetLabel('_TCP_SERVER_');?>"]]
  1153. }),
  1154. value: 3,
  1155. valueField: 'mode',
  1156. displayField: 'mode_txt'
  1157. },{
  1158. fieldLabel: "<?=$Labels->GetLabel('_DEVICE_IP_');?>",
  1159. id: 'ued_ip'
  1160. },{
  1161. fieldLabel: "<?=$Labels->GetLabel('_DEVICE_PORT_');?>",
  1162. value: 8234,
  1163. id: 'ued_port'
  1164. }],
  1165. bbar: [{
  1166. text: 'Cancel',
  1167. handler: function(){//discoverOnvifSources
  1168. addE2UDialog.hide();
  1169. }
  1170. },'->',{
  1171. id: 'con_to_src',
  1172. text: 'Add Adapter to Site',
  1173. disabled: false,
  1174. handler: function(){
  1175. var SPD = Ext.getCmp('ued_speed').getValue();
  1176. var BIT = Ext.getCmp('ued_bit').getValue();
  1177. var STP = Ext.getCmp('ued_stops').getValue();
  1178. var PAR = Ext.getCmp('ued_parity').getValue();
  1179. var MOD = Ext.getCmp('ued_mode').getValue();
  1180. var IP = Ext.getCmp('ued_ip').getValue();
  1181. var PORT= Ext.getCmp('ued_port').getValue();
  1182. var MAC = '';//Ext.getCmp('ued_mac').getValue();
  1183. //var NAME= Ext.getCmp('ued_name').getValue();
  1184. //var SRV = Ext.getCmp('ued_servid').getValue();
  1185. Ext.Ajax.request({
  1186. url: '/lib/controller/addNode.php',
  1187. params: {
  1188. TYPE: 20,
  1189. UART_SPEED: SPD,
  1190. UART_BITS: BIT,
  1191. UART_STOP: STP,
  1192. UART_PAR: PAR,
  1193. UART_MODE: MOD,
  1194. UART_IP: IP,
  1195. UART_PORT: PORT,
  1196. UART_MAC: MAC,
  1197. //UART_NAME: NAME,
  1198. UID: <?=$UserID;?>,
  1199. //SRVID: SRV,
  1200. SID: '<?=$Session;?>'
  1201. },
  1202. success: function( response, opts ){
  1203. var data = Ext.decode(response.responseText);
  1204. if( data.sucess == false ){
  1205. Ext.Msg.show({
  1206. title:'Request Failure!',
  1207. msg: data.error,
  1208. buttons: Ext.Msg.OK,
  1209. icon: Ext.MessageBox.INFO
  1210. });
  1211. } else {
  1212. loadRessources();
  1213. };
  1214. addE2UDialog.hide();
  1215. },
  1216. failure: function( response, opts ) {
  1217. failureAJAXFunction( response, opts );
  1218. addE2UDialog.hide();
  1219. }
  1220. });
  1221. }
  1222. }]
  1223. }]
  1224. });
  1225. };
  1226. addE2UDialog.show();
  1227. };
  1228. var addSensorDialog = null;
  1229. var addSensWM = null;
  1230. function addSensor(){
  1231. if( addSensorDialog == null ){
  1232. addSensorDialog = new Ext.Window({
  1233. modal: true,
  1234. title: '<?=$Labels->GetLabel('_SMM_ADD_LSEN_');?>',
  1235. width: 500,
  1236. height: 438,
  1237. layout: 'form',
  1238. closeAction: 'hide',
  1239. labelWidth: 160,
  1240. labelAlign: 'right',
  1241. items:[{
  1242. xtype: 'panel',
  1243. frame: false,
  1244. border: false,
  1245. 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>'
  1246. },{
  1247. xtype: 'spacer',
  1248. height: 8
  1249. },{
  1250. xtype: 'combo',
  1251. id: 'sens_type',
  1252. fieldLabel: "<?=$Labels->GetLabel('SENS_TYPE');?>",
  1253. lazyRender: true,
  1254. mode: 'local',
  1255. forceSelection: true,
  1256. triggerAction: 'all',
  1257. editable: false,
  1258. disableKeyFilter: true,
  1259. store: new Ext.data.ArrayStore({
  1260. fields: ['mode','mode_txt'],
  1261. data: [
  1262. [1,"ALS <?=$Labels->GetLabel('_SENSOR_');?>"],
  1263. [2,"LFS <?=$Labels->GetLabel('_SENSOR_');?>"],
  1264. [3,"PLS 200 <?=$Labels->GetLabel('_SENSOR_');?>"],
  1265. [4,"PLS 360 <?=$Labels->GetLabel('_SENSOR_');?>"],
  1266. [5,"3D <?=$Labels->GetLabel('_SENSOR_');?>"]
  1267. ]
  1268. }),
  1269. valueField: 'mode',
  1270. displayField: 'mode_txt',
  1271. value: 1,
  1272. width: 200,
  1273. listeners:{
  1274. select: function( a, v, c ){
  1275. var ii = document.getElementById( 'asd_img_div' );
  1276. ii.className = "node_"+(c+1)+"_img_set";
  1277. if( c == 4 ){
  1278. Ext.getCmp('sens_id').hide();
  1279. Ext.getCmp('uart_id').hide();
  1280. Ext.getCmp('sens_port').show();
  1281. Ext.getCmp('sens_ip').show();
  1282. } else {
  1283. Ext.getCmp('sens_id').show();
  1284. Ext.getCmp('uart_id').show();
  1285. Ext.getCmp('sens_port').hide();
  1286. Ext.getCmp('sens_ip').hide();
  1287. };
  1288. }
  1289. }
  1290. },{
  1291. xtype: 'combo',
  1292. id: 'sens_range',
  1293. fieldLabel: "<?=$Labels->GetLabel('SENS_RANGE');?>",
  1294. lazyRender: true,
  1295. mode: 'local',
  1296. forceSelection: true,
  1297. triggerAction: 'all',
  1298. editable: false,
  1299. disableKeyFilter: true,
  1300. store: new Ext.data.ArrayStore({
  1301. fields: ['range','range_txt'],
  1302. data: [
  1303. [15,"15 <?=$Labels->GetLabel('_METERS_RANGE_');?>"],
  1304. [35,"35 <?=$Labels->GetLabel('_METERS_RANGE_');?>"],
  1305. [65,"65 <?=$Labels->GetLabel('_METERS_RANGE_');?>"],
  1306. [75,"75 <?=$Labels->GetLabel('_METERS_RANGE_');?>"],
  1307. [150,"150 <?=$Labels->GetLabel('_METERS_RANGE_');?>"],
  1308. [200,"200 <?=$Labels->GetLabel('_METERS_RANGE_');?>"],
  1309. [300,"300 <?=$Labels->GetLabel('_METERS_RANGE_');?>"],
  1310. [350,"350 <?=$Labels->GetLabel('_METERS_RANGE_');?>"]
  1311. ]
  1312. }),
  1313. valueField: 'range',
  1314. displayField: 'range_txt',
  1315. value: 15,
  1316. width: 200
  1317. },{
  1318. xtype: 'numberfield',
  1319. id: 'sens_id',
  1320. fieldLabel: "<?=$Labels->GetLabel('_PROTO_DEVICE_ID_');?>",
  1321. width: 200,
  1322. value: 0
  1323. },{
  1324. xtype: 'combo',
  1325. fieldLabel: "<?=$Labels->GetLabel('_UART_PORT_');?>",
  1326. lazyRender: true,
  1327. id: 'uart_id',
  1328. mode: 'local',
  1329. disabled: false,
  1330. forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true,
  1331. store: new Ext.data.ArrayStore({
  1332. fields: ['uart','uart_txt'],
  1333. data: [<?php
  1334. $QS="SELECT aux_id, device FROM resources WHERE ( type=1 OR type=129 )";
  1335. $RR=$DATABASE->Query( $QS );
  1336. if( count( $RR ) ){
  1337. $RE=array();
  1338. foreach( $RR as $R ){
  1339. $RE[] = "[ {$R['aux_id']}, '{$R['device']}']";
  1340. };
  1341. echo implode( ',', $RE );
  1342. } else {
  1343. echo "[0, \"".$Labels->GetLabel('_NO_UARTS_DEF_')."\"]";
  1344. };
  1345. ?>]
  1346. }),
  1347. valueField: 'uart',
  1348. displayField: 'uart_txt',
  1349. width: 200
  1350. },{
  1351. xtype: 'textfield',
  1352. id: 'sens_ip',
  1353. hidden: true,
  1354. fieldLabel: "<?=$Labels->GetLabel('_DEVICE_IP_');?>",
  1355. width: 200,
  1356. value: '192.168.200.105'
  1357. },{
  1358. xtype: 'numberfield',
  1359. id: 'sens_port',
  1360. hidden: true,
  1361. fieldLabel: "<?=$Labels->GetLabel('_DEVICE_PORT_');?>",
  1362. width: 200,
  1363. value: 2222
  1364. },{
  1365. xtype:'button',
  1366. width: '100%',
  1367. text: "<?=$Labels->GetLabel('_ADD_');?>",
  1368. handler: function(){
  1369. var TYP = parseInt( Ext.getCmp('sens_type').getValue() );
  1370. var RAN = parseInt( Ext.getCmp('sens_range').getValue() );
  1371. if( TYP > 4 ){
  1372. var RIP = Ext.getCmp('sens_ip').getValue();
  1373. var RPP = parseInt( Ext.getCmp('sens_port').getValue() );
  1374. addSensWM = new Ext.LoadMask( addSensorDialog.getEl(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."});
  1375. addSensWM.show();
  1376. Ext.Ajax.request({
  1377. url: '/lib/controller/doNodeOperation.php',
  1378. params: {
  1379. UID: <?=$UserID;?>,
  1380. SID: '<?=$Session;?>',
  1381. TYPE: TYP,
  1382. RANGE: RAN,
  1383. ADDR: RIP,
  1384. PORT: RPP,
  1385. CCMD: 1
  1386. },
  1387. success: function( response, opts ){
  1388. addSensWM.hide();
  1389. var data = Ext.decode(response.responseText);
  1390. if( data.status == 'ok' ){
  1391. loadAttachedSensors();
  1392. } else {
  1393. Ext.Msg.show({
  1394. title:'Error!',
  1395. msg: data.msg,
  1396. buttons: Ext.Msg.OK,
  1397. icon: Ext.MessageBox.WARNING
  1398. });
  1399. };
  1400. addSensorDialog.hide();
  1401. },
  1402. failure: failureAJAXFunction
  1403. });
  1404. } else {
  1405. var RTI = parseInt( Ext.getCmp('uart_id').getValue() );
  1406. if( RTI > 0 ){
  1407. var PID = parseInt( Ext.getCmp('sens_id').getValue() );
  1408. addSensWM = new Ext.LoadMask( addSensorDialog.getEl(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."});
  1409. addSensWM.show();
  1410. Ext.Ajax.request({
  1411. url: '/lib/controller/doNodeOperation.php',
  1412. params: {
  1413. UID: <?=$UserID;?>,
  1414. SID: '<?=$Session;?>',
  1415. TYPE: TYP,
  1416. DEVID: PID,
  1417. UART: RTI,
  1418. RANGE: RAN,
  1419. CCMD: 1
  1420. },
  1421. success: function( response, opts ){
  1422. addSensWM.hide();
  1423. var data = Ext.decode(response.responseText);
  1424. if( data.status == 'ok' ){
  1425. loadAttachedSensors();
  1426. } else {
  1427. Ext.Msg.show({
  1428. title:'Error!',
  1429. msg: data.msg,
  1430. buttons: Ext.Msg.OK,
  1431. icon: Ext.MessageBox.WARNING
  1432. });
  1433. };
  1434. addSensorDialog.hide();
  1435. },
  1436. failure: failureAJAXFunction
  1437. });
  1438. } else {
  1439. Ext.Msg.show({
  1440. title:'Error!',
  1441. msg: 'Please Choose UART Port',
  1442. buttons: Ext.Msg.OK,
  1443. icon: Ext.MessageBox.WARNING
  1444. });
  1445. };
  1446. };
  1447. }
  1448. }]
  1449. });
  1450. };
  1451. addSensorDialog.show();
  1452. };
  1453. var addDetCamDialog = null;
  1454. var addDetACamDialog = null;
  1455. var addDetCamWM = null;
  1456. function addDetectedAnalogCam(){
  1457. if( addDetACamDialog == null ){
  1458. addDetACamDialog = new Ext.Window({
  1459. modal: true,
  1460. title: '<?=$Labels->GetLabel('_ANAL_SOURCES_LST_');?>',
  1461. width: 800,
  1462. height: 600,
  1463. layout: 'fit',
  1464. closeAction: 'hide',
  1465. items:[{
  1466. xtype: 'grid',
  1467. frame: false,
  1468. border: false,
  1469. ds: cameraListStore,
  1470. cm: AnalogCameraListColModel,
  1471. sm: AnalogCameraListSelModel,
  1472. viewConfig: {
  1473. forceFit: true
  1474. }
  1475. }],
  1476. bbar: [{
  1477. text: '<?=$Labels->GetLabel('_CANCEL_');?>',
  1478. handler: function(){
  1479. addDetACamDialog.hide();
  1480. }
  1481. },'->',{
  1482. id: 'cha_an_strim_set',
  1483. text: '<?=$Labels->GetLabel('_SETTINGS_');?>',
  1484. disabled: ( SelectedSource == 0 ),
  1485. handler: function(){
  1486. editAnalogStream( SelectedSource );
  1487. }
  1488. },{
  1489. id: 'con_to_anal_src',
  1490. text: '<?=$Labels->GetLabel('_CONNECT_2_SEL_');?>',
  1491. disabled: ( SelectedSource == 0 ),
  1492. handler: function(){
  1493. //alert( 'Cam Type:'+SelectedCamTYPE );
  1494. showAnalCamPropDialog();
  1495. }
  1496. }]
  1497. });
  1498. };
  1499. addDetACamDialog.show();
  1500. cameraListStore.load({params:{cam_sources:'anal'}});
  1501. };
  1502. function addDetectedIPCam(){
  1503. if( addDetCamDialog == null ){
  1504. addDetCamDialog = new Ext.Window({
  1505. modal: true,
  1506. title: "<?=$Labels->GetLabel('_ADD_CAM_DIAL_TTL_');?>",
  1507. width: 400,
  1508. height: 287,
  1509. layout: 'form',
  1510. closeAction: 'hide',
  1511. labelWidth: 160,
  1512. labelAlign: 'right',
  1513. items:[{
  1514. xtype: 'spacer',
  1515. height: 8
  1516. },{
  1517. xtype: 'textfield',
  1518. id: 'ncam_ip',
  1519. fieldLabel: "<?=$Labels->GetLabel('_CAM_IP_ADDRESS_');?>",
  1520. value: ''
  1521. },{
  1522. xtype: 'numberfield',
  1523. id: 'ncam_port',
  1524. fieldLabel: "<?=$Labels->GetLabel('_DEVICE_PORT_');?>",
  1525. value: 'default'
  1526. },{
  1527. xtype: 'combo',
  1528. id: 'ncam_protocol',
  1529. fieldLabel: "<?=$Labels->GetLabel('_CTL_PROTOCOL_');?>",
  1530. lazyRender: true,
  1531. mode: 'local',
  1532. forceSelection: true,
  1533. triggerAction: 'all',
  1534. editable: false,
  1535. disableKeyFilter: true,
  1536. store: new Ext.data.ArrayStore({
  1537. fields: ['mode','mode_txt'],
  1538. data: [
  1539. [0,'OnVif'],
  1540. [1,'BOSCH RCP+ over CGI']
  1541. ]
  1542. }),
  1543. valueField: 'mode',
  1544. displayField: 'mode_txt',
  1545. value: 0,
  1546. width: 200
  1547. },{
  1548. xtype: 'textfield',
  1549. id: 'ncam_user',
  1550. fieldLabel: "<?=$Labels->GetLabel('_ACCESS_LOGIN_');?>",
  1551. value: ''
  1552. },{
  1553. xtype: 'textfield',
  1554. id: 'ncam_pwd',
  1555. inputType: 'password',
  1556. fieldLabel: "<?=$Labels->GetLabel('_ACCESS_PASSWORD_');?>",
  1557. value: ''
  1558. },{
  1559. xtype: 'combo',
  1560. id: 'ncam_auth_mode',
  1561. fieldLabel: "<?=$Labels->GetLabel('_AUTH_MODE_0_');?>",
  1562. lazyRender: true,
  1563. mode: 'local',
  1564. forceSelection: true,
  1565. triggerAction: 'all',
  1566. editable: false,
  1567. disableKeyFilter: true,
  1568. store: new Ext.data.ArrayStore({
  1569. fields: ['mode','mode_txt'],
  1570. data: [
  1571. [0,'BASIC'],
  1572. [1,'DIGEST'],
  1573. [2,'DIGEST_IE'],
  1574. [3,'BEARER'],
  1575. [4,'NEGOTIATE'],
  1576. [5,'NTLM'],
  1577. [6,'NTLM_WB'],
  1578. [7,'ANY'],
  1579. [8,'ANYSAFE'],
  1580. [9,'ONLY'],
  1581. [10,'AWS_SIGV4']
  1582. ]
  1583. }),
  1584. valueField: 'mode',
  1585. displayField: 'mode_txt',
  1586. value: 0,
  1587. width: 200
  1588. },{
  1589. xtype: 'spacer',
  1590. height: 8
  1591. },{
  1592. xtype:'button',
  1593. width: '100%',
  1594. text: 'Add Camera to List',
  1595. handler: function(){
  1596. addDetCamWM = new Ext.LoadMask( addDetCamDialog.getEl(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."});
  1597. addDetCamWM.show();
  1598. var NIP = Ext.getCmp('ncam_ip').getValue();
  1599. var NUU = Ext.getCmp('ncam_user').getValue();
  1600. var NPP = Ext.getCmp('ncam_pwd').getValue();
  1601. var NCP = Ext.getCmp('ncam_port').getValue();
  1602. var NPA = Ext.getCmp('ncam_protocol').getValue();
  1603. var NAM = Ext.getCmp('ncam_auth_mode').getValue();
  1604. Ext.Ajax.request({
  1605. url: '/lib/controller/doCameraOperation.php',
  1606. params: {
  1607. UID: <?=$UserID;?>,
  1608. SID: '<?=$Session;?>',
  1609. IP: NIP,
  1610. UU: NUU,
  1611. PP: NPP,
  1612. AU: NAM,
  1613. PO: NCP,
  1614. PR: NPA,
  1615. CMD: 3
  1616. },
  1617. success: function( response, opts ){
  1618. addDetCamWM.hide();
  1619. var data = Ext.decode(response.responseText);
  1620. if( data.status == 'ok' ){
  1621. loadDetectedCameras();
  1622. } else {
  1623. Ext.Msg.show({
  1624. title:'Error!',
  1625. msg: data.msg,
  1626. buttons: Ext.Msg.OK,
  1627. icon: Ext.MessageBox.WARNING
  1628. });
  1629. };
  1630. addDetCamDialog.hide();
  1631. },
  1632. failure: failureAJAXFunction
  1633. });
  1634. }
  1635. }]
  1636. });
  1637. };
  1638. addDetCamDialog.show();
  1639. };
  1640. var settingsSelectedDevice = 0;
  1641. function fetchDeviceStatus(){
  1642. if( tlInterval!= null ){
  1643. window.clearTimeout( tlInterval );
  1644. tlInterval = null;
  1645. };
  1646. Ext.Ajax.request({
  1647. url: '/lib/controller/getStatus.php',
  1648. params: {
  1649. SITE: <?=$SiteID;?>,
  1650. LNID: lastNotificationID,
  1651. SPID: StatusTS,
  1652. LSID: log_store_id, //LoadTS,
  1653. DEVID: settingsSelectedDevice,
  1654. UID: <?=$UserID;?>,
  1655. SID: '<?=$Session;?>'
  1656. },
  1657. success: function( response, opts ){
  1658. var data = Ext.decode(response.responseText);
  1659. StatusTS = data.CTS;
  1660. if( data.nodes.length > 0 ){
  1661. for( i=0; i < data.nodes.length; i++ ){
  1662. switch( data.nodes[i].type ){
  1663. case 1:
  1664. case 2:
  1665. case 3:
  1666. case 4:{ // 2D
  1667. if( data.nodes[i].status ){
  1668. if( data.nodes[i].reload_draw ) {
  1669. load2DDraw( data.nodes[i].id );
  1670. LoadTS = StatusTS;
  1671. };
  1672. if( data.nodes[i].targets != undefined ){
  1673. if( data.nodes[i].targets.length ){
  1674. targets_2d[data.nodes[i].id]=[];
  1675. for( idx = 0; idx < data.nodes[i].targets.length; idx++)
  1676. targets_2d[data.nodes[i].id][idx]={ range: data.nodes[i].targets[idx].digital, az: data.nodes[i].targets[idx].az, color: data.nodes[i].targets[idx].color, stroke: data.nodes[i].targets[idx].stroke };
  1677. draw2DTargets( data.nodes[i].id );
  1678. } else cleanup2DDraw( data.nodes[i].id );
  1679. } else cleanup2DDraw( data.nodes[i].id );
  1680. };
  1681. if( data.nodes[i].bubbles !== undefined ){
  1682. if( data.nodes[i].bubbles.length ){
  1683. bubbles_2d[data.nodes[i].id]=[];
  1684. for( idx = 0; idx < data.nodes[i].bubbles.length; idx++)
  1685. bubbles_2d[data.nodes[i].id][idx]={ range: data.nodes[i].bubbles[idx].digital, az: data.nodes[i].bubbles[idx].az, color: data.nodes[i].bubbles[idx].color, stroke: data.nodes[i].bubbles[idx].stroke };
  1686. draw2DBubbles( data.nodes[i].id );
  1687. } else cleanup2DBubbles( data.nodes[i].id );
  1688. } else cleanup2DBubbles( data.nodes[i].id );
  1689. setStatus2D( data.nodes[i].id, data.nodes[i].status, data.nodes[i].masks_exist, data.nodes[i].masks_status );
  1690. break;
  1691. };
  1692. case 5:{ // 3d
  1693. if( data.nodes[i].reload_draw ){
  1694. reload3dTexture( data.nodes[i].id );
  1695. };
  1696. if( data.nodes[i].targets != undefined ){
  1697. if( data.nodes[i].targets.length ){
  1698. draw3DTargets( data.nodes[i].id, data.nodes[i].targets );
  1699. animateTargets();
  1700. } else {
  1701. cleanup3DDraw( data.nodes[i].id );
  1702. animate();
  1703. };
  1704. } else {
  1705. cleanup3DDraw( data.nodes[i].id );
  1706. animate();
  1707. };
  1708. setStatus2D( data.nodes[i].id, data.nodes[i].status, data.nodes[i].masks_exist, data.nodes[i].masks_status );
  1709. break;
  1710. };
  1711. case 10:
  1712. case 11:
  1713. case 12:
  1714. case 13:
  1715. case 14:
  1716. case 15:{// Cameras
  1717. var iel = document.getElementById('img-img-'+data.nodes[i].id );
  1718. if( iel != null ){
  1719. if( data.nodes[i].status == 0 ){
  1720. if( iel.src != "/style/assets/no-signal.png" ) iel.src = "/style/assets/no-signal.png";
  1721. } else {
  1722. if( data.nodes[i].src != iel.src ) iel.src = data.nodes[i].src;
  1723. };
  1724. };
  1725. break;
  1726. };
  1727. };
  1728. };
  1729. };
  1730. tlInterval = window.setTimeout( fetchDeviceStatus, 333, selectedSite );
  1731. },
  1732. failure: failureAJAXFunction
  1733. });
  1734. };
  1735. var devUploadTimeout = null;
  1736. var devUploadID = -1;
  1737. function fetchDeviceUploadStatus(){
  1738. clearTimeout( devUploadTimeout );
  1739. if( devUploadID < 1 ) return;
  1740. Ext.Ajax.request({
  1741. url: '/lib/controller/getDeviceUploadStatus.php',
  1742. params: {
  1743. UID: <?=$UserID;?>,
  1744. SID: '<?=$Session;?>',
  1745. DID: devUploadID
  1746. },
  1747. success: function( response, opts ){
  1748. var data = Ext.decode(response.responseText);
  1749. var tT = Ext.getCmp('upp_ttext');
  1750. if( tT != undefined ){
  1751. if( data.count > 0 ){
  1752. devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 );
  1753. };
  1754. if( data.current != undefined ){
  1755. tT.update('<p class="UPTTEXT">Uploading '+data.count+' file(s)</p>');
  1756. document.getElementById('upp_ctext').innerHTML ='<p class="UPCTEXT">Current File: '+data.current+'</p>';
  1757. Ext.getCmp('upp_pbar').updateProgress( data.progress, Math.round( data.progress*100 )+'%', true );
  1758. devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 );
  1759. } else {
  1760. Ext.getCmp('upload_progres_panel').hide();
  1761. Ext.getCmp('uploaded_grid').show();
  1762. loadModuleFiles( devUploadID );
  1763. };
  1764. };
  1765. },
  1766. failure: failureAJAXFunction
  1767. });
  1768. };
  1769. function downloadSettings(){
  1770. ReportMask = new Ext.LoadMask(Ext.getBody(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."});
  1771. ReportMask.show();
  1772. const formData = new FormData();
  1773. formData.append("UID",<?=$UserID;?>);
  1774. formData.append("SID",'<?=$Session;?>');
  1775. fetch('/lib/controller/downloadSettings.php',{
  1776. method: "POST",
  1777. body: formData
  1778. })
  1779. .then(resp => resp.blob())
  1780. .then(blob => {
  1781. const url = window.URL.createObjectURL(blob);
  1782. const a = document.createElement('a');
  1783. a.style.display = 'none';
  1784. a.href = url;
  1785. var today=new Date();
  1786. var SY=1900+today.getYear();
  1787. var SMO=today.getMonth()+1;
  1788. var SD=today.getDate();
  1789. var SH = today.getHours();
  1790. var SM = today.getMinutes();
  1791. var SS = today.getSeconds();
  1792. a.download = 'backup_'+SY+'.'+SMO+'.'+SD+'_'+SH+'-'+SM+'-'+SS+'.db';
  1793. document.body.appendChild(a);
  1794. a.click();
  1795. window.URL.revokeObjectURL(url);
  1796. ReportMask.hide();
  1797. Ext.Msg.show({
  1798. title:'<?=$Labels->GetLabel('_SUCCESS_');?>',
  1799. msg: '<?=$Labels->GetLabel('_DB_FILE_HAS_DOWNLOADED_');?>',
  1800. buttons: Ext.Msg.OK,
  1801. icon: Ext.MessageBox.INFO
  1802. });
  1803. })
  1804. .catch(() => {
  1805. ReportMask.hide();
  1806. Ext.Msg.show({
  1807. title:'<?=$Labels->GetLabel('_REQ_FAILURE_');?>',
  1808. msg: '<?=$Labels->GetLabel('_AJX_REQFAILURE_');?>',
  1809. buttons: Ext.Msg.OK,
  1810. icon: Ext.MessageBox.ERROR
  1811. });
  1812. });
  1813. };
  1814. function showSettingsGeneral(){
  1815. stopStatusUpdater();
  1816. content_lvl1 = 1;
  1817. content_lvl2 = 0;
  1818. var tPanel = Ext.getCmp('main_content');
  1819. tPanel.removeAll( true );
  1820. <?php
  1821. //$QS="SELECT * FROM `servers` WHERE `id`=1";
  1822. //$SDD = $DATABASE->Query( $QS );
  1823. //$NData = $SDD[0];
  1824. $QS="SELECT * FROM `resources` WHERE `node_id`=1 AND ( `type`=101 OR `type`=102 )";
  1825. $CN = $DATABASE->Query( $QS );
  1826. $IL=array();
  1827. foreach( $CN as $N ){
  1828. $QS="SELECT * FROM `networks` WHERE `nif_id`={$N['aux_id']} AND `type`=0";
  1829. $NWD = $DATABASE->Query( $QS );
  1830. $NW = $NWD[0];
  1831. $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>";
  1832. };
  1833. $NIFO = '<table><tr>' . implode( '</tr><tr>', $IL ) . '</tr></table>';
  1834. ?>
  1835. tPanel.add({
  1836. xtype: 'tabpanel',
  1837. frame: false,
  1838. id: 'node_settings_content',
  1839. border: false,
  1840. activeTab: content_lvl3,
  1841. items: [{
  1842. xtype: 'panel',
  1843. id: 'gi_tab',
  1844. title: "<?=$Labels->GetLabel( '_GENERAL_NFO_' );?>",
  1845. layout: 'hbox',
  1846. items:[{
  1847. xtype: 'panel',
  1848. flex: 1,
  1849. height: PanelH-15,
  1850. autoScroll: false,
  1851. html: '<table width="100%" height="100%" border=0><tr><td height="290px" align="center" valign="middle"><div class="server_img_set"></div></td></tr>\
  1852. <tr><td height="100px"><table width="100%" border=0><tr>\
  1853. <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>\
  1854. <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>\
  1855. <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>\
  1856. <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>\
  1857. </tr></table></td></tr>\
  1858. <tr><td valign="top"><div class="setEd_infoPanel" id="INFO_SPS">\
  1859. <div class="sideInfo_item" id="SW_INFO"><?=$AP_DATA['build'];?></div>\
  1860. <div class="sideInfo_item" id="OS_INFO"><?=$AP_DATA['os_info'];?></div>\
  1861. <div class="sideInfo_item" id="HW_INFO"><?=$AP_DATA['hw_info'];?></div>\
  1862. </div></td></tr>\
  1863. <tr><td height="60%">&nbsp;</td></tr></table>'
  1864. },{
  1865. xtype: 'panel',
  1866. id: '_ed_small',
  1867. flex: 1,
  1868. height: PanelH-15,
  1869. autoScroll: false,
  1870. items:[{
  1871. xtype: 'panel',
  1872. baseCls:'servopInfo_item01',
  1873. id: 'servopPanel00',
  1874. items:[{
  1875. xtype: 'panel',
  1876. frame: false,
  1877. border: false,
  1878. unstyled: true,
  1879. html: "<p><?=$Labels->GetLabel('_SENS_ALL_RESTART_DESC_');?></p><br/>"
  1880. },{
  1881. xtype: 'button',
  1882. lazyRender: true,
  1883. iconCls: 'srv_op_restart',
  1884. text: "<?=$Labels->GetLabel('_SENS_ALL_RESTART_OP_');?>",
  1885. id: 'tbtn_sop00',
  1886. scale: 'large',
  1887. width: '95%',
  1888. disabled: true,
  1889. handler: function( bt ){
  1890. Ext.Msg.show({
  1891. title:"<?=$Labels->GetLabel('_SENS_ALL_RESTART_QT_');?>",
  1892. msg: "<?=$Labels->GetLabel('_SENS_ALL_RESTART_QM_');?>",
  1893. buttons: Ext.Msg.YESNO,
  1894. width: 400,
  1895. icon: Ext.MessageBox.INFO,
  1896. fn: function(btn, text){
  1897. if( btn == 'yes' ){
  1898. disableServOps();
  1899. doDeviceOperation( 1, 213,'', true );
  1900. };
  1901. }
  1902. });
  1903. }
  1904. }]
  1905. },{
  1906. xtype: 'spacer',
  1907. height: 8
  1908. }
  1909. <?php if( $CUser->Data['access'] > 3 ){ ?>
  1910. ,{
  1911. xtype: 'panel',
  1912. baseCls:'servopInfo_item00',
  1913. id: 'servopPanel01',
  1914. items:[{
  1915. xtype: 'panel',
  1916. frame: false,
  1917. border: false,
  1918. unstyled: true,
  1919. html: "<p><?=$Labels->GetLabel('_SERV_RESTART_DESC_');?></p><br/>"
  1920. },{
  1921. xtype: 'button',
  1922. lazyRender: true,
  1923. iconCls: 'srv_op_restart',
  1924. text: "<?=$Labels->GetLabel('_SERV_RESTART_OP_');?>",
  1925. id: 'tbtn_sop01',
  1926. scale: 'large',
  1927. width: '95%',
  1928. disabled: true,
  1929. handler: function( bt ){
  1930. Ext.Msg.show({
  1931. title:"<?=$Labels->GetLabel('_SERV_RESTART_QT_');?>",
  1932. msg: "<?=$Labels->GetLabel('_SERV_RESTART_QM_');?>",
  1933. buttons: Ext.Msg.YESNO,
  1934. width: 400,
  1935. icon: Ext.MessageBox.INFO,
  1936. fn: function(btn, text){
  1937. if( btn == 'yes' ){
  1938. disableServOps();
  1939. doDeviceOperation( 1, 250,'', true );
  1940. };
  1941. }
  1942. });
  1943. }
  1944. }]
  1945. },{
  1946. xtype: 'spacer',
  1947. height: 8
  1948. }
  1949. <?php if( $CUser->Data['access'] > 4 ){ ?>
  1950. ,{
  1951. xtype: 'panel',
  1952. baseCls:'servopInfo_item10',
  1953. id: 'servopPanel02',
  1954. items:[{
  1955. xtype: 'panel',
  1956. frame: false,
  1957. border: false,
  1958. unstyled: true,
  1959. html: "<p><?=$Labels->GetLabel('_SERV_HW_DET_DESC_');?></p><br/>"
  1960. },{
  1961. xtype: 'button',
  1962. iconCls: 'srv_op_hw_init',
  1963. text: "<?=$Labels->GetLabel('_SERV_HW_DET_OP_');?>",
  1964. id: 'tbtn_sop02',
  1965. scale: 'large',
  1966. width: '95%',
  1967. disabled: true,
  1968. handler: function( bt ){
  1969. Ext.Msg.show({
  1970. title:"<?=$Labels->GetLabel('_SERV_HW_DET_QT_');?>",
  1971. msg: "<?=$Labels->GetLabel('_SERV_HW_DET_QM_');?>",
  1972. buttons: Ext.Msg.YESNO,
  1973. width: 400,
  1974. icon: Ext.MessageBox.INFO,
  1975. fn: function(btn, text){
  1976. if( btn == 'yes' ){
  1977. disableServOps();
  1978. doDeviceOperation( 1, 251,'', true );
  1979. };
  1980. }
  1981. });
  1982. }
  1983. }]
  1984. },{
  1985. xtype: 'spacer',
  1986. height: 8
  1987. }
  1988. <?php if( $CUser->Data['access'] > 5 ){ ?>
  1989. ,{
  1990. xtype: 'panel',
  1991. baseCls:'servopInfo_item20',
  1992. id: 'servopPanel03',
  1993. items:[{
  1994. xtype: 'panel',
  1995. frame: false,
  1996. border: false,
  1997. unstyled: true,
  1998. html: "<p><?=$Labels->GetLabel('_SERV_OSRESET_DESC_');?></p><br/>"
  1999. },{
  2000. xtype: 'button',
  2001. iconCls: 'srv_op_power_cycle',
  2002. text: "<?=$Labels->GetLabel('_SERV_OSRESET_OP_');?>",
  2003. id: 'tbtn_sop03',
  2004. scale: 'large',
  2005. width: '95%',
  2006. disabled: true,
  2007. handler: function( bt ){
  2008. Ext.Msg.show({
  2009. title: "<?=$Labels->GetLabel('_SERV_OSRESET_QT_');?>",
  2010. msg: "<?=$Labels->GetLabel('_SERV_OSRESET_QM_');?>",
  2011. buttons: Ext.Msg.YESNO,
  2012. width: 400,
  2013. icon: Ext.MessageBox.WARNING,
  2014. fn: function(btn, text){
  2015. if( btn == 'yes' ){
  2016. cleanupChangeNotifier();
  2017. } else {
  2018. loadEditor = false;
  2019. };
  2020. }
  2021. });
  2022. }
  2023. }]
  2024. },{
  2025. xtype: 'spacer',
  2026. height: 8
  2027. },{
  2028. xtype: 'panel',
  2029. baseCls:'servopInfo_item30',
  2030. id: 'servopPanel04',
  2031. items:[{
  2032. xtype: 'panel',
  2033. frame: false,
  2034. border: false,
  2035. unstyled: true,
  2036. html: "<p><?=$Labels->GetLabel('_SERV_FACTORY_DESC_');?></p><br/>"
  2037. },{
  2038. xtype: 'button',
  2039. iconCls: 'srv_op_factory_reset',
  2040. text: "<?=$Labels->GetLabel('_SERV_FACTORY_OP_');?>",
  2041. id: 'tbtn_sop04',
  2042. scale: 'large',
  2043. width: '95%',
  2044. disabled: true,
  2045. handler: function( bt ){
  2046. Ext.Msg.show({
  2047. title: "<?=$Labels->GetLabel('_SERV_FACTORY_QT_');?>",
  2048. msg: "<?=$Labels->GetLabel('_SERV_FACTORY_QM_');?>",
  2049. buttons: Ext.Msg.YESNO,
  2050. width: 400,
  2051. icon: Ext.MessageBox.ERROR,
  2052. fn: function(btn, text){
  2053. if( btn == 'yes' ){
  2054. disableServOps();
  2055. doDeviceOperation( 1, 254,'', true );
  2056. };
  2057. }
  2058. });
  2059. }
  2060. }]
  2061. }
  2062. <?php
  2063. };
  2064. };
  2065. }; ?>
  2066. ]
  2067. }]
  2068. }
  2069. <?php if( $CUser->Data['access'] > 4 ){ ?>
  2070. ,{
  2071. xtype: 'panel',
  2072. title: "<?=$Labels->GetLabel( '_RESOURCES_' );?>",
  2073. id: 'res_tab',
  2074. layout: 'hbox',
  2075. items:[{
  2076. xtype: 'panel',
  2077. id: 'resources_container',
  2078. flex: 1,
  2079. height: PanelH-15,
  2080. autoScroll: 'auto',
  2081. tbar:[{
  2082. text: "<?=$Labels->GetLabel( '_ADD_REMOTE_UART_' );?>",
  2083. handler: function(){
  2084. addEthernet2Uart();
  2085. }
  2086. }],
  2087. items:[]
  2088. },{
  2089. xtype: 'panel',
  2090. id: 'res_ed_small',
  2091. flex: 1,
  2092. height: PanelH-15,
  2093. layout: 'fit',
  2094. items:[{
  2095. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  2096. }]
  2097. }]
  2098. },{
  2099. xtype: 'panel',
  2100. title: "<?=$Labels->GetLabel( '_SERVER_MODULES_' );?>",
  2101. id: 'mod_tab',
  2102. layout: 'hbox',
  2103. items:[{
  2104. xtype: 'panel',
  2105. id: 'modules_container',
  2106. flex: 1,
  2107. height: PanelH-15,
  2108. autoScroll: 'auto',
  2109. tbar:[{
  2110. text: "<?=$Labels->GetLabel( '_ADD_MODULE_' );?>",
  2111. handler: function(){
  2112. var addModuleWindow = new Ext.Window({
  2113. id: 'huha_boa',
  2114. title: "<?=$Labels->GetLabel( '_AS_MODULE_' );?>",
  2115. modal: true,
  2116. width: 400,
  2117. height: 300,
  2118. items:[{
  2119. xtype: 'form',
  2120. items: [{
  2121. xtype: 'combo',
  2122. fieldLabel: "<?=$Labels->GetLabel( 'MOD_TYPE' );?>",
  2123. id: 'mod_type',
  2124. lazyRender: true,
  2125. mode: 'local',
  2126. forceSelection: true,
  2127. triggerAction: 'all',
  2128. editable: false,
  2129. disableKeyFilter: true,
  2130. store: new Ext.data.ArrayStore({
  2131. fields: ['az_t','az_txt'],
  2132. data: [<?php
  2133. $QS = "SELECT * FROM `module_types`";
  2134. $MM = $DATABASE->Query( $QS );
  2135. $MIMO = array();
  2136. foreach( $MM as $M ) $MIMO[]="[{$M['id']},\"".$Labels->GetLabel($M['name'])."\"]";
  2137. echo implode( ',', $MIMO );
  2138. ?>]
  2139. }),
  2140. valueField: 'az_t',
  2141. displayField: 'az_txt',
  2142. value: 1,
  2143. listeners:{
  2144. select: function( t, r, i ){
  2145. var n = r.data.az_t;
  2146. Ext.Ajax.request({
  2147. url: '/lib/controller/getModuleInfo.php',
  2148. params: {
  2149. MID: n,
  2150. UID: <?=$UserID;?>,
  2151. SID: '<?=$Session;?>'
  2152. },
  2153. success: function( response, opts ){
  2154. Ext.getCmp('infopan').update( response.responseText );
  2155. }
  2156. });
  2157. }
  2158. }
  2159. },{
  2160. xtype: 'panel',
  2161. id: 'infopan',
  2162. html: ''
  2163. }]
  2164. }],
  2165. bbar:[{
  2166. text: '<?=$Labels->GetLabel( '_CANCEL_' );?>',
  2167. handler: function(){
  2168. addModuleWindow.close();
  2169. }
  2170. },{
  2171. text: '<?=$Labels->GetLabel( '_ADD_' );?>',
  2172. handler: function(){
  2173. var mtyp = Ext.getCmp('mod_type').getValue();
  2174. Ext.Ajax.request({
  2175. url: '/lib/controller/addModule.php',
  2176. params: {
  2177. SERVID: 1,
  2178. TYPE: mtyp,
  2179. UID: <?=$UserID;?>,
  2180. SID: '<?=$Session;?>'
  2181. },
  2182. success: function( response, opts ){
  2183. // If the response is JSON, you have to decode it
  2184. var data = Ext.decode(response.responseText);
  2185. if( data.status == 'ok' ){
  2186. addModuleWindow.close();
  2187. loadModules();
  2188. } else {
  2189. Ext.Msg.show({
  2190. title: "<?=$Labels->GetLabel("_INFO_MSG_");?>",
  2191. msg: data.message,
  2192. buttons: Ext.Msg.OK,//YESNOCANCEL,
  2193. fn: function(){
  2194. //SettingsLidar3D.hide();
  2195. },
  2196. icon: Ext.MessageBox.INFO //QUESTION
  2197. });
  2198. }
  2199. },
  2200. failure: failureAJAXFunction
  2201. });
  2202. }
  2203. }]
  2204. });
  2205. addModuleWindow.show();
  2206. }
  2207. }],
  2208. items:[]
  2209. },{
  2210. xtype: 'panel',
  2211. id: 'mod_ed_small',
  2212. flex: 1,
  2213. height: PanelH-15,
  2214. layout: 'fit',
  2215. items:[{
  2216. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  2217. }]
  2218. }]
  2219. },{
  2220. xtype: 'panel',
  2221. title: "<?=$Labels->GetLabel( '_TARGET_FILTERS_' );?>",
  2222. id: 'flt_tab',
  2223. layout: 'hbox',
  2224. items:[{
  2225. xtype: 'panel',
  2226. id: 'filters_container',
  2227. flex: 1,
  2228. height: PanelH-15,
  2229. autoScroll: 'auto',
  2230. tbar:[{
  2231. text: "<?=$Labels->GetLabel( '_ADD_FILTER_' );?>",
  2232. handler: function(){
  2233. var addFilterWindow = new Ext.Window({
  2234. id: 'fulu_boa',
  2235. title: "<?=$Labels->GetLabel( '_ADD_EVT_FILTER_' );?>",
  2236. modal: true,
  2237. width: 400,
  2238. height: 300,
  2239. items:[{
  2240. xtype: 'form',
  2241. items: [{
  2242. xtype: 'combo',
  2243. fieldLabel: "<?=$Labels->GetLabel( 'MOD_TYPE' );?>",
  2244. id: 'flt_type',
  2245. lazyRender: true,
  2246. mode: 'local',
  2247. forceSelection: true,
  2248. triggerAction: 'all',
  2249. editable: false,
  2250. disableKeyFilter: true,
  2251. store: new Ext.data.ArrayStore({
  2252. fields: ['az_t','az_txt'],
  2253. data: [<?php
  2254. $QS="SELECT `id`,`name` FROM `target_filter_types`";
  2255. $JIJI=$DATABASE->Query( $QS );
  2256. $OOP = array();
  2257. foreach( $JIJI as $JI ) $OOP[] = "[{$JI['id']},'".$Labels->getLabel($JI['name'])."']";
  2258. echo implode(',', $OOP );
  2259. ?>]
  2260. }),
  2261. valueField: 'az_t',
  2262. displayField: 'az_txt',
  2263. value: 1,
  2264. listeners:{
  2265. select: function( t, r, i ){
  2266. var n = r.data.az_t;
  2267. Ext.Ajax.request({
  2268. url: '/lib/controller/getFilterInfo.php',
  2269. params: {
  2270. FID: n,
  2271. UID: <?=$UserID;?>,
  2272. SID: '<?=$Session;?>'
  2273. },
  2274. success: function( response, opts ){
  2275. Ext.getCmp('filt_infopan').update( response.responseText );
  2276. }
  2277. });
  2278. }
  2279. }
  2280. },{
  2281. xtype: 'panel',
  2282. id: 'filt_infopan',
  2283. html: ''
  2284. }]
  2285. }],
  2286. bbar:[{
  2287. text: "<?=$Labels->GetLabel( '_CANCEL_' );?>",
  2288. handler: function(){
  2289. addFilterWindow.close();
  2290. }
  2291. },{
  2292. text: "<?=$Labels->GetLabel( '_ADD_' );?>",
  2293. handler: function(){
  2294. var mtyp = Ext.getCmp('flt_type').getValue();
  2295. Ext.Ajax.request({
  2296. url: '/lib/controller/addFilter.php',
  2297. params: {
  2298. SERVID: 1,
  2299. TYPE: mtyp,
  2300. UID: <?=$UserID;?>,
  2301. SID: '<?=$Session;?>'
  2302. },
  2303. success: function( response, opts ){
  2304. // If the response is JSON, you have to decode it
  2305. var data = Ext.decode(response.responseText);
  2306. if( data.status == 'ok' ){
  2307. addFilterWindow.close();
  2308. loadFilters();
  2309. } else {
  2310. Ext.Msg.show({
  2311. title: "<?=$Labels->GetLabel("_INFO_MSG_");?>",
  2312. msg: data.message,
  2313. buttons: Ext.Msg.OK,//YESNOCANCEL,
  2314. fn: function(){
  2315. //SettingsLidar3D.hide();
  2316. },
  2317. icon: Ext.MessageBox.INFO //QUESTION
  2318. });
  2319. }
  2320. },
  2321. failure: failureAJAXFunction
  2322. });
  2323. }
  2324. }]
  2325. });
  2326. addFilterWindow.show();
  2327. Ext.Ajax.request({
  2328. url: '/lib/controller/getFilterInfo.php',
  2329. params: {
  2330. FID: 1,
  2331. UID: <?=$UserID;?>,
  2332. SID: '<?=$Session;?>'
  2333. },
  2334. success: function( response, opts ){
  2335. Ext.getCmp('filt_infopan').update( response.responseText );
  2336. }
  2337. });
  2338. }
  2339. }],
  2340. items:[]
  2341. },{
  2342. xtype: 'panel',
  2343. id: 'flt_ed_small',
  2344. flex: 1,
  2345. height: PanelH-15,
  2346. layout: 'fit',
  2347. items:[{
  2348. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  2349. }]
  2350. }]
  2351. }
  2352. <?php }; ?>
  2353. ],
  2354. listeners:{
  2355. tabchange: function( tp, t ){
  2356. switch( t.getId() ){
  2357. case 'gi_tab': {
  2358. //content_lvl3=0;
  2359. updateServerStatus();
  2360. break;
  2361. };
  2362. case 'res_tab': {
  2363. //content_lvl3=1;
  2364. stopStatusUpdater();
  2365. loadRessources();
  2366. break;
  2367. };
  2368. case 'mod_tab':{
  2369. //content_lvl3=2;
  2370. stopStatusUpdater();
  2371. loadModules();
  2372. break;
  2373. };
  2374. case 'flt_tab':{
  2375. //content_lvl3=3;
  2376. stopStatusUpdater();
  2377. loadFilters();
  2378. break;
  2379. };
  2380. };
  2381. //updateUserContent();
  2382. },
  2383. afterrender: function(){
  2384. settingsAreChanged = false;
  2385. }
  2386. },
  2387. updateSettings: function(){
  2388. alert('Update Settings');
  2389. }
  2390. });
  2391. tPanel.doLayout();
  2392. updateServerStatus();
  2393. };
  2394. function showSettingsSensors(){
  2395. stopStatusUpdater();
  2396. content_lvl1 = 1;
  2397. content_lvl2 = 4;
  2398. var tPanel = Ext.getCmp('main_content');
  2399. tPanel.removeAll( true );
  2400. tPanel.add({
  2401. xtype: 'panel',
  2402. id: 'sen_set',
  2403. layout: 'hbox',
  2404. tbar:[{
  2405. text: "<?=$Labels->GetLabel( '_SMM_ADD_LSEN_' );?>",
  2406. handler: function(){
  2407. addSensor();
  2408. }
  2409. }],
  2410. items:[{
  2411. xtype: 'panel',
  2412. id: 'sens_container',
  2413. flex: 1,
  2414. height: PanelH-15,
  2415. autoScroll: 'auto',
  2416. items:[]
  2417. },{
  2418. xtype: 'panel',
  2419. id: 'sens_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. tPanel.doLayout();
  2429. loadAttachedSensors();
  2430. };
  2431. function showSettingsDetection(){
  2432. stopStatusUpdater();
  2433. content_lvl1 = 1;
  2434. content_lvl2 = 4;
  2435. var tPanel = Ext.getCmp('main_content');
  2436. tPanel.removeAll( true );
  2437. tPanel.add({
  2438. xtype: 'panel',
  2439. id: 'sen_set',
  2440. layout: 'hbox',
  2441. tbar:[{
  2442. text: "<?=$Labels->GetLabel( '_SMM_ADD_LSEN_' );?>",
  2443. handler: function(){
  2444. addSensor();
  2445. }
  2446. }],
  2447. items:[{
  2448. xtype: 'panel',
  2449. id: 'sens_container',
  2450. flex: 1,
  2451. height: PanelH-15,
  2452. autoScroll: 'auto',
  2453. items:[]
  2454. },{
  2455. xtype: 'panel',
  2456. id: 'sens_op_small',
  2457. flex: 1,
  2458. height: PanelH-15,
  2459. layout: 'fit',
  2460. items:[{
  2461. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  2462. }]
  2463. }]
  2464. });
  2465. tPanel.doLayout();
  2466. loadAttachedSensors();
  2467. };
  2468. function editSensorHW( cid ){
  2469. SelectedSensor = cid;
  2470. Ext.Ajax.request({
  2471. url: '/lib/controller/getSensorEditor.php',
  2472. params: {
  2473. CID: SelectedSensor,
  2474. UID: <?=$UserID;?>,
  2475. SID: '<?=$Session;?>'
  2476. },
  2477. success: function( response, opts ){
  2478. var data = Ext.decode( response.responseText );
  2479. var tComp = Ext.getCmp('sens_op_small');
  2480. if( data.status == 'ok' ){
  2481. if( tComp!= null ){
  2482. var content = Ext.decode( data.content );
  2483. tComp.removeAll( true );
  2484. tComp.add( content );
  2485. tComp.doLayout();
  2486. };
  2487. } else {
  2488. if( tComp!= null ){
  2489. tComp.removeAll( true );
  2490. tComp.add( data );
  2491. tComp.doLayout();
  2492. };
  2493. };
  2494. },
  2495. failure: function(){
  2496. }
  2497. });
  2498. };
  2499. var cameraEditorContent = null;
  2500. function editCamera( cid, etyp ){
  2501. SelectedCam = cid;
  2502. switch( etyp ){
  2503. case 0: cameraEditorContent = Ext.getCmp('dcam_op_small'); break;
  2504. case 1: cameraEditorContent = Ext.getCmp('acam_op_small'); break;
  2505. };
  2506. Ext.Ajax.request({
  2507. url: '/lib/controller/getCameraEditor.php',
  2508. params: {
  2509. CID: SelectedCam,
  2510. UID: <?=$UserID;?>,
  2511. SID: '<?=$Session;?>'
  2512. },
  2513. success: function( response, opts ){
  2514. var data = Ext.decode( response.responseText );
  2515. if( data.status == 'ok' ){
  2516. if( cameraEditorContent!= null ){
  2517. var content = Ext.decode( data.content );
  2518. cameraEditorContent.removeAll( true );
  2519. cameraEditorContent.add( content );
  2520. cameraEditorContent.doLayout();
  2521. };
  2522. } else {
  2523. if( cameraEditorContent!= null ){
  2524. cameraEditorContent.removeAll( true );
  2525. cameraEditorContent.add( data );
  2526. cameraEditorContent.doLayout();
  2527. };
  2528. };
  2529. },
  2530. failure: function(){
  2531. }
  2532. });
  2533. };
  2534. function showSettingsVideo(){
  2535. stopStatusUpdater();
  2536. content_lvl1 = 1;
  2537. content_lvl2 = 4;
  2538. content_lvl3 = 0;
  2539. var tPanel = Ext.getCmp('main_content');
  2540. tPanel.removeAll( true );
  2541. tPanel.add({
  2542. xtype: 'tabpanel',
  2543. frame: false,
  2544. id: 'node_settings_content',
  2545. border: false,
  2546. activeTab: content_lvl3,
  2547. items: [{
  2548. xtype: 'panel',
  2549. id: 'cam_ass_tab',
  2550. title: "<?=$Labels->GetLabel('_CAM_ASS_LIST_');?>",
  2551. layout: 'hbox',
  2552. items:[{
  2553. xtype: 'panel',
  2554. id: 'acam_container',
  2555. flex: 1,
  2556. height: PanelH-15,
  2557. autoScroll: 'auto',
  2558. items:[]
  2559. },{
  2560. xtype: 'panel',
  2561. id: 'acam_op_small',
  2562. flex: 1,
  2563. height: PanelH-15,
  2564. layout: 'fit',
  2565. items:[{
  2566. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  2567. }]
  2568. }]
  2569. },{
  2570. xtype: 'panel',
  2571. title: "<?=$Labels->GetLabel('_CAM_DET_LIST_');?>",
  2572. id: 'cam_det_tab',
  2573. layout: 'hbox',
  2574. items:[{
  2575. xtype: 'panel',
  2576. id: 'dcam_container',
  2577. flex: 1,
  2578. height: PanelH-15,
  2579. autoScroll: 'auto',
  2580. tbar:[{
  2581. text: "<?=$Labels->GetLabel( '_MANUADD_CAMERA_' );?>",
  2582. handler: function(){
  2583. addDetectedIPCam();
  2584. }
  2585. },{
  2586. text: "<?=$Labels->GetLabel( '_MANUADD_ACAMERA_' );?>",
  2587. handler: function(){
  2588. addDetectedAnalogCam();
  2589. }
  2590. }],
  2591. items:[]
  2592. },{
  2593. xtype: 'panel',
  2594. id: 'dcam_op_small',
  2595. flex: 1,
  2596. height: PanelH-15,
  2597. layout: 'fit',
  2598. items:[{
  2599. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  2600. }]
  2601. }]
  2602. }],
  2603. listeners:{
  2604. tabchange: function( tp, t ){
  2605. switch( t.getId() ){
  2606. case 'cam_det_tab': {
  2607. content_lvl3=0;
  2608. stopStatusUpdater();
  2609. loadDetectedCameras();
  2610. break;
  2611. };
  2612. case 'cam_ass_tab': {
  2613. content_lvl3=1;
  2614. stopStatusUpdater();
  2615. loadAssignedCameras();
  2616. break;
  2617. };
  2618. case 'mod_tab':{
  2619. content_lvl3=2;
  2620. stopStatusUpdater();
  2621. loadModules();
  2622. break;
  2623. };
  2624. case 'net_tab':{
  2625. content_lvl3=3;
  2626. stopStatusUpdater();
  2627. break;
  2628. };
  2629. };
  2630. updateUserContent();
  2631. },
  2632. afterrender: function(){
  2633. settingsAreChanged = false;
  2634. }
  2635. }
  2636. });
  2637. tPanel.doLayout();
  2638. updateUserContent();
  2639. updateServerStatus();
  2640. };
  2641. function showSettingsApplication( ap_sid ){
  2642. stopStatusUpdater();
  2643. content_lvl1 = 1;
  2644. content_lvl2 = 3;
  2645. <?php if( $AP_DATA['type']!=1){ ?>
  2646. //Load Location
  2647. prepareMapData();
  2648. <?php };?>
  2649. if( ap_sid == undefined ) ap_sid = 0;
  2650. content_lvl3 = ap_sid;
  2651. var tPanel = Ext.getCmp('main_content');
  2652. tPanel.removeAll( true );
  2653. tPanel.add({
  2654. xtype: 'tabpanel',
  2655. frame: false,
  2656. id: 'settings_a_content',
  2657. border: false,
  2658. activeTab: 'aps_tab_'+content_lvl3,
  2659. items:[{
  2660. title: "<?=$Labels->GetLabel('_WORKING_MODE_');?>",
  2661. xtype: 'form',
  2662. id: 'aps_tab_0',
  2663. labelAlign: 'right',
  2664. labelWidth: 250,
  2665. height: PanelH - 30,
  2666. items:[]
  2667. },
  2668. <?php if( $AP_DATA['type']!=1){ ?>
  2669. {
  2670. title: "<?=$Labels->GetLabel('_GEO_LOCATION_');?>",
  2671. layout: 'column',
  2672. id: 'aps_tab_1',
  2673. items:[]
  2674. },
  2675. <?php };?>{
  2676. title: "<?=$Labels->GetLabel('_BACKUP_SETTINGS_');?>",
  2677. xtype: 'form',
  2678. id: 'aps_tab_2',
  2679. fileUpload: true,
  2680. labelAlign: 'right',
  2681. labelWidth: 180,
  2682. height: PanelH - 30,
  2683. items:[{
  2684. xtype: 'spacer',
  2685. height: 10
  2686. },{
  2687. xtype: 'button',
  2688. text: "<?=$Labels->GetLabel( '_DOWNLOAD_SETTINGS_' );?>",
  2689. width: 500,
  2690. handler: downloadSettings
  2691. },{
  2692. xtype: 'spacer',
  2693. height: 10
  2694. },{
  2695. xtype: 'fileuploadfield',
  2696. id: 'db_file',
  2697. emptyText: "<?=$Labels->GetLabel('_DB_BACKUP_');?>",
  2698. fieldLabel: "<?=$Labels->GetLabel('_SELE_DBBACKUP_');?>",
  2699. width: 300,
  2700. name: 'db_file',
  2701. buttonText: "<?=$Labels->GetLabel('_BROWSE_');?>"
  2702. },{
  2703. xtype: 'spacer',
  2704. height: 10
  2705. },{
  2706. xtype: 'button',
  2707. text: "<?=$Labels->GetLabel( '_APLY_DBBACKUP_' );?>",
  2708. width: 500,
  2709. handler: function(){
  2710. if( Ext.getCmp('as_dbbackup').getForm().isValid()){
  2711. Ext.getCmp('as_dbbackup').getForm().submit({
  2712. url: '/lib/controller/doDatabaseOperation.php',
  2713. waitMsg: "<?=$Labels->GetLabel('_DB_UPLOAD_BACKUP_');?>...",
  2714. encoding: 'multipart/form-data',
  2715. success: function(fp, o){
  2716. }
  2717. });
  2718. };
  2719. }
  2720. },{
  2721. xtype: 'spacer',
  2722. height: 10
  2723. }<?php
  2724. if( file_exists( '../../controller/data/factory.db' ) ){
  2725. ?>,{
  2726. xtype: 'button',
  2727. text: "<?=$Labels->GetLabel( '_FACTORY_RESET_' );?>",
  2728. width: 500,
  2729. handler: function(){
  2730. doDeviceOperation( 1, 254, '', true );
  2731. }
  2732. }<?php
  2733. };
  2734. ?>]
  2735. },{
  2736. title: "<?=$Labels->GetLabel('_REPORT_STORAGE_');?>",
  2737. xtype: 'form',
  2738. id: 'aps_tab_3',
  2739. labelAlign: 'right',
  2740. labelWidth: 180,
  2741. height: PanelH - 30,
  2742. items:[{
  2743. xtype: 'spacer',
  2744. height: 10
  2745. },{
  2746. xtype: 'numberfield',
  2747. id: 'stor_days',
  2748. fieldLabel: "<?=$Labels->GetLabel('_STORE_DAYS_');?>",
  2749. width: 300,
  2750. value: <?=intval($AP_DATA['report_cleanup']);?>,
  2751. name: 'stor_time',
  2752. listeners: {
  2753. change: function( t, b, o ){
  2754. doApplicationOperation( 4, b );
  2755. }
  2756. }
  2757. },{
  2758. xtype: 'spacer',
  2759. height: 10
  2760. },{
  2761. xtype: 'slider',
  2762. id: 'stor_space',
  2763. fieldLabel: "<?=$Labels->GetLabel('_STORE_EMPTY_SPACE_');?>",
  2764. value: <?=intval($AP_DATA['preserve_empty']);?>,
  2765. width: 300,
  2766. name: 'stor_space',
  2767. listeners: {
  2768. change: function( t, b, o ){
  2769. doApplicationOperation( 5, b );
  2770. }
  2771. }
  2772. },{
  2773. xtype: 'spacer',
  2774. height: 10
  2775. },{
  2776. xtype: 'button',
  2777. text: "<?=$Labels->GetLabel( '_APPLY_SETTINGS_' );?>",
  2778. width: 500,
  2779. handler: function(){
  2780. doDeviceOperation( 1, 250, '', true );
  2781. }
  2782. },{
  2783. xtype: 'spacer',
  2784. height: 10
  2785. }]
  2786. },{
  2787. title: "<?=$Labels->GetLabel('_MULTI_LAYOUT_');?>",
  2788. xtype: 'form',
  2789. id: 'aps_tab_4',
  2790. labelAlign: 'right',
  2791. labelWidth: 180,
  2792. height: PanelH - 30,
  2793. items:[]
  2794. }],
  2795. listeners:{
  2796. tabchange: function( tp, t ){
  2797. switch( t.getId() ){
  2798. case 'aps_tab_0': content_lvl3 = 0; break;
  2799. case 'aps_tab_1': content_lvl3 = 1; break;
  2800. case 'aps_tab_2': content_lvl3 = 2; break;
  2801. case 'aps_tab_3': content_lvl3 = 3; break;
  2802. case 'aps_tab_4': content_lvl3 = 4; break;
  2803. case 'aps_tab_5': content_lvl3 = 5; break;
  2804. };
  2805. loadApplicationSettings( content_lvl3 );
  2806. updateUserContent();
  2807. },
  2808. afterrender: function(){
  2809. //settingsAreChanged = false;
  2810. }
  2811. }
  2812. });
  2813. tPanel.doLayout();
  2814. loadApplicationSettings( content_lvl3 );
  2815. //updateUserContent();
  2816. };
  2817. function showMultyLayoutEditor(){
  2818. alert('KAKA');
  2819. };
  2820. function showSettingsUpgrade(){
  2821. stopStatusUpdater();
  2822. content_lvl1 = 1;
  2823. content_lvl2 = 4;
  2824. var tPanel = Ext.getCmp('main_content');
  2825. tPanel.removeAll( true );
  2826. initial_md5 = '';
  2827. tPanel.add({
  2828. columnWidth: 1.0,
  2829. frame: false,
  2830. border: false,
  2831. items: [{
  2832. frame: false,
  2833. border: false,
  2834. collapsible: false,
  2835. draggable: false,
  2836. layout: 'vbox',
  2837. //layoutConfig: {
  2838. // align : 'stretch',
  2839. // pack : 'start',
  2840. //},
  2841. height: PanelH,
  2842. items:[{
  2843. title: "<?=$Labels->getLabel('_MAP_MONITORING_');?>",
  2844. xtype: 'panel',
  2845. height: PanelH-300,
  2846. //flex: 1,
  2847. frame: true,
  2848. width: '100%',
  2849. border: false,
  2850. layout: {
  2851. type: 'table',
  2852. columns: 2,
  2853. tableAttrs: {
  2854. valign: 'top',
  2855. style: 'valign:top;width:100%;'
  2856. }
  2857. },
  2858. defaults: {
  2859. frame: true,
  2860. border: false,
  2861. height: ( PanelH-400 ) / 2,
  2862. style: 'margin: 5px;width:400px;display:block;'
  2863. },
  2864. items:[{
  2865. title: 'Current System Info',
  2866. width: '100%',
  2867. //flex: 1,
  2868. html: '<p>Current Web Version:&nbsp;<b><?=$ARGUS_WEB_VERSION;?></b></p>'
  2869. },{
  2870. title: 'Tasks',
  2871. //width: 400,
  2872. layout: 'vbox',
  2873. items:[{
  2874. xtype: 'button',
  2875. width: '100%',
  2876. text: 'Create Database Backup',
  2877. handler: function(){
  2878. createNewTask( 2 );
  2879. }
  2880. },{
  2881. xtype: 'button',
  2882. width: '100%',
  2883. text: 'Create Full Snapeshot',
  2884. handler: function(){
  2885. createNewTask( 255 );
  2886. }
  2887. }]
  2888. },{
  2889. title: 'Archives',
  2890. height: 250,
  2891. width: '100%',
  2892. tbar:[{
  2893. text: 'Restore',
  2894. id: 'ar_restore_btn',
  2895. handler: function(){
  2896. createNewTask(1, selectedArchiveRecord.data.file_name );
  2897. }
  2898. },{
  2899. text: 'Download',
  2900. id: 'ar_download_btn',
  2901. handler: function(){
  2902. if( selectedArchiveRecord!= null ){
  2903. window.open( '/lib/php/setup_toolkit/vault/'+selectedArchiveRecord.data.base_version + '/'+ selectedArchiveRecord.data.file_name );
  2904. };
  2905. }
  2906. },{
  2907. text: 'Delete',
  2908. id: 'ar_delete_btn',
  2909. handler: function(){
  2910. createNewTask(100, selectedArchiveRecord.data.file_name );
  2911. }
  2912. }],
  2913. items:[{
  2914. xtype: 'grid',
  2915. id: 'archives_grid',
  2916. border: false,
  2917. frame: false,
  2918. autoScroll: true,
  2919. //width: '100%',
  2920. lazyRender: true,
  2921. height: 210,
  2922. ds: archives_store,
  2923. cm: new Ext.grid.ColumnModel( archivesColModel_ops ),
  2924. sm: new Ext.grid.RowSelectionModel( archivesSelModel_ops ),
  2925. viewConfig: {
  2926. // forceFit: true
  2927. },
  2928. }]
  2929. },{
  2930. title: 'Task Status',
  2931. height: 250,
  2932. //flex: 1,
  2933. items:[{
  2934. xtype: 'spacer',
  2935. height: 4
  2936. },{
  2937. id: 'ctask_status',
  2938. border: true,
  2939. html: ''
  2940. },{
  2941. xtype: 'spacer',
  2942. height: 4
  2943. },{
  2944. xtype: 'textarea',
  2945. id: 'task_log',
  2946. height: ( PanelH-320 ) / 2 - 120,
  2947. style: 'font-size:9px;width:100%;margin-bottom:4px;',
  2948. readOnly: true,
  2949. autoScroll: true,
  2950. value: ''
  2951. },{
  2952. xtype: 'progress',
  2953. id: 'task_progress',
  2954. value: 1.0,
  2955. text: 'idle',
  2956. disabled: true
  2957. }],
  2958. tbar:[{
  2959. text: 'Cancel Task',
  2960. id: 'ch_ta_btn',
  2961. disabled: true,
  2962. handler: deleteNewTask
  2963. }]
  2964. }]
  2965. },{
  2966. title: '<?=$Labels->getLabel('_UPLOAD_PACKAGE_');?>',
  2967. xtype: 'panel',
  2968. height: 300,
  2969. //flex: 1,
  2970. frame: true,
  2971. border: false,
  2972. //layout: 'vbox',
  2973. items:[{
  2974. xtype:'button',
  2975. id: 'pickfiles',
  2976. width: '100%',
  2977. text: 'Choose File'
  2978. },{
  2979. height: 200,
  2980. xtype: 'grid',
  2981. id: 'upload_grid',
  2982. border: false,
  2983. frame: false,
  2984. mode: 'local',
  2985. lazyRender: true,
  2986. width: '100%',
  2987. autoScroll: true,
  2988. ds: uploads_store,
  2989. cm: new Ext.grid.ColumnModel( fileUploadsColModel_ops ),
  2990. sm: new Ext.grid.RowSelectionModel( fileUploadsSelModel_ops ),
  2991. viewConfig: {
  2992. forceFit: true
  2993. },
  2994. bbar: [{
  2995. text: 'Clear',
  2996. width: '100%',
  2997. handler: function(){
  2998. muploader.splice();
  2999. uploads_store.removeAll();
  3000. }
  3001. }]
  3002. },{
  3003. xtype:'button',
  3004. id: 'umpalumpa',
  3005. width: '100%',
  3006. disabled: true,
  3007. text: 'Upload',
  3008. handler: function(){
  3009. if( muploader!= null ){
  3010. muploader.start();
  3011. };
  3012. }
  3013. }],
  3014. listeners:{
  3015. afterrender: function(){
  3016. muploader = new plupload.Uploader({
  3017. runtimes : 'html5,html4',
  3018. browse_button : Ext.getDom('pickfiles'), // you can pass in id...
  3019. //container: document.getElementById('upupu'), // ... or DOM Element itself
  3020. max_file_size : '1000mb',
  3021. chunk_size: '200kb',
  3022. max_retries: 3,
  3023. multi_selection: false,
  3024. max_file_count: 1,
  3025. // Fake server response here
  3026. url: '/lib/php/setup_toolkit/upload.php',
  3027. //url: "/echo/json",
  3028. //flash_swf_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/flash/Moxie.cdn.swf',
  3029. //silverlight_xap_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/silverlight/Moxie.cdn.xap',
  3030. filters : [
  3031. //{title : "Image files", extensions : "jpg,gif,png"},
  3032. {title : "Archive files", extensions : "rar,zip,gz,bz2"}
  3033. ],
  3034. init: {
  3035. PostInit: function() {
  3036. //$('filelist').innerHTML = '';
  3037. //$('uploadfiles').onclick = function() {
  3038. // uploader.start();
  3039. // return false;
  3040. //};
  3041. },
  3042. FilesAdded: function( up, files ) {
  3043. Ext.getCmp('umpalumpa').enable();
  3044. plupload.each( files, function(file) {
  3045. uploads_store.loadData( [[ uploads_store_id, file.name, file.id, plupload.formatSize( file.size ), 0, 'N' ]], true );
  3046. uploads_store_id++;
  3047. Ext.getCmp('upload_grid').doLayout();
  3048. });
  3049. },
  3050. UploadProgress: function(up, file) {
  3051. var pb = Ext.getCmp( 'progress_'+file.id );
  3052. if( file.percent < 100 ){
  3053. pb.updateProgress( file.percent / 100, file.percent + '%', false );
  3054. } else {
  3055. pb.updateProgress( 1.0, 'Uploaded', false );
  3056. };
  3057. },
  3058. Error: function(up, err) {
  3059. Ext.Msg.show({
  3060. title:'Upload Status',
  3061. msg: "Error #" + err.code + ": " + err.message,
  3062. buttons: Ext.Msg.OK,
  3063. icon: Ext.MessageBox.ERROR
  3064. });
  3065. }
  3066. }
  3067. });
  3068. muploader.init();
  3069. }
  3070. }
  3071. }]
  3072. }]
  3073. });
  3074. muploader = null;
  3075. uploads_store.removeAll();
  3076. tPanel.doLayout();
  3077. archives_store.load();//{params:{start:0, limit:50, src: 'arch', fil: selecredActiveSourceFilter }});
  3078. updateTaskStatus();
  3079. tlInterval = window.setInterval( updateTaskStatus, 333 );
  3080. };
  3081. function loadSensorDetectionSettings( sensid ){
  3082. Ext.Ajax.request({
  3083. url: '/lib/controller/getSensorDetectionEditor.php',
  3084. params: {
  3085. UID: <?=$UserID;?>,
  3086. SID: '<?=$Session;?>',
  3087. SEN: sensid
  3088. },
  3089. success: function( response, opts ){
  3090. var data = Ext.decode( response.responseText );
  3091. var tComp = Ext.getCmp('main_content');
  3092. if( data.status == 'ok' ){
  3093. if( tComp!= null ){
  3094. var content = Ext.decode( data.content );
  3095. tComp.removeAll( true );
  3096. tComp.add( content );
  3097. tComp.doLayout();
  3098. };
  3099. } else {
  3100. if( tComp!= null ){
  3101. tComp.removeAll( true );
  3102. tComp.add( data );
  3103. tComp.doLayout();
  3104. };
  3105. };
  3106. },
  3107. failure: function(){
  3108. }
  3109. });
  3110. };
  3111. function initSettingsView(){
  3112. if( tlInterval!= null ){
  3113. window.clearInterval( tlInterval );
  3114. tlInterval = null;
  3115. timelineObj = null;
  3116. };
  3117. var tP = Ext.getCmp('left_side_menu');
  3118. //tP.doLayout();
  3119. //tP.setVisible( false );
  3120. tP.removeAll( true );
  3121. tP.add({
  3122. id: 'sme_inner',
  3123. layout:'accordion',
  3124. //height: PanelH,
  3125. frame: false,
  3126. border: false,
  3127. layoutConfig:{
  3128. animate: true//,
  3129. //activeOnTop: true
  3130. },
  3131. items:[]
  3132. });
  3133. tP.doLayout();
  3134. tP = Ext.getCmp('sme_inner');
  3135. <?php if( $CUser->Data['access'] > 3 ){ ?>
  3136. tP.add({
  3137. title: "<?=$Labels->GetLabel('_SYS_SETTINGS_');?>",
  3138. layout: 'vbox',
  3139. height: 120,
  3140. pack: 'center',
  3141. align : 'strech',
  3142. collapsed: ( content_lvl1 != 0 ),
  3143. items:[{
  3144. xtype: 'button',
  3145. width: '100%',
  3146. id:'sys_edit',
  3147. text: "<?=$Labels->GetLabel('_SYS_GENERAL_');?>",
  3148. enableToggle: true,
  3149. pressed: ( content_lvl2 == 0 && content_lvl1 == 0 ),
  3150. allowDepress: false,
  3151. toggleGroup: 'sys_settings',
  3152. handler: showSettingsGeneral
  3153. }
  3154. <?php if( $CUser->Data['access'] > 4 ){ ?>
  3155. ,{
  3156. xtype: 'button',
  3157. width: '100%',
  3158. id:'map_edit',
  3159. text: "<?=$Labels->GetLabel('_SENSOR_CONNECTION_');?>",
  3160. enableToggle: true,
  3161. pressed: ( content_lvl2 == 1 && content_lvl1 == 0 ),
  3162. allowDepress: false,
  3163. toggleGroup: 'sys_settings',
  3164. handler: showSettingsSensors
  3165. }<?php
  3166. if( $AP_DATA['type'] != 23423 ){
  3167. ?>,{
  3168. xtype: 'button',
  3169. width: '100%',
  3170. id:'video_set',
  3171. text: "<?=$Labels->GetLabel('_CAMERA_MNGMNT_');?>",
  3172. enableToggle: true,
  3173. pressed: ( content_lvl2 == 2 && content_lvl1 == 0 ),
  3174. allowDepress: false,
  3175. toggleGroup: 'sys_settings',
  3176. handler: showSettingsVideo
  3177. }
  3178. <?php }; ?>,{
  3179. xtype: 'button',
  3180. width: '100%',
  3181. id:'app_set',
  3182. text: "<?=$Labels->GetLabel('_APPLICA_MNGMNT_');?>",
  3183. enableToggle: true,
  3184. pressed: ( content_lvl2 == 3 && content_lvl1 == 0 ),
  3185. allowDepress: false,
  3186. toggleGroup: 'sys_settings',
  3187. handler: function(){
  3188. showSettingsApplication( content_lvl3 );
  3189. }
  3190. }
  3191. <?php }; ?>
  3192. ]
  3193. });
  3194. <?php if( $CUser->Data['access'] > 4 ){ ?>
  3195. tP.add({
  3196. title: "<?=$Labels->GetLabel('_DET_SETTINGS_');?>",
  3197. layout: 'vbox',
  3198. height: 120,
  3199. pack: 'center',
  3200. align : 'strech',
  3201. collapsed: ( content_lvl1 != 1 ),
  3202. items:[<?php
  3203. if( $AP_DATA['type'] == 1 ){
  3204. ?>
  3205. {
  3206. xtype: 'button',
  3207. width: '100%',
  3208. id:'go_home',
  3209. text: "<?=$Labels->GetLabel('_UPPER_SENSOR_');?>",
  3210. enableToggle: true,
  3211. pressed: ( content_lvl2 == 0 && content_lvl1 == 1 ),
  3212. allowDepress: false,
  3213. toggleGroup: 'det_settings',
  3214. handler: loadMetroControlUpper
  3215. },{
  3216. xtype: 'button',
  3217. width: '100%',
  3218. id:'go_monitor',
  3219. text: "<?=$Labels->GetLabel('_BOTTOM_SENSOR_');?>",
  3220. enableToggle: true,
  3221. pressed: ( content_lvl2 == 1 && content_lvl1 == 1 ),
  3222. allowDepress: false,
  3223. toggleGroup: 'det_settings',
  3224. handler: loadMetroControlBottom
  3225. },{
  3226. xtype: 'button',
  3227. width: '100%',
  3228. id:'go_archive',
  3229. text: "<?=$Labels->GetLabel('_FUSION_ENGINE_');?>",
  3230. enableToggle: true,
  3231. pressed: ( content_lvl2 == 2 && content_lvl1 == 1 ),
  3232. allowDepress: false,
  3233. toggleGroup: 'det_settings',
  3234. handler: loadMetroControlFusion
  3235. }<?php
  3236. } else {
  3237. $QS = "SELECT `name`, `aux_id` FROM `nodes` WHERE `type`>0 AND `type`<5";
  3238. $RR = $DATABASE->Query( $QS );
  3239. if( count( $RR ) ){
  3240. foreach( $RR as $CR ){
  3241. ?>
  3242. {
  3243. xtype: 'button',
  3244. width: '100%',
  3245. text: '<?=$CR['name'];?>',
  3246. enableToggle: true,
  3247. pressed: ( content_lvl2 == 0 && content_lvl1 == 1 ),
  3248. allowDepress: false,
  3249. toggleGroup: 'det_settings',
  3250. handler: function(){
  3251. loadSensorDetectionSettings( <?=$CR['aux_id'];?> );
  3252. }
  3253. },
  3254. <?php
  3255. };
  3256. } else {
  3257. ?>
  3258. {
  3259. xtype: 'spacer',
  3260. html: "<?=$Labels->GetLabel('_NO_SENSORS_DEF_');?>",
  3261. height: 32
  3262. },
  3263. <?php
  3264. };
  3265. ?>
  3266. {
  3267. xtype: 'spacer',
  3268. height: 10
  3269. }<?php
  3270. };
  3271. ?>]
  3272. });
  3273. <?php };
  3274. }; ?>
  3275. tP.add({
  3276. title: "<?=$Labels->GetLabel('_PROF_SETTINGS_');?>",
  3277. items:[<?php
  3278. $ZIGA = array();
  3279. foreach( $Site_Languages as $SL ){
  3280. if( $SL['id'] == $CUser->Data['language'] ){
  3281. $ZIGA[] = "{ xtype:'button', text:'{$SL['name']}', width: '100%', enableToggle: true, pressed : true, handler: function(){ window.location = '/?Lang={$SL['id']}'; } }";
  3282. } else {
  3283. $ZIGA[] = "{ xtype:'button', text:'{$SL['name']}', width: '100%', handler: function(){ window.location = '/?Lang={$SL['id']}'; } }";
  3284. };
  3285. };
  3286. echo implode(',',$ZIGA );
  3287. ?>]
  3288. });
  3289. <?php if( $CUser->Data['access'] > 5 ){ ?>
  3290. tP.add({
  3291. title: "<?=$Labels->GetLabel('_ADM_SETTINGS_');?>",
  3292. collapsed: ( content_lvl1 != 3 ),
  3293. items:[{
  3294. xtype: 'button',
  3295. width: '100%',
  3296. id:'adm_acc',
  3297. text: "<?=$Labels->GetLabel('_USERS_MNGMT_');?>",
  3298. enableToggle: true,
  3299. pressed: ( content_lvl2 == 0 && content_lvl1 == 3 ),
  3300. allowDepress: false,
  3301. toggleGroup: 'adm_settings',
  3302. handler: function( b, e ){
  3303. loadUserEditor();
  3304. }
  3305. },{
  3306. xtype: 'button',
  3307. width: '100%',
  3308. id:'adm_acclog',
  3309. text: "<?=$Labels->GetLabel('_ACC_LOG_');?>",
  3310. enableToggle: true,
  3311. pressed: ( content_lvl2 == 1 && content_lvl1 == 3 ),
  3312. allowDepress: false,
  3313. toggleGroup: 'adm_settings',
  3314. handler: function( b, e ){
  3315. loadAccessLog();
  3316. }
  3317. },{
  3318. xtype: 'button',
  3319. width: '100%',
  3320. id:'adm_servlog',
  3321. text: "<?=$Labels->GetLabel('_SERV_LOG_');?>",
  3322. enableToggle: true,
  3323. pressed: ( content_lvl2 == 2 && content_lvl1 == 3 ),
  3324. allowDepress: false,
  3325. toggleGroup: 'adm_settings',
  3326. handler: function( b, e ){
  3327. loadServerLog();
  3328. }
  3329. }]
  3330. });
  3331. <?php
  3332. };
  3333. ?>
  3334. tP.setVisible( true );
  3335. tP.doLayout();
  3336. switch( content_lvl1 ){
  3337. default:{
  3338. switch( content_lvl2 ){
  3339. default: showSettingsGeneral(); break;
  3340. <?php if( $CUser->Data['access'] > 5 ){ ?>
  3341. case 1: showSettingsSensors(); break;
  3342. case 2: showSettingsVideo(); break;
  3343. case 3: showSettingsApplication(); break;
  3344. <?php }; ?>
  3345. //case 4: showSettingsUpgrade(); break;
  3346. };
  3347. };
  3348. case 1:{
  3349. switch( content_lvl2 ){
  3350. case 0: break;
  3351. };
  3352. break;
  3353. };
  3354. <?php if( $CUser->Data['access'] > 5 ){ ?>
  3355. case 3:{
  3356. switch( content_lvl2 ){
  3357. case 0: loadUserEditor(); break;
  3358. };
  3359. break;
  3360. };
  3361. <?php }; ?>
  3362. };
  3363. };
  3364. function zdonut(cx, cy, radius, data) {
  3365. function arcradius(cx, cy, radius, degrees) {
  3366. var radians = (degrees - 90) * Math.PI / 180.0;
  3367. return { x: cx + (radius * Math.cos(radians)), y: cy + (radius * Math.sin(radians)) };
  3368. }
  3369. var decimals = 4;
  3370. var total = 0;
  3371. var arr = [];
  3372. var beg = 0;
  3373. var end = 0;
  3374. var count = 0;
  3375. var half = radius / 2;
  3376. var midpoint = radius / 2.4;
  3377. for( var i = 0; i < data.length; i++) total += data[i].value;
  3378. for( var i = 0; i < data.length; i++) {
  3379. var item = data[i];
  3380. var tmp = {};
  3381. //var p = Math.floor((((item.value + 1) / total) * 100), decimals );
  3382. var p = (( item.value / total ) * 100.0 );
  3383. count += p;
  3384. if( i === length - 1 && count < 100 ) p = p + (100 - count);
  3385. end = beg + ((360 / 100) * p);
  3386. tmp.index = i;
  3387. tmp.value = item.value;
  3388. tmp.data = item;
  3389. var b = arcradius(cx, cy, radius, end);
  3390. var e = arcradius(cx, cy, radius, beg);
  3391. var la = (end - beg) <= 180 ? 0 : 1;
  3392. 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(' ');
  3393. arr.push(tmp);
  3394. beg = end;
  3395. };
  3396. return arr;
  3397. };
  3398. var selectedPresetsBackgroundSensor = 0;
  3399. function altPTZCmd( me ){
  3400. var name = me.target.id;
  3401. const myArray = name.split("_");
  3402. Ext.Ajax.request({
  3403. url: '/lib/controller/doCameraOperation.php',
  3404. params: {
  3405. UID: <?=$UserID;?>,
  3406. SID: '<?=$Session;?>',
  3407. CMD: 11,
  3408. CID: myArray[3],
  3409. MOV: myArray[2]
  3410. },
  3411. failure: failureAJAXFunction
  3412. });
  3413. };
  3414. function showCameraPresets( AA, camID ){
  3415. Ext.Ajax.request({
  3416. url: '/lib/controller/getCameraPresets.php',
  3417. params: {
  3418. CID: camID,
  3419. UID: <?=$UserID;?>,
  3420. SID: '<?=$Session;?>',
  3421. },
  3422. success: function( response, opts ){
  3423. var data = Ext.decode(response.responseText);
  3424. var hgy = Ext.getCmp('pres_count');
  3425. if( hgy!= undefined ) hgy.setValue( data.count );
  3426. var hgy = Ext.getCmp('pres_p_seg');
  3427. if( hgy!= undefined ) hgy.setValue( data.pres_cols );
  3428. var hgy = Ext.getCmp('pres_z_seg');
  3429. if( hgy!= undefined ) hgy.setValue( data.pres_rows );
  3430. if( data.special_iron != undefined ){
  3431. var hgy = Ext.getCmp('pres_iron');
  3432. if( hgy!= undefined ) hgy.setValue( data.special_iron );
  3433. var juja = document.getElementById('img_btn_035_'+camID );
  3434. if( juja != undefined ){
  3435. juja.classList.add('ptz_ctrl_btn');
  3436. juja.classList.remove('ptz_ctrl_btn_hdn');
  3437. juja.addEventListener( 'mousedown', altPTZCmd );
  3438. };
  3439. } else {
  3440. var juja = document.getElementById('img_btn_035_'+camID );
  3441. if( juja != undefined ){
  3442. juja.classList.add('ptz_ctrl_btn_hdn');
  3443. juja.classList.remove('ptz_ctrl_btn');
  3444. juja.removeEventListener( 'mousedown', altPTZCmd );
  3445. };
  3446. };
  3447. if( data.special_iroff != undefined ){
  3448. var hgy = Ext.getCmp('pres_iroff');
  3449. if( hgy!= undefined ) hgy.setValue( data.special_iroff );
  3450. var juja = document.getElementById('img_btn_036_'+camID );
  3451. if( juja != undefined ){
  3452. juja.classList.add('ptz_ctrl_btn');
  3453. juja.classList.remove('ptz_ctrl_btn_hdn');
  3454. juja.addEventListener( 'mousedown', altPTZCmd );
  3455. };
  3456. } else {
  3457. var juja = document.getElementById('img_btn_036_'+camID );
  3458. if( juja != undefined ){
  3459. juja.classList.add('ptz_ctrl_btn_hdn');
  3460. juja.classList.remove('ptz_ctrl_btn');
  3461. juja.removeEventListener( 'mousedown', altPTZCmd );
  3462. };
  3463. };
  3464. if( data.special_irauto != undefined ){
  3465. var hgy = Ext.getCmp('pres_irauto');
  3466. if( hgy!= undefined ) hgy.setValue( data.special_irauto );
  3467. };
  3468. if( data.special_wiper != undefined ){
  3469. var hgy = Ext.getCmp('pres_wiper');
  3470. if( hgy!= undefined ) hgy.setValue( data.special_wiper );
  3471. var juja = document.getElementById('img_btn_037_'+camID );
  3472. if( juja != undefined ){
  3473. juja.classList.add('ptz_ctrl_btn');
  3474. juja.classList.remove('ptz_ctrl_btn_hdn');
  3475. juja.addEventListener( 'mousedown', altPTZCmd );
  3476. };
  3477. } else {
  3478. var juja = document.getElementById('img_btn_037_'+camID );
  3479. if( juja != undefined ){
  3480. juja.classList.add('ptz_ctrl_btn_hdn');
  3481. juja.classList.remove('ptz_ctrl_btn');
  3482. juja.removeEventListener( 'mousedown', altPTZCmd );
  3483. };
  3484. };
  3485. var svg = document.getElementById( AA );
  3486. svg.innerHTML = "";
  3487. var centerX = svg.clientWidth / 2.0;
  3488. var centerY = svg.clientHeight / 2.0;
  3489. var radius = svg.clientHeight / 2.0 - (data.pres_rows*2.0);
  3490. var color = ['#F6BB42', '#8CC152', '#3BAFDA', '#967ADC', '#DA4453'];
  3491. var max_lines = data.pres_rows;
  3492. for( var cl = max_lines; cl > 0; cl--){
  3493. var segnum = data.pres_cols * Math.pow( 2, ( cl-1 ) );
  3494. var dta = [];
  3495. for( var j = 0; j< segnum; j++) dta[j]={ value: (180/segnum) };
  3496. var crad = cl * ( radius/(max_lines+1));
  3497. var arr = zdonut(centerX, centerY, crad, dta );
  3498. for (var i = 0; i < arr.length; i++) {
  3499. var item = arr[i];
  3500. var tP = document.createElementNS( 'http://www.w3.org/2000/svg', 'path' );
  3501. tP.setAttribute( 'd', item.d );
  3502. var test = false;
  3503. var ll = [];
  3504. if( data.presets.length ){
  3505. for( var z = 0; z < data.presets.length; z++)
  3506. if( data.presets[z].row == cl && data.presets[z].column == i ){
  3507. ll = data.presets[z];
  3508. test = true;
  3509. break;
  3510. };
  3511. };
  3512. if( test ){
  3513. tP.setAttribute( 'stroke', '#000000' );
  3514. tP.setAttribute( 'class', 'preset_ctrl_btn_a' );
  3515. tP.setAttribute( 'onclick', 'triggerPreset('+camID+','+ll.id+')' );
  3516. tP.setAttribute( 'oncontextmenu', 'removePreset('+camID+','+ll.id+')' );
  3517. } else {
  3518. tP.setAttribute( 'stroke', color[(i+cl)%5] );
  3519. tP.setAttribute( 'class', 'preset_ctrl_btn' );
  3520. tP.setAttribute( 'ondblclick', 'setPreset('+camID+','+i+','+cl+')' );
  3521. };
  3522. tP.setAttribute( 'fill', 'none' );
  3523. tP.setAttribute( 'stroke-width', ( radius/(max_lines+1)) );
  3524. svg.appendChild( tP );
  3525. }
  3526. };
  3527. if( selectedPresetsBackgroundSensor ) preview2DDraw( selectedPresetsBackgroundSensor, 'ptz_presets_');
  3528. },
  3529. failure: failureAJAXFunction
  3530. });
  3531. };
  3532. function triggerPreset( camID, presetID ){
  3533. //alert( "Call Preset["+presetID+"] for camera["+camID+"]" );
  3534. doCamOperation( camID, 30, presetID );
  3535. return false;
  3536. };
  3537. function removePreset( camID, presetID ){
  3538. //alert( "Remove Preset["+presetID+"] for camera["+camID+"]" );
  3539. doCamOperation( camID, 29, presetID );
  3540. window.setTimeout( "showCameraPresets( 'ptz_presets_0', "+camID+" );", 500 );
  3541. return false;
  3542. };
  3543. function setPreset( camID, colID, rowID ){
  3544. //alert( "Set new Preset for camera["+camID+"] x:"+colID+" y:"+rowID );
  3545. doCamOperation( camID, 28, colID+"_"+rowID );
  3546. window.setTimeout( "showCameraPresets( 'ptz_presets_0', "+camID+" );", 500 );
  3547. return false;
  3548. };