Trouble with documents/images after upgrade #703

This commit is contained in:
Karel Picman 2017-03-24 12:43:42 +01:00
parent 105721dc9f
commit c1264b4f61
18 changed files with 72 additions and 13 deletions

View File

@ -41,11 +41,13 @@
<% end %>
<%= " - #{dmsf_file.description}" unless dmsf_file.description.blank? %>
<span class="size">(<%= number_to_human_size dmsf_file.last_revision.size %>)</span>
<%= link_to(image_tag('delete.png'),
<% if User.current.allowed_to?(:file_delete, dmsf_file.project) %>
<%= link_to(image_tag('delete.png'),
dmsf_file_path(:id => dmsf_file, :commit => 'yes'),
:data => {:confirm => l(:text_are_you_sure)},
:method => :delete,
:title => l(:title_delete)) %>
<% end %>
<span class="author"><%= dmsf_file.last_revision.user %>, <%= format_time(dmsf_file.last_revision.updated_at) %></span>
</p>
<% end %>

View File

@ -128,6 +128,15 @@
</em>
</p>
<p>
<%= content_tag(:label, l(:label_act_as_attachable)) %>
<%= check_box_tag('settings[dmsf_act_as_attachable]', true, @settings['dmsf_act_as_attachable']) %>
<em class="info">
<%= l(:note_dmsf_act_as_attachable) %><br/>
<%= l(:label_default)%>: <%= l(:general_text_No)%>
</em>
</p>
<hr/>
<em class="info">
<%= l(:menu_dmsf) %> <%= l(:field_column_names) %>

View File

@ -359,3 +359,6 @@ cs:
label_webdav_use_project_names: Použít názvy projektů
note_webdav_use_project_names: Použít názvy projektů místo identifikátorů pro názvy adresářů.
label_act_as_attachable: Jako příloha
note_dmsf_act_as_attachable: Umožní přikládat dokumenty k objektům např. úkolům.

View File

@ -356,3 +356,6 @@ de:
label_webdav_use_project_names: Use project name for project folder
note_webdav_use_project_names: Use project names instead of project identifier for project folders.
label_act_as_attachable: Act as attachable
note_dmsf_act_as_attachable: Allows to attach documents to objects e.g. issues.

View File

@ -359,3 +359,6 @@ en:
label_webdav_use_project_names: Use project name for project folder
note_webdav_use_project_names: Use project names instead of project identifier for project folders.
label_act_as_attachable: Act as attachable
note_dmsf_act_as_attachable: Allows to attach documents to objects e.g. issues.

View File

@ -359,3 +359,6 @@ es:
label_webdav_use_project_names: Use project name for project folder
note_webdav_use_project_names: Use project names instead of project identifier for project folders.
label_act_as_attachable: Act as attachable
note_dmsf_act_as_attachable: Allows to attach documents to objects e.g. issues.

View File

@ -359,3 +359,6 @@ fr:
label_webdav_use_project_names: Use project name for project folder
note_webdav_use_project_names: Use project names instead of project identifier for project folders.
label_act_as_attachable: Act as attachable
note_dmsf_act_as_attachable: Allows to attach documents to objects e.g. issues.

View File

@ -359,3 +359,6 @@ it: # Italian strings thx 2 Matteo Arceci!
label_webdav_use_project_names: Use project name for project folder
note_webdav_use_project_names: Use project names instead of project identifier for project folders.
label_act_as_attachable: Act as attachable
note_dmsf_act_as_attachable: Allows to attach documents to objects e.g. issues.

View File

@ -359,3 +359,6 @@ ja:
label_webdav_use_project_names: Use project name for project folder
note_webdav_use_project_names: Use project names instead of project identifier for project folders.
label_act_as_attachable: Act as attachable
note_dmsf_act_as_attachable: Allows to attach documents to objects e.g. issues.

View File

@ -359,3 +359,6 @@ pl:
label_webdav_use_project_names: Use project name for project folder
note_webdav_use_project_names: Use project names instead of project identifier for project folders.
label_act_as_attachable: Act as attachable
note_dmsf_act_as_attachable: Allows to attach documents to objects e.g. issues.

View File

@ -359,3 +359,6 @@ pt-BR:
label_webdav_use_project_names: Use project name for project folder
note_webdav_use_project_names: Use project names instead of project identifier for project folders.
label_act_as_attachable: Act as attachable
note_dmsf_act_as_attachable: Allows to attach documents to objects e.g. issues.

View File

@ -359,3 +359,6 @@ ru:
label_webdav_use_project_names: Use project name for project folder
note_webdav_use_project_names: Use project names instead of project identifier for project folders.
label_act_as_attachable: Act as attachable
note_dmsf_act_as_attachable: Allows to attach documents to objects e.g. issues.

View File

@ -359,3 +359,6 @@ sl:
label_webdav_use_project_names: Use project name for project folder
note_webdav_use_project_names: Use project names instead of project identifier for project folders.
label_act_as_attachable: Act as attachable
note_dmsf_act_as_attachable: Allows to attach documents to objects e.g. issues.

View File

@ -359,3 +359,6 @@ zh-TW:
label_webdav_use_project_names: Use project name for project folder
note_webdav_use_project_names: Use project names instead of project identifier for project folders.
label_act_as_attachable: Act as attachable
note_dmsf_act_as_attachable: Allows to attach documents to objects e.g. issues.

View File

@ -359,3 +359,6 @@ zh:
label_webdav_use_project_names: Use project name for project folder
note_webdav_use_project_names: Use project names instead of project identifier for project folders.
label_act_as_attachable: Act as attachable
note_dmsf_act_as_attachable: Allows to attach documents to objects e.g. issues.

View File

@ -51,7 +51,8 @@ Redmine::Plugin.register :redmine_dmsf do
'dmsf_memcached_servers' => '',
'dmsf_webdav_ignore' => '^(\._|\.DS_Store$|Thumbs.db$)',
'dmsf_webdav_disable_versioning' => '^\~\$|\.tmp$',
'dmsf_keep_documents_locked' => false
'dmsf_keep_documents_locked' => false,
'dmsf_act_as_attachable' => false
}
menu :project_menu, :dmsf, { :controller => 'dmsf', :action => 'show' }, :caption => :menu_dmsf, :before => :documents, :param => :id

View File

@ -60,7 +60,7 @@ module RedmineDmsf
uploaded_file[:name] = upload.name
uploaded_file[:title] = upload.title
end
DmsfUploadHelper.commit_files_internal uploaded_files, issue, nil, self
DmsfUploadHelper.commit_files_internal uploaded_files, issue, nil, context[:controller]
end
end
end

View File

@ -27,22 +27,30 @@ module RedmineDmsf
def view_issues_form_details_bottom(context={})
if context.is_a?(Hash) && context[:issue]
# Add Dmsf upload form
html = "<div class=\"dmsf_uploader\">"
html << '<p>'
html << "<label>#{l(:label_document_plural)}</label>"
html << context[:controller].send(:render_to_string,
{:partial => 'dmsf_upload/form', :locals => { :multiple => true }})
html << '</p>'
html << '</div>'
html.html_safe
issue = context[:issue]
if User.current.allowed_to?(:file_manipulation, issue.project) &&
Setting.plugin_redmine_dmsf['dmsf_act_as_attachable']
html = "<div class=\"dmsf_uploader\">"
html << '<p>'
html << "<label>#{l(:label_document_plural)}</label>"
html << context[:controller].send(:render_to_string,
{:partial => 'dmsf_upload/form', :locals => { :multiple => true }})
html << '</p>'
html << '</div>'
html.html_safe
end
end
end
def view_issues_show_description_bottom(context={})
if context.is_a?(Hash) && context[:issue]
# Add list of attached documents
issue = context[:issue]
context[:controller].send(:render_to_string, {:partial => 'dmsf_files/links',
:locals => { :dmsf_files => issue.dmsf_files.to_a, :thumbnails => Setting.thumbnails_enabled? }})
if User.current.allowed_to?(:view_dmsf_files, issue.project) &&
Setting.plugin_redmine_dmsf['dmsf_act_as_attachable']
context[:controller].send(:render_to_string, {:partial => 'dmsf_files/links',
:locals => { :dmsf_files => issue.dmsf_files.to_a, :thumbnails => Setting.thumbnails_enabled? }})
end
end
end