← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2121: GIS: Updated export to image to work with the new openlayers version

 

------------------------------------------------------------
revno: 2121
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Wed 2010-09-15 17:58:06 +0200
message:
  GIS: Updated export to image to work with the new openlayers version
modified:
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-09-14 16:49:38 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2010-09-15 15:58:06 +0000
@@ -615,29 +615,22 @@
                     }   
 
                     if (vcb && dcb && mcb && lcb) {
-                    	var svgChildren = document.getElementById('_OpenLayers_Container').childNodes;
-						var svgDivId = null;
-
-						for (i = 0; i < svgChildren.length; i++) { // Search for div containing SVG
-							svgDivId = svgChildren[i].getAttribute('id');
-							if (svgDivId && svgDivId.indexOf('OpenLayers.Layer.Vector_') != -1) {
-								break;
-							}
-						}
-
-						var svg = document.getElementById(svgDivId).innerHTML;
-						var objectSVGDocument = document.getElementById(svgDivId).childNodes[0];
-						
-                        var viewBox = objectSVGDocument.getAttribute('viewBox');
+                    	
+						var svgElement = document.getElementsByTagName('svg')[0];
+						var parentSvgElement = svgElement.parentNode;
+						
+						var svg = parentSvgElement.innerHTML;
+						
+                        var viewBox = svgElement.getAttribute('viewBox');
                         var title = Ext.getCmp('exportimagetitle_tf').getValue();
-                    
+                    	
                         if (!title) {
                             Ext.message.msg(false, i18n_please_enter_map_title );
                         }
                         else {
                             var q = Ext.getCmp('exportimagequality_cb').getValue();
-                            var w = objectSVGDocument.getAttribute('width') * q;
-                            var h = objectSVGDocument.getAttribute('height') * q;
+                            var w = svgElement.getAttribute('width') * q;
+                            var h = svgElement.getAttribute('height') * q;
                             var includeLegend = Ext.getCmp('exportimageincludelegend_chb').getValue();
                             
                             Ext.getCmp('exportimagetitle_tf').reset();