1 package SGN
::Controller
::Search
;
3 use URI
::FromHash
'uri';
4 use namespace
::autoclean
;
7 use CXGN
::Search
::CannedForms
;
8 use CXGN
::Page
::Toolbar
::SGN
;
9 use CXGN
::Glossary
qw(get_definitions create_tooltips_from_text);
12 use CatalystX
::GlobalContext
qw( $c );
14 BEGIN {extends 'Catalyst::Controller'; }
18 SGN::Controller::Search - SGN Search Controller
22 SGN Search Controller. Most, but not all, search code interacts with this
23 controller. This controller defines the general search interface that used to
24 live at direct_search.pl, and links to all other kinds of search.
29 $_[1]->stash->{template} = '/search/stub.mas';
38 Public path: /search/glossary
40 Runs the glossary search.
44 sub glossary : Path('/search/glossary') :Args() {
45 my ( $self, $c, $term ) = @_;
48 my @defs = get_definitions($term);
50 $response = "<p>Your term was not found. <br> The term you searched for was $term.</p>";
52 $response = "<hr /><dl><dt>$term</dt>";
54 $response .= "<dd>$d</dd><br />";
61 <h2>Glossary search</h2>
62 <form action="#" method='get' name='glossary'>
63 <b>Search the glossary by term:</b>
64 <input type = 'text' name = 'getTerm' size = '50' tabindex='0' />
65
66 <input type = 'submit' value = 'Lookup' /></form>
67 <script type="text/javascript" language="javascript">
68 document.glossary.getTerm.focus();
80 =head2 old_direct_search
82 Public path: /search/direct_search.pl
84 Redirects to the new search functionality.
88 sub old_direct_search
: Path
('/search/direct_search.pl') {
89 my ( $self, $c ) = @_;
91 my $term = $c->req->param('search');
93 $term =~ s/[{}\n\r;'"]//g;
95 # map the old direct_search param to the new scheme
99 qtl
=> 'phenotypes/qtl',
103 platform
=> 'expression/platform',
104 template
=> 'expression/template',
105 experiment
=> 'expression/experiment',
108 est_library
=> 'transcripts/est_library',
109 est
=> 'transcripts/est',
110 unigene
=> 'transcripts/unigene',
111 library
=> 'transcripts/est_library',
113 template_experiment_platform
=> 'expression',
115 bacs
=> 'genomic/clones',
117 phenotype_qtl_trait
=> 'phenotypes',
121 $c->res->redirect('/search/'.$term, 301 );
126 Public path: /search/index.pl, /search/
128 Display a search index page.
132 sub search_index
: Path
('/search/index.pl') Path
('/search') Args
(0) {
133 my ( $self, $c ) = @_;
135 $c->stash->{template
} = '/search/advanced_search.mas';
138 sub family_search
: Path
('/search/family') Args
(0) {
139 $_[1]->stash->{content
} = CXGN
::Search
::CannedForms
->family_search_form();
142 sub marker_search
: Path
('/search/markers') Args
(0) {
143 my ( $self, $c ) = @_;
144 my $dbh = $c->dbc->dbh;
145 my $mform = CXGN
::Search
::CannedForms
::MarkerSearch
->new($dbh);
146 $c->stash->{content
} =
147 '<form action="/search/markers/markersearch.pl">'
153 sub bac_search
: Path
('/search/genomic/clones') Args
(0) {
154 $_[1]->stash->{content
} = CXGN
::Search
::CannedForms
->clone_search_form();
157 sub directory_search
: Path
('/search/directory') Args
(0) {
158 $_[1]->stash->{content
} = CXGN
::Search
::CannedForms
->people_search_form();
161 #sub gene_search : Path('/search/loci') Args(0) {
162 # $_[1]->stash->{content} = CXGN::Search::CannedForms->gene_search_form();
165 sub images_search
: Path
('/search/images') Args
(0) {
168 $c->stash->{template
} = '/search/images.mas';
169 #$_[1]->stash->{content} = CXGN::Search::CannedForms->image_search_form(); ####DEPRECATED CGIBIN CODE
172 sub bulk_search
: Path
('/search/bulk') Args
(0) {
177 $c->res->redirect( uri
( path
=> '/user/login', query
=> { goto_url
=> $c->req->uri->path_query } ) );
181 $c->stash->{template
} = '/search/bulk.mas';
186 Converted to Catalyst by Jonathan "Duke" Leto, then heavily refactored
191 This library is free software. You can redistribute it and/or modify
192 it under the same terms as Perl itself.
196 __PACKAGE__
->meta->make_immutable;