[Commits] r1706 - sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets

commits at geoext.org commits at geoext.org
Mon Jan 11 09:53:07 CET 2010


Author: cmoullet
Date: 2010-01-11 09:53:06 +0100 (Mon, 11 Jan 2010)
New Revision: 1706

Modified:
   sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js
Log:
Add absolute path to supporte remote usage


Modified: sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js
===================================================================
--- sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js	2010-01-11 08:40:08 UTC (rev 1705)
+++ sandbox/cmoullet/ux/GoogleEarthPanel/ux/widgets/GoogleEarthPanel.js	2010-01-11 08:53:06 UTC (rev 1706)
@@ -13,6 +13,20 @@
  */
 Ext.namespace('GeoExt.ux');
 
+/** private: property[scriptSource]
+ *  ``String``  Source of this script: complete URL
+ */
+var scriptSource = (function() {
+    var scripts = document.getElementsByTagName('script'),
+            script = scripts[scripts.length - 1];
+
+    if (script.getAttribute.length !== undefined) {
+        return script.src;
+    }
+
+    return script.getAttribute('src', -1);
+}());
+
 GeoExt.ux.GoogleEarthPanel = Ext.extend(Ext.Panel, {
 
     /** api: config[map]
@@ -378,15 +392,15 @@
                 // Vector layer
                 this.earthLayer = new OpenLayers.Layer.Vector("Google Earth Navigation");
                 this.map.addLayer(this.earthLayer);
-
+                var baseUrl = scriptSource.replace('/widgets/GoogleEarthPanel.js', '');
                 // Camera and lookAt points to display
                 this.features = [
                     new OpenLayers.Feature.Vector(null, {role: 'line'}, {strokeColor: '#ff0000',
                         strokeWidth: 3,
                         pointRadius: 6}),
                     new OpenLayers.Feature.Vector(null, {role: 'lookAt'}, {pointRadius: 8,
-                        fillColor: '#ff0000'}),
-                    new OpenLayers.Feature.Vector(null, {role: 'camera'}, {externalGraphic: '../resources/eye.png',
+                        fillColor: '#ff0000'}),    
+                    new OpenLayers.Feature.Vector(null, {role: 'camera'}, {externalGraphic: baseUrl + '/resources/eye.png',
                         graphicHeight: 18,
                         graphicWidth: 31,
                         graphicYOffset: -3,



More information about the Commits mailing list