=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/Interpretation.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/Interpretation.java 2012-05-31 21:51:26 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/Interpretation.java 2012-05-31 22:31:59 +0000 @@ -38,6 +38,7 @@ import org.hisp.dhis.common.annotation.Scanned; import org.hisp.dhis.common.view.DetailedView; import org.hisp.dhis.common.view.ExportView; +import org.hisp.dhis.mapping.MapView; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.reporttable.ReportTable; import org.hisp.dhis.user.User; @@ -55,6 +56,8 @@ { private Chart chart; + private MapView mapView; + private ReportTable reportTable; private OrganisationUnit organisationUnit; // Applicable to report table only @@ -84,6 +87,13 @@ this.created = new Date(); } + public Interpretation( MapView mapView, String text ) + { + this.mapView = mapView; + this.text = text; + this.created = new Date(); + } + public Interpretation( ReportTable reportTable, OrganisationUnit organisationUnit, String text ) { this.reportTable = reportTable; @@ -106,6 +116,11 @@ return chart != null; } + public boolean isMapViewInterpretation() + { + return mapView != null; + } + public boolean isReportTableInterpretation() { return reportTable != null; @@ -133,6 +148,20 @@ @JsonDeserialize( as = BaseIdentifiableObject.class ) @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE ) + public MapView getMapView() + { + return mapView; + } + + public void setMapView( MapView mapView ) + { + this.mapView = mapView; + } + + @JsonProperty + @JsonDeserialize( as = BaseIdentifiableObject.class ) + @JsonView( { DetailedView.class, ExportView.class } ) + @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE ) public ReportTable getReportTable() { return reportTable; === modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/interpretation/hibernate/Interpretation.hbm.xml' --- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/interpretation/hibernate/Interpretation.hbm.xml 2012-05-31 21:51:26 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/interpretation/hibernate/Interpretation.hbm.xml 2012-05-31 22:31:59 +0000 @@ -18,6 +18,9 @@ + + === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/InterpretationController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/InterpretationController.java 2012-05-31 21:51:26 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/InterpretationController.java 2012-05-31 22:31:59 +0000 @@ -27,12 +27,21 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import java.io.IOException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.servlet.http.HttpServletResponse; + import org.hisp.dhis.api.utils.ContextUtils; import org.hisp.dhis.chart.Chart; import org.hisp.dhis.chart.ChartService; import org.hisp.dhis.common.Pager; import org.hisp.dhis.interpretation.Interpretation; import org.hisp.dhis.interpretation.InterpretationService; +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 org.hisp.dhis.reporttable.ReportTable; @@ -45,12 +54,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - /** * @author Lars Helge Overland */ @@ -73,6 +76,9 @@ @Autowired private OrganisationUnitService organisationUnitService; + @Autowired + private MappingService mappingService; + @Override protected List getEntityList( WebMetaData metaData, WebOptions options ) { @@ -111,7 +117,7 @@ if ( chart == null ) { - ContextUtils.conflictResponse( response, "Chart identifier not valid: " + chartUid); + ContextUtils.conflictResponse( response, "Chart identifier not valid: " + chartUid ); return; } @@ -122,6 +128,26 @@ ContextUtils.okResponse( response, "Chart interpretation created" ); } + @RequestMapping( value = "/map/{uid}", method = RequestMethod.POST, consumes = { "text/html", "text/plain" } ) + public void shareMapInterpretation( + @PathVariable( "uid" ) String mapViewUid, + @RequestBody String text, HttpServletResponse response ) throws IOException + { + MapView mapView = mappingService.getMapView( mapViewUid ); + + if ( mapView == null ) + { + ContextUtils.conflictResponse( response, "Map view identifier not valid: " + mapViewUid ); + return; + } + + Interpretation interpretation = new Interpretation( mapView, text ); + + interpretationService.saveInterpretation( interpretation ); + + ContextUtils.okResponse( response, "Map view interpretation created" ); + } + @RequestMapping( value = "/reportTable/{uid}", method = RequestMethod.POST, consumes = { "text/html", "text/plain" } ) public void shareReportTableInterpretation( @PathVariable( "uid" ) String reportTableUid, @@ -165,5 +191,4 @@ ContextUtils.okResponse( response, "Comment created" ); } - } === modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties 2012-05-31 21:51:26 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties 2012-05-31 22:31:59 +0000 @@ -41,4 +41,6 @@ add_a_comment=Add a comment new_interpretations=new interpretations new_interpretation=new interpretation -click_to_view_report_table=Click to view report table \ No newline at end of file +click_to_view_report_table=Click to view report table +click_to_view_in_data_visualizer=Click to view in Data Visualizer +click_to_view_in_gis=Click to view in GIS \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/interpretation.vm' --- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/interpretation.vm 2012-05-31 21:51:26 +0000 +++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/interpretation.vm 2012-05-31 22:31:59 +0000 @@ -14,19 +14,23 @@
${ip.text}
- #if( $ip.chartInterpretation )
+ #if( $ip.chartInterpretation ) -
+ title="$i18n.getString( 'click_to_view_in_data_visualizer' )"> + #elseif( $ip.mapViewInterpretation ) + $encoder.htmlEncode( $ip.mapView.name ) #else -
#if( $ip.organisationUnit )#set( $ou = "&ou=" + $ip.organisationUnit.uid )#else#set( $ou = "" )#end - $encoder.htmlEncode( $ip.reportTable.name ) -
+ $encoder.htmlEncode( $ip.reportTable.name ) #end + #set( $comments = $ip.comments )