← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3867: updated showDetails() for charts to include data elements

 

------------------------------------------------------------
revno: 3867
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-06-10 15:15:44 +0200
message:
  updated showDetails() for charts to include data elements
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/responseChart.vm
  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-09 20:24:19 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js	2011-06-10 13:15:44 +0000
@@ -41,9 +41,24 @@
 
 function chartReceived( xmlObject )
 {
+    var indicators = parseInt( getElementValue(xmlObject, 'indicators') );
+    var dataElements = parseInt( getElementValue(xmlObject, 'dataElements') );
+
     setInnerHTML('titleField', getElementValue(xmlObject, 'title'));
     setInnerHTML('dimensionField', getElementValue(xmlObject, 'dimension'));
-    setInnerHTML('indicatorsField', getElementValue(xmlObject, 'indicators'));
+
+    if( dataElements === 0) {
+        $('#dataElementsView').hide();
+        $('#indicatorsView').show();
+
+        $('#indicatorsField').text( indicators );
+    } else {
+        $('#dataElementsView').show();
+        $('#indicatorsView').hide();
+
+        $('#dataElementsField').text( dataElements );
+    }
+
     setInnerHTML('periodsField', getElementValue(xmlObject, 'periods'));
     setInnerHTML('organisationUnitsField', getElementValue(xmlObject, 'organisationUnits'));
 

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseChart.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseChart.vm	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseChart.vm	2011-06-10 13:15:44 +0000
@@ -4,6 +4,7 @@
 	<title>$encoder.xmlEncode( $chart.title )</title>
 	<dimension>$encoder.xmlEncode( $chart.dimension )</dimension>
 	<indicators>$chart.indicators.size()</indicators>
+	<dataElements>$chart.dataElements.size()</dataElements>
 	<periods>$chart.periods.size()</periods>
 	<organisationUnits>$chart.organisationUnits.size()</organisationUnits>
-</chart>
\ No newline at end of file
+</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-09 07:43:53 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewChartForm.vm	2011-06-10 13:15:44 +0000
@@ -70,7 +70,8 @@
                 </div>
                 <p><label>$i18n.getString( "title" ):</label><br><span id="titleField"></span></p>
                 <p><label>$i18n.getString( "dimension" ):</label><br><span id="dimensionField"></span></p>
-                <p><label>$i18n.getString( "indicators" ):</label><br><span id="indicatorsField"></span></p>
+                <p id='indicatorsView'><label>$i18n.getString( "indicators" ):</label><br><span id="indicatorsField"></span></p>
+                <p id='dataElementsView'><label>$i18n.getString( "dataelements" ):</label><br><span id="dataElementsField"></span></p>
                 <p><label>$i18n.getString( "periods" ):</label><br><span id="periodsField"></span></p>
                 <p><label>$i18n.getString( "organisation_units" ):</label><br><span id="organisationUnitsField"></span></p>
             </div>