fix an intriguing issue raised by lint.
[sgn.git] / mason / cview / map / index.mas
blobf5f2590f83fa79f18bc9f4f8f7877ea892493fd4
2 <%doc>
4 =head1 NAME
6 /cview/map/index.mas - a Mason component to display top level map web page
8 =head1 DESCRIPTION
10 This Mason component displays a web page with an overview graph of a map, an abstract and some statistics about the map, using map_id or map_version_id as a parameter. 
12 This component is based on older Perl scripts that accepted other parameters, such as the mysterious legacy_id or the more cumbersome map short name, and a 'physical' parameter that then somehow displayed a physical map. Support for these has been scrapped. Sorry!
14 On the other hand, a new parameter was added, called "force", which, if set to true, will force the cached images and stats to be re-calculated. Normally, the map overview image and associated image map and the map statistics are cached.
16 Parameters summary:
18 =over 15
20 =item overview_image
22 The img tag and associated html to display the overview graphics [html]
24 =item map_version_id
26 the map_version_id of the map to display.
28 =item abstract
30 the abstract of the map [text]
32 =item hilite
34 a space separated, url-encoded string that gives the markers to be highlighted.
36 =item size
38 the size of the map to display. 0 denotes the standard size (smallest), 10 denotes the largest size.
40 =item map_items
42 items to add to the map, as a multi-line string with chr offset name
44 =item map_url
46 =item chr_url
48 =item comp_map_url
50 =item referer
52 the page (uri + args) that this component is called from (to be able to construct links back from the page comment feature)
54 =item map_stats
58 =item basepath
60 the basepath of the installation
62 =item force
64 if set to true, force the image and map stats caches to be re-calculated.
66 =item can_overlay
68 whether the map knows how to overlay information on the map [boolean]
70 =item private
72 whether the map is private [boolean]. Will cause the map to be shown only for logged in users who own the map.
74 =item parent1_stock_id
76 the stock_id of parent1
78 =item parent1_stock_name
80 the name of stock parent1
82 =item parent2_stock_id
84 the stock_id of parent2
86 =item parent2_stock_name
88 the name of stock parent2
90 =back
92 =head1 AUTHORS
94 Adapted to Mason by Lukas Mueller. Early Perl-only versions were written by Robert Ahrens, with later additions by Lukas Mueller and John Binns <zombieite@gmail.com>.
96 Currently maintained by Lukas Mueller <lam87\@cornell.edu>.
98 =cut
100 </%doc>
102 <%args>
103 $map_id => undef
104 $map_version_id => undef
105 $hilite => undef
106 $size => 1
107 $map_items
108 $short_name => "untitled map"
109 $long_name => "untitled map"
110 $force => 0
111 $physical => undef
112 $referer
113 $abstract => ''
114 $tempdir
115 $basepath
116 $map_url
117 $chr_url
118 $comp_maps_url => ''
119 $default_map_id => 9
120 $private => ''
121 @hilite_markers => ()
122 $marker_stats => ''
123 $chromosome_stats => ''
124 $message => ''
125 $overview_image
126 $can_overlay => 0
127 $parent1_stock_id => ''
128 $parent1_stock_name => '(unknown)'
129 $parent2_stock_id => ''
130 $parent2_stock_name => '(unknown)'
131 </%args>
133 <%perl>
136 # Historic Perl comment by Robert Ahrens, ca. 2003
138 # sub hack_abstract ($$$) {    
139 #     # Look.  This is a total hack and that's that.  Let's make no
140 #     # bones about it. There is doubtlessly a good way to handle this,
141 #     # but in the meantime this sub will allow us to swap in a decent
142 #     # abstract for the physical mapping project w/o having to redesign
143 #     # code.
144 #     my ($abstract, $map, $physical) = @_;
146 </%perl>
148 <& /page/page_title.mas, title=> $short_name &>
150 <div class="container-fluid">
152 <div id="pagetitle2"><center><h3><%$long_name%></h3></center></div>
154 % if ($private) {
155 % print $private;
156 % return;
157 %} 
159 % if ($message) { 
160 %    print "<div class=\"boxbgcolor5\"><b>NOTE:</b><br />$message</div>\n";
161 % }
163 <& /cview/map/overview.mas,
164   map_version_id => $map_version_id,
165   overview_image => $overview_image,
166   size => $size,
167   hilite_markers => [ @hilite_markers ],
168   map_items=> $map_items,
169   basepath => $basepath,
170   tempdir => $tempdir,
171   map_url => $map_url,
172   chr_url => $chr_url,
175 <& /cview/map/overlay_form.mas, 
176   map_version_id => $map_version_id,
177   can_overlay    => $can_overlay,
178   map_items      => $map_items,
179   size           => $size,
180   hilite         => $hilite,
181   map_url        => $map_url,
185 % if ($abstract) { 
187 <&| /page/info_section.mas, title=>"Abstract", collapsible=>1, collapsed=>0 &>
188 <% $abstract %>
189 </&>
191 % }
193 % my ($stock1_link, $stock2_link) = ("", "");
194 % $parent1_stock_id ?  $stock1_link='' : $stock1_link = "/stock/$parent1_stock_id/view";
195 % $parent2_stock_id ?  $stock2_link='' : $stock2_link = "/stock/$parent2_stock_id/view";
196 <&| /page/info_section.mas, collapsible => 1, title=>"Parents of Mapping Population" &>
197 <p>Parent 1 <a href="<% $stock1_link %>"><% $parent1_stock_name %></a></p>
198 <p>Parent 2 <a href="<% $stock2_link %>"><% $parent2_stock_name %></a></p>
199 </&>
202 % my $total = 0; 
203 % my $html = '<table class="table table-hover table-condensed table-bordered"><thead><tr class="info"><th>Chromosome</th><th>Markers</th></tr></thead><tbody>';
204 % foreach (@$chromosome_stats) { $html .= "<tr><td>$_->[0]</td><td>$_->[1]</td></tr>"; $total += $_->[2];  }
205 % $html .= '<tr><td><b>Total:</b></td><td>'.$total.'</td></tr></tbody>';
206 % $html .= '</table>';
207 <&| /page/info_section.mas, 
208   title => 'Map Statistics',
209   collapsible => 1,
210   collapsed => 0,
211  &>
213 <div class="row">
214   <div class="col-sm-6 col-md-6 col-lg-6">
215     <% $html %>
216   </div>
217   <div class="col-sm-6 col-md-6 col-lg-6">
218     <div class="panel panel-info">
219       <div class="panel-heading">Overview</div>
220       <div class="panel-body">
221         <% $marker_stats %>
222       </div>
223     </div>
224   </div>
225 </div>
226 </&>
228 <& /page/comments.mas, object_type=>"map", object_id => $map_version_id,  referer => $referer &>
230 </div>