← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18215: ER EV GIS support for booleans, work in progress.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 18215 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-02-10 17:13:15 +0100
message:
  ER EV GIS support for booleans, work in progress.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/i18n/i18n_app.properties
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/i18n/i18n_app.properties
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/i18n/i18n_app.properties
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/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-apps/src/main/webapp/dhis-web-event-reports/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/i18n/i18n_app.properties	2014-11-17 15:42:17 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/i18n/i18n_app.properties	2015-02-09 16:13:09 +0000
@@ -174,3 +174,5 @@
 initializing=Initializing
 created_by=Created by
 clear_event_report=Clear event report
+yes=Yes
+no=No

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js	2015-02-03 08:30:32 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js	2015-02-10 16:04:57 +0000
@@ -395,7 +395,9 @@
 				return record;
             },
             setRecord: function(record) {
-                this.valueCmp.setValue(record.filter);
+				if (record.filter) {
+					this.valueCmp.setValue(record.filter.split(':')[1]);
+                }
             },
             initComponent: function() {
                 var container = this;
@@ -413,12 +415,12 @@
                     editable: false,
                     width: operatorCmpWidth + valueCmpWidth,
                     style: 'margin-bottom:0',
-                    value: 'false',
+                    value: 'true',
                     store: {
                         fields: ['id', 'name'],
                         data: [
-                            {id: 'true', name: 'Yes'},
-                            {id: 'false', name: 'No'}
+                            {id: 'true', name: ER.i18n.yes},
+                            {id: 'false', name: ER.i18n.no}
                         ]
                     }
                 });
@@ -3816,6 +3818,7 @@
 			index = index || dataElementSelected.items.items.length;
 
 			getUxType = function(element) {
+
 				if (Ext.isObject(element.optionSet) && Ext.isString(element.optionSet.id)) {
 					return 'Ext.ux.panel.OrganisationUnitGroupSetContainer';
 				}
@@ -3832,6 +3835,10 @@
 					return 'Ext.ux.panel.DataElementDateContainer';
 				}
 
+				if (element.type === 'bool' || element.type === 'trueOnly') {
+					return 'Ext.ux.panel.DataElementBooleanContainer';
+				}
+
 				return 'Ext.ux.panel.DataElementIntegerContainer';
 			};
 
@@ -3870,7 +3877,7 @@
                 fixedFilterElementIds = [],
                 aggWindow = ns.app.aggregateLayoutWindow,
                 queryWindow = ns.app.queryLayoutWindow,
-                includeKeys = ['int', 'number', 'boolean', 'bool'],
+                includeKeys = ['int', 'number', 'bool', 'boolean', 'trueOnly'],
                 ignoreKeys = ['pe', 'ou'],
                 recordMap = {
 					'pe': {id: 'pe', name: 'Periods'},
@@ -5737,7 +5744,7 @@
 			if (filters.length) {
 				view.filters = filters;
 			}
-
+console.log(view);
 			return view;
 		};
 

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js	2015-02-09 08:28:01 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js	2015-02-10 16:04:57 +0000
@@ -974,7 +974,7 @@
 					return name;
 				}
 
-				name += metaData.optionNames[id] || metaData.names[id];
+				name += metaData.booleanNames[id] || metaData.optionNames[id] || metaData.names[id] || id;
 
 				return name;
 			};
@@ -1255,12 +1255,13 @@
                     optionMap = {};
 
                     if (header) {
-                        for (var j = 0, id; j < header.ids.length; j++) {
+                        for (var j = 0, id, name; j < header.ids.length; j++) {
                             id = header.ids[j];
+                            name = xResponse.metaData.booleanNames[id] || xResponse.metaData.optionNames[id] || xResponse.metaData.names[id] || id;
 // TODO, items used?
                             dim.items.push({
                                 id: id,
-                                name: xResponse.metaData.optionNames[id] || xResponse.metaData.names[id] || id
+                                name: name
                             });
                         }
                     }
@@ -1750,7 +1751,11 @@
                     meta = ['ou', 'pe'],
                     ouHierarchy,
                     names,
-					headers;
+					headers,
+                    booleanNameMap = {
+                        'true': ER.i18n.yes || 'Yes',
+                        'false': ER.i18n.no || 'No'
+                    };
 
 				response = Ext.clone(response);
 				headers = response.headers;
@@ -1759,6 +1764,7 @@
                 names[emptyId] = emptyId;
 
                 response.metaData.optionNames = {};
+                response.metaData.booleanNames = {};
 				response.nameHeaderMap = {};
 				response.idValueMap = {};
 
@@ -1799,8 +1805,8 @@
                         else {
 							var objects = [];
 
-                            for (var j = 0, id, fullId, name, isHierarchy; j < response.rows.length; j++) {
-                                id = response.rows[j][i] || emptyId;
+                            for (var k = 0, id, fullId, name, isHierarchy; k < response.rows.length; k++) {
+                                id = response.rows[k][i] || emptyId;
                                 fullId = header.name + id;
                                 isHierarchy = service.layout.isHierarchy(xLayout, response, id);
 
@@ -1813,13 +1819,21 @@
                                 names[fullId] = name;
 
                                 // update rows
-                                response.rows[j][i] = fullId;
+                                response.rows[k][i] = fullId;
 
                                 // update ou hierarchy
                                 if (isHierarchy) {
 									ouHierarchy[fullId] = ouHierarchy[id];
 								}
 
+                                // update boolean metadata
+                                if (header.type === 'java.lang.Boolean') {
+console.log(id, booleanNameMap[id]);
+console.log(fullId, booleanNameMap[id]);
+                                    response.metaData.booleanNames[id] = booleanNameMap[id];
+                                    response.metaData.booleanNames[fullId] = booleanNameMap[id];
+                                }
+
 								objects.push({
 									id: fullId,
 									sortingId: header.name === 'pe' ? fullId : name
@@ -1830,7 +1844,7 @@
                             if (!header.optionSet) {
                                 support.prototype.array.sort(objects, 'ASC', 'sortingId');
                             }
-                            
+
                             header.ids = Ext.Array.pluck(objects, 'id');
                         }
                     }
@@ -2359,7 +2373,7 @@
 
                             a.push(getEmptyNameTdConfig({
                                 cls: 'pivot-dim-label',
-                                htmlValue: (xRowAxis ? dimConf.objectNameMap[xLayout.rowObjectNames[j]].name : '') + (xColAxis && xRowAxis ? '&nbsp;/&nbsp;' : '') + (xColAxis ? dimConf.objectNameMap[xLayout.columnObjectNames[i]].name : '')
+                                htmlValue: (xRowAxis ? dimConf.objectNameMap[xLayout.rowObjectNames[j]].name : '') + (xColAxis && xRowAxis ? '&nbsp;//&nbsp;' : '') + (xColAxis ? dimConf.objectNameMap[xLayout.columnObjectNames[i]].name : '')
                             }));
                         }
 
@@ -2415,7 +2429,7 @@
 
 							// sortable column headers. last dim only.
 							if (i === xColAxis.dims - 1 && doSortableColumnHeaders()) {
-                                
+
 								//condoId = xColAxis.ids[j].split('-').join('');
 								condoId = xColAxis.ids[j];
 							}
@@ -2524,7 +2538,7 @@
                             }]);
                         }
                     }
-                    
+
 	//axisAllObjects = [ [ dim, dim ]
 	//				     [ dim, dim ]
 	//				     [ dim, dim ]

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/i18n/i18n_app.properties	2014-11-17 15:42:17 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/i18n/i18n_app.properties	2015-02-09 16:13:09 +0000
@@ -198,3 +198,5 @@
 initializing=Initializing
 created_by=Created by
 clear_event_chart=Clear event chart
+yes=Yes
+no=No

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js	2015-01-28 23:00:57 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js	2015-02-09 19:24:27 +0000
@@ -394,7 +394,9 @@
 				return record;
             },
             setRecord: function(record) {
-                this.valueCmp.setValue(record.filter);
+				if (record.filter) {
+					this.valueCmp.setValue(record.filter.split(':')[1]);
+                }
             },
             initComponent: function() {
                 var container = this;
@@ -412,12 +414,12 @@
                     editable: false,
                     width: operatorCmpWidth + valueCmpWidth,
                     style: 'margin-bottom:0',
-                    value: 'false',
+                    value: 'true',
                     store: {
                         fields: ['id', 'name'],
                         data: [
-                            {id: 'true', name: 'Yes'},
-                            {id: 'false', name: 'No'}
+                            {id: 'true', name: EV.i18n.yes},
+                            {id: 'false', name: EV.i18n.no}
                         ]
                     }
                 });
@@ -3469,6 +3471,10 @@
 					return 'Ext.ux.panel.DataElementDateContainer';
 				}
 
+				if (element.type === 'bool' || element.type === 'trueOnly') {
+					return 'Ext.ux.panel.DataElementBooleanContainer';
+				}
+
 				return 'Ext.ux.panel.DataElementIntegerContainer';
 			};
 
@@ -3505,7 +3511,7 @@
 				allElements = [],
                 fixedFilterElementIds = [],
                 aggWindow = ns.app.aggregateLayoutWindow,
-                includeKeys = ['int', 'number', 'boolean', 'bool'],
+                includeKeys = ['int', 'number', 'bool', 'boolean', 'trueOnly'],
                 ignoreKeys = ['pe', 'ou'],
                 recordMap = {
 					'pe': {id: 'pe', name: 'Periods'},
@@ -3573,7 +3579,7 @@
                 if (layout) {
                     ux.setRecord(element);
                 }
-
+                
                 store = Ext.Array.contains(includeKeys, element.type) || element.optionSet ? aggWindow.colStore : aggWindow.fixedFilterStore;
 
                 if (store === aggWindow.fixedFilterStore) {

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/i18n/i18n_app.properties	2014-12-05 07:44:49 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/i18n/i18n_app.properties	2015-02-09 17:34:51 +0000
@@ -418,3 +418,5 @@
 created_by=Created by
 clear_map=Clear map
 manage_favorites=Manage favorites
+yes=Yes
+no=No

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js	2015-02-05 15:57:08 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js	2015-02-09 17:34:51 +0000
@@ -1437,12 +1437,12 @@
                     editable: false,
                     width: operatorCmpWidth + valueCmpWidth,
                     style: 'margin-bottom:0',
-                    value: 'false',
+                    value: 'true',
                     store: {
                         fields: ['id', 'name'],
                         data: [
-                            {id: 'true', name: 'Yes'},
-                            {id: 'false', name: 'No'}
+                            {id: 'true', name: GIS.i18n.yes},
+                            {id: 'false', name: GIS.i18n.no}
                         ]
                     }
                 });
@@ -4516,6 +4516,10 @@
 					return 'Ext.ux.panel.DataElementDateContainer';
 				}
 
+				if (element.type === 'bool' || element.type === 'trueOnly') {
+					return 'Ext.ux.panel.DataElementBooleanContainer';
+				}
+
 				return 'Ext.ux.panel.DataElementIntegerContainer';
 			};
 

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js	2014-12-09 14:14:28 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core.js	2015-02-10 16:04:57 +0000
@@ -2268,7 +2268,7 @@
 
                             a.push(getEmptyNameTdConfig({
                                 cls: 'pivot-dim-label',
-                                htmlValue: (xRowAxis ? dimConf.objectNameMap[xLayout.rowObjectNames[j]].name : '') + (xColAxis && xRowAxis ? '&nbsp;/&nbsp;' : '') + (xColAxis ? dimConf.objectNameMap[xLayout.columnObjectNames[i]].name : '')
+                                htmlValue: (xRowAxis ? dimConf.objectNameMap[xLayout.rowObjectNames[j]].name : '') + (xColAxis && xRowAxis ? '&nbsp;//&nbsp;' : '') + (xColAxis ? dimConf.objectNameMap[xLayout.columnObjectNames[i]].name : '')
                             }));
                         }