Revision 242932f3

b/djnro/templates/404.html
1 1
{% extends "base.html" %}
2 2
{% load i18n %}
3
    {% block topmenu %}
4
    <ul class="nav">
5
        <li>
6
            <a href="{% url index %}">{% trans "Home" %}</a>
7
        </li>
8
        <li>
9
            <a href="/faq/{{LANGUAGE_CODE}}/">FAQ</a>
10
        </li>
11
        {% include "front/management_dropdown.html" %}
12 3

  
13
    </ul>
14
    {% endblock %}
15
    {% block content %}
16
	<div class="container-fluid">
17
      <div class="row-fluid">
18
        <div class="span2">
19
        </div><!--/span-->
20

  
21

  
22
		<div class="span10">
4
{% block subcontent %}
5
<div class="container-fluid">
6
    <div class="row-fluid">
7
		<div class="span12">
23 8
			<div class="row-fluid">
24 9
				<!--/span-->
25
				<h3>Oops! You got a nice 404: Page does not exist</h3>
10
				<h1>Oops! You got a nice 404: Page does not exist</h1>
26 11
				<hr>
27
					{% block subcontent %}
28
					<div class="span10 alert alert-error">No matter how you reached this page, it simply does not exist!</div>
29
					{% endblock %}
30
				
31
				<!--/span-->
32
			</div><!--/row-->
33
		</div><!--/span-->
34

  
35
        </div><!--/span-->
36

  
37
    </div><!--/.fluid-container-->
38
	{% endblock %}
12
			     <div class="span10 alert alert-error">No matter how you reached this page, it simply does not exist!</div>
13
		  </div><!--/row-->
14
		</div>
15
    </div>
16
</div>
17
{% endblock %}
b/djnro/templates/500.html
1 1
{% extends "base.html" %}
2 2
{% load i18n %}
3
    {% block topmenu %}
4
    <ul class="nav">
5
        <li>
6
            <a href="{% url index %}">{% trans "Home" %}</a>
7
        </li>
8
        <li>
9
            <a href="/faq/{{LANGUAGE_CODE}}/">FAQ</a>
10
        </li>
11
       {% include "front/management_dropdown.html" %}
12

  
13
    </ul>
14
    {% endblock %}
15
    {% block content %}
3
    {% block subcontent %}
16 4
	<div class="container-fluid">
17 5
      <div class="row-fluid">
18
        <div class="span2">
19
        </div><!--/span-->
20

  
21

  
22
		<div class="span10">
6
		<div class="span12">
23 7
			<div class="row-fluid">
24
				<!--/span-->
25
				<h3>Oops! You got a 500: Error!</h3>
8
				<h1>Oops! You got a 500: Error!</h1>
26 9
				<hr>
27
					{% block subcontent %}
28
					<div class="span10 alert alert-error">An error occured! Don't worry, our team has been notified about it and will soon fix it!</div>
29
					{% endblock %}
30
				
31
				<!--/span-->
32
			</div><!--/row-->
33
		</div><!--/span-->
34

  
35
        </div><!--/span-->
36

  
37
    </div><!--/.fluid-container-->
38
	{% endblock %}
10
				<div class="span10 alert alert-error">An error occured! Don't worry, our team has been notified about it and will soon fix it!</div>
11
			</div>
12
		</div>
13
    </div>
14
</div>
15
{% endblock %}
b/djnro/templates/base.html
57 57
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{% trans "Institutions" %}<span class="caret"></span></a>
58 58
                    <ul class="dropdown-menu">
59 59
                        <li class="{% block mgmt %}{% endblock %}"><a href="{% url managementPage %}">{% trans "Management" %}</a></li>
60
                        <li class="{% block participants %}{% endblock %}"><a href="{% url participants %}">{% trans "Participants" %}</a></li>
60 61
                    </ul>
61 62
                </li>
62 63
                <li class="dropdown">
......
64 65
                    <ul class="dropdown-menu">
65 66
                          <li class="{% block closest %}{% endblock %}"><a href="{% url geolocate %}" target="_blank">{% trans "Closest eduroam" %}</a></li>
66 67
                          <li class="{% block world %}{% endblock %}"><a href="{% url world %}">{% trans "World eduroam" %}</a></li>
67
                          <li class="{% block participants %}{% endblock %}"><a href="{% url participants %}">{% trans "Participants" %}</a></li>
68 68
                          <li><a href="https://apps.getpebble.com/applications/5384b2119c84af48350000c7">{% trans "pebduroam" %}</a></li>
69
                    </ul>
70
                </li>
71
                <li >
72 69
                        <li class="{% block api %}{% endblock %}"><a href="{% url api %}">{% trans "Closest point api" %}</a>
70
                    </ul>
73 71
                </li>
74 72
              </ul>
75 73
            </div><!--/.nav-collapse -->
b/djnro/templates/front/participants.html
6 6
{% block hometop %}{% endblock %}
7 7
{% block participants %}active{% endblock %}
8 8

  
9
{% block extrahead %}
10
<style type="text/css">
11
  .headtitle {font-family: "Franklin Gothic Demi", "Franklin Gothic", "ITC Franklin Gothic", Arial, sans-serif; letter-spacing: -1px; }
12
</style>
13
<script type="text/javascript" src="{% static 'js/jquery.min.js' %}"></script>
14
{% endblock %}
15

  
16 9

  
17 10
{% block subcontent %}
18
	{% load tolocale %}
19
	<h4>{% trans "Participating Institutions" %}</h4>
20
	<hr>
21
	<div>{% trans "In"%} {% trans COUNTRY_NAME %} {% trans "eduroam is provided by the following instituitons/organizations" %}</div><br>
22
					<div>{% for i in institutions %}
23
					<address>
24
						<strong>{% tolocale i.institution LANGUAGE_CODE %}</strong><br>
25
						{% with i.institution.get_active_cat_enrl as cats %}
26
    						{% for cat in cats %}
27
    						<a href="{{cat}}" target="_blank">eduroam CAT configuration profiles</a><span style="font-weight: bold; font-size:15px; color:red;">*</span><br>{% endfor %}
28
    					{% endwith %}
29
						{{i.address_street}}<br>
30
						{{i.address_city}}
31
						{% if i.url.all|length > 0 %}
32
						    <dl style="margin-top: 0px;">
33
    							<dt style="font-weight: normal;">urls</dt>
34
    							<dd>
35
						{% for u in i.url.all %}{% if u %}<a href="{{u.url}}">{{u.url}}</a>  {{u.get_urltype_display}} ({{u.get_lang_display}})<br>{% endif %}{% endfor %}
36
						</dd>
37
    						</dl>
38
    						{% endif %}
39

  
40

  
41
					</address>
42

  
43

  
44

  
45
					{% endfor %}</div>
46
					{% if catexists %}
47
					<span style="font-size:11px;"><span style="color:red;">*</span>: Institution admiminstrators may have not created CAT profiles for all/any devices</span>
48
					{% endif %}
49
					{% endblock %}
11
{% load tolocale %}
12
<h1>{% trans "Participating Institutions" %}</h1>
13
<hr>
14
<div>{% trans "In"%} {% trans COUNTRY_NAME %} {% trans "eduroam is provided by the following instituitons/organizations" %}</div>
15
<div>
16
	{% for i in institutions %}
17
	<div class="col-md-6">
18
		<address>
19
			<strong>{% tolocale i.institution LANGUAGE_CODE %}</strong><br/>
20
			{% with i.institution.get_active_cat_enrl as cats %}
21
				{% for cat in cats %}
22
						<a href="{{cat}}" target="_blank">eduroam CAT configuration profiles</a><br/>
23
						<span style="font-weight: bold; font-size:15px; color:red;">*</span><br/>
24
				{% endfor %}
25
			{% endwith %}
26
			{{i.address_street}}<br>
27
			{{i.address_city}}
28
			{% if i.url.all|length > 0 %}
29
		    <dl style="margin-top: 0px;">
30
				<dt style="font-weight: normal;">urls</dt>
31
				<dd>
32
					{% for u in i.url.all %}{% if u %}<a href="{{u.url}}">{{u.url}}</a>  {{u.get_urltype_display}} ({{u.get_lang_display}})<br>{% endif %}{% endfor %}
33
				</dd>
34
			</dl>
35
			{% endif %}
36
		</address>
37
	</div>
38
	{% endfor %}
39
</div>
40
{% if catexists %}
41
	<span style="font-size:11px;"><span style="color:red;">*</span>: Institution admiminstrators may have not created CAT profiles for all/any devices</span>
42
{% endif %}
43
{% endblock %}
50 44

  
51 45

  
b/djnro/templates/front/world.html
5 5
{% block homepage %}{% endblock %}
6 6
{% block hometop %}{% endblock %}
7 7
{% block world %}active{% endblock %}
8
{% block extrahead %}
9
<style type="text/css">
10 8

  
11
  .headtitle {font-family: "Franklin Gothic Demi", "Franklin Gothic", "ITC Franklin Gothic", Arial, sans-serif; letter-spacing: -1px; }
12
</style>
13
<script type="text/javascript" src="{% static 'js/jquery.min.js' %}"></script>
14
<script type="text/javascript" src="{% static 'js/markerclusterer.js' %}"></script>
15
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
16
<script type="text/javascript">
17
	var lat = "{{MAP_CENTER.0}}";
18
	var lat = parseFloat(lat.replace(",","."));
19
	var lng = "{{MAP_CENTER.1}}";
20
	var lng = parseFloat(lng.replace(",","."));
21
	var zoomLevel = 6;
22
	var latlng = new google.maps.LatLng(lat,lng);
23
	var map = '';
24
	var bounds = '';
25
	var image = '';
26
	var infoWindow;
27
	addr = {};
28

  
29

  
30
	var styles = [ {
31
		url : '{% static '/img/edugroup.png' %}',
32
		height : 54,
33
		width : 63,
34
		textColor : '#ffffff',
35
		textSize : 11
36
	}, {
37
		url : '{% static '/img/edugroup.png' %}',
38
		height : 54,
39
		width : 63,
40
		textColor : '#ffffff',
41
		textSize : 11
42
	}, {
43
		url : '{% static '/img/edugroup.png' %}',
44
		height : 54,
45
		width : 63,
46
		textColor : '#ffffff',
47
		textSize : 11
48
	} ];
49

  
50
	function initialize() {
51
		image = new google.maps.MarkerImage('{% static '/img/edupin.png' %}',
52
		// This marker is 29 pixels wide by 40 pixels tall.
53
		new google.maps.Size(29, 40),
54
		// The origin for this image is 0,0.
55
		new google.maps.Point(0, 0),
56
		// The anchor for this image is the base of the flagpole at 18,42.
57
		new google.maps.Point(14, 40));
58

  
59
		var styleArray = [ {
60
			featureType : "all",
61
			stylers : [ {
62
				saturation : -60
63
			}, {
64
				gamma : 1.00
65
			} ]
66
		}, {
67
			featureType : "poi.business",
68
			elementType : "labels",
69
			stylers : [ {
70
				visibility : "off"
71
			} ]
72
		}, {
73
			"featureType" : "transit.line",
74
			"elementType" : "geometry",
75
			"stylers" : [ {
76
				"visibility" : "off"
77
			} ]
78
		}, {
79
			"featureType" : "poi",
80
			"elementType" : "all",
81
			"stylers" : [ {
82
				"visibility" : "off"
83
			} ]
84
		}, {
85
			'featureType' : "administrative.country",
86
			'elementType' : "labels",
87
			'stylers' : [ {
88
				'visibility' : "off"
89
			} ]
90
		}
91

  
92
		];
93

  
94
	geocoder = new google.maps.Geocoder();
95
	var mapOptions = {
96
			center : latlng,
97
			zoom : zoomLevel,
98
			mapTypeId : google.maps.MapTypeId.ROADMAP,
99
			styles : styleArray,
100
			mapTypeId : google.maps.MapTypeId.ROADMAP,
101
			mapTypeControlOptions : {
102
				style : google.maps.MapTypeControlStyle.DEFAULT
103
			},
104
			navigationControl : true,
105
			mapTypeControl : false,
106
		};
107
		map = new google.maps.Map(document.getElementById("map_canvas"),
108
				mapOptions);
109

  
110

  
111
		var homeControlDiv = document.createElement('div');
112
		homeControlDiv.className='roundButtonHolder';
113
		homeControlDiv.id="locationButton";
114
		var homeControl = new HomeControl(homeControlDiv, map);
115

  
116
		homeControlDiv.index = 1;
117
		map.controls[google.maps.ControlPosition.TOP_LEFT].push(homeControlDiv);
118

  
119
		bounds = new google.maps.LatLngBounds();
120
		infoWindow = new google.maps.InfoWindow();
121
		google.maps.event.addListener(map, 'idle', function() {
122
			center = map.getCenter();
123
			geocode(center);
124
			zoom = map.getZoom();
125
			if (zoom > 12){
126
				$("#showCityBtn").show();
127
				$("#showCountryBtn").hide();
128
			}
129
			else if ((zoom <= 12) && (zoom > 7)){
130
				$("#showCityBtn").hide();
131
				$("#showCountryBtn").show();
132
			}
133
			else {
134
				$("#showCityBtn").hide();
135
				$("#showCountryBtn").hide();
136
			}
137
		});
138

  
139

  
140
	}
141

  
142
	var markers = new Array();
143
	function placeMarkers() {
144

  
145
		$
146
				.get(
147
						"{% url worldPoints %}",
148
						function(data) {
149
							$
150
									.each(
151
											data,
152
											function(index, jsonMarker) {
153
												var marker = createMarker(jsonMarker);
154
												if (marker) {
155
													bounds
156
															.extend(marker.position);
157
													markers.push(marker);
158
													google.maps.event
159
															.addListener(
160
																	marker,
161
																	'click',
162
																	function() {
163
																		infoWindow.setContent(jsonMarker.text);
164
																		infoWindow
165
																				.open(
166
																						map,
167
																						marker);
168
																	});
169
												}
170
											});
171
							var mcOptions = {
172
								gridSize : 60,
173
								maxZoom : null,
174
								styles : styles
175
							};
176

  
177
							var markerCluster = new MarkerClusterer(map,
178
									markers, mcOptions);
179
							map.fitBounds(bounds);
180
						});
181
	}
182 9

  
183
	function createMarker(markerObj) {
184
		var latLng = new google.maps.LatLng(markerObj.lat, markerObj.lng);
185
		var marker = new google.maps.Marker({
186
			'position' : latLng,
187
			'map' : map,
188
			'icon' : image,
189
		});
190
		return marker
191
	}
10
{% block content %}
11
<h1>{% trans "Eduroam Worldwide" %}</h1>
12
<hr>
192 13

  
193
	function clusterMarkers(markers) {
194
		var markerCluster = new MarkerClusterer(map, markers);
195
	}
196

  
197

  
198
	function geocode(position){
199
		addr = {};
200
		geocoder
201
		.geocode(
202
				{
203
					'latLng' : position
204
				},
205
				function(results, status) {
206
					if (status == google.maps.GeocoderStatus.OK) {
207
						if (results.length >= 1) {
208
							for ( var ii = 0; ii < results[0].address_components.length; ii++) {
209
								var street_number = route = street = city = state = zipcode = country = formatted_address = '';
210
								var types = results[0].address_components[ii].types
211
										.join(",");
212
								if (types == "sublocality,political"
213
										|| types == "locality,political"
214
										|| types == "neighborhood,political"
215
										|| types == "political") {
216
									addr.city = (city == '' || types == "locality,political") ? results[0].address_components[ii].long_name
217
											: city;
218
								}
219
								if (types == "country,political") {
220
									addr.country = results[0].address_components[ii].long_name;
221
								}
222
							}
223
						}
224
					}
225
				});
226
	}
227

  
228
	function codeAddress(address) {
229
	    geocoder.geocode( { 'address': address}, function(results, status) {
230
	      if (status == google.maps.GeocoderStatus.OK) {
231
	        map.setCenter(results[0].geometry.location);
232
	    	map.fitBounds(results[0].geometry.bounds)
233
	      } else {
234
	        //alert("Geocode was not successful for the following reason: " + status);
235
	      }
236
	    });
237
	  }
238

  
239
	function HomeControl(controlDiv, map) {
240

  
241
		  // Set CSS styles for the DIV containing the control
242
		  // Setting padding to 5 px will offset the control
243
		  // from the edge of the map.
244
		  controlDiv.style.padding = '5px';
245

  
246
		  // Set CSS for the control border.
247
		  var controlUI = document.createElement('button');
248
		  controlUI.className='btn btn-warning roundButton';
249
		  controlUI.id = "showCityBtn";
250
		  extraCSS = 'background-image: url({% static '/img/city.png' %});background-position: center center; background-repeat: no-repeat;';
251
		  controlUI.style.cssText='display:none; cursor:pointer; white-space:nowrap; position:absolute; '+extraCSS;
252
		  controlUI.title = "City View";
253

  
254
		  // Set CSS for the control border.
255
		  var controlUI2 = document.createElement('button');
256
		  controlUI2.className='btn btn-warning roundButton';
257
		  controlUI2.id = "showCountryBtn";
258
		  extraCSS2 = 'background-image: url({% static '/img/country.png' %});background-position: center center; background-repeat: no-repeat;';
259
		  controlUI2.style.cssText='display:none; cursor:pointer; white-space:nowrap; position:absolute; '+extraCSS2;
260
		  controlUI2.title = "Country View";
261

  
262
		  controlDiv.appendChild(controlUI);
263
		  controlDiv.appendChild(controlUI2);
264

  
265
		  // Setup the click event listeners: simply set the map to Chicago.
266
		  google.maps.event.addDomListener(controlUI, 'click', function() {
267
		    codeAddress(addr.city+','+addr.country);
268
		  });
269
		  google.maps.event.addDomListener(controlUI2, 'click', function() {
270
			    codeAddress(addr.country);
271
			  });
272

  
273
		}
274

  
275
	$(document).ready(function() {
276
		initialize();
277
		marks = placeMarkers();
278
		clusterMarkers(marks);
279
	});
280
</script>
14
<div id="map_canvas" data-center-lat="{{ MAP_CENTER.0 }}" data-url="{% url worldPoints %}" data-city="{% static 'img/city.png' %}" data-country="{% static 'img/country.png' %}" data-group="{% static 'img/edugroup.png' %}" data-pin="{% static 'img/edupin.png' %}" data-center-lng="{{ MAP_CENTER.1 }}" style="width:100%; height:600px; overflow: hidden;"></div>
281 15
{% endblock %}
282 16

  
283 17

  
284
					{% block content %}
285
					<h4>{% trans "Eduroam Worldwide" %}</h4>
286
					<hr>
287

  
288
					<div id="map_canvas" style="width:100%; height:600px; overflow: hidden;"></div>
289
					{% endblock %}
290

  
291

  
18
{% block extrajs %}
19
<script type="text/javascript" src="{% static 'js/markerclusterer.js' %}"></script>
20
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
21
<script type="text/javascript" src="{% static 'js/world-map.js' %}"></script>
22
{% endblock %}
b/static/js/world-map.js
1
	var lat = "";
2
	var lng = "";
3
	var zoomLevel = 6;
4
	var latlng;
5
	var map = '';
6
	var bounds = '';
7
	var image = '';
8
	var infoWindow;
9
	addr = {};
10
	var styles;
11
	var pinImg;
12
	var pinsUrl;
13
	var cityImg;
14
	var countryImg;
15

  
16
	function initialize() {
17
		image = new google.maps.MarkerImage(pinImg,
18
		// This marker is 29 pixels wide by 40 pixels tall.
19
		new google.maps.Size(29, 40),
20
		// The origin for this image is 0,0.
21
		new google.maps.Point(0, 0),
22
		// The anchor for this image is the base of the flagpole at 18,42.
23
		new google.maps.Point(14, 40));
24

  
25
		var styleArray = [ {
26
			featureType : "all",
27
			stylers : [ {
28
				saturation : -60
29
			}, {
30
				gamma : 1.00
31
			} ]
32
		}, {
33
			featureType : "poi.business",
34
			elementType : "labels",
35
			stylers : [ {
36
				visibility : "off"
37
			} ]
38
		}, {
39
			"featureType" : "transit.line",
40
			"elementType" : "geometry",
41
			"stylers" : [ {
42
				"visibility" : "off"
43
			} ]
44
		}, {
45
			"featureType" : "poi",
46
			"elementType" : "all",
47
			"stylers" : [ {
48
				"visibility" : "off"
49
			} ]
50
		}, {
51
			'featureType' : "administrative.country",
52
			'elementType' : "labels",
53
			'stylers' : [ {
54
				'visibility' : "off"
55
			} ]
56
		}
57

  
58
		];
59

  
60
	geocoder = new google.maps.Geocoder();
61
	if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
62
		isDraggable = false;
63
		isScrollable = true;
64
	} else {
65
		isDraggable = true;
66
		isScrollable = false;
67
	}
68
	var mapOptions = {
69
			center : latlng,
70
			zoom : zoomLevel,
71
			mapTypeId : google.maps.MapTypeId.ROADMAP,
72
			styles : styleArray,
73
			mapTypeId : google.maps.MapTypeId.ROADMAP,
74
			mapTypeControlOptions : {
75
				style : google.maps.MapTypeControlStyle.DEFAULT
76
			},
77
			navigationControl : true,
78
			mapTypeControl : false,
79
			scrollwheel: isScrollable,
80
			draggable: isDraggable
81
		};
82
		map = new google.maps.Map(document.getElementById("map_canvas"),
83
				mapOptions);
84

  
85

  
86
		var homeControlDiv = document.createElement('div');
87
		homeControlDiv.className='roundButtonHolder';
88
		homeControlDiv.id="locationButton";
89
		var homeControl = new HomeControl(homeControlDiv, map);
90

  
91
		homeControlDiv.index = 1;
92
		map.controls[google.maps.ControlPosition.TOP_LEFT].push(homeControlDiv);
93

  
94
		bounds = new google.maps.LatLngBounds();
95
		infoWindow = new google.maps.InfoWindow();
96
		google.maps.event.addListener(map, 'idle', function() {
97
			center = map.getCenter();
98
			geocode(center);
99
			zoom = map.getZoom();
100
			if (zoom > 12){
101
				$("#showCityBtn").show();
102
				$("#showCountryBtn").hide();
103
			}
104
			else if ((zoom <= 12) && (zoom > 7)){
105
				$("#showCityBtn").hide();
106
				$("#showCountryBtn").show();
107
			}
108
			else {
109
				$("#showCityBtn").hide();
110
				$("#showCountryBtn").hide();
111
			}
112
		});
113

  
114

  
115
	}
116

  
117
	var markers = new Array();
118
	function placeMarkers() {
119
		$.get(
120
			pinsUrl,
121
			function(data) {
122
				$.each(
123
					data,
124
					function(index, jsonMarker) {
125
						var marker = createMarker(jsonMarker);
126
						if (marker) {
127
							bounds.extend(marker.position);
128
							markers.push(marker);
129
							google.maps.event.addListener(
130
								marker,
131
								'click',
132
								function() {
133
									infoWindow.setContent(jsonMarker.text);
134
									infoWindow.open(
135
										map,
136
										marker
137
									);
138
								}
139
							);
140
						}
141
					}
142
				);
143
				var mcOptions = {
144
					gridSize : 60,
145
					maxZoom : null,
146
					styles : styles
147
				};
148

  
149
				var markerCluster = new MarkerClusterer(
150
					map,
151
					markers,
152
					mcOptions
153
				);
154
				map.fitBounds(bounds);
155
			}
156
		);
157
	}
158

  
159
	function createMarker(markerObj) {
160
		var latLng = new google.maps.LatLng(markerObj.lat, markerObj.lng);
161
		var marker = new google.maps.Marker({
162
			'position' : latLng,
163
			'map' : map,
164
			'icon' : image,
165
		});
166
		return marker
167
	}
168

  
169
	function clusterMarkers(markers) {
170
		var markerCluster = new MarkerClusterer(map, markers);
171
	}
172

  
173

  
174
	function geocode(position){
175
		addr = {};
176
		geocoder
177
		.geocode(
178
				{
179
					'latLng' : position
180
				},
181
				function(results, status) {
182
					if (status == google.maps.GeocoderStatus.OK) {
183
						if (results.length >= 1) {
184
							for ( var ii = 0; ii < results[0].address_components.length; ii++) {
185
								var street_number = route = street = city = state = zipcode = country = formatted_address = '';
186
								var types = results[0].address_components[ii].types
187
										.join(",");
188
								if (types == "sublocality,political"
189
										|| types == "locality,political"
190
										|| types == "neighborhood,political"
191
										|| types == "political") {
192
									addr.city = (city == '' || types == "locality,political") ? results[0].address_components[ii].long_name
193
											: city;
194
								}
195
								if (types == "country,political") {
196
									addr.country = results[0].address_components[ii].long_name;
197
								}
198
							}
199
						}
200
					}
201
				});
202
	}
203

  
204
	function codeAddress(address) {
205
	    geocoder.geocode( { 'address': address}, function(results, status) {
206
	      if (status == google.maps.GeocoderStatus.OK) {
207
	        map.setCenter(results[0].geometry.location);
208
	    	map.fitBounds(results[0].geometry.bounds)
209
	      } else {
210
	        //alert("Geocode was not successful for the following reason: " + status);
211
	      }
212
	    });
213
	  }
214

  
215
	function HomeControl(controlDiv, map) {
216

  
217
		  // Set CSS styles for the DIV containing the control
218
		  // Setting padding to 5 px will offset the control
219
		  // from the edge of the map.
220
		  controlDiv.style.padding = '5px';
221

  
222
		  // Set CSS for the control border.
223
		  var controlUI = document.createElement('button');
224
		  controlUI.className='btn btn-warning roundButton';
225
		  controlUI.id = "showCityBtn";
226
		  extraCSS = 'background-image: url(' + cityImg +');background-position: center center; background-repeat: no-repeat;';
227
		  controlUI.style.cssText='display:none; cursor:pointer; white-space:nowrap; position:absolute; '+extraCSS;
228
		  controlUI.title = "City View";
229

  
230
		  // Set CSS for the control border.
231
		  var controlUI2 = document.createElement('button');
232
		  controlUI2.className='btn btn-warning roundButton';
233
		  controlUI2.id = "showCountryBtn";
234
		  extraCSS2 = 'background-image: url('+ countryImg + ');background-position: center center; background-repeat: no-repeat;';
235
		  controlUI2.style.cssText='display:none; cursor:pointer; white-space:nowrap; position:absolute; '+extraCSS2;
236
		  controlUI2.title = "Country View";
237

  
238
		  controlDiv.appendChild(controlUI);
239
		  controlDiv.appendChild(controlUI2);
240

  
241
		  // Setup the click event listeners: simply set the map to Chicago.
242
		  google.maps.event.addDomListener(controlUI, 'click', function() {
243
		    codeAddress(addr.city+','+addr.country);
244
		  });
245
		  google.maps.event.addDomListener(controlUI2, 'click', function() {
246
			    codeAddress(addr.country);
247
			  });
248

  
249
		}
250

  
251
	$(document).ready(function() {
252
		mapDiv = $('#map_canvas');
253
		lat = mapDiv.data('center-lat');
254
		lng = mapDiv.data('center-lng');
255
		lat = parseFloat(lat.toString().replace(",","."));
256
		lng = parseFloat(lng.toString().replace(",","."));
257
		latlng = new google.maps.LatLng(lat,lng);
258
		group = mapDiv.data('group');
259
		pinImg = mapDiv.data('pin');
260
		pinsUrl = mapDiv.data('url');
261
		cityImg = mapDiv.data('city');
262
		countryImg = mapDiv.data('country');
263
		styles = [ {
264
			url : group,
265
			height : 54,
266
			width : 63,
267
			textColor : '#ffffff',
268
			textSize : 11
269
		}, {
270
			url : group,
271
			height : 54,
272
			width : 63,
273
			textColor : '#ffffff',
274
			textSize : 11
275
		}, {
276
			url : group,
277
			height : 54,
278
			width : 63,
279
			textColor : '#ffffff',
280
			textSize : 11
281
		} ];
282
		initialize();
283
		marks = placeMarkers();
284
		clusterMarkers(marks);
285
	});

Also available in: Unified diff