← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6105: Added a direct link to data visualizer for each chart in dashboard

 

------------------------------------------------------------
revno: 6105
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-02-24 11:55:25 +0100
message:
  Added a direct link to data visualizer for each chart in dashboard
modified:
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java
  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/javascript/dropdown.js
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.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-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java	2012-01-25 17:11:43 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java	2012-02-24 10:55:25 +0000
@@ -103,9 +103,9 @@
         return charts;
     }
 
-    private List<Object> chartAreas = new ArrayList<Object>();
+    private List<Chart> chartAreas = new ArrayList<Chart>();
 
-    public List<Object> getChartAreas()
+    public List<Chart> getChartAreas()
     {
         return chartAreas;
     }
@@ -137,7 +137,16 @@
 
         for ( int i = 1; i <= chartsInDashboardCount; i++ )
         {
-            chartAreas.add( content.get( DashboardManager.CHART_AREA_PREFIX + i ) );
+            Object id = content.get( DashboardManager.CHART_AREA_PREFIX + i );
+
+            Chart chart = null;
+            
+            if ( id != null )
+            {
+                chart = chartService.getChart( Integer.valueOf( String.valueOf( id ) ) );
+            }
+            
+            chartAreas.add( chart );
         }
 
         messageCount = messageService.getUnreadMessageConversationCount();

=== 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-02-21 13:32:39 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties	2012-02-24 10:55:25 +0000
@@ -37,3 +37,4 @@
 user_roles=User roles
 meta_data=Meta data
 sending_message=Sending message
+explore=Explore
\ No newline at end of file

=== 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	2011-06-22 18:29:52 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dropdown.js	2012-02-24 10:55:25 +0000
@@ -34,3 +34,8 @@
         title : "Viewing Chart"
     } );
 }
+
+function explore( uid )
+{
+	window.location.href = "../dhis-web-visualizer/app/index.html?uid=" + uid;
+}
\ No newline at end of file

=== 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	2011-11-29 12:01:04 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm	2012-02-24 10:55:25 +0000
@@ -7,6 +7,17 @@
 </div>
 #end
 
+#macro ( chartDropDownButtonDiv $dropDownId $areaDivId $chart )
+<div class="buttonArea">
+    <a href="javascript:showDropDown( '${dropDownId}' )">$i18n.getString( "insert" )</a>
+    <a href="javascript:hideDropDown()">$i18n.getString( "close" )</a>
+    <a href="javascript:clearArea( '${areaDivId}' )">$i18n.getString( "clear" )</a>
+    #if( $chart )
+    <a href="javascript:explore( '${chart.uid}' )">$i18n.getString( "explore" )</a>
+    #end
+</div>
+#end
+
 #macro ( linkDropDownListDiv $divId $listId $page )
 <div id="$divId" class="linkArea">
     <div id="$listId" class="menuDropDownArea">
@@ -24,17 +35,17 @@
 </div>
 #end
 
-#macro ( chartDropDownListDiv $divId $listId $chartId )
+#macro ( chartDropDownListDiv $divId $listId $chart )
 <div id="$divId" class="chartArea">
     <div id="$listId" class="menuDropDownArea">
         <ul class="menuDropDownBox">
-        #foreach( $chart in $charts )
-            <li class="menuDropDownItem" onclick="setAreaItem( '$divId', '$chart.id' )">${chart.name}&nbsp;</li>
+        #foreach( $availableChart in $charts )
+            <li class="menuDropDownItem" onclick="setAreaItem( '${divId}', '${availableChart.id}' )">${availableChart.name}&nbsp;</li>
         #end
         </ul>
     </div>
-    #if ( $chartId )
-        <img style="cursor:pointer" src="getChart.action?id=${chartId}" onclick="viewChart( 'getChart.action?id=${chartId}&width=700&height=500' )">
+    #if ( $chart )
+        <img style="cursor:pointer" src="getChart.action?id=${chart.id}" onclick="viewChart( 'getChart.action?id=${chart.id}&width=700&height=500' )">
     #else
         <span class="labelText">$i18n.getString( 'this_is_a_chart_area' )</span>
     #end
@@ -71,7 +82,7 @@
 
 #if( $startHr )<tr> #end
 	<td style="width:305px; padding-left: 10px;">
-		#dropDownButtonDiv( "chartDropDown${count1}" "chartArea${count1}" )
+		#chartDropDownButtonDiv( "chartDropDown${count1}" "chartArea${count1}" $chart )
 		#chartDropDownListDiv( "chartArea${count1}" "chartDropDown${count1}" $chart )
 	</td>
 #end