← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16062: EV orgunit group sets issue fixed.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 16062 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-07-09 21:54:05 +0200
message:
  EV orgunit group sets issue fixed.
modified:
  dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/app.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-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-07-08 14:37:21 +0000
+++ dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/app.js	2014-07-09 19:53:22 +0000
@@ -3010,7 +3010,7 @@
                 stagesByProgramStore.loadData(stages);
 
                 ns.app.aggregateLayoutWindow.resetData();
-				ns.app.queryLayoutWindow.resetData();
+				//ns.app.queryLayoutWindow.resetData();
 
                 stageId = (layout ? layout.programStage.id : null) || (stages.length === 1 ? stages[0].id : null);
 
@@ -3311,13 +3311,20 @@
         selectDataElements = function(items, layout) {
             var dataElements = [],
 				allElements = [],
+                fixedFilterElementIds = [],
                 aggWindow = ns.app.aggregateLayoutWindow,
                 includeKeys = ['int', 'number', 'boolean', 'bool'],
                 ignoreKeys = ['pe', 'ou'],
                 recordMap = {
 					'pe': {id: 'pe', name: 'Periods'},
 					'ou': {id: 'ou', name: 'Organisation units'}
-				};
+				},
+                extendDim = function(dim) {
+                    dim.id = dim.id || dim.dimension;
+                    dim.name = dim.name || ns.app.response.metaData.names[dim.dimension] || "Nissa";
+
+                    return dim;
+                };
 
                 fixedFilterElementIds = [];
 
@@ -3392,25 +3399,32 @@
                 }
 
                 if (layout.columns) {
-                    for (var i = 0; i < layout.columns.length; i++) {
-                        aggWindow.colStore.add(recordMap[layout.columns[i].dimension]);
-                    }
-                }
+					for (var i = 0, record, dim; i < layout.columns.length; i++) {
+                        dim = layout.columns[i];
+                        record = recordMap[dim.dimension];
+
+						aggWindow.colStore.add(record || extendDim(Ext.clone(dim)));
+					}
+				}
 
                 if (layout.rows) {
-                    for (var i = 0; i < layout.rows.length; i++) {
-                        aggWindow.rowStore.add(recordMap[layout.rows[i].dimension]);
-                    }
-                }
+					for (var i = 0, record, dim; i < layout.rows.length; i++) {
+                        dim = layout.rows[i];
+                        record = recordMap[dim.dimension];
+
+						aggWindow.rowStore.add(record || extendDim(Ext.clone(dim)));
+					}
+				}
 
                 if (layout.filters) {
-                    for (var i = 0, store, record; i < layout.filters.length; i++) {
-                        record = recordMap[layout.filters[i].dimension];
-                        store = Ext.Array.contains(includeKeys, element.type) || element.optionSet ? aggWindow.filterStore : aggWindow.fixedFilterStore;
+					for (var i = 0, store, record, dim; i < layout.filters.length; i++) {
+                        dim = layout.filters[i];
+						record = recordMap[dim.dimension];
+						store = Ext.Array.contains(includeKeys, element.type) || element.optionSet ? aggWindow.filterStore : aggWindow.fixedFilterStore;
 
-                        store.add(record);
-                    }
-                }
+						store.add(record || extendDim(Ext.clone(dim)));
+					}
+				}
 			}
         };
 
@@ -4950,7 +4964,8 @@
 		};
 
 		getView = function(config) {
-			var view = {},
+			var panels = ns.app.accordion.panels,
+                view = {},
 				layoutWindow = ns.app.viewport.getLayoutWindow(),
 				map = {},
 				columns = [],
@@ -4966,8 +4981,7 @@
                 return;
             }
 
-			// pe
-            
+			// pe            
             if (periodMode.getValue() === 'dates') {
                 view.startDate = startDate.getSubmitValue();
                 view.endDate = endDate.getSubmitValue();
@@ -4983,11 +4997,9 @@
 			}
 
 			// ou
-
 			map['ou'] = [treePanel.getDimension()];
 
             // data items
-
             for (var i = 0, record; i < dataElementSelected.items.items.length; i++) {
                 record = dataElementSelected.items.items[i].getRecord();
 
@@ -4996,13 +5008,25 @@
                 map[record.dimension].push(record);
             }
 
+            // dynamic dimensions data
+            for (var i = 0, panel, dim, dimName; i < panels.length; i++) {
+                panel = panels[i];
+
+                if (panel.getDimension) {
+                    dim = panel.getDimension();
+
+                    if (dim && !map.hasOwnProperty(dim.dimension)) {
+                        map[dim.dimension] = [dim];
+                    }
+                }
+            }
+
             // other
 
             //map['longitude'] = [{dimension: 'longitude'}];
             //map['latitude'] = [{dimension: 'latitude'}];
 
             // dimensions
-
             if (layoutWindow.colStore) {
 				layoutWindow.colStore.each(function(item) {
 					a = map[item.data.id] || [];