=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetPeriodsAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetPeriodsAction.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lockexception/GetPeriodsAction.java 1970-01-01 00:00:00 +0000 @@ -1,123 +0,0 @@ -package org.hisp.dhis.dataadmin.action.lockexception; - -/* - * Copyright (c) 2004-2014, 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.Collections; -import java.util.Date; -import java.util.List; - -import org.hisp.dhis.dataset.DataSet; -import org.hisp.dhis.dataset.DataSetService; -import org.hisp.dhis.i18n.I18nFormat; -import org.hisp.dhis.period.CalendarPeriodType; -import org.hisp.dhis.period.Period; -import org.hisp.dhis.period.PeriodType; -import org.hisp.dhis.system.filter.PastAndCurrentPeriodFilter; -import org.hisp.dhis.system.util.FilterUtils; - -import com.opensymphony.xwork2.Action; - -/** - * @author Morten Olav Hansen - */ -public class GetPeriodsAction - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private DataSetService dataSetService; - - public void setDataSetService( DataSetService dataSetService ) - { - this.dataSetService = dataSetService; - } - - private I18nFormat format; - - public void setFormat( I18nFormat format ) - { - this.format = format; - } - - // ------------------------------------------------------------------------- - // Input & Output - // ------------------------------------------------------------------------- - - private int id; - - public void setId( int id ) - { - this.id = id; - } - - private List periods; - - public List getPeriods() - { - return periods; - } - - // ------------------------------------------------------------------------- - // Action Implementation - // ------------------------------------------------------------------------- - - @Override - public String execute() throws Exception - { - periods = getPeriodsForDataSet( id ); - - for ( Period period : periods ) - { - period.setName( format.formatPeriod( period ) ); - } - - return SUCCESS; - } - - private List getPeriodsForDataSet( int id ) - { - DataSet dataSet = dataSetService.getDataSet( id ); - - if ( dataSet == null || dataSet.getPeriodType() == null ) - { - return new ArrayList(); - } - - CalendarPeriodType periodType = (CalendarPeriodType) PeriodType.getPeriodTypeByName( dataSet.getPeriodType().getName() ); - - List periods = periodType.generateLast5Years( new Date() ); - FilterUtils.filter( periods, new PastAndCurrentPeriodFilter() ); - Collections.reverse( periods ); - - return periods; - } -} === 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 2014-07-29 07:52:47 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2014-07-31 14:17:58 +0000 @@ -272,12 +272,6 @@ - - - - === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2014-07-29 07:52:47 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2014-07-31 14:17:58 +0000 @@ -359,4 +359,6 @@ add_option = Add option edit_option = Edit option sort_options = Sort options -available_options = Available options \ No newline at end of file +available_options = Available options +please_select_a_dataset = Please select a dataset +please_select_an_organisation_unit = Please select an organisation unit \ No newline at end of file === 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 2014-07-29 07:52:47 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2014-07-31 14:17:58 +0000 @@ -460,7 +460,8 @@ /main.vm /dhis-web-maintenance-dataadmin/menu.vm - /dhis-web-maintenance-dataadmin/addLockExceptionForm.vm + /dhis-web-maintenance-dataadmin/addLockExceptionForm.vm + javascript/dataArchive.js F_DATASET_PUBLIC_ADD, F_DATASET_PRIVATE_ADD @@ -475,11 +476,6 @@ plainTextError - - jsonPeriods.vm - plainTextError - - jsonLockException.vm plainTextError === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addLockExceptionForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addLockExceptionForm.vm 2012-02-13 04:51:23 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addLockExceptionForm.vm 2014-07-31 14:17:58 +0000 @@ -16,16 +16,18 @@ - + + + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/lockException.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/lockException.js 2013-09-27 13:45:21 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/lockException.js 2014-07-31 14:17:58 +0000 @@ -8,7 +8,7 @@ // arguments is only "array-like", so it doesnt have splice var args = Array.prototype.slice.call(arguments); var selectedOus = args.splice(1, args.length); - + jQuery("#organisationUnitId").val(selectedOus.join(',')); jQuery.getJSON('getDataSets.action?id=' + selectedOus.join(','), function ( data ) { @@ -18,8 +18,7 @@ resetDataSets(); } else { for ( var n in data.dataSets ) { - var option = jQuery(""); } jQuery("#dataSets").removeAttr("disabled"); @@ -32,22 +31,13 @@ function dataSetChanged( e ) { var dataSetId = jQuery("#dataSets option:selected").val(); jQuery("#periods").children().remove(); + currentPeriodOffset = 0; if ( !isNaN(dataSetId) ) { - jQuery.getJSON('getPeriods.action?id=' + dataSetId, function ( data ) { - if ( data.periods.length == 0 ) { - resetPeriods(); - } else { - for ( var n in data.periods ) { - var option = jQuery("").attr("disabled", true); + disable('prevPeriod'); + disable('nextPeriod'); } function resetPeriods() { jQuery("#periods").append("").attr("disabled", true); + disable('prevPeriod'); + disable('nextPeriod'); +} + +/** + * Handles the onClick event for the next period button. + */ +var currentPeriodOffset = 0; + +function nextPeriodsSelected() +{ + if( currentPeriodOffset < 0 ) + { + currentPeriodOffset++; + displayPeriods(); + } +} + +/** + * Handles the onClick event for the previous period button. + */ +function previousPeriodsSelected() +{ + currentPeriodOffset--; + displayPeriods(); +} + +/** + * Generates the period select list options. + */ +function displayPeriods() +{ + var periodType = $( '#dataSets option:selected' ).attr( "periodType" ) + var allowFuturePeriods = $( '#dataSets option:selected' ).attr( "allowFuturePeriods" ); + var periods = dhis2.period.generator.generateReversedPeriods(periodType,currentPeriodOffset); + + if ( allowFuturePeriods == "false" ) + { + periods = dhis2.period.generator.filterFuturePeriods( periods ); + } + + clearListById( 'periods' ); + + for( var i in periods ) + { + jQuery("#periods").append("" ); + } } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/jsonDataSets.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/jsonDataSets.vm 2012-02-08 12:04:46 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/jsonDataSets.vm 2014-07-31 14:17:58 +0000 @@ -3,7 +3,9 @@ #foreach( $dataSet in $dataSets ) { "id": $!{dataSet.id}, - "name": "$!encoder.jsonEncode( ${dataSet.displayName} )" + "name": "$!encoder.jsonEncode( ${dataSet.displayName} )", + "periodType": "$!{dataSet.periodType.name}", + "allowFuturePeriods": "$!{dataSet.allowFuturePeriods}" }#if( $velocityCount < $size ),#end #end ] }