Changeset 369


Ignore:
Timestamp:
Jun 10, 2004, 8:56:50 PM (18 years ago)
Author:
kake
Message:

Move locator registration to OpenGuides.pm

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/OpenGuides.pm

    r368 r369  
    33
    44use CGI;
     5use CGI::Wiki::Plugin::Locator::UK;
    56use OpenGuides::Template;
    67use OpenGuides::Utils;
     
    4041    $self->{wiki} = $wiki;
    4142    $self->{config} = $args{config};
     43    my $locator = CGI::Wiki::Plugin::Locator::UK->new;
     44    $wiki->register_plugin( plugin => $locator );
    4245    return $self;
    4346}
     
    6366    my $self = shift;
    6467    return $self->{config};
     68}
     69
     70=item B<locator>
     71
     72An accessor, returns the underlying L<CGI::Wiki::Plugin::Locator::UK> object.
     73
     74=cut
     75
     76sub locator {
     77    my $self = shift;
     78    return $self->{locator};
    6579}
    6680
  • trunk/wiki.cgi

    r368 r369  
    1212use CGI::Wiki::Search::SII;
    1313use CGI::Wiki::Formatter::UseMod;
    14 use CGI::Wiki::Plugin::Locator::UK;
    1514use CGI::Wiki::Plugin::Diff;
    1615use Config::Tiny;
     
    3635$script_url .= "/" unless $script_url =~ /\/$/;
    3736
    38 my ($guide, $wiki, $formatter, $locator, $q, $differ);
     37my ($guide, $wiki, $formatter, $q, $differ);
    3938eval {
    4039    $guide = OpenGuides->new( config => $config );
    4140    $wiki = $guide->wiki;
    4241    $formatter = $wiki->formatter;
    43     $locator = CGI::Wiki::Plugin::Locator::UK->new;
    44     $wiki->register_plugin( plugin => $locator );
    4542
    4643    $differ = CGI::Wiki::Plugin::Diff->new;
     
    9390    } elsif ($action eq 'find_within_distance') {
    9491        my $metres = $q->param("distance_in_metres");
    95         my @finds = $locator->find_within_distance( node => $node,
    96                                                     metres => $metres );
     92        my @finds = $guide->locator->find_within_distance( node  => $node,
     93                                                           metres => $metres );
    9794        my @nodes;
    9895        foreach my $find ( @finds ) {
    99             my $distance = $locator->distance( from_node => $node,
    100                                                to_node   => $find,
    101                                                unit      => "metres" );
     96            my $distance = $guide->locator->distance( from_node => $node,
     97                                                      to_node   => $find,
     98                                                      unit      => "metres" );
    10299            push @nodes, { name => $find,
    103100                           param => $formatter->node_name_to_node_param($find),
Note: See TracChangeset for help on using the changeset viewer.