diff --git a/lib/OpenLayers/Format/CSWGetRecords/v2_0_2.js b/lib/OpenLayers/Format/CSWGetRecords/v2_0_2.js index 049bfd1e88..e17c800d03 100644 --- a/lib/OpenLayers/Format/CSWGetRecords/v2_0_2.js +++ b/lib/OpenLayers/Format/CSWGetRecords/v2_0_2.js @@ -32,7 +32,8 @@ OpenLayers.Format.CSWGetRecords.v2_0_2 = OpenLayers.Class(OpenLayers.Format.XML, csw: "http://www.opengis.net/cat/csw/2.0.2", dc: "http://purl.org/dc/elements/1.1/", dct: "http://purl.org/dc/terms/", - ows: "http://www.opengis.net/ows" + ows: "http://www.opengis.net/ows", + ogc: "http://www.opengis.net/ogc" }, /** @@ -389,14 +390,13 @@ OpenLayers.Format.CSWGetRecords.v2_0_2 = OpenLayers.Class(OpenLayers.Format.XML, node ); } - //TODO: not implemented in ogc filters? - //if (options.SortBy) { - //this.writeNode( - //"ogc:SortBy", - //options.SortBy, - //node - //); - //} + if (options.SortBy) { + this.writeNode( + "ogc:SortBy", + options.SortBy, + node + ); + } return node; }, "ElementName": function(options) { @@ -433,7 +433,8 @@ OpenLayers.Format.CSWGetRecords.v2_0_2 = OpenLayers.Class(OpenLayers.Format.XML, } return node; } - } + }, + "ogc": OpenLayers.Format.Filter.v1_1_0.prototype.writers["ogc"] }, CLASS_NAME: "OpenLayers.Format.CSWGetRecords.v2_0_2" diff --git a/lib/OpenLayers/Format/Filter/v1_0_0.js b/lib/OpenLayers/Format/Filter/v1_0_0.js index ef1cc9853b..5e1811338d 100644 --- a/lib/OpenLayers/Format/Filter/v1_0_0.js +++ b/lib/OpenLayers/Format/Filter/v1_0_0.js @@ -130,11 +130,10 @@ OpenLayers.Format.Filter.v1_0_0 = OpenLayers.Class( box.setAttribute("srsName", filter.projection); } return node; - }}, OpenLayers.Format.Filter.v1.prototype.writers["ogc"]), - + } + }, OpenLayers.Format.Filter.v1.prototype.writers["ogc"]), "gml": OpenLayers.Format.GML.v2.prototype.writers["gml"], "feature": OpenLayers.Format.GML.v2.prototype.writers["feature"] - }, /** diff --git a/lib/OpenLayers/Format/Filter/v1_1_0.js b/lib/OpenLayers/Format/Filter/v1_1_0.js index cd36a94c89..0bec38d4a9 100644 --- a/lib/OpenLayers/Format/Filter/v1_1_0.js +++ b/lib/OpenLayers/Format/Filter/v1_1_0.js @@ -146,8 +146,39 @@ OpenLayers.Format.Filter.v1_1_0 = OpenLayers.Class( } node.appendChild(box); return node; - }}, OpenLayers.Format.Filter.v1.prototype.writers["ogc"]), - + }, + "SortBy": function(sortProperties) { + var node = this.createElementNSPlus("ogc:SortBy"); + for (var i=0,l=sortProperties.length;i'+ + ''+ + 'Title'+ + 'ASC'+ + ''+ + ''+ + 'Relevance'+ + 'DESC'+ + ''+ + ''; + + var parser = new OpenLayers.Format.Filter.v1_1_0(); + var node = parser.writers['ogc'].SortBy.call(parser, [{ + "property": 'Title', + "order": "ASC" + },{ + "property": 'Relevance', + "order": "DESC" + }]); + + t.xml_eq(node, out, "Check SortBy"); + }