2 package SGN
::Controller
::People
;
6 use URI
::FromHash
'uri';
8 use CXGN
::People
::Person
;
10 use CXGN
::Phenome
::Population
;
11 use SGN
::Controller
::solGS
::AnalysisQueue
;
12 use CXGN
::Page
::FormattingHelpers qw
/info_section_html page_title_html info_table_html simple_selectbox_html html_optional_show columnar_table_html/;
13 use CXGN
::Phenome
::Locus
;
15 BEGIN { extends
'Catalyst::Controller' };
17 sub people_search
: Path
('/search/people') Args
(0) {
20 $c->stash->{template
} = '/search/people.mas';
25 #Code migrated from /cgi-bin/solpeople/top-level.pl
26 sub people_top_level
: Path
('/solpeople/profile') Args
(1) {
29 my $person_id = shift;
30 my $dbh = $c->dbc->dbh;
32 #will redirect user to login page if they are not logged in.
33 my $user_id=CXGN
::Login
->new($dbh)->verify_session();
36 $c->res->redirect(uri
( path
=> '/user/login', query
=> { goto_url
=> $c->req->uri->path_query } ) );
40 if ($person_id == $user_id) {
43 my @roles = $c->user->get_roles;
49 my $p = CXGN
::People
::Person
->new($dbh, $person_id);
50 my $user_type = $p->get_user_type;
54 # User's populations sections
55 my @pops = CXGN
::Phenome
::Population
->my_populations($person_id);
57 foreach my $pop (@pops) {
58 my $pop_name = $pop->get_name();
59 my $pop_id = $pop->get_population_id();
60 my $is_public = $pop->get_privacy_status();
61 if ($is_public) { $is_public = 'is publicly available'; }
62 if ( !$is_public ) { $is_public = 'is not publicly available yet'; }
63 $pops_list .= qq |<a href
="/qtl/population/$pop_id">$pop_name</a
> <i
>($is_public)</i><br/>|;
66 $pops_list = '<h4>You have no populations.</h4>';
68 $c->stash->{populations_list
} = $pops_list;
71 my @loci = CXGN
::Phenome
::Locus
::get_locus_ids_by_editor
( $dbh, $person_id );
79 my $locus_editor_info = "<h4>You have no loci to edit.</h4>";
81 $locus_editor_info = "";
83 for ( my $i = 0 ; $i < ($max) ; $i++ ) {
84 my $locus = CXGN
::Phenome
::Locus
->new( $dbh, $loci[$i] );
85 my $symbol = $locus->get_locus_symbol();
86 my $locus_id = $locus->get_locus_id();
87 $locus_editor_info .= qq { <a href
="/phenome/locus_display.pl?locus_id=$locus_id&action=view">$symbol</a
> };
90 $locus_editor_info .= qq|<br
><b
>and <a href
="/search/locus/>$more more</a></b><br />|;
92 $c->stash->{loci_editor_privileges} = $locus_editor_info;
94 my @annotated_loci = CXGN::Phenome::Locus::get_locus_ids_by_annotator( $dbh, $person_id );
96 $max = @annotated_loci;
97 if ( @annotated_loci > 24 ) {
98 $more = @annotated_loci - 24;
101 my ( $locus_annotations, $more_annotations );
102 for ( my $i = 0 ; $i < $top ; $i++ ) {
103 my $locus = CXGN::Phenome::Locus->new( $dbh, $annotated_loci[$i] );
104 my $symbol = $locus->get_locus_symbol() ? $locus->get_locus_symbol() : '';
105 my $locus_id = $locus->get_locus_id() ? $locus->get_locus_id() : '';
108 $locus_annotations .= qq | <a href="/locus/$locus_id/view">$symbol</a> |;
110 $more_annotations .= qq { <a href
="/locus/$locus_id/view">$symbol</a
> };
114 $locus_annotations .= " and $more more, not shown.<br />";
116 $locus_annotations .= html_optional_show
( 'locus_annotations', 'Show more', qq|<div
class="minorbox">$more_annotations</div
> | );
118 $locus_annotations .= qq| <a href
="../phenome/recent_annotated_loci.pl">[View annotated loci by date
]</a
> |;
119 $c->stash->{loci_annotations
} = $locus_annotations;
123 user
=> qq{ Your current user status is
<b
>$user_type</b>. Please contact <a href="mailto:sgn-feedback\@sgn.cornell.edu">SGN</a> to upgrade to a
<b
>submitter
</b
> account with more privileges
. Submitters can upload user maps
, EST data
, and become locus editors
. },
124 submitter
=> qq{ Your current user status is
<b
>$user_type</b>. You have the maximum user privileges on SGN. Please contact <a href="mailto:sgn-feedback\@sgn.cornell.edu">SGN</a> if you would like to change your user status
.},
125 curator
=> qq{ Your current user status is
<b
>$user_type</b
>. },
126 sequencer
=> qq{ Your current user status is
<b
>$user_type</b
>. You have maximum user privileges on SGN
. },
127 genefamily_editor
=> qq{ Your current user status is
<b
>$user_type</b
>. },
129 $c->stash->{user_status
} = $user_info->{$user_type};
132 $c->stash->{site_name
} = $c->config->{project_name
};
133 $c->stash->{user_roles
} = \
%roles_hash;
134 $c->stash->{sp_person_id
} = $p->get_sp_person_id;
135 $c->stash->{username
} = $c->user->get_object->get_username;
136 $c->stash->{first_name
} = $p->get_first_name;
137 $c->stash->{last_name
} = $p->get_last_name;
138 $c->stash->{is_users_profile
} = $users_profile;
139 $c->stash->{template
} = '/people/profile.mas';