2 package SGN
::Controller
::People
;
6 use CXGN
::People
::Person
;
8 use CXGN
::Phenome
::Population
;
9 use SGN
::Controller
::solGS
::AnalysisProfile
;
10 use CXGN
::Page
::FormattingHelpers qw
/info_section_html page_title_html info_table_html simple_selectbox_html html_optional_show columnar_table_html/;
11 use CXGN
::Phenome
::Locus
;
13 BEGIN { extends
'Catalyst::Controller' };
15 sub people_search
: Path
('/search/people') Args
(0) {
18 $c->stash->{template
} = '/search/people.mas';
23 #Code migrated from /cgi-bin/solpeople/top-level.pl
24 sub people_top_level
: Path
('/solpeople/profile') Args
(1) {
27 my $person_id = shift;
28 my $dbh = $c->dbc->dbh;
30 #will redirect user to login page if they are not logged in.
31 my $user_id=CXGN
::Login
->new($dbh)->verify_session();
33 $c->res->redirect('/solpeople/login.pl');
37 if ($person_id == $user_id) {
40 my @roles = $c->user->get_roles;
46 my $p = CXGN
::People
::Person
->new($dbh, $person_id);
47 my $user_type = $p->get_user_type;
51 # User's populations sections
52 my @pops = CXGN
::Phenome
::Population
->my_populations($person_id);
54 foreach my $pop (@pops) {
55 my $pop_name = $pop->get_name();
56 my $pop_id = $pop->get_population_id();
57 my $is_public = $pop->get_privacy_status();
58 if ($is_public) { $is_public = 'is publicly available'; }
59 if ( !$is_public ) { $is_public = 'is not publicly available yet'; }
60 $pops_list .= qq |<a href
="/qtl/population/$pop_id">$pop_name</a
> <i
>($is_public)</i><br/>|;
63 $pops_list = '<h4>You have no populations.</h4>';
65 $c->stash->{populations_list
} = $pops_list;
67 ##SOLGS user's submitted jobs sections
68 my $solgs_jobs = SGN
::Controller
::solGS
::AnalysisProfile
->solgs_analysis_status_log($c);
71 $solgs_jobs_table = columnar_table_html
(
72 headings
=> [ 'Analysis name', 'Submitted on', 'Status', 'Result page'],
78 $solgs_jobs_table = '<h4>You have no submitted jobs.</h4>';
80 $c->stash->{solgs_jobs_list
} = $solgs_jobs_table;
83 my @loci = CXGN
::Phenome
::Locus
::get_locus_ids_by_editor
( $dbh, $person_id );
91 my $locus_editor_info = "<h4>You have no loci to edit.</h4>";
93 $locus_editor_info = "";
95 for ( my $i = 0 ; $i < ($max) ; $i++ ) {
96 my $locus = CXGN
::Phenome
::Locus
->new( $dbh, $loci[$i] );
97 my $symbol = $locus->get_locus_symbol();
98 my $locus_id = $locus->get_locus_id();
99 $locus_editor_info .= qq { <a href
="/phenome/locus_display.pl?locus_id=$locus_id&action=view">$symbol</a
> };
102 $locus_editor_info .= qq|<br
><b
>and <a href
="/search/locus/>$more more</a></b><br />|;
104 $c->stash->{loci_editor_privileges} = $locus_editor_info;
106 my @annotated_loci = CXGN::Phenome::Locus::get_locus_ids_by_annotator( $dbh, $person_id );
108 $max = @annotated_loci;
109 if ( @annotated_loci > 24 ) {
110 $more = @annotated_loci - 24;
113 my ( $locus_annotations, $more_annotations );
114 for ( my $i = 0 ; $i < $top ; $i++ ) {
115 my $locus = CXGN::Phenome::Locus->new( $dbh, $annotated_loci[$i] );
116 my $symbol = $locus->get_locus_symbol() ? $locus->get_locus_symbol() : '';
117 my $locus_id = $locus->get_locus_id() ? $locus->get_locus_id() : '';
120 $locus_annotations .= qq | <a href="/locus/$locus_id/view">$symbol</a> |;
122 $more_annotations .= qq { <a href
="/locus/$locus_id/view">$symbol</a
> };
126 $locus_annotations .= " and $more more, not shown.<br />";
128 $locus_annotations .= html_optional_show
( 'locus_annotations', 'Show more', qq|<div
class="minorbox">$more_annotations</div
> | );
130 $locus_annotations .= qq| <a href
="../phenome/recent_annotated_loci.pl">[View annotated loci by date
]</a
> |;
131 $c->stash->{loci_annotations
} = $locus_annotations;
135 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
. },
136 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
.},
137 curator
=> qq{ Your current user status is
<b
>$user_type</b
>. },
138 sequencer
=> qq{ Your current user status is
<b
>$user_type</b
>. You have maximum user privileges on SGN
. },
139 genefamily_editor
=> qq{ Your current user status is
<b
>$user_type</b
>. },
141 $c->stash->{user_status
} = $user_info->{$user_type};
144 $c->stash->{site_name
} = $c->config->{project_name
};
145 $c->stash->{user_roles
} = \
%roles_hash;
146 $c->stash->{sp_person_id
} = $p->get_sp_person_id;
147 $c->stash->{username
} = $c->user->get_object->get_username;
148 $c->stash->{first_name
} = $p->get_first_name;
149 $c->stash->{last_name
} = $p->get_last_name;
150 $c->stash->{is_users_profile
} = $users_profile;
151 $c->stash->{template
} = '/people/profile.mas';