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.

2017 lines
64 KiB

​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
4 years ago
​
4 years ago
​
​
10 months ago
4 years ago
​
​
​
​
3 years ago
​
4 years ago
​
​
4 years ago
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
10 months ago
​
​
​
4 years ago
​
​
3 years ago
10 months ago
3 years ago
​
4 years ago
​
3 years ago
3 years ago
3 years ago
3 years ago
10 months ago
3 years ago
​
​
4 years ago
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
3 years ago
​
10 months ago
12 months ago
​
​
10 months 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
3 years ago
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
4 years ago
​
​
10 months ago
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
10 months ago
4 years ago
​
10 months ago
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
4 years ago
3 years ago
4 years ago
​
​
​
​
​
​
​
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
4 years ago
​
​
​
​
​
3 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
3 years ago
4 years ago
​
4 years ago
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
4 years ago
3 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
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
  1. //<?php require_once('../../js_asm.php'); ?>
  2. var map = null;
  3. var selectedMarker = null;
  4. var timelineObj = null;
  5. var tlGroups = new vis.DataSet();
  6. var tlItems = new vis.DataSet();
  7. var selecredActiveSourceFilter = 0;
  8. var rep_store_id = 0;
  9. var rep_array = new Array();
  10. var rep_store = new Ext.data.JsonStore({
  11. autoDestroy: false,
  12. storeId: 'log_store',
  13. //idIndex: 0,
  14. idProperty: 'id',
  15. fields: [
  16. {name: 'id', type: 'int' },
  17. {name: 'node_id', type: 'int' },
  18. {name: 'geo', type: 'bool' },
  19. {name: 'node_name', type: 'string' },
  20. {name: 'dts', type: 'string'},
  21. {name: 'rts', type: 'int'},
  22. {name: 'ts', type: 'int'},
  23. {name: 'ms', type: 'string'},
  24. {name: 'type', type: 'int'},
  25. {name: 'bid', type: 'int'},
  26. {name: 'range', type: 'string'},
  27. {name: 'az', type: 'string'},
  28. {name: 'el', type: 'string'},
  29. {name: 'r', type: 'int'},
  30. {name: 'width', type: 'int'},
  31. {name: 'video',type: 'int'},
  32. {name: 'lat', type: 'float'},
  33. {name: 'lon', type: 'float'}
  34. ]
  35. });
  36. function rep_sn_Renderer( value, meta, record ){
  37. //Must be set according to events
  38. var kaka = record.data.node_id % 3;
  39. return '<div class="log_line_' + kaka + '">'+value+'</div>';
  40. };
  41. function rep_hv_Renderer( value, meta, record ){
  42. switch( value ){
  43. case 1: return '<img src="/style/icons/icons/photo.png">';
  44. case 2: return '<img src="/style/icons/icons/film.png">';
  45. };
  46. return '';
  47. };
  48. function rep_et_Renderer( value, meta, record ){
  49. var kaka = record.data.node_id % 3;
  50. switch( value ){
  51. case 6: ov = "<?=$Labels->GetLabel('_EVT_MSG_STUMO_');?>"; break;
  52. case 7: ov = "<?=$Labels->GetLabel('_EVT_MSG_BUMO_');?>"; break;
  53. case 8: ov = "<?=$Labels->GetLabel('_EVT_MSG_FLIPO_');?>"; break;
  54. case 9: ov = "<?=$Labels->GetLabel('_EVT_MSG_SCANC_');?>"; break;
  55. case 10: ov = "<?=$Labels->GetLabel('_EVT_MSG_B3DTRG_');?>"; break;
  56. case 11: ov = "<?=$Labels->GetLabel('_EVT_MSG_W3DTRG_');?>"; break;
  57. case 12: ov = "<?=$Labels->GetLabel('_EVT_MSG_B2DTRG_');?>"; break;
  58. case 13: ov = "<?=$Labels->GetLabel('_EVT_MSG_W2DTRG_');?>"; break;
  59. case 36: ov = "<?=$Labels->GetLabel('_EVT_MSG_ROI_');?>"; break;
  60. case 39: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_CT_');?>"; break;
  61. case 40: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_USD_');?>"; break;
  62. case 41: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_BSD_');?>"; break;
  63. case 42: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_TD_');?>"; break;
  64. case 43: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_TUPD_');?>"; break;
  65. case 44: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_SUSPA_');?>"; break;
  66. case 79: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_SUSPN_');?>"; break;
  67. case 46: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_RD_');?>"; break;
  68. case 47: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_DD_');?>"; break;
  69. case 48: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_SUSPD_');?>"; break;
  70. case 49: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_DIFD_');?>"; break;
  71. case 52: ov = "<?=$Labels->GetLabel('_EVT_MSG_EVT_START_');?>"; break;
  72. case 53: ov = "<?=$Labels->GetLabel('_EVT_MSG_EVT_END_');?>"; break;
  73. case 54: ov = "<?=$Labels->GetLabel('_EVT_MSG_EVT_CLOMA_');?>"; break;
  74. case 55: ov = "<?=$Labels->GetLabel('_EVT_MSG_CONNECTED_');?>"; break;
  75. case 56: ov = "<?=$Labels->GetLabel('_EVT_MSG_DISCONNECTED_');?>"; break;
  76. case 57: ov = "<?=$Labels->GetLabel('_EVT_MSG_COM_JAMED_');?>"; break;
  77. case 58: ov = "<?=$Labels->GetLabel('_EVT_MSG_VIFDEC_');?>"; break;
  78. case 59: ov = "<?=$Labels->GetLabel('_EVT_MSG_VIFINC_');?>"; break;
  79. case 68: ov = "<?=$Labels->GetLabel('_EVT_MSG_ACKON_');?>"; break;
  80. case 69: ov = "<?=$Labels->GetLabel('_EVT_MSG_ACKOFF_');?>"; break;
  81. case 70: ov = "<?=$Labels->GetLabel('_EVT_MSG_MASKON_');?>"; break;
  82. case 71: ov = "<?=$Labels->GetLabel('_EVT_MSG_MASKOFF_');?>"; break;
  83. case 72: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_OM_DIS_');?>"; break;
  84. case 73: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_OM_TD_');?>"; break;
  85. case 74: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_OM_UP_');?>"; break;
  86. case 75: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_OM_TG_');?>"; break;
  87. case 76: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_OM_EXPIRED_');?>"; break;
  88. case 77: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_TD_EXPIRED_');?>"; break;
  89. case 78: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_SUSP_EXPIRED_');?>"; break;
  90. case 86: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_BUBBLE_CREATED_');?>"; break;
  91. case 87: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_BUBBLE_POPPED_');?>"; break;
  92. case 93: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_BUBBLE_BLOCK_T_');?>"; break;
  93. case 94: ov = "<?=$Labels->GetLabel('_EVT_MSG_TF_BUBBLE_BLOCK_P_');?>"; break;
  94. default: ov = "<?=$Labels->GetLabel('_EVENT_');?> ["+value+"]";
  95. };
  96. return '<div class="log_line_' + kaka + '">'+ov+'</div>';
  97. };
  98. function r_no_target_filter( value, meta, record ){
  99. if( record.data.type >9 && record.data.type < 52 || record.data.type == 86 || record.data.type == 87 || record.data.type == 93 || record.data.type == 94 ) return value;
  100. return '';
  101. };
  102. var rep_ColModel_ops = {
  103. columns: [
  104. {header: "<?=$Labels->GetLabel('_TIME_');?>", width: 180, fixed: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'dts' },
  105. {header: "<?=$Labels->GetLabel('_SOURCE_');?>", width: 100, renderer: rep_sn_Renderer, align: 'left', css: 'vertical-align: middle;', dataIndex: 'node_name' },
  106. {header: "",width: 28,fixed:true,renderer: rep_hv_Renderer, center: 'left', css: 'vertical-align: middle;', dataIndex: 'video' },
  107. {header: "<?=$Labels->GetLabel('_TYPE_');?>", width: 180, renderer: rep_et_Renderer, fixed: false, align: 'center', css: 'vertical-align: middle;', dataIndex: 'type' },
  108. {header: "<?=$Labels->GetLabel('_BUBBLE_ID_');?>", width: 100, dataIndex: 'bid', renderer: r_no_target_filter },
  109. {header: "<?=$Labels->GetLabel('_RANGE_');?>", width: 100, dataIndex: 'range', renderer: r_no_target_filter },
  110. {header: "<?=$Labels->GetLabel('_AZIMUTH_');?>", width: 100, dataIndex: 'az', renderer: r_no_target_filter },
  111. {header: "<?=$Labels->GetLabel('_WIDTH_');?>", width: 100, dataIndex: 'width', renderer: r_no_target_filter }
  112. ],
  113. defaults: {
  114. sortable: false,
  115. fixed: true,
  116. menuDisabled: true,
  117. width: 100
  118. }
  119. };
  120. var cRowSelected = -1;
  121. var rep_SelModel_ops = {
  122. singleSelect: true,
  123. listeners: {
  124. rowselect: function(sm, row, rec ) {
  125. cRowSelected = row;
  126. if( map!= undefined ) if( map != null ){
  127. if( selectedMarker!= null ){
  128. selectedMarker.remove();
  129. if( rec.data.geo ){
  130. //alert( 'Geo!' );
  131. //map.removeLayer( selectedMarker );
  132. //tt = ''+EventRec.geo.lat+' '+EventRec.geo.lon;
  133. selectedMarker.setLatLng([rec.data.lat, rec.data.lon]);
  134. selectedMarker.addTo( map );
  135. };
  136. };
  137. };
  138. loadEventData( rec.data );
  139. //alert( rec.data.id );
  140. //loadEventProperties( rec.data );
  141. //SelectedEvent = rec.data.id;
  142. //alert( SelectedEvent );
  143. //var CB = Ext.getCmp('con_to_src');
  144. //CB.enable();
  145. //selectedArchiveRecord = rec;
  146. //if( rec.data.bk_type!=3 ){
  147. //
  148. //} else {
  149. //
  150. //};
  151. }
  152. }
  153. };
  154. var bubble_store = new Ext.data.JsonStore({
  155. autoDestroy: false,
  156. storeId: 'bubble_store',
  157. //idIndex: 0,
  158. idProperty: 'id',
  159. fields: [
  160. {name: 'id', type: 'int' },
  161. {name: 'range', type: 'string'},
  162. {name: 'az', type: 'string'},
  163. {name: 'el', type: 'string'},
  164. {name: 'r', type: 'int'},
  165. {name: 'count', type: 'int'},
  166. {name: 'x', type: 'float'},
  167. {name: 'y', type: 'float'},
  168. {name: 'z', type: 'float'}
  169. ]
  170. });
  171. var bubble_ColModel_ops = {
  172. columns: [
  173. {header: "<?=$Labels->GetLabel('_BUBBLE_ID_');?>", width: 100, dataIndex: 'id' },
  174. {header: "<?=$Labels->GetLabel('_TARGET_COUNT_');?>", sortable: true, width: 100, dataIndex: 'count' },
  175. {header: "<?=$Labels->GetLabel('_RANGE_');?>", dataIndex: 'range' },
  176. {header: "<?=$Labels->GetLabel('_AZIMUTH_');?>", dataIndex: 'az' },
  177. {header: "<?=$Labels->GetLabel('_ELEVATION_');?>", dataIndex: 'el' }
  178. ],
  179. defaults: {
  180. sortable: false,
  181. fixed: true,
  182. menuDisabled: true,
  183. width: 100
  184. }
  185. };
  186. var bubble_SelectedRows = null;
  187. var bubble_SelModel_ops = {
  188. singleSelect: false,
  189. listeners: {
  190. rowselect: function(sm, row, rec ) {
  191. Ext.getCmp('sbaw_sbp_btn').enable();
  192. loadBubbleData( rec.data );
  193. },
  194. rowdeselect: function(sm, row, rec ) {
  195. if(!sm.hasSelection()){
  196. Ext.getCmp('sbaw_sbp_btn').disable();
  197. }
  198. }
  199. }
  200. };
  201. var cevt = Array();
  202. var coz = Array();
  203. function showHistoryOnMap( data, removeCursor ){
  204. if( removeCursor ) map.removeLayer( selectedMarker );
  205. if( cevt.length ){
  206. for( i=0; i< cevt.length; i++ ){
  207. if( cevt[i]!= null ){
  208. cevt[i].remove();
  209. delete( cevt[i] );
  210. cevt[i] = null;
  211. };
  212. };
  213. };
  214. if( coz.length ){
  215. for( i=0; i< coz.length; i++ ){
  216. if( coz[i]!= null ){
  217. coz[i].remove();
  218. delete( coz[i] );
  219. coz[i]=null;
  220. };
  221. };
  222. };
  223. if( data.log.length ){
  224. var zz = 1.0 / ( data.log.length + 1 );
  225. var idx = 0;
  226. for( i=0; i < data.log.length; i++ ){
  227. if( data.log[i].geo ){
  228. var cp_color='#FF0000';
  229. var opa = ( 1.0 - i * zz );
  230. switch( data.log[i].type ){
  231. case 36: cp_color='#0000FF'; opa = 1.0; break;
  232. };
  233. cevt[idx] = L.circleMarker( [data.log[i].lat, data.log[i].lon], {id:data.log[i].id, color: cp_color, radius: 5, stroke: false, fillOpacity: opa } );//.on('click', function( e, a ){ loadEventPropertiesByID( this.options.id ); } );
  234. cevt[idx].addTo(map);
  235. idx++;
  236. };
  237. };
  238. };
  239. };
  240. var selectedMarkerIcon = L.icon({
  241. iconUrl: '/style/assets/cursor.png',
  242. iconSize: [32, 32],
  243. iconAnchor: [16, 16]//,
  244. //popupAnchor: [-3, -76],
  245. //shadowUrl: 'my-icon-shadow.png',
  246. //shadowSize: [68, 95],
  247. //shadowAnchor: [22, 94]
  248. });
  249. selectedMarker = L.marker([SiteLat, SiteLon], { draggable: false, icon: selectedMarkerIcon } );
  250. var tlOptions = {
  251. groupOrder: 'content', // groupOrder can be a property name or a sorting function
  252. stack: true,
  253. showCurrentTime: true,
  254. //verticalScroll: true,
  255. //zoomKey: 'ctrlKey',
  256. minHeight: 308,
  257. maxHeight: 308
  258. };
  259. var tlLoadLocker = false;
  260. var tlLastTS = 0;
  261. var tlInterval = null;
  262. var tlMonitoring = false;
  263. // Calendar
  264. var CurrentDate=(new Date())/1000;
  265. var today=new Date();
  266. var SY=1900+today.getYear();
  267. var SMO=today.getMonth()+1;
  268. var SD=today.getDate();
  269. var SelectedDay = SD;
  270. var Dates = new Array();
  271. function CheckDate(D){
  272. for(j_index=0;j_index<Dates.length;j_index++){
  273. if (Dates[j_index]==D)return true;
  274. };
  275. return false;
  276. };
  277. function ShiftBAK(){
  278. CurrentDate=CurrentDate-24*3600*GetMonthLength(CurrentDate);
  279. BuildCalendar();
  280. SMO = GetMonthNum(CurrentDate);
  281. SY = GetYear(CurrentDate);
  282. if( SD > GetMonthLength(CurrentDate) ) SD = GetMonthLength(CurrentDate);
  283. loadCalendarDates();
  284. };
  285. function ShiftFWD(){
  286. CurrentDate=CurrentDate+24*3600*GetMonthLength(CurrentDate);
  287. BuildCalendar();
  288. SMO = GetMonthNum(CurrentDate);
  289. SY = GetYear(CurrentDate);
  290. if( SD > GetMonthLength(CurrentDate) ) SD = GetMonthLength(CurrentDate);
  291. loadCalendarDates();
  292. };
  293. function GetMonthName(UTS){ // Unix Time Stamp
  294. var MoNames= new Array();
  295. MoNames[0]='January';
  296. MoNames[1]='February';
  297. MoNames[2]='March';
  298. MoNames[3]='April';
  299. MoNames[4]='May';
  300. MoNames[5]='June';
  301. MoNames[6]='July';
  302. MoNames[7]='August';
  303. MoNames[8]='September';
  304. MoNames[9]='October';
  305. MoNames[10]='November';
  306. MoNames[11]='December';
  307. CDate=new Date();
  308. CDate.setTime(UTS*1000);
  309. CMo=CDate.getMonth();
  310. return MoNames[CMo];
  311. };
  312. function GetMonthShift(UTS){ // Unix Time Stamp
  313. CDate=new Date();
  314. CDate.setTime(UTS*1000);
  315. CDate.setTime((UTS-(CDate.getDate()-1)*86400)*1000);
  316. return CDate.getDay();
  317. };
  318. function GetMonthLength(UTS){ // Unix Time Stamp
  319. CDate=new Date();
  320. CDate.setTime(UTS*1000);
  321. CD=CDate.getDate();
  322. RetVal=31;
  323. CDate.setTime((UTS+(31-CD)*86400)*1000);
  324. if ( CDate.getDate()==31) return RetVal;
  325. RetVal=30;
  326. CDate.setTime((UTS+(30-CD)*86400)*1000);
  327. if ( CDate.getDate()==30) return RetVal;
  328. RetVal=29;
  329. CDate.setTime((UTS+(29-CD)*86400)*1000);
  330. if ( CDate.getDate()==29) return RetVal;
  331. RetVal=28;
  332. CDate.setTime((UTS+(28-CD)*86400)*1000);
  333. if ( CDate.getDate()==28) return RetVal;
  334. return -1;
  335. };
  336. function GetMonthNum(UTS){ // Unix Time Stamp
  337. CDate=new Date();
  338. CDate.setTime(UTS*1000);
  339. return CDate.getMonth()+1;
  340. };
  341. function GetYear(UTS){ // Unix Time Stamp
  342. CDate=new Date();
  343. CDate.setTime(UTS*1000);
  344. y=CDate.getYear();
  345. if (y<100)y+=2000;
  346. if (y<200)y+=1900;
  347. return y;
  348. };
  349. function GetDay(UTS){ // Unix Time Stamp
  350. CDate=new Date();
  351. CDate.setTime(UTS*1000);
  352. y=CDate.getDate();
  353. return y;
  354. };
  355. function selectDate( m, d ){
  356. SY = GetYear(CurrentDate);
  357. SMO = m;
  358. SD = d;
  359. SelectedDay = SD;
  360. getData( 'arch' );
  361. };
  362. function BuildCalendar( ){
  363. Msh=GetMonthShift(CurrentDate);
  364. Mnm=GetMonthName(CurrentDate);
  365. Mln=GetMonthLength(CurrentDate);
  366. Mid=GetMonthNum(CurrentDate);
  367. Mye=GetYear(CurrentDate);
  368. InDTA='<table cellpadding="2" cellspacing="0"><tr height="19px"><td valign="middle"><a href="#" onclick="ShiftBAK();"><img src="/style/img/calendar/l_cal_b.gif"></a></td><td colspan="5" class="CalendarMN" align="center">'+Mnm+' '+Mye+'</td><td><a href="#" onclick="ShiftFWD();"><img border=0 src="/style/img/calendar/r_cal_b.gif"></a></td></tr>';
  369. InDTA+='<tr><td class="CalendarWT" align="center">Su</td><td class="CalendarWT" align="center">Mo</td><td class="CalendarWT" align="center">Tu</td><td class="CalendarWT" align="center">We</td><td class="CalendarWT" align="center">Th</td><td class="CalendarWT" align="center">Fr</td><td class="CalendarWT" align="center">Sa</td></tr>';
  370. InDTA+='<tr>';
  371. for(index=0;index<Msh;index++){
  372. InDTA+='<td style="padding: 1px"><div id="disabled" class="calendar_t">&nbsp;</div></td>';
  373. };
  374. for(;index<(Mln+Msh);index++){
  375. if( CheckDate(index-Msh+1) ){
  376. //InDTA+='<td style="padding: 1px"><div id="ds'+Mid.toString()+(index-Msh+1).toString()+'" onclick="selectDate('+Mid.toString()+','+(index-Msh+1).toString()+');" href="#" title="'+(index-Msh+1).toString()+'" class="CalendarDE">'+(index-Msh+1).toString()+'</a></td>';
  377. if( SD == index ){
  378. InDTA+='<td style="padding: 1px"><div id="selected_day" onclick="selectDate('+Mid.toString()+','+(index-Msh+1).toString()+');" title="Selected" class="calendar_t">'+(index-Msh+1).toString()+'</div></td>';
  379. } else {
  380. InDTA+='<td style="padding: 1px"><div id="have_data_day" onclick="selectDate('+Mid.toString()+','+(index-Msh+1).toString()+');" title="Have Events" class="calendar_t">'+(index-Msh+1).toString()+'</div></td>';
  381. };
  382. } else {
  383. if( SD == index ){
  384. InDTA+='<td style="padding: 1px"><div id="selected_day" class="calendar_t" title="Selected">'+(index-Msh+1).toString()+'</a></td>';
  385. } else {
  386. InDTA+='<td style="padding: 1px"><div id="no_data_day" class="calendar_t" title="No Events">'+(index-Msh+1).toString()+'</a></td>';
  387. };
  388. };
  389. if ((index+1)%7==0){
  390. InDTA+='</tr><tr>';
  391. };
  392. };
  393. for(;(index)%7!=0;index++){
  394. InDTA+='<td style="padding: 1px"><div id="disabled" class="calendar_t">&nbsp;</div></td>';
  395. };
  396. InDTA+='</tr></table>';
  397. tab=document.getElementById('calendar_TD');
  398. tab.innerHTML=InDTA;
  399. };
  400. function loadCalendarDates(){
  401. ReportSelectionMode = 0;
  402. Ext.MessageBox.wait("<?=$Labels->GetLabel('_Loading_Calo_');?>","<?=$Labels->GetLabel('_Please_Wait_');?>",{
  403. width: '100%',
  404. hidden: true,
  405. progress: true,
  406. closable: false
  407. });
  408. ReportLayoutLoadded = false;
  409. Ext.Ajax.request({
  410. url: '/lib/controller/getEventDates.php',
  411. params: {
  412. NID: selecredActiveSourceFilter,
  413. UID: <?=$UserID;?>,
  414. SID: '<?=$Session;?>',
  415. SYE: SY,
  416. SMO: SMO
  417. },
  418. success: function( response, opts ){
  419. Ext.MessageBox.hide();
  420. var data = Ext.decode( response.responseText );
  421. if( data.status == 'ok' ){
  422. Dates = data.days;
  423. BuildCalendar();
  424. //for( var i = 0; i < data.days.length; i++ ){
  425. //
  426. //};
  427. };
  428. },
  429. failure: function( response, opts ) {
  430. Ext.MessageBox.hide();
  431. }
  432. });
  433. };
  434. var eventsListStore = new Ext.data.JsonStore({
  435. root: 'log',
  436. totalProperty: 'totalCount',
  437. idProperty: 'id',
  438. remoteSort: true,
  439. fields: [{
  440. name: 'id',
  441. type: 'int'
  442. },{
  443. name: 'date',
  444. type: 'string'
  445. },{
  446. name: 'time',
  447. type: 'string'
  448. },{
  449. name: 'device',
  450. type: 'string'
  451. },{
  452. name: 'event',
  453. type: 'int'
  454. },{
  455. name: 'data',
  456. type: 'string',
  457. },{
  458. name: 'has_target',
  459. type: 'boolean'
  460. },{
  461. name: 'has_geo',
  462. type: 'boolean'
  463. },{
  464. name: 'has_images',
  465. type: 'boolean'
  466. },{
  467. name: 'images',
  468. type: 'Array'
  469. },{
  470. name: 'dev_type',
  471. type: 'int'
  472. },{
  473. name: 'geo',
  474. type: 'object'
  475. }] /*,
  476. proxy : new Ext.data.HttpProxy({
  477. method: 'POST',
  478. prettyUrls: false,
  479. url: '/lib/controller/getEventRecords.php',
  480. headers: {
  481. UID: <?=$UserID;?>,
  482. SID: '<?=$Session;?>',
  483. NID: 1
  484. }
  485. })*/
  486. });
  487. var SelectedEvent = 0;
  488. var EventPanelWindow = null;
  489. function showEventPanel(){
  490. if( EventPanelWindow == null ){
  491. EventPanelWindow = new Ext.Window({
  492. modal: true,
  493. title: '<?=$Labels->GetLabel("_EVENT_VIEWER_");?>',
  494. width: winW*0.66,
  495. height: winH*0.66,
  496. layout: 'fit',
  497. closeAction: 'hide',
  498. items:[{
  499. title: 'Cameras',
  500. html:'koko',
  501. autoScroll: true,
  502. height: 320
  503. },{
  504. html: 'koko22',
  505. height: 320
  506. }]
  507. });
  508. };
  509. EventPanelWindow .show();
  510. };
  511. var bubbleAnalyticsWindow = null;
  512. var bubbleFilterSize = 0.5
  513. function doBubbleAnalyze(){
  514. Ext.Ajax.request({
  515. url: '/lib/controller/getBubbleAnalysis.php',
  516. params: {
  517. UID: <?=$UserID;?>,
  518. SID: '<?=$Session;?>',
  519. BS: bubbleFilterSize,
  520. TS: currentHistoryTS,
  521. BID: currentHistoryBeginId,
  522. EID: currentHistoryEndId
  523. },
  524. success: function( response, opts ){
  525. var data = Ext.decode( response.responseText );
  526. if( data.status == 'nok' ){
  527. Ext.Msg.show({
  528. title:'<?=$Labels->GetLabel('_FAILURE_');?>',
  529. msg: data.msg,
  530. buttons: Ext.Msg.OK,
  531. icon: Ext.MessageBox.INFO
  532. });
  533. } else {
  534. showBubbleAnalytics( data.bubbles );
  535. };
  536. },
  537. failure: function( response, opts ) {
  538. }
  539. });
  540. };
  541. function showBubbleAnalytics( data ){
  542. if( bubbleAnalyticsWindow == null ){
  543. bubbleAnalyticsWindow = new Ext.Window({
  544. modal: true,
  545. title: '<?=$Labels->GetLabel("_BUBBLE_ANALYSIS_");?>',
  546. width: winW*0.66,
  547. height: winH*0.66,
  548. layout: 'fit',
  549. resizable: false,
  550. closeAction: 'hide',
  551. tbar:[{
  552. id: 'sbaw_ubs_btn',
  553. text: 'Update Bubble Size',
  554. disabled: true,
  555. handler: function(){
  556. bubbleFilterSize = Ext.getCmp('sbaw_ubs_num').getValue();
  557. doBubbleAnalyze();
  558. }
  559. },'-',{
  560. id: 'sbaw_ubs_num',
  561. xtype: 'numberfield',
  562. style: {
  563. fontSize: '12px'
  564. },
  565. width: 50,
  566. value: bubbleFilterSize,
  567. listeners:{
  568. change: function( t, n, o ){
  569. var rr=Ext.getCmp('sbaw_ubs_btn');
  570. rr.enable();
  571. rr=Ext.getCmp('sbaw_ubs_sld');
  572. rr.suspendEvents( false );
  573. rr.setValue( n*10, true );
  574. rr.resumeEvents();
  575. }
  576. }
  577. },'-',{
  578. id: 'sbaw_ubs_sld',
  579. xtype: 'slider',
  580. value: (bubbleFilterSize * 10),
  581. increment: 5,
  582. minValue: 0,
  583. width: 250,
  584. maxValue: 100,
  585. listeners: {
  586. change: function( t, b, o ){
  587. var rr=Ext.getCmp('sbaw_ubs_btn');
  588. rr.enable();
  589. rr=Ext.getCmp('sbaw_ubs_num');
  590. rr.suspendEvents( false );
  591. rr.setValue( b/10, true );
  592. rr.resumeEvents();
  593. }
  594. }
  595. }],
  596. bbar:['->',{
  597. text: 'Cancel',
  598. handler: function(){
  599. bubbleAnalyticsWindow.hide();
  600. }
  601. },{
  602. id: 'sbaw_sbp_btn',
  603. text: 'Set Selected Bubbles as Permanent',
  604. disabled: true,
  605. handler: function(){
  606. var sm = Ext.getCmp('bubble_grid').getSelectionModel();
  607. var ada = sm.getSelections();
  608. var ids ='';
  609. for( i=0; i<ada.length; i++ ) ids += ada[i].id+',';
  610. ids += '-1';
  611. Ext.Ajax.request({
  612. url: '/lib/controller/setPermanentBubbles.php',
  613. params: {
  614. UID: <?=$UserID;?>,
  615. SID: '<?=$Session;?>',
  616. BS: bubbleFilterSize,
  617. TS: currentHistoryTS,
  618. BID: currentHistoryBeginId,
  619. EID: currentHistoryEndId,
  620. SBID: ids
  621. },
  622. success: function( response, opts ){
  623. var data = Ext.decode( response.responseText );
  624. bubbleAnalyticsWindow.hide();
  625. if( data.status == 'nok' ){
  626. Ext.Msg.show({
  627. title:'<?=$Labels->GetLabel('_FAILURE_');?>',
  628. msg: data.msg,
  629. buttons: Ext.Msg.OK,
  630. icon: Ext.MessageBox.ERROR
  631. });
  632. } else {
  633. Ext.Msg.show({
  634. title:'<?=$Labels->GetLabel('_SUCCESS_');?>',
  635. msg: data.msg,
  636. buttons: Ext.Msg.OK,
  637. icon: Ext.MessageBox.INFO
  638. });
  639. };
  640. },
  641. failure: failureAJAXFunction
  642. });
  643. }
  644. }],
  645. items:[{
  646. id: 'bubble_a_container',
  647. frame: false,
  648. border: false,
  649. layout: 'table',
  650. layoutConfig: {
  651. columns: 2
  652. },
  653. items:[{
  654. id: 'bubble_map',
  655. frame: false,
  656. border: false,
  657. draggable: false,
  658. collapsible: false,
  659. listeners:{
  660. afterrender: function(p){
  661. var W = Ext.getCmp( 'bubble_a_container' ).getHeight();
  662. var H = W;
  663. Ext.getCmp( 'bubble_map' ).setWidth( W );
  664. p.setHeight( H );
  665. Ext.getCmp( 'cp_radar_bubble' ).setHeight( H );
  666. Ext.getCmp( 'cp_radar_bubble' ).setWidth( H );
  667. document.getElementById('draw_svgr_bubble').setAttribute("width", H-80 );
  668. /*var el = document.getElementById('div_radar_bubble');
  669. el.addEventListener( "fullscreenchange", ( evt )=>{
  670. if( document.fullscreenElement ){
  671. } else {
  672. if( fsDrawID ){
  673. var el = document.getElementById('draw_svgr_'+fsDrawID );
  674. el.removeAttribute("width");
  675. el.setAttribute( "width", H-80 );
  676. fsDrawID = 0;
  677. };
  678. };
  679. });*/
  680. //window.setTimeout( load2DDraw, 10*%%%NODEID%%%, %%%NODEID%%%, 'draw_svgr_' );
  681. }
  682. },
  683. layout: 'hbox',
  684. items:[{
  685. id: 'cp_radar_bubble',
  686. html: '<div id="div_radar_bubble" style="display: block; padding: 5px; width: \'100%\'; height: \'100%\';"><center><svg id="draw_svgr_bubble" opacity="1.0" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="100%" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd;" viewBox="0 0 574 574" xmlns:xlink="http://www.w3.org/1999/xlink"><text id="g_txt_bubble" text-anchor="left" transform="rotate(0,35,35)" x="35" y="35" fill="#FFF212" style="font: 30px sans-serif">100 m.</text><circle fill="#00A859" stroke="none" cx="287" cy="287" r="284"/><circle id="border_bubble" fill="none" stroke="#373435" stroke-width="5.92139" cx="287" cy="287" r="284"/><circle id="r50_bubble" fill="none" stroke="#FFF212" stroke-width="3.94741" cx="287" cy="287" r="142"/><text id="50_txt_bubble" text-anchor="left" transform="rotate(45,140,140)" x="140" y="140" fill="#FFF212" style="font: 25px sans-serif">50</text><circle id="r25_bubble" fill="none" stroke="#FFF212" stroke-width="2.96042" cx="287" cy="287" r="71"/><text id="25_txt_bubble" text-anchor="left" transform="rotate(45,210,210)" x="210" y="210" fill="#FFF212" style="font: 15px sans-serif">25</text><circle id="r12_bubble" fill="none" stroke="#FFF212" stroke-width="1.47993" cx="287" cy="287" r="34"/><text id="12_txt_bubble" text-anchor="left" transform="rotate(45,245,245)" x="245" y="245" fill="#FFF212" style="font: 10px sans-serif">12.5</text><line fill="none" stroke="#FFF212" stroke-width="3.94741" x1="287" y1="3" x2="287" y2="571"/><line fill="none" stroke="#FFF212" stroke-width="3.94741" x1="3" y1="287" x2="571" y2="287"/><circle fill="none" stroke="#373435" stroke-width="5.92139" cx="287" cy="287" r="284"/></svg></center></div>',
  687. width: '100%'
  688. }]
  689. },{
  690. xtype: 'grid',
  691. id: 'bubble_grid',
  692. border: false,
  693. frame: false,
  694. autoScroll: true,
  695. //width: '100%',
  696. lazyRender: true,
  697. height: 210,
  698. ds: bubble_store,
  699. cm: new Ext.grid.ColumnModel( bubble_ColModel_ops ),
  700. sm: new Ext.grid.RowSelectionModel( bubble_SelModel_ops ),
  701. viewConfig: {
  702. forceFit: true,
  703. getRowClass: function( record, rowIndex, rowParams, store){
  704. switch( record.get('id')%5 ){
  705. case 0: return 'row-level01';
  706. case 1: return 'row-level02';
  707. case 2: return 'row-level03';
  708. case 3: return 'row-level04';
  709. case 4: return 'row-level05';
  710. };
  711. return '';
  712. }
  713. },
  714. listeners:{
  715. afterrender : function( t ){
  716. var H = Ext.getCmp( 'bubble_a_container' ).getHeight();
  717. var W = Ext.getCmp( 'bubble_a_container' ).getWidth() - H -5;
  718. t.setHeight( H );
  719. t.setWidth( W );
  720. }
  721. }
  722. }]
  723. }]
  724. });
  725. };
  726. bubbleAnalyticsWindow.show();
  727. var csvg = document.getElementById( 'draw_svgr_bubble' );
  728. if( csvg!= undefined ){
  729. var roi = csvg.getElementById( "roi" );
  730. if( roi != null ) csvg.removeChild( roi );
  731. };
  732. bubble_store.removeAll();
  733. bubble_store.loadData( data );
  734. };
  735. function ModeRenderer(val){
  736. var p1, p2, p3;
  737. if( ( val & 1 ) == 1 ){
  738. p1 = '<img src="/style/img/cam_cap3.png" alt="Video Source">';
  739. } else {
  740. p1 = '<img src="/style/img/cam_cap0.png" alt="NO Video Source">';
  741. };
  742. if( ( val & 2 ) == 2 ){
  743. p2 = '<img src="/style/img/cam_cap2.png" alt="Audio Source">';
  744. } else {
  745. p2 = '<img src="/style/img/cam_cap0.png" alt="NO Audio Source">';
  746. };
  747. if( ( val & 4 ) == 4 ){
  748. p3 = '<img src="/style/img/cam_cap1.png" alt="PTZ Control">';
  749. } else {
  750. p3 = '<img src="/style/img/cam_cap0.png" alt="NO PTZ Control">';
  751. };
  752. return p1+p2+p3;
  753. };
  754. function LocRenderer( val ){
  755. if( val ){
  756. return '<img src="/style/icons/icons/accept.png" alt="Location" />';
  757. };
  758. return '<img src="/style/icons/icons/bullet_white.png" alt="NO Location" />';
  759. };
  760. function PicRenderer( val ){
  761. if( val ){
  762. return '<img src="/style/icons/icons/camera_link.png"/>';
  763. };
  764. return '<img src="/style/icons/icons/bullet_white.png"/>';
  765. };
  766. function EvtTypeRenderer( val ){
  767. switch( val ){
  768. case 6: return 'Device Enters Into Study Mode';
  769. case 7: return 'Device Is BUSY';
  770. case 8: return 'Flip Complete';
  771. case 9: return 'Scan Complete';
  772. case 10:
  773. case 11:
  774. case 12:
  775. case 13:
  776. case 14: return 'Target';
  777. case 36: return 'Region Of Interest';
  778. default: return 'Event ['+val+']';
  779. };
  780. };
  781. var eventsListColModel_ops = {
  782. columns: [
  783. {header: "ID", width: 100, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' },
  784. {header: "Date",width: 100, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'date' },
  785. {header: "Time", width: 80, sortable: false, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'time' },
  786. {header: "Device", width: 80, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'device' },
  787. {header: "Event", width: 120, sortable: false, dataIndex: 'event', renderer: EvtTypeRenderer },
  788. {header: "Info", width: 200, sortable: false, dataindex: 'data' },
  789. {header: "", width: 25, sortable: false, dataIndex: 'has_geo', renderer: LocRenderer },
  790. {header: "", width: 25, sortable: false, dataIndex: 'has_images', renderer: PicRenderer }
  791. ],
  792. defaults: {
  793. sortable: true,
  794. menuDisabled: true,
  795. width: 100
  796. },
  797. listeners: {
  798. hiddenchange: function(cm, colIndex, hidden) {
  799. //saveConfig(colIndex, hidden);
  800. }
  801. }
  802. };
  803. var SelectedRow = -1;
  804. var eventsListSelModel_ops = {
  805. singleSelect: true,
  806. listeners: {
  807. rowselect: function(sm, row, rec ) {
  808. loadEventProperties( rec.data );
  809. SelectedEvent = rec.data.id;
  810. SelectedRow = row;
  811. //alert( SelectedEvent );
  812. //var CB = Ext.getCmp('con_to_src');
  813. //CB.enable();
  814. }
  815. }
  816. };
  817. function loadTimeLineGroups( NID ){
  818. Ext.Ajax.request({
  819. url: '/lib/controller/getTimeLineGroups.php',
  820. params: {
  821. NID: NID,
  822. UID: <?=$UserID;?>,
  823. SID: '<?=$Session;?>'
  824. },
  825. success: function( response, opts ){
  826. // If the response is JSON, you have to decode it
  827. var data = Ext.decode(response.responseText);
  828. //for(var i = 0; i < data.length; i++) {
  829. //tlGroups.add(data[i]);
  830. //};
  831. tlGroups.update( data );
  832. loadTimeLineItems( SelectedSite );
  833. tlInterval = window.setInterval( loadTimeLineItems, 333, SelectedSite );
  834. },
  835. failure: function( response, opts ) {
  836. //Ext.fly('some_div').update('Fail!');
  837. }/*,
  838. callback: function(options,success,response){
  839. // use this if you need to perform your own success/failure checking
  840. }*/
  841. });
  842. };
  843. function clickDeviceSelector( id ){
  844. var rr = document.getElementById(id+'_div');
  845. if( selecredActiveSourceFilter != id ){
  846. if( selecredActiveSourceFilter > 0 ){
  847. var oo = document.getElementById( selecredActiveSourceFilter + '_div');
  848. oo.classList.remove( "cardDeviceSourceSelected" );
  849. oo.classList.add( "cardDeviceSource" );
  850. };
  851. rr.classList.remove( "cardDeviceSource" );
  852. rr.classList.add( "cardDeviceSourceSelected" );
  853. selecredActiveSourceFilter = id;
  854. turnOffAllGzButThis( selecredActiveSourceFilter );
  855. } else {
  856. selecredActiveSourceFilter = 0;
  857. rr.classList.remove( "cardDeviceSourceSelected" );
  858. rr.classList.add( "cardDeviceSource" );
  859. turnAllGzOn();
  860. var tPanel = Ext.getCmp('prop_content');
  861. tPanel.remove(0);
  862. tPanel.add( {
  863. title: 'Event Information',
  864. border: false,
  865. frame: false,
  866. collapsible: false,
  867. draggable: false,
  868. html: '<p align="center">Select an Event from TimeLine to See Information</p>'
  869. } );
  870. tPanel.doLayout();
  871. };
  872. };
  873. function loadEventPropertiesByID( id ){
  874. var d = eventsListStore.findExact( 'id', id );
  875. if( d > -1 ) {
  876. var EventRec = eventsListStore.getAt( d );
  877. loadEventProperties( EventRec.data );
  878. };
  879. };
  880. function loadEventProperties( EventRec ){
  881. var tPanel = Ext.getCmp('prop_content');
  882. tPanel.removeAll();// remove( 0 );
  883. var tt = '';
  884. if( map!=undefined) if(map!=null){
  885. if( selectedMarker!= null ){
  886. selectedMarker.remove();
  887. //map.removeLayer( selectedMarker );
  888. if( EventRec.has_geo ){
  889. tt = ''+EventRec.geo.lat+' '+EventRec.geo.lon;
  890. selectedMarker.setLatLng([EventRec.geo.lat, EventRec.geo.lon]);
  891. selectedMarker.addTo( map );
  892. };
  893. };
  894. };
  895. tPanel.add( {
  896. title: 'Event Details',
  897. html: '<center><img src="/style/assets/'+EventRec.dev_type+'_node.png" /><p>' + EventRec.device+'</p>'+tt+'</center>'
  898. } );
  899. if( EventRec.has_images ){
  900. for( var i=0; i < EventRec.images.length; i++ ){
  901. tPanel.add( {
  902. frame: false,
  903. html: '<img width="100%" src="/lib/controller/getPicture.php?PID='+EventRec.images[i]+'" data-enlargeable000 ondblclick="fullScreen(\'img-'+EventRec.id+'\');" style="cursor: zoom-in" id="img-'+EventRec.id+'"/>'
  904. });
  905. };
  906. };
  907. tPanel.doLayout();
  908. };
  909. var cEventTSS = 0;
  910. var cEventETS = 0;
  911. var VSRCC ='';
  912. function setVideoSource( mid, frame ){
  913. var video_t = document.getElementById( 'video-img-' + mid );
  914. if( video_t != undefined ){
  915. video_t.src = "/video_view/stream?id="+videoNfo[mid][1]+"&TS="+videoNfo[mid][0]+"&sf=" + frame;
  916. };
  917. };
  918. function setVideoMp4Source( mid, frame ){
  919. var video_t = document.getElementById( 'video-img-' + mid );
  920. if( video_t != undefined ){
  921. var d = new Date( videoNfo[mid][0] * 1000 );
  922. var basePath = '/lib/controller/data/reports/'+d.getFullYear().toString().padStart(4, '0')+'/'+(d.getMonth()+1).toString().padStart(2, '0')+'/'+d.getDate().toString().padStart(2, '0')+'/'+videoNfo[mid][1]+'.mp4';
  923. //video_t.src = "/video_view/stream?id="+videoNfo[mid][1]+"&TS="+videoNfo[mid][0]+"&sf=" + frame;
  924. //"/style/assets/nosignal.mp4";
  925. const parsedUrl = new URL( video_t.src );
  926. if( parsedUrl.pathname != basePath ) {
  927. console.log('Video Source Changed!');
  928. video_t.src = basePath;
  929. video_t.play();
  930. };
  931. video_t.currentTime = parseInt( frame / videoNfo[mid][2] );
  932. /*
  933. var store = grid.getStore();
  934. var rowIndex = store.find('fieldName', 'desiredValue');
  935. if (rowIndex !== -1) {
  936. grid.getSelectionModel().selectRow(rowIndex);
  937. }
  938. */
  939. };
  940. };
  941. function loadEventData( record ){
  942. ReportSelectionMode = 3; // Just One Event
  943. cEventTSS = record.ts+record.ms/1000;
  944. clearAllRadars();
  945. if( record.type == 13 || record.type == 14 || record.type == 36 || record.type == 39 || record.type == 40 || record.type == 41 || record.type == 42|| record.type == 43|| record.type == 44|| record.type == 45|| record.type == 46|| record.type == 47|| record.type == 48|| record.type == 49 || record.type == 86 || record.type == 87 ){
  946. if( record.r == 0 && record.range > 0 ){
  947. record.r = (2048*record.range)/65;
  948. };
  949. if( record.type == 86 || record.type == 87 ){
  950. if( record.type == 86 ){
  951. markEventOnRadar( record.node_id, record.az, record.r, "#00ffff", "#008080" );
  952. } else {
  953. markEventOnRadar( record.node_id, record.az, record.r, "#ffff00", "#808000" );
  954. };
  955. } else {
  956. markEventOnRadar( record.node_id, record.az, record.r, "#ff0000", "#800000" );
  957. };
  958. };
  959. if( record.video ){
  960. if( record.video == 2 ){
  961. showVideos();
  962. Ext.Ajax.request({
  963. url: '/lib/controller/getVideoInfo.php',
  964. params: {
  965. UID: <?=$UserID;?>,
  966. SID: '<?=$Session;?>',
  967. TS: record.rts,
  968. ID: record.id
  969. },
  970. success: function( response, opts ){
  971. var data = Ext.decode(response.responseText);
  972. if( data.videos != undefined ){
  973. if( data.videos.length ){
  974. for( i=0; i < data.videos.length; i++ ){
  975. //var video_t = document.getElementById( 'video-'+data.videos[i].media_stream_id );
  976. videoNfo[data.videos[i].media_stream_id] = [];
  977. videoNfo[data.videos[i].media_stream_id][0] = data.videos[i].ts;
  978. videoNfo[data.videos[i].media_stream_id][1] = data.videos[i].md5;
  979. videoNfo[data.videos[i].media_stream_id][2] = data.videos[i].fps;
  980. videoNfo[data.videos[i].media_stream_id][3] = data.videos[i].ext;
  981. data.videos[i].frame -= 20;
  982. if( data.videos[i].frame < 0 ) data.videos[i].frame = 0;
  983. if( data.videos[i].ext == "mp4" ){
  984. setVideoMp4Source( data.videos[i].media_stream_id, data.videos[i].frame );
  985. } else {
  986. setVideoSource( data.videos[i].media_stream_id, data.videos[i].frame );
  987. };
  988. var slider_t = Ext.getCmp( 'video-slider-'+data.videos[i].media_stream_id );
  989. if( slider_t != undefined ){
  990. slider_t.setMaxValue( 60 * data.videos[i].fps );
  991. slider_t.suspendEvents();
  992. slider_t.setValue( data.videos[i].frame );
  993. slider_t.resumeEvents();
  994. };
  995. };
  996. };
  997. };
  998. }
  999. });
  1000. } else {
  1001. showVideos();//?
  1002. Ext.Ajax.request({
  1003. url: '/lib/controller/getPictureInfo.php',
  1004. params: {
  1005. UID: <?=$UserID;?>,
  1006. SID: '<?=$Session;?>',
  1007. TS: record.ts,
  1008. ID: record.id
  1009. },
  1010. success: function( response, opts ){
  1011. var data = Ext.decode(response.responseText);
  1012. if( data.pictures != undefined ){
  1013. if( data.pictures.length ){
  1014. for( i=0; i < data.pictures.length; i++ ){
  1015. //var video_t = document.getElementById( 'video-'+data.videos[i].media_stream_id );
  1016. videoNfo[data.pictures[i].media_stream_id] = [];
  1017. videoNfo[data.pictures[i].media_stream_id][0] = data.pictures[i].file;setPicture( data.pictures[i].media_stream_id, data.pictures[i].file );
  1018. };
  1019. };
  1020. };
  1021. }
  1022. });
  1023. };
  1024. } else {
  1025. hideVideos();
  1026. };
  1027. };
  1028. function loadBubbleData(record){
  1029. var csvg = document.getElementById( 'draw_svgr_bubble' );
  1030. if( csvg!= undefined ){
  1031. var roi = csvg.getElementById( "roi" );
  1032. if( roi != null ) csvg.removeChild( roi );
  1033. };
  1034. markEventOnRadar( 'bubble', record.az, record.r, "#00ffff", "#008080" );
  1035. };
  1036. function clearAllRadars(){
  1037. for( i=1; i< 1000; i++ ){
  1038. var csvg = document.getElementById( 'draw_svgr_' + i );
  1039. if( csvg!= undefined ){
  1040. var roi = csvg.getElementById( "roi" );
  1041. if( roi != null ) csvg.removeChild( roi );
  1042. };
  1043. };
  1044. };
  1045. function markEventOnRadar( rid, az, range, color, stroke ){
  1046. var csvg = document.getElementById( 'draw_svgr_' + rid );
  1047. if( csvg!= undefined ){
  1048. var roi = csvg.getElementById( "roi" );
  1049. if( roi != null ) csvg.removeChild( roi );
  1050. var bBox = csvg.getBBox();
  1051. var max = 2048;
  1052. switch( drawZoomLevels[rid] ){
  1053. case 50: max = 1024; break;
  1054. case 25: max = 512; break;
  1055. case 12: max = 256; break;
  1056. };
  1057. if( range < max ){
  1058. var ak = 2.0*Math.PI/360;
  1059. var ok = 1.0/35;
  1060. var rk = bBox.width / ( max * 2 );
  1061. var cpx = bBox.width / 2.0;
  1062. var cpy = bBox.height / 2.0;
  1063. x = cpx + rk * range * Math.cos( az*ak );
  1064. y = cpy - rk * range * Math.sin( az*ak );
  1065. var cc = document.createElementNS('http://www.w3.org/2000/svg', "circle");
  1066. var rz = bBox.width / csvg.clientWidth;
  1067. cc.setAttributeNS(null, "cx", x );
  1068. cc.setAttributeNS(null, "cy", y );
  1069. cc.setAttributeNS(null, "r", ""+(6*rz)+"" );
  1070. cc.setAttributeNS(null, "stroke", stroke );
  1071. cc.setAttributeNS(null, "stroke-width", ""+(2*rz)+"" );
  1072. cc.setAttributeNS(null, "stroke-opacity", ""+(1.0));
  1073. cc.setAttributeNS(null, "fill", color );
  1074. cc.setAttributeNS(null, "fill-opacity", ""+(1.0));
  1075. cc.setAttributeNS(null, "id", "roi" );
  1076. csvg.appendChild( cc );
  1077. };
  1078. };
  1079. };
  1080. function getData( Mode, ST/* = 0*/, ET /*= 0*/, SR /*= 0*/, DR /*= 0*/){
  1081. if( tlLoadLocker ) return;
  1082. tlLoadLocker = true;
  1083. if( Mode == 'arch' ){
  1084. Ext.MessageBox.wait("Loading Data","Please Wait",{
  1085. width: '100%',
  1086. hidden: true,
  1087. animate: true,
  1088. progress: true,
  1089. closable: false
  1090. });
  1091. };
  1092. Ext.Ajax.request({
  1093. url: '/lib/controller/getEventRecords.php',
  1094. params: {
  1095. SITE: <?=$SiteID;?>,
  1096. UID: <?=$UserID;?>,
  1097. SID: '<?=$Session;?>',
  1098. MODE: Mode,
  1099. FIL: selecredActiveSourceFilter,
  1100. SDA: SD,
  1101. SMO: SMO,
  1102. SYE: SY,
  1103. STM: ST,
  1104. ETM: ET,
  1105. STR: SR,
  1106. DIR: DR
  1107. },
  1108. success: function( response, opts ){
  1109. tlLoadLocker = false;
  1110. var data = Ext.decode(response.responseText);
  1111. if( data.updateFROMTO ){
  1112. Ext.getCmp('STimeFROM').setValue( data.STT );
  1113. Ext.getCmp('STimeTO').setValue( data.ENT );
  1114. if( data.SLD > 0 ){
  1115. SMO = GetMonthNum(data.SLD);
  1116. SY = GetYear(data.SLD);
  1117. SD = GetDay(data.SLD);
  1118. BuildCalendar();
  1119. };
  1120. };
  1121. eventsListStore.loadData( data, false );
  1122. if( Mode == 'arch' ){
  1123. showHistoryOnMap( data, true );
  1124. Ext.MessageBox.hide();
  1125. if( DR > 0 ){
  1126. Ext.getCmp('evtArchLog').getView().focusRow( eventsListStore.getCount() - 1 );
  1127. Ext.getCmp('evtArchLog').getSelectionModel().selectLastRow();
  1128. };
  1129. if( DR < 0 ){
  1130. Ext.getCmp('evtArchLog').getView().focusRow( 0 );
  1131. Ext.getCmp('evtArchLog').getSelectionModel().selectFirstRow();
  1132. };
  1133. } else {
  1134. showHistoryOnMap( data, false );
  1135. //LoadMapEventsZ( Mode );
  1136. };
  1137. },
  1138. failure: failureAJAXFunction
  1139. });
  1140. };
  1141. function loadArchive(){
  1142. if( tlInterval!= null ){
  1143. window.clearInterval( tlInterval );
  1144. tlInterval = null;
  1145. timelineObj = null;
  1146. };
  1147. setUserContent( 2 );
  1148. var tPanel = Ext.getCmp('main_portal');
  1149. tPanel.removeAll( true );
  1150. Ext.getCmp('main_content').setTitle( 'Events Archive' );
  1151. tPanel.add({
  1152. columnWidth: 0.83,
  1153. frame: false,
  1154. border: false,
  1155. items: [{
  1156. title: 'Site Map',
  1157. frame: false,
  1158. border: false,
  1159. layout: 'vbox',
  1160. layoutConfig: {
  1161. align : 'stretch',
  1162. pack : 'start',
  1163. },
  1164. height: PanelH-300,
  1165. items:[{
  1166. height: PanelH-325,
  1167. flex: 1,
  1168. frame: false,
  1169. border: false,
  1170. layout: 'fit',
  1171. items:{
  1172. id: 'event_map',
  1173. html: '&nbsp;'
  1174. }
  1175. }]
  1176. },{
  1177. frame: false,
  1178. border: false,
  1179. collapsible: false,
  1180. draggable: false,
  1181. layout: 'hbox',
  1182. items:[{
  1183. layout: 'form',
  1184. title: 'Date/Time',
  1185. width: 200,
  1186. frame: true,
  1187. border: false,
  1188. labelAlign: 'right',
  1189. labelWidth: 50,
  1190. defaults: { width: 80},
  1191. items: [{
  1192. xtype: 'combo',
  1193. id: 'STimeFROM',
  1194. fieldLabel: 'From',
  1195. editable: false,
  1196. typeAhead: true,
  1197. triggerAction: 'all',
  1198. width: 120,
  1199. lazyRender:true,
  1200. mode: 'local',
  1201. store: new Ext.data.ArrayStore({
  1202. id: 0,
  1203. fields: ['ss', 'displayText' ],
  1204. data: [<?php
  1205. $zuzu = array();
  1206. for( $i = 0; $i < 24; $i++) if( $i < 10 ) $zuzu[] = '['.($i*3600).',\'0'.$i.':00\']'; else $zuzu[] = '['.($i*3600).',\''.$i.':00\']';
  1207. echo implode( ',', $zuzu ); ?>]
  1208. }),
  1209. valueField: 'ss',
  1210. displayField: 'displayText'
  1211. },{
  1212. xtype: 'combo',
  1213. id: 'STimeTO',
  1214. fieldLabel: 'Till',
  1215. editable: false,
  1216. typeAhead: true,
  1217. triggerAction: 'all',
  1218. width: 120,
  1219. lazyRender:true,
  1220. mode: 'local',
  1221. store: new Ext.data.ArrayStore({
  1222. id: 0,
  1223. fields: ['ss', 'displayText' ],
  1224. data: [<?php
  1225. $zuzu = array();
  1226. for( $i = 1; $i < 25; $i++) if( $i < 10 ) $zuzu[] = '['.($i*3600).',\'0'.$i.':00\']'; else $zuzu[] = '['.($i*3600).',\''.$i.':00\']';
  1227. echo implode( ',', $zuzu ); ?>]
  1228. }),
  1229. valueField: 'ss',
  1230. displayField: 'displayText'
  1231. }],
  1232. html: '<table width="100%"><tr><td id="calendar_TD" align="center"></td></tr></table>',
  1233. buttons: [{
  1234. xtype: 'button',
  1235. text: 'Display History',
  1236. handler: function(){
  1237. var STU = Ext.getCmp('STimeFROM').getValue();
  1238. var ETU = Ext.getCmp('STimeTO').getValue();
  1239. getData( 'arch', STU, ETU );
  1240. }
  1241. }]
  1242. },{
  1243. title: 'Event Log',
  1244. frame: false,
  1245. height: 303,
  1246. id: 'evtArchLog',
  1247. xtype: 'grid',
  1248. ds: eventsListStore,
  1249. cm: new Ext.grid.ColumnModel( eventsListColModel_ops ),
  1250. sm: new Ext.grid.RowSelectionModel( eventsListSelModel_ops ),
  1251. listeners:{
  1252. keydown: function( e ) {
  1253. if( e.getKey() == e.UP ){
  1254. if( SelectedRow == 0 ){
  1255. var id = eventsListStore.getAt( 0 ).id;
  1256. getData( 'arch', 0, 0, id, 1 );
  1257. };
  1258. };
  1259. if( e.getKey() == e.DOWN ){
  1260. if( SelectedRow == ( eventsListStore.getCount() - 1 ) ){
  1261. var id = eventsListStore.getAt( SelectedRow ).id;
  1262. getData( 'arch', 0, 0, id, -1 );
  1263. Ext.getCmp('evtArchLog').getSelectionModel().selectFirstRow();
  1264. Ext.getCmp('evtArchLog').focus( false, true );
  1265. };
  1266. };
  1267. }
  1268. }
  1269. }]
  1270. }]
  1271. });
  1272. tPanel.add({
  1273. columnWidth: 0.17,
  1274. frame: true,
  1275. title: 'Event Information',
  1276. id: 'prop_content',
  1277. border: false,
  1278. items: [{
  1279. html:"<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1280. }]
  1281. });
  1282. tPanel.doLayout();
  1283. /*
  1284. Ext.getCmp('evtLog').getEl().set({tabindex: "0"});
  1285. Ext.getCmp('evtLog').getEl().addKeyMap({
  1286. eventName: "keyup",
  1287. binding: [{
  1288. key: Ext.EventObject.SPACE,
  1289. fn: function(){ alert("Space key pressed"); }
  1290. },{
  1291. key: [Ext.EventObject.LEFT, Ext.EventObject.RIGHT],
  1292. shift: true,
  1293. fn: function(){ alert("Left or right pressed while pressing shift"); }
  1294. }]
  1295. });
  1296. */
  1297. //BuildCalendar();
  1298. loadCalendarDates();
  1299. map = L.map('event_map',{
  1300. attributionControl: true,
  1301. //preferCanvas: true,
  1302. zoomControl: true,
  1303. center: [SiteLat, SiteLon],
  1304. /*zoomControl: false,
  1305. zoom: 17,
  1306. minZoom: 17,
  1307. maxZoom: 17,*/
  1308. keyboard: false
  1309. }).setView([SiteLat, SiteLon], 17);
  1310. //L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon } ).addTo(map).on('click', LoadNodesList ).bindPopup("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");
  1311. var mapLayers = [];
  1312. /*mapLayers["Bing"] = new BingLayer('https://t{s}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/{q}?it=A,G,L&shading=hill', {
  1313. subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
  1314. attribution: '&copy; <a href="https://bing.com/maps" target="_blank">Bing Maps</a>',
  1315. detectRetina: true
  1316. });*/
  1317. mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  1318. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  1319. maxNativeZoom: 18,
  1320. maxZoom: 24,
  1321. })
  1322. // https://leaflet-extras.github.io/leaflet-providers/preview/
  1323. mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
  1324. attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012',
  1325. maxZoom: 19
  1326. });
  1327. mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
  1328. attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community',
  1329. maxZoom: 19
  1330. });
  1331. mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
  1332. attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community',
  1333. maxZoom: 24
  1334. });
  1335. mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde
  1336. attribution: 'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors',
  1337. maxZoom: 19
  1338. });
  1339. mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
  1340. attribution: 'Kartendaten: &copy; <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>-Mitwirkende, SRTM | Kartendarstellung: &copy; <a href="http://opentopomap.org/" target="_blank">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/" target="_blank">CC-BY-SA</a>) ',
  1341. maxZoom: 19
  1342. });
  1343. /*
  1344. mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1345. attribution: 'Maps &copy; <a href="https://www.thunderforest.com" target="_blank">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>',
  1346. maxZoom: 22
  1347. });
  1348. mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1349. attribution: 'Maps &copy; <a href="https://www.thunderforest.com" target="_blank">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>',
  1350. maxZoom: 22
  1351. });
  1352. mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1353. attribution: 'Maps &copy; <a href="https://www.thunderforest.com" target="_blank">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>',
  1354. maxZoom: 22
  1355. });
  1356. */
  1357. var baseMaps = {
  1358. "MyMap": mapLayers["MyMap"],
  1359. "OpenStreetMap": mapLayers["OpenStreetMap"],
  1360. "OpenTopoMap": mapLayers["OpenTopoMap"],
  1361. "EsriSat": mapLayers["EsriSat"],
  1362. "EsriStreet": mapLayers["EsriStreet"],
  1363. "EsriTopo": mapLayers["EsriTopo"],
  1364. //"Bing": mapLayers["Bing"],
  1365. //"OSM-Cycle": mapLayers["Cycle"],
  1366. //"Landscape": mapLayers["Landscape"],
  1367. //"Outdoor": mapLayers["Outdoor"],
  1368. };
  1369. L.control.layers( baseMaps ).addTo(map);
  1370. mapLayers["MyMap"].addTo(map);
  1371. /*L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  1372. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  1373. maxNativeZoom: 18,
  1374. maxZoom: 24,
  1375. }).addTo(map); */
  1376. //loadTimeLineGroups( selectedSite );
  1377. loadMapZones( SelectedSite );
  1378. getData( 'arch' );
  1379. //eventsListStore.load({params:{start:0, limit:50, src: 'arch', fil: selecredActiveSourceFilter }});
  1380. };
  1381. function loadMonitoring(){
  1382. if( tlInterval!= null ){
  1383. window.clearInterval( tlInterval );
  1384. tlInterval = null;
  1385. timelineObj = null;
  1386. };
  1387. setUserContent( 1 );
  1388. var tPanel = Ext.getCmp('main_portal');
  1389. tPanel.removeAll( true );
  1390. Ext.getCmp('main_content').setTitle( 'Events Monitoring' );
  1391. tPanel.add({
  1392. columnWidth: 0.83,
  1393. frame: false,
  1394. border: false,
  1395. items: [{
  1396. title: '<?=$Labels->getLabel('_MAP_MONITORING_');?>',
  1397. frame: false,
  1398. border: false,
  1399. collapsible: false,
  1400. draggable: false,
  1401. layout: 'vbox',
  1402. layoutConfig: {
  1403. align : 'stretch',
  1404. pack : 'start',
  1405. },
  1406. height: PanelH-300,
  1407. items:[{
  1408. height: PanelH-325,
  1409. flex: 1,
  1410. frame: false,
  1411. border: false,
  1412. layout: 'fit',
  1413. items:{
  1414. id: 'event_map',
  1415. html: '&nbsp;'
  1416. }
  1417. }]
  1418. },{
  1419. frame: false,
  1420. border: true,
  1421. collapsible: false,
  1422. draggable: false,
  1423. layout: 'hbox',
  1424. items:[{
  1425. title: 'Alarm Sources',
  1426. xtype: 'panel',
  1427. border: false,
  1428. frame: false,
  1429. collapsible: false,
  1430. draggable: false,
  1431. id: 'sources_panel',
  1432. width: 160,
  1433. autoScroll: 'auto',
  1434. height: 303
  1435. },{
  1436. title: 'Event Log',
  1437. height: 303,
  1438. xtype: 'grid',
  1439. border: false,
  1440. frame: false,
  1441. collapsible: false,
  1442. draggable: false,
  1443. ds: eventsListStore,
  1444. cm: new Ext.grid.ColumnModel( eventsListColModel_ops ),
  1445. sm: new Ext.grid.RowSelectionModel( eventsListSelModel_ops ),
  1446. bbar: [{
  1447. text: 'Clear',
  1448. handler: function(){
  1449. Ext.Ajax.request({
  1450. url: '/lib/controller/clearEventCloud.php',
  1451. params: {
  1452. UID: <?=$UserID;?>,
  1453. SID: '<?=$Session;?>'
  1454. },
  1455. success: function( response, opts ){
  1456. },
  1457. failure: function( response, opts ) {
  1458. }
  1459. });
  1460. }
  1461. }]
  1462. }]
  1463. }]
  1464. });
  1465. tPanel.add({
  1466. columnWidth: 0.17,
  1467. title: 'Event Information',
  1468. frame: true,
  1469. id: 'prop_content',
  1470. border: false,
  1471. items: [{
  1472. html:"<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1473. }]
  1474. });
  1475. tPanel.doLayout();
  1476. map = L.map('event_map',{
  1477. attributionControl: true,
  1478. //preferCanvas: true,
  1479. zoomControl: true,
  1480. center: [SiteLat, SiteLon],
  1481. /*zoomControl: false,
  1482. zoom: 17,
  1483. minZoom: 17,
  1484. maxZoom: 17,*/
  1485. keyboard: false
  1486. }).setView([SiteLat, SiteLon], 17);
  1487. //L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon } ).addTo(map).on('click', LoadNodesList ).bindPopup("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");
  1488. var mapLayers = [];
  1489. /*mapLayers["Bing"] = new BingLayer('https://t{s}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/{q}?it=A,G,L&shading=hill', {
  1490. subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
  1491. attribution: '&copy; <a href="https://bing.com/maps" target="_blank">Bing Maps</a>',
  1492. detectRetina: true
  1493. });*/
  1494. mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  1495. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  1496. maxNativeZoom: 18,
  1497. maxZoom: 24,
  1498. })
  1499. // https://leaflet-extras.github.io/leaflet-providers/preview/
  1500. mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
  1501. attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012',
  1502. maxZoom: 19
  1503. });
  1504. mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
  1505. attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community',
  1506. maxZoom: 19
  1507. });
  1508. mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
  1509. attribution: 'Tiles &copy; <a href="https://www.esri.com" target="_blank">Esri</a> &mdash; Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Community',
  1510. maxZoom: 24
  1511. });
  1512. mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde
  1513. attribution: 'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors',
  1514. maxZoom: 19
  1515. });
  1516. mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
  1517. attribution: 'Kartendaten: &copy; <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>-Mitwirkende, SRTM | Kartendarstellung: &copy; <a href="http://opentopomap.org/" target="_blank">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/" target="_blank">CC-BY-SA</a>) ',
  1518. maxZoom: 19
  1519. });
  1520. /*
  1521. mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1522. attribution: 'Maps &copy; <a href="https://www.thunderforest.com" target="_blank">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>',
  1523. maxZoom: 22
  1524. });
  1525. mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1526. attribution: 'Maps &copy; <a href="https://www.thunderforest.com" target="_blank">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>',
  1527. maxZoom: 22
  1528. });
  1529. mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1530. attribution: 'Maps &copy; <a href="https://www.thunderforest.com" target="_blank">Thunderforest</a>, Data © <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap contributors</a>',
  1531. maxZoom: 22
  1532. });
  1533. */
  1534. var baseMaps = {
  1535. "MyMap": mapLayers["MyMap"],
  1536. "OpenStreetMap": mapLayers["OpenStreetMap"],
  1537. "OpenTopoMap": mapLayers["OpenTopoMap"],
  1538. "EsriSat": mapLayers["EsriSat"],
  1539. "EsriStreet": mapLayers["EsriStreet"],
  1540. "EsriTopo": mapLayers["EsriTopo"],
  1541. //"Bing": mapLayers["Bing"],
  1542. //"OSM-Cycle": mapLayers["Cycle"],
  1543. //"Landscape": mapLayers["Landscape"],
  1544. //"Outdoor": mapLayers["Outdoor"],
  1545. };
  1546. L.control.layers( baseMaps ).addTo(map);
  1547. mapLayers["MyMap"].addTo(map);
  1548. /*L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  1549. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  1550. maxNativeZoom: 18,
  1551. maxZoom: 24,
  1552. }).addTo(map); */
  1553. loadMapZones( SelectedSite );
  1554. tlInterval = window.setInterval( getData, 333, 'live' );
  1555. };
  1556. function loadOnlineMonitoring(devID){
  1557. if( tlInterval!= null ){
  1558. window.clearInterval( tlInterval );
  1559. tlInterval = null;
  1560. timelineObj = null;
  1561. };
  1562. var tPanel = Ext.getCmp('main_content');
  1563. tPanel.removeAll( true );
  1564. tPanel.add({
  1565. html: 'Device Monitoring '+devID
  1566. });
  1567. tPanel.doLayout();
  1568. };
  1569. function shutImg( img, a /* = '' */){
  1570. if( a == '' ){
  1571. img.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEAAAAALAAAAAABAAEAAAI=;';
  1572. } else {
  1573. img.src = a;
  1574. };
  1575. };
  1576. var ReportMask = null;
  1577. var ReportLayoutLoadded = false;
  1578. var ReportSelectionMode = 0; //All
  1579. function loadReportSegment( ts, bid, eid ){
  1580. if( !ReportLayoutLoadded ){
  1581. ReportMask = new Ext.LoadMask(Ext.getCmp('main_content').getEl(), {msg:"Please wait..."});
  1582. ReportMask.show();
  1583. Ext.Ajax.request({
  1584. url: '/lib/controller/getReportLayout.php',
  1585. params: {
  1586. UID: <?=$UserID;?>,
  1587. SID: '<?=$Session;?>'//,
  1588. //BID: nid,
  1589. //EID: evt_ts
  1590. },
  1591. success: function(response, opts ){
  1592. var data = Ext.decode( response.responseText );
  1593. var tPanel = Ext.getCmp('main_content');
  1594. tPanel.removeAll(true);
  1595. Ext.getCmp('main_content').add({
  1596. xtype: 'portal',
  1597. id: 'segment_portal',
  1598. frame: false,
  1599. border: false,
  1600. items:{
  1601. html: ''
  1602. },
  1603. listeners:{
  1604. drop: function( a ){
  1605. updateDashBoardItemLayout( a.panel.id, a.columnIndex, a.position );
  1606. }
  1607. }
  1608. });
  1609. Ext.getCmp('main_content').doLayout();
  1610. tPanel = Ext.getCmp('segment_portal');
  1611. //nodeDashboardStatuses = new Array();
  1612. for( i=0; i < data.length; i++) tPanel.add( data[i] );
  1613. tPanel.doLayout();
  1614. ReportMask.hide();
  1615. ReportLayoutLoadded = true;
  1616. loadReportData( ts, bid, eid );
  1617. },
  1618. error: function(){
  1619. ReportMask.hide();
  1620. }
  1621. });
  1622. } else {
  1623. loadReportData( ts, bid, eid );
  1624. };
  1625. };
  1626. var currentHistoryTS = 0;
  1627. var currentHistoryBeginId = 0;
  1628. var currentHistoryEndId = 0;
  1629. function loadReportData( ts, bid, eid ){
  1630. ReportSelectionMode = 2; // Session Selected
  1631. hideVideos();
  1632. currentHistoryTS = ts;
  1633. currentHistoryBeginId = bid;
  1634. currentHistoryEndId = eid;
  1635. Ext.Ajax.request({
  1636. url: '/lib/controller/getHistoryEvents.php',
  1637. params: {
  1638. UID: <?=$UserID;?>,
  1639. SID: '<?=$Session;?>',
  1640. TS: currentHistoryTS,
  1641. BID: currentHistoryBeginId,
  1642. EID: currentHistoryEndId,
  1643. },
  1644. success: function(response, opts ){
  1645. var data = Ext.decode( response.responseText );
  1646. if( data.log != undefined ){
  1647. if( map != undefined ) if( map != null ) showHistoryOnMap( data, true );
  1648. if( data.log.length ){
  1649. rep_store_id = data.log[0].id;
  1650. rep_array = data.log;//.concat( rep_array );
  1651. //if( log_array.length > 32 ){
  1652. // log_array = log_array.slice( 0, 31 );
  1653. //};
  1654. rep_store.removeAll();
  1655. rep_store.loadData( rep_array );
  1656. };
  1657. } else {
  1658. // alert('No Log');
  1659. // clear the log
  1660. rep_store.removeAll();
  1661. };
  1662. }
  1663. });
  1664. };
  1665. function loadReportDayTree( ts ){
  1666. ReportSelectionMode = 1;//Day Selected
  1667. ReportMask = new Ext.LoadMask(Ext.getCmp('left_side_menu').getEl(), {msg:"Please wait..."});
  1668. ReportMask.show();
  1669. Ext.Ajax.request({
  1670. url: '/lib/controller/getHistoryDay.php',
  1671. params: {
  1672. UID: <?=$UserID;?>,
  1673. SID: '<?=$Session;?>',
  1674. DTS: ts
  1675. },
  1676. success: function(response, opts ){
  1677. var data = Ext.decode( response.responseText );
  1678. var sPanel = Ext.getCmp('left_side_menu');
  1679. sPanel.removeAll( true );
  1680. sPanel.add({
  1681. xtype: 'panel',
  1682. layout: 'vbox',
  1683. frame: true,
  1684. border: false,
  1685. items:[{
  1686. xtype: 'spacer',
  1687. height: 3
  1688. },{
  1689. html: '<p class="cur_date">'+( new Date( ts * 1000)).toLocaleDateString()+'</p><p class="cur_sessions">'+data.sessions+'</p><p class="cur_events">'+data.events+'</p><p class="cur_videos">'+data.videos+'</p>',
  1690. frame: false,
  1691. width: '100%',
  1692. border: false
  1693. },{
  1694. xtype: 'spacer',
  1695. height: 5
  1696. },{
  1697. xtype: 'treepanel',
  1698. autoScroll: true,
  1699. width: '100%',
  1700. height: PanelH-206,
  1701. border: true,
  1702. frame: true,
  1703. loader: new Ext.tree.TreeLoader(),
  1704. rootVisible: false,
  1705. root: new Ext.tree.AsyncTreeNode( data ),
  1706. listeners: {
  1707. click: function(n) {
  1708. if( n.attributes.leaf ){
  1709. Ext.getCmp('chu_adate').show();
  1710. sPanel.doLayout();
  1711. loadReportSegment( ts, n.attributes.bid, n.attributes.eid );
  1712. //Ext.Msg.alert('Navigation Tree Click', 'You clicked: "' + n.attributes.ts + '"');
  1713. };
  1714. }
  1715. }
  1716. },{
  1717. xtype: 'spacer',
  1718. height: 10
  1719. },{
  1720. xtype: 'button',
  1721. id: 'chu_adate',
  1722. text: 'Show Dates',
  1723. hidden: true,
  1724. width: '100%',
  1725. iconCls: 'reports_dates_btn',
  1726. scale: 'large',
  1727. handler: function(){
  1728. Ext.getCmp('chu_adate').hide();
  1729. initReportsView();
  1730. }
  1731. }]
  1732. });
  1733. sPanel.doLayout();
  1734. ReportMask.hide();
  1735. }
  1736. });
  1737. };
  1738. var videoElements = [];
  1739. var videoNfo=[];
  1740. function hideVideos(){
  1741. if( videoElements.length ) for( i = 0; i < videoElements.length; i++ ) hideVideo( videoElements[i] );
  1742. };
  1743. function hideVideo( a ){
  1744. var tt = Ext.getCmp( 'video-ctl-panel-' + a );
  1745. if( tt != undefined ) tt.hide();
  1746. var video_t = document.getElementById( 'video-img-' + a );
  1747. if( video_t != undefined ){
  1748. video_t.src = "/style/assets/no-signal.png";
  1749. };
  1750. };
  1751. function showVideo( a ){
  1752. var tt = Ext.getCmp( 'video-ctl-panel-' + a );
  1753. if( tt != undefined ) tt.show();
  1754. };
  1755. function showMp4( a, b ){
  1756. var tt = Ext.getCmp( 'video-ctl-panel-' + a );
  1757. if( tt != undefined ) tt.show();
  1758. var video_t = document.getElementById( 'video-img-' + a );
  1759. if( video_t != undefined ){
  1760. video_t.src = "/lib/controller/data/reports/"+b;
  1761. };
  1762. };
  1763. function setPicture( a, b ){
  1764. var tt = Ext.getCmp( 'video-ctl-panel-' + a );
  1765. if( tt != undefined ) tt.hide();
  1766. var video_t = document.getElementById( 'video-img-' + a );
  1767. if( video_t != undefined ){
  1768. video_t.src = "/lib/controller/data/reports/"+b;
  1769. };
  1770. };
  1771. function showVideos(){
  1772. if( videoElements.length ) for( i = 0; i < videoElements.length; i++ ) showVideo( videoElements[i] );
  1773. };
  1774. function downloadCurrentVideo( stid ){
  1775. var d = new Date( videoNfo[stid][0] * 1000 );
  1776. var videoFileDownloadTarget = d.getFullYear().toString().padStart(4, '0')+'_'+(d.getMonth()+1).toString().padStart(2, '0')+'_'+d.getDate().toString().padStart(2, '0')+'_'+d.getHours().toString().padStart(2, '0')+'-'+d.getMinutes().toString().padStart(2, '0')+'-'+d.getSeconds().toString().padStart(2, '0');
  1777. // TS, MD5, FPS, EXT
  1778. downloadVideoFile( videoNfo[stid][0], videoNfo[stid][1], videoNfo[stid][2], videoFileDownloadTarget, videoNfo[stid][3] );
  1779. };
  1780. function initReportsView(){
  1781. ReportSelectionMode = 0; // All History
  1782. if( tlInterval!= null ){
  1783. window.clearInterval( tlInterval );
  1784. tlInterval = null;
  1785. timelineObj = null;
  1786. };
  1787. ReportLayoutLoadded = false;
  1788. var tPanel = Ext.getCmp('main_content');
  1789. var sPanel = Ext.getCmp('left_side_menu');
  1790. tPanel.removeAll( true );
  1791. sPanel.removeAll( true );
  1792. tPanel.add({
  1793. xtype: 'panel',
  1794. height: PanelH+15,
  1795. html: '<div id="activity_ph"></div>',
  1796. listeners:{
  1797. afterrender: function(){
  1798. ReportMask = new Ext.LoadMask(Ext.getCmp('main_content').getEl(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."});
  1799. ReportMask.show();
  1800. var jj = (PanelW - 230)/55;
  1801. changeStyleSheet('amap-empty-day','{width: '+jj+'px; height: '+jj+'px;}');
  1802. changeStyleSheet('amap-week-day','{width: '+jj+'px; height: '+jj+'px;}');
  1803. changeStyleSheet('amap-week-name','{width: '+jj+'px; height: '+jj+'px;}');
  1804. Ext.Ajax.request({
  1805. url: '/lib/controller/getHistoryDates.php',
  1806. params: {
  1807. UID: <?=$UserID;?>,
  1808. SID: '<?=$Session;?>'
  1809. },
  1810. success: function(response, opts ){
  1811. var data = Ext.decode( response.responseText );
  1812. var activityMap = new ActivityMap( data, {
  1813. id: "dji-volume-map",
  1814. parent: '#activity_ph',
  1815. showTitle: false,
  1816. showYears: true,
  1817. width: 100,
  1818. hue: 1,
  1819. fit: true,
  1820. compact: true,
  1821. timeColumn: "t",
  1822. valueColumn: "v"
  1823. });
  1824. activityMap.render();
  1825. ReportMask.hide();
  1826. },
  1827. error: function(){
  1828. ReportMask.hide();
  1829. }
  1830. });
  1831. }
  1832. }
  1833. });
  1834. tPanel.doLayout();
  1835. sPanel.add({
  1836. xtype: 'panel',
  1837. frame: true,
  1838. border: false,
  1839. items: [{
  1840. html: '<div class="setEd_infoPanel" id="NANA"><?=$Labels->GetLabel('_PLS_SEL_CAL_DATE_');?></div>',
  1841. height: PanelH - 30
  1842. }]
  1843. });
  1844. sPanel.doLayout();
  1845. };
  1846. function downloadVideoFile( a, b, c, d, e ){
  1847. ReportMask = new Ext.LoadMask( Ext.getBody(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."} );
  1848. ReportMask.show();
  1849. if( e == "mp4" ){
  1850. var z = new Date( a * 1000 );
  1851. var videoFileDownloadTarget = '/lib/controller/data/reports/'+z.getFullYear().toString().padStart(4, '0')+'/'+(z.getMonth()+1).toString().padStart(2, '0')+'/'+z.getDate().toString().padStart(2, '0')+'/'+b+'.mp4';
  1852. const l = document.createElement('a');
  1853. l.style.display = 'none';
  1854. l.href = videoFileDownloadTarget;
  1855. l.download = d + '.mp4';
  1856. document.body.appendChild(l);
  1857. l.click();
  1858. ReportMask.hide();
  1859. Ext.Msg.show({
  1860. title:'<?=$Labels->GetLabel('_SUCCESS_');?>',
  1861. msg: '<?=$Labels->GetLabel('_VIDEO_FILE_HAS_DOWNLOADED_');?>',
  1862. buttons: Ext.Msg.OK,
  1863. icon: Ext.MessageBox.INFO
  1864. });
  1865. } else {
  1866. Ext.Ajax.request({
  1867. url: '/lib/controller/downloadVideo.php',
  1868. params: {
  1869. UID: <?=$UserID;?>,
  1870. SID: '<?=$Session;?>',
  1871. FTS: a,
  1872. FMD: b,
  1873. FPS: c,
  1874. FEX: e
  1875. },
  1876. success: function(response, opts ){
  1877. const l = document.createElement('a');
  1878. l.style.display = 'none';
  1879. l.href = response.responseText;
  1880. l.download = d + response.responseText.substring( response.responseText.lastIndexOf('.'), response.responseText.length );
  1881. document.body.appendChild(l);
  1882. l.click();
  1883. ReportMask.hide();
  1884. Ext.Msg.show({
  1885. title:'<?=$Labels->GetLabel('_SUCCESS_');?>',
  1886. msg: '<?=$Labels->GetLabel('_VIDEO_FILE_HAS_DOWNLOADED_');?>',
  1887. buttons: Ext.Msg.OK,
  1888. icon: Ext.MessageBox.INFO
  1889. });
  1890. },
  1891. error: function(){
  1892. ReportMask.hide();
  1893. Ext.Msg.show({
  1894. title:'<?=$Labels->GetLabel('_REQ_FAILURE_');?>',
  1895. msg: '<?=$Labels->GetLabel('_AJX_REQFAILURE_');?>',
  1896. buttons: Ext.Msg.OK,
  1897. icon: Ext.MessageBox.ERROR
  1898. });
  1899. }
  1900. });
  1901. };
  1902. };