← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7272: DV plugin, added config option for setting name of callback method to allow for caching of data r...

 

------------------------------------------------------------
revno: 7272
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-06-11 20:09:44 +0200
message:
  DV plugin, added config option for setting name of callback method to allow for caching of data requests
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/plugin.js
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/index.html


--
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/plugin/plugin.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/plugin.js	2012-06-02 11:16:07 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/plugin.js	2012-06-11 18:09:44 +0000
@@ -625,6 +625,9 @@
 					object.organisationunitnames.push(DHIS.chart.util.string.getEncodedString(r.o[k]));
 				}
                 return object;
+            },
+            isDefined: function(variable) {
+            	return (typeof(variable) !== 'undefined'); 
             }
         }
     };
@@ -784,7 +787,7 @@
 				baseUrl = Ext.String.urlAppend(baseUrl, 'userOrganisationUnitChildren=true');
 			}
             
-            Ext.data.JsonP.request({
+            var options = {
                 url: baseUrl,
                 disableCaching: false,
                 success: function(r) {
@@ -818,7 +821,13 @@
                     DHIS.chart.state.state = project.state;
 					DHIS.chart.chart.getData(project);
                 }
-            });
+            };
+            
+            if (DHIS.chart.util.value.isDefined(project.state.conf.callbackName)) {
+            	options.callbackName = project.state.conf.callbackName;            	
+            }
+            
+            Ext.data.JsonP.request(options);
         }
     };
     

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/index.html'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/index.html	2012-05-19 17:08:08 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/index.html	2012-06-11 18:09:44 +0000
@@ -50,6 +50,7 @@
 				baseLineLabel: null,
 				domainAxisLabel: null,
 				rangeAxisLabel: null,
+				callbackName: 'chart2',
 				el: 'chart2',
 				url: url
 			});
@@ -70,7 +71,8 @@
 				targetLineValue: 80,
 				targetLineLabel: null,				
 				baseLineValue: 20,
-				baseLineLabel: null,	
+				baseLineLabel: null,
+				callbackName: 'chart3',
 				el: 'chart3',
 				url: url
 			});