=== 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 2013-03-10 12:38:39 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2013-03-11 14:11:16 +0000 @@ -303,6 +303,11 @@ * Indicates rendering of sub-totals for the table. */ private boolean subtotals; + + /** + * Indicates rendering of empty rows for the table. + */ + private boolean hideEmptyRows; /** * The display density of the text in the table. @@ -1384,6 +1389,19 @@ @JsonProperty @JsonView( {DetailedView.class, ExportView.class} ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0) + public boolean isHideEmptyRows() + { + return hideEmptyRows; + } + + public void setHideEmptyRows( boolean hideEmptyRows ) + { + this.hideEmptyRows = hideEmptyRows; + } + + @JsonProperty + @JsonView( {DetailedView.class, ExportView.class} ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0) public String getDisplayDensity() { return displayDensity; @@ -1611,6 +1629,7 @@ sortOrder = reportTable.getSortOrder() == null ? sortOrder : reportTable.getSortOrder(); topLimit = reportTable.getTopLimit() == null ? topLimit : reportTable.getTopLimit(); subtotals = reportTable.isSubtotals(); + hideEmptyRows = reportTable.isHideEmptyRows(); displayDensity = reportTable.getDisplayDensity(); fontSize = reportTable.getFontSize(); userOrganisationUnit = reportTable.isUserOrganisationUnit(); === 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 2013-03-10 12:38:39 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2013-03-11 14:31:35 +0000 @@ -422,10 +422,11 @@ executeSql( "update reporttable set last5financialyears = false where last5financialyears is null" ); executeSql( "update reporttable set cumulative = false where cumulative is null" ); executeSql( "update reporttable set subtotals = false where subtotals is null" ); - executeSql( "update reporttable set userOrganisationUnit = false where userOrganisationUnit is null" ); - executeSql( "update reporttable set userOrganisationUnitChildren = false where userOrganisationUnitChildren is null" ); + executeSql( "update reporttable set userorganisationunit = false where userorganisationunit is null" ); + executeSql( "update reporttable set userorganisationunitchildren = false where userorganisationunitchildren is null" ); executeSql( "update reporttable set displaydensity = 'normal' where displaydensity is null" ); executeSql( "update reporttable set fontsize = 'normal' where fontsize is null" ); + executeSql( "update reporttable set hideemptyrows = false where hideemptyrows is null" ); executeSql( "update chart set reportingmonth = false where reportingmonth is null" ); executeSql( "update chart set reportingbimonth = false where reportingbimonth 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 2013-02-27 16:14:56 +0000 +++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/reporttable/hibernate/ReportTable.hbm.xml 2013-03-11 14:11:16 +0000 @@ -136,9 +136,15 @@ + + + + + + === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js 2013-02-07 07:45:56 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js 2013-03-11 15:11:59 +0000 @@ -1714,7 +1714,7 @@ { dataIndex: 'name', sortable: false, - width: 334, + width: 340, renderer: function(value, metaData, record) { var fn = function() { var el = Ext.get(record.data.id); @@ -1974,6 +1974,7 @@ title: 'Manage favorites', iconCls: 'gis-window-title-icon-favorite', cls: 'gis-container-default', + bodyStyle: 'padding:5px', resizable: false, modal: true, width: 450, === 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-08 16:25:52 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2013-03-11 15:11:59 +0000 @@ -28,6 +28,22 @@ init.rootNodes[i].path = '/' + pt.conf.finals.root.id + '/' + init.rootNodes[i].id; } + // Ougs + for (var i = 0, dim = pt.conf.finals.dimension, oug; i < init.ougs.length; i++) { + oug = init.ougs[i]; + oug.dimensionName = oug.id; + oug.objectName = pt.conf.finals.dimension.organisationUnitGroupSet.objectName; + dim.objectNameMap[oug.id] = oug; + } + + // Degs + for (var i = 0, dim = pt.conf.finals.dimension, deg; i < init.degs.length; i++) { + deg = init.degs[i]; + deg.dimensionName = deg.id; + deg.objectName = pt.conf.finals.dimension.dataElementGroupSet.objectName; + dim.objectNameMap[deg.id] = deg; + } + init.afterRender = function() { pt.cmp.dimension.panels[0].expand(); @@ -81,6 +97,15 @@ else { w.setPosition(targetx, y); } + }, + addBlurHandler: function(w) { + var el = Ext.get(document.getElementsByClassName('x-mask')[0]); + + el.on('click', function() { + w.hide(); + }); + + w.hasBlurHandler = true; } }; @@ -150,6 +175,9 @@ config.options = pt.viewport.optionsWindow.getOptions(); + config.options.userOrganisationUnit = pt.viewport.userOrganisationUnit.getValue(); + config.options.userOrganisationUnitChildren = pt.viewport.userOrganisationUnitChildren.getValue(); + return config; }; @@ -380,14 +408,14 @@ var data = []; if (all) { - data.push({id: dimConf.data.dimensionName, name: dimConf.data.rawValue}); + data.push({id: dimConf.data.dimensionName, name: dimConf.data.name}); } - data.push({id: dimConf.category.dimensionName, name: dimConf.category.rawValue}); + data.push({id: dimConf.category.dimensionName, name: dimConf.category.name}); if (all) { - data.push({id: dimConf.period.dimensionName, name: dimConf.period.rawValue}); - data.push({id: dimConf.organisationUnit.dimensionName, name: dimConf.organisationUnit.rawValue}); + data.push({id: dimConf.period.dimensionName, name: dimConf.period.name}); + data.push({id: dimConf.organisationUnit.dimensionName, name: dimConf.organisationUnit.name}); } return data.concat(pt.init.ougs, pt.init.degs); @@ -427,15 +455,15 @@ rowStore = getStore(); pt.viewport.rowStore = rowStore; - rowStore.add({id: dimConf.period.dimensionName, name: dimConf.period.rawValue}); //i18n + rowStore.add({id: dimConf.period.dimensionName, name: dimConf.period.name}); //i18n colStore = getStore(); pt.viewport.colStore = colStore; - colStore.add({id: dimConf.data.dimensionName, name: dimConf.data.rawValue}); //i18n + colStore.add({id: dimConf.data.dimensionName, name: dimConf.data.name}); //i18n filterStore = getStore(); pt.viewport.filterStore = filterStore; - filterStore.add({id: dimConf.organisationUnit.dimensionName, name: dimConf.organisationUnit.rawValue}); //i18n + filterStore.add({id: dimConf.organisationUnit.dimensionName, name: dimConf.organisationUnit.name}); //i18n getCmpHeight = function() { var size = dimensionStore.totalCount, @@ -656,13 +684,7 @@ pt.util.window.setAnchorPosition(w, pt.viewport.layoutButton); if (!w.hasBlurHandler) { - var el = Ext.get(document.getElementsByClassName('x-mask')[0]); - - el.on('click', function() { - w.hide(); - }); - - w.hasBlurHandler = true; + pt.util.window.addBlurHandler(w); } } } @@ -805,13 +827,7 @@ pt.util.window.setAnchorPosition(w, pt.viewport.optionsButton); if (!w.hasBlurHandler) { - var el = Ext.get(document.getElementsByClassName('x-mask')[0]); - - el.on('click', function() { - w.hide(); - }); - - w.hasBlurHandler = true; + pt.util.window.addBlurHandler(w); } } } @@ -861,6 +877,9 @@ if (pt.xSettings) { favorite = Ext.clone(pt.xSettings.options); + // server + favorite.subtotals = favorite.showSubTotals; + favorite.name = name; favorite.user = system ? null : {id: 'currentUser'}; @@ -1079,7 +1098,7 @@ }); searchTextfield = Ext.create('Ext.form.field.Text', { - width: 340, + width: 350, height: 26, fieldStyle: 'padding-right: 0; padding-left: 6px; border-radius: 1px; border-color: #bbb; font-size:11px', emptyText: 'Search for favorites', //i18n @@ -1141,7 +1160,7 @@ { dataIndex: 'name', sortable: false, - width: 334, + width: 340, renderer: function(value, metaData, record) { var fn = function() { var el = Ext.get(record.data.id); @@ -1150,7 +1169,10 @@ el.addClsOnOver('link'); el.pt = pt; el.favoriteId = record.data.id; - el.dom.setAttribute('onclick', 'Ext.get(this).pt.util.pivot.loadTable(Ext.get(this).favoriteId);'); + el.hideWindow = function() { + favoriteWindow.hide(); + }; + el.dom.setAttribute('onclick', 'Ext.get(this).hideWindow(); Ext.get(this).pt.util.pivot.loadTable(Ext.get(this).favoriteId);'); } }; @@ -1376,7 +1398,7 @@ favoriteWindow = Ext.create('Ext.window.Window', { title: 'Manage favorites', //iconCls: 'pt-window-title-icon-favorite', - bodyStyle: 'padding: 8px; background-color:#fff', + bodyStyle: 'padding: 5px; background-color:#fff', resizable: false, modal: true, width: 450, @@ -1384,14 +1406,13 @@ { xtype: 'panel', layout: 'hbox', - width: 422, bodyStyle: 'border:0 none', items: [ addButton, { height: 24, width: 1, - style: 'width: 1px; margin-left: 7px; margin-right: 7px; margin-top: 1px', + style: 'width: 1px; margin-left: 5px; margin-right: 5px; margin-top: 1px', bodyStyle: 'border-left: 1px solid #aaa' }, searchTextfield @@ -1402,6 +1423,10 @@ listeners: { show: function(w) { pt.util.window.setAnchorPosition(w, pt.viewport.favoriteButton); + + if (!w.hasBlurHandler) { + pt.util.window.addBlurHandler(w); + } } } }); @@ -1427,6 +1452,9 @@ fixedPeriodAvailable, fixedPeriodSelected, period, + userOrganisationUnit, + userOrganisationUnitChildren, + treePanel, organisationUnit, groupSetIdStoreMap, getGroupSetPanels, @@ -2141,24 +2169,24 @@ boxLabel: 'Last 5 years', //i18n pt.i18n.last_5_years } ] - }, - { - xtype: 'panel', - layout: 'anchor', - bodyStyle: 'border-style:none; padding:5px 0 0 46px', - defaults: { - labelSeparator: '', - style: 'margin-bottom:2px', - }, - items: [ - { - xtype: 'label', - text: 'Options', - cls: 'pt-label-period-heading-options' - }, - rewind - ] } + //{ + //xtype: 'panel', + //layout: 'anchor', + //bodyStyle: 'border-style:none; padding:5px 0 0 46px', + //defaults: { + //labelSeparator: '', + //style: 'margin-bottom:2px', + //}, + //items: [ + //{ + //xtype: 'label', + //text: 'Options', + //cls: 'pt-label-period-heading-options' + //}, + //rewind + //] + //} ] } ] @@ -2366,6 +2394,176 @@ } }; + treePanel = Ext.create('Ext.tree.Panel', { + cls: 'pt-tree', + style: 'border-top: 1px solid #ddd; padding-top: 1px', + width: pt.conf.layout.west_fieldset_width - pt.conf.layout.west_width_padding, + rootVisible: false, + autoScroll: true, + multiSelect: true, + rendered: false, + reset: function() { + var rootNode = this.getRootNode().findChild('id', pt.init.rootNodes[0].id); + this.collapseAll(); + this.expandPath(rootNode.getPath()); + this.getSelectionModel().select(rootNode); + }, + selectRootIf: function() { + if (this.getSelectionModel().getSelection().length < 1) { + var node = this.getRootNode().findChild('id', pt.init.rootNodes[0].id); + if (this.rendered) { + this.getSelectionModel().select(node); + } + return node; + } + }, + numberOfRecords: 0, + recordsToSelect: [], + multipleSelectIf: function() { + if (this.recordsToSelect.length === this.numberOfRecords) { + this.getSelectionModel().select(this.recordsToSelect); + this.recordsToSelect = []; + this.numberOfRecords = 0; + } + }, + multipleExpand: function(id, path) { + this.expandPath('/' + pt.conf.finals.root.id + path, 'id', '/', function() { + var record = this.getRootNode().findChild('id', id, true); + this.recordsToSelect.push(record); + this.multipleSelectIf(); + }, this); + }, + select: function(url, params) { + if (!params) { + params = {}; + } + Ext.Ajax.request({ + url: url, + method: 'GET', + params: params, + scope: this, + success: function(r) { + var a = Ext.decode(r.responseText).organisationUnits; + this.numberOfRecords = a.length; + for (var i = 0; i < a.length; i++) { + this.multipleExpand(a[i].id, a[i].path); + } + } + }); + }, + selectByGroup: function(id) { + if (id) { + var url = pt.conf.finals.ajax.path_pivot + pt.conf.finals.ajax.organisationunit_getbygroup, + params = {id: id}; + this.select(url, params); + } + }, + selectByLevel: function(level) { + if (level) { + var url = pt.conf.finals.ajax.path_pivot + pt.conf.finals.ajax.organisationunit_getbylevel, + params = {level: level}; + this.select(url, params); + } + }, + selectByIds: function(ids) { + if (ids) { + var url = pt.conf.finals.ajax.path_pivot + pt.conf.finals.ajax.organisationunit_getbyids; + Ext.Array.each(ids, function(item) { + url = Ext.String.urlAppend(url, 'ids=' + item); + }); + if (!this.rendered) { + pt.cmp.dimension.organisationUnit.panel.expand(); + } + this.select(url); + } + }, + store: Ext.create('Ext.data.TreeStore', { + proxy: { + type: 'ajax', + url: pt.conf.finals.ajax.path_pivot + pt.conf.finals.ajax.organisationunitchildren_get + }, + root: { + id: pt.conf.finals.root.id, + expanded: true, + children: pt.init.rootNodes + }, + listeners: { + load: function(s, node, r) { + for (var i = 0; i < r.length; i++) { + r[i].data.text = pt.conf.util.jsonEncodeString(r[i].data.text); + } + } + } + }), + xable: function(checked, value) { + if (checked || value) { + this.disable(); + } + else { + this.enable(); + } + }, + listeners: { + added: function() { + pt.cmp.dimension.organisationUnit.treepanel = this; + }, + render: function() { + this.rendered = true; + }, + afterrender: function() { + this.getSelectionModel().select(0); + }, + itemcontextmenu: function(v, r, h, i, e) { + v.getSelectionModel().select(r, false); + + if (v.menu) { + v.menu.destroy(); + } + v.menu = Ext.create('Ext.menu.Menu', { + id: 'treepanel-contextmenu', + showSeparator: false, + shadow: false + }); + if (!r.data.leaf) { + v.menu.add({ + id: 'treepanel-contextmenu-item', + text: 'Select all children', //i18n pt.i18n.select_all_children, + icon: 'images/node-select-child.png', + handler: function() { + r.expand(false, function() { + v.getSelectionModel().select(r.childNodes, true); + v.getSelectionModel().deselect(r); + }); + } + }); + } + else { + return; + } + + v.menu.showAt(e.xy); + } + } + }); + + userOrganisationUnit = Ext.create('Ext.form.field.Checkbox', { + columnWidth: 0.5, + boxLabel: 'User organisation unit', //i18n pt.i18n.user_orgunit, + labelWidth: pt.conf.layout.form_label_width, + handler: function(chb, checked) { + treePanel.xable(checked, userOrganisationUnitChildren.getValue()); + } + }); + + userOrganisationUnitChildren = Ext.create('Ext.form.field.Checkbox', { + columnWidth: 0.5, + boxLabel: 'User organisation unit children', //i18n pt.i18n.user_orgunit_children, + labelWidth: pt.conf.layout.form_label_width, + handler: function(chb, checked) { + treePanel.xable(checked, userOrganisationUnit.getValue()); + } + }); + organisationUnit = { xtype: 'panel', title: '
Organisation units
', //i18n pt.i18n.organisation_units @@ -2373,7 +2571,7 @@ hideCollapseTool: true, collapsed: false, getData: function() { - var records = pt.cmp.dimension.organisationUnit.treepanel.getSelectionModel().getSelection(), + var records = treePanel.getSelectionModel().getSelection(), data = { dimensionName: pt.conf.finals.dimension.organisationUnit.dimensionName, objectName: pt.conf.finals.dimension.organisationUnit.objectName, @@ -2388,279 +2586,18 @@ }, onExpand: function() { pt.util.dimension.panel.setHeight(pt.conf.layout.west_maxheight_accordion_organisationunit); - pt.cmp.dimension.organisationUnit.treepanel.setHeight(this.getHeight() - pt.conf.layout.west_fill_accordion_organisationunit); + treePanel.setHeight(this.getHeight() - pt.conf.layout.west_fill_accordion_organisationunit); }, items: [ { layout: 'column', bodyStyle: 'border:0 none; padding-bottom:3px; padding-left:7px', items: [ - { - xtype: 'checkbox', - columnWidth: 0.5, - boxLabel: 'User organisation unit', //i18n pt.i18n.user_orgunit, - labelWidth: pt.conf.layout.form_label_width, - handler: function(chb, checked) { - //pt.cmp.dimension.organisationUnit.toolbar.xable(checked, pt.cmp.favorite.userOrganisationUnitChildren.getValue()); - pt.cmp.dimension.organisationUnit.treepanel.xable(checked, pt.cmp.favorite.userOrganisationUnitChildren.getValue()); - }, - listeners: { - added: function() { - pt.cmp.favorite.userOrganisationUnit = this; - } - } - }, - { - xtype: 'checkbox', - columnWidth: 0.5, - boxLabel: 'User organisation unit children', //i18n pt.i18n.user_orgunit_children, - labelWidth: pt.conf.layout.form_label_width, - handler: function(chb, checked) { - //pt.cmp.dimension.organisationUnit.toolbar.xable(checked, pt.cmp.favorite.userOrganisationUnit.getValue()); - pt.cmp.dimension.organisationUnit.treepanel.xable(checked, pt.cmp.favorite.userOrganisationUnit.getValue()); - }, - listeners: { - added: function() { - pt.cmp.favorite.userOrganisationUnitChildren = this; - } - } - } + userOrganisationUnit, + userOrganisationUnitChildren ] }, - //{ - //id: 'organisationunit_t', - //xtype: 'toolbar', - //style: 'margin-bottom: 4px', - //width: pt.conf.layout.west_fieldset_width - pt.conf.layout.west_width_padding, - //xable: function(checked, value) { - //if (checked || value) { - //this.disable(); - //} - //else { - //this.enable(); - //} - //}, - //defaults: { - //height: 22 - //}, - //items: [ - //{ - //xtype: 'label', - //text: 'Auto-select organisation units by', //i18n - //style: 'padding-left:8px; color:#666; line-height:23px' - //}, - //'->', - //{ - //text: 'Group..', - //handler: function() {}, - //listeners: { - //added: function() { - //this.menu = Ext.create('Ext.menu.Menu', { - //shadow: false, - //showSeparator: false, - //width: pt.conf.layout.treepanel_toolbar_menu_width_group, - //items: [ - //{ - //xtype: 'grid', - //cls: 'pt-menugrid', - //width: pt.conf.layout.treepanel_toolbar_menu_width_group, - //scroll: 'vertical', - //columns: [ - //{ - //dataIndex: 'name', - //width: pt.conf.layout.treepanel_toolbar_menu_width_group, - //style: 'display:none' - //} - //], - //setHeightInMenu: function(store) { - //var h = store.getCount() * 24, - //sh = pt.util.viewport.getSize().y * 0.6; - //this.setHeight(h > sh ? sh : h); - //this.doLayout(); - //this.up('menu').doLayout(); - //}, - //store: pt.store.group, - //listeners: { - //itemclick: function(g, r) { - //g.getSelectionModel().select([], false); - //this.up('menu').hide(); - //pt.cmp.dimension.organisationUnit.treepanel.selectByGroup(r.data.id); - //} - //} - //} - //], - //listeners: { - //show: function() { - //var store = pt.store.group; - - //if (!store.isLoaded) { - //store.load({scope: this, callback: function() { - //this.down('grid').setHeightInMenu(store); - //}}); - //} - //else { - //this.down('grid').setHeightInMenu(store); - //} - //} - //} - //}); - //} - //} - //} - //], - //listeners: { - //added: function() { - //pt.cmp.dimension.organisationUnit.toolbar = this; - //} - //} - //}, - { - xtype: 'treepanel', - cls: 'pt-tree', - style: 'border-top: 1px solid #ddd; padding-top: 1px', - width: pt.conf.layout.west_fieldset_width - pt.conf.layout.west_width_padding, - rootVisible: false, - autoScroll: true, - multiSelect: true, - rendered: false, - selectRootIf: function() { - if (this.getSelectionModel().getSelection().length < 1) { - var node = this.getRootNode().findChild('id', pt.init.rootnodes[0].id, true); - if (this.rendered) { - this.getSelectionModel().select(node); - } - return node; - } - }, - numberOfRecords: 0, - recordsToSelect: [], - multipleSelectIf: function() { - if (this.recordsToSelect.length === this.numberOfRecords) { - this.getSelectionModel().select(this.recordsToSelect); - this.recordsToSelect = []; - this.numberOfRecords = 0; - } - }, - multipleExpand: function(id, path) { - this.expandPath('/' + pt.conf.finals.root.id + path, 'id', '/', function() { - var record = this.getRootNode().findChild('id', id, true); - this.recordsToSelect.push(record); - this.multipleSelectIf(); - }, this); - }, - select: function(url, params) { - if (!params) { - params = {}; - } - Ext.Ajax.request({ - url: url, - method: 'GET', - params: params, - scope: this, - success: function(r) { - var a = Ext.decode(r.responseText).organisationUnits; - this.numberOfRecords = a.length; - for (var i = 0; i < a.length; i++) { - this.multipleExpand(a[i].id, a[i].path); - } - } - }); - }, - selectByGroup: function(id) { - if (id) { - var url = pt.conf.finals.ajax.path_pivot + pt.conf.finals.ajax.organisationunit_getbygroup, - params = {id: id}; - this.select(url, params); - } - }, - selectByLevel: function(level) { - if (level) { - var url = pt.conf.finals.ajax.path_pivot + pt.conf.finals.ajax.organisationunit_getbylevel, - params = {level: level}; - this.select(url, params); - } - }, - selectByIds: function(ids) { - if (ids) { - var url = pt.conf.finals.ajax.path_pivot + pt.conf.finals.ajax.organisationunit_getbyids; - Ext.Array.each(ids, function(item) { - url = Ext.String.urlAppend(url, 'ids=' + item); - }); - if (!this.rendered) { - pt.cmp.dimension.organisationUnit.panel.expand(); - } - this.select(url); - } - }, - store: Ext.create('Ext.data.TreeStore', { - proxy: { - type: 'ajax', - url: pt.conf.finals.ajax.path_pivot + pt.conf.finals.ajax.organisationunitchildren_get - }, - root: { - id: pt.conf.finals.root.id, - expanded: true, - children: pt.init.rootNodes - }, - listeners: { - load: function(s, node, r) { - for (var i = 0; i < r.length; i++) { - r[i].data.text = pt.conf.util.jsonEncodeString(r[i].data.text); - } - } - } - }), - xable: function(checked, value) { - if (checked || value) { - this.disable(); - } - else { - this.enable(); - } - }, - listeners: { - added: function() { - pt.cmp.dimension.organisationUnit.treepanel = this; - organisationUnit.treePanel = this; - }, - render: function() { - this.rendered = true; - }, - afterrender: function() { - this.getSelectionModel().select(0); - }, - itemcontextmenu: function(v, r, h, i, e) { - v.getSelectionModel().select(r, false); - - if (v.menu) { - v.menu.destroy(); - } - v.menu = Ext.create('Ext.menu.Menu', { - id: 'treepanel-contextmenu', - showSeparator: false, - shadow: false - }); - if (!r.data.leaf) { - v.menu.add({ - id: 'treepanel-contextmenu-item', - text: 'Select all children', //i18n pt.i18n.select_all_children, - icon: 'images/node-select-child.png', - handler: function() { - r.expand(false, function() { - v.getSelectionModel().select(r.childNodes, true); - v.getSelectionModel().deselect(r); - }); - } - }); - } - else { - return; - } - - v.menu.showAt(e.xy); - } - } - } + treePanel ], listeners: { added: function() { @@ -3141,26 +3078,26 @@ setFavorite = function(r) { // Indicators + pt.store.indicatorSelected.removeAll(); if (Ext.isArray(r.indicators)) { - pt.store.indicatorSelected.removeAll(); pt.store.indicatorSelected.add(r.indicators); } // Data elements + pt.store.dataElementSelected.removeAll(); if (Ext.isArray(r.dataElements)) { - pt.store.dataElementSelected.removeAll(); pt.store.dataElementSelected.add(r.dataElements); } // Data sets + pt.store.dataSetSelected.removeAll(); if (Ext.isArray(r.dataSets)) { - pt.store.dataSetsSelected.removeAll(); - pt.store.dataSetsSelected.add(r.dataSets); + pt.store.dataSetSelected.add(r.dataSets); } // Fixed periods + pt.store.fixedPeriodSelected.removeAll(); if (Ext.isArray(r.periods)) { - pt.store.fixedPeriodSelected.removeAll(); pt.store.fixedPeriodSelected.add(r.periods); } @@ -3181,12 +3118,20 @@ // Organisation units if (Ext.isArray(r.organisationUnits) && Ext.isObject(r.parentGraphMap)) { + treePanel.numberOfRecords = pt.util.object.getLength(r.parentGraphMap); + for (var key in r.parentGraphMap) { if (r.parentGraphMap.hasOwnProperty(key)) { - organisationUnit.treePanel.selectPath('/root' + r.parentGraphMap[key] + '/' + key); + treePanel.multipleExpand(key, r.parentGraphMap[key]); } } } + else { + treePanel.reset(); + } + + userOrganisationUnit.setValue(r.userOrganisationUnit); + userOrganisationUnitChildren.setValue(r.userOrganisationUnitChildren); // Organisation unit group sets if (Ext.isObject(r.organisationUnitGroupSets)) { @@ -3219,7 +3164,7 @@ dim = pt.conf.finals.dimension.objectNameMap[r.columnDimensions[i]]; pt.viewport.colStore.add({ id: dim.dimensionName, - name: dim.rawValue + name: dim.name }); } } @@ -3229,7 +3174,7 @@ dim = pt.conf.finals.dimension.objectNameMap[r.rowDimensions[i]]; pt.viewport.rowStore.add({ id: dim.dimensionName, - name: dim.rawValue + name: dim.name }); } } @@ -3239,16 +3184,16 @@ dim = pt.conf.finals.dimension.objectNameMap[r.filterDimensions[i]]; pt.viewport.filterStore.add({ id: dim.dimensionName, - name: dim.rawValue + name: dim.name }); } } // Options - pt.viewport.showSubTotals.setValue(!!r.subtotals); - pt.viewport.hideEmptyRows.setValue(!!r.hideEmptyRows); - pt.viewport.displayDensity.setValue(!!r.displayDensity); - pt.viewport.fontSize.setValue(!!r.fontSize); + pt.viewport.showSubTotals.setValue(r.subtotals); + pt.viewport.hideEmptyRows.setValue(r.hideEmptyRows); + pt.viewport.displayDensity.setValue(r.displayDensity); + pt.viewport.fontSize.setValue(r.fontSize); update(); }; @@ -3262,6 +3207,8 @@ optionsButton: optionsButton, favoriteButton: favoriteButton, downloadButton: downloadButton, + userOrganisationUnit: userOrganisationUnit, + userOrganisationUnitChildren: userOrganisationUnitChildren, setFavorite: setFavorite, groupSetIdStoreMap: groupSetIdStoreMap, items: [ === 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-10 16:59:38 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2013-03-11 15:05:14 +0000 @@ -43,7 +43,7 @@ dimension: { data: { value: 'data', - rawValue: 'Data', //i18n PT.i18n.data, + name: 'Data', //i18n PT.i18n.data, dimensionName: 'dx', objectName: 'dx', warning: { @@ -51,31 +51,31 @@ } }, category: { - rawValue: 'Categories', + name: 'Categories', dimensionName: 'co', objectName: 'co', }, indicator: { value: 'indicators', - rawValue: 'Indicators', //i18n PT.i18n.indicator, + name: 'Indicators', //i18n PT.i18n.indicator, dimensionName: 'dx', objectName: 'in' }, dataElement: { value: 'dataElements', - rawValue: 'Data elements', //i18n PT.i18n.data_element, + name: 'Data elements', //i18n PT.i18n.data_element, dimensionName: 'dx', objectName: 'de' }, dataSet: { value: 'dataSets', - rawValue: 'Data sets', //i18n PT.i18n.dataset, + name: 'Data sets', //i18n PT.i18n.dataset, dimensionName: 'dx', objectName: 'ds' }, period: { value: 'period', - rawValue: 'Periods', //i18n PT.i18n.period, + name: 'Periods', //i18n PT.i18n.period, dimensionName: 'pe', objectName: 'pe', warning: { @@ -90,9 +90,11 @@ }, organisationUnit: { value: 'organisationUnits', - rawValue: 'Organisation units', //i18n PT.i18n.organisation_unit, + name: 'Organisation units', //i18n PT.i18n.organisation_unit, dimensionName: 'ou', objectName: 'ou', + userOrganisationUnit: 'USER_ORGUNIT', + userOrganisationUnitChildren: 'USER_ORGUNIT_CHILDREN', warning: { filter: '...'//PT.i18n.wm_multiple_filter_orgunit } @@ -121,6 +123,7 @@ dim.objectNameMap[dim.indicator.objectName] = dim.indicator; dim.objectNameMap[dim.dataElement.objectName] = dim.dataElement; dim.objectNameMap[dim.dataSet.objectName] = dim.dataSet; + dim.objectNameMap[dim.category.objectName] = dim.category; dim.objectNameMap[dim.period.objectName] = dim.period; dim.objectNameMap[dim.organisationUnit.objectName] = dim.organisationUnit; dim.objectNameMap[dim.organisationUnitGroupSet.objectName] = dim.organisationUnitGroupSet; @@ -185,7 +188,7 @@ west_fill_accordion_indicator: 63, west_fill_accordion_dataelement: 63, west_fill_accordion_dataset: 33, - west_fill_accordion_period: 256, + west_fill_accordion_period: 240, west_fill_accordion_organisationunit: 62, west_maxheight_accordion_indicator: 400, west_maxheight_accordion_dataelement: 400, @@ -490,8 +493,15 @@ }, roundIf: function(x, fix) { - var dec = pt.util.number.getNumberOfDecimals(x); - return parseFloat(dec > fix ? x.toFixed(fix) : x); + if (Ext.isString(x)) { + x = parseFloat(x); + } + + if (Ext.isNumber(x) && Ext.isNumber(fix)) { + var dec = pt.util.number.getNumberOfDecimals(x); + return parseFloat(dec > fix ? x.toFixed(fix) : x); + } + return x; }, pp: function(x) { === modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/plugin.js' --- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/plugin.js 2013-03-08 16:25:52 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/plugin.js 2013-03-11 13:53:25 +0000 @@ -13,9 +13,12 @@ {name: 'ou', items: ['ImspTQPwCqd']} ], options: { - showSubTotals: false, + showSubTotals: true, + hideEmptyRows: false, displayDensity: 'normal', - fontSize: 'normal' + fontSize: 'normal', + userOrganisationUnit: true, + userOrganisationUnitChildren: false } }; === 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-06 18:50:22 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js 2013-03-11 13:05:31 +0000 @@ -3930,10 +3930,7 @@ items: [ { xtype: 'checkbox', - //style: 'margin-right:6px', - //columnWidth: 0.5, boxLabel: DV.i18n.show_data, - //labelWidth: DV.conf.layout.form_label_width, listeners: { added: function() { DV.cmp.favorite.showdata = this; @@ -3942,10 +3939,7 @@ }, { xtype: 'checkbox', - //style: 'margin-right:6px', - //columnWidth: 0.5, boxLabel: DV.i18n.trend_line, - //labelWidth: DV.conf.layout.form_label_width, listeners: { added: function() { DV.cmp.favorite.trendline = this; @@ -3961,9 +3955,7 @@ items: [ { xtype: 'checkbox', - //width: ((DV.conf.layout.west_fieldset_width - DV.conf.layout.west_width_padding) / 2) - 3, boxLabel: DV.i18n.hide_legend, - //labelWidth: DV.conf.layout.form_label_width, listeners: { added: function() { DV.cmp.favorite.hidelegend = this; @@ -3972,9 +3964,7 @@ }, { xtype: 'checkbox', - //width: ((DV.conf.layout.west_fieldset_width - DV.conf.layout.west_width_padding) / 2) - 1, boxLabel: DV.i18n.hide_subtitle, - //labelWidth: DV.conf.layout.form_label_width, listeners: { added: function() { DV.cmp.favorite.hidesubtitle = this;