← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2362: (GIS) Minor bug fixed.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 2362 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-10-13 16:53:38 +0200
message:
  (GIS) Minor bug fixed.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java
  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapViewAction.java
  dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapView.vm
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/util.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-api/src/main/java/org/hisp/dhis/mapping/MapView.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java	2010-10-12 11:18:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java	2010-10-13 13:00:43 +0000
@@ -68,6 +68,8 @@
 
     private String mapSource;
     
+    private transient String parentOrganisationUnitName;
+    
     private String mapLegendType;
 
     private int method;
@@ -309,6 +311,16 @@
         this.mapSource = mapSource;
     }
 
+    public String getParentOrganisationUnitName()
+    {
+        return parentOrganisationUnitName;
+    }
+
+    public void setParentOrganisationUnitName( String parentOrganisationUnitName )
+    {
+        this.parentOrganisationUnitName = parentOrganisationUnitName;
+    }
+
     public String getMapLegendType()
     {
         return mapLegendType;

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapViewAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapViewAction.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapViewAction.java	2010-10-13 13:00:43 +0000
@@ -27,8 +27,12 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.mapping.MapView;
 import org.hisp.dhis.mapping.MappingService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -39,6 +43,8 @@
 public class GetMapViewAction
     implements Action
 {
+    private static final Log log = LogFactory.getLog( GetMapViewAction.class );
+    
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -50,6 +56,13 @@
         this.mappingService = mappingService;
     }
 
+    private OrganisationUnitService organisationUnitService;
+
+    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+    {
+        this.organisationUnitService = organisationUnitService;
+    }
+
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -71,7 +84,7 @@
     {
         return object;
     }
-    
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -80,7 +93,19 @@
         throws Exception
     {
         object = mappingService.getMapView( id );
+
+        log.info( "Getting map view: " + object );
         
+        if ( object != null && object.getMapSourceType().equals( MappingService.MAP_SOURCE_TYPE_DATABASE ) )
+        {
+            OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit(
+                Integer.parseInt( object.getMapSource() ) );
+            
+            log.info( "Getting map view for organisation unit: " + object + " for map source: " + object.getMapSource() );
+            
+            object.setParentOrganisationUnitName( organisationUnit.getName() );
+        }
+
         return SUCCESS;
     }
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml	2010-09-27 11:18:38 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml	2010-10-13 13:00:43 +0000
@@ -254,6 +254,7 @@
 	<bean id="org.hisp.dhis.mapping.action.GetMapViewAction" class="org.hisp.dhis.mapping.action.GetMapViewAction"
 		scope="prototype">
 		<property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
+		<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.mapping.action.GetAllMapViewsAction"

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapView.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapView.vm	2010-10-11 17:05:42 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapView.vm	2010-10-13 13:00:43 +0000
@@ -14,6 +14,7 @@
     "endDate": "$!encoder.jsEncode( ${object.endDate} )",
     "mapSourceType": "$!encoder.jsEncode( ${object.mapSourceType} )",
     "mapSource": "$!encoder.jsEncode( ${object.mapSource} )",
+    "parentOrganisationUnitName": "$!encoder.jsEncode( ${object.parentOrganisationUnitName} )",
     "mapLegendType": "$!encoder.jsEncode( ${object.mapLegendType} )",
     "method": "$!{object.method}",
     "classes": "$!{object.classes}",

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/util.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/util.js	2010-10-11 17:05:42 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/util.js	2010-10-13 14:51:29 +0000
@@ -176,7 +176,7 @@
     },
 
     getLegendsJSON: function() {
-        var widget = ACTIVEPANEL == thematicMap ? choropleth : proportionalSymbol;
+        var widget = ACTIVEPANEL == GLOBALS.config.thematicMap ? choropleth : proportionalSymbol;
         var json = '{';
         json += '"legends":';
         json += '[';