ctdo-trac/TracRendezVous/tracrendezvous/location/templates/location.html

170 lines
9.0 KiB
HTML
Raw Permalink Normal View History

2012-03-31 15:45:24 +00:00
<!DOCTYPE htm
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"
xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="layout.html" />
<head>
<script type="text/javascript">
// <![CDATA[
function setLocation()
{
for (i = 0; i < document.mylocation.location_sel.length; ++i)
if (document.mylocation.location_sel.options[i].selected == true)
{
document.mylocation.location_name.value = document.mylocation.location_sel.options[i].value;
document.mylocation.coordinates.value = document.getElementById("nr_coord_" + i.toString()).value;
}
}
function createIframe(lat, lon)
{
var iframe;
try
{
iframe = document.getElementById("mapframe");
iframe.parentNode.removeChild(iframe);
}
catch(e)
{
}
if (document.createElement && (iframe =
document.createElement("iframe")))
{
var blonstart= lon - 0.00928;
var blonend= lon + 0.011276;
var blatstart = lat - 0.0033;
var bladend = lat + 0.0109;
iframe.name = iframe.id = "mapframe";
iframe.width = "100%";
iframe.height = "600px";
iframe.src = "http://www.openstreetmap.org/export/embed.html?bbox=" + blonstart.toString() + "," + blatstart.toString() + "," + blonend.toString() + "," + bladend.toString() + "&marker=" + lat + "," + lon + "&zoom=16";
document.getElementById("location-results").appendChild(iframe);
}
}
var map;
var layer_mapnik;
var layer_tah;
var layer_markers;
function drawmap() {
// Popup und Popuptext mit evtl. Grafik
var popuptext="<font color=\"black\"><b>Thomas Heiles<br>Stra&szlig;e 123<br>54290 Trier</b><p><img src=\"test.jpg\" width=\"180\" height=\"113\"></p></font>";
OpenLayers.Lang.setCode('de');
// Position und Zoomstufe der Karte
var lon = 6.641389;
var lat = 49.756667;
var zoom = 7;
map = new OpenLayers.Map('map', {
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326"),
controls: [
new OpenLayers.Control.MouseDefaults(),
new OpenLayers.Control.LayerSwitcher(),
new OpenLayers.Control.PanZoomBar()],
maxExtent:
new OpenLayers.Bounds(-20037508.34,-20037508.34,
20037508.34, 20037508.34),
numZoomLevels: 18,
maxResolution: 156543,
units: 'meters'
});
layer_mapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik");
layer_markers = new OpenLayers.Layer.Markers("Address", { projection: new OpenLayers.Projection("EPSG:4326"),
visibility: true, displayInLayerSwitcher: false });
map.addLayers([layer_mapnik, layer_markers]);
jumpTo(lon, lat, zoom);
// Position des Markers
addMarker(layer_markers, 6.641389, 49.756667, popuptext);
}
jQuery(document).ready(function($) {
$("#nr_location_search").get(0).focus();
drawmap();
});
// ]]>
</script>
<title>Locations</title>
</head>
<body>
<div id="content">
<form name="mylocation" class="location" uri="" method="post" mime-type="text/plain" action="">
<input type="hidden" value="${rendezvous_id}"/>
<fieldset id="location">
<legend>Known Locations</legend>
<table class="listing">
<thead><tr><th>Name</th><th>Coordinates</th><th py:if="'LOCATION_MODIFY' in perm">Default</th><th py:if="'LOCATION_DELETE' in perm">Delete</th></tr></thead>
<tr py:for="location in locations">
<td><input name="name:${location.location_id}" type="text" size="30" maxlength="100" value="${location.name}"/></td>
<td><input name="location:${location.location_id}" type="text" size="32" maxlength="32" value="${location.coordinate_str()}"/></td>
<py:if test="'LOCATION_MODIFY' in perm">
<td><input type="radio" name="default" value="${location.location_id}" checked="${default_location == location.location_id and 'checked' or None}"/></td>
<td><input name="delete:${location.location_id}" type="checkbox" /></td>
</py:if>
</tr>
</table>
<p class="help">Change or delete existing locations.</p>
<div class="mybuttons">
<input type="reset" name="reset"/>
<input type="submit" name="savelocations" value="Save Changes"/>
</div>
</fieldset>
</form>
<form name="newlocation" class="location" uri="" method="post" mime-type="text/plain" action="">
<fieldset id="new-location">
<legend>New Location</legend>
<table class="rendezvous-wizard">
<tr><th><label for="nr_location_text">Name:</label></th><td><input id="nr_location_text" type="text" size="24" maxlength="25" name="location_name" value=""/></td></tr>
<tr><th><label for="nr_location_text">Coordinates:</label></th><td><input id="nr_coordinates_text" type="text" size="32" maxlength="32" name="coordinates" value=""/></td></tr>
</table>
<div class="mybuttons">
<input type="reset" name="reset"/>
<input type="submit" name="addlocation" value="Add Location"/>
</div>
<div class="hint">
<h3>Allowed coordinates formats:</h3>
<ul>
<li>DD format = 'lat,lon', e.g 53.235235,6.235235</li>
<li>DMS Format = 'N|Wdd°mm'ss" E|Wdddd°mm'ss", e.g N51°31'39.40000" E7°27'53.7200"</li>
</ul>
</div>
</fieldset>
</form>
<form name="search_location" class="location" uri="" method="post" mime-type="text/plain" action="">
<fieldset id="location-search">
<legend>Location Search</legend>
<div>
<label for="nr_location_search">Location Search:</label>
<input id="nr_location_search" type="text" size="40" maxlength="40" name="location_search"/>
<input type="submit" name="search" value="Search"/>
</div>
<p class="help">e.g "central station, cityname"</p>
<div py:if="location_results" id="location-results">
<h3>Search Results</h3>
<table>
<tr py:for="rx, result in enumerate(location_results)" >
<td>${result.attrib["info"]} <a class="location" onclick="createIframe(${result.attrib['lat']},${result.attrib['lon']});">${result.attrib["name"]}</a> ${result.attrib["is_in"]}
<py:with vars="nears = result.find('nearestplaces')">
<py:if test="nears">,&nbsp;
<py:with vars="places = nears.findall('named')">
<py:for each="place in places">${place.attrib["distance"]} km away of <b>${place.attrib["name"]}</b></py:for>
</py:with>
</py:if>
</py:with>
</td>
</tr>
</table>
</div>
</fieldset>
</form>
</div>
</body>
</html>