← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10338: [mobile] support username data type

 

------------------------------------------------------------
revno: 10338
committer: Long <Long@Long-Laptop>
branch nick: dhis2
timestamp: Wed 2013-03-20 14:14:26 +0700
message:
  [mobile] support username data type
modified:
  dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/SaveAnonymousProgramAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/ShowAnonymousFormAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramForm.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.vm
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventForm.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-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java'
--- dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java	2013-03-19 08:20:05 +0000
+++ dhis-2/dhis-services/dhis-service-mobile/src/main/java/org/hisp/dhis/api/mobile/model/MobileOrgUnitLinks.java	2013-03-20 07:14:26 +0000
@@ -58,7 +58,7 @@
 
     private String searchUrl;
 
-    public static double currentVersion = 2.9;
+    public static double currentVersion = 2.11;
 
     private String updateNewVersionUrl;
 

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/SaveAnonymousProgramAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/SaveAnonymousProgramAction.java	2013-03-19 15:44:35 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/SaveAnonymousProgramAction.java	2013-03-20 07:14:26 +0000
@@ -50,6 +50,7 @@
 import org.hisp.dhis.program.ProgramStageDataElementService;
 import org.hisp.dhis.program.ProgramStageInstance;
 import org.hisp.dhis.program.ProgramStageInstanceService;
+import org.hisp.dhis.user.UserService;
 import org.hisp.dhis.util.ContextUtils;
 
 import com.opensymphony.xwork2.Action;
@@ -137,7 +138,19 @@
     {
         this.orgUnitService = orgUnitService;
     }
+    
+    private UserService userService;
+    
+    public UserService getUserService()
+    {
+        return userService;
+    }
 
+    public void setUserService( UserService userService )
+    {
+        this.userService = userService;
+    }
+    
     // -------------------------------------------------------------------------
     // Input Output
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/ShowAnonymousFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/ShowAnonymousFormAction.java	2013-03-18 08:17:23 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/anonymous/action/ShowAnonymousFormAction.java	2013-03-20 07:14:26 +0000
@@ -34,6 +34,8 @@
 import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.program.ProgramStageDataElement;
+import org.hisp.dhis.user.UserService;
+
 import com.opensymphony.xwork2.Action;
 
 /**
@@ -54,6 +56,19 @@
         this.programService = programService;
     }
     
+    private UserService userService;
+    
+    public UserService getUserService()
+    {
+        return userService;
+    }
+
+    public void setUserService( UserService userService )
+    {
+        this.userService = userService;
+    }
+    
+    
     // -------------------------------------------------------------------------
     // Input & Output
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java	2013-01-17 09:23:01 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/GetProgramStageFormAction.java	2013-03-20 07:14:26 +0000
@@ -32,7 +32,6 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
 import org.hisp.dhis.api.mobile.model.Activity;
 import org.hisp.dhis.api.mobile.model.ActivityPlan;
 import org.hisp.dhis.light.utils.NamebasedUtils;
@@ -47,7 +46,7 @@
 import org.hisp.dhis.program.ProgramStageInstanceService;
 import org.hisp.dhis.program.ProgramStageSection;
 import org.hisp.dhis.program.ProgramStageSectionService;
-
+import org.hisp.dhis.user.UserService;
 import com.opensymphony.xwork2.Action;
 
 public class GetProgramStageFormAction
@@ -111,6 +110,18 @@
     {
         this.programStageSectionService = programStageSectionService;
     }
+    
+    private UserService userService;
+    
+    public UserService getUserService()
+    {
+        return userService;
+    }
+
+    public void setUserService( UserService userService )
+    {
+        this.userService = userService;
+    }
 
     // -------------------------------------------------------------------------
     // Input & Output

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java	2013-03-19 16:49:23 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/SaveProgramStageFormAction.java	2013-03-20 07:14:26 +0000
@@ -57,6 +57,7 @@
 import org.hisp.dhis.program.ProgramValidation;
 import org.hisp.dhis.program.ProgramValidationResult;
 import org.hisp.dhis.program.ProgramValidationService;
+import org.hisp.dhis.user.UserService;
 import org.hisp.dhis.util.ContextUtils;
 
 import com.opensymphony.xwork2.Action;
@@ -75,6 +76,18 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
+    private UserService userService;
+    
+    public UserService getUserService()
+    {
+        return userService;
+    }
+
+    public void setUserService( UserService userService )
+    {
+        this.userService = userService;
+    }
+    
     private NamebasedUtils util;
 
     public NamebasedUtils getUtil()

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java	2013-03-13 14:17:15 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/GetSingleEventFormAction.java	2013-03-20 07:14:26 +0000
@@ -47,6 +47,7 @@
 import org.hisp.dhis.program.ProgramStageDataElement;
 import org.hisp.dhis.program.ProgramStageInstance;
 import org.hisp.dhis.program.ProgramStageInstanceService;
+import org.hisp.dhis.user.UserService;
 import org.hisp.dhis.util.SessionUtils;
 
 import com.opensymphony.xwork2.Action;
@@ -92,6 +93,18 @@
     {
         this.patientService = patientService;
     }
+    
+    private UserService userService;
+    
+    public UserService getUserService()
+    {
+        return userService;
+    }
+
+    public void setUserService( UserService userService )
+    {
+        this.userService = userService;
+    }
 
     // -------------------------------------------------------------------------
     // Input Output

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.java	2013-03-19 17:49:33 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/singleevent/action/SaveSingleEventAction.java	2013-03-20 07:14:26 +0000
@@ -56,6 +56,7 @@
 import org.hisp.dhis.program.ProgramStageDataElementService;
 import org.hisp.dhis.program.ProgramStageInstance;
 import org.hisp.dhis.program.ProgramStageInstanceService;
+import org.hisp.dhis.user.UserService;
 import org.hisp.dhis.util.ContextUtils;
 import org.hisp.dhis.util.SessionUtils;
 
@@ -143,6 +144,18 @@
     {
         this.programStageDataElementService = programStageDataElementService;
     }
+    
+    private UserService userService;
+    
+    public UserService getUserService()
+    {
+        return userService;
+    }
+
+    public void setUserService( UserService userService )
+    {
+        this.userService = userService;
+    }
 
     // -------------------------------------------------------------------------
     // Input Output

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml	2013-03-20 03:54:42 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml	2013-03-20 07:14:26 +0000
@@ -184,6 +184,8 @@
 		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
 		<property name="programStageSectionService"
 			ref="org.hisp.dhis.program.ProgramStageSectionService"/>
+		<property name="userService"
+			ref="org.hisp.dhis.user.UserService"/>
 	</bean>
 
 	<bean id="org.hisp.dhis.light.utils.NamebasedUtils" class="org.hisp.dhis.light.utils.NamebasedUtils">
@@ -207,7 +209,7 @@
 		<property name="programStageSectionService" ref="org.hisp.dhis.program.ProgramStageSectionService"/>
 		<property name="programExpressionService" ref="org.hisp.dhis.program.ProgramExpressionService" />
 		<property name="patientDataValueService" ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
-
+		<property name="userService" ref="org.hisp.dhis.user.UserService"/>
 	</bean>
 
 	<bean
@@ -431,6 +433,7 @@
 			ref="org.hisp.dhis.program.ProgramStageInstanceService" />
 		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
 		<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
+		<property name="userService" ref="org.hisp.dhis.user.UserService"/>	
 	</bean>
 
 	<bean id="org.hisp.dhis.light.singleevent.action.SaveSingleEventAction"
@@ -449,6 +452,7 @@
 		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
 		<property name="programStageDataElementService"
 			ref="org.hisp.dhis.program.ProgramStageDataElementService" />
+		<property name="userService" ref="org.hisp.dhis.user.UserService"/>
 	</bean>
 
 
@@ -537,6 +541,7 @@
 		class="org.hisp.dhis.light.anonymous.action.ShowAnonymousFormAction"
 		scope="prototype">
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
+		<property name="userService" ref="org.hisp.dhis.user.UserService"/>
 	</bean>
 
 	<bean id="org.hisp.dhis.light.anonymous.action.SaveAnonymousProgramAction"
@@ -554,6 +559,7 @@
 			ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
 		<property name="programStageDataElementService"
 			ref="org.hisp.dhis.program.ProgramStageDataElementService" />
+		<property name="userService" ref="org.hisp.dhis.user.UserService"/>	
 	</bean>
 
 	<bean

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramForm.vm	2013-03-19 15:44:35 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/anonymous/anonymousProgramForm.vm	2013-03-20 07:14:26 +0000
@@ -44,6 +44,18 @@
 					<option #if( $prevDataValues.get( $key ) == "true" ) selected="selected" #end value="true">$i18n.getString("yes")</option>
 					<option #if( $prevDataValues.get( $key ) == "false" ) selected="selected" #end value="false">$i18n.getString("no")</option>
 				</select>
+			#elseif($dataElement.type=="username")
+					<select name="$key">
+						<option value="">$i18n.getString("please_select")</option>
+						#foreach ($userName in  $userService.getAllUsers())
+							<option value="$userName.getUsername()"
+							#if( $prevDataValues.get( $key ) == $userName ) 
+								selected
+								#set( $selected=true )
+							#end
+							> $userName.getUsername() </option>
+						#end
+					</select>	
 			#else
 				<input type="text" name="$key" value="$!prevDataValues.get($key)" />
 			#end	

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.vm	2013-01-17 09:23:01 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/namebased/programStageForm.vm	2013-03-20 07:14:26 +0000
@@ -64,12 +64,22 @@
 						<option #if( $prevDataValues.get( $key ) == "true" ) selected="selected" #end value="true">$i18n.getString("yes")</option>
 						<option #if( $prevDataValues.get( $key ) == "false" ) selected="selected" #end value="false">$i18n.getString("no")</option>
 					</select>
+				#elseif($dataElement.type=="username")
+					<select name="$key">
+						<option value="">$i18n.getString("please_select")</option>
+						#foreach ($userName in  $userService.getAllUsers())
+							<option value="$userName.getUsername()"
+							#if( $prevDataValues.get( $key ) == $userName ) 
+								selected
+								#set( $selected=true )
+							#end
+							> $userName.getUsername() </option>
+						#end
+					</select>
 				#else
 					<input type="text" name="$key" value="$!prevDataValues.get($key)" />
 				#end
 	
-
-
 			#elseif ($dataElement.getOptionSet())
 				#set( $options = $dataElement.getOptionSet().getOptions() )
 				<select type="text" name="$key" />

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventForm.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventForm.vm	2012-11-01 02:34:16 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/singleevent/singleEventForm.vm	2013-03-20 07:14:26 +0000
@@ -30,6 +30,18 @@
 					<option #if( $prevDataValues.get( $key ) == "true" ) selected="selected" #end value="true">$i18n.getString("yes")</option>
 					<option #if( $prevDataValues.get( $key ) == "false" ) selected="selected" #end value="false">$i18n.getString("no")</option>
 				</select>
+			#elseif($dataElement.type=="username")
+				<select name="$key">
+					<option value="">$i18n.getString("please_select")</option>
+					#foreach ($userName in  $userService.getAllUsers())
+						<option value="$userName.getUsername()"
+						#if( $prevDataValues.get( $key ) == $userName ) 
+							selected
+							#set( $selected=true )
+						#end
+						> $userName.getUsername() </option>
+					#end
+				</select>	
 			#else
 				<input type="text" name="$key" value="$!prevDataValues.get($key)" />
 			#end