=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2009-10-15 17:28:51 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java 2009-12-24 10:42:32 +0000 @@ -65,7 +65,7 @@ /** * Property indicating whether the DataSet is locked for data entry. */ - private transient Boolean locked = false; + private Boolean locked = false; /** * All locked periods within the DataSet. === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java 2009-12-11 11:28:57 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java 2009-12-24 10:42:32 +0000 @@ -36,6 +36,7 @@ import java.util.Set; import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.datalock.DataSetLock; import org.hisp.dhis.i18n.I18nService; import org.hisp.dhis.period.PeriodType; import org.hisp.dhis.source.Source; @@ -254,9 +255,9 @@ for ( DataSet dataSet : dataSetListByPeriodType ) { - DataEntryForm dataEntryForm = dataEntryFormService.getDataEntryFormByDataSet( dataSet ); + // DataEntryForm dataEntryForm = dataEntryFormService.getDataEntryFormByDataSet( dataSet ); - if ( dataEntryForm != null ) + if ( dataSet.getSources() != null ) { assignedDataSetListByPeriodType.add( dataSet ); } @@ -264,7 +265,7 @@ return assignedDataSetListByPeriodType; } - + public Collection getDistinctDataElements( Collection dataSetIdentifiers ) { Collection dataSets = getDataSets( dataSetIdentifiers ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml' --- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml 2009-08-31 15:37:16 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml 2009-12-24 10:42:32 +0000 @@ -36,6 +36,8 @@ class="org.hisp.dhis.period.Period"/> + + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/DefineLockOnDataSetOrgunitAndPeriod.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/DefineLockOnDataSetOrgunitAndPeriod.java 2009-09-21 02:17:30 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/DefineLockOnDataSetOrgunitAndPeriod.java 2009-12-24 10:42:32 +0000 @@ -160,34 +160,32 @@ // Action implementation // ------------------------------------------------------------------------- - public String execute() - throws Exception - { + public String execute() throws Exception{ + Period period = new Period(); - if( periodId != null ) - { + if( periodId != null ){ + period = periodService.getPeriod( periodId.intValue() ); } - else - { + + else{ return SUCCESS; } - - storedBy = currentUserService.getCurrentUsername(); + + period = periodService.getPeriod( periodId.intValue() ); + storedBy = currentUserService.getCurrentUsername(); // ------------------------------------------------------------------------------- // For data set movement from locked to unlocked data set list box and // vice versa according to lock status // ------------------------------------------------------------------------------- - for ( String id : unlockedDataSets ) - { + for ( String id : unlockedDataSets ){ DataSet dataSet = dataSetService.getDataSet( Integer.parseInt( id ) ); DataSetLock dataSetLock = dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period ); - if ( dataSetLock != null ) - { + if ( dataSetLock != null ){ dataSet.setLocked( false ); dataSetService.updateDataSet( dataSet ); dataSetLock.getSources().removeAll( dataSetLock.getSources() ); @@ -200,15 +198,13 @@ // organization unit ( or units ) // ---------------------------------------------------------------------------------------- - if ( lockedDataSets != null ) - { + if ( lockedDataSets != null ){ DataSet dataSet = dataSetService.getDataSet( lockedDataSets.intValue() ); Set organisationUnitsSelectedForLocking = new HashSet( selectionTreeManager .getLockOnSelectedOrganisationUnits() ); DataSetLock dataSetLock = dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period ); - if ( organisationUnitsSelectedForLocking.size() < 1 ) - { + if ( organisationUnitsSelectedForLocking.size() < 1 ){ dataSet.setLocked( false ); dataSetService.updateDataSet( dataSet ); dataSetLock.getSources().removeAll( dataSetLock.getSources() ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetDataSetsForLockAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetDataSetsForLockAction.java 2009-10-24 10:59:17 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetDataSetsForLockAction.java 2009-12-24 10:42:32 +0000 @@ -92,40 +92,35 @@ // Action implementation // ------------------------------------------------------------------------- - public String execute() - { - if ( periodId != null ) - { + public String execute(){ + + if ( periodId != null ){ + Period period = new Period(); period = periodService.getPeriod( periodId.intValue() ); - - for ( DataSet dataSet : dataSetService.getAssignedDataSetsByPeriodType( period.getPeriodType() ) ) - { - if ( dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period ) != null ) - { - if( dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period ).getSources() != null ) - { + + for ( DataSet dataSet : dataSetService.getAssignedDataSetsByPeriodType( period.getPeriodType() ) ){ + if ( dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period ) != null ){ + if( dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period ).getSources() != null ){ dataSet.setLocked( true ); dataSetService.updateDataSet( dataSet ); dataSets.add( dataSet ); } - else - { + else{ dataSetLockService.deleteDataSetLock( dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period ) ); dataSet.setLocked( false ); dataSetService.updateDataSet( dataSet ); dataSets.add( dataSet ); } } - else - { + else{ dataSet.setLocked( false ); dataSetService.updateDataSet( dataSet ); dataSets.add( dataSet ); + System.out.println("unlocked data sets in outer loop :" + dataSets.toString()); } - } + } } - return SUCCESS; } -} \ No newline at end of file +} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetExpandedTreeForLockAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetExpandedTreeForLockAction.java 2009-09-23 00:55:01 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetExpandedTreeForLockAction.java 2009-12-24 10:42:32 +0000 @@ -123,10 +123,10 @@ locked = selectionTreeManager.getLockOnSelectedOrganisationUnits(); Collection pathNodes = findPathNodes( roots, selected ); - - @SuppressWarnings("unused") + + @SuppressWarnings("unused") Collection pathNodesL = findPathNodes( roots, locked ); - + // --------------------------------------------------------------------- // Get the children of the roots // --------------------------------------------------------------------- === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetPeriodsForLockAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetPeriodsForLockAction.java 2009-09-28 22:49:28 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetPeriodsForLockAction.java 2009-12-24 10:42:32 +0000 @@ -1,6 +1,30 @@ -/** - * +/* + * Copyright (c) 2004-2007, 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. */ + package org.hisp.dhis.dataadmin.action.lock; import java.util.ArrayList; @@ -18,8 +42,8 @@ import com.opensymphony.xwork2.Action; /** - * @author scott - * + * @author Brajesh Murari + * @version $Id$ */ public class GetPeriodsForLockAction implements Action { === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/LockSelectedOrganisationUnitAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/LockSelectedOrganisationUnitAction.java 2009-09-28 22:49:28 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/LockSelectedOrganisationUnitAction.java 2009-12-24 10:42:32 +0000 @@ -27,6 +27,7 @@ package org.hisp.dhis.dataadmin.action.lock; import java.util.Collection; +import java.util.HashSet; import java.util.Set; import org.apache.commons.logging.Log; @@ -106,4 +107,4 @@ return SUCCESS; } -} \ No newline at end of file +} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/SelectAllAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/SelectAllAction.java 2009-09-28 22:49:28 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/SelectAllAction.java 2009-12-24 10:42:32 +0000 @@ -36,7 +36,7 @@ */ public class SelectAllAction implements Action - { +{ // ------------------------------------------------------------------------- // Dependencies // ------------------------------------------------------------------------- @@ -45,22 +45,22 @@ public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager ) { - this.selectionTreeManager = selectionTreeManager; + this.selectionTreeManager = selectionTreeManager; } - + public SelectionTreeManager getSelectionTreeManager( ) { - return selectionTreeManager; + return selectionTreeManager; } - + // ------------------------------------------------------------------------- // Action // ------------------------------------------------------------------------- public String execute() throws Exception { - - selectionTreeManager.setLockOnSelectedOrganisationUnits( selectionTreeManager.getSelectedOrganisationUnits() ); - - return SUCCESS; - } - } \ No newline at end of file + + selectionTreeManager.setLockOnSelectedOrganisationUnits( selectionTreeManager.getSelectedOrganisationUnits() ); + + return SUCCESS; + } +} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2009-10-10 14:26:24 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2009-12-24 10:42:32 +0000 @@ -4,7 +4,7 @@ xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> - + - - === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2009-11-02 21:31:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2009-12-24 10:42:32 +0000 @@ -16,7 +16,7 @@ - /dhis-web-maintenance-dataadmin/noResponseInFrame.vm @@ -40,7 +40,7 @@ - /dhis-web-maintenance-dataadmin/responseDataSet.vm + /dhis-web-maintenance-dataadmin/responseDataSet.vm plainTextError @@ -98,7 +98,7 @@ plainTextError - /dhis-web-maintenance-dataadmin/responseSelect.vm plainTextError @@ -123,10 +123,10 @@ - /dhis-web-maintenance-dataadmin/responsePeriod.vm + /dhis-web-commons/ajax/responsePeriod.vm plainTextError - + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/associations.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/associations.js 2009-09-28 22:49:28 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/associations.js 2009-12-24 10:42:32 +0000 @@ -32,13 +32,7 @@ else{ numberOfSelects++; setMessage( i18n_loading ); - - //parent.document.getElementById( "button5" ).disabled = true; - //parent.document.getElementById( "button6" ).disabled = true; - //parent.document.getElementById( "button7" ).disabled = true; - //parent.document.getElementById( "button8" ).disabled = true; parent.document.getElementById( "submitButton" ).disabled = true; - //parent.document.getElementById( "levelList" ).disabled = true; } } @@ -49,13 +43,7 @@ if ( numberOfSelects <= 0 ) { hideMessage(); - - //parent.document.getElementById( "button5" ).disabled = false; - //parent.document.getElementById( "button6" ).disabled = false; - //parent.document.getElementById( "button7" ).disabled = false; - //parent.document.getElementById( "button8" ).disabled = false; + parent.document.getElementById( "submitButton" ).disabled = false; - //parent.document.getElementById( "levelList" ).disabled = false; } } - === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/locking.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/locking.js 2009-10-01 08:05:41 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/locking.js 2009-12-24 10:42:32 +0000 @@ -72,15 +72,16 @@ } function loadEmptyOrgUnitTree(){ - desableLockComponents(); - enableParent( "periodTypeId" ); - enableParent( "periodId" ); - enableParent( "unlockedDataSets" ); - enableParent( "lockedDataSets" ); - enableParent( "button1" ); + desableLockComponents(); + enableParent( "periodTypeId" ); + enableParent( "periodId" ); + enableParent( "unlockedDataSets" ); + enableParent( "lockedDataSets" ); + enableParent( "button1" ); enableParent( "button2" ); enableParent( "button3" ); - enableParent( "button4" ); + enableParent( "button4" ); + iframeForOUTree.location.href='emptyOrgunitSetupAssociationsTree.action'; } @@ -100,17 +101,17 @@ enableParent( "periodId" ); enableParent( "unlockedDataSets" ); enableParent( "lockedDataSets" ); - enableParent( "button1" ); - enableParent( "button2" ); - enableParent( "button3" ); + enableParent( "button1" ); + enableParent( "button2" ); + enableParent( "button3" ); enableParent( "button4" ); enableParent( "button5" ); - enableParent( "button6" ); - enableParent( "button7" ); - enableParent( "button8" ); - enableParent( "button9" ); - enableParent( "levelList" ); - enableParent( "submitButton" ); + enableParent( "button6" ); + enableParent( "button7" ); + enableParent( "button8" ); + enableParent( "button9" ); + enableParent( "levelList" ); + enableParent( "submitButton" ); } function desableLockComponents(){ === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/lockingForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/lockingForm.vm 2009-09-22 22:20:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/lockingForm.vm 2009-12-24 10:42:32 +0000 @@ -81,7 +81,6 @@ - +