← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17467: Added separate action class for setting calendar settings

 

------------------------------------------------------------
revno: 17467
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-11-14 12:34:11 +0100
message:
  Added separate action class for setting calendar settings
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetGeneralSettingsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemCalendarSettings.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetGeneralSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetGeneralSettingsAction.java	2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetGeneralSettingsAction.java	2014-11-14 11:34:11 +0000
@@ -28,10 +28,18 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import com.opensymphony.xwork2.Action;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_ANALYTICS_MAINTENANCE_MODE;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_ANALYTICS_MAX_LIMIT;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_CACHE_STRATEGY;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_DATABASE_SERVER_CPUS;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_FACTOR_OF_DEVIATION;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_GOOGLE_ANALYTICS_UA;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_HELP_PAGE_LINK;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_MULTI_ORGANISATION_UNIT_FORMS;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_OMIT_INDICATORS_ZERO_NUMERATOR_DATAMART;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_PHONE_NUMBER_AREA_CODE;
 
 import org.apache.commons.lang3.StringUtils;
-import org.hisp.dhis.calendar.CalendarService;
 import org.hisp.dhis.configuration.Configuration;
 import org.hisp.dhis.configuration.ConfigurationService;
 import org.hisp.dhis.dataelement.DataElementService;
@@ -41,13 +49,11 @@
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.setting.SystemSettingManager;
 import org.hisp.dhis.user.UserGroupService;
-import org.springframework.beans.factory.annotation.Autowired;
 
-import static org.hisp.dhis.setting.SystemSettingManager.*;
+import com.opensymphony.xwork2.Action;
 
 /**
  * @author Lars Helge Overland
- * @version $Id$
  */
 public class SetGeneralSettingsAction
     implements Action
@@ -98,9 +104,6 @@
         this.organisationUnitService = organisationUnitService;
     }
     
-    @Autowired
-    private CalendarService calendarService;
-
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -196,20 +199,6 @@
         this.analyticsMaintenanceMode = analyticsMaintenanceMode;
     }
     
-    private String calendar;
-
-    public void setCalendar( String calendar )
-    {
-        this.calendar = calendar;
-    }
-
-    private String dateFormat;
-
-    public void setDateFormat( String dateFormat )
-    {
-        this.dateFormat = dateFormat;
-    }
-
     private String helpPageLink;
     
     public void setHelpPageLink( String helpPageLink )
@@ -249,9 +238,6 @@
         systemSettingManager.saveSystemSetting( KEY_ANALYTICS_MAINTENANCE_MODE, analyticsMaintenanceMode );
         systemSettingManager.saveSystemSetting( KEY_HELP_PAGE_LINK, StringUtils.trimToNull( helpPageLink ) );
 
-        calendarService.setSystemCalendarKey( calendar );
-        calendarService.setSystemDateFormatKey( dateFormat );
-        
         Configuration configuration = configurationService.getConfiguration();
 
         if ( feedbackRecipients != null )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml	2014-10-19 17:45:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml	2014-11-14 11:34:11 +0000
@@ -28,6 +28,11 @@
     <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
   </bean>
 
+  <bean id="org.hisp.dhis.settings.action.system.SetCalendarSettingsAction"
+    class="org.hisp.dhis.settings.action.system.SetCalendarSettingsAction"
+    scope="prototype">
+  </bean>
+
   <bean id="org.hisp.dhis.settings.action.system.GetAppearanceSettingsAction"
     class="org.hisp.dhis.settings.action.system.GetAppearanceSettingsAction"
     scope="prototype">

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/struts.xml	2014-07-11 22:15:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/struts.xml	2014-11-14 11:34:11 +0000
@@ -22,6 +22,14 @@
       <param name="menu">/dhis-web-maintenance-settings/settingsMenu.vm</param>
       <param name="requiredAuthorities">F_SYSTEM_SETTING</param>
     </action>
+    
+    <action name="setSystemCalendarSettings" class="org.hisp.dhis.settings.action.system.SetCalendarSettingsAction">
+      <result name="success" type="velocity-json">
+        /dhis-web-commons/ajax/jsonResponseSuccess.vm
+      </result>
+      <param name="onExceptionReturn">plainTextError</param>
+      <param name="requiredAuthorities">F_SYSTEM_SETTING</param>
+    </action>
 
     <!-- General settings -->
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemCalendarSettings.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemCalendarSettings.vm	2014-05-13 11:15:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemCalendarSettings.vm	2014-11-14 11:34:11 +0000
@@ -1,7 +1,7 @@
 <script>
   jQuery(document).ready(function() {
     jQuery("input[type=button]").click(function() {
-      jQuery.postUTF8('setSystemGeneralSettings.action', {
+      jQuery.postUTF8('setSystemCalendarSettings.action', {
         calendar: getFieldValue('calendar'),
         dateFormat: getFieldValue('dateFormat')
       }, function( json ) {