← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9212: Persisting selected period for report table interpretation

 

Merge authors:
  Lars Helge Øverland (larshelge)
------------------------------------------------------------
revno: 9212 [merge]
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-12-07 20:38:28 +0100
message:
  Persisting selected period for report table interpretation
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/Interpretation.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/InterpretationController.java
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/interpretationFeed.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/generateReport.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/reportTableGrid.vm


--
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/interpretation/Interpretation.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/Interpretation.java	2012-11-06 07:01:56 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/interpretation/Interpretation.java	2012-12-07 18:16:00 +0000
@@ -67,7 +67,7 @@
     
     private DataSet dataSet;
     
-    private Period period; // Applicable to data set report
+    private Period period; // Applicable to report table and data set report
     
     private OrganisationUnit organisationUnit; // Applicable to report table and data set report
     
@@ -103,9 +103,10 @@
         this.created = new Date();
     }
     
-    public Interpretation( ReportTable reportTable, OrganisationUnit organisationUnit, String text )
+    public Interpretation( ReportTable reportTable, Period period, OrganisationUnit organisationUnit, String text )
     {
         this.reportTable = reportTable;
+        this.period = period;
         this.organisationUnit = organisationUnit;
         this.text = text;
         this.created = new Date();

=== 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-11-05 19:23:01 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/InterpretationController.java	2012-12-07 18:16:00 +0000
@@ -157,6 +157,7 @@
     @RequestMapping( value = "/reportTable/{uid}", method = RequestMethod.POST, consumes = { "text/html", "text/plain" } )
     public void shareReportTableInterpretation( 
         @PathVariable( "uid" ) String reportTableUid, 
+        @RequestParam( value = "pe", required = false ) String isoPeriod,
         @RequestParam( value = "ou", required = false ) String orgUnitUid, 
         @RequestBody String text, HttpServletResponse response ) throws IOException
     {
@@ -167,7 +168,9 @@
             ContextUtils.conflictResponse( response, "Report table identifier not valid: " + reportTableUid );
             return;
         }
-        
+
+        Period period = PeriodType.getPeriodFromIsoString( isoPeriod );
+                
         OrganisationUnit orgUnit = null;
         
         if ( orgUnitUid != null )
@@ -181,7 +184,7 @@
             }
         }
         
-        Interpretation interpretation = new Interpretation( reportTable, orgUnit, text );
+        Interpretation interpretation = new Interpretation( reportTable, period, orgUnit, text );
         
         interpretationService.saveInterpretation( interpretation );
 

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/interpretationFeed.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/interpretationFeed.vm	2012-12-06 09:20:32 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/interpretationFeed.vm	2012-12-07 18:16:00 +0000
@@ -33,9 +33,10 @@
 	           $encoder.htmlEncode( $ip.map.name )</a>
 	    #elseif( $ip.reportTableInterpretation )
 	        #if( $ip.organisationUnit )#set( $ou = "&ou=" + $ip.organisationUnit.uid )#else#set( $ou = "" )#end
+	        #if( $ip.period )#set( $pe = "&pe=" + $ip.period.isoDate )#else#set( $pe = "" )#end
 	        <a class="bold"
 	           title="$i18n.getString( 'click_to_view_report_table' )" 
-	           href="../dhis-web-reporting/exportTable.action?uid=${ip.reportTable.uid}&pe=${format.formatDate( $ip.created )}${ou}">
+	           href="../dhis-web-reporting/exportTable.action?uid=${ip.reportTable.uid}${pe}${ou}">
 	           $encoder.htmlEncode( $ip.reportTable.name )</a>
 	    #elseif( $ip.dataSetReportInterpretation )
 	        <a class="bold"

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/generateReport.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/generateReport.js	2012-12-07 14:43:11 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/generateReport.js	2012-12-07 18:16:00 +0000
@@ -85,7 +85,7 @@
 	} );
 }
 
-function shareInterpretation( uid, ou )
+function shareInterpretation( uid, pe, ou )
 {
     var text = $( "#interpretationArea" ).val();
     
@@ -93,9 +93,10 @@
     {
     	text = $.trim( text );
     	
-	    var url = "../api/interpretations/reportTable/" + uid;
+	    var url = "../api/interpretations/reportTable/" + uid + "?";
 	    
-	    url += ( ou && ou.length ) ? "?ou=" + ou : "";
+	    url += ( pe && pe.length ) ? "pe=" + pe + "&": "";
+	    url += ( ou && ou.length ) ? "ou=" + ou : "";
 	    
 	    $.ajax( url, {
 	    	type: "POST",

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/reportTableGrid.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/reportTableGrid.vm	2012-12-07 14:25:10 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/reportTableGrid.vm	2012-12-07 18:16:00 +0000
@@ -19,7 +19,7 @@
 
 <div id="shareForm">
 <textarea id="interpretationArea" class="interpretationArea" placeholder="$i18n.getString( 'write_your_interpretation' )"></textarea><br>
-<input type="button" value="$i18n.getString( 'share' )" onclick="shareInterpretation( '${uid}', '$!{ou}' )" style="width:120px">
+<input type="button" value="$i18n.getString( 'share' )" onclick="shareInterpretation( '${uid}', '$!{pe}', '$!{ou}' )" style="width:120px">
 </div>
 
 #parse( "dhis-web-commons/ajax/htmlGrid.vm" )