dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12170
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3678: Fix bug: Error while loading case-entry and save providingFacility ( Patient module).
------------------------------------------------------------
revno: 3678
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-05-20 10:35:47 +0700
message:
Fix bug: Error while loading case-entry and save providingFacility ( Patient module).
modified:
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageCustomDataEntryAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveProvidingFacilityAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DataEntryScreenManager.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DefaultDataEntryScreenManager.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js
--
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/caseentry/LoadDataEntryAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java 2011-05-19 01:11:43 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java 2011-05-20 03:35:47 +0000
@@ -37,7 +37,6 @@
import org.hisp.dhis.dataentryform.DataEntryForm;
import org.hisp.dhis.dataentryform.DataEntryFormService;
import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.minmax.MinMaxDataElement;
import org.hisp.dhis.minmax.MinMaxDataElementService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
@@ -80,7 +79,7 @@
private PatientService patientService;
- private MinMaxDataElementService minMaxDataElementService;
+ // private MinMaxDataElementService minMaxDataElementService;
private OrganisationUnitSelectionManager selectionManager;
@@ -122,10 +121,12 @@
this.patientService = patientService;
}
- public void setMinMaxDataElementService( MinMaxDataElementService minMaxDataElementService )
- {
- this.minMaxDataElementService = minMaxDataElementService;
- }
+ //
+ // public void setMinMaxDataElementService( MinMaxDataElementService
+ // minMaxDataElementService )
+ // {
+ // this.minMaxDataElementService = minMaxDataElementService;
+ // }
public void setProgramStageService( ProgramStageService programStageService )
{
@@ -245,41 +246,21 @@
}
// ---------------------------------------------------------------------
- // Get min/max data-elements
- // ---------------------------------------------------------------------
-
- Collection<MinMaxDataElement> minMaxDataElements = minMaxDataElementService.getMinMaxDataElements(
- organisationUnit, dataElements );
-
- Map<Integer, MinMaxDataElement> minMaxMap = new HashMap<Integer, MinMaxDataElement>( minMaxDataElements
- .size() );
-
- for ( MinMaxDataElement minMaxDataElement : minMaxDataElements )
- {
- minMaxMap.put( minMaxDataElement.getDataElement().getId(), minMaxDataElement );
- }
-
- // ---------------------------------------------------------------------
// Get data-entry-form
// ---------------------------------------------------------------------
DataEntryForm dataEntryForm = programStage.getDataEntryForm();
- if ( useDefaultForm != null && !useDefaultForm )
+ if ( !useDefaultForm && dataEntryForm != null)
{
- customDataEntryFormCode = dataEntryScreenManager.populateCustomDataEntryScreenForMultiDimensional(
- dataEntryForm.getHtmlCode(), patientDataValues, minMaxMap, "", i18n, programStage,
- programStageInstance, organisationUnit );
-
- customDataEntryFormCode = dataEntryFormService.prepareDataEntryFormForEdit( customDataEntryFormCode );
+ customDataEntryFormCode = dataEntryScreenManager.populateCustomDataEntryScreenForMultiDimensional(
+ dataEntryForm.getHtmlCode(), patientDataValues, "", i18n, programStage, programStageInstance,
+ organisationUnit );
}
return SUCCESS;
}
- // customDataEntryFormCode =
- // programStage.getDataEntryForm().getHtmlCode();
-
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageCustomDataEntryAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageCustomDataEntryAction.java 2011-05-01 09:07:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageCustomDataEntryAction.java 2011-05-20 03:35:47 +0000
@@ -94,12 +94,12 @@
this.dataEntryScreenManager = dataEntryScreenManager;
}
- private MinMaxDataElementService minMaxDataElementService;
-
- public void setMinMaxDataElementService( MinMaxDataElementService minMaxDataElementService )
- {
- this.minMaxDataElementService = minMaxDataElementService;
- }
+// private MinMaxDataElementService minMaxDataElementService;
+//
+// public void setMinMaxDataElementService( MinMaxDataElementService minMaxDataElementService )
+// {
+// this.minMaxDataElementService = minMaxDataElementService;
+// }
// -------------------------------------------------------------------------
// Output
@@ -243,19 +243,19 @@
public String execute()
throws Exception
{
- // ---------------------------------------------------------------------
- // Get the min/max values
- // ---------------------------------------------------------------------
-
- Collection<MinMaxDataElement> minMaxDataElements = minMaxDataElementService.getMinMaxDataElements(
- organisationUnit, dataElements );
-
- Map<Integer, MinMaxDataElement> minMaxMap = new HashMap<Integer, MinMaxDataElement>( minMaxDataElements.size() );
-
- for ( MinMaxDataElement minMaxDataElement : minMaxDataElements )
- {
- minMaxMap.put( minMaxDataElement.getDataElement().getId(), minMaxDataElement );
- }
+// // ---------------------------------------------------------------------
+// // Get the min/max values
+// // ---------------------------------------------------------------------
+//
+// Collection<MinMaxDataElement> minMaxDataElements = minMaxDataElementService.getMinMaxDataElements(
+// organisationUnit, dataElements );
+//
+// Map<Integer, MinMaxDataElement> minMaxMap = new HashMap<Integer, MinMaxDataElement>( minMaxDataElements.size() );
+//
+// for ( MinMaxDataElement minMaxDataElement : minMaxDataElements )
+// {
+// minMaxMap.put( minMaxDataElement.getDataElement().getId(), minMaxDataElement );
+// }
// ---------------------------------------------------------------------
// Get Orgunit & Program, ProgramStage
@@ -297,7 +297,7 @@
customDataEntryFormExists = true;
customDataEntryFormCode = dataEntryScreenManager.populateCustomDataEntryScreenForMultiDimensional(
- dataEntryForm.getHtmlCode(), patientDataValues, minMaxMap, disabled,
+ dataEntryForm.getHtmlCode(), patientDataValues, disabled,
i18n, programStage, programStageInstance, organisationUnit );
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveProvidingFacilityAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveProvidingFacilityAction.java 2011-05-01 09:07:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/SaveProvidingFacilityAction.java 2011-05-20 03:35:47 +0000
@@ -36,14 +36,16 @@
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientService;
import org.hisp.dhis.patientdatavalue.PatientDataValue;
import org.hisp.dhis.patientdatavalue.PatientDataValueService;
import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramInstance;
+import org.hisp.dhis.program.ProgramInstanceService;
+import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageInstance;
import org.hisp.dhis.program.ProgramStageInstanceService;
-import org.hisp.dhis.program.ProgramStage;
-import org.hisp.dhis.program.ProgramInstance;
-import org.hisp.dhis.program.ProgramInstanceService;
+import org.hisp.dhis.program.ProgramStageService;
import com.opensymphony.xwork2.Action;
@@ -95,10 +97,38 @@
this.patientDataValueService = patientDataValueService;
}
+ private PatientService patientService;
+
+ public void setPatientService( PatientService patientService )
+ {
+ this.patientService = patientService;
+ }
+
+ private ProgramStageService programStageService;
+
+ public void setProgramStageService( ProgramStageService programStageService )
+ {
+ this.programStageService = programStageService;
+ }
+
// -------------------------------------------------------------------------
// Input/Output
// -------------------------------------------------------------------------
+ private Integer patientId;
+
+ public void setPatientId( Integer patientId )
+ {
+ this.patientId = patientId;
+ }
+
+ private Integer programStageId;
+
+ public void setProgramStageId( Integer programStageId )
+ {
+ this.programStageId = programStageId;
+ }
+
private boolean providedByAnotherFacility;
public void setProvidedByAnotherFacility( boolean providedByAnotherFacility )
@@ -134,11 +164,11 @@
{
OrganisationUnit organisationUnit = selectedStateManager.getSelectedOrganisationUnit();
- Patient patient = selectedStateManager.getSelectedPatient();
-
- Program program = selectedStateManager.getSelectedProgram();
-
- ProgramStage programStage = selectedStateManager.getSelectedProgramStage();
+ Patient patient = patientService.getPatient( patientId );
+
+ ProgramStage programStage = programStageService.getProgramStage( programStageId );
+
+ Program program = programStage.getProgram();
Collection<ProgramInstance> progamInstances = programInstanceService.getProgramInstances( patient, program,
false );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DataEntryScreenManager.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DataEntryScreenManager.java 2011-05-01 09:07:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DataEntryScreenManager.java 2011-05-20 03:35:47 +0000
@@ -28,10 +28,8 @@
package org.hisp.dhis.caseentry.screen;
import java.util.Collection;
-import java.util.Map;
import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.minmax.MinMaxDataElement;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.patientdatavalue.PatientDataValue;
import org.hisp.dhis.program.ProgramStage;
@@ -51,7 +49,7 @@
boolean hasMultiDimensionalDataElement( ProgramStage programStage );
String populateCustomDataEntryScreenForMultiDimensional( String dataEntryFormCode,
- Collection<PatientDataValue> dataValues, Map<Integer, MinMaxDataElement> minMaxMap, String disabled, I18n i18n, ProgramStage programStage,
+ Collection<PatientDataValue> dataValues, String disabled, I18n i18n, ProgramStage programStage,
ProgramStageInstance programStageInstance, OrganisationUnit organisationUnit );
Collection<ProgramStageDataElement> getProgramStageDataElements( String htmlCode );
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DefaultDataEntryScreenManager.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DefaultDataEntryScreenManager.java 2011-05-01 09:07:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/screen/DefaultDataEntryScreenManager.java 2011-05-20 03:35:47 +0000
@@ -43,7 +43,6 @@
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.i18n.I18n;
-import org.hisp.dhis.minmax.MinMaxDataElement;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.patientdatavalue.PatientDataValue;
import org.hisp.dhis.patientdatavalue.PatientDataValueService;
@@ -157,7 +156,7 @@
}
public String populateCustomDataEntryScreenForMultiDimensional( String dataEntryFormCode,
- Collection<PatientDataValue> dataValues, Map<Integer, MinMaxDataElement> minMaxMap, String disabled, I18n i18n, ProgramStage programStage,
+ Collection<PatientDataValue> dataValues, String disabled, I18n i18n, ProgramStage programStage,
ProgramStageInstance programStageInstance, OrganisationUnit organisationUnit )
{
Map<Integer, Collection<PatientDataValue>> mapDataValue = new HashMap<Integer, Collection<PatientDataValue>>();
@@ -167,13 +166,13 @@
result = populateCustomDataEntryForTextBox( dataEntryFormCode, dataValues, disabled, i18n,
programStage, programStageInstance, organisationUnit, mapDataValue );
- result = populateCustomDataEntryForBoolean( result, dataValues, minMaxMap, disabled, i18n,
+ result = populateCustomDataEntryForBoolean( result, dataValues, disabled, i18n,
programStage, programStageInstance, organisationUnit, mapDataValue );
- result = populateCustomDataEntryForMutiDimentionalString( result, dataValues, minMaxMap,
+ result = populateCustomDataEntryForMutiDimentionalString( result, dataValues,
disabled, i18n, programStage, programStageInstance, organisationUnit, mapDataValue );
- result = populateCustomDataEntryForDate( result, dataValues, minMaxMap, disabled, i18n,
+ result = populateCustomDataEntryForDate( result, dataValues, disabled, i18n,
programStage, programStageInstance, organisationUnit, mapDataValue );
result = populateI18nStrings( result, i18n );
@@ -402,7 +401,7 @@
}
private String populateCustomDataEntryForBoolean( String dataEntryFormCode,
- Collection<PatientDataValue> dataValues, Map<Integer, MinMaxDataElement> minMaxMap, String disabled, I18n i18n, ProgramStage programStage,
+ Collection<PatientDataValue> dataValues, String disabled, I18n i18n, ProgramStage programStage,
ProgramStageInstance programStageInstance, OrganisationUnit organisationUnit,
Map<Integer, Collection<PatientDataValue>> mapDataValue )
{
@@ -651,7 +650,7 @@
}
private String populateCustomDataEntryForMutiDimentionalString( String dataEntryFormCode,
- Collection<PatientDataValue> dataValues, Map<Integer, MinMaxDataElement> minMaxMap, String disabled, I18n i18n, ProgramStage programStage,
+ Collection<PatientDataValue> dataValues, String disabled, I18n i18n, ProgramStage programStage,
ProgramStageInstance programStageInstance, OrganisationUnit organisationUnit,
Map<Integer, Collection<PatientDataValue>> mapDataValue )
{
@@ -885,7 +884,7 @@
}
private String populateCustomDataEntryForDate( String dataEntryFormCode, Collection<PatientDataValue> dataValues,
- Map<Integer, MinMaxDataElement> minMaxMap, String disabled, I18n i18n, ProgramStage programStage, ProgramStageInstance programStageInstance,
+ String disabled, I18n i18n, ProgramStage programStage, ProgramStageInstance programStageInstance,
OrganisationUnit organisationUnit, Map<Integer, Collection<PatientDataValue>> mapDataValue )
{
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2011-05-19 01:11:43 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2011-05-20 03:35:47 +0000
@@ -123,6 +123,10 @@
ref="org.hisp.dhis.program.ProgramStageInstanceService" />
<property name="patientDataValueService"
ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
+ <property name="patientService"
+ ref="org.hisp.dhis.patient.PatientService" />
+ <property name="programStageService"
+ ref="org.hisp.dhis.program.ProgramStageService" />
</bean>
<bean id="org.hisp.dhis.caseentry.screen.DataEntryScreenManager"
@@ -163,8 +167,6 @@
<property name="programStageInstanceService"
ref="org.hisp.dhis.program.ProgramStageInstanceService" />
<property name="patientService" ref="org.hisp.dhis.patient.PatientService" />
- <property name="minMaxDataElementService"
- ref="org.hisp.dhis.minmax.MinMaxDataElementService" />
<property name="selectionManager"
ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
<property name="programStageDataElementService"
@@ -215,8 +217,6 @@
id="org.hisp.dhis.caseentry.action.caseentry.ProgramStageCustomDataEntryAction"
class="org.hisp.dhis.caseentry.action.caseentry.ProgramStageCustomDataEntryAction"
scope="prototype">
- <property name="minMaxDataElementService"
- ref="org.hisp.dhis.minmax.MinMaxDataElementService" />
<property name="dataEntryScreenManager"
ref="org.hisp.dhis.caseentry.screen.DataEntryScreenManager" />
<property name="selectedStateManager"
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2011-05-13 09:11:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2011-05-20 03:35:47 +0000
@@ -88,13 +88,7 @@
<!-- save data-value -->
- <action name="saveDateValue" class="org.hisp.dhis.caseentry.action.caseentry.ValidateValueAction">
- <result name="success" type="chain">saveDateValueChain</result>
- <result name="input" type="velocity-xml">/dhis-web-caseentry/status.vm</result>
- <param name="onExceptionReturn">plainTextError</param>
- </action>
-
- <action name="saveDateValueChain" class="org.hisp.dhis.caseentry.action.caseentry.SaveDateValueAction">
+ <action name="saveDateValue" class="org.hisp.dhis.caseentry.action.caseentry.SaveDateValueAction">
<result name="success" type="velocity-xml">status.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm 2011-05-10 07:25:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm 2011-05-20 03:35:47 +0000
@@ -1,117 +1,115 @@
-<div id="dragDiv">
- <table id="listInfo">
- <tr><td style="text-align:left"><strong>$i18n.getString("org_unit_name") :</strong></td> <td id="orgUnitNameField" style="text-align:right"></td></tr>
- <tr><td style="text-align:left"><strong>$i18n.getString("program_stage_name") :</strong></td> <td id="programStageName" style="text-align:right"></td></tr>
- <tr><td style="text-align:left"><strong>$i18n.getString("datae_element_name") :</strong></td> <td id="dataelementName" style="text-align:right"></td></tr>
- </table>
-</div>
-
-
-
-
-<div id="customEntryScreenContainer">
- #if( $customDataEntryFormCode )
- $customDataEntryFormCode
- #else <span style="font-style:italic; color:blue"> $i18n.getString( "no_custom_data_entry_exist" )</span>
- #end
-</div>
-
-<div id="defaultEntryScreenContainer">
- <table class="mainPageTable">
- <col id="noCol">
- <col id="deCol">
- <col id="entryCol">
- <col id="facilityCol">
- <tr>
- <th>$i18n.getString( "nr" )</th>
- <th>$i18n.getString( "data_element" )</th>
- <th>$i18n.getString( "entry" )</th>
- <th>$i18n.getString( "facility_provided_data" )</th>
- </tr>
- #set( $dataElementRowCount = 0 )
- #set( $mark = 0 )
- #set( $tabIndex = 1 )
- #foreach( $programStageDataElement in $programStageDataElements )
- #set( $dataElementRowCount = $dataElementRowCount + 1 )
- #if( $mark == 1 )
- #set( $mark = 0 )
- #else
- #set( $mark = 1 )
- #end
- #set( $patientDataValue = false )
- #set( $patientDataValue = $patientDataValueMap.get( $programStageDataElement.dataElement.id ) )
- <tr #if( $mark == 0 ) style="background-color:#dddddd" #end>
- ##dataElementRowCount
- <td style="text-align:right">$dataElementRowCount</td>
- ##data element name
- <td>
- <span id="value[$programStageDataElement.dataElement.id].name" title="$!encoder.htmlEncode( $programStageDataElement.dataElement.description )">
- $encoder.htmlEncode( $programStageDataElement.dataElement.name )
- #if ( $programStageDataElement.compulsory )
- <em title="$i18n.getString( "required" )" class="required">*</em>
- #end
- </span>
- </td>
- ##type
- <td style="display:none"><span id="value[$programStageDataElement.dataElement.id].type" style="display:none">$encoder.htmlEncode( $programStageDataElement.dataElement.getDetailedNumberType() )</span></td>
- ##entry
- <td>
- #if( $programStageDataElement.dataElement.type == "bool" )
- <select name="entryselect" #if($programStageInstance.completed) disabled="disabled" #end data="{compulsory: $programStageDataElement.compulsory }" id="value[$programStageDataElement.dataElement.id].boolean" onchange="saveChoice( $programStageDataElement.dataElement.id, this )" tabindex="$tabIndex">
- <option value="">[$i18n.getString( "select_value" )]</option>
- <option value="true" #if( $patientDataValue.value == "true" ) selected="selected" #end>$i18n.getString( "yes" )</option>
- <option value="false" #if( $patientDataValue.value == "false" ) selected="selected" #end>$i18n.getString( "no" )</option>
- </select>
- #elseif( $programStageDataElement.dataElement.type == "string" && $programStageDataElement.dataElement.isMultiDimensional() )
- #set( $optionValues = $optionMap.get( $programStageDataElement.dataElement.id ) )
- <select name="entryselect" data="{compulsory: $programStageDataElement.compulsory }" #if($programStageInstance.completed) disabled="disabled" #end id="value[$programStageDataElement.dataElement.id].value" onchange="saveChoice( $programStageDataElement.dataElement.id, this )" tabindex="$tabIndex">
- <option value="">[$i18n.getString( "no_value" )]</option>
- #foreach( $optionValue in $optionValues )
- <option value="$optionValue.id" #if( $patientDataValue.value == $optionValue.id ) selected="selected" #end>$encoder.htmlEncode( $optionValue.name )</option>
- #end
- </select>
- #elseif( $programStageDataElement.dataElement.type == "date" )
- <input type="text" data="{compulsory: $programStageDataElement.compulsory }" #if($programStageInstance.completed) disabled="disabled" #end id="value[$programStageDataElement.dataElement.id].date" name="entryfield" value="$!encoder.htmlEncode($patientDataValue.value)" onchange="saveDateValue( $programStageDataElement.dataElement.id, '$encoder.jsEncode( $programStageDataElement.dataElement.name )' )" tabindex="$tabIndex" >
- <script type="text/javascript">
- datePicker('value\\[$programStageDataElement.dataElement.id\\]\\.date', false);
- </script>
- #else
- <input name="entryfield" data="{compulsory: $programStageDataElement.compulsory }" #if($programStageInstance.completed) disabled="disabled" #end id="value[$programStageDataElement.dataElement.id].value" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveValue( $programStageDataElement.dataElement.id, '$encoder.jsEncode( $programStageDataElement.dataElement.name )' )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
- #end
- </td>
- ##providedByAnotherFacility
- <td>
- #if ( $patientDataValue.value )
- #if( !$patientDataValue.providedByAnotherFacility )
- $patientDataValue.organisationUnit.name
- <input name="providedByAnotherFacility" id="value[$programStageDataElement.dataElement.id].providedByAnotherFacility" type="hidden" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )">
+<span id="startMsg" style="font-style:italic; color:blue"> </span>
+
+<div id='entryForm'>
+ <input type='hidden' id='programStageInstanceId' value='$programStageInstance.id'>
+ <input type='hidden' id='programStageInstanceName' value='$programStageInstance.name'>
+ <input type='hidden' id='incidentDate' value='$!format.formatDate($programStageInstance.programInstance.dateOfIncident)'>
+ <input type='hidden' id='dueDateValue' value='$!format.formatDate( $programStageInstance.dueDate )'>
+ <input type='hidden' id='executionDateValue' value='$!format.formatDate( $programStageInstance.executionDate )'>
+
+ <div id="dragDiv">
+ <table id="listInfo">
+ <tr><td style="text-align:left"><strong>$i18n.getString("org_unit_name") :</strong></td> <td id="orgUnitNameField" style="text-align:right"></td></tr>
+ <tr><td style="text-align:left"><strong>$i18n.getString("program_stage_name") :</strong></td> <td id="programStageName" style="text-align:right">$programStageInstance.programStage.name</td></tr>
+ <tr><td style="text-align:left"><strong>$i18n.getString("datae_element_name") :</strong></td> <td id="dataelementName" style="text-align:right"></td></tr>
+ </table>
+ </div>
+
+ <div id="customEntryScreenContainer">
+ #if( $customDataEntryFormCode )
+ $customDataEntryFormCode
+ #else <span style="font-style:italic; color:blue"> $i18n.getString( "no_custom_data_entry_exist" )</span>
+ #end
+ </div>
+
+ <div id="defaultEntryScreenContainer">
+ <table class="mainPageTable">
+ <col id="noCol">
+ <col id="deCol">
+ <col id="entryCol">
+ <col id="facilityCol">
+ <tr>
+ <th>$i18n.getString( "nr" )</th>
+ <th>$i18n.getString( "data_element" )</th>
+ <th>$i18n.getString( "entry" )</th>
+ <th>$i18n.getString( "facility_provided_data" )</th>
+ </tr>
+ #set( $dataElementRowCount = 0 )
+ #set( $mark = 0 )
+ #set( $tabIndex = 1 )
+ #foreach( $programStageDataElement in $programStageDataElements )
+ #set( $dataElementRowCount = $dataElementRowCount + 1 )
+ #if( $mark == 1 )
+ #set( $mark = 0 )
+ #else
+ #set( $mark = 1 )
+ #end
+ #set( $patientDataValue = false )
+ #set( $patientDataValue = $patientDataValueMap.get( $programStageDataElement.dataElement.id ) )
+ <tr #if( $mark == 0 ) style="background-color:#dddddd" #end>
+ ##dataElementRowCount
+ <td style="text-align:right">$dataElementRowCount</td>
+ ##data element name
+ <td>
+ <span id="value[$programStageDataElement.dataElement.id].name" title="$!encoder.htmlEncode( $programStageDataElement.dataElement.description )">
+ $encoder.htmlEncode( $programStageDataElement.dataElement.name )
+ #if ( $programStageDataElement.compulsory )
+ <em title="$i18n.getString( "required" )" class="required">*</em>
+ #end
+ </span>
+ </td>
+ ##type
+ <td style="display:none"><span id="value[$programStageDataElement.dataElement.id].type" style="display:none">$encoder.htmlEncode( $programStageDataElement.dataElement.getDetailedNumberType() )</span></td>
+ ##entry
+ <td>
+ #if( $programStageDataElement.dataElement.type == "bool" )
+ <select name="entryselect" #if($programStageInstance.completed) disabled="disabled" #end data="{compulsory: $programStageDataElement.compulsory }" id="value[$programStageDataElement.dataElement.id].boolean" onchange="saveChoice( $programStageDataElement.dataElement.id, this )" tabindex="$tabIndex">
+ <option value="">[$i18n.getString( "select_value" )]</option>
+ <option value="true" #if( $patientDataValue.value == "true" ) selected="selected" #end>$i18n.getString( "yes" )</option>
+ <option value="false" #if( $patientDataValue.value == "false" ) selected="selected" #end>$i18n.getString( "no" )</option>
+ </select>
+ #elseif( $programStageDataElement.dataElement.type == "string" && $programStageDataElement.dataElement.isMultiDimensional() )
+ #set( $optionValues = $optionMap.get( $programStageDataElement.dataElement.id ) )
+ <select name="entryselect" data="{compulsory: $programStageDataElement.compulsory }" #if($programStageInstance.completed) disabled="disabled" #end id="value[$programStageDataElement.dataElement.id].value" onchange="saveChoice( $programStageDataElement.dataElement.id, this )" tabindex="$tabIndex">
+ <option value="">[$i18n.getString( "no_value" )]</option>
+ #foreach( $optionValue in $optionValues )
+ <option value="$optionValue.id" #if( $patientDataValue.value == $optionValue.id ) selected="selected" #end>$encoder.htmlEncode( $optionValue.name )</option>
+ #end
+ </select>
+ #elseif( $programStageDataElement.dataElement.type == "date" )
+ <input type="text" data="{compulsory: $programStageDataElement.compulsory }" #if($programStageInstance.completed) disabled="disabled" #end id="value[$programStageDataElement.dataElement.id].date" name="entryfield" value="$!encoder.htmlEncode($patientDataValue.value)" onchange="saveDateValue( $programStageDataElement.dataElement.id, '$encoder.jsEncode( $programStageDataElement.dataElement.name )' )" tabindex="$tabIndex" >
+ <script type="text/javascript">
+ datePicker('value\\[$programStageDataElement.dataElement.id\\]\\.date', false);
+ </script>
#else
- $i18n.getString("other_facility")
- <input name="providedByAnotherFacility" id="value[$programStageDataElement.dataElement.id].providedByAnotherFacility" type="hidden" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )">
+ <input name="entryfield" data="{compulsory: $programStageDataElement.compulsory }" #if($programStageInstance.completed) disabled="disabled" #end id="value[$programStageDataElement.dataElement.id].value" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveValue( $programStageDataElement.dataElement.id, '$encoder.jsEncode( $programStageDataElement.dataElement.name )' )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
#end
- #else
- <input name="providedByAnotherFacility" id="value[$programStageDataElement.dataElement.id].providedByAnotherFacility" type="checkbox" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )">
- #end
- </td>
- </tr>
- #set( $tabIndex = $tabIndex + 1 )
- #end
- </table>
+ </td>
+ ##providedByAnotherFacility
+ <td>
+ #if ( $patientDataValue.value )
+ #if( !$patientDataValue.providedByAnotherFacility )
+ $patientDataValue.organisationUnit.name
+ <input name="providedByAnotherFacility" id="value[$programStageDataElement.dataElement.id].providedByAnotherFacility" type="hidden" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )">
+ #else
+ $i18n.getString("other_facility")
+ <input name="providedByAnotherFacility" id="value[$programStageDataElement.dataElement.id].providedByAnotherFacility" type="hidden" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )">
+ #end
+ #else
+ <input name="providedByAnotherFacility" id="value[$programStageDataElement.dataElement.id].providedByAnotherFacility" type="checkbox" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )">
+ #end
+ </td>
+ </tr>
+ #set( $tabIndex = $tabIndex + 1 )
+ #end
+ </table>
+ </div>
</div>
-<script type="text/javascript">
-
- setFieldValue('orgUnitNameField', getFieldValue('orgunitName') );
- setFieldValue('programStageName', '$programStageInstance.programStage.name' );
- setFieldValue('programStageInstanceId', '$programStageInstance.id' );
- setFieldValue('programStageInstanceName', '$programStageInstance.name' );
- setFieldValue('incidentDate', '$!format.formatDate($programStageInstance.programInstance.dateOfIncident)' );
- setFieldValue('dueDate', '$!format.formatDate( $programStageInstance.dueDate )' );
- setFieldValue('executionDate', '$!format.formatDate( $programStageInstance.executionDate )' );
-
+<script type="text/javascript">
+ //setFieldValue('orgUnitNameField', getFieldValue('orgunitName') );
initCustomCheckboxes();
DRAG_DIV.init();
-
</script>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm 2011-05-10 07:25:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm 2011-05-20 03:35:47 +0000
@@ -74,8 +74,6 @@
<hr style="clear:both">
-<span id="startMsg" style="font-style:italic; color:blue"> </span>
-
<script type="text/javascript">
setFieldValue('patientId', '$patient.id');
</script>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js 2011-05-19 01:11:43 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js 2011-05-20 03:35:47 +0000
@@ -81,9 +81,14 @@
function loadProgramStages()
{
- if ( getFieldValue('programId') )
+ hideById('dataEntryFormDiv');
+ clearListById('programStageId');
+ setFieldValue('dueDate', '');
+ setFieldValue('executionDate', '');
+
+ if ( getFieldValue('programId') == 0 )
{
-
+ return;
}
jQuery.postJSON( "loadProgramStages.action",
{
@@ -123,45 +128,43 @@
function loadDataEntry()
{
+ hideById('dataEntryFormDiv');
if( getFieldValue('programStageId') == '0' )
{
- disable('listPatientBtn');
- disable('searchingAttributeId');
- jQuery('#searchText').removeAttr( 'readonly' );
- disable('searchBtn');
-
return;
}
- enable('executionDate');
+ // Load data-entry form
showLoader();
+ var useDefaultForm = ( jQuery('#useDefaultForm').attr('checked')=='checked')?true:false
+
jQuery('#dataEntryFormDiv').load("dataentryform.action",
{
programStageId:getFieldValue('programStageId'),
patientId: getFieldValue('patientId'),
- useDefaultForm: jQuery('#useDefaultForm').find("checked").value
+ useDefaultForm: useDefaultForm
},
- function( )
- {
- showById('dataRecordingSelectDiv');
- if ( getFieldValue('executionDate') =='' )
- {
- hideById('dataEntryFormDiv');
- setInnerHTML('startMsg', i18n_report_date_warning);
- }
- else
- {
- showById('dataEntryFormDiv');
- setInnerHTML('startMsg', '');
- }
-
- enable('dueDate');
+ function( )
+ {
+ }).slideDown('slow', function()
+ {
+ setFieldValue('executionDate', getFieldValue('executionDateValue'));
+ setFieldValue('dueDate', getFieldValue('dueDateValue'));
enable('executionDate');
enable('validationBtn');
enable('completeBtn');
-
enable('useDefaultForm');
enable('useCustomForm');
+ if ( getFieldValue('executionDate') =='' )
+ {
+ hideById('entryForm');
+ setInnerHTML('startMsg', i18n_report_date_warning);
+ }
+ else
+ {
+ showById('entryForm');
+ setInnerHTML('startMsg', '');
+ }
if( byId('useCustomForm').checked )
{
@@ -172,7 +175,7 @@
}
hideLoader();
- hideById('contentDiv');
+ hideById('contentDiv');
});
}
@@ -395,6 +398,7 @@
{
markValue( resultColor );
showById('dataEntryFormDiv');
+ showById('entryForm');
}
else
{
@@ -621,7 +625,11 @@
request.setCallbackSuccess( handleResponseCheckBox );
request.setCallbackError( handleHttpErrorCheckBox );
request.setResponseTypeXML( 'status' );
- request.send( 'saveProvidingFacility.action?dataElementId=' + dataElementId + '&providedByAnotherFacility=' + providedByAnotherFacility );
+ request.send( 'saveProvidingFacility.action?dataElementId=' + dataElementId
+ + '&patientId=' + getFieldValue('patientId')
+ + '&programStageId=' + getFieldValue('programStageId')
+ + '&providedByAnotherFacility=' + providedByAnotherFacility
+ );
};
function handleResponseCheckBox( rootElement )
@@ -667,8 +675,11 @@
var request = new Request();
request.setCallbackSuccess( handleResponseCheckBox );
request.setCallbackError( handleHttpErrorCheckBox );
- request.setResponseTypeXML( 'status' );
- request.send( 'saveProvidingFacility.action?dataElementId=' + dataElementId + '&providedByAnotherFacility=' + providedByAnotherFacility );
+ request.setResponseTypeXML( 'status' );
+ request.send( 'saveProvidingFacility.action?dataElementId=' + dataElementId
+ + '&patientId=' + getFieldValue('patientId')
+ + '&programStageId=' + programStageId
+ +'&providedByAnotherFacility=' + providedByAnotherFacility );
};
function handleResponseCheckBox( rootElement )