Changeset 12980
- Timestamp:
- 06/01/08 18:11:01 (5 years ago)
- Location:
- lang/perl/mobirc/branches/plaggerize
- Files:
-
- 1 added
- 1 modified
-
lib/App/Mobirc/Plugin/GPS.pm (modified) (5 diffs)
-
t/Plugins/GPS.t (added)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/mobirc/branches/plaggerize/lib/App/Mobirc/Plugin/GPS.pm
r12910 r12980 11 11 use UNIVERSAL::require; 12 12 use String::TT ':all'; 13 use Encode::JP::Mobile; 14 15 has inv_geocoder => ( 16 is => 'ro', 17 isa => 'Str', 18 default => 'Null', 19 ); 13 20 14 21 hook channel_page_option => sub { 15 my ( $self, $global_context, $channel) = @_;22 my ( $self, $global_context, $channel ) = @_; 16 23 17 24 my $time = time(); … … 20 27 21 28 hook httpd => sub { 22 my ( $self, $global_context, $c, $uri) = @_;29 my ( $self, $global_context, $c, $uri ) = @_; 23 30 24 if ( $uri =~ m{^/channel/([^/]+)/gps$}) {31 if ( $uri =~ m{^/channel/([^/]+)/gps$} ) { 25 32 my $channel_name = $1; 26 33 27 34 my $config = App::Mobirc->context->config; 28 my $path = File::Spec->catfile($config->{global}->{assets_dir}, 'plugin', 'GPS', 'measure.tt2'); 35 my $path = File::Spec->catfile( $config->{global}->{assets_dir}, 36 'plugin', 'GPS', 'measure.tt2' ); 29 37 30 38 local %ENV; 31 if (my $devcap_multimedia = $c->req->header('X-UP-DEVCAP-MULTIMEDIA')) { 39 if ( my $devcap_multimedia = $c->req->header('X-UP-DEVCAP-MULTIMEDIA') ) 40 { 32 41 $ENV{HTTP_X_UP_DEVCAP_MULTIMEDIA} = $devcap_multimedia; 33 42 } 34 43 35 my $tt = Template->new( ABSOLUTE => 1);44 my $tt = Template->new( ABSOLUTE => 1 ); 36 45 $tt->process( 37 46 $path, … … 47 56 ) or warn $tt->error; 48 57 49 $c->res->content_type(encode('utf8', 'text/html; charset=Shift_JIS')); 58 $c->res->content_type( 59 encode( 'utf8', 'text/html; charset=Shift_JIS' ) ); 50 60 $c->res->body($out); 51 61 return 1; 52 } else { 62 } 63 else { 53 64 return 0; 54 65 } … … 60 71 if ($uri =~ m{^/channel/([^/]+)/gps_do$}) { 61 72 my $channel_name = uri_unescape $1; 62 my $inv_geocoder = $ conf->{inv_geocoder} || 'EkiData';73 my $inv_geocoder = $self->inv_geocoder; 63 74 64 75 my $point = $c->req->mobile_agent->get_location( $c->req->query_params ); … … 66 77 "App::Mobirc::Plugin::GPS::InvGeocoder::$inv_geocoder"->use or die $@; 67 78 my $msg = "App::Mobirc::Plugin::GPS::InvGeocoder::$inv_geocoder"->inv_geocoder($point); 68 $msg = uri_escape encode($c->req->mobile_agent->encoding, $msg);79 $msg = uri_escape encode($c->req->mobile_agent->encoding, $msg); 69 80 70 81 my $time = time();
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)