[Commits] r278 - in sandbox/opengeo/geoexplorer: examples lib/GeoExt/data

commits at geoext.org commits at geoext.org
Thu Mar 26 07:29:39 CET 2009


Author: tschaub
Date: 2009-03-26 07:29:39 +0100 (Thu, 26 Mar 2009)
New Revision: 278

Modified:
   sandbox/opengeo/geoexplorer/examples/wms-capabilities.js
   sandbox/opengeo/geoexplorer/lib/GeoExt/data/WMSCapabilitiesReader.js
Log:
Adding relevant fields to layer records from capabilities docs.

Modified: sandbox/opengeo/geoexplorer/examples/wms-capabilities.js
===================================================================
--- sandbox/opengeo/geoexplorer/examples/wms-capabilities.js	2009-03-26 05:26:28 UTC (rev 277)
+++ sandbox/opengeo/geoexplorer/examples/wms-capabilities.js	2009-03-26 06:29:39 UTC (rev 278)
@@ -1,8 +1,8 @@
-
+var store;
 Ext.onReady(function() {
     
     // create a new WMS capabilities store
-    var store = new GeoExt.data.WMSCapabilitiesStore({
+    store = new GeoExt.data.WMSCapabilitiesStore({
         url: "data/wmscap.xml"
     });
     // load the store with records derived from the doc at the above url
@@ -15,12 +15,13 @@
         columns: [
             {header: "Title", dataIndex: "title", sortable: true},
             {header: "Name", dataIndex: "name", sortable: true},
-            {id: "description", header: "Description", dataIndex: "abstract"},
+            {header: "Queryable", dataIndex: "queryable", sortable: true, width: 70},
+            {id: "description", header: "Description", dataIndex: "abstract"}
         ],
         autoExpandColumn: "description",
         renderTo: "capgrid",
         height: 300,
-        width: 600,
+        width: 650,
         listeners: {
             rowdblclick: mapPreview
         }

Modified: sandbox/opengeo/geoexplorer/lib/GeoExt/data/WMSCapabilitiesReader.js
===================================================================
--- sandbox/opengeo/geoexplorer/lib/GeoExt/data/WMSCapabilitiesReader.js	2009-03-26 05:26:28 UTC (rev 277)
+++ sandbox/opengeo/geoexplorer/lib/GeoExt/data/WMSCapabilitiesReader.js	2009-03-26 06:29:39 UTC (rev 278)
@@ -22,7 +22,6 @@
  * meta - {Object} Reader configuration.
  * recordType - {Array | Ext.data.Record} An array of field configuration
  *     objects or a record object.  Default is <GeoExt.data.LayerRecord>.
- *     TODO: only works with LayerRecord right now (see #27).
  *
  * Configuration options (meta properties):
  * format - {OpenLayers.Format} A parser for transforming the XHR response
@@ -34,8 +33,23 @@
     if(!meta.format) {
         meta.format = new OpenLayers.Format.WMSCapabilities();
     }
+    if(!(typeof recordType === "function")) {
+        recordType = GeoExt.data.LayerRecord.create(
+            recordType || meta.fields || [
+                {name: "name", type: "string"},
+                {name: "abstract", type: "string"},
+                {name: "queryable", type: "boolean"},
+                {name: "formats"},
+                {name: "styles"},
+                {name: "llbbox"},
+                {name: "minScale"},
+                {name: "maxScale"},
+                {name: "prefix"}
+            ]
+        );
+    }
     GeoExt.data.WMSCapabilitiesReader.superclass.constructor.call(
-        this, meta, recordType || meta.fields || GeoExt.data.LayerRecord
+        this, meta, recordType
     );
 };
 



More information about the Commits mailing list