=== 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 minMaxDataElements = minMaxDataElementService.getMinMaxDataElements( - organisationUnit, dataElements ); - - Map minMaxMap = new HashMap( 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 minMaxDataElements = minMaxDataElementService.getMinMaxDataElements( - organisationUnit, dataElements ); - - Map minMaxMap = new HashMap( minMaxDataElements.size() ); - - for ( MinMaxDataElement minMaxDataElement : minMaxDataElements ) - { - minMaxMap.put( minMaxDataElement.getDataElement().getId(), minMaxDataElement ); - } +// // --------------------------------------------------------------------- +// // Get the min/max values +// // --------------------------------------------------------------------- +// +// Collection minMaxDataElements = minMaxDataElementService.getMinMaxDataElements( +// organisationUnit, dataElements ); +// +// Map minMaxMap = new HashMap( 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 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 dataValues, Map minMaxMap, String disabled, I18n i18n, ProgramStage programStage, + Collection dataValues, String disabled, I18n i18n, ProgramStage programStage, ProgramStageInstance programStageInstance, OrganisationUnit organisationUnit ); Collection 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 dataValues, Map minMaxMap, String disabled, I18n i18n, ProgramStage programStage, + Collection dataValues, String disabled, I18n i18n, ProgramStage programStage, ProgramStageInstance programStageInstance, OrganisationUnit organisationUnit ) { Map> mapDataValue = new HashMap>(); @@ -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 dataValues, Map minMaxMap, String disabled, I18n i18n, ProgramStage programStage, + Collection dataValues, String disabled, I18n i18n, ProgramStage programStage, ProgramStageInstance programStageInstance, OrganisationUnit organisationUnit, Map> mapDataValue ) { @@ -651,7 +650,7 @@ } private String populateCustomDataEntryForMutiDimentionalString( String dataEntryFormCode, - Collection dataValues, Map minMaxMap, String disabled, I18n i18n, ProgramStage programStage, + Collection dataValues, String disabled, I18n i18n, ProgramStage programStage, ProgramStageInstance programStageInstance, OrganisationUnit organisationUnit, Map> mapDataValue ) { @@ -885,7 +884,7 @@ } private String populateCustomDataEntryForDate( String dataEntryFormCode, Collection dataValues, - Map minMaxMap, String disabled, I18n i18n, ProgramStage programStage, ProgramStageInstance programStageInstance, + String disabled, I18n i18n, ProgramStage programStage, ProgramStageInstance programStageInstance, OrganisationUnit organisationUnit, Map> 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" /> + + - - - - saveDateValueChain - /dhis-web-caseentry/status.vm - plainTextError - - - + status.vm plainTextError === 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 @@ -
- - - - -
$i18n.getString("org_unit_name") :
$i18n.getString("program_stage_name") :
$i18n.getString("datae_element_name") :
-
- - - - -
- #if( $customDataEntryFormCode ) - $customDataEntryFormCode - #else $i18n.getString( "no_custom_data_entry_exist" ) - #end -
- -
- - - - - - - - - - - - #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 ) ) - - ##dataElementRowCount - - ##data element name - - ##type - - ##entry - - ##providedByAnotherFacility - + ##providedByAnotherFacility + + + #set( $tabIndex = $tabIndex + 1 ) + #end +
$i18n.getString( "nr" )$i18n.getString( "data_element" )$i18n.getString( "entry" )$i18n.getString( "facility_provided_data" )
$dataElementRowCount - - $encoder.htmlEncode( $programStageDataElement.dataElement.name ) - #if ( $programStageDataElement.compulsory ) - * - #end - - - #if( $programStageDataElement.dataElement.type == "bool" ) - - #elseif( $programStageDataElement.dataElement.type == "string" && $programStageDataElement.dataElement.isMultiDimensional() ) - #set( $optionValues = $optionMap.get( $programStageDataElement.dataElement.id ) ) - - #elseif( $programStageDataElement.dataElement.type == "date" ) - - - #else - - #end - - #if ( $patientDataValue.value ) - #if( !$patientDataValue.providedByAnotherFacility ) - $patientDataValue.organisationUnit.name - + + +
+ + + + + + +
+ + + + +
$i18n.getString("org_unit_name") :
$i18n.getString("program_stage_name") : $programStageInstance.programStage.name
$i18n.getString("datae_element_name") :
+
+ +
+ #if( $customDataEntryFormCode ) + $customDataEntryFormCode + #else $i18n.getString( "no_custom_data_entry_exist" ) + #end +
+ +
+ + + + + + + + + + + + #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 ) ) + + ##dataElementRowCount + + ##data element name + + ##type + + ##entry + - - #set( $tabIndex = $tabIndex + 1 ) - #end -
$i18n.getString( "nr" )$i18n.getString( "data_element" )$i18n.getString( "entry" )$i18n.getString( "facility_provided_data" )
$dataElementRowCount + + $encoder.htmlEncode( $programStageDataElement.dataElement.name ) + #if ( $programStageDataElement.compulsory ) + * + #end + + + #if( $programStageDataElement.dataElement.type == "bool" ) + + #elseif( $programStageDataElement.dataElement.type == "string" && $programStageDataElement.dataElement.isMultiDimensional() ) + #set( $optionValues = $optionMap.get( $programStageDataElement.dataElement.id ) ) + + #elseif( $programStageDataElement.dataElement.type == "date" ) + + #else - $i18n.getString("other_facility") - + #end - #else - - #end -
+
+ #if ( $patientDataValue.value ) + #if( !$patientDataValue.providedByAnotherFacility ) + $patientDataValue.organisationUnit.name + + #else + $i18n.getString("other_facility") + + #end + #else + + #end +
+
- \ 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 @@
- - === 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 )