dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21701
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10347: (DV, PT) Report params + Relperiod/favorite issues fixed.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 10347 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-03-20 12:18:33 +0100
message:
(DV, PT) Report params + Relperiod/favorite issues fixed.
modified:
dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js
dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/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-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2013-03-19 17:04:42 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2013-03-20 11:04:55 +0000
@@ -1060,7 +1060,7 @@
delete favorite.showSubTotals;
favorite.reportParams = {
- paramReportingMonth: favorite.reportingPeriod,
+ paramReportingPeriod: favorite.reportingPeriod,
paramOrganisationUnit: favorite.organisationUnit,
paramParentOrganisationUnit: favorite.parentOrganisationUnit
};
@@ -3859,7 +3859,7 @@
pt.viewport.digitGroupSeparator.setValue(r.digitGroupSeparator);
if (Ext.isObject(r.reportParams)) {
- pt.viewport.reportingPeriod.setValue(r.reportParams.paramReportingMonth);
+ pt.viewport.reportingPeriod.setValue(r.reportParams.paramReportingPeriod);
pt.viewport.organisationUnit.setValue(r.reportParams.paramOrganisationUnit);
pt.viewport.parentOrganisationUnit.setValue(r.reportParams.paramParentOrganisationUnit);
}
=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2013-03-19 16:36:51 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2013-03-20 11:04:55 +0000
@@ -741,7 +741,7 @@
header.index = i;
if (header.meta) {
- header.items = header.name === pt.conf.finals.dimension.period.dimensionName ? [].concat(response.periods) : xLayout.nameItemsMap[header.name];
+ header.items = header.name === pt.conf.finals.dimension.period.dimensionName ? [].concat(response.metaData.periods) : xLayout.nameItemsMap[header.name];
header.size = header.items.length;
}
}
@@ -1086,7 +1086,7 @@
type: 'dimension',
cls: 'pivot-dim',
colSpan: colSpan,
- htmlValue: xResponse.metaData[id]
+ htmlValue: xResponse.metaData.names[id]
}));
if (doSubTotals(xColAxis) && i === 0) {
@@ -1152,7 +1152,7 @@
obj.cls = 'pivot-dim td-nobreak';
obj.noBreak = true;
obj.hidden = !(obj.rowSpan || obj.colSpan);
- obj.htmlValue = xResponse.metaData[obj.id];
+ obj.htmlValue = xResponse.metaData.names[obj.id];
row.push(obj);
}
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js 2013-03-20 09:35:04 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js 2013-03-20 10:28:28 +0000
@@ -190,49 +190,23 @@
},
period: {
relativePeriods: {
- 'LAST_WEEK': 1,
- 'LAST_4_WEEKS': 4,
- 'LAST_12_WEEKS': 12,
- 'LAST_MONTH': 1,
- 'LAST_3_MONTHS': 3,
- 'LAST_12_MONTHS': 12,
- 'LAST_QUARTER': 1,
- 'LAST_4_QUARTERS': 4,
- 'LAST_SIX_MONTH': 1,
- 'LAST_2_SIXMONTHS': 2,
- 'THIS_YEAR': 1,
- 'LAST_YEAR': 1,
- 'LAST_5_YEARS': 5
- },
- relativePeriodValueKeys: {
- 'LAST_WEEK': 'lastWeek',
- 'LAST_4_WEEKS': 'last4Weeks',
- 'LAST_12_WEEKS': 'last12Weeks',
- 'LAST_MONTH': 'reportingMonth',
- 'LAST_3_MONTHS': 'last3Months',
- 'LAST_12_MONTHS': 'last12Months',
- 'LAST_QUARTER': 'reportingQuarter',
- 'LAST_4_QUARTERS': 'last4Quarters',
- 'LAST_SIX_MONTH': 'lastSixMonth',
- 'LAST_2_SIXMONTHS': 'last2SixMonths',
- 'THIS_YEAR': 'thisYear',
- 'LAST_YEAR': 'lastYear',
- 'LAST_5_YEARS': 'last5Years'
- },
- relativePeriodParamKeys: {
- 'lastWeek': 'LAST_WEEK',
- 'last4Weeks': 'LAST_4_WEEKS',
- 'last12Weeks': 'LAST_12_WEEKS',
- 'reportingMonth': 'LAST_MONTH',
- 'last3Months': 'LAST_3_MONTHS',
- 'last12Months': 'LAST_12_MONTHS',
- 'reportingQuarter': 'LAST_QUARTER',
- 'last4Quarters': 'LAST_4_QUARTERS',
- 'lastSixMonth': 'LAST_SIX_MONTH',
- 'last2SixMonths': 'LAST_2_SIXMONTHS',
- 'thisYear': 'THIS_YEAR',
- 'lastYear': 'LAST_YEAR',
- 'last5Years': 'LAST_5_YEARS'
+ 'lastWeek': 1,
+ 'last4Weeks': 4,
+ 'last12Weeks': 12,
+ 'lastMonth': 1,
+ 'last3Months': 3,
+ 'last12Months': 12,
+ 'lastQuarter': 1,
+ 'last4Quarters': 4,
+ 'lastSixMonth': 1,
+ 'last2SixMonths': 2,
+ 'thisYear': 1,
+ 'lastYear': 1,
+ 'last5Years': 5
+ },
+ relativePeriodsUrl: {
+ 'lastMonth': 'reportingMonth',
+ 'lastQuarter': 'reportingQuarter'
},
periodtypes: [
{id: 'Daily', name: 'Daily'},
@@ -613,7 +587,7 @@
count = 0;
for (var key in rp) {
if (rp[key]) {
- count += DV.conf.period.relativePeriods[key] || DV.conf.period.relativePeriods[DV.conf.period.relativePeriodParamKeys[key]];
+ count += DV.conf.period.relativePeriods[key];
}
}
for (var i = 0; i < count; i++) {
@@ -673,8 +647,9 @@
rp = DV.c.relativeperiod.rp,
param;
for (var key in rp) {
- if (rp[key]) {
- a.push((DV.conf.period.relativePeriodValueKeys[key] || key) + '=true');
+ if (rp.hasOwnProperty(key) && rp[key]) {
+ key = DV.conf.period.relativePeriodsUrl[key] ? DV.conf.period.relativePeriodsUrl[key] : key;
+ a.push(key + '=true');
}
}
@@ -1204,7 +1179,7 @@
setRelativePeriods: function(rp) {
if (rp) {
for (var key in rp) {
- var cmp = DV.util.getCmp('checkbox[relativePeriodId="' + (DV.conf.period.relativePeriodParamKeys[key] || key) + '"]');
+ var cmp = DV.util.getCmp('checkbox[relativePeriodId="' + key + '"]');
if (cmp) {
cmp.setValue(rp[key]);
}
@@ -1705,11 +1680,6 @@
}
if (f.relativePeriods) {
- f.relativePeriods.reportingMonth = f.relativePeriods.lastMonth;
- f.relativePeriods.reportingQuarter = f.relativePeriods.lastQuarter;
- delete f.relativePeriods.lastMonth;
- delete f.relativePeriods.lastQuarter;
-
DV.c.relativeperiod.rp = f.relativePeriods;
DV.c.relativeperiod.rewind = f.rewindRelativePeriods;
}
@@ -1900,22 +1870,25 @@
DV.store.indicator.selected.removeAll();
if (DV.c.indicator.records) {
- DV.store.indicator.selected.add(DV.c.indicator.records);
- DV.util.store.addToStorage(DV.store.indicator.available, DV.c.indicator.records);
+ var clone = Ext.clone(DV.c.indicator.records);
+ DV.store.indicator.selected.add(clone);
+ DV.util.store.addToStorage(DV.store.indicator.available, clone);
DV.util.multiselect.filterAvailable(DV.cmp.dimension.indicator.available, DV.cmp.dimension.indicator.selected);
}
DV.store.dataelement.selected.removeAll();
if (DV.c.dataelement.records) {
- DV.store.dataelement.selected.add(DV.c.dataelement.records);
- DV.util.store.addToStorage(DV.store.dataelement.available, DV.c.dataelement.records);
+ var clone = Ext.clone(DV.c.dataelement.records);
+ DV.store.dataelement.selected.add(clone);
+ DV.util.store.addToStorage(DV.store.dataelement.available, clone);
DV.util.multiselect.filterAvailable(DV.cmp.dimension.dataelement.available, DV.cmp.dimension.dataelement.selected);
}
DV.store.dataset.selected.removeAll();
if (DV.c.dataset.records) {
- DV.store.dataset.selected.add(DV.c.dataset.records);
- DV.util.store.addToStorage(DV.store.dataset.available, DV.c.dataset.records);
+ var clone = Ext.clone(DV.c.dataset.records);
+ DV.store.dataset.selected.add(clone);
+ DV.util.store.addToStorage(DV.store.dataset.available, clone);
DV.util.multiselect.filterAvailable(DV.cmp.dimension.dataset.available, DV.cmp.dimension.dataset.selected);
}
@@ -1925,7 +1898,8 @@
DV.store.fixedperiod.selected.removeAll();
if (DV.c.fixedperiod.records) {
- DV.store.fixedperiod.selected.add(DV.c.fixedperiod.records);
+ var clone = Ext.clone(DV.c.fixedperiod.records);
+ DV.store.fixedperiod.selected.add(clone);
DV.util.multiselect.filterAvailable(DV.cmp.dimension.fixedperiod.available, DV.cmp.dimension.fixedperiod.selected);
}
@@ -2669,8 +2643,8 @@
favorite.regression = DV.c.trendline;
favorite.userOrganisationUnit = DV.c.userorganisationunit;
favorite.userOrganisationUnitChildren = DV.c.userorganisationunitchildren;
-
- // Options
+
+ // Options
if (DV.c.domainaxislabel) {
favorite.domainAxisLabel = DV.c.domainaxislabel;
}
@@ -2692,22 +2666,42 @@
// Indicators
if (Ext.isObject(DV.c.indicator) && Ext.isArray(DV.c.indicator.records) && DV.c.indicator.records.length) {
- favorite.indicators = Ext.clone(DV.c.indicator.records);
+ favorite.indicators = [];
+
+ for (var i = 0, r; i < DV.c.indicator.records.length; i++) {
+ r = Ext.clone(DV.c.indicator.records[i]);
+ favorite.indicators.push({id: r.id, name: r.name});
+ }
}
// Data elements
if (Ext.isObject(DV.c.dataelement) && Ext.isArray(DV.c.dataelement.records) && DV.c.dataelement.records.length) {
- favorite.dataElements = Ext.clone(DV.c.dataelement.records);
+ favorite.dataElements = [];
+
+ for (var i = 0, r; i < DV.c.dataelement.records.length; i++) {
+ r = Ext.clone(DV.c.dataelement.records[i]);
+ favorite.dataElements.push({id: r.id, name: r.name});
+ }
}
// Data sets
if (Ext.isObject(DV.c.dataset) && Ext.isArray(DV.c.dataset.records) && DV.c.dataset.records.length) {
- favorite.dataSets = Ext.clone(DV.c.dataset.records);
+ favorite.dataSets = [];
+
+ for (var i = 0, r; i < DV.c.dataset.records.length; i++) {
+ r = Ext.clone(DV.c.dataset.records[i]);
+ favorite.dataSets.push({id: r.id, name: r.name});
+ }
}
// Fixed periods
if (Ext.isObject(DV.c.fixedperiod) && Ext.isArray(DV.c.fixedperiod.records) && DV.c.fixedperiod.records.length) {
- favorite.periods = Ext.clone(DV.c.fixedperiod.records);
+ favorite.periods = [];
+
+ for (var i = 0, r; i < DV.c.period.records.length; i++) {
+ r = Ext.clone(DV.c.period.records[i]);
+ favorite.periods.push({id: r.id, name: r.name});
+ }
}
// Relative periods
@@ -2719,7 +2713,7 @@
if (Ext.isObject(DV.c.relativeperiod.rp)) {
for (var key in DV.c.relativeperiod.rp) {
if (DV.c.relativeperiod.rp.hasOwnProperty(key) && !!DV.c.relativeperiod.rp[key]) {
- favorite.relativePeriods[DV.conf.period.relativePeriodValueKeys[key]] = true;
+ favorite.relativePeriods[key] = true;
}
}
}
@@ -2762,7 +2756,7 @@
text: 'Create', //i18n
handler: function() {
var favorite = getBody();
- favorite.name = nameTextfield.getValue ();
+ favorite.name = nameTextfield.getValue();
if (favorite && favorite.name) {
Ext.Ajax.request({
@@ -2777,12 +2771,12 @@
success: function(r) {
var id = r.getAllResponseHeaders().location.split('/').pop();
- //pt.favorite = favorite;
-
+ DV.c.currentFavorite = {
+ id: id,
+ name: favorite.name
+ };
+ DV.cmp.toolbar.share.xable();
DV.store.favorite.loadStore();
-
- //pt.viewport.interpretationButton.enable();
-
window.destroy();
}
});
@@ -3004,8 +2998,11 @@
headers: {'Content-Type': 'application/json'},
params: Ext.encode(favorite),
success: function() {
- //pt.favorite = favorite;
DV.cmp.toolbar.share.enable();
+ DV.c.currentFavorite = {
+ id: record.data.id,
+ name: favorite.name
+ };
DV.store.favorite.loadStore();
}
});
@@ -3056,7 +3053,7 @@
if (confirm(message)) {
Ext.Ajax.request({
- url: pt.baseUrl + '/api/charts/' + record.data.id,
+ url: DV.init.contextPath + '/api/charts/' + record.data.id,
method: 'DELETE',
success: function() {
DV.store.favorite.loadStore();
@@ -3254,6 +3251,7 @@
fieldLabel: isPublicAccess ? 'Public access' : obj.name, //i18n
labelStyle: 'color:#333',
cls: 'pt-combo',
+ fieldStyle: 'padding-left:5px',
width: 380,
labelWidth: 250,
queryMode: 'local',
@@ -4327,17 +4325,17 @@
},
{
xtype: 'checkbox',
- relativePeriodId: 'LAST_WEEK',
+ relativePeriodId: 'lastWeek',
boxLabel: 'Last week', //i18n pt.i18n.last_month
},
{
xtype: 'checkbox',
- relativePeriodId: 'LAST_4_WEEKS',
+ relativePeriodId: 'last4Weeks',
boxLabel: 'Last 4 weeks', //i18n pt.i18n.last_3_months
},
{
xtype: 'checkbox',
- relativePeriodId: 'LAST_12_WEEKS',
+ relativePeriodId: 'last12Weeks',
boxLabel: 'Last 12 weeks' //i18n pt.i18n.last_12_months,
}
]
@@ -4368,17 +4366,17 @@
},
{
xtype: 'checkbox',
- relativePeriodId: 'LAST_MONTH',
+ relativePeriodId: 'lastMonth',
boxLabel: DV.i18n.last_month
},
{
xtype: 'checkbox',
- relativePeriodId: 'LAST_3_MONTHS',
+ relativePeriodId: 'last3Months',
boxLabel: DV.i18n.last_3_months
},
{
xtype: 'checkbox',
- relativePeriodId: 'LAST_12_MONTHS',
+ relativePeriodId: 'last12Months',
boxLabel: DV.i18n.last_12_months,
checked: true
}
@@ -4410,12 +4408,12 @@
},
{
xtype: 'checkbox',
- relativePeriodId: 'LAST_QUARTER',
+ relativePeriodId: 'lastQuarter',
boxLabel: DV.i18n.last_quarter
},
{
xtype: 'checkbox',
- relativePeriodId: 'LAST_4_QUARTERS',
+ relativePeriodId: 'last4Quarters',
boxLabel: DV.i18n.last_4_quarters
}
]
@@ -4453,12 +4451,12 @@
},
{
xtype: 'checkbox',
- relativePeriodId: 'LAST_SIX_MONTH',
+ relativePeriodId: 'lastSixMonth',
boxLabel: DV.i18n.last_six_month
},
{
xtype: 'checkbox',
- relativePeriodId: 'LAST_2_SIXMONTHS',
+ relativePeriodId: 'last2SixMonths',
boxLabel: DV.i18n.last_two_six_month
}
]
@@ -4489,17 +4487,17 @@
},
{
xtype: 'checkbox',
- relativePeriodId: 'THIS_YEAR',
+ relativePeriodId: 'thisYear',
boxLabel: DV.i18n.this_year
},
{
xtype: 'checkbox',
- relativePeriodId: 'LAST_YEAR',
+ relativePeriodId: 'lastYear',
boxLabel: DV.i18n.last_year
},
{
xtype: 'checkbox',
- relativePeriodId: 'LAST_5_YEARS',
+ relativePeriodId: 'last5Years',
boxLabel: DV.i18n.last_5_years
}
]