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.

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