← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3857: implemented $.dialog() popup for charts

 

------------------------------------------------------------
revno: 3857
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-06-09 09:43:53 +0200
message:
  implemented $.dialog() popup for charts
modified:
  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/viewChartForm.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-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-08 08:38:45 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js	2011-06-09 07:43:53 +0000
@@ -2,11 +2,20 @@
 // View chart
 // -----------------------------------------------------------------------------
 
-function viewChart( url )
+function viewChart( url, size )
 {
-    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-reporting/src/main/webapp/dhis-web-reporting/viewChartForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewChartForm.vm	2011-06-08 08:47:42 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewChartForm.vm	2011-06-09 07:43:53 +0000
@@ -49,7 +49,7 @@
                 <tr id="tr${chart.id}">
                     <td onclick="showChartDetails( $chart.id )">$encoder.htmlEncode( $chart.title )</td>
                     <td style="text-align:right">
-						<a href="javascript:viewChart( 'viewChart.action?id=$chart.id' )" title="$i18n.getString( "view_chart" )"><img src="../images/start_process.png" alt="$i18n.getString( "view_chart" )"></a>
+						<a href="javascript:viewChart( 'viewChart.action?id=$chart.id', '$chart.size' )" title="$i18n.getString( "view_chart" )"><img src="../images/start_process.png" alt="$i18n.getString( "view_chart" )"></a>
 						<a href="displayAddChartForm.action?id=$chart.id&dimension=$chart.dimension" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a>
 						#if( $auth.hasAccess( "dhis-web-reporting", "removeChart" ) )
 						<a href="javascript:removeChart( $chart.id, '$encoder.jsEncode( $chart.title )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a>
@@ -84,3 +84,7 @@
         </td>       
     </tr>
 </table>
+
+<div id="chartView" style="display: none; padding: 0; margin: 0;'">
+	<img id='chartImage' src=''></img>
+</div>