diff --git a/lib/Tuba/Controller.pm b/lib/Tuba/Controller.pm index 5b90f202..8addab98 100644 --- a/lib/Tuba/Controller.pm +++ b/lib/Tuba/Controller.pm @@ -210,8 +210,8 @@ sub make_tree_for_show { my $c = shift; my $obj = shift; my %params; - $params{with_gcmd} = 1 if $c->param('with_gcmd'); - $params{with_regions} = 1 if $c->param('with_regions'); + $params{with_gcmd} = 1 unless $c->param('with_gcmd') == 0; + $params{with_regions} = 1 unless $c->param('with_regions' == 0); $params{bonsai} = 1 if $c->param('brief'); my $ret = $obj->as_tree(c => $c, %params); if (my $gcid = $ret->{uri}) { @@ -248,7 +248,7 @@ sub maybe_include_generic_pub_rels { my $obj = shift; my $pub = $obj->get_publication or return (); my $tree = {}; - $tree->{gcmd_keywords} = [ map $_->as_tree(@_), $pub->gcmd_keywords ] if $c->param('with_gcmd'); + $tree->{gcmd_keywords} = [ map $_->as_tree(@_), $pub->gcmd_keywords ] unless $c->param('with_gcmd') == 0; $tree->{regions} = [ map $_->as_tree(@_), $pub->regions] if $c->param('with_regions'); return %$tree; } diff --git a/lib/Tuba/DB/Object.pm b/lib/Tuba/DB/Object.pm index 7a0287c2..c2aaaf13 100644 --- a/lib/Tuba/DB/Object.pm +++ b/lib/Tuba/DB/Object.pm @@ -421,6 +421,12 @@ sub new_from_reference { return; } +sub get_regions { + my $c = shift; + my $pub = $c->get_publication or return; + return $pub->regions; +} + sub keywords { my $c = shift; my $pub = $c->get_publication or return; diff --git a/lib/Tuba/Region.pm b/lib/Tuba/Region.pm index 45368eb3..67f7e9a4 100644 --- a/lib/Tuba/Region.pm +++ b/lib/Tuba/Region.pm @@ -11,11 +11,17 @@ use Tuba::DB::Objects qw/-nicknames/; sub list { my $c = shift; my $report_id = $c->stash('report_identifier'); + my $pub_id = $c->stash('pub_id'); my $count; my $objects; - if ( $report_id ){ - my $report = Report->new( identifier => $report_id ); - my $publication = $report->get_publication(); + if ( $report_id || $pub_id ){ + my $publication; + if ( $report_id ) { + my $report = Report->new( identifier => $report_id ); + $publication = $report->get_publication(); + } elsif ( $pub_id ) { + $publication = Publication->new( id => $pub_id ); + } $objects = Regions->get_objects( query => [ publication_id => $publication->id ], with_objects => [qw/publications/], diff --git a/lib/Tuba/files/templates/figure/object.html.ep b/lib/Tuba/files/templates/figure/object.html.ep index 864d3a5e..f471ccb6 100644 --- a/lib/Tuba/files/templates/figure/object.html.ep +++ b/lib/Tuba/files/templates/figure/object.html.ep @@ -9,77 +9,95 @@ %= include 'edit_buttons';
This figure appears in <%= obj_link_to $chapter,'show', begin %>chapter <%= $chapter->stringify(tiny => 1) %><%= end %> - of the <%= obj_link($figure->report) %> report.
+This figure appears in <%= obj_link_to $chapter,'show', begin %>chapter <%= $chapter->stringify(tiny => 1) %><%= end %> + of the <%= obj_link($figure->report) %> report.
% } else { -This figure appears in the <%= obj_link($figure->report) %> report.
+This figure appears in the <%= obj_link($figure->report) %> report.
% } % if (my $to = fix_url($figure->url)) { -<%= link_to $to => target => "_blank" => begin %><%= $figure->url %><%= end %>
+<%= link_to $to => target => "_blank" => begin %><%= $figure->url %><%= end %>
% }<%= tbibs_to_links($figure->caption) %>
% if ($figure->source_citation){ -When citing this figure, please reference <%= tbibs_to_links($figure->source_citation) %>.
+When citing this figure, please reference <%= tbibs_to_links($figure->source_citation) %>.
% } % if ($figure->usage_limits) { -<%= $figure->usage_limits %>
+<%= $figure->usage_limits %>
% } % if (my @figs = $figure->kindred_figures) { -Other figures containing images in this figure : <%= include 'commify', objs => \@figs %>
+Other figures containing images in this figure : <%= include 'commify', objs => \@figs %>
% } % if ($figure->time_start && $figure->time_end) { -The time range for this figure is <%= $figure->time_start->strftime('%B %d, %Y (%H:%M %p)') %> - to <%= $figure->time_end->strftime('%B %d, %Y (%H:%M %p)') %>.
+The time range for this figure is <%= $figure->time_start->strftime('%B %d, %Y (%H:%M %p)') %> + to <%= $figure->time_end->strftime('%B %d, %Y (%H:%M %p)') %>.
% } elsif ($figure->time_start) { -The time range for this figure starts at <%= $figure->time_start->strftime('%B %d, %Y (%H:%M %p)') %>.
+The time range for this figure starts at <%= $figure->time_start->strftime('%B %d, %Y (%H:%M %p)') %>.
% } elsif ($figure->time_end) { -The time range for this figure ends at <%= $figure->time_end->strftime('%B %d, %Y (%H:%M %p)') %>.
+The time range for this figure ends at <%= $figure->time_end->strftime('%B %d, %Y (%H:%M %p)') %>.
% } % if ($figure->create_dt) { -This figure was created on <%= $figure->create_dt->strftime('%B %d, %Y') %>.
+This figure was created on <%= $figure->create_dt->strftime('%B %d, %Y') %>.
% } % if ($figure->submission_dt) { -This figure was submitted on <%= $figure->submission_dt->strftime('%B %d, %Y') %>.
+This figure was submitted on <%= $figure->submission_dt->strftime('%B %d, %Y') %>.
% } % if ($figure->lat_min || $figure->lat_max || $figure->lon_min || $figure->lon_max) { -- The spatial range for this figure is <%= $figure->lat_min // 'unknown' %>° to <%= $figure->lat_max // 'unknown' %>° latitude, - and <%= $figure->lon_min // 'unknown' %>° to <%= $figure->lon_max // 'unknown' %>° longitude. -
+The spatial range for this figure is <%= $figure->lat_min // 'unknown' %>° to <%= $figure->lat_max // 'unknown' %>° latitude, + and <%= $figure->lon_min // 'unknown' %>° to <%= $figure->lon_max // 'unknown' %>° longitude.
+ % } +<%= tbibs_to_links($finding->statement) %>
%= include 'h/contributors_short', object => $finding; % if ($finding->chapter) { @@ -37,9 +38,21 @@ % } % } %= include 'h/prov', pub => $finding->get_publication; +This report has <%== $numeric_link->($chp => 'chapter', 'list_chapter') %>, - <%== $numeric_link->($fig => 'figure') %> <% if ($img > 0) { %> (<%= $numeric_link->($img => 'image', 'list_report_images'); =%>)<% } %>, + <%== $numeric_link->($fig => 'figure') %> + <% if ($img > 0) { %> (<%= $numeric_link->($img => 'image', 'list_report_images'); =%>)<% } %>, <%== $numeric_link->($fin => 'finding') %>, <%== $numeric_link->($tab => 'table') %> and