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

127 lines
7.3 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[ */
jQuery(document).ready(function($) {$("#nr_location_search").get(0).focus()});
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);
}
}
/* ]]> */
</script>
<title>Locations</title>
</head>
<body>
<div id="content">
<div id='rendezvous-main'>
<form name="mylocation" class='rendezvous-wizard' 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="'RENDEZVOUS_LOCATION_MODIFY' in perm">Default</th><th py:if="'RENDEZVOUS_LOCATION_DELETE' in perm">Delete</th></tr></thead>
<tr py:for="location in locations">
<td><input name="name:${location.location_id}" type="text" size="40" maxlength="40" 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="'RENDEZVOUS_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='rendezvous-wizard' 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>
<p 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>
</p>
</fieldset>
</form>
<form name="search_location" class='rendezvous-wizard' 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>
</div>
</body>
</html>