<metal:block use-macro="here/standard_template_macro">
<metal:block fill-slot="body">

<h1 i18n:translate="">List locations</h1>

<tal:block 
	define="lat_min options/lat_min;
		lat_max options/lat_max;
		lon_min options/lon_min;
		lon_max options/lon_max;
		geo_types options/geo_types;
		geo_types_str python:','.join(geo_types);
		administrative_level options/administrative_level|string:;
		administrative_level_str python:','.join(administrative_level);
		landscape_type options/landscape_type|string:;
		landscape_type_str python:','.join(landscape_type);
		geo_query options/geo_query;
		country options/country;
		sort_on options/sort_on;
		sort_order options/sort_order;
		step options/step;
		start options/start;
		end options/end;
		sortable options/sortable;
		results options/results;
		first_letter options/first_letter;
		next_start end;
		next_end python:test(end+step<results, end+step, results);
		prev_start python:start-step;
		prev_end start;
		url_params string:?lat_min=${lat_min}&amp;lat_max=${lat_max}&amp;lon_min=${lon_min}&amp;lon_max=${lon_max}&amp;geo_types=${geo_types_str}&amp;administrative_level=${administrative_level_str}&amp;landscape_type=${landscape_type_str}&amp;geo_query=${geo_query}&amp;country=${country}&amp;sortable=${sortable};
		records options/records;
		ratable_records options/ratable_records">

<div class="floated-buttons">
	<span class="buttons">
		<a tal:attributes="href here/absolute_url" i18n:translate="">Back to map</a>
	</span>
</div>

<p i18n:translate="">This page offers the tabular format of the map locations, as resulted from the search filters applied on the map.</p>

<noscript>
	<form action="downloadLocationsKml" method="post">
		<p i18n:translate="">
			Additionally you can display the points in
			<tal:block i18n:name="Google-Earth-viewer">
				<a href="http://earth.google.com/downloads.html"
					i18n:translate="">Google Earth viewer</a>
			</tal:block>
			(version 4.0 or higher)
			<input type="submit" value="View in Google Earth" i18n:attributes="value" i18n:name="submit-button" class="map-button" />
		</p>
		<input type="hidden" name="geo_types:list" tal:attributes="value geo_type" tal:repeat="geo_type geo_types"/>
		<input type="hidden" name="administrative_level:list" tal:attributes="value adm_level" tal:repeat="adm_level administrative_level"/>
		<input type="hidden" name="landscape_type:list" tal:attributes="value land_type" tal:repeat="land_type landscape_type"/>
		<input type="hidden" name="geo_query" tal:attributes="value geo_query"/>
	</form>
</noscript>

	<strong tal:content="python:results"/> <span i18n:translate="">locations found.</span>
	<a tal:attributes="href string:${request/ACTUAL_URL}${url_params}&amp;start=${prev_start}&amp;end=${prev_end}&amp;step=${step}&amp;sort_on=${sort_on}&amp;sort_order=${sort_order}&amp;first_letter=${first_letter}"
		tal:condition="python:prev_start >= 0">
		<< <span i18n:translate="">Prev</span> <span tal:replace="step"/></a>
	<tal:block condition="python:results > step">
		<span i18n:translate="">Displaying</span> <strong><span tal:replace="start"/> - <span tal:replace="end"/></strong>
	</tal:block>
	<a tal:attributes="href string:${request/ACTUAL_URL}${url_params}&amp;start=${next_start}&amp;end=${next_end}&amp;step=${step}&amp;sort_on=${sort_on}&amp;sort_order=${sort_order}&amp;first_letter=${first_letter}"
		tal:condition="python:results > next_start">
		<span i18n:translate="">Next</span> <span tal:replace="python:test(step<next_end-next_start, step, next_end-next_start)"/> >>
	</a>
	<tal:block tal:condition="here/can_filter_by_first_letter">
		<br />
		<a tal:attributes="href string:${request/ACTUAL_URL}${url_params}" i18n:translate="">List all</a>
		<tal:block tal:repeat="letter python:'ABCDEFGHIJKLMNOPQRSTUVWXYZ'">
			<a tal:attributes="href string:${request/ACTUAL_URL}${url_params}&amp;first_letter=${letter}" i18n:translate="" tal:content="letter"/>
		</tal:block>
	</tal:block>

<table metal:define-macro="main" width="100%" class="datatable">
	<thead>
		<tr>
			<th scope="col" class="scope-col" i18n:translate="Type (translate as a noun)">Type</th>
			<tal:block tal:condition="python:sort_on=='title'">
				<tal:block tal:condition="python:sort_order==''">
					<th scope="col" class="scope-col">
						<a id="title" tal:attributes="href string:${request/ACTUAL_URL}${url_params}&amp;first_letter=${first_letter}&amp;sort_on=title&amp;sort_order=reverse#title">
							<span i18n:translate="">Title</span>
						</a>
					</th>
				</tal:block>
				<tal:block tal:condition="python:sort_order=='reverse'">
					<th scope="col" class="scope-col">
						<a id="title" tal:attributes="href string:${request/ACTUAL_URL}${url_params}&amp;first_letter=${first_letter}&amp;sort_on=title#title">
							<span i18n:translate="">Title</span>
						</a>
					</th>
				</tal:block>
			</tal:block>
			<tal:block tal:condition="python:sort_on!='title'">
				<th scope="col" class="scope-col">
					<a tal:omit-tag="not: sortable" id="title" tal:attributes="href string:${request/ACTUAL_URL}${url_params}&amp;first_letter=${first_letter}&amp;sort_on=title#title" i18n:translate="">Title</a>
				</th>
			</tal:block>
			<tal:block tal:condition="python:sort_on=='geo_address'">
				<tal:block tal:condition="python:sort_order==''">
					<th scope="col" class="scope-col">
						<a id="geo_address" tal:attributes="href string:${request/ACTUAL_URL}${url_params}&amp;first_letter=${first_letter}&amp;sort_on=geo_address&amp;sort_order=reverse#geo_address">
							<span i18n:translate="">Address</span>
						</a>
					</th>
				</tal:block>
				<tal:block tal:condition="python:sort_order=='reverse'">
					<th scope="col" class="scope-col">
						<a id="geo_address" tal:attributes="href string:${request/ACTUAL_URL}${url_params}&amp;first_letter=${first_letter}&amp;sort_on=geo_address#geo_address">
							<span i18n:translate="">Address</span>
						</a>
					</th>
				</tal:block>
			</tal:block>
			<tal:block tal:condition="python:sort_on!='geo_address'">
				<th scope="col" class="scope-col">
					<a tal:omit-tag="not: sortable" id="geo_address" tal:attributes="href string:${request/ACTUAL_URL}${url_params}&amp;first_letter=${first_letter}&amp;sort_on=geo_address#geo_address" i18n:translate="">Address</a>
				</th>
			</tal:block>
			<tal:block tal:condition="python:sort_on=='geo_latitude'">
				<tal:block tal:condition="python:sort_order==''">
					<th scope="col" class="scope-col">
						<a id="geo_latitude" tal:attributes="href string:${request/ACTUAL_URL}${url_params}&amp;first_letter=${first_letter}&amp;sort_on=geo_latitude&amp;sort_order=reverse#geo_latitude">
							<span i18n:translate="">Latitude</span>
						</a>
					</th>
				</tal:block>
				<tal:block tal:condition="python:sort_order=='reverse'">
					<th scope="col" class="scope-col">
						<a id="geo_latitude" tal:attributes="href string:${request/ACTUAL_URL}${url_params}&amp;first_letter=${first_letter}&amp;sort_on=geo_latitude#geo_latitude">
							<span i18n:translate="">Latitude</span>
						</a>
					</th>
				</tal:block>
			</tal:block>
			<tal:block tal:condition="python:sort_on!='geo_latitude'">
				<th scope="col" class="scope-col">
					<a tal:omit-tag="not: sortable" id="geo_latitude" tal:attributes="href string:${request/ACTUAL_URL}${url_params}&amp;first_letter=${first_letter}&amp;sort_on=geo_latitude#geo_latitude" i18n:translate="">Latitude</a>
				</th>
			</tal:block>
			<tal:block tal:condition="python:sort_on=='geo_longitude'">
				<tal:block tal:condition="python:sort_order==''">
					<th scope="col" class="scope-col">
						<a id="geo_longitude" tal:attributes="href string:${request/ACTUAL_URL}${url_params}&amp;first_letter=${first_letter}&amp;sort_on=geo_longitude&amp;sort_order=reverse#geo_longitude">
							<span i18n:translate="">Longitude</span>
						</a>
					</th>
				</tal:block>
				<tal:block tal:condition="python:sort_order=='reverse'">
					<th scope="col" class="scope-col">
						<a id="geo_longitude" tal:attributes="href string:${request/ACTUAL_URL}${url_params}&amp;first_letter=${first_letter}&amp;sort_on=geo_longitude#geo_longitude">
							<span i18n:translate="">Longitude</span>
						</a>
					</th>
				</tal:block>
			</tal:block>
			<tal:block tal:condition="python:sort_on!='geo_longitude'">
				<th scope="col" class="scope-col">
					<a tal:omit-tag="not: sortable" id="geo_longitude" tal:attributes="href string:${request/ACTUAL_URL}${url_params}&amp;first_letter=${first_letter}&amp;sort_on=geo_longitude#geo_longitude" i18n:translate="">Longitude</a>
				</th>
			</tal:block>
			<th tal:condition="ratable_records" scope="col" class="scope-col" i18n:translate="">Rating</th>
		</tr>
	</thead>
	<tbody>
		<tr tal:condition="not:records">
			<td colspan="7" i18n:translate="">No locations found</td>
		</tr>
		<tr tal:repeat="record records" tal:condition="records">
			<td>
				<img tal:attributes="src string:getSymbolPicture?id=${record/geo_type};
				                     alt python:here.getSymbolTitle(record.geo_type);
				                     title python:here.getSymbolTitle(record.geo_type);" />
			</td>
			<td><a tal:attributes="href string:${record/absolute_url}" tal:content="record/title_or_id" /></td>
			<td tal:content="record/geo_location/address" />
			<td tal:content="record/geo_location/lat" />
			<td tal:content="record/geo_location/lon" />
			<td tal:condition="ratable_records" class="type" style="width: 15%;">
				<tal:block define="user_rating record/user_rating_stars_numbers|nothing"
					condition="record/is_ratable" replace="structure user_rating"/>
			</td>
		</tr>
	</tbody>
</table>

</tal:block>


</metal:block>
</metal:block>
