Adding download links to event table.
This commit is contained in:
		
							parent
							
								
									b7ad42c462
								
							
						
					
					
						commit
						fa0ef11337
					
				
				
				Notes:
				
					subgit
				
				2018-03-07 17:58:49 +01:00 
			
			r624 www/trunk
| @ -51,11 +51,6 @@ function getGeolocation(id, lat, lng) { | |||||||
| 
 | 
 | ||||||
| /* Load events using ajax */ | /* Load events using ajax */ | ||||||
| function ajaxLoadEvents(stime, etime) { | function ajaxLoadEvents(stime, etime) { | ||||||
| 	var mapBounds = map.getBounds(); |  | ||||||
| 	var N = mapBounds.getNorth(); |  | ||||||
| 	var E = mapBounds.getEast(); |  | ||||||
| 	var S = mapBounds.getSouth(); |  | ||||||
| 	var W = mapBounds.getWest(); |  | ||||||
| 	if ( !stime ) { | 	if ( !stime ) { | ||||||
| 		var stime = new Date(); | 		var stime = new Date(); | ||||||
| 		stime.setDate(stime.getDate()-config['map']['timespan']); | 		stime.setDate(stime.getDate()-config['map']['timespan']); | ||||||
| @ -64,15 +59,16 @@ function ajaxLoadEvents(stime, etime) { | |||||||
| 		var etime = new Date(); | 		var etime = new Date(); | ||||||
| 		etime.setDate(etime.getDate()+1); | 		etime.setDate(etime.getDate()+1); | ||||||
| 	}; | 	}; | ||||||
|  | 	var mapBounds = map.getBounds(); | ||||||
| 	var request_data = { | 	var request_data = { | ||||||
| 		starttime: sprintf("%d-%02d-%02d", stime.getFullYear(), stime.getMonth()+1, stime.getDate()), | 		starttime: sprintf("%d-%02d-%02d", stime.getFullYear(), stime.getMonth()+1, stime.getDate()), | ||||||
| 		endtime: sprintf("%d-%02d-%02d", etime.getFullYear(), etime.getMonth()+1, etime.getDate()), | 		endtime: sprintf("%d-%02d-%02d", etime.getFullYear(), etime.getMonth()+1, etime.getDate()), | ||||||
| 		minlat: S-config['map']['latlngDelta'], | 		minlat: mapBounds.getSouth()-config['map']['latlngDelta'], | ||||||
| 		maxlat: N+config['map']['latlngDelta'], | 		maxlat: mapBounds.getNorth()+config['map']['latlngDelta'], | ||||||
| 		minlon: W-config['map']['latlngDelta'], | 		minlon: mapBounds.getWest()-config['map']['latlngDelta'], | ||||||
| 		maxlon: E+config['map']['latlngDelta'], | 		maxlon: mapBounds.getEast()+config['map']['latlngDelta'], | ||||||
| 		minmag: config['event']['minMag']-config['event']['minMagDelta'], | 		minmag: config['event']['minMag']-config['event']['minMagDelta'], | ||||||
| 		includeArrivals: true, | 		includearrivals: true, | ||||||
| 	}; | 	}; | ||||||
| 	$.ajax({ | 	$.ajax({ | ||||||
| 		type: "GET", | 		type: "GET", | ||||||
| @ -151,6 +147,17 @@ function ajaxLoadEvents(stime, etime) { | |||||||
| 						}; | 						}; | ||||||
| 					}); | 					}); | ||||||
| 					row += '</td></tr>'; | 					row += '</td></tr>'; | ||||||
|  | 					// setting up download links (3nd line)
 | ||||||
|  | 					var xmlurl = sprintf('%s?formatted=true&includearrivals=true&eventid=%s', config['ajax']['eventURL'], id); | ||||||
|  | 					var oTime = new Date(otime); | ||||||
|  | 					var stime = new Date(oTime.getTime()-10*1000.-oTime.getMilliseconds()); | ||||||
|  | 					var etime = new Date(oTime.getTime()+50*1000.-oTime.getMilliseconds()); | ||||||
|  | 					console.log(oTime, stime, etime); | ||||||
|  | 					var mseedurl = sprintf('%s?net=GE,GR,RN&cha=EH?,HH?&start=%04d-%02d-%02dT%02d:%02d:%02d&end=%04d-%02d-%02dT%02d:%02d:%02d', config['ajax']['mseedURL'], Number(stime.getUTCFullYear()), Number(stime.getUTCMonth())+1, Number(stime.getUTCDate()), Number(stime.getUTCHours()), Number(stime.getUTCMinutes()), Number(stime.getUTCSeconds()), Number(etime.getUTCFullYear()), Number(etime.getUTCMonth())+1, Number(etime.getUTCDate()), Number(etime.getUTCHours()), Number(etime.getUTCMinutes()), Number(etime.getUTCSeconds())); | ||||||
|  | 					row +=  '<tr class="tablesorter-childRow">' | ||||||
|  | 						+ '<td colspan="4" eventid="'+id+'">' | ||||||
|  | 						+ sprintf('Download <a class="xml-link" target="_blank" href="%s">QuakeML</a> or <a class="mseed-link" target="_blank" href="%s">miniSEED</a>', xmlurl, mseedurl) | ||||||
|  | 						+ '</td></tr>'; | ||||||
| 					// add row to table
 | 					// add row to table
 | ||||||
| 					var added = $('#eventstable tbody').append(row); | 					var added = $('#eventstable tbody').append(row); | ||||||
| 					added.find('.tablesorter-childRow td').hide(); | 					added.find('.tablesorter-childRow td').hide(); | ||||||
| @ -200,7 +207,6 @@ function toggleFilteredMarkers() { | |||||||
| 			eventTable[$(this).attr("eventid")].setStyle({opacity: 1, strokeOpacity: 1, fillOpacity: config['event']['markerOpacity']}); | 			eventTable[$(this).attr("eventid")].setStyle({opacity: 1, strokeOpacity: 1, fillOpacity: config['event']['markerOpacity']}); | ||||||
| 		}; | 		}; | ||||||
| 	}); | 	}); | ||||||
| 
 |  | ||||||
| 	// hide filtered events in map
 | 	// hide filtered events in map
 | ||||||
| 	$("#eventstable > tbody > tr.filtered > td > a.map-link").each( function() { | 	$("#eventstable > tbody > tr.filtered > td > a.map-link").each( function() { | ||||||
| 		if ( $(this).attr("eventid") ) { | 		if ( $(this).attr("eventid") ) { | ||||||
| @ -292,25 +298,20 @@ $(document).ready(function() { | |||||||
| 				showProcessing: true, | 				showProcessing: true, | ||||||
| 			} | 			} | ||||||
| 		}); | 		}); | ||||||
| 
 |  | ||||||
| 	// hide child rows
 | 	// hide child rows
 | ||||||
| 	$('#eventstable > tbody > tr.tablesorter-childRow td').hide(); | 	$('#eventstable > tbody > tr.tablesorter-childRow td').hide(); | ||||||
| 
 |  | ||||||
| 	// update map after filtering
 | 	// update map after filtering
 | ||||||
| 	$('#eventstable').bind('filterEnd', function(){ | 	$('#eventstable').bind('filterEnd', function(){ | ||||||
| 		toggleFilteredMarkers(); | 		toggleFilteredMarkers(); | ||||||
| 	}); | 	}); | ||||||
| 	 |  | ||||||
| 	// highlight first event
 | 	// highlight first event
 | ||||||
| 	$('#eventstable').bind('sortEnd', function(){ | 	$('#eventstable').bind('sortEnd', function(){ | ||||||
| 		highlightFirstEvent(); | 		highlightFirstEvent(); | ||||||
| 	}); | 	}); | ||||||
| 	 |  | ||||||
| 	// show / hide event info
 | 	// show / hide event info
 | ||||||
| 	$('#eventstable').delegate('.toggle', 'click' , function(){ | 	$('#eventstable').delegate('.toggle', 'click' , function(){ | ||||||
| 		// toggle visibility of selected row
 | 		// toggle visibility of selected row
 | ||||||
| 		$(this).closest('tr').nextUntil('tr.tablesorter-hasChildRow').find('td').toggle('slow'); | 		$(this).closest('tr').nextUntil('tr.tablesorter-hasChildRow').find('td').toggle('slow'); | ||||||
| 
 |  | ||||||
| 		// mark currently selected row and remove class selected from all other rows
 | 		// mark currently selected row and remove class selected from all other rows
 | ||||||
| 		// hide other rows
 | 		// hide other rows
 | ||||||
| 		$(this).closest('tr').nextUntil('tr.tablesorter-hasChildRow').find('td').addClass('selected-now'); | 		$(this).closest('tr').nextUntil('tr.tablesorter-hasChildRow').find('td').addClass('selected-now'); | ||||||
| @ -333,5 +334,4 @@ $(document).ready(function() { | |||||||
| 		}); | 		}); | ||||||
| 		return false; | 		return false; | ||||||
| 	}); | 	}); | ||||||
| 
 |  | ||||||
| }); | }); | ||||||
|  | |||||||
| @ -80,6 +80,7 @@ var config = { | |||||||
| 	ajax: { | 	ajax: { | ||||||
| 		timeout: 150000, // 15 seconds
 | 		timeout: 150000, // 15 seconds
 | ||||||
| 		eventURL: 'https://ariadne.geophysik.ruhr-uni-bochum.de/fdsnws/event/1/query', | 		eventURL: 'https://ariadne.geophysik.ruhr-uni-bochum.de/fdsnws/event/1/query', | ||||||
|  | 		mseedURL: 'https://ariadne.geophysik.ruhr-uni-bochum.de/fdsnws/dataselect/1/query', | ||||||
| 		stationURL: 'https://ariadne.geophysik.ruhr-uni-bochum.de/fdsnws/station/1/query', | 		stationURL: 'https://ariadne.geophysik.ruhr-uni-bochum.de/fdsnws/station/1/query', | ||||||
| 		nominatimURL: '//open.mapquestapi.com/nominatim/v1/reverse.php', | 		nominatimURL: '//open.mapquestapi.com/nominatim/v1/reverse.php', | ||||||
| 		// nominatimURL: '//nominatim.openstreetmap.org/reverse',
 | 		// nominatimURL: '//nominatim.openstreetmap.org/reverse',
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user