Mercurial > dive4elements > gnv-client
comparison 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 |
comparison
equal
deleted
inserted
replaced
988:556e16cc4da5 | 989:e3301755bd3c |
---|---|
83 function showInfo(evt) { | 83 function showInfo(evt) { |
84 } | 84 } |
85 | 85 |
86 | 86 |
87 function addLayer() { | 87 function addLayer() { |
88 var record = grid.getSelectionModel().getSelected(); | 88 var records = grid.getSelectionModel().getSelections(); |
89 | 89 for (rec in records){ |
90 if (record) { | 90 |
91 var record = records[rec]; | |
92 // TODO: Look for something better than object | |
93 if (typeof record == "object"){ | |
91 var copy = record.copy(); | 94 var copy = record.copy(); |
92 copy.set("layer", record.get("layer")); | 95 copy.set("layer", record.get("layer")); |
93 copy.get("layer").mergeNewParams({ | 96 copy.get("layer").mergeNewParams({ |
94 format: "image/png", | 97 format: "image/png", |
95 transparent: true | 98 transparent: true |
96 }); | 99 }); |
97 | 100 copy.singletile = true; |
98 mapPanel.layers.add(copy); | 101 mapPanel.layers.add(copy); |
99 mapPanel.map.zoomToExtent(OpenLayers.Bounds.fromArray(copy.get("llbbox"))); | 102 } |
100 } | 103 } |
104 | |
101 } | 105 } |
102 | 106 |
103 | 107 |
104 // this is just copied from OpenLayers.Util | 108 // this is just copied from OpenLayers.Util |
105 function urlAppend(url, paramStr) { | 109 function urlAppend(url, paramStr) { |
111 parts.length ? "&" + paramStr : "?" + paramStr); | 115 parts.length ? "&" + paramStr : "?" + paramStr); |
112 } | 116 } |
113 return newUrl; | 117 return newUrl; |
114 } | 118 } |
115 | 119 |
120 function showWarning(){ | |
121 if (store.data.length == 0){ | |
122 Ext.MessageBox.alert("<bean:message key="gnviewer.mapclient.wms.load.grid.error.title"/>", '<bean:message key="gnviewer.mapclient.wms.load.grid.error.message"/>', grid); | |
123 return; | |
124 } | |
125 } | |
126 | |
116 | 127 |
117 function updateCapabilities() { | 128 function updateCapabilities() { |
118 var ele = Ext.Element.get('capfield'); | 129 var ele = Ext.Element.get('capfield'); |
119 | 130 |
120 var url = ele.getValue(); | 131 var url = ele.getValue(); |
124 url = urlAppend(url, request); | 135 url = urlAppend(url, request); |
125 | 136 |
126 store = new GeoExt.data.WMSCapabilitiesStore({ | 137 store = new GeoExt.data.WMSCapabilitiesStore({ |
127 url: url | 138 url: url |
128 }); | 139 }); |
129 store.load(); | 140 store.load({ |
130 | 141 callback: showWarning |
142 }); | |
143 | |
131 grid.destroy(); | 144 grid.destroy(); |
132 grid = new Ext.grid.GridPanel({ | 145 grid = new Ext.grid.GridPanel({ |
133 id: 'wmsgrid', | 146 id: 'wmsgrid', |
134 collapsible: false, | 147 collapsible: false, |
135 split: false, | 148 split: false, |