=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/settings/userGeneralSettings.vm' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/settings/userGeneralSettings.vm 2012-10-16 13:26:20 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/settings/userGeneralSettings.vm 2012-11-20 14:43:33 +0000 @@ -5,7 +5,6 @@ currentLocale: getFieldValue( 'currentLocale' ), currentLocaleDb: getFieldValue( 'currentLocaleDb' ), currentStyle: getFieldValue( 'currentStyle' ), - autoSave: jQuery( '#autoSave' ).is(':checked' ), messageEmailNotification: jQuery( '#messageEmailNotification' ).is(':checked' ), messageSmsNotification: jQuery( '#messageSmsNotification' ).is(':checked' ) }, function ( json ) { @@ -50,11 +49,6 @@
- - -
- -
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/settings/user/action/SetGeneralSettingsAction.java' --- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/settings/user/action/SetGeneralSettingsAction.java 2012-10-16 13:26:20 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/settings/user/action/SetGeneralSettingsAction.java 2012-11-20 14:43:33 +0000 @@ -27,7 +27,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import static org.hisp.dhis.user.UserSettingService.AUTO_SAVE_DATA_ENTRY_FORM; import static org.hisp.dhis.user.UserSettingService.KEY_DB_LOCALE; import static org.hisp.dhis.user.UserSettingService.KEY_MESSAGE_EMAIL_NOTIFICATION; import static org.hisp.dhis.user.UserSettingService.KEY_MESSAGE_SMS_NOTIFICATION; @@ -78,13 +77,6 @@ // Input // ------------------------------------------------------------------------- - private Boolean autoSave; - - public void setAutoSave( Boolean autoSave ) - { - this.autoSave = autoSave; - } - private String currentLocale; public void setCurrentLocale( String locale ) @@ -147,9 +139,7 @@ .trimToNull( currentLocaleDb ) ) ); styleManager.setUserStyle( currentStyle ); - - userSettingService.saveUserSetting( AUTO_SAVE_DATA_ENTRY_FORM, autoSave ); - + userSettingService.saveUserSetting( KEY_MESSAGE_EMAIL_NOTIFICATION, messageEmailNotification ); userSettingService.saveUserSetting( KEY_MESSAGE_SMS_NOTIFICATION, messageSmsNotification ); === modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties' --- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties 2012-11-14 19:23:18 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties 2012-11-20 14:43:33 +0000 @@ -337,7 +337,6 @@ db_language=Database language language=Interface language use_db_locale_no_translation=Use database locale / no translation -auto_save_data_entry_forms=Auto-save data entry forms style=Style user_general_settings=User General Settings user_message_settings=User Message Settings === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/SetAutoSaveSettingAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/SetAutoSaveSettingAction.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/dataentryform/SetAutoSaveSettingAction.java 2012-11-20 14:43:33 +0000 @@ -0,0 +1,76 @@ +/* + * 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.dataset.action.dataentryform; + +import org.hisp.dhis.user.UserSettingService; + +import com.opensymphony.xwork2.Action; + +/** + * @author Chau Thu Tran + * + * @version SetAutoSaveSettingAction.java 2:23:02 PM Nov 20, 2012 $ + */ +public class SetAutoSaveSettingAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private UserSettingService userSettingService; + + public void setUserSettingService( UserSettingService userSettingService ) + { + this.userSettingService = userSettingService; + } + + // ------------------------------------------------------------------------- + // Input / Output + // ------------------------------------------------------------------------- + + private boolean autoSave; + + public void setAutoSave( boolean autoSave ) + { + this.autoSave = autoSave; + } + + // ------------------------------------------------------------------------- + // Implementation Action + // ------------------------------------------------------------------------- + + public String execute() + throws Exception + { + userSettingService.saveUserSetting( UserSettingService.AUTO_SAVE_DATA_ENTRY_FORM, autoSave ); + + 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 2012-09-24 21:54:54 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml 2012-11-20 14:43:33 +0000 @@ -303,6 +303,13 @@ + + + + + + /dhis-web-maintenance-dataset/responseSelDataElementList.vm + + + ../dhis-web-commons/ajax/jsonResponseSuccess.vm + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataEntryForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataEntryForm.js 2012-06-04 16:20:41 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataEntryForm.js 2012-11-20 14:43:33 +0000 @@ -71,5 +71,5 @@ function validateDataEntryFormTimeout() { validateDataEntryForm( false ); - window.setTimeout( "validateDataEntryFormTimeout();", 60000 ); + timeOut = window.setTimeout( "validateDataEntryFormTimeout();", 60000 ); } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js 2012-09-18 11:29:01 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js 2012-11-20 14:43:33 +0000 @@ -2,6 +2,7 @@ var currentDynamicElementCode = null; var currentCategoryComboId = null; var currentCategoryComboName = null; +var timeOut; $( document ).ready( function() { @@ -194,9 +195,9 @@ $("#dynamicElementSelector").dblclick(insertDynamicElement); - if( autoSave == 'true' ) + if( autoSave ) { - window.setTimeout( "validateDataEntryFormTimeout( false );", 60000 ); + timeOut = window.setTimeout( "validateDataEntryFormTimeout( false );", 60000 ); } }); @@ -440,3 +441,18 @@ return result; } + +function setAutoSaveSetting(_autoSave) +{ + jQuery.postJSON("setAutoSaveSetting.action",{autoSave:_autoSave}, + function(json) + { + autoSave = _autoSave; + if(_autoSave){ + window.setTimeout( "validateDataEntryFormTimeout( false );", 60000 ); + } + else{ + window.clearTimeout(timeOut); + } + }); +} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm 2012-09-19 08:34:26 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm 2012-11-20 14:43:33 +0000 @@ -94,6 +94,7 @@   |    |  + $i18n.getString( 'auto_save_data_entry_forms' )