← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6663: (patient) Add clear button in tabular report.

 

------------------------------------------------------------
revno: 6663
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-04-20 17:24:33 +0700
message:
  (patient) Add clear button in tabular report.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.java
  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/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-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java	2012-04-19 02:48:18 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java	2012-04-20 10:24:33 +0000
@@ -415,7 +415,12 @@
                 if ( infor.length == 4 )
                 {
                     searchingAttrKeys.put( objectId, infor[3].trim() );
-                    values.add( infor[3].trim() );
+                    String value = infor[3].trim();
+                    if ( attribute.getValueType().equals( PatientAttribute.TYPE_BOOL ) )
+                    {
+                        value = value.equals( i18n.getString( "yes" ) ) ? "true" : "false";
+                    }
+                    values.add( value );
                 }
                 else
                 {
@@ -437,7 +442,12 @@
                 if ( infor.length == 4 )
                 {
                     searchingDEKeys.put( objectId, infor[3].trim() );
-                    values.add( infor[3].trim() );
+                    String value = infor[3].trim();
+                    if ( dataElement.getType().equals( DataElement.VALUE_TYPE_BOOL ) )
+                    {
+                        value = value.equals( i18n.getString( "yes" ) ) ? "true" : "false";
+                    }
+                    values.add( value );
                 }
                 else
                 {

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.java	2012-02-25 12:24:41 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/ReportSelectAction.java	2012-04-20 10:24:33 +0000
@@ -89,7 +89,7 @@
         
         programs = programService.getPrograms( orgunit );
         
-        programs.retainAll( programService.getPrograms( true, false ) );
+        programs.retainAll( programService.getPrograms( true, true ) );
         
         return SUCCESS;
     }

=== 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	2012-04-19 22:00:04 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-04-20 10:24:33 +0000
@@ -327,4 +327,7 @@
 deathdate = Death date
 registrationDate = Date of registration
 report = Report
-et_no_program = Please select one program
\ No newline at end of file
+et_no_program = Please select one program
+asc = ASC
+desc = DESC
+show_hide_columns = Show / Hide columns
\ 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	2012-04-20 06:51:37 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2012-04-20 10:24:33 +0000
@@ -488,7 +488,6 @@
 				data: TR.value.values,
 				remoteSort:true,
 				autoLoad: false,
-				//groupField: 'col1',
 				proxy: {
 					type: 'memory',
 					reader: {
@@ -806,7 +805,6 @@
 				idenCols[i] = { 
 					header: r.data.name, 
 					dataIndex: dataIndex,
-					width: 150,
 					height: TR.conf.layout.east_gridcolumn_height,
 					name: "iden_"+ r.data.id + "_",
 					hidden: eval(TR.value.hidden[index]),
@@ -828,7 +826,6 @@
 				attrCols[i] = { 
 					header: r.data.name, 
 					dataIndex: dataIndex,
-					width: 150,
 					height: TR.conf.layout.east_gridcolumn_height,
 					name: "attr_"+ r.data.id + "_",
 					hidden: eval(TR.value.hidden[index]),
@@ -860,7 +857,6 @@
 				deCols[i] = { 
 					header: r.data.name, 
 					dataIndex: dataIndex,
-					width: 150,
 					height: TR.conf.layout.east_gridcolumn_height,
 					name: "de_"+ r.data.id + "_",
 					hidden: eval(TR.value.hidden[index]),
@@ -965,6 +961,48 @@
 						}
 					}
 				},
+				lbar: [
+					{
+						xtype: 'label',
+						style: 'padding:45px 3px 3 0px',
+					},
+					{
+						xtype: 'button',
+						icon: 'images/clearFilter.png',
+						tooltip: TR.i18n.clear_filter,
+						handler: function() {
+							var cols = [];
+							var grid = TR.datatable.datatable;
+							var i = 0;
+							for( var index=0; index<grid.columns.length; index++)
+							{
+								var col = grid.columns[index];
+								
+								cols[i] = col;
+								i++;
+								
+								var subCols = col.items;
+								for( var subIndex=0; subIndex<subCols.length; subIndex++)
+								{
+									cols[i] = subCols.getAt(subIndex);
+									i++;
+								}
+							}
+							
+							var editor = grid.getStore().getAt(0);
+							var colLen = cols.length;
+							for( var i=1; i<colLen; i++ )
+							{
+								var col = cols[i];
+								var dataIndex = col.dataIndex;
+								TR.store.datatable.first().data[dataIndex] = "";
+							}
+							
+							TR.exe.execute();
+						}
+					}
+					
+				],
 				bbar: [
 					{
 						xtype: 'button',
@@ -1083,9 +1121,7 @@
 							grid.getView().focusRow(this.rowIndex);
 						}
 					}
-				},
-				sortAscText: TR.i18n.asc,
-				sortDescText: TR.i18n.desc
+				}
 			});
 			
 			if (Ext.grid.RowEditor) {
@@ -1095,7 +1131,11 @@
 				});
 			}
 			
-			
+			Ext.override(Ext.grid.header.Container, { 
+				sortAscText: TR.i18n.asc,
+				sortDescText: TR.i18n.desc, 
+				columnsText: TR.i18n.show_hide_columns });
+
 			TR.cmp.region.center.removeAll(true);
 			TR.cmp.region.center.add(this.datatable);		
           	

=== 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	2012-04-20 03:52:46 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm	2012-04-20 10:24:33 +0000
@@ -24,9 +24,8 @@
 download:'$encoder.jsEscape($i18n.getString( 'download' ) , "'")',
 xls:'$encoder.jsEscape($i18n.getString( 'xls' ) , "'")',
 pdf:'$encoder.jsEscape($i18n.getString( 'pdf' ) , "'")',
-filter:'$encoder.jsEscape($i18n.getString( 'filter' ) , "'")',
 cancel:'$encoder.jsEscape($i18n.getString( 'cancel' ) , "'")',
-clear:'$encoder.jsEscape($i18n.getString( 'clear' ) , "'")',
+clear_filter:'$encoder.jsEscape($i18n.getString( 'clear_filter' ) , "'")',
 show_hide_settings_panel:'$encoder.jsEscape($i18n.getString( 'show_hide_settings_panel' ) , "'")',
 updating:'$encoder.jsEscape($i18n.getString( 'updating' ) , "'")',
 data_table:'$encoder.jsEscape($i18n.getString( 'data_table' ) , "'")',
@@ -37,12 +36,9 @@
 em_no_orgunits:'$encoder.jsEscape($i18n.getString( 'em_no_orgunits' ) , "'")',
 organisation_units:'$encoder.jsEscape($i18n.getString( 'organisation_units' ) , "'")',
 commons:'$encoder.jsEscape($i18n.getString( 'commons' ) , "'")',
-asc:'$encoder.jsEscape($i18n.getString( 'asc' ) , "'")',
 options:'$encoder.jsEscape($i18n.getString( 'options' ) , "'")',
 reset:'$encoder.jsEscape($i18n.getString( 'reset' ) , "'")',
 no:'$encoder.jsEscape($i18n.getString( 'no' ) , "'")',
-asc:'$encoder.jsEscape($i18n.getString( 'asc' ) , "'")',
-desc:'$encoder.jsEscape($i18n.getString( 'desc' ) , "'")',
 full_name:'$encoder.jsEscape($i18n.getString( 'full_name' ) , "'")',
 gender:'$encoder.jsEscape($i18n.getString( 'gender' ) , "'")',
 date_of_birth:'$encoder.jsEscape($i18n.getString( 'date_of_birth' ) , "'")',
@@ -55,5 +51,7 @@
 dynamic_attributes:'$encoder.jsEscape($i18n.getString( 'dynamic_attributes' ) , "'")',
 report:'$encoder.jsEscape($i18n.getString( 'report' ) , "'")',
 demographics:'$encoder.jsEscape($i18n.getString( 'demographics' ) , "'")',
-columns:'$encoder.jsEscape($i18n.getString( 'columns' ) , "'")'
+asc:'$encoder.jsEscape($i18n.getString( 'asc' ) , "'")',
+desc:'$encoder.jsEscape($i18n.getString( 'desc' ) , "'")',
+show_hide_columns:'$encoder.jsEscape($i18n.getString( 'show_hide_columns' ) , "'")'
 };
\ No newline at end of file