1 package SGN
::Controller
::Search
;
3 use namespace
::autoclean
;
5 use CXGN
::Search
::CannedForms
;
6 use CXGN
::Page
::Toolbar
::SGN
;
7 use CXGN
::Glossary
qw(get_definitions create_tooltips_from_text);
10 use CatalystX
::GlobalContext
qw( $c );
12 BEGIN {extends 'Catalyst::Controller'; }
16 SGN::Controller::Search - SGN Search Controller
20 SGN Search Controller. Most, but not all, search code interacts with this
21 controller. This controller defines the general search interface that used to
22 live at direct_search.pl, and links to all other kinds of search.
27 $_[1]->stash->{template} = '/search/stub.mas';
36 Public path: /search/glossary
38 Runs the glossary search.
42 sub glossary : Path('/search/glossary') :Args() {
43 my ( $self, $c, $term ) = @_;
46 my @defs = get_definitions($term);
48 $response = "<p>Your term was not found. <br> The term you searched for was $term.</p>";
50 $response = "<hr /><dl><dt>$term</dt>";
52 $response .= "<dd>$d</dd><br />";
59 <h2>Glossary search</h2>
60 <form action="#" method='get' name='glossary'>
61 <b>Search the glossary by term:</b>
62 <input type = 'text' name = 'getTerm' size = '50' tabindex='0' />
63
64 <input type = 'submit' value = 'Lookup' /></form>
65 <script type="text/javascript" language="javascript">
66 document.glossary.getTerm.focus();
78 =head2 old_direct_search
80 Public path: /search/direct_search.pl
82 Redirects to the new search functionality.
86 sub old_direct_search
: Path
('/search/direct_search.pl') {
87 my ( $self, $c ) = @_;
89 my $term = $c->req->param('search');
90 # map the old direct_search param to the new scheme
94 qtl
=> 'phenotypes/qtl',
98 platform
=> 'expression/platform',
99 template
=> 'expression/template',
100 experiment
=> 'expression/experiment',
103 est_library
=> 'transcripts/est_library',
104 est
=> 'transcripts/est',
105 unigene
=> 'transcripts/unigene',
106 library
=> 'transcripts/est_library',
108 template_experiment_platform
=> 'expression',
110 bacs
=> 'genomic/clones',
112 phenotype_qtl_trait
=> 'phenotypes',
116 $c->res->redirect('/search/'.$term, 301 );
121 Public path: /search/index.pl, /search/
123 Display a search index page.
127 sub search_index
: Path
('/search/index.pl') Path
('/search') Args
(0) {
128 my ( $self, $c ) = @_;
131 content
=> $c->view('Toolbar')->index_page('search'),
133 $c->forward('View::Mason');
136 sub family_search
: Path
('/search/family') Args
(0) {
137 $_[1]->stash->{content
} = CXGN
::Search
::CannedForms
->family_search_form();
140 sub marker_search
: Path
('/search/markers') Args
(0) {
141 my ( $self, $c ) = @_;
142 my $dbh = $c->dbc->dbh;
143 my $mform = CXGN
::Search
::CannedForms
::MarkerSearch
->new($dbh);
144 $c->stash->{content
} =
145 '<form action="/search/markers/markersearch.pl">'
151 sub bac_search
: Path
('/search/genomic/clones') Args
(0) {
152 $_[1]->stash->{content
} = CXGN
::Search
::CannedForms
->clone_search_form();
155 sub directory_search
: Path
('/search/directory') Args
(0) {
156 $_[1]->stash->{content
} = CXGN
::Search
::CannedForms
->people_search_form();
159 #sub gene_search : Path('/search/loci') Args(0) {
160 # $_[1]->stash->{content} = CXGN::Search::CannedForms->gene_search_form();
163 sub images_search
: Path
('/search/images') Args
(0) {
164 $_[1]->stash->{content
} = CXGN
::Search
::CannedForms
->image_search_form();
170 Converted to Catalyst by Jonathan "Duke" Leto, then heavily refactored
175 This library is free software. You can redistribute it and/or modify
176 it under the same terms as Perl itself.
180 __PACKAGE__
->meta->make_immutable;