dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17894
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7311: (DV) Encoding bug fixed.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 7311 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-06-15 13:43:23 +0300
message:
(DV) Encoding bug fixed.
modified:
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.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-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js 2012-06-11 13:47:28 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js 2012-06-12 19:38:35 +0000
@@ -532,7 +532,7 @@
},
{html: '<div class="window-p"></div>'},
- {html: '<div class="window-info">' + G.i18n.delete_favorite + '/' + G.i18n.add_to_dashboard +'</div>'},
+ {html: '<div class="window-info">' + G.i18n.delete_favorite + ' / ' + G.i18n.add_to_dashboard +'</div>'},
{
xtype: 'combo',
id: 'favorite_cb',
@@ -2873,7 +2873,7 @@
layout: 'anchor',
collapsible: true,
header: false,
- margins: '0 0 0 2px',
+ margins: '0 0 0 1px',
defaults: {
border: true,
frame: true,
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js 2012-06-12 12:45:33 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js 2012-06-15 10:37:57 +0000
@@ -67,7 +67,7 @@
system: {
rootnode: {
id: r.rn[0],
- name: DV.conf.util.jsonEncode(r.rn[1]),
+ name: DV.conf.util.jsonEncodeString(r.rn[1]),
level: 1
},
periods: {},
@@ -78,13 +78,13 @@
isadmin: r.user.isAdmin,
organisationunit: {
id: r.user.ou[0],
- name: DV.conf.util.jsonEncode(r.user.ou[1])
+ name: DV.conf.util.jsonEncodeString(r.user.ou[1])
},
organisationunitchildren: []
}
};
for (var i = 0; i < r.user.ouc.length; i++) {
- obj.user.organisationunitchildren.push({id: r.user.ouc[i][0], name: DV.conf.util.jsonEncode(r.user.ouc[i][1])});
+ obj.user.organisationunitchildren.push({id: r.user.ouc[i][0], name: DV.conf.util.jsonEncodeString(r.user.ouc[i][1])});
}
return obj;
}
@@ -105,7 +105,7 @@
indicator_getall: 'indicators.json?paging=false&links=false',
indicatorgroup_get: 'indicatorGroups.json?paging=false&links=false',
dataelement_get: 'dataElementGroups/',
- dataelement_getall: 'dataelements.json?paging=false&links=false',
+ dataelement_getall: 'dataElements.json?paging=false&links=false',
dataelementgroup_get: 'dataElementGroups.json?paging=false&links=false',
dataset_get: 'dataSets.json?paging=false&links=false',
organisationunitgroupset_get: 'getOrganisationUnitGroupSetsMinified.action',
@@ -241,8 +241,14 @@
multiselect_fill_reportingrates: 315
},
util: {
- jsonEncode: function(str) {
- return str.replace(/[^a-zA-Z 0-9(){}<>_!+;:?*&%#-]+/g,'');
+ jsonEncodeString: function(str) {
+ return typeof str === 'string' ? str.replace(/[^a-zA-Z 0-9(){}<>_!+;:?*&%#-]+/g,'') : str;
+ },
+ jsonEncodeArray: function(a) {
+ for (var i = 0; i < a.length; i++) {
+ a[i] = DV.conf.util.jsonEncodeString(a[i]);
+ }
+ return a;
}
}
};
@@ -1174,14 +1180,11 @@
var a = [];
for (var i = 0; i < values.length; i++) {
var v = {
- value: parseFloat(values[i][0]),
- data: values[i][1],
- period: values[i][2],
- organisationunit: values[i][3]
+ value: DV.conf.util.jsonEncodeString(parseFloat(values[i][0])),
+ data: DV.conf.util.jsonEncodeString(values[i][1]),
+ period: DV.conf.util.jsonEncodeString(values[i][2]),
+ organisationunit: DV.conf.util.jsonEncodeString(values[i][3])
};
- //if (DV.util.variable.isNotEmpty(r[i][5])) {
- //v.organisationunitgroupid = r[i][5];
- //}
a.push(v);
}
return a;
@@ -1295,7 +1298,7 @@
listeners: {
load: function(s) {
s.each( function(r) {
- r.data.name = DV.conf.util.jsonEncode(r.data.name);
+ r.data.name = DV.conf.util.jsonEncodeString(r.data.name);
});
DV.util.store.addToStorage(s);
DV.util.multiselect.filterAvailable(DV.cmp.dimension.indicator.available, DV.cmp.dimension.indicator.selected);
@@ -1322,7 +1325,7 @@
listeners: {
load: function(s) {
s.each( function(r) {
- r.data.name = DV.conf.util.jsonEncode(r.data.name);
+ r.data.name = DV.conf.util.jsonEncodeString(r.data.name);
});
DV.util.store.addToStorage(s);
DV.util.multiselect.filterAvailable(DV.cmp.dimension.dataelement.available, DV.cmp.dimension.dataelement.selected);
@@ -1351,7 +1354,7 @@
load: function(s) {
this.isloaded = true;
s.each( function(r) {
- r.data.name = DV.conf.util.jsonEncode(r.data.name);
+ r.data.name = DV.conf.util.jsonEncodeString(r.data.name);
});
DV.util.store.addToStorage(s);
DV.util.multiselect.filterAvailable(DV.cmp.dimension.dataset.available, DV.cmp.dimension.dataset.selected);
@@ -1499,23 +1502,23 @@
if (f.indicators) {
for (var i = 0; i < f.indicators.length; i++) {
- DV.c.indicator.objects.push({id: f.indicators[i].id, name: DV.conf.util.jsonEncode(f.indicators[i].name)});
+ DV.c.indicator.objects.push({id: f.indicators[i].id, name: DV.conf.util.jsonEncodeString(f.indicators[i].name)});
}
}
if (f.dataElements) {
for (var i = 0; i < f.dataElements.length; i++) {
- DV.c.dataelement.objects.push({id: f.dataElements[i].id, name: DV.conf.util.jsonEncode(f.dataElements[i].name)});
+ DV.c.dataelement.objects.push({id: f.dataElements[i].id, name: DV.conf.util.jsonEncodeString(f.dataElements[i].name)});
}
}
if (f.dataSets) {
for (var i = 0; i < f.dataSets.length; i++) {
- DV.c.dataset.objects.push({id: f.dataSets[i].id, name: DV.conf.util.jsonEncode(f.dataSets[i].name)});
+ DV.c.dataset.objects.push({id: f.dataSets[i].id, name: DV.conf.util.jsonEncodeString(f.dataSets[i].name)});
}
}
DV.c.period.rp = f.relativePeriods;
for (var i = 0; i < f.organisationUnits.length; i++) {
- DV.c.organisationunit.objects.push({id: f.organisationUnits[i].id, name: DV.conf.util.jsonEncode(f.organisationUnits[i].name)});
+ DV.c.organisationunit.objects.push({id: f.organisationUnits[i].id, name: DV.conf.util.jsonEncodeString(f.organisationUnits[i].name)});
}
DV.c.organisationunit.groupsetid = f.organisationUnitGroupSet ? f.organisationUnitGroupSet.id : null;
@@ -1939,9 +1942,9 @@
DV.value.values = DV.util.value.jsonfy(r.v);
- DV.c.data.names = r.d;
- DV.c.period.names = r.p;
- DV.c.organisationunit.names = r.o;
+ DV.c.data.names = DV.conf.util.jsonEncodeArray(r.d);
+ DV.c.period.names = DV.conf.util.jsonEncodeArray(r.p);
+ DV.c.organisationunit.names = DV.conf.util.jsonEncodeArray(r.o);
if (exe) {
DV.chart.getData(true);
@@ -3222,7 +3225,7 @@
listeners: {
load: function(s, node, r) {
for (var i = 0; i < r.length; i++) {
- r[i].data.text = DV.conf.util.jsonEncode(r[i].data.text);
+ r[i].data.text = DV.conf.util.jsonEncodeString(r[i].data.text);
}
}
}