dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #07633
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2200: Fix bug: Cannot load organisation unit tree in when assigning program to organisation unit.
------------------------------------------------------------
revno: 2200
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-09-23 11:50:45 +0700
message:
Fix bug: Cannot load organisation unit tree in when assigning program to organisation unit.
removed:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/SelectLevelAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/SelectOrganisationUnitGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UnselectAllAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UnselectLevelAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UnselectOrganisationUnitGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/associations.js
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/jdbc/JdbcDataAnalysisStore.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-i18n/src/main/java/org/hisp/dhis/i18n/resourcebundle/DefaultResourceBundleManager.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/SetupAssociationsTreeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programAssociations.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-core/src/main/java/org/hisp/dhis/dataanalysis/jdbc/JdbcDataAnalysisStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/jdbc/JdbcDataAnalysisStore.java 2010-08-27 08:07:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/jdbc/JdbcDataAnalysisStore.java 2010-09-23 04:50:45 +0000
@@ -31,9 +31,24 @@
import java.sql.SQLException;
import java.util.Collection;
+import javax.management.Query;
+
import org.amplecode.quick.StatementHolder;
import org.amplecode.quick.StatementManager;
import org.amplecode.quick.mapper.ObjectMapper;
+import org.hibernate.Criteria;
+import org.hibernate.Hibernate;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.criterion.AggregateProjection;
+import org.hibernate.criterion.CountProjection;
+import org.hibernate.criterion.Disjunction;
+import org.hibernate.criterion.Expression;
+import org.hibernate.criterion.Projection;
+import org.hibernate.criterion.Projections;
+import org.hibernate.criterion.Property;
+import org.hibernate.criterion.Restrictions;
+import org.hibernate.criterion.SQLCriterion;
import org.hisp.dhis.dataanalysis.DataAnalysisStore;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -62,6 +77,13 @@
@Autowired
private StatementBuilder statementBuilder;
+ protected SessionFactory sessionFactory;
+
+ public void setSessionFactory( SessionFactory sessionFactory )
+ {
+ this.sessionFactory = sessionFactory;
+ }
+
// -------------------------------------------------------------------------
// OutlierAnalysisStore implementation
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2010-09-04 07:26:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2010-09-23 04:50:45 +0000
@@ -150,7 +150,9 @@
</bean>
<bean id="org.hisp.dhis.dataanalysis.jdbc.DataAnalysisStore"
- class="org.hisp.dhis.dataanalysis.jdbc.JdbcDataAnalysisStore" />
+ class="org.hisp.dhis.dataanalysis.jdbc.JdbcDataAnalysisStore" >
+ <property name="sessionFactory" ref="sessionFactory" />
+ </bean>
<bean id="org.hisp.dhis.datavalue.DataValueAuditStore"
class="org.hisp.dhis.datavalue.hibernate.HibernateDataValueAuditStore" />
=== modified file 'dhis-2/dhis-services/dhis-service-i18n/src/main/java/org/hisp/dhis/i18n/resourcebundle/DefaultResourceBundleManager.java'
--- dhis-2/dhis-services/dhis-service-i18n/src/main/java/org/hisp/dhis/i18n/resourcebundle/DefaultResourceBundleManager.java 2010-09-22 12:16:23 +0000
+++ dhis-2/dhis-services/dhis-service-i18n/src/main/java/org/hisp/dhis/i18n/resourcebundle/DefaultResourceBundleManager.java 2010-09-23 04:50:45 +0000
@@ -175,6 +175,7 @@
private Collection<Locale> getAvailableLocalesFromDir( String dirPath )
{
File dir = new File( dirPath );
+
Set<Locale> availableLocales = new HashSet<Locale>();
File[] files = dir.listFiles( new FilenameFilter()
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/SelectLevelAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/SelectLevelAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/SelectLevelAction.java 1970-01-01 00:00:00 +0000
@@ -1,107 +0,0 @@
-package org.hisp.dhis.patient.action.program;
-
-/*
- * Copyright (c) 2004-2010, 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.Collection;
-
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.oust.manager.SelectionTreeManager;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Torgeir Lorange Ostby
- * @version $Id: SelectLevelAction.java 4524 2008-02-04 18:48:53Z larshelg $
- */
-public class SelectLevelAction
- implements Action
-{
- private static final int FIRST_LEVEL = 1;
-
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private SelectionTreeManager selectionTreeManager;
-
- public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
- {
- this.selectionTreeManager = selectionTreeManager;
- }
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private Integer level;
-
- public void setLevel( Integer level )
- {
- this.level = level;
- }
-
- // -------------------------------------------------------------------------
- // Action
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
- Collection<OrganisationUnit> rootUnits = selectionTreeManager.getRootOrganisationUnits();
-
- Collection<OrganisationUnit> selectedUnits = selectionTreeManager.getSelectedOrganisationUnits();
-
- for ( OrganisationUnit rootUnit : rootUnits )
- {
- selectLevel( rootUnit, FIRST_LEVEL, selectedUnits );
- }
-
- selectionTreeManager.setSelectedOrganisationUnits( selectedUnits );
-
- return SUCCESS;
- }
-
- // -------------------------------------------------------------------------
- // Supportive methods
- // -------------------------------------------------------------------------
-
- private void selectLevel( OrganisationUnit orgUnit, int currentLevel, Collection<OrganisationUnit> selectedUnits )
- {
- if ( currentLevel == level )
- {
- selectedUnits.add( orgUnit );
- }
- else
- {
- for ( OrganisationUnit child : orgUnit.getChildren() )
- {
- selectLevel( child, currentLevel + 1, selectedUnits );
- }
- }
- }
-}
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/SelectOrganisationUnitGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/SelectOrganisationUnitGroupAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/SelectOrganisationUnitGroupAction.java 1970-01-01 00:00:00 +0000
@@ -1,94 +0,0 @@
-package org.hisp.dhis.patient.action.program;
-
-/*
- * Copyright (c) 2004-2010, 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.Collection;
-
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
-import org.hisp.dhis.oust.manager.SelectionTreeManager;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class SelectOrganisationUnitGroupAction
- implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private SelectionTreeManager selectionTreeManager;
-
- public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
- {
- this.selectionTreeManager = selectionTreeManager;
- }
-
- private OrganisationUnitGroupService organisationUnitGroupService;
-
- public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
- {
- this.organisationUnitGroupService = organisationUnitGroupService;
- }
-
- // -------------------------------------------------------------------------
- // Input & output
- // -------------------------------------------------------------------------
-
- private Integer organisationUnitGroupId;
-
- public void setOrganisationUnitGroupId( Integer organisationUnitGroupId )
- {
- this.organisationUnitGroupId = organisationUnitGroupId;
- }
-
- // -------------------------------------------------------------------------
- // Action
- // -------------------------------------------------------------------------
-
- public String execute()
- {
- OrganisationUnitGroup group = organisationUnitGroupService.getOrganisationUnitGroup( organisationUnitGroupId );
-
- if ( group != null )
- {
- Collection<OrganisationUnit> units = selectionTreeManager.getSelectedOrganisationUnits();
-
- units.addAll( group.getMembers() );
-
- selectionTreeManager.setSelectedOrganisationUnits( units );
- }
-
- return SUCCESS;
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/SetupAssociationsTreeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/SetupAssociationsTreeAction.java 2010-06-24 13:28:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/SetupAssociationsTreeAction.java 2010-09-23 04:50:45 +0000
@@ -27,16 +27,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.oust.manager.SelectionTreeManager;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramService;
-
import com.opensymphony.xwork2.Action;
/**
@@ -49,14 +42,7 @@
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
-
- private SelectionTreeManager selectionTreeManager;
-
- public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
- {
- this.selectionTreeManager = selectionTreeManager;
- }
-
+
private ProgramService programService;
public void setProgramService( ProgramService programService )
@@ -96,24 +82,7 @@
{
program = programService.getProgram( id );
- selectionTreeManager.setSelectedOrganisationUnits( convert( program.getOrganisationUnits() ) );
-
return SUCCESS;
}
-
- // -------------------------------------------------------------------------
- // Supportive methods
- // -------------------------------------------------------------------------
-
- private Set<OrganisationUnit> convert( Collection<OrganisationUnit> orgUnits )
- {
- Set<OrganisationUnit> organisationUnits = new HashSet<OrganisationUnit>();
-
- for ( OrganisationUnit orgUnit : orgUnits )
- {
- organisationUnits.add( orgUnit );
- }
-
- return organisationUnits;
- }
+
}
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UnselectAllAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UnselectAllAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UnselectAllAction.java 1970-01-01 00:00:00 +0000
@@ -1,63 +0,0 @@
-package org.hisp.dhis.patient.action.program;
-
-/*
- * Copyright (c) 2004-2010, 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 org.hisp.dhis.oust.manager.SelectionTreeManager;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class UnselectAllAction
-implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private SelectionTreeManager selectionTreeManager;
-
- public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
- {
- this.selectionTreeManager = selectionTreeManager;
- }
-
- // -------------------------------------------------------------------------
- // Action
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
- selectionTreeManager.clearSelectedOrganisationUnits();
-
- return SUCCESS;
- }
-}
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UnselectLevelAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UnselectLevelAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UnselectLevelAction.java 1970-01-01 00:00:00 +0000
@@ -1,120 +0,0 @@
-package org.hisp.dhis.patient.action.program;
-
-/*
- * Copyright (c) 2004-2010, 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.Collection;
-
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.oust.manager.SelectionTreeManager;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class UnselectLevelAction
- implements Action
- {
- private static final int FIRST_LEVEL = 1;
-
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private SelectionTreeManager selectionTreeManager;
-
- public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
- {
- this.selectionTreeManager = selectionTreeManager;
- }
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private Integer level;
-
- public void setLevel( Integer level )
- {
- this.level = level;
- }
-
- // -------------------------------------------------------------------------
- // Output
- // -------------------------------------------------------------------------
-
- private Integer selectLevel;
-
- public Integer getSelectLevel()
- {
- return selectLevel;
- }
-
- // -------------------------------------------------------------------------
- // Action
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
- Collection<OrganisationUnit> rootUnits = selectionTreeManager.getRootOrganisationUnits();
-
- Collection<OrganisationUnit> selectedUnits = selectionTreeManager.getSelectedOrganisationUnits();
-
- for ( OrganisationUnit rootUnit : rootUnits )
- {
- unselectLevel( rootUnit, FIRST_LEVEL, selectedUnits );
- }
-
- selectionTreeManager.setSelectedOrganisationUnits( selectedUnits );
-
- selectLevel = level;
-
- return SUCCESS;
- }
-
- // -------------------------------------------------------------------------
- // Supportive methods
- // -------------------------------------------------------------------------
-
- private void unselectLevel( OrganisationUnit orgUnit, int currentLevel, Collection<OrganisationUnit> selectedUnits )
- {
- if ( currentLevel == level )
- {
- selectedUnits.remove( orgUnit );
- }
- else
- {
- for ( OrganisationUnit child : orgUnit.getChildren() )
- {
- unselectLevel( child, currentLevel + 1, selectedUnits );
- }
- }
- }
- }
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UnselectOrganisationUnitGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UnselectOrganisationUnitGroupAction.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UnselectOrganisationUnitGroupAction.java 1970-01-01 00:00:00 +0000
@@ -1,94 +0,0 @@
-package org.hisp.dhis.patient.action.program;
-
-/*
- * Copyright (c) 2004-2010, 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.Collection;
-
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
-import org.hisp.dhis.oust.manager.SelectionTreeManager;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class UnselectOrganisationUnitGroupAction
- implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private SelectionTreeManager selectionTreeManager;
-
- public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
- {
- this.selectionTreeManager = selectionTreeManager;
- }
-
- private OrganisationUnitGroupService organisationUnitGroupService;
-
- public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
- {
- this.organisationUnitGroupService = organisationUnitGroupService;
- }
-
- // -------------------------------------------------------------------------
- // Input & output
- // -------------------------------------------------------------------------
-
- private Integer organisationUnitGroupId;
-
- public void setOrganisationUnitGroupId( Integer organisationUnitGroupId )
- {
- this.organisationUnitGroupId = organisationUnitGroupId;
- }
-
- // -------------------------------------------------------------------------
- // Action
- // -------------------------------------------------------------------------
-
- public String execute()
- {
- OrganisationUnitGroup group = organisationUnitGroupService.getOrganisationUnitGroup( organisationUnitGroupId );
-
- if ( group != null )
- {
- Collection<OrganisationUnit> units = selectionTreeManager.getSelectedOrganisationUnits();
-
- units.removeAll( group.getMembers() );
-
- selectionTreeManager.setSelectedOrganisationUnits( units );
- }
-
- return SUCCESS;
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2010-09-15 09:16:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2010-09-23 04:50:45 +0000
@@ -610,8 +610,6 @@
id="org.hisp.dhis.patient.action.program.SetupAssociationsTreeAction"
class="org.hisp.dhis.patient.action.program.SetupAssociationsTreeAction"
scope="prototype">
- <property name="selectionTreeManager"
- ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
</bean>
@@ -623,45 +621,6 @@
ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
</bean>
-
- <bean id="org.hisp.dhis.patient.action.program.SelectLevelAction"
- class="org.hisp.dhis.patient.action.program.SelectLevelAction" scope="prototype">
- <property name="selectionTreeManager"
- ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
- </bean>
-
- <bean id="org.hisp.dhis.patient.action.program.UnselectLevelAction"
- class="org.hisp.dhis.patient.action.program.UnselectLevelAction"
- scope="prototype">
- <property name="selectionTreeManager"
- ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
- </bean>
-
- <bean id="org.hisp.dhis.patient.action.program.UnselectAllAction"
- class="org.hisp.dhis.patient.action.program.UnselectAllAction" scope="prototype">
- <property name="selectionTreeManager"
- ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
- </bean>
-
- <bean
- id="org.hisp.dhis.patient.action.program.SelectOrganisationUnitGroupAction"
- class="org.hisp.dhis.patient.action.program.SelectOrganisationUnitGroupAction"
- scope="prototype">
- <property name="selectionTreeManager"
- ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
- <property name="organisationUnitGroupService"
- ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
- </bean>
-
- <bean
- id="org.hisp.dhis.patient.action.program.UnselectOrganisationUnitGroupAction"
- class="org.hisp.dhis.patient.action.program.UnselectOrganisationUnitGroupAction"
- scope="prototype">
- <property name="selectionTreeManager"
- ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
- <property name="organisationUnitGroupService"
- ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
- </bean>
<!-- Program_ValidationCriteria Association -->
@@ -1191,9 +1150,6 @@
<property name="programStageDataElementService">
<ref bean="org.hisp.dhis.program.ProgramStageDataElementService" />
</property>
- <property name="expressionService">
- <ref bean="org.hisp.dhis.expression.ExpressionService" />
- </property>
</bean>
<bean
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2010-08-17 07:26:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2010-09-23 04:50:45 +0000
@@ -614,7 +614,6 @@
class="org.hisp.dhis.patient.action.program.GetProgramAction">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-patient/programAssociations.vm</param>
- <param name="javascripts">../dhis-web-commons/oust/oust.js,javascript/associations.js</param>
<param name="requiredAuthorities">F_PROGRAM_UPDATE</param>
</action>
@@ -624,42 +623,7 @@
</result>
<param name="requiredAuthorities">F_PROGRAM_UPDATE</param>
</action>
-
- <action name="selectLevel"
- class="org.hisp.dhis.patient.action.program.SelectLevelAction">
- <result name="success" type="velocity-xml">
- /dhis-web-maintenance-patient/responseSuccess.vm</result>
- <param name="requiredAuthorities">F_PROGRAM_UPDATE</param>
- </action>
-
- <action name="unselectLevel"
- class="org.hisp.dhis.patient.action.program.UnselectLevelAction">
- <result name="success" type="velocity-xml">
- /dhis-web-maintenance-patient/responseSuccess.vm</result>
- <param name="requiredAuthorities">F_PROGRAM_UPDATE</param>
- </action>
-
- <action name="selectOrganisationUnitGroup"
- class="org.hisp.dhis.patient.action.program.SelectOrganisationUnitGroupAction">
- <result name="success" type="velocity-xml">
- /dhis-web-maintenance-patient/responseSuccess.vm</result>
- <param name="requiredAuthorities">F_PROGRAM_UPDATE</param>
- </action>
-
- <action name="unselectOrganisationUnitGroup"
- class="org.hisp.dhis.patient.action.program.UnselectOrganisationUnitGroupAction">
- <result name="success" type="velocity-xml">
- /dhis-web-maintenance-patient/responseSuccess.vm</result>
- <param name="requiredAuthorities">F_PROGRAM_UPDATE</param>
- </action>
-
- <action name="unselectAll"
- class="org.hisp.dhis.patient.action.program.UnselectAllAction">
- <result name="success" type="velocity-xml">
- /dhis-web-maintenance-patient/responseSuccess.vm</result>
- <param name="requiredAuthorities">F_PROGRAM_UPDATE</param>
- </action>
-
+
<!-- Program_ValidationCriteria Association -->
<action name="defineValidationCriteriaAssociationsForm"
@@ -667,8 +631,6 @@
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-patient/validationCriteriaAssociations.vm</param>
<param name="javascripts">
- ../dhis-web-commons/oust/oust.js
- ,javascript/associations.js
,javascript/program.js
</param>
<param name="requiredAuthorities">F_PROGRAM_UPDATE</param>
@@ -688,8 +650,6 @@
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-patient/validationDEAssociations.vm</param>
<param name="javascripts">
- ../dhis-web-commons/oust/oust.js
- ,javascript/associations.js
,javascript/program.js
,javascript/programStageDEValidation.js
</param>
@@ -1118,8 +1078,6 @@
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-patient/programsForValidationCriteriaAssociations.vm</param>
<param name="javascripts">
- ../dhis-web-commons/oust/oust.js
- ,javascript/associations.js
,javascript/program.js</param>
<param name="requiredAuthorities">F_PROGRAM_UPDATE</param>
</action>
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/associations.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/associations.js 2010-03-05 13:21:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/associations.js 1970-01-01 00:00:00 +0000
@@ -1,69 +0,0 @@
-
-var numberOfSelects = 0;
-
-function selectAllAtLevel()
-{
- setMessage( i18n_loading );
- var request = new Request();
- request.setCallbackSuccess( selectReceived );
- request.send( 'selectLevel.action?level=' + getListValue( 'levelList' ) );
-}
-
-function unselectAllAtLevel()
-{
- setMessage( i18n_loading );
- var request = new Request();
- request.setCallbackSuccess( selectReceived );
- request.send( 'unselectLevel.action?level=' + getListValue( 'levelList' ) );
-}
-
-function selectGroup()
-{
- setMessage( i18n_loading );
- var request = new Request();
- request.setCallbackSuccess( selectReceived );
- request.send( 'selectOrganisationUnitGroup.action?organisationUnitGroupId=' + getListValue( 'groupList' ) );
-}
-
-function unselectGroup()
-{
- setMessage( i18n_loading );
- var request = new Request();
- request.setCallbackSuccess( selectReceived );
- request.send( 'unselectOrganisationUnitGroup.action?organisationUnitGroupId=' + getListValue( 'groupList' ) );
-}
-
-function unselectAll()
-{
- setMessage( i18n_loading );
- var request = new Request();
- request.setCallbackSuccess( selectReceived );
- request.send( 'unselectAll.action' );
-}
-
-function selectReceived()
-{
- selectionTree.buildSelectionTree();
- hideMessage();
-}
-
-function treeClicked()
-{
- numberOfSelects++;
-
- setMessage( i18n_loading );
-
- document.getElementById( "submitButton" ).disabled = true;
-}
-
-function selectCompleted( selectedUnits )
-{
- numberOfSelects--;
-
- if ( numberOfSelects <= 0 )
- {
- hideMessage();
-
- document.getElementById( "submitButton" ).disabled = false;
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programAssociations.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programAssociations.vm 2010-06-24 13:28:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programAssociations.vm 2010-09-23 04:50:45 +0000
@@ -10,45 +10,10 @@
<table id="selectionTable">
<tr>
<td>
- <input type="button" value="$i18n.getString( "select_all_at_level" )" onclick="selectAllAtLevel()" style="width:12em">
- <select id="levelList" name="levelList" style="width:12em">
- #foreach( $lev in $levels )
- <option value="$lev.level" #if ( $level == $lev.level )selected="selected"#end>$encoder.htmlEncode( $lev.name )</option>
- #end
- </select>
- <input type="button" value="$i18n.getString( "unselect_all_at_level" )" onclick="unselectAllAtLevel()" style="width:12em">
- <input type="button" value="$i18n.getString( "unselect_all" )" onclick="unselectAll()" style="width:12em">
+ #organisationUnitSelectionTree( false, true, false )
</td>
- </tr>
+ </tr>
<tr>
- <td>
- <input type="button" value="$i18n.getString( "select_all_in_group" )" onclick="selectGroup()" style="width:12em">
- <select id="groupList" name="groupList" style="width:12em">
- #foreach ( $group in $groups )
- <option value="$group.id" #if ( $organisationUnitGroupId == $group.id )selected="selected"#end>$encoder.htmlEncode( $group.name )</option>
- #end
- </select>
- <input type="button" value="$i18n.getString( "unselect_all_in_group" )" onclick="unselectGroup()" style="width:12em">
- </td>
- </tr>
- <tr>
- <td>
- <div id="selectionTree" style="width:50em;height:30em;overflow:auto;border:1px solid #cccccc"></div>
-
- <script type="text/javascript">
-
- selectionTreeSelection.setMultipleSelectionAllowed( true );
- selectionTreeSelection.setOnSelectFunction( treeClicked );
- selectionTreeSelection.setListenerFunction( selectCompleted );
- //selectionTree.clearSelectedOrganisationUnits();
- selectionTree.buildSelectionTree();
-
- </script>
-
- </td>
- </tr>
-
- <tr>
<td>
<input type="submit" id="submitButton" value="$i18n.getString( "save" )" style="width:10em"><input type="button"
onclick="window.location.href='program.action'" value="$i18n.getString( "cancel" )" style="width:10em">