[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1909: (GIS) WMS layer management implemented.

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)

revision-diff.txt (36.9 KB)

···

------------------------------------------------------------
revno: 1909 [merge]
committer: Jan Henrik Overland <janhenrik.overland@gmail.com>
branch nick: trunk
timestamp: Wed 2010-05-26 19:51:34 +0200
message:
  (GIS) WMS layer management implemented.
added:
  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapLayersByTypeAction.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLayer.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingStore.java
  dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java
  dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java
  dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLayer.hbm.xml
  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapLayerAction.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/jsonMapLayers.vm
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/config.js
  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

To test the new functionality, use e.g.:

Name: Whatever1
URL: http://labs.metacarta.com/wms/vmap0
Layer: basic

and

Name: Whatever2
URL: [http://iridl.ldeo.columbia.edu/cgi-bin/wms/wms.pl?VERSION=1.1.1](http://iridl.ldeo.columbia.edu/cgi-bin/wms/wms.pl?VERSION=1.1.1)

Layer: Health Regional Africa Meningitis Meningitis Observed
···

On Wed, May 26, 2010 at 7:52 PM, noreply@launchpad.net wrote:

Merge authors:

Jan Henrik Øverland (janhenrik-overland)


revno: 1909 [merge]

committer: Jan Henrik Overland janhenrik.overland@gmail.com

branch nick: trunk

timestamp: Wed 2010-05-26 19:51:34 +0200

message:

(GIS) WMS layer management implemented.

added:

dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapLayersByTypeAction.java

modified:

dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLayer.java

dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java

dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingStore.java

dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java

dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java

dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLayer.hbm.xml

dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapLayerAction.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/jsonMapLayers.vm

dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/config.js

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-api/src/main/java/org/hisp/dhis/mapping/MapLayer.java’

— dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLayer.java 2010-04-12 21:23:33 +0000

+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLayer.java 2010-05-25 16:45:28 +0000

@@ -42,6 +42,8 @@

 private String mapSourceType;



 private String mapSource;
  • private String layer;

    private String fillColor;

@@ -55,13 +57,14 @@

 {

 }
  • public MapLayer( String name, String type, String mapSourceType, String mapSource, String fillColor,
  • public MapLayer( String name, String type, String mapSourceType, String mapSource, String layer, String fillColor,

    double fillOpacity, String strokeColor, int strokeWidth )
    

    {

    [this.name](http://this.name) = name;
    
    this.type = type;
    
    this.mapSourceType = mapSourceType;
    
    this.mapSource = mapSource;
    
  •    this.layer = layer;
    
       this.fillColor = fillColor;
    
       this.fillOpacity = fillOpacity;
    
       this.strokeColor = strokeColor;
    

@@ -155,6 +158,16 @@

     this.mapSource = mapSource;

 }
  • public String getLayer()

  • {

  •    return layer;
    
  • }

  • public void setLayer( String layer )

  • {

  •    this.layer = layer;
    
  • }

 public String getFillColor()

 {

     return fillColor;

=== modified file ‘dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java’

— dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2010-05-11 15:21:26 +0000

+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2010-05-25 16:45:28 +0000

@@ -394,7 +394,7 @@

 void updateMapLayer( MapLayer mapLayer );
  • void addOrUpdateMapLayer( String name, String type, String mapSource, String fillColor, double fillOpacity,
  • void addOrUpdateMapLayer( String name, String type, String mapSource, String layer, String fillColor, double fillOpacity,

    String strokeColor, int strokeWidth );
    

    void deleteMapLayer( MapLayer mapLayer );

@@ -402,6 +402,8 @@

 MapLayer getMapLayer( int id );



 MapLayer getMapLayerByName( String name );
  • Collection getMapLayersByType( String type );

    Collection getMapLayersByMapSourceType();

=== modified file ‘dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingStore.java’

— dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingStore.java 2010-04-12 21:23:33 +0000

+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingStore.java 2010-05-25 16:45:28 +0000

@@ -226,7 +226,7 @@

 MapLegendSet getMapLegendSet( int id );



 MapLegendSet getMapLegendSetByName( String name );
 Collection<MapLegendSet> getMapLegendSetsByType( String type );



 Collection<MapLegendSet> getAllMapLegendSets();

@@ -263,6 +263,8 @@

 MapLayer getMapLayerByName( String name );
  • Collection getMapLayersByType( String type );

 Collection<MapLayer> getMapLayersByMapSourceType( String mapSourceType );



 MapLayer getMapLayerByMapSource( String mapSource );

=== modified file ‘dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java’

— dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2010-05-11 15:21:26 +0000

+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2010-05-25 16:45:28 +0000

@@ -818,7 +818,7 @@

     mappingStore.updateMapLayer( mapLayer );

 }
  • public void addOrUpdateMapLayer( String name, String type, String mapSource, String fillColor, double fillOpacity,
  • public void addOrUpdateMapLayer( String name, String type, String mapSource, String layer, String fillColor, double fillOpacity,

    String strokeColor, int strokeWidth )
    

    {

    MapLayer mapLayer = mappingStore.getMapLayerByName( name );
    

@@ -832,6 +832,7 @@

         mapLayer.setType( type );

         mapLayer.setMapSourceType( mapSourceType );

         mapLayer.setMapSource( mapSource );
  •        mapLayer.setLayer( layer );
    
           mapLayer.setFillColor( fillColor );
    
           mapLayer.setFillOpacity( fillOpacity );
    
           mapLayer.setStrokeColor( strokeColor );
    

@@ -841,7 +842,7 @@

     }

     else

     {
  •        addMapLayer( new MapLayer( name, type, mapSourceType, mapSource, fillColor, fillOpacity, strokeColor,
    
  •        addMapLayer( new MapLayer( name, type, mapSourceType, mapSource, layer, fillColor, fillOpacity, strokeColor,
    
               strokeWidth ) );
    
       }
    

    }

@@ -860,6 +861,11 @@

 {

     return mappingStore.getMapLayerByName( name );

 }
  • public Collection getMapLayersByType( String type )

  • {

  •    return mappingStore.getMapLayersByType( type );
    
  • }

    public Collection getMapLayersByMapSourceType()

    {

=== modified file ‘dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java’

— dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java 2010-05-18 19:22:26 +0000

+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java 2010-05-25 16:45:28 +0000

@@ -458,6 +458,18 @@

     return (MapLayer) criteria.uniqueResult();

 }
  • @SuppressWarnings( “unchecked” )

  • public Collection getMapLayersByType( String type )

  • {

  •    Session session = sessionFactory.getCurrentSession();
    
  •    Criteria criteria = session.createCriteria( MapLayer.class );
    
  •    criteria.add( Restrictions.eq( "type", type ) );
    
  •    return criteria.list();
    
  • }

    @SuppressWarnings( “unchecked” )

    public Collection getMapLayersByMapSourceType( String mapSourceType )

=== modified file ‘dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLayer.hbm.xml’

— dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLayer.hbm.xml 2009-09-29 16:17:58 +0000

+++ dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLayer.hbm.xml 2010-05-25 16:45:28 +0000

@@ -19,6 +19,8 @@

            <property name="mapSource" column="mapsource" unique="true"/>
  •           <property name="layer" column="layer"/>
    
            <property name="fillColor" column="fillcolor"/>



            <property name="fillOpacity" column="fillopacity"/>

=== modified file ‘dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapLayerAction.java’

— dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapLayerAction.java 2010-04-12 21:23:33 +0000

+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapLayerAction.java 2010-05-25 16:45:28 +0000

@@ -74,6 +74,13 @@

     this.mapSource = mapSource;

 }
  • private String layer;

  • public void setLayer( String layer )

  • {

  •    this.layer = layer;
    
  • }

 private String fillColor;



 public void setFillColor( String fillColor )

@@ -108,7 +115,7 @@

 public String execute()

 {
  •    mappingService.addOrUpdateMapLayer( name, type, mapSource, fillColor, fillOpacity, strokeColor, strokeWidth );
    
  •    mappingService.addOrUpdateMapLayer( name, type, mapSource, layer, fillColor, fillOpacity, strokeColor, strokeWidth );
    
    
    
       return SUCCESS;
    

    }

=== added file ‘dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapLayersByTypeAction.java’

— dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapLayersByTypeAction.java 1970-01-01 00:00:00 +0000

+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapLayersByTypeAction.java 2010-05-25 16:45:28 +0000

@@ -0,0 +1,92 @@

+package org.hisp.dhis.mapping.action;

+/*

    • Copyright © 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 java.util.ArrayList;

+import java.util.Collections;

+import java.util.List;

+import org.hisp.dhis.mapping.MapLayer;

+import org.hisp.dhis.mapping.MappingService;

+import org.hisp.dhis.mapping.comparator.MapLayerNameComparator;

+import com.opensymphony.xwork2.Action;

+/**

    • @author Jan Henrik Overland
    • @version $Id$
  • */

+public class GetMapLayersByTypeAction

  • implements Action

+{

  • // -------------------------------------------------------------------------

  • // Dependencies

  • // -------------------------------------------------------------------------

  • private MappingService mappingService;

  • public void setMappingService( MappingService mappingService )

  • {

  •    this.mappingService = mappingService;
    
  • }

  • // -------------------------------------------------------------------------

  • // Input

  • // -------------------------------------------------------------------------

  • private String type;

  • public void setType( String type )

  • {

  •    this.type = type;
    
  • }

  • // -------------------------------------------------------------------------

  • // Output

  • // -------------------------------------------------------------------------

  • private List object;

  • public List getObject()

  • {

  •    return object;
    
  • }

  • // -------------------------------------------------------------------------

  • // Action implementation

  • // -------------------------------------------------------------------------

  • public String execute()

  • {

  •    object = new ArrayList<MapLayer>( mappingService.getMapLayersByType( type ) );
    
  •    Collections.sort( object, new MapLayerNameComparator() );
    
  •    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 2010-05-17 21:05:26 +0000

+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2010-05-25 16:45:28 +0000

@@ -255,6 +255,11 @@

            <property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />

    </bean>
  • <bean id=“org.hisp.dhis.mapping.action.GetMapLayersByTypeAction”

  •    class="org.hisp.dhis.mapping.action.GetMapLayersByTypeAction" scope="prototype">
    
  •    <property name="mappingService" ref="org.hisp.dhis.mapping.MappingService" />
    
    <!-- Indicator -->



    <bean id="org.hisp.dhis.mapping.action.GetAllIndicatorGroupsAction"

=== 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 2010-05-21 14:09:39 +0000

+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties 2010-05-26 17:48:44 +0000

@@ -32,7 +32,7 @@

ajax_request_failed = Ajax request failed

error = Error

component_init_not_complete = Component init not complete

-form_is_not_complete = Form is not complete.

+form_is_not_complete = Form is not complete

filter = Filter

assign_all = Assign all

auto_assign = Auto-assign

@@ -45,7 +45,7 @@

error_while_deleting_relation_map_and_oranisation_unit = Error while deleting relation between map and oranisation unit

remove_selected = Remove selected

remove_relation = Remove relation

-please_select_least_one_organisation_unit_in_the_list = Please select at least one organisation unit in the list.

+please_select_least_one_organisation_unit_in_the_list = Please select at least one organisation unit in the list

assign = Assign

organisation_units = Organisation Units

assigned_to = Assigned to

@@ -60,7 +60,7 @@

assigned = assigned

no = no

creating_map = Creating map…

-selected_period_level_no_data = The selected indicator, period and level returned no data.

+selected_period_level_no_data = The selected indicator, period and level returned no data

creating_choropleth = Creating choropleth…

assign_organisation_unit = Assign organisation unit

no_feature_selected = No feature selected

@@ -117,7 +117,7 @@

name_column = Name column

organisation_unit_level = Organisation unit level

map_source_file = Map source file

-please_enter_map_title = Please enter the map title.

+please_enter_map_title = Please enter the map title

please_render_map_fist = Please render the thematic map first

include_legend = Include legend

include_values = Include values

@@ -138,7 +138,7 @@

was_deleted = was deleted

new_map_view = New map view

there_is_already_a_map_view_called = There is already a map view called

-map_view_name_cannot_be_longer_than_25_characters = Map view name cannot be longer than 25 characters.

+map_view_name_cannot_be_longer_than_25_characters = Map view name cannot contain more than 25 characters

thematic_map_form_is_not_complete = Thematic map form is not complete

map_view_form_is_not_complete = Map view form is not complete.

save = Save

@@ -172,4 +172,13 @@

the_source_file = The source file

assign_to_indicators = Assign to indicators

selected_relations_removed = Selected relations removed

-the_source_file = The source file

\ No newline at end of file

+the_source_file = The source file

+delete_baselayer = Delete base layer

+please_select_a_baselayer = Please select a base layer

+baselayer = Base layer

+baselayers = Base layers

+url = URL

+layer = Layer

+new_baselayer = New base layer

+baselayer_form_is_not_complete = Base layer form is not complete

+baselayer_name_cannot_be_longer_than_25_characters = Base layer name cannot contain more than 25 characters

=== 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 2010-05-11 15:24:04 +0000

+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml 2010-05-25 16:45:28 +0000

@@ -285,6 +285,12 @@

                            /dhis-web-mapping/jsonMapLayers.vm</result>

            </action>
  •    <action name="getMapLayersByType"
    
  •        class="org.hisp.dhis.mapping.action.GetMapLayersByTypeAction">
    
  •        <result name="success" type="velocity-json">
    
  •            /dhis-web-mapping/jsonMapLayers.vm</result>
    
  •    </action>
    
            <!-- Indicator -->



            <action name="getAllIndicatorGroups"

=== 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 2010-05-12 18:58:00 +0000

+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm 2010-05-26 17:48:44 +0000

@@ -170,4 +170,13 @@

var i18n_there_is_already_a_map_called = ‘$encoder.jsEscape($i18n.getString( ‘there_is_already_a_map_called’ ) , "’")’;

var i18n_assign_to_indicators = ‘$encoder.jsEscape($i18n.getString( ‘assign_to_indicators’ ) , "’")’;

var i18n_selected_relations_removed = ‘$encoder.jsEscape($i18n.getString( ‘selected_relations_removed’ ) , "’")’;

-var i18n_the_source_file = ‘$encoder.jsEscape($i18n.getString( ‘the_source_file’ ) , "’")’;

\ No newline at end of file

+var i18n_the_source_file = ‘$encoder.jsEscape($i18n.getString( ‘the_source_file’ ) , "’")’;

+var i18n_delete_baselayer = ‘$encoder.jsEscape($i18n.getString( ‘delete_baselayer’ ) , "’")’;

+var i18n_please_select_a_baselayer = ‘$encoder.jsEscape($i18n.getString( ‘please_select_a_baselayer’ ) , "’")’;

+var i18n_baselayer = ‘$encoder.jsEscape($i18n.getString( ‘baselayer’ ) , "’")’;

+var i18n_baselayers = ‘$encoder.jsEscape($i18n.getString( ‘baselayers’ ) , "’")’;

+var i18n_url = ‘$encoder.jsEscape($i18n.getString( ‘url’ ) , "’")’;

+var i18n_layer = ‘$encoder.jsEscape($i18n.getString( ‘layer’ ) , "’")’;

+var i18n_new_baselayer = ‘$encoder.jsEscape($i18n.getString( ‘new_baselayer’ ) , "’")’;

+var i18n_baselayer_form_is_not_complete = ‘$encoder.jsEscape($i18n.getString( ‘baselayer_form_is_not_complete’ ) , "’")’;

+var i18n_baselayer_name_cannot_be_longer_than_25_characters = ‘$encoder.jsEscape($i18n.getString( ‘baselayer_name_cannot_be_longer_than_25_characters’ ) , "’")’;

=== modified file ‘dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLayers.vm’

— dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLayers.vm 2009-08-26 01:56:03 +0000

+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonMapLayers.vm 2010-05-25 16:45:28 +0000

@@ -6,6 +6,7 @@

 "name": "$!encoder.jsEncode( ${mapLayer.name} )",

 "type": "$!encoder.jsEncode( ${mapLayer.type} )",

 "mapSource": "$!encoder.jsEncode( ${mapLayer.mapSource} )",
  • “layer”: “$!encoder.jsEncode( ${mapLayer.layer} )”,

    “fillColor”: “$!encoder.jsEncode( ${mapLayer.fillColor} )”,

    “fillOpacity”: “$!{mapLayer.fillOpacity}”,

    “strokeColor”: “$!encoder.jsEncode( ${mapLayer.strokeColor} )”,

=== modified file ‘dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/config.js’

— dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/config.js 2010-04-28 11:32:52 +0000

+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/config.js 2010-05-25 16:45:28 +0000

@@ -57,4 +57,6 @@

    map_source_type_geojson = 'geojson';

    map_source_type_shapefile = 'shapefile';

    map_legend_type_automatic = 'automatic';
  •   map_legend_type_predefined = 'predefined';
    

\ No newline at end of file

  •   map_legend_type_predefined = 'predefined';
    
  • map_layer_type_baselayer = ‘baselayer’;

  • map_layer_type_overlay = ‘overlay’;

\ No newline at end of file

=== 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 2010-05-21 13:48:28 +0000

+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2010-05-26 17:48:44 +0000

@@ -60,9 +60,34 @@

 MAP = new OpenLayers.Map({controls:[new OpenLayers.Control.Navigation(),new OpenLayers.Control.ArgParser(),new OpenLayers.Control.Attribution()]});

    MASK = new Ext.LoadMask(Ext.getBody(),{msg:i18n_loading,msgCls:'x-mask-loading2'});
  • if (getUrlParam(‘view’)){PARAMETER=getUrlParam(‘view’);}

  •   var mapViewParam = PARAMETER ? PARAMETER : 0;
    
  • /* Base layers */

  • function addBaseLayersToMap() {

  •    Ext.Ajax.request({
    
  •        url: path + 'getMapLayersByType' + type,
    
  •        params: { type: map_layer_type_baselayer },
    
  •        method: 'POST',
    
  •        success: function(r) {
    
  •            var mapLayers = Ext.util.JSON.decode(r.responseText).mapLayers;
    
  •            for (var i = 0; i < mapLayers.length; i++) {
    
  •                MAP.addLayers([
    
  •                    new OpenLayers.Layer.WMS(
    
  •                        mapLayers[i].name,
    
  •                        mapLayers[i].mapSource,
    
  •                        {layers: mapLayers[i].layer}
    
  •                    )
    
  •                ]);
    
  •                MAP.layers[MAP.layers.length-1].setVisibility(false);
    
  •            }
    
  •        }
    
  •    });
    
  • }

  • addBaseLayersToMap();

  • /* Get map view parameter and apply to global variable */

  • if (getUrlParam(‘view’)){PARAMETER=getUrlParam(‘view’);}

  •   var mapViewParam = PARAMETER || 0;
    
    
    
      Ext.Ajax.request({
    
              url: path + 'getBaseCoordinate' + type,
    

@@ -123,7 +148,7 @@

                                    var c = Ext.getCmp('numClasses').getValue();

                                    var ca = Ext.getCmp('colorA_cf').getValue();

                                    var cb = Ext.getCmp('colorB_cf').getValue();
  •                                   var mlsid = Ext.getCmp('maplegendset_cb').getValue() ? Ext.getCmp('maplegendset_cb').getValue() : 0;
    
  •                                   var mlsid = Ext.getCmp('maplegendset_cb').getValue() || 0;
    
                                      var lon = MAP.getCenter().lon;
    
                                      var lat = MAP.getCenter().lat;
    
                                      var zoom = parseInt(MAP.getZoom());
    

@@ -1976,7 +2001,7 @@

            }

 });
  • /* Section: overlays */
  • /* Section: map layers */

    var wmsOverlayStore=new GeoExt.data.WMSCapabilitiesStore({url:path_geoserver+ows});

    var mapLayerNameTextField=new Ext.form.TextField({id:‘maplayername_tf’,emptyText:emptytext,hideLabel:true,width:combo_width});

    var mapLayerMapSourceFileComboBox=new Ext.form.ComboBox({id:‘maplayermapsourcefile_cb’,editable:false,displayField:‘name’,valueField:‘name’,emptyText:emptytext,hideLabel:true,width:combo_width,minListWidth:combo_width,triggerAction:‘all’,mode:‘remote’,store:geojsonStore});

@@ -2079,7 +2104,7 @@

    var mapLayerFillOpacityComboBox=new Ext.form.ComboBox({id:'maplayerfillopacity_cb',hideLabel:true,editable:true,valueField:'value',displayField:'value',mode:'local',triggerAction:'all',width:combo_number_width,minListWidth:combo_number_width,value:0.5,store:new Ext.data.SimpleStore({fields:['value'],data:[[0.0],[0.1],[0.2],[0.3],[0.4],[0.5],[0.6],[0.7],[0.8],[0.9],[1.0]]})});



    var mapLayerStrokeColorColorField=new Ext.ux.ColorField({id:'maplayerstrokecolor_cf',hideLabel:true,allowBlank:false,width:combo_width,value:'#222222'});

    var mapLayerStrokeWidthComboBox=new Ext.form.ComboBox({id:'maplayerstrokewidth_cb',hideLabel:true,editable:true,valueField:'value',displayField:'value',mode:'local',triggerAction:'all',width:combo_number_width,minListWidth:combo_number_width,value:2,store:new Ext.data.SimpleStore({fields:['value'],data:[[0],[1],[2],[3],[4]]})});
  •   var mapLayerStore=new Ext.data.JsonStore({url:path+'getAllMapLayers'+type,root:'mapLayers',fields:['id','name'],sortInfo:{field:'name',direction:'ASC'},autoLoad:true});
    
  •   var mapLayerStore=new Ext.data.JsonStore({url:path+'getMapLayersByType'+type,baseParams:{type:map_layer_type_overlay},root:'mapLayers',fields:['id','name'],sortInfo:{field:'name',direction:'ASC'},autoLoad:true});
    
    
    
      var mapLayerComboBox=new Ext.form.ComboBox({id:'maplayer_cb',typeAhead:true,editable:false,valueField:'id',displayField:'name',mode:'remote',forceSelection:true,triggerAction:'all',emptyText:emptytext,hideLabel:true,selectOnFocus:true,width:combo_width,minListWidth:combo_width,store:mapLayerStore});
    

    var deleteMapLayerButton = new Ext.Button({

@@ -2219,8 +2244,8 @@

     ]

 });
  •   var mapLayerWindow = new Ext.Window({
    
  •    id: 'maplayer_w',
    
  •   var overlaysWindow = new Ext.Window({
    
  •    id: 'overlays_w',
    
       title: '<span id="window-maplayer-title">'+i18n_overlays+'</span>',
    
              layout: 'fit',
    
       closeAction: 'hide',
    

@@ -2236,11 +2261,11 @@

             listeners: {

                 tabchange: function(panel, tab)

                 {
  •                    if ([tab.id](http://tab.id) == 'maplayer0') {
    
  •                                                   Ext.getCmp('maplayer_w').setHeight(390);
    
  •                    if ([tab.id](http://tab.id) == 'overlay0') {
    
  •                                                   Ext.getCmp('overlays_w').setHeight(395);
    
                       }
    
  •                    else if ([tab.id](http://tab.id) == 'maplayer1') {
    
  •                                                   Ext.getCmp('maplayer_w').setHeight(155);
    
  •                    else if ([tab.id](http://tab.id) == 'overlay1') {
    
  •                                                   Ext.getCmp('overlays_w').setHeight(151);
    
                       }
    
                   }
    
               },
    

@@ -2248,7 +2273,7 @@

             [

                 {

                     title: '<span class="panel-tab-title">'+i18n_new+'</span>',
  •                    id: 'maplayer0',
    
  •                    id: 'overlay0',
    
                       items:
    
                       [
    
                           newMapLayerPanel
    

@@ -2256,7 +2281,7 @@

                 },

                 {

                     title: '<span class="panel-tab-title">'+i18n_delete+'</span>',
  •                    id: 'maplayer1',
    
  •                    id: 'overlay1',
    
                       items:
    
                       [
    
                           deleteMapLayerPanel
    

@@ -2280,6 +2305,188 @@

                    }

            }

 });
  • var mapLayerBaseLayersNameTextField=new Ext.form.TextField({id:‘maplayerbaselayersname_tf’,emptyText:emptytext,hideLabel:true,width:combo_width});

  • var mapLayerBaseLayersUrlTextField=new Ext.form.TextField({id:‘maplayerbaselayersurl_tf’,emptyText:emptytext,hideLabel:true,width:combo_width});

  • var mapLayerBaseLayersLayerTextField=new Ext.form.TextField({id:‘maplayerbaselayerslayer_tf’,emptyText:emptytext,hideLabel:true,width:combo_width});

  • var mapLayerBaseLayerStore=new Ext.data.JsonStore({url:path+‘getMapLayersByType’+type,baseParams:{ type:map_layer_type_baselayer },root:‘mapLayers’,fields:[‘id’,‘name’],sortInfo:{field:‘name’,direction:‘ASC’},autoLoad:true});

  •   var mapLayerBaseLayerComboBox=new Ext.form.ComboBox({id:'maplayerbaselayers_cb',typeAhead:true,editable:false,valueField:'id',displayField:'name',mode:'remote',forceSelection:true,triggerAction:'all',emptyText:emptytext,hideLabel:true,selectOnFocus:true,width:combo_width,minListWidth:combo_width,store:mapLayerBaseLayerStore});
    
  • var deleteMapLayerBaseLayersButton = new Ext.Button({

  •    id: 'deletemaplayerbaselayers_b',
    
  •    text: i18n_delete_baselayer,
    
  •           cls: 'window-button',
    
  •    handler: function() {
    
  •        var ml = Ext.getCmp('maplayerbaselayers_cb').getValue();
    
  •        var mln = Ext.getCmp('maplayerbaselayers_cb').getRawValue();
    
  •        if (!ml) {
    
  •            Ext.messageRed.msg( i18n_delete_baselayer, i18n_please_select_a_baselayer );
    
  •            return;
    
  •        }
    
  •        Ext.Ajax.request({
    
  •            url: path + 'deleteMapLayer' + type,
    
  •            method: 'POST',
    
  •            params: { id: ml },
    
  •            success: function(r) {
    
  •                Ext.messageBlack.msg( i18n_delete_baselayer , i18n_baselayer + ' <span class="x-msg-hl">' + mln + '</span> '+i18n_was_deleted+'.');
    
  •                Ext.getCmp('maplayerbaselayers_cb').getStore().reload();
    
  •                Ext.getCmp('maplayerbaselayers_cb').reset();
    
  •                if (MAP.baseLayer && mln == [MAP.baseLayer.name](http://MAP.baseLayer.name)) {
    
  •                    Ext.Ajax.request({
    
  •                        url: path + 'getMapLayersByType' + type,
    
  •                        params: { type: map_layer_type_baselayer },
    
  •                        method: 'POST',
    
  •                        success: function(r) {
    
  •                            var mapLayers = Ext.util.JSON.decode(r.responseText).mapLayers;
    
  •                            for (var i = 0; i < mapLayers.length; i++) {
    
  •                                MAP.getLayersByName(mapLayers[i].name)[0].setVisibility(false);
    
  •                            }
    
  •                        },
    
  •                        failure: function() {
    
  •                            alert( 'Error: getMapLayersByType' );
    
  •                        }
    
  •                    });
    
  •                }
    
  •            },
    
  •            failure: function() {
    
  •                alert( 'Error: deleteMapLayer' );
    
  •            }
    
  •        });
    
  •        MAP.getLayersByName(mln)[0].destroy(false);
    
  •    }
    
  • });

  • var newMapLayerBaseLayersPanel = new Ext.form.FormPanel({

  •    id: 'newmaplayerbaselayers_p',
    
  •    items:
    
  •    [
    
  •        { html: '<div class="panel-fieldlabel-first">'+i18n_display_name+'</div>' }, mapLayerBaseLayersNameTextField,
    
  •        { html: '<div class="panel-fieldlabel">'+i18n_url+'</div>' }, mapLayerBaseLayersUrlTextField,
    
  •        { html: '<div class="panel-fieldlabel">'+i18n_layer+'</div>' }, mapLayerBaseLayersLayerTextField,
    
  •        {
    
  •                           xtype: 'button',
    
  •                           id: 'newmaplayerbaselayers_b',
    
  •                           text: 'Register new base layer',
    
  •                           cls: 'window-button',
    
  •                           handler: function() {
    
  •                                   var mlbn = Ext.getCmp('maplayerbaselayersname_tf').getValue();
    
  •                                   var mlbu = Ext.getCmp('maplayerbaselayersurl_tf').getValue();
    
  •                                   var mlbl = Ext.getCmp('maplayerbaselayerslayer_tf').getValue();
    
  •                                   if (!mlbn || !mlbu || !mlbl) {
    
  •                                           Ext.messageRed.msg( i18n_new_baselayer, i18n_baselayer_form_is_not_complete );
    
  •                                           return;
    
  •                                   }
    
  •                                   if (validateInput(mlbn) == false) {
    
  •                                           Ext.messageRed.msg( i18n_new_baselayer , i18n_baselayer_name_cannot_be_longer_than_25_characters );
    
  •                                           return;
    
  •                                   }
    
  •                                   Ext.Ajax.request({
    
  •                                           url: path + 'getMapLayersByType' + type,
    
  •                    params: { type: map_layer_type_baselayer },
    
  •                                           method: 'POST',
    
  •                                           success: function(r) {
    
  •                                                   var mapLayers = Ext.util.JSON.decode(r.responseText).mapLayers;
    
  •                                                   for (i in mapLayers) {
    
  •                                                           if (mapLayers[i].name == mlbn) {
    
  •                                                                   Ext.messageRed.msg( i18n_new_baselayer , i18n_name + ' <span class="x-msg-hl">' + mlbn + '</span> '+i18n_is_already_in_use+'.');
    
  •                                                                   return;
    
  •                                                           }
    
  •                                                   }
    
  •                                                   Ext.Ajax.request({
    
  •                                                           url: path + 'addOrUpdateMapLayer' + type,
    
  •                                                           method: 'POST',
    
  •                                                           params: { name: mlbn, type: map_layer_type_baselayer, mapSource: mlbu, layer: mlbl, fillColor: '', fillOpacity: 0, strokeColor: '', strokeWidth: 0 },
    
  •                                                           success: function(r) {
    
  •                                                                   Ext.messageBlack.msg( i18n_new_baselayer , 'The base layer <span class="x-msg-hl">' + mlbn + '</span> '+i18n_was_registered+'.');
    
  •                                                                   Ext.getCmp('maplayerbaselayers_cb').getStore().reload();
    
  •                                                                   MAP.addLayers([
    
  •                                    new OpenLayers.Layer.WMS(
    
  •                                        mlbn,
    
  •                                        mlbu,
    
  •                                        {layers: mlbl}
    
  •                                    )
    
  •                                ]);
    
  •                                                                   Ext.getCmp('maplayerbaselayersname_tf').reset();
    
  •                                                                   Ext.getCmp('maplayerbaselayersurl_tf').reset();
    
  •                                                                   Ext.getCmp('maplayerbaselayerslayer_tf').reset();
    
  •                                                           },
    
  •                                                           failure: function() {}
    
  •                                                   });
    
  •                                           },
    
  •                                           failure: function() {}
    
  •                                   });
    
  •                           }
    
  •                   }
    
  •    ]
    
  • });

  • var deleteMapLayerBaseLayerPanel = new Ext.form.FormPanel({

  •    id: 'deletemaplayerbaselayer_p',
    
  •    items:
    
  •    [
    
  •        { html: '<div class="panel-fieldlabel-first">'+i18n_baselayers+'</div>' }, mapLayerBaseLayerComboBox,
    
  •        deleteMapLayerBaseLayersButton
    
  •    ]
    
  • });

  • var baselayersWindow = new Ext.Window({

  •    id: 'baselayers_w',
    
  •    title: '<span id="window-maplayer-title">'+i18n_baselayers+'</span>',
    
  •           layout: 'fit',
    
  •    closeAction: 'hide',
    
  •           width: 234,
    
  •    items:
    
  •    [
    
  •                   {
    
  •            xtype: 'tabpanel',
    
  •            activeTab: 0,
    
  •            deferredRender: false,
    
  •            plain: true,
    
  •            defaults: {layout: 'fit', bodyStyle: 'padding:8px'},
    
  •            listeners: {
    
  •                tabchange: function(panel, tab)
    
  •                {
    
  •                    if ([tab.id](http://tab.id) == 'baselayer0') {
    
  •                                                   Ext.getCmp('baselayers_w').setHeight(247);
    
  •                    }
    
  •                    else if ([tab.id](http://tab.id) == 'baselayer1') {
    
  •                                                   Ext.getCmp('baselayers_w').setHeight(151);
    
  •                    }
    
  •                }
    
  •            },
    
  •            items:
    
  •            [
    
  •                {
    
  •                    title: '<span class="panel-tab-title">'+i18n_new+'</span>',
    
  •                    id: 'baselayer0',
    
  •                    items:
    
  •                    [
    
  •                        newMapLayerBaseLayersPanel
    
  •                    ]
    
  •                },
    
  •                {
    
  •                    title: '<span class="panel-tab-title">'+i18n_delete+'</span>',
    
  •                    id: 'baselayer1',
    
  •                    items:
    
  •                    [
    
  •                        deleteMapLayerBaseLayerPanel
    
  •                    ]
    
  •                }
    
  •            ]
    
  •        }
    
  •    ]
    
  • });

    /* Section: administrator */

    var adminPanel = new Ext.form.FormPanel({

@@ -2517,12 +2724,6 @@

 });



    /* Section: layers */
  •   var vmap0 = new OpenLayers.Layer.WMS(
    
  •    'World',
    
  •    '[http://labs.metacarta.com/wms/vmap0](http://labs.metacarta.com/wms/vmap0)',
    
  •    {layers: 'basic'}
    
  • );

 var choroplethLayer = new OpenLayers.Layer.Vector('Thematic map', {

     'visibility': false,

     'displayInLayerSwitcher': false,

@@ -2539,14 +2740,13 @@

     })

 });
  • MAP.addLayers([ vmap0, choroplethLayer ]);

  •   MAP.layers[0].setVisibility(false);
    
  • MAP.addLayers([ choroplethLayer ]);

    function addOverlaysToMap() {

           Ext.Ajax.request({
    
  •                   url: path + 'getAllMapLayers' + type,
    
  •                   method: 'GET',
    
  •                   url: path + 'getMapLayersByType' + type,
    
  •        params: { type: map_layer_type_overlay },
    
  •                   method: 'POST',
    
                      success: function(r) {
    
                              var mapLayers = Ext.util.JSON.decode(r.responseText).mapLayers;
    

@@ -2598,7 +2798,7 @@

     nodeType: 'gx_baselayercontainer',

     singleClickExpand: true,

     expanded: true,
  •    text: 'Backgrounds',
    
  •    text: 'Base layers',
    
              iconCls: 'icon-background'
    

    }, {

       nodeType: 'gx_overlaylayercontainer',
    

@@ -2623,14 +2823,26 @@

                    [

                            {

                                    xtype: 'button',
  •                                   id: 'baselayers_b',
    
  •                                   text: 'Base layers',
    
  •                                   cls: 'x-btn-text-icon',
    
  •                                   ctCls: 'aa_med',
    
  •                                   icon: '../../images/add_small.png',
    
  •                                   handler: function() {
    
  •                    Ext.getCmp('baselayers_w').setPagePosition(Ext.getCmp('east').x - 262, Ext.getCmp('center').y + 50);
    
  •                                           Ext.getCmp('baselayers_w').show();
    
  •                                   }
    
  •                           },
    
  •            {
    
  •                                   xtype: 'button',
    
                                      id: 'overlays_b',
    
                                      text: 'Overlays',
    
                                      cls: 'x-btn-text-icon',
    
                                      ctCls: 'aa_med',
    
                                      icon: '../../images/add_small.png',
    
                                      handler: function() {
    
  •                    Ext.getCmp('maplayer_w').setPagePosition(Ext.getCmp('east').x - 262, Ext.getCmp('center').y + 50);
    
  •                                           Ext.getCmp('maplayer_w').show();
    
  •                    Ext.getCmp('overlays_w').setPagePosition(Ext.getCmp('east').x - 262, Ext.getCmp('center').y + 50);
    
  •                                           Ext.getCmp('overlays_w').show();
    
                                      }
    
                              }
    
                      ]
    

@@ -3031,12 +3243,19 @@

     div: $('mouseposition'),

     prefix: '<span style="color:#666;">x: &nbsp;</span>',

     separator: '<br/><span style="color:#666;">y: &nbsp;</span>'
  • }));

  • }));

  • var vmap0 = new OpenLayers.Layer.WMS(

  •    "World",
    
  •    "[http://labs.metacarta.com/wms/vmap0](http://labs.metacarta.com/wms/vmap0)",
    
  •    {layers: "basic"}
    
  • );

 MAP.addControl(new OpenLayers.Control.OverviewMap({

     div: $('overviewmap'),

     size: new OpenLayers.Size(188, 97),
  •    minRectSize: 0
    
  •    minRectSize: 0,
    
  •    layers: [vmap0]
    

    }));

    MAP.addControl(new OpenLayers.Control.ZoomBox());

@@ -3045,7 +3264,7 @@

    MAP.events.on({

     changelayer: function(e) {
  •        if (e.property == 'visibility' && e.layer != choroplethLayer && e.layer != vmap0) {
    
  •        if (e.property == 'visibility' && e.layer != choroplethLayer ) {
    
               if (e.layer.visibility) {
    
                   selectFeatureChoropleth.deactivate();
    
               }
    

Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp