dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27054
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13413: [mobile] anonymous reporting using sms (WIP)
------------------------------------------------------------
revno: 13413
committer: Long <Long@Long-Laptop>
branch nick: dhis2
timestamp: Tue 2013-12-24 15:11:09 +0700
message:
[mobile] anonymous reporting using sms (WIP)
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/parse/ParserType.java
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/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/resources/org/hisp/dhis/mobile/i18n_module.properties
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/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 2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/sms/parse/ParserType.java 2013-12-24 08:11:09 +0000
@@ -34,5 +34,5 @@
J2ME_PARSER,
ALERT_PARSER,
UNREGISTERED_PARSER,
- ;
+ 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/CreateSMSCommandForm.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/CreateSMSCommandForm.java 2013-12-01 22:32:50 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/CreateSMSCommandForm.java 2013-12-24 08:11:09 +0000
@@ -30,6 +30,7 @@
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
+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,6 +67,13 @@
this.userGroupService = userGroupService;
}
+ // private ProgramService programService;
+ //
+ // public void setProgramService( ProgramService programService )
+ // {
+ // this.programService = programService;
+ // }
+
// -------------------------------------------------------------------------
// Input && Output
// -------------------------------------------------------------------------
@@ -98,6 +106,13 @@
this.userGroupID = userGroupID;
}
+ private Integer selectedAnonymousProgramID;
+
+ public void setSelectedAnonymousProgramID( Integer selectedAnonymousProgramID )
+ {
+ this.selectedAnonymousProgramID = selectedAnonymousProgramID;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -121,7 +136,11 @@
userGroup = userGroupService.getUserGroup( userGroupID );
command.setUserGroup( userGroup );
}
-
+ else if ( parserType.equals( ParserType.ANONYMOUS_PROGRAM_PARSER ) )
+ {
+
+ }
+
smsCommandService.save( command );
return SUCCESS;
}
=== 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-11-20 04:03:42 +0000
+++ 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
@@ -39,6 +39,8 @@
import org.hisp.dhis.dataelement.comparator.DataElementSortOrderComparator;
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.SMSCode;
import org.hisp.dhis.smscommand.SMSCommand;
@@ -51,41 +53,47 @@
public class SMSCommandAction
implements Action
{
-
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
-
+
private SMSCommandService smsCommandService;
-
+
public void setSmsCommandService( SMSCommandService smsCommandService )
{
this.smsCommandService = smsCommandService;
}
private DataSetService dataSetService;
-
+
public void setDataSetService( DataSetService dataSetService )
{
this.dataSetService = dataSetService;
}
-
+
private UserGroupService userGroupService;
-
public void setUserGroupService( UserGroupService userGroupService )
{
this.userGroupService = userGroupService;
}
-
+
+ private ProgramService programService;
+
+ public void setProgramService( ProgramService programService )
+ {
+ this.programService = programService;
+ }
+
// -------------------------------------------------------------------------
// Input & Output
// -------------------------------------------------------------------------
-
+
private SMSCommand smsCommand;
-
+
private List<DataElement> dataElements;
-
+
private List<UserGroup> userGroupList;
public List<UserGroup> getUserGroupList()
@@ -93,8 +101,9 @@
return userGroupList;
}
+ public List<Program> anonymousProgramList;
+
private int selectedCommandID = -1;
-
public int getSelectedCommandID()
{
@@ -107,7 +116,6 @@
}
private Map<String, String> codes = new HashMap<String, String>();
-
public Map<String, String> getCodes()
{
@@ -118,8 +126,9 @@
{
this.codes = codes;
}
-
- public ParserType[] getParserType(){
+
+ public ParserType[] getParserType()
+ {
return ParserType.values();
}
@@ -134,7 +143,7 @@
{
smsCommand = smsCommandService.getSMSCommand( selectedCommandID );
}
-
+
if ( smsCommand != null && smsCommand.getCodes() != null )
{
for ( SMSCode x : smsCommand.getCodes() )
@@ -142,14 +151,16 @@
codes.put( "" + x.getDataElement().getId() + x.getOptionId(), x.getCode() );
}
}
- userGroupList = new ArrayList<UserGroup>(userGroupService.getAllUserGroups());
+ userGroupList = new ArrayList<UserGroup>( userGroupService.getAllUserGroups() );
+ anonymousProgramList = new ArrayList<Program>(
+ programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
return SUCCESS;
}
// -------------------------------------------------------------------------
// Supporting methods
// -------------------------------------------------------------------------
-
+
public List<DataElement> getDataElements()
{
if ( smsCommand != null )
@@ -164,7 +175,6 @@
}
return null;
}
-
public Collection<DataSet> getDataSets()
{
@@ -175,9 +185,9 @@
{
return smsCommandService.getSMSCommands();
}
-
+
public SMSCommand getSmsCommand()
{
return smsCommand;
- }
+ }
}
=== 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-17 08:41:46 +0000
+++ 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
@@ -143,6 +143,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.EditSMSCommandForm"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties 2013-11-20 04:49:25 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties 2013-12-24 08:11:09 +0000
@@ -130,3 +130,9 @@
special_characters = Special Characters
value = Value
add_more = Add More
+program=Program
+KEY_VALUE_PARSER=Key Value Parser
+J2ME_PARSER=J2ME Parser
+ALERT_PARSER=Alert Parser
+UNREGISTERED_PARSER=Unregistered Parser
+ANONYMOUS_PROGRAM_PARSER=Anonymous Program Parser
=== 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-11-29 09:50:53 +0000
+++ 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
@@ -6,6 +6,8 @@
showById( "dataSetParser" );
} else if ( value == 'ALERT_PARSER' || value == 'UNREGISTERED_PARSER' ) {
showById( "alertParser" );
+ } else if (value == 'ANONYMOUS_PROGRAM_PARSER') {
+ showById( "anonymousProgramParser" );
}
currentType = value;
}
@@ -14,6 +16,7 @@
{
hideById( "dataSetParser" );
hideById( "alertParser" );
+ hideById( "anonymousProgramParser" );
}
function generateSpecialCharactersForm()
=== 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-11-26 03:39:47 +0000
+++ 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
@@ -26,7 +26,7 @@
<td>
<select id="parserType" name="parserType" style="width:100%;" onchange="changeParserType( this.value )">
#foreach( $type in $parserType )
- <option value="$type">$type</option>
+ <option value="$type">$i18n.getString( "$type" )</option>
#end
</select>
</td>
@@ -57,6 +57,19 @@
</tr>
</tbody>
+ <tbody id="anonymousProgramParser">
+ <tr>
+ <td>$i18n.getString( "program" )</td>
+ <td>
+ <select name="programId" >
+ #foreach( $anonymousProgram in $anonymousProgramList )
+ <option value="$userGroup.id">$anonymousProgram.name</option>
+ #end
+ </select>
+ </td>
+ </tr>
+ </tbody>
+
<tr>
<td colspan="2">
<input id="save" type="submit" style="width: 100px" value="$i18n.getString( "save" )" />