dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14612
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5021: (mobile) display children with dataset on orgunit selection
------------------------------------------------------------
revno: 5021
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-10-24 13:36:21 +0200
message:
(mobile) display children with dataset on orgunit selection
modified:
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetOrganisationUnitsAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/utils/SectionFormUtils.java
dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectOrganisationUnit.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-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetOrganisationUnitsAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetOrganisationUnitsAction.java 2011-10-14 09:32:58 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetOrganisationUnitsAction.java 2011-10-24 11:36:21 +0000
@@ -31,10 +31,9 @@
import java.util.Collections;
import java.util.List;
+import org.hisp.dhis.light.dataentry.utils.SectionFormUtils;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
-import org.hisp.dhis.system.filter.OrganisationUnitWithDataSetsFilter;
-import org.hisp.dhis.system.util.FilterUtils;
import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.user.User;
@@ -57,6 +56,18 @@
this.currentUserService = currentUserService;
}
+ private SectionFormUtils sectionFormUtils;
+
+ public void setSectionFormUtils( SectionFormUtils sectionFormUtils )
+ {
+ this.sectionFormUtils = sectionFormUtils;
+ }
+
+ public SectionFormUtils getSectionFormUtils()
+ {
+ return sectionFormUtils;
+ }
+
// -------------------------------------------------------------------------
// Input & Output
// -------------------------------------------------------------------------
@@ -81,7 +92,7 @@
{
organisationUnits = new ArrayList<OrganisationUnit>( user.getOrganisationUnits() );
Collections.sort( organisationUnits, new OrganisationUnitNameComparator() );
- FilterUtils.filter( organisationUnits, new OrganisationUnitWithDataSetsFilter() );
+ organisationUnits = sectionFormUtils.organisationUnitWithDataSetsFilter( organisationUnits );
}
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/utils/SectionFormUtils.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/utils/SectionFormUtils.java 2011-10-04 11:18:18 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/utils/SectionFormUtils.java 2011-10-24 11:36:21 +0000
@@ -49,6 +49,8 @@
import org.hisp.dhis.options.SystemSettingManager;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.period.Period;
+import org.hisp.dhis.system.filter.OrganisationUnitWithDataSetsFilter;
+import org.hisp.dhis.system.util.FilterUtils;
import org.hisp.dhis.system.util.ListUtils;
import org.hisp.dhis.validation.ValidationResult;
import org.hisp.dhis.validation.ValidationRule;
@@ -205,6 +207,14 @@
return dataValueMap;
}
+ public List<OrganisationUnit> organisationUnitWithDataSetsFilter( Collection<OrganisationUnit> organisationUnits )
+ {
+ List<OrganisationUnit> ous = new ArrayList<OrganisationUnit>( organisationUnits );
+ FilterUtils.filter( ous, new OrganisationUnitWithDataSetsFilter() );
+
+ return ous;
+ }
+
// -------------------------------------------------------------------------
// Static Utils
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2011-10-14 10:44:57 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2011-10-24 11:36:21 +0000
@@ -20,6 +20,7 @@
<bean id="org.hisp.dhis.light.dataentry.action.GetOrganisationUnitsAction" class="org.hisp.dhis.light.dataentry.action.GetOrganisationUnitsAction">
<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
+ <property name="sectionFormUtils" ref="org.hisp.dhis.light.dataentry.utils.SectionFormUtils" />
</bean>
<bean id="org.hisp.dhis.light.dataentry.action.GetDataSetsAction" class="org.hisp.dhis.light.dataentry.action.GetDataSetsAction">
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectOrganisationUnit.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectOrganisationUnit.vm 2011-10-14 13:06:43 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectOrganisationUnit.vm 2011-10-24 11:36:21 +0000
@@ -5,6 +5,11 @@
<ul>
#foreach( $organisationUnit in $organisationUnits )
<li><a href="selectDataSet.action?organisationUnitId=$organisationUnit.id">$!encoder.htmlEncode( ${organisationUnit.name} )</a></li>
+ #if( $organisationUnit.children.size() > 0 )
+ #foreach( $child in $sectionFormUtils.organisationUnitWithDataSetsFilter( $organisationUnit.children ))
+ <li>- <a href="selectDataSet.action?organisationUnitId=$child.id">$!encoder.htmlEncode( ${child.name} )</a></li>
+ #end
+ #end
#end
</ul>
</p>