=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module.properties 2013-06-25 16:34:25 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module.properties 2013-06-26 15:56:41 +0000 @@ -124,4 +124,6 @@ legend_set=Legend set select_organisation_units=Select organisation units select_boundaries_and_level=Select boundaries and level -select_organisation_unit_level=Select organisation unit level \ No newline at end of file +select_organisation_unit_level=Select organisation unit level +totals=Totals +details=Details \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module_fr_FR.properties' --- dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module_fr_FR.properties 2013-06-25 16:34:25 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module_fr_FR.properties 2013-06-26 15:56:41 +0000 @@ -119,4 +119,6 @@ legend_set=Jeu de l\u00E9gendes select_organisation_units=S\u00E9lectionner les unit\u00E9s d'organisation select_boundaries_and_level=S\u00E9lectionner limites et le niveau -select_organisation_unit_level=S\u00E9lectionner le niveau de l'unit\u00E9 d'organisation \ No newline at end of file +select_organisation_unit_level=S\u00E9lectionner le niveau de l'unit\u00E9 d'organisation +details=D\u00E9tails +totals=Totaux \ No newline at end of file === 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-06-25 18:26:47 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2013-06-26 16:11:35 +0000 @@ -254,6 +254,12 @@ } }; + util.str = { + replaceAll: function(str, find, replace) { + return str.replace(new RegExp(find, 'g'), replace); + } + }; + return util; }; @@ -287,10 +293,9 @@ }); store.dataElementAvailable = Ext.create('Ext.data.Store', { - fields: ['id', 'name'], + fields: ['id', 'name', 'dataElementId', 'optionComboId', 'operandName'], proxy: { type: 'ajax', - url: pt.conf.finals.ajax.path_visualizer + pt.conf.finals.ajax.dataelement_get, reader: { type: 'json', root: 'dataElements' @@ -300,6 +305,64 @@ sortStore: function() { this.sort('name', 'ASC'); }, + setTotalsProxy: function(uid) { + var path; + + if (Ext.isString(uid)) { + path = pt.conf.finals.ajax.dataelement_get + uid + '.json?links=false&paging=false'; + } + else if (uid === 0) { + path = pt.conf.finals.ajax.dataelement_getall; + } + + if (!path) { + alert('Invalid parameter'); + return; + } + + this.setProxy({ + type: 'ajax', + url: pt.conf.finals.ajax.path_api + path, + reader: { + type: 'json', + root: 'dataElements' + } + }); + + this.load({ + scope: this, + callback: function() { + this.sortStore(); + } + }); + }, + setDetailsProxy: function(uid) { + if (Ext.isString(uid)) { + this.setProxy({ + type: 'ajax', + url: pt.conf.finals.ajax.path_commons + 'getOperands.action?uid=' + uid, + reader: { + type: 'json', + root: 'operands' + } + }); + + this.load({ + scope: this, + callback: function() { + this.each(function(r) { + r.set('id', r.data.dataElementId + '-' + r.data.optionComboId); + r.set('name', r.data.operandName); + }); + + this.sortStore(); + } + }); + } + else { + alert('Invalid parameter'); + } + }, listeners: { load: function(s) { pt.util.store.addToStorage(s); @@ -1159,10 +1222,12 @@ }); getBody = function() { - var favorite; + var favorite, + dimensions; if (pt.layout) { favorite = Ext.clone(pt.layout); + dimensions = [].concat(favorite.columns, favorite.rows, favorite.filters); // Server sync favorite.totals = favorite.showTotals; @@ -1181,6 +1246,15 @@ delete favorite.parentOrganisationUnit; delete favorite.parentGraphMap; + + // Replace operand id characters + for (var i = 0; i < dimensions.length; i++) { + if (dimensions[i].dimension === pt.conf.finals.dimension.operand.objectName) { + for (var j = 0; j < dimensions[i].items.length; j++) { + dimensions[i].items[j].id = dimensions[i].items[j].id.replace('-', '.'); + } + } + } } return favorite; @@ -1970,7 +2044,7 @@ window = Ext.create('Ext.window.Window', { title: PT.i18n.share + ' ' + PT.i18n.interpretation + ' (' + pt.favorite.name + ') ', layout: 'fit', - //iconCls: 'dv-window-title-interpretation', + //iconCls: 'pt-window-title-interpretation', width: 500, bodyStyle: 'padding:5px 5px 3px; background-color:#fff', resizable: true, @@ -2330,13 +2404,110 @@ } }); + dataElementGroupStore = Ext.create('Ext.data.Store', { + fields: ['id', 'name', 'index'], + proxy: { + type: 'ajax', + url: pt.conf.finals.ajax.path_api + pt.conf.finals.ajax.dataelementgroup_get, + reader: { + type: 'json', + root: 'dataElementGroups' + } + }, + listeners: { + load: function(s) { + if (dataElementDetailLevel.getValue() === pt.conf.finals.dimension.dataElement.objectName) { + s.add({ + id: 0, + name: '[ ' + PT.i18n.all_data_element_groups + ' ]', + index: -1 + }); + } + + s.sort([ + {property: 'index', direction: 'ASC'}, + {property: 'name', direction: 'ASC'} + ]); + } + } + }); + + dataElementGroupComboBox = Ext.create('Ext.form.field.ComboBox', { + cls: 'pt-combo', + style: 'margin:0 2px 2px 0', + width: pt.conf.layout.west_fieldset_width - pt.conf.layout.west_width_padding - 90, + valueField: 'id', + displayField: 'name', + emptyText: PT.i18n.select_data_element_group, + editable: false, + store: dataElementGroupStore, + loadAvailable: function() { + var store = pt.store.dataElementAvailable, + detailLevel = dataElementDetailLevel.getValue(), + value = this.getValue(); + + if (value !== null) { + if (detailLevel === pt.conf.finals.dimension.dataElement.objectName) { + store.setTotalsProxy(value); + } + else { + store.setDetailsProxy(value); + } + } + }, + listeners: { + select: function(cb) { + cb.loadAvailable(); + } + } + }); + + dataElementDetailLevel = Ext.create('Ext.form.field.ComboBox', { + cls: 'pt-combo', + style: 'margin-bottom:2px', + baseBodyCls: 'small', + queryMode: 'local', + editable: false, + valueField: 'id', + displayField: 'text', + width: 90 - 2, + value: pt.conf.finals.dimension.dataElement.objectName, + store: { + fields: ['id', 'text'], + data: [ + {id: pt.conf.finals.dimension.dataElement.objectName, text: PT.i18n.totals}, + {id: pt.conf.finals.dimension.operand.objectName, text: PT.i18n.details} + ] + }, + listeners: { + select: function(cb) { + var record = dataElementGroupStore.getById(0); + + if (cb.getValue() === pt.conf.finals.dimension.operand.objectName && record) { + dataElementGroupStore.remove(record); + } + + if (cb.getValue() === pt.conf.finals.dimension.dataElement.objectName && !record) { + dataElementGroupStore.insert(0, { + id: 0, + name: '[ ' + PT.i18n.all_data_element_groups + ' ]', + index: -1 + }); + } + + dataElementGroupComboBox.loadAvailable(); + pt.store.dataElementSelected.removeAll(); + } + } + }); + dataElement = { xtype: 'panel', title: '
' + PT.i18n.data_elements + '
', hideCollapseTool: true, getDimension: function() { var config = { - dimension: pt.conf.finals.dimension.dataElement.objectName, + dimension: dataElementDetailLevel.getValue(), items: [] }; @@ -2358,66 +2529,12 @@ }, items: [ { - xtype: 'combobox', - cls: 'pt-combo', - style: 'margin-bottom:2px; margin-top:0px', - width: pt.conf.layout.west_fieldset_width - pt.conf.layout.west_width_padding, - valueField: 'id', - displayField: 'name', - emptyText: PT.i18n.select_data_element_group, - editable: false, - store: { - xtype: 'store', - fields: ['id', 'name', 'index'], - proxy: { - type: 'ajax', - url: pt.conf.finals.ajax.path_api + pt.conf.finals.ajax.dataelementgroup_get, - reader: { - type: 'json', - root: 'dataElementGroups' - } - }, - listeners: { - load: function(s) { - s.add({ - id: 0, - name: PT.i18n.all_data_element_groups, - index: -1 - }); - s.sort([ - { - property: 'index', - direction: 'ASC' - }, - { - property: 'name', - direction: 'ASC' - } - ]); - } - } - }, - listeners: { - select: function(cb) { - var store = pt.store.dataElementAvailable; - store.parent = cb.getValue(); - - if (pt.util.store.containsParent(store)) { - pt.util.store.loadFromStorage(store); - pt.util.multiselect.filterAvailable(dataElementAvailable, dataElementSelected); - } - else { - if (cb.getValue() === 0) { - store.proxy.url = pt.conf.finals.ajax.path_api + pt.conf.finals.ajax.dataelement_getall; - store.load(); - } - else { - store.proxy.url = pt.conf.finals.ajax.path_api + pt.conf.finals.ajax.dataelement_get + cb.getValue() + '.json'; - store.load(); - } - } - } - } + xtype: 'container', + layout: 'column', + items: [ + dataElementGroupComboBox, + dataElementDetailLevel + ] }, { xtype: 'panel', @@ -3674,12 +3791,20 @@ }; validateSpecialCases = function(layout) { - var dimConf = pt.conf.finals.dimension; + var dimConf = pt.conf.finals.dimension, + dimensions, + objectNameDimensionMap = {}; if (!layout) { return; } + dimensions = [].concat(layout.columns, layout.rows, layout.filters); + + for (var i = 0; i < dimensions.length; i++) { + objectNameDimensionMap[dimensions[i].dimension] = dimensions[i]; + } + if (layout.filters && layout.filters.length) { for (var i = 0; i < layout.filters.length; i++) { @@ -3703,6 +3828,24 @@ } } + // dc and in + if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.indicator.objectName]) { + alert('Indicators and detailed data elements cannot be specified together'); + return; + } + + // dc and de + if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.dataElement.objectName]) { + alert('Detailed data elements and totals cannot be specified together'); + return; + } + + // dc and ds + if (objectNameDimensionMap[dimConf.operand.objectName] && objectNameDimensionMap[dimConf.dataSet.objectName]) { + alert('Data sets and detailed data elements cannot be specified together'); + return; + } + // Degs and datasets in the same query //if (Ext.Array.contains(dimensionNames, dimConf.data.dimensionName) && pt.store.dataSetSelected.data.length) { //for (var i = 0; i < pt.init.degs.length; i++) { === 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-06-25 17:47:12 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2013-06-26 16:11:35 +0000 @@ -10,6 +10,7 @@ ajax: { path_pivot: '../', path_api: '../../api/', + path_commons: '../../dhis-web-commons-ajax-json/', initialize: 'initialize.action', redirect: 'dhis-web-commons-about/redirect.action', data_get: 'chartValues.json', @@ -966,14 +967,20 @@ } }(); - var createValueIds = function() { + var createValueIdMap = function() { var valueHeaderIndex = response.nameHeaderMap[pt.conf.finals.dimension.value.value].index, - dimensionNames = xLayout.axisDimensionNames, + coHeader = response.nameHeaderMap[pt.conf.finals.dimension.category.dimensionName], + axisDimensionNames = xLayout.axisDimensionNames, idIndexOrder = []; // idIndexOrder - for (var i = 0; i < dimensionNames.length; i++) { - idIndexOrder.push(response.nameHeaderMap[dimensionNames[i]].index); + for (var i = 0; i < axisDimensionNames.length; i++) { + idIndexOrder.push(response.nameHeaderMap[axisDimensionNames[i]].index); + + // If co exists in response, add co after dx + if (coHeader && axisDimensionNames[i] === pt.conf.finals.dimension.data.dimensionName) { + idIndexOrder.push(coHeader.index); + } } // idValueMap @@ -1460,9 +1467,9 @@ valueObjectsRow = []; for (var j = 0, id, value, htmlValue, empty; j < colSize; j++) { - id = (xColAxis ? xColAxis.ids[j] : '') + (xRowAxis ? xRowAxis.ids[i] : ''); + id = (xColAxis ? pt.util.str.replaceAll(xColAxis.ids[j], '-', '') : '') + (xRowAxis ? pt.util.str.replaceAll(xRowAxis.ids[i], '-', '') : ''); empty = false; - + if (map[id]) { value = parseFloat(map[id]); htmlValue = pt.util.number.roundIf(map[id], 1).toString(); @@ -2007,7 +2014,7 @@ return; } - record.id = config.id; + record.id = config.id.replace('.', '-'); if (Ext.isString(config.name)) { record.name = config.name; === modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/styles/style.css' --- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/styles/style.css 2013-06-25 16:34:25 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/styles/style.css 2013-06-26 14:02:39 +0000 @@ -550,6 +550,10 @@ height: 32px; } +.x-btn-default-small { + border-radius: 1px; +} + .x-btn-default-toolbar-small-pressed { border-color: #bbb; background-image: none; @@ -829,16 +833,15 @@ padding: 6px 5px 4px 8px; border: 0 none; cursor: pointer; - border-top-left-radius: 1px; - border-top-right-radius: 1px; + border-radius: 0; background-image: none; background-color: #e0e0e0; - background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #dcdcdc), color-stop(100%, #e5e5e5)) !important; - background-image: -webkit-linear-gradient(top, #dcdcdc, #e5e5e5) !important; - background-image: -moz-linear-gradient(top, #dcdcdc, #e5e5e5) !important; - background-image: -o-linear-gradient(top, #dcdcdc, #e5e5e5) !important; - background-image: -ms-linear-gradient(top, #dcdcdc, #e5e5e5) !important; - background-image: linear-gradient(top, #dcdcdc, #e5e5e5) !important; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #dedede), color-stop(100%, #e6e6e6)) !important; + background-image: -webkit-linear-gradient(top, #dddddd, #e6e6e6) !important; + background-image: -moz-linear-gradient(top, #dddddd, #e6e6e6) !important; + background-image: -o-linear-gradient(top, #dddddd, #e6e6e6) !important; + background-image: -ms-linear-gradient(top, #dddddd, #e6e6e6) !important; + background-image: linear-gradient(top, #dddddd, #e6e6e6) !important; } /* accordion title dock, default, collapsed */ .pt-accordion .collapsed .x-accordion-hd { @@ -847,8 +850,7 @@ /* accordion title dock outer, shared */ .pt-accordion .x-accordion-item { - border-top-left-radius: 2px; - border-top-right-radius: 2px; + border-radius: 1px; } /* accordion title dock outer, default */ .pt-accordion .x-accordion-item { === modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/i18n.vm' --- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/i18n.vm 2013-06-25 16:34:25 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/i18n.vm 2013-06-26 15:56:41 +0000 @@ -125,5 +125,7 @@ legend_set: '$encoder.jsEscape($i18n.getString( 'legend_set' ) , "'")', select_organisation_units: '$encoder.jsEscape($i18n.getString( 'select_organisation_units' ) , "'")', select_boundaries_and_level: '$encoder.jsEscape($i18n.getString( 'select_boundaries_and_level' ) , "'")', - select_organisation_unit_level: '$encoder.jsEscape($i18n.getString( 'select_organisation_unit_level' ) , "'")' + select_organisation_unit_level: '$encoder.jsEscape($i18n.getString( 'select_organisation_unit_level' ) , "'")', + totals: '$encoder.jsEscape($i18n.getString( 'totals' ) , "'")', + details: '$encoder.jsEscape($i18n.getString( 'details' ) , "'")', }; === modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module_fr_FR.properties' --- dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module_fr_FR.properties 2013-06-26 12:18:21 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module_fr_FR.properties 2013-06-26 15:56:41 +0000 @@ -177,4 +177,6 @@ sharing_settings=Param\u00E8tres de partage select_organisation_units=S\u00E9lectionner les unit\u00E9s d'organisation select_boundaries_and_level=S\u00E9lectionner limites et le niveau -select_organisation_unit_level=S\u00E9lectionner le niveau de l'unit\u00E9 d'organisation \ No newline at end of file +select_organisation_unit_level=S\u00E9lectionner le niveau de l'unit\u00E9 d'organisation +details=D\u00E9tails +totals=Totaux \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/css/style.css' --- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/css/style.css 2013-06-26 12:18:21 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/css/style.css 2013-06-26 14:02:39 +0000 @@ -373,6 +373,10 @@ height: 32px; } +.x-btn-default-small { + border-radius: 1px; +} + .x-btn-default-toolbar-small-pressed { border-color: #bbb; background-image: none; @@ -646,12 +650,12 @@ border-top-right-radius: 1px; background-image: none; background-color: #e0e0e0; - background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #dcdcdc), color-stop(100%, #e5e5e5)) !important; - background-image: -webkit-linear-gradient(top, #dcdcdc, #e5e5e5) !important; - background-image: -moz-linear-gradient(top, #dcdcdc, #e5e5e5) !important; - background-image: -o-linear-gradient(top, #dcdcdc, #e5e5e5) !important; - background-image: -ms-linear-gradient(top, #dcdcdc, #e5e5e5) !important; - background-image: linear-gradient(top, #dcdcdc, #e5e5e5) !important; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #dedede), color-stop(100%, #e6e6e6)) !important; + background-image: -webkit-linear-gradient(top, #dedede, #e6e6e6) !important; + background-image: -moz-linear-gradient(top, #dedede, #e6e6e6) !important; + background-image: -o-linear-gradient(top, #dedede, #e6e6e6) !important; + background-image: -ms-linear-gradient(top, #dedede, #e6e6e6) !important; + background-image: linear-gradient(top, #dedede, #e6e6e6) !important; } /* accordion title dock, default, collapsed */ .dv-accordion .collapsed .x-accordion-hd { @@ -660,8 +664,7 @@ /* accordion title dock outer, shared */ .dv-accordion .x-accordion-item { - border-top-left-radius: 2px; - border-top-right-radius: 2px; + border-radius: 1px; } /* accordion title dock outer, default */ .dv-accordion .x-accordion-item { === 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-06-26 12:30:37 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js 2013-06-26 16:11:35 +0000 @@ -2634,7 +2634,7 @@ dataElementGroupComboBox = Ext.create('Ext.form.field.ComboBox', { cls: 'dv-combo', style: 'margin:0 2px 2px 0', - width: dv.conf.layout.west_fieldset_width - dv.conf.layout.west_width_padding - 110, + width: dv.conf.layout.west_fieldset_width - dv.conf.layout.west_width_padding - 90, valueField: 'id', displayField: 'name', emptyText: DV.i18n.select_data_element_group, @@ -2669,7 +2669,7 @@ editable: false, valueField: 'id', displayField: 'text', - width: 110 - 2, + width: 90 - 2, value: dv.conf.finals.dimension.dataElement.objectName, store: { fields: ['id', 'text'], === modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js' --- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js 2013-06-26 12:30:37 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js 2013-06-26 15:56:41 +0000 @@ -1260,7 +1260,6 @@ numberOfChars = str.length; width = (numberOfItems * itemLength) + (numberOfChars * charLength); -//alert(width + ' > ' + dv.viewport.centerRegion.getWidth() + '\n' + str); if (width > dv.viewport.centerRegion.getWidth() - 50) { isVertical = true; @@ -2005,7 +2004,7 @@ } // Layout - layout.type = config.type; + layout.type = config.type.toLowerCase(); layout.columns = config.columns; layout.rows = config.rows;