dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #32675
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16658: PT show dimension labels option implemented.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 16658 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-09-08 16:52:28 +0200
message:
PT show dimension labels option implemented.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/i18n/en.properties
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/styles/style.css
--
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/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2014-09-08 14:31:53 +0000
@@ -195,6 +195,11 @@
*/
private String aggregationType;
+ /**
+ * Indicates showing organisation unit hierarchy names.
+ */
+ private boolean showDimensionLabels;
+
// -------------------------------------------------------------------------
// Transient properties
// -------------------------------------------------------------------------
@@ -990,6 +995,20 @@
this.showHierarchy = showHierarchy;
}
+
+ @JsonProperty
+ @JsonView( {DetailedView.class, ExportView.class, DimensionalView.class} )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
+ public boolean isShowDimensionLabels()
+ {
+ return showDimensionLabels;
+ }
+
+ public void setShowDimensionLabels( boolean showDimensionLabels )
+ {
+ this.showDimensionLabels = showDimensionLabels;
+ }
+
// -------------------------------------------------------------------------
// Get- and set-methods for transient properties
// -------------------------------------------------------------------------
@@ -1062,6 +1081,8 @@
displayDensity = reportTable.getDisplayDensity();
fontSize = reportTable.getFontSize();
legendSet = reportTable.getLegendSet();
+ showDimensionLabels = reportTable.isShowDimensionLabels();
+ hideEmptyRows = reportTable.isHideEmptyRows();
columnDimensions.clear();
columnDimensions.addAll( reportTable.getColumnDimensions() );
=== 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-09-03 03:26:27 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2014-09-08 14:31:53 +0000
@@ -430,6 +430,7 @@
executeSql( "update eventchart set regression = false where regression is null" );
executeSql( "update eventchart set hidetitle = false where hidetitle is null" );
executeSql( "update eventchart set hidesubtitle = false where hidesubtitle is null" );
+ executeSql( "update reporttable set showdimensionlabels = false where showdimensionlabels is null" );
// move timelydays from system setting => dataset property
executeSql( "update dataset set timelydays = 15 where timelydays is null" );
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml 2014-05-22 13:07:04 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml 2014-09-08 14:31:53 +0000
@@ -178,6 +178,8 @@
<property name="showHierarchy" />
+ <property name="showDimensionLabels" />
+
<!-- Access properties -->
<property name="externalAccess" />
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js 2014-09-02 14:11:29 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js 2014-09-08 14:48:14 +0000
@@ -3981,7 +3981,7 @@
store: periodTypeStore,
periodOffset: 0,
listeners: {
- select: function(cmp) {
+ select: function() {
periodType.periodOffset = 0;
onPeriodTypeSelect();
}
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/i18n/en.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/i18n/en.properties 2014-08-27 10:36:05 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/i18n/en.properties 2014-09-08 14:31:53 +0000
@@ -160,4 +160,5 @@
open_last_map=Open last map
show_row_totals=Show row totals
show_col_totals=Show column totals
-assigned_categories=Assigned categories
\ No newline at end of file
+assigned_categories=Assigned categories
+show_dimension_labels=Show dimension labels
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js 2014-09-02 14:11:29 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js 2014-09-08 14:31:53 +0000
@@ -439,6 +439,7 @@
var showRowTotals,
showColTotals,
showSubTotals,
+ showDimensionLabels,
hideEmptyRows,
aggregationType,
showHierarchy,
@@ -454,34 +455,36 @@
parameters,
comboboxWidth = 262,
+ comboBottomMargin = 1,
+ checkboxBottomMargin = 2,
window;
showColTotals = Ext.create('Ext.form.field.Checkbox', {
boxLabel: NS.i18n.show_col_totals,
- style: 'margin-bottom:4px',
+ style: 'margin-bottom:' + checkboxBottomMargin + 'px',
checked: true
});
showRowTotals = Ext.create('Ext.form.field.Checkbox', {
boxLabel: NS.i18n.show_row_totals,
- style: 'margin-bottom:4px',
+ style: 'margin-bottom:' + checkboxBottomMargin + 'px',
checked: true
});
showSubTotals = Ext.create('Ext.form.field.Checkbox', {
boxLabel: NS.i18n.show_subtotals,
- style: 'margin-bottom:4px',
+ style: 'margin-bottom:' + checkboxBottomMargin + 'px',
checked: true
});
hideEmptyRows = Ext.create('Ext.form.field.Checkbox', {
boxLabel: NS.i18n.hide_empty_rows,
- style: 'margin-bottom:4px'
+ style: 'margin-bottom:' + checkboxBottomMargin + 'px',
});
aggregationType = Ext.create('Ext.form.field.ComboBox', {
cls: 'ns-combo',
- style: 'margin-bottom:3px',
+ style: 'margin-top:3px; margin-bottom:' + comboBottomMargin + 'px',
width: comboboxWidth,
labelWidth: 130,
fieldLabel: NS.i18n.aggregation_type,
@@ -506,12 +509,17 @@
showHierarchy = Ext.create('Ext.form.field.Checkbox', {
boxLabel: NS.i18n.show_hierarchy,
- style: 'margin-bottom:4px'
+ style: 'margin-bottom:' + checkboxBottomMargin + 'px',
+ });
+
+ showDimensionLabels = Ext.create('Ext.form.field.Checkbox', {
+ boxLabel: NS.i18n.show_dimension_labels,
+ style: 'margin-bottom:' + comboBottomMargin + 'px'
});
displayDensity = Ext.create('Ext.form.field.ComboBox', {
cls: 'ns-combo',
- style: 'margin-bottom:3px',
+ style: 'margin-top:5px; margin-bottom:' + comboBottomMargin + 'px',
width: comboboxWidth,
labelWidth: 130,
fieldLabel: NS.i18n.display_density,
@@ -532,7 +540,7 @@
fontSize = Ext.create('Ext.form.field.ComboBox', {
cls: 'ns-combo',
- style: 'margin-bottom:3px',
+ style: 'margin-bottom:' + comboBottomMargin + 'px',
width: comboboxWidth,
labelWidth: 130,
fieldLabel: NS.i18n.font_size,
@@ -554,7 +562,7 @@
digitGroupSeparator = Ext.create('Ext.form.field.ComboBox', {
labelStyle: 'color:#333',
cls: 'ns-combo',
- style: 'margin-bottom:3px',
+ style: 'margin-bottom:' + comboBottomMargin + 'px',
width: comboboxWidth,
labelWidth: 130,
fieldLabel: NS.i18n.digit_group_separator,
@@ -574,10 +582,11 @@
legendSet = Ext.create('Ext.form.field.ComboBox', {
cls: 'ns-combo',
- style: 'margin-bottom:3px',
+ style: 'margin-bottom:' + comboBottomMargin + 'px',
width: comboboxWidth,
labelWidth: 130,
fieldLabel: NS.i18n.legend_set,
+ labelStyle: 'color:#333',
valueField: 'id',
displayField: 'name',
editable: false,
@@ -679,6 +688,7 @@
bodyStyle: 'border:0 none',
style: 'margin-left:14px',
items: [
+ showDimensionLabels,
displayDensity,
fontSize,
digitGroupSeparator,
@@ -702,7 +712,7 @@
window = Ext.create('Ext.window.Window', {
title: NS.i18n.table_options,
- bodyStyle: 'background-color:#fff; padding:5px',
+ bodyStyle: 'background-color:#fff; padding:3px',
closeAction: 'hide',
autoShow: true,
modal: true,
@@ -713,6 +723,7 @@
showRowTotals: showRowTotals.getValue(),
showColTotals: showColTotals.getValue(),
showSubTotals: showSubTotals.getValue(),
+ showDimensionLabels: showDimensionLabels.getValue(),
hideEmptyRows: hideEmptyRows.getValue(),
aggregationType: aggregationType.getValue(),
showHierarchy: showHierarchy.getValue(),
@@ -733,6 +744,7 @@
showRowTotals.setValue(Ext.isBoolean(layout.showRowTotals) ? layout.showRowTotals : true);
showColTotals.setValue(Ext.isBoolean(layout.showColTotals) ? layout.showColTotals : true);
showSubTotals.setValue(Ext.isBoolean(layout.showSubTotals) ? layout.showSubTotals : true);
+ showDimensionLabels.setValue(Ext.isBoolean(layout.showDimensionLabels) ? layout.showDimensionLabels : true);
hideEmptyRows.setValue(Ext.isBoolean(layout.hideEmptyRows) ? layout.hideEmptyRows : false);
aggregationType.setValue(Ext.isString(layout.aggregationType) ? layout.aggregationType : 'default');
showHierarchy.setValue(Ext.isBoolean(layout.showHierarchy) ? layout.showHierarchy : false);
@@ -751,7 +763,7 @@
items: [
{
bodyStyle: 'border:0 none; color:#222; font-size:12px; font-weight:bold',
- style: 'margin-bottom:6px; margin-left:2px',
+ style: 'margin-top:2px; margin-bottom:6px; margin-left:3px',
html: NS.i18n.data
},
data,
@@ -760,7 +772,7 @@
},
{
bodyStyle: 'border:0 none; color:#222; font-size:12px; font-weight:bold',
- style: 'margin-bottom:6px; margin-left:2px',
+ style: 'margin-bottom:6px; margin-left:3px',
html: NS.i18n.organisation_units
},
organisationUnits,
@@ -769,12 +781,12 @@
},
{
bodyStyle: 'border:0 none; color:#222; font-size:12px; font-weight:bold',
- style: 'margin-bottom:6px; margin-left:2px',
+ style: 'margin-bottom:6px; margin-left:3px',
html: NS.i18n.style
},
style,
{
- bodyStyle: 'border:0 none; padding:4px'
+ bodyStyle: 'border:0 none; padding:3px'
},
{
bodyStyle: 'border:1px solid #d5d5d5; padding:5px; background-color:#f0f0f0',
@@ -829,6 +841,7 @@
w.showRowTotals = showRowTotals;
w.showColTotals = showColTotals;
w.showSubTotals = showSubTotals;
+ w.showDimensionLabels = showDimensionLabels;
w.hideEmptyRows = hideEmptyRows;
w.aggregationType = aggregationType;
w.showHierarchy = showHierarchy;
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js 2014-08-28 09:59:21 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js 2014-09-08 14:31:53 +0000
@@ -312,6 +312,8 @@
// showSubTotals: boolean (true)
+ // showDimensionLabels: boolean (false)
+
// hideEmptyRows: boolean (false)
// aggregationType: string ('default') - 'default', 'count', 'sum'
@@ -478,6 +480,7 @@
layout.showRowTotals = Ext.isBoolean(config.rowTotals) ? config.rowTotals : (Ext.isBoolean(config.showRowTotals) ? config.showRowTotals : true);
layout.showColTotals = Ext.isBoolean(config.colTotals) ? config.colTotals : (Ext.isBoolean(config.showColTotals) ? config.showColTotals : true);
layout.showSubTotals = Ext.isBoolean(config.subtotals) ? config.subtotals : (Ext.isBoolean(config.showSubTotals) ? config.showSubTotals : true);
+ layout.showDimensionLabels = Ext.isBoolean(config.showDimensionLabels) ? config.showDimensionLabels : (Ext.isBoolean(config.showDimensionLabels) ? config.showDimensionLabels : true);
layout.hideEmptyRows = Ext.isBoolean(config.hideEmptyRows) ? config.hideEmptyRows : false;
layout.aggregationType = Ext.isString(config.aggregationType) ? config.aggregationType : 'default';
@@ -2154,14 +2157,54 @@
var a = [],
getEmptyHtmlArray;
- getEmptyHtmlArray = function() {
- return (xColAxis && xRowAxis) ? getTdHtml({
- cls: 'pivot-dim-empty cursor-default',
- colSpan: xRowAxis.dims,
- rowSpan: xColAxis.dims,
- htmlValue: ' '
- }) : '';
- };
+ getEmptyNameTdConfig = function(config) {
+ config = config || {};
+
+ return getTdHtml({
+ cls: config.cls ? ' ' + config.cls : 'pivot-empty',
+ colSpan: config.colSpan ? config.colSpan : 1,
+ rowSpan: config.rowSpan ? config.rowSpan : 1,
+ htmlValue: config.htmlValue ? config.htmlValue : ' '
+ });
+ };
+
+ getEmptyHtmlArray = function(i) {
+ var a = [];
+
+ if (i < xColAxis.dims - 1) {
+ if (xRowAxis && xRowAxis.dims) {
+ for (var j = 0; j < xRowAxis.dims - 1; j++) {
+ a.push(getEmptyNameTdConfig({
+ cls: 'pivot-dim-label'
+ }));
+ }
+ }
+
+ a.push(getEmptyNameTdConfig({
+ cls: 'pivot-dim-label align-right',
+ htmlValue: ' ' + dimConf.objectNameMap[xLayout.columnObjectNames[i]].name
+ }));
+ }
+ else {
+ if (xRowAxis && xRowAxis.dims) {
+ for (var j = 0; j < xRowAxis.dims - 1; j++) {
+ a.push(getEmptyNameTdConfig({
+ cls: 'pivot-dim-label align-left',
+ htmlValue: dimConf.objectNameMap[xLayout.rowObjectNames[j]].name
+ }));
+ }
+ }
+
+ a.push(getEmptyNameTdConfig({
+ cls: 'pivot-dim-label',
+ htmlValue: '<span class="td-nobreak">' + dimConf.objectNameMap[xLayout.rowObjectNames[j]].name + '</span>' +
+ ' ' +
+ '<span class="td-nobreak" style="float:right">' + dimConf.objectNameMap[xLayout.columnObjectNames[i]].name + '</span>'
+ }));
+ }
+
+ return a;
+ };
if (!(xColAxis && Ext.isObject(xColAxis))) {
return a;
@@ -2171,8 +2214,18 @@
for (var i = 0, dimHtml; i < xColAxis.dims; i++) {
dimHtml = [];
- if (i === 0) {
- dimHtml.push(getEmptyHtmlArray());
+ //if (i === 0) {
+ //dimHtml.push(getEmptyHtmlArray());
+ //}
+
+ if (xLayout.showDimensionLabels) {
+ dimHtml = dimHtml.concat(getEmptyHtmlArray(i));
+ }
+ else if (i === 0) {
+ dimHtml.push(xColAxis && xRowAxis ? getEmptyNameTdConfig({
+ colSpan: xRowAxis.dims,
+ rowSpan: xColAxis.dims
+ }) : '');
}
for (var j = 0, obj, spanCount = 0, condoId, totalId; j < xColAxis.size; j++) {
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/styles/style.css'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/styles/style.css 2014-03-20 09:06:16 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/styles/style.css 2014-09-08 12:08:14 +0000
@@ -173,6 +173,9 @@
.align-left {
text-align: left !important;
}
+.align-right {
+ text-align: right !important;
+}
/*----------------------------------------------------------------------------
* Pivot
@@ -214,9 +217,12 @@
background-color: #adb8c9;
}
-.pivot-dim-empty {
+.pivot-dim-label {
+ background-color: #f7f9fD;
+ white-space: nowrap;
+}
+.pivot-empty {
background-color: #dae6f8;
- text-align: center;
}
.pivot-value {