dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18560
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7863: Add display of incident date for program.
------------------------------------------------------------
revno: 7863
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-08-06 16:34:34 +0700
message:
Add display of incident date for program.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.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/program/Program.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2012-05-24 09:45:14 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2012-08-06 09:34:34 +0000
@@ -83,6 +83,8 @@
private Integer type;
private Boolean displayProvidedOtherFacility;
+
+ private Boolean displayIncidentDate;
// -------------------------------------------------------------------------
// Constructors
@@ -300,6 +302,16 @@
}
}
+ public Boolean getDisplayIncidentDate()
+ {
+ return displayIncidentDate;
+ }
+
+ public void setDisplayIncidentDate( Boolean displayIncidentDate )
+ {
+ this.displayIncidentDate = displayIncidentDate;
+ }
+
private Object getValueFromPatient( String property, Patient patient )
throws Exception
{
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2012-07-30 11:53:35 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2012-08-06 09:34:34 +0000
@@ -121,6 +121,8 @@
moveStoredByFormStageInstanceToDataValue();
executeSql( "ALTER TABLE patientattribute DROP COLUMN inheritable" );
+
+ executeSql( "ALTER TABLE patientattribute DROP COLUMN inheritable" );
}
// -------------------------------------------------------------------------
@@ -272,7 +274,8 @@
+ resultSet.getInt( 4 ) + ")" );
}
executeSql( "ALTER TABLE patienttabularreport DROP COLUMN programstageid" );
- executeSql( "DROP TABLE patienttabularreport_dataelements" );
+ executeSql( "UPDATE program SET displayIncidentDate=true WHERE displayIncidentDate is null and type!=3" );
+ executeSql( "UPDATE program SET displayIncidentDate=false WHERE displayIncidentDate is null and type==3" );
}
catch ( Exception e )
{
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml'
--- dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml 2012-05-23 15:02:50 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml 2012-08-06 09:34:34 +0000
@@ -42,6 +42,8 @@
<property name="type" />
<property name="displayProvidedOtherFacility" />
+
+ <property name="displayIncidentDate" />
</class>
</hibernate-mapping>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm 2012-08-02 14:50:12 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataentryRecords.vm 2012-08-06 09:34:34 +0000
@@ -8,7 +8,7 @@
#foreach( $patient in $patientListByOrgUnit )
#set( $programInstance = $programInstanceMap.get( $patient ) )
<tr #alternate( $mark )>
- <td width='150px;'>
+ <td>
<input type='button' class='patient-object' value='$patient.getFullName()' onclick='javascript:showPatientHistory( "$patient.id" );' title='$i18n.getString( "patient_details_and_history" )'>
</td>
#set($programStageInstances = $programStageInstanceMap.get($programInstance) )
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2012-08-02 13:10:04 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/patient.js 2012-08-06 09:34:34 +0000
@@ -391,6 +391,13 @@
}
}
+ var displayIncidentDate = jQuery('#enrollmentDiv [name=programId] option:selected').attr('displayIncidentDate');
+ if(displayIncidentDate=='true'){
+ showIncidentDateField();
+ }else{
+ hideIncidentDateField();
+ }
+
jQuery('#loaderDiv').hide();
});
}
@@ -722,9 +729,22 @@
{
showById('enrollmentDateTR');
showById('dateOfIncidentTR');
+ enable('dateOfIncident');
showById('enrollBtn');
}
+function hideIncidentDateField()
+{
+ setFieldValue( 'dateOfIncident', '' );
+ disable('dateOfIncident');
+ hideById('dateOfIncidentTR');
+}
+
+function showIncidentDateField()
+{
+ showById('dateOfIncidentTR');
+}
+
function saveIdentifierAndAttribute()
{
$.ajax({
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm 2012-08-02 09:58:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/programEnrollmentSelectForm.vm 2012-08-06 09:34:34 +0000
@@ -56,7 +56,7 @@
<select id="programId" name="programId" onchange="showProgramEnrollmentForm('$patient.id', this.value);" >
<option value="0">[$i18n.getString( "select" )]</option>
#foreach( $program in $programs )
- <option value="$program.id" type='$program.type'>$encoder.htmlEncode( $program.name )</option>
+ <option value="$program.id" type='$program.type' displayIncidentDate='$!program.displayIncidentDate'>$encoder.htmlEncode( $program.name )</option>
#end
</select>
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css 2012-08-02 14:50:12 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css 2012-08-06 09:34:34 +0000
@@ -10,6 +10,7 @@
input.small-button[type="button"]
{
width: 30px;
+ height: 30px;
}
input.large-button[type="button"]
@@ -166,7 +167,7 @@
input.patient-object[type="button"]
{
- width: 140px;
+ width: 130px;
height: 60px;
white-space: normal;
border-color: #bbbbbb;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java 2012-05-23 16:19:55 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java 2012-08-06 09:34:34 +0000
@@ -125,6 +125,13 @@
this.displayProvidedOtherFacility = displayProvidedOtherFacility;
}
+ private Boolean displayIncidentDate;
+
+ public void setDisplayIncidentDate( Boolean displayIncidentDate )
+ {
+ this.displayIncidentDate = displayIncidentDate;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -133,7 +140,8 @@
throws Exception
{
displayProvidedOtherFacility = (displayProvidedOtherFacility == null) ? false : displayProvidedOtherFacility;
-
+ displayIncidentDate = (displayIncidentDate == null) ? false : displayIncidentDate;
+
Program program = new Program();
program.setName( name );
@@ -144,11 +152,12 @@
program.setMaxDaysAllowedInputData( maxDaysAllowedInputData );
program.setType( type );
program.setDisplayProvidedOtherFacility( displayProvidedOtherFacility );
+ program.setDisplayIncidentDate(displayIncidentDate);
programService.saveProgram( program );
- if ( program.getType().equals( Program.SINGLE_EVENT_WITH_REGISTRATION ) ||
- program.getType().equals( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ))
+ if ( program.getType().equals( Program.SINGLE_EVENT_WITH_REGISTRATION )
+ || program.getType().equals( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) )
{
ProgramStage programStage = new ProgramStage();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java 2012-05-23 16:19:55 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java 2012-08-06 09:34:34 +0000
@@ -122,6 +122,13 @@
this.displayProvidedOtherFacility = displayProvidedOtherFacility;
}
+ private Boolean displayIncidentDate;
+
+ public void setDisplayIncidentDate( Boolean displayIncidentDate )
+ {
+ this.displayIncidentDate = displayIncidentDate;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -130,7 +137,8 @@
throws Exception
{
displayProvidedOtherFacility = (displayProvidedOtherFacility == null) ? false : displayProvidedOtherFacility;
-
+ displayIncidentDate = (displayIncidentDate == null) ? false : displayIncidentDate;
+
Program program = programService.getProgram( id );
program.setName( name );
program.setDescription( description );
@@ -140,6 +148,7 @@
program.setMaxDaysAllowedInputData( maxDaysAllowedInputData );
program.setType( type );
program.setDisplayProvidedOtherFacility( displayProvidedOtherFacility );
+ program.setDisplayIncidentDate(displayIncidentDate);
programService.updateProgram( program );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2012-08-01 14:38:30 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2012-08-06 09:34:34 +0000
@@ -251,4 +251,5 @@
number_of_visits = Number of visits
insert = Insert
visit_selected_program_stage = Visited selected program stage
-intro_patient_aggregation_query_builder = Define formulas, expressions, rules for aggregation data from name-based to aggregation system
\ No newline at end of file
+intro_patient_aggregation_query_builder = Define formulas, expressions, rules for aggregation data from name-based to aggregation system
+show_incident_date = Show incident date
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm 2012-07-26 06:38:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm 2012-08-06 09:34:34 +0000
@@ -27,7 +27,7 @@
<tr>
<td><label>$i18n.getString( "type" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
<td>
- <select style="width: 336px;" id="type" name="type" onchange='programTypeOnChange();' class="{validate:{required:true}}">
+ <select style="width: 336px;" id="type" name="type" onchange='programOnChange();' class="{validate:{required:true}}">
<option value=''>[$i18n.getString('please_select')]</option>
<option value='1'>$i18n.getString('multiple_events_with_registration')</option>
<option value='2'>$i18n.getString('single_event_with_registration')</option>
@@ -44,6 +44,12 @@
</tr>
<tr>
+ <td><label>$i18n.getString( "show_incident_date" )</label></td>
+ <td><input style="margin: 0;"type="checkbox" id="displayIncidentDate" name="displayIncidentDate" value='true' checked onchange='programOnChange();'></td>
+ <td></td>
+ </tr>
+
+ <tr>
<td><label>$i18n.getString( "date_of_enrollment_description" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
<td><input style="width: 330px;" type="text" id="dateOfEnrollmentDescription" name="dateOfEnrollmentDescription" class="{validate:{required:true,minlength:4}}"></td>
<td></td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js 2012-07-31 08:38:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js 2012-08-06 09:34:34 +0000
@@ -38,7 +38,7 @@
removeItem( programId, name, i18n_confirm_delete, 'removeProgram.action' );
}
-function programTypeOnChange()
+function programOnChange()
{
var type = getFieldValue('type');
@@ -46,17 +46,17 @@
if(type == "3")
{
disable('dateOfEnrollmentDescription');
- disable('dateOfIncidentDescription');
- }
- // single-event
- else if( type=='2')
- {
- enable('dateOfEnrollmentDescription');
- disable('dateOfIncidentDescription');
- }
- else
- {
- enable('dateOfEnrollmentDescription');
- enable('dateOfIncidentDescription');
+ disable("displayIncidentDate");
+ disable("dateOfIncidentDescription");
+ }
+ else{
+ enable('dateOfEnrollmentDescription');
+ enable("displayIncidentDate");
+ if(byId('displayIncidentDate').checked){
+ enable("dateOfIncidentDescription");
+ }
+ else {
+ disable("dateOfIncidentDescription");
+ }
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm 2012-07-11 04:24:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm 2012-08-06 09:34:34 +0000
@@ -26,7 +26,7 @@
<tr>
<td><label>$i18n.getString( "type" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
<td>
- <select style="width: 336px;" id="type" name="type" onchange='programTypeOnChange();' class="{validate:{required:true}}">
+ <select style="width: 336px;" id="type" name="type" onchange='programOnChange();' class="{validate:{required:true}}">
<option value=''>[$i18n.getString('please_select')]</option>
<option value='1' #if( $program.type=='1' ) selected #end>$i18n.getString('multiple_events_with_registration')</option>
<option value='2' #if( $program.type=='2' ) selected #end>$i18n.getString('single_event_with_registration')</option>
@@ -41,6 +41,12 @@
<td><input style="margin: 0;" type="checkbox" id="displayProvidedOtherFacility" name="displayProvidedOtherFacility" value='true' #if( $program.displayProvidedOtherFacility=='false' ) checked #end ></td>
<td></td>
</tr>
+
+ <tr>
+ <td><label>$i18n.getString( "show_incident_date" )</label></td>
+ <td><input style="margin: 0;"type="checkbox" id="displayIncidentDate" name="displayIncidentDate" value='true' onchange='programOnChange();' #if( $program.type=='3' ) disabled #elseif($program.displayIncidentDate=='true') checked #end></td>
+ <td></td>
+ </tr>
<tr>
<td><label>$i18n.getString( "version" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>