The OpenLayers server threw a disk, and clobbered another, resulting in a loss
of data up to our last backup. In the previous subversion repository, this was r1694->r1777. I'm sorry to all those of you who might have checked out that code, as this will surely cause problems for you. We're currently working to figure out what went wrong, and how to prevent it in the future. git-svn-id: http://svn.openlayers.org/trunk/openlayers@1695 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -51,8 +51,33 @@ OpenLayers.Layer.GeoRSS.prototype =
|
||||
if (!doc || ajaxRequest.fileType!="XML") {
|
||||
doc = OpenLayers.parseXMLString(ajaxRequest.responseText);
|
||||
}
|
||||
this.name = doc.getElementsByTagName("title")[0].firstChild.nodeValue;
|
||||
var itemlist = doc.getElementsByTagName('item');
|
||||
|
||||
this.name = null;
|
||||
try {
|
||||
this.name = doc.getElementsByTagNameNS('*', 'title')[0].firstChild.nodeValue;
|
||||
}
|
||||
catch (e) {
|
||||
this.name = doc.getElementsByTagName('title')[0].firstChild.nodeValue;
|
||||
}
|
||||
|
||||
/* Try RSS items first, then Atom entries */
|
||||
var itemlist = null;
|
||||
try {
|
||||
itemlist = doc.getElementsByTagNameNS('*', 'item');
|
||||
}
|
||||
catch (e) {
|
||||
itemlist = doc.getElementsByTagName('item');
|
||||
}
|
||||
|
||||
if (itemlist.length == 0) {
|
||||
try {
|
||||
itemlist = doc.getElementsByTagNameNS('*', 'entry');
|
||||
}
|
||||
catch(e) {
|
||||
itemlist = doc.getElementsByTagName('entry');
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < itemlist.length; i++) {
|
||||
var data = {};
|
||||
var point = OpenLayers.Util.getNodes(itemlist[i], 'georss:point');
|
||||
@@ -72,44 +97,52 @@ OpenLayers.Layer.GeoRSS.prototype =
|
||||
location = new OpenLayers.LonLat(parseFloat(location[1]), parseFloat(location[0]));
|
||||
|
||||
/* Provide defaults for title and description */
|
||||
var title = "No title";
|
||||
var title = "Untitled";
|
||||
try {
|
||||
title = OpenLayers.Util.getNodes(itemlist[i],
|
||||
"title")[0].firstChild.nodeValue;
|
||||
}
|
||||
catch (e) { alert(e); }
|
||||
|
||||
var description = "No description";
|
||||
catch (e) { title="Untitled"; }
|
||||
|
||||
/* First try RSS descriptions, then Atom summaries */
|
||||
var descr_nodes = null;
|
||||
try {
|
||||
description = OpenLayers.Util.getNodes(itemlist[i],
|
||||
"description")[0].firstChild.nodeValue;
|
||||
descr_nodes = itemlist[i].getElementsByTagNameNS("*",
|
||||
"description");
|
||||
}
|
||||
catch (e) { alert(e); }
|
||||
catch (e) {
|
||||
descr_nodes = itemlist[i].getElementsByTagName("description");
|
||||
}
|
||||
if (descr_nodes.length == 0) {
|
||||
try {
|
||||
descr_nodes = itemlist[i].getElementsByTagNameNS("*",
|
||||
"summary");
|
||||
}
|
||||
catch (e) {
|
||||
descr_nodes = itemlist[i].getElementsByTagName("summary");
|
||||
}
|
||||
}
|
||||
|
||||
var description = "No description.";
|
||||
try {
|
||||
description = descr_nodes[0].firstChild.nodeValue;
|
||||
}
|
||||
catch (e) { description="No description."; }
|
||||
|
||||
try { var link = OpenLayers.Util.getNodes(itemlist[i], "link")[0].firstChild.nodeValue; } catch (e) { }
|
||||
data.icon = OpenLayers.Marker.defaultIcon();
|
||||
data.popupSize = new OpenLayers.Size(250, 100);
|
||||
data.popupSize = new OpenLayers.Size(250, 120);
|
||||
if ((title != null) && (description != null)) {
|
||||
contentHTML = "<br />";
|
||||
contentHTML += "<div style='margin: -0.5em 0.5em 0.5em 0.5em'>"
|
||||
|
||||
contentHTML += "<div style='height: 1.3em; overflow: hidden'>";
|
||||
contentHTML += "<span style='font-size: 1.2em; font-weight: bold'>";
|
||||
if (link) contentHTML += "<a href='"+link+"' target='_blank'>";
|
||||
contentHTML += title;
|
||||
if (link) contentHTML += "</a>";
|
||||
contentHTML += "</span>";
|
||||
contentHTML += "</div>";
|
||||
|
||||
|
||||
contentHTML += "<span style='font-size: 0.7em; align:center'>";
|
||||
contentHTML = '<div class="olLayerGeoRSSClose">[x]</div>';
|
||||
contentHTML += '<div class="olLayerGeoRSSTitle">';
|
||||
if (link) contentHTML += '<a class="link" href="'+link+'" target="_blank">';
|
||||
contentHTML += title;
|
||||
if (link) contentHTML += '</a>';
|
||||
contentHTML += '</div>';
|
||||
contentHTML += '<div style="" class="olLayerGeoRSSDescription">';
|
||||
contentHTML += description;
|
||||
contentHTML += "</span>";
|
||||
|
||||
contentHTML += "</div>"
|
||||
data['popupContentHTML'] = contentHTML;
|
||||
|
||||
//data['popupContentHTML'] = '<h2>'+title+'</h2><p>'+description+'</p>';
|
||||
contentHTML += '</div>';
|
||||
data['popupContentHTML'] = contentHTML;
|
||||
}
|
||||
var feature = new OpenLayers.Feature(this, location, data);
|
||||
this.features.push(feature);
|
||||
|
||||
Reference in New Issue
Block a user