Changeset 338

Show
Ignore:
Timestamp:
03/26/04 17:28:30 (5 years ago)
Author:
earle
Message:

Fixed RDF.pm to use default city and country if the node in question is geospatial in topic.
Added language to TT vars for search.

Location:
trunk/lib/OpenGuides
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/OpenGuides/RDF.pm

    r333 r338  
    143143    my $opening_hours_text = $node_data{metadata}{opening_hours_text}[0] || ''; 
    144144    my $postcode           = $node_data{metadata}{postcode}[0]           || ''; 
    145     my $city               = $node_data{metadata}{city}[0]               || ''; 
    146     my $country            = $node_data{metadata}{country}[0]            || ''; 
     145    my $city               = $node_data{metadata}{city}[0]               || $self->{default_city}; 
     146    my $country            = $node_data{metadata}{country}[0]            || $self->{default_country}; 
    147147    my $latitude           = $node_data{metadata}{latitude}[0]           || ''; 
    148148    my $longitude          = $node_data{metadata}{longitude}[0]          || ''; 
     
    154154    my @locales            = @{ $node_data{metadata}{locale} || [] }; 
    155155 
    156     my $objType; 
     156    my ($is_geospatial, $objType); 
    157157 
    158158    if ($latitude || $longitude || $postcode || $city || $country || @locales) 
    159159    { 
    160       $objType = 'geo:SpatialThing'; 
     160      $is_geospatial = 1; 
     161      $objType    = 'geo:SpatialThing'; 
    161162    } 
    162163    else 
     
    203204  <$objType rdf:ID="obj" dc:title="$node_name"> 
    204205}; 
    205  
    206206    $rdf .= "    <!-- categories -->\n"; 
    207     $rdf .= "    <dc:subject>$_</dc:subject>\n" foreach @{$catrefs}; 
     207    $rdf .= "    <dc:subject>$_</dc:subject>\n"             foreach @{$catrefs}; 
    208208    $rdf .= "\n    <!-- address and geospatial data -->\n"; 
    209     $rdf .= "    <city>$city</city>" if $city; 
    210     $rdf .= "    <postalCode>$postcode</postalCode>\n" if $postcode; 
    211     $rdf .= "    <country>$country</country>\n" if $country; 
    212     $rdf .= "    <wn:Neighborhood>$_</wn:Neighborhood>\n" foreach @locales; 
     209    $rdf .= "    <city>$city</city>"                        if $is_geospatial; 
     210    $rdf .= "    <postalCode>$postcode</postalCode>\n"      if $postcode; 
     211    $rdf .= "    <country>$country</country>\n"             if $is_geospatial; 
     212    $rdf .= "    <wn:Neighborhood>$_</wn:Neighborhood>\n"   foreach @locales; 
    213213 
    214214    if ($latitude && $longitude) { 
     
    224224 
    225225    $rdf .= "\n    <!-- contact information -->\n"; 
    226     $rdf .= "    <phone>$phone</phone>\n" if $phone; 
    227     $rdf .= "    <fax>$fax</fax>\n" if $fax; 
    228     $rdf .= "    <homePage>$website</homePage>\n" if $website; 
     226    $rdf .= "    <phone>$phone</phone>\n"                              if $phone; 
     227    $rdf .= "    <fax>$fax</fax>\n"                                    if $fax; 
     228    $rdf .= "    <homePage>$website</homePage>\n"                      if $website; 
    229229    $rdf .= "    <chefmoz:Hours>$opening_hours_text</chefmoz:Hours>\n" if $opening_hours_text; 
    230230 
  • trunk/lib/OpenGuides/SuperSearch.pm

    r273 r338  
    4444    my ($class, %args) = @_; 
    4545    my $config = $args{config}; 
    46     my $self = { config => $config }; 
     46    my $self   = { config => $config }; 
    4747    bless $self, $class; 
     48 
    4849    my $wiki = OpenGuides::Utils->make_wiki_object( config => $config ); 
    49     $self->{wiki} = $wiki; 
     50 
     51    $self->{wiki}     = $wiki; 
    5052    $self->{wikimain} = $config->{_}{script_url} . $config->{_}{script_name}; 
    51     $self->{css} = $config->{_}{stylesheet_url}; 
    52     $self->{head} = $config->{_}{site_name} . " Search"; 
     53    $self->{css}      = $config->{_}{stylesheet_url}; 
     54    $self->{head}     = $config->{_}{site_name} . " Search"; 
     55    $self->{language} = $config->{_}{default_language};  
     56 
    5357    return $self; 
    5458} 
     
    8791 
    8892    $tt_vars{ss_version}  = $VERSION; 
    89     $tt_vars{ss_info_url} = 'http://openguides.org/london?Search_Script'; 
     93    $tt_vars{ss_info_url} = 'http://london.openguides.org/?Search_Script'; 
    9094 
    9195    # Do we have an existing search? if so, do it. 
     
    156160    my ($self, %args) = @_; 
    157161    my $tt_vars = $args{tt_vars} || {}; 
     162    $tt_vars->{language} = $self->{language}; 
     163 
    158164    $tt_vars->{not_editable} = 1; 
    159165