dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09317
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2435: Fix pagination bug in maintenance user, minor bug in maintenance datadictionary and apply paginat...
------------------------------------------------------------
revno: 2435
committer: Quang <Quang@Quang-PC>
branch nick: trunk
timestamp: Wed 2010-12-29 00:49:37 +0700
message:
Fix pagination bug in maintenance user, minor bug in maintenance datadictionary and apply pagination in maintenance orgunit.
removed:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/searchUser.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/GetOrganisationUnitGroupListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/GetGroupSetListAction.java
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/organisationUnit.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitGroup.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitGroupSet.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetOrgunitUserListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/allUser.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/user.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/organisationunit/OrganisationUnitGroupService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupService.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupService.java 2010-12-28 17:49:37 +0000
@@ -183,4 +183,20 @@
* @return a Collection of OrganisationUnitGroupSets.
*/
Collection<OrganisationUnitGroupSet> getCompulsoryOrganisationUnitGroupSetsNotAssignedTo( OrganisationUnit organisationUnit );
+
+ Collection<OrganisationUnitGroup> getOrganisationUnitGroupsBetween( int first, int max );
+
+ Collection<OrganisationUnitGroup> getOrganisationUnitGroupsBetweenByName( String name, int first, int max );
+
+ int getOrganisationUnitGroupCount();
+
+ int getOrganisationUnitGroupCountByName( String name );
+
+ Collection<OrganisationUnitGroupSet> getOrganisationUnitGroupSetsBetween( int first, int max );
+
+ Collection<OrganisationUnitGroupSet> getOrganisationUnitGroupSetsBetweenByName( String name, int first, int max );
+
+ int getOrganisationUnitGroupSetCount();
+
+ int getOrganisationUnitGroupSetCountByName( String name );
}
=== 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-13 17:03:08 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java 2010-12-28 17:49:37 +0000
@@ -31,6 +31,7 @@
import java.util.List;
import java.util.Set;
+import org.hisp.dhis.dataelement.DataElementGroupSet;
import org.hisp.dhis.hierarchy.HierarchyViolationException;
import org.hisp.dhis.source.Source;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserStore.java 2010-12-11 20:38:50 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserStore.java 2010-12-28 17:49:37 +0000
@@ -113,7 +113,25 @@
int getUserCountByName( String name );
-
+ //=====================
+ Collection<UserCredentials> getUsersWithoutOrganisationUnitBetween( int first, int max );
+
+ Collection<UserCredentials> getUsersWithoutOrganisationUnitBetweenByName( String name, int first, int max );
+
+ int getUsersWithoutOrganisationUnitCount();
+
+ int getUsersWithoutOrganisationUnitCountByName( String name );
+
+ //=====================
+ Collection<UserCredentials> getUsersByOrganisationUnitBetween( OrganisationUnit orgUnit, int first, int max );
+
+ Collection<UserCredentials> getUsersByOrganisationUnitBetweenByName( OrganisationUnit orgUnit, String name, int first, int max );
+
+ int getUsersByOrganisationUnitCount( OrganisationUnit orgUnit );
+
+ int getUsersByOrganisationUnitCountByName( OrganisationUnit orgUnit, String name );
+
+
// -------------------------------------------------------------------------
// UserCredentials
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.java 2010-12-28 17:49:37 +0000
@@ -208,4 +208,45 @@
return groupSets;
}
+
+ public Collection<OrganisationUnitGroup> getOrganisationUnitGroupsBetween( int first, int max )
+ {
+ return organisationUnitGroupStore.getBetween( first, max );
+ }
+
+ public Collection<OrganisationUnitGroup> getOrganisationUnitGroupsBetweenByName( String name, int first, int max )
+ {
+ return organisationUnitGroupStore.getBetweenByName( name, first, max );
+ }
+
+ public int getOrganisationUnitGroupCount()
+ {
+ return organisationUnitGroupStore.getCount();
+ }
+
+ public int getOrganisationUnitGroupCountByName( String name )
+ {
+ return organisationUnitGroupStore.getCountByName( name );
+ }
+
+ public Collection<OrganisationUnitGroupSet> getOrganisationUnitGroupSetsBetween( int first, int max )
+ {
+ return organisationUnitGroupSetStore.getBetween( first, max );
+ }
+
+ public Collection<OrganisationUnitGroupSet> getOrganisationUnitGroupSetsBetweenByName( String name, int first, int max )
+ {
+ return organisationUnitGroupSetStore.getBetweenByName( name, first, max );
+ }
+
+ public int getOrganisationUnitGroupSetCount()
+ {
+ return organisationUnitGroupSetStore.getCount();
+ }
+
+ public int getOrganisationUnitGroupSetCountByName( String name )
+ {
+ return organisationUnitGroupSetStore.getCountByName( name );
+ }
+
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java 2010-12-07 17:02:27 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java 2010-12-28 17:49:37 +0000
@@ -27,8 +27,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
+import java.util.List;
import org.apache.log4j.Logger;
import org.hibernate.Criteria;
@@ -429,4 +431,92 @@
{
return userRoleStore.getBetweenByName( name, first, max );
}
+
+ // ===================
+ public Collection<UserCredentials> getUsersByOrganisationUnitBetween( OrganisationUnit orgUnit, int first, int max )
+ {
+ return getBlockUser( toUserCredentials( getUsersByOrganisationUnit( orgUnit ) ), first, max );
+ }
+
+ public Collection<UserCredentials> getUsersByOrganisationUnitBetweenByName( OrganisationUnit orgUnit, String name,
+ int first, int max )
+ {
+ return getBlockUser( findByName( toUserCredentials( getUsersByOrganisationUnit( orgUnit ) ), name ), first, max );
+ }
+
+ public int getUsersByOrganisationUnitCount( OrganisationUnit orgUnit )
+ {
+ return getUsersByOrganisationUnit( orgUnit ).size();
+ }
+
+ public int getUsersByOrganisationUnitCountByName( OrganisationUnit orgUnit, String name )
+ {
+ return findByName( toUserCredentials( getUsersByOrganisationUnit( orgUnit ) ), name ).size();
+ }
+
+ // ===================
+ public Collection<UserCredentials> getUsersWithoutOrganisationUnitBetween( int first, int max )
+ {
+ return getBlockUser( toUserCredentials( getUsersWithoutOrganisationUnit()), first, max );
+ }
+
+ public Collection<UserCredentials> getUsersWithoutOrganisationUnitBetweenByName( String name, int first, int max )
+ {
+
+ return getBlockUser( findByName( toUserCredentials( getUsersWithoutOrganisationUnit() ), name ), first, max );
+ }
+
+ public int getUsersWithoutOrganisationUnitCount()
+ {
+ return getUsersWithoutOrganisationUnit().size();
+ }
+
+ public int getUsersWithoutOrganisationUnitCountByName( String name )
+ {
+ return findByName( toUserCredentials( getUsersWithoutOrganisationUnit() ), name ).size();
+ }
+
+ // ==============================
+ private Collection<UserCredentials> findByName( Collection<UserCredentials> users, String key )
+ {
+
+ List<UserCredentials> returnList = new ArrayList<UserCredentials>();
+
+ for ( UserCredentials user : users )
+ {
+ if ( user.getUsername().toLowerCase().contains( key.toLowerCase() ) )
+ {
+ returnList.add( user );
+ }
+ }
+
+ return returnList;
+ }
+
+ private List<UserCredentials> getBlockUser( Collection<UserCredentials> usersList, int startPos, int pageSize )
+ {
+ List<UserCredentials> returnList;
+
+ List<UserCredentials> elementList = new ArrayList<UserCredentials>( usersList );
+ try
+ {
+ returnList = elementList.subList( startPos, startPos + pageSize );
+ }
+ catch ( IndexOutOfBoundsException ex )
+ {
+ returnList = elementList.subList( startPos, elementList.size() );
+ }
+ return returnList;
+ }
+
+ private List<UserCredentials> toUserCredentials( Collection<User> users )
+ {
+ List<UserCredentials> returnUserCredentials = new ArrayList<UserCredentials>();
+
+ for ( User user : users )
+ {
+ returnUserCredentials.add( getUserCredentials( user ) );
+ }
+ return returnUserCredentials;
+ }
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListAction.java 2010-11-25 21:34:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListAction.java 2010-12-28 17:49:37 +0000
@@ -185,7 +185,7 @@
this.paging = createPaging( dataElements.size() );
- dataElements = getBlockElement( dataElements, paging.getStartPage(), paging.getEndPos() );
+ dataElements = getBlockElement( dataElements, paging.getStartPos(), paging.getPageSize() );
}
else
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitListAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitListAction.java 2010-12-28 17:49:37 +0000
@@ -27,6 +27,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.apache.commons.lang.StringUtils.isNotBlank;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -36,15 +38,14 @@
import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
-
-import com.opensymphony.xwork2.ActionSupport;
+import org.hisp.dhis.paging.ActionPagingSupport;
/**
* @author Torgeir Lorange Ostby
* @version $Id: GetOrganisationUnitListAction.java 1898 2006-09-22 12:06:56Z torgeilo $
*/
public class GetOrganisationUnitListAction
- extends ActionSupport
+ extends ActionPagingSupport<OrganisationUnit>
{
// -------------------------------------------------------------------------
// Dependencies
@@ -80,7 +81,7 @@
}
// -------------------------------------------------------------------------
- // Output
+ // Input & Output
// -------------------------------------------------------------------------
private List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>();
@@ -90,6 +91,18 @@
return organisationUnits;
}
+ private String key;
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ public void setKey( String key )
+ {
+ this.key = key;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -115,6 +128,28 @@
displayPropertyHandler.handle( organisationUnits );
+ if ( isNotBlank( key ) )
+ {
+ organisationUnits = searchByName( organisationUnits, key );
+ }
+
+ this.paging = createPaging( organisationUnits.size() );
+ organisationUnits = getBlockElement( organisationUnits, paging.getStartPos(), paging.getPageSize() );
+
return SUCCESS;
}
+
+ private List<OrganisationUnit> searchByName( List<OrganisationUnit> orgUnits, String key )
+ {
+ List<OrganisationUnit> result = new ArrayList<OrganisationUnit>();
+
+ for ( OrganisationUnit each : orgUnits )
+ {
+ if ( each.getName().toLowerCase().contains( key.toLowerCase() ) )
+ {
+ result.add( each );
+ }
+ }
+ return result;
+ }
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/GetOrganisationUnitGroupListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/GetOrganisationUnitGroupListAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/GetOrganisationUnitGroupListAction.java 2010-12-28 17:49:37 +0000
@@ -27,13 +27,17 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.apache.commons.lang.StringUtils.isNotBlank;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import org.hisp.dhis.concept.Concept;
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
import org.hisp.dhis.organisationunit.comparator.OrganisationUnitGroupNameComparator;
+import org.hisp.dhis.paging.ActionPagingSupport;
import com.opensymphony.xwork2.ActionSupport;
@@ -42,7 +46,7 @@
* @version $Id: GetOrganisationUnitGroupListAction.java 1898 2006-09-22 12:06:56Z torgeilo $
*/
public class GetOrganisationUnitGroupListAction
- extends ActionSupport
+ extends ActionPagingSupport<OrganisationUnitGroup>
{
// -------------------------------------------------------------------------
// Dependencies
@@ -56,7 +60,7 @@
}
// -------------------------------------------------------------------------
- // Output
+ // Input & Output
// -------------------------------------------------------------------------
private List<OrganisationUnitGroup> organisationUnitGroups = new ArrayList<OrganisationUnitGroup>();
@@ -66,6 +70,18 @@
return organisationUnitGroups;
}
+ private String key;
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ public void setKey( String key )
+ {
+ this.key = key;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -73,8 +89,18 @@
public String execute()
throws Exception
{
- organisationUnitGroups = new ArrayList<OrganisationUnitGroup>( organisationUnitGroupService
- .getAllOrganisationUnitGroups() );
+ if ( isNotBlank( key ) ) // Filter on key only if set
+ {
+ this.paging = createPaging( organisationUnitGroupService.getOrganisationUnitGroupCountByName( key ) );
+
+ organisationUnitGroups = new ArrayList<OrganisationUnitGroup>( organisationUnitGroupService.getOrganisationUnitGroupsBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) );
+ }
+ else
+ {
+ this.paging = createPaging( organisationUnitGroupService.getOrganisationUnitGroupCount() );
+
+ organisationUnitGroups = new ArrayList<OrganisationUnitGroup>( organisationUnitGroupService.getOrganisationUnitGroupsBetween( paging.getStartPos(), paging.getPageSize() ) );
+ }
Collections.sort( organisationUnitGroups, new OrganisationUnitGroupNameComparator() );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/GetGroupSetListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/GetGroupSetListAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/GetGroupSetListAction.java 2010-12-28 17:49:37 +0000
@@ -27,13 +27,17 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.apache.commons.lang.StringUtils.isNotBlank;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
import org.hisp.dhis.organisationunit.comparator.OrganisationUnitGroupSetNameComparator;
+import org.hisp.dhis.paging.ActionPagingSupport;
import com.opensymphony.xwork2.ActionSupport;
@@ -42,7 +46,7 @@
* @version $Id$
*/
public class GetGroupSetListAction
- extends ActionSupport
+ extends ActionPagingSupport<OrganisationUnitGroupSet>
{
// -------------------------------------------------------------------------
// Dependencies
@@ -56,7 +60,7 @@
}
// -------------------------------------------------------------------------
- // Output
+ // Input& Output
// -------------------------------------------------------------------------
private List<OrganisationUnitGroupSet> organisationUnitGroupSets;
@@ -65,6 +69,18 @@
{
return organisationUnitGroupSets;
}
+
+ private String key;
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ public void setKey( String key )
+ {
+ this.key = key;
+ }
// -------------------------------------------------------------------------
// Action implementation
@@ -73,8 +89,21 @@
public String execute()
throws Exception
{
- organisationUnitGroupSets = new ArrayList<OrganisationUnitGroupSet>( organisationUnitGroupService
- .getAllOrganisationUnitGroupSets() );
+ if ( isNotBlank( key ) ) // Filter on key only if set
+ {
+ this.paging = createPaging( organisationUnitGroupService.getOrganisationUnitGroupSetCountByName( key ) );
+
+ organisationUnitGroupSets = new ArrayList<OrganisationUnitGroupSet>( organisationUnitGroupService.getOrganisationUnitGroupSetsBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) );
+ }
+ else
+ {
+ this.paging = createPaging( organisationUnitGroupService.getOrganisationUnitGroupSetCount() );
+
+ organisationUnitGroupSets = new ArrayList<OrganisationUnitGroupSet>( organisationUnitGroupService.getOrganisationUnitGroupSetsBetween( paging.getStartPos(), paging.getPageSize() ) );
+ }
+
+// organisationUnitGroupSets = new ArrayList<OrganisationUnitGroupSet>( organisationUnitGroupService
+// .getAllOrganisationUnitGroupSets() );
Collections.sort( organisationUnitGroupSets, new OrganisationUnitGroupSetNameComparator() );
=== 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-12-16 13:23:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml 2010-12-28 17:49:37 +0000
@@ -27,6 +27,7 @@
../dhis-web-commons/ouwt/ouwt.js,
javascript/organisationUnit.js
</param>
+ <param name="stylesheets">../dhis-web-commons/paging/paging.css</param>
<interceptor-ref name="organisationUnitTreeStack" />
</action>
@@ -102,6 +103,7 @@
<param name="menu">/dhis-web-maintenance-organisationunit/menu.vm</param>
<param name="menuTreeHeight">384</param>
<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/organisationUnitGroup.js</param>
+ <param name="stylesheets">../dhis-web-commons/paging/paging.css</param>
<interceptor-ref name="organisationUnitTreeStack" />
</action>
@@ -169,6 +171,7 @@
<param name="menu">/dhis-web-maintenance-organisationunit/menu.vm</param>
<param name="menuTreeHeight">384</param>
<param name="javascripts">javascript/organisationUnitGroupSet.js</param>
+ <param name="stylesheets">../dhis-web-commons/paging/paging.css</param>
</action>
<action name="getOrganisationUnitGroupSet"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnit.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnit.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/organisationUnit.vm 2010-12-28 17:49:37 +0000
@@ -6,9 +6,7 @@
<td style="vertical-align:top">
<table width="100%">
<tr>
- <td>
- $i18n.getString( "filter_by_name" ): <form style="display:inline" action="none" onsubmit="return false"><div style="inline"><input type="text" onkeyup="filterValues( this.value )"/></div></form>
- </td>
+ <td>#filterDiv( "organisationUnit" )</td>
<td colspan="3" style="text-align:right"><input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddOrganisationUnitForm.action'"/></td>
</tr>
</table>
@@ -43,6 +41,8 @@
</tr>
#end
</table>
+ <p></p>
+ #parse( "/dhis-web-commons/paging/paging.vm" )
</td>
<td style="width:20em; padding-left:2em; vertical-align:top">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitGroup.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitGroup.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/organisationUnitGroup.vm 2010-12-28 17:49:37 +0000
@@ -6,7 +6,7 @@
<td style="vertical-align:top">
<table width="100%">
<tr>
- <td>$i18n.getString( "filter_by_name" ): <form style="display:inline" action="none" onsubmit="return false"><div style="inline"><input type="text" onkeyup="filterValues( this.value )"/></div></form></td>
+ <td>#filterDiv( "organisationUnitGroup" )</td>
<td colspan="3" style="text-align:right"><input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='openAddOrganisationUnitGroup.action'"/></td>
</tr>
</table>
@@ -32,6 +32,8 @@
#end
</tbody>
</table>
+ <p></p>
+ #parse( "/dhis-web-commons/paging/paging.vm" )
</td>
<td style="width:20em; padding-left:2em; vertical-align:top">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitGroupSet.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/organisationUnitGroupSet.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/organisationUnitGroupSet.vm 2010-12-28 17:49:37 +0000
@@ -6,7 +6,7 @@
<td style="vertical-align:top">
<table width="100%">
<tr>
- <td>$i18n.getString( "filter_by_name" ): <form style="display:inline" action="none" onsubmit="return false"><div style="inline"><input type="text" onkeyup="filterValues( this.value )"/></div></form></td>
+ <td>#filterDiv( "organisationUnitGroupSet" )</td>
<td colspan="3" style="text-align:right"><input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddOrganisationUnitGroupSetForm.action'"/></td>
</tr>
</table>
@@ -33,6 +33,8 @@
#end
</tbody>
</table>
+ <p></p>
+ #parse( "/dhis-web-commons/paging/paging.vm" )
</td>
<td style="width:20em; padding-left:2em; vertical-align:top">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetOrgunitUserListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetOrgunitUserListAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetOrgunitUserListAction.java 2010-12-28 17:49:37 +0000
@@ -27,6 +27,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.apache.commons.lang.StringUtils.isNotBlank;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -35,6 +37,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+import org.hisp.dhis.paging.ActionPagingSupport;
import org.hisp.dhis.user.User;
import org.hisp.dhis.user.UserCredentials;
import org.hisp.dhis.user.UserStore;
@@ -47,7 +50,7 @@
* @version $Id: GetOrgunitUserListAction.java 5549 2008-08-20 05:23:35Z abyot $
*/
public class GetOrgunitUserListAction
- implements Action
+ extends ActionPagingSupport<User>
{
// -------------------------------------------------------------------------
// Dependencies
@@ -78,6 +81,18 @@
return userCredentialsList;
}
+ private String key;
+
+ public void setKey( String key )
+ {
+ this.key = key;
+ }
+
+ public String getKey()
+ {
+ return key;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -85,26 +100,41 @@
public String execute()
throws Exception
{
- userCredentialsList = new ArrayList<UserCredentials>();
-
- Collection<User> users = new HashSet<User>();
-
OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit();
- if ( organisationUnit == null )
+ if ( isNotBlank( key ) ) // Filter on key only if set
{
- users = userStore.getUsersWithoutOrganisationUnit();
+ if ( organisationUnit == null )
+ {
+ this.paging = createPaging( userStore.getUsersWithoutOrganisationUnitCountByName( key ) );
+
+ userCredentialsList = new ArrayList<UserCredentials>( userStore.getUsersWithoutOrganisationUnitBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) );
+ }
+ else
+ {
+ this.paging = createPaging( userStore.getUsersByOrganisationUnitCountByName( organisationUnit, key ) );
+
+ userCredentialsList = new ArrayList<UserCredentials>( userStore.getUsersByOrganisationUnitBetweenByName( organisationUnit, key, paging.getStartPos(), paging.getPageSize() ) );
+
+ }
}
else
{
- users = userStore.getUsersByOrganisationUnit( organisationUnit );
- }
-
- for ( User user : users )
- {
- userCredentialsList.add( userStore.getUserCredentials( user ) );
- }
-
+ if ( organisationUnit == null )
+ {
+ this.paging = createPaging( userStore.getUsersWithoutOrganisationUnitCount( ) );
+
+ userCredentialsList = new ArrayList<UserCredentials>( userStore.getUsersWithoutOrganisationUnitBetween( paging.getStartPos(), paging.getPageSize() ) );
+ }
+ else
+ {
+ this.paging = createPaging( userStore.getUsersByOrganisationUnitCount( organisationUnit ) );
+
+ userCredentialsList = new ArrayList<UserCredentials>( userStore.getUsersByOrganisationUnitBetween( organisationUnit, paging.getStartPos(), paging.getPageSize() ) );
+
+ }
+ }
+
Collections.sort( userCredentialsList, new UsernameComparator() );
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/struts.xml 2010-12-23 12:27:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/struts.xml 2010-12-28 17:49:37 +0000
@@ -24,6 +24,7 @@
<param name="menuTreeHeight">404</param>
<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/user.js,javascript/filterTable.js</param>
<interceptor-ref name="organisationUnitTreeStack"/>
+ <param name="stylesheets">../dhis-web-commons/paging/paging.css</param>
</action>
<action name="alluser" class="org.hisp.dhis.user.action.GetUserListAction">
@@ -34,11 +35,6 @@
<param name="stylesheets">../dhis-web-commons/paging/paging.css</param>
<interceptor-ref name="organisationUnitTreeStack"/>
</action>
-
- <action name="searchUser"
- class="org.hisp.dhis.user.action.GetUserListAction" method="searchUserByName">
- <result name="success" type="velocity">/dhis-web-maintenance-user/searchUser.vm</result>
- </action>
<action name="getUser" class="org.hisp.dhis.user.action.GetUserAction">
<result name="success" type="velocity-xml">/dhis-web-maintenance-user/responseUser.vm</result>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/allUser.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/allUser.vm 2010-12-09 22:05:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/allUser.vm 2010-12-28 17:49:37 +0000
@@ -1,6 +1,84 @@
<h3>$i18n.getString( "user_management" ) #openHelp( "users" )</h3>
<form id="userForm" method="POST">
-#parse( "/dhis-web-maintenance-user/searchUser.vm" )
+<table style="width:100%">
+ <tr>
+ <td style="vertical-align:top">
+ <table width='100%'>
+ <tr>
+ <td>#filterDiv( "alluser" )</td>
+ <td colspan="3" style="text-align:right"><input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddUserForm.action'"/></td>
+ </tr>
+ </table>
+ <table class="listTable" id="userList" width='100%'>
+ <col/>
+ <col/>
+ <thead>
+ <tr>
+ <th>$i18n.getString( "username" )</th>
+ <th>$i18n.getString( "name" )</th>
+ <th class="{sorter: false}" style="width:80px;">$i18n.getString( "operations" )</th>
+ </tr>
+ </thead>
+ <tbody id="list">
+ #set( $mark = false )
+ #foreach( $userCredentials in $userCredentialsList )
+ <tr id="tr${userCredentials.id}" #alternate( $mark )>
+ <td>$encoder.htmlEncode( $userCredentials.username )</td>
+ <td>$encoder.htmlEncode( $userCredentials.user.surname ), $encoder.htmlEncode( $userCredentials.user.firstName )</td>
+ <td style="text-align:right">
+ <a href="showUpdateUserForm.action?id=$userCredentials.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
+ #if($currentUserName != $userCredentials.username)
+ <a href="javascript:removeUser( $userCredentials.id, '$encoder.jsEncode( $userCredentials.username )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
+ #else
+ <img src="../images/delete-denied.png" alt="$i18n.getString( 'remove' )"/>
+ #end
+ <a href="javascript:showUserDetails( $userCredentials.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a>
+ </td>
+ </tr>
+ #if( $mark )
+ #set( $mark = false )
+ #else
+ #set( $mark = true )
+ #end
+ #end
+ </tbody>
+ </table>
+ <p></p>
+ <div class="paging-container">
+ #parse( "/dhis-web-commons/paging/paging.vm" )
+ </div>
+ </td>
+ <td style="width:20em; padding-left:2em; vertical-align:top">
+
+ <div id="detailsArea" style="display:none">
+ <div style="float:right">
+ <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_details' )"/></a>
+ </div>
+ <p><label>$i18n.getString( "username" ):</label><br/><span id="usernameField"></span></p>
+ <p><label>$i18n.getString( "surname" ):</label><br/><span id="surnameField"></span></p>
+ <p><label>$i18n.getString( "firstName" ):</label><br/><span id="firstNameField"></span></p>
+ <p><label>$i18n.getString( "email" ):</label><br/><span id="emailField"></span></p>
+ <p><label>$i18n.getString( "phone_number" ):</label><br/><span id="phoneNumberField"></span></p>
+ <p><label>$i18n.getString( "number_of_orgunit" ):</label><br/><span id="numberOrgunitField"></span></p>
+ </div>
+
+ <div id="warningArea" style="position:fixed;right:10px;top:200px;display:none">
+ <div style="float:right">
+ <a href="javascript:hideWarning()" title="$i18n.getString( 'hide_warning' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_warning' )"/></a>
+ </div>
+ <p><span id="warningField"></span></p>
+ </div>
+
+ </td>
+ </tr>
+</table>
+
+
+<script>
+ jQuery(document).ready(function(){
+ tableSorter( 'userList' );
+ });
+</script>
</form>
<script type="text/javascript">
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/searchUser.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/searchUser.vm 2010-12-06 14:13:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/searchUser.vm 1970-01-01 00:00:00 +0000
@@ -1,79 +0,0 @@
-<table style="width:100%">
- <tr>
- <td style="vertical-align:top">
- <table width='100%'>
- <tr>
- <td>#filterDiv( "alluser" )</td>
- <td colspan="3" style="text-align:right"><input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddUserForm.action'"/></td>
- </tr>
- </table>
- <table class="listTable" id="userList" width='100%'>
- <col/>
- <col/>
- <thead>
- <tr>
- <th>$i18n.getString( "username" )</th>
- <th>$i18n.getString( "name" )</th>
- <th class="{sorter: false}" style="width:80px;">$i18n.getString( "operations" )</th>
- </tr>
- </thead>
- <tbody id="list">
- #set( $mark = false )
- #foreach( $userCredentials in $userCredentialsList )
- <tr id="tr${userCredentials.id}" #alternate( $mark )>
- <td>$encoder.htmlEncode( $userCredentials.username )</td>
- <td>$encoder.htmlEncode( $userCredentials.user.surname ), $encoder.htmlEncode( $userCredentials.user.firstName )</td>
- <td style="text-align:right">
- <a href="showUpdateUserForm.action?id=$userCredentials.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
- #if($currentUserName != $userCredentials.username)
- <a href="javascript:removeUser( $userCredentials.id, '$encoder.jsEncode( $userCredentials.username )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
- #else
- <img src="../images/delete-denied.png" alt="$i18n.getString( 'remove' )"/>
- #end
- <a href="javascript:showUserDetails( $userCredentials.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a>
- </td>
- </tr>
- #if( $mark )
- #set( $mark = false )
- #else
- #set( $mark = true )
- #end
- #end
- </tbody>
- </table>
- <p></p>
- <div class="paging-container">
- #parse( "/dhis-web-commons/paging/paging.vm" )
- </div>
- </td>
- <td style="width:20em; padding-left:2em; vertical-align:top">
-
- <div id="detailsArea" style="display:none">
- <div style="float:right">
- <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_details' )"/></a>
- </div>
- <p><label>$i18n.getString( "username" ):</label><br/><span id="usernameField"></span></p>
- <p><label>$i18n.getString( "surname" ):</label><br/><span id="surnameField"></span></p>
- <p><label>$i18n.getString( "firstName" ):</label><br/><span id="firstNameField"></span></p>
- <p><label>$i18n.getString( "email" ):</label><br/><span id="emailField"></span></p>
- <p><label>$i18n.getString( "phone_number" ):</label><br/><span id="phoneNumberField"></span></p>
- <p><label>$i18n.getString( "number_of_orgunit" ):</label><br/><span id="numberOrgunitField"></span></p>
- </div>
-
- <div id="warningArea" style="position:fixed;right:10px;top:200px;display:none">
- <div style="float:right">
- <a href="javascript:hideWarning()" title="$i18n.getString( 'hide_warning' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_warning' )"/></a>
- </div>
- <p><span id="warningField"></span></p>
- </div>
-
- </td>
- </tr>
-</table>
-
-
-<script>
- jQuery(document).ready(function(){
- tableSorter( 'userList' );
- });
-</script>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/user.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/user.vm 2010-12-09 22:05:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/user.vm 2010-12-28 17:49:37 +0000
@@ -1,7 +1,85 @@
<h3>$i18n.getString( "user_management" ) #openHelp( "users" )</h3>
<form id="userForm" method="POST">
-#parse( "/dhis-web-maintenance-user/searchUser.vm" )
+<table style="width:100%">
+ <tr>
+ <td style="vertical-align:top">
+ <table width='100%'>
+ <tr>
+ <td>#filterDiv( "user" )</td>
+ <td colspan="3" style="text-align:right"><input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddUserForm.action'"/></td>
+ </tr>
+ </table>
+ <table class="listTable" id="userList" width='100%'>
+ <col/>
+ <col/>
+ <thead>
+ <tr>
+ <th>$i18n.getString( "username" )</th>
+ <th>$i18n.getString( "name" )</th>
+ <th class="{sorter: false}" style="width:80px;">$i18n.getString( "operations" )</th>
+ </tr>
+ </thead>
+ <tbody id="list">
+ #set( $mark = false )
+ #foreach( $userCredentials in $userCredentialsList )
+ <tr id="tr${userCredentials.id}" #alternate( $mark )>
+ <td>$encoder.htmlEncode( $userCredentials.username )</td>
+ <td>$encoder.htmlEncode( $userCredentials.user.surname ), $encoder.htmlEncode( $userCredentials.user.firstName )</td>
+ <td style="text-align:right">
+ <a href="showUpdateUserForm.action?id=$userCredentials.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
+ #if($currentUserName != $userCredentials.username)
+ <a href="javascript:removeUser( $userCredentials.id, '$encoder.jsEncode( $userCredentials.username )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
+ #else
+ <img src="../images/delete-denied.png" alt="$i18n.getString( 'remove' )"/>
+ #end
+ <a href="javascript:showUserDetails( $userCredentials.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a>
+ </td>
+ </tr>
+ #if( $mark )
+ #set( $mark = false )
+ #else
+ #set( $mark = true )
+ #end
+ #end
+ </tbody>
+ </table>
+ <p></p>
+ <div class="paging-container">
+ #parse( "/dhis-web-commons/paging/paging.vm" )
+ </div>
+ </td>
+ <td style="width:20em; padding-left:2em; vertical-align:top">
+
+ <div id="detailsArea" style="display:none">
+ <div style="float:right">
+ <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_details' )"/></a>
+ </div>
+ <p><label>$i18n.getString( "username" ):</label><br/><span id="usernameField"></span></p>
+ <p><label>$i18n.getString( "surname" ):</label><br/><span id="surnameField"></span></p>
+ <p><label>$i18n.getString( "firstName" ):</label><br/><span id="firstNameField"></span></p>
+ <p><label>$i18n.getString( "email" ):</label><br/><span id="emailField"></span></p>
+ <p><label>$i18n.getString( "phone_number" ):</label><br/><span id="phoneNumberField"></span></p>
+ <p><label>$i18n.getString( "number_of_orgunit" ):</label><br/><span id="numberOrgunitField"></span></p>
+ </div>
+
+ <div id="warningArea" style="position:fixed;right:10px;top:200px;display:none">
+ <div style="float:right">
+ <a href="javascript:hideWarning()" title="$i18n.getString( 'hide_warning' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_warning' )"/></a>
+ </div>
+ <p><span id="warningField"></span></p>
+ </div>
+
+ </td>
+ </tr>
+</table>
+
+
+<script>
+ jQuery(document).ready(function(){
+ tableSorter( 'userList' );
+ });
+</script>
</form>
<script type="text/javascript">