dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09280
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2418: Ported user group functionality to user maintainance and tried to clean up a bit
------------------------------------------------------------
revno: 2418
committer: Jo Størset <storset@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2010-12-23 17:57:24 +0530
message:
Ported user group functionality to user maintainance and tried to clean up a bit
removed:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserGroupStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HiberntateUserGroupStore.java
dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/
dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/
dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/AddUserGroupAction.java
dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/AddUserGroupFormAction.java
dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/EditUserGroupFormAction.java
dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/GetUserGroupAction.java
dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/GetUserGroupListAction.java
dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/RemoveUserGroupAction.java
dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/UpdateUserGroupAction.java
dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/ValidateUserGroupAction.java
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/addUserGroupForm.vm
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/editUserGroupForm.vm
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/responseUserGroup.vm
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/userGroupList.vm
added:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserGroupFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/EditUserGroupFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserGroupListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/RemoveUserGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/ValidateUserGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserGroupForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/editUserGroupForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/responseUserGroup.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/userGroupList.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserGroupService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserGroupService.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties
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/index.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/user.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/menu.vm
dhis-mobile/dhis-web-mobile/src/main/resources/META-INF/dhis/beans.xml
dhis-mobile/dhis-web-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties
dhis-mobile/dhis-web-mobile/src/main/resources/struts.xml
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/menu.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/user/UserGroupService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserGroupService.java 2010-12-16 17:38:32 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserGroupService.java 2010-12-23 12:27:24 +0000
@@ -7,7 +7,7 @@
{
String ID = UserGroupService.class.getName();
- int addUserGroup( UserGroup userGroup );
+ void addUserGroup( UserGroup userGroup );
void updateUserGroup( UserGroup userGroup );
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserGroupStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserGroupStore.java 2010-12-16 17:38:32 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserGroupStore.java 1970-01-01 00:00:00 +0000
@@ -1,21 +0,0 @@
-package org.hisp.dhis.user;
-
-import java.util.Collection;
-
-
-public interface UserGroupStore
-{
- String ID = UserGroupStore.class.getName();
-
- int addUserGroup( UserGroup userGroup );
-
- void updateUserGroup( UserGroup userGroup );
-
- void deleteUserGroup( UserGroup userGroup );
-
- UserGroup getUserGroup( int userGroupId );
-
- Collection<UserGroup> getAllUserGroups();
-
- UserGroup getUserGroupByName( String name );
-}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserGroupService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserGroupService.java 2010-12-16 17:38:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/DefaultUserGroupService.java 2010-12-23 12:27:24 +0000
@@ -2,9 +2,7 @@
import java.util.Collection;
-import org.hisp.dhis.user.UserGroup;
-import org.hisp.dhis.user.UserGroupService;
-import org.hisp.dhis.user.UserGroupStore;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.springframework.transaction.annotation.Transactional;
@Transactional
@@ -14,53 +12,52 @@
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
-
- private UserGroupStore userGroupStore;
-
- public void setUserGroupStore( UserGroupStore userGroupStore )
+ private GenericIdentifiableObjectStore<UserGroup> userGroupStore;
+
+ public void setUserGroupStore( GenericIdentifiableObjectStore<UserGroup> userGroupStore )
{
this.userGroupStore = userGroupStore;
}
-
+
// -------------------------------------------------------------------------
// UserGroup
// -------------------------------------------------------------------------
@Override
- public int addUserGroup( UserGroup userGroup )
+ public void addUserGroup( UserGroup userGroup )
{
- return userGroupStore.addUserGroup( userGroup );
+ userGroupStore.saveOrUpdate( userGroup );
}
@Override
public void deleteUserGroup( UserGroup userGroup )
{
- userGroupStore.deleteUserGroup( userGroup );
+ userGroupStore.delete( userGroup );
}
@Override
public void updateUserGroup( UserGroup userGroup )
{
- userGroupStore.updateUserGroup( userGroup );
+ userGroupStore.update( userGroup );
}
@Override
public Collection<UserGroup> getAllUserGroups()
{
- return userGroupStore.getAllUserGroups();
+ return userGroupStore.getAll();
}
@Override
public UserGroup getUserGroup( int userGroupId )
{
- return userGroupStore.getUserGroup( userGroupId );
+ return userGroupStore.get( userGroupId );
}
@Override
public UserGroup getUserGroupByName( String name )
{
- return userGroupStore.getUserGroupByName( name );
+ return userGroupStore.getByName( name );
}
}
=== removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HiberntateUserGroupStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HiberntateUserGroupStore.java 2010-12-16 17:38:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HiberntateUserGroupStore.java 1970-01-01 00:00:00 +0000
@@ -1,86 +0,0 @@
-package org.hisp.dhis.user.hibernate;
-
-import java.util.Collection;
-
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.criterion.Restrictions;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.user.UserGroup;
-import org.hisp.dhis.user.UserGroupStore;
-
-public class HiberntateUserGroupStore implements UserGroupStore
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private SessionFactory sessionFactory;
-
- public void setSessionFactory( SessionFactory sessionFactory )
- {
- this.sessionFactory = sessionFactory;
- }
-
- // -------------------------------------------------------------------------
- // UserGroup
- // -------------------------------------------------------------------------
-
- @Override
- public int addUserGroup( UserGroup userGroup )
- {
- Session session = sessionFactory.getCurrentSession();
-
- return (Integer) session.save( userGroup );
- }
-
- @Override
- public void deleteUserGroup( UserGroup userGroup )
- {
- Session session = sessionFactory.getCurrentSession();
-
- session.delete( userGroup );
- }
-
- @Override
- public void updateUserGroup( UserGroup userGroup )
- {
- Session session = sessionFactory.getCurrentSession();
-
- session.update( userGroup );
- }
-
-
- @Override
- public Collection<UserGroup> getAllUserGroups()
- {
- Session session = sessionFactory.getCurrentSession();
-
- Criteria criteria = session.createCriteria( UserGroup.class );
-
- return criteria.list();
-
- }
-
- @Override
- public UserGroup getUserGroup( int userGroupId )
- {
- Session session = sessionFactory.getCurrentSession();
-
- return (UserGroup) session.get( UserGroup.class, userGroupId );
- }
-
- @Override
- public UserGroup getUserGroupByName( String name )
- {
- Session session = sessionFactory.getCurrentSession();
-
- Criteria criteria = session.createCriteria( DataElement.class );
- criteria.add( Restrictions.eq( "name", name ) );
-
- return (UserGroup) criteria.uniqueResult();
- }
-
-
-}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2010-12-22 09:16:14 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2010-12-23 12:27:24 +0000
@@ -191,11 +191,11 @@
<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
</bean>
- <bean id="org.hisp.dhis.user.UserGroupStore" class="org.hisp.dhis.user.hibernate.HiberntateUserGroupStore">
+ <bean id="org.hisp.dhis.user.UserGroupStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
+ <property name="clazz" value="org.hisp.dhis.user.UserGroup" />
<property name="sessionFactory" ref="sessionFactory" />
</bean>
-
<bean id="org.hisp.dhis.validation.ValidationCriteriaStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
<property name="clazz" value="org.hisp.dhis.validation.ValidationCriteria" />
<property name="sessionFactory" ref="sessionFactory" />
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserGroupAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserGroupAction.java 2010-12-23 12:27:24 +0000
@@ -0,0 +1,82 @@
+package org.hisp.dhis.user.action;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.hisp.dhis.user.User;
+import org.hisp.dhis.user.UserGroup;
+import org.hisp.dhis.user.UserGroupService;
+import org.hisp.dhis.user.UserStore;
+
+import com.opensymphony.xwork2.Action;
+
+public class AddUserGroupAction implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private UserStore userStore;
+
+ public void setUserStore( UserStore userStore )
+ {
+ this.userStore = userStore;
+ }
+
+ private UserGroupService userGroupService;
+
+ public void setUserGroupService( UserGroupService userGroupService )
+ {
+ this.userGroupService = userGroupService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Parameters
+ // -------------------------------------------------------------------------
+
+ private List<Integer> groupMembers;
+
+ public void setGroupMembers( List<Integer> groupMembers )
+ {
+ this.groupMembers = groupMembers;
+ }
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+
+ public String execute() throws Exception
+ {
+
+
+
+ Set<User> userList = new HashSet<User>();
+
+ for( Integer groupMember : groupMembers )
+ {
+ User user = userStore.getUser( groupMember );
+ userList.add( user );
+
+
+ }
+
+ UserGroup userGroup = new UserGroup( name, userList );
+
+ userGroupService.addUserGroup( userGroup );
+
+
+
+
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserGroupFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserGroupFormAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/AddUserGroupFormAction.java 2010-12-23 12:27:24 +0000
@@ -0,0 +1,46 @@
+package org.hisp.dhis.user.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.user.User;
+import org.hisp.dhis.user.UserStore;
+
+import com.opensymphony.xwork2.Action;
+
+public class AddUserGroupFormAction implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private UserStore userStore;
+
+ public void setUserStore( UserStore userStore )
+ {
+ this.userStore = userStore;
+ }
+
+ // -------------------------------------------------------------------------
+ // Parameters
+ // -------------------------------------------------------------------------
+
+ private List<User> availableUsers;
+
+ public List<User> getAvailableUsers()
+ {
+ return availableUsers;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+
+ public String execute() throws Exception
+ {
+ availableUsers = new ArrayList<User>( userStore.getAllUsers() );
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/EditUserGroupFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/EditUserGroupFormAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/EditUserGroupFormAction.java 2010-12-23 12:27:24 +0000
@@ -0,0 +1,94 @@
+package org.hisp.dhis.user.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.user.User;
+import org.hisp.dhis.user.UserGroup;
+import org.hisp.dhis.user.UserGroupService;
+import org.hisp.dhis.user.UserStore;
+
+import com.opensymphony.xwork2.Action;
+
+public class EditUserGroupFormAction
+ implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private UserStore userStore;
+
+ public void setUserStore( UserStore userStore )
+ {
+ this.userStore = userStore;
+ }
+
+ private UserGroupService userGroupService;
+
+ public void setUserGroupService( UserGroupService userGroupService )
+ {
+ this.userGroupService = userGroupService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Parameters
+ // -------------------------------------------------------------------------
+
+ private Integer userGroupId;
+
+ public void setUserGroupId( Integer userGroupId )
+ {
+ this.userGroupId = userGroupId;
+ }
+
+ public Integer getUserGroupId()
+ {
+ return userGroupId;
+ }
+
+ private List<User> availableUsers = new ArrayList<User>();
+
+ public List<User> getAvailableUsers()
+ {
+ return availableUsers;
+ }
+
+ private List<User> groupMembers = new ArrayList<User>();
+
+ public List<User> getGroupMembers()
+ {
+ return groupMembers;
+
+ }
+
+
+ private UserGroup group ;
+
+ public UserGroup getGroup()
+ {
+ return group;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+
+
+ public String execute()
+ throws Exception
+ {
+
+ availableUsers = new ArrayList<User>( userStore.getAllUsers() );
+
+ group = userGroupService.getUserGroup( userGroupId );
+
+ groupMembers = new ArrayList<User>( group.getMembers() );
+
+ availableUsers.removeAll( groupMembers );
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserGroupAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserGroupAction.java 2010-12-23 12:27:24 +0000
@@ -0,0 +1,81 @@
+package org.hisp.dhis.user.action;
+
+import org.hisp.dhis.user.UserGroup;
+import org.hisp.dhis.user.UserGroupService;
+
+import com.opensymphony.xwork2.Action;
+
+
+
+public class GetUserGroupAction implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ // private UserStore userStore;
+
+ //public void setUserStore( UserStore userStore )
+ //{
+ // this.userStore = userStore;
+ // }
+
+ private UserGroupService userGroupService;
+
+ public void setUserGroupService( UserGroupService userGroupService )
+ {
+ this.userGroupService = userGroupService;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Input/output
+ // -------------------------------------------------------------------------
+
+ private Integer userGroupId;
+
+ public void setUserGroupId( Integer userGroupId )
+ {
+ this.userGroupId = userGroupId;
+ }
+
+ public Integer getUserGroupId()
+ {
+ return userGroupId;
+ }
+
+ private UserGroup group ;
+
+ public UserGroup getGroup()
+ {
+ return group;
+ }
+
+ private int memberCount;
+
+ public int getMemberCount()
+ {
+ return memberCount;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ group = userGroupService.getUserGroup(userGroupId );
+
+ memberCount =group.getMembers().size();
+
+ return SUCCESS;
+ }
+
+
+
+
+
+
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserGroupListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserGroupListAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/GetUserGroupListAction.java 2010-12-23 12:27:24 +0000
@@ -0,0 +1,50 @@
+package org.hisp.dhis.user.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.user.UserGroup;
+import org.hisp.dhis.user.UserGroupService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetUserGroupListAction
+ implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private UserGroupService userGroupService;
+
+ public void setUserGroupService( UserGroupService userGroupService )
+ {
+ this.userGroupService = userGroupService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Parameters
+ // -------------------------------------------------------------------------
+
+ private List<UserGroup> userGroupList;
+
+ public List<UserGroup> getUserGroupList()
+ {
+ return userGroupList;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+
+ userGroupList = new ArrayList<UserGroup>( userGroupService.getAllUserGroups() );
+
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/RemoveUserGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/RemoveUserGroupAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/RemoveUserGroupAction.java 2010-12-23 12:27:24 +0000
@@ -0,0 +1,80 @@
+package org.hisp.dhis.user.action;
+
+import org.hisp.dhis.common.DeleteNotAllowedException;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.user.UserGroupService;
+
+import com.opensymphony.xwork2.Action;
+
+public class RemoveUserGroupAction
+ implements Action
+{
+
+ private UserGroupService userGroupService;
+
+ public void setUserGroupService( UserGroupService userGroupService )
+ {
+ this.userGroupService = userGroupService;
+ }
+
+ // -------------------------------------------------------------------------
+ // I18n
+ // -------------------------------------------------------------------------
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+
+
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ System.out.println("\n\n ===== \n userGroupService : " + userGroupService);
+ System.out.println("\n\n userGroupId : " + id);
+ System.out.println("\n\n userGroupService.getUserGroup( userGroupId ) : " + userGroupService.getUserGroup( id ));
+ try
+ {
+ userGroupService.deleteUserGroup( userGroupService.getUserGroup( id ) );
+ }
+ catch ( DeleteNotAllowedException ex )
+ {
+ if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
+ {
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+
+ return ERROR;
+ }
+ }
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserGroupAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/UpdateUserGroupAction.java 2010-12-23 12:27:24 +0000
@@ -0,0 +1,83 @@
+package org.hisp.dhis.user.action;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.hisp.dhis.user.User;
+import org.hisp.dhis.user.UserGroup;
+import org.hisp.dhis.user.UserGroupService;
+import org.hisp.dhis.user.UserStore;
+
+import com.opensymphony.xwork2.Action;
+
+public class UpdateUserGroupAction implements Action
+{
+ private UserStore userStore;
+
+ public void setUserStore( UserStore userStore )
+ {
+ this.userStore = userStore;
+ }
+
+ private UserGroupService userGroupService;
+
+ public void setUserGroupService( UserGroupService userGroupService )
+ {
+ this.userGroupService = userGroupService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Parameters
+ // -------------------------------------------------------------------------
+
+ private List<Integer> groupMembers;
+
+ public void setGroupMembers( List<Integer> groupMembers )
+ {
+ this.groupMembers = groupMembers;
+ }
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private Integer userGroupId;
+
+ public void setUserGroupId( Integer userGroupId )
+ {
+ this.userGroupId = userGroupId;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+
+ System.out.println(" groupMembers size : "+ groupMembers.size());
+
+ Set<User> userList = new HashSet<User>();
+
+ for ( Integer groupMember : groupMembers )
+ {
+ User user = userStore.getUser( groupMember );
+ userList.add( user );
+ }
+
+ UserGroup userGroup = userGroupService.getUserGroup( userGroupId );
+
+ userGroup.setName( name );
+ userGroup.setMembers( userList );
+
+ userGroupService.updateUserGroup( userGroup);
+
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/ValidateUserGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/ValidateUserGroupAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/java/org/hisp/dhis/user/action/ValidateUserGroupAction.java 2010-12-23 12:27:24 +0000
@@ -0,0 +1,48 @@
+package org.hisp.dhis.user.action;
+
+import java.util.ArrayList;
+
+import org.hisp.dhis.user.UserGroup;
+import org.hisp.dhis.user.UserGroupService;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+public class ValidateUserGroupAction
+ extends ActionSupport
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private UserGroupService userGroupService;
+
+ public void setUserGroupService( UserGroupService userGroupService )
+ {
+ this.userGroupService = userGroupService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Parameters
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ private String name;
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ UserGroup group = userGroupService.getUserGroupByName( name );
+
+ if( (id==null && group!= null ) || ( id!= null && id!= group.getId())){
+
+ return INPUT;
+ }
+ return SUCCESS;
+ }
+
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/META-INF/dhis/beans.xml 2010-09-17 07:24:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/META-INF/dhis/beans.xml 2010-12-23 12:27:24 +0000
@@ -211,4 +211,47 @@
</property>
</bean>
+ <!-- User groups -->
+
+ <bean id="org.hisp.dhis.user.action.GetUserGroupListAction" class="org.hisp.dhis.user.action.GetUserGroupListAction"
+ scope="prototype">
+ <property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.user.action.AddUserGroupFormAction" class="org.hisp.dhis.user.action.AddUserGroupFormAction"
+ scope="prototype">
+ <property name="userStore" ref="org.hisp.dhis.user.UserStore" />
+ </bean>
+
+ <bean id="org.hisp.dhis.user.action.AddUserGroupAction" class="org.hisp.dhis.user.action.AddUserGroupAction"
+ scope="prototype">
+ <property name="userStore" ref="org.hisp.dhis.user.UserStore" />
+ <property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.user.action.EditUserGroupFormAction" class="org.hisp.dhis.user.action.EditUserGroupFormAction"
+ scope="prototype">
+ <property name="userStore" ref="org.hisp.dhis.user.UserStore" />
+ <property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.user.action.UpdateUserGroupAction" class="org.hisp.dhis.user.action.UpdateUserGroupAction"
+ scope="prototype">
+ <property name="userStore" ref="org.hisp.dhis.user.UserStore" />
+ <property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.user.action.RemoveUserGroupAction" class="org.hisp.dhis.user.action.RemoveUserGroupAction"
+ scope="prototype">
+ <property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
+ </bean>
+
+
+ <bean id="org.hisp.dhis.user.action.GetUserGroupAction" class="org.hisp.dhis.user.action.GetUserGroupAction"
+ scope="prototype">
+ <property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
+ </bean>
+
+
+
</beans>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2010-12-09 06:15:40 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2010-12-23 12:27:24 +0000
@@ -190,4 +190,16 @@
can_not_remove_last_super_user_role = Can not remove the last super user role.
excel_importing = Excel Importing
delete_current_user = Delete Current User
-number_of_orgunit = Number of organisation units
\ No newline at end of file
+number_of_orgunit = Number of organisation units
+
+user_groups = User groups
+intro_user_groups = Create user groups for functionality that should work on a group of users, like notifications.
+user_group_management = User group management
+filter_by_name = Filter by name
+edit_user_group = Edit user group
+user_group_details = User group details
+confirm_delete = Confirm delete
+add_user_group = Add user group
+available_users = Available users
+group_members = Group members
+no_of_Users = Number of users
\ No newline at end of file
=== 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-06 14:13:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/struts.xml 2010-12-23 12:27:24 +0000
@@ -159,6 +159,55 @@
<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
<result name="logout" type="redirect">/dhis-web-commons-security/logout.action</result>
</action>
+
+ <!-- User Group -->
+
+ <action name="getAllUserGroups" class="org.hisp.dhis.user.action.GetUserGroupListAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-user/userGroupList.vm</param>
+ <param name="menu">/dhis-web-maintenance-user/menu.vm</param>
+ <param name="stylesheets">css/receiveImportPage.css</param>
+ <param name="javascripts">javascript/user.js</param>
+ </action>
+
+ <action name="getUserGroup" class="org.hisp.dhis.user.action.GetUserGroupAction">
+ <result name="success" type="velocity-xml">
+ /dhis-web-maintenance-user/responseUserGroup.vm</result>
+ </action>
+
+ <action name="addUserGroupForm" class="org.hisp.dhis.user.action.AddUserGroupFormAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-user/addUserGroupForm.vm</param>
+ <param name="menu">/dhis-web-maintenance-user/menu.vm</param>
+ <param name="javascripts">javascript/user.js</param>
+ <param name="stylesheets">css/receiveImportPage.css</param>
+ </action>
+
+ <action name="addUserGroup" class="org.hisp.dhis.user.action.AddUserGroupAction">
+ <param name="javascripts">javascript/user.js</param>
+ <result name="success" type="redirect">
+ getAllUserGroups.action</result>
+ </action>
+
+ <action name="editUserGroupForm" class="org.hisp.dhis.user.action.EditUserGroupFormAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-user/editUserGroupForm.vm</param>
+ <param name="menu">/dhis-web-maintenance-user/menu.vm</param>
+ <param name="stylesheets">css/receiveImportPage.css</param>
+ </action>
+
+ <action name="updateUserGroup" class="org.hisp.dhis.user.action.UpdateUserGroupAction">
+ <result name="success" type="redirect">
+ getAllUserGroups.action</result>
+ </action>
+
+ <action name="removeUserGroup" class="org.hisp.dhis.user.action.RemoveUserGroupAction">
+
+ <!-- <result name="success" type="redirect">getAllUserGroups.action</result> -->
+ <result name="success" type="velocity">
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <!--<param name ="javascripts">javascript/user.js</param> -->
+ </action>
</package>
</struts>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserGroupForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserGroupForm.vm 2010-12-23 12:27:24 +0000
@@ -0,0 +1,91 @@
+<h3>$i18n.getString( "add_user_group" )</h3>
+
+<form id="addUserGroupForm" name="addUserGroupForm" action = " addUserGroup.action" method="post" onSubmit=" return addValidation()" >
+ <table id="detailsList">
+ <col/> ## Labels
+ <col/> ## Input
+ <thead>
+ <tr>
+ <th colspan="2">$i18n.getString( "user_group_details" )</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><input type="text" id="name" name="name" onchange="nameChanged()" style="width:20em" maxlength="150"
+ class="{validate:{required:true,minlength:4,alphanumericwithbasicpuncspaces:true,firstletteralphabet:false}}"/>
+ </td>
+ </tr>
+ <tr><td> </td><td> </td></tr>
+ </tbody>
+ </table>
+ <br/>
+<table>
+ <tr>
+ <th>$i18n.getString( "available_users" )</th><td></td>
+ <th>$i18n.getString( "group_members" )
+ <select id="memberValidator" multiple="multiple" style="display:none" class="{validate:{required:true}}"/>
+ </th>
+ </tr>
+ <tr>
+ <td><input type="text" id="availableUsersFilter" onkeyup="filterList( this.value, 'availableUsers' )" style="width:25em"/></td>
+ <td style="text-align:center">< $i18n.getString( "filters" ) ></td>
+ <td><input type="text" id="groupMembersFilter" onkeyup="filterList( this.value, 'groupMembers' )" style="width:25em"/></td>
+ </tr>
+ <tr>
+ <td>
+ <select id="availableUsers" size="2" multiple="multiple" style="min-width:25em; height:25em" ondblclick="moveSelectedById( 'availableUsers', 'groupMembers' )">
+ #foreach( $user in $availableUsers )
+ <option value="$user.id">$encoder.htmlEncode( $user.name )</option>
+ #end
+ </select>
+ </td>
+
+ <td style="text-align:center">
+ <input type="button" value=">" title="$i18n.getString('move_selected')" style="width:50px" onclick="moveSelectedById( 'availableUsers', 'groupMembers' )"/><br/>
+ <input type="button" value="<" title="$i18n.getString('remove_selected')" style="width:50px" onclick="moveSelectedById( 'groupMembers', 'availableUsers' )"/><br/>
+ <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="moveAllById( 'availableUsers', 'groupMembers' )"/><br/>
+ <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="moveAllById( 'groupMembers', 'availableUsers' )"/>
+ </td>
+
+ <td>
+ <select id="groupMembers" name="groupMembers" size="2" multiple="multiple" style="min-width:25em; height:25em" ondblclick="moveSelectedById( 'groupMembers', 'availableUsers' )" />
+ </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td></td>
+ </tr>
+</table>
+
+<p><input type="submit" value="$i18n.getString( 'add' )" style="width:10em"/><input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='getAllUserGroups.action'" style="width:10em"/></p>
+
+</form>
+
+<script type="text/javascript">
+
+
+
+
+
+ var i18n_select_dataelement_group = '$encoder.jsEscape( $i18n.getString( "select_User_group" ) , "'")';
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_data_element_group" ) , "'")';
+ var i18n_member_of = '$encoder.jsEscape( $i18n.getString( "member_of" ) , "'")';
+ var i18n_update_success = '$encoder.jsEscape( $i18n.getString( "update_success" ) , "'")';
+
+ var dataElementGroups = new Object();
+ #foreach( $dataElementGroup in $dataElementGroups )
+ dataElementGroups['$dataElementGroup.id'] = '$encoder.jsEscape( $dataElementGroup.name, "'" )';
+ #end
+
+ var availableDataElements = new Object();
+ #foreach( $dataElement in $dataElements )
+ availableDataElements['$dataElement.id'] = '$encoder.jsEscape( $dataElement.name, "'" )';
+ #end
+ var selectedDataElements = new Object();
+
+ initAllList();
+</script>
+
+
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/editUserGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/editUserGroupForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/editUserGroupForm.vm 2010-12-23 12:27:24 +0000
@@ -0,0 +1,102 @@
+
+<h3>$i18n.getString( "edit_user_group" )</h3>
+
+<form id="editUserGroupForm" name="editUserGroupForm" action="updateUserGroup.action" method="post" onsubmit="return editValidation();" >
+
+ <input type="hidden" name="userGroupId" id="userGroupId" value="$userGroupId" />
+ <table id="detailsList">
+ <col/> ## Labels
+ <col/> ## Input
+ <thead>
+ <tr>
+ <th colspan="2">$i18n.getString( "user_group_details" )</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><input type="text" id="name" name="name" value ="$encoder.htmlEncode( $group.name )" onchange="nameChanged()" style="width:20em" maxlength="150" />
+ </td>
+ </tr>
+ <tr><td> </td><td> </td></tr>
+ </tbody>
+ </table>
+ <br/>
+<table>
+ <tr>
+ <th>$i18n.getString( "available_users" )</th><td></td>
+ <th>$i18n.getString( "group_members" )
+ <select id="memberValidator" multiple="multiple" style="display:none"/>
+ </th>
+ </tr>
+ <tr>
+ <td><input type="text" id="availableUsersFilter" onkeyup="filterList( this.value, 'availableUsers' )" style="width:25em"/></td>
+ <td style="text-align:center">< $i18n.getString( "filters" ) ></td>
+ <td><input type="text" id="groupMembersFilter" onkeyup="filterList( this.value, 'groupMembers' )" style="width:25em"/></td>
+ </tr>
+ <tr>
+ <td>
+ <select id="availableUsers" size="2" multiple="multiple" style="min-width:25em; height:25em" ondblclick="moveSelectedById( 'availableUsers', 'groupMembers' )">
+ #foreach( $user in $availableUsers )
+ <option value="$user.id">$encoder.htmlEncode( $user.name )</option>
+ #end
+ </select>
+ </td>
+
+ <td style="text-align:center">
+ <input type="button" value=">" title="$i18n.getString('move_selected')" style="width:50px" onclick="moveSelectedById( 'availableUsers', 'groupMembers' )"/><br/>
+ <input type="button" value="<" title="$i18n.getString('remove_selected')" style="width:50px" onclick="moveSelectedById( 'groupMembers', 'availableUsers' )"/><br/>
+ <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="moveAllById( 'availableUsers', 'groupMembers' )"/><br/>
+ <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="moveAllById( 'groupMembers', 'availableUsers' )"/>
+ </td>
+
+ <td>
+ <select id="groupMembers" name="groupMembers" size="2"value = "$group.name" multiple="multiple" style="min-width:25em; height:25em" ondblclick="moveSelectedById( 'groupMembers', 'availableUsers' )" />
+ #foreach( $user in $groupMembers )
+ <option value="$user.id">$encoder.htmlEncode( $user.name )</option>
+ #end
+ </td>
+
+ </tr>
+ <tr>
+ <td></td>
+ <td></td>
+ <td></td>
+ </tr>
+</table>
+
+<p><input type="submit" value="$i18n.getString( 'save' )" style="width:10em"/><input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='getAllUserGroups.action'" style="width:10em"/></p>
+
+</form>
+<script type="text/javascript">
+ function editValidation ()
+{
+ var k =0 ;
+ var xyz=document.getElementById("name");
+ var abc =document.getElementById("groupMembers");
+ var c = abc.length ;
+
+ if( xyz.value == "") {
+ alert ("please select name ");alert(' xyz.value is empty');
+ return false;
+ }
+ else if ( c <=0 ){
+ alert("please select at least one member");
+ return false ;
+ }else{
+ if (c >0 )
+ {
+ /* for( k =0;k<=c;k++)
+ {alert('k : ' + k);
+ alert('abc.options[k] : ' + abc.options[k]);
+ abc.options[k].selected = true ;
+ }*/
+
+ selectAllById("groupMembers");
+ }
+ }
+
+ return true;
+}
+
+</script>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/index.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/index.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/index.vm 2010-12-23 12:27:24 +0000
@@ -5,4 +5,6 @@
#introListImgItem( "alluser.action" "user" "user" )
#introListImgItem( "user.action" "user_by_orgunit" "user" )
#introListImgItem( "allRole.action" "user_role" "user" )
+ #introListImgItem( "getAllUserGroups.action" "user_groups" "user" )
+
</ul>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/user.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/user.js 2010-12-03 05:41:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/user.js 2010-12-23 12:27:24 +0000
@@ -53,4 +53,62 @@
function removeUser( userId, username )
{
removeItem( userId, username, i18n_confirm_delete, 'removeUser.action' );
-}
\ No newline at end of file
+}
+
+
+
+// -----------------------------------------------------------------------------
+// Usergroup functionality
+// -----------------------------------------------------------------------------
+
+function showUserGroupDetails( userGroupId )
+{
+ var request = new Request();
+ request.setResponseTypeXML( 'userGroup' );
+ request.setCallbackSuccess( userGroupReceived );
+ request.send( 'getUserGroup.action?userGroupId=' + userGroupId );
+}
+
+function userGroupReceived( userGroupElement )
+{
+ setInnerHTML( 'nameField', getElementValue( userGroupElement, 'name' ) );
+ setInnerHTML( 'idField', getElementValue( userGroupElement, 'id' ) );
+ setInnerHTML( 'noOfGroupField', getElementValue( userGroupElement, 'noOfUsers' ) );
+
+ showDetails();
+}
+
+function removeUserGroup( userGroupId, userGroupName )
+{
+ removeItem( userGroupId, userGroupName, i18n_confirm_delete, "removeUserGroup.action" );
+}
+
+function addValidation ()
+{
+ var k =0 ;
+ var xyz=document.getElementById("name");
+ var abc =document.getElementById("groupMembers");
+ var c = abc.length ;
+ if( xyz.value == "") {
+ alert ("please select name ");
+ return false;
+ }
+ else if ( c <= 0 ){
+ alert("please select at least one member");
+ return false ;
+ }
+ else if (c > 0 )
+ {
+ for( k =0;k<=c;k++)
+ {
+ abc.options[k].selected = true ;
+ }
+ }
+
+ return true;
+}
+
+function editValidation ()
+{
+ alert("dev");
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/menu.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/menu.vm 2010-04-21 10:42:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/menu.vm 2010-12-23 12:27:24 +0000
@@ -3,5 +3,8 @@
<li><a href="alluser.action" title="$i18n.getString( "user" )">$i18n.getString( "user" ) </a></li>
<li><a href="user.action" title="$i18n.getString( "user_by_orgunit" )">$i18n.getString( "user_by_orgunit" ) </a></li>
<li><a href="allRole.action" title="$i18n.getString( "user_role" )">$i18n.getString( "user_role" ) </a></li>
- <li><a href="deleteCurrentUser.action" title="Delete Current User">Delete Current User</a></li>
+ <li><a href="deleteCurrentUser.action" title="$i18n.getString( "delete_current_user" )">$i18n.getString( "delete_current_user" )</a></li>
+
+ <li><a href="getAllUserGroups.action" title="$i18n.getString( "user_groups" )" >$i18n.getString( "user_groups" )</a></li>
+
</ul>
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/responseUserGroup.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/responseUserGroup.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/responseUserGroup.vm 2010-12-23 12:27:24 +0000
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<userGroup>
+ <name>$group.name</name>
+ <id>$group.id</id>
+ <noOfUsers>$memberCount</noOfUsers>
+</userGroup>
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/userGroupList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/userGroupList.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/userGroupList.vm 2010-12-23 12:27:24 +0000
@@ -0,0 +1,77 @@
+<h3>$i18n.getString( "user_group_management" )</h3>
+
+<table class="mainPageTable">
+ <tr>
+ <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 colspan="9" style="text-align:right">
+ <input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='addUserGroupForm.action'" style="width:80px"/></a>
+ </td>
+ </tr>
+ </table>
+ <table class="listTable" id="listTable">
+ <col/>
+ <col width="20"/>
+ <col width="20"/>
+ <col width="20"/>
+
+ <thead>
+ <tr>
+ <th>$i18n.getString( "name" )</th>
+ <th style="text-align:center" colspan="3" class="{sorter: false}">$i18n.getString( "operations" )</th>
+ </tr>
+ </thead>
+ <tbody id="list">
+ #foreach( $userGroup in $userGroupList )
+ <tr id="tr${userGroup.id}">
+ <td onclick="showUserGroupDetails( $userGroup.id )">$encoder.htmlEncode( $userGroup.name )</td>
+ <td style="text-align:center">
+ <a href="editUserGroupForm.action?userGroupId=$userGroup.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
+ </td>
+ <td style="text-align:center">
+ <a href="javascript:removeUserGroup( '$userGroup.id', '$encoder.jsEncode( $userGroup.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
+ </td>
+ <td style="text-align:center">
+ <a href="javascript:showUserGroupDetails( $userGroup.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a>
+ </td>
+ </tr>
+ #end
+ </tbody>
+ </table>
+ </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( "name" ):</label><br/><span id="nameField"></span></p>
+ <p><label>$i18n.getString( "id" ):</label><br/><span id="idField"></span></p>
+ <p><label>$i18n.getString( "no_of_Users" ):</label><br/><span id="noOfGroupField"></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 type="text/javascript">
+
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete" ) , "'" )';
+
+ jQuery(document).ready(function(){
+ tableSorter( 'listTable' );
+ });
+
+
+function removeUserGroup( userGroupId, userGroupName )
+{
+ removeItem( userGroupId, userGroupName, i18n_confirm_delete, "removeUserGroup.action" );
+}
+</script>
=== removed directory 'dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user'
=== removed directory 'dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action'
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/AddUserGroupAction.java'
--- dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/AddUserGroupAction.java 2010-10-25 05:35:48 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/AddUserGroupAction.java 1970-01-01 00:00:00 +0000
@@ -1,82 +0,0 @@
-package org.hisp.dhis.mobile.user.action;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.hisp.dhis.user.User;
-import org.hisp.dhis.user.UserGroup;
-import org.hisp.dhis.user.UserGroupService;
-import org.hisp.dhis.user.UserStore;
-
-import com.opensymphony.xwork2.Action;
-
-public class AddUserGroupAction implements Action
-{
-
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private UserStore userStore;
-
- public void setUserStore( UserStore userStore )
- {
- this.userStore = userStore;
- }
-
- private UserGroupService userGroupService;
-
- public void setUserGroupService( UserGroupService userGroupService )
- {
- this.userGroupService = userGroupService;
- }
-
- // -------------------------------------------------------------------------
- // Parameters
- // -------------------------------------------------------------------------
-
- private List<Integer> groupMembers;
-
- public void setGroupMembers( List<Integer> groupMembers )
- {
- this.groupMembers = groupMembers;
- }
-
- private String name;
-
- public void setName( String name )
- {
- this.name = name;
- }
-
- // -------------------------------------------------------------------------
- // Action Implementation
- // -------------------------------------------------------------------------
-
- public String execute() throws Exception
- {
-
-
-
- Set<User> userList = new HashSet<User>();
-
- for( Integer groupMember : groupMembers )
- {
- User user = userStore.getUser( groupMember );
- userList.add( user );
-
-
- }
-
- UserGroup userGroup = new UserGroup( name, userList );
-
- userGroupService.addUserGroup( userGroup );
-
-
-
-
- return SUCCESS;
- }
-
-}
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/AddUserGroupFormAction.java'
--- dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/AddUserGroupFormAction.java 2010-10-21 06:32:42 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/AddUserGroupFormAction.java 1970-01-01 00:00:00 +0000
@@ -1,46 +0,0 @@
-package org.hisp.dhis.mobile.user.action;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hisp.dhis.user.User;
-import org.hisp.dhis.user.UserStore;
-
-import com.opensymphony.xwork2.Action;
-
-public class AddUserGroupFormAction implements Action
-{
-
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private UserStore userStore;
-
- public void setUserStore( UserStore userStore )
- {
- this.userStore = userStore;
- }
-
- // -------------------------------------------------------------------------
- // Parameters
- // -------------------------------------------------------------------------
-
- private List<User> availableUsers;
-
- public List<User> getAvailableUsers()
- {
- return availableUsers;
- }
-
- // -------------------------------------------------------------------------
- // Action Implementation
- // -------------------------------------------------------------------------
-
- public String execute() throws Exception
- {
- availableUsers = new ArrayList<User>( userStore.getAllUsers() );
-
- return SUCCESS;
- }
-}
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/EditUserGroupFormAction.java'
--- dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/EditUserGroupFormAction.java 2010-10-28 12:20:38 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/EditUserGroupFormAction.java 1970-01-01 00:00:00 +0000
@@ -1,94 +0,0 @@
-package org.hisp.dhis.mobile.user.action;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hisp.dhis.user.User;
-import org.hisp.dhis.user.UserGroup;
-import org.hisp.dhis.user.UserGroupService;
-import org.hisp.dhis.user.UserStore;
-
-import com.opensymphony.xwork2.Action;
-
-public class EditUserGroupFormAction
- implements Action
-{
-
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private UserStore userStore;
-
- public void setUserStore( UserStore userStore )
- {
- this.userStore = userStore;
- }
-
- private UserGroupService userGroupService;
-
- public void setUserGroupService( UserGroupService userGroupService )
- {
- this.userGroupService = userGroupService;
- }
-
- // -------------------------------------------------------------------------
- // Parameters
- // -------------------------------------------------------------------------
-
- private Integer userGroupId;
-
- public void setUserGroupId( Integer userGroupId )
- {
- this.userGroupId = userGroupId;
- }
-
- public Integer getUserGroupId()
- {
- return userGroupId;
- }
-
- private List<User> availableUsers = new ArrayList<User>();
-
- public List<User> getAvailableUsers()
- {
- return availableUsers;
- }
-
- private List<User> groupMembers = new ArrayList<User>();
-
- public List<User> getGroupMembers()
- {
- return groupMembers;
-
- }
-
-
- private UserGroup group ;
-
- public UserGroup getGroup()
- {
- return group;
- }
-
-
- // -------------------------------------------------------------------------
- // Action Implementation
- // -------------------------------------------------------------------------
-
-
- public String execute()
- throws Exception
- {
-
- availableUsers = new ArrayList<User>( userStore.getAllUsers() );
-
- group = userGroupService.getUserGroup( userGroupId );
-
- groupMembers = new ArrayList<User>( group.getMembers() );
-
- availableUsers.removeAll( groupMembers );
- return SUCCESS;
- }
-
-}
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/GetUserGroupAction.java'
--- dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/GetUserGroupAction.java 2010-10-25 05:35:48 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/GetUserGroupAction.java 1970-01-01 00:00:00 +0000
@@ -1,81 +0,0 @@
-package org.hisp.dhis.mobile.user.action;
-
-import org.hisp.dhis.user.UserGroup;
-import org.hisp.dhis.user.UserGroupService;
-
-import com.opensymphony.xwork2.Action;
-
-
-
-public class GetUserGroupAction implements Action
-{
-
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- // private UserStore userStore;
-
- //public void setUserStore( UserStore userStore )
- //{
- // this.userStore = userStore;
- // }
-
- private UserGroupService userGroupService;
-
- public void setUserGroupService( UserGroupService userGroupService )
- {
- this.userGroupService = userGroupService;
- }
-
-
- // -------------------------------------------------------------------------
- // Input/output
- // -------------------------------------------------------------------------
-
- private Integer userGroupId;
-
- public void setUserGroupId( Integer userGroupId )
- {
- this.userGroupId = userGroupId;
- }
-
- public Integer getUserGroupId()
- {
- return userGroupId;
- }
-
- private UserGroup group ;
-
- public UserGroup getGroup()
- {
- return group;
- }
-
- private int memberCount;
-
- public int getMemberCount()
- {
- return memberCount;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- {
- group = userGroupService.getUserGroup(userGroupId );
-
- memberCount =group.getMembers().size();
-
- return SUCCESS;
- }
-
-
-
-
-
-
-
-}
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/GetUserGroupListAction.java'
--- dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/GetUserGroupListAction.java 2010-10-21 06:32:42 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/GetUserGroupListAction.java 1970-01-01 00:00:00 +0000
@@ -1,50 +0,0 @@
-package org.hisp.dhis.mobile.user.action;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hisp.dhis.user.UserGroup;
-import org.hisp.dhis.user.UserGroupService;
-
-import com.opensymphony.xwork2.Action;
-
-public class GetUserGroupListAction
- implements Action
-{
-
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private UserGroupService userGroupService;
-
- public void setUserGroupService( UserGroupService userGroupService )
- {
- this.userGroupService = userGroupService;
- }
-
- // -------------------------------------------------------------------------
- // Parameters
- // -------------------------------------------------------------------------
-
- private List<UserGroup> userGroupList;
-
- public List<UserGroup> getUserGroupList()
- {
- return userGroupList;
- }
-
- // -------------------------------------------------------------------------
- // Action Implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
-
- userGroupList = new ArrayList<UserGroup>( userGroupService.getAllUserGroups() );
-
- return SUCCESS;
- }
-
-}
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/RemoveUserGroupAction.java'
--- dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/RemoveUserGroupAction.java 2010-10-25 05:35:48 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/RemoveUserGroupAction.java 1970-01-01 00:00:00 +0000
@@ -1,80 +0,0 @@
-package org.hisp.dhis.mobile.user.action;
-
-import org.hisp.dhis.common.DeleteNotAllowedException;
-import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.user.UserGroupService;
-
-import com.opensymphony.xwork2.Action;
-
-public class RemoveUserGroupAction
- implements Action
-{
-
- private UserGroupService userGroupService;
-
- public void setUserGroupService( UserGroupService userGroupService )
- {
- this.userGroupService = userGroupService;
- }
-
- // -------------------------------------------------------------------------
- // I18n
- // -------------------------------------------------------------------------
-
- private I18n i18n;
-
- public void setI18n( I18n i18n )
- {
- this.i18n = i18n;
- }
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private Integer id;
- public void setId( Integer id )
- {
- this.id = id;
- }
-
-
- // -------------------------------------------------------------------------
- // Output
- // -------------------------------------------------------------------------
-
-
-
- private String message;
-
- public String getMessage()
- {
- return message;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- {
- System.out.println("\n\n ===== \n userGroupService : " + userGroupService);
- System.out.println("\n\n userGroupId : " + id);
- System.out.println("\n\n userGroupService.getUserGroup( userGroupId ) : " + userGroupService.getUserGroup( id ));
- try
- {
- userGroupService.deleteUserGroup( userGroupService.getUserGroup( id ) );
- }
- catch ( DeleteNotAllowedException ex )
- {
- if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
- {
- message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
-
- return ERROR;
- }
- }
-
- return SUCCESS;
- }
-}
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/UpdateUserGroupAction.java'
--- dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/UpdateUserGroupAction.java 2010-10-25 05:35:48 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/UpdateUserGroupAction.java 1970-01-01 00:00:00 +0000
@@ -1,83 +0,0 @@
-package org.hisp.dhis.mobile.user.action;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.hisp.dhis.user.User;
-import org.hisp.dhis.user.UserGroup;
-import org.hisp.dhis.user.UserGroupService;
-import org.hisp.dhis.user.UserStore;
-
-import com.opensymphony.xwork2.Action;
-
-public class UpdateUserGroupAction implements Action
-{
- private UserStore userStore;
-
- public void setUserStore( UserStore userStore )
- {
- this.userStore = userStore;
- }
-
- private UserGroupService userGroupService;
-
- public void setUserGroupService( UserGroupService userGroupService )
- {
- this.userGroupService = userGroupService;
- }
-
- // -------------------------------------------------------------------------
- // Parameters
- // -------------------------------------------------------------------------
-
- private List<Integer> groupMembers;
-
- public void setGroupMembers( List<Integer> groupMembers )
- {
- this.groupMembers = groupMembers;
- }
-
- private String name;
-
- public void setName( String name )
- {
- this.name = name;
- }
-
- private Integer userGroupId;
-
- public void setUserGroupId( Integer userGroupId )
- {
- this.userGroupId = userGroupId;
- }
-
- // -------------------------------------------------------------------------
- // Action Implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
-
- System.out.println(" groupMembers size : "+ groupMembers.size());
-
- Set<User> userList = new HashSet<User>();
-
- for ( Integer groupMember : groupMembers )
- {
- User user = userStore.getUser( groupMember );
- userList.add( user );
- }
-
- UserGroup userGroup = userGroupService.getUserGroup( userGroupId );
-
- userGroup.setName( name );
- userGroup.setMembers( userList );
-
- userGroupService.updateUserGroup( userGroup);
-
- return SUCCESS;
- }
-
-}
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/ValidateUserGroupAction.java'
--- dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/ValidateUserGroupAction.java 2010-10-28 09:25:22 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/ValidateUserGroupAction.java 1970-01-01 00:00:00 +0000
@@ -1,48 +0,0 @@
-package org.hisp.dhis.mobile.user.action;
-
-import java.util.ArrayList;
-
-import org.hisp.dhis.user.UserGroup;
-import org.hisp.dhis.user.UserGroupService;
-
-import com.opensymphony.xwork2.ActionSupport;
-
-public class ValidateUserGroupAction
- extends ActionSupport
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private UserGroupService userGroupService;
-
- public void setUserGroupService( UserGroupService userGroupService )
- {
- this.userGroupService = userGroupService;
- }
-
- // -------------------------------------------------------------------------
- // Parameters
- // -------------------------------------------------------------------------
-
- private Integer id;
-
- private String name;
-
- // -------------------------------------------------------------------------
- // Action Implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
- UserGroup group = userGroupService.getUserGroupByName( name );
-
- if( (id==null && group!= null ) || ( id!= null && id!= group.getId())){
-
- return INPUT;
- }
- return SUCCESS;
- }
-
-}
=== modified file 'dhis-mobile/dhis-web-mobile/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-mobile/dhis-web-mobile/src/main/resources/META-INF/dhis/beans.xml 2010-10-25 05:35:48 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/resources/META-INF/dhis/beans.xml 2010-12-23 12:27:24 +0000
@@ -30,61 +30,6 @@
<property name="sendSMSService" ref="org.hisp.dhis.mobile.api.SendSMSService"/>
</bean>
-<!-- UserGroup -->
- <bean id="org.hisp.dhis.mobile.user.action.GetUserGroupListAction"
- class="org.hisp.dhis.mobile.user.action.GetUserGroupListAction"
- scope="prototype">
- <property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
- </bean>
- <bean id="org.hisp.dhis.mobile.user.action.AddUserGroupFormAction"
- class="org.hisp.dhis.mobile.user.action.AddUserGroupFormAction"
- scope="prototype">
- <property name="userStore" ref="org.hisp.dhis.user.UserStore" />
- </bean>
- <bean id="org.hisp.dhis.mobile.user.action.AddUserGroupAction"
- class="org.hisp.dhis.mobile.user.action.AddUserGroupAction"
- scope="prototype">
- <property name="userStore" ref="org.hisp.dhis.user.UserStore" />
- <property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
- </bean>
-
- <!--edit -->
-
-
- <bean id="org.hisp.dhis.mobile.user.action.EditUserGroupFormAction"
- class="org.hisp.dhis.mobile.user.action.EditUserGroupFormAction"
- scope="prototype">
- <property name="userStore" ref="org.hisp.dhis.user.UserStore" />
- <property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
- </bean>
-
- <!-- End of edit -->
-
-
-<!-- update -->
- <bean id="org.hisp.dhis.mobile.user.action.UpdateUserGroupAction"
- class="org.hisp.dhis.mobile.user.action.UpdateUserGroupAction"
- scope="prototype">
- <property name="userStore" ref="org.hisp.dhis.user.UserStore" />
- <property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
- </bean>
-<!-- End of update -->
- <!-- Remove-->
-
- <bean id="org.hisp.dhis.mobile.user.action.RemoveUserGroupAction"
- class="org.hisp.dhis.mobile.user.action.RemoveUserGroupAction"
- scope="prototype">
- <property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
- </bean>
-
-
- <bean id="org.hisp.dhis.mobile.user.action.GetUserGroupAction"
- class="org.hisp.dhis.mobile.user.action.GetUserGroupAction"
- scope="prototype">
- <property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
- </bean>
-
-
<bean id="org.hisp.dhis.mobile.app.action.CreateMobileAppAction"
class="org.hisp.dhis.mobile.app.action.CreateMobileAppAction"
scope="prototype">
=== modified file 'dhis-mobile/dhis-web-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties'
--- dhis-mobile/dhis-web-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties 2010-10-28 09:25:22 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties 2010-12-23 12:27:24 +0000
@@ -1,9 +0,0 @@
-usergroup_management = User Group Management
-filter_by_name = Filter By Name
-edit_usergroup = Edit UserGroup
-usergroup_details = UserGroup Details
-confirm_delete = Confirm Delete
-add_usergroup = Add UserGroup
-available_users = Available USers
-group_members = Group Members
-no_of_Users = No Of Users
\ No newline at end of file
=== modified file 'dhis-mobile/dhis-web-mobile/src/main/resources/struts.xml'
--- dhis-mobile/dhis-web-mobile/src/main/resources/struts.xml 2010-10-28 09:17:13 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/resources/struts.xml 2010-12-23 12:27:24 +0000
@@ -58,69 +58,6 @@
<param name="stylesheets">css/receiveImportPage.css</param>
</action>
- <!-- User Group -->
- <action name="getAllUserGroups"
- class="org.hisp.dhis.mobile.user.action.GetUserGroupListAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-mobile/userGroupList.vm</param>
- <param name="menu">/dhis-web-mobile/menu.vm</param>
- <param name="stylesheets">css/receiveImportPage.css</param>
- <param name="javascripts">javascript/user.js</param>
- </action>
-
- <action name="addUserGroupForm"
- class="org.hisp.dhis.mobile.user.action.AddUserGroupFormAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-mobile/addUserGroupForm.vm</param>
- <param name="menu">/dhis-web-mobile/menu.vm</param>
- <param name="javascripts">javascript/user.js</param>
- <param name="stylesheets">css/receiveImportPage.css</param>
- </action>
-
- <action name="addUserGroup"
- class="org.hisp.dhis.mobile.user.action.AddUserGroupAction">
- <param name="javascripts">javascript/user.js</param>
- <result name="success" type="redirect">
- getAllUserGroups.action</result>
- </action>
-
- <!-- edit user group-->
- <action name="editUserGroupForm"
- class="org.hisp.dhis.mobile.user.action.EditUserGroupFormAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-mobile/editUserGroupForm.vm</param>
- <param name="menu">/dhis-web-mobile/menu.vm</param>
- <param name="stylesheets">css/receiveImportPage.css</param>
- </action>
-
- <action name="updateUserGroup"
- class="org.hisp.dhis.mobile.user.action.UpdateUserGroupAction">
- <result name="success" type="redirect">
- getAllUserGroups.action</result>
- </action>
-
- <!-- edit user group end -->
-
- <!-- Remove user group -->
-
- <action name="removeUserGroup"
- class="org.hisp.dhis.mobile.user.action.RemoveUserGroupAction">
-
- <!-- <result name="success" type="redirect">getAllUserGroups.action</result> -->
- <result name="success" type="velocity">
- /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
- <!--<param name ="javascripts">javascript/user.js</param>-->
- </action>
-
- <!--show details-->
-
- <action name="getUserGroup"
- class="org.hisp.dhis.mobile.user.action.GetUserGroupAction">
- <result name="success" type="velocity-xml">
- /dhis-web-mobile/responseUserGroup.vm</result>
-
- </action>
- <!-- show detail end-->
<!-- Create Mobile Application -->
<action name="createMobileApp"
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/addUserGroupForm.vm'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/addUserGroupForm.vm 2010-10-28 09:17:13 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/addUserGroupForm.vm 1970-01-01 00:00:00 +0000
@@ -1,91 +0,0 @@
-<h3>$i18n.getString( "add_usergroup" )</h3>
-
-<form id="addUserGroupForm" name="addUserGroupForm" action = " addUserGroup.action" method="post" onSubmit=" return addValidation()" >
- <table id="detailsList">
- <col/> ## Labels
- <col/> ## Input
- <thead>
- <tr>
- <th colspan="2">$i18n.getString( "usergroup_details" )</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td><input type="text" id="name" name="name" onchange="nameChanged()" style="width:20em" maxlength="150"
- class="{validate:{required:true,minlength:4,alphanumericwithbasicpuncspaces:true,firstletteralphabet:false}}"/>
- </td>
- </tr>
- <tr><td> </td><td> </td></tr>
- </tbody>
- </table>
- <br/>
-<table>
- <tr>
- <th>$i18n.getString( "available_users" )</th><td></td>
- <th>$i18n.getString( "group_members" )
- <select id="memberValidator" multiple="multiple" style="display:none" class="{validate:{required:true}}"/>
- </th>
- </tr>
- <tr>
- <td><input type="text" id="availableUsersFilter" onkeyup="filterList( this.value, 'availableUsers' )" style="width:25em"/></td>
- <td style="text-align:center">< $i18n.getString( "filters" ) ></td>
- <td><input type="text" id="groupMembersFilter" onkeyup="filterList( this.value, 'groupMembers' )" style="width:25em"/></td>
- </tr>
- <tr>
- <td>
- <select id="availableUsers" size="2" multiple="multiple" style="min-width:25em; height:25em" ondblclick="moveSelectedById( 'availableUsers', 'groupMembers' )">
- #foreach( $user in $availableUsers )
- <option value="$user.id">$encoder.htmlEncode( $user.name )</option>
- #end
- </select>
- </td>
-
- <td style="text-align:center">
- <input type="button" value=">" title="$i18n.getString('move_selected')" style="width:50px" onclick="moveSelectedById( 'availableUsers', 'groupMembers' )"/><br/>
- <input type="button" value="<" title="$i18n.getString('remove_selected')" style="width:50px" onclick="moveSelectedById( 'groupMembers', 'availableUsers' )"/><br/>
- <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="moveAllById( 'availableUsers', 'groupMembers' )"/><br/>
- <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="moveAllById( 'groupMembers', 'availableUsers' )"/>
- </td>
-
- <td>
- <select id="groupMembers" name="groupMembers" size="2" multiple="multiple" style="min-width:25em; height:25em" ondblclick="moveSelectedById( 'groupMembers', 'availableUsers' )" />
- </td>
- </tr>
- <tr>
- <td></td>
- <td></td>
- <td></td>
- </tr>
-</table>
-
-<p><input type="submit" value="$i18n.getString( 'add' )" style="width:10em"/><input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='getAllUserGroups.action'" style="width:10em"/></p>
-
-</form>
-
-<script type="text/javascript">
-
-
-
-
-
- var i18n_select_dataelement_group = '$encoder.jsEscape( $i18n.getString( "select_User_group" ) , "'")';
- var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_data_element_group" ) , "'")';
- var i18n_member_of = '$encoder.jsEscape( $i18n.getString( "member_of" ) , "'")';
- var i18n_update_success = '$encoder.jsEscape( $i18n.getString( "update_success" ) , "'")';
-
- var dataElementGroups = new Object();
- #foreach( $dataElementGroup in $dataElementGroups )
- dataElementGroups['$dataElementGroup.id'] = '$encoder.jsEscape( $dataElementGroup.name, "'" )';
- #end
-
- var availableDataElements = new Object();
- #foreach( $dataElement in $dataElements )
- availableDataElements['$dataElement.id'] = '$encoder.jsEscape( $dataElement.name, "'" )';
- #end
- var selectedDataElements = new Object();
-
- initAllList();
-</script>
-
-
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/editUserGroupForm.vm'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/editUserGroupForm.vm 2010-10-28 09:17:13 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/editUserGroupForm.vm 1970-01-01 00:00:00 +0000
@@ -1,102 +0,0 @@
-
-<h3>$i18n.getString( "edit_usergroup" )</h3>
-
-<form id="editUserGroupForm" name="editUserGroupForm" action="updateUserGroup.action" method="post" onsubmit="return editValidation();" >
-
- <input type="hidden" name="userGroupId" id="userGroupId" value="$userGroupId" />
- <table id="detailsList">
- <col/> ## Labels
- <col/> ## Input
- <thead>
- <tr>
- <th colspan="2">$i18n.getString( "usergroup_details" )</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td><input type="text" id="name" name="name" value ="$encoder.htmlEncode( $group.name )" onchange="nameChanged()" style="width:20em" maxlength="150" />
- </td>
- </tr>
- <tr><td> </td><td> </td></tr>
- </tbody>
- </table>
- <br/>
-<table>
- <tr>
- <th>$i18n.getString( "available_users" )</th><td></td>
- <th>$i18n.getString( "group_members" )
- <select id="memberValidator" multiple="multiple" style="display:none"/>
- </th>
- </tr>
- <tr>
- <td><input type="text" id="availableUsersFilter" onkeyup="filterList( this.value, 'availableUsers' )" style="width:25em"/></td>
- <td style="text-align:center">< $i18n.getString( "filters" ) ></td>
- <td><input type="text" id="groupMembersFilter" onkeyup="filterList( this.value, 'groupMembers' )" style="width:25em"/></td>
- </tr>
- <tr>
- <td>
- <select id="availableUsers" size="2" multiple="multiple" style="min-width:25em; height:25em" ondblclick="moveSelectedById( 'availableUsers', 'groupMembers' )">
- #foreach( $user in $availableUsers )
- <option value="$user.id">$encoder.htmlEncode( $user.name )</option>
- #end
- </select>
- </td>
-
- <td style="text-align:center">
- <input type="button" value=">" title="$i18n.getString('move_selected')" style="width:50px" onclick="moveSelectedById( 'availableUsers', 'groupMembers' )"/><br/>
- <input type="button" value="<" title="$i18n.getString('remove_selected')" style="width:50px" onclick="moveSelectedById( 'groupMembers', 'availableUsers' )"/><br/>
- <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="moveAllById( 'availableUsers', 'groupMembers' )"/><br/>
- <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="moveAllById( 'groupMembers', 'availableUsers' )"/>
- </td>
-
- <td>
- <select id="groupMembers" name="groupMembers" size="2"value = "$group.name" multiple="multiple" style="min-width:25em; height:25em" ondblclick="moveSelectedById( 'groupMembers', 'availableUsers' )" />
- #foreach( $user in $groupMembers )
- <option value="$user.id">$encoder.htmlEncode( $user.name )</option>
- #end
- </td>
-
- </tr>
- <tr>
- <td></td>
- <td></td>
- <td></td>
- </tr>
-</table>
-
-<p><input type="submit" value="$i18n.getString( 'save' )" style="width:10em"/><input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='getAllUserGroups.action'" style="width:10em"/></p>
-
-</form>
-<script type="text/javascript">
- function editValidation ()
-{
- var k =0 ;
- var xyz=document.getElementById("name");
- var abc =document.getElementById("groupMembers");
- var c = abc.length ;
-
- if( xyz.value == "") {
- alert ("please select name ");alert(' xyz.value is empty');
- return false;
- }
- else if ( c <=0 ){
- alert("please select at least one member");
- return false ;
- }else{
- if (c >0 )
- {
- /* for( k =0;k<=c;k++)
- {alert('k : ' + k);
- alert('abc.options[k] : ' + abc.options[k]);
- abc.options[k].selected = true ;
- }*/
-
- selectAllById("groupMembers");
- }
- }
-
- return true;
-}
-
-</script>
=== modified file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/menu.vm'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/menu.vm 2010-10-21 06:32:42 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/menu.vm 2010-12-23 12:27:24 +0000
@@ -7,6 +7,4 @@
<li><a href = "mobileSettings.action">Settings</a></li>
<li><a href = "receiveAllMessages.action">Inbox</a></li>
<li><a href = "getAllDraftMessages.action">Draft</a></li>
-
- <li><a href = "getAllUserGroups.action">UserGroup</a></li>
</ul>
\ No newline at end of file
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/responseUserGroup.vm'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/responseUserGroup.vm 2010-10-28 09:17:13 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/responseUserGroup.vm 1970-01-01 00:00:00 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<userGroup>
- <name>$group.name</name>
- <id>$group.id</id>
- <noOfUsers>$memberCount</noOfUsers>
-</userGroup>
\ No newline at end of file
=== removed file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/userGroupList.vm'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/userGroupList.vm 2010-10-28 09:17:13 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/userGroupList.vm 1970-01-01 00:00:00 +0000
@@ -1,77 +0,0 @@
-<h3>$i18n.getString( "usergroup_management" )</h3>
-
-<table class="mainPageTable">
- <tr>
- <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 colspan="9" style="text-align:right">
- <input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='addUserGroupForm.action'" style="width:80px"/></a>
- </td>
- </tr>
- </table>
- <table class="listTable" id="listTable">
- <col/>
- <col width="20"/>
- <col width="20"/>
- <col width="20"/>
-
- <thead>
- <tr>
- <th>$i18n.getString( "name" )</th>
- <th style="text-align:center" colspan="3" class="{sorter: false}">$i18n.getString( "operations" )</th>
- </tr>
- </thead>
- <tbody id="list">
- #foreach( $userGroup in $userGroupList )
- <tr id="tr${userGroup.id}">
- <td onclick="showUserGroupDetails( $userGroup.id )">$encoder.htmlEncode( $userGroup.name )</td>
- <td style="text-align:center">
- <a href="editUserGroupForm.action?userGroupId=$userGroup.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
- </td>
- <td style="text-align:center">
- <a href="javascript:removeUserGroup( '$userGroup.id', '$encoder.jsEncode( $userGroup.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
- </td>
- <td style="text-align:center">
- <a href="javascript:showUserGroupDetails( $userGroup.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a>
- </td>
- </tr>
- #end
- </tbody>
- </table>
- </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( "name" ):</label><br/><span id="nameField"></span></p>
- <p><label>$i18n.getString( "id" ):</label><br/><span id="idField"></span></p>
- <p><label>$i18n.getString( "no_of_Users" ):</label><br/><span id="noOfGroupField"></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 type="text/javascript">
-
- var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete" ) , "'" )';
-
- jQuery(document).ready(function(){
- tableSorter( 'listTable' );
- });
-
-
-function removeUserGroup( userGroupId, userGroupName )
-{
- removeItem( userGroupId, userGroupName, i18n_confirm_delete, "removeUserGroup.action" );
-}
-</script>