Merge lp:~ronnie.vd.c/loco-team-portal/570613 into lp:loco-team-portal

Proposed by Ronnie on 2011-02-17
Status: Merged
Merged at revision: 393
Proposed branch: lp:~ronnie.vd.c/loco-team-portal/570613
Merge into: lp:loco-team-portal
Diff against target: 749 lines (+445/-157)
12 files modified
loco_directory/events/models.py (+3/-0)
loco_directory/events/urls.py (+1/-0)
loco_directory/events/views.py (+24/-2)
loco_directory/media/css/newstyle.css (+3/-15)
loco_directory/media/js/common.js (+0/-103)
loco_directory/media/js/jquery-ubuntu-maps.js (+373/-0)
loco_directory/templates/events/global_event_detail.html (+12/-1)
loco_directory/templates/events/global_event_detail.inc.html (+4/-1)
loco_directory/templates/venues/venue_detail.html (+3/-4)
loco_directory/templates/venues/venue_detail.inc.html (+7/-9)
loco_directory/templates/venues/venue_update.html (+12/-18)
loco_directory/venues/forms.py (+3/-4)
To merge this branch: bzr merge lp:~ronnie.vd.c/loco-team-portal/570613
Reviewer Review Type Date Requested Status
Michael Hall (community) 2011-02-17 Approve on 2011-02-17
Review via email: mp+50194@code.launchpad.net

Description of the change

Google Maps are added to the pages "global event" and "venue add/update/details". The markers cant be clicked at the moment.

To post a comment you must log in.
384. By Ronnie on 2011-02-17

Added translation tags

Michael Hall (mhall119) wrote :

Pure awesome

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'loco_directory/events/models.py'
2--- loco_directory/events/models.py 2011-01-18 20:38:55 +0000
3+++ loco_directory/events/models.py 2011-02-17 17:57:17 +0000
4@@ -107,6 +107,9 @@
5
6 def random_5_attendees(self):
7 return Attendee.objects.filter(event__id__exact=self.id).order_by('?')[5:]
8+
9+ def has_location(self):
10+ return self.filter(venue__longitude__isnull=False, venue__latitude__isnull=False)
11
12 class TeamEvent(BaseEvent):
13 """
14
15=== modified file 'loco_directory/events/urls.py'
16--- loco_directory/events/urls.py 2010-12-19 21:25:01 +0000
17+++ loco_directory/events/urls.py 2011-02-17 17:57:17 +0000
18@@ -22,6 +22,7 @@
19 url(r'^global/(?P<global_event_id>\d+)/detail/$', 'events.views.global_event_detail', name='global-event-detail'),
20 url(r'^global/(?P<global_event_id>\d+)/delete/$', 'events.views.global_event_delete', name='global-event-delete'),
21 url(r'^global/(?P<global_event_id>\d+)/update/$', 'events.views.global_event_update', name='global-event-update'),
22+ url(r'^global/(?P<global_event_id>\d+)/locations/$', 'events.views.global_event_locations', name='global-event-locations'),
23 url(r'^global/add/$', 'events.views.global_event_new', name='global-event-new'),
24
25 )
26
27=== modified file 'loco_directory/events/views.py'
28--- loco_directory/events/views.py 2011-02-02 17:40:39 +0000
29+++ loco_directory/events/views.py 2011-02-17 17:57:17 +0000
30@@ -3,6 +3,7 @@
31 from django.shortcuts import render_to_response
32 from django.shortcuts import get_object_or_404
33 from django.contrib.auth.decorators import login_required
34+from django.utils import simplejson
35 from django.utils.translation import ugettext as _
36 from django.core.urlresolvers import reverse
37
38@@ -471,5 +472,26 @@
39 return redirect( global_event_object )
40
41
42-
43-
44+def global_event_locations(request, global_event_id):
45+ """
46+ the longitude and latitude global event
47+ """
48+ global_event_object = get_object_or_404(GlobalEvent, pk=global_event_id)
49+ locations = []
50+ for event in global_event_object.teamevent_set.has_location():
51+ location = {}
52+ location['url'] = event.get_absolute_url()
53+ location['title'] = event.name
54+ # TODO: create an separate view with template for the content
55+ location['content'] = '<p>Location: <a href="%s">%s</a></p><p>Start date: %s</p><p>End date: %s</p>' % (event.get_absolute_url(),
56+ event.venue.name,
57+ str(event.date_begin),
58+ str(event.date_end))
59+ location['lng'] = event.venue.longitude
60+ location['lat'] = event.venue.latitude
61+ locations.append(location)
62+
63+ json = simplejson.dumps(locations)
64+
65+ return HttpResponse(json)
66+
67
68=== modified file 'loco_directory/media/css/newstyle.css'
69--- loco_directory/media/css/newstyle.css 2011-02-03 01:43:39 +0000
70+++ loco_directory/media/css/newstyle.css 2011-02-17 17:57:17 +0000
71@@ -25,21 +25,9 @@
72 white-space: nowrap;
73 }
74
75-#venue-map-selector {
76- width: 400px;
77- height: 300px;
78- border: 1px solid #ccc;
79- position: absolute;
80- right: 30px;
81- top: 40px;
82-}
83-#venue-map {
84- width: 400px;
85- border: 1px solid #CCC;
86- bottom: 10px;
87- float: right;
88- height: 300px;
89- margin-right: 10px;
90+.minor-content.venue-map {
91+ min-height: 350px;
92+ margin-top: 60px;
93 }
94
95 #main-content {
96
97=== added file 'loco_directory/media/img/ajax-loader.gif'
98Binary files loco_directory/media/img/ajax-loader.gif 1970-01-01 00:00:00 +0000 and loco_directory/media/img/ajax-loader.gif 2011-02-17 17:57:17 +0000 differ
99=== added file 'loco_directory/media/img/marker.png'
100Binary files loco_directory/media/img/marker.png 1970-01-01 00:00:00 +0000 and loco_directory/media/img/marker.png 2011-02-17 17:57:17 +0000 differ
101=== removed file 'loco_directory/media/js/common.js'
102--- loco_directory/media/js/common.js 2010-06-09 01:36:18 +0000
103+++ loco_directory/media/js/common.js 1970-01-01 00:00:00 +0000
104@@ -1,103 +0,0 @@
105-//Click Control to get lonlat values. trigger function set the values
106-OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
107- defaultHandlerOptions: {
108- 'single': true,
109- 'double': false,
110- 'pixelTolerance': 0,
111- 'stopSingle': false,
112- 'stopDouble': false
113- },
114-
115- initialize: function(options) {
116- this.handlerOptions = OpenLayers.Util.extend(
117- {}, this.defaultHandlerOptions
118- );
119- OpenLayers.Control.prototype.initialize.apply(
120- this, arguments
121- );
122- this.handler = new OpenLayers.Handler.Click(
123- this, {
124- 'click': this.trigger
125- }, this.handlerOptions
126- );
127- },
128-
129- trigger: function(e) {
130- var lonlat = map.getLonLatFromViewPortPx(e.xy);
131- $("#id_longitude").val(lonlat.lon)
132- $("#id_latitude").val(lonlat.lat)
133- map.markers.erase();
134- //alert("You clicked near " + lonlat.lat + " N, " + lonlat.lon + " E");
135- }
136-
137-});
138-//function to add markers to map
139-function addMarker(layer, lon, lat, popupContentHTML) {
140- var ll = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
141- var feature = new OpenLayers.Feature(layer, ll);
142- feature.closeBox = true;
143- feature.popupClass = OpenLayers.Class(OpenLayers.Popup.FramedCloud, { minSize: new OpenLayers.Size(200, 100) });
144- feature.data.popupContentHTML = popupContentHTML;
145- feature.data.overflow = "hidden";
146-
147- var marker = new OpenLayers.Marker(ll);
148- marker.feature = feature;
149-
150- var markerClick = function(evt) {
151- if (this.popup == null) {
152- this.popup = this.createPopup(this.closeBox);
153- map.addPopup(this.popup);
154- this.popup.show();
155- } else {
156- this.popup.toggle();
157- }
158- OpenLayers.Event.stop(evt);
159- };
160- marker.events.register("mousedown", feature, markerClick);
161-
162- layer.addMarker(marker);
163-}
164-
165-//openlayers map
166-var map;
167-function showmap(divid, select, lon, lat, htmltext){
168- map = new OpenLayers.Map(divid);
169- map.addControl(new OpenLayers.Control.LayerSwitcher());
170- var gphy = new OpenLayers.Layer.Google(
171- "Google Physical",
172- {type: G_PHYSICAL_MAP}
173- );
174- var gmap = new OpenLayers.Layer.Google(
175- "Google Streets", // the default
176- {numZoomLevels: 20}
177- );
178- var ghyb = new OpenLayers.Layer.Google(
179- "Google Hybrid",
180- {type: G_HYBRID_MAP, numZoomLevels: 20}
181- );
182- var gsat = new OpenLayers.Layer.Google(
183- "Google Satellite",
184- {type: G_SATELLITE_MAP, numZoomLevels: 22}
185- );
186- var markers = new OpenLayers.Layer.Markers("Markers Layer");
187-
188- map.addLayers([gphy, ghyb, gsat, markers]);
189- if (lon === undefined && lat === undefined) {
190- map.setCenter(new OpenLayers.LonLat(0, 0), 0);
191- } else {
192- for (i=0;i<lon.length;i++) {
193- addMarker(markers, lon[i], lat[i], htmltext[i]);
194- }
195- var lonLat = new OpenLayers.LonLat(lon[0], lat[0]).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
196- map.setCenter (lonLat, 6);
197- }
198- //map.zoomToMaxExtent();
199- if (select) {
200- var click = new OpenLayers.Control.Click();
201- map.addControl(click);
202- click.activate();
203- }
204-
205-
206-}
207-
208
209=== added file 'loco_directory/media/js/jquery-ubuntu-maps.js'
210--- loco_directory/media/js/jquery-ubuntu-maps.js 1970-01-01 00:00:00 +0000
211+++ loco_directory/media/js/jquery-ubuntu-maps.js 2011-02-17 17:57:17 +0000
212@@ -0,0 +1,373 @@
213+/*
214+ * jQuery Google Map Plugin 0.2.3
215+ * https://wiki.ubuntu.com/ubuntu-django-foundations/map
216+ * Requires jQuery 1.4.2
217+ *
218+ * Copyright 2011, Ronnie van den Crommenacker
219+ * Dual licensed under the MIT or GPL Version 2 licenses.
220+ * http://jquery.org/license
221+ */
222+
223+(function ($) {
224+ $.fn.extend({
225+ showLocations: function (options) {
226+ var defaults = {
227+ markers_url: null, // http://link/to/json/markers or /link/to/json/markers
228+ markers_list: null, // [ {lat: 0.345, lng: 0.3456}, {lat: 44.345, lng: 34.3456} ]
229+ position_name: {
230+ lat: 'lat', // { lat: 0.4567, lng: 0.2345 }
231+ lng: 'lng' // { lat: 0.4567, lng: 0.2345 }
232+ },
233+ marker_content_url: null, // The url to load when clicked on a marker
234+ marker_content_tmpl: null, // The template to load when clicked on a marker
235+ mapOptions: {
236+ zoom: 2,
237+ center: new google.maps.LatLng(22, 12),
238+ mapTypeId: google.maps.MapTypeId.ROADMAP,
239+ mapTypeControl: false
240+ },
241+ user_location_zoom: 7, // use null to disable this feature
242+ single_marker_zoom: 7, // the zoomlevel. use null to disable
243+ ajax_load_error: '<p>The page could not be loaded</p>',
244+ ajax_load_icon: '/ubuntu-website/media/images/ajax-loader.gif',
245+ marker_icon: null,
246+ cluster_tmpl: null,
247+ filter: null, //[ { element: $('...'), attrs: { attr: value }}, { element: $('...'), attrs: { attr: value }} ]
248+ mcOptions: { gridSize: 40, maxZoom: 10, zoomOnClick: false//, styles: [
249+ //{ url: 'images/supportCluster1.png', height: 48, width: 48, opt_anchor: [16, 0], opt_textColor: '#ffffff', opt_textSize: 10 }, /* 2-9 members */
250+ //{ url: 'images/supportCluster2.png', height: 64, width: 64, opt_anchor: [24, 0], opt_textColor: '#ffffff', opt_textSize: 11 }, /* 10-99 members */
251+ //{ url: 'images/supportCluster3.png', height: 96, width: 96, opt_anchor: [32, 0], opt_textColor: '#ffffff', opt_textSize: 12 }, /* 100-999 members */
252+ //{ url: 'images/supportCluster4.png', height: 128, width: 128, opt_anchor: [32, 0], opt_textColor: '#ffffff', opt_textSize: 12 } /* 1000+ members */
253+ //]
254+ }
255+ },
256+ // Add the window where the details are shown when clicked on a marker
257+ infowindow = new google.maps.InfoWindow();
258+
259+ options = $.extend(defaults, options);
260+
261+ // TODO: rewrite this one
262+ function getAjaxLoader() {
263+ var ajaximg = $('<img src="' + options.ajax_load_icon + '" />')
264+ .attr({'style': 'display:inline-block;vertical-align:middle;margin-right:10px;'}),
265+ ajaxtxt = $('<p>')
266+ .attr({'style': 'display:inline-block;vertical-align:middle;'})
267+ .html('Retrieving data<br />from server...'),
268+ wrapper = $('<div>')
269+ .attr({'style': 'margin:auto;width:130px;'});
270+ return wrapper.append(ajaximg).append(ajaxtxt)[0];
271+ }
272+
273+ infowindow.show = function (html, pos) {
274+ this.setContent(html);
275+ this.setPosition(pos);
276+ this.open(this.map);
277+ };
278+ infowindow.ajaxloader = null;
279+ infowindow.showLoader = function (pos) {
280+ // Set a temporary loader while the data is retreved from the server
281+ if (this.ajaxloader === null) {
282+ // TODO: allow user defined ajax loader
283+ this.ajaxloader = getAjaxLoader();
284+ }
285+ this.show(this.ajaxloader, pos);
286+ };
287+ infowindow.showTemplate = function (url, data, pos) {
288+ var $data = data,
289+ $pos = pos,
290+ ifw = this;
291+
292+ if (!$.tmpl) {
293+ alert('jQuery.tmpl is not installed\nYou can download here:\nhttp://github.com/jquery/jquery-tmpl');
294+ return false;
295+ }
296+
297+ this.showLoader(pos);
298+ $.ajax({
299+ url: url,
300+ dataType: 'html',
301+ success: function (template) {
302+ ifw.show($(template).tmpl($data)[0], $pos);
303+ },
304+ error: function () {
305+ ifw.show(options.ajax_load_error, $pos);
306+ }
307+ });
308+ };
309+ infowindow.showHTML = function (url, pos) {
310+ var $pos = pos,
311+ ifw = this;
312+
313+ this.showLoader(pos);
314+ //TODO: Check for better same-origin in url
315+ if (url.slice(0, 4) == 'http'){
316+ ifw.show($('<iframe>').attr('src', url)[0], $pos);
317+ } else {
318+ $.ajax({
319+ url: url,
320+ dataType: 'html',
321+ success: function (html) {
322+ ifw.show(html, $pos);
323+ },
324+ error: function () {
325+ ifw.show(options.ajax_load_error, $pos);
326+ }
327+ });
328+ }
329+ };
330+
331+ // Constructs an url with ${...} together with data to a normal url
332+ function constructUrl(url, marker) {
333+ var pattern = /\$\{[\w\d]+\}/g, // match pattern for ${....}
334+ url_match = url.match(pattern), // Matches the url for ${...} and returns a list of matches
335+ param = null, // Used for getting a specific param from the marker
336+ tag = null; // The tags in the match pattern
337+
338+ for (tag in url_match) {
339+ if (url_match.hasOwnProperty(tag)) {
340+ param = url_match[tag];
341+ url = url.replace(param, marker[param.slice(2, param.length - 1)]);
342+ }
343+ }
344+ return url;
345+ }
346+
347+ // Function executed when clicked on a cluster object
348+ function clusterClicked(cluster) {
349+ if (options.cluster_tmpl) {
350+ infowindow.showTemplate(options.cluster_tmpl, {marker_list: cluster[0].markers_}, cluster[0].getCenter());
351+ }
352+ }
353+
354+ // Function that is executed when user clicks on a marker
355+ function markerClicked() {
356+ var url = null;
357+
358+ if (options.marker_content_url) {
359+ url = constructUrl(options.marker_content_url, this);
360+ infowindow.showHTML(url, this.position);
361+ } else if (options.marker_content_tmpl) {
362+ infowindow.showTemplate(options.marker_content_tmpl, {marker: this}, this.position);
363+ }
364+ }
365+
366+ // Create from json data the google.maps.Marker and add them to the markercluster (mc)
367+ // Then center the map if there is only one cluster and options.single_marker_zoom is true
368+ function createMarkers(map, mc, markers) {
369+ var marker_list = [], // A list of gmakers
370+ marker = null, // The json of a marker
371+ gmarker = null, // The actual google.maps.Marker() type
372+ idx = null, // Index
373+ lat = options.position_name.lat, // The parameter that contains the latitude
374+ lng = options.position_name.lng; // The parameter that contains the longitude
375+
376+ if (markers[0].fields) {
377+ // Django model
378+ // Use django pk and fields parameters
379+ for (idx in markers) {
380+ if (markers.hasOwnProperty(idx)) {
381+ marker = markers[idx].fields;
382+ marker.pk = markers[idx].pk;
383+ marker.position = new google.maps.LatLng(marker[lat], marker[lng]);
384+ if (!marker.icon && options.marker_icon) {
385+ marker.icon = options.marker_icon;
386+ }
387+ gmarker = new google.maps.Marker(marker);
388+ google.maps.event.addDomListener(gmarker, 'click', markerClicked);
389+ marker_list.push(gmarker);
390+ }
391+ }
392+
393+ } else {
394+ // Use normal parameters
395+ for (idx in markers) {
396+ if (markers.hasOwnProperty(idx)) {
397+ marker = markers[idx];
398+ marker.position = new google.maps.LatLng(marker[lat], marker[lng]);
399+ if (!markers[idx].icon && options.marker_icon) {
400+ marker.icon = options.marker_icon;
401+ }
402+ gmarker = new google.maps.Marker(marker);
403+ google.maps.event.addDomListener(gmarker, 'click', markerClicked);
404+ marker_list.push(gmarker);
405+ }
406+ }
407+ }
408+ mc.addMarkers(marker_list);
409+
410+ // If there is only one marker
411+ if (options.single_marker_zoom && marker_list.length === 1) {
412+ // Make sure the map is initialized
413+ // FIXME: Look for an map.init event
414+ setTimeout(function () {
415+ map.setCenter(mc.getMarkers()[0].getPosition());
416+ map.setZoom(options.single_marker_zoom);
417+ }, 100);
418+ }
419+ }
420+
421+ return $(this).each(function (i, html_element) {
422+ var map = new google.maps.Map(html_element, options.mapOptions),
423+ markerCluster = new MarkerClusterer(map, [], options.mcOptions),
424+ filter = options.filter,
425+ filterer = null,
426+ index = null,
427+ pos = null;
428+
429+ // FIXME: Manually override the zoomOnClick because of this bug
430+ // http://www.devcomments.com/V3-MarkerClusterer-zoomOnClick-issue-at255452.htm
431+ markerCluster.zoomOnClick_ = false;
432+
433+ // Attach the info window to the curernt map
434+ infowindow.map = map;
435+
436+ // When clicked on a cluster, call the event
437+ google.maps.event.addListener(markerCluster, 'clusterclick', clusterClicked);
438+
439+ // Try W3C Geolocation (Preferred)
440+ // Ask the user for their location and set the map to it
441+ if (options.user_location_zoom && navigator.geolocation) {
442+ navigator.geolocation.getCurrentPosition(function (position) {
443+ pos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
444+ map.setCenter(pos);
445+ map.setZoom(options.user_location_zoom);
446+ });
447+ }
448+
449+ // Load the list of markers into the map
450+ if (options.markers_url) {
451+ $.get(options.markers_url, function (markers) {
452+ createMarkers(map, markerCluster, markers);
453+ }, 'json');
454+ } else if (options.markers_list) {
455+ createMarkers(map, markerCluster, options.markers_list);
456+ }
457+
458+ if (filter) {
459+ filterer = (function (markerCluster) {
460+ var mc = markerCluster,
461+ markers = mc.getMarkers();
462+ return {
463+ addFilter: function (filter) {
464+ filter.element.click(function (event) {
465+ var attrs = filter.attrs,
466+ visible_markers = [],
467+ m = null,
468+ a = null;
469+
470+ event.preventDefault();
471+
472+ for (m in markers) {
473+ if (markers.hasOwnProperty(m)) {
474+ marker = markers[m];
475+ for (a in attrs) {
476+ if (attrs.hasOwnProperty(a)) {
477+ if (marker[a] === attrs[a]) {
478+ visible_markers.push(marker);
479+ }
480+ }
481+ }
482+ }
483+ }
484+ // If there are no filter options, show all markers
485+ if (!a) {
486+ visible_markers = markers;
487+ }
488+ mc.clearMarkers();
489+ mc.addMarkers(visible_markers, false);
490+ });
491+ }
492+ };
493+ }(markerCluster));
494+ for (index in filter) {
495+ if (filter.hasOwnProperty(index)) {
496+ filterer.addFilter(filter[index]);
497+ }
498+ }
499+ }
500+ });
501+ },
502+ selectLocation: function (options) {
503+ var defaults = {
504+ html_lng: null,
505+ html_lat: null,
506+ marker_icon: null,
507+ markers: [],
508+ html_addr: null,
509+ mapOptions: {
510+ zoom: 4,
511+ center: new google.maps.LatLng(51.8211, 5.591),
512+ mapTypeId: google.maps.MapTypeId.ROADMAP,
513+ mapTypeControl: false
514+ }
515+ };
516+ options = $.extend(defaults, options);
517+
518+ function showPositionHTML(location) {
519+ if (options.html_lng && options.html_lat) {
520+ if (location.lat() && location.lng()) {
521+ options.html_lat.val(location.lat());
522+ options.html_lng.val(location.lng());
523+ }
524+ }
525+ }
526+
527+ function setMarker(map, location) {
528+ var marker = null;
529+
530+ if (options.markers.length) {
531+ marker = options.markers[0];
532+ marker.setPosition(location);
533+ marker.setAnimation(google.maps.Animation.DROP);
534+ } else {
535+ marker = new google.maps.Marker({
536+ map: map,
537+ position: location,
538+ draggable: true,
539+ animation: google.maps.Animation.DROP
540+ });
541+ if (options.marker_icon) {
542+ marker.icon = options.marker_icon;
543+ }
544+ options.markers.push(marker);
545+ google.maps.event.addListener(options.markers[0], 'mouseup', function () {
546+ showPositionHTML(marker.getPosition());
547+ });
548+ }
549+
550+ map.setCenter(location);
551+ showPositionHTML(marker.getPosition());
552+ }
553+
554+ return $(this).each(function (i, html_element) {
555+ var map = new google.maps.Map($(html_element)[0], options.mapOptions),
556+ geoCoder = new google.maps.Geocoder(),
557+ location = null;
558+
559+ if (options.html_addr) {
560+ options.html_addr.change(function () {
561+ var address = [];
562+ options.html_addr.each(function (i, item) {
563+ address.push(item.value);
564+ });
565+
566+ geoCoder.geocode({address: address.join(' ')}, function (results, status) {
567+ if (status === google.maps.GeocoderStatus.OK) {
568+ setMarker(map, results[0].geometry.location);
569+ }
570+ });
571+ });
572+ }
573+ google.maps.event.addListener(map, 'click', function (event) {
574+ setMarker(map, event.latLng);
575+ });
576+
577+ if (options.html_lat.val() && options.html_lng.val()) {
578+ location = new google.maps.LatLng(options.html_lat.val(), options.html_lng.val());
579+ setMarker(map, location);
580+ }
581+ });
582+
583+ }
584+ });
585+}(jQuery));
586
587=== modified file 'loco_directory/templates/events/global_event_detail.html'
588--- loco_directory/templates/events/global_event_detail.html 2010-12-19 21:25:01 +0000
589+++ loco_directory/templates/events/global_event_detail.html 2011-02-17 17:57:17 +0000
590@@ -1,8 +1,19 @@
591 {% extends "base.html" %}
592 {% load i18n %}
593
594-{% block extrahead %}{{block.super}}
595+{% block extrahead %}{{ block.super }}
596 <link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}/css/twidenash.css" />
597+ <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language={% trans 'en' %}&region={% trans 'US' %}"></script>
598+ <script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclusterer/1.0/src/markerclusterer_packed.js"></script>
599+ <script type="text/javascript" src="{{MEDIA_URL}}js/jquery-ubuntu-maps.js"></script>
600+ <script type="text/javascript">
601+ //<![CDATA[
602+ $(function(){
603+ $('#venue-map').showLocations({markers_url:'{% url global-event-locations global_event_id=global_event_object.id %}',
604+ marker_icon: '{{ MEDIA_URL }}/img/marker.png'});
605+ });
606+ //]]>
607+ </script>
608 {% endblock %}
609
610 {% block title %}{% trans global_event_object.name %} | {% trans "Ubuntu LoCo Team Directory" %} {% endblock %}
611
612=== modified file 'loco_directory/templates/events/global_event_detail.inc.html'
613--- loco_directory/templates/events/global_event_detail.inc.html 2011-02-03 14:26:00 +0000
614+++ loco_directory/templates/events/global_event_detail.inc.html 2011-02-17 17:57:17 +0000
615@@ -1,5 +1,6 @@
616 {% load i18n %}
617 {% block extrahead %}{{ block.super }}
618+
619 {% if global_event_object.pictag %}
620 <link rel="stylesheet" href="{{MEDIA_URL}}css/jquery.lightbox-0.5.css" type="text/css" media="screen" />
621 <script type="text/javascript" src="{{MEDIA_URL}}js/jquery.lightbox-0.5.min.js"></script>
622@@ -97,11 +98,13 @@
623 {% endif %}
624 </article>
625
626-<article class="main-content">
627+<article class="minor-content">
628 <h3>{% trans "Details" %}</h3>
629 {% include "events/global_event_detail_basic.inc.html" %}
630 </article>
631
632+<section id="venue-map" class="minor-content alone venue-map"></section>
633+
634 <hr class="divide" />
635
636 {% if global_event_object.teamevent_set.all %}
637
638=== modified file 'loco_directory/templates/venues/venue_detail.html'
639--- loco_directory/templates/venues/venue_detail.html 2010-11-20 17:25:50 +0000
640+++ loco_directory/templates/venues/venue_detail.html 2011-02-17 17:57:17 +0000
641@@ -4,10 +4,9 @@
642 {% block title %}{% trans venue_object.name %} | {% trans "Ubuntu LoCo Team Directory" %} {% endblock %}
643
644 {% block extrahead %}{{block.super}}
645-<script type="text/javascript" src="http://openlayers.org/api/OpenLayers.js"></script>
646-<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key={{ google_api_key }}" type="text/javascript"></script>
647-<script src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script>
648- <script type="text/javascript" src="{{MEDIA_URL}}/js/common.js"></script>
649+<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language={% trans 'en' %}&region={% trans 'US' %}"></script>
650+<script type="text/javascript" src="http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclusterer/1.0/src/markerclusterer_packed.js"></script>
651+<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery-ubuntu-maps.js"></script>
652 {% endblock %}
653
654 {% block sub_nav_links %}
655
656=== modified file 'loco_directory/templates/venues/venue_detail.inc.html'
657--- loco_directory/templates/venues/venue_detail.inc.html 2010-07-27 10:15:45 +0000
658+++ loco_directory/templates/venues/venue_detail.inc.html 2011-02-17 17:57:17 +0000
659@@ -4,18 +4,16 @@
660 <p>{% include "venues/venue_detail_basic.inc.html" %}</p>
661 </article>
662
663-<article id="venue-map" class="" style="min-height: 300px; border: 0px;">
664 {% if venue_object.longitude and venue_object.latitude %}
665+<article class="minor-content alone venue-map" id="venue-map" class="">
666 </article>
667 <script>
668- var lon = new Array();
669- var lat = new Array();
670- var htmltext = new Array();
671- lon[0] = {{ venue_object.longitude }}
672- lat[0] = {{ venue_object.latitude }}
673- htmltext[0] = "{{ venue_object.name }}"
674- var select = new Boolean(false);
675- showmap('venue-map', select, lon, lat, htmltext)
676+ $(function(){
677+ $('#venue-map').showLocations({
678+ markers_list: [{ lat: {{ venue_object.latitude }}, lng: {{ venue_object.longitude }} }],
679+ marker_icon: '{{ MEDIA_URL }}img/marker.png'
680+ });
681+ });
682 </script>
683 {% endif %}
684
685
686=== modified file 'loco_directory/templates/venues/venue_update.html'
687--- loco_directory/templates/venues/venue_update.html 2010-11-20 17:25:50 +0000
688+++ loco_directory/templates/venues/venue_update.html 2011-02-17 17:57:17 +0000
689@@ -8,24 +8,18 @@
690 {% endblock %}
691
692 {% block extrafooter %}
693-<script type="text/javascript"><!--
694- var lon = new Array();
695- var lat = new Array();
696- var htmltext = new Array();
697- var select = new Boolean(true);
698- {% if venue_object %}
699- lon[0] = $("#id_longitude").val()
700- lat[0] = $("#id_latitude").val()
701- htmltext[0] = "{{ venue_object.name }}"
702- showmap('venue-map-selector', select, lon, lat, htmltext)
703- {% else %}
704- showmap('venue-map-selector', select)
705- {% endif %}
706+<script type="text/javascript">
707+//<![CDATA[
708+ $(function(){
709+ $('#venue-map-selector').selectLocation({html_lng: $("#id_longitude"),
710+ html_lat: $("#id_latitude"),
711+ html_addr: $("#id_country, #id_spr, #id_city, #id_address"),
712+ marker_icon: '{{ MEDIA_URL }}img/marker.png'});
713
714-$(document).ready(function(){
715- $('span[rel*=help]').colorTip({color:'orange'});
716-});
717---></script>
718+ $('span[rel*=help]').colorTip({color:'orange'});
719+ });
720+//]]>
721+</script>
722 {% endblock %}
723
724 {% block content %}
725@@ -42,6 +36,6 @@
726 </form>
727 </article>
728
729-<div id="venue-map-selector" title="{% trans "Select venue position" %}">&nbsp;</div>
730+<section class="minor-content alone venue-map" id="venue-map-selector" title="{% trans "Select venue position" %}">&nbsp;</section>
731
732 {% endblock %}
733
734=== modified file 'loco_directory/venues/forms.py'
735--- loco_directory/venues/forms.py 2010-11-27 02:45:34 +0000
736+++ loco_directory/venues/forms.py 2011-02-17 17:57:17 +0000
737@@ -29,10 +29,9 @@
738 '/media/css/colortip-1.0-jquery.css',
739 )}
740 js = (
741- 'http://openlayers.org/api/OpenLayers.js',
742- 'http://maps.google.com/maps?file=api&amp;v=2&amp;key='+google_api_key ,
743- 'http://www.openstreetmap.org/openlayers/OpenStreetMap.js',
744- '/media/js/common.js',
745+ 'http://maps.google.com/maps/api/js?sensor=false&language=%(language)s&region=%(region)s' % {'language': _('en'), 'region': _('US')},
746+ 'http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclusterer/1.0/src/markerclusterer_packed.js',
747+ '/media/js/jquery-ubuntu-maps.js',
748 '/media/js/colortip-1.0-jquery.js',
749 )
750

Subscribers

People subscribed via source and target branches