← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2802: (GIS) Removed pointless mapsource uniqueness for overlays.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 2802 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-02-02 17:37:25 +0100
message:
  (GIS) Removed pointless mapsource uniqueness for overlays.
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.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/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-01-25 22:15:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2011-02-02 16:34:41 +0000
@@ -107,6 +107,7 @@
         executeSql( "ALTER TABLE map DROP COLUMN longitude" );
         executeSql( "ALTER TABLE map DROP COLUMN latitude" );
         executeSql( "ALTER TABLE map DROP COLUMN zoom" );
+        executeSql( "ALTER TABLE maplayer DROP CONSTRAINT maplayer_mapsource_key" );
 
         // ---------------------------------------------------------------------
         // Update tables for dimensional model

=== 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	2010-11-15 16:26:51 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLayer.hbm.xml	2011-02-02 16:34:41 +0000
@@ -15,7 +15,7 @@
 		
 		<property name="type" column="type"/>
 	
-		<property name="mapSource" column="mapsource" unique="true"/>
+		<property name="mapSource" column="mapsource"/>
 		
 		<property name="layer" column="layer"/>
 		

=== 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-02-02 15:24:39 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js	2011-02-02 16:34:41 +0000
@@ -1610,50 +1610,34 @@
                         Ext.message.msg(false, G.i18n.form_is_not_complete);
                         return;
                     }
-					
-					Ext.Ajax.request({
-						url: G.conf.path_mapping + 'getMapLayersByType' + G.conf.type,
+                    
+                    Ext.Ajax.request({
+                        url: G.conf.path_mapping + 'addOrUpdateMapLayer' + G.conf.type,
                         method: 'POST',
-                        params: {type: 'overlay'},
+                        params: {name: mln, type: 'overlay', mapSource: mlmsf, fillColor: mlfc, fillOpacity: 1, strokeColor: mlsc, strokeWidth: mlsw},
                         success: function(r) {
-							var overlays = Ext.util.JSON.decode(r.responseText).mapLayers;
-							
-							for (var i = 0; i < overlays.length; i++) {
-								if (overlays[i].mapSource == mlmsf) {
-									Ext.message.msg(false, 'Map source <span class="x-msg-hl">' + mlmsf + '</span> ' + G.i18n.is_already_in_use);
-									return;
-								}
-							}
-							
-							Ext.Ajax.request({
-								url: G.conf.path_mapping + 'addOrUpdateMapLayer' + G.conf.type,
-								method: 'POST',
-								params: {name: mln, type: 'overlay', mapSource: mlmsf, fillColor: mlfc, fillOpacity: 1, strokeColor: mlsc, strokeWidth: mlsw},
-								success: function(r) {
-									Ext.message.msg(true, 'Overlay <span class="x-msg-hl">' + mln + '</span> ' + G.i18n.registered);
-									G.stores.overlay.load();
-									
-									if (G.vars.map.getLayersByName(mln).length) {
-										G.vars.map.getLayersByName(mln)[0].destroy();
-									}
-                                    
-									var overlay = G.util.createOverlay(mln, mlfc, 1, mlsc, mlsw,
-                                        G.conf.path_mapping + 'getGeoJsonFromFile.action?name=' + mlmsf);
-                                        
-                                    overlay.events.register('loadstart', null, G.func.loadStart);
-                                    overlay.events.register('loadend', null, G.func.loadEnd);
-                                    overlay.setOpacity(mlfo);
-                                    overlay.layerType = G.conf.map_layer_type_overlay;
-									
-									G.vars.map.addLayer(overlay);
-									G.vars.map.getLayersByName(mln)[0].setZIndex(G.conf.defaultLayerZIndex);
-									
-									Ext.getCmp('maplayername_tf').reset();
-									Ext.getCmp('maplayermapsourcefile_cb').clearValue();
-								}
-							});
-						}
-					});
+                            Ext.message.msg(true, 'Overlay <span class="x-msg-hl">' + mln + '</span> ' + G.i18n.registered);
+                            G.stores.overlay.load();
+                            
+                            if (G.vars.map.getLayersByName(mln).length) {
+                                G.vars.map.getLayersByName(mln)[0].destroy();
+                            }
+                            
+                            var overlay = G.util.createOverlay(mln, mlfc, 1, mlsc, mlsw,
+                                G.conf.path_mapping + 'getGeoJsonFromFile.action?name=' + mlmsf);
+                                
+                            overlay.events.register('loadstart', null, G.func.loadStart);
+                            overlay.events.register('loadend', null, G.func.loadEnd);
+                            overlay.setOpacity(mlfo);
+                            overlay.layerType = G.conf.map_layer_type_overlay;
+                            
+                            G.vars.map.addLayer(overlay);
+                            G.vars.map.getLayersByName(mln)[0].setZIndex(G.conf.defaultLayerZIndex);
+                            
+                            Ext.getCmp('maplayername_tf').reset();
+                            Ext.getCmp('maplayermapsourcefile_cb').clearValue();
+                        }
+                    });
                 }
             },
             {