dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #29365
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14820: ER, show hierarchy option fixes.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 14820 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-04-13 22:11:35 +0200
message:
ER, show hierarchy option fixes.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml
dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/app.js
dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.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-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java 2014-04-09 11:45:21 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java 2014-04-13 20:08:51 +0000
@@ -117,6 +117,11 @@
private boolean hideEmptyRows;
/**
+ * Indicates rendering of empty rows for the table.
+ */
+ private boolean showHierarchy;
+
+ /**
* The display density of the text in the table.
*/
private String displayDensity;
@@ -178,6 +183,7 @@
{
EventReport report = (EventReport) other;
+ dataType = report.getDataType();
program = report.getProgram();
programStage = report.getProgramStage();
startDate = report.getStartDate();
@@ -185,6 +191,7 @@
totals = report.isTotals();
subtotals = report.isSubtotals();
hideEmptyRows = report.isHideEmptyRows();
+ showHierarchy = report.isShowHierarchy();
displayDensity = report.getDisplayDensity();
fontSize = report.getFontSize();
}
@@ -345,6 +352,19 @@
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public boolean isShowHierarchy()
+ {
+ return showHierarchy;
+ }
+
+ public void setShowHierarchy( boolean showHierarchy )
+ {
+ this.showHierarchy = showHierarchy;
+ }
+
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public String getDisplayDensity()
{
return displayDensity;
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2014-04-09 13:35:52 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2014-04-13 20:08:51 +0000
@@ -491,6 +491,7 @@
executeSql( "update eventreport set sortorder = 0 where sortorder is null" );
executeSql( "update eventreport set toplimit = 0 where toplimit is null" );
+ executeSql( "update eventreport set showhierarchy = false where showhierarchy is null" );
// Move chart filters to chart_filters table
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml 2014-04-09 11:45:21 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml 2014-04-13 20:08:51 +0000
@@ -110,6 +110,8 @@
<property name="hideEmptyRows" />
+ <property name="showHierarchy" />
+
<property name="digitGroupSeparator" />
<property name="displayDensity" />
=== modified file 'dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/app.js 2014-04-10 21:46:10 +0000
+++ dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/app.js 2014-04-13 20:08:51 +0000
@@ -1814,10 +1814,10 @@
comboboxWidth = 262,
window;
- showHierarchy = Ext.create('Ext.form.field.Checkbox', {
- boxLabel: NS.i18n.show_hierarchy,
- style: 'margin-bottom:4px'
- });
+ //showHierarchy = Ext.create('Ext.form.field.Checkbox', {
+ //boxLabel: NS.i18n.show_hierarchy,
+ //style: 'margin-bottom:4px'
+ //});
displayDensity = Ext.create('Ext.form.field.ComboBox', {
cls: 'ns-combo',
@@ -1895,13 +1895,13 @@
//store: ns.app.stores.legendSet
//});
- organisationUnits = {
- bodyStyle: 'border:0 none',
- style: 'margin-left:14px',
- items: [
- showHierarchy
- ]
- };
+ //organisationUnits = {
+ //bodyStyle: 'border:0 none',
+ //style: 'margin-left:14px',
+ //items: [
+ //showHierarchy
+ //]
+ //};
style = {
bodyStyle: 'border:0 none',
@@ -1929,7 +1929,7 @@
hideEmptyRows: false,
sortOrder: 0,
topLimit: 0,
- showHierarchy: showHierarchy.getValue(),
+ showHierarchy: false,
displayDensity: displayDensity.getValue(),
fontSize: fontSize.getValue(),
digitGroupSeparator: digitGroupSeparator.getValue()
@@ -1937,22 +1937,22 @@
};
},
setOptions: function(layout) {
- showHierarchy.setValue(Ext.isBoolean(layout.showHierarchy) ? layout.showHierarchy : false);
+ //showHierarchy.setValue(Ext.isBoolean(layout.showHierarchy) ? layout.showHierarchy : false);
displayDensity.setValue(Ext.isString(layout.displayDensity) ? layout.displayDensity : 'normal');
fontSize.setValue(Ext.isString(layout.fontSize) ? layout.fontSize : 'normal');
digitGroupSeparator.setValue(Ext.isString(layout.digitGroupSeparator) ? layout.digitGroupSeparator : 'space');
//legendSet.setValue(Ext.isObject(layout.legendSet) && Ext.isString(layout.legendSet.id) ? layout.legendSet.id : 0);
},
items: [
- {
- bodyStyle: 'border:0 none; color:#222; font-size:12px; font-weight:bold',
- style: 'margin-bottom:6px; margin-left:2px',
- html: NS.i18n.organisation_units
- },
- organisationUnits,
- {
- bodyStyle: 'border:0 none; padding:5px'
- },
+ //{
+ //bodyStyle: 'border:0 none; color:#222; font-size:12px; font-weight:bold',
+ //style: 'margin-bottom:6px; margin-left:2px',
+ //html: NS.i18n.organisation_units
+ //},
+ //organisationUnits,
+ //{
+ //bodyStyle: 'border:0 none; padding:5px'
+ //},
{
bodyStyle: 'border:0 none; color:#222; font-size:12px; font-weight:bold',
style: 'margin-bottom:6px; margin-left:2px',
@@ -2004,7 +2004,7 @@
//}
// cmp
- w.showHierarchy = showHierarchy;
+ //w.showHierarchy = showHierarchy;
w.displayDensity = displayDensity;
w.fontSize = fontSize;
w.digitGroupSeparator = digitGroupSeparator;
@@ -3141,7 +3141,13 @@
isOuc = false,
isOugc = false,
levels = [],
- groups = [];
+ groups = [],
+
+ winMap = {
+ 'aggregated_values': ns.app.aggregateOptionsWindow,
+ 'individual_cases': ns.app.queryOptionsWindow
+ },
+ optionsWindow = winMap[layout.dataType];
reset();
@@ -3230,8 +3236,8 @@
}
// options
- if (ns.app.aggregateOptionsWindow) {
- ns.app.aggregateOptionsWindow.setOptions(layout);
+ if (optionsWindow) {
+ optionsWindow.setOptions(layout);
}
};
@@ -3584,7 +3590,8 @@
var dataElements = [],
aggWindow = ns.app.aggregateLayoutWindow,
queryWindow = ns.app.queryLayoutWindow,
- includeKeys = ['int', 'number', 'boolean', 'bool'];
+ includeKeys = ['int', 'number', 'boolean', 'bool'],
+ dimensionStoreMap = {};
// data element objects
for (var i = 0, item; i < items.length; i++) {
@@ -3612,6 +3619,11 @@
if (layout) {
ux.setRecord(element);
+
+ if (layout.dataType === 'aggregated_values') {
+ aggWindow.addDimensionFromLayout(element, layout);
+
+
}
store = Ext.Array.contains(includeKeys, element.type) || element.optionSet ? aggWindow.rowStore : aggWindow.fixedFilterStore;
@@ -5502,6 +5514,11 @@
config.endDate = config.endDate.substr(0,10);
}
+ config.paging = {
+ page: 1,
+ pageSize: 100
+ };
+
web.report.getData(config, true);
}
});
=== modified file 'dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js 2014-04-11 00:13:08 +0000
+++ dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js 2014-04-13 15:52:00 +0000
@@ -1655,15 +1655,26 @@
service.response.query.getExtendedResponse = function(layout, response) {
var xResponse = Ext.clone(response),
+ metaData = xResponse.metaData,
dimensionNames = Ext.Array.pluck(layout.columns, 'dimension'),
dimensionHeaders = [],
headers = xResponse.headers,
nameHeaderMap = {},
- nameMap = {};
+ nameMap = {},
+ ouIndex;
nameMap['pe'] = 'eventdate';
nameMap['ou'] = 'ouname';
+ // get ou index
+ for (var i = 0, header; i < headers.length; i++) {
+ if (headers[i].name === 'ou') {
+ ouIndex = i;
+ break;
+ }
+ }
+
+ // update rows
for (var i = 0, header; i < headers.length; i++) {
header = headers[i];
header.index = i;
@@ -1682,8 +1693,17 @@
}
}
+ // TODO, using descendants -> missing orgunits in ouHierarchy
+
+ //else if (header.name === 'ouname' && layout.showHierarchy && metaData.ouHierarchy) {
+ //for (var j = 0, ouId; j < xResponse.rows.length; j++) {
+ //ouId = xResponse.rows[j][ouIndex];
+ //xResponse.rows[j][i] = service.layout.getHierarchyName(metaData.ouHierarchy, metaData.names, ouId);
+ //}
+ //}
}
+ // dimension headers
for (var i = 0, name; i < dimensionNames.length; i++) {
name = nameMap[dimensionNames[i]] || dimensionNames[i];
@@ -2720,10 +2740,23 @@
row = rows[i];
html += '<tr>';
- for (var j = 0, str, value; j < dimensionHeaders.length; j++) {
- str = row[dimensionHeaders[j].index];
- value = web.report.query.format(str);
- html += '<td class="pivot-value align-left">' + value + '</td>';
+ for (var j = 0, str, header, name; j < dimensionHeaders.length; j++) {
+ header = dimensionHeaders[j];
+ str = row[header.index];
+ name = web.report.query.format(str);
+
+ //if (header.name === 'ouname' && layout.showHierarchy) {
+ //var a = Ext.Array.clean(name.split('/'));
+ //name = '';
+
+ //for (var k = 0, isLast; k < a.length; k++) {
+ //isLast = !!(i === a.length - 1);
+
+ //name += (!isLast ? '<span class="text-weak">' : '') + a[i] + (!isLast ? '</span>' : '') + (!isLast ? ' / ' : '');
+ //}
+ //}
+
+ html += '<td class="pivot-value align-left">' + name + '</td>';
}
html += '</tr>';