Merge pull request #4106 from solgenomics/topic/wishlist
[sgn.git] / mason / gem / experimental_design / basic_expdesign_info.mas
blob19ead439644b3a4374b49bdac04f37dc28d0b36e
1 <%doc>
3 =head1 NAME 
4  
5  basic_expdesign_info.mas
6  Mason component to show the basic information for experimental design web page.
8 =cut
10 =head1 VERSION 
12 0.1
14 =cut 
16 =head1 DESCRIPTION
18  Mason component to show the basic information for experimental design web page.
20  - Mason root page = experimental_design_detail.mas
21  - Perl controller = experimental_design.pl
23 =cut
25 =head 1 AUTHOR
27  Aureliano Bombarely (ab782@cornell.edu)
29 =cut 
31 </%doc>
34 <%args>
35 $expdesign
36 </%args>
39 <%perl>
40 use strict;
41 use warnings;
43 use CXGN::GEM::Schema;
44 use CXGN::Page::FormattingHelpers  qw/ info_section_html info_table_html columnar_table_html page_title_html html_break_string /;
46 my $basic_info_content;
47 my $expdesign_accession;
49 my $default_message = '<i><font color="gray">data not available</font></i>';
51 ## If there aren't any experiment_row that comes from experimental_design_detail.mas, it will return a message.
53 if (defined $expdesign->get_experimental_design_id()) {
54    
55     my $schema = $expdesign->get_schema();
57     my $expdesign_name = $expdesign->get_experimental_design_name();
58     $expdesign_accession = $expdesign_name;
60     my $expdesign_type = $expdesign->get_design_type();
61     my $description = $expdesign->get_description();
63     ## Get the external links
65     my @dbxref_list_id = $expdesign->get_dbxref_list();
66     my @dbxref_html_list = ();
68     foreach my $dbxref_id (@dbxref_list_id) {
69         my ($dbxref_row) = $schema->resultset('General::Dbxref')
70                                   ->search({ dbxref_id => $dbxref_id });
72         if (defined $dbxref_row) {
73             my ($db_row) = $schema->resultset('General::Db')
74                                   ->search({ db_id => $dbxref_row->get_column('db_id') });
75             
76             my $dbxref_link = $db_row->get_column('urlprefix') . 
77                               $db_row->get_column('url') . 
78                               $dbxref_row->get_column('accession');
80             my $dbxref_html = $db_row->get_column('name') . 
81                               ": <a href=$dbxref_link>" . 
82                               $dbxref_row->get_column('accession')."</a>";
84             push @dbxref_html_list, $dbxref_html;
85         }
86     }
87     
88     my $dbxref_html_list = join('<br>', @dbxref_html_list) || $default_message;
90     ## Create the HTML table
92     $basic_info_content = <<HTML;
94     <table width="100%">
95         <tr> <td width="25%"> <b>Experimental design name:</b>   </td> <td> $expdesign_name </td></tr>
96         <tr> <td width="25%"> <b>Experimental design type:</b>   </td> <td> $expdesign_type </td></tr>
97         <tr> <td width="25%"> <b>Description:</b>                </td> <td> $description </td></tr>
98         <tr> <td width="25%"> <b>Experimental design links:</b>  </td> <td> $dbxref_html_list </td></tr>
99    </table>
101 HTML
103 } else {
104    $basic_info_content = "<big>There aren't any experimental design data for the specified parameters.</big>";
105 }   
107 my $basic_info_html;
108 if (defined $expdesign_accession) {
109    $basic_info_html = "<center><big><b>Expression Experimental Design: $expdesign_accession</b></big></center><br>";
112 $basic_info_html .= info_section_html( title => "Experimental Design Basic Information", contents => $basic_info_content );
114 </%perl>
116 <% $basic_info_html %>
118 <& 
119    /util/import_javascript.mas, 
120    classes => 'CXGN.Effects'