← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1449: Implemented sorting of selected elements in charts.

 

------------------------------------------------------------
revno: 1449
committer: Lars Helge Oeverland <larshelge@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-02-18 16:41:11 +0100
message:
  Implemented sorting of selected elements in charts.
modified:
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ConversionUtils.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryComboForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GetChartOptionsAction.java
  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/webapp/dhis-web-reporting/addChartForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartOrganisationUnitModeForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartPeriodModeForm.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-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ConversionUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ConversionUtils.java	2010-01-29 09:05:27 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ConversionUtils.java	2010-02-18 15:41:11 +0000
@@ -71,6 +71,7 @@
             throw new RuntimeException( "Failed to convert objects", ex );
         }
     }
+    
     /**
      * Returns the identifier of the argument object. The object is assumed to
      * have a <code>int getId()</code> method.

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties	2010-02-01 20:21:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties	2010-02-18 15:41:11 +0000
@@ -29,7 +29,7 @@
 clear_dataset_completeness											= Clear dataset completeness
 clear_hierarchy_history												= Clear hierarchy history
 clear_zero_values													= Clear zero values
-group_set_structure													= Exclusive organisation unit groupset structure
+group_set_structure													= Organisation unit groupset structure normalized
 organisation_unit_structure											= Organisation unit structure
 data_element_category_option_combo_name								= Data element category option combo name
 generate_resource_tables											= Generate tables

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryComboForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryComboForm.vm	2010-02-09 09:10:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/addDataElementCategoryComboForm.vm	2010-02-18 15:41:11 +0000
@@ -59,7 +59,7 @@
         </td>
 		<td valign="top" align="center">		 
           <input type="button" value="&gt;" onclick="move( 'availableList' )"><br>	
-		  <input type="button" value="&lt;" onclick="move ( 'selectedList' )">	<br>	<br>  	
+		  <input type="button" value="&lt;" onclick="move ( 'selectedList' )"><br><br>  	
 		  <a href="#" onclick="moveUp('selectedList')"><img src="../images/move_up.png" border="0" alt=""></a><br><br>
 		  <a href="#" onclick="moveDown('selectedList')"><img src="../images/move_down.png" border="0" alt=""></a>		  
         </td> 

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GetChartOptionsAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GetChartOptionsAction.java	2009-08-20 08:17:49 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/GetChartOptionsAction.java	2010-02-18 15:41:11 +0000
@@ -244,10 +244,6 @@
             selectedOrganisationUnits = chart.getOrganisationUnits();
             availableOrganisationUnits.removeAll( selectedOrganisationUnits );
             
-            Collections.sort( selectedIndicators, indicatorComparator );
-            Collections.sort( selectedPeriods, new PeriodComparator() );
-            Collections.sort( selectedOrganisationUnits, organisationUnitComparator );
-
             displayPropertyHandler.handle( selectedIndicators );
             displayPropertyHandler.handle( selectedOrganisationUnits );
         }

=== 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	2009-11-23 11:51:03 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chart/action/SaveChartAction.java	2010-02-18 15:41:11 +0000
@@ -42,8 +42,6 @@
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.reporttable.RelativePeriods;
 
-import static org.hisp.dhis.system.util.ConversionUtils.*;
-
 import com.opensymphony.xwork2.Action;
 
 /**
@@ -272,10 +270,25 @@
     {
         Chart chart = new Chart();
 
-        List<Indicator> indicators = getList( indicatorService.getIndicators( getIntegerCollection( selectedIndicators ) ) );
-        List<Period> periods = getList( periodService.getPeriods( getIntegerCollection( selectedPeriods ) ) );        
-        List<OrganisationUnit> organisationUnits = getList( organisationUnitService.getOrganisationUnits( getIntegerCollection( selectedOrganisationUnits ) ) );
-
+        List<Indicator> indicators = new ArrayList<Indicator>();
+        List<Period> periods = new ArrayList<Period>();
+        List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>();
+        
+        for ( Integer id : getIntegerCollection( selectedIndicators ) )
+        {
+            indicators.add( indicatorService.getIndicator( id ) );
+        }
+        
+        for ( Integer id : getIntegerCollection( selectedPeriods ) )
+        {
+            periods.add( periodService.getPeriod( id ) );
+        }
+        
+        for ( Integer id : getIntegerCollection( selectedOrganisationUnits ) )
+        {
+            organisationUnits.add( organisationUnitService.getOrganisationUnit( id ) );
+        }
+        
         chart.setId( id != null ? id : 0 );
         chart.setTitle( title );
         chart.setType( type );
@@ -289,6 +302,8 @@
         chart.setPeriods( periods );
         chart.setOrganisationUnits( organisationUnits );
 
+        //TODO currently not in use
+        
         RelativePeriods relatives = new RelativePeriods();
         
         relatives.setReportingMonth( reportingMonth );

=== 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	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartForm.vm	2010-02-18 15:41:11 +0000
@@ -65,14 +65,16 @@
 </table>
 
 <table>
-        
+
+    <col>       
+    <col width="16">
+    	
     <!-- Indicators -->
-    
     <tr>
-        <th>$i18n.getString( "value_y_available_indicators" )</th>      
+        <th colspan="2">$i18n.getString( "value_y_available_indicators" )</th>
     </tr>
     <tr>
-        <td>
+        <td colspan="2">
             <select id="indicatorGroupId" name="indicatorGroupId" style="min-width:600px" onchange="getIndicators()">
                 <option value="$ALL">[ $i18n.getString( "select_indicatorgroup_all" ) ]</option>
                 #foreach ( $group in $indicatorGroups )
@@ -80,9 +82,10 @@
                 #end
             </select>
         </td>
+        <td></td>
     </tr>
     <tr>
-        <td>
+        <td colspan="2">
             <select multiple size="6" id="availableIndicators" name="availableIndicators" style="min-width:600px" ondblclick="moveSelectedById( 'availableIndicators', 'selectedIndicators' )">             
                 #foreach ( $indicator in $availableIndicators )
                     <option value="$indicator.id">$indicator.name</option>
@@ -91,7 +94,7 @@
         </td>
     </tr>
     <tr>
-        <td>
+        <td colspan="2">
             <input type="button" value="$i18n.getString( 'add_selected' )" title="$i18n.getString( 'add_selected' )" style="width:120px" onclick="moveSelectedById( 'availableIndicators', 'selectedIndicators' )"><input 
                 type="button" value="$i18n.getString( 'add_all' )" title="$i18n.getString( 'add_all' )" style="width:120px" onclick="moveAllById( 'availableIndicators', 'selectedIndicators' )"><input 
                 type="button" value="$i18n.getString( 'remove_selected' )" title="$i18n.getString( 'remove_selected' )" style="width:120px" onclick="moveSelectedById( 'selectedIndicators', 'availableIndicators' )"><input 
@@ -99,7 +102,7 @@
         </td>
     </tr>
     <tr>
-        <th>$i18n.getString( "value_y_selected_indicators" )</th>
+        <th colspan="2">$i18n.getString( "value_y_selected_indicators" )</th>
     </tr>
     <tr>
         <td>
@@ -107,11 +110,15 @@
                 #foreach( $indicator in $selectedIndicators )
                     <option value="$indicator.id">$indicator.name</option>
                 #end
-            </select>
+            </select>                  
+        </td>
+        <td>
+            <a href="#" onclick="moveUpSelectedOption( 'selectedIndicators' )"><img src="../images/move_up.png" border="0" alt=""></a><br><br>
+            <a href="#" onclick="moveDownSelectedOption( 'selectedIndicators' )"><img src="../images/move_down.png" border="0" alt=""></a>        
         </td>
     </tr>
     <tr>
-        <td style="height:15px"></td>
+        <td colspan="2" style="height:15px"></td>
     </tr>
     
     <!-- Category -->
@@ -123,13 +130,13 @@
     #end    
     
     <tr>
-        <td style="height:15px"></td>
+        <td colspan="2" style="height:15px"></td>
     </tr>
     
     <!-- Submit -->
     
     <tr>        
-        <td>
+        <td colspan="2">
             <input type="button" value="$i18n.getString( 'save' )"onclick="saveChart()" style="width:120px"><input 
                 type="button" value="$i18n.getString( 'back' )" onclick="javascript:window.location.href='displayViewChartForm.action'" style="width:120px">
         </td>

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartOrganisationUnitModeForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartOrganisationUnitModeForm.vm	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartOrganisationUnitModeForm.vm	2010-02-18 15:41:11 +0000
@@ -2,10 +2,10 @@
 <!-- OrganisationUnit -->
 
 <tr>
-    <th>$i18n.getString( "category_x_available_organisationunits" )</th>
+    <th colspan="2">$i18n.getString( "category_x_available_organisationunits" )</th>
 </tr>
 <tr>
-    <td>
+    <td colspan="2">
         <select id="organisationUnitLevel" name="organisationUnitLevel" style="min-width:600px" onchange="getOrganisationUnits()">
             <option value="$ALL">[ $i18n.getString( "select_organisationunit_level_all" ) ]</option>
             #foreach ( $level in $levels )
@@ -15,7 +15,7 @@
     </td>
 </tr>
 <tr>
-    <td>
+    <td colspan="2">
         <select multiple size="6" id="availableOrganisationUnits" name="availableOrganisationUnits" style="min-width:600px" ondblclick="moveSelectedById( 'availableOrganisationUnits', 'selectedOrganisationUnits' )">
             #foreach ( $unit in $availableOrganisationUnits )
                 <option value="$unit.id">$unit.name</option>
@@ -24,7 +24,7 @@
     </td>
 </tr>
 <tr>
-    <td>
+    <td colspan="2">
         <input type="button" value="$i18n.getString( 'add_selected' )" title="$i18n.getString( 'add_selected' )" style="width:120px" onclick="moveSelectedById( 'availableOrganisationUnits', 'selectedOrganisationUnits' )"><input 
             type="button" value="$i18n.getString( 'add_all' )" title="$i18n.getString( 'add_all' )" style="width:120px" onclick="moveAllById( 'availableOrganisationUnits', 'selectedOrganisationUnits' )"><input 
             type="button" value="$i18n.getString( 'add_children' )" title="$i18n.getString( 'add_children' )" style="width:120px" onclick="getOrganisationUnitChildren()"><input 
@@ -33,7 +33,7 @@
     </td>
 </tr>
 <tr>
-    <th>$i18n.getString( "category_x_selected_organisationunits" )</th>
+    <th colspan="2">$i18n.getString( "category_x_selected_organisationunits" )</th>
 </tr>
 <tr>
     <td>
@@ -43,18 +43,22 @@
             #end
         </select>
     </td>
+    <td>
+        <a href="#" onclick="moveUpSelectedOption( 'selectedOrganisationUnits' )"><img src="../images/move_up.png" border="0" alt=""></a><br><br>
+        <a href="#" onclick="moveDownSelectedOption( 'selectedOrganisationUnits' )"><img src="../images/move_down.png" border="0" alt=""></a>        
+    </td>
 </tr>
 <tr>
-    <td style="height:15px"></td>
+    <td colspan="2" style="height:15px"></td>
 </tr>
 
 <!-- Period -->
 
 <tr>
-    <th>$i18n.getString( "filter_available_periods" )</th>
+    <th colspan="2">$i18n.getString( "filter_available_periods" )</th>
 </tr>
 <tr>
-    <td>
+    <td colspan="2">
         <select id="periodTypeId" name="periodTypeId" style="min-width:600px" onchange="getPeriodsToSelected()">
             <option value="null">[ $i18n.getString( "select_period_type_all" ) ]</option>
             #foreach ( $type in $periodTypes )
@@ -64,7 +68,7 @@
     </td>
 </tr>
 <tr>
-    <td>
+    <td colspan="2">
         <select id="selectedPeriods" name="selectedPeriods" style="min-width:600px">               
             #foreach ( $period in $selectedPeriods )
                 <option value="$period.id">$format.formatPeriod( $period )</option>

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartPeriodModeForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartPeriodModeForm.vm	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartPeriodModeForm.vm	2010-02-18 15:41:11 +0000
@@ -2,10 +2,10 @@
 <!-- Periods -->
 
 <tr>
-    <th>$i18n.getString( "category_x_available_periods" )</th>
+    <th colspan="2">$i18n.getString( "category_x_available_periods" )</th>
 </tr>   
 <tr>
-    <td>
+    <td colspan="2">
         <select id="periodTypeId" name="periodTypeId" style="min-width:600px" onchange="getPeriods()">
             <option value="null">[ $i18n.getString( "select_period_type_all" ) ]</option>
             #foreach ( $type in $periodTypes )
@@ -15,7 +15,7 @@
     </td>
 </tr>
 <tr>
-    <td>
+    <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.id">$format.formatPeriod( $period )</option>
@@ -24,7 +24,7 @@
     </td>
 </tr>
 <tr>
-    <td>
+    <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 
@@ -32,7 +32,7 @@
     </td>
 </tr>
 <tr>
-    <th>$i18n.getString( "category_x_selected_periods" )</th>
+    <th colspan="2">$i18n.getString( "category_x_selected_periods" )</th>
 </tr>
 <tr>
     <td>
@@ -42,18 +42,22 @@
             #end
         </select>
     </td>
+    <td>
+        <a href="javascript:moveUpSelectedOption( 'selectedPeriods' )"><img src="../images/move_up.png" border="0" alt=""></a><br><br>
+        <a href="javascript:moveDownSelectedOption( 'selectedPeriods' )"><img src="../images/move_down.png" border="0" alt=""></a>        
+    </td>
 </tr>
 <tr>
-    <td style="height:15px"></td>
+    <td colspan="2" style="height:15px"></td>
 </tr>
 
 <!-- OrganisationUnit -->
 
 <tr>
-    <th>$i18n.getString( "filter_available_organisationunits" )</th>
+    <th colspan="2">$i18n.getString( "filter_available_organisationunits" )</th>
 </tr>
 <tr>
-    <td>
+    <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 )
@@ -63,7 +67,7 @@
     </td>
 </tr>
 <tr>
-    <td>
+    <td colspan="2">
         <select id="selectedOrganisationUnits" name="selectedOrganisationUnits" style="min-width:600px">               
             #foreach ( $unit in $selectedOrganisationUnits )
                 <option value="$unit.id">$unit.name</option>