dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09123
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2346: Work in progress on orgunit search
------------------------------------------------------------
revno: 2346
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2010-12-12 18:09:27 +0100
message:
Work in progress on orgunit search
added:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/icons/hierarchy.png
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/icons/search.png
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/search/
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/search/GetCompulsoryGroupSetsAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/search/SearchOrganisationUnitsAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitSearch.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/index.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/menu.vm
resources/sql/integritychecks.sql
--
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/organisationunit/OrganisationUnitService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java 2010-12-12 13:35:21 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java 2010-12-12 17:09:27 +0000
@@ -232,6 +232,15 @@
*/
Set<Source> convert( Collection<OrganisationUnit> organisationUnits );
+ /**
+ * Get the units which name are like the given name and are members of the
+ * given groups. If name or groups are null or empty they are ignored in the
+ * search. If name and groups are null an empty collection is returned.
+ *
+ * @param name the name.
+ * @param groups the organisation unit groups.
+ * @return a collection of organisation units.
+ */
Collection<OrganisationUnit> getOrganisationUnitsByNameAndGroups( String name, Collection<OrganisationUnitGroup> groups );
/**
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java 2010-12-12 13:35:21 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java 2010-12-12 17:09:27 +0000
@@ -32,6 +32,8 @@
import org.amplecode.quick.StatementHolder;
import org.amplecode.quick.StatementManager;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.Session;
@@ -139,40 +141,50 @@
@SuppressWarnings( "unchecked" )
public Collection<OrganisationUnit> getOrganisationUnitsByNameAndGroups( String name, Collection<OrganisationUnitGroup> groups )
{
- if ( groups != null && groups.size() > 0 )
- {
- StringBuilder hql = new StringBuilder( "from OrganisationUnit o where" );
-
- if ( name != null && !name.trim().isEmpty() )
- {
- hql.append( " lower(name) like :name and" );
- }
-
+ name = StringUtils.trimToNull( name );
+ groups = CollectionUtils.isEmpty( groups ) ? null : groups;
+
+ if ( name == null && groups == null )
+ {
+ return new HashSet<OrganisationUnit>();
+ }
+
+ StringBuilder hql = new StringBuilder( "from OrganisationUnit o where" );
+
+ if ( name != null )
+ {
+ hql.append( " lower(name) like :name and" );
+ }
+
+ if ( groups != null )
+ {
for ( int i = 0; i < groups.size(); i++ )
{
hql.append( " :g" ).append( i ).append( " in elements( o.groups ) and" );
}
-
- hql.delete( hql.length() - 4, hql.length() );
-
- Query query = sessionFactory.getCurrentSession().createQuery( hql.toString() );
-
- if ( name != null && !name.trim().isEmpty() )
- {
- query.setString( "name", "%" + name.toLowerCase() + "%" );
- }
-
+ }
+
+ hql.delete( hql.length() - " and".length(), hql.length() );
+
+ Query query = sessionFactory.getCurrentSession().createQuery( hql.toString() );
+
+ if ( name != null )
+ {
+ query.setString( "name", "%" + name.toLowerCase() + "%" );
+ }
+
+ if ( groups != null )
+ {
int i = 0;
for ( OrganisationUnitGroup group : groups )
{
query.setEntity( "g" + i++, group );
}
-
- return query.list();
}
- return new HashSet<OrganisationUnit>();
+ return query.list();
+
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java 2010-12-12 13:35:21 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java 2010-12-12 17:09:27 +0000
@@ -357,7 +357,7 @@
assertTrue( equals( organisationUnitService.getOrganisationUnitsAtLevel( 4, unitB ), unitH, unitI, unitJ, unitK ) );
}
@Test
- public void testGetOrganisationUnitsByGroups()
+ public void testGetOrganisationUnitsByNameAndGroups()
{
OrganisationUnit unitA = createOrganisationUnit( 'A' );
OrganisationUnit unitB = createOrganisationUnit( 'B' );
@@ -387,6 +387,9 @@
units = organisationUnitService.getOrganisationUnitsByNameAndGroups( unitA.getName().toLowerCase(), groups );
assertEquals( 1, units.size() );
assertEquals( unitA, units.iterator().next() );
+ units = organisationUnitService.getOrganisationUnitsByNameAndGroups( unitA.getName(), null );
+ assertEquals( 1, units.size() );
+ assertEquals( unitA, units.iterator().next() );
groups = Arrays.asList( groupA, groupB );
units = organisationUnitService.getOrganisationUnitsByNameAndGroups( null, groups );
@@ -394,6 +397,9 @@
units = organisationUnitService.getOrganisationUnitsByNameAndGroups( unitB.getName().toUpperCase(), groups );
assertEquals( 1, units.size() );
assertEquals( unitB, units.iterator().next() );
+ units = organisationUnitService.getOrganisationUnitsByNameAndGroups( unitB.getName(), null );
+ assertEquals( 1, units.size() );
+ assertEquals( unitB, units.iterator().next() );
groups = Arrays.asList( groupA, groupB, groupC );
units = organisationUnitService.getOrganisationUnitsByNameAndGroups( null, groups );
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/icons/hierarchy.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/icons/hierarchy.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/icons/hierarchy.png 2010-12-12 17:09:27 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/icons/search.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/icons/search.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/icons/search.png 2010-12-12 17:09:27 +0000 differ
=== added directory 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/search'
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/search/GetCompulsoryGroupSetsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/search/GetCompulsoryGroupSetsAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/search/GetCompulsoryGroupSetsAction.java 2010-12-12 17:09:27 +0000
@@ -0,0 +1,68 @@
+package org.hisp.dhis.oum.action.search;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
+import org.hisp.dhis.organisationunit.comparator.OrganisationUnitGroupSetNameComparator;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Lars Helge Overland
+ */
+public class GetCompulsoryGroupSetsAction
+ implements Action
+{
+ private OrganisationUnitGroupService organisationUnitGroupService;
+
+ public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
+ {
+ this.organisationUnitGroupService = organisationUnitGroupService;
+ }
+
+ private List<OrganisationUnitGroupSet> groupSets;
+
+ public List<OrganisationUnitGroupSet> getGroupSets()
+ {
+ return groupSets;
+ }
+
+ public String execute()
+ {
+ groupSets = new ArrayList<OrganisationUnitGroupSet>( organisationUnitGroupService.getCompulsoryOrganisationUnitGroupSets() );
+
+ Collections.sort( groupSets, new OrganisationUnitGroupSetNameComparator() );
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/search/SearchOrganisationUnitsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/search/SearchOrganisationUnitsAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/search/SearchOrganisationUnitsAction.java 2010-12-12 17:09:27 +0000
@@ -0,0 +1,117 @@
+package org.hisp.dhis.oum.action.search;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Lars Helge Overland
+ */
+public class SearchOrganisationUnitsAction
+ implements Action
+{
+ private static final int ANY = -1;
+
+ // -------------------------------------------------------------------------
+ // Depdencies
+ // -------------------------------------------------------------------------
+
+ private OrganisationUnitGroupService organisationUnitGroupService;
+
+ public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
+ {
+ this.organisationUnitGroupService = organisationUnitGroupService;
+ }
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private Collection<Integer> group = new HashSet<Integer>();
+
+ public void setGroup( Collection<Integer> group )
+ {
+ this.group = group;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private Collection<OrganisationUnit> organisationUnits;
+
+ public Collection<OrganisationUnit> getOrganisationUnits()
+ {
+ return organisationUnits;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ Collection<OrganisationUnitGroup> groups = new HashSet<OrganisationUnitGroup>();
+
+ for ( Integer id : group )
+ {
+ if ( id != ANY )
+ {
+ OrganisationUnitGroup group = organisationUnitGroupService.getOrganisationUnitGroup( id );
+ groups.add( group );
+ }
+ }
+
+ organisationUnits = organisationUnitService.getOrganisationUnitsByNameAndGroups( name, groups );
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml 2010-09-14 09:03:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml 2010-12-12 17:09:27 +0000
@@ -247,7 +247,7 @@
<ref bean="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
</property>
</bean>
-
+
<!-- Hierarchy operations -->
<bean
@@ -312,4 +312,24 @@
ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
</bean>
+ <!-- OrganisationUnit Search -->
+
+ <bean
+ id="org.hisp.dhis.oum.action.search.GetCompulsoryGroupSetsAction"
+ class="org.hisp.dhis.oum.action.search.GetCompulsoryGroupSetsAction"
+ scope="prototype">
+ <property name="organisationUnitGroupService"
+ ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
+ </bean>
+
+ <bean
+ id="org.hisp.dhis.oum.action.search.SearchOrganisationUnitsAction"
+ class="org.hisp.dhis.oum.action.search.SearchOrganisationUnitsAction"
+ scope="prototype">
+ <property name="organisationUnitGroupService"
+ ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
+ <property name="organisationUnitService"
+ ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ </bean>
+
</beans>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties 2010-12-09 06:15:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/org/hisp/dhis/oum/i18n_module.properties 2010-12-12 17:09:27 +0000
@@ -93,6 +93,16 @@
intro_org_unit_group = Create, modify, view and delete organisation unit groups. Groups are used for improved analysis.
intro_org_unit_group_set = Create, modify, view and delete organisation unit group sets. Group sets are used for improved analysis.
intro_org_unit_level = Create, modify, view and delete descriptive names for the organisation unit levels in the system.
+intro_org_unit_search = Search organisation units based on name and group sets. View extended information for individual units.
intro_hierarchy_operations_menu = Move organisation units in the organisation unit tree. All children will be moved along with the unit.
loading = Loading
-coordinates = Coordinates
\ No newline at end of file
+coordinates = Coordinates
+org_unit_search = Organisation Unit Search
+org_unit_search_management = Organisation unit search
+criteria = Criteria
+options = Options
+any = Any
+search_result = Search result
+search = Search
+organisation_units = organisation units
+found = Found
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml 2010-11-29 13:06:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml 2010-12-12 17:09:27 +0000
@@ -22,7 +22,7 @@
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-organisationunit/organisationUnit.vm</param>
<param name="menu">/dhis-web-maintenance-organisationunit/menuWithTree.vm</param>
- <param name="menuTreeHeight">358</param>
+ <param name="menuTreeHeight">328</param>
<param name="javascripts">
../dhis-web-commons/ouwt/ouwt.js,
javascript/organisationUnit.js
@@ -293,6 +293,20 @@
class="org.hisp.dhis.oum.action.organisationunitlevel.SaveOrganisationUnitLevelsAction">
<result name="success" type="redirect">index.action</result>
</action>
+
+ <!-- OrganisationUnit Search -->
+
+ <action name="organisationUnitSearch"
+ class="org.hisp.dhis.oum.action.search.GetCompulsoryGroupSetsAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-organisationunit/organisationUnitSearch.vm</param>
+ <param name="menu">/dhis-web-maintenance-organisationunit/menu.vm</param>
+ </action>
+
+ <action name="searchOrganisationUnits"
+ class="org.hisp.dhis.oum.action.search.SearchOrganisationUnitsAction">
+ <result name="success" type="chain">organisationUnitSearch</result>
+ </action>
</package>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/index.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/index.vm 2010-12-09 22:05:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/index.vm 2010-12-12 17:09:27 +0000
@@ -6,5 +6,6 @@
#introListImgItem( "organisationUnitGroup.action" "org_unit_group" "organisationunit" )
#introListImgItem( "organisationUnitGroupSet.action" "org_unit_group_set" "organisationunit" )
#introListImgItem( "organisationUnitLevel.action" "org_unit_level" "organisationunit" )
- #introListImgItem( "hierarchyOperations.action" "hierarchy_operations_menu" "organisationunit" )
+ #introListImgItem( "organisationUnitSearch.action" "org_unit_search" "search" )
+ #introListImgItem( "hierarchyOperations.action" "hierarchy_operations_menu" "hierarchy" )
</ul>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/menu.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/menu.vm 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/menu.vm 2010-12-12 17:09:27 +0000
@@ -6,5 +6,6 @@
<li><a href="organisationUnitGroup.action">$i18n.getString( "org_unit_group" ) </a></li>
<li><a href="organisationUnitGroupSet.action">$i18n.getString( "org_unit_group_set" ) </a></li>
<li><a href="organisationUnitLevel.action">$i18n.getString( "org_unit_level" ) </a></li>
+ <li><a href="organisationUnitSearch.action">$i18n.getString( "org_unit_search" ) </a></li>
<li><a href="hierarchyOperations.action">$i18n.getString( "hierarchy_operations_menu" ) </a></li>
</ul>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitSearch.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitSearch.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitSearch.vm 2010-12-12 17:09:27 +0000
@@ -0,0 +1,65 @@
+
+<h3>$i18n.getString( "org_unit_search_management" )</h3>
+
+<form action="searchOrganisationUnits.action" method="get">
+<table>
+<tr>
+<th>$i18n.getString( "criteria" )</th>
+<th>$i18n.getString( "options" )</th>
+</tr>
+
+<tr>
+<td>$i18n.getString( "name" )</th>
+<td><input type="text" name="name" style="width:325px"></td>
+</tr>
+
+#foreach( $groupSet in $groupSets )
+<tr>
+<td>$encoder.htmlEncode( $groupSet.name )</td>
+<td>
+ <select name="group" style="width:325px">
+ <option value="-1">[ $i18n.getString( "any" ) ]</option>
+ #foreach( $group in $groupSet.organisationUnitGroups )
+ <option value="$group.id">$encoder.htmlEncode( $group.name )</option>
+ #end
+ </select>
+</td>
+</tr>
+#end
+
+<tr>
+<td style="height:15px" colspan="2"></td>
+</tr>
+<tr>
+
+<td></td>
+<td><input type="submit" value="$i18n.getString( 'search' )" style="width:100px"></td>
+
+<tr>
+<td style="height:15px" colspan="2"></td>
+</tr>
+<tr>
+
+</tr>
+
+</table>
+</form>
+
+#if ( $organisationUnits )
+
+<h4>$i18n.getString( "found" ) $organisationUnits.size() $i18n.getString( "organisation_units" )</h4>
+
+<table>
+<tr>
+<th style="min-width:300px">$i18n.getString( "name" )</th>
+</tr>
+
+#foreach( $unit in $organisationUnits )
+<tr>
+<td>$encoder.htmlEncode( $unit.name )</td>
+</tr>
+#end
+
+</table>
+
+#end
=== modified file 'resources/sql/integritychecks.sql'
--- resources/sql/integritychecks.sql 2010-11-08 13:02:47 +0000
+++ resources/sql/integritychecks.sql 2010-12-12 17:09:27 +0000
@@ -34,3 +34,10 @@
select dm.dataelementid from datasetmembers dm
join dataset ds on(dm.datasetid=ds.datasetid)
where sc.datasetid=ds.datasetid);
+
+-- Get orgunit groups which an orgunit member of
+
+select * from orgunitgroup g
+join orgunitgroupmembers m using(orgunitgroupid)
+join organisationunit o using (organisationunitid)
+where o.name = 'Mandera District Hospital';