dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18706
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7908: Strange behave in program stage entry form.
------------------------------------------------------------
revno: 7908
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-08-14 11:37:16 +0700
message:
Strange behave in program stage entry form.
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/SaveDataEntryFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.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-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java 2012-08-13 13:34:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java 2012-08-14 04:37:16 +0000
@@ -141,16 +141,16 @@
// -----------------------------------------------------------------
String dataElementCode = inputMatcher.group();
-
+
Matcher valueTagMatcher = VALUE_TAG_PATTERN.matcher( dataElementCode );
Matcher titleTagMatcher = TITLE_TAG_PATTERN.matcher( dataElementCode );
if ( valueTagMatcher.find() && valueTagMatcher.groupCount() > 0 )
{
- dataElementCode = dataElementCode.replace( valueTagMatcher.group( 1 ), EMPTY );
+ dataElementCode = dataElementCode.replace( valueTagMatcher.group( 1 ), EMPTY );
}
- if ( titleTagMatcher.find() && valueTagMatcher.groupCount() > 0 )
+ if ( titleTagMatcher.find() && titleTagMatcher.groupCount() > 0 )
{
dataElementCode = dataElementCode.replace( titleTagMatcher.group( 1 ), EMPTY );
}
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java 2012-07-28 13:37:33 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java 2012-08-14 04:37:16 +0000
@@ -331,7 +331,7 @@
{
String inputHTML = inputMatcher.group();
inputHTML = inputHTML.replace( ">", "" );
-
+
// -----------------------------------------------------------------
// Get HTML input field code
// -----------------------------------------------------------------
@@ -348,29 +348,11 @@
int dataElementId = Integer.parseInt( identifierMatcher.group( 2 ) );
DataElement dataElement = dataElementService.getDataElement( dataElementId );
-
- if ( dataElement != null )
- {
- if ( DataElement.VALUE_TYPE_DATE.equals( dataElement.getType() ) )
- {
- inputHTML = populateCustomDataEntryForDate( dataElement, inputHTML );
- }
- else if ( DataElement.VALUE_TYPE_BOOL.equals( dataElement.getType() ) )
- {
- inputHTML = populateCustomDataEntryForBoolean( dataElement, inputHTML );
- }
- else if ( !DataElement.VALUE_TYPE_TRUE_ONLY.equals( dataElement.getType() ) )
- {
- inputHTML = populateCustomDataEntryForTrueOnly( dataElement, inputHTML );
- }
- else
- {
- inputHTML = populateCustomDataEntryForTextBox( dataElement, inputHTML );
- }
- }
-
+
+ inputHTML = populateCustomDataEntryForTextBox( dataElement, inputHTML );
+
inputHTML = inputHTML + ">";
-
+
inputMatcher.appendReplacement( sb, inputHTML );
}
@@ -387,60 +369,21 @@
private String populateCustomDataEntryForTextBox( DataElement dataElement, String inputHTML )
{
- String displayValue = (dataElement == null) ? " value=\"" + DATA_ELEMENT_DOES_NOT_EXIST + "\" " : " value=\"[ "
- + dataElement.getName() + " ]\"";
- inputHTML = inputHTML.contains( EMPTY_VALUE_TAG ) ? inputHTML.replace( EMPTY_VALUE_TAG, displayValue )
- : inputHTML + " " + displayValue;
-
- String displayTitle = (dataElement == null) ? " title=\"" + DATA_ELEMENT_DOES_NOT_EXIST + "\" " : " title=\""
- + dataElement.getId() + "." + dataElement.getName() + "-" + dataElement.getDetailedNumberType() + "\" ";
- inputHTML = inputHTML.contains( EMPTY_TITLE_TAG ) ? inputHTML.replace( EMPTY_TITLE_TAG, displayTitle )
- : inputHTML + " " + displayTitle;
- return inputHTML;
- }
-
- private String populateCustomDataEntryForBoolean( DataElement dataElement, String inputHTML )
- {
- String displayValue = (dataElement == null) ? " value=\"" + DATA_ELEMENT_DOES_NOT_EXIST + "\" " : " value=\"[ "
- + dataElement.getName() + " ]\" ";
- inputHTML = inputHTML.contains( EMPTY_VALUE_TAG ) ? inputHTML.replace( EMPTY_VALUE_TAG, displayValue )
- : inputHTML + " " + displayValue;
-
- String displayTitle = (dataElement == null) ? " title=\"" + DATA_ELEMENT_DOES_NOT_EXIST + "\" " : " title=\""
- + dataElement.getId() + "." + dataElement.getName() + "-" + dataElement.getDetailedNumberType() + "\" ";
- inputHTML = inputHTML.contains( EMPTY_TITLE_TAG ) ? inputHTML.replace( EMPTY_TITLE_TAG, displayTitle )
- : inputHTML + " " + displayTitle;
-
- return inputHTML;
- }
-
- private String populateCustomDataEntryForTrueOnly( DataElement dataElement, String inputHTML )
- {
- String displayValue = (dataElement == null) ? " value=\"" + DATA_ELEMENT_DOES_NOT_EXIST + "\" " : " value=\"[ "
- + dataElement.getName() + " ]\" ";
- inputHTML = inputHTML.contains( EMPTY_VALUE_TAG ) ? inputHTML.replace( EMPTY_VALUE_TAG, displayValue )
- : inputHTML + " " + displayValue;
-
- String displayTitle = (dataElement == null) ? " title=\"" + DATA_ELEMENT_DOES_NOT_EXIST + "\" " : " title=\""
- + dataElement.getId() + "." + dataElement.getName() + "-" + dataElement.getDetailedNumberType() + "\" ";
- inputHTML = inputHTML.contains( EMPTY_TITLE_TAG ) ? inputHTML.replace( EMPTY_TITLE_TAG, displayTitle )
- : inputHTML + " " + displayTitle;
-
- return inputHTML;
- }
-
- private String populateCustomDataEntryForDate( DataElement dataElement, String inputHTML )
- {
- String displayValue = (dataElement == null) ? " value=\"" + DATA_ELEMENT_DOES_NOT_EXIST + "\"" : " value=\"[ "
- + dataElement.getName() + " ]\"";
- inputHTML = inputHTML.contains( EMPTY_VALUE_TAG ) ? inputHTML.replace( EMPTY_VALUE_TAG, displayValue )
- : inputHTML + " " + displayValue;
-
- String displayTitle = (dataElement == null) ? " title=\"" + DATA_ELEMENT_DOES_NOT_EXIST + "\"" : " title=\""
- + dataElement.getId() + "." + dataElement.getName() + "-" + dataElement.getDetailedNumberType() + "\" ";
- inputHTML = inputHTML.contains( EMPTY_TITLE_TAG ) ? inputHTML.replace( EMPTY_TITLE_TAG, displayTitle )
- : inputHTML + " " + displayTitle;
-
+ if ( dataElement != null )
+ {
+ inputHTML = inputHTML.contains( EMPTY_VALUE_TAG ) ? inputHTML.replace( EMPTY_VALUE_TAG, " value=\"[" + dataElement.getDisplayName() +"]\"" )
+ : inputHTML + " value=\"[" + dataElement.getDisplayName() + "]\" ";
+
+ String displayTitle = dataElement.getId() + " - " + dataElement.getName() + " - " + dataElement.getDetailedNumberType() + " - ";
+ inputHTML = inputHTML.contains( EMPTY_TITLE_TAG ) ? inputHTML.replace( EMPTY_TITLE_TAG, " title=\"" + displayTitle + "\"" )
+ : inputHTML + " title=\"" + displayTitle + "\"";
+ }
+ else
+ {
+ inputHTML = inputHTML.contains( EMPTY_VALUE_TAG ) ? " value=\"[" + DATA_ELEMENT_DOES_NOT_EXIST + "]\" "
+ : " value=\"[ " + DATA_ELEMENT_DOES_NOT_EXIST + " ]\"";
+ }
+
return inputHTML;
}
@@ -532,13 +475,13 @@
{
inputHTML += jsCodeForOnchange;
}
-
+
if ( DataElement.VALUE_TYPE_LONG_TEXT.equals( dataElement.getDetailedTextType() ) )
{
inputHTML = inputHTML.replaceFirst( "input", "textarea" );
inputHTML += " >$VALUE</textarea>";
}
-
+
return inputHTML;
}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm 2012-08-12 06:10:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientDashboard.vm 2012-08-14 04:37:16 +0000
@@ -4,7 +4,6 @@
• <a href="javascript:getPatientLocation( '$patient.id' );">$i18n.getString( "change_patient_location" )</a>
</h4>
-
<div id="subMenu">
<ul>
<li><a href="javascript:onClickBackBtn();">$i18n.getString( 'back_to_registration' )</a></li>
@@ -141,21 +140,8 @@
</tr>
</table>
<div class='event-flow-dashboard'>
- <table>
- <tr>
- #foreach( $programStageInstance in $programInstance.programStageInstances )
- <td>
- <img src='images/rightarrow.png'>
- </td>
- <td><input type='button' id='ps_$programStageInstance.id' name='programStageBtn' class='stage-object' value='$programStageInstance.programStage.name $format.formatDate( $programStageInstance.dueDate )'
- onclick='javascript:loadProgramStageRecords($programStageInstance.id, $programInstance.completed );'></td>
- <script>
- var status = $statusMap.get( $programStageInstance.id );
- setEventColorStatus( 'ps_' + $programStageInstance.id ,status);
- </script>
- #end
- </tr>
- </table>
+ #set( $programStageInstances = $programInstance.programStageInstances )
+ #parse( "/dhis-web-caseentry/programStageInstanceFlow.vm" )
</div>
</div>
#end
@@ -171,21 +157,8 @@
</table>
<div class='event-flow-dashboard'>
- <table>
- <tr>
- #foreach( $programStageInstance in $programInstance.programStageInstances )
- <td>
- <img src='images/rightarrow.png'>
- </td>
- <td><input type='button' id='ps_$programStageInstance.id' name='programStageBtn' class='stage-object' value='$programStageInstance.programStage.name $format.formatDate( $programStageInstance.dueDate )'
- onclick='javascript:loadProgramStageRecords($programStageInstance.id, $programInstance.completed );'></td>
- <script>
- var status = $statusMap.get( $programStageInstance.id );
- setEventColorStatus( 'ps_' + $programStageInstance.id ,status);
- </script>
- #end
- </tr>
- </table>
+ #set( $programStageInstances = $programInstance.programStageInstances )
+ #parse( "/dhis-web-caseentry/programStageInstanceFlow.vm" )
</div>
</div>
#end
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/SaveDataEntryFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/SaveDataEntryFormAction.java 2012-01-11 05:31:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/SaveDataEntryFormAction.java 2012-08-14 04:37:16 +0000
@@ -133,15 +133,17 @@
// Save data-entry-form
// ---------------------------------------------------------------------
+ designTextarea = dataEntryFormService.prepareDataEntryFormForSave( designTextarea );
+
if ( dataEntryForm == null )
{
- dataEntryForm = new DataEntryForm( name, dataEntryFormService.prepareDataEntryFormForSave( designTextarea ) );
+ dataEntryForm = new DataEntryForm( name, designTextarea );
dataEntryFormService.addDataEntryForm( dataEntryForm );
}
else
{
dataEntryForm.setName( name );
- dataEntryForm.setHtmlCode( dataEntryFormService.prepareDataEntryFormForSave( designTextarea ) );
+ dataEntryForm.setHtmlCode( designTextarea );
dataEntryFormService.updateDataEntryForm( dataEntryForm );
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js 2012-07-31 07:09:18 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js 2012-08-14 04:37:16 +0000
@@ -148,25 +148,23 @@
var dataElementType = dataElement.type;
var htmlCode = "";
- var id = programStageId + "-" + dataElementId + "-val" ;
+ var id = programStageId + "-" + dataElementId + "-val" ;
+ var titleValue = dataElementId + " - " + dataElementName + " - " + dataElementType;
if ( dataElementType == "bool" )
{
- var titleValue = "-- " + dataElementId + "." + dataElementName + " ("+dataElementType+") --";
var displayName = dataElementName;
- htmlCode = "<input title=\"" + titleValue + "\" name=\"entryselect\" id=\"" + id + "\" value=\"" + displayName + "\" title=\"" + displayName + "\">";
+ htmlCode = "<input title=\"" + titleValue + "\" name=\"entryselect\" id=\"" + id + "\" value=\"[" + displayName + "]\" title=\"" + displayName + "\">";
}
else if ( dataElementType == "trueOnly" )
{
- var titleValue = "-- " + dataElementId + "." + dataElementName + " ("+dataElementType+") --";
var displayName = dataElementName;
htmlCode = "<input type=\"checkbox\" title=\"" + titleValue + "\" name=\"entryselect\" id=\"" + id + "\" title=\"" + displayName + "\">";
}
else
{
- var titleValue = "-- " + dataElementId + "." + dataElementName +" (" + dataElementType + ") --";
var displayName = dataElementName;
- htmlCode += "<input title=\"" + titleValue + "\" value=\"" + displayName + "\" name=\"entryfield\" id=\"" + id + "\" />";
+ htmlCode += "<input title=\"" + titleValue + "\" value=\"[" + displayName + "]\" name=\"entryfield\" id=\"" + id + "\" />";
}
if( checkExisted( id ) )