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.

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