← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10679: finished offline username support in anonymous entry

 

------------------------------------------------------------
revno: 10679
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-04-24 15:54:41 +0700
message:
  finished offline username support in anonymous entry
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/GetProgramMetaDataAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetProgramStageInstanceAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramMetaData.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-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/GetProgramMetaDataAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/GetProgramMetaDataAction.java	2013-04-18 07:03:12 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/GetProgramMetaDataAction.java	2013-04-24 08:54:41 +0000
@@ -28,6 +28,7 @@
  */
 
 import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
@@ -94,6 +95,13 @@
         return optionSets;
     }
 
+    private Boolean usernames = false;
+
+    public boolean getUsernames()
+    {
+        return usernames;
+    }
+
     // -------------------------------------------------------------------------
     // Action Impl
     // -------------------------------------------------------------------------
@@ -131,6 +139,11 @@
                 {
                     optionSets.add( programStageDataElement.getDataElement().getUid() );
                 }
+
+                if ( programStageDataElement.getDataElement().getType().equals( DataElement.VALUE_TYPE_USER_NAME ) )
+                {
+                    usernames = true;
+                }
             }
         }
     }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetProgramStageInstanceAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetProgramStageInstanceAction.java	2013-04-13 05:13:24 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/GetProgramStageInstanceAction.java	2013-04-24 08:54:41 +0000
@@ -144,7 +144,8 @@
 
     private void populateCoordinates()
     {
-        if ( programStageInstance.getProgramStage().getCaptureCoordinates() )
+        if ( programStageInstance != null && programStageInstance.getProgramStage() != null
+            && programStageInstance.getProgramStage().getCaptureCoordinates() )
         {
             longitude = ValidationUtils.getLongitude( programStageInstance.getCoordinates() );
             latitude = ValidationUtils.getLatitude( programStageInstance.getCoordinates() );

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2013-04-24 06:11:42 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2013-04-24 08:54:41 +0000
@@ -31,7 +31,7 @@
                 });
 
                 promise = promise.pipe(function() {
-                    loadOptionSets( data.metaData.optionSets, true );
+                    loadOptionSets( data.metaData.optionSets, data.metaData.usernames );
                 });
 
                 deferred.resolve();

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramMetaData.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramMetaData.vm	2013-04-18 11:00:24 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramMetaData.vm	2013-04-24 08:54:41 +0000
@@ -1,5 +1,6 @@
 { "metaData": {
 "optionSets": [#foreach( $os in $optionSets )"$encoder.jsonEncode( $os )"#if( $velocityCount < $optionSets.size() ),#end#end],
+"usernames": $usernames,
 "programs": {
 #set( $psize = $programs.size() )
 #foreach( $program in $programs )