=== 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 2013-12-13 16:03:24 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommand.java 2014-01-07 06:53:01 +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; @@ -48,6 +49,10 @@ private DataSet dataset; + // Support only anonymous program for now + + private Program program; + private Set codes; private String codeSeparator; @@ -63,7 +68,8 @@ private boolean currentPeriodUsedForReporting = false; // default is prev public SMSCommand( String name, String parser, ParserType parserType, String separator, DataSet dataset, - Set codes, String codeSeparator, String defaultMessage, UserGroup userGroup, String receivedMessage, Set specialCharacters ) + Set codes, String codeSeparator, String defaultMessage, UserGroup userGroup, String receivedMessage, + Set specialCharacters ) { super(); this.name = name; @@ -129,6 +135,15 @@ this.codes = codes; } + public SMSCommand( String name, String parser, String separator, Program program, Set codes ) + { + this.name = name; + this.parser = parser; + this.separator = separator; + this.program = program; + this.codes = codes; + } + public SMSCommand( String parser, String name, DataSet dataset, Set codes ) { this.parser = parser; @@ -296,4 +311,13 @@ this.specialCharacters = specialCharacters; } + 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/SMSCommand.hbm.xml' --- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sms/hibernate/SMSCommand.hbm.xml 2013-12-13 16:03:24 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sms/hibernate/SMSCommand.hbm.xml 2014-01-07 06:53:01 +0000 @@ -28,6 +28,8 @@ + + === 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-01-05 20:29:26 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/CreateSMSCommandForm.java 2014-01-07 06:53:01 +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,7 +106,19 @@ { this.userGroupID = userGroupID; } + + private Integer selectedProgramId; + + public Integer getSelectedProgramId() + { + return selectedProgramId; + } + public void setSelectedProgramId( Integer selectedProgramId ) + { + this.selectedProgramId = selectedProgramId; + } + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- @@ -130,7 +144,8 @@ } else if ( parserType.equals( ParserType.ANONYMOUS_PROGRAM_PARSER ) ) { - + Program program = programService.getProgram( selectedProgramId ); + command.setProgram(program); } smsCommandService.save( command ); === 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 2013-12-24 08:11:09 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/SMSCommandAction.java 2014-01-07 06:53:01 +0000 @@ -166,12 +166,19 @@ if ( smsCommand != null ) { DataSet d = smsCommand.getDataset(); + Program program = smsCommand.getProgram(); if ( d != null ) { dataElements = new ArrayList( d.getDataElements() ); Collections.sort( dataElements, new DataElementSortOrderComparator() ); return dataElements; } + else if ( program != null ) + { + dataElements = new ArrayList( program.getAllDataElements() ); + Collections.sort( dataElements, new DataElementSortOrderComparator() ); + return dataElements; + } } return null; } === 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 2013-12-24 08:11:09 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml 2014-01-07 06:53:01 +0000 @@ -162,6 +162,7 @@ + #if($smsCommand.parserType) $smsCommand.parserType #end - #if( $smsCommand.parserType == 'KEY_VALUE_PARSER' || $smsCommand.parserType == 'J2ME_PARSER' ) + #if( $smsCommand.parserType == 'KEY_VALUE_PARSER' || $smsCommand.parserType == 'J2ME_PARSER' || $smsCommand.parserType == 'ANONYMOUS_PROGRAM_PARSER' ) $i18n.getString( "dataset" ) #if($smsCommand.dataset.name) $smsCommand.dataset.name #end @@ -170,7 +170,7 @@

- #if( $smsCommand.parserType == 'KEY_VALUE_PARSER' || $smsCommand.parserType == 'J2ME_PARSER' ) + #if( $smsCommand.parserType == 'KEY_VALUE_PARSER' || $smsCommand.parserType == 'J2ME_PARSER' || $smsCommand.parserType == 'ANONYMOUS_PROGRAM_PARSER') === 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 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/smscommand/new-sms-command.vm 2014-01-07 06:53:01 +0000 @@ -61,9 +61,9 @@
$i18n.getString( "program" ) - #foreach( $anonymousProgram in $anonymousProgramList ) - + #end