← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6108: (DV) Improved warnings + Datatable bug fixed + Improved code structure.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 6108 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-02-24 13:58:31 +0100
message:
  (DV) Improved warnings + Datatable bug fixed + Improved code structure.
modified:
  dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/css/style.css
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/images/warning.png
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/i18n.vm


--
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-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties	2012-02-23 11:12:25 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties	2012-02-24 12:48:46 +0000
@@ -108,4 +108,7 @@
 wm_stacked_chart=stacked charts
 wm_pie_chart=pie charts
 wm_required_categories=at least two categories required
-wm_first_filter_unit=First filter unit used (more than one selected).
+wm_multiple_filter_ind_de=Multiple indicators/data elements selected as filter.
+wm_multiple_filter_period=Multiple periods selected as filter.
+wm_multiple_filter_orgunit=Multiple organisation units selected as filter.
+wm_first_filter_used=The first one is being used.
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js	2012-02-23 00:55:26 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js	2012-02-24 12:46:07 +0000
@@ -79,6 +79,7 @@
             path_commons: '../../dhis-web-commons-ajax-json/',
             path_api: '../../api/',
             path_portal: '../../dhis-web-portal/',
+            path_images: 'images/',
             initialize: 'initialize.action',
             redirect: 'redirect.action',
             data_get: 'getAggregatedValues.action',
@@ -97,7 +98,10 @@
         dimension: {
             data: {
                 value: 'data',
-                rawvalue: DV.i18n.data
+                rawvalue: DV.i18n.data,
+                warning: {
+					filter: DV.i18n.wm_multiple_filter_ind_de
+				}
             },
             indicator: {
                 value: 'indicator',
@@ -109,11 +113,17 @@
             },
             period: {
                 value: 'period',
-                rawvalue: DV.i18n.period
+                rawvalue: DV.i18n.period,
+                warning: {
+					filter: DV.i18n.wm_multiple_filter_period
+				}
             },
             organisationunit: {
                 value: 'organisationunit',
-                rawvalue: DV.i18n.organisation_unit
+                rawvalue: DV.i18n.organisation_unit,
+                warning: {
+					filter: DV.i18n.wm_multiple_filter_orgunit
+				}
             }
         },        
         chart: {
@@ -138,8 +148,9 @@
             pdf: 'pdf'
         },
         cmd: {
-			chartid: 'id',
-            init: 'init'
+            init: 'init_',
+            datatable: 'datatable_',
+			urlparam: 'id'
         }
     },
     chart: {
@@ -192,7 +203,7 @@
         DV.conf.init.example.setState();
         DV.conf.init.example.setValues();
         
-        DV.init.cmd = DV.util.getUrlParam(DV.conf.finals.cmd.chartid) || DV.conf.finals.cmd.init;
+        DV.init.cmd = DV.util.getUrlParam(DV.conf.finals.cmd.urlparam) || DV.conf.finals.cmd.init;
         DV.exe.execute(true, DV.init.cmd);
     };
     
@@ -428,7 +439,7 @@
                     if (exception && !a.length) {
 						DV.util.notification.error(DV.i18n.et_no_indicators_dataelements, DV.i18n.em_no_indicators_dataelements);
                     }
-                    if (isFilter && a.length > 1) {
+                    if (exception && isFilter && a.length > 1) {
 						DV.exe.warnings.push(DV.i18n.wm_first_filter_unit);
 					}
 					return (isFilter && a.length > 1) ? a.slice(0,1) : a;
@@ -459,7 +470,7 @@
                     if (exception && !a.length) {
 						DV.util.notification.error(DV.i18n.et_no_periods, DV.i18n.em_no_periods);
                     }
-                    if (isFilter && a.length > 1) {
+                    if (exception && isFilter && a.length > 1) {
 						DV.exe.warnings.push(DV.i18n.wm_first_filter_unit);
 					}
                     return (isFilter && a.length > 1) ? a.slice(0,1) : a;
@@ -539,7 +550,7 @@
 					if (exception && !a.length) {
 						DV.util.notification.error(DV.i18n.et_no_orgunits, DV.i18n.em_no_orgunits);
 					}
-                    if (isFilter && a.length > 1 && !DV.state.userOrganisationUnit) {
+                    if (exception && isFilter && a.length > 1 && !DV.state.userOrganisationUnit) {
 						DV.exe.warnings.push(DV.i18n.wm_first_filter_unit);
 					}
                     return DV.state.userOrganisationUnit ? [DV.init.system.user.organisationUnit.name] : (isFilter && a.length > 1) ? a.slice(0,1) : a;
@@ -581,16 +592,16 @@
 					]
 				}).show();
 				DV.cmp.statusbar.panel.setWidth(DV.cmp.region.center.getWidth());
-				DV.cmp.statusbar.panel.update('<img src="images/' + DV.conf.statusbar.icon.error + '" style="padding:0 5px 0 0"/>' + text);
+				DV.cmp.statusbar.panel.update('<img src="' + DV.conf.finals.ajax.path_images + DV.conf.statusbar.icon.error + '" style="padding:0 5px 0 0"/>' + text);
 			},
 			warning: function(text) {
 				text = text || '';
-				DV.cmp.statusbar.panel.update('<img src="images/' + DV.conf.statusbar.icon.warning + '" style="padding:0 5px 0 0"/>' + text);
 				DV.cmp.statusbar.panel.setWidth(DV.cmp.region.center.getWidth());
+				DV.cmp.statusbar.panel.update('<img src="' + DV.conf.finals.ajax.path_images + DV.conf.statusbar.icon.warning + '" style="padding:0 5px 0 0"/>' + text);
 			},
 			ok: function() {
 				DV.cmp.statusbar.panel.setWidth(DV.cmp.region.center.getWidth());
-				DV.cmp.statusbar.panel.update('<img src="images/' + DV.conf.statusbar.icon.ok + '" style="padding:0 5px 0 0"/>&nbsp;&nbsp;');
+				DV.cmp.statusbar.panel.update('<img src="' + DV.conf.finals.ajax.path_images + DV.conf.statusbar.icon.ok + '" style="padding:0 5px 0 0"/>&nbsp;&nbsp;');
 			}				
 		},
         mask: {
@@ -1223,7 +1234,7 @@
                     s.sortStore();
                     s.each(function(r) {
                         r.data.lastUpdated = r.data.lastUpdated.substr(0,16);
-                        r.data.icon = '<img src="images/favorite.png" />';
+                        r.data.icon = '<img src="' + DV.conf.finals.ajax.path_images + 'favorite.png" />';
                         r.commit();
                     });
                 }
@@ -1273,15 +1284,13 @@
             
             this.series.names = DV.util.dimension[this.series.dimension].getNames();
             this.category.names = DV.util.dimension[this.category.dimension].getNames();
-            this.filter.names = DV.util.dimension[this.filter.dimension].getNames(false, true);
-            
+            this.filter.names = DV.util.dimension[this.filter.dimension].getNames();
+
             if (!this.validation.names.call(this)) {
 				return;
 			}
-            
-            if (!this.validation.categories.call(this)) {
-				return;
-			}
+			
+            this.validation.filter.call(this);
             
             this.indicatorIds = DV.util.dimension.indicator.getIds();
             this.dataelementIds = DV.util.dimension.dataelement.getIds();
@@ -1423,6 +1432,8 @@
 						if (!this.validation.names.call(this)) {
 							return;
 						}
+			
+						this.validation.filter.call(this);
 						
 						this.validation.render.call(this);
 						
@@ -1514,6 +1525,12 @@
 				}
 				return true;
 			},
+			filter: function() {
+				if (this.filter.names.length > 1) {
+					this.filter.names = this.filter.names.slice(0,1);
+					DV.exe.warnings.push(DV.conf.finals.dimension[this.filter.dimension].warning.filter + ' ' + DV.i18n.wm_first_filter_used);
+				}
+			},
 			categories: function() {
 				if (this.category.names.length < 2 && (this.type === DV.conf.finals.chart.line || this.type === DV.conf.finals.chart.area)) {
 					DV.util.notification.error(DV.i18n.et_line_area_categories, DV.i18n.em_line_area_categories);
@@ -1863,11 +1880,9 @@
 			DV.state.getOptions();
             DV.cmp.region.center.removeAll(true);
             DV.cmp.region.center.add(this.chart);            
+            DV.exe.finalize();
             
-            if (DV.init.cmd === DV.conf.finals.cmd.init) {
-				DV.exe.finalize();
-            }
-            else {
+            if (DV.init.cmd !== DV.conf.finals.cmd.init) {
                 DV.store.getDataTableStore(true);
             }
         }
@@ -1920,8 +1935,6 @@
         reload: function() {
             DV.cmp.region.east.removeAll(true);
             DV.cmp.region.east.add(this.datatable);
-            
-            DV.exe.finalize();
         }            
     };
     
@@ -1932,6 +1945,9 @@
                 if (cmd === DV.conf.finals.cmd.init) {
                     DV.chart.getData(exe);
                 }
+                else if (cmd === DV.conf.finals.cmd.datatable) {
+					DV.store.getDataTableStore(exe);
+				}					
                 else {
 					DV.state.resetState();
                     DV.state.setFavorite(true, cmd);
@@ -1957,6 +1973,9 @@
         getWarnings: function() {
 			var t = '';
 			for (var i = 0; i < this.warnings.length; i++) {
+				if (i > 0) {
+					t += '<img src="' + DV.conf.finals.ajax.path_images + DV.conf.statusbar.icon.warning + '" style="padding:0 5px 0 8px" />';
+				}
 				t += this.warnings[i] + ' ';
 			}
 			return t;
@@ -3581,7 +3600,7 @@
                                 if (p.collapsed && p.items.length) {
                                     p.expand();
                                     DV.cmp.toolbar.resizeeast.show();
-                                    DV.exe.datatable(true);
+                                    DV.exe.execute(true, DV.conf.finals.cmd.datatable);
                                 }
                                 else {
                                     p.collapse();
@@ -3628,7 +3647,7 @@
 						{
 							xtype: 'panel',
 							cls: 'dv-statusbar',
-							height: 23,
+							height: 24,
 							listeners: {
 								added: function() {
 									DV.cmp.statusbar.panel = this;
@@ -3640,7 +3659,12 @@
                 listeners: {
                     added: function() {
                         DV.cmp.region.center = this;
-                    }
+                    },
+                    resize: function() {
+						if (DV.state.isRendered && DV.cmp.statusbar.panel) {
+							DV.cmp.statusbar.panel.setWidth(DV.cmp.region.center.getWidth());
+						}
+					}
                 }
             },
             {

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/css/style.css'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/css/style.css	2012-02-22 22:15:05 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/css/style.css	2012-02-24 02:05:40 +0000
@@ -640,5 +640,6 @@
 	background-color: transparent;
 	color: #111;
 	vertical-align: top;
-	font-size: 10px
+	font-size: 10px;
+	line-height: 14px;
 }

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/images/warning.png'
Binary files dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/images/warning.png	2012-02-22 02:15:06 +0000 and dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/images/warning.png	2012-02-24 01:40:54 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/i18n.vm'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/i18n.vm	2012-02-22 22:15:05 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/i18n.vm	2012-02-24 01:24:18 +0000
@@ -112,6 +112,9 @@
 wm_stacked_chart:'$encoder.jsEscape($i18n.getString( 'wm_stacked_chart' ) , "'")',
 wm_pie_chart:'$encoder.jsEscape($i18n.getString( 'wm_pie_chart' ) , "'")',
 wm_required_categories:'$encoder.jsEscape($i18n.getString( 'wm_required_categories' ) , "'")',
-wm_first_filter_unit:'$encoder.jsEscape($i18n.getString( 'wm_first_filter_unit' ) , "'")'
+wm_multiple_filter_ind_de:'$encoder.jsEscape($i18n.getString( 'wm_multiple_filter_ind_de' ) , "'")',
+wm_multiple_filter_period:'$encoder.jsEscape($i18n.getString( 'wm_multiple_filter_period' ) , "'")',
+wm_multiple_filter_orgunit:'$encoder.jsEscape($i18n.getString( 'wm_multiple_filter_orgunit' ) , "'")',
+wm_first_filter_used:'$encoder.jsEscape($i18n.getString( 'wm_first_filter_used' ) , "'")'
 
 };
\ No newline at end of file