]> dev.renevier.net Git - syp.git/blobdiff - js/syp.js
add links to syp homepage in attribution control
[syp.git] / js / syp.js
index c9f637aa78f615f4fed291c6e4daa11305dfa721..3228e62b5a7aeecbf70bb1f94c615b1b8aa13f94 100644 (file)
--- a/js/syp.js
+++ b/js/syp.js
@@ -1,6 +1,21 @@
 /* Copyright (c) 2009 Arnaud Renevier, Inc, published under the modified BSD
  * license. */
 
+OpenLayers.Control.SypAttribution = OpenLayers.Class (OpenLayers.Control.Attribution, {
+    updateAttribution: function() {
+        var attributions = ['propulsed by <a href="http://syp.renevier.net">syp</a>'];
+        if (this.map && this.map.layers) {
+            for(var i=0, len=this.map.layers.length; i<len; i++) {
+                var layer = this.map.layers[i];
+                if (layer.attribution && layer.getVisibility()) {
+                    attributions.push( layer.attribution );
+                }
+            }  
+            this.div.innerHTML = attributions.join(this.separator);
+        }
+    }
+});
+
 var SYP = {
     Settings: {
         MARKER_ICON: "openlayers/img/marker-blue.png",
@@ -20,7 +35,7 @@ var SYP = {
                 new OpenLayers.Control.Navigation(),
                 new OpenLayers.Control.PanZoom(),
                 new OpenLayers.Control.Permalink(),
-                new OpenLayers.Control.Attribution()
+                new OpenLayers.Control.SypAttribution()
             ],
             projection: new OpenLayers.Projection("EPSG:900913"),
             displayProjection: new OpenLayers.Projection("EPSG:4326")