[Commits] r1783 - in sandbox/ahocevar/playground/trunk/geoext: lib/GeoExt/data tests/lib/GeoExt/data

commits at geoext.org commits at geoext.org
Tue Jan 19 16:56:33 CET 2010


Author: ahocevar
Date: 2010-01-19 16:56:33 +0100 (Tue, 19 Jan 2010)
New Revision: 1783

Modified:
   sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/data/PrintProvider.js
   sandbox/ahocevar/playground/trunk/geoext/tests/lib/GeoExt/data/PrintProvider.html
Log:
getAbsoluteUrl and test fix for IE (IE7 in particular)

Modified: sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/data/PrintProvider.js
===================================================================
--- sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/data/PrintProvider.js	2010-01-19 15:04:02 UTC (rev 1782)
+++ sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/data/PrintProvider.js	2010-01-19 15:56:33 UTC (rev 1783)
@@ -431,6 +431,9 @@
     getAbsoluteUrl: function(url) {
         var a;
         if(Ext.isIE) {
+            if(url.indexOf("../") === 0) {
+                url = window.location.pathname + "/../" + url;
+            }
             a = document.createElement("<a href='" + url + "'/>");
         } else {
             a = document.createElement("a");

Modified: sandbox/ahocevar/playground/trunk/geoext/tests/lib/GeoExt/data/PrintProvider.html
===================================================================
--- sandbox/ahocevar/playground/trunk/geoext/tests/lib/GeoExt/data/PrintProvider.html	2010-01-19 15:04:02 UTC (rev 1782)
+++ sandbox/ahocevar/playground/trunk/geoext/tests/lib/GeoExt/data/PrintProvider.html	2010-01-19 15:56:33 UTC (rev 1783)
@@ -133,7 +133,7 @@
             var layerStore = new GeoExt.data.LayerStore({
                 layers: [layers[0], layers[1]]
             });
-            layerStore.getAt(1).set("legendURL", "../../../../../geoext/resources/images/default/anchor.png");
+            layerStore.getAt(1).set("legendURL", "../../../../resources/images/default/anchor.png");
             
             // a legend panel to test all legend encoders
             var legend = new GeoExt.LegendPanel({
@@ -144,14 +144,17 @@
             var origRequest = Ext.Ajax.request;
             Ext.Ajax.request = function(req) {
                 log.request = req;
+                var _open = window.open;
+                window.open = Ext.emptyFn;
                 req.success.call(req.scope, {
                     responseText: '{"getURL":"foo"}'
                 });
+                window.open = _open;
             }
             printProvider.print(map, [printPage], {legend: legend});
             Ext.Ajax.request = origRequest;
             
-            var baseUrl = window.location.href.substr(0, window.location.href.indexOf("/tests/lib/GeoExt"));
+            var baseUrl = parent.location.href.substr(0, parent.location.href.indexOf("/tests/run-tests.html"));
             var imgUrl = baseUrl + "/resources/images/default/anchor.png";
             var expect = {"units":"degrees","srs":"EPSG:4326","layout":"A4 portrait","dpi":75,"layers":[{"baseURL":"http://demo.opengeo.org/geoserver/wms","opacity":1,"singleTile":false,"type":"WMS","layers":["topp:tasmania_state_boundaries","topp:tasmania_water_bodies"],"format":"image/gif","styles":[""],"customParams":{"VENDORFOO":"bar"}},{"baseURL":"http://c0.labs.metacarta.com/wms-c/cache/","opacity":1,"singleTile":false,"type":"TileCache","layer":"basic","maxExtent":[-180,-90,180,90],"tileSize":[256,256],"extension":"png","resolutions":[0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125,0.000021457672119140625]},{"type":"Image","baseURL":"http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif","opacity":1,"extent":[-180,-88.759,180,88.759],"pixelSize":[580,288],"name":"image"},{"type":"Vector","styles":{"1":{"fillColor":"#ee9900","fillOpacity":0.4,"hoverFillColor":"white","hoverFillOpacity":0.8,"strokeColor":"#ee9900","strokeOpacity":1,"strokeWidth":1,"strokeLinecap":"round","strokeDashstyle":"solid","hoverStrokeColor":"red","hoverStrokeOpacity":1,"hoverStrokeWidth":0.2,"pointRadius":6,"hoverPointRadius":1,"hoverPointUnit":"%","pointerEvents":"visiblePainted","cursor":"inherit"}},"styleProperty":"_gx_style","geoJson":{"type":"FeatureCollection","features":[{"type":"Feature","id":"OpenLayers.Feature.Vector_72","properties":{"_gx_style":1},"geometry":{"type":"Point","coordinates":[1,2]}}]},"name":"vector","opacity":1}],"pages":[{"mapTitle":"foo","comment":"bar","center":[1,2],"scale":4000000,"rotation":0}],"customParam":"foo","legends":[{"name":"osm","classes":[{"name":"","icon":imgUrl}]},{"name":"wms","classes":[{"name":"","icons":["http://demo.opengeo.org/geoserver/wms?FORMAT=image%2Fgif&VENDORFOO=bar&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=topp%3Atasmania_state_boundaries","http://demo.opengeo.org/geoserver/wms?FORMAT=image%2Fgif&VENDORFOO=bar&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=topp%3Atasmania_water_bodies"]}]}]};
 



More information about the Commits mailing list