← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8940: Revert 8937.

 

------------------------------------------------------------
revno: 8940
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-11-07 21:57:54 +0700
message:
  Revert 8937.
modified:
  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


--
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	2012-11-07 14:21:44 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js	2012-11-07 14:57:54 +0000
@@ -5,10 +5,13 @@
 				r = Ext.JSON.decode(r.responseText);
 				var obj = { 
 					system: {
-						rootnode: {id: r.rn[0], name: r.rn[1], level: 1}, 
 						maxLevels: r.levels.length
 					}
 				};
+				obj.system.rootnodes = [];
+				for (var i = 0; i < r.user.ous.length; i++) {
+					obj.system.rootnodes.push({id: r.user.ous[i].id, text: r.user.ous[i].name, leaf: r.user.ous[i].leaf});
+				}
 				
 				obj.system.program = [];
 				for (var i = 0; i < r.programs.length; i++) {
@@ -1685,11 +1688,13 @@
 														url: TR.conf.finals.ajax.path_root + TR.conf.finals.ajax.organisationunitchildren_get
 													},
 													root: {
-														id: TR.init.system.rootnode.id,
-                                                        text: TR.init.system.rootnode.name,
-														expanded: false
+														id: 0,
+                                                        text: "/",
+														expanded: true,
+														children: TR.init.system.rootnodes
 													}
 												}),
+												rootVisible: false, 
 												listeners: {
 													added: function() {
 														TR.cmp.params.organisationunit.treepanel = this;
@@ -1698,7 +1703,15 @@
 													{
 														treePanel.getSelectionModel().select( treePanel.getRootNode() );
 														TR.state.orgunitIds = [];
-														TR.state.orgunitIds.push( treePanel.getSelectionModel().getSelection() );
+														var orgunitid = treePanel.getSelectionModel().getSelection()[0].data.id;
+														if(orgunitid==0){
+															for( var i in TR.init.system.rootnodes){
+																 TR.state.orgunitIds.push( TR.init.system.rootnodes[i].id );
+															}
+														}
+														else{
+															TR.state.orgunitIds.push( orgunitid );
+														}													
 													},
 													itemclick : function(view,rec,item,index,eventObj){
 														TR.state.orgunitIds = [];

=== 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-11-07 14:21:44 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularInitialize.vm	2012-11-07 14:57:54 +0000
@@ -2,12 +2,17 @@
 	"user":
 	{
 		"id":"$!currentUser.id",
-		"isAdmin":$!currentUser.userCredentials.isSuper()
+		"isAdmin":$!currentUser.userCredentials.isSuper(),
+		"ous":[
+			#foreach( $orgunit in $currentUser.organisationUnits )
+			   {
+					 "id":  "${orgunit.id}" ,
+					 "name": "$!encoder.jsonEncode( ${orgunit.name} )",
+					 "leaf": !$orgunit.hasChild()
+			   }#if( $velocityCount < $programs.size() ),#end
+			#end
+		]
 	},
-	"rn":[
-		"$!{rootNode.id}",
-		"$!encoder.jsonEncode(${rootNode.name})"
-    ],
 	"programs": [
 		#foreach( $program in $programs )
 		  {