1var calendarImageSource = '/siata_nuevo/application/assets/img/siata_nuevo/018.gif'; 2var dateFormat = 'yy-mm-dd'; 3var timeFormat = 'hh:mm:ss'; 4 5var data_div_prefix = "data_div"; 6var icon_plus_url = "/siata_nuevo/application/assets/img/siata_nuevo/plus.png"; 7var icon_minus_url = "/siata_nuevo/application/assets/img/siata_nuevo/minus.png"; 8var style_class_separador_data = "separador_data_div"; 9var style_class_acelerografo_data = "acelerografo_data"; 10 11var data_service_base_url = "/siata_nuevo/"; 12var listar_eventos_acelerografo_service_name = "listar_eventos_acelerografo.php"; 13 14var post_type_flag = "POST"; 15var get_type_flag = "GET"; 16 17function formatDateTimeGraficador (date) 18{ 19 var currentDay = (date.getDate ().toString().length == 1) ? '0' + date.getDate () : date.getDate (); 20 var currentMonth = ((date.getMonth () + 1).toString().length == 1) ? '0' + (date.getMonth () + 1) : date.getMonth () + 1; 21 var currentYear = date.getFullYear (); 22 var currentHour = (date.getHours ().toString().length == 1) ? '0' + date.getHours () : date.getHours (); 23 var currentMinute = (date.getMinutes ().toString().length == 1) ? '0' + date.getMinutes () : date.getMinutes (); 24 var currentSecond = (date.getSeconds ().toString().length == 1) ? '0' + date.getSeconds () : date.getSeconds (); 25 26 return currentYear + "-" + currentMonth + "-" + currentDay + " " + currentHour + ":" + currentMinute + ":" + currentSecond; 27} 28 29function configurarDatetimePicker (inputId) 30{ 31 jQuery(function($){ 32 $.datepicker.regional['es'] = { 33 closeText: 'Cerrar', 34 prevText: '<Ant', 35 nextText: 'Sig>', 36 currentText: 'Hoy', 37 monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'], 38 monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun','Jul','Ago','Sep','Oct','Nov','Dic'], 39 dayNames: ['Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado'], 40 dayNamesShort: ['Dom','Lun','Mar','Mié','Juv','Vie','Sáb'], 41 dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','Sá'], 42 weekHeader: 'Sm', 43 firstDay: 1, 44 dateFormat: dateFormat, 45 timeFormat: timeFormat, 46 isRTL: false, 47 showMonthAfterYear: false, 48 yearSuffix: ''}; 49 $.datepicker.setDefaults($.datepicker.regional['es']); 50 }); 51} 52 53function init_datetime_picker () 54{ 55 var currentDateTime = new Date (); 56 currentDateTime.setSeconds (0); 57 var currentDateTimePre = new Date (currentDateTime.getTime () - (5 * 60 * 1000)); 58 59 if (($("#fechaInicialBusquedaAcelerografo")) && ($("#fechaFinalBusquedaAcelerografo")) && ($("#enviarBotonBusquedaAcelerografo"))) 60 { 61 $("#fechaInicialBusquedaAcelerografo").val (formatDateTimeGraficador (currentDateTimePre)); 62 $("#fechaFinalBusquedaAcelerografo").val (formatDateTimeGraficador (currentDateTime)); 63 64 configurarDatetimePicker ("fechaInicialBusquedaAcelerografo"); 65 configurarDatetimePicker ("fechaFinalBusquedaAcelerografo"); 66 $("#enviarBotonBusquedaAcelerografo").button (); 67 } 68} 69 70function run_ajax_json_response_service (service_url, service_name, param_names, param_values, type_flag, async_flag) 71{ 72 if ((async_flag == null) || (async_flag == undefined) || (typeof async_flag != typeof true)) 73 { 74 async_flag = true; 75 } 76 77 if ((type_flag == null) || (type_flag == undefined) || ((type_flag != post_type_flag) && (type_flag != get_type_flag))) 78 { 79 type_flag = "POST"; 80 } 81 82 var json_parameters = {}; 83 84 if ((param_names != null) && (param_names != undefined) && (param_values != null) && (param_values != undefined) && (param_names.length == param_values.length)) 85 { 86 $.each (param_names, function (idx_param_name, param_name) 87 { 88 json_parameters[param_name] = param_values[idx_param_name]; 89 } 90 ); 91 } 92 93 response_data = {}; 94 95 $.ajax ({ 96 url : service_url + service_name, 97 type : type_flag, 98 dataType : "json", 99 data : json_parameters, 100 async : async_flag, 101 success : function (data) { 102 response_data = data; 103 }, 104 error : function (request, status, error) { 105// console.log(service_url + service_name); 106 error_response_json = {}; 107 error_response_json_detail = {}; 108 error_response_json_detail["status"] = status; 109 error_response_json_detail["error"] = error; 110 error_response_json["error_detail"] = error_response_json_detail; 111 112 response_data = error_response_json; 113 } 114 }); 115 116 return response_data; 117} 118 119function run_ajax_xml_response_service (service_url, service_name, param_names, param_values, type_flag, async_flag) 120{ 121 if ((async_flag == null) || (async_flag == undefined) || (typeof async_flag != typeof true)) 122 { 123 async_flag = true; 124 } 125 126 if ((type_flag == null) || (type_flag == undefined) || ((type_flag != post_type_flag) && (type_flag != get_type_flag))) 127 { 128 type_flag = "POST"; 129 } 130 131 var json_parameters = {}; 132 133 if ((param_names != null) && (param_names != undefined) && (param_values != null) && (param_values != undefined) && (param_names.length == param_values.length)) 134 { 135 $.each (param_names, function (idx_param_name, param_name) 136 { 137 json_parameters[param_name] = param_values[idx_param_name]; 138 } 139 ); 140 } 141 142 response_data = {}; 143 $.ajax ({ 144 url : service_url + service_name, 145 type : type_flag, 146 dataType : "xml", 147 data : json_parameters, 148 async : async_flag, 149 success : function (data) { 150 response_data = data; 151 }, 152 error : function (request, status, error) { 153 error_response_json = {}; 154 error_response_json_detail = {}; 155 error_response_json_detail["status"] = status; 156 error_response_json_detail["error"] = error; 157 error_response_json["error_detail"] = error_response_json_detail; 158 159 response_data = error_response_json; 160 } 161 }); 162 163 return response_data; 164} 165 166function toggle_div (div_id) 167{ 168 $("#" + div_id).toggle ("fast"); 169} 170 171function create_graph_div_element (div_id, graph_title_array, graph_imgpath_array, num_cols) 172{ 173 var div_element = $("<div/>", { 174 "id": div_id 175 }).css ({ 176// "border": "1px solid", 177 "width": "100%", 178 "margin": "5 0 5 0", 179 "padding": "0 0 0 0" 180 }); 181 182 div_element.hide (); 183 184 var table_obj = $("<table border='0'/>").css ({"width": "100%"}); 185 table_obj.appendTo (div_element); 186 var num_rows = Math.ceil (graph_title_array.length / num_cols); 187 var current_array_idx = 0; 188 189 for (var i = 0; i < num_rows; i++) 190 { 191 var tr_obj = $("<tr/>").css ({"width": "100%", "font-size": "0.78vw"}).appendTo (table_obj); 192 193 for (var j = 0; j < num_cols; j++) 194 { 195 if (current_array_idx < graph_title_array.length) 196 { 197 var td_title_obj = $("<td/>", {"text": graph_title_array[current_array_idx]}).css ({"font-weight": "bold", "text-align": "left", "word-wrap": "break-word"}).appendTo (tr_obj); 198 var td_value_obj = $("<td/>"); 199 var ref_obj = $("<a/>", {"text": graph_imgpath_array[current_array_idx].slice(-25), "href": graph_imgpath_array[current_array_idx], "target": "_blank"}).css ({"padding-right": "5px", "text-align": "left", "word-wrap": "break-word", "width": "100%"}).appendTo (td_value_obj); 200 td_value_obj.appendTo (tr_obj); 201 202 current_array_idx += 1; 203 } 204 else 205 { 206 break; 207 } 208 } 209 210 if (current_array_idx >= graph_title_array.length) 211 { 212 break; 213 } 214 } 215 216 return div_element; 217} 218 219function create_info_div_icon (related_div_id, icon_active_url, icon_inactive_url) 220{ 221 var a_element = $("<a/>", { 222 "href": "javascript: toggle_div ('" + related_div_id + "')" 223 }); 224 225 var img_element = $("<img/>", { 226 "src": icon_active_url, 227 "alt": "info_icon" 228 }).css ({ 229 "width": "10px", 230 "height": "10px", 231 "padding-right": "5px" 232 }); 233 img_element.appendTo (a_element); 234 235 a_element.click (function () { 236 var current_icon_url = img_element.attr ("src"); 237 238 if (current_icon_url == icon_active_url) 239 { 240 img_element.attr ("src", icon_inactive_url); 241 } 242 else 243 { 244 img_element.attr ("src", icon_active_url); 245 } 246 }); 247 248 img_element.appendTo (a_element); 249 250 return a_element; 251} 252 253function create_info_div_title_element (related_div_id, info_title_text) 254{ 255 var title_element = $("<a/>", { 256 "text": info_title_text, 257 }).css ({ 258 "font-size": "0.78vw !important", 259 "font-weight": "bold", 260 "margin": "0" 261 }); 262 263 return title_element; 264} 265 266function create_info_div_element (div_id, element_title_array, element_value_array, num_cols) 267{ 268 var div_element = $("<div/>", { 269 "id": div_id 270 }).css ({ 271 "width": "100%", 272 "margin": "5 0 5 0", 273 "padding": "0 0 0 0" 274 }); 275 276 div_element.hide (); 277 278 var table_obj = $("<table border='0'/>").css ({"width": "100%"}).appendTo (div_element); 279 var num_rows = Math.ceil (element_title_array.length / num_cols); 280 var current_array_idx = 0; 281 282 for (var i = 0; i < num_rows; i++) 283 { 284 var tr_obj = $("<tr/>").css ({"width": "100%", "font-size": "0.78vw"}).appendTo (table_obj); 285 286 for (var j = 0; j < num_cols; j++) 287 { 288 if (current_array_idx < element_title_array.length) 289 { 290 var td_title_obj = $("<td/>", {"text": element_title_array[current_array_idx]}).css ({"font-weight": "bold", "text-align": "left"}).appendTo (tr_obj); 291 292 if (element_value_array[current_array_idx].startsWith("https://")) 293 { 294 var td_value_obj = $("<td/>"); 295 var ref_obj = $("<a/>", {"text": element_value_array[current_array_idx].slice(-25), "href": element_value_array[current_array_idx], "target": "_blank"}).css ({"padding-right": "5px", "text-align": "left", "word-wrap": "break-word", "width": "100%"}).appendTo (td_value_obj); 296 td_value_obj.appendTo (tr_obj); 297 } 298 else 299 { 300 var td_value_obj = $("<td/>", {"text": element_value_array[current_array_idx]}).css ({"padding-right": "5px", "text-align": "left"}).appendTo (tr_obj); 301 } 302 303 if (element_title_array.length - current_array_idx == 1) 304 { 305 td_value_obj.attr('colspan', (num_cols - j)); 306 } 307 308 current_array_idx += 1; 309 } 310 else 311 { 312 break; 313 } 314 } 315 316 if (current_array_idx >= element_title_array.length) 317 { 318 break; 319 } 320 } 321 322 return div_element; 323} 324 325function load_acelerografo_data_view (id_estacion, fecha_inicial, fecha_final, parent_div_id) 326{ 327 var paramNames = new Array (); 328 var paramValues = new Array () 329 330 paramNames.push ("id_estacion"); 331 paramValues.push (id_estacion); 332 paramNames.push ("fecha_inicial"); 333 paramValues.push (fecha_inicial); 334 paramNames.push ("fecha_final"); 335 paramValues.push (fecha_final); 336 337 acelerografo_data = run_ajax_json_response_service (data_service_base_url, listar_eventos_acelerografo_service_name, paramNames, paramValues, get_type_flag, false); 338 339 if ((acelerografo_data["error_detail"] == null) || (acelerografo_data["error_detail"] == undefined)) 340 { 341 $("#" + parent_div_id).empty (); 342 343 if (acelerografo_data.features.length == 0) 344 { 345 alert ("No se encontraron datos con los criterios seleccionados", "Informacion - Graficador de Datos", function() {$.alerts.dialogClass = null;}); 346 } 347 else 348 { 349 $.each (acelerografo_data.features, function (idx_feature, feature_data) 350 { 351 var data_div = $("<div/>", { 352 "id": parent_div_id + data_div_prefix + idx_feature, 353 "class": style_class_acelerografo_data, 354 "font-size": "0.78vw" 355 }).appendTo ("#" + parent_div_id); 356 357 var table_obj = $("<table/>").css ({"width": "100%"}).appendTo (data_div); 358 var tr_obj = $("<tr/>").css ({"width": "100%", "font-size": "0.78vw"}).appendTo (table_obj); 359
359 var td_data_obj = $("<td/>").css ({"width": "100%", "font-size": "0.78vw"}).appendTo (tr_obj); 360 361 $("<p/>", { 362 "text": "Evento: " + feature_data.properties.ideventoacelerografo, 363 }).css ({ 364 "font-size": "0.78vw !important", 365 "font-weight": "bold" 366 }).appendTo (td_data_obj); 367 368 var related_div_id = ""; 369 370 var evt_data_icon_element = create_info_div_icon (parent_div_id + data_div_prefix + "_evt_" + feature_data.properties.codigo + idx_feature, icon_plus_url, icon_minus_url); 371 var evt_data_title_element = create_info_div_title_element (parent_div_id + data_div_prefix + "_evt_" + feature_data.properties.codigo + idx_feature, "Datos Evento Acelerógrafo"); 372 var ing_data_icon_element = create_info_div_icon (parent_div_id + data_div_prefix + "_ing_" + feature_data.properties.codigo + idx_feature, icon_plus_url, icon_minus_url); 373 var ing_data_title_element = create_info_div_title_element (parent_div_id + data_div_prefix + "_ing_" + feature_data.properties.codigo + idx_feature, "Datos Evento RSNC"); 374 var graph_data_icon_element = create_info_div_icon (parent_div_id + data_div_prefix + "_graph_" + feature_data.properties.codigo + idx_feature, icon_plus_url, icon_minus_url); 375 var graph_data_title_element = create_info_div_title_element (parent_div_id + data_div_prefix + "_graph_" + feature_data.properties.codigo + idx_feature, "Graficas"); 376 var download_data_icon_element = create_info_div_icon (parent_div_id + data_div_prefix + "_download_" + feature_data.properties.codigo + idx_feature, icon_plus_url, icon_minus_url); 377 var download_data_title_element = create_info_div_title_element (parent_div_id + data_div_prefix + "_download_" + feature_data.properties.codigo + idx_feature, "Datos"); 378 379 var est_data_title_array = new Array ("Municipio", "Latitud", "Longitud", "Altura Nivel Mar", "Altura Nivel Piso", "Equipo", "Red"); 380 var est_data_value_array = new Array (feature_data.properties.municipio, parseFloat (feature_data.properties.latitud_estacion).toFixed (4), parseFloat (feature_data.properties.longitud_estacion).toFixed (4), parseFloat (feature_data.properties.alturanivelmar_estacion).toFixed (4), parseFloat (feature_data.properties.alturanivelpiso_estacion).toFixed (4), feature_data.properties.marcasensor, feature_data.properties.redacelerografo); 381 var evt_data_title_array = new Array ("Fecha Inicial","Fecha Final", "AceleraciónMax_ns", "AceleraciónMax_ew", "AceleraciónMax_v"); 382 var evt_data_value_array = new Array (feature_data.properties.fecha_inicial, feature_data.properties.fecha_final, parseFloat (feature_data.properties.amax_ns).toFixed (4), parseFloat (feature_data.properties.amax_ew).toFixed (4), parseFloat (feature_data.properties.amax_v).toFixed (4)); 383 384 var codigo_nombre = feature_data.properties.nombre.substring (feature_data.properties.nombre.length - 4, feature_data.properties.nombre.length - 1); 385 var fecha_str_date = feature_data.properties.fecha_inicial.substring (0, 4) + feature_data.properties.fecha_inicial.substring (5, 7) + feature_data.properties.fecha_inicial.substring (8,10); 386 var url_prefix_graph = "https://siata.gov.co/testJC1/files/"; 387 388 var ing_data_title_array = new Array ("Fecha", "Profundidad", "Magnitud", "Latitud", "Longitud", "Numero Estaciones", "Departamento", "Municipio"); 389 var ing_data_value_array = new Array (feature_data.properties.fecha, parseFloat (feature_data.properties.profundidad).toFixed (4), parseFloat (feature_data.properties.magnitud).toFixed (4), parseFloat (feature_data.properties.latitud_eventoingeominas).toFixed (4), parseFloat (feature_data.properties.longitud_eventoingeominas).toFixed (4), feature_data.properties.numero_estaciones, feature_data.properties.departamento_eventoingeominas, feature_data.properties.municipio_eventoingeominas); 390 var est_data_div = create_info_div_element (parent_div_id + data_div_prefix + "_est_" + feature_data.properties.codigo + idx_feature, est_data_title_array, est_data_value_array, 1); 391 var evt_data_div = create_info_div_element (parent_div_id + data_div_prefix + "_evt_" + feature_data.properties.codigo + idx_feature, evt_data_title_array, evt_data_value_array, 1); 392 var ing_data_div = create_info_div_element (parent_div_id + data_div_prefix + "_ing_" + feature_data.properties.codigo + idx_feature, ing_data_title_array, ing_data_value_array, 1); 393 394 var graph_data_title_array = new Array (); 395 graph_data_title_array.push ("Espectro Tres Ejes"); 396 graph_data_title_array.push ("Aceleraciones"); 397 graph_data_title_array.push ("Espectros Logaritmicos"); 398 graph_data_title_array.push ("Espectros Semilogaritmicos"); 399 graph_data_title_array.push ("Espectros Eje Tripartita"); 400 graph_data_title_array.push ("Valores Originales"); 401 402 var download_data_title_array = new Array (); 403 download_data_title_array.push ("Evento Ingeominas"); 404 download_data_title_array.push ("Valores Originales"); 405 download_data_title_array.push ("Evento Estacion"); 406 download_data_title_array.push ("Valores Espectro"); 407 408 var codigo_nombre = feature_data.properties.nombre.substring (feature_data.properties.nombre.length - 4, feature_data.properties.nombre.length - 1); 409 var fecha_str_date = feature_data.properties.fecha_inicial.substring (0, 4) + feature_data.properties.fecha_inicial.substring (5, 7) + feature_data.properties.fecha_inicial.substring (8,10); 410 var url_prefix_graph = "https://siata.gov.co/testJC1/files/"; 411 412 var graph_imgpath_array = new Array (); 413 graph_imgpath_array.push (url_prefix_graph + feature_data.properties.ideventoingeominas + "/" + "03_" + feature_data.properties.ideventoingeominas + "_" + "GRAPH_3EspColor_" + codigo_nombre + fecha_str_date + ".png"); 414 graph_imgpath_array.push (url_prefix_graph + feature_data.properties.ideventoingeominas + "/" + "03_" + feature_data.properties.ideventoingeominas + "_" + "GRAPH_Aceleraciones_" + codigo_nombre + fecha_str_date + ".png"); 415 graph_imgpath_array.push (url_prefix_graph + feature_data.properties.ideventoingeominas + "/" + "03_" + feature_data.properties.ideventoingeominas + "_" + "GRAPH_EspecLogLog_" + codigo_nombre + fecha_str_date + ".png"); 416 graph_imgpath_array.push (url_prefix_graph + feature_data.properties.ideventoingeominas + "/" + "03_" + feature_data.properties.ideventoingeominas + "_" + "GRAPH_EspecSemiLog_" + codigo_nombre + fecha_str_date + ".png"); 417 graph_imgpath_array.push (url_prefix_graph + feature_data.properties.ideventoingeominas + "/" + "03_" + feature_data.properties.ideventoingeominas + "_" + "GRAPH_Espectros_" + codigo_nombre + fecha_str_date + ".png"); 418 graph_imgpath_array.push (url_prefix_graph + feature_data.properties.ideventoingeominas + "/" + "03_" + feature_data.properties.ideventoingeominas + "_" + "GRAPH_Originales_" + codigo_nombre + fecha_str_date + ".png"); 419 420 var graph_download_array = new Array (); 421 if (feature_data.properties.fecha.substring (17, 19) == "00") 422 { 423 graph_download_array.push (url_prefix_graph + feature_data.properties.ideventoingeominas + "/" + "01_" + feature_data.properties.ideventoingeominas + "_" + "SGN_" + fecha_str_date + feature_data.properties.fecha.substring (11, 13) + feature_data.properties.fecha.substring (14, 16) + ".csv"); 424 } 425 else 426 { 427 graph_download_array.push (url_prefix_graph + feature_data.properties.ideventoingeominas + "/" + "01_" + feature_data.properties.ideventoingeominas + "_" + "SGN_" + fecha_str_date + feature_data.properties.fecha.substring (11, 13) + feature_data.properties.fecha.substring (14, 16) + feature_data.properties.fecha.substring (17, 19) + ".csv"); 428 } 429 430 graph_download_array.push (url_prefix_graph + feature_data.properties.ideventoingeominas + "/" + "02_" + feature_data.properties.ideventoingeominas + "_" + "DATA_" + codigo_nombre + fecha_str_date + ".csv"); 431 graph_download_array.push (url_prefix_graph + feature_data.properties.ideventoingeominas + "/" + "02_" + feature_data.properties.ideventoingeominas + "_" + "EST_" + codigo_nombre + fecha_str_date + ".csv"); 432 graph_download_array.push (url_prefix_graph + feature_data.properties.ideventoingeominas + "/" + "02_" + feature_data.properties.ideventoingeominas + "_" + "ESPECT_" + codigo_nombre + fecha_str_date + ".csv"); 433 434 var graph_data_div = create_graph_div_element (parent_div_id + data_div_prefix + "_graph_" + feature_data.properties.codigo + idx_feature, graph_data_title_array, graph_imgpath_array, 1); 435 var download_data_div = create_graph_div_element (parent_div_id + data_div_prefix + "_download_" + feature_data.properties.codigo + idx_feature, download_data_title_array, graph_download_array, 1); 436 437 evt_data_title_element.appendTo (evt_data_icon_element); 438 evt_data_icon_element.appendTo (td_data_obj); 439 evt_data_div.appendTo (td_data_obj); 440 $("<br/>").appendTo (td_data_obj); 441 ing_data_title_element.appendTo (ing_data_icon_element); 442 ing_data_icon_element.appendTo (td_data_obj); 443 ing_data_div.appendTo (td_data_obj); 444 $("<br/>").appendTo (td_data_obj); 445 graph_data_title_element.appendTo (graph_data_icon_element); 446 graph_data_icon_element.appendTo (td_data_obj); 447 graph_data_div.appendTo (td_data_obj); 448 $("<br/>").appendTo (td_data_obj); 449 download_data_title_element.appendTo (download_data_icon_element); 450 download_data_icon_element.appendTo (td_data_obj); 451 download_data_div.appendTo (td_data_obj); 452 $("<br/>").appendTo (td_data_obj); 453 454 $("<div/>", { 455 "class": style_class_separador_data 456 }).appendTo ("#" + parent_div_id); 457 458 }); 459 460 } 461 } 462 else 463 { 464 alert ("Error: No se puede leer la informacion de los datos de red acelerografica", "Error - Graficador de Datos", function() {$.alerts.dialogClass = null;}); 465 return; 466 } 467}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.