diff --git a/app/controllers/dmsf_controller.rb b/app/controllers/dmsf_controller.rb index 081643c8..9333c0f0 100644 --- a/app/controllers/dmsf_controller.rb +++ b/app/controllers/dmsf_controller.rb @@ -187,7 +187,7 @@ class DmsfController < ApplicationController def send_revision send_file(@revision.disk_file, - :filename => filename_for_content_disposition(@revision.file.name), + :filename => filename_for_content_disposition(@revision.name), :type => @revision.detect_content_type, :disposition => "attachment") end diff --git a/app/controllers/dmsf_state_controller.rb b/app/controllers/dmsf_state_controller.rb index 434df33f..ef05e34f 100644 --- a/app/controllers/dmsf_state_controller.rb +++ b/app/controllers/dmsf_state_controller.rb @@ -31,7 +31,8 @@ class DmsfStateController < ApplicationController @file.lock flash[:notice] = l(:notice_file_locked) end - redirect_to :controller => "dmsf", :action => "index", :id => @project, :folder_id => @file.folder + redirect_to params[:current] ? params[:current] : + {:controller => "dmsf", :action => "index", :id => @project, :folder_id => @file.folder} end def unlock_file @@ -45,7 +46,8 @@ class DmsfStateController < ApplicationController flash[:error] = l(:error_only_user_that_locked_file_can_unlock_it) end end - redirect_to :controller => "dmsf", :action => "index", :id => @project, :folder_id => @file.folder + redirect_to params[:current] ? params[:current] : + {:controller => "dmsf", :action => "index", :id => @project, :folder_id => @file.folder} end def user_pref @@ -66,7 +68,8 @@ class DmsfStateController < ApplicationController @folder.notify_activate flash[:notice] = l(:notice_folder_notifications_activated) end - redirect_to :controller => "dmsf", :action => "index", :id => @project, :folder_id => @folder.folder + redirect_to params[:current] ? params[:current] : + {:controller => "dmsf", :action => "index", :id => @project, :folder_id => @folder.folder} end def folder_notify_deactivate @@ -76,7 +79,8 @@ class DmsfStateController < ApplicationController @folder.notify_deactivate flash[:notice] = l(:notice_folder_notifications_deactivated) end - redirect_to :controller => "dmsf", :action => "index", :id => @project, :folder_id => @folder.folder + redirect_to params[:current] ? params[:current] : + {:controller => "dmsf", :action => "index", :id => @project, :folder_id => @folder.folder} end def file_notify_activate @@ -86,7 +90,8 @@ class DmsfStateController < ApplicationController @file.notify_activate flash[:notice] = l(:notice_file_notifications_activated) end - redirect_to :controller => "dmsf", :action => "index", :id => @project, :folder_id => @file.folder + redirect_to params[:current] ? params[:current] : + {:controller => "dmsf", :action => "index", :id => @project, :folder_id => @file.folder} end def file_notify_deactivate @@ -96,7 +101,8 @@ class DmsfStateController < ApplicationController @file.notify_deactivate flash[:notice] = l(:notice_file_notifications_deactivated) end - redirect_to :controller => "dmsf", :action => "index", :id => @project, :folder_id => @file.folder + redirect_to params[:current] ? params[:current] : + {:controller => "dmsf", :action => "index", :id => @project, :folder_id => @file.folder} end private diff --git a/app/views/dmsf/index.html.erb b/app/views/dmsf/index.html.erb index 9dd4c78d..c55a8d46 100644 --- a/app/views/dmsf/index.html.erb +++ b/app/views/dmsf/index.html.erb @@ -141,7 +141,7 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder {:controller => "dmsf_detail", :action => "file_detail", :id => @project, :file_id => file }, :title => l(:link_details, :title =>h(file.last_revision.title))) %> -
+
<% unless file.locked_for_user? && !User.current.allowed_to?(:force_file_unlock, @project)%> <% if file.locked? %> <%= link_to(image_tag("unlock.png", :plugin => "redmine_dmsf"), @@ -154,7 +154,7 @@ form_tag({:action => "entries_operation", :id => @project, :folder_id => @folder <% end %>   <% end %> - <% if User.current.allowed_to?(:file_manipulation, @project) %> + <% if User.current.allowed_to?(:file_manipulation, @project) && !file.locked_for_user? %> <%= link_to(image_tag("delete.png", :plugin => "redmine_dmsf"), {:controller => "dmsf_detail", :action => "delete_file", :id => @project, :file_id => file}, :class => "delete-link", :title => l(:title_delete)) %> diff --git a/app/views/dmsf_detail/file_detail.html.erb b/app/views/dmsf_detail/file_detail.html.erb index 950b5f83..4e803061 100644 --- a/app/views/dmsf_detail/file_detail.html.erb +++ b/app/views/dmsf_detail/file_detail.html.erb @@ -1,13 +1,46 @@ <% html_title(l(:dmsf)) %>
+ <% if User.current.allowed_to?(:file_manipulation, @project) %> + <% unless @file.locked_for_user? && !User.current.allowed_to?(:force_file_unlock, @project)%> + <% if @file.locked? %> + <%= link_to(image_tag("unlock.png", :plugin => "redmine_dmsf"), + {:controller => "dmsf_state", :action => "unlock_file", :id => @project, :file_id => @file, + :current => request.url }, + :title => l(:title_unlock_file)) %> + <% else %> + <%= link_to(image_tag("lock.png", :plugin => "redmine_dmsf"), + {:controller => "dmsf_state", :action => "lock_file", :id => @project, :file_id => @file, + :current => request.url }, + :title => l(:title_lock_file)) %> + <% end %> + <% end %> + <% if User.current.allowed_to?(:file_manipulation, @project) && !@file.locked_for_user? %> +   + <%= link_to(image_tag("delete.png", :plugin => "redmine_dmsf"), + {:controller => "dmsf_detail", :action => "delete_file", :id => @project, + :file_id => @file}, :class => "delete-entry", :title => l(:title_delete)) %> + <% end %> + <% if User.current.allowed_to?(:file_approval, @project) %> +   + <% if @file.notification %> + <%= link_to(image_tag("notify.png", :plugin => "redmine_dmsf"), + {:controller => "dmsf_state", :action => "file_notify_deactivate", :id => @project, + :file_id => @file, :current => request.url }, :title => l(:title_notifications_active_deactivate)) %> + <% else %> + <%= link_to(image_tag("notifynot.png", :plugin => "redmine_dmsf"), + {:controller => "dmsf_state", :action => "file_notify_activate", :id => @project, + :file_id => @file, :current => request.url}, :title => l(:title_notifications_not_active_activate)) %> + <% end %> + <% end %> + <% end %>
<% path = @file.folder.nil? ? [] : @file.folder.dmsf_path %>

<%= render(:partial => "/dmsf/path", :locals => {:path => path}) %> / -<%= h(@file.last_revision.title) %>
<%= h(@file.name) %>
+<%= h(@file.last_revision.title) %> <% if @file.notification %> <%= image_tag("notify.png", :plugin => "redmine_dmsf", :title => l(:title_notifications_active)) %> @@ -22,12 +55,14 @@ <% @file.revisions.each do |revision| %>
- <%= link_to(l(:title_download), - {:controller=>"dmsf", :action => "download_revision", :id => @project, :revision_id => revision}) %> + <%= link_to(image_tag("download.png", :plugin => "redmine_dmsf"), + {:controller=>"dmsf", :action => "download_revision", :id => @project, :revision_id => revision}, + :title => l(:title_title_version_version_download, :title => h(revision.title), :version => revision.version)) %> <% if User.current.allowed_to?(:file_approval, @project) %> - | <%= link_to(l(:title_delete), - {:action => "delete_revision", :id => @project, :revision_id => revision}, - :class => "delete-link", :title => l(:title_delete_revision)) %> +   + <%= link_to(image_tag("delete.png", :plugin => "redmine_dmsf"), + {:action => "delete_revision", :id => @project, :revision_id => revision}, + :class => "delete-revision", :title => l(:title_delete_revision)) %> <% end %>

@@ -94,10 +129,14 @@ jQuery.noConflict(); jQuery(document).ready(function() { - jQuery("a.delete-link").click(function(event) { + jQuery("a.delete-revision").click(function(event) { if(!window.confirm("<%= l(:question_do_you_really_want_to_delete_this_revision) %>")) event.preventDefault(); }) + jQuery("a.delete-entry").click(function(event) { + if(!window.confirm("<%= l(:question_do_you_really_want_to_delete_this_entry) %>")) event.preventDefault(); + }) + jQuery("#fileFileUpload").change(function() { if(jQuery("input[name=\"file[version]\"]:checked").val() == "same") { jQuery("#fileMinorVersionRadio").prop("checked", true); diff --git a/assets/images/download.png b/assets/images/download.png new file mode 100644 index 00000000..64d92be9 Binary files /dev/null and b/assets/images/download.png differ diff --git a/config/locales/en.yml b/config/locales/en.yml index df7f1b8f..913e2eef 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -106,4 +106,5 @@ en: :option_version_minor: "Minor" :option_version_major: "Major" :label_new_content: "New content" + \ No newline at end of file