dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18053
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7451: (DV) Orgunit tree auto expansion/selection + Select orgunits by group/level + Groups/groupsets se...
------------------------------------------------------------
revno: 7451
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-06-28 19:04:59 +0200
message:
(DV) Orgunit tree auto expansion/selection + Select orgunits by group/level + Groups/groupsets separated from orgunits in new panel.
added:
dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetOrganisationUnitsAction.java
dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetOrganisationUnitsByGroupAction.java
dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetOrganisationUnitsByLevelAction.java
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonminOrganisationUnitPaths.vm
modified:
dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties
dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/struts.xml
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/css/style.css
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/i18n.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
=== added file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetOrganisationUnitsAction.java'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetOrganisationUnitsAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetOrganisationUnitsAction.java 2012-06-28 17:04:59 +0000
@@ -0,0 +1,89 @@
+package org.hisp.dhis.visualizer.action;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Jan Henrik Overland
+ */
+public class GetOrganisationUnitsAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private Collection<String> ids;
+
+ public void setIds( Collection<String> ids )
+ {
+ this.ids = ids;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private Collection<OrganisationUnit> object = new ArrayList<OrganisationUnit>();
+
+ public Collection<OrganisationUnit> getObject()
+ {
+ return object;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ object = organisationUnitService.getOrganisationUnitsByUid( ids );
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetOrganisationUnitsByGroupAction.java'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetOrganisationUnitsByGroupAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetOrganisationUnitsByGroupAction.java 2012-06-28 17:04:59 +0000
@@ -0,0 +1,91 @@
+package org.hisp.dhis.visualizer.action;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Jan Henrik Overland
+ */
+public class GetOrganisationUnitsByGroupAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private OrganisationUnitGroupService organisationUnitGroupService;
+
+ public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
+ {
+ this.organisationUnitGroupService = organisationUnitGroupService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private String id;
+
+ public void setId( String id )
+ {
+ this.id = id;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private Collection<OrganisationUnit> object = new ArrayList<OrganisationUnit>();
+
+ public Collection<OrganisationUnit> getObject()
+ {
+ return object;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ if ( id != null )
+ {
+ object = organisationUnitGroupService.getOrganisationUnitGroup( id ).getMembers();
+ }
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetOrganisationUnitsByLevelAction.java'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetOrganisationUnitsByLevelAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetOrganisationUnitsByLevelAction.java 2012-06-28 17:04:59 +0000
@@ -0,0 +1,91 @@
+package org.hisp.dhis.visualizer.action;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Jan Henrik Overland
+ */
+public class GetOrganisationUnitsByLevelAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private Integer level;
+
+ public void setLevel( Integer level )
+ {
+ this.level = level;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private Collection<OrganisationUnit> object = new ArrayList<OrganisationUnit>();
+
+ public Collection<OrganisationUnit> getObject()
+ {
+ return object;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ if ( level != null )
+ {
+ object = organisationUnitService.getOrganisationUnitsAtLevel( level );
+ }
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/META-INF/dhis/beans.xml 2012-05-06 19:28:22 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/META-INF/dhis/beans.xml 2012-06-28 17:04:59 +0000
@@ -27,6 +27,27 @@
<property name="organisationUnitService"
ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
</bean>
+
+ <bean id="org.hisp.dhis.visualizer.action.GetOrganisationUnitsAction"
+ class="org.hisp.dhis.visualizer.action.GetOrganisationUnitsAction"
+ scope="prototype">
+ <property name="organisationUnitService"
+ ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.visualizer.action.GetOrganisationUnitsByGroupAction"
+ class="org.hisp.dhis.visualizer.action.GetOrganisationUnitsByGroupAction"
+ scope="prototype">
+ <property name="organisationUnitGroupService"
+ ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.visualizer.action.GetOrganisationUnitsByLevelAction"
+ class="org.hisp.dhis.visualizer.action.GetOrganisationUnitsByLevelAction"
+ scope="prototype">
+ <property name="organisationUnitService"
+ ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ </bean>
<!-- Aggregated values -->
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties 2012-06-10 16:06:59 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties 2012-06-28 17:04:59 +0000
@@ -129,3 +129,5 @@
interpretation_was_shared = Interpretation was shared
save_load_favorite_before_sharing = Please save or load a favorite before sharing
create_chart_before_datatable = Please create a chart before showing the datatable
+organisation_unit_groups = Organisation unit groups
+nb_groups_replace_orgunits = NB! Groups will replace the selected organisation units
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/struts.xml 2012-06-02 12:20:59 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/struts.xml 2012-06-28 17:04:59 +0000
@@ -31,6 +31,24 @@
/dhis-web-visualizer/jsonminOrganisationUnitChildren.vm</result>
</action>
+ <action name="getOrganisationUnitPaths"
+ class="org.hisp.dhis.visualizer.action.GetOrganisationUnitsAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-visualizer/jsonminOrganisationUnitPaths.vm</result>
+ </action>
+
+ <action name="getOrganisationUnitPathsByGroup"
+ class="org.hisp.dhis.visualizer.action.GetOrganisationUnitsByGroupAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-visualizer/jsonminOrganisationUnitPaths.vm</result>
+ </action>
+
+ <action name="getOrganisationUnitPathsByLevel"
+ class="org.hisp.dhis.visualizer.action.GetOrganisationUnitsByLevelAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-visualizer/jsonminOrganisationUnitPaths.vm</result>
+ </action>
+
<!-- Aggregated values -->
<action name="getAggregatedValues"
=== 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-27 06:54:05 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js 2012-06-28 17:04:59 +0000
@@ -108,7 +108,12 @@
dataelement_getall: 'dataElements.json?paging=false&links=false',
dataelementgroup_get: 'dataElementGroups.json?paging=false&links=false',
dataset_get: 'dataSets.json?paging=false&links=false',
+ organisationunit_getbygroup: 'getOrganisationUnitPathsByGroup.action',
+ organisationunit_getbylevel: 'getOrganisationUnitPathsByLevel.action',
+ organisationunit_getbyids: 'getOrganisationUnitPaths.action',
+ organisationunitgroup_getall: 'organisationUnitGroups.json?paging=false&links=false',
organisationunitgroupset_get: 'getOrganisationUnitGroupSetsMinified.action',
+ organisationunitlevel_getall: 'organisationUnitLevels.json?paging=false&links=false&viewClass=detailed',
organisationunitchildren_get: 'getOrganisationUnitChildren.action',
favorite_addorupdate: 'addOrUpdateChart.action',
favorite_addorupdatesystem: 'addOrUpdateSystemChart.action',
@@ -181,7 +186,10 @@
init: 'init_',
none: 'none_',
urlparam: 'id'
- }
+ },
+ root: {
+ id: 'root'
+ }
},
relativePeriodUnits: {
lastSixMonth: 1,
@@ -219,12 +227,13 @@
west_fill_accordion_dataelement: 77,
west_fill_accordion_dataset: 45,
west_fill_accordion_organisationunit: 75,
- west_maxheight_accordion_indicator: 450,
- west_maxheight_accordion_dataelement: 450,
- west_maxheight_accordion_dataset: 450,
- west_maxheight_accordion_period: 340,
- west_maxheight_accordion_organisationunit: 700,
- west_maxheight_accordion_options: 393,
+ west_maxheight_accordion_indicator: 478,
+ west_maxheight_accordion_dataelement: 478,
+ west_maxheight_accordion_dataset: 478,
+ west_maxheight_accordion_period: 368,
+ west_maxheight_accordion_organisationunit: 728,
+ west_maxheight_accordion_organisationunitgroup: 270,
+ west_maxheight_accordion_options: 421,
east_tbar_height: 31,
east_gridcolumn_height: 30,
form_label_width: 55,
@@ -235,6 +244,8 @@
treepanel_minheight: 135,
treepanel_maxheight: 400,
treepanel_fill_default: 310,
+ treepanel_toolbar_menu_width_group: 140,
+ treepanel_toolbar_menu_width_level: 120,
multiselect_minheight: 100,
multiselect_maxheight: 250,
multiselect_fill_default: 345,
@@ -264,7 +275,8 @@
period: {
checkbox: []
},
- organisationunit: {}
+ organisationunit: {},
+ organisationunitgroup: {}
},
options: {},
toolbar: {
@@ -610,8 +622,8 @@
tp = DV.cmp.dimension.organisationunit.treepanel,
selection = tp.getSelectionModel().getSelection();
if (!selection.length) {
- var firstRoot = tp.getRootNode().getChildAt(0);
- selection = [firstRoot];
+ var root = tp.selectRootIf();
+ selection = [root];
}
Ext.Array.each(selection, function(r) {
a.push({id: r.data.id, name: r.data.text});
@@ -638,7 +650,7 @@
return a;
},
getGroupSetId: function() {
- var value = DV.cmp.dimension.organisationunit.panel.groupsets.getValue();
+ var value = DV.cmp.dimension.organisationunitgroup.panel.groupsets.getValue();
return !value || value === DV.i18n.none || value === DV.conf.finals.cmd.none ? null : value;
},
getGroupNameByGroupId: function(id) {
@@ -1467,6 +1479,41 @@
this.sort('index', 'ASC');
}
}
+ }),
+ group: Ext.create('Ext.data.Store', {
+ fields: ['id', 'name'],
+ proxy: {
+ type: 'ajax',
+ url: DV.conf.finals.ajax.path_api + DV.conf.finals.ajax.organisationunitgroup_getall,
+ reader: {
+ type: 'json',
+ root: 'organisationUnitGroups'
+ }
+ },
+ isloaded: false,
+ listeners: {
+ load: function() {
+ this.isloaded = true;
+ }
+ }
+ }),
+ level: Ext.create('Ext.data.Store', {
+ fields: ['id', 'name', 'level'],
+ proxy: {
+ type: 'ajax',
+ url: DV.conf.finals.ajax.path_api + DV.conf.finals.ajax.organisationunitlevel_getall,
+ reader: {
+ type: 'json',
+ root: 'organisationUnitLevels'
+ }
+ },
+ isloaded: false,
+ listeners: {
+ load: function() {
+ this.isloaded = true;
+ this.sort('level', 'ASC');
+ }
+ }
})
};
@@ -1716,20 +1763,22 @@
DV.util.checkbox.setRelativePeriods(DV.c.period.rp);
+ DV.cmp.dimension.organisationunit.treepanel.selectByIds(DV.c.organisationunit.ids);
+
if (DV.c.organisationunit.groupsetid) {
if (DV.store.groupset.isloaded) {
- DV.cmp.dimension.organisationunit.panel.groupsets.setValue(DV.c.organisationunit.groupsetid);
+ DV.cmp.dimension.organisationunitgroup.panel.groupsets.setValue(DV.c.organisationunit.groupsetid);
}
else {
DV.store.groupset.load({
callback: function() {
- DV.cmp.dimension.organisationunit.panel.groupsets.setValue(DV.c.organisationunit.groupsetid);
+ DV.cmp.dimension.organisationunitgroup.panel.groupsets.setValue(DV.c.organisationunit.groupsetid);
}
});
}
}
else {
- DV.cmp.dimension.organisationunit.panel.groupsets.setValue(DV.store.isloaded ? DV.conf.finals.cmd.none : DV.i18n.none);
+ DV.cmp.dimension.organisationunitgroup.panel.groupsets.setValue(DV.store.isloaded ? DV.conf.finals.cmd.none : DV.i18n.none);
}
},
validation: {
@@ -1888,7 +1937,7 @@
},
favorite: function(f) {
if (!f.organisationUnits || !f.organisationUnits.length) {
- alert(DV.i18n.favorite_no_orgunits);
+ console.log(DV.i18n.favorite_no_orgunits);
return false;
}
return true;
@@ -3179,25 +3228,134 @@
hideCollapseTool: true,
items: [
{
- xtype: 'combobox',
- cls: 'dv-combo',
- style: 'margin-bottom:8px',
- width: DV.conf.layout.west_fieldset_width - DV.conf.layout.west_width_subtractor,
- valueField: 'id',
- displayField: 'name',
- fieldLabel: DV.i18n.group_sets,
- labelWidth: 85,
- labelStyle: 'padding-left:7px;',
- editable: false,
- queryMode: 'remote',
- value: DV.i18n.none,
- store: DV.store.groupset,
- listeners: {
- added: function() {
- this.up('panel').groupsets = this;
+ id: 'organisationunit_t',
+ xtype: 'toolbar',
+ cls: 'dv-toolbar-tbar',
+ style: 'margin-bottom: 5px',
+ defaults: {
+ height: 28
+ },
+ items: [
+ {
+ xtype: 'label',
+ text: 'Auto-select organisation units by',
+ style: 'padding-left:8px; color:#666; line-height:28px'
+ },
+ '->',
+ {
+ text: 'Group..',
+ cls: 'dv-toolbar-btn-2',
+ handler: function() {},
+ listeners: {
+ added: function() {
+ this.menu = Ext.create('Ext.menu.Menu', {
+ shadow: false,
+ showSeparator: false,
+ width: DV.conf.layout.treepanel_toolbar_menu_width_group,
+ items: [
+ {
+ xtype: 'grid',
+ cls: 'dv-menugrid',
+ width: DV.conf.layout.treepanel_toolbar_menu_width_group,
+ scroll: 'vertical',
+ columns: [
+ {
+ dataIndex: 'name',
+ width: DV.conf.layout.treepanel_toolbar_menu_width_group,
+ style: 'display:none'
+ }
+ ],
+ setHeightInMenu: function(store) {
+ var h = store.getCount() * 24,
+ sh = DV.util.viewport.getSize().y * 0.6;
+ this.setHeight(h > sh ? sh : h);
+ this.doLayout();
+ this.up('menu').doLayout();
+ },
+ store: DV.store.group,
+ listeners: {
+ itemclick: function(g, r) {
+ g.getSelectionModel().select([], false);
+ this.up('menu').hide();
+ DV.cmp.dimension.organisationunit.treepanel.selectByGroup(r.data.id);
+ }
+ }
+ }
+ ],
+ listeners: {
+ show: function() {
+ if (!DV.store.group.isloaded) {
+ DV.store.group.load({scope: this, callback: function() {
+ this.down('grid').setHeightInMenu(DV.store.group);
+ }});
+ }
+ else {
+ this.down('grid').setHeightInMenu(DV.store.group);
+ }
+ }
+ }
+ });
+ }
+ }
+ },
+ {
+ text: 'Level..',
+ cls: 'dv-toolbar-btn-2',
+ handler: function() {},
+ listeners: {
+ added: function() {
+ this.menu = Ext.create('Ext.menu.Menu', {
+ shadow: false,
+ showSeparator: false,
+ width: DV.conf.layout.treepanel_toolbar_menu_width_level,
+ items: [
+ {
+ xtype: 'grid',
+ cls: 'dv-menugrid',
+ width: DV.conf.layout.treepanel_toolbar_menu_width_level,
+ scroll: 'vertical',
+ columns: [
+ {
+ dataIndex: 'name',
+ width: DV.conf.layout.treepanel_toolbar_menu_width_level,
+ style: 'display:none'
+ }
+ ],
+ setHeightInMenu: function(store) {
+ var h = store.getCount() * 24,
+ sh = DV.util.viewport.getSize().y * 0.6;
+ this.setHeight(h > sh ? sh : h);
+ this.doLayout();
+ this.up('menu').doLayout();
+ },
+ store: DV.store.level,
+ listeners: {
+ itemclick: function(g, r) {
+ g.getSelectionModel().select([], false);
+ this.up('menu').hide();
+ DV.cmp.dimension.organisationunit.treepanel.selectByLevel(r.data.level);
+ }
+ }
+ }
+ ],
+ listeners: {
+ show: function() {
+ if (!DV.store.level.isloaded) {
+ DV.store.level.load({scope: this, callback: function() {
+ this.down('grid').setHeightInMenu(DV.store.level);
+ }});
+ }
+ else {
+ this.down('grid').setHeightInMenu(DV.store.level);
+ }
+ }
+ }
+ });
+ }
+ }
}
- }
- },
+ ]
+ },
{
xtype: 'treepanel',
cls: 'dv-tree',
@@ -3209,29 +3367,79 @@
selectRootIf: function() {
if (this.getSelectionModel().getSelection().length < 1) {
var node = this.getRootNode().findChild('id', DV.init.system.rootnodes[0].id, true);
- this.getSelectionModel().select(node);
+ if (this.rendered) {
+ this.getSelectionModel().select(node);
+ }
+ return node;
}
},
+ numberOfRecords: 0,
recordsToSelect: [],
multipleSelectIf: function() {
- if (this.recordsToSelect.length > 1) {
+ if (this.recordsToSelect.length === this.numberOfRecords) {
this.getSelectionModel().select(this.recordsToSelect);
+ this.recordsToSelect = [];
+ this.numberOfRecords = 0;
}
},
- multipleExpand: function(path, id) {
- this.expandPath(path, 'id', '/', function() {
+ multipleExpand: function(id, path) {
+ this.expandPath('/' + DV.conf.finals.root.id + path, 'id', '/', function() {
var record = this.getRootNode().findChild('id', id, true);
this.recordsToSelect.push(record);
this.multipleSelectIf();
}, this);
},
+ select: function(url, params) {
+ if (!params) {
+ params = {};
+ }
+ Ext.Ajax.request({
+ url: url,
+ method: 'GET',
+ params: params,
+ scope: this,
+ success: function(r) {
+ var a = Ext.JSON.decode(r.responseText).organisationUnits;
+ this.numberOfRecords = a.length;
+ for (var i = 0; i < a.length; i++) {
+ this.multipleExpand(a[i].id, a[i].path);
+ }
+ }
+ });
+ },
+ selectByGroup: function(id) {
+ if (id) {
+ var url = DV.conf.finals.ajax.path_visualizer + DV.conf.finals.ajax.organisationunit_getbygroup,
+ params = {id: id};
+ this.select(url, params);
+ }
+ },
+ selectByLevel: function(level) {
+ if (level) {
+ var url = DV.conf.finals.ajax.path_visualizer + DV.conf.finals.ajax.organisationunit_getbylevel,
+ params = {level: level};
+ this.select(url, params);
+ }
+ },
+ selectByIds: function(ids) {
+ if (ids) {
+ var url = DV.conf.finals.ajax.path_visualizer + DV.conf.finals.ajax.organisationunit_getbyids;
+ Ext.Array.each(ids, function(item) {
+ url = Ext.String.urlAppend(url, 'ids=' + item);
+ });
+ if (!this.rendered) {
+ DV.cmp.dimension.organisationunit.panel.expand();
+ }
+ this.select(url);
+ }
+ },
store: Ext.create('Ext.data.TreeStore', {
proxy: {
type: 'ajax',
url: DV.conf.finals.ajax.path_visualizer + DV.conf.finals.ajax.organisationunitchildren_get
},
root: {
- id: 'root',
+ id: DV.conf.finals.root.id,
expanded: true,
children: DV.init.system.rootnodes
},
@@ -3247,7 +3455,12 @@
added: function() {
DV.cmp.dimension.organisationunit.treepanel = this;
},
+ render: function() {
+ this.rendered = true;
+ },
itemcontextmenu: function(v, r, h, i, e) {
+ v.getSelectionModel().select(r, false);
+
if (v.menu) {
v.menu.destroy();
}
@@ -3289,6 +3502,46 @@
}
},
{
+ title: '<div style="height:17px; background-image:url(images/organisationunit.png); background-repeat:no-repeat; padding-left:20px">' + DV.i18n.organisation_unit_groups + '</div>',
+ hideCollapseTool: true,
+ items: [
+ {
+ xtype: 'label',
+ style: 'font-style:italic; font-size:11px; color:#666',
+ margin: '0 0 0 7',
+ text: DV.i18n.nb_groups_replace_orgunits
+ },
+ {
+ xtype: 'combobox',
+ cls: 'dv-combo',
+ style: 'margin-top:10px',
+ width: DV.conf.layout.west_fieldset_width - DV.conf.layout.west_width_subtractor,
+ valueField: 'id',
+ displayField: 'name',
+ fieldLabel: 'By group set',
+ labelWidth: 85,
+ labelStyle: 'padding-left:7px;',
+ editable: false,
+ queryMode: 'remote',
+ value: DV.i18n.none,
+ store: DV.store.groupset,
+ listeners: {
+ added: function() {
+ this.up('panel').groupsets = this;
+ }
+ }
+ }
+ ],
+ listeners: {
+ added: function() {
+ DV.cmp.dimension.organisationunitgroup.panel = this;
+ },
+ expand: function() {
+ DV.util.dimension.panel.setHeight(DV.conf.layout.west_maxheight_accordion_organisationunitgroup);
+ }
+ }
+ },
+ {
title: '<div style="height:17px; background-image:url(images/options.png); background-repeat:no-repeat; padding-left:20px">' + DV.i18n.chart_options + '</div>',
hideCollapseTool: true,
cls: 'dv-accordion-options',
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/css/style.css'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/css/style.css 2012-06-10 20:54:09 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/css/style.css 2012-06-28 17:04:59 +0000
@@ -308,7 +308,16 @@
background-image: -ms-linear-gradient(top, #c7c7c7,#e0e0e0);
background-image: linear-gradient(top, #c7c7c7,#e0e0e0);
}
-
+
+
+.dv-toolbar-tbar .dv-toolbar-btn-2, .dv-toolbar-tbar .dv-toolbar-btn-2.x-menu-active {
+ background: transparent;
+ border-color: transparent;
+}
+.dv-toolbar-tbar .dv-toolbar-btn-2.over, .dv-toolbar-tbar .dv-toolbar-btn-2.x-menu-active.over {
+ background: #e1e1e1;
+ border-color: transparent;
+}
/* Toolbar separator */
.x-toolbar .x-toolbar-separator-horizontal {
@@ -385,10 +394,15 @@
}
/* Toolbar favorites */
-#favorite_t {
+#favorite_t, #organisationunit_t {
border-bottom-width: 1px !important;
border-radius: 2px;
-}
+}
+
+.x-btn-default-toolbar-small-menu-active, .x-btn-default-toolbar-small-pressed {
+ border-color: #e1e1e1;
+ background: #e1e1e1;
+}
/* Multiselect dock border radius */
.dv-toolbar-multiselect-left .x-docked-top {
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/i18n.vm'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/i18n.vm 2012-06-10 16:06:59 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/i18n.vm 2012-06-28 17:04:59 +0000
@@ -127,6 +127,8 @@
write_your_interpretation:'$encoder.jsEscape($i18n.getString( 'write_your_interpretation' ) , "'")',
interpretation_was_shared:'$encoder.jsEscape($i18n.getString( 'interpretation_was_shared' ) , "'")',
save_load_favorite_before_sharing:'$encoder.jsEscape($i18n.getString( 'save_load_favorite_before_sharing' ) , "'")',
-create_chart_before_datatable:'$encoder.jsEscape($i18n.getString( 'create_chart_before_datatable' ) , "'")'
+create_chart_before_datatable:'$encoder.jsEscape($i18n.getString( 'create_chart_before_datatable' ) , "'")',
+organisation_unit_groups:'$encoder.jsEscape($i18n.getString( 'organisation_unit_groups' ) , "'")',
+nb_groups_replace_orgunits:'$encoder.jsEscape($i18n.getString( 'nb_groups_replace_orgunits' ) , "'")'
-};
\ No newline at end of file
+};
=== added file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonminOrganisationUnitPaths.vm'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonminOrganisationUnitPaths.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonminOrganisationUnitPaths.vm 2012-06-28 17:04:59 +0000
@@ -0,0 +1,2 @@
+#set( $size = $object.size() )
+{"organisationUnits":[#foreach($unit in $object){"id":"$!{unit.uid}","name":"$!encoder.jsonEncode(${unit.name})","path":"#foreach($anc in $unit.getAncestors())/${anc.uid}#end"}#if($velocityCount < $size),#end#end]}