Ticket #26: ticket_26.patch
| File ticket_26.patch, 3.0 kB (added by ivorw, 3 years ago) |
|---|
-
trunk/t/21_rdf.t
5 5 use OpenGuides::Utils; 6 6 use OpenGuides::Test; 7 7 use URI::Escape; 8 use Test::More tests => 2 7;8 use Test::More tests => 28; 9 9 10 10 eval { require DBD::SQLite; }; 11 11 my $have_sqlite = $@ ? 0 : 1; … … 59 59 latitude => "51.524193", 60 60 longitude => "-0.114436", 61 61 summary => "a nice pub", 62 map_link => "http://pubsite.com/calthorpe/get_there.htm", 62 63 } 63 64 ); 64 65 … … 83 84 qr|<dc:title>CGI::Wiki Test Site: Calthorpe Arms</dc:title>|, 84 85 "sets the title correctly" ); 85 86 87 like( $rdfxml, 88 qr|<os:map_link rdf:resource="http://pubsite.com/calthorpe/get_there.htm" />|, 89 "Map link" ); 90 86 91 like( $rdfxml, qr|<dc:contributor foaf:nick="Kake" />|, 87 92 "last username to edit used as contributor" ); 88 93 -
trunk/lib/OpenGuides/RDF.pm
76 76 my $username = $node_data{metadata}{username}[0] || ''; 77 77 my $os_x = $node_data{metadata}{os_x}[0] || ''; 78 78 my $os_y = $node_data{metadata}{os_y}[0] || ''; 79 my $map_link = $node_data{metadata}{map_link}[0] || ''; 79 80 my @categories = @{ $node_data{metadata}{category} || [] }; 80 81 my @locales = @{ $node_data{metadata}{locale} || [] }; 81 82 my $summary = $node_data{metadata}{summary}[0] || ''; … … 83 84 # replace any errant characters in data to prevent illegal XML 84 85 foreach ($phone, $fax, $website, $opening_hours_text, $address, $postcode, 85 86 $city, $country, $latitude, $longitude, $version, $os_x, $os_y, 86 @categories, @locales, $summary )87 @categories, @locales, $summary, $map_link) 87 88 { 88 89 if ($_) 89 90 { … … 95 96 96 97 my ($is_geospatial, $objType); 97 98 98 if ($os_x || $os_y || $latitude || $longitude || $address || $postcode || @locales || $opening_hours_text) { 99 if ($os_x || $os_y || $latitude || $longitude || $address || $postcode || 100 @locales || $opening_hours_text || $map_link) { 99 101 $is_geospatial = 1; 100 102 $objType = 'geo:SpatialThing'; 101 103 } else { … … 172 174 <os:x>$os_x</os:x> 173 175 <os:y>$os_y</os:y>}; 174 176 } 177 if ($map_link) { 178 $rdf .= qq{\n<os:map_link rdf:resource="$map_link" />}; 179 } 175 180 } 176 177 181 $rdf .= "\n\n <!-- contact information -->\n\n" if ($phone || $fax || $website || $opening_hours_text); 178 182 $rdf .= " <phone>$phone</phone>\n" if $phone; 179 183 $rdf .= " <fax>$fax</fax>\n" if $fax;
