dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30413
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15439: GIS, isadmin callback bug fixed + PT, ou hierarchy wip + ER, ou hierarcy bug fixed + EV, gui wip.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 15439 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-05-28 00:28:55 +0200
message:
GIS, isadmin callback bug fixed + PT, ou hierarchy wip + ER, ou hierarcy bug fixed + EV, gui wip.
added:
dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/area.png
dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/bar-stacked.png
dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/bar.png
dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/column-stacked.png
dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/column.png
dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/line.png
dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/pie.png
dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/radar.png
modified:
dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/app.js
dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js
dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/app.js
dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/core.js
dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/plugin.js
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/core.js
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/core.js
--
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-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/app.js 2014-05-23 13:45:16 +0000
+++ dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/app.js 2014-05-27 12:45:32 +0000
@@ -5804,11 +5804,11 @@
table = getHtml(xLayout, xResponse);
- //if (table.tdCount > 20000 || (layout.hideEmptyRows && table.tdCount > 10000)) {
- //alert('Table has too many cells. Please reduce the table and try again.');
- //web.mask.hide(ns.app.centerRegion);
- //return;
- //}
+ if (table.tdCount > 20000 || (layout.hideEmptyRows && table.tdCount > 10000)) {
+ alert('Table has too many cells. Please reduce the table and try again.');
+ web.mask.hide(ns.app.centerRegion);
+ return;
+ }
if (layout.sorting) {
xResponse = web.report.aggregate.sort(xLayout, xResponse, xColAxis);
@@ -5848,9 +5848,6 @@
web.mask.hide(ns.app.centerRegion);
if (NS.isDebug) {
- var res = response || xResponse;
-
- console.log("Number of records", res.rows.length);
console.log("Number of cells", table.tdCount);
console.log("DATA", (ns.app.dateCreate - ns.app.dateData) / 1000);
console.log("CREATE", (ns.app.dateRender - ns.app.dateCreate) / 1000);
=== modified file 'dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js 2014-05-23 13:45:16 +0000
+++ dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js 2014-05-27 12:25:50 +0000
@@ -825,6 +825,11 @@
if (service.layout.isHierarchy(layout, response, id)) {
var a = metaData.names[id].split('/');
+
+ if (a.length === 1) {
+ return a[0];
+ }
+
a.shift();
for (var i = 0, isLast; i < a.length; i++) {
@@ -2075,16 +2080,16 @@
}
html += '<td ' + (config.uuid ? ('id="' + config.uuid + '" ') : '');
- html += ' class="' + cls + '" ' + colSpan + rowSpan
-
-
- if (bgColor) {
- html += '>';
- html += '<div class="legendCt">';
- html += '<div class="number ' + config.cls + '" style="padding:' + displayDensity + '; padding-right:3px; font-size:' + fontSize + '">' + htmlValue + '</div>';
- html += '<div class="arrowCt ' + config.cls + '">';
- html += '<div class="arrow" style="border-bottom:8px solid transparent; border-right:8px solid ' + bgColor + '"> </div>';
- html += '</div></div></div></td>';
+ html += ' class="' + cls + '" ' + colSpan + rowSpan;
+
+
+ //if (bgColor) {
+ //html += '>';
+ //html += '<div class="legendCt">';
+ //html += '<div class="number ' + config.cls + '" style="padding:' + displayDensity + '; padding-right:3px; font-size:' + fontSize + '">' + htmlValue + '</div>';
+ //html += '<div class="arrowCt ' + config.cls + '">';
+ //html += '<div class="arrow" style="border-bottom:8px solid transparent; border-right:8px solid ' + bgColor + '"> </div>';
+ //html += '</div></div></div></td>';
//cls = 'legend';
//cls += config.hidden ? ' td-hidden' : '';
@@ -2098,10 +2103,11 @@
//html += htmlValue + '</div>';
//html += '<div class="legendColor" style="background-color:' + bgColor + '"> </div>';
//html += '</div></td>';
- }
- else {
- html += 'style="padding:' + displayDensity + '; font-size:' + fontSize + ';"' + '>' + htmlValue + '</td>';
- }
+ //}
+ //else {
+ //html += 'style="padding:' + displayDensity + '; font-size:' + fontSize + ';"' + '>' + htmlValue + '</td>';
+ html += 'style="' + (bgColor && isValue ? 'color:' + bgColor + '; ' : '') + 'padding:' + displayDensity + '; font-size:' + fontSize + ';"' + '>' + htmlValue + '</td>';
+ //}
return html;
};
=== added file 'dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/area.png'
Binary files dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/area.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/area.png 2014-05-23 16:09:18 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/bar-stacked.png'
Binary files dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/bar-stacked.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/bar-stacked.png 2014-05-23 16:09:18 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/bar.png'
Binary files dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/bar.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/bar.png 2014-05-23 16:09:18 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/column-stacked.png'
Binary files dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/column-stacked.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/column-stacked.png 2014-05-23 16:09:18 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/column.png'
Binary files dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/column.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/column.png 2014-05-23 16:09:18 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/line.png'
Binary files dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/line.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/line.png 2014-05-23 16:09:18 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/pie.png'
Binary files dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/pie.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/pie.png 2014-05-23 16:09:18 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/radar.png'
Binary files dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/radar.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/images/radar.png 2014-05-23 16:09:18 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/app.js 2014-05-23 11:16:01 +0000
+++ dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/app.js 2014-05-23 16:09:18 +0000
@@ -1260,302 +1260,12 @@
return window;
};
- QueryLayoutWindow = function() {
- var dimension,
- dimensionStore,
- col,
- colStore,
-
- getStore,
- getStoreKeys,
- getCmpHeight,
- getSetup,
- addDimension,
- removeDimension,
- saveState,
- resetData,
- reset,
- dimensionStoreMap = {},
-
- dimensionPanel,
- window,
-
- margin = 1,
- defaultWidth = 160,
- defaultHeight = 158,
- maxHeight = (ns.app.viewport.getHeight() - 100) / 2,
-
- dataType = 'individual_cases';
-
- getStore = function(data) {
- var config = {};
-
- config.fields = ['id', 'name'];
-
- if (data) {
- config.data = data;
- }
-
- config.getDimensionNames = function() {
- var dimensionNames = [];
-
- this.each(function(r) {
- dimensionNames.push(r.data.id);
- });
-
- return Ext.clone(dimensionNames);
- };
-
- return Ext.create('Ext.data.Store', config);
- };
-
- getStoreKeys = function(store) {
- var keys = [],
- items = store.data.items;
-
- if (items) {
- for (var i = 0; i < items.length; i++) {
- keys.push(items[i].data.id);
- }
- }
-
- return keys;
- };
-
- dimensionStore = getStore();
- dimensionStore.reset = function(all) {
- dimensionStore.removeAll();
- };
-
- colStore = getStore();
-
- getCmpHeight = function() {
- var size = dimensionStore.totalCount,
- expansion = 10,
- height = defaultHeight,
- diff;
-
- if (size > 10) {
- diff = size - 10;
- height += (diff * expansion);
- }
-
- height = height > maxHeight ? maxHeight : height;
-
- return height;
- };
-
- dimension = Ext.create('Ext.ux.form.MultiSelect', {
- cls: 'ns-toolbar-multiselect-leftright',
- width: defaultWidth,
- height: (getCmpHeight() * 2) + margin,
- style: 'margin-right:' + margin + 'px; margin-bottom:0px',
- valueField: 'id',
- displayField: 'name',
- dragGroup: 'querylayoutDD',
- dropGroup: 'querylayoutDD',
- ddReorder: false,
- store: dimensionStore,
- tbar: {
- height: 25,
- items: {
- xtype: 'label',
- text: NS.i18n.filter,
- cls: 'ns-toolbar-multiselect-leftright-label'
- }
- },
- listeners: {
- afterrender: function(ms) {
- ms.boundList.on('itemdblclick', function(view, record) {
- ms.store.remove(record);
- colStore.add(record);
- });
-
- ms.store.on('add', function() {
- Ext.defer( function() {
- ms.boundList.getSelectionModel().deselectAll();
- }, 10);
- });
- }
- }
- });
-
- col = Ext.create('Ext.ux.form.MultiSelect', {
- cls: 'ns-toolbar-multiselect-leftright',
- width: defaultWidth,
- height: (getCmpHeight() * 2) + margin,
- style: 'margin-bottom: 0px',
- valueField: 'id',
- displayField: 'name',
- dragGroup: 'querylayoutDD',
- dropGroup: 'querylayoutDD',
- store: colStore,
- tbar: {
- height: 25,
- items: {
- xtype: 'label',
- text: NS.i18n.column,
- cls: 'ns-toolbar-multiselect-leftright-label'
- }
- },
- listeners: {
- afterrender: function(ms) {
- ms.boundList.on('itemdblclick', function(view, record) {
- ms.store.remove(record);
- dimensionStore.add(record);
- });
-
- ms.store.on('add', function() {
- Ext.defer( function() {
- ms.boundList.getSelectionModel().deselectAll();
- }, 10);
- });
- }
- }
- });
-
- getSetup = function() {
- return {
- col: getStoreKeys(colStore)
- };
- };
-
- addDimension = function(record) {
- var store = dimensionStoreMap[record.id] || dimensionStore;
- store.add(record);
- };
-
- removeDimension = function(dataElementId) {
- var stores = [dimensionStore, colStore];
-
- for (var i = 0, store, index; i < stores.length; i++) {
- store = stores[i];
- index = store.findExact('id', dataElementId);
-
- if (index != -1) {
- store.remove(store.getAt(index));
- dimensionStoreMap[dataElementId] = store;
- }
- }
- };
-
- saveState = function(map) {
- map = map || dimensionStoreMap;
-
- dimensionStore.each(function(record) {
- map[record.data.id] = dimensionStore;
- });
-
- colStore.each(function(record) {
- map[record.data.id] = colStore;
- });
-
- return map;
- };
-
- resetData = function() {
- var map = saveState({}),
- keys = ['pe', 'latitude', 'longitude', 'ou'];
-
- for (var key in map) {
- if (map.hasOwnProperty(key) && !Ext.Array.contains(keys, key)) {
- removeDimension(key);
- }
- }
- };
-
- reset = function() {
- colStore.removeAll();
- dimensionStore.removeAll();
-
- colStore.add({id: 'pe', name: 'Event date'});
- colStore.add({id: 'ou', name: 'Organisation unit'});
-
- dimensionStore.add({id: 'longitude', name: 'Longitude'});
- dimensionStore.add({id: 'latitude', name: 'Latitude'});
- };
-
- window = Ext.create('Ext.window.Window', {
- title: NS.i18n.table_layout,
- layout: 'column',
- bodyStyle: 'background-color:#fff; padding:' + margin + 'px',
- closeAction: 'hide',
- autoShow: true,
- modal: true,
- resizable: false,
- getSetup: getSetup,
- dimensionStore: dimensionStore,
- dataType: dataType,
- colStore: colStore,
- addDimension: addDimension,
- removeDimension: removeDimension,
- saveState: saveState,
- resetData: resetData,
- reset: reset,
- hideOnBlur: true,
- items: [
- dimension,
- col
- ],
- bbar: [
- '->',
- {
- text: NS.i18n.hide,
- listeners: {
- added: function(b) {
- b.on('click', function() {
- window.hide();
- });
- }
- }
- },
- {
- text: '<b>' + NS.i18n.update + '</b>',
- listeners: {
- added: function(b) {
- b.on('click', function() {
- var config = ns.core.web.report.getLayoutConfig();
-
- if (!config) {
- return;
- }
-
- // keep sorting
- if (ns.app.layout && ns.app.layout.sorting) {
- config.sorting = Ext.clone(ns.app.layout.sorting);
- }
-
- window.hide();
-
- ns.core.web.report.getData(config, false);
- });
- }
- }
- }
- ],
- listeners: {
- show: function(w) {
- if (ns.app.layoutButton.rendered) {
- ns.core.web.window.setAnchorPosition(w, ns.app.layoutButton);
-
- if (!w.hasHideOnBlurHandler) {
- ns.core.web.window.addHideOnBlurHandler(w);
- }
- }
- },
- render: function() {
- reset();
- }
- }
- });
-
- return window;
- };
-
AggregateOptionsWindow = function() {
var showTotals,
showSubTotals,
hideEmptyRows,
+ limit,
+ countType,
aggregationType,
showHierarchy,
digitGroupSeparator,
@@ -1569,7 +1279,7 @@
style,
parameters,
- comboboxWidth = 262,
+ comboboxWidth = 280,
window;
showTotals = Ext.create('Ext.form.field.Checkbox', {
@@ -1593,9 +1303,30 @@
limit = Ext.create('Ext.ux.container.LimitContainer', {
boxLabel: NS.i18n.limit,
sortOrder: 1,
- topLimit: 10
+ topLimit: 10,
+ comboboxWidth: comboboxWidth
});
+ countType = Ext.create('Ext.form.field.ComboBox', {
+ cls: 'ns-combo',
+ style: 'margin-bottom:2px',
+ width: comboboxWidth,
+ labelWidth: 130,
+ fieldLabel: NS.i18n.count_type,
+ labelStyle: 'color:#333',
+ queryMode: 'local',
+ valueField: 'id',
+ editable: false,
+ value: 'events',
+ 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}
+ ]
+ })
+ });
+
showHierarchy = Ext.create('Ext.form.field.Checkbox', {
boxLabel: NS.i18n.show_hierarchy,
style: 'margin-bottom:4px'
@@ -1684,7 +1415,8 @@
showTotals,
showSubTotals,
hideEmptyRows,
- limit
+ limit,
+ countType
//aggregationType
]
};
@@ -1723,6 +1455,7 @@
hideEmptyRows: hideEmptyRows.getValue(),
sortOrder: limit.getSortOrder(),
topLimit: limit.getTopLimit(),
+ countType: countType.getValue(),
showHierarchy: showHierarchy.getValue(),
displayDensity: displayDensity.getValue(),
fontSize: fontSize.getValue(),
@@ -1735,6 +1468,7 @@
showSubTotals.setValue(Ext.isBoolean(layout.showSubTotals) ? layout.showSubTotals : 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');
//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');
@@ -1818,6 +1552,7 @@
w.showSubTotals = showSubTotals;
w.hideEmptyRows = hideEmptyRows;
w.limit = limit;
+ w.countType = countType;
w.showHierarchy = showHierarchy;
w.displayDensity = displayDensity;
w.fontSize = fontSize;
@@ -1829,223 +1564,6 @@
return window;
};
- QueryOptionsWindow = function() {
- var showHierarchy,
- digitGroupSeparator,
- displayDensity,
- fontSize,
- reportingPeriod,
- organisationUnit,
- parentOrganisationUnit,
-
- data,
- style,
- parameters,
-
- comboboxWidth = 262,
- window;
-
- //showHierarchy = Ext.create('Ext.form.field.Checkbox', {
- //boxLabel: NS.i18n.show_hierarchy,
- //style: 'margin-bottom:4px'
- //});
-
- displayDensity = Ext.create('Ext.form.field.ComboBox', {
- cls: 'ns-combo',
- style: 'margin-bottom:2px',
- width: comboboxWidth,
- labelWidth: 130,
- fieldLabel: NS.i18n.display_density,
- labelStyle: 'color:#333',
- queryMode: 'local',
- valueField: 'id',
- editable: false,
- value: 'normal',
- store: Ext.create('Ext.data.Store', {
- fields: ['id', 'text'],
- data: [
- {id: 'comfortable', text: NS.i18n.comfortable},
- {id: 'normal', text: NS.i18n.normal},
- {id: 'compact', text: NS.i18n.compact}
- ]
- })
- });
-
- fontSize = Ext.create('Ext.form.field.ComboBox', {
- cls: 'ns-combo',
- style: 'margin-bottom:2px',
- width: comboboxWidth,
- labelWidth: 130,
- fieldLabel: NS.i18n.font_size,
- labelStyle: 'color:#333',
- queryMode: 'local',
- valueField: 'id',
- editable: false,
- value: 'normal',
- store: Ext.create('Ext.data.Store', {
- fields: ['id', 'text'],
- data: [
- {id: 'large', text: NS.i18n.large},
- {id: 'normal', text: NS.i18n.normal},
- {id: 'small', text: NS.i18n.small_}
- ]
- })
- });
-
- digitGroupSeparator = Ext.create('Ext.form.field.ComboBox', {
- labelStyle: 'color:#333',
- cls: 'ns-combo',
- style: 'margin-bottom:2px',
- width: comboboxWidth,
- labelWidth: 130,
- fieldLabel: NS.i18n.digit_group_separator,
- queryMode: 'local',
- valueField: 'id',
- editable: false,
- value: 'space',
- store: Ext.create('Ext.data.Store', {
- fields: ['id', 'text'],
- data: [
- {id: 'comma', text: 'Comma'},
- {id: 'space', text: 'Space'},
- {id: 'none', text: 'None'}
- ]
- })
- });
-
- //legendSet = Ext.create('Ext.form.field.ComboBox', {
- //cls: 'ns-combo',
- //style: 'margin-bottom:3px',
- //width: comboboxWidth,
- //labelWidth: 130,
- //fieldLabel: NS.i18n.legend_set,
- //valueField: 'id',
- //displayField: 'name',
- //editable: false,
- //value: 0,
- //store: ns.app.stores.legendSet
- //});
-
- //organisationUnits = {
- //bodyStyle: 'border:0 none',
- //style: 'margin-left:14px',
- //items: [
- //showHierarchy
- //]
- //};
-
- style = {
- bodyStyle: 'border:0 none',
- style: 'margin-left:14px',
- items: [
- displayDensity,
- fontSize,
- digitGroupSeparator
- //legendSet
- ]
- };
-
- window = Ext.create('Ext.window.Window', {
- title: NS.i18n.table_options,
- bodyStyle: 'background-color:#fff; padding:5px 5px 3px',
- closeAction: 'hide',
- autoShow: true,
- modal: true,
- resizable: false,
- hideOnBlur: true,
- getOptions: function() {
- return {
- showTotals: false,
- showSubTotals: false,
- hideEmptyRows: false,
- sortOrder: 0,
- topLimit: 0,
- showHierarchy: false,
- displayDensity: displayDensity.getValue(),
- fontSize: fontSize.getValue(),
- digitGroupSeparator: digitGroupSeparator.getValue()
- //legendSet: {id: legendSet.getValue()}
- };
- },
- setOptions: function(layout) {
- //showHierarchy.setValue(Ext.isBoolean(layout.showHierarchy) ? layout.showHierarchy : false);
- displayDensity.setValue(Ext.isString(layout.displayDensity) ? layout.displayDensity : 'normal');
- fontSize.setValue(Ext.isString(layout.fontSize) ? layout.fontSize : 'normal');
- digitGroupSeparator.setValue(Ext.isString(layout.digitGroupSeparator) ? layout.digitGroupSeparator : 'space');
- //legendSet.setValue(Ext.isObject(layout.legendSet) && Ext.isString(layout.legendSet.id) ? layout.legendSet.id : 0);
- },
- items: [
- //{
- //bodyStyle: 'border:0 none; color:#222; font-size:12px; font-weight:bold',
- //style: 'margin-bottom:6px; margin-left:2px',
- //html: NS.i18n.organisation_units
- //},
- //organisationUnits,
- //{
- //bodyStyle: 'border:0 none; padding:5px'
- //},
- {
- bodyStyle: 'border:0 none; color:#222; font-size:12px; font-weight:bold',
- style: 'margin-bottom:6px; margin-left:2px',
- html: NS.i18n.style
- },
- style
- ],
- bbar: [
- '->',
- {
- text: NS.i18n.hide,
- handler: function() {
- window.hide();
- }
- },
- {
- text: '<b>' + NS.i18n.update + '</b>',
- handler: function() {
- var config = ns.core.web.report.getLayoutConfig();
- //layout = ns.core.api.layout.Layout(config);
-
- if (!config) {
- return;
- }
-
- // keep sorting
- if (ns.app.layout && ns.app.layout.sorting) {
- config.sorting = Ext.clone(ns.app.layout.sorting);
- }
-
- window.hide();
-
- ns.core.web.report.getData(config, false);
- }
- }
- ],
- listeners: {
- show: function(w) {
- if (ns.app.optionsButton.rendered) {
- ns.core.web.window.setAnchorPosition(w, ns.app.optionsButton);
-
- if (!w.hasHideOnBlurHandler) {
- ns.core.web.window.addHideOnBlurHandler(w);
- }
- }
-
- //if (!legendSet.store.isLoaded) {
- //legendSet.store.load();
- //}
-
- // cmp
- //w.showHierarchy = showHierarchy;
- w.displayDensity = displayDensity;
- w.fontSize = fontSize;
- w.digitGroupSeparator = digitGroupSeparator;
- }
- }
- });
-
- return window;
- };
-
FavoriteWindow = function() {
// Objects
@@ -2076,7 +1594,7 @@
windowWidth = 500,
windowCmpWidth = windowWidth - 14;
- ns.app.stores.eventReport.on('load', function(store, records) {
+ ns.app.stores.eventChart.on('load', function(store, records) {
var pager;
if (store.proxy.reader && store.proxy.reader.jsonData && store.proxy.reader.jsonData.pager) {
@@ -2125,7 +1643,7 @@
NameWindow = function(id) {
var window,
- record = ns.app.stores.eventReport.getById(id);
+ record = ns.app.stores.eventChart.getById(id);
nameTextfield = Ext.create('Ext.form.field.Text', {
height: 26,
@@ -2152,7 +1670,7 @@
if (favorite && favorite.name) {
Ext.Ajax.request({
- url: ns.core.init.contextPath + '/api/eventReports/',
+ url: ns.core.init.contextPath + '/api/eventCharts/',
method: 'POST',
headers: {'Content-Type': 'application/json'},
params: Ext.encode(favorite),
@@ -2166,7 +1684,7 @@
ns.app.layout.id = id;
ns.app.layout.name = name;
- ns.app.stores.eventReport.loadStore();
+ ns.app.stores.eventChart.loadStore();
ns.app.shareButton.enable();
@@ -2181,25 +1699,25 @@
text: NS.i18n.update,
handler: function() {
var name = nameTextfield.getValue(),
- eventReport;
+ eventChart;
if (id && name) {
Ext.Ajax.request({
- url: ns.core.init.contextPath + '/api/eventReports/' + id + '.json?viewClass=dimensional&links=false',
+ url: ns.core.init.contextPath + '/api/eventCharts/' + id + '.json?viewClass=dimensional&links=false',
method: 'GET',
failure: function(r) {
ns.core.web.mask.show();
alert(r.responseText);
},
success: function(r) {
- eventReport = Ext.decode(r.responseText);
- eventReport.name = name;
+ eventChart = Ext.decode(r.responseText);
+ eventChart.name = name;
Ext.Ajax.request({
- url: ns.core.init.contextPath + '/api/eventReports/' + eventReport.id,
+ url: ns.core.init.contextPath + '/api/eventCharts/' + eventReport.id,
method: 'PUT',
headers: {'Content-Type': 'application/json'},
- params: Ext.encode(eventReport),
+ params: Ext.encode(eventChart),
failure: function(r) {
ns.core.web.mask.show();
alert(r.responseText);
@@ -2213,7 +1731,7 @@
}
}
- ns.app.stores.eventReport.loadStore();
+ ns.app.stores.eventChart.loadStore();
window.destroy();
}
});
@@ -2290,8 +1808,8 @@
this.currentValue = this.getValue();
var value = this.getValue(),
- url = value ? ns.core.init.contextPath + '/api/eventReports.json?include=id,name,access&filter=name:like:' + value : null;
- store = ns.app.stores.eventReport;
+ url = value ? ns.core.init.contextPath + '/api/eventCharts.json?include=id,name,access&filter=name:like:' + value : null;
+ store = ns.app.stores.eventChart;
store.page = 1;
store.loadStore(url);
@@ -2306,8 +1824,8 @@
text: NS.i18n.prev,
handler: function() {
var value = searchTextfield.getValue(),
- url = value ? ns.core.init.contextPath + '/api/eventReports.json?include=id,name,access&filter=name:like:' + value : null;
- store = ns.app.stores.eventReport;
+ url = value ? ns.core.init.contextPath + '/api/eventCharts.json?include=id,name,access&filter=name:like:' + value : null;
+ store = ns.app.stores.eventChart;
store.page = store.page <= 1 ? 1 : store.page - 1;
store.loadStore(url);
@@ -2318,8 +1836,8 @@
text: NS.i18n.next,
handler: function() {
var value = searchTextfield.getValue(),
- url = value ? ns.core.init.contextPath + '/api/eventReports/query/' + value + '.json?viewClass=sharing&links=false' : null,
- store = ns.app.stores.eventReport;
+ url = value ? ns.core.init.contextPath + '/api/eventCharts/query/' + value + '.json?viewClass=sharing&links=false' : null,
+ store = ns.app.stores.eventChart;
store.page = store.page + 1;
store.loadStore(url);
@@ -2399,7 +1917,7 @@
if (confirm(message)) {
Ext.Ajax.request({
- url: ns.core.init.contextPath + '/api/eventReports/' + record.data.id,
+ url: ns.core.init.contextPath + '/api/eventCharts/' + record.data.id,
method: 'PUT',
headers: {'Content-Type': 'application/json'},
params: Ext.encode(favorite),
@@ -2410,7 +1928,7 @@
ns.app.layout.name = true;
ns.app.xLayout.name = true;
- ns.app.stores.eventReport.loadStore();
+ ns.app.stores.eventChart.loadStore();
ns.app.shareButton.enable();
}
@@ -2433,7 +1951,7 @@
if (record.data.access.manage) {
Ext.Ajax.request({
- url: ns.core.init.contextPath + '/api/sharing?type=eventReport&id=' + record.data.id,
+ url: ns.core.init.contextPath + '/api/sharing?type=eventChart&id=' + record.data.id,
method: 'GET',
failure: function(r) {
ns.app.viewport.mask.hide();
@@ -2462,7 +1980,7 @@
if (confirm(message)) {
Ext.Ajax.request({
- url: ns.core.init.contextPath + '/api/eventReports/' + record.data.id,
+ url: ns.core.init.contextPath + '/api/eventCharts/' + record.data.id,
method: 'DELETE',
success: function() {
ns.app.stores.eventReport.loadStore();
@@ -2479,7 +1997,7 @@
width: 6
}
],
- store: ns.app.stores.eventReport,
+ store: ns.app.stores.eventChart,
bbar: [
info,
'->',
@@ -2493,7 +2011,7 @@
this.store.page = 1;
this.store.loadStore();
- ns.app.stores.eventReport.on('load', function() {
+ ns.app.stores.eventChart.on('load', function() {
if (this.isVisible()) {
this.fireEvent('afterrender');
}
@@ -2853,7 +2371,7 @@
text: NS.i18n.save,
handler: function() {
Ext.Ajax.request({
- url: ns.core.init.contextPath + '/api/sharing?type=eventReport&id=' + sharing.object.id,
+ url: ns.core.init.contextPath + '/api/sharing?type=eventChart&id=' + sharing.object.id,
method: 'POST',
headers: {
'Content-Type': 'application/json'
@@ -2907,8 +2425,8 @@
linkPanel = Ext.create('Ext.panel.Panel', {
html: function() {
- var url = ns.core.init.contextPath + '/dhis-web-event-reports/app/index.html?id=' + ns.app.layout.id,
- apiUrl = ns.core.init.contextPath + '/api/eventReports/' + ns.app.layout.id + '/data.html',
+ var url = ns.core.init.contextPath + '/dhis-web-event-charts/app/index.html?id=' + ns.app.layout.id,
+ apiUrl = ns.core.init.contextPath + '/api/eventCharts/' + ns.app.layout.id + '/data.html',
html = '';
html += '<div><b>Report link: </b><span class="user-select"><a href="' + url + '" target="_blank">' + url + '</a></span></div>';
@@ -5663,7 +5181,7 @@
}
Ext.Ajax.request({
- url: init.contextPath + '/api/eventReports/' + id + '.json?viewClass=dimensional&links=false',
+ url: init.contextPath + '/api/eventCharts/' + id + '.json?viewClass=dimensional&links=false',
failure: function(r) {
web.mask.hide(ns.app.centerRegion);
alert(r.responseText);
@@ -5863,11 +5381,28 @@
// viewport
createViewport = function() {
- var caseButton,
- aggregateButton,
- paramButtonMap = {},
- typeToolbar,
- onTypeClick,
+ var eventChartStore,
+
+ buttons = [],
+ buttonAddedListener,
+ column,
+ stackedcolumn,
+ bar,
+ stackedbar,
+ line,
+ area,
+ pie,
+ radar,
+ chartType,
+ getDimensionStore,
+ colStore,
+ rowStore,
+ filterStore,
+ series,
+ category,
+ filter,
+ layout,
+
widget,
accordion,
westRegion,
@@ -5887,19 +5422,19 @@
ns.app.stores = ns.app.stores || {};
- eventReportStore = Ext.create('Ext.data.Store', {
+ eventChartStore = Ext.create('Ext.data.Store', {
fields: ['id', 'name', 'lastUpdated', 'access'],
proxy: {
type: 'ajax',
reader: {
type: 'json',
- root: 'eventReports'
+ root: 'eventCharts'
}
},
isLoaded: false,
pageSize: 10,
page: 1,
- defaultUrl: ns.core.init.contextPath + '/api/eventReports.json?include=id,name,access',
+ defaultUrl: ns.core.init.contextPath + '/api/eventCharts.json?include=id,name,access',
loadStore: function(url) {
this.proxy.url = url || this.defaultUrl;
@@ -5928,10 +5463,14 @@
}
}
});
- ns.app.stores.eventReport = eventReportStore;
+ ns.app.stores.eventChart = eventChartStore;
// viewport
+ buttonAddedListener = function(b) {
+ buttons.push(b);
+ };
+
column = Ext.create('Ext.button.Button', {
xtype: 'button',
chartType: ns.core.conf.finals.chart.column,
@@ -6324,8 +5863,9 @@
}
}(),
items: [
- typeToolbar,
- accordion
+ chartType,
+ layout,
+ accordion
],
listeners: {
added: function() {
@@ -6730,12 +6270,8 @@
ns.app.aggregateLayoutWindow = AggregateLayoutWindow();
ns.app.aggregateLayoutWindow.hide();
- ns.app.queryLayoutWindow = QueryLayoutWindow();
- ns.app.queryLayoutWindow.hide();
ns.app.aggregateOptionsWindow = AggregateOptionsWindow();
ns.app.aggregateOptionsWindow.hide();
- ns.app.queryOptionsWindow = QueryOptionsWindow();
- ns.app.queryOptionsWindow.hide();
},
afterrender: function() {
@@ -6830,13 +6366,13 @@
var i18nArray = Ext.decode(r.responseText);
Ext.Ajax.request({
- url: init.contextPath + '/api/system/context.json',
+ url: init.contextPath + '/api/system/info.json',
success: function(r) {
init.contextPath = Ext.decode(r.responseText).contextPath || init.contextPath;
// i18n
requests.push({
- url: init.contextPath + '/api/i18n?package=org.hisp.dhis.eventreport',
+ url: init.contextPath + '/api/i18n?package=org.hisp.dhis.eventchart',
method: 'POST',
headers: {
'Content-Type': 'application/json',
=== modified file 'dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/core.js 2014-04-24 15:09:41 +0000
+++ dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/core.js 2014-05-23 16:09:18 +0000
@@ -93,9 +93,37 @@
value: 'value'
}
},
- root: {
- id: 'root'
- }
+ chart: {
+ series: 'series',
+ category: 'category',
+ filter: 'filter',
+ column: 'column',
+ stackedcolumn: 'stackedcolumn',
+ bar: 'bar',
+ stackedbar: 'stackedbar',
+ line: 'line',
+ area: 'area',
+ pie: 'pie',
+ radar: 'radar'
+ },
+ data: {
+ domain: 'domain_',
+ targetLine: 'targetline_',
+ baseLine: 'baseline_',
+ trendLine: 'trendline_'
+ },
+ image: {
+ png: 'png',
+ pdf: 'pdf'
+ },
+ cmd: {
+ init: 'init_',
+ none: 'none_',
+ urlparam: 'id'
+ },
+ root: {
+ id: 'root'
+ }
};
dimConf = conf.finals.dimension;
=== modified file 'dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/plugin.js'
--- dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/plugin.js 2014-04-24 15:09:41 +0000
+++ dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/plugin.js 2014-05-23 16:09:18 +0000
@@ -2752,9 +2752,9 @@
}
Ext.data.JsonP.request({
- url: init.contextPath + '/api/eventReports/' + id + '.jsonp?viewClass=dimensional&links=false',
+ url: init.contextPath + '/api/eventCharts/' + id + '.jsonp?viewClass=dimensional&links=false',
failure: function(r) {
- window.open(init.contextPath + '/api/eventReports/' + id + '.json?viewClass=dimensional&links=false', '_blank');
+ window.open(init.contextPath + '/api/eventCharts/' + id + '.json?viewClass=dimensional&links=false', '_blank');
},
success: function(r) {
var layout = api.layout.Layout(r);
=== 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 2014-05-16 10:04:38 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js 2014-05-27 22:23:21 +0000
@@ -3952,7 +3952,7 @@
validateView,
// constants
- baseWidth = 442,
+ baseWidth = 444,
toolWidth = 36,
accBaseWidth = baseWidth - 2;
@@ -4038,7 +4038,7 @@
forceSelection: true,
queryMode: 'remote',
columnWidth: 0.5,
- style: 'margin:1px 1px 2px 0',
+ style: 'margin:1px 1px 1px 0',
storage: {},
store: programStore,
getRecord: function() {
@@ -4090,7 +4090,7 @@
queryMode: 'remote',
forceSelection: true,
columnWidth: 0.5,
- style: 'margin:1px 0 2px 1px',
+ style: 'margin:1px 0 1px 0',
disabled: true,
listConfig: {loadMask: false},
store: stagesByProgramStore,
@@ -4171,10 +4171,10 @@
dataElementAvailable = Ext.create('Ext.ux.form.MultiSelect', {
cls: 'ns-toolbar-multiselect-left',
width: accBaseWidth,
- height: 112,
+ height: 118,
valueField: 'id',
displayField: 'name',
- style: 'margin-bottom:2px',
+ style: 'margin-bottom:1px',
store: dataElementsByStageStore,
tbar: [
{
@@ -4220,7 +4220,7 @@
dataElementSelected = Ext.create('Ext.panel.Panel', {
width: accBaseWidth,
height: 204,
- bodyStyle: 'padding:2px 0 5px 3px; overflow-y: scroll',
+ bodyStyle: 'padding:2px 0 1px 3px; overflow-y: scroll',
tbar: {
height: 27,
items: {
@@ -4329,7 +4329,7 @@
dataElement = Ext.create('Ext.panel.Panel', {
title: '<div class="gis-panel-title-data">Data</div>',
- bodyStyle: 'padding:2px',
+ bodyStyle: 'padding:1px',
hideCollapseTool: true,
items: [
{
@@ -8552,7 +8552,6 @@
fn = function() {
if (++callbacks === requests.length) {
-
gis = GIS.core.getInstance(init);
GIS.app.createExtensions();
@@ -8574,7 +8573,7 @@
var i18nArray = Ext.decode(r.responseText);
Ext.Ajax.request({
- url: init.contextPath + '/api/system/context.json',
+ url: init.contextPath + '/api/system/info.json',
success: function(r) {
init.contextPath = Ext.decode(r.responseText).contextPath || init.contextPath;
@@ -8627,10 +8626,8 @@
ouc = Ext.Array.clean(ouc.concat(Ext.Array.pluck(org.children, 'id') || []));
}
- init.user = {
- ou: ou,
- ouc: ouc
- }
+ init.user.ou = ou;
+ init.user.ouc = ouc;
}
else {
alert('User is not assigned to any organisation units');
@@ -8644,7 +8641,7 @@
requests.push({
url: init.contextPath + '/api/me/authorization/F_GIS_ADMIN',
success: function(r) {
- init.user.isAdmin = Ext.decode(r.responseText);
+ init.user.isAdmin = (r.responseText === 'true');
fn();
}
});
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js 2014-05-15 10:48:43 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js 2014-05-27 11:08:21 +0000
@@ -1038,8 +1038,11 @@
// ou
if (Ext.isArray(view.organisationUnits)) {
+ paramString += '&dimension=ou:';
+
for (var i = 0; i < view.organisationUnits.length; i++) {
- paramString += '&dimension=ou:' + view.organisationUnits[i].id;
+ paramString += view.organisationUnits[i].id;
+ paramString += i < view.organisationUnits.length - 1 ? ';' : '';
}
}
=== 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 2014-05-22 13:07:04 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2014-05-27 11:08:21 +0000
@@ -5120,6 +5120,34 @@
}
}
}
+ //{
+ //text: 'export',
+ //handler: function() {
+ //var myWin = window.open(),
+ //tableId = 'datatable',
+ //text = '';
+
+ ////text += '<a id="csvlink" href="" download="datatable.csv" onclick="javascript:this.download()">Download CSV</a><br/><br/>';
+ //text += '<a href="" download="data.csv">download</a>';
+
+ //text += '<table id="datatable">';
+
+ //text += '<tr><th>indicator</th><th>period</th><th>orgunit</th><th>value</th></tr>';
+
+ //text += '<tr><td>anc1</td><td>jan</td><td>telemark</td><td>8</td></tr>';
+ //text += '<tr><td>anc1</td><td>jan</td><td>oslo</td><td>2</td></tr>';
+ //text += '<tr><td>anc1</td><td>feb</td><td>telemark</td><td>11</td></tr>';
+ //text += '<tr><td>anc1</td><td>feb</td><td>oslo</td><td>12</td></tr>';
+
+ //text += '</table>';
+
+ //myWin.document.write(text);
+
+ //myWin.document.getElementById('csvlink').download = function() {
+ //return ExcellentExport.csv(window, 'datatable');
+ //};
+ //}
+ //}
],
listeners: {
added: function() {
@@ -5795,7 +5823,7 @@
var i18nArray = Ext.decode(r.responseText);
Ext.Ajax.request({
- url: init.contextPath + '/api/system/context.json',
+ url: init.contextPath + '/api/system/info.json',
success: function(r) {
init.contextPath = Ext.decode(r.responseText).contextPath || init.contextPath;
=== 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 2014-05-22 13:07:04 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2014-05-27 11:08:21 +0000
@@ -110,6 +110,10 @@
dimConf.objectNameMap[dimConf.organisationUnit.objectName] = dimConf.organisationUnit;
dimConf.objectNameMap[dimConf.dimension.objectName] = dimConf.dimension;
+ dimConf.objectNameMap['ou1'] = dimConf.organisationUnit;
+ dimConf.objectNameMap['ou2'] = dimConf.organisationUnit;
+ dimConf.objectNameMap['ou3'] = dimConf.organisationUnit;
+
conf.period = {
periodTypes: [
{id: 'Daily', name: NS.i18n.daily},
@@ -1110,8 +1114,10 @@
addOuHierarchyDimensions = function() {
var axis = xLayout.dimensionNameAxisMap[ou],
ouHierarchy = response.metaData.ouHierarchy,
- levels = [],
+ idsByLevel = [],
+ objectsByLevel = [],
ouIndex,
+ numLevels = 0,
a;
// get ou index
@@ -1122,25 +1128,75 @@
}
}
- // get levels
- for (var key in ouHierarchy) {
- if (ouHierarchy.hasOwnProperty(key)) {
- a = Ext.Array.clean(ouHierarchy[key].split('/'));
-
- if (!levels[a.length]) {
- levels[a.length] = [];
+ // number of levels
+ for (var key in ouHierarchy) {
+ if (ouHierarchy.hasOwnProperty(key)) {
+ a = Ext.Array.clean(ouHierarchy[key].split('/'));
+
+ numLevels = Math.max(a.length, numLevels);
+ }
+ }
+
+ numLevels = numLevels + 1;
+
+ // create level arrays
+ for (var i = 0; i < numLevels; i++) {
+ idsByLevel.push([]);
+ objectsByLevel.push([]);
+ }
+
+ // populate levels
+ for (var key in ouHierarchy) {
+ if (ouHierarchy.hasOwnProperty(key)) {
+ a = Ext.Array.clean(ouHierarchy[key].split('/'));
+ a.push(key);
+
+ if (a.length === numLevels) {
+ for (var i = 0, id; i < a.length; i++) {
+ id = a[i];
+
+ idsByLevel[i].push(id);
+ }
}
-
- levels[a.length].push({
- id: key,
- name: response.metaData.names[key]
+ }
+ }
+
+ // unique only, create objects
+ for (var i = 0, idLevel; i < idsByLevel.length; i++) {
+ idLevel = idsByLevel[i];
+ idLevel = Ext.Array.unique(idLevel);
+
+ for (var j = 0; j < idLevel.length; j++) {
+ objectsByLevel[i].push({
+ id: idLevel[j],
+ name: response.metaData.names[idLevel[j]]
});
}
}
- levels = Ext.Array.clean(levels);
-
- console.log("levels", levels);
+ objectsByLevel = Ext.Array.clean(objectsByLevel);
+ objectsByLevel.shift();
+
+ // remove ou dimension
+ axis = Ext.Array.erase(axis, ouIndex, 1);
+
+ // insert levels
+ for (var i = 0; i < objectsByLevel.length; i++) {
+ Ext.Array.insert(axis, ouIndex, [{
+ dimension: 'ou' + (i + 1),
+ dimensionName: 'ou' + (i + 1),
+ objectName: 'ou' + (i + 1),
+ ids: idsByLevel[i],
+ items: objectsByLevel[i]
+ }]);
+
+ ouIndex = ouIndex + 1;
+ }
+
+ console.log("axis", axis);
+ console.log("objectsByLevel", objectsByLevel);
+
+
};
// Set items from init/metaData/xLayout
@@ -1260,9 +1316,9 @@
}
// Add ou hierarchy dimensions
- if (xOuDimension && xLayout.showHierarchy) {
- addOuHierarchyDimensions();
- }
+ //if (xOuDimension && xLayout.showHierarchy) {
+ //addOuHierarchyDimensions();
+ //}
// Re-layout
layout = api.layout.Layout(xLayout);