dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19948
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8921: Only load orgunits belong to the loggon user on Orgunit Tab in tabular report.
------------------------------------------------------------
revno: 8921
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-11-07 10:53:08 +0700
message:
Only load orgunits belong to the loggon user on Orgunit Tab in tabular report.
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-06 15:44:27 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2012-11-07 03:53:08 +0000
@@ -5,11 +5,13 @@
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]}},
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++) {
@@ -1686,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;
@@ -1699,7 +1703,15 @@
{
treePanel.getSelectionModel().select( treePanel.getRootNode() );
TR.state.orgunitIds = [];
- TR.state.orgunitIds.push( treePanel.getSelectionModel().getSelection()[0].data.id );
+ 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-06-12 03:38:24 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonTabularInitialize.vm 2012-11-07 03:53:08 +0000
@@ -2,16 +2,17 @@
"user":
{
"id":"$!currentUser.id",
- "isAdmin":true,
- "ou":[
- "$!currentUser.organisationUnit.id",
- "$!encoder.jsonEncode(${currentUser.organisationUnit.name})"
+ "isAdmin":$!currentUser.userCredentials.isSuper(),
+ "ous":[
+ #foreach( $orgunit in $currentUser.organisationUnits )
+ {
+ "id": "${orgunit.id}" ,
+ "name": "$!encoder.jsonEncode( ${orgunit.name} )",
+ "leaf": #if($orgunit.hasChild()) "false" #else "true" #end
+ }#if( $velocityCount < $programs.size() ),#end
+ #end
]
},
- "rn":[
- "$!{rootNode.id}",
- "$!encoder.jsonEncode(${rootNode.name})"
- ],
"programs": [
#foreach( $program in $programs )
{
@@ -25,7 +26,7 @@
#foreach( $orgunitGroup in $orgunitGroups )
{
"id": "${orgunitGroup.id}" ,
- "name": "${orgunitGroup.name}"
+ "name": "$!encoder.jsonEncode( ${orgunitGroup.name} )"
}#if($velocityCount < $orgunitGroups.size()),#end
#end
],
@@ -33,7 +34,7 @@
#foreach( $level in $levels )
{
"value": "${level.level}" ,
- "name": "${level.name}"
+ "name": "$!encoder.jsonEncode( ${level.name} )"
}#if($velocityCount < $levels.size()),#end
#end
]