← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7174: Impl sharing of charts straight from dashboard

 

------------------------------------------------------------
revno: 7174
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-06-04 14:06:05 +0200
message:
  Impl sharing of charts straight from dashboard
modified:
  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/webapp/dhis-web-dashboard-integration/dashboard.vm
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dropdown.js
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css


--
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-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-06-01 11:29:46 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties	2012-06-04 12:06:05 +0000
@@ -45,4 +45,8 @@
 new_interpretation=new interpretation
 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
+click_to_view_in_gis=Click to view in GIS
+share=Share
+write_your_interpretation=Write your interpretation
+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-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm	2012-06-03 16:26:12 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm	2012-06-04 12:06:05 +0000
@@ -14,6 +14,7 @@
     <a href="javascript:clearArea( '${areaDivId}' )">$i18n.getString( "clear" )</a>
     #if( $chart )
     <a href="javascript:explore( '${chart.uid}' )">$i18n.getString( "explore" )</a>
+    <a href="javascript:viewShareForm( '${chart.uid}' )">$i18n.getString( "share" )</a>
     #end
 </div>
 #end

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dropdown.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dropdown.js	2012-06-04 09:24:05 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dropdown.js	2012-06-04 12:06:05 +0000
@@ -1,6 +1,8 @@
 
 $( document ).ready( function()
 {
+	$( "#interpretationArea" ).autogrow();
+	
 	var viewportWidth = parseInt( $( window ).width() );
 	var linkWidth = parseInt( 338 );
 	var chartWidth = parseInt( 325 );
@@ -55,4 +57,42 @@
 function explore( uid )
 {
 	window.location.href = "../dhis-web-visualizer/app/index.html?id=" + uid;
-}
\ No newline at end of file
+}
+
+function viewShareForm( uid )
+{	
+	$( "#interpretationChartId" ).val( uid );
+	
+	$( "#shareForm" ).dialog( {
+		modal : true,
+		width : 500,
+		resizable: false,
+		title : i18n_share_your_interpretation
+	} );
+}
+
+function shareInterpretation()
+{
+    var chartId = $( "#interpretationChartId" ).val();
+    var text = $( "#interpretationArea" ).val();
+    
+    if ( text.length && $.trim( text ).length )
+    {
+    	text = $.trim( text );
+    	
+	    var url = "../api/interpretations/chart/" + chartId;
+	    
+	    // TODO url += ( ou && ou.length ) ? "?ou=" + ou : "";
+	    
+	    $.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-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm	2012-06-03 20:33:54 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm	2012-06-04 12:06:05 +0000
@@ -1,3 +1,7 @@
+<script type="text/javascript">
+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>
 
 <h3>$i18n.getString( "dashboard" ) #openHelp( "dashboards_setup" )
 &#8226; <a href="showSendFeedback.action">$i18n.getString( "write_feedback" )</a>
@@ -11,6 +15,12 @@
 
 <div id="contentDiv"></div>
 
-<div id="chartView" style="display:none; padding:0; margin:0;">
+<div id="chartView">
 	<img id="chartImage" src="" style="padding: 10px;"></img>
 </div>
+
+<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()">
+	<input type="hidden" id="interpretationChartId">
+</div>

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css	2012-06-04 09:24:05 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css	2012-06-04 12:06:05 +0000
@@ -97,6 +97,36 @@
   background-color: #f8f8f8;
 }
 
+#shareForm
+{
+  display: none;
+}
+
+#chartView
+{
+  display: none; 
+  padding: 0; 
+  margin: 0;
+}
+
+.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;
+}
+
 /*----------------------------------------------------------------------------*/
 /* Message                                                                    */
 /*----------------------------------------------------------------------------*/