Add useFeedTitle option to georss layer -- defaults to true -- to determine

whether to use the remote title or the local name. (Closes #731)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@4226 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-09-12 02:18:33 +00:00
parent 8f402c063f
commit f662d49682
2 changed files with 26 additions and 6 deletions

View File

@@ -48,6 +48,12 @@ OpenLayers.Layer.GeoRSS = OpenLayers.Class(OpenLayers.Layer.Markers, {
*/
popupSize: null,
/**
* APIProperty: useFeedTitle
* {Boolean} Set layer.name to the first <title> element in the feed. Default is true.
*/
useFeedTitle: true,
/**
* Constructor: OpenLayers.Layer.GeoRSS
* Create a GeoRSS Layer.
@@ -86,12 +92,17 @@ OpenLayers.Layer.GeoRSS = OpenLayers.Class(OpenLayers.Layer.Markers, {
doc = OpenLayers.parseXMLString(ajaxRequest.responseText);
}
this.name = null;
try {
this.name = doc.getElementsByTagNameNS('*', 'title')[0].firstChild.nodeValue;
}
catch (e) {
this.name = doc.getElementsByTagName('title')[0].firstChild.nodeValue;
if (this.useFeedTitle) {
var name = null;
try {
name = doc.getElementsByTagNameNS('*', 'title')[0].firstChild.nodeValue;
}
catch (e) {
name = doc.getElementsByTagName('title')[0].firstChild.nodeValue;
}
if (name) {
this.setName(name);
}
}
/* Try RSS items first, then Atom entries */