dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14562
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4985: ui for completeness charts added, still missing completeness values
------------------------------------------------------------
revno: 4985
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-10-20 13:23:55 +0200
message:
ui for completeness charts added, still missing completeness values
added:
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartDataSetModeForm.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartDataSetOrgunitOrPeriodForm.vm
modified:
dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartForm.vm
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/jsonChart.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-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml 2011-09-22 09:15:51 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml 2011-10-20 11:23:55 +0000
@@ -12,13 +12,13 @@
<generator class="native" />
</id>
- <property name="uuid" length="40" />
+ <property name="uuid" length="40" />
<property name="title" not-null="true" unique="true" />
- <property name="domainAxixLabel" />
-
- <property name="rangeAxisLabel" />
+ <property name="domainAxixLabel" />
+
+ <property name="rangeAxisLabel" />
<property name="type" />
@@ -56,6 +56,13 @@
<many-to-many column="dataelementid" class="org.hisp.dhis.dataelement.DataElement" foreign-key="fk_chart_dataelements_dataelementid" />
</list>
+ <list name="dataSets" table="chart_datasets">
+ <cache usage="read-write" />
+ <key column="chartid" foreign-key="fk_chart_datasets_chartid" />
+ <list-index column="sort_order" base="0" />
+ <many-to-many column="datasetid" class="org.hisp.dhis.dataset.DataSet" foreign-key="fk_chart_datasets_datasetid" />
+ </list>
+
<list name="periods" table="chart_periods">
<cache usage="read-write" />
<key column="chartid" foreign-key="fk_chart_periods_chartid" />
@@ -70,12 +77,12 @@
<many-to-many column="organisationunitid" class="org.hisp.dhis.organisationunit.OrganisationUnit"
foreign-key="fk_chart_organisationunits_organisationunitid" />
</list>
-
- <set name="groups" table="chartgroupmembers" inverse="true">
- <cache usage="read-write" />
- <key column="chartid" />
- <many-to-many class="org.hisp.dhis.chart.ChartGroup" column="chartgroupid" />
- </set>
+
+ <set name="groups" table="chartgroupmembers" inverse="true">
+ <cache usage="read-write" />
+ <key column="chartid" />
+ <many-to-many class="org.hisp.dhis.chart.ChartGroup" column="chartgroupid" />
+ </set>
<component name="relatives">
<property name="reportingMonth" />
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java 2011-10-20 09:35:23 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java 2011-10-20 11:23:55 +0000
@@ -341,16 +341,16 @@
dataElements.add( dataElementService.getDataElement( id ) );
}
+ for ( Integer id : getIntegerCollection( selectedDataSets ) )
+ {
+ dataSets.add( dataSetService.getDataSet( id ) );
+ }
+
for ( Integer id : getIntegerCollection( selectedOrganisationUnits ) )
{
organisationUnits.add( organisationUnitService.getOrganisationUnit( id ) );
}
- for ( Integer id : getIntegerCollection( selectedDataSets ) )
- {
- dataSets.add( dataSetService.getDataSet( id ) );
- }
-
Collections.sort( periods, new AscendingPeriodComparator() );
chart.setTitle( title );
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties 2011-10-12 17:32:39 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties 2011-10-20 11:23:55 +0000
@@ -68,6 +68,7 @@
must_select_at_least_one_indictor_data_element_data_set = Please select at least one indicator, data element or data set
must_select_at_least_one_indicator = Please select at least one indicator
must_select_at_least_one_dataelement = Please select at least one data element
+must_select_at_least_one_dataset = Please select at least one dataset
must_select_at_least_one_unit= Please select at least one organisation unit
must_select_at_least_one_period= Please select at least one period
target_line_value_must_be_provided = Target line value must be provided when target lines are enabled.
@@ -171,14 +172,19 @@
add_indicator_chart = Add indicator chart
period_by_indicator_chart = Period by indicator chart
period_by_dataelement_chart = Period by data element chart
+period_by_completeness_chart = Period by completeness chart
indicator_by_period_chart= Indicator by period chart
dataelement_by_period_chart= Data element by period chart
+completeness_by_period_chart= Completeness by period chart
indicator_by_organisation_unit_chart= Indicator by organisation unit chart
dataelement_by_organisation_unit_chart= Data element by organisation unit chart
+completeness_by_organisation_unit_chart= Completeness by organisation unit chart
create_indicator_by_period_chart= Create indicator by period chart
create_dataelement_by_period_chart= Create data element by period chart
+create_completeness_by_period_chart= Create completeness by period chart
create_indicator_by_organisation_unit_chart= Create indicator by organisation unit chart
create_dataelement_by_organisation_unit_chart= Create data element by organisation unit chart
+create_completeness_by_organisation_unit_chart= Create completeness by organisation unit chart
dimension= Dimension
category_option_combos= Category Option Combinations
hide_legend= Hide legend
@@ -200,7 +206,9 @@
value_y_available_indicators= Value (Y) - Available indicators
value_y_selected_indicators= Value (Y) - Selected indicators
value_y_available_dataelements= Value (Y) - Available data elements
+value_y_available_datasets= Value (Y) - Available datasets
value_y_selected_dataelements= Value (Y) - Selected data elements
+value_y_selected_datasets= Value (Y) - Selected datasets
category_x_available_organisationunits= Category (X) - Available organisation units
category_x_selected_organisationunits= Category (X) - Selected organisation units
category_x_available_periods= Category (X) - Available periods
@@ -314,10 +322,13 @@
orgunit_distribution_report = Organisation Unit Distribution Report
create_period_by_indicator_chart = Create period by indicator chart
create_period_by_dataelement_chart = Create period by data element chart
+create_period_by_completeness_chart = Create period by completeness chart
value_x_selected_indicators = Value (X) - Selected indicators
value_x_available_indicators = Value (X) - Available indicators
value_x_selected_dataelements = Value (X) - Selected data elements
+value_x_selected_datasets = Value (X) - Selected datasets
value_x_available_dataelements = Value (X) - Available data elements
+value_x_available_datasets = Value (X) - Available datasets
category_y_selected_periods = Value (Y) - Selected periods
category_y_available_periods = Value (Y) - Available periods
get_current_design = Get current design
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartDataSetModeForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartDataSetModeForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartDataSetModeForm.vm 2011-10-20 11:23:55 +0000
@@ -0,0 +1,150 @@
+<table>
+<!-- Periods -->
+
+<tr>
+ <th colspan="2">$i18n.getString( "category_y_available_periods" )</th>
+</tr>
+<tr>
+ <td>
+ <input type="button" style="width:60px" value="$i18n.getString( 'prev' )" onclick="getAvailablePeriods( 'periodType', 'availablePeriods', 'selectedPeriods', '-1' )" />
+ <input type="button" style="width:60px" value="$i18n.getString( 'next' )" onclick="getAvailablePeriods( 'periodType', 'availablePeriods', 'selectedPeriods', '1' )" />
+ <select id="periodType" name="periodType" style="min-width:478px" onchange="getAvailablePeriods( 'periodType', 'availablePeriods', 'selectedPeriods', '0' )">
+ <option value="">[ $i18n.getString( "select_period_type_all" ) ]</option>
+ #foreach ( $type in $periodTypes )
+ <option value="$type.name">$i18n.getString( $type.name )</option>
+ #end
+ </select>
+ </td>
+</tr>
+<tr>
+ <td colspan="2">
+ <select multiple size="6" id="availablePeriods" name="availablePeriods" style="min-width:600px" ondblclick="moveSelectedById( 'availablePeriods', 'selectedPeriods' )">
+ #foreach ( $period in $availablePeriods )
+ <option value="$period.externalId">$format.formatPeriod( $period )</option>
+ #end
+ </select>
+ </td>
+</tr>
+
+<tr>
+ <td colspan="2">
+ <input type="button" value="$i18n.getString( 'add_selected' )" title="$i18n.getString( 'add_selected' )" style="width:120px" onclick="moveSelectedById( 'availablePeriods', 'selectedPeriods' )" />
+ <input type="button" value="$i18n.getString( 'add_all' )" title="$i18n.getString( 'add_all' )" style="width:120px" onclick="moveAllById( 'availablePeriods', 'selectedPeriods' )" />
+ <input type="button" value="$i18n.getString( 'remove_selected' )" title="$i18n.getString( 'remove_selected' )" style="width:120px" onclick="moveSelectedById( 'selectedPeriods', 'availablePeriods' )" />
+ <input type="button" value="$i18n.getString( 'remove_all' )" title="$i18n.getString( 'remove_all' )" style="width:120px" onclick="moveAllById( 'selectedPeriods', 'availablePeriods' )" />
+ </td>
+</tr>
+
+<tr>
+ <th colspan="2">$i18n.getString( "category_y_selected_periods" )</th>
+</tr>
+
+<tr>
+ <td>
+ <select size="6" id="selectedPeriods" name="selectedPeriods" style="min-width:600px" multiple ondblclick="moveSelectedById( 'selectedPeriods', 'availablePeriods' )">
+ #foreach ( $period in $selectedPeriods )
+ <option value="$period.externalId">$format.formatPeriod( $period )</option>
+ #end
+ </select>
+ </td>
+ <td></td>
+</tr>
+<tr>
+ <td colspan="2" style="height:15px"></td>
+</tr>
+<!-- Relative periods -->
+
+<tr>
+ <th colspan="2">$i18n.getString( "relative_periods" )</th>
+</tr>
+<tr>
+ <td>
+ <label for="reportingMonth">$i18n.getString( "reporting_month" )</label>
+ <input type="checkbox" id="reportingMonth" name="reportingMonth" value="true"#if( $chart.relatives.isReportingMonth() ) checked#end>
+ <label for="monthsThisYear">$i18n.getString( "months_this_year" )</label>
+ <input type="checkbox" id="monthsThisYear" name="monthsThisYear" value="true""#if( $chart.relatives.isMonthsThisYear() ) checked#end>
+ <label for="quartersThisYear">$i18n.getString( "quarters_this_year" )</label>
+ <input type="checkbox" id="quartersThisYear" name="quartersThisYear" value="true"#if( $chart.relatives.isQuartersThisYear() ) checked#end>
+ <label for="thisYear">$i18n.getString( "this_year" )</label>
+ <input type="checkbox" id="thisYear" name="thisYear" value="true"#if( $chart.relatives.isThisYear() ) checked#end><br><br>
+ <label for="monthsLastYear">$i18n.getString( "months_last_year" )</label>
+ <input type="checkbox" id="monthsLastYear" name="monthsLastYear" value="true""#if( $chart.relatives.isMonthsLastYear() ) checked#end>
+ <label for="quartersLastYear">$i18n.getString( "quarters_last_year" )</label>
+ <input type="checkbox" id="quartersLastYear" name="quartersLastYear" value="true"#if( $chart.relatives.isQuartersLastYear() ) checked#end>
+ <label for="lastYear">$i18n.getString( "last_year" )</label>
+ <input type="checkbox" id="lastYear" name="lastYear" value="true"#if( $chart.relatives.isLastYear() ) checked#end>
+ </td>
+</tr>
+<tr>
+ <td style="height:15px"></td>
+</tr>
+<!-- DataSets -->
+ <tr>
+ <th colspan="2">$i18n.getString( "value_x_available_datasets" )</th>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <select multiple size="6" id="availableDataSets" name="availableDataSets" style="min-width:600px" ondblclick="moveSelectedById( 'availableDataSets', 'selectedDataSets' )">
+ #foreach ( $dataSet in $availableDataSets )
+ <option value="$dataSet.id">$dataSet.name</option>
+ #end
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <input type="button" value="$i18n.getString( 'add_selected' )" title="$i18n.getString( 'add_selected' )" style="width:120px" onclick="moveSelectedById( 'availableDataSets', 'selectedDataSets' )" />
+ <input type="button" value="$i18n.getString( 'add_all' )" title="$i18n.getString( 'add_all' )" style="width:120px" onclick="moveAllById( 'availableDataSets', 'selectedDataSets' )" />
+ <input type="button" value="$i18n.getString( 'remove_selected' )" title="$i18n.getString( 'remove_selected' )" style="width:120px" onclick="moveSelectedById( 'selectedDataSets', 'availableDataSets' )" />
+ <input type="button" value="$i18n.getString( 'remove_all' )" title="$i18n.getString( 'remove_all' )" style="width:120px" onclick="moveAllById( 'selectedDataSets', 'availableDataSets' )" />
+ </td>
+ </tr>
+
+ <tr>
+ <th colspan="2">$i18n.getString( "value_x_selected_datasets" )</th>
+ </tr>
+
+ <tr>
+ <td>
+ <select multiple size="6" id="selectedDataSets" name="selectedDataSets" style="min-width:600px" ondblclick="moveSelectedById( 'selectedDataSets', 'availableDataSets' )">
+ #foreach( $dataSet in $selectedDataSets )
+ <option value="$dataSet.id">$dataSet.name</option>
+ #end
+ </select>
+ </td>
+ <td>
+ <a href="#" onclick="moveUpSelectedOption( 'selectedDataSets' )"><img src="../images/move_up.png" border="0" alt=""></a><br><br>
+ <a href="#" onclick="moveDownSelectedOption( 'selectedDataSets' )"><img src="../images/move_down.png" border="0" alt=""></a>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" style="height:15px"></td>
+ </tr>
+
+<!-- OrganisationUnit -->
+
+<tr>
+ <th colspan="2">$i18n.getString( "filter_available_organisationunits" ) - <a href="javascript:clearListById( 'selectedOrganisationUnits' )">$i18n.getString( 'clear' )</a></th>
+</tr>
+
+<tr>
+ <td colspan="2">
+ <select id="organisationUnitLevel" name="organisationUnitLevel" style="min-width:600px" onchange="getOrganisationUnitsToSelected()">
+ <option value="$ALL">[ $i18n.getString( "select_organisationunit_level_all" ) ]</option>
+ #foreach ( $level in $levels )
+ <option value="$level.level">$encoder.htmlEncode( $level.name )</option>
+ #end
+ </select>
+ </td>
+</tr>
+<tr>
+ <td colspan="2">
+ <select id="selectedOrganisationUnits" name="selectedOrganisationUnits" style="min-width:600px">
+ #foreach ( $unit in $selectedOrganisationUnits )
+ <option value="$unit.id">$unit.name</option>
+ #end
+ </select>
+ </td>
+</tr>
+
+</table>
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartDataSetOrgunitOrPeriodForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartDataSetOrgunitOrPeriodForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartDataSetOrgunitOrPeriodForm.vm 2011-10-20 11:23:55 +0000
@@ -0,0 +1,64 @@
+<table>
+
+ <col>
+ <col width="16">
+
+ <!-- Data elements -->
+ <tr>
+ <th colspan="2">$i18n.getString( "value_y_available_datasets" )</th>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <select multiple size="6" id="availableDataSets" name="availableDataSets" style="min-width:600px" ondblclick="moveSelectedById( 'availableDataSets', 'selectedDataSets' )">
+ #foreach ( $dataSet in $availableDataSets )
+ <option value="$dataSet.id">$dataSet.name</option>
+ #end
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <input type="button" value="$i18n.getString( 'add_selected' )" title="$i18n.getString( 'add_selected' )" style="width:120px" onclick="moveSelectedById( 'availableDataSets', 'selectedDataSets' )" />
+ <input type="button" value="$i18n.getString( 'add_all' )" title="$i18n.getString( 'add_all' )" style="width:120px" onclick="moveAllById( 'availableDataSets', 'selectedDataSets' )" />
+ <input type="button" value="$i18n.getString( 'remove_selected' )" title="$i18n.getString( 'remove_selected' )" style="width:120px" onclick="moveSelectedById( 'selectedDataSets', 'availableDataSets' )" />
+ <input type="button" value="$i18n.getString( 'remove_all' )" title="$i18n.getString( 'remove_all' )" style="width:120px" onclick="moveAllById( 'selectedDataSets', 'availableDataSets' )" />
+ </td>
+ </tr>
+
+ <tr>
+ <th colspan="2">$i18n.getString( "value_y_selected_datasets" )</th>
+ </tr>
+
+ <tr>
+ <td>
+ <select multiple size="6" id="selectedDataSets" name="selectedDataSets" style="min-width:600px" ondblclick="moveSelectedById( 'selectedDataSets', 'availableDataSets' )">
+ #foreach( $dataSet in $selectedDataSets )
+ <option value="$dataSet.id">$dataSet.name</option>
+ #end
+ </select>
+ </td>
+ <td>
+ <a href="#" onclick="moveUpSelectedOption( 'selectedDataSets' )"><img src="../images/move_up.png" border="0" alt=""></a><br><br>
+ <a href="#" onclick="moveDownSelectedOption( 'selectedDataSets' )"><img src="../images/move_down.png" border="0" alt=""></a>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" style="height:15px"></td>
+ </tr>
+
+ <!-- Category -->
+
+ #if ( $dimension == "period_completeness" )
+ #parse( "dhis-web-reporting/addChartPeriodModeForm.vm" )
+ #else
+ #parse( "dhis-web-reporting/addChartOrganisationUnitModeForm.vm" )
+ #end
+
+ <tr>
+ <td colspan="2" style="height:15px"></td>
+ </tr>
+
+</table>
+
+</form>
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartForm.vm 2011-09-07 13:14:46 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartForm.vm 2011-10-20 11:23:55 +0000
@@ -20,6 +20,7 @@
var i18n_must_select_at_least_one_indicator = '$encoder.jsEscape( $i18n.getString( "must_select_at_least_one_indicator" ), "'")';
var i18n_must_select_at_least_one_dataelement = '$encoder.jsEscape( $i18n.getString( "must_select_at_least_one_dataelement" ), "'")';
+ var i18n_must_select_at_least_one_dataset = '$encoder.jsEscape( $i18n.getString( "must_select_at_least_one_dataset" ), "'")';
var i18n_must_select_at_least_one_unit = '$encoder.jsEscape( $i18n.getString( "must_select_at_least_one_unit" ), "'")';
var i18n_must_select_at_least_one_period = '$encoder.jsEscape( $i18n.getString( "must_select_at_least_one_period" ), "'")';
var i18n_target_line_value_must_be_provided = '$encoder.jsEscape( $i18n.getString( "target_line_value_must_be_provided" ), "'")';
@@ -31,14 +32,20 @@
$i18n.getString( "create_period_by_indicator_chart" )
#elseif( $dimension == "period_dataElement" )
$i18n.getString( "create_period_by_dataelement_chart" )
+ #elseif( $dimension == "period_completeness" )
+ $i18n.getString( "create_period_by_completeness_chart" )
#elseif ( $dimension == "organisationUnit" )
$i18n.getString( "create_indicator_by_organisation_unit_chart" )
#elseif ( $dimension == "organisationUnit_dataElement" )
$i18n.getString( "create_dataelement_by_organisation_unit_chart" )
+ #elseif ( $dimension == "organisationUnit_completeness" )
+ $i18n.getString( "create_completeness_by_organisation_unit_chart" )
#elseif ( $dimension == "indicator" )
$i18n.getString( "create_indicator_by_period_chart" )
#elseif ( $dimension == "dataElement_period" )
$i18n.getString( "create_dataelement_by_period_chart" )
+ #elseif ( $dimension == "completeness_period" )
+ $i18n.getString( "create_completeness_by_period_chart" )
#end
#end
@@ -59,7 +66,7 @@
</tr>
<tr>
<td><label for="domainAxisLabel">$i18n.getString( "domain_axis_label_x" )</label></td>
- <td><input type="text" id="domainAxisLabel" name="domainAxisLabel" style="width:300px" value="$!chart.domainAxisLabel"></td>
+ <td><input type="text" id="domainAxisLabel" name="domainAxisLabel" style="width:300px" value="$!chart.domainAxixLabel"></td>
</tr>
<tr>
<td><label for="rangeAxisLabel">$i18n.getString( "range_axis_label_y" )</label></td>
@@ -137,26 +144,30 @@
#parse( "dhis-web-reporting/addChartOrgunitOrPeriodForm.vm" )
#elseif( $dimension == "period_dataElement" )
#parse( "dhis-web-reporting/addChartDataElementOrgunitOrPeriodForm.vm" )
+#elseif( $dimension == "period_completeness" )
+ #parse( "dhis-web-reporting/addChartDataSetOrgunitOrPeriodForm.vm" )
#elseif ( $dimension == "organisationUnit" )
#parse( "dhis-web-reporting/addChartOrgunitOrPeriodForm.vm" )
#elseif ( $dimension == "organisationUnit_dataElement" )
#parse( "dhis-web-reporting/addChartDataElementOrgunitOrPeriodForm.vm" )
+#elseif ( $dimension == "organisationUnit_completeness" )
+ #parse( "dhis-web-reporting/addChartDataSetOrgunitOrPeriodForm.vm" )
#elseif ( $dimension == "indicator" )
#parse( "dhis-web-reporting/addChartIndicatorModeForm.vm" )
#elseif ( $dimension == "dataElement_period" )
#parse( "dhis-web-reporting/addChartDataElementModeForm.vm" )
+#elseif ( $dimension == "completeness_period" )
+ #parse( "dhis-web-reporting/addChartDataSetModeForm.vm" )
#end
<table>
<!-- Submit -->
-
<tr>
<td colspan="2">
- <input type="button" value="$i18n.getString( 'save' )" onclick="saveChart()" style="width:120px" />
+ <input type="button" value="$i18n.getString( 'save' )" onclick="saveChart('$dimension')" style="width:120px" />
<input type="button" value="$i18n.getString( 'back' )" onclick="javascript:window.location.href='displayViewChartForm.action'" style="width:120px" />
</td>
</tr>
-
</table>
</form>
=== 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-10-11 14:15:32 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js 2011-10-20 11:23:55 +0000
@@ -33,75 +33,97 @@
function showChartDetails( chartId )
{
- jQuery.post( 'getChart.action', { id: chartId }, function ( json ) {
- var indicators = parseInt( json.chart.indicators );
- var dataElements = parseInt( json.chart.dataElements );
-
- setInnerHTML( 'titleField', json.chart.title );
- setInnerHTML( 'dimensionField', json.chart.dimension );
-
- if ( dataElements === 0 )
- {
- $( '#dataElementsView' ).hide();
- $( '#indicatorsView' ).show();
-
- $( '#indicatorsField' ).text( indicators );
- } else
- {
- $( '#dataElementsView' ).show();
- $( '#indicatorsView' ).hide();
-
- $( '#dataElementsField' ).text( dataElements );
- }
-
- setInnerHTML( 'periodsField', json.chart.periods );
- setInnerHTML( 'organisationUnitsField', json.chart.organisationUnits );
-
- showDetails();
- });
+ jQuery.post( 'getChart.action', {
+ id : chartId
+ }, function( json )
+ {
+ var indicators = parseInt( json.chart.indicators );
+ var dataElements = parseInt( json.chart.dataElements );
+ var dataSets = parseInt( json.chart.dataSets );
+
+ setInnerHTML( 'titleField', json.chart.title );
+ setInnerHTML( 'dimensionField', json.chart.dimension );
+
+ if ( isIndicatorChart( json.chart.dimension ) )
+ {
+ $( '#dataElementsView' ).hide();
+ $( '#dataSetsView' ).hide();
+ $( '#indicatorsView' ).show();
+
+ $( '#indicatorsField' ).text( indicators );
+ }
+ else if ( isDataElementChart( json.chart.dimension ) )
+ {
+ $( '#indicatorsView' ).hide();
+ $( '#dataSetsView' ).hide();
+ $( '#dataElementsView' ).show();
+
+ $( '#dataElementsField' ).text( dataElements );
+ }
+ else if ( isCompletenessChart( json.chart.dimension ) )
+ {
+ $( '#indicatorsView' ).hide();
+ $( '#dataElementsView' ).hide();
+ $( '#dataSetsView' ).show();
+
+ $( '#dataSetsField' ).text( dataSets );
+ }
+
+ setInnerHTML( 'periodsField', json.chart.periods );
+ setInnerHTML( 'organisationUnitsField', json.chart.organisationUnits );
+
+ showDetails();
+ } );
}
// -----------------------------------------------------------------------------
// Validate and save
// -----------------------------------------------------------------------------
-
-function saveChart()
+function saveChart( dimension )
{
- if ( validateTargetLine() && validateCollections() )
+ if ( validateTargetLine() && validateCollections( dimension ) )
{
- $.postJSON( "validateChart.action", { id:getFieldValue( "id" ), title:getFieldValue( "title" ) }, function( json )
- {
- if ( json.response == "input" )
- {
- setMessage( json.message );
- return false;
- }
- else if ( json.response == "success" )
- {
- if ( $( "#selectedIndicators" ).attr( 'multiple' ) !== undefined )
- {
- $( "#selectedIndicators" ).children().attr( "selected", true );
- }
-
- if ( $( "#selectedDataElements" ).attr( 'multiple' ) !== undefined )
- {
- $( "#selectedDataElements" ).children().attr( "selected", true );
- }
-
- if ( $( "#selectedPeriods" ).attr( 'multiple' ) !== undefined )
- {
- $( "#selectedPeriods" ).children().attr( "selected", true );
- }
-
- if ( $( "#selectedOrganisationUnits" ).attr( 'multiple' ) !== undefined )
- {
- $( "#selectedOrganisationUnits" ).children().attr( "selected", true );
- }
-
- $( "#chartForm" ).submit();
- }
- } );
+ $.postJSON( "validateChart.action", {
+ id : getFieldValue( "id" ),
+ title : getFieldValue( "title" )
+ }, function( json )
+ {
+ if ( json.response == "input" )
+ {
+ setMessage( json.message );
+ return false;
+ }
+ else if ( json.response == "success" )
+ {
+ if ( $( "#selectedIndicators" ).attr( 'multiple' ) !== undefined )
+ {
+ $( "#selectedIndicators" ).children().attr( "selected", true );
+ }
+
+ if ( $( "#selectedDataElements" ).attr( 'multiple' ) !== undefined )
+ {
+ $( "#selectedDataElements" ).children().attr( "selected", true );
+ }
+
+ if ( $( "#selectedDataSets" ).attr( 'multiple' ) !== undefined )
+ {
+ $( "#selectedDataSets" ).children().attr( "selected", true );
+ }
+
+ if ( $( "#selectedPeriods" ).attr( 'multiple' ) !== undefined )
+ {
+ $( "#selectedPeriods" ).children().attr( "selected", true );
+ }
+
+ if ( $( "#selectedOrganisationUnits" ).attr( 'multiple' ) !== undefined )
+ {
+ $( "#selectedOrganisationUnits" ).children().attr( "selected", true );
+ }
+
+ $( "#chartForm" ).submit();
+ }
+ } );
}
}
@@ -141,15 +163,61 @@
return true;
}
-function validateCollections()
-{
- if ( !hasElements( "selectedIndicators" ) && !hasElements( "selectedDataElements" ) )
+function isIndicatorChart( dimension )
+{
+ if ( dimension == "period" || dimension == "organisationUnit" || dimension == "indicator" )
+ {
+ return true;
+ }
+
+ return false;
+}
+
+function isDataElementChart( dimension )
+{
+ if ( dimension == "period_dataElement" || dimension == "organisationUnit_dataElement"
+ || dimension == "dataElement_period" )
+ {
+ return true;
+ }
+
+ return false;
+}
+
+function isCompletenessChart( dimension )
+{
+ if ( dimension == "period_completeness" || dimension == "organisationUnit_completeness"
+ || dimension == "completeness_period" )
+ {
+ return true;
+ }
+
+ return false;
+}
+
+function validateCollections( dimension )
+{
+ if ( isIndicatorChart( dimension ) && !hasElements( "selectedIndicators" ) )
{
setMessage( i18n_must_select_at_least_one_indicator );
return false;
}
+ if ( isDataElementChart( dimension ) && !hasElements( "selectedDataElements" ) )
+ {
+ setMessage( i18n_must_select_at_least_one_dataelement );
+
+ return false;
+ }
+
+ if ( isCompletenessChart( dimension ) && !hasElements( "selectedDataSets" ) )
+ {
+ setMessage( i18n_must_select_at_least_one_dataset );
+
+ return false;
+ }
+
if ( !hasElements( "selectedOrganisationUnits" ) && !isChecked( "userOrganisationUnit" ) )
{
setMessage( i18n_must_select_at_least_one_unit );
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonChart.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonChart.vm 2011-09-29 06:40:09 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonChart.vm 2011-10-20 11:23:55 +0000
@@ -5,6 +5,7 @@
"dimension": "$!encoder.jsonEncode( ${chart.dimension} )",
"indicators": "$!{chart.indicators.size()}",
"dataElements": "$!{chart.dataElements.size()}",
+ "dataSets": "$!{chart.dataSets.size()}",
"periods": "$!{chart.periods.size()}",
"organisationUnits": "$!{chart.organisationUnits.size()}"
}
=== 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-14 08:01:50 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewChartForm.vm 2011-10-20 11:23:55 +0000
@@ -26,10 +26,16 @@
<select id="chart_type">
<option value='indicator'>$i18n.getString( 'indicator_by_period_chart' )</option>
<option value='organisationUnit'>$i18n.getString( 'indicator_by_organisation_unit_chart' )</option>
+
<option value='dataElement_period'>$i18n.getString( 'dataelement_by_period_chart' )</option>
<option value='organisationUnit_dataElement'>$i18n.getString( 'dataelement_by_organisation_unit_chart' )</option>
+
+ <option value='completeness_period'>$i18n.getString( 'completeness_by_period_chart' )</option>
+ <option value='organisationUnit_completeness'>$i18n.getString( 'completeness_by_organisation_unit_chart' )</option>
+
<option value='period'>$i18n.getString( 'period_by_indicator_chart' )</option>
<option value='period_dataElement'>$i18n.getString( 'period_by_dataelement_chart' )</option>
+ <option value='period_completeness'>$i18n.getString( 'period_by_completeness_chart' )</option>
</select>
<button type="button" id="add_chart">$i18n.getString( 'add' )</button>
</td>
@@ -72,6 +78,7 @@
<p><label>$i18n.getString( "dimension" ):</label><br><span id="dimensionField"></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 id='dataSetsView'><label>$i18n.getString( "datasets" ):</label><br><span id="dataSetsField"></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>