=== 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-10-08 15:02:26 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2013-10-16 17:37:28 +0000 @@ -187,12 +187,12 @@ w.hasDestroyOnBlurHandler = true; }; - + util.message = { alert: function(message) { alert(message); } - } + } }()); // init @@ -963,7 +963,7 @@ style: 'margin-bottom:4px' }); pt.viewport.showHierarchy = showHierarchy; - + displayDensity = Ext.create('Ext.form.field.ComboBox', { cls: 'pt-combo', style: 'margin-bottom:3px', @@ -1130,7 +1130,7 @@ hideEmptyRows ] }; - + organisationUnits = { bodyStyle: 'border:0 none', style: 'margin-left:14px', @@ -2026,7 +2026,7 @@ userGroupRowContainer = Ext.create('Ext.container.Container', { bodyStyle: 'border:0 none' }); - + if (sharing.meta.allowExternalAccess) { externalAccess = userGroupRowContainer.add({ xtype: 'checkbox', @@ -2219,7 +2219,7 @@ createViewport = function() { var dimConf = pt.conf.finals.dimension, - + indicatorAvailable, indicatorSelected, indicator, @@ -3399,11 +3399,11 @@ }, multipleExpand: function(id, path, doUpdate) { var rootId = pt.conf.finals.root.id; - + if (path.substr(0, rootId.length + 1) !== ('/' + rootId)) { path = '/' + rootId + path; } - + this.expandPath('/' + path, 'id', '/', function() { var record = this.getRootNode().findChild('id', id, true); this.recordsToSelect.push(record); @@ -3431,14 +3431,14 @@ getParentGraphMap: function() { var selection = this.getSelectionModel().getSelection(), map = {}; - + if (Ext.isArray(selection) && selection.length) { for (var i = 0, pathArray, key; i < selection.length; i++) { pathArray = selection[i].getPath().split('/'); map[pathArray.pop()] = pathArray.join('/'); } } - + return map; }, selectGraphMap: function(map, doUpdate) { @@ -3589,7 +3589,7 @@ if (!param) { return; } - + var items = this.items.items; this.menuValue = param; @@ -4479,7 +4479,7 @@ // State downloadButton.enable(); - + if (isFavorite) { interpretationButton.enable(); } @@ -4686,6 +4686,7 @@ userOrganisationUnit: userOrganisationUnit, userOrganisationUnitChildren: userOrganisationUnitChildren, dataElementDetailLevel: dataElementDetailLevel, + treePanel: treePanel, setGui: setGui, items: [ westRegion, @@ -4744,10 +4745,10 @@ url: '../initialize.action', success: function(r) { var init = Ext.decode(r.responseText); - + PT.i18n = init.i18n; - - pt = PT.core.getInstance(init); + + pt = PT.core.getInstance(init); PT.app.extendInstance(pt); === 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-10-16 12:10:40 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2013-10-16 17:51:18 +0000 @@ -1689,7 +1689,12 @@ // add uuids array to leaves if (aAllObjects.length) { - for (var i = 0, leaf, parentUuids, obj, span = aAllObjects.length > 1 ? aSpan[aAllObjects.length - 2] : 1, leafUuids = []; i < aAllObjects[aAllObjects.length - 1].length; i++) { + + // Span is second-last in aSpan - or axis size (instead of 1 - to highlight all leaves when dim == 1 ) + var span = aAllObjects.length > 1 ? aSpan[aAllObjects.length - 2] : nCols; + //var span = aAllObjects.length > 1 ? aSpan[aAllObjects.length - 2] : 1; + + for (var i = 0, leaf, parentUuids, obj, leafUuids = []; i < aAllObjects[aAllObjects.length - 1].length; i++) { leaf = aAllObjects[aAllObjects.length - 1][i]; leafUuids.push(leaf.uuid); parentUuids = []; @@ -1706,7 +1711,7 @@ // add uuid for all leaves if (leafUuids.length === span) { - for (var j = i - span + 1, leaf; j <= i; j++) { + for (var j = (i - span) + 1, leaf; j <= i; j++) { leaf = aAllObjects[aAllObjects.length - 1][j]; leaf.uuids = leaf.uuids.concat(Ext.clone(leafUuids)); } @@ -2646,6 +2651,7 @@ uuids = pt.uuidDimUuidsMap[uuid], layoutConfig = Ext.clone(pt.layout), objects = [], + parentGraphMap = pt.viewport.treePanel.getParentGraphMap(), menu; // modify layout dimension items based on uuid objects @@ -2656,7 +2662,7 @@ } // clear layoutConfig dimension items - for (var i = 0, a = [].concat(layoutConfig.columns, layoutConfig.rows); i < a.length; i++) { + for (var i = 0, a = [].concat(layoutConfig.columns || [], layoutConfig.rows || []); i < a.length; i++) { a[i].items = []; } @@ -2673,6 +2679,17 @@ } } + // parent graph map + layoutConfig.parentGraphMap = {}; + + for (var i = 0, id; i < objects.length; i++) { + id = objects[i].id; + + if (parentGraphMap.hasOwnProperty(id)) { + layoutConfig.parentGraphMap[id] = parentGraphMap[id]; + } + } + // menu menu = Ext.create('Ext.menu.Menu', {