community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r894269 - in /comdev/nearby_people: nearby/foaf.py templates/people.html
Date Mon, 28 Dec 2009 23:05:39 GMT
Author: rgardler
Date: Mon Dec 28 23:05:38 2009
New Revision: 894269

URL: http://svn.apache.org/viewvc?rev=894269&view=rev
Log:
Grab depiction details from the FOAF and render it in the info overlay

Modified:
    comdev/nearby_people/nearby/foaf.py
    comdev/nearby_people/templates/people.html

Modified: comdev/nearby_people/nearby/foaf.py
URL: http://svn.apache.org/viewvc/comdev/nearby_people/nearby/foaf.py?rev=894269&r1=894268&r2=894269&view=diff
==============================================================================
--- comdev/nearby_people/nearby/foaf.py (original)
+++ comdev/nearby_people/nearby/foaf.py Mon Dec 28 23:05:38 2009
@@ -66,6 +66,7 @@
             lat  = None
             long = None
             projects = []
+            depiction = None
 
             if uri.startswith(PEOPLE_FOAF_NAMESPACE):
                 file = os.path.join(PEOPLE_FOAF_PATH, uri.replace(PEOPLE_FOAF_NAMESPACE,""))
@@ -77,6 +78,7 @@
                 latN  = foaf.getElementsByTagNameNS(NS_GEO,"lat")
                 uidN = foaf.getElementsByTagNameNS(NS_FOAF,"Person")
                 currentProjectsN = foaf.getElementsByTagNameNS(NS_FOAF,"currentProject")
+                depictionN = foaf.getElementsByTagNameNS(NS_FOAF,"depiction")
                 if surnameN:
                     surname = surnameN[0].firstChild.data
                 if nameN:
@@ -87,6 +89,8 @@
                     lat = latN[0].firstChild.data
                 if uidN:
                     uid = uidN[0].getAttribute("rdf:ID")
+                if depictionN:
+                    depiction = depictionN[0].getAttribute("rdf:resource")
             else:
                 # TODO - external FOAF support
                 # ....
@@ -109,7 +113,6 @@
                         long = "-%s" % long
 
             if currentProjectsN:
-                print "start"
                 for projectN in currentProjectsN:
                     projectName = projectN.getElementsByTagNameNS(NS_DOAP,"name")
                     if not projectName:
@@ -117,14 +120,13 @@
                     if projectName:
                         projects.append({"name": projectName[0].firstChild.data})
                 print projects
-                print "end"
-                print "\n"
 
             # Finish building up
             if name and surname and uid and lat and long:
                 self.people[name] = {
                     "name": name, "surname": surname, "uid":uid, 
-                    "latitude": lat, "longitude": long, "projects": projects
+                    "latitude": lat, "longitude": long, "projects": projects,
+                    "avatar": depiction
                 }
 
         self.updated_at = datetime.datetime.utcnow()

Modified: comdev/nearby_people/templates/people.html
URL: http://svn.apache.org/viewvc/comdev/nearby_people/templates/people.html?rev=894269&r1=894268&r2=894269&view=diff
==============================================================================
--- comdev/nearby_people/templates/people.html (original)
+++ comdev/nearby_people/templates/people.html Mon Dec 28 23:05:38 2009
@@ -39,7 +39,8 @@
                 projectNames.push("{{project.name}}");
             {% endfor %}
             marker = createMarker("{{person.name}}",{{person.latitude}},
-                         {{person.longitude}},"{{person.link}}", projectNames);
+                         {{person.longitude}},"{{person.link}}", projectNames,
+                         "{{person.avatar}}");
             map.addOverlay(marker);
             markers["{{person.uid}}"] = marker;
         {% endfor %}
@@ -56,12 +57,15 @@
     }
 });
 
-function createMarker(name,lat,lng,link,projects) {
+function createMarker(name,lat,lng,link,projects,avatar) {
 	var point = new GLatLng(lat,lng);
     var options = { title: name }; // appears when cursor hovers over marker
     var marker = new GMarker(point,options);
     GEvent.addListener(marker, "click", function() {
-      var msg = name + "<br \/>";
+      var msg = "<h3>" + name + "</h3>";
+      if (avatar != "None") {
+          msg = msg + "<img src='" + avatar + "' alt='Image of " + name + "'/>"; 
+      }
       msg = msg + " <ul>";
       for (var i = 0; i < projects.length; i++) {
     	  msg = msg + "<li>" + projects[i] + "</li>";



Mime
View raw message