← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7538: Add available values for cells when to edit data-vaue in tabular report.

 

------------------------------------------------------------
revno: 7538
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-07-09 15:32:27 +0700
message:
  Add available values for cells when to edit data-vaue 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/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-06-25 21:43:59 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/report/GenerateTabularReportAction.java	2012-07-09 08:32:27 +0000
@@ -452,6 +452,11 @@
             values.add( i18n.getString( "yes" ) );
             values.add( i18n.getString( "no" ) );
         }
+        if ( valueType.equals( DataElement.VALUE_TYPE_TRUE_ONLY ) )
+        {
+            values.add( i18n.getString( "" ) );
+            values.add( i18n.getString( "yes" ) );
+        }
 
         return values;
     }

=== 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-07-09 03:38:52 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-07-09 08:32:27 +0000
@@ -128,7 +128,6 @@
 relationship=Relationship
 manage_relationship=Relationship management
 relationship_already_exists=Relationship already exists
-list_all_patients=List all persons
 nr=No
 unenroll=Unenroll
 enroll=Enroll
@@ -370,4 +369,7 @@
 single_event_with_registration = Single event with registration
 show_data_entry = Show data entry
 intro_single_event_with_registration = The data to register is defined by a single event with registration program.
-remove_empty_events = Remove Empty events  
\ No newline at end of file
+remove_empty_events = Remove Empty events  
+true_value = true
+false_value = false
+patients = persons
\ 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-07-09 04:46:02 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2012-07-09 08:32:27 +0000
@@ -1109,7 +1109,6 @@
 		},
 		covertXType: function( type )
 		{
-			type = type.toLowerCase();
 			if( type == 'date' )
 			{
 				return 'datefield';
@@ -1118,7 +1117,7 @@
 			{
 				return 'numberfield';
 			}
-			if( type == 'combo' || type == 'list' )
+			if( type == 'combo' || type == 'list' || type == 'trueOnly' )
 			{
 				return 'combobox';
 			}
@@ -1467,7 +1466,8 @@
 			params.filter = {};
 			params.filter.type = TR.value.covertValueType( type );
 				
-			if( type.toLowerCase() == 'date' )
+			type = type.toLowerCase();
+			if( type == 'date' )
 			{
 				params.renderer = Ext.util.Format.dateRenderer( TR.i18n.format_date );
 				params.filter.dateFormat = TR.i18n.format_date;
@@ -1477,7 +1477,27 @@
 				
 				params.editor.format = TR.i18n.format_date;
 			}
-			else if( type.toLowerCase() == 'list' )
+			else if( type == 'bool' || type == 'trueonly' )
+			{
+				params.editor.xtype = 'combobox';
+				params.editor.queryMode = 'local';
+				params.editor.editable = false;
+				params.editor.valueField = 'value';
+				params.editor.displayField = 'name';
+				if( type.toLowerCase() == 'bool' ){
+					params.editor.store = new Ext.data.ArrayStore({
+						fields: ['value', 'name'],
+						data: [['true', TR.i18n.true_value], ['false', TR.i18n.false_value]]
+					});
+				}
+				else{
+					params.editor.store = new Ext.data.ArrayStore({
+						fields: ['value', 'name'],
+						data: [['', TR.i18n.none], ['true', TR.i18n.true_value]]
+					});
+				}
+			}
+			else if( type == 'list' )
 			{
 				params.editor.xtype = 'combobox';
 				params.editor.typeAhead = true;
@@ -1568,6 +1588,33 @@
 		}
     };
 	
+	Ext.apply(Ext.form.VTypes, {
+		daterange : function(val, field) {
+			var date = field.parseDate(val);
+	 
+			if(!date){
+				return;
+			}
+			if (field.startDateField && (!this.dateRangeMax || (date.getTime() != this.dateRangeMax.getTime()))) {
+				var start = Ext.getCmp(field.startDateField);
+				start.setMaxValue(date);
+				start.validate();
+				this.dateRangeMax = date;
+			}
+			else if (field.endDateField && (!this.dateRangeMin || (date.getTime() != this.dateRangeMin.getTime()))) {
+				var end = Ext.getCmp(field.endDateField);
+				end.setMinValue(date);
+				end.validate();
+				this.dateRangeMin = date;
+			}
+			/*
+			 * Always return true since we're only using this vtype to set the
+			 * min/max allowed values (these are tested for after the vtype test)
+			 */
+			return true;
+		}
+	});
+
     TR.viewport = Ext.create('Ext.container.Viewport', {
         layout: 'border',
         renderTo: Ext.getBody(),

=== 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-07-09 04:46:02 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm	2012-07-09 08:32:27 +0000
@@ -86,5 +86,7 @@
 operations:'$encoder.jsEscape($i18n.getString( 'operations' ) , "'")',
 deleting:'$encoder.jsEscape($i18n.getString( 'deleting' ) , "'")',
 saving:'$encoder.jsEscape($i18n.getString( 'saving' ) , "'")',
-renaming:'$encoder.jsEscape($i18n.getString( 'renaming' ) , "'")'
+renaming:'$encoder.jsEscape($i18n.getString( 'renaming' ) , "'")',
+true_value:'$encoder.jsEscape($i18n.getString( 'true_value' ) , "'")',
+false_value:'$encoder.jsEscape($i18n.getString( 'false_value' ) , "'")'
 };
\ No newline at end of file