← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9645: Ad-hoc aggregated reports in Tabular reports (WIP).

 

------------------------------------------------------------
revno: 9645
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-01-29 13:06:22 +0700
message:
  Ad-hoc aggregated reports in Tabular reports (WIP).
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/css/style.css
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularInitialize.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-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2013-01-25 08:32:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2013-01-29 06:06:22 +0000
@@ -543,4 +543,6 @@
 like = LIKE
 in = IN
 select_all_children = Select all children
-total = Total
\ No newline at end of file
+total = Total
+confirm_delete_date_range_list=Are you sure you want to delete date range list?
+invalid_position = Please select at most two row positions or two filter positions.
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2013-01-27 13:20:53 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2013-01-29 06:06:22 +0000
@@ -10,7 +10,7 @@
 				};
 				obj.system.rootnodes = [];
 				for (var i = 0; i < r.user.ous.length; i++) {
-					obj.system.rootnodes.push({id: r.user.ous[i].id, localid: r.user.ous[i].id,text: r.user.ous[i].name, leaf: r.user.ous[i].leaf});
+					obj.system.rootnodes.push({id: r.user.ous[i].id, localid: r.user.ous[i].localid,text: r.user.ous[i].name, leaf: r.user.ous[i].leaf});
 				}
 				
 				obj.system.program = [];
@@ -702,67 +702,56 @@
 					Ext.getCmp('positionOrgunitCbx').setValue(1);
 					Ext.getCmp('positionPeriodCbx').setValue(2);
 					Ext.getCmp('positionDataCbx').setValue(3);
-					this.period();
 					break;
 				case TR.conf.reportPosition.POSITION_ROW_PERIOD_COLUMN_ORGUNIT :
 					Ext.getCmp('positionOrgunitCbx').setValue(2);
 					Ext.getCmp('positionPeriodCbx').setValue(1);
 					Ext.getCmp('positionDataCbx').setValue(3);
-					this.period();
 					break;
 				case TR.conf.reportPosition.POSITION_ROW_ORGUNIT_ROW_PERIOD :
 					Ext.getCmp('positionOrgunitCbx').setValue(1);
 					Ext.getCmp('positionPeriodCbx').setValue(1);
 					Ext.getCmp('positionDataCbx').setValue(3);
-					this.period();
 					break;
 				case TR.conf.reportPosition.POSITION_ROW_PERIOD :
 					Ext.getCmp('positionOrgunitCbx').setValue(3);
 					Ext.getCmp('positionPeriodCbx').setValue(1);
 					Ext.getCmp('positionDataCbx').setValue(3);
-					this.period();
 					break;
 				case TR.conf.reportPosition.POSITION_ROW_PERIOD :
 					Ext.getCmp('positionOrgunitCbx').setValue(3);
 					Ext.getCmp('positionPeriodCbx').setValue(1);
 					Ext.getCmp('positionDataCbx').setValue(2);
-					this.period();
 					break;
 				case TR.conf.reportPosition.POSITION_ROW_ORGUNIT :
 					Ext.getCmp('positionOrgunitCbx').setValue(1);
 					Ext.getCmp('positionPeriodCbx').setValue(2);
 					Ext.getCmp('positionDataCbx').setValue(3);
-					this.period();
 					break;	
 				case TR.conf.reportPosition.POSITION_ROW_PERIOD_COLUMN_DATA :
 					Ext.getCmp('positionOrgunitCbx').setValue(3);
 					Ext.getCmp('positionPeriodCbx').setValue(1);
 					Ext.getCmp('positionDataCbx').setValue(2);
-					this.period();
 					break;
 				case TR.conf.reportPosition.POSITION_ROW_ORGUNIT_COLUMN_DATA :
 					Ext.getCmp('positionOrgunitCbx').setValue(1);
 					Ext.getCmp('positionPeriodCbx').setValue(3);
 					Ext.getCmp('positionDataCbx').setValue(2);
-					this.period();
 					break;
 				case TR.conf.reportPosition.POSITION_ROW_DATA :
 					Ext.getCmp('positionOrgunitCbx').setValue(3);
 					Ext.getCmp('positionPeriodCbx').setValue(3);
 					Ext.getCmp('positionDataCbx').setValue(1);
-					this.period();
 					break;
 				case TR.conf.reportPosition.POSITION_ROW_DATA_COLUMN_PERIOD :
 					Ext.getCmp('positionOrgunitCbx').setValue(3);
 					Ext.getCmp('positionPeriodCbx').setValue(2);
 					Ext.getCmp('positionDataCbx').setValue(1);
-					this.period();
 					break;
 				case TR.conf.reportPosition.POSITION_ROW_DATA_COLUMN_ORGUNIT :
 					Ext.getCmp('positionOrgunitCbx').setValue(2);
 					Ext.getCmp('positionPeriodCbx').setValue(3);
 					Ext.getCmp('positionDataCbx').setValue(1);
-					this.period();
 					break;
 				}
 			}
@@ -1006,8 +995,8 @@
 								var f = Ext.JSON.decode(r.responseText);
 								
 								Ext.getCmp('programCombobox').setValue( f.programId );
-								Ext.getCmp('programStageCombobox').setValue( f.programStageId );
-								Ext.getCmp('programStageCombobox').setRawValue( f.programStageName );
+								TR.store.programStage.removeAll();
+								TR.store.programStage.add({'id': f.programStageId, 'name': f.programStageName});
 								Ext.getCmp('startDate').setValue( f.startDate );
 								Ext.getCmp('endDate').setValue( f.endDate );
 								Ext.getCmp('facilityLBCombobox').setValue( f.facilityLB );
@@ -1135,8 +1124,11 @@
 								var f = Ext.JSON.decode(r.responseText);
 								
 								Ext.getCmp('programCombobox').setValue( f.programId );
-								Ext.getCmp('programStageCombobox').setValue( f.programStageId );
-								Ext.getCmp('programStageCombobox').setRawValue( f.programStageName );
+								
+								// Program-Stage
+								TR.store.programStage.removeAll();
+								TR.store.programStage.add({'id': f.programStageId, 'name': f.programStageName});
+								
 								Ext.getCmp('userOrgunit').setValue( f.userOrganisationUnit );
 								Ext.getCmp('userOrgunitChildren').setValue( f.userOrganisationUnitChildren );								
 								
@@ -1463,10 +1455,6 @@
 			{
 				this.caseBasedReport.filter();
 			}
-			else
-			{
-				
-			}
 		},
 		getParams: function(isSorted){
 			if(Ext.getCmp('reportTypeGroup').getValue().reportType=='true')
@@ -1480,10 +1468,7 @@
 			{
 				return this.caseBasedReport.getURLParams( type, isSorted );
 			}
-			else
-			{
-				return this.aggregateReport.getURLParams( type );
-			}
+			return this.aggregateReport.getURLParams( type );
 		},
 		paramChanged: function() {
 			if(Ext.getCmp('reportTypeGroup').getValue().reportType=='true')
@@ -2093,12 +2078,6 @@
 					}
 				});
 			},
-			getFilterValueByColumn: function( colname ) {
-				
-			},
-			isParamChanged: function() {
-			
-			},
 			validation: {
 				objects: function() {
 					if (TR.cmp.settings.program.getValue() == null) {
@@ -2106,6 +2085,11 @@
 						return false;
 					}
 					
+					if (Ext.getCmp('programStageCombobox').getValue() == '') {
+						TR.util.notification.error(TR.i18n.em_no_program_stage, TR.i18n.em_no_program_stage);
+						return false;
+					}
+					
 					if( TR.cmp.settings.startDate.rawValue != "" 
 						&& !TR.cmp.settings.startDate.isValid() )
 					{
@@ -2129,11 +2113,6 @@
 						return false;
 					}
 					
-					if (Ext.getCmp('programStageCombobox').getValue() == '') {
-						TR.util.notification.error(TR.i18n.em_no_program_stage, TR.i18n.em_no_program_stage);
-						return false;
-					}
-					
 					if( TR.store.dateRange.data.length==0
 						&& TR.cmp.params.fixedperiod.selected.store.data.items.length == 0 )
 					{
@@ -2186,6 +2165,13 @@
 							periodInt++;
 						}
 					});
+					
+					var position = TR.state.aggregateReport.getPosition();
+					if( position==''){
+						TR.util.notification.error(TR.i18n.invalid_position, TR.i18n.invalid_position);
+						return false;	
+					}
+					
 					if( Ext.getCmp('limitOption').getValue() && periodInt>1)
 					{
 						TR.util.notification.error(TR.i18n.select_only_one_period, TR.i18n.select_only_one_period);
@@ -2265,13 +2251,17 @@
         datatable: null,
 		getDataTable: function() {
 			var cols = this.createColTable();
+
+			// title
+			var title = TR.cmp.settings.program.rawValue + " - " + TR.cmp.params.programStage.rawValue + " " + TR.i18n.report;
+			
 			// grid
 			this.datatable = Ext.create('Ext.grid.Panel', {
                 height: TR.util.viewport.getSize().y - 58,
 				id: 'gridTable',
 				columns: cols,
 				scroll: 'both',
-				title: TR.cmp.settings.program.rawValue + " - " + TR.cmp.params.programStage.rawValue + " " + TR.i18n.report,
+				title: title,
 				selType: 'cellmodel',
 				features: [{
 					ftype: 'filters',
@@ -3002,21 +2992,10 @@
 											},
 											{
 												xtype: 'button',
-												text: TR.i18n.clear,
+												text: TR.i18n.add,
 												style: 'margin-left:95px; margin-bottom: 10px;',
 												width: 130,
 												height: 24,
-												handler: function() {
-													Ext.getCmp('startDateRange').setValue("");
-													Ext.getCmp('endDateRange').setValue("");
-												}
-											},
-											{
-												xtype: 'button',
-												text: TR.i18n.add,
-												style: 'margin-left:4px; margin-bottom: 10px;',
-												width: 130,
-												height: 24,
 												handler: function() {	
 													var startDate = Ext.getCmp('startDateRange').rawValue;
 													var endDate = Ext.getCmp('endDateRange').rawValue;
@@ -3031,6 +3010,23 @@
 													}
 												}
 											},
+											{
+												xtype: 'button',
+												text: TR.i18n.clear,
+												style: 'margin-left:4px; margin-bottom: 10px;',
+												width: 130,
+												height: 24,
+												handler: function() {
+													if( TR.store.dateRange.data.items.length > 0 )
+													{
+														var result = window.confirm( TR.i18n.confirm_delete_date_range_list );
+														if ( result )
+														{
+															TR.store.dateRange.loadData([],false);
+														}
+													}
+												}
+											},
 											Ext.create('Ext.grid.Panel', {
 												style: 'border: solid 1px #D0D0D0',
 												width: TR.conf.layout.west_fieldset_width - 18,
@@ -3105,7 +3101,8 @@
 															{
 																xtype: 'checkbox',
 																paramName: 'reportingMonth',
-																boxLabel: TR.i18n.last_month
+																boxLabel: TR.i18n.last_month,
+																checked: true
 															},
 															{
 																xtype: 'checkbox',
@@ -3115,8 +3112,7 @@
 															{
 																xtype: 'checkbox',
 																paramName: 'last12Months',
-																boxLabel: TR.i18n.last_12_months,
-																checked: true
+																boxLabel: TR.i18n.last_12_months
 															}
 														]
 													},
@@ -3724,6 +3720,11 @@
 																	r.expand(false, function() {
 																		v.getSelectionModel().select(r.childNodes, true);
 																		v.getSelectionModel().deselect(r);
+																		
+																		TR.state.orgunitIds = [];
+																		for( var i in r.childNodes){
+																			 TR.state.orgunitIds.push( r.childNodes[0].data.localid );
+																		}
 																	});
 																}
 															});
@@ -4055,9 +4056,6 @@
 														listeners: {
 															added: function() {
 																TR.cmp.settings.positionOrgunit = this;
-															},
-															change: function (cb, nv, ov) {
-																TR.util.positionFilter.orgunit();
 															}
 														}
 													},
@@ -4083,9 +4081,6 @@
 														listeners: {
 															added: function() {
 																TR.cmp.settings.positionPeriod = this;
-															},
-															change: function (cb, nv, ov) {
-																TR.util.positionFilter.period();
 															}
 														}
 													},
@@ -4103,7 +4098,9 @@
 														width: TR.conf.layout.west_fieldset_width - TR.conf.layout.west_width_subtractor - 40,
 														store:  new Ext.data.ArrayStore({
 															fields: ['value', 'name'],
-															data: [ ['3', TR.i18n.filters] ]
+															data: [ ['1', TR.i18n.rows], 
+																	['2', TR.i18n.columns], 
+																	['3', TR.i18n.filters] ]
 														}),
 														value: '3',
 														listeners: {
@@ -4150,11 +4147,12 @@
 												},
 												{
 													xtype: 'checkbox',
+													cls: 'tr-checkbox',
 													id: 'completedEventsOpt',
 													style:'padding: 0px 0px 0px 3px;',
 													boxLabel: TR.i18n.use_completed_events,
 													boxLabelAlign: 'before',
-													labelWidth: 135,
+													labelWidth: 135
 												},
 												{
 													xtype: 'combobox',

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/css/style.css'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/css/style.css	2013-01-17 07:31:43 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/css/style.css	2013-01-29 06:06:22 +0000
@@ -216,6 +216,11 @@
     padding-left: 1px;
     font-size: 11px;
 }
+.x-form-cb-label-before {
+    padding-left: 1px;
+    font-size: 11px;
+}
+
 /* TR checkbox */
 .tr-checkbox .x-form-item-label {
     padding-left: 5px;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm	2013-01-26 07:07:27 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm	2013-01-29 06:06:22 +0000
@@ -155,5 +155,7 @@
 in: '$encoder.jsEscape($i18n.getString( 'in' ) , "'")',
 like: '$encoder.jsEscape($i18n.getString( 'like' ) , "'")',
 select_all_children: '$encoder.jsEscape($i18n.getString( 'select_all_children' ) , "'")',
-total: '$encoder.jsEscape($i18n.getString( 'total' ) , "'")'
+total: '$encoder.jsEscape($i18n.getString( 'total' ) , "'")',
+confirm_delete_date_range_list: '$encoder.jsEscape($i18n.getString( 'confirm_delete_date_range_list' ) , "'")',
+invalid_position: '$encoder.jsEscape($i18n.getString( 'invalid_position' ) , "'")'
 };
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularInitialize.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularInitialize.vm	2013-01-28 06:30:22 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularInitialize.vm	2013-01-29 06:06:22 +0000
@@ -7,7 +7,7 @@
 			#foreach( $orgunit in $currentUser.organisationUnits )
 			   {
 					 "id":  "${orgunit.uid}" ,
-					 "localid": "$organisationUnit.id",
+					 "localid": "$orgunit.id",
 					 "name": "$!encoder.jsonEncode( ${orgunit.name} )",
 					 "leaf": !$orgunit.hasChild()
 			   }#if( $velocityCount < $programs.size() ),#end