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';
- -
- % my $pub = $figure->get_publication; - % if ($pub) { - % for my $file ($pub->files) { - %= link_to "show_file", { 'file_identifier' => $file->identifier } => class => '' => itemprop => "url" => begin - %= image $file->thumbnail_path, class => 'img-thumbnail img-responsive', itemprop => "thumbnailUrl" - %= end - % } - % } -
+

<%= $figure->title %>

+
+

Figure <%= $figure->numeric || $figure->identifier %>

- %= include commify => objs => scalar $figure->all_orgs + %= include commify => objs => scalar $figure->all_orgs
%= include commify => objs => scalar $figure->all_people % if (my $chapter = $figure->chapter) { -

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.

+ % } +
+
+
+ % my $pub = $figure->get_publication; + % if ($pub) { + % for my $file ($pub->files) { + %= link_to "show_file", { 'file_identifier' => $file->identifier } => class => '' => itemprop => "url" => begin + %= image $file->thumbnail_path, class => 'img-thumbnail img-responsive', itemprop => "thumbnailUrl" + %= end + % } + % } +
+ % if ($figure->get_regions) { +
+ % my $regions = $figure->get_regions; + %= include 'h/regions', regions => $regions; +
% } + + % if ($figure->keywords) { +
+ % my $keywords = $figure->keywords; + %= include 'h/keywords', keywords => $keywords; +
+ % } +
+ +
%= include 'h/prov', pub => $figure->get_publication; %= include 'h/cited_by', pub => $figure->get_publication; %= include 'h/cites', pub => $figure->get_publication; % if (my @images = sorted_list($figure,'images')) { -
- This figure is composed of <%= @images==1 ? 'this image' : 'these images' %> : -
- %= include 'obj_thumbnails', objs => [ sorted_list($figure,'images') ], no_table => 1, tiny_captions => 1; +
+ This figure is composed of <%= @images==1 ? 'this image' : 'these images' %> : +
+ %= include 'obj_thumbnails', objs => [ sorted_list($figure,'images') ], no_table => 1, tiny_captions => 1; % } - +
-<%= include 'h/other_formats'; =%> +%= include 'h/other_formats'; %= include 'h/tbibjs'; diff --git a/lib/Tuba/files/templates/finding/object.html.ep b/lib/Tuba/files/templates/finding/object.html.ep index 462c93aa..aa1e4bea 100644 --- a/lib/Tuba/files/templates/finding/object.html.ep +++ b/lib/Tuba/files/templates/finding/object.html.ep @@ -18,7 +18,8 @@ %= include 'edit_buttons';
- % my $pub = $report->get_publication; +
+ % my $pub = $finding->get_publication;

<%= 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; +
+ % if ($finding->get_regions) { + % my $regions = $finding->get_regions; + %= include 'h/regions', regions => $regions; + % } + + % if ($finding->keywords) { + % my $keywords = $finding->keywords; + %= include 'h/keywords', keywords => $keywords; + % } +
+
%= include 'h/cited_by', pub => $finding->get_publication; %= include 'h/cites', pub => $finding->get_publication; - +
%= include 'h/other_formats'; diff --git a/lib/Tuba/files/templates/h/keywords.html.ep b/lib/Tuba/files/templates/h/keywords.html.ep new file mode 100644 index 00000000..44e600c6 --- /dev/null +++ b/lib/Tuba/files/templates/h/keywords.html.ep @@ -0,0 +1,18 @@ +
Related NASA GCMD keywords
+

diff --git a/lib/Tuba/files/templates/h/prov.html.ep b/lib/Tuba/files/templates/h/prov.html.ep index 0bc2f518..58c2b1bc 100644 --- a/lib/Tuba/files/templates/h/prov.html.ep +++ b/lib/Tuba/files/templates/h/prov.html.ep @@ -8,7 +8,7 @@ This <%= $object->meta->table %> <%= ontology_human($parent->{relationship}) %> <%= link_to 'show_publication' => { publication_identifier => $parent_pub->id } => begin %><%= $parent_pub->stringify %><%= end %> - <% if ($parent->{activity}) { %>using the activity <%= obj_link($parent->{activity}) %><% } %>. + <% if ($parent->{activity}) { %>using the activity <%= obj_link($parent->{activity}) %><% } %> <% if ($parent->{note}) { =%>(<%= $parent->{note} || "" =%>)<% } =%>
% } @@ -25,7 +25,7 @@ % for my $rel (sort keys %{ $by_type_rel{$type} } ) { % my $count = @{ $by_type_rel{$type}{$rel} };
  • <%= pl($type,$count) %> <%= ontology_human_pl($rel,$count) %> this <%= $pub->publication_type_identifier %> : - <%= include 'commify', objs => $by_type_rel{$type}{$rel}, short => 1 =%>. + <%= include 'commify', objs => $by_type_rel{$type}{$rel}, short => 1 =%>
  • % } % } diff --git a/lib/Tuba/files/templates/h/regions.html.ep b/lib/Tuba/files/templates/h/regions.html.ep new file mode 100644 index 00000000..46d20ffc --- /dev/null +++ b/lib/Tuba/files/templates/h/regions.html.ep @@ -0,0 +1,18 @@ +
    Regions Covered
    +

    diff --git a/lib/Tuba/files/templates/report/object.html.ep b/lib/Tuba/files/templates/report/object.html.ep index c0b5a887..54babb76 100644 --- a/lib/Tuba/files/templates/report/object.html.ep +++ b/lib/Tuba/files/templates/report/object.html.ep @@ -47,7 +47,8 @@

    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