← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13417: dv migrating svg request to web api - work in progress

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 13417 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-12-24 15:42:36 +0100
message:
  dv migrating svg request to web api - work in progress
modified:
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.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/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js	2013-12-23 08:00:34 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js	2013-12-23 21:01:24 +0000
@@ -746,7 +746,7 @@
 			listeners: {
 				show: function() {
 					var x = gis.viewport.eastRegion.getPosition()[0] - this.getWidth() - 3,
-						y = gis.viewport.centerRegion.getPosition()[1] + 26;
+						y = gis.viewport.centerRegion.getPosition()[1] + 58;
 					this.setPosition(x, y);
 				},
 				destroy: function() {

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js	2013-12-23 12:53:42 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js	2013-12-24 14:40:33 +0000
@@ -1344,23 +1344,40 @@
 			support.svg = support.svg || {};
 
 			support.svg.submitForm = function(type) {
-				var svg = Ext.query('svg'),
-					form = Ext.query('#exportForm')[0];
-
-				if (!(Ext.isArray(svg) && svg.length)) {
+                var svg = Ext.query('svg');
+                
+                if (!(Ext.isArray(svg) && svg.length)) {
 					alert('Browser does not support SVG');
 					return;
 				}
 
-				svg = Ext.get(svg[0]);
-				svg = svg.parent().dom.innerHTML;
-
-				Ext.query('#svgField')[0].value = svg;
-				Ext.query('#typeField')[0].value = type;
-				Ext.query('#nameField')[0].value = 'test';
-
-				form.action = '../exportImage.action';
-				form.submit();
+                svg = Ext.get(svg[0]).parent().dom.innerHTML;
+
+                Ext.Ajax.request({
+                    url: ns.core.init.contextPath + '/api/svg.' + type,
+                    method: 'POST',
+                    headers: {'Content-Type': 'application/xml'},
+                    params: Ext.encode(svg)
+                });
+                
+				//var svg = Ext.query('svg'),
+					//form = Ext.query('#exportForm')[0];
+
+				//if (!(Ext.isArray(svg) && svg.length)) {
+					//alert('Browser does not support SVG');
+					//return;
+				//}
+
+				//svg = Ext.get(svg[0]);
+				//svg = svg.parent().dom.innerHTML;
+
+				//Ext.query('#svgField')[0].value = svg;
+				//Ext.query('#typeField')[0].value = type;
+				//Ext.query('#nameField')[0].value = 'test';
+
+				//form.action = ns.core.init.contextPath + '/api/svg.' + type;
+                //form.method = 'post';
+				//form.submit();
 			};
 		}());