dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19746
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8742: [mobile] display correct message form complete and form incomplete
------------------------------------------------------------
revno: 8742
committer: Long <Long@Long-Laptop>
branch nick: dhis2
timestamp: Mon 2012-10-29 10:48:40 +0700
message:
[mobile] display correct message form complete and form incomplete
added:
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/UndoCompleteAction.java
modified:
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetDataSetOverviewAction.java
dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/MarkComplete.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/resources/org/hisp/dhis/light/i18n_module.properties
dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntryOverview.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-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetDataSetOverviewAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetDataSetOverviewAction.java 2012-01-22 19:37:21 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetDataSetOverviewAction.java 2012-10-29 03:48:40 +0000
@@ -29,6 +29,7 @@
import com.opensymphony.xwork2.Action;
import org.apache.commons.lang.Validate;
+import org.hisp.dhis.dataset.CompleteDataSetRegistrationService;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.dataset.Section;
@@ -92,6 +93,13 @@
this.format = format;
}
+ private CompleteDataSetRegistrationService registrationService;
+
+ public void setRegistrationService( CompleteDataSetRegistrationService registrationService )
+ {
+ this.registrationService = registrationService;
+ }
+
// -------------------------------------------------------------------------
// Input & Output
// -------------------------------------------------------------------------
@@ -186,6 +194,18 @@
this.validated = validated;
}
+ private boolean completed;
+
+ public boolean isCompleted()
+ {
+ return completed;
+ }
+
+ public void setCompleted( boolean isCompleted )
+ {
+ this.completed = isCompleted;
+ }
+
// -------------------------------------------------------------------------
// Action Implementation
// -------------------------------------------------------------------------
@@ -205,6 +225,16 @@
dataSet = dataSetService.getDataSet( dataSetId );
+ if ( registrationService.getCompleteDataSetRegistration( dataSet, period, organisationUnit ) == null )
+ {
+ completed = false;
+ }
+ else
+ {
+ completed = true;
+ }
+
+
if ( sectionId != null )
{
for ( Section section : dataSet.getSections() )
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/MarkComplete.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/MarkComplete.java 2012-01-23 06:32:10 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/MarkComplete.java 2012-10-29 03:48:40 +0000
@@ -156,6 +156,7 @@
registration.setStoredBy( currentUserService.getCurrentUsername() );
registrationService.saveCompleteDataSetRegistration( registration );
+
}
return SUCCESS;
=== added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/UndoCompleteAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/UndoCompleteAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/UndoCompleteAction.java 2012-10-29 03:48:40 +0000
@@ -0,0 +1,107 @@
+package org.hisp.dhis.light.dataentry.action;
+
+import org.hisp.dhis.dataset.CompleteDataSetRegistration;
+import org.hisp.dhis.dataset.CompleteDataSetRegistrationService;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import com.opensymphony.xwork2.Action;
+
+public class UndoCompleteAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private CompleteDataSetRegistrationService registrationService;
+
+ public void setRegistrationService( CompleteDataSetRegistrationService registrationService )
+ {
+ this.registrationService = registrationService;
+ }
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ private DataSetService dataSetService;
+
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+ private PeriodService periodService;
+
+ public void setPeriodService( PeriodService periodService )
+ {
+ this.periodService = periodService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private Integer organisationUnitId;
+
+ public void setOrganisationUnitId( Integer organisationUnitId )
+ {
+ this.organisationUnitId = organisationUnitId;
+ }
+
+ public Integer getOrganisationUnitId()
+ {
+ return organisationUnitId;
+ }
+
+ private String periodId;
+
+ public void setPeriodId( String periodId )
+ {
+ this.periodId = periodId;
+ }
+
+ public String getPeriodId()
+ {
+ return periodId;
+ }
+
+ private Integer dataSetId;
+
+ public void setDataSetId( Integer dataSetId )
+ {
+ this.dataSetId = dataSetId;
+ }
+
+ public Integer getDataSetId()
+ {
+ return dataSetId;
+ }
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
+
+ Period period = periodService.getPeriodByExternalId( periodId );
+
+ DataSet dataSet = dataSetService.getDataSet( dataSetId );
+
+ CompleteDataSetRegistration registration = registrationService.getCompleteDataSetRegistration( dataSet, period, organisationUnit );
+
+ if ( registration != null )
+ {
+ registrationService.deleteCompleteDataSetRegistration( registration );
+ }
+
+ return SUCCESS;
+ }
+
+}
=== 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 2012-10-23 07:56:15 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2012-10-29 03:48:40 +0000
@@ -70,6 +70,8 @@
<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
<property name="formUtils"
ref="org.hisp.dhis.light.dataentry.utils.FormUtils" />
+ <property name="registrationService"
+ ref="org.hisp.dhis.dataset.CompleteDataSetRegistrationService" />
</bean>
<bean id="org.hisp.dhis.light.dataentry.action.MarkComplete"
@@ -82,6 +84,16 @@
ref="org.hisp.dhis.dataset.CompleteDataSetRegistrationService" />
<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
</bean>
+
+ <bean id="org.hisp.dhis.light.dataentry.action.UndoCompleteAction"
+ class="org.hisp.dhis.light.dataentry.action.UndoCompleteAction" scope="prototype">
+ <property name="organisationUnitService"
+ ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+ <property name="registrationService"
+ ref="org.hisp.dhis.dataset.CompleteDataSetRegistrationService" />
+ <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
+ </bean>
<bean id="org.hisp.dhis.light.dataentry.action.GetSectionFormAction"
class="org.hisp.dhis.light.dataentry.action.GetSectionFormAction"
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties 2012-10-26 07:11:07 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties 2012-10-29 03:48:40 +0000
@@ -125,4 +125,5 @@
visit_schedule_type=Visit Schedule Type
or_register_new_person=or register new person
invalid_phone_number=invalid phone number
-save_any_way=Save anyway
\ No newline at end of file
+save_any_way=Save anyway
+form_in_complete= Form InComplete
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml 2012-10-23 07:56:15 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/struts.xml 2012-10-29 03:48:40 +0000
@@ -71,6 +71,13 @@
/light/index.action?organisationUnitId=${organisationUnitId}&dataSetId=${dataSetId}&periodId=${periodId}&complete=true
</result>
</action>
+
+ <action name="inComplete"
+ class="org.hisp.dhis.light.dataentry.action.UndoCompleteAction">
+ <result name="success" type="redirect">
+ /light/dataEntry.action?organisationUnitId=${organisationUnitId}&dataSetId=${dataSetId}&periodId=${periodId}
+ </result>
+ </action>
<!-- Namebased Data Entry -->
=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntryOverview.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntryOverview.vm 2012-10-12 09:22:44 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntryOverview.vm 2012-10-29 03:48:40 +0000
@@ -38,8 +38,7 @@
</ul>
</p>
-<form method="GET" action="markComplete.action">
-
+<form method="GET" action=#if($completed == true) "inComplete.action" #else "markComplete.action" #end>
<input type="hidden" id="organisationUnitId" name="organisationUnitId" value="$organisationUnitId" />
<input type="hidden" id="dataSetId" name="dataSetId" value="$dataSetId" />
<input type="hidden" id="periodId" name="periodId" value="$periodId" />
@@ -47,7 +46,7 @@
<div class="header-box" align="center">
<p>
<input type="hidden" name="formComplete" value="true" />
- <input type="submit" style="width: 100%;" value="$i18n.getString("form_complete")" />
+ <input type="submit" style="width: 100%;" value=#if($completed == true) $i18n.getString("form_in_complete") #else $i18n.getString("form_complete") #end />
</p>
</div>