=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/editor/DefinedAssociationEditorAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/editor/DefinedAssociationEditorAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/editor/DefinedAssociationEditorAction.java 2011-04-01 08:26:08 +0000 @@ -0,0 +1,157 @@ +package org.hisp.dhis.dataset.action.editor; + +/* + * Copyright (c) 2004-2011, 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.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; +import org.hisp.dhis.i18n.I18n; +import org.hisp.dhis.organisationunit.OrganisationUnitService; +import org.hisp.dhis.source.Source; + +import com.opensymphony.xwork2.Action; + +/** + * @author Dang Duy Hieu + * @version $Id$ + */ +public class DefinedAssociationEditorAction + implements Action +{ + private static final String SEPERATE = " - "; + + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } + + private OrganisationUnitService organisationUnitService; + + public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) + { + this.organisationUnitService = organisationUnitService; + } + + // ------------------------------------------------------------------------- + // I18n + // ------------------------------------------------------------------------- + + private I18n i18n; + + public void setI18n( I18n i18n ) + { + this.i18n = i18n; + } + + // ------------------------------------------------------------------------- + // Input + // ------------------------------------------------------------------------- + + private Integer orgUnitId; + + public void setOrgUnitId( Integer orgUnitId ) + { + this.orgUnitId = orgUnitId; + } + + private Integer dataSetId; + + public void setDataSetId( Integer dataSetId ) + { + this.dataSetId = dataSetId; + } + + private boolean assigned; + + public void setAssigned( boolean assigned ) + { + this.assigned = assigned; + } + + // ------------------------------------------------------------------------- + // Output + // ------------------------------------------------------------------------- + + public Integer getOrgUnitId() + { + return orgUnitId; + } + + public Integer getDataSetId() + { + return dataSetId; + } + + public boolean isAssigned() + { + return assigned; + } + + private String title; + + public String getTitle() + { + return title; + } + + // ------------------------------------------------------------------------- + // Action implement + // ------------------------------------------------------------------------- + + public String execute() + throws Exception + { + DataSet dataSet = dataSetService.getDataSet( dataSetId ); + Source source = organisationUnitService.getOrganisationUnit( orgUnitId ); + + title = SEPERATE + dataSet.getName() + SEPERATE + source.getName(); + + if ( assigned ) + { + dataSet.getSources().add( source ); + + title = i18n.getString( "assigned" ) + SEPERATE + title; + } + else + { + dataSet.getSources().remove( source ); + + title = i18n.getString( "unassigned" ) + SEPERATE + title; + } + + dataSetService.updateDataSet( dataSet ); + + return SUCCESS; + } + +} === removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/editor/DefinedAssociationsEditorAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/editor/DefinedAssociationsEditorAction.java 2011-03-23 04:38:39 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/editor/DefinedAssociationsEditorAction.java 1970-01-01 00:00:00 +0000 @@ -1,157 +0,0 @@ -package org.hisp.dhis.dataset.action.editor; - -/* - * Copyright (c) 2004-2011, 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.dataset.DataSet; -import org.hisp.dhis.dataset.DataSetService; -import org.hisp.dhis.i18n.I18n; -import org.hisp.dhis.organisationunit.OrganisationUnitService; -import org.hisp.dhis.source.Source; - -import com.opensymphony.xwork2.Action; - -/** - * @author Dang Duy Hieu - * @version $Id$ - */ -public class DefinedAssociationsEditorAction - implements Action -{ - private static final String SEPERATE = " - "; - - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private DataSetService dataSetService; - - public void setDataSetService( DataSetService dataSetService ) - { - this.dataSetService = dataSetService; - } - - private OrganisationUnitService organisationUnitService; - - public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) - { - this.organisationUnitService = organisationUnitService; - } - - // ------------------------------------------------------------------------- - // I18n - // ------------------------------------------------------------------------- - - private I18n i18n; - - public void setI18n( I18n i18n ) - { - this.i18n = i18n; - } - - // ------------------------------------------------------------------------- - // Input - // ------------------------------------------------------------------------- - - private Integer orgUnitId; - - public void setOrgUnitId( Integer orgUnitId ) - { - this.orgUnitId = orgUnitId; - } - - private Integer dataSetId; - - public void setDataSetId( Integer dataSetId ) - { - this.dataSetId = dataSetId; - } - - private boolean assigned; - - public void setAssigned( boolean assigned ) - { - this.assigned = assigned; - } - - // ------------------------------------------------------------------------- - // Output - // ------------------------------------------------------------------------- - - public Integer getOrgUnitId() - { - return orgUnitId; - } - - public Integer getDataSetId() - { - return dataSetId; - } - - public boolean isAssigned() - { - return assigned; - } - - private String title; - - public String getTitle() - { - return title; - } - - // ------------------------------------------------------------------------- - // Action implement - // ------------------------------------------------------------------------- - - public String execute() - throws Exception - { - DataSet dataSet = dataSetService.getDataSet( dataSetId ); - Source source = organisationUnitService.getOrganisationUnit( orgUnitId ); - - title = SEPERATE + dataSet.getName() + SEPERATE + source.getName(); - - if ( assigned ) - { - dataSet.getSources().add( source ); - - title = i18n.getString( "assigned" ) + SEPERATE + title; - } - else - { - dataSet.getSources().remove( source ); - - title = i18n.getString( "unassigned" ) + SEPERATE + title; - } - - dataSetService.updateDataSet( dataSet ); - - return SUCCESS; - } - -} === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/editor/DefinedMultiAssociationsEditorAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/editor/DefinedMultiAssociationsEditorAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/editor/DefinedMultiAssociationsEditorAction.java 2011-04-01 08:26:08 +0000 @@ -0,0 +1,195 @@ +package org.hisp.dhis.dataset.action.editor; + +/* + * Copyright (c) 2004-2011, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hisp.dhis.databrowser.MetaValue; +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; +import org.hisp.dhis.i18n.I18n; +import org.hisp.dhis.organisationunit.OrganisationUnitService; +import org.hisp.dhis.source.Source; + +import com.opensymphony.xwork2.Action; + +/** + * @author Dang Duy Hieu + * @version $Id$ + */ +public class DefinedMultiAssociationsEditorAction + implements Action +{ + private static final String SEPERATE = " - "; + + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } + + private OrganisationUnitService organisationUnitService; + + public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) + { + this.organisationUnitService = organisationUnitService; + } + + // ------------------------------------------------------------------------- + // I18n + // ------------------------------------------------------------------------- + + private I18n i18n; + + public void setI18n( I18n i18n ) + { + this.i18n = i18n; + } + + // ------------------------------------------------------------------------- + // Parameters + // ------------------------------------------------------------------------- + + private Integer orgUnitId; + + private Integer[] dataSetIds; + + private Boolean[] statuses; + + private boolean checked; + + private Source source; + + private List metaItems = new ArrayList(); + + private Map itemMaps = new HashMap(); + + // ------------------------------------------------------------------------- + // Input + // ------------------------------------------------------------------------- + + public void setOrgUnitId( Integer orgUnitId ) + { + this.orgUnitId = orgUnitId; + } + + public void setDataSetIds( Integer[] dataSetIds ) + { + this.dataSetIds = dataSetIds; + } + + public void setStatuses( Boolean[] statuses ) + { + this.statuses = statuses; + } + + public boolean isChecked() + { + return checked; + } + + public void setChecked( boolean checked ) + { + this.checked = checked; + } + + public List getMetaItems() + { + return metaItems; + } + + // ------------------------------------------------------------------------- + // Output + // ------------------------------------------------------------------------- + + public Map getItemMaps() + { + return itemMaps; + } + + public Source getSource() + { + return source; + } + + // ------------------------------------------------------------------------- + // Action implement + // ------------------------------------------------------------------------- + + public String execute() + throws Exception + { + String title = ""; + + if ( checked ) + { + title = i18n.getString( "assigned" ) + SEPERATE; + } + else + { + title = i18n.getString( "unassigned" ) + SEPERATE; + } + + if ( dataSetIds.length == statuses.length ) + { + source = organisationUnitService.getOrganisationUnit( orgUnitId ); + + for ( int i = 0; i < dataSetIds.length; i++ ) + { + DataSet dataSet = dataSetService.getDataSet( dataSetIds[i] ); + + itemMaps.put( i, title + dataSet.getName() + SEPERATE + source.getName() ); + + metaItems.add( new MetaValue( orgUnitId, dataSet.getId() + "", String.valueOf( checked ) ) ); + + if ( (checked && !statuses[i]) ) + { + dataSet.getSources().add( source ); + + dataSetService.updateDataSet( dataSet ); + } + else if ( (!checked && statuses[i]) ) + { + dataSet.getSources().remove( source ); + + dataSetService.updateDataSet( dataSet ); + } + } + } + + return SUCCESS; + } +} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml 2011-03-21 14:30:16 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml 2011-04-01 08:26:08 +0000 @@ -429,8 +429,19 @@ - + + + + + + + + + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml 2011-03-21 14:30:16 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml 2011-04-01 08:26:08 +0000 @@ -320,10 +320,15 @@ /dhis-web-maintenance-dataset/htmlGrid.vm - + /dhis-web-maintenance-dataset/loadIcon.vm + + /dhis-web-maintenance-dataset/loadIcons.vm + + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/htmlGrid.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/htmlGrid.vm 2011-03-30 05:05:04 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/htmlGrid.vm 2011-04-01 08:26:08 +0000 @@ -27,7 +27,7 @@ #foreach( $meta in $!MetaValues ) #set( $list = $!MetaValueMaps.get( $meta.id ) ) - + $meta #foreach( $item in $list ) @@ -58,5 +58,5 @@ arrayIds.push( '$encoder.jsEscape( $id, "'" )' ); #end } - + \ No newline at end of file === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/loadIcons.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/loadIcons.vm 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/loadIcons.vm 2011-04-01 08:26:08 +0000 @@ -0,0 +1,11 @@ + +$source.name +#foreach( $item in $metaItems ) +#set( $index = $velocityCount - 1 ) + +
+ + +
+ +#end \ No newline at end of file