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.

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