Skip to content

Commit

Permalink
Only show set display image option to curator role
Browse files Browse the repository at this point in the history
  • Loading branch information
bm743 committed Feb 7, 2025
1 parent 5376c00 commit f02edab
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
10 changes: 5 additions & 5 deletions mason/image/print_images.mas
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ if ($images && !$image_objects) {
###print qq{ <script src="jquery.colorbox-min.js"></script> };

if ($image_objects) { # don't display anything for empty list of images
if ($stock_image_flag == '1') { # Only include 'Set as Display Image' column for images of this stock, not for images of related stock table
if ($curator && $stock_image_flag == '1') { # Only include 'Set as Display Image' column for images of this stock, not for images of related stock table
$image_html .= qq|<table class="table table-bordered"><thead><tr><th><button class="btn btn-sm btn-default" id="print_images_multi_image_view">View Selected</button></th><th>Image</th><th>Description</th><th>Type</th><th>Set as Display Image</th></tr></thead><tbody>|;
} else {
$image_html .= qq|<table class="table table-bordered"><thead><tr><th><button class="btn btn-sm btn-default" id="print_images_multi_image_view">View Selected</button></th><th>Image</th><th>Description</th><th>Type</th></tr></thead><tbody>|;
}
print "<div>check_curator_role: $stock_image_flag</div>";

my $i = 0;
foreach my $image_ob (@$image_objects) {
$count++;
Expand All @@ -104,9 +104,9 @@ if ($image_objects) { # don't display anything for empty list of images
. $image_description
. "</td><td>"
. $images->[$i]->[1]
. "</td><td>"
. $set_button
. "</td></tr>";
. "</td>"
. ($curator == 1 ? "<td>$set_button</td>" : "")
. "</tr>";
if ( $count < 3 ) { $image_html .= $fhtml; }
else {
push @more_is, $fhtml;
Expand Down
8 changes: 2 additions & 6 deletions mason/page/detail_page_2_col_section.mas
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,9 @@ $field_headers => ()

% if ($info_section_id eq 'stock_images_section'){
<& /image/compare_images.mas, stock_id => $stock_id &>
<%perl>
if ($curator == 1) {
$stock_image_flag = '1';
}
</%perl>

<&| /page/info_section.mas, title=>"Images of This Stock(" . scalar(@$image_ids) . ")", collapsible=>1, collapsed=>0 &>
<& /image/print_images.mas , stock_id=>$stock_id , images=>$image_ids , dbh=>$dbh, additional_image_button_id=>'stock_images', stock_image_flag=>$stock_image_flag , curator=>$curator &>
<& /image/print_images.mas , stock_id=>$stock_id , images=>$image_ids , dbh=>$dbh, additional_image_button_id=>'stock_images', stock_image_flag=>'1' , curator=>$curator &>
</&>

<&| /page/info_section.mas, title=>"Images of Related Stock(s) (" . scalar(@$related_image_ids) . ")", collapsible=>1, collapsed=>0 &>
Expand Down
2 changes: 1 addition & 1 deletion mason/stock/index.mas
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ function jqueryStuff() {

% }

<& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Images $curator</h4>", info_section_subtitle => 'View and add images of this stock and of related stocks.', icon_class => "glyphicon glyphicon-camera", info_section_id => "stock_images_section", image_ids => $image_ids, related_image_ids => $related_image_ids, dbh => $dbh, buttons_html => qq|<a id="add_new_image_button" class="btn btn-sm btn-default" style="margin:3px" href="/image/add?type_id=$stock_id&action=new&type=stock&refering_page=$this_page">Add new image</a><a class="btn btn-sm btn-default" style="margin:3px" id="stock_images_section_compare_images_button">Compare Images</a>| &>
<& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Images</h4>", info_section_subtitle => 'View and add images of this stock and of related stocks.', icon_class => "glyphicon glyphicon-camera", info_section_id => "stock_images_section", image_ids => $image_ids, related_image_ids => $related_image_ids, dbh => $dbh, curator =>$curator, buttons_html => qq|<a id="add_new_image_button" class="btn btn-sm btn-default" style="margin:3px" href="/image/add?type_id=$stock_id&action=new&type=stock&refering_page=$this_page">Add new image</a><a class="btn btn-sm btn-default" style="margin:3px" id="stock_images_section_compare_images_button">Compare Images</a>| &>

<& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Upload Data Files</h4>", info_section_subtitle => 'Upload any additional files for this Accession.', icon_class => "glyphicon glyphicon-cloud-upload", info_section_id => "stock_upload_files" &>

Expand Down

0 comments on commit f02edab

Please sign in to comment.