← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7123: Impl sharing of report table interpretation

 

------------------------------------------------------------
revno: 7123
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-05-31 22:29:41 +0200
message:
  Impl sharing of report table interpretation
added:
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/style/
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/style/dhis-web-reporting.css
modified:
  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/interpretation.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/ExportTableAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties
  dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml
  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-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 18:16:45 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/InterpretationController.java	2012-05-31 20:29:41 +0000
@@ -104,6 +104,7 @@
         if ( chart == null )
         {
             ContextUtils.conflictResponse( response, "Chart identifier not valid" );
+            return;
         }
         
         Interpretation interpretation = new Interpretation( chart, text );
@@ -121,6 +122,7 @@
         if ( reportTable == null )
         {
             ContextUtils.conflictResponse( response, "Report table identifier not valid" );
+            return;
         }
         
         Interpretation interpretation = new Interpretation( reportTable, text );

=== 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-29 19:44:34 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/interpretation.vm	2012-05-31 20:29:41 +0000
@@ -36,7 +36,7 @@
 		</div>
 		#end
 		</div>
-		<textarea id="commentArea${ip.uid}" class="commentArea" placeholder="$i18n.getString( 'add_a_comment' )..."></textarea>
+		<textarea id="commentArea${ip.uid}" class="commentArea" placeholder="$i18n.getString( 'add_a_comment' )..."></textarea><br>
 		<input type="button" class="commentButton" value="Post comment" onclick="postComment( '${ip.uid}' )">
 	</div>
 	

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/ExportTableAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/ExportTableAction.java	2012-04-23 09:35:01 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/ExportTableAction.java	2012-05-31 20:29:41 +0000
@@ -102,6 +102,11 @@
 
     private String uid;
 
+    public String getUid()
+    {
+        return uid;
+    }
+
     public void setUid( String uid )
     {
         this.uid = uid;

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties	2012-05-21 09:33:12 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties	2012-05-31 20:29:41 +0000
@@ -214,4 +214,8 @@
 last_5_financial_years=Last 5 financial years
 financial_yearly=Financial Yearly
 please_specify_file=Please specify a design file
-jasper_design=Jasper design
\ No newline at end of file
+jasper_design=Jasper design
+write_your_interpretation=Write your interpretation
+share=Share
+share_your_interpretation=Share your interpretation
+interpretation_was_shared=Interpretation was shared
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml	2012-04-23 09:35:01 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml	2012-05-31 20:29:41 +0000
@@ -186,6 +186,7 @@
       <param name="page">/dhis-web-reporting/reportTableGrid.vm</param>
       <param name="menu">/dhis-web-reporting/menu.vm</param>
       <param name="javascripts">javascript/generateReport.js</param>
+	  <param name="stylesheets">style/dhis-web-reporting.css</param>
     </action>
 
     <action name="getCategoryComboDataElements" class="org.hisp.dhis.reporting.tablecreator.action.GetCategoryComboDataElementsAction">

=== 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-04-23 09:35:01 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/generateReport.js	2012-05-31 20:29:41 +0000
@@ -73,3 +73,34 @@
 
     window.location.href = url;
 }
+
+function viewShareForm()
+{
+	$( "#shareForm" ).dialog( {
+		modal : true,
+		width : 500,
+		resizable: false,
+		title : i18n_share_your_interpretation
+	} );
+}
+
+function shareInterpretation( uid )
+{
+    var text = $( "#interpretationArea" ).val();
+    
+    if ( text.length )
+    {
+	    var url = "../api/interpretations/reportTable/" + uid;
+	    
+	    $.ajax( url, {
+	    	type: "POST",
+	    	contentType: "text/html",
+	    	data: text,
+	    	success: function() {
+	    		$( "#shareForm" ).dialog( "close" );
+	    		$( "#interpretationArea" ).val( "" );
+	    		setHeaderDelayMessage( i18n_interpretation_was_shared );
+	    	}    	
+	    } );
+    }
+}

=== 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	2011-01-14 18:10:02 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/reportTableGrid.vm	2012-05-31 20:29:41 +0000
@@ -1,11 +1,26 @@
 
+<script type="text/javascript">
+$( document ).ready( function() {
+	jQuery( "#interpretationArea" ).autogrow();
+} );
+
+var i18n_share_your_interpretation = '$encoder.jsEscape( $i18n.getString( "share_your_interpretation" ), "'")';
+var i18n_interpretation_was_shared = '$encoder.jsEscape( $i18n.getString( "interpretation_was_shared" ), "'")';
+</script>
+
 <div>
 <input type="button" value="$i18n.getString( 'get_report_as_xls' )" onclick="exportReport( 'xls' )" style="width:140px">
 <input type="button" value="$i18n.getString( 'get_report_as_csv' )" onclick="exportReport( 'csv' )" style="width:140px">
 <input type="button" value="$i18n.getString( 'get_report_as_pdf' )" onclick="exportReport( 'pdf' )" style="width:140px">
 <input type="button" value="$i18n.getString( 'get_report_as_jasper' )" onclick="exportReport( 'jasper' )" style="width:140px">
 <input type="button" value="$i18n.getString( 'get_report_as_jrxml' )" onclick="exportReport( 'jrxml' )" style="width:140px">
+<input type="button" value="$i18n.getString( 'share' )" onclick="viewShareForm()" style="width:140px">
 <input type="button" value="$i18n.getString( 'back' )" onclick="javascript:window.location.href='displayManageTableForm.action'" style="width:140px">
 </div>
 
-#parse( "dhis-web-commons/ajax/htmlGrid.vm" )
\ No newline at end of file
+#parse( "dhis-web-commons/ajax/htmlGrid.vm" )
+
+<div id="shareForm">
+<textarea id="interpretationArea" class="interpretationArea" placeholder="$i18n.getString( 'write_your_interpretation' )..."></textarea>
+<input type="button" class="interpretationButton" value="$i18n.getString( 'share' )" onclick="shareInterpretation( '${uid}' )">
+</div>
\ No newline at end of file

=== added directory 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/style'
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/style/dhis-web-reporting.css'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/style/dhis-web-reporting.css	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/style/dhis-web-reporting.css	2012-05-31 20:29:41 +0000
@@ -0,0 +1,23 @@
+
+#shareForm
+{
+  display: none;
+}
+
+.interpretationArea
+{
+  height: 120px;
+  width: 462px;
+  border: 1px solid #ccc;
+  resize: none;
+  overflow: auto;
+  margin: 10px 4px 6px 4px;
+  padding: 4px 0 0px 6px;
+}
+
+.interpretationButton
+{
+  width: 120px;
+  height: 24px;
+  margin: 0 0 6px 4px;
+}