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.

2711 lines
74 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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. function loadPhoneBook(){
  334. Ext.Ajax.request({
  335. url: '/lib/controller/getPhoneBook.php',
  336. params: {
  337. UID: <?=$UserID;?>,
  338. SID: '<?=$Session;?>',
  339. },
  340. success: function( response, opts ){
  341. var data = Ext.decode(response.responseText);
  342. //var tPanel = Ext.getCmp('main_portal');
  343. //tPanel.removeAll(true);
  344. //for( i=0; i < data.length; i++) tPanel.add( data[i] );
  345. //tPanel.doLayout();
  346. },
  347. failure: failureAJAXFunction
  348. });
  349. };
  350. var addNPNWindow = null;
  351. function addNewPhoneNumber(){
  352. if( addNPNWindow == null ){
  353. addNPNWindow = new Ext.Window({
  354. title: '<?=$Labels->GetLabel('_ADD_NEW_PHN_');?>',
  355. modal: true,
  356. closeAction: 'hide',
  357. resizable: false,
  358. width: 400,
  359. height: 300,
  360. items:[{
  361. xtype: 'form',
  362. labelWidth: 120,
  363. labelAlign: 'right',
  364. items: [{
  365. xtype: 'textfield',
  366. fieldLabel: '<?=$Labels->GetLabel('_NAME_LABEL_');?>',
  367. id: 'ph_name',
  368. width: 220,
  369. value: ''
  370. },{
  371. xtype: 'textfield',
  372. fieldLabel: '<?=$Labels->GetLabel('_PHONE_NUMBER_');?>',
  373. id: 'ph_number',
  374. width: 220,
  375. validator: function( a ){
  376. return true;
  377. },
  378. value: ''
  379. },{
  380. xtype: 'radio',
  381. id: 'r_ph_call',
  382. fieldLabel: '<?=$Labels->GetLabel('_CALL_ONLY_');?>',
  383. name: 'ph_cam',
  384. checked: true,
  385. value: '1'
  386. },{
  387. xtype: 'radio',
  388. id: 'r_ph_msg',
  389. fieldLabel: '<?=$Labels->GetLabel('_SMS_ONLY_');?>',
  390. name: 'ph_cam',
  391. value: '0'
  392. },{
  393. xtype: 'textarea',
  394. fieldLabel: '<?=$Labels->GetLabel('_CUSTOM_MSG_');?>',
  395. width: 220,
  396. height: 130,
  397. id: 'cus_sms',
  398. name: 'cus_sms'
  399. }]
  400. }],
  401. bbar:['->',{
  402. text: 'Add',
  403. handler: function(){
  404. var num = Ext.getCmp( 'ph_number' ).getValue();
  405. var lbl = Ext.getCmp( 'ph_name' ).getValue();
  406. var con = (Ext.getCmp( 'r_ph_call' ).getValue())?1:0;
  407. var cust = Ext.getCmp( 'cus_sms' ).getValue();
  408. Ext.Ajax.request({
  409. url: '/lib/controller/addPhoneBookRecord.php',
  410. params: {
  411. UID: <?=$UserID;?>,
  412. SID: '<?=$Session;?>',
  413. PNUM: num,
  414. PNAM: lbl,
  415. PCAL: con,
  416. PMSG: cust
  417. },
  418. success: function( response, opts ){
  419. var data = Ext.decode(response.responseText);
  420. if( data.success ){
  421. } else {
  422. Ext.Msg.show({
  423. title:'<?=$Labels->GetLabel('_ERROR_');?>',
  424. msg: data.msg,
  425. buttons: Ext.Msg.OK,
  426. icon: Ext.MessageBox.ERROR//,
  427. //fn: function(btn, text){
  428. // if( btn == 'yes' ){
  429. // cleanupChangeNotifier();
  430. // } else {
  431. // loadEditor = false;
  432. // };
  433. //}
  434. });
  435. };
  436. //var tPanel = Ext.getCmp('main_portal');
  437. //tPanel.removeAll(true);
  438. //for( i=0; i < data.length; i++) tPanel.add( data[i] );
  439. //tPanel.doLayout();
  440. },
  441. failure: failureAJAXFunction
  442. });
  443. }
  444. },{
  445. text: 'Cancel',
  446. handler: function(){
  447. addNPNWindow.hide();
  448. }
  449. }]
  450. });
  451. };
  452. addNPNWindow.show();
  453. };
  454. function loadDetectedCameras(){
  455. Ext.Ajax.request({
  456. url: '/lib/controller/getCameras.php',
  457. params: {
  458. UID: <?=$UserID;?>,
  459. TYP: 0,
  460. SID: '<?=$Session;?>',
  461. },
  462. success: function( response, opts ){
  463. var tData = Ext.decode(response.responseText);
  464. var tPanel = Ext.getCmp('dcam_container');
  465. if( tData.status == 'ok' ){
  466. var res = Ext.decode( tData.cameras );
  467. tPanel.removeAll( true );
  468. tPanel.add( res );
  469. tPanel.doLayout();
  470. var zPanel = Ext.getCmp('dcam_op_small');
  471. zPanel.removeAll( true );
  472. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  473. zPanel.doLayout();
  474. } else {
  475. tPanel.removeAll( true );
  476. tPanel.doLayout();
  477. var zPanel = Ext.getCmp('dcam_op_small');
  478. zPanel.removeAll( true );
  479. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  480. zPanel.doLayout();
  481. };
  482. },
  483. failure: failureAJAXFunction
  484. });
  485. };
  486. function loadAssignedCameras(){
  487. Ext.Ajax.request({
  488. url: '/lib/controller/getCameras.php',
  489. params: {
  490. UID: <?=$UserID;?>,
  491. TYP: 1,
  492. SID: '<?=$Session;?>',
  493. },
  494. success: function( response, opts ){
  495. var tData = Ext.decode(response.responseText);
  496. var tPanel = Ext.getCmp('acam_container');
  497. if( tData.status == 'ok' ){
  498. var res = Ext.decode( tData.cameras );
  499. tPanel.removeAll( true );
  500. tPanel.add( res );
  501. tPanel.doLayout();
  502. var zPanel = Ext.getCmp('acam_op_small');
  503. zPanel.removeAll( true );
  504. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  505. zPanel.doLayout();
  506. } else {
  507. tPanel.removeAll( true );
  508. tPanel.doLayout();
  509. var zPanel = Ext.getCmp('acam_op_small');
  510. zPanel.removeAll( true );
  511. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  512. zPanel.doLayout();
  513. };
  514. },
  515. failure: failureAJAXFunction
  516. });
  517. };
  518. function loadAttachedSensors(){
  519. Ext.Ajax.request({
  520. url: '/lib/controller/getSensors.php',
  521. params: {
  522. UID: <?=$UserID;?>,
  523. SID: '<?=$Session;?>',
  524. },
  525. success: function( response, opts ){
  526. var tData = Ext.decode(response.responseText);
  527. var tPanel = Ext.getCmp('sens_container');
  528. if( tData.status == 'ok' ){
  529. var res = Ext.decode( tData.sensors );
  530. tPanel.removeAll( true );
  531. tPanel.add( res );
  532. tPanel.doLayout();
  533. var zPanel = Ext.getCmp('sens_op_small');
  534. zPanel.removeAll( true );
  535. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  536. zPanel.doLayout();
  537. } else {
  538. tPanel.removeAll( true );
  539. tPanel.doLayout();
  540. var zPanel = Ext.getCmp('sens_op_small');
  541. zPanel.removeAll( true );
  542. zPanel.add( { html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>" } );
  543. zPanel.doLayout();
  544. };
  545. },
  546. failure: failureAJAXFunction
  547. });
  548. };
  549. function editResource( rid ){
  550. var loadEditor = true;
  551. if( settingsAreChanged ){
  552. Ext.Msg.show({
  553. title:'<?=$Labels->GetLabel('_SETTINGS_CHANGED_');?>',
  554. msg: '<?=$Labels->GetLabel('_SET_CHANGED_WOULD_SAVE_');?>',
  555. buttons: Ext.Msg.YESNO,
  556. icon: Ext.MessageBox.WARNING,
  557. fn: function(btn, text){
  558. if( btn == 'yes' ){
  559. cleanupChangeNotifier();
  560. } else {
  561. loadEditor = false;
  562. };
  563. }
  564. });
  565. };
  566. if( loadEditor ){
  567. Ext.Ajax.request({
  568. url: '/lib/controller/getResourceEditor.php',
  569. params: {
  570. RID: rid,
  571. UID: <?=$UserID;?>,
  572. SID: '<?=$Session;?>',
  573. },
  574. success: function( response, opts ){
  575. var data = Ext.decode(response.responseText);
  576. var resourceEdPanel = Ext.getCmp('res_ed_small');
  577. if( resourceEdPanel ){
  578. resourceEdPanel.removeAll( true );
  579. resourceEdPanel.add( data );
  580. resourceEdPanel.doLayout();
  581. };
  582. },
  583. failure: failureAJAXFunction
  584. });
  585. };
  586. };
  587. function editFilter( fid ){
  588. var loadEditor = true;
  589. if( settingsAreChanged ){
  590. Ext.Msg.show({
  591. title: "<?=$Labels->GetLabel('_SETTINGS_CHANGED_');?>",
  592. msg: "<?=$Labels->GetLabel('_SET_CHANGED_WOULD_SAVE_');?>",
  593. buttons: Ext.Msg.YESNO,
  594. icon: Ext.MessageBox.WARNING,
  595. fn: function(btn, text){
  596. if( btn == 'yes' ){
  597. cleanupChangeNotifier();
  598. } else {
  599. loadEditor = false;
  600. };
  601. }
  602. });
  603. };
  604. if( loadEditor ){
  605. Ext.Ajax.request({
  606. url: '/lib/controller/getFilterEditor.php',
  607. params: {
  608. FID: fid,
  609. UID: <?=$UserID;?>,
  610. SID: '<?=$Session;?>',
  611. },
  612. success: function( response, opts ){
  613. var data = Ext.decode(response.responseText);
  614. var resourceEdPanel = Ext.getCmp('flt_ed_small');
  615. if( resourceEdPanel ){
  616. resourceEdPanel.removeAll( true );
  617. resourceEdPanel.add( data );
  618. resourceEdPanel.doLayout();
  619. };
  620. },
  621. failure: failureAJAXFunction
  622. });
  623. };
  624. };
  625. function editModule( mid ){
  626. var loadEditor = true;
  627. if( settingsAreChanged ){
  628. Ext.Msg.show({
  629. title: "<?=$Labels->GetLabel('_SETTINGS_CHANGED_');?>",
  630. msg: "<?=$Labels->GetLabel('_SET_CHANGED_WOULD_SAVE_');?>",
  631. buttons: Ext.Msg.YESNO,
  632. icon: Ext.MessageBox.WARNING,
  633. fn: function(btn, text){
  634. if( btn == 'yes' ){
  635. cleanupChangeNotifier();
  636. } else {
  637. loadEditor = false;
  638. };
  639. }
  640. });
  641. };
  642. if( loadEditor ){
  643. Ext.Ajax.request({
  644. url: '/lib/controller/getModuleEditor.php',
  645. params: {
  646. MID: mid,
  647. UID: <?=$UserID;?>,
  648. SID: '<?=$Session;?>',
  649. },
  650. success: function( response, opts ){
  651. var data = Ext.decode(response.responseText);
  652. var moduleEdPanel = Ext.getCmp('mod_ed_small');
  653. if( moduleEdPanel ){
  654. moduleEdPanel.removeAll( true );
  655. moduleEdPanel.add( data );
  656. moduleEdPanel.doLayout();
  657. };
  658. },
  659. failure: failureAJAXFunction
  660. });
  661. };
  662. };
  663. function enableModule( ID ){
  664. Ext.Ajax.request({
  665. url: '/lib/controller/doModuleOperation.php',
  666. params: {
  667. OPID: 2,
  668. OPCODE: 1,
  669. MID: ID,
  670. UID: <?=$UserID;?>,
  671. SID: '<?=$Session;?>'
  672. },
  673. success: function(){
  674. //showSettings( SelectedNodeID, 2 );
  675. loadModules();
  676. }
  677. });
  678. };
  679. function disableModule( ID ){
  680. Ext.Ajax.request({
  681. url: '/lib/controller/doModuleOperation.php',
  682. params: {
  683. OPID: 2,
  684. OPCODE: 0,
  685. MID: ID,
  686. UID: <?=$UserID;?>,
  687. SID: '<?=$Session;?>'
  688. },
  689. success: function(){
  690. //showSettings( SelectedNodeID, 2 );
  691. loadModules();
  692. }
  693. });
  694. };
  695. //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;
  696. function doCamOperation( cid, op, param, reload = false ){
  697. Ext.Ajax.request({
  698. url: '/lib/controller/doCameraOperation.php',
  699. params: {
  700. CID: cid,
  701. CMD: 10,
  702. OPID: op,
  703. OPCODE: param,
  704. UID: <?=$UserID;?>,
  705. SID: '<?=$Session;?>'
  706. },
  707. success: function(){
  708. if( reload ) loadDetectedCameras();
  709. if( reload ) loadAssignedCameras();
  710. }
  711. });
  712. };
  713. function doApplicationOperation( op, param, reload = false ){
  714. Ext.Ajax.request({
  715. url: '/lib/controller/doApplicationOperation.php',
  716. params: {
  717. OPID: op,
  718. OPCODE: param,
  719. UID: <?=$UserID;?>,
  720. SID: '<?=$Session;?>'
  721. },
  722. success: function(){
  723. //if( reload ) loadDetectedCameras();
  724. //if( reload ) loadAssignedCameras();
  725. }
  726. });
  727. };
  728. function doSensorOperation( sensorid, op, param, reload = false ){
  729. Ext.Ajax.request({
  730. url: '/lib/controller/doSensorOperation.php',
  731. params: {
  732. SNID: sensorid,
  733. CMD: op,
  734. OPID: op,
  735. OPCODE: param,
  736. UID: <?=$UserID;?>,
  737. SID: '<?=$Session;?>'
  738. },
  739. success: function(){
  740. if( reload ) loadAttachedSensors();
  741. }
  742. });
  743. };
  744. function doResourceOperation( resourceid, op, param, value, reload = false ){
  745. Ext.Ajax.request({
  746. url: '/lib/controller/doResourceOperation.php',
  747. params: {
  748. RID: resourceid,
  749. OPID: op,
  750. OPCODE: param,
  751. OPVAL: value,
  752. UID: <?=$UserID;?>,
  753. SID: '<?=$Session;?>'
  754. },
  755. success: function(){
  756. if( reload ) loadAttachedSensors();
  757. }
  758. });
  759. };
  760. function removeModule( ID ){
  761. Ext.Msg.show({
  762. title: "<?=$Labels->GetLabel('_PLS_CONFIRM_');?>",
  763. msg: "<?=$Labels->GetLabel('_RUS_DELETE_MODULE_');?>",
  764. buttons: Ext.Msg.YESNOCANCEL,
  765. fn: function( btn, text ){
  766. if( btn == 'yes' ){
  767. Ext.Ajax.request({
  768. url: '/lib/controller/doModuleOperation.php',
  769. params: {
  770. OPID: 1,
  771. MID: ID,
  772. UID: <?=$UserID;?>,
  773. SID: '<?=$Session;?>'
  774. },
  775. success: function(){
  776. //showSettings( SelectedNodeID, 2 );
  777. loadModules();
  778. }
  779. });
  780. };
  781. },
  782. icon: Ext.MessageBox.QUESTION
  783. });
  784. };
  785. function disableServOps(){
  786. var tC = Ext.getCmp('servopPanel01');
  787. tC.removeClass('servopInfo_item01');
  788. tC.addClass('servopInfo_item00');
  789. tC.disable();
  790. Ext.getCmp('tbtn_sop01').disable();
  791. //tC.doLayout();
  792. tC = Ext.getCmp('servopPanel02');
  793. tC.removeClass('servopInfo_item11');
  794. tC.addClass('servopInfo_item10');
  795. tC.disable();
  796. Ext.getCmp('tbtn_sop02').disable();
  797. //tC.doLayout();
  798. tC = Ext.getCmp('servopPanel03');
  799. tC.removeClass('servopInfo_item21');
  800. tC.addClass('servopInfo_item20');
  801. tC.disable();
  802. Ext.getCmp('tbtn_sop03').disable();
  803. //tC.doLayout();
  804. tC = Ext.getCmp('servopPanel04');
  805. tC.removeClass('servopInfo_item31');
  806. tC.addClass('servopInfo_item30');
  807. tC.disable();
  808. Ext.getCmp('tbtn_sop04').disable();
  809. //tC.doLayout();
  810. };
  811. function enableServOps(){
  812. var tC = Ext.getCmp('servopPanel01');
  813. if( tC != undefined ){
  814. tC.removeClass('servopInfo_item00');
  815. tC.addClass('servopInfo_item01');
  816. Ext.getCmp('tbtn_sop01').enable();
  817. tC.enable();
  818. };
  819. //tC.doLayout();
  820. tC = Ext.getCmp('servopPanel02');
  821. if( tC != undefined ){
  822. tC.removeClass('servopInfo_item10');
  823. tC.addClass('servopInfo_item11');
  824. tC.enable();
  825. Ext.getCmp('tbtn_sop02').enable();
  826. };
  827. //tC.doLayout();
  828. tC = Ext.getCmp('servopPanel03');
  829. if( tC != undefined ){
  830. tC.removeClass('servopInfo_item20');
  831. tC.addClass('servopInfo_item21');
  832. tC.enable();
  833. Ext.getCmp('tbtn_sop03').enable();
  834. };
  835. //tC.doLayout();
  836. tC = Ext.getCmp('servopPanel04');
  837. if( tC != undefined ){
  838. tC.removeClass('servopInfo_item30');
  839. tC.addClass('servopInfo_item31');
  840. tC.enable();
  841. Ext.getCmp('tbtn_sop04').enable();
  842. };
  843. //tC.doLayout();
  844. };
  845. function updateServerStatus(){
  846. Ext.Ajax.request({
  847. url: '/lib/controller/getServerStatus.php',
  848. params: {
  849. SERVID: 1,
  850. UID: <?=$UserID;?>,
  851. SID: '<?=$Session;?>'
  852. },
  853. success: function( response, opts ){
  854. // If the response is JSON, you have to decode it
  855. var sps = document.getElementById("INFO_SPS");
  856. if( sps == undefined ) return;
  857. var data = Ext.decode(response.responseText);
  858. if( data.status == 'ok' ){
  859. serverIsOnLine = true;
  860. enableServOps();
  861. //document.getElementById('HW_NFO').innerHTML = data.stats.hw_info;
  862. //document.getElementById('OS_NFO').innerHTML = data.stats.os_info;
  863. //document.getElementById('BLD_NFO').innerHTML = data.stats.build;
  864. setDonatStatus( 1, 0, data.stats.stat_cpu15 );
  865. setDonatStatus( 1, 1, data.stats.stat_mem );
  866. setDonatStatus( 1, 2, data.stats.stat_disk );
  867. setDonatStatus( 1, 3, data.stats.temp0 );
  868. sps.classList.remove('setEd_infoPanel');
  869. sps.classList.add('setEl_infoPanel');
  870. } else {
  871. serverIsOnLine = false;
  872. disableServOps();
  873. if( data.status == 'na' ){
  874. setDonatStatus( 1, 0, -1 );
  875. setDonatStatus( 1, 1, -1 );
  876. setDonatStatus( 1, 2, -1 );
  877. setDonatStatus( 1, 3, -1 );
  878. sps.classList.remove('setEl_infoPanel');
  879. sps.classList.add('setEd_infoPanel');
  880. } else {
  881. Ext.Msg.show({
  882. title: "<?=$Labels->GetLabel("_INFO_MSG_");?>",
  883. msg: data.messages,
  884. buttons: Ext.Msg.OK,//YESNOCANCEL,
  885. fn: function(){
  886. },
  887. icon: Ext.MessageBox.INFO //QUESTION
  888. });
  889. };
  890. };
  891. if( tlInterval == null ){
  892. tlInterval = window.setInterval( updateServerStatus, 1200, selectedSite );
  893. };
  894. },
  895. failure: failureAJAXFunction
  896. });
  897. };
  898. var devUploadTimeout = null;
  899. var devUploadID = -1;
  900. function fetchDeviceUploadStatus(){
  901. clearTimeout( devUploadTimeout );
  902. if( devUploadID < 1 ) return;
  903. Ext.Ajax.request({
  904. url: '/lib/controller/getDeviceUploadStatus.php',
  905. params: {
  906. UID: <?=$UserID;?>,
  907. SID: '<?=$Session;?>',
  908. DID: devUploadID
  909. },
  910. success: function( response, opts ){
  911. var data = Ext.decode(response.responseText);
  912. var tT = Ext.getCmp('upp_ttext');
  913. if( tT != undefined ){
  914. if( data.count > 0 ){
  915. devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 );
  916. };
  917. if( data.current != undefined ){
  918. tT.update('<p class="UPTTEXT">Uploading '+data.count+' file(s)</p>');
  919. document.getElementById('upp_ctext').innerHTML ='<p class="UPCTEXT">Current File: '+data.current+'</p>';
  920. Ext.getCmp('upp_pbar').updateProgress( data.progress, Math.round( data.progress*100 )+'%', true );
  921. devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 );
  922. } else {
  923. Ext.getCmp('upload_progres_panel').hide();
  924. Ext.getCmp('uploaded_grid').show();
  925. loadModuleFiles( devUploadID );
  926. };
  927. };
  928. },
  929. failure: failureAJAXFunction
  930. });
  931. };
  932. function downloadSettings(){
  933. ReportMask = new Ext.LoadMask(Ext.getBody(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."});
  934. ReportMask.show();
  935. const formData = new FormData();
  936. formData.append("UID",<?=$UserID;?>);
  937. formData.append("SID",'<?=$Session;?>');
  938. fetch('/lib/controller/downloadSettings.php',{
  939. method: "POST",
  940. body: formData
  941. })
  942. .then(resp => resp.blob())
  943. .then(blob => {
  944. const url = window.URL.createObjectURL(blob);
  945. const a = document.createElement('a');
  946. a.style.display = 'none';
  947. a.href = url;
  948. var today=new Date();
  949. var SY=1900+today.getYear();
  950. var SMO=today.getMonth()+1;
  951. var SD=today.getDate();
  952. var SH = today.getHours();
  953. var SM = today.getMinutes();
  954. var SS = today.getSeconds();
  955. a.download = 'backup_'+SY+'.'+SMO+'.'+SD+'_'+SH+'-'+SM+'-'+SS+'.db';
  956. document.body.appendChild(a);
  957. a.click();
  958. window.URL.revokeObjectURL(url);
  959. ReportMask.hide();
  960. Ext.Msg.show({
  961. title:'<?=$Labels->GetLabel('_SUCCESS_');?>',
  962. msg: '<?=$Labels->GetLabel('_DB_FILE_HAS_DOWNLOADED_');?>',
  963. buttons: Ext.Msg.OK,
  964. icon: Ext.MessageBox.INFO
  965. });
  966. })
  967. .catch(() => {
  968. ReportMask.hide();
  969. Ext.Msg.show({
  970. title:'<?=$Labels->GetLabel('_REQ_FAILURE_');?>',
  971. msg: '<?=$Labels->GetLabel('_AJX_REQFAILURE_');?>',
  972. buttons: Ext.Msg.OK,
  973. icon: Ext.MessageBox.ERROR
  974. });
  975. });
  976. };
  977. function showSettingsGeneral(){
  978. stopStatusUpdater();
  979. content_lvl1 = 1;
  980. content_lvl2 = 0;
  981. var tPanel = Ext.getCmp('main_content');
  982. tPanel.removeAll( true );
  983. <?php
  984. //$QS="SELECT * FROM `servers` WHERE `id`=1";
  985. //$SDD = $DATABASE->Query( $QS );
  986. //$NData = $SDD[0];
  987. $QS="SELECT * FROM `resources` WHERE `node_id`=1 AND ( `type`=101 OR `type`=102 )";
  988. $CN = $DATABASE->Query( $QS );
  989. echo "SUKAKAKA";
  990. $IL=array();
  991. foreach( $CN as $N ){
  992. $QS="SELECT * FROM `networks` WHERE `nif_id`={$N['aux_id']} AND `type`=0";
  993. $NWD = $DATABASE->Query( $QS );
  994. $NW = $NWD[0];
  995. $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>";
  996. };
  997. $NIFO = '<table><tr>' . implode( '</tr><tr>', $IL ) . '</tr></table>';
  998. ?>
  999. tPanel.add({
  1000. xtype: 'tabpanel',
  1001. frame: false,
  1002. id: 'node_settings_content',
  1003. border: false,
  1004. activeTab: content_lvl3,
  1005. items: [{
  1006. xtype: 'panel',
  1007. id: 'gi_tab',
  1008. title: "<?=$Labels->GetLabel( '_GENERAL_NFO_' );?>",
  1009. layout: 'hbox',
  1010. items:[{
  1011. xtype: 'panel',
  1012. flex: 1,
  1013. height: PanelH-15,
  1014. autoScroll: false,
  1015. html: '<table width="100%" height="100%" border=0><tr><td height="290px" align="center" valign="middle"><div class="server_img_set"></div></td></tr>\
  1016. <tr><td height="100px"><table width="100%" border=0><tr>\
  1017. <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>\
  1018. <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>\
  1019. <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>\
  1020. <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>\
  1021. </tr></table></td></tr>\
  1022. <tr><td valign="top"><div class="setEd_infoPanel" id="INFO_SPS">\
  1023. <div class="sideInfo_item" id="SW_INFO"><?=$AP_DATA['build'];?></div>\
  1024. <div class="sideInfo_item" id="OS_INFO"><?=$AP_DATA['os_info'];?></div>\
  1025. <div class="sideInfo_item" id="HW_INFO"><?=$AP_DATA['hw_info'];?></div>\
  1026. </div></td></tr>\
  1027. <tr><td height="60%">&nbsp;</td></tr></table>'
  1028. },{
  1029. xtype: 'panel',
  1030. id: '_ed_small',
  1031. flex: 1,
  1032. height: PanelH-15,
  1033. autoScroll: false,
  1034. items:[
  1035. <?php if( $CUser->Data['access'] > 3 ){ ?>
  1036. {
  1037. xtype: 'panel',
  1038. baseCls:'servopInfo_item00',
  1039. id: 'servopPanel01',
  1040. items:[{
  1041. xtype: 'panel',
  1042. frame: false,
  1043. border: false,
  1044. unstyled: true,
  1045. html: "<p><?=$Labels->GetLabel('_SERV_RESTART_DESC_');?></p><br/>"
  1046. },{
  1047. xtype: 'button',
  1048. lazyRender: true,
  1049. iconCls: 'srv_op_restart',
  1050. text: "<?=$Labels->GetLabel('_SERV_RESTART_OP_');?>",
  1051. id: 'tbtn_sop01',
  1052. scale: 'large',
  1053. width: '95%',
  1054. disabled: true,
  1055. handler: function( bt ){
  1056. Ext.Msg.show({
  1057. title:"<?=$Labels->GetLabel('_SERV_RESTART_QT_');?>",
  1058. msg: "<?=$Labels->GetLabel('_SERV_RESTART_QM_');?>",
  1059. buttons: Ext.Msg.YESNO,
  1060. width: 400,
  1061. icon: Ext.MessageBox.INFO,
  1062. fn: function(btn, text){
  1063. if( btn == 'yes' ){
  1064. disableServOps();
  1065. doDeviceOperation( 1, 250,'', true );
  1066. };
  1067. }
  1068. });
  1069. }
  1070. }]
  1071. },{
  1072. xtype: 'spacer',
  1073. height: 8
  1074. }
  1075. <?php if( $CUser->Data['access'] > 4 ){ ?>
  1076. ,{
  1077. xtype: 'panel',
  1078. baseCls:'servopInfo_item10',
  1079. id: 'servopPanel02',
  1080. items:[{
  1081. xtype: 'panel',
  1082. frame: false,
  1083. border: false,
  1084. unstyled: true,
  1085. html: "<p><?=$Labels->GetLabel('_SERV_HW_DET_DESC_');?></p><br/>"
  1086. },{
  1087. xtype: 'button',
  1088. iconCls: 'srv_op_hw_init',
  1089. text: "<?=$Labels->GetLabel('_SERV_HW_DET_OP_');?>",
  1090. id: 'tbtn_sop02',
  1091. scale: 'large',
  1092. width: '95%',
  1093. disabled: true,
  1094. handler: function( bt ){
  1095. Ext.Msg.show({
  1096. title:"<?=$Labels->GetLabel('_SERV_HW_DET_QT_');?>",
  1097. msg: "<?=$Labels->GetLabel('_SERV_HW_DET_QM_');?>",
  1098. buttons: Ext.Msg.YESNO,
  1099. width: 400,
  1100. icon: Ext.MessageBox.INFO,
  1101. fn: function(btn, text){
  1102. if( btn == 'yes' ){
  1103. disableServOps();
  1104. doDeviceOperation( 1, 251,'', true );
  1105. };
  1106. }
  1107. });
  1108. }
  1109. }]
  1110. },{
  1111. xtype: 'spacer',
  1112. height: 8
  1113. }
  1114. <?php if( $CUser->Data['access'] > 5 ){ ?>
  1115. ,{
  1116. xtype: 'panel',
  1117. baseCls:'servopInfo_item20',
  1118. id: 'servopPanel03',
  1119. items:[{
  1120. xtype: 'panel',
  1121. frame: false,
  1122. border: false,
  1123. unstyled: true,
  1124. html: "<p><?=$Labels->GetLabel('_SERV_OSRESET_DESC_');?></p><br/>"
  1125. },{
  1126. xtype: 'button',
  1127. iconCls: 'srv_op_power_cycle',
  1128. text: "<?=$Labels->GetLabel('_SERV_OSRESET_OP_');?>",
  1129. id: 'tbtn_sop03',
  1130. scale: 'large',
  1131. width: '95%',
  1132. disabled: true,
  1133. handler: function( bt ){
  1134. Ext.Msg.show({
  1135. title: "<?=$Labels->GetLabel('_SERV_OSRESET_QT_');?>",
  1136. msg: "<?=$Labels->GetLabel('_SERV_OSRESET_QM_');?>",
  1137. buttons: Ext.Msg.YESNO,
  1138. width: 400,
  1139. icon: Ext.MessageBox.WARNING,
  1140. fn: function(btn, text){
  1141. if( btn == 'yes' ){
  1142. cleanupChangeNotifier();
  1143. } else {
  1144. loadEditor = false;
  1145. };
  1146. }
  1147. });
  1148. }
  1149. }]
  1150. },{
  1151. xtype: 'spacer',
  1152. height: 8
  1153. },{
  1154. xtype: 'panel',
  1155. baseCls:'servopInfo_item30',
  1156. id: 'servopPanel04',
  1157. items:[{
  1158. xtype: 'panel',
  1159. frame: false,
  1160. border: false,
  1161. unstyled: true,
  1162. html: "<p><?=$Labels->GetLabel('_SERV_FACTORY_DESC_');?></p><br/>"
  1163. },{
  1164. xtype: 'button',
  1165. iconCls: 'srv_op_factory_reset',
  1166. text: "<?=$Labels->GetLabel('_SERV_FACTORY_OP_');?>",
  1167. id: 'tbtn_sop04',
  1168. scale: 'large',
  1169. width: '95%',
  1170. disabled: true,
  1171. handler: function( bt ){
  1172. Ext.Msg.show({
  1173. title: "<?=$Labels->GetLabel('_SERV_FACTORY_QT_');?>",
  1174. msg: "<?=$Labels->GetLabel('_SERV_FACTORY_QM_');?>",
  1175. buttons: Ext.Msg.YESNO,
  1176. width: 400,
  1177. icon: Ext.MessageBox.ERROR,
  1178. fn: function(btn, text){
  1179. if( btn == 'yes' ){
  1180. disableServOps();
  1181. doDeviceOperation( 1, 254,'', true );
  1182. };
  1183. }
  1184. });
  1185. }
  1186. }]
  1187. }
  1188. <?php
  1189. };
  1190. };
  1191. }; ?>
  1192. ]
  1193. }]
  1194. }
  1195. <?php if( $CUser->Data['access'] > 4 ){ ?>
  1196. ,{
  1197. xtype: 'panel',
  1198. title: "<?=$Labels->GetLabel( '_RESOURCES_' );?>",
  1199. id: 'res_tab',
  1200. layout: 'hbox',
  1201. items:[{
  1202. xtype: 'panel',
  1203. id: 'resources_container',
  1204. flex: 1,
  1205. height: PanelH-15,
  1206. autoScroll: 'auto',
  1207. tbar:[{
  1208. text: "<?=$Labels->GetLabel( '_ADD_REMOTE_UART_' );?>",
  1209. handler: function(){
  1210. addEthernet2Uart();
  1211. }
  1212. }],
  1213. items:[]
  1214. },{
  1215. xtype: 'panel',
  1216. id: 'res_ed_small',
  1217. flex: 1,
  1218. height: PanelH-15,
  1219. layout: 'fit',
  1220. items:[{
  1221. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1222. }]
  1223. }]
  1224. },{
  1225. xtype: 'panel',
  1226. title: "<?=$Labels->GetLabel( '_SERVER_MODULES_' );?>",
  1227. id: 'mod_tab',
  1228. layout: 'hbox',
  1229. items:[{
  1230. xtype: 'panel',
  1231. id: 'modules_container',
  1232. flex: 1,
  1233. height: PanelH-15,
  1234. autoScroll: 'auto',
  1235. tbar:[{
  1236. text: "<?=$Labels->GetLabel( '_ADD_MODULE_' );?>",
  1237. handler: function(){
  1238. var addModuleWindow = new Ext.Window({
  1239. id: 'huha_boa',
  1240. title: "<?=$Labels->GetLabel( '_AS_MODULE_' );?>",
  1241. modal: true,
  1242. width: 400,
  1243. height: 300,
  1244. items:[{
  1245. xtype: 'form',
  1246. items: [{
  1247. xtype: 'combo',
  1248. fieldLabel: "<?=$Labels->GetLabel( 'MOD_TYPE' );?>",
  1249. id: 'mod_type',
  1250. lazyRender: true,
  1251. mode: 'local',
  1252. forceSelection: true,
  1253. triggerAction: 'all',
  1254. editable: false,
  1255. disableKeyFilter: true,
  1256. store: new Ext.data.ArrayStore({
  1257. fields: ['az_t','az_txt'],
  1258. data: [<?php
  1259. $QS = "SELECT * FROM `module_types`";
  1260. $MM = $DATABASE->Query( $QS );
  1261. $MIMO = array();
  1262. foreach( $MM as $M ) $MIMO[]="[{$M['id']},\"".$Labels->GetLabel($M['name'])."\"]";
  1263. echo implode( ',', $MIMO );
  1264. ?>]
  1265. }),
  1266. valueField: 'az_t',
  1267. displayField: 'az_txt',
  1268. value: 1,
  1269. listeners:{
  1270. select: function( t, r, i ){
  1271. var n = r.data.az_t;
  1272. Ext.Ajax.request({
  1273. url: '/lib/controller/getModuleInfo.php',
  1274. params: {
  1275. MID: n,
  1276. UID: <?=$UserID;?>,
  1277. SID: '<?=$Session;?>'
  1278. },
  1279. success: function( response, opts ){
  1280. Ext.getCmp('infopan').update( response.responseText );
  1281. }
  1282. });
  1283. }
  1284. }
  1285. },{
  1286. xtype: 'panel',
  1287. id: 'infopan',
  1288. html: ''
  1289. }]
  1290. }],
  1291. bbar:[{
  1292. text: '<?=$Labels->GetLabel( '_CANCEL_' );?>',
  1293. handler: function(){
  1294. addModuleWindow.close();
  1295. }
  1296. },{
  1297. text: '<?=$Labels->GetLabel( '_ADD_' );?>',
  1298. handler: function(){
  1299. var mtyp = Ext.getCmp('mod_type').getValue();
  1300. Ext.Ajax.request({
  1301. url: '/lib/controller/addModule.php',
  1302. params: {
  1303. SERVID: 1,
  1304. TYPE: mtyp,
  1305. UID: <?=$UserID;?>,
  1306. SID: '<?=$Session;?>'
  1307. },
  1308. success: function( response, opts ){
  1309. // If the response is JSON, you have to decode it
  1310. var data = Ext.decode(response.responseText);
  1311. if( data.status == 'ok' ){
  1312. addModuleWindow.close();
  1313. loadModules();
  1314. } else {
  1315. Ext.Msg.show({
  1316. title: "<?=$Labels->GetLabel("_INFO_MSG_");?>",
  1317. msg: data.message,
  1318. buttons: Ext.Msg.OK,//YESNOCANCEL,
  1319. fn: function(){
  1320. //SettingsLidar3D.hide();
  1321. },
  1322. icon: Ext.MessageBox.INFO //QUESTION
  1323. });
  1324. }
  1325. },
  1326. failure: failureAJAXFunction
  1327. });
  1328. }
  1329. }]
  1330. });
  1331. addModuleWindow.show();
  1332. }
  1333. }],
  1334. items:[]
  1335. },{
  1336. xtype: 'panel',
  1337. id: 'mod_ed_small',
  1338. flex: 1,
  1339. height: PanelH-15,
  1340. layout: 'fit',
  1341. items:[{
  1342. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1343. }]
  1344. }]
  1345. },{
  1346. xtype: 'panel',
  1347. title: "<?=$Labels->GetLabel( '_TARGET_FILTERS_' );?>",
  1348. id: 'flt_tab',
  1349. layout: 'hbox',
  1350. items:[{
  1351. xtype: 'panel',
  1352. id: 'filters_container',
  1353. flex: 1,
  1354. height: PanelH-15,
  1355. autoScroll: 'auto',
  1356. tbar:[{
  1357. text: "<?=$Labels->GetLabel( '_ADD_FILTER_' );?>",
  1358. handler: function(){
  1359. var addFilterWindow = new Ext.Window({
  1360. id: 'fulu_boa',
  1361. title: "<?=$Labels->GetLabel( '_ADD_EVT_FILTER_' );?>",
  1362. modal: true,
  1363. width: 400,
  1364. height: 300,
  1365. items:[{
  1366. xtype: 'form',
  1367. items: [{
  1368. xtype: 'combo',
  1369. fieldLabel: "<?=$Labels->GetLabel( 'MOD_TYPE' );?>",
  1370. id: 'flt_type',
  1371. lazyRender: true,
  1372. mode: 'local',
  1373. forceSelection: true,
  1374. triggerAction: 'all',
  1375. editable: false,
  1376. disableKeyFilter: true,
  1377. store: new Ext.data.ArrayStore({
  1378. fields: ['az_t','az_txt'],
  1379. data: [<?php
  1380. $QS="SELECT `id`,`name` FROM `target_filter_types`";
  1381. $JIJI=$DATABASE->Query( $QS );
  1382. $OOP = array();
  1383. foreach( $JIJI as $JI ) $OOP[] = "[{$JI['id']},'".$Labels->getLabel($JI['name'])."']";
  1384. echo implode(',', $OOP );
  1385. ?>]
  1386. }),
  1387. valueField: 'az_t',
  1388. displayField: 'az_txt',
  1389. value: 1,
  1390. listeners:{
  1391. select: function( t, r, i ){
  1392. var n = r.data.az_t;
  1393. Ext.Ajax.request({
  1394. url: '/lib/controller/getFilterInfo.php',
  1395. params: {
  1396. FID: n,
  1397. UID: <?=$UserID;?>,
  1398. SID: '<?=$Session;?>'
  1399. },
  1400. success: function( response, opts ){
  1401. Ext.getCmp('filt_infopan').update( response.responseText );
  1402. }
  1403. });
  1404. }
  1405. }
  1406. },{
  1407. xtype: 'panel',
  1408. id: 'filt_infopan',
  1409. html: ''
  1410. }]
  1411. }],
  1412. bbar:[{
  1413. text: "<?=$Labels->GetLabel( '_CANCEL_' );?>",
  1414. handler: function(){
  1415. addFilterWindow.close();
  1416. }
  1417. },{
  1418. text: "<?=$Labels->GetLabel( '_ADD_' );?>",
  1419. handler: function(){
  1420. var mtyp = Ext.getCmp('flt_type').getValue();
  1421. Ext.Ajax.request({
  1422. url: '/lib/controller/addFilter.php',
  1423. params: {
  1424. SERVID: 1,
  1425. TYPE: mtyp,
  1426. UID: <?=$UserID;?>,
  1427. SID: '<?=$Session;?>'
  1428. },
  1429. success: function( response, opts ){
  1430. // If the response is JSON, you have to decode it
  1431. var data = Ext.decode(response.responseText);
  1432. if( data.status == 'ok' ){
  1433. addFilterWindow.close();
  1434. loadFilters();
  1435. } else {
  1436. Ext.Msg.show({
  1437. title: "<?=$Labels->GetLabel("_INFO_MSG_");?>",
  1438. msg: data.message,
  1439. buttons: Ext.Msg.OK,//YESNOCANCEL,
  1440. fn: function(){
  1441. //SettingsLidar3D.hide();
  1442. },
  1443. icon: Ext.MessageBox.INFO //QUESTION
  1444. });
  1445. }
  1446. },
  1447. failure: failureAJAXFunction
  1448. });
  1449. }
  1450. }]
  1451. });
  1452. addFilterWindow.show();
  1453. Ext.Ajax.request({
  1454. url: '/lib/controller/getFilterInfo.php',
  1455. params: {
  1456. FID: 1,
  1457. UID: <?=$UserID;?>,
  1458. SID: '<?=$Session;?>'
  1459. },
  1460. success: function( response, opts ){
  1461. Ext.getCmp('filt_infopan').update( response.responseText );
  1462. }
  1463. });
  1464. }
  1465. }],
  1466. items:[]
  1467. },{
  1468. xtype: 'panel',
  1469. id: 'flt_ed_small',
  1470. flex: 1,
  1471. height: PanelH-15,
  1472. layout: 'fit',
  1473. items:[{
  1474. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1475. }]
  1476. }]
  1477. }
  1478. <?php }; ?>
  1479. ],
  1480. listeners:{
  1481. tabchange: function( tp, t ){
  1482. switch( t.getId() ){
  1483. case 'gi_tab': {
  1484. //content_lvl3=0;
  1485. updateServerStatus();
  1486. break;
  1487. };
  1488. case 'res_tab': {
  1489. //content_lvl3=1;
  1490. stopStatusUpdater();
  1491. loadRessources();
  1492. break;
  1493. };
  1494. case 'mod_tab':{
  1495. //content_lvl3=2;
  1496. stopStatusUpdater();
  1497. loadModules();
  1498. break;
  1499. };
  1500. case 'flt_tab':{
  1501. //content_lvl3=3;
  1502. stopStatusUpdater();
  1503. loadFilters();
  1504. break;
  1505. };
  1506. };
  1507. //updateUserContent();
  1508. },
  1509. afterrender: function(){
  1510. settingsAreChanged = false;
  1511. }
  1512. },
  1513. updateSettings: function(){
  1514. alert('Update Settings');
  1515. }
  1516. });
  1517. tPanel.doLayout();
  1518. updateServerStatus();
  1519. };
  1520. function showSettingsSensors(){
  1521. stopStatusUpdater();
  1522. content_lvl1 = 1;
  1523. content_lvl2 = 4;
  1524. var tPanel = Ext.getCmp('main_content');
  1525. tPanel.removeAll( true );
  1526. tPanel.add({
  1527. xtype: 'panel',
  1528. id: 'sen_set',
  1529. layout: 'hbox',
  1530. tbar:[{
  1531. text: "<?=$Labels->GetLabel( '_SMM_ADD_LSEN_' );?>",
  1532. handler: function(){
  1533. addSensor();
  1534. }
  1535. }],
  1536. items:[{
  1537. xtype: 'panel',
  1538. id: 'sens_container',
  1539. flex: 1,
  1540. height: PanelH-15,
  1541. autoScroll: 'auto',
  1542. items:[]
  1543. },{
  1544. xtype: 'panel',
  1545. id: 'sens_op_small',
  1546. flex: 1,
  1547. height: PanelH-15,
  1548. layout: 'fit',
  1549. items:[{
  1550. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1551. }]
  1552. }]
  1553. });
  1554. tPanel.doLayout();
  1555. loadAttachedSensors();
  1556. };
  1557. function showSettingsDetection(){
  1558. stopStatusUpdater();
  1559. content_lvl1 = 1;
  1560. content_lvl2 = 4;
  1561. var tPanel = Ext.getCmp('main_content');
  1562. tPanel.removeAll( true );
  1563. tPanel.add({
  1564. xtype: 'panel',
  1565. id: 'sen_set',
  1566. layout: 'hbox',
  1567. tbar:[{
  1568. text: "<?=$Labels->GetLabel( '_SMM_ADD_LSEN_' );?>",
  1569. handler: function(){
  1570. addSensor();
  1571. }
  1572. }],
  1573. items:[{
  1574. xtype: 'panel',
  1575. id: 'sens_container',
  1576. flex: 1,
  1577. height: PanelH-15,
  1578. autoScroll: 'auto',
  1579. items:[]
  1580. },{
  1581. xtype: 'panel',
  1582. id: 'sens_op_small',
  1583. flex: 1,
  1584. height: PanelH-15,
  1585. layout: 'fit',
  1586. items:[{
  1587. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1588. }]
  1589. }]
  1590. });
  1591. tPanel.doLayout();
  1592. loadAttachedSensors();
  1593. };
  1594. function editSensorHW( cid ){
  1595. SelectedSensor = cid;
  1596. Ext.Ajax.request({
  1597. url: '/lib/controller/getSensorEditor.php',
  1598. params: {
  1599. CID: SelectedSensor,
  1600. UID: <?=$UserID;?>,
  1601. SID: '<?=$Session;?>'
  1602. },
  1603. success: function( response, opts ){
  1604. var data = Ext.decode( response.responseText );
  1605. var tComp = Ext.getCmp('sens_op_small');
  1606. if( data.status == 'ok' ){
  1607. if( tComp!= null ){
  1608. var content = Ext.decode( data.content );
  1609. tComp.removeAll( true );
  1610. tComp.add( content );
  1611. tComp.doLayout();
  1612. };
  1613. } else {
  1614. if( tComp!= null ){
  1615. tComp.removeAll( true );
  1616. tComp.add( data );
  1617. tComp.doLayout();
  1618. };
  1619. };
  1620. },
  1621. failure: function(){
  1622. }
  1623. });
  1624. };
  1625. var cameraEditorContent = null;
  1626. function editCamera( cid, etyp ){
  1627. SelectedCam = cid;
  1628. switch( etyp ){
  1629. case 0: cameraEditorContent = Ext.getCmp('dcam_op_small'); break;
  1630. case 1: cameraEditorContent = Ext.getCmp('acam_op_small'); break;
  1631. };
  1632. Ext.Ajax.request({
  1633. url: '/lib/controller/getCameraEditor.php',
  1634. params: {
  1635. CID: SelectedCam,
  1636. UID: <?=$UserID;?>,
  1637. SID: '<?=$Session;?>'
  1638. },
  1639. success: function( response, opts ){
  1640. var data = Ext.decode( response.responseText );
  1641. if( data.status == 'ok' ){
  1642. if( cameraEditorContent!= null ){
  1643. var content = Ext.decode( data.content );
  1644. cameraEditorContent.removeAll( true );
  1645. cameraEditorContent.add( content );
  1646. cameraEditorContent.doLayout();
  1647. };
  1648. } else {
  1649. if( cameraEditorContent!= null ){
  1650. cameraEditorContent.removeAll( true );
  1651. cameraEditorContent.add( data );
  1652. cameraEditorContent.doLayout();
  1653. };
  1654. };
  1655. },
  1656. failure: function(){
  1657. }
  1658. });
  1659. };
  1660. function showSettingsVideo(){
  1661. stopStatusUpdater();
  1662. content_lvl1 = 1;
  1663. content_lvl2 = 4;
  1664. var tPanel = Ext.getCmp('main_content');
  1665. tPanel.removeAll( true );
  1666. tPanel.add({
  1667. xtype: 'tabpanel',
  1668. frame: false,
  1669. id: 'node_settings_content',
  1670. border: false,
  1671. activeTab: content_lvl3,
  1672. items: [{
  1673. xtype: 'panel',
  1674. title: "<?=$Labels->GetLabel('_CAM_DET_LIST_');?>",
  1675. id: 'cam_det_tab',
  1676. layout: 'hbox',
  1677. items:[{
  1678. xtype: 'panel',
  1679. id: 'dcam_container',
  1680. flex: 1,
  1681. height: PanelH-15,
  1682. autoScroll: 'auto',
  1683. tbar:[{
  1684. text: "<?=$Labels->GetLabel( '_MANUADD_CAMERA_' );?>",
  1685. handler: function(){
  1686. addDetectedIPCam();
  1687. }
  1688. }],
  1689. items:[]
  1690. },{
  1691. xtype: 'panel',
  1692. id: 'dcam_op_small',
  1693. flex: 1,
  1694. height: PanelH-15,
  1695. layout: 'fit',
  1696. items:[{
  1697. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1698. }]
  1699. }]
  1700. },{
  1701. xtype: 'panel',
  1702. id: 'cam_ass_tab',
  1703. title: "<?=$Labels->GetLabel('_CAM_ASS_LIST_');?>",
  1704. layout: 'hbox',
  1705. items:[{
  1706. xtype: 'panel',
  1707. id: 'acam_container',
  1708. flex: 1,
  1709. height: PanelH-15,
  1710. autoScroll: 'auto',
  1711. items:[]
  1712. },{
  1713. xtype: 'panel',
  1714. id: 'acam_op_small',
  1715. flex: 1,
  1716. height: PanelH-15,
  1717. layout: 'fit',
  1718. items:[{
  1719. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1720. }]
  1721. }]
  1722. }],
  1723. listeners:{
  1724. tabchange: function( tp, t ){
  1725. switch( t.getId() ){
  1726. case 'cam_det_tab': {
  1727. content_lvl3=0;
  1728. stopStatusUpdater();
  1729. loadDetectedCameras();
  1730. break;
  1731. };
  1732. case 'cam_ass_tab': {
  1733. content_lvl3=1;
  1734. stopStatusUpdater();
  1735. loadAssignedCameras();
  1736. break;
  1737. };
  1738. case 'mod_tab':{
  1739. content_lvl3=2;
  1740. stopStatusUpdater();
  1741. loadModules();
  1742. break;
  1743. };
  1744. case 'net_tab':{
  1745. content_lvl3=3;
  1746. stopStatusUpdater();
  1747. break;
  1748. };
  1749. };
  1750. updateUserContent();
  1751. },
  1752. afterrender: function(){
  1753. settingsAreChanged = false;
  1754. }
  1755. }
  1756. });
  1757. tPanel.doLayout();
  1758. updateUserContent();
  1759. updateServerStatus();
  1760. };
  1761. function showSettingsApplication(){
  1762. stopStatusUpdater();
  1763. content_lvl1 = 1;
  1764. content_lvl2 = 3;
  1765. //Load Location
  1766. prepareMapData();
  1767. var tPanel = Ext.getCmp('main_content');
  1768. tPanel.removeAll( true );
  1769. tPanel.add({
  1770. xtype: 'tabpanel',
  1771. frame: false,
  1772. id: 'settings_a_content',
  1773. border: false,
  1774. activeTab: 0,
  1775. items:[{
  1776. title: "<?=$Labels->GetLabel('_WORKING_MODE_');?>",
  1777. xtype: 'form',
  1778. labelAlign: 'right',
  1779. labelWidth: 180,
  1780. height: PanelH - 30,
  1781. items:[{
  1782. xtype: 'spacer',
  1783. height: 10
  1784. },{
  1785. xtype: 'panel',
  1786. frame: false,
  1787. border: true,
  1788. bodyStyle: 'background-color: white;',
  1789. <?php
  1790. echo "html: '<center><img height=\"120px\" src=\"/style/assets/{$AP_DATA['oem_logo']}.png\"></center>',";
  1791. ?>
  1792. height: 130
  1793. },{
  1794. xtype: 'spacer',
  1795. height: 10
  1796. },{
  1797. xtype: 'textfield',
  1798. fieldLabel: "<?=$Labels->GetLabel( '_INSTANCE_ID_' );?>",
  1799. width: 300,
  1800. value: '<?php
  1801. $QS = "SELECT `identity` FROM `servers` LIMIT 1";
  1802. $TT = $DATABASE->Query( $QS );
  1803. if( count( $TT ) ){
  1804. echo $TT[0]['identity'];
  1805. } else {
  1806. echo "----No-Identity-Set---";
  1807. };
  1808. ?>'
  1809. },{
  1810. xtype: 'spacer',
  1811. height: 10
  1812. },{
  1813. xtype: 'button',
  1814. text: "<?=$Labels->GetLabel( '_GEN_INSTANCE_ID_' );?>",
  1815. width: 500,
  1816. handler: function(){
  1817. doApplicationOperation( 3, 0 );
  1818. }
  1819. },{
  1820. xtype: 'spacer',
  1821. height: 10
  1822. },{
  1823. xtype: 'combo',
  1824. fieldLabel: "<?=$Labels->GetLabel('_DEBUGGING_MODE_');?>",
  1825. editable: false,
  1826. typeAhead: true,
  1827. triggerAction: 'all',
  1828. width: '100%',
  1829. lazyRender:true,
  1830. mode: 'local',
  1831. store: new Ext.data.ArrayStore({
  1832. fields: ['sid', 'snam'],
  1833. data: [[0,"<?=$Labels->GetLabel('__DISABLED__');?>"], [1,"<?=$Labels->GetLabel('___ENABLED__');?>"]]
  1834. }),
  1835. value: <?=$AP_DATA['work_mode'];?>,
  1836. valueField: 'sid',
  1837. displayField: 'snam',
  1838. listeners:{
  1839. select: function( t, r, i ){
  1840. doApplicationOperation( 1, i );
  1841. }
  1842. }
  1843. }]
  1844. },
  1845. <?php if( $AP_DATA['type']!=1){ ?>
  1846. {
  1847. title: "<?=$Labels->GetLabel('_GEO_LOCATION_');?>",
  1848. layout: 'column',
  1849. items:[{
  1850. columnWidth: 0.83,
  1851. frame: false,
  1852. border: false,
  1853. items: [{
  1854. //layout: 'fit',
  1855. //height: PanelH-150,
  1856. //flex: 1,
  1857. //border: true,
  1858. //items:{
  1859. xtype: 'panel',
  1860. id: 'sys_location_map',
  1861. height: PanelH-170,
  1862. html: '&nbsp;',
  1863. listeners:{
  1864. afterrender: function( t, state ){
  1865. loadLocationEditor('sys_location_map');
  1866. }
  1867. }
  1868. //}
  1869. },{
  1870. layout: 'table',
  1871. title: "<?=$Labels->GetLabel('_SITE_PROP_LBL_');?>",
  1872. flex: 1,
  1873. defaults: {
  1874. bodyStyle:'padding:20px'
  1875. },
  1876. layoutConfig: {
  1877. // The total column count must be specified here
  1878. columns: 8,
  1879. textAlign: 'center'
  1880. },
  1881. items:[{
  1882. border: false,
  1883. id: 'lab_123',
  1884. html: "<?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?> "+((MAP_IS_LOCAL)?'Pos X':"<?=$Labels->GetLabel('_LON_SHORT_LBL_');?>")+':'
  1885. },{
  1886. xtype: 'numberfield',
  1887. width: 100,
  1888. decimalPrecision: 8,
  1889. id: 'siteLon',
  1890. value: SiteLon
  1891. },{
  1892. border: false,
  1893. id: 'lab_124',
  1894. html: ((MAP_IS_LOCAL)?'Pos Y':"<?=$Labels->GetLabel('_LAT_SHORT_LBL_');?>")+':'
  1895. },{
  1896. xtype: 'numberfield',
  1897. id: 'siteLat',
  1898. decimalPrecision: 8,
  1899. width: 100,
  1900. value: SiteLat
  1901. },{
  1902. border: false,
  1903. html: "<?=$Labels->GetLabel('_ALT_SHORT_LBL_');?>:"
  1904. },{
  1905. xtype: 'numberfield',
  1906. decimalPrecision: 2,
  1907. width: 100,
  1908. id: 'siteAlt',
  1909. value: SiteAlt
  1910. },{
  1911. xtype: 'button',
  1912. text: "<?=$Labels->GetLabel('_UPDATE_LBL_');?>",
  1913. handler: updateSiteAnchor
  1914. },{
  1915. xtype: 'panel',
  1916. frame: false,
  1917. border: false,
  1918. rowspan: 2,
  1919. 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">')
  1920. },{
  1921. border: false,
  1922. html: "<?=$Labels->GetLabel('_MAP_TYP_LBL_');?>:"
  1923. },/*{
  1924. xtype: 'radio',
  1925. name: 'map_type',
  1926. boxLabel: '<?=$Labels->GetLabel('_MAP_REG_LBL_');?>',
  1927. checked: true,
  1928. value: 0
  1929. },{
  1930. xtype: 'radio',
  1931. name: 'map_type',
  1932. boxLabel: '<?=$Labels->GetLabel('_MAP_CUST_LBL_');?>',
  1933. colspan: 2,
  1934. value: 1
  1935. },*/{
  1936. xtype: 'combo',
  1937. disabled: false,
  1938. typeAhead: true,
  1939. triggerAction: 'all',
  1940. id: 'siteMap',
  1941. lazyRender:true,
  1942. colspan: 3,
  1943. mode: 'local',
  1944. store: mapListStore /*new Ext.data.ArrayStore({
  1945. id: 0,
  1946. fields: ['map_id', 'map_text' ],
  1947. data: [[1, 'OpenStreetMap'], [2, 'OpenTopoMap'], [3, 'EsriSat'], [4, 'EsriStreet'], [5, 'EsriTopo']]
  1948. })*/,
  1949. value: MAP_ID,
  1950. valueField: 'map_id',
  1951. displayField: 'map_name',
  1952. listeners:{
  1953. select: function(){
  1954. updateSiteMap();
  1955. LoadNodesList();
  1956. }
  1957. }
  1958. }/*,{
  1959. xtype: 'button',
  1960. disabled: false,
  1961. text: '<?=$Labels->GetLabel('_EDIT_');?>',
  1962. handler: function(){
  1963. editCurrentMap();
  1964. }
  1965. }*/,{
  1966. xtype: 'button',
  1967. disabled: false,
  1968. text: "<?=$Labels->GetLabel('_DELETE_');?>",
  1969. handler: function(){
  1970. deleteCurrentMap();
  1971. }
  1972. },{
  1973. xtype: 'button',
  1974. id: 'add-c_map-btn',
  1975. disabled: false,
  1976. text: "<?=$Labels->GetLabel('_CREATE_NEW_LBL_');?>",
  1977. handler: function(){
  1978. createNewMap();
  1979. }
  1980. }]
  1981. }]
  1982. },{
  1983. //title: 'Properties',
  1984. frame: true,
  1985. border: false,
  1986. xtype: 'panel',
  1987. flex: 1,
  1988. height: PanelH,
  1989. columnWidth: 0.17,
  1990. layout: 'fit',
  1991. id: 'prop_content',
  1992. items:[{
  1993. html: "<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1994. }]
  1995. }]
  1996. },
  1997. <?php };?>{
  1998. title: "<?=$Labels->GetLabel('_BACKUP_SETTINGS_');?>",
  1999. xtype: 'form',
  2000. id: 'as_dbbackup',
  2001. fileUpload: true,
  2002. labelAlign: 'right',
  2003. labelWidth: 180,
  2004. height: PanelH - 30,
  2005. items:[{
  2006. xtype: 'spacer',
  2007. height: 10
  2008. },{
  2009. xtype: 'button',
  2010. text: "<?=$Labels->GetLabel( '_DOWNLOAD_SETTINGS_' );?>",
  2011. width: 500,
  2012. handler: downloadSettings
  2013. },{
  2014. xtype: 'spacer',
  2015. height: 10
  2016. },{
  2017. xtype: 'fileuploadfield',
  2018. id: 'db_file',
  2019. emptyText: "<?=$Labels->GetLabel('_DB_BACKUP_');?>",
  2020. fieldLabel: "<?=$Labels->GetLabel('_SELE_DBBACKUP_');?>",
  2021. width: 300,
  2022. name: 'db_file',
  2023. buttonText: "<?=$Labels->GetLabel('_BROWSE_');?>"
  2024. },{
  2025. xtype: 'spacer',
  2026. height: 10
  2027. },{
  2028. xtype: 'button',
  2029. text: "<?=$Labels->GetLabel( '_APLY_DBBACKUP_' );?>",
  2030. width: 500,
  2031. handler: function(){
  2032. if( Ext.getCmp('as_dbbackup').getForm().isValid()){
  2033. Ext.getCmp('as_dbbackup').getForm().submit({
  2034. url: '/lib/controller/doDatabaseOperation.php',
  2035. waitMsg: "<?=$Labels->GetLabel('_DB_UPLOAD_BACKUP_');?>...",
  2036. encoding: 'multipart/form-data',
  2037. success: function(fp, o){
  2038. }
  2039. });
  2040. };
  2041. }
  2042. },{
  2043. xtype: 'spacer',
  2044. height: 10
  2045. }<?php
  2046. if( file_exists( '../../controller/data/factory.db' ) ){
  2047. ?>,{
  2048. xtype: 'button',
  2049. text: "<?=$Labels->GetLabel( '_FACTORY_RESET_' );?>",
  2050. width: 500,
  2051. handler: function(){
  2052. doDeviceOperation( 1, 254, '', true );
  2053. }
  2054. }<?php
  2055. };
  2056. ?>]
  2057. },{
  2058. title: "<?=$Labels->GetLabel('_REPORT_STORAGE_');?>",
  2059. xtype: 'form',
  2060. id: 'as_reposit',
  2061. labelAlign: 'right',
  2062. labelWidth: 180,
  2063. height: PanelH - 30,
  2064. items:[{
  2065. xtype: 'spacer',
  2066. height: 10
  2067. },{
  2068. xtype: 'numberfield',
  2069. id: 'stor_days',
  2070. fieldLabel: "<?=$Labels->GetLabel('_STORE_DAYS_');?>",
  2071. width: 300,
  2072. value: <?=intval($AP_DATA['report_cleanup']);?>,
  2073. name: 'stor_time',
  2074. listeners: {
  2075. change: function( t, b, o ){
  2076. doApplicationOperation( 4, b );
  2077. }
  2078. }
  2079. },{
  2080. xtype: 'spacer',
  2081. height: 10
  2082. },{
  2083. xtype: 'slider',
  2084. id: 'stor_space',
  2085. fieldLabel: "<?=$Labels->GetLabel('_STORE_EMPTY_SPACE_');?>",
  2086. value: <?=intval($AP_DATA['preserve_empty']);?>,
  2087. width: 300,
  2088. name: 'stor_space',
  2089. listeners: {
  2090. change: function( t, b, o ){
  2091. doApplicationOperation( 5, b );
  2092. }
  2093. }
  2094. },{
  2095. xtype: 'spacer',
  2096. height: 10
  2097. },{
  2098. xtype: 'button',
  2099. text: "<?=$Labels->GetLabel( '_APPLY_SETTINGS_' );?>",
  2100. width: 500,
  2101. handler: function(){
  2102. doDeviceOperation( 1, 250, '', true );
  2103. }
  2104. },{
  2105. xtype: 'spacer',
  2106. height: 10
  2107. }]
  2108. }]
  2109. });
  2110. tPanel.doLayout();
  2111. updateUserContent();
  2112. };
  2113. function showSettingsUpgrade(){
  2114. stopStatusUpdater();
  2115. content_lvl1 = 1;
  2116. content_lvl2 = 4;
  2117. var tPanel = Ext.getCmp('main_content');
  2118. tPanel.removeAll( true );
  2119. initial_md5 = '';
  2120. tPanel.add({
  2121. columnWidth: 1.0,
  2122. frame: false,
  2123. border: false,
  2124. items: [{
  2125. frame: false,
  2126. border: false,
  2127. collapsible: false,
  2128. draggable: false,
  2129. layout: 'vbox',
  2130. //layoutConfig: {
  2131. // align : 'stretch',
  2132. // pack : 'start',
  2133. //},
  2134. height: PanelH,
  2135. items:[{
  2136. title: "<?=$Labels->getLabel('_MAP_MONITORING_');?>",
  2137. xtype: 'panel',
  2138. height: PanelH-300,
  2139. //flex: 1,
  2140. frame: true,
  2141. width: '100%',
  2142. border: false,
  2143. layout: {
  2144. type: 'table',
  2145. columns: 2,
  2146. tableAttrs: {
  2147. valign: 'top',
  2148. style: 'valign:top;width:100%;'
  2149. }
  2150. },
  2151. defaults: {
  2152. frame: true,
  2153. border: false,
  2154. height: ( PanelH-400 ) / 2,
  2155. style: 'margin: 5px;width:400px;display:block;'
  2156. },
  2157. items:[{
  2158. title: 'Current System Info',
  2159. width: '100%',
  2160. //flex: 1,
  2161. html: '<p>Current Web Version:&nbsp;<b><?=$ARGUS_WEB_VERSION;?></b></p>'
  2162. },{
  2163. title: 'Tasks',
  2164. //width: 400,
  2165. layout: 'vbox',
  2166. items:[{
  2167. xtype: 'button',
  2168. width: '100%',
  2169. text: 'Create Database Backup',
  2170. handler: function(){
  2171. createNewTask( 2 );
  2172. }
  2173. },{
  2174. xtype: 'button',
  2175. width: '100%',
  2176. text: 'Create Full Snapeshot',
  2177. handler: function(){
  2178. createNewTask( 255 );
  2179. }
  2180. }]
  2181. },{
  2182. title: 'Archives',
  2183. height: 250,
  2184. width: '100%',
  2185. tbar:[{
  2186. text: 'Restore',
  2187. id: 'ar_restore_btn',
  2188. handler: function(){
  2189. createNewTask(1, selectedArchiveRecord.data.file_name );
  2190. }
  2191. },{
  2192. text: 'Download',
  2193. id: 'ar_download_btn',
  2194. handler: function(){
  2195. if( selectedArchiveRecord!= null ){
  2196. window.open( '/lib/php/setup_toolkit/vault/'+selectedArchiveRecord.data.base_version + '/'+ selectedArchiveRecord.data.file_name );
  2197. };
  2198. }
  2199. },{
  2200. text: 'Delete',
  2201. id: 'ar_delete_btn',
  2202. handler: function(){
  2203. createNewTask(100, selectedArchiveRecord.data.file_name );
  2204. }
  2205. }],
  2206. items:[{
  2207. xtype: 'grid',
  2208. id: 'archives_grid',
  2209. border: false,
  2210. frame: false,
  2211. autoScroll: true,
  2212. //width: '100%',
  2213. lazyRender: true,
  2214. height: 210,
  2215. ds: archives_store,
  2216. cm: new Ext.grid.ColumnModel( archivesColModel_ops ),
  2217. sm: new Ext.grid.RowSelectionModel( archivesSelModel_ops ),
  2218. viewConfig: {
  2219. // forceFit: true
  2220. },
  2221. }]
  2222. },{
  2223. title: 'Task Status',
  2224. height: 250,
  2225. //flex: 1,
  2226. items:[{
  2227. xtype: 'spacer',
  2228. height: 4
  2229. },{
  2230. id: 'ctask_status',
  2231. border: true,
  2232. html: ''
  2233. },{
  2234. xtype: 'spacer',
  2235. height: 4
  2236. },{
  2237. xtype: 'textarea',
  2238. id: 'task_log',
  2239. height: ( PanelH-320 ) / 2 - 120,
  2240. style: 'font-size:9px;width:100%;margin-bottom:4px;',
  2241. readOnly: true,
  2242. autoScroll: true,
  2243. value: ''
  2244. },{
  2245. xtype: 'progress',
  2246. id: 'task_progress',
  2247. value: 1.0,
  2248. text: 'idle',
  2249. disabled: true
  2250. }],
  2251. tbar:[{
  2252. text: 'Cancel Task',
  2253. id: 'ch_ta_btn',
  2254. disabled: true,
  2255. handler: deleteNewTask
  2256. }]
  2257. }]
  2258. },{
  2259. title: '<?=$Labels->getLabel('_UPLOAD_PACKAGE_');?>',
  2260. xtype: 'panel',
  2261. height: 300,
  2262. //flex: 1,
  2263. frame: true,
  2264. border: false,
  2265. //layout: 'vbox',
  2266. items:[{
  2267. xtype:'button',
  2268. id: 'pickfiles',
  2269. width: '100%',
  2270. text: 'Choose File'
  2271. },{
  2272. height: 200,
  2273. xtype: 'grid',
  2274. id: 'upload_grid',
  2275. border: false,
  2276. frame: false,
  2277. mode: 'local',
  2278. lazyRender: true,
  2279. width: '100%',
  2280. autoScroll: true,
  2281. ds: uploads_store,
  2282. cm: new Ext.grid.ColumnModel( fileUploadsColModel_ops ),
  2283. sm: new Ext.grid.RowSelectionModel( fileUploadsSelModel_ops ),
  2284. viewConfig: {
  2285. forceFit: true
  2286. },
  2287. bbar: [{
  2288. text: 'Clear',
  2289. width: '100%',
  2290. handler: function(){
  2291. muploader.splice();
  2292. uploads_store.removeAll();
  2293. }
  2294. }]
  2295. },{
  2296. xtype:'button',
  2297. id: 'umpalumpa',
  2298. width: '100%',
  2299. disabled: true,
  2300. text: 'Upload',
  2301. handler: function(){
  2302. if( muploader!= null ){
  2303. muploader.start();
  2304. };
  2305. }
  2306. }],
  2307. listeners:{
  2308. afterrender: function(){
  2309. muploader = new plupload.Uploader({
  2310. runtimes : 'html5,html4',
  2311. browse_button : Ext.getDom('pickfiles'), // you can pass in id...
  2312. //container: document.getElementById('upupu'), // ... or DOM Element itself
  2313. max_file_size : '1000mb',
  2314. chunk_size: '200kb',
  2315. max_retries: 3,
  2316. multi_selection: false,
  2317. max_file_count: 1,
  2318. // Fake server response here
  2319. url: '/lib/php/setup_toolkit/upload.php',
  2320. //url: "/echo/json",
  2321. //flash_swf_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/flash/Moxie.cdn.swf',
  2322. //silverlight_xap_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/silverlight/Moxie.cdn.xap',
  2323. filters : [
  2324. //{title : "Image files", extensions : "jpg,gif,png"},
  2325. {title : "Archive files", extensions : "rar,zip,gz,bz2"}
  2326. ],
  2327. init: {
  2328. PostInit: function() {
  2329. //$('filelist').innerHTML = '';
  2330. //$('uploadfiles').onclick = function() {
  2331. // uploader.start();
  2332. // return false;
  2333. //};
  2334. },
  2335. FilesAdded: function( up, files ) {
  2336. Ext.getCmp('umpalumpa').enable();
  2337. plupload.each( files, function(file) {
  2338. uploads_store.loadData( [[ uploads_store_id, file.name, file.id, plupload.formatSize( file.size ), 0, 'N' ]], true );
  2339. uploads_store_id++;
  2340. Ext.getCmp('upload_grid').doLayout();
  2341. });
  2342. },
  2343. UploadProgress: function(up, file) {
  2344. var pb = Ext.getCmp( 'progress_'+file.id );
  2345. if( file.percent < 100 ){
  2346. pb.updateProgress( file.percent / 100, file.percent + '%', false );
  2347. } else {
  2348. pb.updateProgress( 1.0, 'Uploaded', false );
  2349. };
  2350. },
  2351. Error: function(up, err) {
  2352. Ext.Msg.show({
  2353. title:'Upload Status',
  2354. msg: "Error #" + err.code + ": " + err.message,
  2355. buttons: Ext.Msg.OK,
  2356. icon: Ext.MessageBox.ERROR
  2357. });
  2358. }
  2359. }
  2360. });
  2361. muploader.init();
  2362. }
  2363. }
  2364. }]
  2365. }]
  2366. });
  2367. muploader = null;
  2368. uploads_store.removeAll();
  2369. tPanel.doLayout();
  2370. archives_store.load();//{params:{start:0, limit:50, src: 'arch', fil: selecredActiveSourceFilter }});
  2371. updateTaskStatus();
  2372. tlInterval = window.setInterval( updateTaskStatus, 333 );
  2373. };
  2374. function loadSensorDetectionSettings( sensid ){
  2375. Ext.Ajax.request({
  2376. url: '/lib/controller/getSensorDetectionEditor.php',
  2377. params: {
  2378. UID: <?=$UserID;?>,
  2379. SID: '<?=$Session;?>',
  2380. SEN: sensid
  2381. },
  2382. success: function( response, opts ){
  2383. var data = Ext.decode( response.responseText );
  2384. var tComp = Ext.getCmp('main_content');
  2385. if( data.status == 'ok' ){
  2386. if( tComp!= null ){
  2387. var content = Ext.decode( data.content );
  2388. tComp.removeAll( true );
  2389. tComp.add( content );
  2390. tComp.doLayout();
  2391. };
  2392. } else {
  2393. if( tComp!= null ){
  2394. tComp.removeAll( true );
  2395. tComp.add( data );
  2396. tComp.doLayout();
  2397. };
  2398. };
  2399. },
  2400. failure: function(){
  2401. }
  2402. });
  2403. };
  2404. function initSettingsView(){
  2405. if( tlInterval!= null ){
  2406. window.clearInterval( tlInterval );
  2407. tlInterval = null;
  2408. timelineObj = null;
  2409. };
  2410. var tP = Ext.getCmp('left_side_menu');
  2411. //tP.doLayout();
  2412. //tP.setVisible( false );
  2413. tP.removeAll( true );
  2414. tP.add({
  2415. id: 'sme_inner',
  2416. layout:'accordion',
  2417. //height: PanelH,
  2418. frame: false,
  2419. border: false,
  2420. layoutConfig:{
  2421. animate: true//,
  2422. //activeOnTop: true
  2423. },
  2424. items:[]
  2425. });
  2426. tP.doLayout();
  2427. tP = Ext.getCmp('sme_inner');
  2428. <?php if( $CUser->Data['access'] > 3 ){ ?>
  2429. tP.add({
  2430. title: "<?=$Labels->GetLabel('_SYS_SETTINGS_');?>",
  2431. layout: 'vbox',
  2432. height: 120,
  2433. pack: 'center',
  2434. align : 'strech',
  2435. collapsed: ( content_lvl1 != 0 ),
  2436. items:[{
  2437. xtype: 'button',
  2438. width: '100%',
  2439. id:'sys_edit',
  2440. text: "<?=$Labels->GetLabel('_SYS_GENERAL_');?>",
  2441. enableToggle: true,
  2442. pressed: ( content_lvl2 == 0 && content_lvl1 == 0 ),
  2443. allowDepress: false,
  2444. toggleGroup: 'sys_settings',
  2445. handler: showSettingsGeneral
  2446. }
  2447. <?php if( $CUser->Data['access'] > 4 ){ ?>
  2448. ,{
  2449. xtype: 'button',
  2450. width: '100%',
  2451. id:'map_edit',
  2452. text: "<?=$Labels->GetLabel('_SENSOR_CONNECTION_');?>",
  2453. enableToggle: true,
  2454. pressed: ( content_lvl2 == 1 && content_lvl1 == 0 ),
  2455. allowDepress: false,
  2456. toggleGroup: 'sys_settings',
  2457. handler: showSettingsSensors
  2458. },{
  2459. xtype: 'button',
  2460. width: '100%',
  2461. id:'video_set',
  2462. text: "<?=$Labels->GetLabel('_CAMERA_MNGMNT_');?>",
  2463. enableToggle: true,
  2464. pressed: ( content_lvl2 == 2 && content_lvl1 == 0 ),
  2465. allowDepress: false,
  2466. toggleGroup: 'sys_settings',
  2467. handler: showSettingsVideo
  2468. },{
  2469. xtype: 'button',
  2470. width: '100%',
  2471. id:'app_set',
  2472. text: "<?=$Labels->GetLabel('_APPLICA_MNGMNT_');?>",
  2473. enableToggle: true,
  2474. pressed: ( content_lvl2 == 3 && content_lvl1 == 0 ),
  2475. allowDepress: false,
  2476. toggleGroup: 'sys_settings',
  2477. handler: showSettingsApplication
  2478. }
  2479. <?php }; ?>
  2480. ]
  2481. });
  2482. <?php if( $CUser->Data['access'] > 4 ){ ?>
  2483. tP.add({
  2484. title: "<?=$Labels->GetLabel('_DET_SETTINGS_');?>",
  2485. layout: 'vbox',
  2486. height: 120,
  2487. pack: 'center',
  2488. align : 'strech',
  2489. collapsed: ( content_lvl1 != 1 ),
  2490. items:[<?php
  2491. if( $AP_DATA['type'] == 1 ){
  2492. ?>
  2493. {
  2494. xtype: 'button',
  2495. width: '100%',
  2496. id:'go_home',
  2497. text: "<?=$Labels->GetLabel('_UPPER_SENSOR_');?>",
  2498. enableToggle: true,
  2499. pressed: ( content_lvl2 == 0 && content_lvl1 == 1 ),
  2500. allowDepress: false,
  2501. toggleGroup: 'det_settings',
  2502. handler: loadMetroControlUpper
  2503. },{
  2504. xtype: 'button',
  2505. width: '100%',
  2506. id:'go_monitor',
  2507. text: "<?=$Labels->GetLabel('_BOTTOM_SENSOR_');?>",
  2508. enableToggle: true,
  2509. pressed: ( content_lvl2 == 1 && content_lvl1 == 1 ),
  2510. allowDepress: false,
  2511. toggleGroup: 'det_settings',
  2512. handler: loadMetroControlBottom
  2513. },{
  2514. xtype: 'button',
  2515. width: '100%',
  2516. id:'go_archive',
  2517. text: "<?=$Labels->GetLabel('_FUSION_ENGINE_');?>",
  2518. enableToggle: true,
  2519. pressed: ( content_lvl2 == 2 && content_lvl1 == 1 ),
  2520. allowDepress: false,
  2521. toggleGroup: 'det_settings',
  2522. handler: loadMetroControlFusion
  2523. }<?php
  2524. } else {
  2525. $QS = "SELECT `name`, `aux_id` FROM `nodes` WHERE `type`>0 AND `type`<5";
  2526. $RR = $DATABASE->Query( $QS );
  2527. if( count( $RR ) ){
  2528. foreach( $RR as $CR ){
  2529. ?>
  2530. {
  2531. xtype: 'button',
  2532. width: '100%',
  2533. text: '<?=$CR['name'];?>',
  2534. enableToggle: true,
  2535. pressed: ( content_lvl2 == 0 && content_lvl1 == 1 ),
  2536. allowDepress: false,
  2537. toggleGroup: 'det_settings',
  2538. handler: function(){
  2539. loadSensorDetectionSettings( <?=$CR['aux_id'];?> );
  2540. }
  2541. },
  2542. <?php
  2543. };
  2544. } else {
  2545. ?>
  2546. {
  2547. xtype: 'spacer',
  2548. html: "<?=$Labels->GetLabel('_NO_SENSORS_DEF_');?>",
  2549. height: 32
  2550. },
  2551. <?php
  2552. };
  2553. ?>
  2554. {
  2555. xtype: 'spacer',
  2556. height: 10
  2557. }<?php
  2558. };
  2559. ?>]
  2560. });
  2561. <?php };
  2562. }; ?>
  2563. tP.add({
  2564. title: "<?=$Labels->GetLabel('_PROF_SETTINGS_');?>",
  2565. items:[<?php
  2566. $ZIGA = array();
  2567. foreach( $Site_Languages as $SL ){
  2568. if( $SL['id'] == $CUser->Data['language'] ){
  2569. $ZIGA[] = "{ xtype:'button', text:'{$SL['name']}', width: '100%', enableToggle: true, pressed : true, handler: function(){ window.location = '/?Lang={$SL['id']}'; } }";
  2570. } else {
  2571. $ZIGA[] = "{ xtype:'button', text:'{$SL['name']}', width: '100%', handler: function(){ window.location = '/?Lang={$SL['id']}'; } }";
  2572. };
  2573. };
  2574. echo implode(',',$ZIGA );
  2575. ?>]
  2576. });
  2577. <?php if( $CUser->Data['access'] > 5 ){ ?>
  2578. tP.add({
  2579. title: "<?=$Labels->GetLabel('_ADM_SETTINGS_');?>",
  2580. collapsed: ( content_lvl1 != 3 ),
  2581. items:[{
  2582. xtype: 'button',
  2583. width: '100%',
  2584. id:'adm_acc',
  2585. text: "<?=$Labels->GetLabel('_USERS_MNGMT_');?>",
  2586. enableToggle: true,
  2587. pressed: ( content_lvl2 == 0 && content_lvl1 == 3 ),
  2588. allowDepress: false,
  2589. toggleGroup: 'adm_settings',
  2590. handler: function( b, e ){
  2591. loadUserEditor();
  2592. }
  2593. },{
  2594. xtype: 'button',
  2595. width: '100%',
  2596. id:'adm_acclog',
  2597. text: "<?=$Labels->GetLabel('_ACC_LOG_');?>",
  2598. enableToggle: true,
  2599. pressed: ( content_lvl2 == 1 && content_lvl1 == 3 ),
  2600. allowDepress: false,
  2601. toggleGroup: 'adm_settings',
  2602. handler: function( b, e ){
  2603. loadAccessLog();
  2604. }
  2605. },{
  2606. xtype: 'button',
  2607. width: '100%',
  2608. id:'adm_servlog',
  2609. text: "<?=$Labels->GetLabel('_SERV_LOG_');?>",
  2610. enableToggle: true,
  2611. pressed: ( content_lvl2 == 2 && content_lvl1 == 3 ),
  2612. allowDepress: false,
  2613. toggleGroup: 'adm_settings',
  2614. handler: function( b, e ){
  2615. loadServerLog();
  2616. }
  2617. }]
  2618. });
  2619. <?php
  2620. };
  2621. ?>
  2622. tP.setVisible( true );
  2623. tP.doLayout();
  2624. switch( content_lvl1 ){
  2625. default:{
  2626. switch( content_lvl2 ){
  2627. default: showSettingsGeneral(); break;
  2628. <?php if( $CUser->Data['access'] > 5 ){ ?>
  2629. case 1: showSettingsSensors(); break;
  2630. case 2: showSettingsVideo(); break;
  2631. case 3: showSettingsApplication(); break;
  2632. <?php }; ?>
  2633. //case 4: showSettingsUpgrade(); break;
  2634. };
  2635. };
  2636. case 1:{
  2637. switch( content_lvl2 ){
  2638. case 0: break;
  2639. };
  2640. break;
  2641. };
  2642. <?php if( $CUser->Data['access'] > 5 ){ ?>
  2643. case 3:{
  2644. switch( content_lvl2 ){
  2645. case 0: loadUserEditor(); break;
  2646. };
  2647. break;
  2648. };
  2649. <?php }; ?>
  2650. };
  2651. };