← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13421: Remove validation of dataelements in tabular report.

 

------------------------------------------------------------
revno: 13421
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-12-25 10:01:47 +0700
message:
  Remove validation of dataelements in tabular report.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.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-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-10-22 03:05:45 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2013-12-25 03:01:47 +0000
@@ -1906,12 +1906,25 @@
 				
 				if( type)
 				{
-					document.location =  url + programId + "." + type + "?stage=" + programStageId + TR.state.getURLParams();
+					url +=  programId + "." + type 
+					if (Ext.getCmp('programStageCombobox').getValue() != '') {
+						url += "?stage=" + programStageId
+						return false;
+					}
+					else{
+						url += "?";
+					}
+					url+= TR.state.getURLParams();
+					document.location = url;
 				}
 				// Show report on grid
 				else
 				{
-					url += programId + ".json?stage=" + programStageId;
+					url += programId + ".json";
+					if (Ext.getCmp('programStageCombobox').getValue() != '') {
+						url += "?stage=" + programStageId;
+						return false;
+					}
 					TR.util.mask.showMask(TR.cmp.region.center, TR.i18n.loading);
 					Ext.Ajax.request({
 						url: url,
@@ -1989,17 +2002,7 @@
 						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.params.dataelement.selected.store.data.items.length == 0 )
-					{
-						TR.util.notification.error(TR.i18n.em_no_data_element, TR.i18n.em_no_data_element);
-						return false;
-					}
-					else
+					if(TR.cmp.params.dataelement.selected.store.data.items.length > 0 )
 					{
 						var isvalid = true;
 						TR.cmp.params.dataelement.selected.store.each( function(r) {
@@ -2073,12 +2076,26 @@
 				// Export to XLS
 				if( type)
 				{
-					document.location =  url + programId + "." + type + "?stage=" + programStageId + TR.state.getURLParams();
+					url += programId + "." + type 
+					if (Ext.getCmp('programStageCombobox').getValue() != '') {
+						url += "?stage=" + programStageId
+						return false;
+					}
+					else{
+						url += "?";
+					}
+					url +=  TR.state.getURLParams();
+					document.location = url;
 				}
 				// Show report on grid
 				else
 				{
-					url += programId + ".json?stage=" + programStageId;
+					url += programId + ".json";
+					if (Ext.getCmp('programStageCombobox').getValue() != '') {
+						url += "?stage=" + programStageId;
+						return false;
+					}
+					
 					TR.util.mask.showMask(TR.cmp.region.center, TR.i18n.loading);
 					Ext.Ajax.request({
 						url: url,
@@ -2264,11 +2281,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;
-					}
-					
 					// Validate date
 					
 					if( TR.cmp.settings.startDate.rawValue != "" 
@@ -2316,12 +2328,7 @@
 					
 					// Validate data element
 					
-					if(TR.cmp.params.dataelement.selected.store.data.items.length == 0 )
-					{
-						TR.util.notification.error(TR.i18n.em_no_data_element, TR.i18n.em_no_data_element);
-						return false;
-					}
-					else
+					if(TR.cmp.params.dataelement.selected.store.data.items.length > 0 )
 					{
 						var isvalid = true;
 						TR.cmp.params.dataelement.selected.store.each( function(r) {
@@ -2658,10 +2665,24 @@
 		createCaseColTable: function(){
 			var cols = [];
 			
-			for( var i =0; i <TR.value.columns.length; i++ )
+			for( var i=0; i <TR.value.columns.length; i++ )
 			{
+				// hidden cols
+				if( i<2 || i==6 || i==7 ){
+					cols[i] = {
+						header: TR.value.columns[i].column, 
+						dataIndex: TR.value.columns[i].name,
+						height: TR.conf.layout.east_gridcolumn_height,
+						name: TR.value.columns[i].column,
+						sortable: true,
+						draggable: false,
+						hideable: true,
+						hidden: true,
+						menuDisabled: true
+					}
+				}
 				// Sortable columns
-				if( i==2 || i== 3 || i>= 6 ){
+				else if( i==2 || i== 5 ){
 					cols[i] = {
 						header: TR.value.columns[i].column, 
 						dataIndex: TR.value.columns[i].name,
@@ -2673,7 +2694,6 @@
 						menuDisabled: true
 					}
 				}
-				// Hiden event UID column and other columnsS
 				else{
 					cols[i] = {
 						header: TR.value.columns[i].column, 
@@ -2682,12 +2702,10 @@
 						name: TR.value.columns[i].column,
 						sortable: false,
 						draggable: false,
-						hidden: true,
-						hideable: true,
+						hideable: false,
 						menuDisabled: false
 					}
 				}
-				
 			}
 				
 			return cols;