=== modified file 'dhis-2/dhis-web/dhis-web-light/pom.xml' --- dhis-2/dhis-web/dhis-web-light/pom.xml 2011-12-26 09:25:32 +0000 +++ dhis-2/dhis-web/dhis-web-light/pom.xml 2012-01-16 18:30:37 +0000 @@ -44,6 +44,10 @@ org.hisp.dhis + dhis-service-administration + + + org.hisp.dhis dhis-service-mobile === modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetPeriodsAction.java' --- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetPeriodsAction.java 2012-01-04 12:55:23 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetPeriodsAction.java 2012-01-16 18:30:37 +0000 @@ -26,14 +26,10 @@ */ package org.hisp.dhis.light.dataentry.action; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - +import com.opensymphony.xwork2.Action; import org.apache.commons.lang.Validate; +import org.hisp.dhis.datalock.DataSetLock; +import org.hisp.dhis.datalock.DataSetLockService; import org.hisp.dhis.dataset.CompleteDataSetRegistration; import org.hisp.dhis.dataset.CompleteDataSetRegistrationService; import org.hisp.dhis.dataset.DataSet; @@ -46,7 +42,7 @@ import org.hisp.dhis.system.filter.PastAndCurrentPeriodFilter; import org.hisp.dhis.system.util.FilterUtils; -import com.opensymphony.xwork2.Action; +import java.util.*; /** * @author mortenoh @@ -74,6 +70,13 @@ this.dataSetService = dataSetService; } + private DataSetLockService dataSetLockService; + + public void setDataSetLockService( DataSetLockService dataSetLockService ) + { + this.dataSetLockService = dataSetLockService; + } + private CompleteDataSetRegistrationService registrationService; public void setRegistrationService( CompleteDataSetRegistrationService registrationService ) @@ -142,6 +145,13 @@ return periods; } + private List lockedPeriods = new ArrayList(); + + public List getLockedPeriods() + { + return lockedPeriods; + } + private Boolean complete = false; public void setComplete( Boolean complete ) @@ -190,6 +200,8 @@ periods = periods.subList( 0, MAX_PERIODS ); } + markLockedDataSets( organisationUnit, dataSet, periods ); + for ( Period period : periods ) { period.setName( format.formatPeriod( period ) ); @@ -202,4 +214,30 @@ return SUCCESS; } + + private void markLockedDataSets( OrganisationUnit organisationUnit, DataSet dataSet, List periods ) + { + for ( Period period : periods ) + { + boolean locked = dataSetLocked( organisationUnit, dataSet, period ); + + if ( locked ) + { + lockedPeriods.add( period ); + } + } + } + + private boolean dataSetLocked( OrganisationUnit organisationUnit, DataSet dataSet, Period period ) + { + // HACK workaround since get dataSetLock by unit/dataSet/period fails + DataSetLock dataSetLock = dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period ); + + if ( dataSetLock != null && dataSetLock.getSources().contains( organisationUnit ) ) + { + return true; + } + + return false; + } } === modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java' --- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java 2012-01-12 09:16:32 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java 2012-01-16 18:30:37 +0000 @@ -37,6 +37,8 @@ import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; import org.hisp.dhis.dataelement.DataElementCategoryService; import org.hisp.dhis.dataelement.DataElementService; +import org.hisp.dhis.datalock.DataSetLock; +import org.hisp.dhis.datalock.DataSetLockService; import org.hisp.dhis.dataset.*; import org.hisp.dhis.datavalue.DataValue; import org.hisp.dhis.datavalue.DataValueService; @@ -105,6 +107,13 @@ this.dataSetService = dataSetService; } + private DataSetLockService dataSetLockService; + + public void setDataSetLockService( DataSetLockService dataSetLockService ) + { + this.dataSetLockService = dataSetLockService; + } + private CompleteDataSetRegistrationService registrationService; public void setRegistrationService( CompleteDataSetRegistrationService registrationService ) @@ -275,6 +284,9 @@ dataSet = dataSetService.getDataSet( dataSetId ); + // this should never happen, but validate that that dataset is not locked + Validate.isTrue( !dataSetLocked( organisationUnit, dataSet, period ) ); + String storedBy = currentUserService.getCurrentUsername(); if ( StringUtils.isBlank( storedBy ) ) @@ -463,4 +475,17 @@ return SUCCESS; } + + private boolean dataSetLocked( OrganisationUnit organisationUnit, DataSet dataSet, Period period ) + { + // HACK workaround since get dataSetLock by unit/dataSet/period fails + DataSetLock dataSetLock = dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period ); + + if ( dataSetLock != null && dataSetLock.getSources().contains( organisationUnit ) ) + { + return true; + } + + return false; + } } === modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2012-01-12 08:43:22 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2012-01-16 18:30:37 +0000 @@ -38,6 +38,7 @@ scope="prototype"> + @@ -70,6 +71,7 @@ + === modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties 2012-01-13 10:16:31 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties 2012-01-16 18:30:37 +0000 @@ -44,3 +44,4 @@ reply=Reply write_feedback=Write feedback form_complete=Form complete +successfully_saved_section=Successfully Saved === modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntryOverview.vm' --- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntryOverview.vm 2012-01-13 10:16:31 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/dataEntryOverview.vm 2012-01-16 18:30:37 +0000 @@ -32,6 +32,7 @@ #end *# +#if( $complete != true)

    #if( $dataSet.sections.size() > 0 ) @@ -45,6 +46,9 @@ #end

+#else +
+#end
=== removed file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/images/check.jpg' Binary files dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/images/check.jpg 2011-10-14 07:44:17 +0000 and dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/images/check.jpg 1970-01-01 00:00:00 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/images/checkmark.jpg' Binary files dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/images/checkmark.jpg 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/images/checkmark.jpg 2012-01-16 18:30:37 +0000 differ === added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/images/lock.jpg' Binary files dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/images/lock.jpg 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/images/lock.jpg 2012-01-16 18:30:37 +0000 differ === modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectPeriod.vm' --- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectPeriod.vm 2011-11-01 18:28:36 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/selectPeriod.vm 2012-01-16 18:30:37 +0000 @@ -1,25 +1,18 @@

$i18n.getString( "available_periods" )

-#if( $validated ) -
-

Successfully Saved

-

- #if( $complete ) - DataSet $dataSet.name was saved and completed
- #else - DataSet $dataSet.name was saved
- #end -

-
-#end -

    #foreach( $period in $periods )
  • - $!encoder.htmlEncode( ${period.name} ) - #if( $periodCompletedMap.get($period) )#end + #if( ! $lockedPeriods.contains( $period ) && ! $periodCompletedMap.get($period) ) + $!encoder.htmlEncode( ${period.name} ) + #else + $!encoder.htmlEncode( ${period.name} ) + #end + + #if( $periodCompletedMap.get($period) )#end + #if( $lockedPeriods.contains( $period ) )#end
  • #end