Ticket #731: georss.patch
| File georss.patch, 2.2 kB (added by crschmidt, 1 year ago) |
|---|
-
tests/Layer/test_GeoRSS.html
old new 28 28 t.eq( layer.name, "Crschmidt's Places At Platial", "Layer name is correct." ); 29 29 } ); 30 30 } 31 32 function test_Layer_GeoRSS_dontUseFeedTitle (t) { 33 t.plan( 1 ); 34 layer = new OpenLayers.Layer.GeoRSS('Test Layer', georss_txt, {'useFeedTitle': false} ); 35 t.delay_call( 1, function() { 36 t.eq( layer.name, "Test Layer", "Layer name is correct when not used from feed." ); 37 } ); 38 } 39 31 40 function test_01_Layer_GeoRSS_AtomParsing (t) { 32 41 t.plan( 6 ); 33 42 layer = new OpenLayers.Layer.GeoRSS('Test Layer', atom_xml ); -
lib/OpenLayers/Layer/GeoRSS.js
old new 42 42 */ 43 43 icon: null, 44 44 45 /** 46 * APIProperty: useFeedTitle 47 * {Boolean} Set layer.name to the first <title> element in the feed. Default is true. 48 */ 49 useFeedTitle: true, 50 45 51 /** 46 52 * Constructor: OpenLayers.Layer.GeoRSS 47 53 * Create a GeoRSS Layer. … … 80 86 doc = OpenLayers.parseXMLString(ajaxRequest.responseText); 81 87 } 82 88 83 this.name = null; 84 try { 85 this.name = doc.getElementsByTagNameNS('*', 'title')[0].firstChild.nodeValue; 89 if (this.useFeedTitle) { 90 var name = null; 91 try { 92 name = doc.getElementsByTagNameNS('*', 'title')[0].firstChild.nodeValue; 93 } 94 catch (e) { 95 name = doc.getElementsByTagName('title')[0].firstChild.nodeValue; 96 } 97 if (name) { 98 this.setName(name); 99 } 86 100 } 87 catch (e) {88 this.name = doc.getElementsByTagName('title')[0].firstChild.nodeValue;89 }90 101 91 102 /* Try RSS items first, then Atom entries */ 92 103 var itemlist = null;
