root / templates / front / index.html @ 80d3b062
History | View | Annotate | Download (10.8 kB)
1 | af9d484b | Leonidas Poulopoulos | {% extends "base.html" %} |
---|---|---|---|
2 | 4e4485b0 | Leonidas Poulopoulos | {% load i18n %} |
3 | af9d484b | Leonidas Poulopoulos | {% block title %}eduroam@Greece{% endblock %} |
4 | 13e8e1ec | Leonidas Poulopoulos | {% block homepage %}class="active"{% endblock %} |
5 | 13e8e1ec | Leonidas Poulopoulos | {% block hometop %}class="active"{% endblock %} |
6 | af9d484b | Leonidas Poulopoulos | {% block extrahead %} |
7 | af9d484b | Leonidas Poulopoulos | <style type="text/css"> |
8 | af9d484b | Leonidas Poulopoulos | html,body { |
9 | af9d484b | Leonidas Poulopoulos | height: 100%; |
10 | af9d484b | Leonidas Poulopoulos | overflow: hidden; |
11 | af9d484b | Leonidas Poulopoulos | } |
12 | af9d484b | Leonidas Poulopoulos | .headtitle {font-family: "Franklin Gothic Demi", "Franklin Gothic", "ITC Franklin Gothic", Arial, sans-serif; letter-spacing: -1px; } |
13 | af9d484b | Leonidas Poulopoulos | </style>
|
14 | af9d484b | Leonidas Poulopoulos | <script type="text/javascript" src="/static/js/jquery.min.js"></script> |
15 | af9d484b | Leonidas Poulopoulos | <script type="text/javascript" src="/static/js/markerclusterer.js"></script> |
16 | 62d0c01e | Leonidas Poulopoulos | <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script> |
17 | af9d484b | Leonidas Poulopoulos | <script type="text/javascript"> |
18 | af9d484b | Leonidas Poulopoulos | var lat = 36.97;
|
19 | af9d484b | Leonidas Poulopoulos | var lng = 23.71;
|
20 | af9d484b | Leonidas Poulopoulos | var zoomLevel = 6;
|
21 | af9d484b | Leonidas Poulopoulos | var latlng = new google.maps.LatLng(lat,lng);
|
22 | af9d484b | Leonidas Poulopoulos | var map = '';
|
23 | af9d484b | Leonidas Poulopoulos | var bounds = '';
|
24 | af9d484b | Leonidas Poulopoulos | var image = '';
|
25 | af9d484b | Leonidas Poulopoulos | var infoWindow;
|
26 | 13e8e1ec | Leonidas Poulopoulos | addr = {};
|
27 | af9d484b | Leonidas Poulopoulos |
|
28 | af9d484b | Leonidas Poulopoulos | |
29 | bf3e4525 | Leonidas Poulopoulos | var styles = [ {
|
30 | bf3e4525 | Leonidas Poulopoulos | url : '/static/img/edugroup.png',
|
31 | bf3e4525 | Leonidas Poulopoulos | height : 54,
|
32 | bf3e4525 | Leonidas Poulopoulos | width : 63,
|
33 | bf3e4525 | Leonidas Poulopoulos | textColor : '#ffffff',
|
34 | bf3e4525 | Leonidas Poulopoulos | textSize : 11
|
35 | bf3e4525 | Leonidas Poulopoulos | }, {
|
36 | bf3e4525 | Leonidas Poulopoulos | url : '/static/img/edugroup.png',
|
37 | bf3e4525 | Leonidas Poulopoulos | height : 54,
|
38 | bf3e4525 | Leonidas Poulopoulos | width : 63,
|
39 | bf3e4525 | Leonidas Poulopoulos | textColor : '#ffffff',
|
40 | bf3e4525 | Leonidas Poulopoulos | textSize : 11
|
41 | bf3e4525 | Leonidas Poulopoulos | }, {
|
42 | bf3e4525 | Leonidas Poulopoulos | url : '/static/img/edugroup.png',
|
43 | bf3e4525 | Leonidas Poulopoulos | height : 54,
|
44 | bf3e4525 | Leonidas Poulopoulos | width : 63,
|
45 | bf3e4525 | Leonidas Poulopoulos | textColor : '#ffffff',
|
46 | bf3e4525 | Leonidas Poulopoulos | textSize : 11
|
47 | bf3e4525 | Leonidas Poulopoulos | } ];
|
48 | af9d484b | Leonidas Poulopoulos | |
49 | bf3e4525 | Leonidas Poulopoulos | function initialize() {
|
50 | bf3e4525 | Leonidas Poulopoulos | image = new google.maps.MarkerImage('/static/img/edupin.png',
|
51 | bf3e4525 | Leonidas Poulopoulos | // This marker is 29 pixels wide by 40 pixels tall.
|
52 | bf3e4525 | Leonidas Poulopoulos | new google.maps.Size(29, 40),
|
53 | bf3e4525 | Leonidas Poulopoulos | // The origin for this image is 0,0.
|
54 | bf3e4525 | Leonidas Poulopoulos | new google.maps.Point(0, 0),
|
55 | bf3e4525 | Leonidas Poulopoulos | // The anchor for this image is the base of the flagpole at 18,42.
|
56 | bf3e4525 | Leonidas Poulopoulos | new google.maps.Point(14, 40));
|
57 | bf3e4525 | Leonidas Poulopoulos | |
58 | bf3e4525 | Leonidas Poulopoulos | var styleArray = [ {
|
59 | af9d484b | Leonidas Poulopoulos | featureType : "all",
|
60 | af9d484b | Leonidas Poulopoulos | stylers : [ {
|
61 | af9d484b | Leonidas Poulopoulos | saturation : -60
|
62 | af9d484b | Leonidas Poulopoulos | }, {
|
63 | af9d484b | Leonidas Poulopoulos | gamma : 1.00
|
64 | af9d484b | Leonidas Poulopoulos | } ]
|
65 | af9d484b | Leonidas Poulopoulos | }, {
|
66 | af9d484b | Leonidas Poulopoulos | featureType : "poi.business",
|
67 | af9d484b | Leonidas Poulopoulos | elementType : "labels",
|
68 | af9d484b | Leonidas Poulopoulos | stylers : [ {
|
69 | af9d484b | Leonidas Poulopoulos | visibility : "off"
|
70 | af9d484b | Leonidas Poulopoulos | } ]
|
71 | af9d484b | Leonidas Poulopoulos | }, {
|
72 | af9d484b | Leonidas Poulopoulos | "featureType" : "transit.line",
|
73 | af9d484b | Leonidas Poulopoulos | "elementType" : "geometry",
|
74 | af9d484b | Leonidas Poulopoulos | "stylers" : [ {
|
75 | af9d484b | Leonidas Poulopoulos | "visibility" : "off"
|
76 | af9d484b | Leonidas Poulopoulos | } ]
|
77 | af9d484b | Leonidas Poulopoulos | }, {
|
78 | af9d484b | Leonidas Poulopoulos | "featureType" : "poi",
|
79 | af9d484b | Leonidas Poulopoulos | "elementType" : "all",
|
80 | af9d484b | Leonidas Poulopoulos | "stylers" : [ {
|
81 | af9d484b | Leonidas Poulopoulos | "visibility" : "off"
|
82 | af9d484b | Leonidas Poulopoulos | } ]
|
83 | af9d484b | Leonidas Poulopoulos | }, {
|
84 | af9d484b | Leonidas Poulopoulos | 'featureType' : "administrative.country",
|
85 | af9d484b | Leonidas Poulopoulos | 'elementType' : "labels",
|
86 | af9d484b | Leonidas Poulopoulos | 'stylers' : [ {
|
87 | af9d484b | Leonidas Poulopoulos | 'visibility' : "off"
|
88 | af9d484b | Leonidas Poulopoulos | } ]
|
89 | af9d484b | Leonidas Poulopoulos | }
|
90 | af9d484b | Leonidas Poulopoulos | |
91 | af9d484b | Leonidas Poulopoulos | ];
|
92 | af9d484b | Leonidas Poulopoulos | |
93 | 13e8e1ec | Leonidas Poulopoulos | geocoder = new google.maps.Geocoder();
|
94 | bf3e4525 | Leonidas Poulopoulos | var mapOptions = {
|
95 | af9d484b | Leonidas Poulopoulos | center : latlng,
|
96 | af9d484b | Leonidas Poulopoulos | zoom : zoomLevel,
|
97 | af9d484b | Leonidas Poulopoulos | mapTypeId : google.maps.MapTypeId.ROADMAP,
|
98 | af9d484b | Leonidas Poulopoulos | styles : styleArray,
|
99 | af9d484b | Leonidas Poulopoulos | mapTypeId : google.maps.MapTypeId.ROADMAP,
|
100 | af9d484b | Leonidas Poulopoulos | mapTypeControlOptions : {
|
101 | af9d484b | Leonidas Poulopoulos | style : google.maps.MapTypeControlStyle.DEFAULT
|
102 | af9d484b | Leonidas Poulopoulos | },
|
103 | af9d484b | Leonidas Poulopoulos | navigationControl : true,
|
104 | af9d484b | Leonidas Poulopoulos | mapTypeControl : false,
|
105 | af9d484b | Leonidas Poulopoulos | };
|
106 | af9d484b | Leonidas Poulopoulos | map = new google.maps.Map(document.getElementById("map_canvas"),
|
107 | af9d484b | Leonidas Poulopoulos | mapOptions);
|
108 | 13e8e1ec | Leonidas Poulopoulos |
|
109 | 13e8e1ec | Leonidas Poulopoulos |
|
110 | 13e8e1ec | Leonidas Poulopoulos | var homeControlDiv = document.createElement('div');
|
111 | 13e8e1ec | Leonidas Poulopoulos | homeControlDiv.className='roundButtonHolder';
|
112 | 13e8e1ec | Leonidas Poulopoulos | homeControlDiv.id="locationButton";
|
113 | 13e8e1ec | Leonidas Poulopoulos | var homeControl = new HomeControl(homeControlDiv, map);
|
114 | 13e8e1ec | Leonidas Poulopoulos | |
115 | 13e8e1ec | Leonidas Poulopoulos | homeControlDiv.index = 1;
|
116 | 13e8e1ec | Leonidas Poulopoulos | map.controls[google.maps.ControlPosition.TOP_LEFT].push(homeControlDiv);
|
117 | af9d484b | Leonidas Poulopoulos | |
118 | af9d484b | Leonidas Poulopoulos | bounds = new google.maps.LatLngBounds();
|
119 | af9d484b | Leonidas Poulopoulos | infoWindow = new google.maps.InfoWindow();
|
120 | 13e8e1ec | Leonidas Poulopoulos | google.maps.event.addListener(map, 'idle', function() {
|
121 | 13e8e1ec | Leonidas Poulopoulos | center = map.getCenter();
|
122 | 13e8e1ec | Leonidas Poulopoulos | geocode(center);
|
123 | 13e8e1ec | Leonidas Poulopoulos | zoom = map.getZoom();
|
124 | 13e8e1ec | Leonidas Poulopoulos | if (zoom > 12){
|
125 | 13e8e1ec | Leonidas Poulopoulos | $("#showCityBtn").show();
|
126 | 13e8e1ec | Leonidas Poulopoulos | $("#showCountryBtn").hide();
|
127 | 13e8e1ec | Leonidas Poulopoulos | }
|
128 | 13e8e1ec | Leonidas Poulopoulos | else if ((zoom <= 12) && (zoom > 7)){
|
129 | 13e8e1ec | Leonidas Poulopoulos | $("#showCityBtn").hide();
|
130 | 13e8e1ec | Leonidas Poulopoulos | $("#showCountryBtn").show();
|
131 | 13e8e1ec | Leonidas Poulopoulos | }
|
132 | 13e8e1ec | Leonidas Poulopoulos | else {
|
133 | 13e8e1ec | Leonidas Poulopoulos | $("#showCityBtn").hide();
|
134 | 13e8e1ec | Leonidas Poulopoulos | $("#showCountryBtn").hide();
|
135 | 13e8e1ec | Leonidas Poulopoulos | }
|
136 | 13e8e1ec | Leonidas Poulopoulos | });
|
137 | 13e8e1ec | Leonidas Poulopoulos |
|
138 | af9d484b | Leonidas Poulopoulos | |
139 | af9d484b | Leonidas Poulopoulos | }
|
140 | af9d484b | Leonidas Poulopoulos | |
141 | af9d484b | Leonidas Poulopoulos | var markers = new Array();
|
142 | af9d484b | Leonidas Poulopoulos | function placeMarkers() {
|
143 | af9d484b | Leonidas Poulopoulos | |
144 | af9d484b | Leonidas Poulopoulos | $
|
145 | af9d484b | Leonidas Poulopoulos | .get(
|
146 | af9d484b | Leonidas Poulopoulos | "{% url get-all-services %}",
|
147 | af9d484b | Leonidas Poulopoulos | function(data) {
|
148 | af9d484b | Leonidas Poulopoulos | $
|
149 | af9d484b | Leonidas Poulopoulos | .each(
|
150 | af9d484b | Leonidas Poulopoulos | data,
|
151 | af9d484b | Leonidas Poulopoulos | function(index, jsonMarker) {
|
152 | af9d484b | Leonidas Poulopoulos | var marker = createMarker(jsonMarker);
|
153 | af9d484b | Leonidas Poulopoulos | if (marker) {
|
154 | af9d484b | Leonidas Poulopoulos | bounds
|
155 | af9d484b | Leonidas Poulopoulos | .extend(marker.position);
|
156 | af9d484b | Leonidas Poulopoulos | markers.push(marker);
|
157 | af9d484b | Leonidas Poulopoulos | google.maps.event
|
158 | af9d484b | Leonidas Poulopoulos | .addListener(
|
159 | af9d484b | Leonidas Poulopoulos | marker,
|
160 | af9d484b | Leonidas Poulopoulos | 'click',
|
161 | af9d484b | Leonidas Poulopoulos | function() {
|
162 | af9d484b | Leonidas Poulopoulos | infoWindow.content = "<div><h4>"
|
163 | af9d484b | Leonidas Poulopoulos | + jsonMarker.inst
|
164 | af9d484b | Leonidas Poulopoulos | + "</h4>"
|
165 | af9d484b | Leonidas Poulopoulos | +
|
166 | af9d484b | Leonidas Poulopoulos | |
167 | af9d484b | Leonidas Poulopoulos | "<div class='tabbable'>"
|
168 | af9d484b | Leonidas Poulopoulos | + "<ul class='nav nav-tabs'>"
|
169 | 80d3b062 | Leonidas Poulopoulos | + "<li class='active'><a href='#tab1' data-toggle='tab'>{% trans 'Main' %}</a></li>"
|
170 | 80d3b062 | Leonidas Poulopoulos | + "<li><a href='#tab2' data-toggle='tab'>{% trans 'Advanced' %}</a></li>"
|
171 | af9d484b | Leonidas Poulopoulos | + "</ul>"
|
172 | af9d484b | Leonidas Poulopoulos | + "<div class='tab-content'>"
|
173 | af9d484b | Leonidas Poulopoulos | + "<div class='tab-pane active' id='tab1'>"
|
174 | af9d484b | Leonidas Poulopoulos | + "<dl class='dl-horizontal'>"
|
175 | 80d3b062 | Leonidas Poulopoulos | + "<dt>{% trans 'Name' %}</dt><dd>"
|
176 | af9d484b | Leonidas Poulopoulos | + jsonMarker.name
|
177 | af9d484b | Leonidas Poulopoulos | + "</dd>"
|
178 | 80d3b062 | Leonidas Poulopoulos | + "<dt>{% trans 'Address' %}</dt><dd>"
|
179 | af9d484b | Leonidas Poulopoulos | + jsonMarker.address
|
180 | af9d484b | Leonidas Poulopoulos | + "</dd>"
|
181 | 80d3b062 | Leonidas Poulopoulos | + "<dt>{% trans 'Encryption' %}</dt><dd>"
|
182 | af9d484b | Leonidas Poulopoulos | + jsonMarker.enc
|
183 | af9d484b | Leonidas Poulopoulos | + "</dd>"
|
184 | 80d3b062 | Leonidas Poulopoulos | + "<dt>{% trans 'SSID' %}</dt><dd>"
|
185 | af9d484b | Leonidas Poulopoulos | + jsonMarker.SSID
|
186 | af9d484b | Leonidas Poulopoulos | + "</dd>"
|
187 | 80d3b062 | Leonidas Poulopoulos | + "<dt>{% trans 'Number of APs' %}</dt><dd>"
|
188 | af9d484b | Leonidas Poulopoulos | + jsonMarker.AP_no
|
189 | af9d484b | Leonidas Poulopoulos | + "</dd></dl>"
|
190 | af9d484b | Leonidas Poulopoulos | + "</div>"
|
191 | af9d484b | Leonidas Poulopoulos | + "<div class='tab-pane' id='tab2'>"
|
192 | af9d484b | Leonidas Poulopoulos | + "<dl class='dl-horizontal'>"
|
193 | 80d3b062 | Leonidas Poulopoulos | + "<dt>{% trans 'Port Restrict' %}</dt><dd>"
|
194 | af9d484b | Leonidas Poulopoulos | + jsonMarker.port_restrict
|
195 | af9d484b | Leonidas Poulopoulos | + "</dd>"
|
196 | 80d3b062 | Leonidas Poulopoulos | + "<dt>{% trans 'transp_proxy' %}</dt><dd>"
|
197 | af9d484b | Leonidas Poulopoulos | + jsonMarker.transp_proxy
|
198 | af9d484b | Leonidas Poulopoulos | + "</dd>"
|
199 | af9d484b | Leonidas Poulopoulos | + "<dt>IPv6</dt><dd>"
|
200 | af9d484b | Leonidas Poulopoulos | + jsonMarker.IPv6
|
201 | af9d484b | Leonidas Poulopoulos | + "</dd>"
|
202 | af9d484b | Leonidas Poulopoulos | + "<dt>NAT</dt><dd>"
|
203 | af9d484b | Leonidas Poulopoulos | + jsonMarker.NAT
|
204 | af9d484b | Leonidas Poulopoulos | + "</dd>"
|
205 | 80d3b062 | Leonidas Poulopoulos | + "<dt>{% trans 'Wired' %}</dt><dd>"
|
206 | af9d484b | Leonidas Poulopoulos | + jsonMarker.wired
|
207 | af9d484b | Leonidas Poulopoulos | + "</dd></dl>"
|
208 | af9d484b | Leonidas Poulopoulos | + "</div>"
|
209 | af9d484b | Leonidas Poulopoulos | + "</div>"
|
210 | af9d484b | Leonidas Poulopoulos | + "</div>"
|
211 | af9d484b | Leonidas Poulopoulos | + "</div>";
|
212 | af9d484b | Leonidas Poulopoulos | infoWindow
|
213 | af9d484b | Leonidas Poulopoulos | .open(
|
214 | af9d484b | Leonidas Poulopoulos | map,
|
215 | af9d484b | Leonidas Poulopoulos | marker);
|
216 | af9d484b | Leonidas Poulopoulos | });
|
217 | af9d484b | Leonidas Poulopoulos | }
|
218 | af9d484b | Leonidas Poulopoulos | });
|
219 | af9d484b | Leonidas Poulopoulos | var mcOptions = {
|
220 | af9d484b | Leonidas Poulopoulos | gridSize : 50,
|
221 | af9d484b | Leonidas Poulopoulos | maxZoom : 15,
|
222 | af9d484b | Leonidas Poulopoulos | styles : styles
|
223 | af9d484b | Leonidas Poulopoulos | };
|
224 | af9d484b | Leonidas Poulopoulos | |
225 | af9d484b | Leonidas Poulopoulos | var markerCluster = new MarkerClusterer(map,
|
226 | af9d484b | Leonidas Poulopoulos | markers, mcOptions);
|
227 | af9d484b | Leonidas Poulopoulos | map.fitBounds(bounds)
|
228 | af9d484b | Leonidas Poulopoulos | });
|
229 | af9d484b | Leonidas Poulopoulos | }
|
230 | af9d484b | Leonidas Poulopoulos | |
231 | af9d484b | Leonidas Poulopoulos | function createMarker(markerObj) {
|
232 | af9d484b | Leonidas Poulopoulos | var title = markerObj.name;
|
233 | af9d484b | Leonidas Poulopoulos | var address = markerObj.address;
|
234 | af9d484b | Leonidas Poulopoulos | var latLng = new google.maps.LatLng(markerObj.lat, markerObj.lng);
|
235 | af9d484b | Leonidas Poulopoulos | var marker = new google.maps.Marker({
|
236 | af9d484b | Leonidas Poulopoulos | 'position' : latLng,
|
237 | af9d484b | Leonidas Poulopoulos | 'map' : map,
|
238 | af9d484b | Leonidas Poulopoulos | 'title' : title,
|
239 | af9d484b | Leonidas Poulopoulos | 'address' : address,
|
240 | af9d484b | Leonidas Poulopoulos | 'icon' : image,
|
241 | af9d484b | Leonidas Poulopoulos | });
|
242 | af9d484b | Leonidas Poulopoulos | return marker
|
243 | af9d484b | Leonidas Poulopoulos | }
|
244 | af9d484b | Leonidas Poulopoulos | |
245 | af9d484b | Leonidas Poulopoulos | function clusterMarkers(markers) {
|
246 | af9d484b | Leonidas Poulopoulos | var markerCluster = new MarkerClusterer(map, markers);
|
247 | af9d484b | Leonidas Poulopoulos | }
|
248 | af9d484b | Leonidas Poulopoulos | |
249 | af9d484b | Leonidas Poulopoulos | function rad(x) {
|
250 | af9d484b | Leonidas Poulopoulos | return x * Math.PI / 180;
|
251 | af9d484b | Leonidas Poulopoulos | }
|
252 | af9d484b | Leonidas Poulopoulos | |
253 | af9d484b | Leonidas Poulopoulos | function find_closest_marker(event) {
|
254 | af9d484b | Leonidas Poulopoulos | var lat = event.latLng.lat();
|
255 | af9d484b | Leonidas Poulopoulos | var lng = event.latLng.lng();
|
256 | af9d484b | Leonidas Poulopoulos | var R = 6371; // radius of earth in km
|
257 | af9d484b | Leonidas Poulopoulos | var distances = [];
|
258 | af9d484b | Leonidas Poulopoulos | var closest = -1;
|
259 | af9d484b | Leonidas Poulopoulos | for (i = 0; i < markers.length; i++) {
|
260 | af9d484b | Leonidas Poulopoulos | var mlat = markers[i].position.lat();
|
261 | af9d484b | Leonidas Poulopoulos | var mlng = markers[i].position.lng();
|
262 | af9d484b | Leonidas Poulopoulos | var dLat = rad(mlat - lat);
|
263 | af9d484b | Leonidas Poulopoulos | var dLong = rad(mlng - lng);
|
264 | af9d484b | Leonidas Poulopoulos | var a = Math.sin(dLat / 2) * Math.sin(dLat / 2)
|
265 | af9d484b | Leonidas Poulopoulos | + Math.cos(rad(lat)) * Math.cos(rad(lat))
|
266 | af9d484b | Leonidas Poulopoulos | * Math.sin(dLong / 2) * Math.sin(dLong / 2);
|
267 | af9d484b | Leonidas Poulopoulos | var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
268 | af9d484b | Leonidas Poulopoulos | var d = R * c;
|
269 | af9d484b | Leonidas Poulopoulos | distances[i] = d;
|
270 | af9d484b | Leonidas Poulopoulos | if (closest == -1 || d < distances[closest]) {
|
271 | af9d484b | Leonidas Poulopoulos | closest = i;
|
272 | af9d484b | Leonidas Poulopoulos | }
|
273 | af9d484b | Leonidas Poulopoulos | }
|
274 | af9d484b | Leonidas Poulopoulos | |
275 | af9d484b | Leonidas Poulopoulos | alert(markers[closest].address);
|
276 | af9d484b | Leonidas Poulopoulos | }
|
277 | af9d484b | Leonidas Poulopoulos | |
278 | 13e8e1ec | Leonidas Poulopoulos | function geocode(position){
|
279 | 13e8e1ec | Leonidas Poulopoulos | addr = {};
|
280 | 13e8e1ec | Leonidas Poulopoulos | geocoder
|
281 | 13e8e1ec | Leonidas Poulopoulos | .geocode(
|
282 | 13e8e1ec | Leonidas Poulopoulos | {
|
283 | 13e8e1ec | Leonidas Poulopoulos | 'latLng' : position
|
284 | 13e8e1ec | Leonidas Poulopoulos | },
|
285 | 13e8e1ec | Leonidas Poulopoulos | function(results, status) {
|
286 | 13e8e1ec | Leonidas Poulopoulos | if (status == google.maps.GeocoderStatus.OK) {
|
287 | 13e8e1ec | Leonidas Poulopoulos | if (results.length >= 1) {
|
288 | 13e8e1ec | Leonidas Poulopoulos | for ( var ii = 0; ii < results[0].address_components.length; ii++) {
|
289 | 13e8e1ec | Leonidas Poulopoulos | var street_number = route = street = city = state = zipcode = country = formatted_address = '';
|
290 | 13e8e1ec | Leonidas Poulopoulos | var types = results[0].address_components[ii].types
|
291 | 13e8e1ec | Leonidas Poulopoulos | .join(",");
|
292 | 13e8e1ec | Leonidas Poulopoulos | if (types == "sublocality,political"
|
293 | 13e8e1ec | Leonidas Poulopoulos | || types == "locality,political"
|
294 | 13e8e1ec | Leonidas Poulopoulos | || types == "neighborhood,political"
|
295 | 13e8e1ec | Leonidas Poulopoulos | || types == "political") {
|
296 | 13e8e1ec | Leonidas Poulopoulos | addr.city = (city == '' || types == "locality,political") ? results[0].address_components[ii].long_name
|
297 | 13e8e1ec | Leonidas Poulopoulos | : city;
|
298 | 13e8e1ec | Leonidas Poulopoulos | }
|
299 | 13e8e1ec | Leonidas Poulopoulos | if (types == "country,political") {
|
300 | 13e8e1ec | Leonidas Poulopoulos | addr.country = results[0].address_components[ii].long_name;
|
301 | 13e8e1ec | Leonidas Poulopoulos | }
|
302 | 13e8e1ec | Leonidas Poulopoulos | }
|
303 | 13e8e1ec | Leonidas Poulopoulos | }
|
304 | 13e8e1ec | Leonidas Poulopoulos | }
|
305 | 13e8e1ec | Leonidas Poulopoulos | });
|
306 | 13e8e1ec | Leonidas Poulopoulos | }
|
307 | 13e8e1ec | Leonidas Poulopoulos |
|
308 | 13e8e1ec | Leonidas Poulopoulos | function codeAddress(address) {
|
309 | 13e8e1ec | Leonidas Poulopoulos | geocoder.geocode( { 'address': address}, function(results, status) {
|
310 | 13e8e1ec | Leonidas Poulopoulos | if (status == google.maps.GeocoderStatus.OK) {
|
311 | 13e8e1ec | Leonidas Poulopoulos | map.setCenter(results[0].geometry.location);
|
312 | 13e8e1ec | Leonidas Poulopoulos | map.fitBounds(results[0].geometry.bounds)
|
313 | 13e8e1ec | Leonidas Poulopoulos | } else {
|
314 | 13e8e1ec | Leonidas Poulopoulos | alert("Geocode was not successful for the following reason: " + status);
|
315 | 13e8e1ec | Leonidas Poulopoulos | }
|
316 | 13e8e1ec | Leonidas Poulopoulos | });
|
317 | 13e8e1ec | Leonidas Poulopoulos | }
|
318 | 13e8e1ec | Leonidas Poulopoulos | |
319 | 13e8e1ec | Leonidas Poulopoulos | function HomeControl(controlDiv, map) {
|
320 | 13e8e1ec | Leonidas Poulopoulos | |
321 | 13e8e1ec | Leonidas Poulopoulos | // Set CSS styles for the DIV containing the control
|
322 | 13e8e1ec | Leonidas Poulopoulos | // Setting padding to 5 px will offset the control
|
323 | 13e8e1ec | Leonidas Poulopoulos | // from the edge of the map.
|
324 | 13e8e1ec | Leonidas Poulopoulos | controlDiv.style.padding = '5px';
|
325 | 13e8e1ec | Leonidas Poulopoulos | |
326 | 13e8e1ec | Leonidas Poulopoulos | // Set CSS for the control border.
|
327 | 13e8e1ec | Leonidas Poulopoulos | var controlUI = document.createElement('button');
|
328 | 13e8e1ec | Leonidas Poulopoulos | controlUI.className='btn btn-warning roundButton';
|
329 | 13e8e1ec | Leonidas Poulopoulos | controlUI.id = "showCityBtn";
|
330 | 13e8e1ec | Leonidas Poulopoulos | extraCSS = 'background-image: url(/static/img/city.png);background-position: center center; background-repeat: no-repeat;';
|
331 | 13e8e1ec | Leonidas Poulopoulos | controlUI.style.cssText='display:none; cursor:pointer; white-space:nowrap; position:absolute; '+extraCSS;
|
332 | 13e8e1ec | Leonidas Poulopoulos | controlUI.title = "City View";
|
333 | 13e8e1ec | Leonidas Poulopoulos | |
334 | 13e8e1ec | Leonidas Poulopoulos | // Set CSS for the control border.
|
335 | 13e8e1ec | Leonidas Poulopoulos | var controlUI2 = document.createElement('button');
|
336 | 13e8e1ec | Leonidas Poulopoulos | controlUI2.className='btn btn-warning roundButton';
|
337 | 13e8e1ec | Leonidas Poulopoulos | controlUI2.id = "showCountryBtn";
|
338 | 13e8e1ec | Leonidas Poulopoulos | extraCSS2 = 'background-image: url(/static/img/country.png);background-position: center center; background-repeat: no-repeat;';
|
339 | 13e8e1ec | Leonidas Poulopoulos | controlUI2.style.cssText='display:none; cursor:pointer; white-space:nowrap; position:absolute; '+extraCSS2;
|
340 | 13e8e1ec | Leonidas Poulopoulos | controlUI2.title = "Country View";
|
341 | 13e8e1ec | Leonidas Poulopoulos |
|
342 | 13e8e1ec | Leonidas Poulopoulos | controlDiv.appendChild(controlUI);
|
343 | 13e8e1ec | Leonidas Poulopoulos | controlDiv.appendChild(controlUI2);
|
344 | 13e8e1ec | Leonidas Poulopoulos |
|
345 | 13e8e1ec | Leonidas Poulopoulos | // Setup the click event listeners: simply set the map to Chicago.
|
346 | 13e8e1ec | Leonidas Poulopoulos | google.maps.event.addDomListener(controlUI, 'click', function() {
|
347 | 13e8e1ec | Leonidas Poulopoulos | codeAddress(addr.city+','+addr.country);
|
348 | 13e8e1ec | Leonidas Poulopoulos | });
|
349 | 13e8e1ec | Leonidas Poulopoulos | google.maps.event.addDomListener(controlUI2, 'click', function() {
|
350 | 13e8e1ec | Leonidas Poulopoulos | codeAddress(addr.country);
|
351 | 13e8e1ec | Leonidas Poulopoulos | });
|
352 | 13e8e1ec | Leonidas Poulopoulos |
|
353 | 13e8e1ec | Leonidas Poulopoulos | }
|
354 | 13e8e1ec | Leonidas Poulopoulos |
|
355 | af9d484b | Leonidas Poulopoulos | $(document).ready(function() {
|
356 | af9d484b | Leonidas Poulopoulos | initialize();
|
357 | af9d484b | Leonidas Poulopoulos | marks = placeMarkers();
|
358 | af9d484b | Leonidas Poulopoulos | clusterMarkers(marks);
|
359 | af9d484b | Leonidas Poulopoulos | });
|
360 | af9d484b | Leonidas Poulopoulos | </script>
|
361 | af9d484b | Leonidas Poulopoulos | {% endblock %} |
362 | af9d484b | Leonidas Poulopoulos | |
363 | af9d484b | Leonidas Poulopoulos | |
364 | 13e8e1ec | Leonidas Poulopoulos | {% block subcontent %} |
365 | 212ce199 | Leonidas Poulopoulos | <h4>{% trans "Eduroam in Greece" %}</h4> |
366 | 212ce199 | Leonidas Poulopoulos | <hr>
|
367 | 13e8e1ec | Leonidas Poulopoulos | |
368 | af9d484b | Leonidas Poulopoulos | <div id="map_canvas" style="width:100%; height:600px; overflow: hidden;"></div> |
369 | af9d484b | Leonidas Poulopoulos | {% endblock %} |
370 | af9d484b | Leonidas Poulopoulos | |
371 | 13e8e1ec | Leonidas Poulopoulos |