dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #08143
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2425: Added UserGroup management
------------------------------------------------------------
revno: 2425
committer: dev ratan <dev-hisp@xxxxxxxxx>
branch nick: trunk
timestamp: Mon 2010-10-25 11:05:48 +0530
message:
Added UserGroup management
added:
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/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/webapp/dhis-web-mobile/editUserGroupForm.vm
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javascript/user.js
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/responseUserGroup.vm
modified:
dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/AddUserGroupAction.java
dhis-mobile/dhis-web-mobile/src/main/resources/META-INF/dhis/beans.xml
dhis-mobile/dhis-web-mobile/src/main/resources/struts.xml
dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/userGroupList.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-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-21 06:32:42 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/AddUserGroupAction.java 2010-10-25 05:35:48 +0000
@@ -57,18 +57,25 @@
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-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 1970-01-01 00:00:00 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/EditUserGroupFormAction.java 2010-10-25 05:35:48 +0000
@@ -0,0 +1,94 @@
+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() );
+
+
+ return SUCCESS;
+ }
+
+}
=== added 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 1970-01-01 00:00:00 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/GetUserGroupAction.java 2010-10-25 05:35:48 +0000
@@ -0,0 +1,81 @@
+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;
+ }
+
+
+
+
+
+
+
+}
=== added 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 1970-01-01 00:00:00 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/RemoveUserGroupAction.java 2010-10-25 05:35:48 +0000
@@ -0,0 +1,80 @@
+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;
+ }
+}
=== added 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 1970-01-01 00:00:00 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/java/org/hisp/dhis/mobile/user/action/UpdateUserGroupAction.java 2010-10-25 05:35:48 +0000
@@ -0,0 +1,83 @@
+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;
+ }
+
+}
=== 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-21 06:32:42 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/resources/META-INF/dhis/beans.xml 2010-10-25 05:35:48 +0000
@@ -48,7 +48,43 @@
<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/struts.xml'
--- dhis-mobile/dhis-web-mobile/src/main/resources/struts.xml 2010-10-21 06:32:42 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/resources/struts.xml 2010-10-25 05:35:48 +0000
@@ -5,97 +5,150 @@
<struts>
<!-- use the DHIS web portal default -->
<include file="dhis-web-commons.xml"/>
- <package name="dhis-web-mobile" extends="dhis-web-commons" namespace="/dhis-web-mobile">
-
- <!-- Pages -->
- <action name="index" class="org.hisp.dhis.mobile.action.MobileHomePageAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-mobile/welcome.vm</param>
- <param name="menu">/dhis-web-mobile/menu.vm</param>
- </action>
- <action name="receiveImport"
- class="org.hisp.dhis.mobile.action.ReceiveImportPageAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-mobile/receiveImportPage.vm</param>
- <param name="menu">/dhis-web-mobile/menu.vm</param>
- <param name="stylesheets">css/receiveImportPage.css</param>
- </action>
- <action name="sendSMS" class="org.hisp.dhis.mobile.action.SendSMSAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-mobile/sendSMSPage.vm</param>
- <param name="menu">/dhis-web-mobile/menu.vm</param>
- <param name="requiredAuthorities">F_MOBILE_SENDSMS</param>
- </action>
- <action name="sendOta" class="org.hisp.dhis.mobile.action.SendOtaAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-mobile/sendOtaPage.vm</param>
- <param name="menu">/dhis-web-mobile/menu.vm</param>
- <param name="requiredAuthorities">F_MOBILE_SENDSMS</param>
- </action>
- <action name="mobileSettings" class="org.hisp.dhis.mobile.action.MobileSettingsAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-mobile/mobileSettingsPage.vm</param>
- <param name="menu">/dhis-web-mobile/menu.vm</param>
+ <package name="dhis-web-mobile" extends="dhis-web-commons"
+ namespace="/dhis-web-mobile">
+
+ <!-- Pages -->
+ <action name="index"
+ class="org.hisp.dhis.mobile.action.MobileHomePageAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-mobile/welcome.vm</param>
+ <param name="menu">/dhis-web-mobile/menu.vm</param>
+ </action>
+ <action name="receiveImport"
+ class="org.hisp.dhis.mobile.action.ReceiveImportPageAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-mobile/receiveImportPage.vm</param>
+ <param name="menu">/dhis-web-mobile/menu.vm</param>
+ <param name="stylesheets">css/receiveImportPage.css</param>
+ </action>
+ <action name="sendSMS" class="org.hisp.dhis.mobile.action.SendSMSAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-mobile/sendSMSPage.vm</param>
+ <param name="menu">/dhis-web-mobile/menu.vm</param>
+ <param name="requiredAuthorities">F_MOBILE_SENDSMS</param>
+ </action>
+ <action name="sendOta" class="org.hisp.dhis.mobile.action.SendOtaAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-mobile/sendOtaPage.vm</param>
+ <param name="menu">/dhis-web-mobile/menu.vm</param>
+ <param name="requiredAuthorities">F_MOBILE_SENDSMS</param>
+ </action>
+ <action name="mobileSettings"
+ class="org.hisp.dhis.mobile.action.MobileSettingsAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-mobile/mobileSettingsPage.vm</param>
+ <param name="menu">/dhis-web-mobile/menu.vm</param>
<param name="requiredAuthorities">F_MOBILE_SETTINGS</param>
- </action>
-
- <action name="receiveAllMessages" class="org.hisp.dhis.mobile.action.ReceiveMessagesPageAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-mobile/inbox.vm</param>
- <param name="menu">/dhis-web-mobile/menu.vm</param>
- <param name="stylesheets">css/receiveImportPage.css</param>
- </action>
-
- <action name="getAllDraftMessages" class="org.hisp.dhis.mobile.action.DraftPageAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-mobile/draft.vm</param>
- <param name="menu">/dhis-web-mobile/menu.vm</param>
- <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>
- </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="stylesheets">css/receiveImportPage.css</param>
- </action>
-
- <action name="addUserGroup" class="org.hisp.dhis.mobile.user.action.AddUserGroupAction">
- <result name="success" type="redirect">getAllUserGroups.action</result>
- </action>
-
-
- <!-- Create Mobile Application -->
- <action name="createMobileApp" class="org.hisp.dhis.mobile.app.action.CreateMobileAppAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-mobile/createMobileAppPage.vm</param>
- <param name="menu">/dhis-web-mobile/menu.vm</param>
- </action>
-
- <action name="getDataElements" class="org.hisp.dhis.mobile.app.action.GetDataElementsAction">
- <result name="success" type="velocity"> /dhis-web-mobile/dataElementsResponse.vm</result>
- <param name="onExceptionReturn">plainTextError</param>
- </action>
-
- <action name="splashUpload" class="org.hisp.dhis.mobile.app.action.SplashUploadAction">
- <result name="success" type="velocity">/dhis-web-mobile/splashUploadResponse.vm</result>
- <param name="onExceptionReturn">plainTextError</param>
- <interceptor-ref name="fileUploadStack">
- <param name="allowedTypes">image/png</param>
- </interceptor-ref>
- </action>
-
- <action name="jarGenerator" class="org.hisp.dhis.mobile.app.action.JarGeneratorAction">
- <result name="success" type="chain">createMobileApp</result>
- </action>
-
- </package>
+ </action>
+
+ <action name="receiveAllMessages"
+ class="org.hisp.dhis.mobile.action.ReceiveMessagesPageAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-mobile/inbox.vm</param>
+ <param name="menu">/dhis-web-mobile/menu.vm</param>
+ <param name="stylesheets">css/receiveImportPage.css</param>
+ </action>
+
+ <action name="getAllDraftMessages"
+ class="org.hisp.dhis.mobile.action.DraftPageAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-mobile/draft.vm</param>
+ <param name="menu">/dhis-web-mobile/menu.vm</param>
+ <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="stylesheets">css/receiveImportPage.css</param>
+ </action>
+
+ <action name="addUserGroup"
+ class="org.hisp.dhis.mobile.user.action.AddUserGroupAction">
+ <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"
+ class="org.hisp.dhis.mobile.app.action.CreateMobileAppAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-mobile/createMobileAppPage.vm</param>
+ <param name="menu">/dhis-web-mobile/menu.vm</param>
+ </action>
+
+ <action name="getDataElements"
+ class="org.hisp.dhis.mobile.app.action.GetDataElementsAction">
+ <result name="success" type="velocity">
+ /dhis-web-mobile/dataElementsResponse.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
+ <action name="splashUpload"
+ class="org.hisp.dhis.mobile.app.action.SplashUploadAction">
+ <result name="success" type="velocity">
+ /dhis-web-mobile/splashUploadResponse.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ <interceptor-ref name="fileUploadStack">
+ <param name="allowedTypes">image/png</param>
+ </interceptor-ref>
+ </action>
+
+ <action name="jarGenerator"
+ class="org.hisp.dhis.mobile.app.action.JarGeneratorAction">
+ <result name="success" type="chain">createMobileApp</result>
+ </action>
+
+ </package>
</struts>
\ No newline at end of file
=== added 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 1970-01-01 00:00:00 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/editUserGroupForm.vm 2010-10-25 05:35:48 +0000
@@ -0,0 +1,69 @@
+<h3>$i18n.getString( "edit_usergroup" )</h3>
+
+<form id="addUserGroupForm" name="addUserGroupForm" action="updateUserGroup.action" method="post" >
+ <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"
+ 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"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>
\ No newline at end of file
=== added file 'dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javascript/user.js'
--- dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javascript/user.js 1970-01-01 00:00:00 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/javascript/user.js 2010-10-25 05:35:48 +0000
@@ -0,0 +1,24 @@
+function removeUserGroup( userGroupId, userGroupName )
+{
+ removeItem( userGroupId, userGroupName, i18n_confirm_delete, "removeUserGroup.action" );
+}
+
+
+
+
+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, 'noOfGroup' ) );
+
+ showDetails();
+}
\ No newline at end of file
=== added 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 1970-01-01 00:00:00 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/responseUserGroup.vm 2010-10-25 05:35:48 +0000
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<userGroup>
+ <name>$group.name</name>
+ <id>$group.id</id>
+ <noOfGroup>$memberCount</noOfGroup>
+</userGroup>
\ No newline at end of file
=== modified 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-21 06:32:42 +0000
+++ dhis-mobile/dhis-web-mobile/src/main/webapp/dhis-web-mobile/userGroupList.vm 2010-10-25 05:35:48 +0000
@@ -47,7 +47,8 @@
<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( "number_of_users" ):</label><br/><span id="userCountField"></span></p>
+ <p><label>$i18n.getString( "id" ):</label><br/><span id="idField"></span></p>
+ <p><label>$i18n.getString( "no_of_group" ):</label><br/><span id="noOfGroupField"></span></p>
</div>
<div id="warningArea" style="position:fixed;right:10px;top:200px;display:none">
@@ -68,4 +69,9 @@
tableSorter( 'listTable' );
});
+
+function removeUserGroup( userGroupId, userGroupName )
+{
+ removeItem( userGroupId, userGroupName, i18n_confirm_delete, "removeUserGroup.action" );
+}
</script>