← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3859: added $.dialog() popup for charts on dashboard

 

------------------------------------------------------------
revno: 3859
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-06-09 21:07:37 +0200
message:
  added $.dialog() popup for charts on 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/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-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js


--
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	2011-04-11 09:14:35 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/action/ProvideContentAction.java	2011-06-09 19:07:37 +0000
@@ -74,7 +74,7 @@
     {
         this.userSettingManager = userSettingManager;
     }
-    
+
     private MessageService messageService;
 
     public void setMessageService( MessageService messageService )
@@ -106,7 +106,7 @@
     {
         return chartAreas;
     }
-    
+
     private long messageCount;
 
     public long getMessageCount()
@@ -131,14 +131,14 @@
         Collections.sort( charts, new ChartTitleComparator() );
 
         int chartsInDashboardCount = userSettingManager.getChartsInDashboard();
-        
+
         for ( int i = 1; i <= chartsInDashboardCount; i++ )
         {
             chartAreas.add( content.get( DashboardManager.CHART_AREA_PREFIX + i ) );
         }
 
         messageCount = messageService.getUnreadMessageCount();
-        
+
         return SUCCESS;
     }
 }

=== 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	2010-03-08 07:37:39 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dropdown.js	2011-06-09 19:07:37 +0000
@@ -1,29 +1,40 @@
 
 function setAreaItem( area, item )
 {
-  var request = new Request();  
-  request.setCallbackSuccess( setAreaItemReceived );    
-  request.send( "setAreaItem.action?area=" + area + "&item=" + item );
+    var request = new Request();
+    request.setCallbackSuccess(setAreaItemReceived);
+    request.send("setAreaItem.action?area=" + area + "&item=" + item);
 }
 
 function setAreaItemReceived( messageElement )
 {
-  window.location.href = "index.action";
+    window.location.href = "index.action";
 }
 
 function clearArea( area )
 {
-  var request = new Request();  
-  request.setCallbackSuccess( clearAreaReceived );    
-  request.send( "clearArea.action?area=" + area );
+    var request = new Request();
+    request.setCallbackSuccess(clearAreaReceived);
+    request.send("clearArea.action?area=" + area);
 }
 
 function clearAreaReceived( messageElement )
 {
-  window.location.href = "index.action";
+    window.location.href = "index.action";
 }
 
 function viewChart( url )
 {
-    window.open( url, "_blank", "directories=no, height=560, width=760, location=no, menubar=no, status=no, toolbar=no, resizable=yes, scrollbars=yes" );
+    var width = size === 'wide' ? 1000 : 700;
+    var height = size === 'tall' ? 800 : 500;
+
+    $('#chartImage').attr('src', url);
+    $('#chartView').dialog({
+        autoOpen : true,
+        modal : true,
+        height : height + 35,
+        width : width,
+        resizable : false,
+        title : 'Viewing Chart'
+    });
 }

=== 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-04-19 10:06:23 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm	2011-06-09 19:07:37 +0000
@@ -34,8 +34,7 @@
         </ul>
     </div>
     #if ( $chartId )
-        <img style="cursor:pointer" src="getChart.action?id=${chartId}" 
-            onclick="viewChart( 'getChart.action?id=${chartId}&width=700&height=500' )">
+        <img style="cursor:pointer" src="getChart.action?id=${chartId}" onclick="viewChart( 'getChart.action?id=${chartId}&width=700&height=500' )">
     #else
         <span class="labelText">$i18n.getString( 'this_is_a_chart_area' )</span>
     #end
@@ -60,6 +59,7 @@
 	<td>
 
 <table>
+
 #set( $sizeHalf = $chartAreas.size() / 2 )
 
 #foreach( $chart in $chartAreas )
@@ -79,3 +79,7 @@
 	</td>
 </tr>
 </table>
+
+<div id="chartView" style="display: none; padding: 0; margin: 0;'">
+	<img id='chartImage' src=''></img>
+</div>

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js	2011-06-09 07:43:53 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js	2011-06-09 19:07:37 +0000
@@ -6,7 +6,7 @@
 {
     var width = size === 'wide' ? 1000 : 700;
     var height = size === 'tall' ? 800 : 500;
-    
+
     $('#chartImage').attr('src', url);
     $('#chartView').dialog({
        autoOpen: true,