Mercurial > dive4elements > gnv-client
diff gnv/src/main/webapp/scripts/olutils.jsp @ 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 | 42da41835b54 |
children | f55692e3e0ce |
line wrap: on
line diff
--- 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',