5 SGN::Controller::DocumentBrowser - a controller for viewing document browser page
9 The document browser is a tool that allows the user to upload a tsv file. The file is archived so others can view it as well. Users can then search the file for text matches and the value from the first column can then be saved to a list.
16 package SGN
::Controller
::DocumentBrowser
;
19 use URI
::FromHash
'uri';
21 BEGIN { extends
'Catalyst::Controller'; }
24 sub document_browser
:Path
('/tools/documents/') :Args
(0) {
27 my $bcs_schema = $c->dbic_schema('Bio::Chado::Schema', 'sgn_chado');
29 my $user = $c->user();
31 $c->res->redirect( uri
( path
=> '/solpeople/login.pl', query
=> { goto_url
=> $c->req->uri->path_query } ) );
37 my $q = "SELECT file_id, m.create_date, p.sp_person_id, p.username, basename, dirname, filetype FROM metadata.md_files JOIN metadata.md_metadata as m using(metadata_id) JOIN sgn_people.sp_person as p ON (p.sp_person_id=m.create_person_id) WHERE filetype='document_browser' and m.obsolete = 0 ORDER BY file_id ASC";
38 my $h = $bcs_schema->storage()->dbh()->prepare($q);
41 while (my ($file_id, $create_date, $person_id, $username, $basename, $dirname, $filetype) = $h->fetchrow_array()) {
42 $file_info{$file_id} = [$file_id, $create_date, $person_id, $username, $basename, $dirname, $filetype];
44 foreach (keys %file_info){
45 push @file_array, $file_info{$_};
48 $c->stash->{files
} = \
@file_array;
49 $c->stash->{template
} = '/tools/document_browser.mas';