diff --git a/app/views/dmsf/show.html.erb b/app/views/dmsf/show.html.erb index 32ff80e0..ccc9635a 100644 --- a/app/views/dmsf/show.html.erb +++ b/app/views/dmsf/show.html.erb @@ -104,10 +104,12 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder <%= check_box_tag("files[]", file.id, false, :title => l(:title_check_for_zip_download_or_email)) %> + <% file_download_url = url_for({:only_path => false, :controller => :dmsf_files, :action => "show", :id => file, :download => ""}) %> <%= link_to(h(file.last_revision.display_title), - {:controller => :dmsf_files, :action => "show", :id => file, :download => ""}, + file_download_url, :class => "icon icon-file #{DmsfHelper.filetype_css(file.name)}", - :title => l(:title_title_version_version_download, :title => h(file.title), :version => file.version)) %> + :title => l(:title_title_version_version_download, :title => h(file.title), :version => file.version), + "data-downloadurl" => "#{file.last_revision.detect_content_type}:#{h(file.name)}:#{file_download_url}") %>
<%= h(file.display_name) %>
<%= number_to_human_size(file.last_revision.size) %> @@ -244,6 +246,17 @@ sUrl = "jquery.dataTables/#{I18n.locale.to_s.downcase}.json" if I18n.locale && ! return "<%= l(:label_number_of_folders)%>: <%= @subfolders.length %>, <%= l(:label_number_of_documents)%>: <%= @files.length %>"; } }); + + jQuery("[data-downloadurl]").each(function() { + var url = this.getAttribute("data-downloadurl"); + if (this.addEventListener) { + this.addEventListener("dragstart", function(e) { + if (e.dataTransfer) { + e.dataTransfer.setData("DownloadURL", url); + } + },false); + } + }); }); <% end %>