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.

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