Changeset 547

Show
Ignore:
Timestamp:
11/16/04 13:50:24 (4 years ago)
Author:
kake
Message:

Fix bugs with latlong representation.

Location:
trunk
Files:
1 added
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/MANIFEST

    r545 r547  
    7575t/63_bug_map_link_no_address.t 
    7676t/64_bug_node_history.t 
     77t/66_bug_latlong_representation.t 
    7778t/templates/15_test.tt 
    7879wiki.cgi 
  • trunk/lib/OpenGuides.pm

    r544 r547  
    527527    my $node = $args{id}; 
    528528    my $q = $args{cgi_obj}; 
     529    my $return_output = $args{return_output}; 
    529530    my $wiki = $self->wiki; 
    530531    my $config = $self->config; 
     
    541542 
    542543    $metadata{opening_hours_text} = $q->param("hours_text") || ""; 
     544 
     545    # Pick out the unmunged versions of lat/long if they're set. 
     546    # (If they're not, it means they weren't munged in the first place.) 
     547    $metadata{latitude} = delete $metadata{latitude_unmunged} 
     548        if $metadata{latitude_unmunged}; 
     549    $metadata{longitude} = delete $metadata{longitude_unmunged} 
     550        if $metadata{longitude_unmunged}; 
    543551 
    544552    # Check to make sure all the indexable nodes are created 
     
    577585 
    578586    if ($written) { 
    579         print $self->redirect_to_node($node); 
     587        my $output = $self->redirect_to_node($node); 
     588        return $output if $return_output; 
     589        print $output; 
    580590    } else { 
    581591        my %node_data = $wiki->retrieve_node($node); 
  • trunk/lib/OpenGuides/Template.pm

    r530 r547  
    297297 
    298298    # Check whether we need to munge lat and long. 
     299    # Store them unmunged as well so commit_node can get hold of them. 
    299300    my %prefs = OpenGuides::CGI->get_prefs_from_cookie( config => $config ); 
    300301    if ( $prefs{latlong_traditional} ) { 
    301302        foreach my $var ( qw( latitude longitude ) ) { 
     303            $vars{$var."_unmunged"} = $vars{$var}; 
    302304            $vars{$var} = Geography::NationalGrid->deg2string($vars{$var}); 
    303305        } 
  • trunk/templates/node.tt

    r545 r547  
    3333    </select> 
    3434    of here. 
    35     <input type="hidden" name="lat" value="[% latitude %]" /> 
    36     <input type="hidden" name="long" value="[% longitude %]" /> 
     35    <input type="hidden" name="lat" value="[% IF latitude_unmunged %][% latitude_unmunged %][% ELSE %][% latitude %][% END %]" /> 
     36    <input type="hidden" name="long" value="[% IF longitude_unmunged %][% longitude_unmunged %][% ELSE %][% longitude %][% END %]" /> 
    3737    <input type="submit" name="Go" value="Go" class="form_button" /> 
    3838  </form>