dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #35725
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18287: Fixed bug in Add/Update program indicator.
------------------------------------------------------------
revno: 18287
committer: Tran Chau<tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-02-17 00:57:07 +0700
message:
Fixed bug in Add/Update program indicator.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java
dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programIndicator.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.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/ProgramIndicator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java 2015-02-16 11:46:32 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramIndicator.java 2015-02-16 17:57:07 +0000
@@ -50,7 +50,7 @@
extends BaseNameableObject
{
public static final String SEPARATOR_ID = "\\.";
- public static final String KEY_DATAELEMENT = "\\$";
+ public static final String KEY_DATAELEMENT = "#";
public static final String KEY_ATTRIBUTE = "A";
public static final String KEY_PROGRAM_VARIABLE = "V";
public static final String KEY_CONSTANT = "C";
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java 2015-02-16 11:46:32 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramIndicatorService.java 2015-02-16 17:57:07 +0000
@@ -346,10 +346,14 @@
return ProgramIndicator.EXPRESSION_NOT_WELL_FORMED;
}
}
+ else if ( key.equals( ProgramIndicator.KEY_PROGRAM_VARIABLE ) )
+ {
+ matcher.appendReplacement( description, 0 + "" );
+ }
}
matcher.appendTail( description );
-
+
// ---------------------------------------------------------------------
// Well-formed expression
// ---------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties 2015-02-16 11:46:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/org/hisp/dhis/trackedentity/i18n_module.properties 2015-02-16 17:57:07 +0000
@@ -505,4 +505,5 @@
date_diff = Date diff
program_stage_sort_order = Program stage sort order
sort_order = Sort order
-expression_is_not_well_formed = Expression is not well-formed
\ No newline at end of file
+expression_is_not_well_formed = Expression is not well-formed
+program_variables = Program variables
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programIndicator.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programIndicator.js 2015-02-16 12:03:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programIndicator.js 2015-02-16 17:57:07 +0000
@@ -63,14 +63,14 @@
var programStageId = getFieldValue('programStageId');
var dataElementId = element.options[element.selectedIndex].value;
- insertTextCommon('expression', "${" + programStageId + "." + dataElementId + "}");
+ insertTextCommon('expression', "#{" + programStageId + "." + dataElementId + "}");
getConditionDescription();
}
-function insertAttribute( element ){
+function insertData( element, key ){
var attributeId = element.options[element.selectedIndex].value;
- insertTextCommon('expression', "A{" + attributeId + "}");
+ insertTextCommon('expression', key + "{" + attributeId + "}");
getConditionDescription();
}
@@ -94,20 +94,28 @@
}
function getConditionDescription() {
- $.postJSON('getProgramIndicatorDescripttion.action',
- {
- expression: getFieldValue('expression')
- }, function( json ) {
- if( json.response =='error' ){
- setFieldValue('checkExpression','');
- $('#aggregationDescription').css('color','red');
- }
- else{
- setFieldValue('checkExpression', json.message);
- $('#aggregationDescription').css('color','black');
- }
- setInnerHTML('aggregationDescription', json.message);
- })
+ var expression = getFieldValue('expression');
+ if( expression == '' )
+ {
+ setInnerHTML('aggregationDescription', '');
+ }
+ else
+ {
+ $.postJSON('getProgramIndicatorDescripttion.action',
+ {
+ expression: expression
+ }, function( json ) {
+ if( json.response =='error' ){
+ setFieldValue('checkExpression','');
+ $('#aggregationDescription').css('color','red');
+ }
+ else{
+ setFieldValue('checkExpression', json.message);
+ $('#aggregationDescription').css('color','black');
+ }
+ setInnerHTML('aggregationDescription', json.message);
+ });
+ }
}
function programIndicatorOnChange() {
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm 2015-02-16 12:03:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm 2015-02-16 17:57:07 +0000
@@ -1,7 +1,7 @@
<div id="tabs">
<ul>
<li><a href="#tab-1">$i18n.getString("dataelements")</a></li>
- <li><a href="#tab-2">$i18n.getString("program")</a></li>
+ <li><a href="#tab-2">$i18n.getString("program_variables")</a></li>
<li><a href="#tab-3">$i18n.getString("attributes")</a></li>
<li><a href="#tab-4">$i18n.getString("constant")</a></li>
</ul>
@@ -55,7 +55,7 @@
</tr>
<tr>
<td>
- <select id="attributes" name="attributes" size="8" style="height:120px;" ondblclick="insertAttribute(this);">
+ <select id="attributes" name="attributes" size="8" style="height:120px;" ondblclick="insertData(this,'A');">
#foreach( $programAttribute in $program.programAttributes )
#if( $programAttribute.attribute.valueType=='number' )
<option value='$programAttribute.attribute.uid'>$encoder.htmlEncode($programAttribute.attribute.displayName)</option>
@@ -80,7 +80,7 @@
</tr>
<tr>
<td>
- <select id="constants" name="constants" size="8" style="height:120px;" ondblclick="insertAttribute(this);">
+ <select id="constants" name="constants" size="8" style="height:120px;" ondblclick="insertData(this,'C');">
#foreach( $constant in $constants )
<option value='$constant.uid'>$encoder.htmlEncode($constant.displayName)</option>
#end