[Commits] r2279 - in sandbox/mapgears/geoext.ux/ux/WMSBrowser: examples examples/data lib/GeoExt.ux lib/GeoExt.ux/plugins lib/GeoExt.ux/widgets resources/lang

commits at geoext.org commits at geoext.org
Tue Aug 24 15:40:45 CEST 2010


Author: adube
Date: 2010-08-24 15:40:45 +0200 (Tue, 24 Aug 2010)
New Revision: 2279

Added:
   sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserWithStatusBar.html
   sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/data/dev4g.mapgears.com_cgi-bin_mswms_gmap_incompatible_srs.xml
   sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/plugins/
   sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/plugins/WMSBrowserAlerts.js
   sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/widgets/WMSBrowserStatusBar.js
Removed:
   sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserExample.html
   sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserExample.js
Modified:
   sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserInWindowExample.html
   sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserInWindowExample.js
   sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/store.js
   sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/SingleFile.js
   sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/widgets/WMSBrowser.js
   sandbox/mapgears/geoext.ux/ux/WMSBrowser/resources/lang/fr.js
Log:
#242 WMSBrowser, fixes applied (see comment 3 in ticket)

Deleted: sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserExample.html
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserExample.html	2010-08-21 13:04:23 UTC (rev 2278)
+++ sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserExample.html	2010-08-24 13:40:45 UTC (rev 2279)
@@ -1,52 +0,0 @@
-<html>
-    <head>
-        <title>WMSBrowser Example</title>
-        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-        <!-- ext version 3.1.0 -->
-        <script type="text/javascript" src="../../../../ext/adapter/ext/ext-base.js"></script>
-        <script type="text/javascript" src="../../../../ext/ext-all.js"></script>
-        <link rel="stylesheet" type="text/css" href="../../../../ext/resources/css/ext-all.css" />
-        <link rel="stylesheet" type="text/css" href="../../../../ext/examples/shared/examples.css" />
-
-        <!-- openlayers version trunk -->
-        <script type="text/javascript" src="../../../../openlayers/lib/OpenLayers.js"></script>
-        <script type="text/javascript" src="../../../../openlayers/lib/OpenLayers/Lang/fr.js"></script>
-        <script type="text/javascript" src="../resources/lang/fr.js"></script>
-        <script type="text/javascript" src="../../../../geoext/lib/GeoExt.js"></script>
-        
-        <link rel="stylesheet" type="text/css" href="../resources/css/WMSBrowser.css" />
-        <script type="text/javascript" src="../lib/GeoExt.ux/SingleFile.js"></script>
-
-        <script type="text/javascript" src="./store.js"></script>        
-        <script type="text/javascript" src="WMSBrowserExample.js"></script>
-        
-    </head>
-    <body>
-        <h1>WMSBrowser example</h1>
-                
-        <p>
-          Select an url (currently xml files) from the list then click
-          'connect'.  A list of layers appears on the left grid.  Selecting one
-          parse some more information in the form to the right.  Double-clicking
-          on one shows a preview of the layer in a small popup.  After
-          selecting a layer, click on the 'Add Layer' button below to add it
-          to the map.
-        </p>
-        
-        <p>
-          Please, note that the current example use xml files stored locally
-          in ./data/.  In order to be able to use external WMS urls, you must 
-          use a proxy because of the 'Same origin policy' of ajax requests in 
-          javascript.  One is included in this folder.  Simply go to the js file
-          below and uncomment the 'OpenLayers.ProxyHost' line to use it.
-        </p>
-        
-        <p>
-          See
-          <a href="WMSBrowserExample.js">WMSBrowserExample.js</a>
-          for the source code.
-        </p>
-        
-        <div id="content"></div>
-    </body>
-</html>

Deleted: sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserExample.js
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserExample.js	2010-08-21 13:04:23 UTC (rev 2278)
+++ sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserExample.js	2010-08-24 13:40:45 UTC (rev 2279)
@@ -1,36 +0,0 @@
-var WMSBrowser, mapPanel;
-
-//OpenLayers.ProxyHost = "./proxy.php?url=";
-
-Ext.onReady(function() {
-
-    Ext.QuickTips.init();
-
-    mapPanel = new GeoExt.MapPanel({
-        region: "center",
-        layers: [new OpenLayers.Layer.WMS("Global Imagery",
-            "http://labs.metacarta.com/wms/vmap0",
-            {layers: "basic"})] ,
-        center: [-68,52],
-        zoom: 4
-    });
-
-    WMSBrowser = new GeoExt.ux.WMSBrowser({
-        title: OpenLayers.i18n("WMSBrowser"),
-        region: "east",
-        width: 500,
-        gridPanelOptions: {'height': 250},
-        allowInvalidUrl: true,
-        // comment the below line to have a 'textfield' instead of a 'combobox'
-        serverStore: oServerStore,
-        layerStore: mapPanel.layers
-    });
-
-    new Ext.Panel({
-        renderTo: "content",
-        layout: "border",
-        width: 900,
-        height: 350,
-        items: [mapPanel, WMSBrowser]
-    });
-});

Modified: sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserInWindowExample.html
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserInWindowExample.html	2010-08-21 13:04:23 UTC (rev 2278)
+++ sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserInWindowExample.html	2010-08-24 13:40:45 UTC (rev 2279)
@@ -5,22 +5,38 @@
         <!-- ext version 3.1.0 -->
         <script type="text/javascript" src="../../../../ext/adapter/ext/ext-base.js"></script>
         <script type="text/javascript" src="../../../../ext/ext-all.js"></script>
+
+        <!-- ext version 3.1.0 debug -->
+        <!--script type="text/javascript" src="../../../../ext/adapter/ext/ext-base-debug-w-comments.js"></script>
+        <script type="text/javascript" src="../../../../ext/ext-all-debug.js"></script-->
+
         <link rel="stylesheet" type="text/css" href="../../../../ext/resources/css/ext-all.css" />
         <link rel="stylesheet" type="text/css" href="../../../../ext/examples/shared/examples.css" />
 
+        <!-- Ext.ux.StatusBar includes -->
+        <!--link rel="stylesheet" type="text/css" href="../../../../ext/examples/ux/statusbar/css/statusbar.css" />
+        <script type="text/javascript" src="../../../../ext/examples/ux/statusbar/StatusBar.js"></script-->
+
         <!-- openlayers version trunk -->
         <script type="text/javascript" src="../../../../openlayers/lib/OpenLayers.js"></script>
         <script type="text/javascript" src="../../../../openlayers/lib/OpenLayers/Lang/fr.js"></script>
-        <script type="text/javascript" src="../resources/lang/fr.js"></script>
         <script type="text/javascript" src="../../../../geoext/lib/GeoExt.js"></script>
         
+        <!-- google v2 api for 192.168.4.120 -->
+        <!--script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA3mOTdOkDlYkDjNn8Pnmr6RSx-0TMqGjMArKjswQRjIfEFr4DRBQbnmTwDEUT7Xj85OddpLMNrWtXoA'></script-->
+        <!-- google v2 api for dev.geoext.org -->
+        <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA3mOTdOkDlYkDjNn8Pnmr6RTWxvN8zH6Ta_pgIhhU0TB7bG8iAhSdF2CWCQsaZn1qngCCwDaLVo3nCg'></script>
+
+        <!-- openstreetmap for openlayers -->
+        <script src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script>
+
+        <!-- WMSBrowser source -->
         <link rel="stylesheet" type="text/css" href="../resources/css/WMSBrowser.css" />
         <script type="text/javascript" src="../lib/GeoExt.ux/SingleFile.js"></script>
+        <script type="text/javascript" src="../resources/lang/fr.js"></script>
 
-    <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>
-        <script src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script>
 
-
+        <!-- Example source -->
         <script type="text/javascript" src="./store.js"></script>
         <script type="text/javascript" src="WMSBrowserInWindowExample.js"></script>
         

Modified: sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserInWindowExample.js
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserInWindowExample.js	2010-08-21 13:04:23 UTC (rev 2278)
+++ sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserInWindowExample.js	2010-08-24 13:40:45 UTC (rev 2279)
@@ -64,22 +64,23 @@
         WMSBrowser = new GeoExt.ux.WMSBrowser({
             border: false,
             region: "east",
-            gridPanelOptions: {'height': 300},
             zoomOnLayerAdded: false,
-            closeOnLayerAdded: true,
+            closeOnLayerAdded: false,
             allowInvalidUrl: true,
+            alertPopupTimeout: 2000,
             // comment the below line to have a 'textfield' instead of a 
             // 'combobox'.  oServerStore is in ./store.js
             serverStore: oServerStore,
+            mapPanelPreviewOptions: {height: 170, collapsed: false},
             layerStore: mapPanel.layers
         });
 
         browserWindow = new Ext.Window({
-            resizable: false,
-            modal: true,
+            resizable: true,
+            modal: false,
             closeAction: 'hide',
-            width: 600,
-            height: 400,
+            width: 550,
+            height: 450,
             title: OpenLayers.i18n("WMSBrowser"),
             layout: 'fit',
             items: [WMSBrowser]

Added: sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserWithStatusBar.html
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserWithStatusBar.html	                        (rev 0)
+++ sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/WMSBrowserWithStatusBar.html	2010-08-24 13:40:45 UTC (rev 2279)
@@ -0,0 +1,66 @@
+<html>
+    <head>
+        <title>WMSBrowser with a Ext.ux.StatusBar example</title>
+        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+        <!-- ext version 3.1.0 -->
+        <script type="text/javascript" src="../../../../ext/adapter/ext/ext-base.js"></script>
+        <script type="text/javascript" src="../../../../ext/ext-all.js"></script>
+
+        <!-- ext version 3.1.0 debug -->
+        <!--script type="text/javascript" src="../../../../ext/adapter/ext/ext-base-debug-w-comments.js"></script>
+        <script type="text/javascript" src="../../../../ext/ext-all-debug.js"></script-->
+
+        <link rel="stylesheet" type="text/css" href="../../../../ext/resources/css/ext-all.css" />
+        <link rel="stylesheet" type="text/css" href="../../../../ext/examples/shared/examples.css" />
+
+        <!-- Ext.ux.StatusBar includes -->
+        <link rel="stylesheet" type="text/css" href="../../../../ext/examples/ux/statusbar/css/statusbar.css" />
+        <script type="text/javascript" src="../../../../ext/examples/ux/statusbar/StatusBar.js"></script>
+
+        <!-- openlayers version trunk -->
+        <script type="text/javascript" src="../../../../openlayers/lib/OpenLayers.js"></script>
+        <script type="text/javascript" src="../../../../openlayers/lib/OpenLayers/Lang/fr.js"></script>
+        <script type="text/javascript" src="../../../../geoext/lib/GeoExt.js"></script>
+        
+        <!-- google v2 api for 192.168.4.120 -->
+        <!--script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA3mOTdOkDlYkDjNn8Pnmr6RSx-0TMqGjMArKjswQRjIfEFr4DRBQbnmTwDEUT7Xj85OddpLMNrWtXoA'></script-->
+        <!-- google v2 api for dev.geoext.org -->
+        <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA3mOTdOkDlYkDjNn8Pnmr6RTWxvN8zH6Ta_pgIhhU0TB7bG8iAhSdF2CWCQsaZn1qngCCwDaLVo3nCg'></script>
+
+        <!-- openstreetmap for openlayers -->
+        <script src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script>
+
+        <!-- WMSBrowser source -->
+        <link rel="stylesheet" type="text/css" href="../resources/css/WMSBrowser.css" />
+        <script type="text/javascript" src="../lib/GeoExt.ux/SingleFile.js"></script>
+        <script type="text/javascript" src="../resources/lang/fr.js"></script>
+
+
+        <!-- Example source -->
+        <script type="text/javascript" src="./store.js"></script>
+        <script type="text/javascript" src="WMSBrowserInWindowExample.js"></script>
+        
+    </head>
+    <body>
+        <h1>WMSBrowser with a Ext.ux.StatusBar example</h1>
+        
+        <p>
+          The same WMSBrowser widget using a Ext.ux.StatusBar.
+        </p>
+
+        <p>
+          You only need to include the Ext.ux.StatusBar source files (js and css)
+          in order to have it automatically included inside the widget.
+        </p>
+        
+        <p>
+          See
+          <a href="WMSBrowserInWindowExample.js">
+            WMSBrowserInWindowExample.js
+          </a>
+          for the source code.
+        </p>
+        
+        <div id="content"></div>
+    </body>
+</html>

Added: sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/data/dev4g.mapgears.com_cgi-bin_mswms_gmap_incompatible_srs.xml
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/data/dev4g.mapgears.com_cgi-bin_mswms_gmap_incompatible_srs.xml	                        (rev 0)
+++ sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/data/dev4g.mapgears.com_cgi-bin_mswms_gmap_incompatible_srs.xml	2010-08-24 13:40:45 UTC (rev 2279)
@@ -0,0 +1,281 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE WMT_MS_Capabilities SYSTEM "http://schemas.opengis.net/wms/1.1.1/WMS_MS_Capabilities.dtd" [
+ <!ELEMENT VendorSpecificCapabilities EMPTY>
+ ]>
+<!-- end of DOCTYPE declaration -->
+<WMT_MS_Capabilities version="1.1.1">
+
+<!-- MapServer version 5.4.2 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SWF OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=GEOS SUPPORTS=RGBA_PNG INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE -->
+
+<Service>
+  <Name>OGC:WMS</Name>
+  <Title>GMap WMS Demo Server</Title>
+  <Abstract>This demonstration server was setup by DM Solutions Group (http://www.dmsolutions.ca/) and is powered by the UMN MapServer (http://mapserver.org/).  This server uses Canadian source data (c)2000, Government of Canada with permission from Natural Resources Canada from NRCan's GeoGratis 
+web site (http://geogratis.cgdi.gc.ca/).</Abstract>
+  <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?"/>
+  <ContactInformation>
+  </ContactInformation>
+</Service>
+
+<Capability>
+  <Request>
+    <GetCapabilities>
+      <Format>application/vnd.ogc.wms_xml</Format>
+      <DCPType>
+        <HTTP>
+          <Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?"/></Get>
+          <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?"/></Post>
+        </HTTP>
+      </DCPType>
+    </GetCapabilities>
+    <GetMap>
+      <Format>image/png</Format>
+      <Format>image/gif</Format>
+      <Format>image/png; mode=24bit</Format>
+      <Format>image/jpeg</Format>
+      <Format>image/vnd.wap.wbmp</Format>
+      <Format>image/tiff</Format>
+      <Format>image/svg+xml</Format>
+      <DCPType>
+        <HTTP>
+          <Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?"/></Get>
+          <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?"/></Post>
+        </HTTP>
+      </DCPType>
+    </GetMap>
+    <GetFeatureInfo>
+      <Format>text/plain</Format>
+      <Format>text/html</Format>
+      <Format>application/vnd.ogc.gml</Format>
+      <DCPType>
+        <HTTP>
+          <Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?"/></Get>
+          <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?"/></Post>
+        </HTTP>
+      </DCPType>
+    </GetFeatureInfo>
+    <DescribeLayer>
+      <Format>text/xml</Format>
+      <DCPType>
+        <HTTP>
+          <Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?"/></Get>
+          <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?"/></Post>
+        </HTTP>
+      </DCPType>
+    </DescribeLayer>
+    <GetLegendGraphic>
+      <Format>image/png</Format>
+      <Format>image/gif</Format>
+      <Format>image/png; mode=24bit</Format>
+      <Format>image/jpeg</Format>
+      <Format>image/vnd.wap.wbmp</Format>
+      <DCPType>
+        <HTTP>
+          <Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?"/></Get>
+          <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?"/></Post>
+        </HTTP>
+      </DCPType>
+    </GetLegendGraphic>
+    <GetStyles>
+      <Format>text/xml</Format>
+      <DCPType>
+        <HTTP>
+          <Get><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?"/></Get>
+          <Post><OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?"/></Post>
+        </HTTP>
+      </DCPType>
+    </GetStyles>
+  </Request>
+  <Exception>
+    <Format>application/vnd.ogc.se_xml</Format>
+    <Format>application/vnd.ogc.se_inimage</Format>
+    <Format>application/vnd.ogc.se_blank</Format>
+  </Exception>
+  <VendorSpecificCapabilities/>
+  <UserDefinedSymbolization SupportSLD="1" UserLayer="0" UserStyle="1" RemoteWFS="0"/>
+  <Layer>
+    <Name>DEMO</Name>
+    <Title>GMap WMS Demo Server</Title>
+    <SRS>EPSG:42304</SRS>
+    <LatLonBoundingBox minx="-178.864" miny="31.8948" maxx="179.914" maxy="89.8172"/>
+    <BoundingBox SRS="EPSG:42304" minx="-2.75155e+06" miny="-935783" maxx="3.58285e+06" maxy="4.67412e+06"/>
+    <Layer>
+      <Name>base</Name>
+<!-- WARNING: Mandatory metadata '..._GROUP_TITLE' was missing in this context. -->
+      <Title>base</Title>
+      <Abstract>base</Abstract>
+      <Layer queryable="0" opaque="0" cascaded="0">
+        <Name>bathymetry</Name>
+        <Title>Elevation/Bathymetry</Title>
+        <SRS>EPSG:42304</SRS>
+        <!-- WARNING: Optional LatLonBoundingBox could not be established for this layer.  Consider setting LAYER.EXTENT or wms_extent metadata. Also check that your data exists in the DATA statement -->
+      </Layer>
+      <Layer queryable="0" opaque="0" cascaded="0">
+        <Name>land_fn</Name>
+        <Title>Foreign Lands</Title>
+        <SRS>EPSG:42304</SRS>
+        <LatLonBoundingBox minx="-178.838" miny="31.8844" maxx="179.94" maxy="89.8254"/>
+        <BoundingBox SRS="EPSG:42304" minx="-2.75056e+06" miny="-936638" maxx="3.58387e+06" maxy="4.67312e+06"/>
+        <Style>
+          <Name>default</Name>
+          <Title>default</Title>
+          <LegendURL width="124" height="23">
+             <Format>image/png</Format>
+             <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?version=1.1.1&amp;service=WMS&amp;request=GetLegendGraphic&amp;layer=land_fn&amp;format=image/png&amp;STYLE=default"/>
+          </LegendURL>
+        </Style>
+      </Layer>
+      <Layer queryable="0" opaque="0" cascaded="0">
+        <Name>drain_fn</Name>
+        <Title>Water</Title>
+        <SRS>EPSG:42304</SRS>
+        <LatLonBoundingBox minx="-179.973" miny="35.2464" maxx="179.92" maxy="88.06"/>
+        <BoundingBox SRS="EPSG:42304" minx="-2.75056e+06" miny="-936638" maxx="2.75882e+06" maxy="4.36727e+06"/>
+        <Style>
+          <Name>default</Name>
+          <Title>default</Title>
+          <LegendURL width="68" height="23">
+             <Format>image/png</Format>
+             <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?version=1.1.1&amp;service=WMS&amp;request=GetLegendGraphic&amp;layer=drain_fn&amp;format=image/png&amp;STYLE=default"/>
+          </LegendURL>
+        </Style>
+      </Layer>
+      <Layer queryable="0" opaque="0" cascaded="0">
+        <Name>drainage</Name>
+        <Title>Drainage</Title>
+        <SRS>EPSG:42304</SRS>
+        <LatLonBoundingBox minx="-169.629" miny="39.2232" maxx="-15.1085" maxy="83.0129"/>
+        <BoundingBox SRS="EPSG:42304" minx="-2.1694e+06" miny="-386968" maxx="2.79747e+06" maxy="3.74336e+06"/>
+        <Style>
+          <Name>default</Name>
+          <Title>default</Title>
+          <LegendURL width="68" height="23">
+             <Format>image/png</Format>
+             <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?version=1.1.1&amp;service=WMS&amp;request=GetLegendGraphic&amp;layer=drainage&amp;format=image/png&amp;STYLE=default"/>
+          </LegendURL>
+        </Style>
+      </Layer>
+    </Layer>
+    <Layer queryable="1" opaque="0" cascaded="0">
+        <Name>park</Name>
+        <Title>Parks</Title>
+        <SRS>EPSG:42304</SRS>
+        <LatLonBoundingBox minx="-173.433" miny="41.4271" maxx="-13.0481" maxy="83.7466"/>
+        <BoundingBox SRS="EPSG:42304" minx="-2.3468e+06" miny="-67422.4" maxx="2.84037e+06" maxy="3.83012e+06"/>
+        <Style>
+          <Name>default</Name>
+          <Title>default</Title>
+          <LegendURL width="68" height="23">
+             <Format>image/png</Format>
+             <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?version=1.1.1&amp;service=WMS&amp;request=GetLegendGraphic&amp;layer=park&amp;format=image/png&amp;STYLE=default"/>
+          </LegendURL>
+        </Style>
+    </Layer>
+    <Layer queryable="0" opaque="0" cascaded="0">
+        <Name>prov_bound</Name>
+        <Title>Province</Title>
+        <SRS>EPSG:42304</SRS>
+        <LatLonBoundingBox minx="-173.537" miny="35.8775" maxx="-11.9603" maxy="83.8009"/>
+        <BoundingBox SRS="EPSG:42304" minx="-2.3406e+06" miny="-719746" maxx="3.00943e+06" maxy="3.83661e+06"/>
+        <Style>
+          <Name>default</Name>
+          <Title>default</Title>
+          <LegendURL width="89" height="23">
+             <Format>image/png</Format>
+             <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?version=1.1.1&amp;service=WMS&amp;request=GetLegendGraphic&amp;layer=prov_bound&amp;format=image/png&amp;STYLE=default"/>
+          </LegendURL>
+        </Style>
+    </Layer>
+    <Layer queryable="1" opaque="0" cascaded="0">
+        <Name>prov_bound_poly</Name>
+        <Title>Province</Title>
+        <SRS>EPSG:42304</SRS>
+        <LatLonBoundingBox minx="-173.537" miny="35.8775" maxx="-11.9603" maxy="83.8009"/>
+        <BoundingBox SRS="EPSG:42304" minx="-2.3406e+06" miny="-719746" maxx="3.00943e+06" maxy="3.83661e+06"/>
+        <Style>
+          <Name>default</Name>
+          <Title>default</Title>
+          <LegendURL width="138" height="23">
+             <Format>image/png</Format>
+             <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?version=1.1.1&amp;service=WMS&amp;request=GetLegendGraphic&amp;layer=prov_bound_poly&amp;format=image/png&amp;STYLE=default"/>
+          </LegendURL>
+        </Style>
+    </Layer>
+    <Layer queryable="0" opaque="0" cascaded="0">
+        <Name>fedlimit</Name>
+        <Title>Federal Limit</Title>
+        <SRS>EPSG:42304</SRS>
+        <LatLonBoundingBox minx="-179.96" miny="34.2409" maxx="178.833" maxy="89.9051"/>
+        <BoundingBox SRS="EPSG:42304" minx="-2.69358e+06" miny="-724162" maxx="3.38519e+06" maxy="4.6545e+06"/>
+        <Style>
+          <Name>default</Name>
+          <Title>default</Title>
+          <LegendURL width="124" height="23">
+             <Format>image/png</Format>
+             <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?version=1.1.1&amp;service=WMS&amp;request=GetLegendGraphic&amp;layer=fedlimit&amp;format=image/png&amp;STYLE=default"/>
+          </LegendURL>
+        </Style>
+    </Layer>
+    <Layer queryable="0" opaque="0" cascaded="0">
+        <Name>rail</Name>
+        <Title>Railroads</Title>
+        <SRS>EPSG:42304</SRS>
+        <LatLonBoundingBox minx="-137.447" miny="37.7146" maxx="-46.3201" maxy="66.7201"/>
+        <BoundingBox SRS="EPSG:42304" minx="-2.14572e+06" miny="-680853" maxx="2.61606e+06" maxy="1.93097e+06"/>
+        <Style>
+          <Name>default</Name>
+          <Title>default</Title>
+          <LegendURL width="96" height="23">
+             <Format>image/png</Format>
+             <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?version=1.1.1&amp;service=WMS&amp;request=GetLegendGraphic&amp;layer=rail&amp;format=image/png&amp;STYLE=default"/>
+          </LegendURL>
+        </Style>
+    </Layer>
+    <Layer queryable="0" opaque="0" cascaded="0">
+        <Name>road</Name>
+        <Title>Roads</Title>
+        <SRS>EPSG:42304</SRS>
+        <LatLonBoundingBox minx="-179.56" miny="-61.784" maxx="179.235" maxy="-35.4622"/>
+        <BoundingBox SRS="EPSG:42304" minx="-2.5e+07" miny="-2.5e+07" maxx="2.5e+07" maxy="2.5e+07"/>
+        <Style>
+          <Name>default</Name>
+          <Title>default</Title>
+          <LegendURL width="68" height="23">
+             <Format>image/png</Format>
+             <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?version=1.1.1&amp;service=WMS&amp;request=GetLegendGraphic&amp;layer=road&amp;format=image/png&amp;STYLE=default"/>
+          </LegendURL>
+        </Style>
+    </Layer>
+    <Layer queryable="1" opaque="0" cascaded="0">
+        <Name>popplace</Name>
+        <Title>Cities</Title>
+        <SRS>EPSG:42304</SRS>
+        <LatLonBoundingBox minx="-179.56" miny="-61.784" maxx="179.235" maxy="-35.4622"/>
+        <BoundingBox SRS="EPSG:42304" minx="-2.5e+07" miny="-2.5e+07" maxx="2.5e+07" maxy="2.5e+07"/>
+        <Style>
+          <Name>default</Name>
+          <Title>default</Title>
+          <LegendURL width="215" height="77">
+             <Format>image/png</Format>
+             <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?version=1.1.1&amp;service=WMS&amp;request=GetLegendGraphic&amp;layer=popplace&amp;format=image/png&amp;STYLE=default"/>
+          </LegendURL>
+        </Style>
+    </Layer>
+    <Layer queryable="0" opaque="0" cascaded="0">
+        <Name>grid</Name>
+        <Title>Grid</Title>
+        <SRS>EPSG:42304</SRS>
+        <LatLonBoundingBox minx="-178.838" miny="31.8844" maxx="179.94" maxy="89.8254"/>
+        <BoundingBox SRS="EPSG:42304" minx="-2.75056e+06" miny="-936639" maxx="3.58387e+06" maxy="4.67312e+06"/>
+        <Style>
+          <Name>default</Name>
+          <Title>default</Title>
+          <LegendURL width="96" height="23">
+             <Format>image/png</Format>
+             <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://dev4g.mapgears.com/cgi-bin/mswms_gmap?version=1.1.1&amp;service=WMS&amp;request=GetLegendGraphic&amp;layer=grid&amp;format=image/png&amp;STYLE=default"/>
+          </LegendURL>
+        </Style>
+    </Layer>
+  </Layer>
+</Capability>
+</WMT_MS_Capabilities>
\ No newline at end of file

Modified: sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/store.js
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/store.js	2010-08-21 13:04:23 UTC (rev 2278)
+++ sandbox/mapgears/geoext.ux/ux/WMSBrowser/examples/store.js	2010-08-24 13:40:45 UTC (rev 2279)
@@ -3,6 +3,7 @@
     data : [
         ['./data/wmscap.xml']
         ,['./data/dev4g.mapgears.com_cgi-bin_mswms_gmap.xml']
+        ,['./data/dev4g.mapgears.com_cgi-bin_mswms_gmap_incompatible_srs.xml']
         ,['./data/dev4g.mapgears.com_cgi-bin_mswms_gmap_1.3.0.xml']
         //,['http://dev4g.mapgears.com/cgi-bin/mswms_gmap']
     ]

Modified: sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/SingleFile.js
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/SingleFile.js	2010-08-21 13:04:23 UTC (rev 2278)
+++ sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/SingleFile.js	2010-08-24 13:40:45 UTC (rev 2279)
@@ -53,7 +53,9 @@
 
     var jsfiles = new Array(
         "data/Store.js",
-        "widgets/WMSBrowser.js"
+        "widgets/WMSBrowser.js",
+        "widgets/WMSBrowserStatusBar",
+        "plugins/WMSBrowserAlerts"
     );
 
     var agent = navigator.userAgent;

Added: sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/plugins/WMSBrowserAlerts.js
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/plugins/WMSBrowserAlerts.js	                        (rev 0)
+++ sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/plugins/WMSBrowserAlerts.js	2010-08-24 13:40:45 UTC (rev 2279)
@@ -0,0 +1,114 @@
+/**
+ * Copyright (c) 2008-2010 The Open Source Geospatial Foundation
+ * 
+ * Published under the BSD license.
+ * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text
+ * of the license.
+ */
+
+Ext.namespace("GeoExt.ux.plugins");
+
+/*
+ * @requires GeoExt.ux/widgets/WMSBrowser.js
+ */
+
+/** api: (define)
+ *  module = GeoExt.ux.plugins
+ *  class = WMSBrowserAlerts
+ */
+
+/** api: constructor
+ *  .. class:: WMSBrowserAlerts
+ */
+GeoExt.ux.plugins.WMSBrowserAlerts = Ext.extend(Ext.util.Observable, {
+
+    /** private: property[wmsbrowser]
+     *  :class:`GeoExt.ux.WMSBrowser`  The widget in which to listen
+     *  custom events to display the messages and status.
+     */
+    wmsbrowser: null,
+
+    /** api: config[autoHidePopup]
+     * ``Boolean`` Whether the popup should be automatically hidden after a
+     *             certain period of time or not.  Defaults to false.
+     */
+    autoHidePopup: false,
+
+    /** api: config[popupTimeout]
+     * ``Integer`` The time in milliseconds the popup should be visible.  Only
+     *             used if 'autoHidePopup' property is set to true.
+     */
+    popupTimeout: 4000,
+
+    /** private: method[init]
+     *  :param wmsbrowser: ``GeoExt.ux.WMSBrowser``
+     */
+    init: function(wmsbrowser, config) {
+        this.wmsbrowser = wmsbrowser;
+        this.popupTimeout = this.wmsbrowser.alertPopupTimeout;
+        this.autoHidePopup = this.wmsbrowser.alertPopupAutoHide;
+
+        this.wmsbrowser.on(
+            'getcapabilitiesfail',
+            this.onGetCapabilitiesFail,
+            this
+        );
+
+        this.wmsbrowser.on(
+            'genericerror',
+            this.onGenericError,
+            this
+        );
+    },
+
+    /** private: method[showPopup]
+     *  Display a popup with given title, message and icon.  Automatically hides
+     *  after a certain period of time (set by the 'popupTimeout' property).
+     */
+    showPopup: function(title, message, extIcon) {
+        if(!extIcon){
+            extIcon = Ext.MessageBox.WARNING
+        }
+
+        Ext.MessageBox.show({
+            title: title,
+            msg: message,
+            modal: false,
+            width: 300,
+            buttons: Ext.MessageBox.OK,
+            icon: extIcon
+        });
+
+        if (this.autoHidePopup) {
+            setTimeout(function(){
+                Ext.MessageBox.hide();
+            }, this.popupTimeout);
+        }
+    },
+
+    /** private: method[onGetCapabilitiesFail]
+     *  Called when a "getcapabilitiessuccess" event is fired by the 
+     *  :class:`GeoExt.ux.WMSBrowser` widget.  Shows the according failure
+     *  message.
+     */
+    onGetCapabilitiesFail: function() {
+        this.showPopup(
+            this.wmsbrowser.errorText,
+            this.wmsbrowser.urlInvalidText
+        );
+    },
+
+    /** private: method[onGenericError]
+     *  :param message: ``String``  The error message sent by the event.
+     *
+     *  Called when a "genericerror" event is fired by the 
+     *  :class:`GeoExt.ux.WMSBrowser` widget.  Shows the message sent by
+     *  the event.
+     */
+    onGenericError: function(message) {
+        this.showPopup(
+            this.wmsbrowser.warningText,
+            message
+        );
+    }
+});

Modified: sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/widgets/WMSBrowser.js
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/widgets/WMSBrowser.js	2010-08-21 13:04:23 UTC (rev 2278)
+++ sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/widgets/WMSBrowser.js	2010-08-24 13:40:45 UTC (rev 2279)
@@ -22,62 +22,300 @@
  */
 GeoExt.ux.WMSBrowser = Ext.extend(Ext.Panel, {
 
-    layout: 'absolute',
+    /** private: property[CUSTOM_EVENTS]
+     *  ``Array(String)`` Array of custom events used by this widget
+     */
+    CUSTOM_EVENTS: [
+        "beforegetcapabilities",
+        "getcapabilitiessuccess",
+        "getcapabilitiesfail",
+        "genericerror",
+        "layeradded"
+    ],
 
-    minWidth: 300,
+    /** private: property[DEFAULT_CAPABILITIES_PARAMS]
+     *  ``Array(String)`` Array of default GetCapabilities request parameters
+     */
+    DEFAULT_CAPABILITIES_PARAMS: {
+       'service': "WMS",
+       'request': "GetCapabilities",
+       'version': '1.1.1'
+    },
 
-    minHeight: 200,
+    /* begin i18n */
+    /** api: config[inputURLText] ``String`` i18n */
+    inputURLText: "Select or input a server address (URL)",
 
-    plain:true,
+    /** api: config[connectText] ``String`` i18n */
+    connectText: "Connect",
 
-    bodyStyle:'padding:5px;',
+    /** api: config[pleaseInputURLText] ``String`` i18n */
+    pleaseInputURLText: "Please, select or input a server adress (URL) in the" +
+                        " dropdown list first.",
 
-    buttonAlign:'center',
+    /** api: config[srsCompatibleText] ``String`` i18n */
+    srsCompatibleText: "SRS compatible",
 
-    useIcons: false,
+    /** api: config[extentCompatibleText] ``String`` i18n */
+    extentCompatibleText: "Extent compatible",
 
+    /** api: config[titleText] ``String`` i18n */
+    titleText: "Title",
+
+    /** api: config[nameText] ``String`` i18n */
+    nameText: "Name",
+
+    /** api: config[queryableText] ``String`` i18n */
+    queryableText: "Queryable",
+
+    /** api: config[descriptionText] ``String`` i18n */
+    descriptionText: "Description",
+
+    /** api: config[yesText] ``String`` i18n */
+    yesText: "Yes",
+
+    /** api: config[noText] ``String`` i18n */
+    noText: "No",
+
+    /** api: config[addLayerText] ``String`` i18n */
+    addLayerText: "Add layer",
+
+    /** api: config[addSelectedLayersText] ``String`` i18n */
+    addSelectedLayersText: "Add currently selected layers as one single layer.",
+
+    /** api: config[mapPanelPreviewTitleText] ``String`` i18n */
+    mapPanelPreviewTitleText: "Map preview",
+
+    /** api: config[layerCantBeAddedText] ``String`` i18n */
+    layerCantBeAddedText: "This layer can't be added : ",
+
+    /** api: config[srsNotSupportedText] ``String`` i18n */
+    srsNotSupportedText: "This layer can't be added to the current map" + 
+                         " because it doesn't support its projection.",
+
+    /** api: config[srsNotSupportedShortText] ``String`` i18n */
+    srsNotSupportedShortText: "it doesn't support the map current projection",
+
+    /** api: config[extentNotSupportedShortText] ``String`` i18n */
+    extentNotSupportedShortText: "it is out of the map bounds",
+
+    /** api: config[pleaseSelectALayerText] ``String`` i18n */
+    pleaseSelectALayerText: "Please, select one or more layers from the grid first.",
+
+    /** api: config[closeWindowText] ``String`` i18n */
+    closeWindowText: "Close this window",
+
+    /** api: config[closeText] ``String`` i18n */
+    closeText: "Close",
+
+    /** api: config[inputURLInvalidText] ``String`` i18n */
+    inputURLInvalidText: "The url address entered is not valid.",
+
+    /** api: config[layerNameText] ``String`` i18n */
+    layerNameText: "Layer name :",
+
+    /** api: config[noLayerReturnedText] ``String`` i18n */
+    noLayerReturnedText: "The url address is valid but returned no layers.",
+
+    /** api: config[layersSuccessfullyLoadedText] ``String`` i18n */
+    layersSuccessfullyLoadedText: "Layers successfully loaded.",
+
+    /** api: config[layerAddedText] ``String`` i18n */
+    layerAddedText: "Layer(s) successfully added to the map.",
+
+    /** api: config[urlInvalidText] ``String`` i18n */
+    urlInvalidText: "The server address (url) is invalid or is not a valid WMS server.",
+
+    /** api: config[pleaseInputLayerNameText] ``String`` i18n */
+    pleaseInputLayerNameText: "Please, input a layer name in the textfield below.",
+
+    /** api: config[warningText] ``String`` i18n */
+    warningText: "Warning",
+
+    /** api: config[errorText] ``String`` i18n */
+    errorText: "Error",
+    /* end i18n */
+
+    /** api: config[layerStore]
+     *  ``GeoExt.data.LayerStore`` A store holding records.  Mandatory.
+     */
+
+    /** api: property[layerStore]
+     *  :class:`GeoExt.data.LayerStore`  A store containing
+     *  :class:`GeoExt.data.LayerRecord` objects.
+     */
     layerStore: null,
 
+    /** api: config[serverStore]
+     *  ``Ext.data.SimpleStore``
+     *  A store holding records.  If not provided, an empty
+     *  :class:`Ext.data.SimpleStore` will be created.
+     */
+
+    /** api: property[serverStore]
+     *  :class:`Ext.data.SimpleStore`  A store containing
+     *  :class:`Ext.data.Record` objects for server urls.
+     */
     serverStore: null,
 
+    /** api: config[serverStoreDisplayField]
+     *  ``String``  The field to display in the dropdown list using the
+     *              serverStore.  Defaults to 'url'.
+     */
     serverStoreDisplayField: 'url',
 
-    capabilitiesParams: {},
+    /** api: config[layout]
+     *  ``String``  The default 'layout' value.
+     */
+    layout: 'border',
 
-    defaultCapabilitiesParams: {
-       'service': "WMS",
-       'request': "GetCapabilities",
-       'version': '1.1.1'
-    },
+    /** api: config[defaultType]
+     *  ``String``  The default 'defaultType' value.
+     */
+    defaultType: 'textfield',
 
-    gridPanelOptions: {
-        'height': 200
+    /** api: config[defaults]
+     *  ``Object``  The default 'defaults' value.
+     */
+    defaults: {
+        style:'padding:2px;margin:0px;'
     },
 
+    /** api: config[capabilitiesParams]
+     *  ``Object``  Hash of parameters for the GetCapabilities requests.  Each
+     *              defined parameter will overwrites the 
+     *              DEFAULT_CAPABILITIES_PARAMS
+     */
+    capabilitiesParams: {},
+
+    /** api: config[mapPanelPreviewOptions]
+     *  ``Object``  Hash of options for the mapPanelPreview object.  Each
+     *              defined option will overwrites the default according option
+     *              of the object when creating it.
+     */
+    mapPanelPreviewOptions: {},
+
+    /** api: config[layerNameFieldOptions]
+     *  ``Object``  Hash of options for the layerNameField object.  Each
+     *              defined option will overwrites the default according option
+     *              of the object when creating it.
+     */
+    layerNameFieldOptions: {},
+
     /** api: config[layerOptions]
-     * ``Object`` optional object passed as default options                                                           
+     * ``Object`` optional object passed as default options
      * ``OpenLayers.Layer.WMS`` constructor
      */
     layerOptions: null,
 
+    /** api: config[useIcons]
+     * ``Boolean`` Whether the buttons should use icons or not.  Defaults to
+     *             false.
+     */
+    useIcons: false,
+
+    /** api: config[zoomOnLayerAdded]
+     * ``Boolean`` Whether the map should zoom to the newly added layer's extent
+     *             or not.  Defaults to false.
+     */
     zoomOnLayerAdded: false,
 
+    /** api: config[closeOnLayerAdded]
+     * ``Boolean`` Whether the window containing the widget should automatically
+     *             closes after a layer has been added to the map or not.
+     *             Defaults to false.  Only working of widget is inside a
+     *             :class:`Ext.Window` object.
+     */
     closeOnLayerAdded: false,
 
+    /** api: config[allowInvalidUrl]
+     * ``Boolean`` Whether invalid urls should be allowed to be inputed inside
+     *             the server dropdown list or not.  If set to false, then
+     *             if an invalid url is inputed, no query will be made.
+     *             Defaults to false.
+     */
     allowInvalidUrl: false,
 
+    /** api: config[selectFirstRecordOnStoreLoad]
+     * ``Boolean`` Whether the first record in the grid should be automatically
+     *             selected after a GetCapabilities request or not.  Defaults to
+     *             false.
+     */
+    selectFirstRecordOnStoreLoad: false,
+
+    /** api: config[alertPopupAutoHide]
+     * ``Boolean`` Whether the alert popups should be automatically hidden
+     *             after a certain period of time or not.  Defaults to false.è
+     *             Only used if no :class:`GeoExt.ux.WMSBrowserStatusBar` is
+     *             set.
+     */
+    alertPopupAutoHide: false,
+
+    /** api: config[alertPopupTimeout]
+     * ``Integer`` The 'popupTimeout' property to set the 
+     * :class:`GeoExt.ux.plugins.WMSBrowserAlerts` plugin.  Only used if no
+     * :class:`GeoExt.ux.WMSBrowserStatusBar` is set.
+     */
+    alertPopupTimeout: 4000,
+
+    /** private: property[currentUrl]
+     *  ``String`` Used to keep track of the url while a query is processing.
+     */
     currentUrl: null,
+ 
+    /** private: property[layerPreview]
+     *  :class:`GeoExt.data.LayerRecord`  Used to create the layer preview
+     */
+    layerPreview: null,
 
+    /** private: property[mapPanelPreview]
+     *  :class:`GeoExt.MapPanel`  Used to create the map preview (containing the
+     *                            layer preview)
+     */
+    mapPanelPreview: null,
+
+    /** private: prperty[gridPanel]
+     *  :class:`Ext.grid.GridPanel`  The grid used to display the 
+     *  :class:`GeoExt.data.LayerRecord` created inside the
+     *  :class:`GeoExt.data.WMSCapabilitiesStore`.
+     */
+    gridPanel: null,
+
+    /** private: property[centerPanel]
+     *  :class:`Ext.form.FormPanel`  The panel used as a 'center' container
+     */
+    centerPanel: null,
+
+    /** private: property[serverComboBox]
+     *  :class:`Ext.form.ComboBox`  The dropdown list of WMS servers
+     */
+    serverComboBox: null,
+
+    /** private: property[layerNameField]
+     *  :class:`Ext.form.TextField`  The field used to contain the layer's name
+     */
+    layerNameField: null,
+
+    /** private: property[statusBar]
+     *  :class:`GeoExt.ux.WMSBrowserStatusBar`  If Ext.ux.StatusBar class is
+     *  present, it will automatically added to this widget.
+     */
+    statusBar: null,
+
     /** private: method[constructor]
      */
     constructor: function(config) {
-        this.serverStore = config.serverStore || null;
-        this.gridPanelOptions = config.gridPanelOptions || this.gridPanelOptions;
-        this.layerOptions = config.layerOptions || this.layerOptions;
+        Ext.apply(this, config);
+
+        if (!this.serverStore) {
+            this.serverStore = 
+                new Ext.data.SimpleStore({fields: ['url'], data : []});
+        }
         
-        OpenLayers.Util.applyDefaults(
-            this.capabilitiesParams, this.defaultCapabilitiesParams);
+        Ext.applyIf(this.capabilitiesParams, this.DEFAULT_CAPABILITIES_PARAMS);
 
+        this.addEvents(this.CUSTOM_EVENTS);
+
         this.initMyItems();
         this.initMyToolbar();
 
@@ -86,419 +324,341 @@
         this.on("afterrender", this.onAfterRender, this);
     },
 
+    /** private: method[initMyItems]
+     *
+     *  Initializes the widget items.  Create the north and center panels in
+     *  which there are :
+     *  - a dropdown list of server urls
+     *  - a grid panel containing layer records
+     *  - a form panel containing layer info when one layer record is selected
+     *  - a mappanel used for the preview
+     */
     initMyItems: function() {
-        var oItems;
-
-        oItems = [];
-
-        // Top panel
-        oTopPanel = {
-            style:'padding:2px;margin:2px;',
-            region: 'north',
-            id: "wms_field_group",
-            xtype: 'fieldset',
-            layout: 'form',
-            border: false,
-            collapsible: false,
-	    anchor: '100%',
-            defaults: {width: '100%'},
-            defaultType: 'textfield',
-            buttonAlign:'center',
-            items: [],
-            buttons: []
-        };
-
-        // URL panel
-        var oURLField;
-        if(this.serverStore) {
-            oURLField = {
+        // north (connection informations)
+        this.serverComboBox = new Ext.form.ComboBox({
             style:'padding:0px;margin:0px;',
-                columnWidth: 0.85,
-                'name': 'wms_url',
-                'id': 'wms_url',
-                xtype: 'combo',
-                store: this.serverStore,
-                displayField: this.serverStoreDisplayField,
-                typeAhead: true,
-                mode: 'local',
-                forceSelection: false,
-                triggerAction: 'all',
-                allowBlank: false,
-                validator:this.urlValidator,
-                invalidText: OpenLayers.i18n('The url address entered is not valid.'),
-                emptyText:OpenLayers.i18n('Select or input a server address (URL)'),
-                selectOnFocus:true
-            };
-        } else {
-            oURLField = {
-            style:'padding:0px;margin:0px;',
-                xtype: "textfield",
-                columnWidth: 0.85,
-                layout: 'fit',
-                'name': 'wms_url',
-                'id': 'wms_url',
-                border: false,
-                allowBlank: false,
-                validator:this.urlValidator,
-                invalidText: OpenLayers.i18n('The url address entered is not valid.'),
-                'emptyText': OpenLayers.i18n('Input the server address (URL)')
-            };
-        }
-
-        // Top panel - URL and Connect
-        oTopPanel.items.push({
-            style:'padding:0px;margin:0px;',
-            xtype: 'fieldset',
-            layout: 'column',
-            border: false,
-            collapsible: false,
-            collapsed: false,
-            items: [
-                oURLField,
-                {
-                    style:'padding:0px;margin:0px;',
-                    columnWidth: 0.15,
-                    border: false,
-                    items: [{
-			width: 'auto',
- 			autoWidth: 'true',
-                        style:'padding:0px;margin:0px;',
-                        xtype: 'button',
-                        text:  OpenLayers.i18n('Connect'),
-                        scope: this,
-                        handler: function(b, e){this.triggerGetCapabilities();}
-                    }]
-                }
-            ]
+            columnWidth: 0.85,
+            'name': 'wms_url',
+            xtype: 'combo',
+            store: this.serverStore,
+            displayField: this.serverStoreDisplayField,
+            typeAhead: true,
+            mode: 'local',
+            forceSelection: false,
+            triggerAction: 'all',
+            allowBlank: false,
+            validator:this.urlValidator,
+            invalidText: this.inputURLInvalidText,
+            emptyText: this.inputURLText,
+            selectOnFocus:true
         });
 
-
-        // Top panel - Username and Password
-	// currenty not used at all...
-	/*
-        oTopPanel.items.push({
-            style:'padding:10px;margin:2px;',
-            xtype: 'fieldset',
-            title: OpenLayers.i18n('Login information (optional)'),
-            layout: 'form',
-            collapsible: true,
-            collapsed: true,
+        var northPanel = new Ext.form.FormPanel({
+            height: 'auto',
             autoHeight: true,
-            autoWidth: true,
-            defaults: {width: '100%'},
-            defaultType: 'textfield',
-            items: [{
-                name: 'wms_username',
-                id: 'wms_username',
-                fieldLabel: OpenLayers.i18n('Username')
-            },{
-                name: 'wms_password',
-                id: 'wms_password',
-                inputType: 'password',
-                fieldLabel: OpenLayers.i18n('Password')
+            border: false,
+            region: 'north',
+            layout: 'column',
+            items: [this.serverComboBox, {
+                columnWidth: 0.15,
+                width: '100%',
+                style:'padding:0px;margin:0px;',
+                xtype: 'button',
+                text: this.connectText,
+                scope: this,
+                handler: function(b, e){this.triggerGetCapabilities();}
             }]
         });
-        */
-        oItems.push(oTopPanel);
 
-        // Center Panel
-        oCenterPanel = {
-            style:'padding:2px;margin:2px;',
-	    x: 0,
-	    y: 25,
-            xtype: 'form',
-            region: 'center',
-            id: "wms_capabilities_panel",
-            layout: 'column',
-            border: false,
-            collapsible: false,
-            anchor: '100% 100%',
-            defaults: {width: '100%', hideLabel: true},
-            defaultType: 'textfield',
-            buttonAlign:'center',
-            items: []
-        };
+        // center (capabilities grid and info, mapPanel)
+        this.mapPanelPreview = new GeoExt.MapPanel(
+            Ext.applyIf(this.mapPanelPreviewOptions, {
+                xtype: "gx_mappanel",
+                title: this.mapPanelPreviewTitleText,
+                region: 'south',
+                collapsible: true,
+                collapsed: true,
+                border: false,
+                height: 200,
+                floatable: false,
+                minSize: 100,
+                split: true,
+                layers: [new OpenLayers.Layer("dummy")]
+            })
+        );
+        this.mapPanelPreview.on("collapse", this.hideLayerPreview, this);
+        this.mapPanelPreview.on("expand", this.showLayerPreview, this);
 
-        // WMSCapabilitiesStore on blank url on start
-        this.capStore = new GeoExt.data.WMSCapabilitiesStore({'url': "", layerOptions: this.layerOptions});
-        this.capStore.on('load', this.onWMSCapabilitiesStoreLoad, this);
+        this.gridPanel = this.createGridPanel();
 
-        oCenterPanel.items.push(this.createGridPanel(this.capStore));
-        oCenterPanel.items.push(this.createFormPanel());
-        
-        oItems.push(oCenterPanel);
+        this.statusBar = (GeoExt.ux.WMSBrowserStatusBar)
+            ? new GeoExt.ux.WMSBrowserStatusBar({'wmsbrowser': this})
+            : null;
 
-        Ext.apply(this, {items: oItems});
-    },
-
-    triggerGetCapabilities: function() {
-        var urlField = Ext.getCmp('wms_url');
-        var url = urlField.getValue();
-
-        // if url in not valid
-        if(!urlField.isValid()) {
-            // if url is blank, throw error
-            if(!url) {
-                alert(OpenLayers.i18n('Please, enter an url in the textbox first'));
-                return;
-            }
-            // if url is not blank and the widget don't allow invalid urls, 
-            // throw error
-            else if (!this.allowInvalidUrl){
-                alert( OpenLayers.i18n('The url address entered is not valid.'));
-                return;
-            }
+        if (!this.statusBar) {
+            Ext.apply(this, {plugins: [new GeoExt.ux.plugins.WMSBrowserAlerts()]});
         }
 
-        // keep the inputed url in order to add it to the url store later if
-        // it was valid
-        this.currentUrl = url;
+        var centerPanel = new Ext.form.FormPanel({
+            tbar: this.statusBar,
+            region: 'center',
+            layout: 'absolute',
+            border: false,
+            items: [
+                this.gridPanel, {
+                anchor: '50% 100%',
+                x: '50%',
+                y: '0',
+                layout: 'border',
+                border: true,
+                items: [
+                    this.createFormPanel(), 
+                    this.mapPanelPreview
+                ]
+            }]
+        });
 
-        // add the GetCapabilities parameters to the url
-        var params = OpenLayers.Util.getParameterString(this.capabilitiesParams);        
-        url = OpenLayers.Util.urlAppend(url, params);
+        this.centerPanel = centerPanel;
 
-        if (OpenLayers.ProxyHost && OpenLayers.String.startsWith(url, "http")) {
-            url = OpenLayers.ProxyHost + encodeURIComponent(url);
-        }
-
-        // change the url of the capability store proxy
-        this.capStore.proxy.setUrl(url);
-        this.capStore.proxy.setApi(Ext.data.Api.actions.read, url);
-
-        this.capStore.load();
+        Ext.apply(this, {items: [northPanel, centerPanel]});
     },
 
-    removeAllItemsFromObject: function(object){
-        while(object.items.length != 0){
-            var oItem = object.items.items[0];
-            object.remove(oItem, true);
-            oItem.destroy();
-        }
-    },
+    /** private: method[createGridPanel]
+     *  :return:  ``Ext.grid.GridPanel``
+     *
+     * Creates and returns the grid panel used to display the layer records.
+     */
+    createGridPanel: function() {
+        this.capStore = new GeoExt.data.WMSCapabilitiesStore({
+            'url': "", layerOptions: this.layerOptions
+        });
+        this.capStore.on(
+            'load',
+            this.onWMSCapabilitiesStoreLoad,
+            this
+        );
+        this.capStore.on(
+            'loadexception',
+            this.onWMSCapabilitiesStoreLoadException,
+            this
+        );
 
-    createWMSCapabilitiesStore: function(url) {
-        var store = new GeoExt.data.WMSCapabilitiesStore({'url': url});
-        store.on('load', this.onWMSCapabilitiesStoreLoad, this);
-        return store;
-    },
+        var checkboxSelectionModel = new Ext.grid.CheckboxSelectionModel({
+            singleSelect: false,
+            renderer: function(value, metaData, record) {
+                // Hide checkbox for certain records
+                if(record.get('srsCompatible') == false ||
+                   record.get('extentCompatible' == false)) {
+                    return;
+                }
+                return Ext.grid.CheckboxSelectionModel.prototype.renderer.apply(
+                    this, arguments
+                );
+            },
+            listeners: {
+                beforerowselect: function(sm, row, keep, rec) {
+                    return sm.scope.isRecordSelectable(rec);
+                },
+                rowselect: function(sm, row, rec) {
+                    sm.scope.centerPanel.getForm().loadRecord(rec);
+                    sm.scope.addLayerToPreview(rec);
+                    sm.scope.setLayerNameFromSelectedRecords();
+                },
+                rowdeselect: function(sm, row, rec) {
+                    sm.scope.centerPanel.getForm().reset();
+                    sm.scope.removeLayerFromPreview(rec);
+                    sm.scope.setLayerNameFromSelectedRecords();
+                }
+            },
+            scope: this
+        });
 
-    createGridPanel: function(store) {
         var columns = [
-            { header: OpenLayers.i18n('Add'),
+            checkboxSelectionModel,
+            { header: this.srsCompatibleText, scope: this,
               dataIndex: "srsCompatible", hidden: false,
-              renderer: this.boolRenderer, width: 30},
-            { header: OpenLayers.i18n('Title'), 
+              renderer: this.boolRenderer, width: 30, hidden: true},
+            { header: this.extentCompatibleText, scope: this,
+              dataIndex: "extentCompatible", hidden: false,
+              renderer: this.boolRenderer, width: 30, hidden: true},
+            { header: this.titleText, scope: this,
               dataIndex: "title", id: "title", sortable: true},
-            { header: OpenLayers.i18n('Name'), 
+            { header: this.nameText, scope: this,
               dataIndex: "name", sortable: true},
-            { header: OpenLayers.i18n('Queryable'), 
+            { header: this.queryableText, scope: this,
               dataIndex: "queryable", sortable: true, hidden: true, 
-              renderer: this.boolRenderer},
-            { header: OpenLayers.i18n('Description'),
+              renderer: this.boolRenderer, width: 30},
+            { header: this.descriptionText, scope: this,
               dataIndex: "abstract", hidden: true}
         ];
 
-        // In order to have a scrollbar, a GridPanel must have a 'height' set,
-        // it can't be left with 'autoHeight': true...
         var options = {
-            id: 'wms_capabilities_grid_panel',
-            columnWidth: 0.5,
-            layout: 'fit',
-            store: store,
+            layout: 'absolute',
+            x: 0,
+            y: 0,
+            anchor: '50% 100%',
+            store: this.capStore,
             columns: columns,
-            // SelectionModel
-            sm: new Ext.grid.RowSelectionModel({
-                singleSelect: true,
-                listeners: {
-                    rowselect: function(sm, row, rec) {
-                        Ext.getCmp("wms_capabilities_panel").getForm().loadRecord(rec);
-                    }
-                }
-            }),
+            sm: checkboxSelectionModel,
             autoExpandColumn: "title",
             width: 'auto',
             autoWidth: true,
-            listeners: {
-                rowdblclick: this.mapPreview
-            }
+            border: true
         };
 
-        options = OpenLayers.Util.applyDefaults(this.gridPanelOptions, options);
-
         return new Ext.grid.GridPanel(options);
     },
 
+    /** private: method[createFormPanel]
+     *  :return:  ``Object``
+     *
+     * Creates and returns the form panel options used to display some
+     * informations when a layer is selected in the grid.
+     */
     createFormPanel: function() {
-        var nDescHeight = parseInt(this.gridPanelOptions['height']) - 115;
-
         var options = {
-            style:'padding:0px;margin:0px;',
-            columnWidth: 0.5,
             xtype: 'fieldset',
-            //layout: 'anchor',
+            layout: 'absolute',
+            region: 'center',
             labelWidth: 80,
-            defaults: Ext.isIE6 ? {width: '150px', border:false, readOnly: true} : {width: '100%', border:false, readOnly: true},
+            anchor: '100% 100%',
             defaultType: 'textfield',
-            autoHeight: true,
-            bodyStyle: Ext.isIE ? 'padding:0 0 0px 0px;' : 'padding:5px 0px;',
             border: false,
-            style: {
-                "margin-left": "10px",
-                "margin-right": Ext.isIE6 ? (Ext.isStrict ? "-10px" : "-13px") : "0"
-            },
             items: [{
-                fieldLabel: OpenLayers.i18n('Title'),
-                name: 'title'
+                x: 0,
+                y: 0,
+                xtype:'label',
+                text: this.descriptionText
             },{
-                fieldLabel: OpenLayers.i18n('Name'),
-                name: 'name'
-            },{
-                xtype: 'radiogroup',
-                columns: 'auto',
-                fieldLabel: OpenLayers.i18n('Queryable'),
-                name: 'queryable',
-                defaults: {readOnly: true},
-                items: [{
-                    name: 'queryableBox',
-                    inputValue: "true",
-                    boxLabel: OpenLayers.i18n("Yes")
-                }, {
-                    name: 'queryableBox',
-                    inputValue: "",
-                    boxLabel: OpenLayers.i18n("No")
-                }]
-            },{
-                xtype: 'radiogroup',
-                columns: 'auto',
-                fieldLabel: OpenLayers.i18n('Can add ?'),
-                name: 'srsCompatible',
-                defaults: {readOnly: true},
-                items: [{
-                    name: 'srsCompatibleBox',
-                    inputValue: "true",
-                    boxLabel: OpenLayers.i18n("Yes")
-                }, {
-                    name: 'srsCompatibleBox',
-                    inputValue: "false",
-                    boxLabel: OpenLayers.i18n("No")
-                }]
-            },{
                 xtype: 'textarea',
-                fieldLabel: OpenLayers.i18n('Description'),
                 name: 'abstract',
-	        height: nDescHeight	
+                x: 0,
+                y: 15,
+                anchor: '100% 100%'
             }]
         };
 
         return options;
-
     },
 
-    mapPreview: function(grid, index) {
-        var record = grid.getStore().getAt(index);
-        var layer = record.get("layer").clone();
-        
-        var win = new Ext.Window({
-            title: OpenLayers.i18n('Preview') + ": " + record.get("title"),
-            width: 512,
-            height: 256,
-            layout: "fit",
-            items: [{
-                xtype: "gx_mappanel",
-                layers: [layer],
-                extent: record.get("llbbox")
-            }]
-        });
-        win.show();
-    },
-
+    /** private: method[initMyToolbar]
+     *
+     *  Initializes the widget toolbars.  The bottom toolbars contains :
+     *  - a textfield used to hold the layer's name
+     *  - 'add' and 'close' buttons.
+     */
     initMyToolbar: function() {
         var items = [];
 
         items.push('->');
 
+        // LayerName textfield
+        items.push({
+            xtype: 'label',
+            text: this.layerNameText
+        });
+        this.layerNameField = new Ext.form.TextField(
+            Ext.applyIf(
+                this.layerNameFieldOptions, {
+                    width: 275,
+                    xtype: 'textfield'
+            })
+        );
+        items.push(this.layerNameField);
+
+        items.push('-');
+
         // AddLayer action
         var actionOptions = {
             handler: this.addLayer,
             scope: this,
-            tooltip: OpenLayers.i18n('Add currently selected layer')
+            tooltip: this.addSelectedLayersText
         };
 
         if (this.useIcons === true) {
             actionOptions.iconCls = "gx-wmsbrowser-addlayer";
         } else {
-            actionOptions.text = OpenLayers.i18n('Add Layer');
+            actionOptions.text = this.addLayerText;
         }
 
         var action = new Ext.Action(actionOptions);
         items.push(action);
 
-        // Cancel/Close action... todo
-
-
         Ext.apply(this, {bbar: new Ext.Toolbar(items)});
     },
 
-    addLayer: function() {
-        var grid = Ext.getCmp('wms_capabilities_grid_panel');
-        var record = grid.getSelectionModel().getSelected();
-        if(record) {
-            // check the projection of the map is supported by the layer
-            if (record.get("srsCompatible") === false) {
-                var error = "This layer can't be added to the current map" + 
-                            " because it doesn't support its projection.";
-                alert(OpenLayers.i18n(error));
+    /** private: method[triggerGetCapabilities]
+     *
+     *  Called when the user clicks the 'connect' button.  Validate that the
+     *  url is valid and trigger a GetCapabilities request.
+     */
+    triggerGetCapabilities: function() {
+        var url = this.serverComboBox.getValue();
+
+        // if url in not valid
+        if(!this.serverComboBox.isValid()) {
+            // if url is blank, throw error
+            if(!url) {
+                this.fireEvent('genericerror', this.pleaseInputURLText);
                 return;
             }
+            // if url is not blank and the widget don't allow invalid urls, 
+            // throw error
+            else if (!this.allowInvalidUrl){
+                this.fireEvent('genericerror', this.inputURLInvalidText);
+                return;
+            }
+        }
 
-            var copy = record.clone();
+        this.fireEvent('beforegetcapabilities');
 
-            // the following line gives a "too much recursion" error.
-            //copy.set("layer", record.get("layer"));
-            copy.data.layer = record.data.layer.clone();
+        // keep the inputed url in order to add it to the url store later if
+        // it was valid
+        this.currentUrl = url;
 
-            copy.get("layer").mergeNewParams({
-                format: "image/png",
-                transparent: "true"
-            });
-            this.layerStore.add(copy);
+        // add the GetCapabilities parameters to the url
+        var params = OpenLayers.Util.getParameterString(this.capabilitiesParams);        
+        url = OpenLayers.Util.urlAppend(url, params);
 
-            if(this.zoomOnLayerAdded) {
-                // zoom to added layer extent (in the current map projection)
-                this.layerStore.map.zoomToExtent(
-                    OpenLayers.Bounds.fromArray(copy.get("llbbox")).transform(
-                        new OpenLayers.Projection("EPSG:4326"),
-                        new OpenLayers.Projection(
-                            this.layerStore.map.getProjection()))
-                );
-            }
+        if (OpenLayers.ProxyHost && OpenLayers.String.startsWith(url, "http")) {
+            url = OpenLayers.ProxyHost + encodeURIComponent(url);
+        }
 
-            if(this.closeOnLayerAdded && 
-               this.ownerCt.getXType() == Ext.Window.xtype) {
-                this.closeWindow();
-            }
+        // change the url of the capability store proxy
+        this.capStore.proxy.setUrl(url);
+        this.capStore.proxy.setApi(Ext.data.Api.actions.read, url);
 
-        } else {
-            // means no record was selected
-            if(grid.store.getTotalCount() > 0) {
-                var error = "Please, select a layer from the grid first.";
-                alert(OpenLayers.i18n(error));
-            } else {
-                var error = "Please, enter an url in the textbox " + 
-                            "then click \'Connect\'.";
-                alert(OpenLayers.i18n(error));
-            }
-        }
+        this.capStore.load();
     },
 
+    /** private: method[onWMSCapabilitiesStoreLoad]
+     *  :param store: ``GeoExt.data.WMSGetCapabilitiesStore``
+     *  :param records: ``Array(GeoExt.data.LayerRecord)``
+     *  :param options: ``Object``
+     *
+     *  Called after a GetCapabilities request.  If the request returned
+     *  records, that means it was a valid server so add it in the dropdown
+     *  list.
+     *
+     *  For each returned layer records, validate that it supports the map's
+     *  projection and intersects the map's extent.
+     */
     onWMSCapabilitiesStoreLoad: function(store, records, options) {
         var srs = this.layerStore.map.getProjection();
-        var grid = Ext.getCmp('wms_capabilities_grid_panel');
-        var urlField = Ext.getCmp('wms_url');
 
+        var mapMaxExtent = this.layerStore.map.getMaxExtent().clone().transform(
+            new OpenLayers.Projection(this.layerStore.map.getProjection()),
+            new OpenLayers.Projection('EPSG:4326')
+        );
+
+        if (this.layerPreview) {
+            this.mapPanelPreview.layers.removeAll();
+            this.mapPanelPreview.map.addLayer(new OpenLayers.Layer("dummy"));
+            this.layerPreview = null;
+        }
+
         // loop through all records (layers) to see if they contain the current
-        // map projection
+        // map projection and intersects the map extent.
         for(var i=0; i<records.length; i++) {
             var record = records[i];
 
@@ -510,28 +670,149 @@
             } else {
                 record.set("srsCompatible", false);
             }
+
+            // Check if the llbbox 
+            var layerExtent = record.get("llbbox");
+            var extent;
+            if (layerExtent) 
+            {
+                if(typeof layerExtent == "string") {
+                    extent = OpenLayers.Bounds.fromString(layerExtent);
+                } else if(layerExtent instanceof Array) {
+                    extent = OpenLayers.Bounds.fromArray(layerExtent);
+                }
+            }
+
+            if (!extent || mapMaxExtent.intersectsBounds(extent, false)) {
+                record.set("extentCompatible", true);
+            } else {
+                record.set("extentCompatible", false);
+            }
         }
 
-        if(grid.store.getCount() > 0) {
+        if(this.gridPanel.store.getCount() > 0) {
+            this.fireEvent('getcapabilitiessuccess');
+
             // select the first element of the list on load end
-            grid.getSelectionModel().selectRow(0);
+            if (this.selectFirstRecordOnStoreLoad) {
+                this.gridPanel.getSelectionModel().selectRow(0);
+            }
 
             // the url that was used was a valid WMS server, keep it if the
             // url field is a combobox and if it's not already added
-            if(urlField.getXType() == Ext.form.ComboBox.xtype) {
-                var aszUrls = urlField.store.getValueArray('url');
+            if(this.serverComboBox.getXType() == Ext.form.ComboBox.xtype) {
+                var aszUrls = this.serverComboBox.store.getValueArray('url');
                 if(OpenLayers.Util.indexOf(aszUrls, this.currentUrl) == -1) {
                     var record = new Ext.data.Record({'url': this.currentUrl});
-                    urlField.store.add([record]);
+                    this.serverComboBox.store.add([record]);
                 }
             }
+        } else {
+            this.fireEvent('genericerror', this.noLayerReturnedText);
         }
     },
 
+    onWMSCapabilitiesStoreLoadException: function() {
+        this.fireEvent('getcapabilitiesfail');
+    },
+
+    /** private: method[addLayer]
+     *
+     *  From all currently selected layer records, create a single
+     *  :class:`GeoExt.data.LayerRecord` object and add it to the
+     *  :class:`GeoExt.data.LayerStore` object.  Called when the user clicks the
+     *  'addLayer' button.
+     */
+    addLayer: function() {
+        var records = this.gridPanel.getSelectionModel().getSelections();
+
+        // VALIDATION : record selection or connection established
+        if (records.length == 0) {
+            // if no record was selected
+            if(this.gridPanel.store.getTotalCount() > 0) {
+                this.fireEvent('genericerror', this.pleaseSelectALayerText);
+            } else {
+                this.fireEvent('genericerror', this.pleaseInputURLText);
+            }
+
+            return;
+        }
+
+        // VALIDATION : layername not empty
+        var layerName = this.layerNameField.getValue();
+        if (!layerName || layerName == "") {
+            this.fireEvent('genericerror', this.pleaseInputLayerNameText);
+            return;
+        }
+
+        var newlayerRecord, layersParam = [];
+
+        for (var i=0, len=records.length; i<len; i++) {
+            var record = records[i];
+
+            // check the projection of the map is supported by the layer
+            if (record.get("srsCompatible") === false) {
+                alert( this.srsNotSupportedText);
+                continue;
+            }
+
+            if (!newLayerRecord) {
+                var newLayerRecord = record.clone();
+
+                // the following line gives a "too much recursion" error.
+                //newLayerRecord.set("layer", record.get("layer"));
+                newLayerRecord.data.layer = record.data.layer.clone();
+
+                newLayerRecord.get("layer").mergeNewParams({
+                    format: "image/png",
+                    transparent: "true"
+                });
+
+                layersParam.push(newLayerRecord.get("layer").params.LAYERS);
+            } else {
+                layersParam.push(record.get("layer").params.LAYERS);
+            }
+
+        }
+
+        if (newLayerRecord) {
+            newLayerRecord.get("layer").mergeNewParams(
+                {'LAYERS': layersParam}
+            );
+
+            newLayerRecord.get("layer").name = 
+                this.layerNameField.getValue();
+
+            this.layerStore.add(newLayerRecord);
+
+            this.fireEvent('layeradded');
+
+            if(this.zoomOnLayerAdded) {
+                // zoom to added layer extent (in the current map projection)
+                this.layerStore.map.zoomToExtent(
+                    OpenLayers.Bounds.fromArray(newLayerRecord.get("llbbox")).transform(
+                        new OpenLayers.Projection("EPSG:4326"),
+                        new OpenLayers.Projection(
+                            this.layerStore.map.getProjection()))
+                );
+            }
+
+            if(this.closeOnLayerAdded && 
+               this.ownerCt.getXType() == Ext.Window.xtype) {
+                this.closeWindow();
+            }
+        }
+    },
+
+    /** private: method[boolRenderer]
+     *  :param bool: ``Boolean``
+     *
+     *  Renders boolean values in color and with alternate text value.
+     */
     boolRenderer: function(bool) {
         return (bool)
-            ? '<span style="color:green;">' + OpenLayers.i18n("Yes") + '</span>'
-            : '<span style="color:red;">' + OpenLayers.i18n("No") + '</span>';
+            ? '<span style="color:green;">' + this.yesText + '</span>'
+            : '<span style="color:red;">' + this.noText + '</span>';
     },
 
     /** private: method[onAfterRender]
@@ -544,17 +825,20 @@
         }
     },
 
+    /** private: method[addCloseButton]
+     *  Adds a 'close' button to the bottom toolbar.
+     */
     addCloseButton : function() {
         var actionOptions = {
             handler: this.closeWindow,
             scope: this,
-            tooltip: OpenLayers.i18n('Close this window')
+            tooltip: this.closeWindowText
         };
 
         if (this.useIcons === true) {
             actionOptions.iconCls = "gx-wmsbrowser-close";
         } else {
-            actionOptions.text = OpenLayers.i18n('Close');
+            actionOptions.text = this.closeText;
         }
 
         var action = new Ext.Action(actionOptions);
@@ -562,13 +846,205 @@
         this.getBottomToolbar().add(action);
     },
 
+    /** private: method[closeWindow]
+     *  Hides the :class:`Ext.Window`.  Only used if the widget was rendered
+     *  inside one.
+     */
     closeWindow: function() {
         this.ownerCt.hide();
     },
 
+    /** private: method[urlValidator]
+     *  :param url: ``String``  The url inputed or selected
+     *  :return: ``Boolean``  Whether the url is valid or not.
+     */
     urlValidator: function(url) {
-        var result = Ext.form.VTypes.url(url);
+        return Ext.form.VTypes.url(url);
+    },
 
-        return result;
+    /** private: method[addLayerToPreview]
+     *  :param record: ``GeoExt.data.LayerRecord``  The selected layer record
+     *
+     *  Add selected layer records to the exiting
+     *  :class:`GeoExt.data.LayerRecord` object if it exists else create a new
+     *  one, then recenter the map preview on the newly added data.
+     */
+    addLayerToPreview: function(record) {
+        if (!this.layerPreview) {
+            this.layerPreview = record.clone();
+            this.layerPreview.data.layer = record.data.layer.clone();
+            this.layerPreview.get("layer").mergeNewParams({
+                format: "image/png",
+                transparent: "true"
+            });
+
+            this.layerPreview.get("layer").mergeNewParams(
+                {'LAYERS': [this.layerPreview.get("layer").params.LAYERS]}
+            );
+
+            this.mapPanelPreview.layers.add(this.layerPreview);
+
+            if (this.mapPanelPreview.collapsed) {
+                this.hideLayerPreview();
+            }
+
+            this.zoomToRecordLLBBox(this.layerPreview);
+        } else {
+            this.layerPreview.get("layer").params.LAYERS.push(
+                record.get("layer").params.LAYERS
+            );
+            this.layerPreview.get("layer").mergeNewParams(
+                {'LAYERS': this.layerPreview.get("layer").params.LAYERS}
+            );
+            this.zoomToRecordLLBBox(record, false);
+        }
+    },
+
+    /** private: method[removeLayerFromPreview]
+     *  :param record: ``GeoExt.data.LayerRecord``  The unselected layer record
+     *
+     *  Remove the unselected layer from the :class:`GeoExt.data.LayerRecord`
+     *  params.
+     */
+    removeLayerFromPreview: function(record) {
+        if (!this.layerPreview) {
+            return;
+        }
+
+        var layers = this.layerPreview.get("layer").params.LAYERS;
+        var index = OpenLayers.Util.indexOf(
+            layers, record.get("layer").params.LAYERS
+        );
+
+        if (index != -1) {
+            layers.splice(index, 1);
+        }
+
+        this.layerPreview.get("layer").mergeNewParams({'LAYERS': layers});
+    },
+
+    /** private: method[zoomToRecordLLBBox]
+     *  :param record: ``GeoExt.data.LayerRecord``  The layer record to zoom to
+     *
+     *  Get the 'llbbox' value of the record layer and zoom to its location.
+     */
+    zoomToRecordLLBBox: function(record, zoomToMaxExtent) {
+        if (zoomToMaxExtent == null) {
+            zoomToMaxExtent = true;
+        }
+        var zoomed = false;
+
+        var layerExtent = record.get("llbbox");
+        if (layerExtent) 
+        {
+            var extent;
+            if(typeof layerExtent == "string") {
+                extent = OpenLayers.Bounds.fromString(layerExtent);
+            } else if(layerExtent instanceof Array) {
+                extent = OpenLayers.Bounds.fromArray(layerExtent);
+            }
+            
+            if (extent) {
+                this.mapPanelPreview.map.zoomToExtent(extent);
+                zoomed = true;
+            }
+        }
+
+        if (zoomToMaxExtent && !zoomed) {
+            this.mapPanelPreview.zoomToMaxExtent();
+        }
+    },
+
+    /** private: method[hideLayerPreview]
+     *  Hide the layer preview.
+     */
+    hideLayerPreview: function() {
+        if (this.layerPreview) {
+            this.layerPreview.get('layer').setVisibility(false);
+        }
+    },
+
+    /** private: method[showLayerPreview]
+     *  Show the layer preview.
+     */
+    showLayerPreview: function() {
+        if (this.layerPreview) {
+            this.layerPreview.get('layer').setVisibility(true);
+        }
+    },
+
+    /** private: method[getLayerNameFromSelectedRecords]
+     *  :return:  ``String`` The string of all selected layer
+     *
+     *  Get all currently selected layer record 'title' or 'name', merge them
+     *  together in a single string separated by ',' and return it.
+     */
+    getLayerNameFromSelectedRecords: function() {
+        var layerName = [];
+        var records = this.gridPanel.getSelectionModel().getSelections();
+
+        for (var i=0, len=records.length; i<len; i++) {
+            var record = records[i];
+            if (record.get('title') != "") {
+                layerName.push(record.get('title'));
+            } else if (record.get('name') != "") {
+                layerName.push(record.get('name'));
+            }
+        }
+
+        return layerName.join(', ');
+    },
+
+    /** private: method[setLayerNameFromSelectedRecords]
+     *  Set the layerName field value to all the selected layer record 'title'
+     *  or 'name'. 
+     */
+    setLayerNameFromSelectedRecords: function() {
+        this.layerNameField.setValue(this.getLayerNameFromSelectedRecords());
+    },
+
+    /** private: method[]
+     *  :param record: ``GeoExt.data.LayerRecord``  The layer record to check
+     *
+     *  :return:  ``Boolean`` Wheter the record is selectable or not.
+     *
+     *  Check if a layer can be selected by checking its 'srsCompatible' and
+     *  'extentCompatible' properties.  Throw errors if it's not.
+     */
+    isRecordSelectable: function(record) {
+        var compatible = true;
+        var reasons = [];
+
+        // check if srs is valid
+        if (!record.get("srsCompatible")) {
+            compatible = false;
+            reasons.push(
+                this.srsNotSupportedShortText +
+                " (" + this.layerStore.map.getProjection() + ")"
+            );
+        }
+
+        // check if exent is valid
+        if (!record.get("extentCompatible")) {
+            compatible = false;
+            reasons.push(
+                this.extentNotSupportedShortText +
+                " (" + this.layerStore.map.getExtent().toBBOX() + ")"
+            );
+        }
+
+        // output a message if not valid
+        if (!compatible) {
+            var layerName = "";
+            if (record.get('title') != "") {
+                layerName = record.get('title') + " : ";
+            } else if (record.get('name') != "") {
+                layerName = record.get('name') + " : ";
+            }
+            var message = layerName + this.layerCantBeAddedText + reasons.join(', ');
+            this.fireEvent('genericerror', message);
+        }
+
+        return compatible;
     }
 });

Added: sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/widgets/WMSBrowserStatusBar.js
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/widgets/WMSBrowserStatusBar.js	                        (rev 0)
+++ sandbox/mapgears/geoext.ux/ux/WMSBrowser/lib/GeoExt.ux/widgets/WMSBrowserStatusBar.js	2010-08-24 13:40:45 UTC (rev 2279)
@@ -0,0 +1,154 @@
+/**
+ * Copyright (c) 2008-2010 The Open Source Geospatial Foundation
+ * 
+ * Published under the BSD license.
+ * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text
+ * of the license.
+ */
+
+Ext.namespace("GeoExt.ux")
+
+/**
+ * @include GeoExt.ux/widgets/WMSBrowser.js
+ */
+
+/** api: (define)
+ *  module = GeoExt.ux
+ *  class = WMSBrowserStatusBar
+ */
+
+if (Ext.ux.StatusBar) {
+
+    /** api: constructor
+     *  .. class:: WMSBrowserStatusBar
+     */
+    GeoExt.ux.WMSBrowserStatusBar = Ext.extend(Ext.ux.StatusBar, {
+
+        /* begin i18n */
+        /** api: config[text] ``String`` i18n */
+        text: 'Ready',
+
+        /** api: config[busyText] ``String`` i18n */
+        busyText: 'Loading layers...',
+
+        /** api: config[defaultText] ``String`` i18n */
+        defaultText: 'Ready',
+        /* end i18n */
+
+        /** api: config[iconCls]
+         *  ``String``  The default 'iconCls' value.
+         */
+        iconCls: 'x-status-valid',
+
+        /** api: config[defaultIconCls]
+         *  ``String``  The default 'defaultIconCls' value.
+         */
+        defaultIconCls: 'x-status-valid',
+
+        /** private: property[wmsbrowser]
+         *  :class:`GeoExt.ux.WMSBrowser`  The widget in which to listen
+         *  custom events to display the messages and status.
+         */
+        wmsbrowser: null,
+
+        /** private: method[constructor]
+         */
+        constructor: function(config) {
+            Ext.apply(this, config);
+            arguments.callee.superclass.constructor.call(this, config);
+
+            // event registrations
+            this.wmsbrowser.on(
+                'beforegetcapabilities',
+                this.onBeforeGetCapabilities,
+                this
+            );
+
+            this.wmsbrowser.on(
+                'getcapabilitiessuccess',
+                this.onGetCapabilitiesSuccess,
+                this
+            );
+
+            this.wmsbrowser.on(
+                'getcapabilitiesfail',
+                this.onGetCapabilitiesFail,
+                this
+            );
+
+            this.wmsbrowser.on(
+                'genericerror',
+                this.onGenericError,
+                this
+            );
+
+            this.wmsbrowser.on(
+                'layeradded',
+                this.onLayerAdded,
+                this
+            );
+        },
+
+        /** private: method[onBeforeGetCapabilities]
+         *  Called when a "beforegetcapabilities" event is fired by the 
+         *  :class:`GeoExt.ux.WMSBrowser` widget.  Set the status bar to "busy".
+         */
+        onBeforeGetCapabilities: function() {
+            this.showBusy();
+        },
+
+        /** private: method[onGetCapabilitiesSuccess]
+         *  Called when a "getcapabilitiessuccess" event is fired by the 
+         *  :class:`GeoExt.ux.WMSBrowser` widget.  Shows the according success
+         *  message.
+         */
+        onGetCapabilitiesSuccess: function() {
+            this.setStatus({
+                text: this.wmsbrowser.layersSuccessfullyLoadedText,
+                iconCls: 'x-status-valid',
+                clear: true
+            });
+        },
+
+        /** private: method[onGetCapabilitiesFail]
+         *  Called when a "getcapabilitiessuccess" event is fired by the 
+         *  :class:`GeoExt.ux.WMSBrowser` widget.  Shows the according failure
+         *  message.
+         */
+        onGetCapabilitiesFail: function() {
+            this.setStatus({
+                text: this.wmsbrowser.urlInvalidText,
+                iconCls: 'x-status-error',
+                clear: true
+            });
+        },
+
+        /** private: method[onGenericError]
+         *  :param message: ``String``  The error message sent by the event.
+         *
+         *  Called when a "genericerror" event is fired by the 
+         *  :class:`GeoExt.ux.WMSBrowser` widget.  Shows the message sent by
+         *  the event.
+         */
+        onGenericError: function(message) {
+            this.setStatus({
+                text: message,
+                iconCls: 'x-status-error',
+                clear: true
+            });
+        },
+
+        /** private: method[onLayerAdded]
+         *  Called when a "layeradded" event is fired by the 
+         *  :class:`GeoExt.ux.WMSBrowser` widget.  Shows the according success
+         *  message.
+         */
+        onLayerAdded: function() {
+            this.setStatus({
+                text: this.wmsbrowser.layerAddedText,
+                iconCls: 'x-status-valid',
+                clear: true
+            });
+        }
+    });
+}

Modified: sandbox/mapgears/geoext.ux/ux/WMSBrowser/resources/lang/fr.js
===================================================================
--- sandbox/mapgears/geoext.ux/ux/WMSBrowser/resources/lang/fr.js	2010-08-21 13:04:23 UTC (rev 2278)
+++ sandbox/mapgears/geoext.ux/ux/WMSBrowser/resources/lang/fr.js	2010-08-24 13:40:45 UTC (rev 2279)
@@ -1,26 +1,43 @@
-OpenLayers.Util.extend(OpenLayers.Lang.fr, {
-    'Select or input a server address (URL)': "Sélectionner ou entrer une adresse de serveur (URL)",
-    'Input the server address (URL)': "Entrer une adresse de serveur (URL) ",
-    'Connect': "Connexion",
-    'Login information (optional)': "Information de connexion (optionnel)",
-    'Username': "Nom d'usager",
-    'Password': "Mot de passe",
-    'Please, enter an url in the textbox first': "Veuillez entrer une url dans la boite de texte d'abord",
-    'Add': "Ajout",
-    'Title': "Titre",
-    'Name': "Nom", 
-    'Queryable': "Interrogeable",
-    'Description': "Description",
-    'Yes': "Oui",
-    'No': "Non",
-    'Can add ?': "Ajoutable",
-    'Preview': "Aperçu",
-    'Add currently selected layer': "Ajouter la couche présentement sélectionnée",
-    'Add Layer': "Ajouter la couche",
-    'This layer can\'t be added to the current map because it doesn\'t support its projection.': "Cette couche ne peut être ajoutée puisque qu'elle ne supporte pas la projection de la carte.",
-    'Please, select a layer from the grid first.': "Veuillez sélectionner une couche dans la grille d'abord",
-    'Please, enter an url in the textbox then click \'Connect\'.': "Veuillez entrer une url dans la boîte de texte puis cliquer sur 'Connexion'",
-    'Close this window': "Fermer cette fenêtre",
-    'Close': "Fermer",
-    'The url address entered is not valid.': "L'adresse url entrée est non conforme."
-});
+Ext.namespace("GeoExt.ux")
+if (GeoExt.ux.WMSBrowser) {
+    Ext.apply(GeoExt.ux.WMSBrowser.prototype, {
+    inputURLText: "Sélectionner ou entrer une adresse de serveur (URL)",
+    connectText: "Connexion",
+    pleaseInputURLText: "Veuillez sélectionner ou entrer une adresse de serveur (URL) dans la boîte déroulante d'abord.",
+    srsCompatibleText: "SRS compatible",
+    extentCompatibleText: "Extent compatible",
+    titleText: "Titre",
+    nameText: "Nom",
+    queryableText: "Interrogeable",
+    descriptionText: "Description",
+    yesText: "Oui",
+    noText: "Non",
+    addLayerText: "Ajouter",
+    addSelectedLayersText: "Ajouter les couches présentement sélectionnées en tant qu'une seule couche.",
+    mapPanelPreviewTitleText: "Aperçu de la carte",
+    layerCantBeAddedText: "Cette couche ne peut être ajoutée : ",
+    srsNotSupportedText: "Cette couche ne peut être ajoutée à la présente carte parce qu'elle ne supporte pas sa projection.",
+    srsNotSupportedShortText: "elle ne supporte pas la projection de la carte",
+    extentNotSupportedShortText: "elle est en dehors de l'extent de la carte",
+    pleaseSelectALayerText: "Veuillez sélectionner une ou plusieurs couches dans la grille d'abord.",
+    closeWindowText: "Fermer cette fenêtre",
+    closeText: "Fermer",
+    inputURLInvalidText: "L'adresse (url) entrée n'est pas valide.",
+    layerNameText: "Nom de la couche :",
+    noLayerReturnedText: "L'adresse entrée est valide mais n'a retourné aucune couches.",
+    layersSuccessfullyLoadedText: "Couches chargées avec succès.",
+    layerAddedText: "Couche(s) ajoutée(s) avec succès à la carte",
+    urlInvalidText: "L'addresse de serveur (url) n'est pas valide ou n'est pas un serveur WMS valide.",
+    pleaseInputLayerNameText: "Veuillez saisir un nom de couche dans la boîte de texte ci-dessous.",
+    warningText: "Avertissement",
+    errorText: "Erreur"
+    });
+}
+
+if (GeoExt.ux.WMSBrowserStatusBar) {
+    Ext.apply(GeoExt.ux.WMSBrowserStatusBar.prototype, {
+        text: 'Prêt',
+        defaultText: 'Prêt',
+        busyText: 'Chargement des couches...'
+    });
+}



More information about the Commits mailing list