|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
<head>
|
|
|
|
<title>YaCy '#[clientname]#': Location Search</title>
|
|
|
|
#%env/templates/metas.template%#
|
|
|
|
<script type="text/javascript" src="http://openlayers.org/api/OpenLayers.js"></script>
|
|
|
|
<script type="text/javascript" src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script>
|
|
|
|
<script type="text/javascript">
|
|
|
|
function adaptHeight() {
|
|
|
|
document.getElementById('map').style.height = (document.documentElement.clientHeight - 130) + "px";
|
|
|
|
}
|
|
|
|
window.onresize = adaptHeight;
|
|
|
|
</script>
|
|
|
|
<script type="text/javascript">
|
|
|
|
var map;
|
|
|
|
var searchLayer_md = null;
|
|
|
|
var searchLayer_co = null;
|
|
|
|
var path_mdsearch = 'yacysearch_location.rss?dom=alltext&query=';
|
|
|
|
var path_losearch = 'yacysearch_location.rss?dom=location&query=';
|
|
|
|
var marker_md = new OpenLayers.Icon("/env/grafics/marker_red.png", new OpenLayers.Size(11,16));
|
|
|
|
var marker_co = new OpenLayers.Icon("/env/grafics/star_yellow.png", new OpenLayers.Size(25,25));
|
|
|
|
// possible values for dom: location,metatag,alltext,title,publisher,creator,subject
|
|
|
|
|
|
|
|
function init() {
|
|
|
|
map = new OpenLayers.Map('map', {
|
|
|
|
maxResolution:'auto',
|
|
|
|
controls:[
|
|
|
|
new OpenLayers.Control.Navigation(),
|
|
|
|
new OpenLayers.Control.PanZoomBar(),
|
|
|
|
new OpenLayers.Control.ZoomBox(),
|
|
|
|
new OpenLayers.Control.LayerSwitcher(),
|
|
|
|
new OpenLayers.Control.Attribution()]
|
|
|
|
});
|
|
|
|
|
|
|
|
//layerMaplint = new OpenLayers.Layer.OSM.Maplint("Maplint");
|
|
|
|
layerWMS = new OpenLayers.Layer.WMS( "OpenLayers WMS", "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
|
|
|
|
layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik");
|
|
|
|
layerCycleMap = new OpenLayers.Layer.OSM.CycleMap("CycleMap");
|
|
|
|
map.addLayer(layerMapnik);
|
|
|
|
map.addLayer(layerCycleMap);
|
|
|
|
//map.addLayer(layerMaplint);
|
|
|
|
map.addLayer(layerWMS);
|
|
|
|
|
|
|
|
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
|
|
|
map.setCenter(new OpenLayers.LonLat(9,48) // Center of the map
|
|
|
|
.transform(
|
|
|
|
new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
|
|
|
|
new OpenLayers.Projection("EPSG:900913") // to Spherical Mercator Projection
|
|
|
|
), 5 // Zoom level
|
|
|
|
);
|
|
|
|
|
|
|
|
#(initsearch)#::
|
|
|
|
var query = '#[query]#'.replace(' ', '+');
|
|
|
|
searchLayer_co = new OpenLayers.Layer.GeoRSS('GeoRSS', path_losearch + query, {'icon':marker_co});
|
|
|
|
map.addLayer(searchLayer_co);
|
|
|
|
searchLayer_md = new OpenLayers.Layer.GeoRSS('GeoRSS', path_mdsearch + query, {'icon':marker_md});
|
|
|
|
map.addLayer(searchLayer_md);
|
|
|
|
#(/initsearch)#
|
|
|
|
|
|
|
|
window.setInterval("refresh()", 1000);
|
|
|
|
}
|
|
|
|
|
|
|
|
function search() {
|
|
|
|
var query = document.getElementById('query').value.replace(' ', '+');
|
|
|
|
if (searchLayer_md != null) searchLayer_md.destroy();
|
|
|
|
if (searchLayer_co != null) searchLayer_co.destroy();
|
|
|
|
var center = map.getCenter().transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326"));
|
|
|
|
var extend = map.getExtent().transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326"));
|
|
|
|
var radius = Math.sqrt(extend.getWidth() * extend.getWidth() + extend.getHeight() * extend.getHeight()) / 2;
|
|
|
|
searchLayer_co = new OpenLayers.Layer.GeoRSS('GeoRSS', path_losearch + query + '&lon=' + center.lon + '&lat=' + center.lat + '&r=' + radius + '&z=' + map.getZoom(), {'icon':marker_co});
|
|
|
|
map.addLayer(searchLayer_co);
|
|
|
|
searchLayer_md = new OpenLayers.Layer.GeoRSS('GeoRSS', path_mdsearch + query + '&lon=' + center.lon + '&lat=' + center.lat + '&r=' + radius + '&z=' + map.getZoom(), {'icon':marker_md});
|
|
|
|
map.addLayer(searchLayer_md);
|
|
|
|
//map.zoomToExtent(searchLayer_co.getExtent());
|
|
|
|
//map.panTo(searchLayer_co.getExtent().getCenterLonLat());
|
|
|
|
//map.setCenter(searchLayer_co.getExtent().getLonLatFromViewPortPx, 5);
|
|
|
|
//map.setCenter(searchLayer_co.getExtent().getCenterLonLat(), map.getZoomForExtent(searchLayer_co.getExtent(), true));
|
|
|
|
//document.getElementById('apilink').setAttribute('href', 'yacysearch_location.rss?query=' + query);
|
|
|
|
}
|
|
|
|
|
|
|
|
function refresh() {
|
|
|
|
if (searchLayer_co == null || searchLayer_md == null) {
|
|
|
|
document.getElementById('resultline').innerHTML = "";
|
|
|
|
} else {
|
|
|
|
var cocount = searchLayer_co.markers.length;
|
|
|
|
var mdcount = searchLayer_md.markers.length;
|
|
|
|
document.getElementById('resultline').innerHTML = mdcount + " POIs found";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</head>
|
|
|
|
<body id="yacysearch_location" onload="init();">
|
|
|
|
#(topmenu)#
|
|
|
|
#%env/templates/embeddedheader.template%#
|
|
|
|
::
|
|
|
|
<div id="api">
|
|
|
|
<a href="yacysearch_location.rss" id="apilink"><img src="/env/grafics/api.png" width="60" height="40" alt="API"/></a>
|
|
|
|
<script type="text/javascript">
|
|
|
|
//<![CDATA[
|
|
|
|
document.getElementById('apilink').setAttribute('href', 'yacysearch_location.rss?dom=metatag|alltext&' + window.location.search.substring(1));
|
|
|
|
//]]>
|
|
|
|
</script>
|
|
|
|
<span>The information that is presented on this page can also be retrieved as XML
|
|
|
|
Click the API icon to see the XML.
|
|
|
|
To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de/wiki/index.php/Dev:API">API wiki page</a>.</span>
|
|
|
|
</div>
|
|
|
|
#%env/templates/simpleheader.template%#
|
|
|
|
#(/topmenu)#
|
|
|
|
|
|
|
|
<form class="search small" onsubmit="return false;" class="search small" accept-charset="UTF-8">
|
|
|
|
<h2>#[promoteSearchPageGreeting]#</h2>
|
|
|
|
<div class="yacylogo"><a href="#[promoteSearchPageGreeting.homepage]#" class="yacylogo"><img src="#[promoteSearchPageGreeting.smallImage]#" alt="yacysearch" /></a></div>
|
|
|
|
<fieldset class="yacys">
|
|
|
|
<input type="text" value="#(initsearch)#::#[query]##(/initsearch)#" id="query" size="42" onFocus="this.select()" />
|
|
|
|
<input type="submit" onclick="search(); return false;" value="search" onsubmit="search(); return false;" />
|
|
|
|
</fieldset>
|
|
|
|
<div id="resultline"></div>
|
|
|
|
</form><br/>
|
|
|
|
<div id="map" style="clear:both; width:100%; height:720px"></div>
|
|
|
|
<script type="text/javascript">
|
|
|
|
adaptHeight();
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|