Parent Directory | Revision Log
Implement OpenSearch for Frey::Shell::Grep
1 | package Frey::OpenSearch; |
2 | use Moose; |
3 | |
4 | extends 'Frey'; |
5 | with 'Frey::Web'; |
6 | with 'Frey::File'; |
7 | |
8 | use MIME::Base64; |
9 | |
10 | sub grep_as_markup { |
11 | my $self = shift; |
12 | |
13 | warn "# url ", $self->dump( $self->request_url ); |
14 | |
15 | my $url = qq|http://localhost:3000/Frey::Shell::Grep/as_markup|; # FIXME don't hard-code URL |
16 | my $icon = encode_base64( $self->read_file( 'static/icons/Frey/Shell/Grep.png' ) ); |
17 | |
18 | $self->content_type( 'text/xml' ); |
19 | |
20 | qq| |
21 | <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" |
22 | xmlns:moz="http://www.mozilla.org/2006/browser/search/"> |
23 | <ShortName>Frey::Shell::Grep</ShortName> |
24 | <Description>Find something with grep</Description> |
25 | <InputEncoding>UTF-8</InputEncoding> |
26 | <Image height="16" width="16">data:image/png;base64,$icon</Image> |
27 | <SearchForm>$url</SearchForm> |
28 | <Url type="text/html" |
29 | method="get" |
30 | template="$url"> |
31 | <Param name="pattern" value="{searchTerms}"/> |
32 | </Url> |
33 | <!-- |
34 | <Url type="application/x-suggestions+json" template="suggestionURL"/> |
35 | <moz:SearchForm>$url</moz:SearchForm> |
36 | --> |
37 | </OpenSearchDescription> |
38 | |; |
39 | } |
40 | |
41 | =head1 SEE ALSO |
42 | |
43 | L<http://developer.mozilla.org/en/docs/Creating_OpenSearch_plugins_for_Firefox> |
44 | |
45 | =cut |
46 | |
47 | 1; |
ViewVC Help | |
Powered by ViewVC 1.1.26 |