dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17481
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6969: Added method getUrl to table plugin for getting URL to dynamic report table data
------------------------------------------------------------
revno: 6969
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-05-16 23:52:29 +0200
message:
Added method getUrl to table plugin for getting URL to dynamic report table data
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
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/plugin.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/plugin/plugin.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/plugin.js 2012-05-16 12:56:16 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/plugin/plugin.js 2012-05-16 21:52:29 +0000
@@ -1078,7 +1078,8 @@
/* TABLE */
DHIS.table.finals = {
- dataGet: 'api/reportTables/data.jsonp?minimal=true',
+ tableDataGet: 'api/reportTables/data.jsonp?minimal=true',
+ dynamicDataGet: 'api/reportTables/data',
data: 'data',
periods: 'periods',
orgunits: 'orgunits',
@@ -1094,6 +1095,7 @@
orgUnitIsParent: false,
hiddenCols: [],
useExtGrid: false,
+ format: 'html',
el: '',
url: ''
}
@@ -1113,10 +1115,8 @@
DHIS.table.tables[el].destroy();
}
},
- getDataUrl: function(conf) {
- var url = conf.url + DHIS.table.finals.dataGet;
-
- Ext.Array.each(conf.indicators, function(item) {
+ getDataQuery: function(conf,url) {
+ Ext.Array.each(conf.indicators, function(item) {
url = Ext.String.urlAppend(url, 'in=' + item);
});
Ext.Array.each(conf.dataelements, function(item) {
@@ -1135,7 +1135,16 @@
url = Ext.String.urlAppend(url, 'crosstab=' + item);
});
url = DHIS.table.utils.appendUrlIfTrue(url, DHIS.table.finals.orgUnitIsParent, conf.orgUnitIsParent);
+
return url;
+ },
+ getTableDataUrl: function(conf) {
+ var url = conf.url + DHIS.table.finals.tableDataGet;
+ return this.getDataQuery(conf, url);
+ },
+ getDynamicDataUrl: function(conf) {
+ var url = conf.url + DHIS.table.finals.dynamicDataGet + '.' + conf.format;
+ return this.getDataQuery(conf, url);
}
};
@@ -1166,7 +1175,7 @@
render: function(conf) {
DHIS.table.utils.destroy(conf.el);
Ext.data.JsonP.request({
- url: DHIS.table.utils.getDataUrl(conf),
+ url: DHIS.table.utils.getTableDataUrl(conf),
disableCaching: false,
success: function(data) {
DHIS.table.tables[conf.el] = Ext.create('Ext.grid.Panel', {
@@ -1206,7 +1215,7 @@
},
render: function(conf) {
Ext.data.JsonP.request({
- url: DHIS.table.utils.getDataUrl(conf),
+ url: DHIS.table.utils.getTableDataUrl(conf),
disableCaching: false,
success: function(data) {
var html = DHIS.table.plain.getMarkup(data);
@@ -1219,13 +1228,18 @@
DHIS.table.impl = {
render: function(conf) {
conf = Ext.applyIf(conf, DHIS.table.finals.defaultConf);
- if ( conf.useExtGrid ) {
+ if (conf.useExtGrid) {
DHIS.table.grid.render(conf);
}
else {
DHIS.table.plain.render(conf);
}
+ },
+ getUrl: function(conf) {
+ conf = Ext.applyIf(conf, DHIS.table.finals.defaultConf);
+ return DHIS.table.utils.getDynamicDataUrl(conf);
}
}
DHIS.getTable = DHIS.table.impl.render;
+DHIS.getUrl = DHIS.table.impl.getUrl;
\ No newline at end of file
=== 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-16 12:56:16 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/index.html 2012-05-16 21:52:29 +0000
@@ -74,6 +74,18 @@
el: 'table2',
url: url
});
+
+ var url1 = DHIS.getUrl({
+ indicators: ['OdiHJayrsKo'],
+ periods: ['last12Months'],
+ orgunits: ['ImspTQPwCqd'],
+ crosstab: ['periods'],
+ orgUnitIsParent: true,
+ format: 'pdf',
+ url: url
+ });
+
+ Ext.get('url1').update(url1);
});
</script>
@@ -119,5 +131,8 @@
<h1>My table 2</h1>
<div id="table2"></div>
+
+ <h1>My URL</h1>
+ <div id="url1"></div>
</body>
</html>
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/plugin.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/plugin.js 2012-05-16 12:56:16 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/plugin/plugin.js 2012-05-16 21:52:29 +0000
@@ -1078,7 +1078,8 @@
/* TABLE */
DHIS.table.finals = {
- dataGet: 'api/reportTables/data.jsonp?minimal=true',
+ tableDataGet: 'api/reportTables/data.jsonp?minimal=true',
+ dynamicDataGet: 'api/reportTables/data',
data: 'data',
periods: 'periods',
orgunits: 'orgunits',
@@ -1094,6 +1095,7 @@
orgUnitIsParent: false,
hiddenCols: [],
useExtGrid: false,
+ format: 'html',
el: '',
url: ''
}
@@ -1113,10 +1115,8 @@
DHIS.table.tables[el].destroy();
}
},
- getDataUrl: function(conf) {
- var url = conf.url + DHIS.table.finals.dataGet;
-
- Ext.Array.each(conf.indicators, function(item) {
+ getDataQuery: function(conf,url) {
+ Ext.Array.each(conf.indicators, function(item) {
url = Ext.String.urlAppend(url, 'in=' + item);
});
Ext.Array.each(conf.dataelements, function(item) {
@@ -1135,7 +1135,16 @@
url = Ext.String.urlAppend(url, 'crosstab=' + item);
});
url = DHIS.table.utils.appendUrlIfTrue(url, DHIS.table.finals.orgUnitIsParent, conf.orgUnitIsParent);
+
return url;
+ },
+ getTableDataUrl: function(conf) {
+ var url = conf.url + DHIS.table.finals.tableDataGet;
+ return this.getDataQuery(conf, url);
+ },
+ getDynamicDataUrl: function(conf) {
+ var url = conf.url + DHIS.table.finals.dynamicDataGet + '.' + conf.format;
+ return this.getDataQuery(conf, url);
}
};
@@ -1166,7 +1175,7 @@
render: function(conf) {
DHIS.table.utils.destroy(conf.el);
Ext.data.JsonP.request({
- url: DHIS.table.utils.getDataUrl(conf),
+ url: DHIS.table.utils.getTableDataUrl(conf),
disableCaching: false,
success: function(data) {
DHIS.table.tables[conf.el] = Ext.create('Ext.grid.Panel', {
@@ -1206,7 +1215,7 @@
},
render: function(conf) {
Ext.data.JsonP.request({
- url: DHIS.table.utils.getDataUrl(conf),
+ url: DHIS.table.utils.getTableDataUrl(conf),
disableCaching: false,
success: function(data) {
var html = DHIS.table.plain.getMarkup(data);
@@ -1219,13 +1228,18 @@
DHIS.table.impl = {
render: function(conf) {
conf = Ext.applyIf(conf, DHIS.table.finals.defaultConf);
- if ( conf.useExtGrid ) {
+ if (conf.useExtGrid) {
DHIS.table.grid.render(conf);
}
else {
DHIS.table.plain.render(conf);
}
+ },
+ getUrl: function(conf) {
+ conf = Ext.applyIf(conf, DHIS.table.finals.defaultConf);
+ return DHIS.table.utils.getDynamicDataUrl(conf);
}
}
DHIS.getTable = DHIS.table.impl.render;
+DHIS.getUrl = DHIS.table.impl.getUrl;
\ No newline at end of file