← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2968: [Mobile Dataset Page]: Load all mobile dataset instead for one orgunit.

 

------------------------------------------------------------
revno: 2968
committer: Tran Ng Minh Luan <Luan@MinhLuan-PC>
branch nick: dhis2
timestamp: Thu 2011-03-03 13:16:22 +0700
message:
  [Mobile Dataset Page]: Load all mobile dataset instead for one orgunit.
  [Edit Dataset Page]: Remove "Available for Mobile" checkbox
removed:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/menuWithTree.vm
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateDataSetStore.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/MobileDataSetListAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/index.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/menu.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/mobileDatasetList.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-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java	2011-02-15 06:36:28 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java	2011-03-03 06:16:22 +0000
@@ -203,11 +203,16 @@
     Collection<DataElement> getDataElements( DataSet dataSet );
     
     /**
-     * Returns all DataSets that can be collected through mobile.
+     * Returns all DataSets that can be collected through mobile (one organisation unit).
      */
     Collection<DataSet> getDataSetsForMobile(Source source);
 
     /**
+     * Returns all DataSets that can be collected through mobile (all organisation unit).
+     */
+    Collection<DataSet> getDataSetsForMobile();
+    
+    /**
      * Get list of realted datasets from categoryOption
      * 
      * @return A List containing related DataSets.

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetStore.java	2011-02-16 20:05:48 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetStore.java	2011-03-03 06:16:22 +0000
@@ -128,6 +128,8 @@
      * Returns all DataSets that can be collected through mobile.
      */
     Collection<DataSet> getDataSetsForMobile(Source source);
+    
+    Collection<DataSet> getDataSetsForMobile();
 
     Collection<DataSet> getDataSetsBySources( Collection<? extends Source> sources );
     

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java	2011-02-15 06:36:28 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java	2011-03-03 06:16:22 +0000
@@ -293,6 +293,10 @@
         return i18n( i18nService, dataSetStore.getDataSetsForMobile(source) );		
     }
     
+    public Collection<DataSet> getDataSetsForMobile(){
+        return i18n( i18nService, dataSetStore.getDataSetsForMobile() );
+    }
+    
     public Collection<DataSet> getMobileDataSetsFromCategoryOption(int categoryOptionId){
         return dataSetStore.getMobileDataSetsFromCategoryOption(categoryOptionId);
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateDataSetStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateDataSetStore.java	2011-02-15 06:36:28 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateDataSetStore.java	2011-03-03 06:16:22 +0000
@@ -208,8 +208,16 @@
         query.setEntity( "source", source );
 
         return query.list();
-
     }
+    
+    @SuppressWarnings( "unchecked" )
+    public Collection<DataSet> getDataSetsForMobile()
+    {
+        String hql = "from DataSet d where d.mobile = true";
+        Query query = sessionFactory.getCurrentSession().createQuery( hql );
+
+        return query.list();
+    }    
 
     public Collection<DataSet> getMobileDataSetsFromCategoryOption( int categoryOptionId )
     {

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/MobileDataSetListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/MobileDataSetListAction.java	2011-02-25 07:08:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/MobileDataSetListAction.java	2011-03-03 06:16:22 +0000
@@ -1,9 +1,13 @@
 package org.hisp.dhis.dataset.action;
 
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
 
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.dataset.comparator.DataSetNameComparator;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
 
@@ -23,36 +27,29 @@
         this.dataSetService = dataSetService;
     }
     
-    private OrganisationUnitSelectionManager selectionManager;
-
-    public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
-    {
-        this.selectionManager = selectionManager;
-    }
-    
     // -------------------------------------------------------------------------
     // Getters and Setters
     // -------------------------------------------------------------------------
-    private Collection<DataSet> dataSets;
+    private List<DataSet> dataSets;
     
-    public void setDataSets( Collection<DataSet> dataSets )
+    public void setDataSets( List<DataSet> dataSets )
     {
         this.dataSets = dataSets;
     }
     
-    public Collection<DataSet> getDataSets()
+    public List<DataSet> getDataSets()
     {
         return dataSets;
     }
     
-    private Collection<DataSet> mobileDatasets;
+    private List<DataSet> mobileDatasets;
 
-    public Collection<DataSet> getMobileDatasets()
+    public List<DataSet> getMobileDatasets()
     {
         return mobileDatasets;
     }
 
-    public void setMobileDatasets( Collection<DataSet> mobileDatasets )
+    public void setMobileDatasets( List<DataSet> mobileDatasets )
     {
         this.mobileDatasets = mobileDatasets;
     }
@@ -61,11 +58,11 @@
     public String execute()
         throws Exception
     {
-        OrganisationUnit selectedUnits =  selectionManager.getSelectedOrganisationUnit();
-        dataSets = dataSetService.getDataSetsBySource( selectedUnits );
-        mobileDatasets = dataSetService.getDataSetsForMobile( selectedUnits );
+        dataSets = new ArrayList<DataSet>(dataSetService.getAllDataSets());
+        mobileDatasets = new ArrayList<DataSet>(dataSetService.getDataSetsForMobile());
         dataSets.removeAll( mobileDatasets );
-        System.out.println("Number of datasets:"+ dataSets.size());
+        Collections.sort( dataSets, new DataSetNameComparator() );
+        Collections.sort( mobileDatasets, new DataSetNameComparator() );
         return SUCCESS;
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java	2011-01-06 13:41:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java	2011-03-03 06:16:22 +0000
@@ -88,13 +88,6 @@
         this.selectedList = selectedList;
     }
 
-    private boolean mobile;
-
-    public void setMobile( boolean mobile )
-    {
-        this.mobile = mobile;
-    }
-
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
@@ -157,7 +150,6 @@
         dataSet.setCode( code );
         dataSet.setPeriodType( periodService.getPeriodTypeByClass( periodType.getClass() ) );
         dataSet.setDataElements( dataElements );
-        dataSet.setMobile( mobile );
         
         if ( dataSet.isMobile() )
         {

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml	2011-02-25 07:08:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml	2011-03-03 06:16:22 +0000
@@ -143,9 +143,6 @@
 		<property name="dataSetService">
 			<ref bean="org.hisp.dhis.dataset.DataSetService"/>
 		</property>
-		<property name="selectionManager">
-			<ref bean="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager"/>
-		</property>
 	</bean>
 	
 	<bean id="org.hisp.dhis.dataset.action.UpdateMobileDataSetAction"

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml	2011-02-25 07:08:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml	2011-03-03 06:16:22 +0000
@@ -20,12 +20,7 @@
 			class="org.hisp.dhis.dataset.action.MobileDataSetListAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-maintenance-dataset/mobileDatasetList.vm</param>
-			<param name="menu">/dhis-web-maintenance-dataset/menuWithTree.vm</param>
-			<param name="menuTreeHeight">300</param>
-			<param name="javascripts">
-					../dhis-web-commons/ouwt/ouwt.js,javascript/organisationUnit.js,javascript/mobiledataset.js
-			</param>
-			<interceptor-ref name="organisationUnitTreeStack" />
+			<param name="menu">/dhis-web-maintenance-dataset/menu.vm</param>
 	</action>
 	
 	<action name="updateMobileDataset"

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm	2011-01-27 10:07:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm	2011-03-03 06:16:22 +0000
@@ -46,14 +46,7 @@
             #end
           </select>
         </td>
-      </tr>	 
-      <tr>
-		<td>$i18n.getString("available_for_mobile_reporting")</td>
-		<td>
-			<input type="checkbox" name="mobile" id="mobile" value="true" #if( $dataSet.mobile ) checked="checked"#end>
-		</td>
-	  </tr>
-	   
+      </tr>	   
       <tr><td>&nbsp;</td><td>&nbsp;</td></tr>
     </tbody>
   </table>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/index.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/index.vm	2011-02-25 07:08:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/index.vm	2011-03-03 06:16:22 +0000
@@ -3,7 +3,7 @@
 
 <ul id="introList">
     #introListImgItem( "dataSet.action" "dataset" "dataset" )
+    #introListImgItem( "showMobileDataSet.action" "mobile_dataset" "dataset" )
     #introListImgItem( "section.action" "dataset_section" "dataset" )
     #introListImgItem( "showAssignMultiDataSetForOrgunitForm.action" "dataset_assignment_editor" "dataset" )
-    #introListImgItem( "showMobileDataSet.action" "mobile_dataset" "dataset" )
 </ul>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/menu.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/menu.vm	2011-02-25 07:08:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/menu.vm	2011-03-03 06:16:22 +0000
@@ -2,7 +2,7 @@
 <h2>$i18n.getString( "dataset" )&nbsp;</h2>
 <ul>
 	<li><a href="dataSet.action">$i18n.getString( "dataset" )&nbsp;</a></li>
+	<li><a href="showMobileDataSet.action">$i18n.getString( "mobile_dataset" )&nbsp;</a></li>
 	<li><a href="section.action">$i18n.getString( "dataset_section" )&nbsp;</a></li>
 	<li><a href="showAssignMultiDataSetForOrgunitForm.action">$i18n.getString( "dataset_assignment_editor" )&nbsp;</a></li>
-	<li><a href="showMobileDataSet.action">$i18n.getString( "mobile_dataset" )&nbsp;</a></li>
 </ul>
\ No newline at end of file

=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/menuWithTree.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/menuWithTree.vm	2011-02-25 07:08:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/menuWithTree.vm	1970-01-01 00:00:00 +0000
@@ -1,5 +0,0 @@
-#parse( "/dhis-web-maintenance-dataset/menu.vm" )
-#parse( "/dhis-web-commons/ouwt/orgunittreesearch.vm" )
-<script>
-	selection.setListenerFunction( orgunitselected );
-</script>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/mobileDatasetList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/mobileDatasetList.vm	2011-02-25 07:08:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/mobileDatasetList.vm	2011-03-03 06:16:22 +0000
@@ -1,3 +1,4 @@
+<h3>$i18n.getString( "mobile_dataset" )</h3>
 <form id="updateMobileDataset" name="updateMobileDataset" action="updateMobileDataset.action" method="post">
 <table id="dataSetSelectionArea">
     <col/> ## Available DataSet of selected Organisation Unit