[Commits] r1707 - sandbox/cmoullet/ux/StreetViewPanel/ux/widgets

commits at geoext.org commits at geoext.org
Mon Jan 11 09:56:45 CET 2010


Author: cmoullet
Date: 2010-01-11 09:56:43 +0100 (Mon, 11 Jan 2010)
New Revision: 1707

Modified:
   sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js
Log:
Add baseUrl attribute to support remote call


Modified: sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js
===================================================================
--- sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js	2010-01-11 08:53:06 UTC (rev 1706)
+++ sandbox/cmoullet/ux/StreetViewPanel/ux/widgets/StreetViewPanel.js	2010-01-11 08:56:43 UTC (rev 1707)
@@ -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.StreetViewPanel = Ext.extend(Ext.Panel, {
 
     /** api: config[map]
@@ -113,6 +127,11 @@
      */
     readPermalink: true,
 
+    /** private: property[baseUrl]
+     *  ``String``  base url of this file (directory of the ux)
+     */
+    baseUrl: scriptSource.replace('/widgets/StreetViewPanel.js', ''),
+
     /** private: method[initComponent]
      *  Private initComponent override.
      */
@@ -451,7 +470,7 @@
                 this.panorama.navigationToolLayer = new OpenLayers.Layer.Vector("2DNavigationTool", {
                     styleMap: new OpenLayers.StyleMap({
                         "default": {
-                            externalGraphic: "../resources/tool.png",
+                            externalGraphic: this.baseUrl + "/resources/tool.png",
                             graphicHeight: 32,
                             graphicWidth: 32,
                             graphicOpacity: 0.8,
@@ -485,7 +504,7 @@
                 this.panorama.navigationLinkLayer = new OpenLayers.Layer.Vector("2DNavigationLink", {
                     styleMap: new OpenLayers.StyleMap({
                         "default": {
-                            externalGraphic: "../resources/link.png",
+                            externalGraphic: this.baseUrl + "/resources/link.png",
                             graphicHeight: 24,
                             graphicYOffset: -44,
                             graphicOpacity: 0.8,
@@ -493,7 +512,7 @@
                         },
                         "select": {
                             cursor: "pointer",
-                            externalGraphic: "../resources/link_selected.png"
+                            externalGraphic: this.baseUrl + "/resources/link_selected.png"
                         }
                     })
                 });



More information about the Commits mailing list