dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15077
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5302: (DV) 'Initialize' server response minimised.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 5302 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-12-06 13:09:19 +0100
message:
(DV) 'Initialize' server response minimised.
modified:
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/jsonInitialize.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-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 2011-12-06 11:09:30 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js 2011-12-06 12:06:06 +0000
@@ -5,7 +5,20 @@
{x: 'Category 1', 'Series 1': 41, 'Series 2': 69, 'Series 3': 63, 'Series 4': 51},
{x: 'Category 2', 'Series 1': 51, 'Series 2': 42, 'Series 3': 58, 'Series 4': 52},
{x: 'Category 3', 'Series 1': 44, 'Series 2': 71, 'Series 3': 62, 'Series 4': 54}
- ]
+ ],
+ jsonfy: function(r) {
+ r = Ext.JSON.decode(r.responseText);
+ var obj = {system: {rootNode: {id: r.rn[0], name: r.rn[1], level: 1}, periods: {}}};
+ var keys1 = ['lastMonth', 'monthsThisYear', 'monthsLastYear', 'lastQuarter', 'quartersThisYear', 'quartersLastYear', 'thisYear', 'lastYear', 'lastFiveYears'];
+ var keys2 = ['lm', 'mty', 'mly', 'lq', 'qty', 'qly', 'ty', 'ly', 'lfy'];
+ for (var i = 0; i < keys1.length; i++) {
+ obj.system.periods[keys1[i]] = [];
+ for (var j = 0; j < r.p[keys2[i]].length; j++) {
+ obj.system.periods[keys1[i]].push({id: r.p[keys2[i]][j][0], name: r.p[keys2[i]][j][1]});
+ }
+ }
+ return obj;
+ }
},
finals: {
ajax: {
@@ -84,7 +97,7 @@
url: DV.conf.finals.ajax.url_visualizer + 'initialize.action',
success: function(r) {
- DV.init = Ext.JSON.decode(r.responseText);
+ DV.init = DV.conf.init.jsonfy(r);
DV.init.isInit = true;
DV.init.initialize = function() {
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonInitialize.vm'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonInitialize.vm 2011-10-27 13:39:17 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonInitialize.vm 2011-12-06 12:06:06 +0000
@@ -1,1 +1,1 @@
-{"system":{"rootNode":{"id":"$!{rootNode.id}","name":"$!encoder.jsonEncode(${rootNode.name})","level":1},"periods":{"lastMonth":[#foreach($period in $lastMonth){"id":"$!{period.id}","name":"$!encoder.jsonEncode(${period.name})"}#if($velocityCount<$lastMonth.size()),#end#end],"monthsThisYear":[#foreach($period in $monthsThisYear){"id":"$!{period.id}","name":"$!encoder.jsonEncode(${period.name})"}#if($velocityCount<$monthsThisYear.size()),#end#end],"monthsLastYear":[#foreach($period in $monthsLastYear){"id":"$!{period.id}","name":"$!encoder.jsonEncode(${period.name})"}#if($velocityCount<$monthsLastYear.size()),#end#end],"lastQuarter":[#foreach($period in $lastQuarter){"id":"$!{period.id}","name":"$!encoder.jsonEncode(${period.name})"}#if($velocityCount<$lastQuarter.size()),#end#end],"quartersThisYear":[#foreach($period in $quartersThisYear){"id":"$!{period.id}","name":"$!encoder.jsonEncode(${period.name})"}#if($velocityCount<$quartersThisYear.size()),#end#end],"quartersLastYear":[#foreach($period in $quartersLastYear){"id":"$!{period.id}","name":"$!encoder.jsonEncode(${period.name})"}#if($velocityCount<$quartersLastYear.size()),#end#end],"thisYear":[#foreach($period in $thisYear){"id":"$!{period.id}","name":"$!encoder.jsonEncode(${period.name})"}#if($velocityCount<$thisYear.size()),#end#end],"lastYear":[#foreach($period in $lastYear){"id":"$!{period.id}","name":"$!encoder.jsonEncode(${period.name})"}#if($velocityCount<$lastYear.size()),#end#end],"lastFiveYears":[#foreach($period in $lastFiveYears){"id":"$!{period.id}","name":"$!encoder.jsonEncode(${period.name})"}#if($velocityCount<$lastFiveYears.size()),#end#end]}}}
\ No newline at end of file
+{"rn":["$!{rootNode.id}","$!encoder.jsonEncode(${rootNode.name})"],"p":{"lm":[#foreach($p in $lastMonth)["$!{p.id}","$!encoder.jsonEncode(${p.name})"]#if($velocityCount<$lastMonth.size()),#end#end],"mty":[#foreach($p in $monthsThisYear)["$!{p.id}","$!encoder.jsonEncode(${p.name})"]#if($velocityCount<$monthsThisYear.size()),#end#end],"mly":[#foreach($p in $monthsLastYear)["$!{p.id}","$!encoder.jsonEncode(${p.name})"]#if($velocityCount<$monthsLastYear.size()),#end#end],"lq":[#foreach($p in $lastQuarter)["$!{p.id}","$!encoder.jsonEncode(${p.name})"]#if($velocityCount<$lastQuarter.size()),#end#end],"qty":[#foreach($p in $quartersThisYear)["$!{p.id}","$!encoder.jsonEncode(${p.name})"]#if($velocityCount<$quartersThisYear.size()),#end#end],"qly":[#foreach($p in $quartersLastYear)["$!{p.id}","$!encoder.jsonEncode(${p.name})"]#if($velocityCount<$quartersLastYear.size()),#end#end],"ty":[#foreach($p in $thisYear)["$!{p.id}","$!encoder.jsonEncode(${p.name})"]#if($velocityCount<$thisYear.size()),#end#end],"ly":[#foreach($p in $lastYear)["$!{p.id}","$!encoder.jsonEncode(${p.name})"]#if($velocityCount<$lastYear.size()),#end#end],"lfy":[#foreach($p in $lastFiveYears)["$!{p.id}","$!encoder.jsonEncode(${p.name})"]#if($velocityCount<$lastFiveYears.size()),#end#end]}}
\ No newline at end of file