dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41514
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21148: Minor fix
------------------------------------------------------------
revno: 21148
committer: Markus Bekken <markus.bekken@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-11-20 23:46:15 +0100
message:
Minor fix
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.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-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js 2015-11-18 21:57:07 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js 2015-11-20 22:46:15 +0000
@@ -1079,19 +1079,18 @@
var replaceVariables = function(expression, variablesHash){
//replaces the variables in an expression with actual variable values.
- //Check if the expression contains program rule variables at all(any dollar signs):
- if(expression.indexOf('#{') !== -1) {
+ //Check if the expression contains program rule variables at all(any curly braces):
+ if(expression.indexOf('{') !== -1) {
//Find every variable name in the expression;
- var variablespresent = expression.match(/#{\w+.?\w*}/g);
+ var variablespresent = expression.match(/[A#CV]{\w+.?\w*}/g);
//Replace each matched variable:
angular.forEach(variablespresent, function(variablepresent) {
//First strip away any prefix and postfix signs from the variable name:
- variablepresent = variablepresent.replace("#{","").replace("}","");
+ variablepresent = variablepresent.replace("#{","").replace("A{","").replace("C{","").replace("V{","").replace("}","");
- if(angular.isDefined(variablesHash[variablepresent]) &&
- variablesHash[variablepresent].variablePrefix === '#') {
+ if(angular.isDefined(variablesHash[variablepresent])) {
//Replace all occurrences of the variable name(hence using regex replacement):
- expression = expression.replace(new RegExp("#{" + variablepresent + "}", 'g'),
+ expression = expression.replace(new RegExp( variablesHash[variablepresent].variablePrefix + "{" + variablepresent + "}", 'g'),
variablesHash[variablepresent].variableValue);
}
else {