[javascript][gmap] only use LabeledMarker in google maps when the extension is loaded
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Fri, 14 Nov 2008 19:02:07 +0100
changeset 78 079c4d11a616
parent 77 9e103ea52259
child 79 fd20ff4e8fa0
child 82 57f37f7af21b
[javascript][gmap] only use LabeledMarker in google maps when the extension is loaded
web/data/cubicweb.gmap.js
--- a/web/data/cubicweb.gmap.js	Fri Nov 14 11:52:11 2008 +0100
+++ b/web/data/cubicweb.gmap.js	Fri Nov 14 19:02:07 2008 +0100
@@ -50,25 +50,23 @@
     if(marker.icon[3]){
       icon.shadow4 =  marker.icon[3];
     }
-
-    var gmarker = new LabeledMarker(point, {
-      icon: icon,
-      title: marker.title,
-      labelText: uselabel?'<strong>' + i + '</strong>':'',
-      labelOffset: new GSize(2, -32)
-    });
+    if (typeof LabeledMarker == "undefined") {
+	var gmarker = new GMarker(point, {icon: icon,
+	title: marker.title});
+    } else {
+        var gmarker = new LabeledMarker(point, {
+          icon: icon,
+          title: marker.title,
+          labelText: uselabel?'<strong>' + i + '</strong>':'',
+          labelOffset: new GSize(2, -32)
+        });
+    }
     map.addOverlay(gmarker);
     GEvent.addListener(gmarker, 'click', function() {
       jQuery.post(marker.bubbleUrl, function(data) {
 	map.openInfoWindowHtml(point, data);
       });
     });
-  },
-
-  appendLegendItem: function(marker, i) {
-    var ul = this.legendBox.firstChild;
-    ul.appendChild(LI(null, [SPAN({'class': "itemNo"}, i),
-                             SPAN(null, marker.title)]));
   }
 
 });