dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17995
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7402: (DV) Multiple orgunit root support implemented.
------------------------------------------------------------
revno: 7402
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-06-26 13:51:38 +0200
message:
(DV) Multiple orgunit root support implemented.
modified:
dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/InitializeAction.java
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonInitialize.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-visualizer/src/main/java/org/hisp/dhis/visualizer/action/InitializeAction.java'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/InitializeAction.java 2012-03-06 11:11:02 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/InitializeAction.java 2012-06-26 11:51:38 +0000
@@ -59,14 +59,14 @@
{
this.organisationUnitService = organisationUnitService;
}
-
+
private OrganisationUnitGroupService organisationUnitGroupService;
public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
{
this.organisationUnitGroupService = organisationUnitGroupService;
}
-
+
private PeriodService periodService;
public void setPeriodService( PeriodService periodService )
@@ -85,50 +85,50 @@
// Output
// -------------------------------------------------------------------------
- private OrganisationUnit rootNode;
+ private Collection<OrganisationUnit> rootNodes;
- public OrganisationUnit getRootNode()
+ public Collection<OrganisationUnit> getRootNodes()
{
- return rootNode;
+ return rootNodes;
}
-
+
private Collection<OrganisationUnitGroupSet> organisationUnitGroupSets;
-
+
public Collection<OrganisationUnitGroupSet> getOrganisationUnitGroupSets()
{
return organisationUnitGroupSets;
}
private List<Period> lastMonth;
-
+
public List<Period> getLastMonth()
{
return lastMonth;
}
private List<Period> last12Months;
-
+
public List<Period> getLast12Months()
{
return last12Months;
}
-
+
private List<Period> lastQuarter;
public List<Period> getLastQuarter()
{
return lastQuarter;
}
-
+
private List<Period> last4Quarters;
-
+
public List<Period> getLast4Quarters()
{
return last4Quarters;
}
-
+
private List<Period> lastSixMonth;
-
+
public List<Period> getLastSixMonth()
{
return lastSixMonth;
@@ -140,21 +140,21 @@
{
return last2SixMonths;
}
-
+
private List<Period> lastYear;
public List<Period> getLastYear()
{
return lastYear;
}
-
+
private List<Period> thisYear;
public List<Period> getThisYear()
{
return thisYear;
}
-
+
private List<Period> last5Years;
public List<Period> getLast5Years()
@@ -169,52 +169,54 @@
public String execute()
throws Exception
{
- Collection<OrganisationUnit> rootUnits = new ArrayList<OrganisationUnit>( organisationUnitService
- .getOrganisationUnitsAtLevel( 1 ) );
-
- rootNode = rootUnits.size() > 0 ? rootUnits.iterator().next() : new OrganisationUnit();
-
+ rootNodes = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitsAtLevel( 1 ) );
+
+ if ( rootNodes.size() < 1 )
+ {
+ rootNodes.add( new OrganisationUnit() );
+ }
+
organisationUnitGroupSets = organisationUnitGroupService.getAllOrganisationUnitGroupSets();
-
+
RelativePeriods rp = new RelativePeriods();
-
+
rp.clear().setReportingMonth( true );
lastMonth = periodService.reloadPeriods( setNames( rp.getRelativePeriods() ) );
-
+
rp.clear().setLast12Months( true );
last12Months = periodService.reloadPeriods( setNames( rp.getRelativePeriods() ) );
-
+
rp.clear().setReportingQuarter( true );
lastQuarter = periodService.reloadPeriods( setNames( rp.getRelativePeriods() ) );
-
+
rp.clear().setLast4Quarters( true );
last4Quarters = periodService.reloadPeriods( setNames( rp.getRelativePeriods() ) );
-
+
rp.clear().setLastSixMonth( true );
lastSixMonth = periodService.reloadPeriods( setNames( rp.getRelativePeriods() ) );
-
+
rp.clear().setLast2SixMonths( true );
last2SixMonths = periodService.reloadPeriods( setNames( rp.getRelativePeriods() ) );
-
+
rp.clear().setLastYear( true );
lastYear = periodService.reloadPeriods( setNames( rp.getRelativePeriods() ) );
-
+
rp.clear().setThisYear( true );
thisYear = periodService.reloadPeriods( setNames( rp.getRelativePeriods() ) );
-
+
rp.clear().setLast5Years( true );
last5Years = periodService.reloadPeriods( setNames( rp.getRelativePeriods() ) );
return SUCCESS;
}
-
+
private List<Period> setNames( List<Period> periods )
{
for ( Period period : periods )
{
period.setName( format.formatPeriod( period ) );
}
-
+
return periods;
}
-}
\ No newline at end of file
+}
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js 2012-06-15 10:37:57 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js 2012-06-26 11:51:38 +0000
@@ -65,11 +65,7 @@
r = Ext.JSON.decode(r.responseText);
var obj = {
system: {
- rootnode: {
- id: r.rn[0],
- name: DV.conf.util.jsonEncodeString(r.rn[1]),
- level: 1
- },
+ rootnodes: [],
periods: {},
organisationunitgroupsets: r.ougs
},
@@ -83,6 +79,9 @@
organisationunitchildren: []
}
};
+ for (var i = 0; i < r.rn.length; i++) {
+ obj.system.rootnodes.push({id: r.rn[i][0], text: r.rn[i][1], level: 1});
+ }
for (var i = 0; i < r.user.ouc.length; i++) {
obj.user.organisationunitchildren.push({id: r.user.ouc[i][0], name: DV.conf.util.jsonEncodeString(r.user.ouc[i][1])});
}
@@ -3202,6 +3201,7 @@
xtype: 'treepanel',
cls: 'dv-tree',
width: DV.conf.layout.west_fieldset_width - DV.conf.layout.west_width_subtractor,
+ rootVisible: false,
autoScroll: true,
multiSelect: true,
rendered: false,
@@ -3218,9 +3218,8 @@
url: DV.conf.finals.ajax.path_visualizer + DV.conf.finals.ajax.organisationunitchildren_get
},
root: {
- id: DV.init.system.rootnode.id,
- text: DV.init.system.rootnode.name,
- expanded: false
+ expanded: true,
+ children: DV.init.system.rootnodes
},
listeners: {
load: function(s, node, r) {
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonInitialize.vm'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonInitialize.vm 2012-06-05 17:42:28 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonInitialize.vm 2012-06-26 11:51:38 +0000
@@ -1,1 +1,1 @@
-{"user":{"id":"$!currentUser.id","isAdmin":$auth.hasAccess( "dhis-web-visualizer", "addOrUpdateSystemChart" ),"ou":["$!currentUser.organisationUnit.uid","$!encoder.jsonEncode(${currentUser.organisationUnit.name})"],"ouc":[#foreach($ou in $!currentUser.organisationUnit.getSortedChildren())["$!{ou.uid}","$!encoder.jsonEncode(${ou.name})"]#if($velocityCount<$currentUser.organisationUnit.getSortedChildren().size()),#end#end]},"rn":["$!{rootNode.uid}","$!encoder.jsonEncode(${rootNode.name})"],"ougs":{#foreach($ougs in $organisationUnitGroupSets)"$!{ougs.uid}":[#foreach($oug in $ougs.getSortedGroups()){"id":"$!{oug.uid}","name":"$!encoder.jsonEncode($!{oug.name})"}#if($velocityCount<$ougs.getSortedGroups().size()),#end#end]#if($velocityCount<$organisationUnitGroupSets.size()),#end#end}}
\ No newline at end of file
+{"user":{"id":"$!currentUser.id","isAdmin":$auth.hasAccess( "dhis-web-visualizer", "addOrUpdateSystemChart" ),"ou":["$!currentUser.organisationUnit.uid","$!encoder.jsonEncode(${currentUser.organisationUnit.name})"],"ouc":[#foreach($ou in $!currentUser.organisationUnit.getSortedChildren())["$!{ou.uid}","$!encoder.jsonEncode(${ou.name})"]#if($velocityCount<$currentUser.organisationUnit.getSortedChildren().size()),#end#end]},"rn":[#foreach($rn in $rootNodes)["$!{rn.uid}","$!encoder.jsonEncode(${rn.name})"]#if($velocityCount<$rootNodes.size()),#end#end],"ougs":{#foreach($ougs in $organisationUnitGroupSets)"$!{ougs.uid}":[#foreach($oug in $ougs.getSortedGroups()){"id":"$!{oug.uid}","name":"$!encoder.jsonEncode($!{oug.name})"}#if($velocityCount<$ougs.getSortedGroups().size()),#end#end]#if($velocityCount<$organisationUnitGroupSets.size()),#end#end}}