Skip to content

Commit f02edab

Browse files
committed
Only show set display image option to curator role
1 parent 5376c00 commit f02edab

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

mason/image/print_images.mas

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ if ($images && !$image_objects) {
7272
###print qq{ <script src="jquery.colorbox-min.js"></script> };
7373

7474
if ($image_objects) { # don't display anything for empty list of images
75-
if ($stock_image_flag == '1') { # Only include 'Set as Display Image' column for images of this stock, not for images of related stock table
75+
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
7676
$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>|;
7777
} else {
7878
$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>|;
7979
}
80-
print "<div>check_curator_role: $stock_image_flag</div>";
80+
8181
my $i = 0;
8282
foreach my $image_ob (@$image_objects) {
8383
$count++;
@@ -104,9 +104,9 @@ if ($image_objects) { # don't display anything for empty list of images
104104
. $image_description
105105
. "</td><td>"
106106
. $images->[$i]->[1]
107-
. "</td><td>"
108-
. $set_button
109-
. "</td></tr>";
107+
. "</td>"
108+
. ($curator == 1 ? "<td>$set_button</td>" : "")
109+
. "</tr>";
110110
if ( $count < 3 ) { $image_html .= $fhtml; }
111111
else {
112112
push @more_is, $fhtml;

mason/page/detail_page_2_col_section.mas

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -322,13 +322,9 @@ $field_headers => ()
322322

323323
% if ($info_section_id eq 'stock_images_section'){
324324
<& /image/compare_images.mas, stock_id => $stock_id &>
325-
<%perl>
326-
if ($curator == 1) {
327-
$stock_image_flag = '1';
328-
}
329-
</%perl>
325+
330326
<&| /page/info_section.mas, title=>"Images of This Stock(" . scalar(@$image_ids) . ")", collapsible=>1, collapsed=>0 &>
331-
<& /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 &>
327+
<& /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 &>
332328
</&>
333329

334330
<&| /page/info_section.mas, title=>"Images of Related Stock(s) (" . scalar(@$related_image_ids) . ")", collapsible=>1, collapsed=>0 &>

mason/stock/index.mas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ function jqueryStuff() {
392392

393393
% }
394394

395-
<& /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>| &>
395+
<& /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>| &>
396396

397397
<& /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" &>
398398

0 commit comments

Comments
 (0)