dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #25102
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12368: Partial merge from lp:~dhis2-devs-core/dhis2/psicustomlocale. Dynamic database locales. Work in p...
Merge authors:
James Chang (jamesbchang)
------------------------------------------------------------
revno: 12368 [merge]
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-10-01 18:44:42 +0200
message:
Partial merge from lp:~dhis2-devs-core/dhis2/psicustomlocale. Dynamic database locales. Work in progress.
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/locale/I18nLocale.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nLocaleService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nLocaleService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nLocaleStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/hibernate/
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/hibernate/HibernateI18nLocaleStore.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/i18n/
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/i18n/locale/
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/i18n/locale/hibernate/
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/i18n/locale/hibernate/I18nLocale.hbm.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/AddLocaleAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/GetLocaleAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/GetLocaleListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/RemoveLocaleAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/ShowAddLocaleFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/ValidateLocaleAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addLocaleForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/jsonLocale.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/localeList.vm
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nService.java
dhis-2/dhis-services/dhis-service-core/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
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/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/index.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/menu.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
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/locale/I18nLocale.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/locale/I18nLocale.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/locale/I18nLocale.java 2013-10-01 16:44:42 +0000
@@ -0,0 +1,79 @@
+package org.hisp.dhis.i18n.locale;
+
+/*
+ * 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 org.hisp.dhis.common.BaseIdentifiableObject;
+
+public class I18nLocale
+ extends BaseIdentifiableObject
+{
+ private String name;
+
+ private String locale;
+
+ // -------------------------------------------------------------------------
+ // Constructors
+ // -------------------------------------------------------------------------
+
+ public I18nLocale()
+ {
+ this.name = "English, United Kingdom";
+ this.locale = "en_GB";
+ }
+
+ public I18nLocale( String name, String locale )
+ {
+ this.name = name;
+ this.locale = locale;
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters and setters
+ // -------------------------------------------------------------------------
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ public String getLocale()
+ {
+ return locale;
+ }
+
+ public void setLocale( String locale )
+ {
+ this.locale = locale;
+ }
+}
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nLocaleService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nLocaleService.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nLocaleService.java 2013-10-01 16:44:42 +0000
@@ -0,0 +1,95 @@
+package org.hisp.dhis.i18n;
+
+/*
+ * 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.Collection;
+
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+import org.hisp.dhis.i18n.locale.I18nLocale;
+import org.springframework.transaction.annotation.Transactional;
+
+@Transactional
+public class DefaultI18nLocaleService
+ implements I18nLocaleService
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private GenericIdentifiableObjectStore<I18nLocale> localeStore;
+
+ public void setLocaleStore( GenericIdentifiableObjectStore<I18nLocale> localeStore )
+ {
+ this.localeStore = localeStore;
+ }
+
+ // -------------------------------------------------------------------------
+ // I18nLocaleService implementation
+ // -------------------------------------------------------------------------
+
+ public void saveI18nLocale( I18nLocale locale )
+ {
+ localeStore.save( locale );
+ }
+
+ public I18nLocale getI18nLocale( int id )
+ {
+ return localeStore.get( id );
+ }
+
+ public I18nLocale getI18nLocaleByUid( String uid )
+ {
+ return localeStore.getByUid( uid );
+ }
+
+ public void deleteI18nLocale( I18nLocale locale )
+ {
+ localeStore.delete( locale );
+ }
+
+ public int getI18nLocaleCount()
+ {
+ return localeStore.getCount();
+ }
+
+ public int getI18nLocaleCountByName( String name )
+ {
+ return localeStore.getCountLikeName( name );
+ }
+
+ public Collection<I18nLocale> getI18nLocalesBetween( int first, int max )
+ {
+ return localeStore.getAllOrderedName( first, max );
+ }
+
+ public Collection<I18nLocale> getI18nLocalesBetweenLikeName( String name, int first, int max )
+ {
+ return localeStore.getAllLikeNameOrderedName( name, first, max );
+ }
+}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nService.java 2013-09-14 17:39:13 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nService.java 2013-10-01 16:44:42 +0000
@@ -76,7 +76,7 @@
{
this.userSettingService = userSettingService;
}
-
+
// -------------------------------------------------------------------------
// Properties
// -------------------------------------------------------------------------
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nLocaleService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nLocaleService.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nLocaleService.java 2013-10-01 16:44:42 +0000
@@ -0,0 +1,51 @@
+package org.hisp.dhis.i18n;
+
+/*
+ * 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.
+ */
+
+import java.util.Collection;
+
+import org.hisp.dhis.i18n.locale.I18nLocale;
+
+public interface I18nLocaleService
+{
+ void saveI18nLocale( I18nLocale locale );
+
+ I18nLocale getI18nLocale( int id );
+
+ I18nLocale getI18nLocaleByUid( String uid );
+
+ void deleteI18nLocale( I18nLocale locale );
+
+ int getI18nLocaleCount();
+
+ int getI18nLocaleCountByName( String name );
+
+ Collection<I18nLocale> getI18nLocalesBetween( int first, int max );
+
+ Collection<I18nLocale> getI18nLocalesBetweenLikeName( String name, int first, int max );
+}
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nLocaleStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nLocaleStore.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nLocaleStore.java 2013-10-01 16:44:42 +0000
@@ -0,0 +1,37 @@
+package org.hisp.dhis.i18n;
+
+/*
+ * 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.
+ */
+
+import org.hisp.dhis.common.GenericNameableObjectStore;
+import org.hisp.dhis.i18n.locale.I18nLocale;
+
+public interface I18nLocaleStore
+ extends GenericNameableObjectStore<I18nLocale>
+{
+ I18nLocale getI18nLocaleByLocale( String language, String country );
+}
=== added directory 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/hibernate'
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/hibernate/HibernateI18nLocaleStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/hibernate/HibernateI18nLocaleStore.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/hibernate/HibernateI18nLocaleStore.java 2013-08-13 09:24:46 +0000
@@ -0,0 +1,19 @@
+package org.hisp.dhis.i18n.hibernate;
+
+import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
+import org.hisp.dhis.i18n.I18nLocaleStore;
+import org.hisp.dhis.i18n.locale.I18nLocale;
+
+public class HibernateI18nLocaleStore
+ extends HibernateIdentifiableObjectStore<I18nLocale>
+ implements I18nLocaleStore
+{
+ @Override
+ public I18nLocale getI18nLocaleByLocale( String language, String country )
+ {
+ return (I18nLocale) getCriteria( Restrictions.eq( "language", language ), Restrictions.eq( "country", country ) )
+ .uniqueResult();
+ }
+
+}
=== 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-09-30 04:26:09 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2013-10-01 16:44:42 +0000
@@ -342,8 +342,13 @@
<bean id="org.hisp.dhis.sms.hibernate.OutboundSmsStore"
class="org.hisp.dhis.sms.hibernate.HibernateOutboundSmsStore">
- <property name="clazz" value="org.hisp.dhis.sms.outbound.OutboundSms" />
- <property name="sessionFactory" ref="sessionFactory" />
+ <property name="clazz" value="org.hisp.dhis.sms.outbound.OutboundSms" />
+ <property name="sessionFactory" ref="sessionFactory" />
+ </bean>
+
+ <bean id="org.hisp.dhis.i18n.I18nLocaleStore" class="org.hisp.dhis.i18n.hibernate.HibernateI18nLocaleStore">
+ <property name="clazz" value="org.hisp.dhis.i18n.locale.I18nLocale" />
+ <property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- Service definitions -->
@@ -823,6 +828,10 @@
</list>
</property>
</bean>
+
+ <bean id="org.hisp.dhis.i18n.118nLocaleService" class="org.hisp.dhis.i18n.DefaultI18nLocaleService">
+ <property name="localeStore" ref="org.hisp.dhis.i18n.I18nLocaleStore" />
+ </bean>
<!-- Startup routine definitions -->
=== added directory 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/i18n'
=== added directory 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/i18n/locale'
=== added directory 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/i18n/locale/hibernate'
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/i18n/locale/hibernate/I18nLocale.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/i18n/locale/hibernate/I18nLocale.hbm.xml 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/i18n/locale/hibernate/I18nLocale.hbm.xml 2013-10-01 16:44:42 +0000
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+ "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"
+ [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
+ >
+
+<hibernate-mapping>
+ <class name="org.hisp.dhis.i18n.locale.I18nLocale" table="i18nlocale">
+
+ <id name="id" column="i18nlocaleid">
+ <generator class="native" />
+ </id>
+ &identifiableProperties;
+
+ <property name="name" column="name" length="250" not-null="true" unique="true" />
+
+ <property name="locale" column="locale" length="15" not-null="true" />
+
+ <!-- Form properties -->
+
+ </class>
+</hibernate-mapping>
=== added directory 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale'
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/AddLocaleAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/AddLocaleAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/AddLocaleAction.java 2013-10-01 16:44:42 +0000
@@ -0,0 +1,89 @@
+package org.hisp.dhis.dataadmin.action.locale;
+
+/*
+ * 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.
+ */
+
+import java.util.Locale;
+
+import org.hisp.dhis.i18n.I18nLocaleService;
+import org.hisp.dhis.i18n.locale.I18nLocale;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author James Chang
+ */
+public class AddLocaleAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private I18nLocaleService localeService;
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private String language;
+
+ public void setLanguage( String language )
+ {
+ this.language = language;
+ }
+
+ private String country;
+
+ public void setCountry( String country )
+ {
+ this.country = country;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ I18nLocale i18nLocale = new I18nLocale( name, (new Locale( language, country )).toString() );
+
+ localeService.saveI18nLocale( i18nLocale );
+
+ return SUCCESS;
+ }
+}
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/GetLocaleAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/GetLocaleAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/GetLocaleAction.java 2013-10-01 16:44:42 +0000
@@ -0,0 +1,84 @@
+package org.hisp.dhis.dataadmin.action.locale;
+
+/*
+ * 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.
+ */
+
+import org.hisp.dhis.i18n.I18nLocaleService;
+import org.hisp.dhis.i18n.locale.I18nLocale;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Abyot Asalefew Gizaw
+ * @version $Id$
+ */
+public class GetLocaleAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private I18nLocaleService localeService;
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private int id;
+
+ public int getId()
+ {
+ return id;
+ }
+
+ public void setId( int id )
+ {
+ this.id = id;
+ }
+
+ private I18nLocale i18nLocale;
+
+ public I18nLocale getI18nLocale()
+ {
+ return i18nLocale;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ i18nLocale = localeService.getI18nLocale( id );
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/GetLocaleListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/GetLocaleListAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/GetLocaleListAction.java 2013-10-01 16:44:42 +0000
@@ -0,0 +1,113 @@
+package org.hisp.dhis.dataadmin.action.locale;
+
+/*
+ * 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.
+ */
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.i18n.I18nLocaleService;
+import org.hisp.dhis.i18n.locale.I18nLocale;
+import org.hisp.dhis.paging.ActionPagingSupport;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * @author James Chang
+ * @version $Id$
+ */
+public class GetLocaleListAction
+ extends ActionPagingSupport<I18nLocale>
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private I18nLocaleService localeService;
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public Integer getId()
+ {
+ return id;
+ }
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private int total;
+
+ public int getTotal()
+ {
+ return total;
+ }
+
+ private List<I18nLocale> i18nlocales = new ArrayList<I18nLocale>();
+
+ public List<I18nLocale> getI18nLocales()
+ {
+ return i18nlocales;
+ }
+
+ private String key;
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ public void setKey( String key )
+ {
+ this.key = key;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ total = localeService.getI18nLocaleCount();
+
+ this.paging = createPaging( total );
+
+ i18nlocales = new ArrayList<I18nLocale>( localeService.getI18nLocalesBetween( paging.getStartPos(), paging.getPageSize() ));
+
+ Collections.sort( i18nlocales, IdentifiableObjectNameComparator.INSTANCE );
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/RemoveLocaleAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/RemoveLocaleAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/RemoveLocaleAction.java 2013-10-01 16:44:42 +0000
@@ -0,0 +1,105 @@
+package org.hisp.dhis.dataadmin.action.locale;
+
+/*
+ * 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.
+ */
+
+import org.hisp.dhis.common.DeleteNotAllowedException;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.i18n.I18nLocaleService;
+import org.hisp.dhis.i18n.locale.I18nLocale;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author James Chang
+ * @version $Id$
+ */
+public class RemoveLocaleAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private I18nLocaleService localeService;
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private int id;
+
+ public void setId( int id )
+ {
+ this.id = id;
+ }
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ try
+ {
+ I18nLocale i18nLocale = localeService.getI18nLocale( id );
+
+ localeService.deleteI18nLocale( i18nLocale );
+ }
+ catch ( DeleteNotAllowedException ex )
+ {
+ if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
+ {
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
+
+ return ERROR;
+ }
+ }
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/ShowAddLocaleFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/ShowAddLocaleFormAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/ShowAddLocaleFormAction.java 2013-10-01 16:44:42 +0000
@@ -0,0 +1,80 @@
+package org.hisp.dhis.dataadmin.action.locale;
+
+/*
+ * 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.
+ */
+
+import java.util.Map;
+
+import org.hisp.dhis.i18n.I18nLocaleService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author James Chang
+ * @version $Id$
+ */
+public class ShowAddLocaleFormAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private I18nLocaleService localeService;
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private Map<String, String> availableLanguages;
+
+ public Map<String, String> getAvailableLanguages()
+ {
+ return availableLanguages;
+ }
+
+ private Map<String, String> availableCountries;
+
+ public Map<String, String> getAvailableCountries()
+ {
+ return availableCountries;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ //availableLanguages = localeService.getAvailableLanguages();
+ //availableCountries = localeService.getAvailableCountries();
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/ValidateLocaleAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/ValidateLocaleAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/locale/ValidateLocaleAction.java 2013-10-01 16:44:42 +0000
@@ -0,0 +1,75 @@
+package org.hisp.dhis.dataadmin.action.locale;
+
+/*
+ * 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.
+ */
+
+import org.hisp.dhis.i18n.I18nLocaleService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author James Chang
+ */
+public class ValidateLocaleAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ @Autowired
+ private I18nLocaleService localeService;
+
+ // -------------------------------------------------------------------------
+ // I18n
+ // -------------------------------------------------------------------------
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ return SUCCESS;
+ }
+}
=== 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 2013-09-03 19:11:14 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2013-10-01 16:44:42 +0000
@@ -82,6 +82,32 @@
<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
</bean>
+ <!-- I18nLocale -->
+
+ <bean id="org.hisp.dhis.dataadmin.action.locale.GetLocaleListAction"
+ class="org.hisp.dhis.dataadmin.action.locale.GetLocaleListAction"
+ scope="prototype" />
+
+ <bean id="org.hisp.dhis.dataadmin.action.locale.GetLocaleAction"
+ class="org.hisp.dhis.dataadmin.action.locale.GetLocaleAction"
+ scope="prototype" />
+
+ <bean id="org.hisp.dhis.dataadmin.action.locale.AddLocaleAction"
+ class="org.hisp.dhis.dataadmin.action.locale.AddLocaleAction"
+ scope="prototype" />
+
+ <bean id="org.hisp.dhis.dataadmin.action.locale.RemoveLocaleAction"
+ class="org.hisp.dhis.dataadmin.action.locale.RemoveLocaleAction"
+ scope="prototype" />
+
+ <bean id="org.hisp.dhis.dataadmin.action.locale.ShowAddLocaleFormAction"
+ class="org.hisp.dhis.dataadmin.action.locale.ShowAddLocaleFormAction"
+ scope="prototype" />
+
+ <bean id="org.hisp.dhis.dataadmin.action.locale.ValidateLocaleAction"
+ class="org.hisp.dhis.dataadmin.action.locale.ValidateLocaleAction"
+ scope="prototype" />
+
<!-- Duplicate data elimination -->
<bean id="org.hisp.dhis.dataadmin.action.duplicatedataelimination.EliminateDuplicateDataAction"
=== 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 2013-09-24 07:05:03 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2013-09-25 09:43:22 +0000
@@ -91,6 +91,7 @@
intro_patient_data_archive=Archive person data which is not currently relevant to your system. Data can also be unarchived.
intro_maintenance=Perform maintenance tasks such as pruning of data values and periods and clearing of database resource tables.
intro_resource_table=Generate resource database tables for the organisation unit hierarchy and group set structure among others.
+intro_locale=Create, manage locales.
intro_organisation_unit_merge=Merge two organisation units and their data values. Data is merged depending on existence and date of last modification.
intro_data_statistics=Browse the number of objects in the database, like data elements, indicators, data sets and data values.
intro_cache_statistics=Monitor and clear the system database cache status. Provides information on object and query caches.
@@ -322,4 +323,18 @@
period_structure=Period structure
data_element_category_option_combo=Data element category option combinations
update_category_option_combos=Update category option combinations
-date_period_structure=Date period structure
\ No newline at end of file
+date_period_structure=Date period structure
+
+#-- The locale management page ------------------------------------------------------#
+locale=Locale
+locale_management=Locale Management
+create_new_locale=Create New Locale
+locale_details=Locale Details
+edit_locale=Edit Locale
+confirm_delete_locale=Are you sure you want to delete this locale?
+language=Language
+country=Country
+locale_language_no_translation=Please select a language
+locale_country_no_translation=Please select a country
+
+
=== 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 2013-09-03 19:11:14 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2013-09-14 11:24:50 +0000
@@ -44,6 +44,79 @@
<param name="requiredAuthorities">F_PERFORM_MAINTENANCE</param>
</action>
+ <action name="generateResourceTable" class="org.hisp.dhis.dataadmin.action.resourcetable.GenerateResourceTableAction">
+ <result name="success" type="velocity-xml">/dhis-web-maintenance-dataadmin/responseSuccess.vm</result>
+ <param name="requiredAuthorities">F_PERFORM_MAINTENANCE</param>
+ </action>
+
+ <!-- Locale -->
+
+ <action name="locale"
+ class="org.hisp.dhis.dataadmin.action.locale.GetLocaleListAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-dataadmin/localeList.vm</param>
+ <param name="menu">/dhis-web-maintenance-dataadmin/menu.vm</param>
+ <param name="javascripts">javascript/locale.js</param>
+ <param name="requiredAuthorities">F_LOCALE_MANAGEMENT</param>
+ </action>
+
+
+ <action name="getLocale"
+ class="org.hisp.dhis.dataadmin.action.locale.GetLocaleAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-maintenance-dataadmin/jsonLocale.vm
+ </result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
+
+ <action name="removeLocale"
+ class="org.hisp.dhis.dataadmin.action.locale.RemoveLocaleAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm
+ </result>
+ <result name="error" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseError.vm
+ </result>
+ <param name="requiredAuthorities">F_LOCALE_DELETE</param>
+ </action>
+
+ <action name="addLocale"
+ class="org.hisp.dhis.dataadmin.action.locale.AddLocaleAction">
+ <result name="success" type="redirect">locale.action
+ </result>
+ <param name="requiredAuthorities">F_LOCALE_ADD</param>
+ </action>
+
+ <action name="showAddLocaleForm"
+ class="org.hisp.dhis.dataadmin.action.locale.ShowAddLocaleFormAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-dataadmin/addLocaleForm.vm</param>
+ <param name="javascripts">javascript/localeForm.js</param>
+ <param name="requiredAuthorities">F_LOCALE_ADD</param>
+ </action>
+
+ <action name="showUpdateLocaleForm"
+ class="org.hisp.dhis.dataadmin.action.locale.ShowUpdateLocaleFormAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-dataadmin/updateLocaleForm.vm</param>
+ <param name="javascripts">javascript/localeForm.js</param>
+ <param name="requiredAuthorities">F_LOCALE_UPDATE</param>
+ </action>
+
+ <action name="updateLocale"
+ class="org.hisp.dhis.dataadmin.action.locale.UpdateLocaleAction">
+ <result name="success" type="redirect">locale.action
+ </result>
+ <param name="requiredAuthorities">F_LOCALE_UPDATE</param>
+ </action>
+
+ <action name="validateLocale" class="org.hisp.dhis.dataadmin.action.locale.ValidateLocaleAction">
+ <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
<!-- Cache -->
<action name="showCache" class="org.hisp.dhis.dataadmin.action.cache.ShowCacheAction">
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addLocaleForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addLocaleForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addLocaleForm.vm 2013-10-01 16:44:42 +0000
@@ -0,0 +1,45 @@
+<h3>$i18n.getString( "create_new_locale" )</h3>
+
+<form id="addLocaleForm" name="addLocaleForm" action="addLocale.action" method="post" class="inputForm">
+
+<table>
+ <thead>
+ <tr>
+ <th colspan="2">$i18n.getString( "locale_details" )</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ <tr>
+ <td><label>$i18n.getString( "language" ) </label></td>
+ <td>
+ <select id="language" name="language" onchange="setName()" class="{validate:{required:true}}">
+ <option value="">[$i18n.getString( "locale_language_no_translation" )]</option>
+ #foreach( $language in $availableLanguages.entrySet() )
+ <option value="$language.value">$language.key</option>
+ #end
+ </select>
+ </td>
+ <td></td>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "country" ) </label></td>
+ <td>
+ <select id="country" name="country" onchange="setName()">
+ #foreach( $country in $availableCountries.entrySet() )
+ <option value="$country.value">$country.key</option>
+ #end
+ </select>
+ </td>
+ <td></td>
+ </tr>
+ <tbody>
+</table>
+
+
+<p>
+ <input type="submit" name="save" value="$i18n.getString( 'add' )" style="width: 10em;" />
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='locale.action'" style="width: 10em;" />
+</p>
+
+</form>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/index.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/index.vm 2013-08-16 12:29:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/index.vm 2013-08-22 16:02:45 +0000
@@ -5,6 +5,7 @@
#introListImgItem( "displayDataIntegrityForm.action" "data_integrity" "dataintegrity" )
#introListImgItem( "displayMaintenanceForm.action" "maintenance" "maintenance" )
#introListImgItem( "displayResourceTableForm.action" "resource_table" "resourcetable" )
+ #introListImgItem( "locale.action" "locale" "datadictionary" )
#introListImgItem( "showSqlViewListForm.action" "sql_view" "sqlview" )
#introListImgItem( "displayOrganisationUnitMergeForm.action" "organisation_unit_merge" "organisationunitmerge" )
#introListImgItem( "displayDuplicateDataEliminationForm.action" "duplicate_data_elimination" "duplicatedataelimination" )
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/jsonLocale.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/jsonLocale.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/jsonLocale.vm 2013-09-25 08:46:13 +0000
@@ -0,0 +1,7 @@
+{ "i18nLocale":
+ {
+ "id": "${i18nLocale.id}",
+ "name": "$!encoder.jsonEncode( ${i18nLocale.name} )",
+ "locale": "$!encoder.jsonEncode( ${i18nLocale.locale} )"
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/localeList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/localeList.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/localeList.vm 2013-09-25 08:46:13 +0000
@@ -0,0 +1,77 @@
+<script type="text/javascript">
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_locale" ) , "'" )';
+ //var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ), "'")';
+ //var i18n_yes = '$encoder.jsEscape( $i18n.getString( "yes" ) , "'" )';
+ //var i18n_no = '$encoder.jsEscape( $i18n.getString( "no" ), "'")';
+
+</script>
+
+<h3>$i18n.getString( "locale_management" ) #openHelp( "locale" )</h3>
+
+<table class="mainPageTable">
+ <tr>
+ <td>
+ <table width="100%">
+ <tr valign="bottom">
+ <td>#filterDiv( "locale" )</td>
+ <td> </td>
+ <td align="right"><input type="button" value="$i18n.getString( "add_new" )" onclick="window.location.href='showAddLocaleForm.action'" style="width:70px"></td>
+ </tr>
+ </table>
+ </td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td style="vertical-align:top">
+
+ <table class="listTable" id="listTable">
+ <col />
+ <col width="100" />
+ <thead>
+ <tr>
+ <th>$i18n.getString( "name" )</th>
+ <th class="{sorter: false}">$i18n.getString( "operations" )</th>
+ </tr>
+ </thead>
+ <tbody id="list">
+ #foreach( $i18nLocale in $i18nLocales )
+ <tr id="tr${i18nLocale.id}">
+
+ <td onclick="showLocaleDetails( $i18nLocale.id )">$encoder.htmlEncode( $i18nLocale.name )</td>
+
+ <td style="text-align:center">
+ <a href="javascript:removeLocale( $i18nLocale.id, '$encoder.jsEncode( $i18nLocale.name )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
+ <a href="javascript:showLocaleDetails( $i18nLocale.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
+ </td>
+
+ </tr>
+ #end
+
+ </tbody>
+ </table>
+ <p></p>
+ #parse( "/dhis-web-commons/paging/paging.vm" )
+ </td>
+
+
+ <td style="width:20em; padding-left:2em; vertical-align:top">
+
+ <div id="detailsArea" style="display:none">
+ <div style="float:right">
+ <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"/></a>
+ </div>
+ <p><label>$i18n.getString( "name" ):</label><br/><span id="nameField"></span></p>
+ <p><label>$i18n.getString( "locale" ):</label><br/><span id="localeField"></span></p>
+ </div>
+
+ <div id="warningArea" style="position:fixed;right:10px;top:200px;display:none">
+ <div style="float:right">
+ <a href="javascript:hideWarning()" title="$i18n.getString( 'hide_warning' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_warning' )"/></a>
+ </div>
+ <p><span id="warningField"></span></p>
+ </div>
+ </td>
+
+ </tr>
+</table>
+
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/menu.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/menu.vm 2013-04-30 08:03:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/menu.vm 2013-06-19 09:11:45 +0000
@@ -6,6 +6,7 @@
<li><a href="displayDataIntegrityForm.action">$i18n.getString( "data_integrity" ) </a></li>
<li><a href="displayMaintenanceForm.action">$i18n.getString( "maintenance" ) </a></li>
<li><a href="displayResourceTableForm.action">$i18n.getString( "resource_table" ) </a></li>
+ <li><a href="locale.action">$i18n.getString( "locale" ) </a></li>
<li><a href="showSqlViewListForm.action">$i18n.getString( "sql_view" ) </a></li>
<li><a href="displayOrganisationUnitMergeForm.action">$i18n.getString( "organisation_unit_merge" ) </a></li>
<li><a href="displayDuplicateDataEliminationForm.action">$i18n.getString( "duplicate_data_elimination" ) </a></li>