← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16273: [mobile] smsCommand for tracked entity registration

 

------------------------------------------------------------
revno: 16273
committer: Long <long.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2014-07-30 11:28:22 +0700
message:
  [mobile] smsCommand for tracked entity registration
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/parse/ParserType.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCode.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommand.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sms/hibernate/SMSCode.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sms/hibernate/SMSCommand.hbm.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/CreateSMSCommandForm.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/EditSMSCommandForm.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/SMSCommandAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/command.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/edit-sms-command.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/new-sms-command.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/sms/parse/ParserType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/parse/ParserType.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/parse/ParserType.java	2014-07-30 04:28:22 +0000
@@ -34,5 +34,6 @@
     J2ME_PARSER,
     ALERT_PARSER,
     UNREGISTERED_PARSER,
-    ANONYMOUS_PROGRAM_PARSER
+    ANONYMOUS_PROGRAM_PARSER,
+    TRACKED_ENTITY_REGISTRATION_PARSER
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCode.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCode.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCode.java	2014-07-30 04:28:22 +0000
@@ -29,6 +29,7 @@
  */
 
 import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
 
 public class SMSCode
 {
@@ -37,6 +38,8 @@
     private String code;
 
     private DataElement dataElement;
+    
+    private TrackedEntityAttribute  trackedEntityAttribute;
 
     private int optionId;
 
@@ -46,6 +49,14 @@
         this.dataElement = dataElement;
         this.optionId = optionId;
     }
+    
+    public SMSCode( String code, TrackedEntityAttribute trackedEntityAttribute)
+    {
+        this.code = code;
+        this.trackedEntityAttribute = trackedEntityAttribute;
+    }
+    
+    
 
     public SMSCode()
     {
@@ -91,4 +102,16 @@
     {
         this.optionId = optionId;
     }
+
+    public TrackedEntityAttribute getTrackedEntityAttribute()
+    {
+        return trackedEntityAttribute;
+    }
+
+    public void setTrackedEntityAttribute( TrackedEntityAttribute trackedEntityAttribute )
+    {
+        this.trackedEntityAttribute = trackedEntityAttribute;
+    }
+    
+    
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommand.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommand.java	2014-06-27 11:45:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommand.java	2014-07-30 04:28:22 +0000
@@ -29,6 +29,7 @@
  */
 
 import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.program.Program;
 import org.hisp.dhis.sms.parse.ParserType;
 import org.hisp.dhis.user.UserGroup;
 
@@ -61,14 +62,22 @@
     private ParserType parserType;
 
     private String separator;
+    
+    //Dataset
 
     private DataSet dataset;
 
     private Set<SMSCode> codes;
 
     private String codeSeparator;
+    
+    //Usergroup
 
     private UserGroup userGroup;
+    
+    //Program
+    
+    private Program program;
 
     private Set<SMSSpecialCharacter> specialCharacters;
 
@@ -89,6 +98,7 @@
     private String moreThanOneOrgUnitMessage;
     
     private String successMessage;
+    
 
     public SMSCommand( String name, String parser, ParserType parserType, String separator, DataSet dataset,
         Set<SMSCode> codes, String codeSeparator, String defaultMessage, UserGroup userGroup, String receivedMessage, Set<SMSSpecialCharacter> specialCharacters )
@@ -373,4 +383,14 @@
     {
         this.successMessage = successMessage;
     }
+
+    public Program getProgram()
+    {
+        return program;
+    }
+
+    public void setProgram( Program program )
+    {
+        this.program = program;
+    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sms/hibernate/SMSCode.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sms/hibernate/SMSCode.hbm.xml	2013-08-29 17:04:34 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sms/hibernate/SMSCode.hbm.xml	2014-07-30 04:28:22 +0000
@@ -14,6 +14,9 @@
     <property name="code" type="text" />
     <many-to-one name="dataElement" class="org.hisp.dhis.dataelement.DataElement" column="dataelementid"
       foreign-key="fk_dataelement_dataelementid" />
+      
+      <many-to-one name="trackedEntityAttribute" class="org.hisp.dhis.trackedentity.TrackedEntityAttribute" column="trackedentityattributeid"
+      foreign-key="fk_trackedentityattribute_trackedentityattributeid" />
     <property name="optionId" type="integer" />
 
   </class>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sms/hibernate/SMSCommand.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sms/hibernate/SMSCommand.hbm.xml	2014-06-27 11:45:23 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sms/hibernate/SMSCommand.hbm.xml	2014-07-30 04:28:22 +0000
@@ -45,6 +45,7 @@
     </set>
 
     <many-to-one name="userGroup" class="org.hisp.dhis.user.UserGroup" column="usergroupid" foreign-key="fk_smscommand_usergroup" />
+    <many-to-one name="program" class="org.hisp.dhis.program.Program" column="programid" foreign-key="fk_smscommand_program" />
 
   </class>
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/CreateSMSCommandForm.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/CreateSMSCommandForm.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/CreateSMSCommandForm.java	2014-07-30 04:28:22 +0000
@@ -30,6 +30,8 @@
 
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
 import org.hisp.dhis.sms.parse.ParserType;
 import org.hisp.dhis.smscommand.SMSCommand;
 import org.hisp.dhis.smscommand.SMSCommandService;
@@ -66,12 +68,12 @@
         this.userGroupService = userGroupService;
     }
 
-    // private ProgramService programService;
-    //
-    // public void setProgramService( ProgramService programService )
-    // {
-    // this.programService = programService;
-    // }
+     private ProgramService programService;
+    
+     public void setProgramService( ProgramService programService )
+     {
+     this.programService = programService;
+     }
 
     // -------------------------------------------------------------------------
     // Input && Output
@@ -104,11 +106,25 @@
     {
         this.userGroupID = userGroupID;
     }
+    
+    private Integer selectedProgramId;
+    
+    public Integer getSelectedProgramId()
+    {
+        return selectedProgramId;
+    }
 
+    public void setSelectedProgramId( Integer selectedProgramId )
+    {
+        this.selectedProgramId = selectedProgramId;
+    }    
+    
+    
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
 
+
     @Override
     public String execute()
         throws Exception
@@ -128,6 +144,11 @@
             userGroup = userGroupService.getUserGroup( userGroupID );
             command.setUserGroup( userGroup );
         }
+        else if ( parserType.equals( ParserType.TRACKED_ENTITY_REGISTRATION_PARSER ) )
+        {
+            Program program = programService.getProgram( selectedProgramId );
+            command.setProgram( program );
+        }
         else if ( parserType.equals( ParserType.ANONYMOUS_PROGRAM_PARSER ) )
         {
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/EditSMSCommandForm.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/EditSMSCommandForm.java	2014-06-27 11:45:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/EditSMSCommandForm.java	2014-07-30 04:28:22 +0000
@@ -40,10 +40,12 @@
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.sms.parse.ParserType;
 import org.hisp.dhis.smscommand.SMSCode;
 import org.hisp.dhis.smscommand.SMSCommand;
 import org.hisp.dhis.smscommand.SMSCommandService;
 import org.hisp.dhis.smscommand.SMSSpecialCharacter;
+import org.hisp.dhis.trackedentity.TrackedEntityAttributeService;
 import org.hisp.dhis.user.UserGroupService;
 
 import com.opensymphony.xwork2.Action;
@@ -82,6 +84,18 @@
         this.userGroupService = userGroupService;
     }
 
+    private TrackedEntityAttributeService trackedEntityAttributeService;
+
+    public TrackedEntityAttributeService getTrackedEntityAttributeService()
+    {
+        return trackedEntityAttributeService;
+    }
+
+    public void setTrackedEntityAttributeService( TrackedEntityAttributeService trackedEntityAttributeService )
+    {
+        this.trackedEntityAttributeService = trackedEntityAttributeService;
+    }
+
     // -------------------------------------------------------------------------
     // Input && Output
     // -------------------------------------------------------------------------
@@ -96,6 +110,8 @@
 
     private String specialCharactersInfo;
 
+    private String trackedEntityAttributeCodes;
+
     private String separator;
 
     private String codeSeparator;
@@ -152,48 +168,66 @@
         }
         smsCommandService.saveSpecialCharacterSet( specialCharacterSet );
 
+        SMSCommand command = getSMSCommand();
+
+        if ( selectedDataSetID > -1 && command != null )
+        {
+            if ( command.getParserType() == ParserType.TRACKED_ENTITY_REGISTRATION_PARSER )
+            {
+                @SuppressWarnings( "unchecked" )
+                List<JSONObject> jsonRegistrationCodes = (List<JSONObject>) JSONObject.fromObject(
+                    trackedEntityAttributeCodes ).get( "trackedEntityAttributeCodes" );
+                for ( JSONObject x : jsonRegistrationCodes )
+                {
+                    SMSCode c = new SMSCode();
+                    c.setCode( x.getString( "code" ) );
+                    c.setTrackedEntityAttribute( trackedEntityAttributeService.getTrackedEntityAttribute( x
+                        .getInt( "trackedEntityAttributeId" ) ) );
+                    codeSet.add( c );
+                }
+            }
+        }
+
         if ( codeSet.size() > 0 )
         {
             smsCommandService.save( codeSet );
         }
 
-        SMSCommand c = getSMSCommand();
-
-        if ( selectedDataSetID > -1 && c != null )
+        if ( selectedDataSetID > -1 && command != null )
         {
-            c.setCurrentPeriodUsedForReporting( currentPeriodUsedForReporting );
-            c.setName( name );
-            c.setSeparator( separator );
+            command.setCurrentPeriodUsedForReporting( currentPeriodUsedForReporting );
+            command.setName( name );
+            command.setSeparator( separator );
 
             if ( completenessMethod != null )
             {
-                c.setCompletenessMethod( completenessMethod );
+                command.setCompletenessMethod( completenessMethod );
             }
 
             // remove codes
-            Set<SMSCode> toRemoveCodes = c.getCodes();
+            Set<SMSCode> toRemoveCodes = command.getCodes();
             smsCommandService.deleteCodeSet( toRemoveCodes );
 
             // remove special characters
-            Set<SMSSpecialCharacter> toRemoveCharacters = c.getSpecialCharacters();
+            Set<SMSSpecialCharacter> toRemoveCharacters = command.getSpecialCharacters();
             smsCommandService.deleteSpecialCharacterSet( toRemoveCharacters );
 
-            c.setCodes( codeSet );
+            command.setCodes( codeSet );
 
             // message
-            c.setDefaultMessage( defaultMessage );
-            c.setReceivedMessage( receivedMessage );
-            c.setMoreThanOneOrgUnitMessage( moreThanOneOrgUnitMessage );
-            c.setNoUserMessage( noUserMessage );
-            c.setWrongFormatMessage( wrongFormatMessage );
-            c.setSuccessMessage( successMessage );
+            command.setDefaultMessage( defaultMessage );
+            command.setReceivedMessage( receivedMessage );
+            command.setMoreThanOneOrgUnitMessage( moreThanOneOrgUnitMessage );
+            command.setNoUserMessage( noUserMessage );
+            command.setWrongFormatMessage( wrongFormatMessage );
+            command.setSuccessMessage( successMessage );
 
             if ( userGroupID != null && userGroupID > -1 )
             {
-                c.setUserGroup( userGroupService.getUserGroup( userGroupID ) );
+                command.setUserGroup( userGroupService.getUserGroup( userGroupID ) );
             }
-            c.setSpecialCharacters( specialCharacterSet );
-            smsCommandService.save( c );
+            command.setSpecialCharacters( specialCharacterSet );
+            smsCommandService.save( command );
         }
 
         return SUCCESS;
@@ -376,4 +410,14 @@
         this.successMessage = successMessage;
     }
 
+    public String getTrackedEntityAttributeCodes()
+    {
+        return trackedEntityAttributeCodes;
+    }
+
+    public void setTrackedEntityAttributeCodes( String trackedEntityAttributeCodes )
+    {
+        this.trackedEntityAttributeCodes = trackedEntityAttributeCodes;
+    }
+
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/SMSCommandAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/SMSCommandAction.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/SMSCommandAction.java	2014-07-30 04:28:22 +0000
@@ -41,10 +41,12 @@
 import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.program.Program;
 import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.program.ProgramTrackedEntityAttribute;
 import org.hisp.dhis.sms.parse.ParserType;
 import org.hisp.dhis.smscommand.SMSCode;
 import org.hisp.dhis.smscommand.SMSCommand;
 import org.hisp.dhis.smscommand.SMSCommandService;
+import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
 import org.hisp.dhis.user.UserGroup;
 import org.hisp.dhis.user.UserGroupService;
 
@@ -101,7 +103,19 @@
         return userGroupList;
     }
 
-    public List<Program> anonymousProgramList;
+    private List<Program> programList;
+
+    public List<Program> getProgramList()
+    {
+        return programList;
+    }
+
+    public void setProgramList( List<Program> programList )
+    {
+        this.programList = programList;
+    }
+
+    private List<TrackedEntityAttribute> trackedEntityAttributeList;
 
     private int selectedCommandID = -1;
 
@@ -148,12 +162,19 @@
         {
             for ( SMSCode x : smsCommand.getCodes() )
             {
-                codes.put( "" + x.getDataElement().getId() + x.getOptionId(), x.getCode() );
+                if ( smsCommand.getParserType() == ParserType.TRACKED_ENTITY_REGISTRATION_PARSER )
+                {
+                    codes.put( "" + x.getTrackedEntityAttribute().getId(), x.getCode() );
+                }
+                else
+                {
+                    codes.put( "" + x.getDataElement().getId() + x.getOptionId(), x.getCode() );
+                }
+
             }
         }
         userGroupList = new ArrayList<UserGroup>( userGroupService.getAllUserGroups() );
-        anonymousProgramList = new ArrayList<Program>(
-            programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
+        programList = new ArrayList<Program>( programService.getPrograms( Program.MULTIPLE_EVENTS_WITH_REGISTRATION ) );
         return SUCCESS;
     }
 
@@ -190,4 +211,28 @@
     {
         return smsCommand;
     }
+
+    public List<TrackedEntityAttribute> getTrackedEntityAttributeList()
+    {
+        if ( smsCommand != null )
+        {
+            Program program = smsCommand.getProgram();
+            if ( program != null )
+            {
+                trackedEntityAttributeList = new ArrayList<TrackedEntityAttribute>();
+                for ( ProgramTrackedEntityAttribute programAttribute : program.getProgramAttributes() )
+                {
+                    trackedEntityAttributeList.add( programAttribute.getAttribute() );
+                }
+                return trackedEntityAttributeList;
+            }
+
+        }
+        return null;
+    }
+
+    public void setTrackedEntityAttributeList( List<TrackedEntityAttribute> trackedEntityAttributeList )
+    {
+        this.trackedEntityAttributeList = trackedEntityAttributeList;
+    }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml	2014-05-21 09:48:18 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml	2014-07-30 04:28:22 +0000
@@ -133,7 +133,7 @@
 		<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
 		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
 		<property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
-
+		<property name="trackedEntityAttributeService" ref="org.hisp.dhis.trackedentity.TrackedEntityAttributeService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.mobile.action.smscommand.CreateSMSCommandForm"
@@ -142,6 +142,7 @@
 		<property name="smsCommandService" ref="smsCommandService" />
 		<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
 		<property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
+		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 	</bean>
 
 	<bean id="org.hisp.dhis.mobile.action.smscommand.DeleteSMSCommandAction"

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/command.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/command.js	2013-12-24 08:11:09 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/command.js	2014-07-30 04:28:22 +0000
@@ -8,6 +8,8 @@
     	showById( "alertParser" );
     } else if (value == 'ANONYMOUS_PROGRAM_PARSER') {
     	showById( "anonymousProgramParser" );
+    } else if (value == 'TRACKED_ENTITY_REGISTRATION_PARSER') {
+    	showById( "registrationParser" );
     }
 	currentType = value;
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/edit-sms-command.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/edit-sms-command.vm	2014-06-27 11:45:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/edit-sms-command.vm	2014-07-30 04:28:22 +0000
@@ -4,7 +4,8 @@
 
     function prepSubmit(){
 	
-		validation( "updateSMSCommandForm" );
+		//validation( "updateSMSCommandForm" );
+		
 		var selectedDataOptions = '{"codes":[';      
 
 		for (var i=1; i<=jQuery('.trDataElementCode').length; i++ )
@@ -37,6 +38,17 @@
 		}
 		specialCharactersInfo += ']}';
 		$("#specialCharactersInfo").val(specialCharactersInfo);
+		
+		var trackedEntityAttributeCodes = '{"trackedEntityAttributeCodes":[';
+		
+		for (var i=1; i<jQuery('.trackedEntityAttribute').length; i++)
+		{ 
+			trackedEntityAttributeCodes += '{"trackedEntityAttributeId" :"'+document.getElementById("attId"+i).value+'",';
+			trackedEntityAttributeCodes += '"code" :"'+document.getElementById("attCode"+i).value+'"},';	
+		}
+		trackedEntityAttributeCodes += ']}';
+		$("#trackedEntityAttributeCodes").val(trackedEntityAttributeCodes);
+		
 		$("#updateSMSCommandForm").submit();
     };
 	
@@ -257,10 +269,34 @@
 	</tr>
 	</table>
     #end
+    
+    #if( $smsCommand.parserType == 'TRACKED_ENTITY_REGISTRATION_PARSER' )
+    	<table id="codes">
+		<col style="width:350px"/><col/>
+	    <thead>
+	      <tr>
+	        <th>$i18n.getString( "tracked_entity_attribute")</th>
+			<th>$i18n.getString( "code" )</th>
+	      </tr>
+	    </thead>
+	    #set($index = 0)
+    	#foreach($attribute in $trackedEntityAttributeList)
+    		
+	    #set ($index = $index + 1)
+	    
+    		 <tr class="trackedEntityAttribute">
+               <td>$attribute.name <input type="hidden" id="attId$index" name="attId$index" value="$attribute.id"/></td>
+               <td><input type="text" name="attCode$index" id="attCode$index" class="{validate:{required:true}}" value='$!codes["$attribute.id"]'></td>   
+            </tr>      
+	    #end
+	    </table>
+    #end
 
 	<br/>	
     <input type="hidden" name="codeDataelementOption" id="codeDataelementOption" />
 	<input type="hidden" name="specialCharactersInfo" id="specialCharactersInfo" />
+	<input type="hidden" name="trackedEntityAttributeCodes" id="trackedEntityAttributeCodes" />
+	
     <input type="button" style="width: 100px" onclick="prepSubmit()" value="$i18n.getString( 'save' )" />
     <input type="button" id="btnBack" name="btnBack" value="Back" style="width:8em" onclick="window.location.href='SMSCommands.action'"/>
 </form>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/new-sms-command.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/new-sms-command.vm	2014-01-07 10:08:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/new-sms-command.vm	2014-07-30 04:28:22 +0000
@@ -70,6 +70,19 @@
 			</tr>
 		</tbody>
 		
+		<tbody id="registrationParser">
+			<tr>
+				<td>$i18n.getString( "program" )</td>
+				<td>
+					<select name="selectedProgramId" >
+					#foreach( $program in $programList )
+						<option value="$program.id">$program.name</option>
+					#end
+					</select>
+				</td>
+			</tr>
+		</tbody>
+		
 		<tr>
 			<td colspan="2">
 			     <input id="save" type="submit"  style="width: 100px" value="$i18n.getString( "save" )" />