dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17409
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6915: local vn - Allowed user to assign the category option combo into organisation unit.
------------------------------------------------------------
revno: 6915
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-05-12 02:42:32 +0700
message:
local vn - Allowed user to assign the category option combo into organisation unit.
removed:
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/cogroup/action/OpenCategoryOptionAssociationsAction.java
added:
local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/OptionComboAssociation.java
local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/OptionComboAssociationDeletionHandler.java
local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/OptionComboAssociationService.java
local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/OptionComboAssociationStore.java
local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/hibernate/HibernateOptionComboAssociationStore.java
local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultOptionComboAssociationService.java
local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/hibernate/OptionComboAssociation.hbm.xml
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/cogroup/action/ShowDefineOptionComboAssociationsAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/cogroup/action/UpdateOptionComboAssociationsAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/optionComboAssociations.vm
modified:
local/vn/dhis-service-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml
local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/advance/action/GenerateAdvancedReportPeriodColumnListingAction.java
local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml
local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties
local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties
local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/attribute.ajax.js
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/category.ajax.js
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonCategoryOptions.vm
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/listCategoryOptionGroupOrder.vm
local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/viewAdministrator.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 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/OptionComboAssociation.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/OptionComboAssociation.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/OptionComboAssociation.java 2012-05-11 19:42:32 +0000
@@ -0,0 +1,166 @@
+package org.hisp.dhis.reportsheet;
+
+/*
+ * 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 org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class OptionComboAssociation
+{
+ private int id;
+
+ private OrganisationUnit source;
+
+ private DataElementCategoryOptionCombo optionCombo;
+
+ // -------------------------------------------------------------------------
+ // Constructors
+ // -------------------------------------------------------------------------
+
+ public OptionComboAssociation()
+ {
+ }
+
+ public OptionComboAssociation( OrganisationUnit source, DataElementCategoryOptionCombo optionCombo )
+ {
+ this.source = source;
+ this.optionCombo = optionCombo;
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters and setters
+ // -------------------------------------------------------------------------
+
+ public int getId()
+ {
+ return id;
+ }
+
+ public void setId( int id )
+ {
+ this.id = id;
+ }
+
+ public OrganisationUnit getSource()
+ {
+ return source;
+ }
+
+ public void setSource( OrganisationUnit source )
+ {
+ this.source = source;
+ }
+
+ public DataElementCategoryOptionCombo getOptionCombo()
+ {
+ return optionCombo;
+ }
+
+ public void setOptionCombo( DataElementCategoryOptionCombo optionCombo )
+ {
+ this.optionCombo = optionCombo;
+ }
+
+ // -------------------------------------------------------------------------
+ // hashCode and equals
+ // -------------------------------------------------------------------------
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+
+ result = prime * result + ((source == null) ? 0 : source.hashCode());
+ result = prime * result + ((optionCombo == null) ? 0 : optionCombo.hashCode());
+
+ return result;
+ }
+
+ @Override
+ public boolean equals( Object obj )
+ {
+ if ( this == obj )
+ {
+ return true;
+ }
+ if ( obj == null )
+ {
+ return false;
+ }
+ if ( getClass() != obj.getClass() )
+ {
+ return false;
+ }
+
+ OptionComboAssociation other = (OptionComboAssociation) obj;
+
+ if ( source == null )
+ {
+ if ( other.source != null )
+ {
+ return false;
+ }
+ }
+ else if ( !source.equals( other.source ) )
+ {
+ return false;
+ }
+
+ if ( optionCombo == null )
+ {
+ if ( other.optionCombo != null )
+ {
+ return false;
+ }
+ }
+ else if ( !optionCombo.equals( other.optionCombo ) )
+ {
+ return false;
+ }
+
+ if ( id != other.id )
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public String toString()
+ {
+ String toString = "[" + source + ", " + optionCombo + "]";
+
+ return toString;
+ }
+}
=== added file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/OptionComboAssociationDeletionHandler.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/OptionComboAssociationDeletionHandler.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/OptionComboAssociationDeletionHandler.java 2012-05-11 19:42:32 +0000
@@ -0,0 +1,80 @@
+package org.hisp.dhis.reportsheet;
+
+/*
+ * 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 org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.system.deletion.DeletionHandler;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class OptionComboAssociationDeletionHandler
+ extends DeletionHandler
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ public OptionComboAssociationService optionComboAssociationService;
+
+ public void setOptionComboAssociationService( OptionComboAssociationService optionComboAssociationService )
+ {
+ this.optionComboAssociationService = optionComboAssociationService;
+ }
+
+ // -------------------------------------------------------------------------
+ // DeletionHandler implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String getClassName()
+ {
+ return OptionComboAssociation.class.getSimpleName();
+ }
+
+ @Override
+ public void deleteOrganisationUnit( OrganisationUnit unit )
+ {
+ for ( OptionComboAssociation registration : optionComboAssociationService
+ .getAllOptionComboAssociations() )
+ {
+ if ( registration.getSource().equals( unit ) )
+ {
+ optionComboAssociationService.deleteOptionComboAssociation( registration );
+ }
+ }
+ }
+
+ @Override
+ public void deleteDataElementCategoryOptionCombo( DataElementCategoryOptionCombo optionCombo )
+ {
+ optionComboAssociationService.deleteOptionComboAssociations( optionCombo );
+ }
+}
=== added file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/OptionComboAssociationService.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/OptionComboAssociationService.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/OptionComboAssociationService.java 2012-05-11 19:42:32 +0000
@@ -0,0 +1,134 @@
+package org.hisp.dhis.reportsheet;
+
+/*
+ * 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.Collection;
+
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public interface OptionComboAssociationService
+{
+ String ID = OptionComboAssociationService.class.getName();
+
+ /**
+ * Saves a OptionComboAssociation.
+ *
+ * @param association the OptionComboAssociation to save.
+ */
+ void saveOptionComboAssociation( OptionComboAssociation association );
+
+ /**
+ * Updates a OptionComboAssociation.
+ *
+ * @param association the OptionComboAssociation to update.
+ */
+ void updateOptionComboAssociation( OptionComboAssociation association );
+
+ /**
+ * Deletes a OptionComboAssociation.
+ *
+ * @param association the OptionComboAssociation to delete.
+ */
+ void deleteOptionComboAssociation( OptionComboAssociation association );
+
+ /**
+ * Deletes the OptionComboAssociations associated with the given
+ * OrganisationUnit.
+ *
+ * @param source the OrganisationUnit.
+ */
+ void deleteOptionComboAssociations( OrganisationUnit source );
+
+ /**
+ * Deletes the OptionComboAssociations associated with the given
+ * DataElementCategoryOptionCombo.
+ *
+ * @param optionCombo the DataElementCategoryOptionCombo.
+ */
+ void deleteOptionComboAssociations( DataElementCategoryOptionCombo optionCombo );
+
+ /**
+ * Deletes the OptionComboAssociations associated with the given
+ * DataElementCategoryOptionCombo and the list of OrganisationUnits.
+ *
+ * @param optionCombo the DataElementCategoryOptionCombo.
+ * @param sources the list of OrganisationUnits.
+ */
+ void deleteOptionComboAssociations( Collection<OrganisationUnit> sources,
+ DataElementCategoryOptionCombo optionCombo );
+
+ /**
+ * Retrieves all CategoryOptionAssociations.
+ *
+ * @return a Collection of OptionComboAssociations.
+ */
+ Collection<OptionComboAssociation> getAllOptionComboAssociations();
+
+ /**
+ * Retrieves all OptionComboAssociations associated with the given
+ * OrganisationUnit.
+ *
+ * @param source the OrganisationUnit
+ * @return a Collection of OptionComboAssociations.
+ */
+ Collection<OptionComboAssociation> getOptionComboAssociations( OrganisationUnit source );
+
+ /**
+ * Retrieves the OptionComboAssociation for the given OrganisationUnit,
+ * DataElementCategoryOptionCombo
+ *
+ * @param source the OrganisationUnit.
+ * @param optionCombo the DataElementCategoryOptionCombo.
+ * @return the OptionComboAssociation.
+ */
+ OptionComboAssociation getOptionComboAssociation( OrganisationUnit source,
+ DataElementCategoryOptionCombo optionCombo );
+
+ /**
+ * Retrieves all DataElementCategoryOptionCombos associated with the given
+ * OrganisationUnit.
+ *
+ * @param source the OrganisationUnit
+ * @return a Collection of DataElementCategoryOptionCombos.
+ */
+ Collection<DataElementCategoryOptionCombo> getOptionCombos( OrganisationUnit source );
+
+ /**
+ * Retrieves all OrganisationUnits associated with the given
+ * DataElementCategoryOptionCombo.
+ *
+ * @param optionCombo the DataElementCategoryOptionCombo
+ * @return a Collection of OrganisationUnits.
+ */
+ Collection<OptionComboAssociation> getOptionComboAssociations( DataElementCategoryOptionCombo optionCombo );
+}
=== added file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/OptionComboAssociationStore.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/OptionComboAssociationStore.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/OptionComboAssociationStore.java 2012-05-11 19:42:32 +0000
@@ -0,0 +1,134 @@
+package org.hisp.dhis.reportsheet;
+
+/*
+ * 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.Collection;
+
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public interface OptionComboAssociationStore
+{
+ String ID = OptionComboAssociationStore.class.getName();
+
+ /**
+ * Saves a OptionComboAssociation.
+ *
+ * @param association the OptionComboAssociation to save.
+ */
+ void saveOptionComboAssociation( OptionComboAssociation association );
+
+ /**
+ * Updates a OptionComboAssociation.
+ *
+ * @param association the OptionComboAssociation to update.
+ */
+ void updateOptionComboAssociation( OptionComboAssociation association );
+
+ /**
+ * Deletes a OptionComboAssociation.
+ *
+ * @param association the OptionComboAssociation to delete.
+ */
+ void deleteOptionComboAssociation( OptionComboAssociation association );
+
+ /**
+ * Deletes the OptionComboAssociations associated with the given
+ * OrganisationUnit.
+ *
+ * @param source the OrganisationUnit.
+ */
+ void deleteOptionComboAssociations( OrganisationUnit source );
+
+ /**
+ * Deletes the OptionComboAssociations associated with the given
+ * DataElementCategoryOptionCombo.
+ *
+ * @param optionCombo the DataElementCategoryOptionCombo.
+ */
+ void deleteOptionComboAssociations( DataElementCategoryOptionCombo optionCombo );
+
+ /**
+ * Deletes the OptionComboAssociations associated with the given
+ * DataElementCategoryOptionCombo and the list of OrganisationUnits.
+ *
+ * @param optionCombo the DataElementCategoryOptionCombo.
+ * @param sources the list of OrganisationUnits.
+ */
+ void deleteOptionComboAssociations( Collection<OrganisationUnit> sources,
+ DataElementCategoryOptionCombo optionCombo );
+
+ /**
+ * Retrieves all CategoryOptionAssociations.
+ *
+ * @return a Collection of OptionComboAssociations.
+ */
+ Collection<OptionComboAssociation> getAllOptionComboAssociations();
+
+ /**
+ * Retrieves all OptionComboAssociations associated with the given
+ * OrganisationUnit.
+ *
+ * @param source the OrganisationUnit
+ * @return a Collection of OptionComboAssociations.
+ */
+ Collection<OptionComboAssociation> getOptionComboAssociations( OrganisationUnit source );
+
+ /**
+ * Retrieves the OptionComboAssociation for the given OrganisationUnit,
+ * DataElementCategoryOptionCombo
+ *
+ * @param source the OrganisationUnit.
+ * @param optionCombo the DataElementCategoryOptionCombo.
+ * @return the OptionComboAssociation.
+ */
+ OptionComboAssociation getOptionComboAssociation( OrganisationUnit source,
+ DataElementCategoryOptionCombo optionCombo );
+
+ /**
+ * Retrieves all DataElementCategoryOptionCombos associated with the given
+ * OrganisationUnit.
+ *
+ * @param source the OrganisationUnit
+ * @return a Collection of DataElementCategoryOptionCombos.
+ */
+ Collection<DataElementCategoryOptionCombo> getOptionCombos( OrganisationUnit source );
+
+ /**
+ * Retrieves all OrganisationUnits associated with the given
+ * DataElementCategoryOptionCombo.
+ *
+ * @param optionCombo the DataElementCategoryOptionCombo
+ * @return a Collection of OrganisationUnits.
+ */
+ Collection<OptionComboAssociation> getOptionComboAssociations( DataElementCategoryOptionCombo optionCombo );
+}
=== added file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/hibernate/HibernateOptionComboAssociationStore.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/hibernate/HibernateOptionComboAssociationStore.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/hibernate/HibernateOptionComboAssociationStore.java 2012-05-11 19:42:32 +0000
@@ -0,0 +1,162 @@
+package org.hisp.dhis.reportsheet.hibernate;
+
+/*
+ * 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.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.hibernate.Criteria;
+import org.hibernate.Query;
+import org.hibernate.SessionFactory;
+import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.reportsheet.OptionComboAssociation;
+import org.hisp.dhis.reportsheet.OptionComboAssociationStore;
+import org.hisp.dhis.system.util.ConversionUtils;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class HibernateOptionComboAssociationStore
+ implements OptionComboAssociationStore
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private SessionFactory sessionFactory;
+
+ public void setSessionFactory( SessionFactory sessionFactory )
+ {
+ this.sessionFactory = sessionFactory;
+ }
+
+ // -------------------------------------------------------------------------
+ // Implementation
+ // -------------------------------------------------------------------------
+
+ public void saveOptionComboAssociation( OptionComboAssociation registration )
+ {
+ sessionFactory.getCurrentSession().save( registration );
+ }
+
+ public void updateOptionComboAssociation( OptionComboAssociation registration )
+ {
+ sessionFactory.getCurrentSession().update( registration );
+ }
+
+ @SuppressWarnings( "unchecked" )
+ public Collection<OptionComboAssociation> getAllOptionComboAssociations()
+ {
+ return sessionFactory.getCurrentSession().createCriteria( OptionComboAssociation.class ).list();
+ }
+
+ public OptionComboAssociation getOptionComboAssociation( OrganisationUnit source,
+ DataElementCategoryOptionCombo optionCombo )
+ {
+ Criteria criteria = sessionFactory.getCurrentSession().createCriteria( OptionComboAssociation.class );
+
+ criteria.add( Restrictions.eq( "source", source ) );
+ criteria.add( Restrictions.eq( "optionCombo", optionCombo ) );
+
+ return (OptionComboAssociation) criteria.uniqueResult();
+ }
+
+ public void deleteOptionComboAssociation( OptionComboAssociation registration )
+ {
+ sessionFactory.getCurrentSession().delete( registration );
+ sessionFactory.getCurrentSession().flush();
+ }
+
+ public void deleteOptionComboAssociations( OrganisationUnit source )
+ {
+ String hql = "delete from OptionComboAssociation c where c.source = :source";
+
+ Query query = sessionFactory.getCurrentSession().createQuery( hql );
+
+ query.setEntity( "source", source );
+
+ query.executeUpdate();
+ }
+
+ public void deleteOptionComboAssociations( DataElementCategoryOptionCombo optionCombo )
+ {
+ String hql = "delete from OptionComboAssociation c where c.optionCombo = :optionCombo";
+
+ Query query = sessionFactory.getCurrentSession().createQuery( hql );
+
+ query.setEntity( "optionCombo", optionCombo );
+
+ query.executeUpdate();
+ }
+
+ @Override
+ public void deleteOptionComboAssociations( Collection<OrganisationUnit> sources,
+ DataElementCategoryOptionCombo optionCombo )
+ {
+ String hql = "delete from OptionComboAssociation c where c.optionCombo = :optionCombo and c.source.id in (:ids)";
+
+ Query query = sessionFactory.getCurrentSession().createQuery( hql );
+
+ query.setEntity( "optionCombo", optionCombo );
+ query.setParameterList( "ids", ConversionUtils.getIdentifiers( OrganisationUnit.class, sources ) );
+
+ query.executeUpdate();
+ }
+
+ @SuppressWarnings( "unchecked" )
+ public Collection<OptionComboAssociation> getOptionComboAssociations( OrganisationUnit source )
+ {
+ Criteria criteria = sessionFactory.getCurrentSession().createCriteria( OptionComboAssociation.class );
+
+ criteria.add( Restrictions.eq( "source", source ) );
+
+ return criteria.list();
+ }
+
+ public Collection<DataElementCategoryOptionCombo> getOptionCombos( OrganisationUnit source )
+ {
+ Set<DataElementCategoryOptionCombo> optionCombos = new HashSet<DataElementCategoryOptionCombo>();
+
+ for ( OptionComboAssociation association : this.getOptionComboAssociations( source ) )
+ {
+ optionCombos.add( association.getOptionCombo() );
+ }
+
+ return optionCombos;
+ }
+
+ @SuppressWarnings( "unchecked" )
+ public Collection<OptionComboAssociation> getOptionComboAssociations( DataElementCategoryOptionCombo optionCombo )
+ {
+ Criteria criteria = sessionFactory.getCurrentSession().createCriteria( OptionComboAssociation.class );
+
+ criteria.add( Restrictions.eq( "optionCombo", optionCombo ) );
+
+ return criteria.list();
+ }
+}
=== added file 'local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultOptionComboAssociationService.java'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultOptionComboAssociationService.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/impl/DefaultOptionComboAssociationService.java 2012-05-11 19:42:32 +0000
@@ -0,0 +1,125 @@
+package org.hisp.dhis.reportsheet.impl;
+
+/*
+ * 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.Collection;
+
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.reportsheet.OptionComboAssociation;
+import org.hisp.dhis.reportsheet.OptionComboAssociationService;
+import org.hisp.dhis.reportsheet.OptionComboAssociationStore;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+@Transactional
+public class DefaultOptionComboAssociationService
+ implements OptionComboAssociationService
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private OptionComboAssociationStore optionComboAssociationStore;
+
+ public void setOptionComboAssociationStore( OptionComboAssociationStore optionComboAssociationStore )
+ {
+ this.optionComboAssociationStore = optionComboAssociationStore;
+ }
+
+ // -------------------------------------------------------------------------
+ // OptionComboAssociationService
+ // -------------------------------------------------------------------------
+
+ @Override
+ public void saveOptionComboAssociation( OptionComboAssociation association )
+ {
+ optionComboAssociationStore.saveOptionComboAssociation( association );
+ }
+
+ @Override
+ public void updateOptionComboAssociation( OptionComboAssociation association )
+ {
+ optionComboAssociationStore.updateOptionComboAssociation( association );
+ }
+
+ @Override
+ public void deleteOptionComboAssociation( OptionComboAssociation association )
+ {
+ optionComboAssociationStore.deleteOptionComboAssociation( association );
+ }
+
+ @Override
+ public void deleteOptionComboAssociations( OrganisationUnit source )
+ {
+ optionComboAssociationStore.deleteOptionComboAssociations( source );
+ }
+
+ @Override
+ public void deleteOptionComboAssociations( DataElementCategoryOptionCombo optionCombo )
+ {
+ optionComboAssociationStore.deleteOptionComboAssociations( optionCombo );
+ }
+
+ @Override
+ public void deleteOptionComboAssociations( Collection<OrganisationUnit> sources,
+ DataElementCategoryOptionCombo optionCombo )
+ {
+ optionComboAssociationStore.deleteOptionComboAssociations( sources, optionCombo );
+ }
+
+ @Override
+ public Collection<OptionComboAssociation> getAllOptionComboAssociations()
+ {
+ return optionComboAssociationStore.getAllOptionComboAssociations();
+ }
+
+ @Override
+ public Collection<OptionComboAssociation> getOptionComboAssociations( OrganisationUnit source )
+ {
+ return optionComboAssociationStore.getOptionComboAssociations( source );
+ }
+
+ @Override
+ public OptionComboAssociation getOptionComboAssociation( OrganisationUnit source,
+ DataElementCategoryOptionCombo optionCombo )
+ {
+ return optionComboAssociationStore.getOptionComboAssociation( source, optionCombo );
+ }
+
+ @Override
+ public Collection<DataElementCategoryOptionCombo> getOptionCombos( OrganisationUnit source )
+ {
+ return optionComboAssociationStore.getOptionCombos( source );
+ }
+
+ @Override
+ public Collection<OptionComboAssociation> getOptionComboAssociations( DataElementCategoryOptionCombo optionCombo )
+ {
+ return optionComboAssociationStore.getOptionComboAssociations( optionCombo );
+ }
+}
=== modified file 'local/vn/dhis-service-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml 2012-05-04 09:50:39 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml 2012-05-11 19:42:32 +0000
@@ -98,6 +98,17 @@
<property name="categoryOptionAssociationStore"
ref="org.hisp.dhis.reportsheet.CategoryOptionAssociationStore" />
</bean>
+
+ <bean id="org.hisp.dhis.reportsheet.OptionComboAssociationStore"
+ class="org.hisp.dhis.reportsheet.hibernate.HibernateOptionComboAssociationStore">
+ <property name="sessionFactory" ref="sessionFactory"/>
+ </bean>
+
+ <bean id="org.hisp.dhis.reportsheet.OptionComboAssociationService"
+ class="org.hisp.dhis.reportsheet.impl.DefaultOptionComboAssociationService">
+ <property name="optionComboAssociationStore"
+ ref="org.hisp.dhis.reportsheet.OptionComboAssociationStore" />
+ </bean>
<!-- Report Location Manager -->
@@ -128,6 +139,12 @@
ref="org.hisp.dhis.reportsheet.CategoryOptionAssociationService" />
</bean>
+ <bean id="org.hisp.dhis.reportsheet.OptionComboAssociationDeletionHandler"
+ class="org.hisp.dhis.reportsheet.OptionComboAssociationDeletionHandler">
+ <property name="optionComboAssociationService"
+ ref="org.hisp.dhis.reportsheet.OptionComboAssociationService" />
+ </bean>
+
<!-- DeletionManager -->
<bean
=== added file 'local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/hibernate/OptionComboAssociation.hbm.xml'
--- local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/hibernate/OptionComboAssociation.hbm.xml 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-service-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/hibernate/OptionComboAssociation.hbm.xml 2012-05-11 19:42:32 +0000
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping>
+ <class name="org.hisp.dhis.reportsheet.OptionComboAssociation" table="reportexcel_optioncomboassociations">
+
+ <id name="id" column="optioncomboassociationid">
+ <generator class="native" />
+ </id>
+
+ <properties name="source_optioncombo_unique_key" unique="true">
+ <many-to-one name="source" class="org.hisp.dhis.organisationunit.OrganisationUnit" column="sourceid"
+ foreign-key="fk_optioncomboassociation_organisationunitid" />
+ <many-to-one name="optionCombo" class="org.hisp.dhis.dataelement.DataElementCategoryOptionCombo" column="optionComboid"
+ foreign-key="fk_optioncomboassociation_optioncomboid" />
+ </properties>
+
+ </class>
+</hibernate-mapping>
=== removed file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/cogroup/action/OpenCategoryOptionAssociationsAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/cogroup/action/OpenCategoryOptionAssociationsAction.java 2012-05-04 09:50:39 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/cogroup/action/OpenCategoryOptionAssociationsAction.java 1970-01-01 00:00:00 +0000
@@ -1,96 +0,0 @@
-package org.hisp.dhis.reportsheet.cogroup.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 org.hisp.dhis.reportsheet.CategoryOptionGroupOrder;
-import org.hisp.dhis.reportsheet.CategoryOptionGroupOrderService;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Dang Duy Hieu
- * @version $Id$
- */
-
-public class OpenCategoryOptionAssociationsAction
- implements Action
-{
- // -------------------------------------------------------------------------
- // Dependency
- // -------------------------------------------------------------------------
-
- @Autowired
- private CategoryOptionGroupOrderService groupOrderService;
-
- // -------------------------------------------------------------------------
- // Input & Output
- // -------------------------------------------------------------------------
-
- private Integer id;
-
- private Integer reportId;
-
- private CategoryOptionGroupOrder group;
-
- // -------------------------------------------------------------------------
- // Getter & Setter
- // -------------------------------------------------------------------------
-
- public void setId( Integer id )
- {
- this.id = id;
- }
-
- public void setReportId( Integer reportId )
- {
- this.reportId = reportId;
- }
-
- public Integer getReportId()
- {
- return reportId;
- }
-
- public CategoryOptionGroupOrder getGroup()
- {
- return group;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
- group = groupOrderService.getCategoryOptionGroupOrder( id );
-
- return SUCCESS;
- }
-}
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/cogroup/action/ShowDefineOptionComboAssociationsAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/cogroup/action/ShowDefineOptionComboAssociationsAction.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/cogroup/action/ShowDefineOptionComboAssociationsAction.java 2012-05-11 19:42:32 +0000
@@ -0,0 +1,99 @@
+package org.hisp.dhis.reportsheet.cogroup.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.HashSet;
+import java.util.Set;
+
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.oust.manager.SelectionTreeManager;
+import org.hisp.dhis.reportsheet.OptionComboAssociation;
+import org.hisp.dhis.reportsheet.OptionComboAssociationService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+
+public class ShowDefineOptionComboAssociationsAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private DataElementCategoryService categoryService;
+
+ @Autowired
+ private OptionComboAssociationService associationService;
+
+ @Autowired
+ private SelectionTreeManager selectionTreeManager;
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private Integer optionComboId;
+
+ public void setOptionComboId( Integer optionComboId )
+ {
+ this.optionComboId = optionComboId;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ DataElementCategoryOptionCombo optionCombo = categoryService.getDataElementCategoryOptionCombo( optionComboId );
+
+ Set<OrganisationUnit> sources = new HashSet<OrganisationUnit>();
+
+ if ( optionCombo != null )
+ {
+ for ( OptionComboAssociation association : associationService.getOptionComboAssociations( optionCombo ) )
+ {
+ sources.add( association.getSource() );
+ }
+ }
+
+ selectionTreeManager.setSelectedOrganisationUnits( sources );
+
+ return SUCCESS;
+ }
+
+}
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/cogroup/action/UpdateOptionComboAssociationsAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/cogroup/action/UpdateOptionComboAssociationsAction.java 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/cogroup/action/UpdateOptionComboAssociationsAction.java 2012-05-11 19:42:32 +0000
@@ -0,0 +1,122 @@
+package org.hisp.dhis.reportsheet.cogroup.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.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.oust.manager.SelectionTreeManager;
+import org.hisp.dhis.reportsheet.OptionComboAssociation;
+import org.hisp.dhis.reportsheet.OptionComboAssociationService;
+import org.hisp.dhis.reportsheet.action.ActionSupport;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+
+public class UpdateOptionComboAssociationsAction
+ extends ActionSupport
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private DataElementCategoryService categoryService;
+
+ @Autowired
+ private OptionComboAssociationService associationService;
+
+ @Autowired
+ private SelectionTreeManager selectionTreeManager;
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private Integer optionComboId;
+
+ public void setOptionComboId( Integer optionComboId )
+ {
+ this.optionComboId = optionComboId;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ DataElementCategoryOptionCombo optionCombo = categoryService.getDataElementCategoryOptionCombo( optionComboId );
+
+ Set<OrganisationUnit> sources = new HashSet<OrganisationUnit>();
+
+ if ( optionCombo != null )
+ {
+ for ( OptionComboAssociation association : associationService.getOptionComboAssociations( optionCombo ) )
+ {
+ sources.add( association.getSource() );
+ }
+ }
+
+ Set<OrganisationUnit> cloneSources = new HashSet<OrganisationUnit>( sources );
+
+ Collection<OrganisationUnit> selectedUnits = selectionTreeManager.getReloadedSelectedOrganisationUnits();
+
+ sources.removeAll( selectedUnits );
+
+ if ( sources != null && !sources.isEmpty() )
+ {
+ associationService.deleteOptionComboAssociations( sources, optionCombo );
+ }
+
+ selectedUnits.removeAll( cloneSources );
+
+ for ( OrganisationUnit newSource : selectedUnits )
+ {
+ OptionComboAssociation association = new OptionComboAssociation( newSource, optionCombo );
+
+ associationService.saveOptionComboAssociation( association );
+ }
+
+ sources = null;
+ cloneSources = null;
+ selectedUnits = null;
+
+ message = i18n.getString( "update_associations_successful" );
+
+ return SUCCESS;
+ }
+}
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/advance/action/GenerateAdvancedReportPeriodColumnListingAction.java'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/advance/action/GenerateAdvancedReportPeriodColumnListingAction.java 2011-08-04 08:39:55 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/java/org/hisp/dhis/reportsheet/exporting/advance/action/GenerateAdvancedReportPeriodColumnListingAction.java 2012-05-11 19:42:32 +0000
@@ -122,7 +122,6 @@
for ( OrganisationUnit organisationUnit : organisationUnits )
{
-
if ( exportItem.getItemType().equalsIgnoreCase( ExportItem.TYPE.DATAELEMENT ) )
{
value += MathUtils.calculateExpression( ExpressionUtils.generateExpression( exportItem, p
@@ -135,7 +134,6 @@
.getStartdate(), p.getEnddate(), organisationUnit, dataElementService, categoryService,
aggregationService ) );
}
-
}
ExcelUtils.writeValueByPOI( exportItem.getRow(), p.getColumn(), String.valueOf( value ),
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml 2012-05-04 09:50:39 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/META-INF/dhis/beans.xml 2012-05-11 19:42:32 +0000
@@ -316,6 +316,22 @@
class="org.hisp.dhis.reportsheet.cogroup.action.UpdateCategoryOptionAssociationsAction"
scope="prototype" />
+
+ <bean
+ id="org.hisp.dhis.reportsheet.cogroup.action.OpenOptionComboAssociationsAction"
+ class="org.hisp.dhis.reportsheet.cogroup.action.OpenOptionComboAssociationsAction"
+ scope="prototype" />
+
+ <bean
+ id="org.hisp.dhis.reportsheet.cogroup.action.ShowDefineOptionComboAssociationsAction"
+ class="org.hisp.dhis.reportsheet.cogroup.action.ShowDefineOptionComboAssociationsAction"
+ scope="prototype" />
+
+ <bean
+ id="org.hisp.dhis.reportsheet.cogroup.action.UpdateOptionComboAssociationsAction"
+ class="org.hisp.dhis.reportsheet.cogroup.action.UpdateOptionComboAssociationsAction"
+ scope="prototype" />
+
<!-- REPORT EXCEL ATTRIBUTE BEAN -->
<bean
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties 2012-05-09 05:19:35 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module.properties 2012-05-11 19:42:32 +0000
@@ -207,6 +207,7 @@
intro_import_reports = Create, update, delete and view the elements for importing data from excel files. This import items closer to export items.
intro_excel_template_management = Upload, rename, search, download and delete the file extension .xls or .xlsx. Users can identify which files are used and unused files to. Automatically, allowing to update excel reporting system when file names which are used to be changed.
intro_define_categoryoption_associations = Thus function allows users for assigning the categoy option to organisation unit.
+intro_define_categoryoptioncombo_associations = Thus function allows users for assigning the option combo to organisation unit.
translation_translate = Translate
template_using = File is using
template_pending = File is pending
@@ -328,6 +329,7 @@
select_category_option = Select category option
please_select_category = Please select a category
please_select_category_option = Please select category option
+please_select_category_option_combo = Please select category option combo
categoryoption_groups = Category Option Groups
specify_export_report = Please select report
export_type = Export type
@@ -335,5 +337,7 @@
export_multi = Export multi-reports
categoryoption_associations = Open category option associations
define_categoryoption_associations = Define Categoryoption Associations Management
+define_categoryoptioncombo_associations = Define Categoryoption Combo Associations Management
update_associations_successful = Update associations successfully
-category_options = Category options
\ No newline at end of file
+category_options = Category options
+categories = Categories
\ No newline at end of file
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties 2012-05-09 05:19:35 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/org/hisp/dhis/reportsheet/i18n_module_vi_VN.properties 2012-05-11 19:42:32 +0000
@@ -27,6 +27,7 @@
move_selected=B\u1ecf v\u00e0o
intro_clean_up=Ch\u1ee9c n\u0103ng n\u00e0y cho ph\u00e9p ng\u01b0\u1eddi d\u00f9ng x\u00f3a c\u00e1c t\u1eadp tin t\u1ea1m sinh ra trong qu\u00e1 tr\u00ecnh sinh b\u00e1o c\u00e1o ho\u1eb7c xem tr\u01b0\u1edbc b\u00e1o c\u00e1o.
intro_define_categoryoption_associations=Ch\u1ee9c n\u0103ng n\u00e0y cho ph\u00e9p ng\u01b0\u1eddi d\u00f9ng g\u00e1n Ph\u1ea7n t\u1eed ph\u00e2n lo\u1ea1i v\u00e0o \u0111\u01a1n v\u1ecb.
+intro_define_categoryoptioncombo_associations=Ch\u1ee9c n\u0103ng n\u00e0y cho ph\u00e9p ng\u01b0\u1eddi d\u00f9ng g\u00e1n Option Combo v\u00e0o \u0111\u01a1n v\u1ecb.
not_null=kh\u00f4ng r\u1ed7ng
upload_file=T\u1ea3i l\u00ean
add_export_item=Th\u00eam ph\u1ea7n t\u1eed
@@ -363,6 +364,7 @@
select_category_option = Select ph\u1ea7n t\u1eed ph\u00e2n lo\u1ea1i
please_select_category = H\u00e3y ch\u1ecdn ph\u00e2n lo\u1ea1i
please_select_category_option = H\u00e3y ch\u1ecdn ph\u1ea7n t\u1eed ph\u00e2n lo\u1ea1i
+please_select_category_option_combo = H\u00e3y ch\u1ecdn Option Combo
categoryoption_groups = Nh\u00f3m c\u00e1c Ph\u00e2n lo\u1ea1i
specify_export_report = H\u00e3y ch\u1ecdn b\u00e1o c\u00e1o
export_type = Ki\u1ec3u xu\u1ea5t b\u00e1o c\u00e1o
@@ -370,5 +372,7 @@
export_multi = Xu\u1ea5t \u0111a b\u00e1o c\u00e1o
categoryoption_associations = G\u00e1n ph\u1ea7n t\u1eed ph\u00e2n lo\u1ea1i cho \u0111\u01a1n v\u1ecb
define_categoryoption_associations = Qu\u1ea3n l\u00fd g\u00e1n ph\u1ea7n t\u1eed ph\u00e2n lo\u1ea1i cho \u0111\u01a1n v\u1ecb
+define_categoryoptioncombo_associations = Qu\u1ea3n l\u00fd g\u00e1n Option Combo cho \u0111\u01a1n v\u1ecb
update_associations_successful = C\u1eadp nh\u1eadt th\u00e0nh c\u00f4ng
-category_options = Ph\u1ea7n t\u1eed ph\u00e2n lo\u1ea1i
\ No newline at end of file
+category_options = Ph\u1ea7n t\u1eed ph\u00e2n lo\u1ea1i
+categories = Ph\u00e2n lo\u1ea1i
\ No newline at end of file
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml 2012-05-09 05:19:35 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml 2012-05-11 19:42:32 +0000
@@ -309,6 +309,28 @@
/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
</action>
+
+ <action name="openOptionComboAssociations"
+ class="org.hisp.dhis.reportsheet.action.NoAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-spreadsheet-reporting/optionComboAssociations.vm</param>
+ <param name="menu">/dhis-web-spreadsheet-reporting/menu.vm</param>
+ <param name="javascripts">javascript/category.ajax.js</param>
+ <param name="stylesheets">style/basic.css</param>
+ </action>
+
+ <action name="showAssociationsByOptionCombo"
+ class="org.hisp.dhis.reportsheet.cogroup.action.ShowDefineOptionComboAssociationsAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ </action>
+
+ <action name="updateOptionComboAssociations"
+ class="org.hisp.dhis.reportsheet.cogroup.action.UpdateOptionComboAssociationsAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ </action>
+
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- DATAELEMENT GROUP ORDER FOR CATEGORY ACTION -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/attribute.ajax.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/attribute.ajax.js 2012-05-09 05:19:35 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/attribute.ajax.js 2012-05-11 19:42:32 +0000
@@ -10,23 +10,30 @@
target.children().remove();
if ( attributeMap.length == 0 )
- {
- jQuery.getJSON( '../dhis-web-commons-ajax-json/getAttributes.action', function( json )
+ {
+ jQuery.ajax(
{
- attributeMap.push( new Attribute( -1, '[ ' + i18n_label + ' ]' ) );
- target.append( '<option value="-1">[ ' + i18n_label + ' ]</option>' );
-
- jQuery.each( json.attributes, function( i, item )
+ type: 'GET',
+ url: '../dhis-web-commons-ajax-json/getAttributes.action',
+ dataType: 'json',
+ async: false,
+ success: function( json )
{
- if ( id && item.id == id ) {
- target.append( '<option value="' + item.id + '" selected="true">' + item.name + '</option>' );
- }
- else {
- target.append( '<option value="' + item.id + '">' + item.name + '</option>' );
- }
+ attributeMap.push( new Attribute( -1, '[ ' + i18n_label + ' ]' ) );
+ target.append( '<option value="-1">[ ' + i18n_label + ' ]</option>' );
- attributeMap.push( new Attribute( item.id, item.name ) );
- } );
+ jQuery.each( json.attributes, function( i, item )
+ {
+ if ( id && item.id == id ) {
+ target.append( '<option value="' + item.id + '" selected="true">' + item.name + '</option>' );
+ }
+ else {
+ target.append( '<option value="' + item.id + '">' + item.name + '</option>' );
+ }
+
+ attributeMap.push( new Attribute( item.id, item.name ) );
+ } );
+ }
} );
}
else
@@ -64,17 +71,23 @@
{
valueList = new Array();
- jQuery.getJSON( 'getAttributeValuesByAttribute.action', {
- attributeId : id
- }, function( json )
+ jQuery.ajax(
{
- jQuery.each( json.values, function( i, item )
+ type: 'GET',
+ url: 'getAttributeValuesByAttribute.action',
+ data: 'attributeId=' + id,
+ dataType: 'json',
+ async: false,
+ success: function( json )
{
- valueList.push( new AttributeValue( item.value ) );
- source.append( '<option value="' + item.value + '">' + item.value + '</option>' );
- } );
-
- attributeValueMap[ id ] = valueList;
+ jQuery.each( json.values, function( i, item )
+ {
+ valueList.push( new AttributeValue( item.value ) );
+ source.append( '<option value="' + item.value + '">' + item.value + '</option>' );
+ } );
+
+ attributeValueMap[ id ] = valueList;
+ }
} );
}
else
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/category.ajax.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/category.ajax.js 2012-05-09 05:19:35 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/category.ajax.js 2012-05-11 19:42:32 +0000
@@ -10,23 +10,30 @@
target.children().remove();
if ( categoryMap.length == 0 )
- {
- jQuery.getJSON( '../dhis-web-commons-ajax-json/getDataElementCategories.action', function( json )
+ {
+ jQuery.ajax(
{
- categoryMap.push( new Category( -1, '[ ' + i18n_label + ' ]' ) );
- target.append( '<option value="-1">[ ' + i18n_label + ' ]</option>' );
-
- jQuery.each( json.dataElementCategories, function( i, item )
+ type: 'GET',
+ url: '../dhis-web-commons-ajax-json/getDataElementCategories.action',
+ dataType: 'json',
+ async: false,
+ success: function( json )
{
- if ( id && item.id == id ) {
- target.append( '<option value="' + item.id + '" selected="true">' + item.name + '</option>' );
- }
- else {
- target.append( '<option value="' + item.id + '">' + item.name + '</option>' );
- }
+ categoryMap.push( new Category( -1, '[ ' + i18n_label + ' ]' ) );
+ target.append( '<option value="-1">[ ' + i18n_label + ' ]</option>' );
- categoryMap.push( new Category( item.id, item.name ) );
- } );
+ jQuery.each( json.dataElementCategories, function( i, item )
+ {
+ if ( id && item.id == id ) {
+ target.append( '<option value="' + item.id + '" selected="true">' + item.name + '</option>' );
+ }
+ else {
+ target.append( '<option value="' + item.id + '">' + item.name + '</option>' );
+ }
+
+ categoryMap.push( new Category( item.id, item.name ) );
+ } );
+ }
} );
}
else
@@ -47,12 +54,11 @@
{
var source = jQuery( "#" + sourceList );
var dest = jQuery( "#" + destList );
-
+
if ( source )
{
source.empty();
}
-
if ( dest && !isFirstLoad )
{
dest.empty();
@@ -64,17 +70,37 @@
{
valueList = new Array();
- jQuery.getJSON( 'getCategoryOptionsByCategory.action', {
- categoryId : id
- }, function( json )
+ jQuery.ajax(
{
- jQuery.each( json.categoryOptions, function( i, item )
- {
- valueList.push( new CategoryOption( item.id, item.name ) );
- source.append( '<option value="' + item.id + '">' + item.name + '</option>' );
- } );
-
- categoryOptionMap[ id ] = valueList;
+ type: 'GET',
+ url: 'getCategoryOptionsByCategory.action',
+ data: 'categoryId=' + id,
+ dataType: 'json',
+ async: false,
+ success: function( json ) {
+
+ jQuery.each( json.categoryOptions, function( i, item )
+ {
+ valueList.push( new CategoryOption( item.id, item.name ) );
+ source.append( '<option value="' + item.id + '">' + item.name + '</option>' );
+
+ var optionComboList = optionComboMap[ item.id ];
+
+ if ( optionComboList == null )
+ {
+ optionComboList = new Array();
+
+ jQuery.each( item.optionCombos, function( i, subItem )
+ {
+ optionComboList.push( new CategoryOptionCombo( subItem.id, subItem.name ) );
+ } );
+
+ optionComboMap[ item.id ] = optionComboList;
+ }
+ } );
+
+ categoryOptionMap[ id ] = valueList;
+ }
} );
}
else
@@ -133,4 +159,11 @@
this.name = _name;
}
-var categoryLib = new CategoryLib();
\ No newline at end of file
+function CategoryOptionCombo( _id, _name )
+{
+ this.id = _id;
+ this.name = _name;
+}
+
+var categoryLib = new CategoryLib();
+var optionComboMap = new Array();
\ No newline at end of file
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonCategoryOptions.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonCategoryOptions.vm 2012-04-26 18:25:07 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/jsonCategoryOptions.vm 2012-05-11 19:42:32 +0000
@@ -5,7 +5,17 @@
{
"id": "${co.id}",
"name": "$!encoder.jsonEncode( ${co.name} )",
- "categoryId": "${co.category.id}"
+ "categoryId": "${co.category.id}",
+
+ #set( $subSize = $!co.categoryOptionCombos.size() )
+ "optionCombos": [
+ #foreach( $coc in $!co.categoryOptionCombos )
+ {
+ "id": "${coc.id}",
+ "name": "$!encoder.jsonEncode( ${coc.name} )"
+ }#if( $velocityCount < $subSize ),#end
+ #end
+ ]
}#if( $velocityCount < $size ),#end
#end
]
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/listCategoryOptionGroupOrder.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/listCategoryOptionGroupOrder.vm 2012-05-04 09:50:39 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/listCategoryOptionGroupOrder.vm 2012-05-11 19:42:32 +0000
@@ -52,7 +52,6 @@
<tr>
<td width="625px">$!encoder.htmlEncode( $group.name )</td>
<td>
- <a href="javascript:openCategoryOptionAssociations( '$group.id' );" title="$i18n.getString( 'categoryoption_associations' )"><img src="../images/assign.png" border="1px" alt="$i18n.getString( 'categoryoption_associations' )"/></a>
<a href="javascript:openUpdateCategoryOptionGroupOrder( '$group.id' );" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
<a href="javascript:openSortCategoryOptionForGroupOrder( '$group.id' );" title="$i18n.getString( 'sort_categoryoption' )"><img src="../images/sort.png" border="1px"/></a>
<a href="javascript:deleteCategoryOptionGroupOrder( '$group.id', '$group.name' );" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
=== added file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/optionComboAssociations.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/optionComboAssociations.vm 1970-01-01 00:00:00 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/optionComboAssociations.vm 2012-05-11 19:42:32 +0000
@@ -0,0 +1,120 @@
+<script type="text/javascript">
+ var validator = null;
+
+ jQuery(document).ready( function()
+ {
+ validator = validation( "optionComboAssociationsForm", function( form ) { validateOptionComboAssociations( form ); });
+
+ categoryLib.loadCategories( "categoryId" );
+ } );
+
+ var i18n_label = '$encoder.jsEscape($i18n.getString( 'select_category_option' ) , "'")';
+ var i18n_verify_category_option = '$encoder.jsEscape($i18n.getString( 'please_select_category_option' ) , "'")';
+ var i18n_verify_category_option_combo = '$encoder.jsEscape($i18n.getString( 'please_select_category_option_combo' ) , "'")';
+</script>
+
+<h3>$i18n.getString( "define_categoryoptioncombo_associations" )</h3>
+
+<form id="optionComboAssociationsForm" action="updateOptionComboAssociations.action">
+ <table>
+ <tbody>
+ <tr><th>$i18n.getString( "categories" )</th></tr>
+ <tr>
+ <td>
+ <select id="categoryId" style="width:220px" onchange="getCategoryOptions();" class="{validate:{required:true}}">
+ </select>
+ </td>
+ </tr>
+ <tr><th>$i18n.getString( "category_options" )</th></tr>
+ <tr>
+ <td>
+ <select id="categoryOptionId" style="width:220px" onchange="getOptionCombosByCategoryOption( this.value )" class="{validate:{required:true}}">
+ </select>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+ <table id="selectionTable">
+ <tr>
+ <td>
+ <select id="optionComboId" style="width:400px" size="27" onclick="getAssociationsByOptionCombo( this.value )" class="{validate:{required:true}}">
+ </select>
+ </td>
+ <td>
+ #organisationUnitSelectionTree( true, true, false )
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input type="submit" id="submitButton" value="$i18n.getString( 'save' )" style="width:10em"/>
+ <input type="button" onclick="window.location.href='openAdministrator.action'" value="$i18n.getString( 'back' )" style="width:10em"/>
+ </td>
+ </tr>
+ </table>
+
+</form>
+
+<script type="text/javascript">
+
+ function getCategoryOptions()
+ {
+ categoryLib.loadCategoryOptionsByCategory( getFieldValue( 'categoryId' ), null, 'categoryOptionId' );
+ getOptionCombosByCategoryOption( getFieldValue( "categoryOptionId" ) );
+ }
+
+ function getOptionCombosByCategoryOption( value )
+ {
+ var optionComboTarget = jQuery( "#optionComboId" );
+ optionComboTarget.empty();
+
+ if ( value && value != "" )
+ {
+ jQuery.each( optionComboMap[value], function( i, item )
+ {
+ optionComboTarget.append( '<option value="' + item.id + '">' + item.name + '</option>' );
+ } );
+ }
+ }
+
+ function getAssociationsByOptionCombo( value )
+ {
+ if ( value && value != "" )
+ {
+ jQuery.get( "showAssociationsByOptionCombo.action",
+ {
+ optionComboId: value
+ }, function( json )
+ {
+ if ( json.response == "success" ) {
+ selectionTree.buildSelectionTree();
+ }
+ } );
+ } else {
+ selectionTree.clearSelectedOrganisationUnits();
+ selectionTree.buildSelectionTree();
+ }
+ }
+
+ function validateOptionComboAssociations( _form )
+ {
+ var optionComboId = getFieldValue( "optionComboId" );
+
+ if ( optionComboId == null || optionComboId == "" )
+ {
+ markInvalid( "optionComboId", i18n_verify_category_option_combo );
+ return;
+ }
+
+ jQuery.get( _form.action,
+ {
+ optionComboId: optionComboId
+ }, function ( json ) {
+ if ( json.response == "success" ) {
+ showSuccessMessage( json.message );
+ } else {
+ showErrorMessage( json.message );
+ }
+ } );
+ }
+</script>
\ No newline at end of file
=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/viewAdministrator.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/viewAdministrator.vm 2012-05-09 05:19:35 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/viewAdministrator.vm 2012-05-11 19:42:32 +0000
@@ -4,7 +4,7 @@
#introListImgItem( "getConfiguration.action" "configuration" "systemsettings")
#introListImgItem( "listAllExportReport.action" "design_export_reports" "export")
#introListImgItem( "listAllImportReport.action" "design_import_reports" "import" )
- #introListImgItem( "openCategoryOptionAssociations.action" "define_categoryoption_associations" "dhis-web-maintenance-datadictionary")
+ #introListImgItem( "openOptionComboAssociations.action" "define_categoryoptioncombo_associations" "dhis-web-maintenance-datadictionary")
#introListImgItem( "listDataEntryStatus.action" "data_status_management" "validationcriteria")
#introListImgItem( "listAllExcelTemplates.action" "excel_template_management" "excel")
#introListImgItem( "javascript: cleanUp();" "clean_up" "clean-up")