dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20679
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9581: Add property for program to allow blocking entry form after to complete an event.
------------------------------------------------------------
revno: 9581
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-01-23 11:48:39 +0700
message:
Add property for program to allow blocking entry form after to complete an event.
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/dataEntryForm.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgram.vm
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
--
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-12-10 04:03:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java 2013-01-23 04:48:39 +0000
@@ -94,6 +94,8 @@
private List<PatientAttribute> patientAttributes;
+ private Boolean blockEntryForm = false;
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -365,4 +367,14 @@
{
return type != null && (SINGLE_EVENT_WITH_REGISTRATION == type || MULTIPLE_EVENTS_WITH_REGISTRATION == type);
}
+
+ public Boolean getBlockEntryForm()
+ {
+ return blockEntryForm;
+ }
+
+ public void setBlockEntryForm( Boolean blockEntryForm )
+ {
+ this.blockEntryForm = blockEntryForm;
+ }
}
=== 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 2013-01-07 05:07:05 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/startup/TableAlteror.java 2013-01-23 04:48:39 +0000
@@ -163,6 +163,8 @@
executeSql( "ALTER TABLE programvalidation RENAME description TO name" );
+ executeSql( "UPDATE program SET blockEntryForm=false WHERE blockEntryForm is null" );
+
updateUid();
}
=== 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-12-10 04:03:33 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/resources/org/hisp/dhis/program/hibernate/Program.hbm.xml 2013-01-23 04:48:39 +0000
@@ -61,5 +61,7 @@
<property name="ignoreOverdueEvents" />
+ <property name="blockEntryForm" />
+
</class>
</hibernate-mapping>
=== 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 2012-12-20 07:35:58 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm 2013-01-23 04:48:39 +0000
@@ -12,6 +12,7 @@
#end
entryFormContainerOnReady();
+
});
</script>
@@ -26,7 +27,8 @@
<input type='hidden' name='programStageId' id='programStageId' value='$!programStageInstance.programStage.id'>
<input type='hidden' name='programId' id='programId' value='$!programStageInstance.programInstance.program.id'>
<input type='hidden' name='validCompleteOnly' id='validCompleteOnly' value='$!programStageInstance.programStage.validCompleteOnly'>
-<input type='hidden' id='currentUsername' name='currentUsername' value='$!currentUsername'>
+<input type='hidden' name='currentUsername' id='currentUsername' value='$!currentUsername'>
+<input type='hidden' name='blockEntryForm' id='blockEntryForm' value='$!programStageInstance.programInstance.program.blockEntryForm'>
<div id='entryForm' #if($!programStageInstance.executionDate) class='visible' #else class='hidden' #end>
<table id="postCommentTbl" class="hidden">
@@ -78,5 +80,9 @@
jQuery("[id=executionDate]").prop('disabled', true);
jQuery("[id=executionDate]").datepicker("destroy");
#end
+
+ if(getFieldValue('completed')=='true' && getFieldValue('blockEntryForm')=='true'){
+ blockEntryForm();
+ }
</script>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm 2013-01-08 04:25:40 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm 2013-01-23 04:48:39 +0000
@@ -72,9 +72,7 @@
<td style='width:20px;' align='center'>
#set( $id = $programStageDataElement.programStage.id + '_' + $programStageDataElement.dataElement.id + '_facility' )
#if( $programStageDataElement.allowProvidedElsewhere == 'true')
- <div id='span_$id' class='provided-elsewhere'>
- <input class='provided-elsewhere' name="$id" id="$id" type="checkbox" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )" #if($patientDataValue.providedElsewhere == 'true') checked #end />
- </div>
+ <input class='provided-elsewhere' name="$id" id="$id" type="checkbox" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )" #if($patientDataValue.providedElsewhere == 'true') checked #end />
#end
</td>
#end
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js 2013-01-18 01:23:52 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js 2013-01-23 04:48:39 +0000
@@ -97,9 +97,7 @@
{
var programStageId = byId( 'programStageId' ).value;
var checked= checkField.checked;
- var spanField = byId( 'span_' + checkField.id );
- spanField.style.backgroundColor = SAVING_COLOR;
-
+
var facilitySaver = new FacilitySaver( dataElementId, checked, SUCCESS_COLOR );
facilitySaver.save();
}
@@ -304,36 +302,17 @@
{
var codeElement = rootElement.getElementsByTagName( 'code' )[0];
var code = parseInt( codeElement.firstChild.nodeValue );
- if ( code == 0 )
- {
- markValue( SUCCESS );
- }
- else
- {
- markValue( ERROR );
+
+ if ( code != 0 )
+ {
window.alert( i18n_saving_value_failed_status_code + '\n\n' + code );
}
}
function handleHttpError( errorCode )
{
- markValue( ERROR );
window.alert( i18n_saving_value_failed_error_code + '\n\n' + errorCode );
}
-
- function markValue( result )
- {
- var programStageId = byId( 'programStageId' ).value;
- var element = byId('span_' + programStageId + '_' + dataElementId + '_facility');
- if( result == SUCCESS )
- {
- element.style.backgroundColor = SUCCESS_COLOR;
- }
- else if( result == ERROR )
- {
- element.style.backgroundColor = ERROR_COLOR;
- }
- }
}
function ExecutionDateSaver( programId_, programStageInstanceId_, executionDate_, resultColor_ )
@@ -531,6 +510,12 @@
eventBox.attr('status',1);
resetActiveEvent( eventBox.attr("pi") );
+
+ var blocked = jQuery('#entryFormContainer [id=blockEntryForm]').val();
+ if( blocked=='true' ){
+ blockEntryForm();
+ }
+
hideLoader();
if( isCreateEvent ){
@@ -557,11 +542,39 @@
var eventBox = jQuery('#ps_' + getFieldValue('programStageInstanceId'));
eventBox.attr('status',2);
resetActiveEvent( eventBox.attr("pi") );
+
+ unblockEntryForm();
});
}
}
+
+function blockEntryForm()
+{
+ jQuery("#entryFormContainer :input").each(function()
+ {
+ disable($(this).attr('id'));
+ });
+ jQuery("#entryFormContainer").find(".ui-combobox").each(function()
+ {
+ jQuery(this).addClass('hidden');
+ });
+
+}
+
+function unblockEntryForm()
+{
+ jQuery("#entryFormContainer :input").each(function()
+ {
+ enable($(this).attr('id'));
+ });
+ jQuery("#entryFormContainer").find(".ui-combobox").each(function()
+ {
+ jQuery(this).removeClass('hidden');
+ });
+}
+
TOGGLE = {
init : function() {
jQuery(".togglePanel").each(function(){
=== 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 2013-01-21 07:29:15 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css 2013-01-23 04:48:39 +0000
@@ -182,13 +182,13 @@
input.optionset[type="text"]
{
- width:235px;
+ width:260px;
}
input.date-field[type="text"]
{
- width:235px;
+ width:260px;
}
div.provided-elsewhere
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgram.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgram.vm 2012-12-10 04:03:33 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonProgram.vm 2013-01-23 04:48:39 +0000
@@ -12,6 +12,7 @@
"dateOfIncidentDescription": "$!encoder.jsEncode( ${program.dateOfIncidentDescription} )",
"programStageCount": "${program.programStages.size()}",
"noAttributes": "$!program.patientAttributes.size()",
- "noIdentifierTypes": "$!program.patientIdentifierTypes.size()"
+ "noIdentifierTypes": "$!program.patientIdentifierTypes.size()",
+ "blockEntryForm": "$!program.blockEntryForm"
}
}
\ No newline at end of file
=== 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-12-10 04:03:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java 2013-01-23 04:48:39 +0000
@@ -176,6 +176,13 @@
this.ignoreOverdueEvents = ignoreOverdueEvents;
}
+ private Boolean blockEntryForm;
+
+ public void setBlockEntryForm( Boolean blockEntryForm )
+ {
+ this.blockEntryForm = blockEntryForm;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -187,7 +194,8 @@
displayIncidentDate = (displayIncidentDate == null) ? false : displayIncidentDate;
generateBydEnrollmentDate = (generateBydEnrollmentDate == null) ? false : generateBydEnrollmentDate;
ignoreOverdueEvents = (ignoreOverdueEvents == null) ? false : ignoreOverdueEvents;
-
+ blockEntryForm = (blockEntryForm == null) ? false : blockEntryForm;
+
Program program = new Program();
program.setName( name );
@@ -200,7 +208,8 @@
program.setDisplayIncidentDate( displayIncidentDate );
program.setGeneratedByEnrollmentDate( generateBydEnrollmentDate );
program.setIgnoreOverdueEvents( ignoreOverdueEvents );
-
+ program.setBlockEntryForm( blockEntryForm );
+
List<PatientIdentifierType> identifierTypes = new ArrayList<PatientIdentifierType>();
List<PatientAttribute> patientAttributes = new ArrayList<PatientAttribute>();
int index = 0;
=== 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-12-10 04:03:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java 2013-01-23 04:48:39 +0000
@@ -172,6 +172,13 @@
this.ignoreOverdueEvents = ignoreOverdueEvents;
}
+ private Boolean blockEntryForm;
+
+ public void setBlockEntryForm( Boolean blockEntryForm )
+ {
+ this.blockEntryForm = blockEntryForm;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -183,6 +190,7 @@
displayIncidentDate = (displayIncidentDate == null) ? false : displayIncidentDate;
generateBydEnrollmentDate = (generateBydEnrollmentDate == null) ? false : generateBydEnrollmentDate;
ignoreOverdueEvents = (ignoreOverdueEvents == null) ? false : ignoreOverdueEvents;
+ blockEntryForm = (blockEntryForm == null) ? false : blockEntryForm;
Program program = programService.getProgram( id );
program.setName( name );
@@ -195,7 +203,8 @@
program.setDisplayIncidentDate( displayIncidentDate );
program.setGeneratedByEnrollmentDate( generateBydEnrollmentDate );
program.setIgnoreOverdueEvents( ignoreOverdueEvents );
-
+ program.setBlockEntryForm( blockEntryForm );
+
List<PatientIdentifierType> identifierTypes = new ArrayList<PatientIdentifierType>();
List<PatientAttribute> patientAttributes = new ArrayList<PatientAttribute>();
int index = 0;
=== 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 2013-01-17 10:48:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2013-01-23 04:48:39 +0000
@@ -324,4 +324,5 @@
current_date = Current date
display_name = Display name
code_and_name = Code and Name
-sort_by = Sort by
\ No newline at end of file
+sort_by = Sort by
+block_entry_form_after_completed = Block entry form after completed
\ No newline at end of file