=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datadictionary/DataDictionaryService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datadictionary/DataDictionaryService.java 2011-06-02 03:22:21 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datadictionary/DataDictionaryService.java 2011-06-02 08:44:31 +0000 @@ -30,7 +30,6 @@ import java.util.Collection; import org.hisp.dhis.dataelement.DataElement; -import org.hisp.dhis.indicator.Indicator; /** * @author Lars Helge Overland @@ -98,12 +97,6 @@ */ Collection getDataElementsByDictionaryId( int dictionaryId ); - Collection getDataElementsByDictionaryId( String key, int dictionaryId ); - - Collection getIndicatorsByDictionaryId( int dictionaryId ); - - Collection getIndicatorsByDictionaryId( String key, int dictionaryId ); - Collection getDataDictionarysBetween( int first, int max ); Collection getDataDictionarysBetweenByName( String name, int first, int max ); === removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datadictionary/DataDictionaryStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datadictionary/DataDictionaryStore.java 2011-06-02 03:22:21 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datadictionary/DataDictionaryStore.java 1970-01-01 00:00:00 +0000 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2004-2009, 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.datadictionary; - -import java.util.Collection; - -import org.hisp.dhis.common.GenericIdentifiableObjectStore; -import org.hisp.dhis.dataelement.DataElement; -import org.hisp.dhis.indicator.Indicator; - -/** - * @author Chau Thu Tran - * @version $ DataDictionaryStore.java Jun 1, 2011 2:23:14 PM $ - * - */ -public interface DataDictionaryStore - extends GenericIdentifiableObjectStore -{ - Collection getDataElements( String key, int dictionaryId ); - - Collection getIndicators( String key, int dictionaryId ); -} === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datadictionary/DefaultDataDictionaryService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datadictionary/DefaultDataDictionaryService.java 2011-06-02 03:22:21 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datadictionary/DefaultDataDictionaryService.java 2011-06-02 08:44:31 +0000 @@ -31,9 +31,9 @@ import java.util.Collection; +import org.hisp.dhis.common.GenericIdentifiableObjectStore; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.i18n.I18nService; -import org.hisp.dhis.indicator.Indicator; import org.hisp.dhis.system.util.Filter; import org.hisp.dhis.system.util.FilterUtils; import org.springframework.transaction.annotation.Transactional; @@ -50,9 +50,9 @@ // Dependencies // ------------------------------------------------------------------------- - private DataDictionaryStore dataDictionaryStore; + private GenericIdentifiableObjectStore dataDictionaryStore; - public void setDataDictionaryStore( DataDictionaryStore dataDictionaryStore ) + public void setDataDictionaryStore( GenericIdentifiableObjectStore dataDictionaryStore ) { this.dataDictionaryStore = dataDictionaryStore; } @@ -111,21 +111,6 @@ return i18n( i18nService, dataDictionaryStore.get( dictionaryId ).getDataElements() ); } - public Collection getDataElementsByDictionaryId( String key, int dictionaryId ) - { - return i18n( i18nService, dataDictionaryStore.getDataElements( key, dictionaryId ) ); - } - - public Collection getIndicatorsByDictionaryId( int dictionaryId ) - { - return i18n( i18nService, dataDictionaryStore.get( dictionaryId ).getIndicators() ); - } - - public Collection getIndicatorsByDictionaryId( String key, int dictionaryId ) - { - return i18n( i18nService, dataDictionaryStore.getIndicators( key, dictionaryId ) ); - } - public int getDataDictionaryCount() { return dataDictionaryStore.getCount(); === removed directory 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datadictionary/hibernate' === removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datadictionary/hibernate/HibernateDataDictionaryStore.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datadictionary/hibernate/HibernateDataDictionaryStore.java 2011-06-02 03:22:21 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datadictionary/hibernate/HibernateDataDictionaryStore.java 1970-01-01 00:00:00 +0000 @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2004-2009, 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.datadictionary.hibernate; - -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.hibernate.criterion.Order; -import org.hibernate.criterion.Restrictions; -import org.hibernate.transform.Transformers; -import org.hisp.dhis.datadictionary.DataDictionary; -import org.hisp.dhis.datadictionary.DataDictionaryStore; -import org.hisp.dhis.dataelement.DataElement; -import org.hisp.dhis.hibernate.HibernateGenericStore; -import org.hisp.dhis.indicator.Indicator; - -/** - * @author Chau Thu Tran - * @version $ HibernateDataDictionaryStore.java Jun 1, 2011 2:24:46 PM $ - * - */ -public class HibernateDataDictionaryStore - extends HibernateGenericStore - implements DataDictionaryStore -{ - - @SuppressWarnings( "unchecked" ) - public Collection getDataElements( String key, int dictionaryId ) - { - List results = getCriteria().createAlias( "dataElements", "dataElement" ).add( - Restrictions.ilike( "dataElement.name", "%" + key + "%" ) ).add( Restrictions.eq( "id", dictionaryId ) ) - .addOrder( Order.asc( "dataElement.name" ) ).setResultTransformer( Transformers.ALIAS_TO_ENTITY_MAP ) - .list(); - - Set dataElements = new HashSet(); - for ( Map map : results ) - { - dataElements.add( (DataElement) map.get( "dataElement" ) ); - } - - return dataElements; - } - - @SuppressWarnings( "unchecked" ) - public Collection getIndicators( String key, int dictionaryId ) - { - List results = getCriteria().createAlias( "indicators", "indicator" ).add( - Restrictions.ilike( "indicator.name", "%" + key + "%" ) ).add( Restrictions.eq( "id", dictionaryId ) ) - .addOrder( Order.asc( "indicator.name" ) ).setResultTransformer( Transformers.ALIAS_TO_ENTITY_MAP ).list(); - - Set indicators = new HashSet(); - for ( Map map : results ) - { - indicators.add( (Indicator) map.get( "indicator" ) ); - } - - return indicators; - } - -} === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2011-06-02 03:22:21 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2011-06-02 08:44:31 +0000 @@ -42,7 +42,7 @@ - + === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2011-06-02 03:07:52 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2011-06-02 08:44:31 +0000 @@ -302,7 +302,7 @@ { var key = event.keyCode || event.charCode || event.which; - var focusField = ( key == 13 || key == 40 ) ? getNextEntryField( field ) : ( ( key == 38 ) ? getPreviousEntryField( field ) : false ); + var focusField = ( key == 13 || key == 40 ) ? getNextEntryField( field ) : ( key == 38 ) ? getPreviousEntryField( field ) : false; if ( focusField ) { @@ -314,39 +314,32 @@ function getNextEntryField( field ) { - if ( field ) - { - var index = field.getAttribute( 'tabindex' ); - field = $('input[tabindex="'+(++index)+'"]'); - - while ( field ) - { - if ( field.is(':disabled') || field.is(':hidden') ) - { - field = $('input[tabindex="'+(++index)+'"]'); - } - else return field; - } - } + var fields = $('input[name="entryfield"]'); + + var index = field.tabIndex; + + while (fields[index]) { + if (!fields[index].disabled) { + return fields[index]; + } + index++; + } } function getPreviousEntryField( field ) { - if ( field ) - { - var index = field.getAttribute( 'tabindex' ); - field = $('input[tabindex="'+(--index)+'"]'); - - while ( field ) - { - if ( field.is(':disabled') || field.is(':hidden') ) - { - field = $('input[tabindex="'+(--index)+'"]'); - } - else return field; - } - } + var fields = $('input[name="entryfield"]'); + + var index = field.tabIndex - 2; + + while (fields[index]) { + if (!fields[index].disabled) { + return fields[index]; + } + index--; + } } + // ----------------------------------------------------------------------------- // Data completeness // ----------------------------------------------------------------------------- === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListAction.java 2011-06-02 03:22:21 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/GetDataElementListAction.java 2011-06-02 08:44:31 +0000 @@ -138,7 +138,7 @@ } private String key; - + public String getKey() { return key; @@ -165,8 +165,7 @@ dataDictionaryId = null; } - else - // Specified, set current data dictionary + else // Specified, set current data dictionary { dataDictionaryModeManager.setCurrentDataDictionary( dataDictionaryId ); } @@ -181,41 +180,23 @@ if ( isNotBlank( key ) ) // Filter on key only if set { - if ( dataDictionaryId == null ) - { - this.paging = createPaging( dataElementService.getDataElementCountByName( key ) ); - - dataElements = new ArrayList( dataElementService.getDataElementsBetweenByName( key, paging - .getStartPos(), paging.getPageSize() ) ); - } - else - { - dataElements = new ArrayList( dataDictionaryService.getDataElementsByDictionaryId( key, - dataDictionaryId ) ); - - this.paging = createPaging( dataElements.size() ); - - if ( dataElements.size() > 0 ) - { - dataElements = getBlockElement( dataElements, paging.getStartPos(), paging.getEndPos() ); - } - } + this.paging = createPaging( dataElementService.getDataElementCountByName( key ) ); + + dataElements = new ArrayList( dataElementService.getDataElementsBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) ); } else if ( dataDictionaryId != null ) { - dataElements = new ArrayList( dataDictionaryService - .getDataElementsByDictionaryId( dataDictionaryId ) ); - + dataElements = new ArrayList( dataDictionaryService.getDataElementsByDictionaryId( dataDictionaryId ) ); + this.paging = createPaging( dataElements.size() ); - - dataElements = getBlockElement( dataElements, paging.getStartPos(), paging.getEndPos() ); + + dataElements = getBlockElement( dataElements, paging.getStartPos(), paging.getPageSize() ); } else { this.paging = createPaging( dataElementService.getDataElementCount() ); - - dataElements = new ArrayList( dataElementService.getDataElementsBetween( paging.getStartPos(), - paging.getPageSize() ) ); + + dataElements = new ArrayList( dataElementService.getDataElementsBetween( paging.getStartPos(), paging.getPageSize() ) ); } Collections.sort( dataElements, dataElementComparator ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/GetIndicatorListAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/GetIndicatorListAction.java 2011-06-02 03:22:21 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/GetIndicatorListAction.java 2011-06-02 08:44:31 +0000 @@ -138,7 +138,7 @@ } private String key; - + public String getKey() { return key; @@ -162,15 +162,14 @@ else if ( dataDictionaryId == -1 ) // All, reset current data dictionary { dataDictionaryModeManager.setCurrentDataDictionary( null ); - + dataDictionaryId = null; } - else - // Specified, set current data dictionary + else // Specified, set current data dictionary { dataDictionaryModeManager.setCurrentDataDictionary( dataDictionaryId ); } - + dataDictionaries = new ArrayList( dataDictionaryService.getAllDataDictionaries() ); Collections.sort( dataDictionaries, new DataDictionaryNameComparator() ); @@ -181,45 +180,25 @@ if ( isNotBlank( key ) ) // Filter on key only if set { - if ( dataDictionaryId == null ) - { - this.paging = createPaging( indicatorService.getIndicatorCountByName( key ) ); - - indicators = new ArrayList( indicatorService.getIndicatorsBetweenByName( key, paging - .getStartPos(), paging.getPageSize() ) ); - } - else - { - indicators = new ArrayList( dataDictionaryService.getIndicatorsByDictionaryId( key, - dataDictionaryId ) ); - - this.paging = createPaging( indicators.size() ); - - if( indicators.size() > 0 ) - { - indicators = getBlockElement( indicators, paging.getStartPos() , paging.getEndPos() ); - } - } + this.paging = createPaging( indicatorService.getIndicatorCountByName( key ) ); + + indicators = new ArrayList( indicatorService.getIndicatorsBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) ); } else if ( dataDictionaryId != null ) { - indicators = new ArrayList( dataDictionaryService.getIndicatorsByDictionaryId( dataDictionaryId ) ); - + indicators = new ArrayList( dataDictionaryService.getDataDictionary( dataDictionaryId ).getIndicators() ); + this.paging = createPaging( indicators.size() ); - - if ( indicators.size() > 0 ) - { - indicators = getBlockElement( indicators, paging.getStartPos() , paging.getEndPos() ); - } + + indicators = getBlockElement( indicators, paging.getStartPage(), paging.getEndPos() ); } else { this.paging = createPaging( indicatorService.getIndicatorCount() ); - - indicators = new ArrayList( indicatorService.getIndicatorsBetween( paging.getStartPos(), paging - .getPageSize() ) ); + + indicators = new ArrayList( indicatorService.getIndicatorsBetween( paging.getStartPos(), paging.getPageSize() ) ); } - + Collections.sort( indicators, indicatorComparator ); displayPropertyHandler.handle( indicators );