community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r1745913 - in /comdev/nearby_people: nearby/foaf.py nearby/views.py templates/map.html
Date Sat, 28 May 2016 18:21:15 GMT
Author: nick
Date: Sat May 28 18:21:15 2016
New Revision: 1745913

URL: http://svn.apache.org/viewvc?rev=1745913&view=rev
Log:
Support getting everyone, and re-create the "all public committers" map with a few extra views

Modified:
    comdev/nearby_people/nearby/foaf.py
    comdev/nearby_people/nearby/views.py
    comdev/nearby_people/templates/map.html

Modified: comdev/nearby_people/nearby/foaf.py
URL: http://svn.apache.org/viewvc/comdev/nearby_people/nearby/foaf.py?rev=1745913&r1=1745912&r2=1745913&view=diff
==============================================================================
--- comdev/nearby_people/nearby/foaf.py (original)
+++ comdev/nearby_people/nearby/foaf.py Sat May 28 18:21:15 2016
@@ -39,6 +39,10 @@ class FOAF(object):
         self.updated_at = None
         self.warn_no_location = warn_no_location
 
+    def get_all(self):
+        self.ensure_data()
+        return self.people.values()
+
     def get_nearby(self, lat, long, rows = 10):
         self.ensure_data()
 
@@ -221,11 +225,14 @@ class FOAF(object):
             missing.append("long")
 
         if not missing:
+            # Create the phonebook link for the person
+            link = "http://home.apache.org/committer-index.html#%s" % uid
+            # Save the details
             self.people[name] = {
                 "name": name, "surname": surname, 
                 "uid":uid, "email": email,
                 "latitude": lat, "longitude": long, "projects": projects,
-                "avatar": depiction, "weblogs": weblogs
+                "avatar": depiction, "weblogs": weblogs, "link": link
             }
         else:
             if not self.warn_no_location and \

Modified: comdev/nearby_people/nearby/views.py
URL: http://svn.apache.org/viewvc/comdev/nearby_people/nearby/views.py?rev=1745913&r1=1745912&r2=1745913&view=diff
==============================================================================
--- comdev/nearby_people/nearby/views.py (original)
+++ comdev/nearby_people/nearby/views.py Sat May 28 18:21:15 2016
@@ -103,11 +103,6 @@ def retrieve_people_data(form):
    rows = int(search_data.get("rows", form.fields["rows"].initial))
    people = foaf.get_nearby(search_latitude, search_longitude, rows)
 
-   # Work out the people.apache.org links for people
-   for d,person in people:
-      person["link"] = "http://people.apache.org/list_%s.html#%s" % \
-             (person["surname"][0], person["uid"])
-
    # Work out our zoom
    min_lat = min( [float(d[1]["latitude"]) for d in people]+[search_latitude] )
    max_lat = max( [float(d[1]["latitude"]) for d in people]+[search_latitude] )
@@ -150,4 +145,5 @@ def find_people_json(request):
 
 def all_people(request):
    "Map of all committers with public locations"
-   return HttpResponse("TODO", mimetype=mimetypes["text"])
+   data = { "gmaps_key": GMAPS_KEY, "people": all_public_foaf.get_all() }
+   return render(request, "map.html", data)

Modified: comdev/nearby_people/templates/map.html
URL: http://svn.apache.org/viewvc/comdev/nearby_people/templates/map.html?rev=1745913&r1=1745912&r2=1745913&view=diff
==============================================================================
--- comdev/nearby_people/templates/map.html (original)
+++ comdev/nearby_people/templates/map.html Sat May 28 18:21:15 2016
@@ -2,8 +2,8 @@
 {% load distances %}
 {% load emails %}
 
-{% block title %}- Public Committers{% endblock %}
-{% block heading %}Apache Public Committers{% endblock %}
+{% block title %}- Public Committers Locations{% endblock %}
+{% block heading %}Apache Public Committers Map{% endblock %}
 {% block bodyclass %}people{% endblock %}
 {% block extrahead %}
 
@@ -18,23 +18,43 @@
 var markers = [];
 var map;
 
+function global() {
+    map.setZoom(1);
+    map.panTo(new GLatLng(0, 0));
+}
+function europe() {
+    map.setZoom(3);
+    map.panTo(new GLatLng(50.000, 5.0000));
+}
+function namer() {
+    map.setZoom(3);
+    map.panTo(new GLatLng(37.000, -93.0000));
+}
+function samer() {
+    map.setZoom(3);
+    map.panTo(new GLatLng(-20.000, -65.0000));
+}
+function africa() {
+    map.setZoom(3);
+    map.panTo(new GLatLng(0.000, 20.0000));
+}
+function asia() {
+    map.setZoom(3);
+    map.panTo(new GLatLng(35.000, 102.0000));
+}
+function aus() {
+    map.setZoom(3);
+    map.panTo(new GLatLng(-25.000, 137.0000));
+}
+
 $(document).ready(function(){
 	if (GBrowserIsCompatible()) {
 		map = new GMap2(document.getElementById('map'));
 		map.addControl(new GLargeMapControl());
-        map.setCenter(new GLatLng({{center_lat}}, {{center_long}}), 14);
-
-        // Zoom to roughly the right place
-        map.panTo(new GLatLng( {{center_lat}}, {{center_long}} ));
-        map.setZoom(
-             map.getBoundsZoomLevel(new GLatLngBounds(
-                    new GLatLng( {{bl_lat}} - 0.05, {{bl_long}} - 0.05 ),
-                    new GLatLng( {{tr_lat}} + 0.05, {{tr_long}} + 0.05 )
-             ))
-        );
+      global();
 
-        // Add our markers
-        {% for dist, person in people %}
+      // Add our markers
+      {% for person in people %}
             var projectNames = new Array();
             {% for project in person.projects %}
                 projectNames.push("{{project.name}}");
@@ -44,18 +64,8 @@ $(document).ready(function(){
                          "{{person.avatar}}","{{person.email|emailformat}}");
             map.addOverlay(marker);
             markers["{{person.uid}}"] = marker;
-        {% endfor %}
-
-        // Add the search marker
-        search_icon = new GIcon(G_DEFAULT_ICON);
-        search_icon.image = "http://www.google.com/intl/en_us/mapfiles/ms/icons/green-dot.png";
-        search_icon.iconSize = GSize(32,32);
-        search_point = new GMarker(
-           new GLatLng({{location.latitude}},{{location.longitude}}),
-           search_icon, false
-        );
-        map.addOverlay(search_point);
-    }
+      {% endfor %}
+   }
 });
 
 function createMarker(name,lat,lng,link,projects,avatar,email) {
@@ -65,7 +75,7 @@ function createMarker(name,lat,lng,link,
     GEvent.addListener(marker, "click", function() {
       var msg = "<h3>" + name + "</h3>";
       if (avatar != "None") {
-          msg = msg + "<img src='" + avatar + "' alt='Image of " + name + "'/>"; 
+          msg = msg + "<img src='" + avatar + "' alt='Image of " + name + "'/>";
       }
       msg = msg + " <ul>";
       for (var i = 0; i < projects.length; i++) {
@@ -90,7 +100,6 @@ function showDetail(uid) {
 	map.panTo(markers[uid].getPoint())
     GEvent.trigger(markers[uid], "click");
 }
-
 //-->
 </script>
 <style type="text/css">
@@ -109,31 +118,20 @@ function showDetail(uid) {
 {% endblock %}
 {% block content %}
 
-<h1>TODO - Update this to match the old https://people.apache.org/map.html</h1>
+<p>This map shows locations of those committers within the ASF who have 
+ added their locations.</p>
+<p>Predefined views: 
+ <input type="button" value="Worldwide" onClick="global()"/>
+ <input type="button" value="Europe" onClick="europe()"/>
+ <input type="button" value="North America" onClick="namer()"/>
+ <input type="button" value="South America" onClick="samer()"/>
+ <input type="button" value="Africa" onClick="africa()"/>
+ <input type="button" value="Asia" onClick="asia()"/>
+ <input type="button" value="Australasia" onClick="aus()"/>
+</p>
 
-{% if people %}
-	{% if large_distance %}
-		<p>Sorry, there isn't anyone all that near to you. Below is a 
-		list of people you may wish to visit when travelling futher 
-		afield.</p>
-	{% endif %}
-
-	<table id="people">
-	  {% for dist, person in people %}
-		<tr>
-		  <td><a href="javascript:showDetail('{{person.uid}}')">{{person.name}}</a></td>
-		  <td>{{dist|distanceformat}}</td>
-		</tr>
-	  {% endfor %}
-	</table>
+<div id="map"></div>
 
-	<div id="map"></div>
-	
-{% else %}
-	<p>Sorry, there's no-one near you :(</p>
-	<p>Maybe <a href="/pick_place/">try somewhere else?</a></p>
-	<p><i>Why not try searching for people near where you may be visiting
-     when on holiday, or next time you're travelling for work?</i></p>
-{% endif %}
+<p><i>TODO - Info</i></p>
 
 {% endblock %}



Mime
View raw message