[Commits] r1817 - in sandbox/cmoullet/ux/LayerAction: examples ux/widgets

commits at geoext.org commits at geoext.org
Tue Jan 26 12:21:44 CET 2010


Author: cmoullet
Date: 2010-01-26 12:21:44 +0100 (Tue, 26 Jan 2010)
New Revision: 1817

Modified:
   sandbox/cmoullet/ux/LayerAction/examples/LayerActionExample.html
   sandbox/cmoullet/ux/LayerAction/ux/widgets/GeoRSSLayerWindow.js
Log:
Only supported in OL trunk


Modified: sandbox/cmoullet/ux/LayerAction/examples/LayerActionExample.html
===================================================================
--- sandbox/cmoullet/ux/LayerAction/examples/LayerActionExample.html	2010-01-26 11:01:21 UTC (rev 1816)
+++ sandbox/cmoullet/ux/LayerAction/examples/LayerActionExample.html	2010-01-26 11:21:44 UTC (rev 1817)
@@ -5,7 +5,7 @@
         <script type="text/javascript" src="http://extjs.cachefly.net/builds/ext-cdn-771.js"></script>
         <link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-2.2.1/resources/css/ext-all.css" />
         <link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-2.2.1/examples/shared/examples.css" />
-        <script src="http://openlayers.org/api/2.8/OpenLayers.js"></script>
+        <script type="text/javascript" src="../../../trunk/openlayers/lib/OpenLayers.js"></script>
         <script type="text/javascript" src="../../../trunk/geoext/lib/GeoExt.js"></script>
         <script type="text/javascript" src="../ux/widgets/KMLLayerAction.js"></script>
         <script type="text/javascript" src="../ux/widgets/KMLLayerWindow.js"></script>

Modified: sandbox/cmoullet/ux/LayerAction/ux/widgets/GeoRSSLayerWindow.js
===================================================================
--- sandbox/cmoullet/ux/LayerAction/ux/widgets/GeoRSSLayerWindow.js	2010-01-26 11:01:21 UTC (rev 1816)
+++ sandbox/cmoullet/ux/LayerAction/ux/widgets/GeoRSSLayerWindow.js	2010-01-26 11:21:44 UTC (rev 1817)
@@ -86,6 +86,44 @@
                         style: this.rssstyle
                     });
                     this.map.addLayer(geoRSSLayer);
+
+                    var selectCtrl = new OpenLayers.Control.SelectFeature(geoRSSLayer, {
+                        autoActivate: true
+                    });
+                    selectCtrl.events.on({
+                        featurehighlighted: function(evt) {
+                            var feature = evt.feature;
+                            if (!feature._popup) {
+                                var tpl = "<h3>${title}</h3><br/><p>${desc}</p><br/><a target='_blank' href='${link}'>More informations</a>";
+                                feature._popup = new GeoExt.Popup({
+                                    html: OpenLayers.String.format(tpl, {
+                                        title: feature.attributes.title,
+                                        desc: feature.attributes.description,
+                                        link: feature.attributes.link
+                                    }),
+                                    feature: feature,
+                                    unpinnable: false,
+                                    width: 260,
+                                    listeners: {
+                                        close: function() {
+                                            this.unselectAll();
+                                        },
+                                        scope: selectCtrl
+                                    }
+                                });
+                            }
+                            feature._popup.show();
+                        },
+                        featureunhighlighted: function(evt) {
+                            var feature = evt.feature;
+                            if (feature._popup) {
+                                feature._popup.close();
+                                feature._popup = null;
+                            }
+                        }
+                    });
+
+                    this.map.addControl(selectCtrl); 
                     this.close();
                 },
                 scope:this



More information about the Commits mailing list