← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7053: TR, removed number column

 

------------------------------------------------------------
revno: 7053
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-05-27 23:33:59 +0200
message:
  TR, removed number column
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java
  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/jsonTabularInitialize.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReportResult.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-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2012-05-26 22:54:37 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2012-05-27 21:33:59 +0000
@@ -213,7 +213,7 @@
         System.out.println("attributeKeys "+attributeKeys);
         System.out.println("dataElementKeys "+dataElementKeys);
 
-        int maxLevel = organisationUnitService.getMaxOfOrganisationUnitLevels() - 1;
+        int maxLevel = organisationUnitService.getMaxOfOrganisationUnitLevels();
         
         Map<Integer, OrganisationUnitLevel> orgUnitLevelMap = organisationUnitService.getOrganisationUnitLevelMap();
         

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2012-05-26 22:54:37 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2012-05-27 21:33:59 +0000
@@ -232,7 +232,7 @@
             String name = orgUnitLevelMap.containsKey( l ) ? orgUnitLevelMap.get( l ).getName() : "Level " + l;
             grid.addHeader( new GridHeader( name, false, true ) );
             
-            sql += "(select name from organisationunit where organisationunitid=ous.idlevel1) as level_" + i + ", ";
+            sql += "(select name from organisationunit where organisationunitid=ous.idlevel" + l + ") as level_" + i + ", ";
         }
 
         for ( PatientIdentifierType type : identifiers )
@@ -263,7 +263,7 @@
             sql += "(select value from patientdatavalue where programstageinstanceid=psi.programstageinstanceid and dataelementid=" + element.getId() + ") as element_" + element.getId() + ", ";
         }
         
-        sql = sql.substring( 0, sql.length() - 2 ) + " "; // Remove last comma
+        sql = sql.substring( 0, sql.length() - 2 ) + " "; // Removing last comma
 
         sql += "from programstageinstance psi ";
         sql += "left join programinstance pi on (psi.programinstanceid=pi.programinstanceid) ";
@@ -286,7 +286,7 @@
         sql += "psi.executiondate ";
         sql += descOrder ? "desc " : "";
         sql += "offset 0 limit 50 ";
-        sql += ") as tabular "; //TODO page and filter
+        sql += ") as tabular "; //TODO page
         
         String operator = "where ";
         
@@ -305,6 +305,7 @@
         for ( Integer key : dataElementKeys.keySet() )
         {
             sql += operator + "element_" + key + dataElementKeys.get( key ) + ", ";
+            operator = "and ";
         }
 
         sql = sql.substring( 0, sql.length() - 2 ) + " "; // Remove last comma

=== 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-05-26 17:38:10 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2012-05-27 21:33:59 +0000
@@ -3,7 +3,13 @@
 		ajax: {
 			jsonfy: function(r) {
 				r = Ext.JSON.decode(r.responseText);
-				var obj = {system: {rootnode: {id: r.rn[0], name: r.rn[1], level: 1}, user: {id: r.user.id, isadmin: r.user.isAdmin, organisationunit: {id: r.user.ou[0], name: r.user.ou[1]}}}};
+				var obj = { 
+					system: {
+						rootnode: {id: r.rn[0], name: r.rn[1], level: 1}, 
+						user: {id: r.user.id, isadmin: r.user.isAdmin, organisationunit: {id: r.user.ou[0], name: r.user.ou[1]}},
+						maxLevels: r.levels.length
+					}
+				};
 				for (var program in r.programs) {
 					obj.system.program = [];
 					for (var i = 0; i < r.programs.length; i++) {
@@ -720,7 +726,7 @@
 			this.datatable = Ext.create('Ext.data.ArrayStore', {
 				fields: TR.value.fields,
 				data: TR.value.values,
-				remoteSort:true,
+				remoteSort: true,
 				autoLoad: false,
 				storage: {}
 			});
@@ -1007,18 +1013,20 @@
 		rowEditing: null,
 		getDataTable: function() {
 			
-			var index = 1;
-			
 			var paramsLen = TR.cmp.params.identifierType.selected.store.data.length
 						+ TR.cmp.params.patientAttribute.selected.store.data.length
 						+ TR.cmp.params.dataelement.selected.store.data.length;
 			var metaDatatColsLen = TR.value.columns.length - paramsLen;
 			
-			// column
+			var orgUnitCols = ( TR.init.system.maxLevels + 1 - TR.cmp.settings.level.getValue() );
+			var index = 0;
 			var cols = [];
-			cols[0] = {
-				header: TR.i18n.no, 
-				dataIndex: 'id',
+			
+			// Report date column
+			
+			cols[index] = {
+				header: TR.value.columns[index].name, 
+				dataIndex: 'col' + index,
 				width: 50,
 				height: TR.conf.layout.east_gridcolumn_height,
 				sortable: false,
@@ -1026,45 +1034,44 @@
 				hideable: false,
 				menuDisabled: true
 			};
+						
+			// Org unit level columns
 			
-			// report-date && orgunits
-			var index=0;
-			for( index=0; index < paramsLen; index++ )
+			for( var i = 0; i < orgUnitCols; i++ )
 			{
-				cols[index + 1] = {
+				cols[++index] = {
 					header: TR.value.columns[index].name, 
-					dataIndex: 'col' + eval(index + 1),
+					dataIndex: 'col' + index,
 					height: TR.conf.layout.east_gridcolumn_height,
-					name:"meta_" + index + "_",
+					name: 'meta_' + index + '_',
 					sortable: false,
 					draggable: false,
-					hidden: eval(TR.value.columns[index].hidden )
+					hidden: eval(TR.value.columns[index].hidden)
 				}
 			}
 			
-			// identifier
+			// Identifier columns
+			
 			TR.cmp.params.identifierType.selected.store.each( function(r) {
-				var dataIndex = "col" + index;
-				cols[index + 1] = {
+				cols[++index] = {
 					header: TR.value.columns[index].name, 
-					dataIndex: 'col' + eval(index + 1),
+					dataIndex: 'col' + index,
 					height: TR.conf.layout.east_gridcolumn_height,
-					name: "iden_"+ r.data.id + "_",
+					name: 'iden_' + r.data.id + '_',
 					sortable: false,
 					draggable: false,
 					hidden: eval(TR.value.columns[index].hidden )
 				}
-				index++;
 			});
 			
-			// patient-attributes
-			TR.cmp.params.patientAttribute.selected.store.each( function(r) {
-				var dataIndex = "col" + eval(index + 1);
-				cols[index + 1] = { 
+			// Attribute columns
+			
+			TR.cmp.params.patientAttribute.selected.store.each( function(r) {	
+				cols[++index] = {
 					header: TR.value.columns[index].name, 
-					dataIndex: dataIndex,
+					dataIndex: 'col' + index,
 					height: TR.conf.layout.east_gridcolumn_height,
-					name: "attr_"+ r.data.id + "_",
+					name: 'attr_' + r.data.id + '_',
 					hidden: eval(TR.value.columns[index].hidden ),
 					sortable: false,
 					draggable: true,
@@ -1082,15 +1089,18 @@
 						})
 					}
 				};
-				index++;
 			});
 			
-			// Dataelements
+			// Data element columns
+			
 			TR.cmp.params.dataelement.selected.store.each( function(r) {
-				var dataIndex = "col" + eval(index + 1);
-				cols[index + 1] = { 
+				++index;
+				console.log(TR.value.columns);
+				console.log(r);
+				
+				cols[index] = {
 					header: TR.value.columns[index].name, 
-					dataIndex: dataIndex,
+					dataIndex: 'col' + index,
 					height: TR.conf.layout.east_gridcolumn_height,
 					name: "de_"+ r.data.id + "_",
 					hidden: eval(TR.value.columns[index].hidden ),
@@ -1110,7 +1120,6 @@
 						})
 					}
 				};
-				index++;
 			});
 			
 			this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {

=== 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	2012-05-23 15:02:50 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularInitialize.vm	2012-05-27 21:33:59 +0000
@@ -12,7 +12,7 @@
 		"$!{rootNode.id}",
 		"$!encoder.jsonEncode(${rootNode.name})"
 	],
-	
+		
 	"programs": [
 		#foreach( $program in $programs )
 		  {

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReportResult.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReportResult.vm	2012-05-26 22:54:37 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularReportResult.vm	2012-05-27 21:33:59 +0000
@@ -3,6 +3,8 @@
 #set( $noHeader = $grid.getHeaders().size() )
 #set ( $metaData = $noHeader - $valueTypes.size() )
 "total": "${total}",
+"currentPage": "$paging.currentPage",
+"pageSize": "$paging.pageSize",
 "columns":[
   #set($index = 0)
   #foreach( $col in $grid.getHeaders() )
@@ -22,12 +24,10 @@
 "items":[
   [
   "$i18n.getString( 'filter' )",
-  #foreach( $col in [1..${noHeader}] )""#if( $velocityCount < $noHeader ),#end#end
+  #foreach( $col in [2..${noHeader}] )""#if( $velocityCount < $noHeader - 1 ),#end#end
   ],
   #foreach( $row in $grid.getRows() )
   [
-    #set( $nr = ( ( $paging.getCurrentPage() - 1  ) * $paging.pageSize ) + $velocityCount )
-    ${nr},
     #foreach( $col in $row )
 	#set($colName = "col"+ $velocityCount)
     "$!encoder.htmlEncode( $col )"#if( $velocityCount < $noHeader ),#end