← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13896: GIS, share button fix + plugin config fixes.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 13896 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-01-30 13:00:46 +0100
message:
  GIS, share button fix + plugin config fixes.
modified:
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.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/app.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js	2014-01-30 11:32:36 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js	2014-01-30 11:59:43 +0000
@@ -3801,7 +3801,7 @@
 			cls: 'gis-textarea',
 			height: 130,
 			fieldStyle: 'padding-left: 4px; padding-top: 3px',
-			emptyText: GIS.i18n.write_your_interpretation
+			emptyText: GIS.i18n.write_your_interpretation + '..'
 		});
 
 		panel = Ext.create('Ext.panel.Panel', {
@@ -8033,16 +8033,32 @@
 			handler: function() {
 				var textArea,
 					window,
-					text = '';
+					text = '',
+                    el = 'table1',
+                    layout = gis.util.map.map2plugin(gis.util.layout.getPluginConfig());
+
+                layout.el = el;
+
+                if (layout.mapViews) {
+                    for (var i = 0, view; i < layout.mapViews.length; i++) {
+                        view = layout.mapViews[i];
+
+                        if (view.legendSet) {
+                            delete view.legendSet.bounds;
+                            delete view.legendSet.colors;
+                            delete view.legendSet.names;
+                        }
+                    }
+                }
 
 				text += '<html>\n<head>\n';
 				text += '<link rel="stylesheet" href="http://dhis2-cdn.org/v214/ext/resources/css/ext-plugin-gray.css"; />\n';
 				text += '<script src="http://dhis2-cdn.org/v214/ext/ext-all.js";></script>\n';
 				text += '<script src="http://dhis2-cdn.org/v214/plugin/table.js";></script>\n';
 				text += '</head>\n\n<body>\n';
-				text += '<div id="table1"></div>\n\n';
+				text += '<div id="' + el + '"></div>\n\n';
 				text += '<script>\n\n';
-				text += 'DHIS.getMap(' + JSON.stringify(gis.util.map.map2plugin(gis.util.layout.getPluginConfig()), null, 2) + ');\n\n';
+				text += 'DHIS.getMap(' + JSON.stringify(layout, null, 2) + ');\n\n';
 				text += '</script>\n\n';
 				text += '</body>\n</html>';
 
@@ -8079,57 +8095,11 @@
 
 				window.show();
 			}
-
-
-
-				//var textArea,
-					//window,
-					//text = 'DHIS.getMap(' + JSON.stringify(gis.util.map.map2plugin(gis.util.layout.getPluginConfig())) + ');';
-
-				//textArea = Ext.create('Ext.form.field.TextArea', {
-					//width: 400,
-					//height: 200,
-					//readOnly: true,
-					//cls: 'gis-textarea monospaced',
-					//value: text
-				//});
-
-				//window = Ext.create('Ext.window.Window', {
-					//title: 'Plugin configuration',
-					//layout: 'fit',
-					//modal: true,
-					//resizable: false,
-					//items: textArea,
-					//destroyOnBlur: true,
-					//bbar: [
-						//'->',
-						//{
-							//text: 'Format',
-							//handler: function() {
-								//textArea.setValue('DHIS.getMap(' + JSON.stringify(gis.util.map.map2plugin(gis.util.layout.getPluginConfig()), null, 2) + ');');
-
-							//}
-						//},
-						//{
-							//text: 'Select',
-							//handler: function() {
-								//textArea.selectText();
-							//}
-						//}
-					//],
-					//listeners: {
-						//show: function(w) {
-							//this.setPosition(215, 33);
-						//}
-					//}
-				//});
-
-				//window.show();
-			//}
 		});
 
 		shareButton = Ext.create('Ext.button.Button', {
 			text: GIS.i18n.share,
+            disabled: true,
 			xableItems: function() {
 				interpretationItem.xable();
 				pluginItem.xable();

=== 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	2014-01-30 11:32:36 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js	2014-01-30 11:59:43 +0000
@@ -1358,6 +1358,10 @@
 			}
 			else {
 				gis.map = null;
+
+				if (gis.viewport.shareButton) {
+                    gis.viewport.shareButton.enable();
+				}
 			}
 		};
 
@@ -1545,6 +1549,10 @@
 			}
 			else {
 				gis.map = null;
+
+				if (gis.viewport.shareButton) {
+                    gis.viewport.shareButton.enable();
+				}
 			}
 		};
 
@@ -2017,6 +2025,7 @@
 			else {
 				gis.map = null;
 				if (gis.viewport.shareButton) {
+                    gis.viewport.shareButton.enable();
 				}
 			}