changeset 989:e3301755bd3c

Improved the workflow for inserting new layer into the client. gnv/trunk@1178 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 08 Jun 2010 14:49:11 +0000
parents 556e16cc4da5
children 56b22bc68dfa
files gnv/ChangeLog gnv/src/main/resources/applicationMessages.properties gnv/src/main/resources/applicationMessages_en.properties gnv/src/main/webapp/scripts/olutils.jsp
diffstat 4 files changed, 39 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/gnv/ChangeLog	Tue Jun 08 13:57:05 2010 +0000
+++ b/gnv/ChangeLog	Tue Jun 08 14:49:11 2010 +0000
@@ -1,3 +1,16 @@
+2010-06-08  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties:
+	  Added localization for the message that will be displayed if no 
+	  layer where found.
+ 
+	* src/main/webapp/scripts/olutils.jsp: 
+	  Improved the workflow for inserting new layer into the client.
+	  If no layer are found using the given url an exceptionmessage will be
+	  displayed using an ext-window.
+	  Now it is also possible to add more than one layer at once.
+
 2010-06-08  Tim Englich  <tim.englich@intevation.de>
 
 	* src/main/webapp/scripts/layers.jsp: 
--- a/gnv/src/main/resources/applicationMessages.properties	Tue Jun 08 13:57:05 2010 +0000
+++ b/gnv/src/main/resources/applicationMessages.properties	Tue Jun 08 14:49:11 2010 +0000
@@ -140,6 +140,8 @@
 gnviewer.mapclient.wms.load.grid.title = Titel
 gnviewer.mapclient.wms.load.bt.text = Laden
 gnviewer.mapclient.wms.load.bt.tooltip = L\u00e4d das Capabilities Dokument vom angegebenen Server
+gnviewer.mapclient.wms.load.grid.error.title = Fehler
+gnviewer.mapclient.wms.load.grid.error.message = Unter der angegebenen Url konnten keine Layer ermittelt werden.
 gnviewer.mapclient.controls.nav.previous.title = Springt zum letzten Kartenausschnitt
 gnviewer.mapclient.controls.nav.next.title = Springt zum vorherigen Kartenausschnitt
 gnviewer.mapclient.controls.navigate.title = Verschieben der Karte
--- a/gnv/src/main/resources/applicationMessages_en.properties	Tue Jun 08 13:57:05 2010 +0000
+++ b/gnv/src/main/resources/applicationMessages_en.properties	Tue Jun 08 14:49:11 2010 +0000
@@ -138,8 +138,10 @@
 gnviewer.mapclient.wms.load.grid.title = Title
 gnviewer.mapclient.wms.load.bt.text = Load
 gnviewer.mapclient.wms.load.bt.tooltip = Load the Capabilities document from the given destination.
+gnviewer.mapclient.wms.load.grid.error.title = Error
+gnviewer.mapclient.wms.load.grid.error.message = No layer could be determined under the given url.
 gnviewer.mapclient.controls.nav.previous.title = Jumps to the last Mapview
 gnviewer.mapclient.controls.nav.next.title = Jumps to the last Mapview
 gnviewer.mapclient.controls.navigate.title = Moves the map
-gnviewer.mapclient.controls.zoombox.title = Zoom by clicking an moving the mouseto generate a bix
+gnviewer.mapclient.controls.zoombox.title = Zoom by clicking an moving the mouse to generate a box
 gnviewer.mapclient.controls.info.title = Identify features by clicking
\ No newline at end of file
--- a/gnv/src/main/webapp/scripts/olutils.jsp	Tue Jun 08 13:57:05 2010 +0000
+++ b/gnv/src/main/webapp/scripts/olutils.jsp	Tue Jun 08 14:49:11 2010 +0000
@@ -85,19 +85,23 @@
 
 
 function addLayer() {
-    var record = grid.getSelectionModel().getSelected();
-    
-    if (record) {
+    var records = grid.getSelectionModel().getSelections();
+    for (rec in records){
+       
+        var record = records[rec];
+        // TODO: Look for something better than object
+        if (typeof record == "object"){ 
         var copy = record.copy();
         copy.set("layer", record.get("layer"));
         copy.get("layer").mergeNewParams({
             format: "image/png",
             transparent: true
         });
-
+        copy.singletile = true;
         mapPanel.layers.add(copy);
-        mapPanel.map.zoomToExtent(OpenLayers.Bounds.fromArray(copy.get("llbbox")));
-    }
+        }
+     }
+
 }
 
 
@@ -113,6 +117,13 @@
     return newUrl;
 }
 
+function showWarning(){
+    if (store.data.length == 0){
+        Ext.MessageBox.alert("<bean:message key="gnviewer.mapclient.wms.load.grid.error.title"/>", '<bean:message key="gnviewer.mapclient.wms.load.grid.error.message"/>', grid);
+        return;
+    }
+}
+
 
 function updateCapabilities() {
     var ele = Ext.Element.get('capfield');
@@ -126,8 +137,10 @@
     store = new GeoExt.data.WMSCapabilitiesStore({
         url: url
     });
-    store.load();
-
+    store.load({
+        callback: showWarning
+    });
+    
     grid.destroy();
     grid = new Ext.grid.GridPanel({
         id: 'wmsgrid',

http://dive4elements.wald.intevation.org