View file upload/src/addons/Andy/ShowMap/_data/templates.xml

File size: 7.18Kb
<?xml version="1.0" encoding="utf-8"?>
<templates>
  <template type="public" title="andy_showmap" version_id="11" version_string="1.1"><![CDATA[<xf:title>{{ phrase('showmap_show_map') }}</xf:title>

<xf:css src="andy_showmap.less" />

{$description}

<br /><br />

<div id="map" style="width:100%;"></div>

<br />

<div class="block">
	<div class="block-container">
		<div class="block-body">
			<xf:datalist data-xf-init="responsive-data-list">
				<xf:datarow rowtype="header">
					<xf:cell>{{ phrase('showmap_title') }}</xf:cell>
					<xf:cell>{{ phrase('showmap_forum') }}</xf:cell>
				</xf:datarow>
				<xf:foreach loop="$results" value="$result">
					<xf:datarow rowclass="dataList-row--noHover">
						<xf:cell href="{$result.link}">{$result.title}</xf:cell>
						<xf:cell><a href="{{ link('forums', $result) }}">{$result.forumTitle}</a></xf:cell>
					</xf:datarow>
				</xf:foreach>
			</xf:datalist>
		</div>
	</div>
</div>

<script>

var height = window.innerHeight;
height = height - {$xf.options.showMapHeight};

// set minimum height
if (height < 500) {
	height = 500;
}
	
document.getElementById("map").style.height = height + "px";
	
// declare variables
var locations = {$locationsJson|raw};
var map;
var markers = [];

// init map
function initMap() {

	// create map
	map = new google.maps.Map(document.getElementById('map'), {
		zoom: {$zoom},
		center: {
			lat: {$initialLat},
			lng: {$initialLng}
		},
		scrollwheel: false
	});

	var infoWin = new google.maps.InfoWindow();

	markers = locations.map(function(location, i) {
		var marker = new google.maps.Marker({
			position: location,
			title: location['title']
		});	

		google.maps.event.addListener(marker, 'click', function(evt) {
			infoWin.setContent(location.info);
			infoWin.open(map, marker);
		})
		return marker;
	});

	// get markerCluster
	var markerCluster = new MarkerClusterer(map, markers, {
		imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m',
		minimumClusterSize: {$xf.options.showMapMinimumClusterSize}
	});
}

</script>
    
<script src="https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/markerclusterer.js"></script>
	
<script src="https://maps.googleapis.com/maps/api/js?key={$xf.options.showMapKey}&callback=initMap"></script>]]></template>
  <template type="public" title="andy_showmap_admin" version_id="11" version_string="1.1"><![CDATA[<xf:title>{{ phrase('showmap_show_map_admin') }}</xf:title>

<a href="{{ link('showmap/admin-add') }}">{{ phrase('showmap_add') }}</a>
<br /><br />

<a href="{{ link('showmap/update') }}">{{ phrase('showmap_update') }}</a>
<br /><br />

<div class="block-container">
	<div class="block-body">
		<xf:datalist data-xf-init="responsive-data-list">
			<xf:datarow rowtype="header">
				<xf:cell>{{ phrase('showmap_category_id') }}</xf:cell>
				<xf:cell>{{ phrase('showmap_description') }}</xf:cell>
				<xf:cell>{{ phrase('showmap_coordinates') }}</xf:cell>
				<xf:cell>{{ phrase('showmap_zoom') }}</xf:cell>
				<xf:cell>{{ phrase('showmap_action') }}</xf:cell>
			</xf:datarow>
			<xf:foreach loop="$results" value="$result">
				<xf:datarow rowclass="dataList-row--noHover">
					<xf:cell>{$result.category_id}</xf:cell>
					<xf:cell>{$result.description}</xf:cell>
					<xf:cell>{$result.coordinates}</xf:cell>
					<xf:cell>{$result.zoom}</xf:cell>
					<xf:cell href="{{ link('showmap/admin-edit', '', {'show_map_id': $result.show_map_id}) }}">{{ phrase('showmap_edit') }}</xf:cell>
			</xf:datarow>
			</xf:foreach>
		</xf:datalist>
	</div>
</div>]]></template>
  <template type="public" title="andy_showmap_admin_add" version_id="11" version_string="1.1"><![CDATA[<xf:title>{{ phrase('showmap_add') }}</xf:title>

<div class="structItem-title">
	<a href="{{ link('showmap/admin') }}">{{ phrase('showmap_return_to_show_map_admin') }}</a>
</div>

<br />

<xf:form action="{{ link('showmap/admin-save') }}" class="block">
	<div class="block-container">
		<div class="block-body">
			<xf:textboxrow label="{{ phrase('showmap_category_id') }}" name="id" explain="{{ phrase('showmap_explain_category_id') }}" autofocus="autofocus" />
			<xf:textboxrow label="{{ phrase('showmap_description') }}" name="description" explain="{{ phrase('showmap_explain_description') }}" />
			<xf:textboxrow label="{{ phrase('showmap_coordinates') }}" name="coordinates" explain="{{ phrase('showmap_explain_coordinates') }}" />
			<xf:numberboxrow label="{{ phrase('showmap_zoom') }}" type="number" min="1" max="14" name="zoom" explain="{{ phrase('showmap_explain_zoom') }}" />
		</div>
	</div>
	<xf:submitrow submit="{{ phrase('showmap_submit') }}" />
</xf:form>]]></template>
  <template type="public" title="andy_showmap_admin_edit" version_id="11" version_string="1.1"><![CDATA[<xf:title>{{ phrase('showmap_edit') }}</xf:title>

<div class="structItem-title">
	<a href="{{ link('showmap/admin') }}">{{ phrase('showmap_return_to_show_map_admin') }}</a>
</div>

<br />

<a href="{{ link('showmap/admin-delete', '', {'show_map_id': $showMapId}) }}">{{ phrase('showmap_delete') }}</a>
<br /><br />

<xf:form action="{{ link('showmap/admin-edit-save') }}" class="block">
	<div class="block-container">
		<div class="block-body">
			<xf:hiddenval label="{{ phrase('showmap_show_map_id') }}" name="show_map_id" value="{$showMapId}" />
			<xf:textboxrow label="{{ phrase('showmap_category_id') }}" name="id" value="{$categoryId}" explain="{{ phrase('showmap_explain_category_id') }}" />
			<xf:textboxrow label="{{ phrase('showmap_description') }}" name="description" value="{$description}" explain="{{ phrase('showmap_explain_description') }}" />
			<xf:textboxrow label="{{ phrase('showmap_coordinates') }}" name="coordinates" value="{$coordinates}" explain="{{ phrase('showmap_explain_coordinates') }}" />
			<xf:textboxrow label="{{ phrase('showmap_zoom') }}" name="zoom" value="{$zoom}" explain="{{ phrase('showmap_explain_zoom') }}" />
		</div>
	</div>
	<xf:submitrow submit="{{ phrase('showmap_submit') }}" />
</xf:form>]]></template>
  <template type="public" title="andy_showmap_update" version_id="11" version_string="1.1"><![CDATA[<xf:title>{{ phrase('showmap_show_map_update') }}</xf:title>

<div class="structItem-title">
	<a href="{{ link('showmap/admin') }}">{{ phrase('showmap_return_to_show_map_admin') }}</a>
</div>

<br />

<xf:form action="{{ link('showmap/update-save') }}">
	<div class="block-container">
		<div class="block-body">
			<xf:numberboxrow label="{{ phrase('showmap_forum_id') }}" name="forum_id" min="0"/>
			<xf:selectrow name="id" value="" label="{{ phrase('showmap_category_id') }}">
				<xf:foreach loop="$results" value="$option">
					<xf:option value="{$option.category_id}">{$option.category_id}</xf:option>
				</xf:foreach>
			</xf:selectrow>
		</div>
	</div>
	<xf:submitrow submit="{{ phrase('showmap_submit') }}" />
</xf:form>]]></template>
  <template type="public" title="andy_showmap_update_confirm" version_id="11" version_string="1.1"><![CDATA[<xf:title>{{ phrase('showmap_show_map_update_confirm') }}</xf:title>

<div class="structItem-title">
	<a href="{{ link('showmap/admin') }}">{{ phrase('showmap_return_to_show_map_admin') }}</a>
</div>

<br />

{{ phrase('showmap_category_id:') }} {$categoryId}
<br />
{{ phrase('showmap_markers:') }} {$insertCount}]]></template>
</templates>