← Back to team overview

dhis2-devs team mailing list archive

Re: [Branch ~dhis2-devs-core/dhis2/trunk] Rev 2987: (GIS) Google Maps API key now stored as system setting + GUI for adding new key + Key included dy...

 

This is very nice, check it out.. Google maps now default base layer, hybrid
maps available. Works on localhost, requires a key on a public domain which
can easily be obtained here: http://code.google.com/apis/maps/signup.html

<http://code.google.com/apis/maps/signup.html>

On Tue, Mar 8, 2011 at 4:45 PM, <noreply@xxxxxxxxxxxxx> wrote:

> Merge authors:
>  Jan Henrik Øverland (janhenrik-overland)
> ------------------------------------------------------------
> revno: 2987 [merge]
> committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
> branch nick: dhis2
> timestamp: Tue 2011-03-08 16:43:40 +0100
> message:
>  (GIS) Google Maps API key now stored as system setting + GUI for adding
> new key + Key included dynamically on page load.
> added:
>
>  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/DeleteMapSystemSettingsAction.java
>
>  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapSystemSettingsAction.java
>
>  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/SetMapSystemSettingsAction.java
>
>  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsGoogleKey.vm
> modified:
>
>  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
>
>  dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/SystemSettingManager.java
>
>  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapLegendSetByIndicatorAction.java
>
>  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/SetMapUserSettingsAction.java
>
>  dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml
>
>  dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties
>  dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml
>  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm
>
>  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html
>
>  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.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
>
> === modified file
> 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
> ---
> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
>        2011-02-28 15:46:58 +0000
> +++
> dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
>        2011-03-08 15:29:28 +0000
> @@ -108,6 +108,8 @@
>         executeSql( "DROP TABLE maporganisationunitrelation" );
>         executeSql( "ALTER TABLE mapview DROP COLUMN mapid" );
>         executeSql( "DROP TABLE map" );
> +        executeSql( "DELETE FROM systemsetting WHERE name = 'longitude'"
> );
> +        executeSql( "DELETE FROM systemsetting WHERE name = 'latitude'" );
>
>         executeSql( "ALTER TABLE map DROP CONSTRAINT
> fk_map_organisationunitid" );
>         executeSql( "ALTER TABLE map DROP COLUMN organisationunitid" );
>
> === modified file
> 'dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/SystemSettingManager.java'
> ---
> dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/SystemSettingManager.java
>     2011-02-18 20:20:07 +0000
> +++
> dhis-2/dhis-services/dhis-service-options/src/main/java/org/hisp/dhis/options/SystemSettingManager.java
>     2011-03-08 14:55:19 +0000
> @@ -48,8 +48,7 @@
>     final String KEY_REPORT_TEMPLATE_DIRECTORY = "reportTemplateDirectory";
>     final String KEY_MAX_NUMBER_OF_ATTEMPTS = "maxAttempts";
>     final String KEY_TIMEFRAME_MINUTES = "lockoutTimeframe";
> -    final String KEY_GIS_LONGITUDE = "longitude";
> -    final String KEY_GIS_LATITUDE = "latitude";
> +    final String KEY_GOOGLE_MAPS_API_KEY = "googleMapsAPIKey";
>     final String KEY_DISABLE_DATAENTRYFORM_WHEN_COMPLETED =
> "dataEntryFormCompleted";
>     final String KEY_FACTOR_OF_DEVIATION = "factorDeviation";
>     final String KEY_AGGREGATION_STRATEGY = "aggregationStrategy";
> @@ -63,14 +62,15 @@
>     final int DEFAULT_TIMEFRAME_MINUTES = 1;
>     final double DEFAULT_FACTOR_OF_DEVIATION = 2.0;
>
> +    final String DEFAULT_GOOGLE_MAPS_API_KEY =
> "ABQIAAAAut6AhySExnYIXm5s2OFIkxRKNzJ-_9njnryRTbvC6CtrS4sRvRREWnxwlZUa630pLuPf3nD9i4fq9w";
>     final String AGGREGATION_STRATEGY_REAL_TIME = "real_time";
>     final String AGGREGATION_STRATEGY_BATCH = "batch";
>     final String DEFAULT_AGGREGATION_STRATEGY =
> AGGREGATION_STRATEGY_REAL_TIME;
>     final int DEFAULT_COMPLETENESS_OFFSET = 15;
>
> -    void saveSystemSetting( String name, Serializable value );
> +    void saveSystemSetting( String name, Serializable value );
>
> -    Serializable getSystemSetting( String name );
> +    Serializable getSystemSetting( String name );
>
>     Serializable getSystemSetting( String name, Serializable defaultValue
> );
>
>
> === added file
> 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/DeleteMapSystemSettingsAction.java'
> ---
> dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/DeleteMapSystemSettingsAction.java
>      1970-01-01 00:00:00 +0000
> +++
> dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/DeleteMapSystemSettingsAction.java
>      2011-03-08 15:14:32 +0000
> @@ -0,0 +1,77 @@
> +package org.hisp.dhis.mapping.action;
> +
> +/*
> + * Copyright (c) 2004-2010, 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.options.SystemSettingManager;
> +
> +import com.opensymphony.xwork2.Action;
> +
> +/**
> + * @author Jan Henrik Overland
> + * @version $Id$
> + */
> +public class DeleteMapSystemSettingsAction
> +    implements Action
> +{
> +    //
> -------------------------------------------------------------------------
> +    // Dependencies
> +    //
> -------------------------------------------------------------------------
> +
> +    private SystemSettingManager systemSettingManager;
> +
> +    public void setSystemSettingManager( SystemSettingManager
> systemSettingManager )
> +    {
> +        this.systemSettingManager = systemSettingManager;
> +    }
> +
> +    //
> -------------------------------------------------------------------------
> +    // Input
> +    //
> -------------------------------------------------------------------------
> +
> +    private Boolean googleKey;
> +
> +    public void setGoogleKey( Boolean googleKey )
> +    {
> +        this.googleKey = googleKey;
> +    }
> +
> +    //
> -------------------------------------------------------------------------
> +    // Action implementation
> +    //
> -------------------------------------------------------------------------
> +
> +    public String execute()
> +        throws Exception
> +    {
> +        if ( googleKey == true )
> +        {
> +            systemSettingManager.deleteSystemSetting(
> SystemSettingManager.KEY_GOOGLE_MAPS_API_KEY );
> +        }
> +
> +        return SUCCESS;
> +    }
> +}
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapLegendSetByIndicatorAction.java'
> ---
> dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapLegendSetByIndicatorAction.java
>   2010-04-12 21:23:33 +0000
> +++
> dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapLegendSetByIndicatorAction.java
>   2011-03-07 20:53:01 +0000
> @@ -62,7 +62,7 @@
>     }
>
>     //
> -------------------------------------------------------------------------
> -    // Input
> +    // Output
>     //
> -------------------------------------------------------------------------
>
>     private MapLegendSet object;
>
> === added file
> 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapSystemSettingsAction.java'
> ---
> dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapSystemSettingsAction.java
> 1970-01-01 00:00:00 +0000
> +++
> dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapSystemSettingsAction.java
> 2011-03-08 14:55:19 +0000
> @@ -0,0 +1,76 @@
> +package org.hisp.dhis.mapping.action;
> +
> +/*
> + * Copyright (c) 2004-2010, 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.options.SystemSettingManager;
> +
> +import com.opensymphony.xwork2.Action;
> +
> +/**
> + * @author Jan Henrik Overland
> + * @version $Id$
> + */
> +public class GetMapSystemSettingsAction
> +    implements Action
> +{
> +    //
> -------------------------------------------------------------------------
> +    // Dependencies
> +    //
> -------------------------------------------------------------------------
> +
> +    private SystemSettingManager systemSettingManager;
> +
> +    public void setSystemSettingManager( SystemSettingManager
> systemSettingManager )
> +    {
> +        this.systemSettingManager = systemSettingManager;
> +    }
> +
> +    //
> -------------------------------------------------------------------------
> +    // Output
> +    //
> -------------------------------------------------------------------------
> +
> +    private String googleKey;
> +
> +    public String getGoogleKey()
> +    {
> +        return googleKey;
> +    }
> +
> +    //
> -------------------------------------------------------------------------
> +    // Action implementation
> +    //
> -------------------------------------------------------------------------
> +
> +    public String execute()
> +        throws Exception
> +    {
> +        googleKey = "<script src='
> http://maps.google.com/maps?file=api&amp;v=3&amp;sensor=false&amp;key=";
> +            + (String) systemSettingManager.getSystemSetting(
> SystemSettingManager.KEY_GOOGLE_MAPS_API_KEY,
> +                SystemSettingManager.DEFAULT_GOOGLE_MAPS_API_KEY ) + "'
> type='text/javascript'></script>";
> +
> +        return SUCCESS;
> +    }
> +}
>
> === added file
> 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/SetMapSystemSettingsAction.java'
> ---
> dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/SetMapSystemSettingsAction.java
> 1970-01-01 00:00:00 +0000
> +++
> dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/SetMapSystemSettingsAction.java
> 2011-03-08 14:55:19 +0000
> @@ -0,0 +1,77 @@
> +package org.hisp.dhis.mapping.action;
> +
> +/*
> + * Copyright (c) 2004-2010, 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.options.SystemSettingManager;
> +
> +import com.opensymphony.xwork2.Action;
> +
> +/**
> + * @author Jan Henrik Overland
> + * @version $Id$
> + */
> +public class SetMapSystemSettingsAction
> +    implements Action
> +{
> +    //
> -------------------------------------------------------------------------
> +    // Dependencies
> +    //
> -------------------------------------------------------------------------
> +
> +    private SystemSettingManager systemSettingManager;
> +
> +    public void setSystemSettingManager( SystemSettingManager
> systemSettingManager )
> +    {
> +        this.systemSettingManager = systemSettingManager;
> +    }
> +
> +    //
> -------------------------------------------------------------------------
> +    // Input
> +    //
> -------------------------------------------------------------------------
> +
> +    private String googleKey;
> +
> +    public void setGoogleKey( String googleKey )
> +    {
> +        this.googleKey = googleKey;
> +    }
> +
> +    //
> -------------------------------------------------------------------------
> +    // Action implementation
> +    //
> -------------------------------------------------------------------------
> +
> +    public String execute()
> +        throws Exception
> +    {
> +        if ( googleKey != null )
> +        {
> +            systemSettingManager.saveSystemSetting(
> SystemSettingManager.KEY_GOOGLE_MAPS_API_KEY, googleKey );
> +        }
> +
> +        return SUCCESS;
> +    }
> +}
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/SetMapUserSettingsAction.java'
> ---
> dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/SetMapUserSettingsAction.java
>   2010-11-15 16:26:51 +0000
> +++
> dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/SetMapUserSettingsAction.java
>   2011-03-08 10:15:50 +0000
> @@ -69,7 +69,10 @@
>     public String execute()
>         throws Exception
>     {
> -        userSettingService.saveUserSetting( KEY_MAP_DATE_TYPE, mapDateType
> );
> +        if ( mapDateType != null )
> +        {
> +            userSettingService.saveUserSetting( KEY_MAP_DATE_TYPE,
> mapDateType );
> +        }
>
>         return SUCCESS;
>     }
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml'
> ---
> dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml
> 2011-02-02 10:36:33 +0000
> +++
> dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml
> 2011-03-08 15:14:32 +0000
> @@ -61,6 +61,26 @@
>         scope="prototype">
>         <property name="userSettingService"
> ref="org.hisp.dhis.user.UserSettingService" />
>     </bean>
> +
> +    <!-- SystemSetting -->
> +
> +    <bean id="org.hisp.dhis.mapping.action.GetMapSystemSettingsAction"
> +        class="org.hisp.dhis.mapping.action.GetMapSystemSettingsAction"
> +        scope="prototype">
> +        <property name="systemSettingManager"
> ref="org.hisp.dhis.options.SystemSettingManager" />
> +    </bean>
> +
> +    <bean id="org.hisp.dhis.mapping.action.SetMapSystemSettingsAction"
> +        class="org.hisp.dhis.mapping.action.SetMapSystemSettingsAction"
> +        scope="prototype">
> +        <property name="systemSettingManager"
> ref="org.hisp.dhis.options.SystemSettingManager" />
> +    </bean>
> +
> +    <bean id="org.hisp.dhis.mapping.action.DeleteMapSystemSettingsAction"
> +        class="org.hisp.dhis.mapping.action.DeleteMapSystemSettingsAction"
> +        scope="prototype">
> +        <property name="systemSettingManager"
> ref="org.hisp.dhis.options.SystemSettingManager" />
> +    </bean>
>
>        <!-- Map values -->
>
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties'
> ---
> dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties
>    2011-02-25 19:04:17 +0000
> +++
> dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties
>    2011-03-07 20:53:01 +0000
> @@ -238,4 +238,5 @@
>  max                                                                    =
> max
>  characters                                                     =
> characters
>  geojson_file                                           = GeoJSON file
> -history                                                                =
> History
> \ No newline at end of file
> +history                                                                =
> History
> +api_key                                                                =
> API key
> \ No newline at end of file
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml'
> --- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml
>  2011-01-26 11:42:12 +0000
> +++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml
>  2011-03-08 15:14:32 +0000
> @@ -34,8 +34,28 @@
>
>         <action name="setMapUserSettings"
>             class="org.hisp.dhis.mapping.action.SetMapUserSettingsAction">
> -            <result name="success"
> type="velocity-json">/dhis-web-mapping/void.vm
> -            </result>
> +            <result name="success" type="velocity-json">
> +                /dhis-web-mapping/void.vm</result>
> +        </action>
> +
> +        <!-- SystemSetting -->
> +
> +        <action name="getMapSystemSettings"
> +
>  class="org.hisp.dhis.mapping.action.GetMapSystemSettingsAction">
> +            <result name="success" type="velocity-json">
> +                /dhis-web-mapping/jsGoogleKey.vm</result>
> +        </action>
> +
> +        <action name="setMapSystemSettings"
> +
>  class="org.hisp.dhis.mapping.action.SetMapSystemSettingsAction">
> +            <result name="success" type="velocity-json">
> +                /dhis-web-mapping/void.vm</result>
> +        </action>
> +
> +        <action name="deleteMapSystemSettings"
> +
>  class="org.hisp.dhis.mapping.action.DeleteMapSystemSettingsAction">
> +            <result name="success" type="velocity-json">
> +                /dhis-web-mapping/void.vm</result>
>         </action>
>
>                <!-- OrganisationUnit -->
> @@ -351,7 +371,7 @@
>
>                <!-- i18n -->
>
> -               <action name="i18nJavaScript"
> class="org.hisp.dhis.mapping.action.NoAction">
> +               <action name="i18n"
> class="org.hisp.dhis.mapping.action.NoAction">
>             <result name="success"
> type="velocity">/dhis-web-mapping/i18n.vm</result>
>                </action>
>
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm'
> ---
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm
> 2011-02-25 19:04:17 +0000
> +++
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm
> 2011-03-07 20:53:01 +0000
> @@ -240,5 +240,6 @@
>     max: '$encoder.jsEscape($i18n.getString( 'max' ) , "'")',
>     characters: '$encoder.jsEscape($i18n.getString( 'characters' ) , "'")',
>     geojson_file: '$encoder.jsEscape($i18n.getString( 'geojson_file' ) ,
> "'")',
> -    history: '$encoder.jsEscape($i18n.getString( 'history' ) , "'")'
> +    history: '$encoder.jsEscape($i18n.getString( 'history' ) , "'")',
> +    api_key: '$encoder.jsEscape($i18n.getString( 'api_key' ) , "'")'
>  };
> \ No newline at end of file
>
> === added file
> 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsGoogleKey.vm'
> ---
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsGoogleKey.vm
>    1970-01-01 00:00:00 +0000
> +++
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsGoogleKey.vm
>    2011-03-08 14:55:19 +0000
> @@ -0,0 +1,1 @@
> +document.write("$!encoder.jsonEncode( ${googleKey} )");
> \ No newline at end of file
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html'
> ---
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html
>        2011-03-03 14:42:07 +0000
> +++
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html
>        2011-03-08 14:55:19 +0000
> @@ -42,7 +42,7 @@
>
>     <div id="position">
>         <div id="mouseposition"></div>
> -    </div>
> +    </div>
>
>     <form id="exportForm" method="post">
>         <input type="hidden" id="titleField" name="title"/>
> @@ -64,7 +64,7 @@
>                <input type="hidden" id="imageFormat" name="imageFormat"/>
>     </form>
>
> -    <!-- JavaScript -->
> +    <!-- JavaScript -->
>
>         <!-- ExtJS -->
>         <script type="text/javascript"
> src="../resources/ext/adapter/ext/ext-base.js"></script>
> @@ -86,9 +86,6 @@
>             <!-- UX -->
>             <script type="text/javascript"
> src="../resources/openlayers-ux/newSelectFeature.js"></script>
>
> -               <!-- Google Maps API -->
> -               <script src="
> http://maps.google.com/maps?file=api&amp;v=3&amp;sensor=false&amp;key=ABQIAAAAut6AhySExnYIXm5s2OFIkxRKNzJ-_9njnryRTbvC6CtrS4sRvRREWnxwlZUa630pLuPf3nD9i4fq9w";
> type="text/javascript"></script>
> -
>         <!-- GeoExt -->
>         <script type="text/javascript"
> src="../resources/geoext/script/GeoExt.js"></script>
>
> @@ -96,7 +93,8 @@
>         <script type="text/javascript"
> src="../resources/mapfish/MapFish.js"></script>
>
>                <!-- DHIS -->
> -        <script type="text/javascript"
> src="i18nJavaScript.action"></script>
> +        <script type="text/javascript" src="i18n.action"></script>
> +        <script type="text/javascript"
> src="getMapSystemSettings.action"></script>
>         <script type="text/javascript" src="script/global.js"></script>
>         <script type="text/javascript" src="script/index.js"></script>
>  </body>
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js'
> ---
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js
>   2011-03-03 14:42:07 +0000
> +++
> dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js
>   2011-03-08 15:38:37 +0000
> @@ -8,8 +8,8 @@
>         controls: [new OpenLayers.Control.MouseToolbar()],
>         displayProjection: new OpenLayers.Projection("EPSG:4326")
>     });
> -
> -       G.vars.mask = new
> Ext.LoadMask(Ext.getBody(),{msg:G.i18n.loading,msgCls:'x-mask-loading2'});
> +
> +    G.vars.mask = new
> Ext.LoadMask(Ext.getBody(),{msg:G.i18n.loading,msgCls:'x-mask-loading2'});
>     G.vars.parameter = G.util.getUrlParam('view') ? {id:
> G.util.getUrlParam('view')} : {id: null};
>
>     Ext.Ajax.request({
> @@ -379,7 +379,7 @@
>     G.vars.map.addLayer(pointLayer);
>
>     /* Init base layers */
> -       var gm_normal = new OpenLayers.Layer.Google("GM Default", {
> +       var gm_normal = new OpenLayers.Layer.Google("Google Normal", {
>                type: G_NORMAL_MAP,
>                sphericalMercator: true,
>                maxExtent: new
> OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
> @@ -388,7 +388,7 @@
>        gm_normal.layerType = G.conf.map_layer_type_baselayer;
>        G.vars.map.addLayer(gm_normal);
>
> -       var gm_hybrid = new OpenLayers.Layer.Google("GM Hybrid", {
> +       var gm_hybrid = new OpenLayers.Layer.Google("Google Hybrid", {
>                type: G_HYBRID_MAP,
>                sphericalMercator: true,
>                maxExtent: new
> OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
> @@ -1391,6 +1391,7 @@
>             }
>         }
>     });
> +
>
>     /* Section: help */
>        function setHelpText(topic, tab) {
> @@ -1827,59 +1828,154 @@
>         layout: 'accordion',
>         closeAction: 'hide',
>         width: G.conf.window_width,
> -        height: 119,
> +        height: 145,
> +        minHeight: 77,
>         items: [
>             {
> -                xtype: 'form',
> -                title: 'Date type',
> -                bodyStyle: 'padding:8px',
> -                labelWidth: G.conf.label_width,
> +                title: 'Date',
>                 items: [
> -                    {html: '<div class="window-info">Set thematic map date
> type</div>'},
>                     {
> -                        xtype: 'combo',
> -                        id: 'mapdatetype_cb',
> -                        fieldLabel: G.i18n.date_type,
> -                        labelSeparator: G.conf.labelseparator,
> -                                               disabled:
> G.system.aggregationStrategy == G.conf.aggregation_strategy_batch,
> -                        editable: false,
> -                        valueField: 'value',
> -                        displayField: 'text',
> -                        mode: 'local',
> -                        value: G.conf.map_date_type_fixed,
> -                        triggerAction: 'all',
> -                        width: G.conf.combo_width_fieldset,
> -                        minListWidth: G.conf.combo_width_fieldset,
> -                        store: {
> -                            xtype: 'arraystore',
> -                            fields: ['value', 'text'],
> -                            data: [
> -                                [G.conf.map_date_type_fixed,
> G.i18n.fixed_periods],
> -                                [G.conf.map_date_type_start_end,
> G.i18n.start_end_dates]
> -                            ]
> -                        },
> -                        listeners: {
> -                            'select': function(cb) {
> -                                if (cb.getValue() !=
> G.vars.mapDateType.value) {
> -                                    G.vars.mapDateType.value =
> cb.getValue();
> -                                    Ext.Ajax.request({
> -                                        url: G.conf.path_mapping +
> 'setMapUserSettings' + G.conf.type,
> -                                        method: 'POST',
> -                                        params: {mapDateType:
> G.vars.mapDateType.value},
> -                                        success: function() {
> -                                            Ext.message.msg(true, '<span
> class="x-msg-hl">' + cb.getRawValue() + '</span> '+
> G.i18n.saved_as_date_type);
> -
>  choropleth.prepareMapViewDateType();
> -
>  symbol.prepareMapViewDateType();
> +                        xtype: 'form',
> +                        bodyStyle: 'padding:8px',
> +                        labelWidth: G.conf.label_width,
> +                        items: [
> +                            {html: '<div class="window-info">Set thematic
> map date type</div>'},
> +                            {
> +                                xtype: 'combo',
> +                                id: 'mapdatetype_cb',
> +                                fieldLabel: G.i18n.date_type,
> +                                labelSeparator: G.conf.labelseparator,
> +                                disabled: G.system.aggregationStrategy ===
> G.conf.aggregation_strategy_batch,
> +                                editable: false,
> +                                valueField: 'value',
> +                                displayField: 'text',
> +                                mode: 'local',
> +                                value: G.conf.map_date_type_fixed,
> +                                triggerAction: 'all',
> +                                width: G.conf.combo_width_fieldset,
> +                                minListWidth: G.conf.combo_width_fieldset,
> +                                store: {
> +                                    xtype: 'arraystore',
> +                                    fields: ['value', 'text'],
> +                                    data: [
> +                                        [G.conf.map_date_type_fixed,
> G.i18n.fixed_periods],
> +                                        [G.conf.map_date_type_start_end,
> G.i18n.start_end_dates]
> +                                    ]
> +                                },
> +                                listeners: {
> +                                    'select': function(cb) {
> +                                        if (cb.getValue() !==
> G.vars.mapDateType.value) {
> +                                            G.vars.mapDateType.value =
> cb.getValue();
> +                                            Ext.Ajax.request({
> +                                                url: G.conf.path_mapping +
> 'setMapUserSettings' + G.conf.type,
> +                                                method: 'POST',
> +                                                params: {mapDateType:
> G.vars.mapDateType.value},
> +                                                success: function() {
> +                                                    Ext.message.msg(true,
> '<span class="x-msg-hl">' + cb.getRawValue() + '</span> '+
> G.i18n.saved_as_date_type);
> +
>  choropleth.prepareMapViewDateType();
> +
>  symbol.prepareMapViewDateType();
> +                                                }
> +                                            });
>                                         }
> -                                    });
> +                                    }
>                                 }
>                             }
> -                        }
> -                    }
> -                ]
> -            }
> -        ]
> +                        ]
> +                    }
> +                ],
> +                listeners: {
> +                    expand: function() {
> +                        adminWindow.setHeight(Ext.isChrome ||
> (Ext.isWindows && Ext.isGecko) ? 145 : 143);
> +                    },
> +                    collapse: function() {
> +                        adminWindow.setHeight(77);
> +                    }
> +                }
> +            },
> +            {
> +                title: 'Google Maps',
> +                items: [
> +                    {
> +                        xtype: 'form',
> +                        bodyStyle: 'padding:8px',
> +                        labelWidth: G.conf.label_width,
> +                        items: [
> +                            {html: '<div class="window-info">Update Google
> Maps API key</div>'},
> +                            {
> +                                xtype: 'textfield',
> +                                id: 'googlemapsapikey_tf',
> +                                fieldLabel: G.i18n.api_key,
> +                                labelSeparator: G.conf.labelseparator,
> +                                width: G.conf.combo_width_fieldset,
> +                                minListWidth: G.conf.combo_width_fieldset
> +                            }
> +                        ]
> +                    },
> +                    {
> +                        xtype: 'form',
> +                        items: [
> +                            {
> +                                xtype: 'toolbar',
> +                                style: 'padding-top:4px',
> +                                items: [
> +                                    '->',
> +                                    {
> +                                        xtype: 'button',
> +                                        text: G.i18n.update,
> +                                        iconCls: 'icon-assign',
> +                                        handler: function() {
> +                                            if
> (!Ext.getCmp('googlemapsapikey_tf').getValue()) {
> +                                                Ext.message.msg(false,
> G.i18n.form_is_not_complete);
> +                                                return;
> +                                            }
> +
> +                                            Ext.Ajax.request({
> +                                                url: G.conf.path_mapping +
> 'setMapSystemSettings' + G.conf.type,
> +                                                method: 'POST',
> +                                                params: {googleKey:
> Ext.getCmp('googlemapsapikey_tf').getValue()},
> +                                                success: function(r) {
> +
>  window.location.reload();
> +                                                }
> +                                            });
> +                                        }
> +                                    },
> +                                    {
> +                                        xtype: 'button',
> +                                        text: 'Use localhost',
> +                                        iconCls: 'icon-remove',
> +                                        handler: function() {
> +                                            Ext.Ajax.request({
> +                                                url: G.conf.path_mapping +
> 'deleteMapSystemSettings' + G.conf.type,
> +                                                method: 'POST',
> +                                                params: {googleKey: true},
> +                                                success: function() {
> +
>  window.location.reload();
> +                                                }
> +                                            });
> +                                        }
> +                                    }
> +                                ]
> +                            }
> +                        ]
> +                    }
> +                ],
> +                listeners: {
> +                    expand: function() {
> +                        adminWindow.setHeight(Ext.isChrome ||
> (Ext.isWindows && Ext.isGecko) ? 169 : 166);
> +                    },
> +                    collapse: function() {
> +                        adminWindow.setHeight(77);
> +                    }
> +                }
> +            }
> +        ],
> +        listeners: {
> +            afterrender: function() {
> +                adminWindow.setHeight(Ext.isChrome || (Ext.isWindows &&
> Ext.isGecko) ? 145 : 143);
> +            }
> +        }
>     });
> +
>
>     var layerTree = new Ext.tree.TreePanel({
>         title: '<span class="panel-title">' + G.i18n.map_layers +
> '</span>',
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>

Follow ups

References