=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/EventAnalyticalObject.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/EventAnalyticalObject.java 2015-01-17 07:41:26 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/EventAnalyticalObject.java 2015-02-16 14:25:40 +0000 @@ -32,6 +32,7 @@ import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramStage; +import org.hisp.dhis.analytics.EventOutputType; /** * @author Lars Helge Overland @@ -46,4 +47,6 @@ Date getStartDate(); Date getEndDate(); + + EventOutputType getOutputType(); } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventchart/EventChart.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventchart/EventChart.java 2015-02-05 06:53:38 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventchart/EventChart.java 2015-02-16 14:25:40 +0000 @@ -34,6 +34,8 @@ import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +import org.hisp.dhis.analytics.EventOutputType; import org.hisp.dhis.chart.BaseChart; import org.hisp.dhis.common.AnalyticsType; import org.hisp.dhis.common.BaseIdentifiableObject; @@ -52,6 +54,7 @@ import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramStage; import org.hisp.dhis.user.User; +import org.hisp.dhis.analytics.EventOutputType; import java.util.ArrayList; import java.util.Date; @@ -80,7 +83,7 @@ private List rowDimensions = new ArrayList<>(); - private String countType; + private EventOutputType outputType; // ------------------------------------------------------------------------- // Constructors @@ -252,14 +255,14 @@ @JsonProperty @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public String getCountType() + public EventOutputType getOutputType() { - return countType; + return outputType; } - public void setCountType( String countType ) + public void setOutputType( EventOutputType outputType ) { - this.countType = countType; + this.outputType = outputType; } // ------------------------------------------------------------------------- @@ -281,7 +284,7 @@ programStage = eventChart.getProgramStage(); startDate = eventChart.getStartDate(); endDate = eventChart.getEndDate(); - countType = eventChart.getCountType(); + outputType = eventChart.getOutputType(); } else if ( MergeStrategy.MERGE_IF_NOT_NULL.equals( strategy ) ) { @@ -289,7 +292,7 @@ programStage = eventChart.getProgramStage() == null ? programStage : eventChart.getProgramStage(); startDate = eventChart.getStartDate() == null ? startDate : eventChart.getStartDate(); endDate = eventChart.getEndDate() == null ? endDate : eventChart.getEndDate(); - countType = eventChart.getCountType() == null ? countType : eventChart.getCountType(); + outputType = eventChart.getOutputType() == null ? outputType : eventChart.getOutputType(); } columnDimensions.clear(); === 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 2015-02-16 13:05:07 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java 2015-02-16 14:25:40 +0000 @@ -48,6 +48,7 @@ import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramStage; import org.hisp.dhis.user.User; +import org.hisp.dhis.analytics.EventOutputType; import java.util.ArrayList; import java.util.Date; @@ -125,9 +126,9 @@ private boolean colSubTotals; /** - * Indicates count type. + * Indicates output type. */ - private String countType; + private EventOutputType outputType; /** * Indicates rendering of empty rows for the table. @@ -382,14 +383,14 @@ @JsonProperty @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public String getCountType() + public EventOutputType getOutputType() { - return countType; + return outputType; } - public void setCountType( String countType ) + public void setOutputType( EventOutputType outputType ) { - this.countType = countType; + this.outputType = outputType; } @JsonProperty @@ -468,7 +469,7 @@ programStage = eventReport.getProgramStage(); startDate = eventReport.getStartDate(); endDate = eventReport.getEndDate(); - countType = eventReport.getCountType(); + outputType = eventReport.getOutputType(); displayDensity = eventReport.getDisplayDensity(); fontSize = eventReport.getFontSize(); } @@ -479,7 +480,7 @@ programStage = eventReport.getProgramStage() == null ? programStage : eventReport.getProgramStage(); startDate = eventReport.getStartDate() == null ? startDate : eventReport.getStartDate(); endDate = eventReport.getEndDate() == null ? endDate : eventReport.getEndDate(); - countType = eventReport.getCountType() == null ? countType : eventReport.getCountType(); + outputType = eventReport.getOutputType() == null ? outputType : eventReport.getOutputType(); displayDensity = eventReport.getDisplayDensity() == null ? displayDensity : eventReport.getDisplayDensity(); fontSize = eventReport.getFontSize() == null ? fontSize : eventReport.getFontSize(); } === 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 2015-02-12 14:30:37 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2015-02-16 14:25:40 +0000 @@ -484,6 +484,12 @@ // reporttable col/row subtotals executeSql( "update reporttable set colsubtotals = subtotals where colsubtotals is null" ); executeSql( "update reporttable set rowsubtotals = subtotals where rowsubtotals is null" ); + + // reporttable upgrade counttype to outputtype + executeSql( "update eventreport set outputtype = 'EVENT' where outputtype is null and counttype = 'events'" ); + executeSql( "update eventreport set outputtype = 'TRACKED_ENTITY_INSTANCE' where outputtype is null and counttype = 'tracked_entity_instances'" ); + executeSql( "update eventreport set outputtype = 'EVENT' where outputtype is null" ); + executeSql( "alter table eventreport drop column counttype" ); executeSql( "update chart set reportingmonth = false where reportingmonth is null" ); executeSql( "update chart set reportingbimonth = false where reportingbimonth is null" ); @@ -522,7 +528,13 @@ // eventreport col/row subtotals executeSql( "update eventreport set colsubtotals = subtotals where colsubtotals is null" ); - executeSql( "update eventreport set rowsubtotals = subtotals where rowsubtotals is null" ); + executeSql( "update eventreport set rowsubtotals = subtotals where rowsubtotals is null" ); + + // eventchart upgrade counttype to outputtype + executeSql( "update eventchart set outputtype = 'EVENT' where outputtype is null and counttype = 'events'" ); + executeSql( "update eventchart set outputtype = 'TRACKED_ENTITY_INSTANCE' where outputtype is null and counttype = 'tracked_entity_instances'" ); + executeSql( "update eventchart set outputtype = 'EVENT' where outputtype is null" ); + executeSql( "alter table eventchart drop column counttype" ); executeSql( "update eventchart set sortorder = 0 where sortorder is null" ); === modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventchart/EventChart.hbm.xml' --- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventchart/EventChart.hbm.xml 2014-10-14 06:43:28 +0000 +++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventchart/EventChart.hbm.xml 2015-02-16 14:25:40 +0000 @@ -124,7 +124,12 @@ - + + + org.hisp.dhis.analytics.EventOutputType + 12 + + === 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-10-13 13:43:13 +0000 +++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml 2015-02-16 14:25:40 +0000 @@ -124,7 +124,12 @@ - + + + org.hisp.dhis.analytics.EventOutputType + 12 + + === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/i18n/i18n_app.properties' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/i18n/i18n_app.properties 2015-02-09 16:13:09 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/i18n/i18n_app.properties 2015-02-16 14:25:40 +0000 @@ -156,9 +156,6 @@ top=Top bottom=Bottom limit=Limit -events=Events -tracked_entity_instances=Tracked entity instances -count_type=Count type go_to_event_charts=Go to event charts open_this_table_as_chart=Open this table as chart open_last_chart=Open last chart @@ -176,3 +173,7 @@ clear_event_report=Clear event report yes=Yes no=No +output_type=Output type +event=Event +tracked_entity_instance=Tracked entity instance +enrollment=Enrollment === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js 2015-02-11 17:02:00 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js 2015-02-16 14:25:40 +0000 @@ -1701,7 +1701,7 @@ showDimensionLabels, hideEmptyRows, limit, - countType, + outputType, aggregationType, showHierarchy, digitGroupSeparator, @@ -1765,22 +1765,23 @@ style: 'margin-top:' + separatorTopMargin + 'px' }); - countType = Ext.create('Ext.form.field.ComboBox', { + outputType = Ext.create('Ext.form.field.ComboBox', { cls: 'ns-combo', style: 'margin-bottom:' + comboBottomMargin + 'px', width: comboboxWidth, labelWidth: 130, - fieldLabel: NS.i18n.count_type, + fieldLabel: NS.i18n.output_type, labelStyle: 'color:#333', queryMode: 'local', valueField: 'id', editable: false, - value: 'events', + value: 'EVENT', store: Ext.create('Ext.data.Store', { fields: ['id', 'text'], data: [ - {id: 'events', text: NS.i18n.events}, - {id: 'tracked_entity_instances', text: NS.i18n.tracked_entity_instances} + {id: 'EVENT', text: NS.i18n.event}, + {id: 'ENROLLMENT', text: NS.i18n.enrollment}, + {id: 'TRACKED_ENTITY_INSTANCE', text: NS.i18n.tracked_entity_instance} ] }) }); @@ -1864,7 +1865,7 @@ showDimensionLabels, hideEmptyRows, limit, - countType + outputType //aggregationType ] }; @@ -1906,7 +1907,7 @@ hideEmptyRows: hideEmptyRows.getValue(), sortOrder: limit.getSortOrder(), topLimit: limit.getTopLimit(), - countType: countType.getValue(), + outputType: outputType.getValue(), showHierarchy: showHierarchy.getValue(), showDimensionLabels: showDimensionLabels.getValue(), displayDensity: displayDensity.getValue(), @@ -1923,7 +1924,7 @@ showDimensionLabels.setValue(Ext.isBoolean(layout.showDimensionLabels) ? layout.showDimensionLabels : true); hideEmptyRows.setValue(Ext.isBoolean(layout.hideEmptyRows) ? layout.hideEmptyRows : false); limit.setValues(layout.sortOrder, layout.topLimit); - countType.setValue(Ext.isString(layout.countType) ? layout.countType : 'events'); + outputType.setValue(Ext.isString(layout.outputType) ? layout.outputType : 'EVENT'); //aggregationType.setValue(Ext.isString(layout.aggregationType) ? layout.aggregationType : 'default'); showHierarchy.setValue(Ext.isBoolean(layout.showHierarchy) ? layout.showHierarchy : false); displayDensity.setValue(Ext.isString(layout.displayDensity) ? layout.displayDensity : 'normal'); @@ -2010,7 +2011,7 @@ w.showDimensionLabels = showDimensionLabels; w.hideEmptyRows = hideEmptyRows; w.limit = limit; - w.countType = countType; + w.outputType = outputType; w.showHierarchy = showHierarchy; w.displayDensity = displayDensity; w.fontSize = fontSize; === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js 2015-02-11 13:03:35 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js 2015-02-16 16:00:31 +0000 @@ -313,7 +313,7 @@ // hideEmptyRows: boolean (false) - // countType: string ('events') - 'events', 'tracked_entity_instance' + // outputType: string ('EVENT') - 'EVENT', 'TRACKED_ENTITY_INSTANCE', 'ENROLLMENT' // aggregationType: string ('default') - 'default', 'count', 'sum' @@ -492,7 +492,7 @@ layout.showRowSubTotals = Ext.isBoolean(config.rowSubTotals) ? config.rowSubTotals : (Ext.isBoolean(config.showRowSubTotals) ? config.showRowSubTotals : 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.countType = Ext.isString(config.countType) && !Ext.isEmpty(config.countType) ? config.countType : 'events'; + layout.outputType = Ext.isString(config.outputType) && !Ext.isEmpty(config.outputType) ? config.outputType : 'EVENT'; layout.aggregationType = Ext.isString(config.aggregationType) ? config.aggregationType : 'default'; layout.showHierarchy = Ext.isBoolean(config.showHierarchy) ? config.showHierarchy : false; @@ -2077,11 +2077,9 @@ paramString += '&limit=' + view.topLimit + '&sortOrder=' + (view.sortOrder < 0 ? 'ASC' : 'DESC'); } - // count type - if (view.dataType === 'aggregated_values' && view.countType) { - if (view.countType === 'tracked_entity_instances') { - paramString += '&uniqueInstances=true'; - } + // output type + if (view.dataType === 'aggregated_values' && view.outputType) { + paramString += '&outputType=' + view.outputType; } // sorting @@ -2371,7 +2369,7 @@ a.push(getEmptyNameTdConfig({ cls: 'pivot-dim-label', - htmlValue: (xRowAxis ? dimConf.objectNameMap[xLayout.rowObjectNames[j]].name : '') + (xColAxis && xRowAxis ? ' // ' : '') + (xColAxis ? dimConf.objectNameMap[xLayout.columnObjectNames[i]].name : '') + htmlValue: (xRowAxis ? dimConf.objectNameMap[xLayout.rowObjectNames[j]].name : '') + (xColAxis && xRowAxis ? ' / ' : '') + (xColAxis ? dimConf.objectNameMap[xLayout.columnObjectNames[i]].name : '') })); } === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/i18n/i18n_app.properties' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/i18n/i18n_app.properties 2015-02-09 16:13:09 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/i18n/i18n_app.properties 2015-02-16 16:00:31 +0000 @@ -200,3 +200,7 @@ clear_event_chart=Clear event chart yes=Yes no=No +output_type=Output type +event=Event +tracked_entity_instance=Tracked entity instance +enrollment=Enrollment === 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 2015-02-11 17:02:00 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js 2015-02-16 16:00:31 +0000 @@ -1409,6 +1409,7 @@ baseLineValue, baseLineTitle, sortOrder, + outputType, rangeAxisMinValue, rangeAxisMaxValue, @@ -1518,6 +1519,27 @@ }) }); + outputType = Ext.create('Ext.form.field.ComboBox', { + cls: 'ns-combo', + style: 'margin-bottom:' + comboBottomMargin + 'px', + width: cmpWidth, + labelWidth: 125, + fieldLabel: NS.i18n.output_type, + labelStyle: 'color:#333', + queryMode: 'local', + valueField: 'id', + editable: false, + value: 'EVENT', + store: Ext.create('Ext.data.Store', { + fields: ['id', 'text'], + data: [ + {id: 'EVENT', text: NS.i18n.event}, + {id: 'ENROLLMENT', text: NS.i18n.enrollment}, + {id: 'TRACKED_ENTITY_INSTANCE', text: NS.i18n.tracked_entity_instance} + ] + }) + }); + // axes rangeAxisMinValue = Ext.create('Ext.form.field.Number', { width: numberWidth, @@ -1636,7 +1658,8 @@ baseLineTitle ] }, - sortOrder + sortOrder, + outputType ] }; @@ -1676,13 +1699,13 @@ window = Ext.create('Ext.window.Window', { title: NS.i18n.chart_options, - bodyStyle: 'background-color:#fff; padding:3px', + bodyStyle: 'background-color:#fff; padding:2px', closeAction: 'hide', autoShow: true, modal: true, resizable: false, hideOnBlur: true, - getOptions: function() { + getOptions: function() { return { showValues: showValues.getValue(), hideEmptyRows: hideEmptyRows.getValue(), @@ -1692,6 +1715,7 @@ baseLineValue: baseLineValue.getValue(), baseLineTitle: baseLineTitle.getValue(), sortOrder: sortOrder.getValue(), + outputType: outputType.getValue(), rangeAxisMaxValue: rangeAxisMaxValue.getValue(), rangeAxisMinValue: rangeAxisMinValue.getValue(), rangeAxisSteps: rangeAxisSteps.getValue(), @@ -1739,6 +1763,7 @@ } sortOrder.setValue(Ext.isNumber(layout.sortOrder) ? layout.sortOrder : 0); + outputType.setValue(Ext.isString(layout.outputType) ? layout.outputType : 'EVENT'); // rangeAxisMaxValue if (Ext.isNumber(layout.rangeAxisMaxValue)) { @@ -1802,7 +1827,7 @@ items: [ { bodyStyle: 'border:0 none; color:#222; font-size:12px; font-weight:bold', - style: 'margin-bottom:6px; margin-left:2px', + style: 'margin-top:4px; margin-bottom:6px; margin-left:5px', html: NS.i18n.data }, data, @@ -1811,7 +1836,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:5px', html: NS.i18n.axes }, axes, @@ -1820,7 +1845,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:5px', html: NS.i18n.general }, general @@ -1861,6 +1886,7 @@ w.baseLineValue = baseLineValue; w.baseLineTitle = baseLineTitle; w.sortOrder = sortOrder; + w.outputType = outputType; w.rangeAxisMaxValue = rangeAxisMaxValue; w.rangeAxisMinValue = rangeAxisMinValue; === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/core.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/core.js 2015-02-11 13:03:35 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/core.js 2015-02-16 16:00:31 +0000 @@ -344,6 +344,8 @@ // sortOrder: number + // outputType: string ('EVENT') - 'EVENT', 'TRACKED_ENTITY_INSTANCE', 'ENROLLMENT' + // rangeAxisMaxValue: number // rangeAxisMinValue: number @@ -571,6 +573,7 @@ layout.baseLineTitle = Ext.isString(config.baseLineLabel) && !Ext.isEmpty(config.baseLineLabel) ? config.baseLineLabel : (Ext.isString(config.baseLineTitle) && !Ext.isEmpty(config.baseLineTitle) ? config.baseLineTitle : null); layout.sortOrder = Ext.isNumber(config.sortOrder) ? config.sortOrder : 0; + layout.outputType = Ext.isString(config.outputType) && !Ext.isEmpty(config.outputType) ? config.outputType : 'EVENT'; layout.rangeAxisMaxValue = Ext.isNumber(config.rangeAxisMaxValue) ? config.rangeAxisMaxValue : null; layout.rangeAxisMinValue = Ext.isNumber(config.rangeAxisMinValue) ? config.rangeAxisMinValue : null; @@ -2026,6 +2029,11 @@ paramString += '&startDate=' + layout.startDate + '&endDate=' + layout.endDate; } + // output type + if (layout.outputType) { + paramString += '&outputType=' + layout.outputType; + } + // display property paramString += '&displayProperty=' + init.userAccount.settings.keyAnalysisDisplayProperty.toUpperCase();