dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #25354
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12558: translation of application Keys on login page
------------------------------------------------------------
revno: 12558
committer: James Chang <jamesbchang@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-10-10 19:00:38 +0700
message:
translation of application Keys on login page
removed:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/GetAppearanceSettingsStringAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemAppearanceSettingsString.vm
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/TranslateSystemSettingManager.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultTranslateSystemSettingManager.java
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/settings/systemAppearanceSettingsString.vm
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/settings/system/
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/settings/system/action/
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/settings/system/action/GetAppearanceSettingsStringAction.java
modified:
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/LocaleUtils.java
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/loginStrings.vm
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetStringsFromLocaleAction.java
dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml
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/javascripts/systemAppearanceSettings.js
--
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
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/TranslateSystemSettingManager.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/TranslateSystemSettingManager.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/TranslateSystemSettingManager.java 2013-10-10 12:00:38 +0000
@@ -0,0 +1,40 @@
+package org.hisp.dhis.setting;
+
+/*
+ * Copyright (c) 2004-2013, 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.Map;
+
+/**
+ * @author James Chang
+ */
+
+public interface TranslateSystemSettingManager
+{
+ Map<String, String> getTranslation_SystemAppearanceSetting( String localeStr );
+}
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultTranslateSystemSettingManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultTranslateSystemSettingManager.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultTranslateSystemSettingManager.java 2013-10-10 12:00:38 +0000
@@ -0,0 +1,98 @@
+package org.hisp.dhis.setting;
+
+/*
+ * Copyright (c) 2004-2013, 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 static org.hisp.dhis.setting.SystemSettingManager.DEFAULT_APPLICATION_TITLE;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_APPLICATION_FOOTER;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_APPLICATION_INTRO;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_APPLICATION_NOTIFICATION;
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_APPLICATION_TITLE;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+/**
+ * @author James Chang
+ */
+
+public class DefaultTranslateSystemSettingManager
+ implements TranslateSystemSettingManager
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private SystemSettingManager systemSettingManager;
+
+ public void setSystemSettingManager( SystemSettingManager systemSettingManager )
+ {
+ this.systemSettingManager = systemSettingManager;
+ }
+
+ // -------------------------------------------------------------------------
+ // Method implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public Map<String, String> getTranslation_SystemAppearanceSetting( String localeStr )
+ {
+ Map<String, String> translations = new Hashtable<String, String>();
+
+ // Add the key application data (with localeCode name) into translations map object
+ translations.put( KEY_APPLICATION_TITLE, getSystemSettingWithFallbacks( KEY_APPLICATION_TITLE, localeStr, DEFAULT_APPLICATION_TITLE ) );
+ translations.put( KEY_APPLICATION_INTRO, getSystemSettingWithFallbacks( KEY_APPLICATION_INTRO, localeStr, "" ) );
+ translations.put( KEY_APPLICATION_NOTIFICATION, getSystemSettingWithFallbacks( KEY_APPLICATION_NOTIFICATION, localeStr, "" ) );
+ translations.put( KEY_APPLICATION_FOOTER, getSystemSettingWithFallbacks( KEY_APPLICATION_FOOTER, localeStr, "" ) );
+
+ return translations;
+ }
+
+ // -------------------------------------------------------------------------
+ // Support Method implementation
+ // -------------------------------------------------------------------------
+ private String getSystemSettingWithFallbacks( String keyName, String localeStr, String defaultValue )
+ {
+ String settingValue = "";
+
+ String keyWithLocale = systemSettingManager.getSystemSetting( keyName + localeStr, "" ).toString();
+
+ if ( keyWithLocale.isEmpty() )
+ {
+ settingValue = systemSettingManager.getSystemSetting( keyName, defaultValue ).toString();
+ }
+ else
+ {
+ settingValue = keyWithLocale;
+ }
+
+ return settingValue;
+ }
+
+}
=== 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 2013-10-08 17:20:57 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2013-10-10 12:00:38 +0000
@@ -672,6 +672,10 @@
</property>
</bean>
+ <bean id="org.hisp.dhis.setting.TranslateSystemSettingManager" class="org.hisp.dhis.setting.DefaultTranslateSystemSettingManager">
+ <property name="systemSettingManager" ref="org.hisp.dhis.setting.SystemSettingManager" />
+ </bean>
+
<bean id="org.hisp.dhis.setting.StyleManager" class="org.hisp.dhis.setting.DefaultStyleManager">
<property name="systemSettingManager" ref="org.hisp.dhis.setting.SystemSettingManager" />
<property name="userSettingService" ref="org.hisp.dhis.user.UserSettingService" />
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/LocaleUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/LocaleUtils.java 2013-10-08 17:16:47 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/LocaleUtils.java 2013-10-10 12:00:38 +0000
@@ -54,7 +54,14 @@
*/
public static Locale getLocale( String localeStr )
{
- return org.apache.commons.lang.LocaleUtils.toLocale( localeStr );
+ if ( localeStr == null || localeStr.isEmpty() )
+ {
+ return null;
+ }
+ else
+ {
+ return org.apache.commons.lang.LocaleUtils.toLocale( localeStr );
+ }
}
/**
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.js 2013-10-07 09:33:02 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.js 2013-10-10 12:00:38 +0000
@@ -44,5 +44,11 @@
$( '#loginMessage' ).html( json.wrong_username_or_password );
$( '#poweredByLabel' ).html( json.powered_by );
$( '#submit' ).val( json.login );
+
+ $( '#titleArea' ).html( json.applicationTitle );
+ $( '#introArea' ).html( json.keyApplicationIntro );
+ $( '#notificationArea' ).html( json.keyApplicationNotification );
+ $( '#applicationFooter' ).html( json.keyApplicationFooter );
} );
-}
\ No newline at end of file
+}
+
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.vm 2013-10-06 19:54:35 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.vm 2013-10-10 12:00:38 +0000
@@ -58,7 +58,7 @@
<div id="footerArea">
<span id="poweredByLabel">Powered by</span>
<a href="http://www.dhis2.org">DHIS 2</a>
- $!{keyApplicationFooter}
+ <span id="applicationFooter">$!{keyApplicationFooter}</span>
<select id="localeSelect" onchange="login.localeChanged()" style="margin-left: 30px">
<option value="">[ Change language ]</option>
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/loginStrings.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/loginStrings.vm 2013-10-05 17:11:35 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/loginStrings.vm 2013-10-10 12:00:38 +0000
@@ -6,5 +6,19 @@
"create_an_account": "$!i18nObject.getString( "create_an_account" )",
"wrong_username_or_password": "$!i18nObject.getString( "wrong_username_or_password" )",
"powered_by": "$!i18nObject.getString( "powered_by" )",
-"login": "$!i18nObject.getString( "login" )"
+"login": "$!i18nObject.getString( "login" )",
+
+"applicationTitle": "$!encoder.htmlEncode( $!translations.get( "applicationTitle" ) )",
+
+#set($strKeyApplicationIntro = $!translations.get( "keyApplicationIntro" ) )
+#set($strKeyApplicationIntro = $strKeyApplicationIntro.replaceAll( "'", ''' ) )
+"keyApplicationIntro": "$!encoder.jsEncode( $strKeyApplicationIntro )",
+
+#set($strKeyApplicationNotification = $!translations.get( "keyApplicationNotification" ) )
+#set($strKeyApplicationNotification = $strKeyApplicationNotification.replaceAll( "'", ''' ) )
+"keyApplicationNotification": "$!encoder.jsEncode( $strKeyApplicationNotification )",
+
+#set($strKeyApplicationFooter = $!translations.get( "keyApplicationFooter" ) )
+#set($strKeyApplicationFooter = $strKeyApplicationFooter.replaceAll("'", ''') )
+"keyApplicationFooter": "$!encoder.jsEncode( $strKeyApplicationFooter )"
}
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/settings/systemAppearanceSettingsString.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/settings/systemAppearanceSettingsString.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/settings/systemAppearanceSettingsString.vm 2013-10-10 12:00:38 +0000
@@ -0,0 +1,15 @@
+{
+"applicationTitle": "$!encoder.htmlEncode( $!translations.get( "applicationTitle" ) )",
+
+#set($strKeyApplicationIntro = $!translations.get( "keyApplicationIntro" ) )
+#set($strKeyApplicationIntro = $strKeyApplicationIntro.replaceAll( "'", ''' ) )
+"keyApplicationIntro": "$!encoder.jsEncode( $strKeyApplicationIntro )",
+
+#set($strKeyApplicationNotification = $!translations.get( "keyApplicationNotification" ) )
+#set($strKeyApplicationNotification = $strKeyApplicationNotification.replaceAll( "'", ''' ) )
+"keyApplicationNotification": "$!encoder.jsEncode( $strKeyApplicationNotification )",
+
+#set($strKeyApplicationFooter = $!translations.get( "keyApplicationFooter" ) )
+#set($strKeyApplicationFooter = $strKeyApplicationFooter.replaceAll("'", ''') )
+"keyApplicationFooter": "$!encoder.jsEncode( $strKeyApplicationFooter )"
+}
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetStringsFromLocaleAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetStringsFromLocaleAction.java 2013-10-07 09:41:37 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetStringsFromLocaleAction.java 2013-10-10 12:00:38 +0000
@@ -31,10 +31,13 @@
import com.opensymphony.xwork2.Action;
import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.i18n.I18nManager;
+import org.hisp.dhis.setting.TranslateSystemSettingManager;
import org.hisp.dhis.system.util.LocaleUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import java.util.Hashtable;
import java.util.Locale;
+import java.util.Map;
/**
* @author Lars Helge Overland
@@ -42,15 +45,35 @@
public class GetStringsFromLocaleAction
implements Action
{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
@Autowired
private I18nManager manager;
+ @Autowired
+ private TranslateSystemSettingManager translateSystemSettingManager;
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
private String loc;
public void setLoc( String loc )
{
this.loc = loc;
}
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private Map<String, String> translations = new Hashtable<String, String>();
+
+ public Map<String, String> getTranslations()
+ {
+ return translations;
+ }
private I18n i18nObject;
@@ -71,6 +94,8 @@
Locale locale = LocaleUtils.getLocale( loc );
i18nObject = manager.getI18n( this.getClass(), locale );
+
+ translations = translateSystemSettingManager.getTranslation_SystemAppearanceSetting( loc );
}
return SUCCESS;
=== added directory 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/settings/system'
=== added directory 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/settings/system/action'
=== added file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/settings/system/action/GetAppearanceSettingsStringAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/settings/system/action/GetAppearanceSettingsStringAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/settings/system/action/GetAppearanceSettingsStringAction.java 2013-10-10 12:00:38 +0000
@@ -0,0 +1,87 @@
+package org.hisp.dhis.settings.system.action;
+
+/*
+ * Copyright (c) 2004-2013, 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.Hashtable;
+import java.util.Map;
+
+import org.hisp.dhis.setting.TranslateSystemSettingManager;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author James Chang
+ */
+public class GetAppearanceSettingsStringAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private TranslateSystemSettingManager translateSystemSettingManager;
+
+ public void setTranslateSystemSettingManager( TranslateSystemSettingManager translateSystemSettingManager )
+ {
+ this.translateSystemSettingManager = translateSystemSettingManager;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private String localeCode;
+
+ public void setLocaleCode( String localeCode )
+ {
+ this.localeCode = localeCode;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private Map<String, String> translations = new Hashtable<String, String>();
+
+ public Map<String, String> getTranslations()
+ {
+ return translations;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ translations = translateSystemSettingManager.getTranslation_SystemAppearanceSetting( localeCode );
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2013-10-08 17:16:47 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2013-10-10 12:00:38 +0000
@@ -595,6 +595,16 @@
<property name="styleManager" ref="org.hisp.dhis.setting.StyleManager" />
</bean>
+ <!-- System settings -->
+
+ <bean id="org.hisp.dhis.settings.system.action.GetAppearanceSettingsStringAction"
+ class="org.hisp.dhis.settings.system.action.GetAppearanceSettingsStringAction"
+ scope="prototype">
+ <property name="translateSystemSettingManager" ref="org.hisp.dhis.setting.TranslateSystemSettingManager" />
+ </bean>
+
+ <!-- Others -->
+
<bean id="org.hisp.dhis.commons.action.GetPingAction" class="org.hisp.dhis.commons.action.GetPingAction">
<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
</bean>
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml 2013-10-07 09:33:02 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml 2013-10-10 12:00:38 +0000
@@ -18,6 +18,7 @@
<package name="dhis-web-commons" extends="struts-default" namespace="/dhis-web-commons">
+
<result-types>
<result-type name="plainTextErrorResult" class="org.hisp.dhis.result.PlainTextErrorResult" />
<result-type name="chart" class="org.hisp.dhis.result.ChartResult" />
@@ -466,6 +467,11 @@
</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
+
+ <action name="systemAppearanceSettingsString" class="org.hisp.dhis.settings.system.action.GetAppearanceSettingsStringAction">
+ <result name="success" type="velocity-json">/dhis-web-commons/settings/systemAppearanceSettingsString.vm</result>
+ </action>
+
</package>
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/GetAppearanceSettingsStringAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/GetAppearanceSettingsStringAction.java 2013-10-09 13:47:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/GetAppearanceSettingsStringAction.java 1970-01-01 00:00:00 +0000
@@ -1,97 +0,0 @@
-package org.hisp.dhis.settings.action.system;
-
-/*
- * Copyright (c) 2004-2013, 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 static org.hisp.dhis.setting.SystemSettingManager.DEFAULT_APPLICATION_TITLE;
-import static org.hisp.dhis.setting.SystemSettingManager.KEY_APPLICATION_FOOTER;
-import static org.hisp.dhis.setting.SystemSettingManager.KEY_APPLICATION_INTRO;
-import static org.hisp.dhis.setting.SystemSettingManager.KEY_APPLICATION_NOTIFICATION;
-import static org.hisp.dhis.setting.SystemSettingManager.KEY_APPLICATION_TITLE;
-
-import java.util.Hashtable;
-import java.util.Map;
-
-import org.hisp.dhis.setting.SystemSettingManager;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author James Chang
- */
-public class GetAppearanceSettingsStringAction
- implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private SystemSettingManager systemSettingManager;
-
- public void setSystemSettingManager( SystemSettingManager systemSettingManager )
- {
- this.systemSettingManager = systemSettingManager;
- }
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private String localeCode;
-
- public void setLocaleCode( String localeCode )
- {
- this.localeCode = localeCode;
- }
-
- // -------------------------------------------------------------------------
- // Output
- // -------------------------------------------------------------------------
-
- private Map<String, Object> translations = new Hashtable<String, Object>();
-
- public Map<String, Object> getTranslations()
- {
- return translations;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- {
- // Add the key application data (with localeCode name) into translations map object
- translations.put( KEY_APPLICATION_TITLE, systemSettingManager.getSystemSetting( KEY_APPLICATION_TITLE + localeCode, DEFAULT_APPLICATION_TITLE ) );
- translations.put( KEY_APPLICATION_INTRO, systemSettingManager.getSystemSetting( KEY_APPLICATION_INTRO + localeCode, "" ) );
- translations.put( KEY_APPLICATION_NOTIFICATION, systemSettingManager.getSystemSetting( KEY_APPLICATION_NOTIFICATION + localeCode, "" ) );
- translations.put( KEY_APPLICATION_FOOTER, systemSettingManager.getSystemSetting( KEY_APPLICATION_FOOTER + localeCode, "" ) );
-
- return SUCCESS;
- }
-}
=== 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 2013-10-09 13:47:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml 2013-10-10 12:00:38 +0000
@@ -41,13 +41,6 @@
<property name="styleManager" ref="org.hisp.dhis.setting.StyleManager" />
</bean>
- <bean id="org.hisp.dhis.settings.action.system.GetAppearanceSettingsStringAction"
- class="org.hisp.dhis.settings.action.system.GetAppearanceSettingsStringAction"
- scope="prototype">
- <property name="systemSettingManager" ref="org.hisp.dhis.setting.SystemSettingManager" />
- </bean>
-
-
<bean id="org.hisp.dhis.settings.action.system.GetSMTPSettingsAction"
class="org.hisp.dhis.settings.action.system.GetSMTPSettingsAction"
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 2013-10-09 13:47:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/struts.xml 2013-10-10 12:00:38 +0000
@@ -47,10 +47,6 @@
<param name="requiredAuthorities">F_SYSTEM_SETTING</param>
</action>
- <action name="systemAppearanceSettingsString" class="org.hisp.dhis.settings.action.system.GetAppearanceSettingsStringAction">
- <result name="success" type="velocity-json">/dhis-web-maintenance-settings/systemAppearanceSettingsString.vm</result>
- </action>
-
<!-- Email settings -->
<action name="systemEmailSettings" class="org.hisp.dhis.settings.action.system.GetSMTPSettingsAction">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/javascripts/systemAppearanceSettings.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/javascripts/systemAppearanceSettings.js 2013-10-09 13:47:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/javascripts/systemAppearanceSettings.js 2013-10-10 12:00:38 +0000
@@ -1,7 +1,7 @@
function changeLocale()
{
- $.get( 'systemAppearanceSettingsString.action?localeCode=' + $( '#localeSelect' ).val(), function( json ) {
+ $.get( '../dhis-web-commons-ajax/systemAppearanceSettingsString.action?localeCode=' + $( '#localeSelect' ).val(), function( json ) {
$( '#applicationTitle' ).val( json.applicationTitle );
$( '#applicationIntro' ).val( json.keyApplicationIntro );
$( '#applicationNotification' ).val( json.keyApplicationNotification );
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemAppearanceSettingsString.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemAppearanceSettingsString.vm 2013-10-09 13:47:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemAppearanceSettingsString.vm 1970-01-01 00:00:00 +0000
@@ -1,15 +0,0 @@
-{
-"applicationTitle": "$!encoder.htmlEncode( $!translations.get( "applicationTitle" ) )",
-
-#set($strKeyApplicationIntro = $!translations.get( "keyApplicationIntro" ) )
-#set($strKeyApplicationIntro = $strKeyApplicationIntro.replaceAll( "'", ''' ) )
-"keyApplicationIntro": "$!encoder.jsEncode( $strKeyApplicationIntro )",
-
-#set($strKeyApplicationNotification = $!translations.get( "keyApplicationNotification" ) )
-#set($strKeyApplicationNotification = $strKeyApplicationNotification.replaceAll( "'", ''' ) )
-"keyApplicationNotification": "$!encoder.jsEncode( $strKeyApplicationNotification )",
-
-#set($strKeyApplicationFooter = $!translations.get( "keyApplicationFooter" ) )
-#set($strKeyApplicationFooter = $strKeyApplicationFooter.replaceAll("'", ''') )
-"keyApplicationFooter": "$!encoder.jsEncode( $strKeyApplicationFooter )"
-}