Index: OpenGuides/Config.pm =================================================================== --- OpenGuides/Config.pm (revision 717) +++ OpenGuides/Config.pm (working copy) @@ -8,9 +8,9 @@ dbtype dbname dbuser dbpass dbhost script_name install_directory script_url custom_lib_path use_plucene indexing_directory enable_page_deletion admin_pass stylesheet_url site_name navbar_on_home_page home_name - site_desc default_city default_country contact_email default_language + site_desc default_city default_state default_country contact_email default_language formatting_rules_node formatting_rules_link backlinks_in_title template_path custom_template_path - geo_handler ellipsoid + geo_handler ellipsoid use_geocoder flickr_key flickr_secret flickr_auth_token gmaps_api_key ); my @questions = map { $_ . "__qu" } @variables; OpenGuides::Config->mk_accessors( @variables ); @@ -99,7 +99,7 @@ if ( $self->can( $var ) ) { # handle any garbage in file gracefully $self->$var( $stored{$var} ); } else { - warn "Don't know what to do with variable '$var'"; + #warn "Don't know what to do with variable '$var'"; } } Index: OpenGuides/Template.pm =================================================================== --- OpenGuides/Template.pm (revision 717) +++ OpenGuides/Template.pm (working copy) @@ -113,7 +113,6 @@ my $script_name = $config->script_name; my $script_url = $config->script_url; - my $default_city = $config->default_city; # Check cookie to see if we need to set the formatting_rules_link. my ($formatting_rules_link, $omit_help_links); @@ -146,13 +145,13 @@ home_link => $script_url . $script_name, home_name => $config->home_name, navbar_on_home_page => $config->navbar_on_home_page, + gmaps_api_key => $config->gmaps_api_key, omit_help_links => $omit_help_links, formatting_rules_link => $formatting_rules_link, formatting_rules_node => $formatting_rules_node, openguides_version => $OpenGuides::VERSION, enable_page_deletion => $enable_page_deletion, language => $config->default_language, - default_city => $default_city, }; if ($args{node}) { @@ -296,7 +295,7 @@ ); if ( $args{metadata} ) { - foreach my $var ( qw( phone fax address postcode os_x os_y osie_x + foreach my $var ( qw( phone fax address city postcode os_x os_y osie_x osie_y latitude longitude map_link website summary) ) { $vars{$var} = $metadata{$var}[0]; @@ -338,7 +337,7 @@ ); } } else { - foreach my $var ( qw( phone fax address postcode map_link website summary) ) { + foreach my $var ( qw( phone fax address city postcode map_link website summary) ) { $vars{$var} = $q->param($var); } Index: OpenGuides/RDF.pm =================================================================== --- OpenGuides/RDF.pm (revision 717) +++ OpenGuides/RDF.pm (working copy) @@ -48,9 +48,9 @@ }; $self->{site_name} = $config->site_name; $self->{default_city} = $config->default_city || ""; + $self->{default_state} = $config->default_state || ""; $self->{default_country} = $config->default_country || ""; $self->{site_description} = $config->site_desc || ""; - $self->{og_version} = $args{og_version}; $self; } @@ -62,11 +62,13 @@ my $wiki = $self->{wiki}; my %node_data = $wiki->retrieve_node( $node_name ); + my $content = $wiki->format($node_data{content}) || ''; my $phone = $node_data{metadata}{phone}[0] || ''; my $fax = $node_data{metadata}{fax}[0] || ''; my $website = $node_data{metadata}{website}[0] || ''; my $opening_hours_text = $node_data{metadata}{opening_hours_text}[0] || ''; my $address = $node_data{metadata}{address}[0] || ''; + my $state = $node_data{metadata}{state}[0] || $self->{default_state}; my $postcode = $node_data{metadata}{postcode}[0] || ''; my $city = $node_data{metadata}{city}[0] || $self->{default_city}; my $country = $node_data{metadata}{country}[0] || $self->{default_country}; @@ -130,19 +132,22 @@ xmlns="http://www.w3.org/2000/10/swap/pim/contact#" > - + } . $self->{site_name} . qq{: $node_name $timestamp $timestamp $username - $version + $content <$objType rdf:ID="obj" dc:title="$node_name"> }; $rdf .= " $summary\n" if $summary; + $rdf .= " \n"; + $rdf .= " $state" if $state && $is_geospatial; $rdf .= "\n \n\n" if @categories; $rdf .= " $_\n" foreach @categories; Index: OpenGuides/Utils.pm =================================================================== --- OpenGuides/Utils.pm (revision 717) +++ OpenGuides/Utils.pm (working copy) @@ -5,6 +5,7 @@ $VERSION = '0.08'; use Carp qw( croak ); +use Flickr::API; use CGI::Wiki; use CGI::Wiki::Formatter::UseMod; use CGI::Wiki::Plugin::RSS::Reader; @@ -111,7 +112,7 @@ # Make formatter. my $script_name = $config->script_name; - my $search_url = $config->script_url . "search.cgi"; + my $search_url = $config->script_url . "supersearch.cgi"; my %macros = ( '@SEARCHBOX' => @@ -127,6 +128,23 @@ my $link_title = $_[2] || "View all pages in $_[0] $_[1]"; return qq($link_title); }, + qr/\[\[Image:(\d+)(?:\|(s|m|l))?(?:\|(.*))?\]\]/i => + sub { + my ($wiki, $id, $size, $style) = @_; + $size = $size || "s"; + + my $api = new Flickr::API({'key' => $config->flickr_key, + 'secret' => $config->flickr_secret}); + my $response = $api->execute_method('flickr.photos.getInfo', { + 'photo_id' => $id + }); + my $data = $response->content(); + $data =~ m/); + }, qr/\@INDEX_LIST\s+\[\[(Category|Locale)\s+([^\]]+)]]/ => sub { my ($wiki, $type, $value) = @_; @@ -200,7 +218,7 @@ implicit_links => 0, allowed_tags => [qw(a p b strong i em pre small img table td tr th br hr ul li center blockquote kbd - div code strike sub sup font)], + div code strike sub sup font span)], macros => \%macros, pass_wiki_to_macros => 1, node_prefix => "$script_name?", Index: OpenGuides.pm =================================================================== --- OpenGuides.pm (revision 714) +++ OpenGuides.pm (working copy) @@ -9,6 +9,7 @@ use OpenGuides::Template; use OpenGuides::Utils; use Time::Piece; +use LWP::Simple; use URI::Escape; use vars qw( $VERSION ); @@ -153,7 +154,7 @@ $tt_vars{index_type} = lc($type); $tt_vars{index_value} = $2; $tt_vars{"rss_".lc($type)."_url"} = - $config->script_name . "?action=rc;format=rss;" + $config->script_name . "?action=rss;" . lc($type) . "=" . lc(CGI->escape($2)); } @@ -542,6 +543,12 @@ elsif ( $args{format} eq "plain" ) { $template = "plain_index.tt"; $conf{content_type} = "text/plain"; + } elsif ( $args{format} eq "map" ) { + my $q = CGI->new; + $tt_vars{zoom} = $q->param('zoom') || ''; + $tt_vars{lat} = $q->param('lat') || ''; + $tt_vars{long} = $q->param('long') || ''; + $template = "map_index.tt"; } } else { $template = "site_index.tt"; @@ -736,6 +743,15 @@ $metadata{longitude} = delete $metadata{longitude_unmunged} if $metadata{longitude_unmunged}; + if ($config->use_geocoder and $metadata{address} and $metadata{city} and !$metadata{longitude} and !$metadata{latitude}) { + my $where = "$metadata{address}, $metadata{city}, ".$config->default_state; + my $addr = uri_escape($where); + my @result = get("http://rpc.geocoder.us/service/csv?address=$addr" ); + my $result = "@result"; + my ($lat, $long, @rest) = split(",", $result); + $metadata{latitude} = $lat; + $metadata{longitude} = $long; + } # Check to make sure all the indexable nodes are created foreach my $type (qw(Category Locale)) { my $lctype = lc($type);