<% # Created L/21/05/2012 # Updated J/20/08/2020 # # Copyright 2008-2022 | Fabrice Creuzot (luigifab) # https://www.luigifab.fr/redmine/apijs # # This program is free software, you can redistribute it or modify # it under the terms of the GNU General Public License (GPL) as published # by the free software foundation, either version 2 of the license, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but without any warranty, without even the implied warranty of # merchantability or fitness for a particular purpose. See the # GNU General Public License (GPL) for more details. if Setting.plugin_redmine_apijs['sort_attachments'] == '1' attachments = attachments.to_a.sort! { |a,b| a.filename.downcase <=> b.filename.downcase } end setting_enabled = Setting.plugin_redmine_apijs['enabled'] == '1' setting_show_album = Setting.plugin_redmine_apijs['show_album'] == '1' setting_show_album_infos = Setting.plugin_redmine_apijs['show_album_infos'] == '1' setting_show_filename = Setting.plugin_redmine_apijs['show_filename'] == '1' setting_show_exifdate = Setting.plugin_redmine_apijs['show_exifdate'] == '1' permission_delete = User.current.allowed_to?(:delete_attachments, @project) permission_rename = User.current.allowed_to?(:rename_attachments, @project) permission_edit = User.current.allowed_to?(:edit_attachments, @project) @slideshowi = 0 unless defined? @slideshowi show_album = show_list = false if setting_show_album attachments.each { |attachment| if (attachment.isPhoto? || attachment.isVideo?) && !attachment.isExcluded? show_album = true else show_list = true end } else show_list = true end %> <% if setting_enabled %> <% if show_album %>

<%= l(:apijs_title_album) %>

<% slideshowj = 0 %> <% attachments.each { |attachment| %> <% if (attachment.isPhoto? || attachment.isVideo?) && !attachment.isExcluded? %> <% description = (attachment.description.blank?) ? ' ' : attachment.description.gsub(/["\\\x0]/, ' ') %>
<% if attachment.readable? %> <% end %> <% if permission_edit %> <% end %> <% if permission_rename %> <% end %> <% if permission_delete %> <% end %>
<% if setting_show_album_infos %> <%= h(attachment.filename) %> <%= h(attachment.author) %> (<%= format_time(attachment.created_on) %>) <%= h(description) %> <% else %> <%= h(description) %> <% end %>
<% slideshowj += 1 %> <% end %> <% } %> <% @slideshowi += 1 if slideshowj > 0 %>
<% end %> <% if show_list %>

<%= l(:apijs_title_files) %>

<% end %> <% else %> <% end %>