← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3981: (GIS) Upgraded to Google Maps API v3.5 = no API key needed. API key panel removed from admin sett...

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 3981 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-06-22 11:08:54 +0300
message:
  (GIS) Upgraded to Google Maps API v3.5 = no API key needed. API key panel removed from admin settings window.
removed:
  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/webapp/dhis-web-mapping/jsGoogleKey.vm
modified:
  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/mapping/index.html
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/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
=== removed 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	2011-03-08 14:55:19 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapSystemSettingsAction.java	1970-01-01 00:00:00 +0000
@@ -1,76 +0,0 @@
-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;
-    }
-}

=== 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-06-22 05:50:46 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml	2011-06-22 07:36:16 +0000
@@ -40,12 +40,6 @@
         
         <!-- SystemSetting -->
 
-        <action name="getMapSystemSettings"
-            class="org.hisp.dhis.mapping.action.GetMapSystemSettingsAction">
-            <result name="success" type="velocity-javascript">
-                /dhis-web-mapping/jsGoogleKey.vm</result>
-        </action>
-
         <action name="setMapSystemSettings"
             class="org.hisp.dhis.mapping.action.SetMapSystemSettingsAction">
             <result name="success" type="velocity-json">

=== removed 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	2011-03-08 14:55:19 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsGoogleKey.vm	1970-01-01 00:00:00 +0000
@@ -1,1 +0,0 @@
-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-05-26 13:44:26 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/index.html	2011-06-22 07:36:16 +0000
@@ -86,8 +86,8 @@
         
         <!-- DHIS -->
         <script type="text/javascript" src="i18n.action"></script>
-        <script type="text/javascript">var G_NORMAL_MAP = null, G_HYBRID_MAP = null;</script>
-        <script type="text/javascript" src="getMapSystemSettings.action"></script>
+        <script type="text/javascript">window.google = null;</script>
+        <script src="http://maps.google.com/maps/api/js?v=3.5&amp;sensor=false";></script>        
         <script type="text/javascript" src="javascript/global.js"></script>
         <script type="text/javascript" src="javascript/index.js"></script>
 </body>

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js	2011-06-22 05:50:46 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js	2011-06-22 07:36:16 +0000
@@ -36,8 +36,8 @@
     window_width: 251,
     window_position_x: 55,
     window_position_y: 41,
-    adminwindow_collapsed: 77,
-    adminwindow_expanded_1: Ext.isChrome || (Ext.isWindows && Ext.isGecko) ? 171 : 166,
+    adminwindow_collapsed: 54,
+    adminwindow_expanded_1: Ext.isChrome || (Ext.isWindows && Ext.isGecko) ? 121 : 116,
     adminwindow_expanded_2: Ext.isChrome || (Ext.isWindows && Ext.isGecko) ? 145 : 143,
         
     

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js	2011-06-22 06:24:33 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js	2011-06-22 07:36:16 +0000
@@ -300,26 +300,20 @@
     G.vars.map.addLayer(symbolLayer);
     
     /* Init base layers */
-    if (G_NORMAL_MAP && G_HYBRID_MAP) {
-        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),
-            numZoomLevels: 21
-        });
-        
-        gm_normal.layerType = G.conf.map_layer_type_baselayer;
-        G.vars.map.addLayer(gm_normal);
-        
-        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),
-            numZoomLevels: 21
-        });
-        
-        gm_hybrid.layerType = G.conf.map_layer_type_baselayer;
-        G.vars.map.addLayer(gm_hybrid);
+    if (window.google) {
+        var gmap = new OpenLayers.Layer.Google(
+            "Google Streets", // the default
+            {numZoomLevels: 20, animationEnabled: false}
+        );        
+        gmap.layerType = G.conf.map_layer_type_baselayer;
+        G.vars.map.addLayer(gmap);
+        
+        var ghyb = new OpenLayers.Layer.Google(
+            "Google Hybrid",
+            {type: google.maps.MapTypeId.HYBRID, numZoomLevels: 20, animationEnabled: true}
+        );        
+        ghyb.layerType = G.conf.map_layer_type_baselayer;
+        G.vars.map.addLayer(ghyb);
     }
 	
     var osm = new OpenLayers.Layer.OSM.Osmarender("OpenStreetMap");
@@ -1622,84 +1616,6 @@
         minHeight: G.conf.adminwindow_collapsed,
         items: [
             {
-                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: {
-                        fn: function() {
-                            adminWindow.setHeight(G.conf.adminwindow_expanded_1);
-                        }
-                    },
-                    collapse: function() {
-                        adminWindow.setHeight(G.conf.adminwindow_collapsed);
-                    }
-                }
-            },
-            {
                 title: 'Date',
                 items: [
                     {
@@ -1754,7 +1670,7 @@
                 ],
                 listeners: {
                     expand: function() {
-                        adminWindow.setHeight(G.conf.adminwindow_expanded_2);
+                        adminWindow.setHeight(G.conf.adminwindow_expanded_1);
                     },
                     collapse: function() {
                         adminWindow.setHeight(G.conf.adminwindow_collapsed);
@@ -2651,6 +2567,8 @@
             'afterrender': function() {
                 G.util.setOpacityByLayerType(G.conf.map_layer_type_overlay, G.conf.defaultLayerOpacity);
                 G.util.setOpacityByLayerType(G.conf.map_layer_type_thematic, G.conf.defaultLayerOpacity);
+                symbolLayer.setOpacity(1);
+                
                 
                 var svg = document.getElementsByTagName('svg');