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.

2031 lines
65 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. var basePath = '/lib/controller/data/reports/'+reportHistoryBase+'/'+videoNfo[mid][1]+'.mp4';
  924. //video_t.src = "/video_view/stream?id="+videoNfo[mid][1]+"&TS="+videoNfo[mid][0]+"&sf=" + frame;
  925. //"/style/assets/nosignal.mp4";
  926. const parsedUrl = new URL( video_t.src );
  927. if( parsedUrl.pathname != basePath ) {
  928. console.log('Video Source Changed!');
  929. video_t.src = basePath;
  930. video_t.play();
  931. };
  932. video_t.currentTime = parseInt( frame / videoNfo[mid][2] );
  933. /*
  934. var store = grid.getStore();
  935. var rowIndex = store.find('fieldName', 'desiredValue');
  936. if (rowIndex !== -1) {
  937. grid.getSelectionModel().selectRow(rowIndex);
  938. }
  939. */
  940. };
  941. };
  942. function loadEventData( record ){
  943. ReportSelectionMode = 3; // Just One Event
  944. cEventTSS = record.ts+record.ms/1000;
  945. clearAllRadars();
  946. 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 ){
  947. if( record.r == 0 && record.range > 0 ){
  948. record.r = (2048*record.range)/65;
  949. };
  950. if( record.type == 86 || record.type == 87 ){
  951. if( record.type == 86 ){
  952. markEventOnRadar( record.node_id, record.az, record.r, "#00ffff", "#008080" );
  953. } else {
  954. markEventOnRadar( record.node_id, record.az, record.r, "#ffff00", "#808000" );
  955. };
  956. } else {
  957. markEventOnRadar( record.node_id, record.az, record.r, "#ff0000", "#800000" );
  958. };
  959. };
  960. if( record.video ){
  961. if( record.video == 2 ){
  962. showVideos();
  963. Ext.Ajax.request({
  964. url: '/lib/controller/getVideoInfo.php',
  965. params: {
  966. UID: <?=$UserID;?>,
  967. SID: '<?=$Session;?>',
  968. TS: record.rts,
  969. ID: record.id
  970. },
  971. success: function( response, opts ){
  972. var data = Ext.decode(response.responseText);
  973. if( data.videos != undefined ){
  974. if( data.videos.length ){
  975. for( i=0; i < data.videos.length; i++ ){
  976. //var video_t = document.getElementById( 'video-'+data.videos[i].media_stream_id );
  977. videoNfo[data.videos[i].media_stream_id] = [];
  978. videoNfo[data.videos[i].media_stream_id][0] = data.videos[i].ts;
  979. videoNfo[data.videos[i].media_stream_id][1] = data.videos[i].md5;
  980. videoNfo[data.videos[i].media_stream_id][2] = data.videos[i].fps;
  981. videoNfo[data.videos[i].media_stream_id][3] = data.videos[i].ext;
  982. videoNfo[data.videos[i].media_stream_id][4] = data.videos[i].fname; // host local time stamp for file name
  983. data.videos[i].frame -= 20;
  984. if( data.videos[i].frame < 0 ) data.videos[i].frame = 0;
  985. if( data.videos[i].ext == "mp4" ){
  986. setVideoMp4Source( data.videos[i].media_stream_id, data.videos[i].frame );
  987. } else {
  988. setVideoSource( data.videos[i].media_stream_id, data.videos[i].frame );
  989. };
  990. var slider_t = Ext.getCmp( 'video-slider-'+data.videos[i].media_stream_id );
  991. if( slider_t != undefined ){
  992. slider_t.setMaxValue( 60 * data.videos[i].fps );
  993. slider_t.suspendEvents();
  994. slider_t.setValue( data.videos[i].frame );
  995. slider_t.resumeEvents();
  996. };
  997. };
  998. };
  999. };
  1000. }
  1001. });
  1002. } else {
  1003. showVideos();//?
  1004. Ext.Ajax.request({
  1005. url: '/lib/controller/getPictureInfo.php',
  1006. params: {
  1007. UID: <?=$UserID;?>,
  1008. SID: '<?=$Session;?>',
  1009. TS: record.ts,
  1010. ID: record.id
  1011. },
  1012. success: function( response, opts ){
  1013. var data = Ext.decode(response.responseText);
  1014. if( data.pictures != undefined ){
  1015. if( data.pictures.length ){
  1016. for( i=0; i < data.pictures.length; i++ ){
  1017. //var video_t = document.getElementById( 'video-'+data.videos[i].media_stream_id );
  1018. videoNfo[data.pictures[i].media_stream_id] = [];
  1019. videoNfo[data.pictures[i].media_stream_id][0] = data.pictures[i].file;setPicture( data.pictures[i].media_stream_id, data.pictures[i].file );
  1020. };
  1021. };
  1022. };
  1023. }
  1024. });
  1025. };
  1026. } else {
  1027. hideVideos();
  1028. };
  1029. };
  1030. function loadBubbleData(record){
  1031. var csvg = document.getElementById( 'draw_svgr_bubble' );
  1032. if( csvg!= undefined ){
  1033. var roi = csvg.getElementById( "roi" );
  1034. if( roi != null ) csvg.removeChild( roi );
  1035. };
  1036. markEventOnRadar( 'bubble', record.az, record.r, "#00ffff", "#008080" );
  1037. };
  1038. function clearAllRadars(){
  1039. for( i=1; i< 1000; i++ ){
  1040. var csvg = document.getElementById( 'draw_svgr_' + i );
  1041. if( csvg!= undefined ){
  1042. var roi = csvg.getElementById( "roi" );
  1043. if( roi != null ) csvg.removeChild( roi );
  1044. };
  1045. };
  1046. };
  1047. function markEventOnRadar( rid, az, range, color, stroke ){
  1048. var csvg = document.getElementById( 'draw_svgr_' + rid );
  1049. if( csvg!= undefined ){
  1050. var roi = csvg.getElementById( "roi" );
  1051. if( roi != null ) csvg.removeChild( roi );
  1052. var bBox = csvg.getBBox();
  1053. var max = 2048;
  1054. switch( drawZoomLevels[rid] ){
  1055. case 50: max = 1024; break;
  1056. case 25: max = 512; break;
  1057. case 12: max = 256; break;
  1058. };
  1059. if( range < max ){
  1060. var ak = 2.0*Math.PI/360;
  1061. var ok = 1.0/35;
  1062. var rk = bBox.width / ( max * 2 );
  1063. var cpx = bBox.width / 2.0;
  1064. var cpy = bBox.height / 2.0;
  1065. x = cpx + rk * range * Math.cos( az*ak );
  1066. y = cpy - rk * range * Math.sin( az*ak );
  1067. var cc = document.createElementNS('http://www.w3.org/2000/svg', "circle");
  1068. var rz = bBox.width / csvg.clientWidth;
  1069. cc.setAttributeNS(null, "cx", x );
  1070. cc.setAttributeNS(null, "cy", y );
  1071. cc.setAttributeNS(null, "r", ""+(6*rz)+"" );
  1072. cc.setAttributeNS(null, "stroke", stroke );
  1073. cc.setAttributeNS(null, "stroke-width", ""+(2*rz)+"" );
  1074. cc.setAttributeNS(null, "stroke-opacity", ""+(1.0));
  1075. cc.setAttributeNS(null, "fill", color );
  1076. cc.setAttributeNS(null, "fill-opacity", ""+(1.0));
  1077. cc.setAttributeNS(null, "id", "roi" );
  1078. csvg.appendChild( cc );
  1079. };
  1080. };
  1081. };
  1082. function getData( Mode, ST/* = 0*/, ET /*= 0*/, SR /*= 0*/, DR /*= 0*/){
  1083. if( tlLoadLocker ) return;
  1084. tlLoadLocker = true;
  1085. if( Mode == 'arch' ){
  1086. Ext.MessageBox.wait("Loading Data","Please Wait",{
  1087. width: '100%',
  1088. hidden: true,
  1089. animate: true,
  1090. progress: true,
  1091. closable: false
  1092. });
  1093. };
  1094. Ext.Ajax.request({
  1095. url: '/lib/controller/getEventRecords.php',
  1096. params: {
  1097. SITE: <?=$SiteID;?>,
  1098. UID: <?=$UserID;?>,
  1099. SID: '<?=$Session;?>',
  1100. MODE: Mode,
  1101. FIL: selecredActiveSourceFilter,
  1102. SDA: SD,
  1103. SMO: SMO,
  1104. SYE: SY,
  1105. STM: ST,
  1106. ETM: ET,
  1107. STR: SR,
  1108. DIR: DR
  1109. },
  1110. success: function( response, opts ){
  1111. tlLoadLocker = false;
  1112. var data = Ext.decode(response.responseText);
  1113. if( data.updateFROMTO ){
  1114. Ext.getCmp('STimeFROM').setValue( data.STT );
  1115. Ext.getCmp('STimeTO').setValue( data.ENT );
  1116. if( data.SLD > 0 ){
  1117. SMO = GetMonthNum(data.SLD);
  1118. SY = GetYear(data.SLD);
  1119. SD = GetDay(data.SLD);
  1120. BuildCalendar();
  1121. };
  1122. };
  1123. eventsListStore.loadData( data, false );
  1124. if( Mode == 'arch' ){
  1125. showHistoryOnMap( data, true );
  1126. Ext.MessageBox.hide();
  1127. if( DR > 0 ){
  1128. Ext.getCmp('evtArchLog').getView().focusRow( eventsListStore.getCount() - 1 );
  1129. Ext.getCmp('evtArchLog').getSelectionModel().selectLastRow();
  1130. };
  1131. if( DR < 0 ){
  1132. Ext.getCmp('evtArchLog').getView().focusRow( 0 );
  1133. Ext.getCmp('evtArchLog').getSelectionModel().selectFirstRow();
  1134. };
  1135. } else {
  1136. showHistoryOnMap( data, false );
  1137. //LoadMapEventsZ( Mode );
  1138. };
  1139. },
  1140. failure: failureAJAXFunction
  1141. });
  1142. };
  1143. function loadArchive(){
  1144. if( tlInterval!= null ){
  1145. window.clearInterval( tlInterval );
  1146. tlInterval = null;
  1147. timelineObj = null;
  1148. };
  1149. setUserContent( 2 );
  1150. var tPanel = Ext.getCmp('main_portal');
  1151. tPanel.removeAll( true );
  1152. Ext.getCmp('main_content').setTitle( 'Events Archive' );
  1153. tPanel.add({
  1154. columnWidth: 0.83,
  1155. frame: false,
  1156. border: false,
  1157. items: [{
  1158. title: 'Site Map',
  1159. frame: false,
  1160. border: false,
  1161. layout: 'vbox',
  1162. layoutConfig: {
  1163. align : 'stretch',
  1164. pack : 'start',
  1165. },
  1166. height: PanelH-300,
  1167. items:[{
  1168. height: PanelH-325,
  1169. flex: 1,
  1170. frame: false,
  1171. border: false,
  1172. layout: 'fit',
  1173. items:{
  1174. id: 'event_map',
  1175. html: '&nbsp;'
  1176. }
  1177. }]
  1178. },{
  1179. frame: false,
  1180. border: false,
  1181. collapsible: false,
  1182. draggable: false,
  1183. layout: 'hbox',
  1184. items:[{
  1185. layout: 'form',
  1186. title: 'Date/Time',
  1187. width: 200,
  1188. frame: true,
  1189. border: false,
  1190. labelAlign: 'right',
  1191. labelWidth: 50,
  1192. defaults: { width: 80},
  1193. items: [{
  1194. xtype: 'combo',
  1195. id: 'STimeFROM',
  1196. fieldLabel: 'From',
  1197. editable: false,
  1198. typeAhead: true,
  1199. triggerAction: 'all',
  1200. width: 120,
  1201. lazyRender:true,
  1202. mode: 'local',
  1203. store: new Ext.data.ArrayStore({
  1204. id: 0,
  1205. fields: ['ss', 'displayText' ],
  1206. data: [<?php
  1207. $zuzu = array();
  1208. for( $i = 0; $i < 24; $i++) if( $i < 10 ) $zuzu[] = '['.($i*3600).',\'0'.$i.':00\']'; else $zuzu[] = '['.($i*3600).',\''.$i.':00\']';
  1209. echo implode( ',', $zuzu ); ?>]
  1210. }),
  1211. valueField: 'ss',
  1212. displayField: 'displayText'
  1213. },{
  1214. xtype: 'combo',
  1215. id: 'STimeTO',
  1216. fieldLabel: 'Till',
  1217. editable: false,
  1218. typeAhead: true,
  1219. triggerAction: 'all',
  1220. width: 120,
  1221. lazyRender:true,
  1222. mode: 'local',
  1223. store: new Ext.data.ArrayStore({
  1224. id: 0,
  1225. fields: ['ss', 'displayText' ],
  1226. data: [<?php
  1227. $zuzu = array();
  1228. for( $i = 1; $i < 25; $i++) if( $i < 10 ) $zuzu[] = '['.($i*3600).',\'0'.$i.':00\']'; else $zuzu[] = '['.($i*3600).',\''.$i.':00\']';
  1229. echo implode( ',', $zuzu ); ?>]
  1230. }),
  1231. valueField: 'ss',
  1232. displayField: 'displayText'
  1233. }],
  1234. html: '<table width="100%"><tr><td id="calendar_TD" align="center"></td></tr></table>',
  1235. buttons: [{
  1236. xtype: 'button',
  1237. text: 'Display History',
  1238. handler: function(){
  1239. var STU = Ext.getCmp('STimeFROM').getValue();
  1240. var ETU = Ext.getCmp('STimeTO').getValue();
  1241. getData( 'arch', STU, ETU );
  1242. }
  1243. }]
  1244. },{
  1245. title: 'Event Log',
  1246. frame: false,
  1247. height: 303,
  1248. id: 'evtArchLog',
  1249. xtype: 'grid',
  1250. ds: eventsListStore,
  1251. cm: new Ext.grid.ColumnModel( eventsListColModel_ops ),
  1252. sm: new Ext.grid.RowSelectionModel( eventsListSelModel_ops ),
  1253. listeners:{
  1254. keydown: function( e ) {
  1255. if( e.getKey() == e.UP ){
  1256. if( SelectedRow == 0 ){
  1257. var id = eventsListStore.getAt( 0 ).id;
  1258. getData( 'arch', 0, 0, id, 1 );
  1259. };
  1260. };
  1261. if( e.getKey() == e.DOWN ){
  1262. if( SelectedRow == ( eventsListStore.getCount() - 1 ) ){
  1263. var id = eventsListStore.getAt( SelectedRow ).id;
  1264. getData( 'arch', 0, 0, id, -1 );
  1265. Ext.getCmp('evtArchLog').getSelectionModel().selectFirstRow();
  1266. Ext.getCmp('evtArchLog').focus( false, true );
  1267. };
  1268. };
  1269. }
  1270. }
  1271. }]
  1272. }]
  1273. });
  1274. tPanel.add({
  1275. columnWidth: 0.17,
  1276. frame: true,
  1277. title: 'Event Information',
  1278. id: 'prop_content',
  1279. border: false,
  1280. items: [{
  1281. html:"<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1282. }]
  1283. });
  1284. tPanel.doLayout();
  1285. /*
  1286. Ext.getCmp('evtLog').getEl().set({tabindex: "0"});
  1287. Ext.getCmp('evtLog').getEl().addKeyMap({
  1288. eventName: "keyup",
  1289. binding: [{
  1290. key: Ext.EventObject.SPACE,
  1291. fn: function(){ alert("Space key pressed"); }
  1292. },{
  1293. key: [Ext.EventObject.LEFT, Ext.EventObject.RIGHT],
  1294. shift: true,
  1295. fn: function(){ alert("Left or right pressed while pressing shift"); }
  1296. }]
  1297. });
  1298. */
  1299. //BuildCalendar();
  1300. loadCalendarDates();
  1301. map = L.map('event_map',{
  1302. attributionControl: true,
  1303. //preferCanvas: true,
  1304. zoomControl: true,
  1305. center: [SiteLat, SiteLon],
  1306. /*zoomControl: false,
  1307. zoom: 17,
  1308. minZoom: 17,
  1309. maxZoom: 17,*/
  1310. keyboard: false
  1311. }).setView([SiteLat, SiteLon], 17);
  1312. //L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon } ).addTo(map).on('click', LoadNodesList ).bindPopup("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");
  1313. var mapLayers = [];
  1314. /*mapLayers["Bing"] = new BingLayer('https://t{s}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/{q}?it=A,G,L&shading=hill', {
  1315. subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
  1316. attribution: '&copy; <a href="https://bing.com/maps" target="_blank">Bing Maps</a>',
  1317. detectRetina: true
  1318. });*/
  1319. mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  1320. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  1321. maxNativeZoom: 18,
  1322. maxZoom: 24,
  1323. })
  1324. // https://leaflet-extras.github.io/leaflet-providers/preview/
  1325. mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
  1326. 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',
  1327. maxZoom: 19
  1328. });
  1329. mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
  1330. 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',
  1331. maxZoom: 19
  1332. });
  1333. mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
  1334. 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',
  1335. maxZoom: 24
  1336. });
  1337. mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde
  1338. attribution: 'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors',
  1339. maxZoom: 19
  1340. });
  1341. mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
  1342. 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>) ',
  1343. maxZoom: 19
  1344. });
  1345. /*
  1346. mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1347. 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>',
  1348. maxZoom: 22
  1349. });
  1350. mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1351. 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>',
  1352. maxZoom: 22
  1353. });
  1354. mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1355. 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>',
  1356. maxZoom: 22
  1357. });
  1358. */
  1359. var baseMaps = {
  1360. "MyMap": mapLayers["MyMap"],
  1361. "OpenStreetMap": mapLayers["OpenStreetMap"],
  1362. "OpenTopoMap": mapLayers["OpenTopoMap"],
  1363. "EsriSat": mapLayers["EsriSat"],
  1364. "EsriStreet": mapLayers["EsriStreet"],
  1365. "EsriTopo": mapLayers["EsriTopo"],
  1366. //"Bing": mapLayers["Bing"],
  1367. //"OSM-Cycle": mapLayers["Cycle"],
  1368. //"Landscape": mapLayers["Landscape"],
  1369. //"Outdoor": mapLayers["Outdoor"],
  1370. };
  1371. L.control.layers( baseMaps ).addTo(map);
  1372. mapLayers["MyMap"].addTo(map);
  1373. /*L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  1374. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  1375. maxNativeZoom: 18,
  1376. maxZoom: 24,
  1377. }).addTo(map); */
  1378. //loadTimeLineGroups( selectedSite );
  1379. loadMapZones( SelectedSite );
  1380. getData( 'arch' );
  1381. //eventsListStore.load({params:{start:0, limit:50, src: 'arch', fil: selecredActiveSourceFilter }});
  1382. };
  1383. function loadMonitoring(){
  1384. if( tlInterval!= null ){
  1385. window.clearInterval( tlInterval );
  1386. tlInterval = null;
  1387. timelineObj = null;
  1388. };
  1389. setUserContent( 1 );
  1390. var tPanel = Ext.getCmp('main_portal');
  1391. tPanel.removeAll( true );
  1392. Ext.getCmp('main_content').setTitle( 'Events Monitoring' );
  1393. tPanel.add({
  1394. columnWidth: 0.83,
  1395. frame: false,
  1396. border: false,
  1397. items: [{
  1398. title: '<?=$Labels->getLabel('_MAP_MONITORING_');?>',
  1399. frame: false,
  1400. border: false,
  1401. collapsible: false,
  1402. draggable: false,
  1403. layout: 'vbox',
  1404. layoutConfig: {
  1405. align : 'stretch',
  1406. pack : 'start',
  1407. },
  1408. height: PanelH-300,
  1409. items:[{
  1410. height: PanelH-325,
  1411. flex: 1,
  1412. frame: false,
  1413. border: false,
  1414. layout: 'fit',
  1415. items:{
  1416. id: 'event_map',
  1417. html: '&nbsp;'
  1418. }
  1419. }]
  1420. },{
  1421. frame: false,
  1422. border: true,
  1423. collapsible: false,
  1424. draggable: false,
  1425. layout: 'hbox',
  1426. items:[{
  1427. title: 'Alarm Sources',
  1428. xtype: 'panel',
  1429. border: false,
  1430. frame: false,
  1431. collapsible: false,
  1432. draggable: false,
  1433. id: 'sources_panel',
  1434. width: 160,
  1435. autoScroll: 'auto',
  1436. height: 303
  1437. },{
  1438. title: 'Event Log',
  1439. height: 303,
  1440. xtype: 'grid',
  1441. border: false,
  1442. frame: false,
  1443. collapsible: false,
  1444. draggable: false,
  1445. ds: eventsListStore,
  1446. cm: new Ext.grid.ColumnModel( eventsListColModel_ops ),
  1447. sm: new Ext.grid.RowSelectionModel( eventsListSelModel_ops ),
  1448. bbar: [{
  1449. text: 'Clear',
  1450. handler: function(){
  1451. Ext.Ajax.request({
  1452. url: '/lib/controller/clearEventCloud.php',
  1453. params: {
  1454. UID: <?=$UserID;?>,
  1455. SID: '<?=$Session;?>'
  1456. },
  1457. success: function( response, opts ){
  1458. },
  1459. failure: function( response, opts ) {
  1460. }
  1461. });
  1462. }
  1463. }]
  1464. }]
  1465. }]
  1466. });
  1467. tPanel.add({
  1468. columnWidth: 0.17,
  1469. title: 'Event Information',
  1470. frame: true,
  1471. id: 'prop_content',
  1472. border: false,
  1473. items: [{
  1474. html:"<div class='setEd_infoPanel' id='NUNU'><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>"
  1475. }]
  1476. });
  1477. tPanel.doLayout();
  1478. map = L.map('event_map',{
  1479. attributionControl: true,
  1480. //preferCanvas: true,
  1481. zoomControl: true,
  1482. center: [SiteLat, SiteLon],
  1483. /*zoomControl: false,
  1484. zoom: 17,
  1485. minZoom: 17,
  1486. maxZoom: 17,*/
  1487. keyboard: false
  1488. }).setView([SiteLat, SiteLon], 17);
  1489. //L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon } ).addTo(map).on('click', LoadNodesList ).bindPopup("<b><?=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?></b>");
  1490. var mapLayers = [];
  1491. /*mapLayers["Bing"] = new BingLayer('https://t{s}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/{q}?it=A,G,L&shading=hill', {
  1492. subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
  1493. attribution: '&copy; <a href="https://bing.com/maps" target="_blank">Bing Maps</a>',
  1494. detectRetina: true
  1495. });*/
  1496. mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  1497. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  1498. maxNativeZoom: 18,
  1499. maxZoom: 24,
  1500. })
  1501. // https://leaflet-extras.github.io/leaflet-providers/preview/
  1502. mapLayers["EsriStreet"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
  1503. 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',
  1504. maxZoom: 19
  1505. });
  1506. mapLayers["EsriSat"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
  1507. 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',
  1508. maxZoom: 19
  1509. });
  1510. mapLayers["EsriTopo"] = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/{z}/{y}/{x}', {
  1511. 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',
  1512. maxZoom: 24
  1513. });
  1514. mapLayers["OpenStreetMap"] = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { //de/tiles/osmde
  1515. attribution: 'Map data &copy; <a href="https://openstreetmap.org" target="_blank">OpenStreetMap</a> contributors',
  1516. maxZoom: 19
  1517. });
  1518. mapLayers["OpenTopoMap"] = L.tileLayer("https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", {
  1519. 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>) ',
  1520. maxZoom: 19
  1521. });
  1522. /*
  1523. mapLayers["Cycle"] = L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1524. 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>',
  1525. maxZoom: 22
  1526. });
  1527. mapLayers["Landscape"] = L.tileLayer('https://tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1528. 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>',
  1529. maxZoom: 22
  1530. });
  1531. mapLayers["Outdoor"] = L.tileLayer('https://tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + _PHP['API_KEY_THUNDERFOREST_1'], {
  1532. 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>',
  1533. maxZoom: 22
  1534. });
  1535. */
  1536. var baseMaps = {
  1537. "MyMap": mapLayers["MyMap"],
  1538. "OpenStreetMap": mapLayers["OpenStreetMap"],
  1539. "OpenTopoMap": mapLayers["OpenTopoMap"],
  1540. "EsriSat": mapLayers["EsriSat"],
  1541. "EsriStreet": mapLayers["EsriStreet"],
  1542. "EsriTopo": mapLayers["EsriTopo"],
  1543. //"Bing": mapLayers["Bing"],
  1544. //"OSM-Cycle": mapLayers["Cycle"],
  1545. //"Landscape": mapLayers["Landscape"],
  1546. //"Outdoor": mapLayers["Outdoor"],
  1547. };
  1548. L.control.layers( baseMaps ).addTo(map);
  1549. mapLayers["MyMap"].addTo(map);
  1550. /*L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  1551. attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
  1552. maxNativeZoom: 18,
  1553. maxZoom: 24,
  1554. }).addTo(map); */
  1555. loadMapZones( SelectedSite );
  1556. tlInterval = window.setInterval( getData, 333, 'live' );
  1557. };
  1558. function loadOnlineMonitoring(devID){
  1559. if( tlInterval!= null ){
  1560. window.clearInterval( tlInterval );
  1561. tlInterval = null;
  1562. timelineObj = null;
  1563. };
  1564. var tPanel = Ext.getCmp('main_content');
  1565. tPanel.removeAll( true );
  1566. tPanel.add({
  1567. html: 'Device Monitoring '+devID
  1568. });
  1569. tPanel.doLayout();
  1570. };
  1571. function shutImg( img, a /* = '' */){
  1572. if( a == '' ){
  1573. img.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEAAAAALAAAAAABAAEAAAI=;';
  1574. } else {
  1575. img.src = a;
  1576. };
  1577. };
  1578. var ReportMask = null;
  1579. var ReportLayoutLoadded = false;
  1580. var ReportSelectionMode = 0; //All
  1581. function loadReportSegment( ts, bid, eid ){
  1582. if( !ReportLayoutLoadded ){
  1583. ReportMask = new Ext.LoadMask(Ext.getCmp('main_content').getEl(), {msg:"Please wait..."});
  1584. ReportMask.show();
  1585. Ext.Ajax.request({
  1586. url: '/lib/controller/getReportLayout.php',
  1587. params: {
  1588. UID: <?=$UserID;?>,
  1589. SID: '<?=$Session;?>'//,
  1590. //BID: nid,
  1591. //EID: evt_ts
  1592. },
  1593. success: function(response, opts ){
  1594. var data = Ext.decode( response.responseText );
  1595. var tPanel = Ext.getCmp('main_content');
  1596. tPanel.removeAll(true);
  1597. Ext.getCmp('main_content').add({
  1598. xtype: 'portal',
  1599. id: 'segment_portal',
  1600. frame: false,
  1601. border: false,
  1602. items:{
  1603. html: ''
  1604. },
  1605. listeners:{
  1606. drop: function( a ){
  1607. updateDashBoardItemLayout( a.panel.id, a.columnIndex, a.position );
  1608. }
  1609. }
  1610. });
  1611. Ext.getCmp('main_content').doLayout();
  1612. tPanel = Ext.getCmp('segment_portal');
  1613. //nodeDashboardStatuses = new Array();
  1614. for( i=0; i < data.length; i++) tPanel.add( data[i] );
  1615. tPanel.doLayout();
  1616. ReportMask.hide();
  1617. ReportLayoutLoadded = true;
  1618. loadReportData( ts, bid, eid );
  1619. },
  1620. error: function(){
  1621. ReportMask.hide();
  1622. }
  1623. });
  1624. } else {
  1625. loadReportData( ts, bid, eid );
  1626. };
  1627. };
  1628. var currentHistoryTS = 0;
  1629. var currentHistoryBeginId = 0;
  1630. var currentHistoryEndId = 0;
  1631. function loadReportData( ts, bid, eid ){
  1632. ReportSelectionMode = 2; // Session Selected
  1633. hideVideos();
  1634. currentHistoryTS = ts;
  1635. currentHistoryBeginId = bid;
  1636. currentHistoryEndId = eid;
  1637. Ext.Ajax.request({
  1638. url: '/lib/controller/getHistoryEvents.php',
  1639. params: {
  1640. UID: <?=$UserID;?>,
  1641. SID: '<?=$Session;?>',
  1642. TS: currentHistoryTS,
  1643. BID: currentHistoryBeginId,
  1644. EID: currentHistoryEndId,
  1645. },
  1646. success: function(response, opts ){
  1647. var data = Ext.decode( response.responseText );
  1648. if( data.log != undefined ){
  1649. if( map != undefined ) if( map != null ) showHistoryOnMap( data, true );
  1650. if( data.log.length ){
  1651. rep_store_id = data.log[0].id;
  1652. rep_array = data.log;//.concat( rep_array );
  1653. //if( log_array.length > 32 ){
  1654. // log_array = log_array.slice( 0, 31 );
  1655. //};
  1656. rep_store.removeAll();
  1657. rep_store.loadData( rep_array );
  1658. };
  1659. } else {
  1660. // alert('No Log');
  1661. // clear the log
  1662. rep_store.removeAll();
  1663. };
  1664. }
  1665. });
  1666. };
  1667. var reportHistoryBase = '';
  1668. function loadReportDayTree( ts ){
  1669. ReportSelectionMode = 1;//Day Selected
  1670. ReportMask = new Ext.LoadMask(Ext.getCmp('left_side_menu').getEl(), {msg:"Please wait..."});
  1671. ReportMask.show();
  1672. reportHistoryBase = '';
  1673. Ext.Ajax.request({
  1674. url: '/lib/controller/getHistoryDay.php',
  1675. params: {
  1676. UID: <?=$UserID;?>,
  1677. SID: '<?=$Session;?>',
  1678. DTS: ts
  1679. },
  1680. success: function(response, opts ){
  1681. var data = Ext.decode( response.responseText );
  1682. var sPanel = Ext.getCmp('left_side_menu');
  1683. reportHistoryBase = data.base_path;
  1684. sPanel.removeAll( true );
  1685. sPanel.add({
  1686. xtype: 'panel',
  1687. layout: 'vbox',
  1688. frame: true,
  1689. border: false,
  1690. items:[{
  1691. xtype: 'spacer',
  1692. height: 3
  1693. },{
  1694. 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>',
  1695. frame: false,
  1696. width: '100%',
  1697. border: false
  1698. },{
  1699. xtype: 'spacer',
  1700. height: 5
  1701. },{
  1702. xtype: 'treepanel',
  1703. autoScroll: true,
  1704. width: '100%',
  1705. height: PanelH-206,
  1706. border: true,
  1707. frame: true,
  1708. loader: new Ext.tree.TreeLoader(),
  1709. rootVisible: false,
  1710. root: new Ext.tree.AsyncTreeNode( data ),
  1711. listeners: {
  1712. click: function(n) {
  1713. if( n.attributes.leaf ){
  1714. Ext.getCmp('chu_adate').show();
  1715. sPanel.doLayout();
  1716. loadReportSegment( ts, n.attributes.bid, n.attributes.eid );
  1717. //Ext.Msg.alert('Navigation Tree Click', 'You clicked: "' + n.attributes.ts + '"');
  1718. };
  1719. }
  1720. }
  1721. },{
  1722. xtype: 'spacer',
  1723. height: 10
  1724. },{
  1725. xtype: 'button',
  1726. id: 'chu_adate',
  1727. text: 'Show Dates',
  1728. hidden: true,
  1729. width: '100%',
  1730. iconCls: 'reports_dates_btn',
  1731. scale: 'large',
  1732. handler: function(){
  1733. Ext.getCmp('chu_adate').hide();
  1734. initReportsView();
  1735. }
  1736. }]
  1737. });
  1738. sPanel.doLayout();
  1739. ReportMask.hide();
  1740. }
  1741. });
  1742. };
  1743. var videoElements = [];
  1744. var videoNfo=[];
  1745. function hideVideos(){
  1746. if( videoElements.length ) for( i = 0; i < videoElements.length; i++ ) hideVideo( videoElements[i] );
  1747. };
  1748. function hideVideo( a ){
  1749. var tt = Ext.getCmp( 'video-ctl-panel-' + a );
  1750. if( tt != undefined ) tt.hide();
  1751. var video_t = document.getElementById( 'video-img-' + a );
  1752. if( video_t != undefined ){
  1753. video_t.src = "/style/assets/no-signal.png";
  1754. };
  1755. };
  1756. function showVideo( a ){
  1757. var tt = Ext.getCmp( 'video-ctl-panel-' + a );
  1758. if( tt != undefined ) tt.show();
  1759. <?php
  1760. // Disable Button in KIOSK mode
  1761. if( $_SERVER['SERVER_ADDR'] == $_SERVER['REMOTE_ADDR'] ){
  1762. ?>
  1763. tt = Ext.getCmp( 'video-btn-download-' + a );
  1764. if( tt != undefined ) tt.hide();
  1765. <?php
  1766. };
  1767. ?>
  1768. };
  1769. function showMp4( a, b ){
  1770. var tt = Ext.getCmp( 'video-ctl-panel-' + a );
  1771. if( tt != undefined ) tt.show();
  1772. var video_t = document.getElementById( 'video-img-' + a );
  1773. if( video_t != undefined ){
  1774. video_t.src = "/lib/controller/data/reports/"+b;
  1775. };
  1776. };
  1777. function setPicture( a, b ){
  1778. var tt = Ext.getCmp( 'video-ctl-panel-' + a );
  1779. if( tt != undefined ) tt.hide();
  1780. var video_t = document.getElementById( 'video-img-' + a );
  1781. if( video_t != undefined ){
  1782. video_t.src = "/lib/controller/data/reports/"+b;
  1783. };
  1784. };
  1785. function showVideos(){
  1786. if( videoElements.length ) for( i = 0; i < videoElements.length; i++ ) showVideo( videoElements[i] );
  1787. };
  1788. function downloadCurrentVideo( stid ){
  1789. var d = new Date( videoNfo[stid][0] * 1000 );
  1790. // File name in the host's local time (from the server); browser local time only as a fallback
  1791. var videoFileDownloadTarget = videoNfo[stid][4] ? videoNfo[stid][4] : 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');
  1792. // TS, MD5, FPS, EXT
  1793. downloadVideoFile( videoNfo[stid][0], videoNfo[stid][1], videoNfo[stid][2], videoFileDownloadTarget, videoNfo[stid][3] );
  1794. };
  1795. function initReportsView(){
  1796. ReportSelectionMode = 0; // All History
  1797. if( tlInterval!= null ){
  1798. window.clearInterval( tlInterval );
  1799. tlInterval = null;
  1800. timelineObj = null;
  1801. };
  1802. ReportLayoutLoadded = false;
  1803. var tPanel = Ext.getCmp('main_content');
  1804. var sPanel = Ext.getCmp('left_side_menu');
  1805. tPanel.removeAll( true );
  1806. sPanel.removeAll( true );
  1807. tPanel.add({
  1808. xtype: 'panel',
  1809. height: PanelH+15,
  1810. html: '<div id="activity_ph"></div>',
  1811. listeners:{
  1812. afterrender: function(){
  1813. ReportMask = new Ext.LoadMask(Ext.getCmp('main_content').getEl(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."});
  1814. ReportMask.show();
  1815. var jj = (PanelW - 230)/55;
  1816. changeStyleSheet('amap-empty-day','{width: '+jj+'px; height: '+jj+'px;}');
  1817. changeStyleSheet('amap-week-day','{width: '+jj+'px; height: '+jj+'px;}');
  1818. changeStyleSheet('amap-week-name','{width: '+jj+'px; height: '+jj+'px;}');
  1819. Ext.Ajax.request({
  1820. url: '/lib/controller/getHistoryDates.php',
  1821. params: {
  1822. UID: <?=$UserID;?>,
  1823. SID: '<?=$Session;?>'
  1824. },
  1825. success: function(response, opts ){
  1826. var data = Ext.decode( response.responseText );
  1827. var activityMap = new ActivityMap( data, {
  1828. id: "dji-volume-map",
  1829. parent: '#activity_ph',
  1830. showTitle: false,
  1831. showYears: true,
  1832. width: 100,
  1833. hue: 1,
  1834. fit: true,
  1835. compact: true,
  1836. timeColumn: "t",
  1837. valueColumn: "v"
  1838. });
  1839. activityMap.render();
  1840. ReportMask.hide();
  1841. },
  1842. error: function(){
  1843. ReportMask.hide();
  1844. }
  1845. });
  1846. }
  1847. }
  1848. });
  1849. tPanel.doLayout();
  1850. sPanel.add({
  1851. xtype: 'panel',
  1852. frame: true,
  1853. border: false,
  1854. items: [{
  1855. html: '<div class="setEd_infoPanel" id="NANA"><?=$Labels->GetLabel('_PLS_SEL_CAL_DATE_');?></div>',
  1856. height: PanelH - 30
  1857. }]
  1858. });
  1859. sPanel.doLayout();
  1860. };
  1861. function downloadVideoFile( a, b, c, d, e ){
  1862. ReportMask = new Ext.LoadMask( Ext.getBody(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."} );
  1863. ReportMask.show();
  1864. if( e == "mp4" ){
  1865. var z = new Date( a * 1000 );
  1866. 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';
  1867. const l = document.createElement('a');
  1868. l.style.display = 'none';
  1869. l.href = videoFileDownloadTarget;
  1870. l.download = d + '.mp4';
  1871. document.body.appendChild(l);
  1872. l.click();
  1873. ReportMask.hide();
  1874. Ext.Msg.show({
  1875. title:'<?=$Labels->GetLabel('_SUCCESS_');?>',
  1876. msg: '<?=$Labels->GetLabel('_VIDEO_FILE_HAS_DOWNLOADED_');?>',
  1877. buttons: Ext.Msg.OK,
  1878. icon: Ext.MessageBox.INFO
  1879. });
  1880. } else {
  1881. Ext.Ajax.request({
  1882. url: '/lib/controller/downloadVideo.php',
  1883. params: {
  1884. UID: <?=$UserID;?>,
  1885. SID: '<?=$Session;?>',
  1886. FTS: a,
  1887. FMD: b,
  1888. FPS: c,
  1889. FEX: e
  1890. },
  1891. success: function(response, opts ){
  1892. const l = document.createElement('a');
  1893. l.style.display = 'none';
  1894. l.href = response.responseText;
  1895. l.download = d + response.responseText.substring( response.responseText.lastIndexOf('.'), response.responseText.length );
  1896. document.body.appendChild(l);
  1897. l.click();
  1898. ReportMask.hide();
  1899. Ext.Msg.show({
  1900. title:'<?=$Labels->GetLabel('_SUCCESS_');?>',
  1901. msg: '<?=$Labels->GetLabel('_VIDEO_FILE_HAS_DOWNLOADED_');?>',
  1902. buttons: Ext.Msg.OK,
  1903. icon: Ext.MessageBox.INFO
  1904. });
  1905. },
  1906. error: function(){
  1907. ReportMask.hide();
  1908. Ext.Msg.show({
  1909. title:'<?=$Labels->GetLabel('_REQ_FAILURE_');?>',
  1910. msg: '<?=$Labels->GetLabel('_AJX_REQFAILURE_');?>',
  1911. buttons: Ext.Msg.OK,
  1912. icon: Ext.MessageBox.ERROR
  1913. });
  1914. }
  1915. });
  1916. };
  1917. };