diff --git a/app/controllers/dmsf_controller.rb b/app/controllers/dmsf_controller.rb index cbb56203..87816e56 100644 --- a/app/controllers/dmsf_controller.rb +++ b/app/controllers/dmsf_controller.rb @@ -298,6 +298,7 @@ class DmsfController < ApplicationController def edit @parent = @folder.folder @pathfolder = copy_folder(@folder) + @force_file_unlock_allowed = User.current.allowed_to?(:force_file_unlock, @project) end def save diff --git a/app/controllers/dmsf_files_controller.rb b/app/controllers/dmsf_files_controller.rb index d8982266..abb54e86 100644 --- a/app/controllers/dmsf_files_controller.rb +++ b/app/controllers/dmsf_files_controller.rb @@ -98,6 +98,7 @@ class DmsfFilesController < ApplicationController @revision = @file.last_revision @file_delete_allowed = User.current.allowed_to?(:file_delete, @project) + @file_manipulation_allowed = User.current.allowed_to?(:file_manipulation, @project) @revision_pages = Paginator.new @file.revisions.visible.count, params['per_page'] ? params['per_page'].to_i : 25, params['page'] respond_to do |format| diff --git a/app/controllers/dmsf_upload_controller.rb b/app/controllers/dmsf_upload_controller.rb index 6077fcd8..59d31f67 100644 --- a/app/controllers/dmsf_upload_controller.rb +++ b/app/controllers/dmsf_upload_controller.rb @@ -153,11 +153,7 @@ class DmsfUploadController < ApplicationController file.notification = Setting.plugin_redmine_dmsf[:dmsf_default_notifications].present? new_revision.minor_version = 0 new_revision.major_version = 0 - else - if file.locked_for_user? - failed_uploads.push(commited_file) - next - end + else if file.last_revision last_revision = file.last_revision new_revision.source_revision = last_revision @@ -168,6 +164,11 @@ class DmsfUploadController < ApplicationController new_revision.major_version = 0 end end + + if file.locked_for_user? + failed_uploads.push(commited_file) + next + end commited_disk_filepath = "#{DmsfHelper.temp_dir}/#{commited_file[:disk_filename].gsub(/[\/\\]/,'')}" @@ -186,16 +187,6 @@ class DmsfUploadController < ApplicationController end new_revision.mime_type = Redmine::MimeType.of(new_revision.name) new_revision.size = File.size(commited_disk_filepath) - - if file.locked? - begin - file.unlock! - flash[:notice] = l(:notice_file_unlocked) - rescue DmsfLockError => e - flash[:error] = e.message - next - end - end # Need to save file first to generate id for it in case of creation. # File id is needed to properly generate revision disk filename diff --git a/app/views/dmsf/_dir.html.erb b/app/views/dmsf/_dir.html.erb index de2714cc..94e1f721 100644 --- a/app/views/dmsf/_dir.html.erb +++ b/app/views/dmsf/_dir.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright (C) 2011-15 Karel Pičman +# Copyright (C) 2011-16 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -56,14 +56,24 @@ <%= h(subfolder.user) if subfolder %> <% if @folder_manipulation_allowed %> - <% unless locked %> + <% unless locked_for_user %> <%= link_to(image_tag('edit.png'), edit_dmsf_path(:id => project, :folder_id => subfolder), :title => l(:link_edit, :title => subfolder ? h(subfolder.title) : project.name)) %> <% if subfolder %> - <%= link_to(image_tag('lock.png', :plugin => 'redmine_dmsf'), - lock_dmsf_path(:id => project, :folder_id => subfolder), - :title => l(:title_lock_file)) %> + <% if locked %> + <% if subfolder.unlockable? %> + <%= link_to(image_tag('unlock.png', :plugin => 'redmine_dmsf'), + unlock_dmsf_path(:id => project, :folder_id => subfolder), + :title => l(:title_unlock_file)) %> + <% else %> + + <% end %> + <% else %> + <%= link_to(image_tag('lock.png', :plugin => 'redmine_dmsf'), + lock_dmsf_path(:id => project, :folder_id => subfolder), + :title => l(:title_lock_file)) %> + <% end %> <% else %> <% end %> @@ -77,11 +87,9 @@ :title => l(:title_notifications_not_active_activate)) %> <% end %> <% if link %> - <%= link_to(image_tag('delete.png'), - dmsf_link_path(link), + <%= link_to(image_tag('delete.png'), dmsf_link_path(link), :data => {:confirm => l(:text_are_you_sure)}, - :method => :delete, - :title => l(:title_delete)) %> + :method => :delete, :title => l(:title_delete)) %> <% else %> <%= link_to(image_tag('delete.png'), delete_dmsf_path(:id => project, :folder_id => subfolder), diff --git a/app/views/dmsf/_file.html.erb b/app/views/dmsf/_file.html.erb index c2f81af7..f822b055 100644 --- a/app/views/dmsf/_file.html.erb +++ b/app/views/dmsf/_file.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright (C) 2011-15 Karel Pičman +# Copyright (C) 2011-16 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -20,8 +20,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. %> -<% locked_for_user = file.locked_for_user? %> -<% locked = file.locked? %> <% wf = DmsfWorkflow.find_by_id(file.last_revision.dmsf_workflow_id) %> <%= check_box_tag(name, id, false, @@ -30,7 +28,7 @@ <% file_view_url = url_for({:controller => :dmsf_files, :action => 'view', :id => file}) %> <%= link_to(h(title), file_view_url, - :target => "_blank", + :target => '_blank', :class => "icon icon-file #{DmsfHelper.filetype_css(file.name)}", :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_view_url}") %> @@ -39,7 +37,7 @@ <%= number_to_human_size(file.last_revision.size) %> <%= format_time(file.last_revision.updated_at) %> - <% if locked_for_user %> + <% if file.locked_for_user? %> <% if file.lock.reverse[0].user %> <%= link_to(image_tag(link ? 'locked_gray.png' : 'locked.png', :plugin => 'redmine_dmsf'), user_path(file.lock.reverse[0].user), @@ -48,7 +46,7 @@ <%= content_tag(:span, image_tag(link ? 'locked_gray.png' : 'locked.png', :plugin => 'redmine_dmsf'), :title => l(:notice_account_unknown_email)) %> <% end %> - <% elsif locked %> + <% elsif file.locked? %> <%= content_tag(:span, image_tag(link ? 'lockedbycurrent_gray.png' : 'lockedbycurrent.png', :plugin => 'redmine_dmsf'), :title => l(:title_locked_by_you)) %> <% end %> @@ -69,106 +67,111 @@ <% end %> <%= h(file.last_revision.user) %> - - <% if @file_manipulation_allowed || @file_approval_allowed %> - <% if @file_manipulation_allowed %> - <% unless locked %> - <%= link_to(image_tag('filedetails.png', :plugin => 'redmine_dmsf'), - dmsf_file_path(:id => file), - :title => l(:link_details, :title => h(file.last_revision.title))) %> + + <% if @file_manipulation_allowed %> + <%= link_to(image_tag('filedetails.png', :plugin => 'redmine_dmsf'), + dmsf_file_path(:id => file), + :title => l(:link_details, :title => h(file.last_revision.title))) %> + <% unless file.locked_for_user? %> + <% if !file.locked? %> <%= link_to(image_tag('lock.png', :plugin => 'redmine_dmsf'), lock_dmsf_files_path(:id => file), :title => l(:title_lock_file)) %> - <% if file.notification %> - <%= link_to(image_tag('notify.png', :plugin => 'redmine_dmsf'), - notify_deactivate_dmsf_files_path(:id => file), - :title => l(:title_notifications_active_deactivate)) %> - <% else %> - <%= link_to(image_tag('notifynot.png', :plugin => 'redmine_dmsf'), - notify_activate_dmsf_files_path(:id => file), - :title => l(:title_notifications_not_active_activate)) %> - <% end %> - <% if link %> - <%= link_to(image_tag('delete.png'), - dmsf_link_path(link), - :data => {:confirm => l(:text_are_you_sure)}, - :method => :delete, - :title => l(:title_delete)) %> - <% else %> - <% if @file_delete_allowed %> - <%= link_to(image_tag('delete.png'), - dmsf_file_path(:id => file), - :data => {:confirm => l(:text_are_you_sure)}, - :method => :delete, - :title => l(:title_delete)) unless locked_for_user %> - <% else %> - - <% end %> - <% end %> + <% elsif file.unlockable? %> + <%= link_to(image_tag('unlock.png', :plugin => 'redmine_dmsf'), + unlock_dmsf_files_path(:id => file), + :title => l(:title_unlock_file))%> <% else %> - <% if (!locked_for_user || @force_file_unlock_allowed) && file.unlockable? %> - <%= link_to(image_tag('unlock.png', :plugin => 'redmine_dmsf'), - unlock_dmsf_files_path(:id => file), - :title => l(:title_unlock_file))%> + <% end %> + <% if file.notification %> + <%= link_to(image_tag('notify.png', :plugin => 'redmine_dmsf'), + notify_deactivate_dmsf_files_path(:id => file), + :title => l(:title_notifications_active_deactivate)) %> + <% else %> + <%= link_to(image_tag('notifynot.png', :plugin => 'redmine_dmsf'), + notify_activate_dmsf_files_path(:id => file), + :title => l(:title_notifications_not_active_activate)) %> + <% end %> + <% if link %> + <%= link_to(image_tag('delete.png'), + dmsf_link_path(link), + :data => {:confirm => l(:text_are_you_sure)}, + :method => :delete, + :title => l(:title_delete)) %> + <% else %> + <% if @file_delete_allowed %> + <%= link_to(image_tag('delete.png'), + dmsf_file_path(:id => file), + :data => {:confirm => l(:text_are_you_sure)}, + :method => :delete, + :title => l(:title_delete)) unless file.locked_for_user? %> <% else %> - <% end %> + <% end %> + <% end %> + <% else %> + <% if @force_file_unlock_allowed && file.unlockable? %> + <%= link_to(image_tag('unlock.png', :plugin => 'redmine_dmsf'), + unlock_dmsf_files_path(:id => file), + :title => l(:title_unlock_file))%> + <% else %> - - <% end %> + <% end %> + + <% end %> - <% if @file_approval_allowed %> - <% case file.last_revision.workflow %> - <% when DmsfWorkflow::STATE_WAITING_FOR_APPROVAL %> - <% if wf %> - <% assignments = wf.next_assignments(file.last_revision.id) %> - <% index = assignments.find_index{|assignment| assignment.user_id == User.current.id} if assignments %> - <% if index %> - <%= link_to(image_tag('waiting_for_approval.png', :plugin => 'redmine_dmsf'), - action_dmsf_workflow_path( - :project_id => project.id, - :id => wf.id, - :dmsf_workflow_step_assignment_id => assignments[index].id, - :dmsf_file_revision_id => file.last_revision.id), - :title => l(:title_waiting_for_approval), - :remote => true) %> - <% else %> - <%= content_tag(:span, image_tag('waiting_for_approval.png', :plugin => 'redmine_dmsf'), - :title => "#{l(:label_dmsf_wokflow_action_approve)} #{l(:label_dmsf_wokflow_action_reject)} #{l(:label_dmsf_wokflow_action_delegate)}") %> - <% end %> - <% else %> + <% end %> + <% if @file_approval_allowed %> + <% case file.last_revision.workflow %> + <% when DmsfWorkflow::STATE_WAITING_FOR_APPROVAL %> + <% if wf %> + <% assignments = wf.next_assignments(file.last_revision.id) %> + <% index = assignments.find_index{|assignment| assignment.user_id == User.current.id} if assignments %> + <% if index %> + <%= link_to(image_tag('waiting_for_approval.png', :plugin => 'redmine_dmsf'), + action_dmsf_workflow_path( + :project_id => project.id, + :id => wf.id, + :dmsf_workflow_step_assignment_id => assignments[index].id, + :dmsf_file_revision_id => file.last_revision.id), + :title => l(:title_waiting_for_approval), + :remote => true) %> + <% else %> <%= content_tag(:span, image_tag('waiting_for_approval.png', :plugin => 'redmine_dmsf'), :title => "#{l(:label_dmsf_wokflow_action_approve)} #{l(:label_dmsf_wokflow_action_reject)} #{l(:label_dmsf_wokflow_action_delegate)}") %> <% end %> - <% when DmsfWorkflow::STATE_APPROVED %> - <%= content_tag(:span, image_tag('approved.png', :plugin => 'redmine_dmsf'), - :title => l(:title_approved)) %> - <% when DmsfWorkflow::STATE_ASSIGNED %> - <% if User.current && (file.last_revision.dmsf_workflow_assigned_by == User.current.id) && wf %> - <%= link_to(image_tag('assigned.png', :plugin => 'redmine_dmsf'), - start_dmsf_workflow_path( - :id => file.last_revision.dmsf_workflow_id, - :dmsf_file_revision_id => file.last_revision.id), - :title => l(:label_dmsf_wokflow_action_start)) %> - <% else %> - <%= content_tag(:span, image_tag('assigned.png', :plugin => 'redmine_dmsf'), - title => l(:label_dmsf_wokflow_action_start)) %> - <% end %> - <% when DmsfWorkflow::STATE_REJECTED %> + <% else %> + <%= content_tag(:span, image_tag('waiting_for_approval.png', :plugin => 'redmine_dmsf'), + :title => "#{l(:label_dmsf_wokflow_action_approve)} #{l(:label_dmsf_wokflow_action_reject)} #{l(:label_dmsf_wokflow_action_delegate)}") %> + <% end %> + <% when DmsfWorkflow::STATE_APPROVED %> + <%= content_tag(:span, image_tag('approved.png', :plugin => 'redmine_dmsf'), + :title => l(:title_approved)) %> + <% when DmsfWorkflow::STATE_ASSIGNED %> + <% if User.current && (file.last_revision.dmsf_workflow_assigned_by == User.current.id) && wf %> + <%= link_to(image_tag('assigned.png', :plugin => 'redmine_dmsf'), + start_dmsf_workflow_path( + :id => file.last_revision.dmsf_workflow_id, + :dmsf_file_revision_id => file.last_revision.id), + :title => l(:label_dmsf_wokflow_action_start)) %> + <% else %> <%= content_tag(:span, image_tag('assigned.png', :plugin => 'redmine_dmsf'), - :title => l(:title_rejected)) %> - <% else %> - <% if @workflows_available %> - <%= link_to(image_tag('none.png', :plugin => 'redmine_dmsf'), - assign_dmsf_workflow_path( - :project_id => project.id, - :dmsf_file_revision_id => file.last_revision.id), - :title => l(:label_dmsf_wokflow_action_assign), - :remote => true) %> - <% end %> - <% end %> - <% end %> + title => l(:label_dmsf_wokflow_action_start)) %> + <% end %> + <% when DmsfWorkflow::STATE_REJECTED %> + <%= content_tag(:span, image_tag('assigned.png', :plugin => 'redmine_dmsf'), + :title => l(:title_rejected)) %> + <% else %> + <% if @workflows_available && !file.locked_for_user? %> + <%= link_to(image_tag('none.png', :plugin => 'redmine_dmsf'), + assign_dmsf_workflow_path( + :project_id => project.id, + :dmsf_file_revision_id => file.last_revision.id), + :title => l(:label_dmsf_wokflow_action_assign), + :remote => true) %> + <% end %> + <% end %> <% end %> 1 diff --git a/app/views/dmsf/_url.html.erb b/app/views/dmsf/_url.html.erb index 9b7848c0..28bfd7e9 100644 --- a/app/views/dmsf/_url.html.erb +++ b/app/views/dmsf/_url.html.erb @@ -3,7 +3,7 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright (C) 2011-15 Karel Pičman +# Copyright (C) 2011-16 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -22,11 +22,13 @@ - <%= link_to(h(title), - link.external_url, - :target => "_blank", - :class => 'icon icon-link') %> -
<%= link.external_url %>
+ <%= link_to(h(title), + link.external_url, + :target => '_blank', + :class => 'icon icon-link') %> +
+ <%= link.external_url %> +
<%= format_time(link.updated_at) %> @@ -34,25 +36,20 @@ <%= h(link.user) %> + + + <% if @file_manipulation_allowed %> - <% if @file_manipulation_allowed %> - - - - <%= link_to(image_tag('delete.png'), - dmsf_link_path(link), - :data => {:confirm => l(:text_are_you_sure)}, - :method => :delete, - :title => l(:title_delete)) %> - <% else %> - - - - - <% end %> - <% end %> + <%= link_to(image_tag('delete.png'), + dmsf_link_path(link), + :data => {:confirm => l(:text_are_you_sure)}, + :method => :delete, + :title => l(:title_delete)) %> + <% else %> + + <% end %> 1 link.updated_at.to_i - + \ No newline at end of file diff --git a/app/views/dmsf/edit.html.erb b/app/views/dmsf/edit.html.erb index d21f21de..300e2c15 100644 --- a/app/views/dmsf/edit.html.erb +++ b/app/views/dmsf/edit.html.erb @@ -1,7 +1,11 @@ -<%# Redmine plugin for Document Management System "Features" +<%# +# encoding: utf-8 # -# Copyright (C) 2011 Vít Jonáš -# Copyright (C) 2012 Daniel Munn +# Redmine plugin for Document Management System "Features" +# +# Copyright (C) 2011 Vít Jonáš +# Copyright (C) 2012 Daniel Munn +# Copyright (C) 2011-16 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -20,12 +24,17 @@ <% html_title(l(:dmsf)) %>
- <% if User.current.allowed_to?(:folder_manipulation, @project) && params[:action] == 'edit' %> - <% unless @folder.locked? %> - <%= link_to(l(:button_lock), + <% if !@folder.new_record? && User.current.allowed_to?(:folder_manipulation, @project) %> + <% if !@folder.locked_for_user? %> + <% unless @folder.locked? %> + <%= link_to(l(:button_lock), lock_dmsf_path(:id => @project, :folder_id => @folder), - :title => l(:title_lock_file), - :class => 'icon icon-dmsf-lock') %> + :title => l(:title_lock_file), :class => 'icon icon-dmsf-lock') %> + <% else %> + <%= link_to_if(@folder.unlockable?, l(:button_unlock), + unlock_dmsf_path(:id => @project, :folder_id => @folder), + :title => l(:title_unlock_file), :class => 'icon icon-dmsf-unlock')%> + <% end %> <% if @folder.notification %> <%= link_to(l(:label_notifications_off), notify_deactivate_dmsf_path(:id => @project, :folder_id => @folder), @@ -39,22 +48,17 @@ <% end %> <%= link_to(l(:label_link_to), new_dmsf_link_path(:project_id => @project.id, :dmsf_folder_id => @folder.id, :type => 'link_to'), - :title => l(:title_create_link), - :class => 'icon icon-link') %> + :title => l(:title_create_link), :class => 'icon icon-link') %> <%= link_to(l(:button_copy), copy_folder_path(:id => @folder), :title => l(:title_copy), :class => 'icon icon-copy') %> <%= link_to(l(:button_delete), delete_dmsf_path(:id => @project, :folder_id => @folder), :data => {:confirm => l(:text_are_you_sure)}, - :title => l(:title_delete), - :class => 'icon icon-del') %> - <% else %> - <% if (!@folder.locked_for_user? || User.current.allowed_to?(:force_file_unlock, @project)) && @folder.unlockable? %> - <%= link_to(l(:button_unlock), - unlock_dmsf_path(:id => @project, :folder_id => @folder), - :title => l(:title_unlock_file), - :class => 'icon icon-dmsf-unlock')%> - <% end %> + :title => l(:title_delete), :class => 'icon icon-del') %> + <% elsif @force_file_unlock_allowed %> + <%= link_to_if(@folder.unlockable?, l(:button_unlock), + unlock_dmsf_path(:id => @project, :folder_id => @folder), + :title => l(:title_unlock_file), :class => 'icon icon-dmsf-unlock')%> <% end %> <% end %>
diff --git a/app/views/dmsf/show.html.erb b/app/views/dmsf/show.html.erb index 8bf99cff..5945ac72 100644 --- a/app/views/dmsf/show.html.erb +++ b/app/views/dmsf/show.html.erb @@ -5,7 +5,7 @@ # # Copyright (C) 2011 Vít Jonáš # Copyright (C) 2012 Daniel Munn -# Copyright (C) 2011-15 Karel Pičman +# Copyright (C) 2011-16 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -22,12 +22,11 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. %> -<% html_title(l(:dmsf)) %> +<% html_title l(:dmsf) %>
<% if @folder_manipulation_allowed %> <% if @folder.nil? %> - <%= link_to(l(:button_edit), - edit_root_dmsf_path(:id => @project), + <%= link_to(l(:button_edit), edit_root_dmsf_path(:id => @project), :title => l(:link_edit, :title => l(:link_documents)), :class => 'icon icon-edit') %> <% elsif !@locked_for_user %> @@ -37,54 +36,31 @@ :class => 'icon icon-edit') %> <% end %> <% if @folder && (!@locked_for_user || User.current.allowed_to?(:force_file_unlock, @project)) %> - <% if @folder.locked? %> - <% unless @folder.unlockable? %> - <%= link_to(l(:button_unlock), - :title => l(:title_folder_parent_locked, :name => @folder.folder.lock.reverse[0].folder.title), - :class => 'icon icon-dmsf-unlock') if @folder %> - <% else %> - <%= link_to(l(:button_unlock), - unlock_dmsf_path(:id => @project, :folder_id => @folder, :current => request.url), - :title => l(:title_unlock_folder), - :class => 'icon icon-dmsf-unlock') if @folder %> - <% end %> + <% if @folder.locked? %> + <%= link_to_if(@folder.unlockable?, l(:button_unlock), + unlock_dmsf_path(:id => @project, :folder_id => @folder, :current => request.url), + :title => l(:title_unlock_folder), :class => 'icon icon-dmsf-unlock') %> <% else %> <%= link_to(l(:button_lock), lock_dmsf_path(:id => @project, :folder_id => @folder, :current => request.url), - :title => l(:title_lock_folder), - :class => 'icon icon-dmsf-lock') if @folder %> + :title => l(:title_lock_folder), :class => 'icon icon-dmsf-lock') %> <% end %> - <% end %> - <% unless @folder %> - <% if @project.dmsf_notification %> - <%= link_to(l(:label_notifications_off), - notify_deactivate_dmsf_path(:id => @project), - :title => l(:title_notifications_active_deactivate), - :class => 'icon icon-notification-on') %> - <% else %> - <%= link_to(l(:label_notifications_on), - notify_activate_dmsf_path(:id => @project), - :title => l(:title_notifications_active_deactivate), - :class => 'icon icon-notification-off') %> - <% end %> + <% end %> + <% if !@locked_for_user && ((@folder && @folder.notification) || (!@filder && @project.dmsf_notification)) %> + <%= link_to(l(:label_notifications_off), + notify_deactivate_dmsf_path(:id => @project, :folder_id => @folder), + :title => l(:title_notifications_active_deactivate), + :class => 'icon icon-notification-on') %> <% else %> - <% if @folder.notification %> - <%= link_to(l(:label_notifications_off), - notify_deactivate_dmsf_path(:id => @project, :folder_id => @folder), - :title => l(:title_notifications_active_deactivate), - :class => 'icon icon-notification-on') %> - <% else %> - <%= link_to(l(:label_notifications_on), - notify_activate_dmsf_path(:id => @project, :folder_id => @folder), - :title => l(:title_notifications_not_active_activate), - :class => 'icon icon-notification-off') %> - <% end %> - <% end %> - <% if @file_manipulation_allowed %> + <%= link_to(l(:label_notifications_on), + notify_activate_dmsf_path(:id => @project, :folder_id => @folder), + :title => l(:title_notifications_not_active_activate), + :class => 'icon icon-notification-off') %> + <% end %> + <% if @file_manipulation_allowed && !@locked_for_user %> <%= link_to(l(:label_link_from), new_dmsf_link_path(:project_id => @project.id, :dmsf_folder_id => @folder ? @folder.id : @folder, :type => 'link_from'), - :title => l(:title_create_link), - :class => 'icon icon-link') unless @locked_for_user %> + :title => l(:title_create_link), :class => 'icon icon-link') %> <% end %> <%= link_to(l(:link_create_folder), new_dmsf_path(:id => @project, :parent_id => @folder), @@ -288,4 +264,6 @@ <% end %> -<%= render(:partial => 'dmsf_upload/multi_upload') if (@file_manipulation_allowed && !@locked_for_user) %> +<% if (@file_manipulation_allowed && !@locked_for_user) %> + <%= render(:partial => 'dmsf_upload/multi_upload') %> +<% end %> \ No newline at end of file diff --git a/app/views/dmsf_files/show.html.erb b/app/views/dmsf_files/show.html.erb index c7512dce..e3dc0297 100644 --- a/app/views/dmsf_files/show.html.erb +++ b/app/views/dmsf_files/show.html.erb @@ -26,11 +26,14 @@
<% if User.current.allowed_to?(:file_manipulation, @project) %> - <% unless @file.locked? %> - <%= link_to(l(:button_lock), - lock_dmsf_files_path(:id => @file), - :title => l(:title_lock_file), - :class => 'icon icon-dmsf-lock') %> + <% unless @file.locked_for_user? %> + <% unless @file.locked? %> + <%= link_to(l(:button_lock), lock_dmsf_files_path(:id => @file), + :title => l(:title_lock_file), :class => 'icon icon-dmsf-lock') %> + <% else %> + <%= link_to_if(@file.unlockable?, l(:button_unlock), unlock_dmsf_files_path(:id => @file), + :title => l(:title_unlock_file), :class => 'icon icon-dmsf-unlock') %> + <% end %> <% if @file.notification %> <%= link_to(l(:label_notifications_off), notify_deactivate_dmsf_files_path(:id => @file), @@ -50,11 +53,9 @@ :title => l(:title_copy), :class => 'icon icon-copy') %> <%= delete_link @file if @file_delete_allowed %> <% else %> - <% if (!@file.locked_for_user? || User.current.allowed_to?(:force_file_unlock, @project)) && @file.unlockable? %> - <%= link_to(l(:button_unlock), - unlock_dmsf_files_path(:id => @file), - :title => l(:title_unlock_file), - :class => 'icon icon-dmsf-unlock')%> + <% if User.current.allowed_to?(:force_file_unlock, @project) %> + <%= link_to_if(@file.unlockable?, l(:button_unlock), unlock_dmsf_files_path(:id => @file), + :title => l(:title_unlock_file), :class => 'icon icon-dmsf-unlock')%> <% end %> <% end %> <% end %> @@ -62,9 +63,11 @@ <%= render(:partial => '/dmsf/path', :locals => {:folder => @file.folder, :filename => @file.title}) %> -<%= error_messages_for('file') %> -<%= error_messages_for('revision') %> -<%= render(:partial => 'file_new_revision') if User.current.allowed_to?(:file_manipulation, @file.project) %> +<% if User.current.allowed_to?(:file_manipulation, @file.project) && !@file.locked_for_user? %> + <%= error_messages_for('file') %> + <%= error_messages_for('revision') %> + <%= render(:partial => 'file_new_revision') %> +<% end %>

<%= l(:heading_revisions) %>

<% @file.revisions.visible[@revision_pages.offset,@revision_pages.per_page].each do |revision| %> diff --git a/assets/images/filedetails.png b/assets/images/filedetails.png index 0ef642fa..f7df57a3 100644 Binary files a/assets/images/filedetails.png and b/assets/images/filedetails.png differ diff --git a/assets/images/operations.png b/assets/images/operations.png deleted file mode 100644 index 8bf76fbb..00000000 Binary files a/assets/images/operations.png and /dev/null differ diff --git a/assets/images/ticket_go.png b/assets/images/ticket_go.png deleted file mode 100644 index 2aaec381..00000000 Binary files a/assets/images/ticket_go.png and /dev/null differ diff --git a/assets/stylesheets/dmsf.css b/assets/stylesheets/dmsf.css index d4cfe0ae..1e52d358 100644 --- a/assets/stylesheets/dmsf.css +++ b/assets/stylesheets/dmsf.css @@ -208,7 +208,7 @@ table.access-table tbody td, table.access-table tbody tr:hover td { } /* Approval workflow */ -#admin-menu a.approvalworkflows { background-image: url(../images/ticket_go.png); } +#admin-menu a.approvalworkflows { background-image: url(../../../images/ticket_go.png); } #users_for_delegate {height: 200px; overflow:auto;} #users_for_delegate label {display: block;} tr.workflow.locked a { color: #aaa; } @@ -263,7 +263,6 @@ table.list td.step { .modal{ font-size: 12px} /* Command icons */ -.dmsf_icon-narrow { padding-left: 16px } .icon-link { background-image: url(../images/link.png); } .icon-notification-on { background-image: url(../images/notify.png); margin-left: 3px; } .icon-notification-off { background-image: url(../images/notifynot.png); margin-left: 3px; } diff --git a/config/locales/cs.yml b/config/locales/cs.yml index d61abdbe..335b1165 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright (C) 2011 Vít Jonáš -# Copyright (C) 2011-15 Karel Pičman +# Copyright (C) 2011-16 Karel Pičman # # # This program is free software; you can redistribute it and/or @@ -219,7 +219,6 @@ cs: warning_folder_not_locked: Složku nelze zamknout notice_folder_unlocked: Složka byla odemčena error_only_user_that_locked_folder_can_unlock_it: Nemáte oprávnění k odemknutí této složky - title_folder_parent_locked: "Nadřazená složka %{name} je zamčená" title_unlock_folder: Odemknout title_lock_folder: Zamknout diff --git a/config/locales/de.yml b/config/locales/de.yml index 3fff02ee..151e3256 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -4,7 +4,7 @@ # # Copyright (C) 2011 Terrence Miller # Copyright (C) 2013 Christian Wetting -# Copyright (C) 2011-15 Karel Pičman +# Copyright (C) 2011-16 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -219,7 +219,6 @@ de: warning_folder_not_locked: Der Ordner konnte nicht gesperrt werden notice_folder_unlocked: Der Ordner wurde erfolgreich entsperrt error_only_user_that_locked_folder_can_unlock_it: Sie haben keine Berechtigung zur Entsperrung des Ordners - title_folder_parent_locked: "Übergeordnetes Verzeichnis %{name} ist gesperrt" title_unlock_folder: Ordner zur Bearbeitung durch andere Benutzer entsperren title_lock_folder: Ordner zum Schutz vor Bearbeitung durch andere Benutzer sperren diff --git a/config/locales/en.yml b/config/locales/en.yml index 836637bf..764a2440 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -4,7 +4,7 @@ # # Copyright (C) 2011 Vít Jonáš # Copyright (C) 2012 Daniel Munn -# Copyright (C) 2011-15 Karel Pičman +# Copyright (C) 2011-16 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -219,7 +219,6 @@ en: warning_folder_not_locked: Unfortunately, the folder could not be locked notice_folder_unlocked: The folder was successfully unlocked error_only_user_that_locked_folder_can_unlock_it: You are not authorised to unlock this folder - title_folder_parent_locked: "Parent folder %{name} is locked" title_unlock_folder: Unlock to allow changes for other members title_lock_folder: Lock to prevent changes for other members diff --git a/config/locales/es.yml b/config/locales/es.yml index 8be42f4f..9101df95 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -4,7 +4,7 @@ # # Copyright (C) 2011 Vít Jonáš # Copyright (C) 2015 Agustin Ivorra -# Copyright (C) 2011-15 Karel Pičman +# Copyright (C) 2011-16 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -219,7 +219,6 @@ es: warning_folder_not_locked: Desafortunadamente, el directorio no se pudo bloquear notice_folder_unlocked: El directorio se desbloqueó exitosamente error_only_user_that_locked_folder_can_unlock_it: No está autorizado para desbloquearel directorio - title_folder_parent_locked: "Directorio padre %{name} está bloqueado" title_unlock_folder: Desbloquear para que sea editado por otros miembros title_lock_folder: Bloquear para evitar que sea editado por otros miembros diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 87f4a50d..e6a72410 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -2,10 +2,10 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright (C) 2011 Vít Jonáš -# Copyright (C) 2012 Daniel Munn -# Copyright (C) 2014 Atmis -# Copyright (C) 2011-15 Karel Pičman +# Copyright (C) 2011 Vít Jonáš +# Copyright (C) 2012 Daniel Munn +# Copyright (C) 2014 Atmis +# Copyright (C) 2011-16 Karel Pičman # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 @@ -219,7 +219,6 @@ fr: warning_folder_not_locked: Echec du verrouillage du dossier notice_folder_unlocked: Le dossier a été déverrouillé error_only_user_that_locked_folder_can_unlock_it: "Vous n'êtes autorisé à déverrouiller ce dossier" - title_folder_parent_locked: "Le dossier parent %{name} verrouillé" title_unlock_folder: Déverrouiller afin de permettre la modification par les membres du projet title_lock_folder: "Verrouiller afin d'empêcher les modifications du dossier" @@ -333,4 +332,4 @@ fr: open_approvals: Approbations en attente label_maximum_ajax_upload_filesize: Taille maximale de fichier pour téléversement via AJAX - note_maximum_ajax_upload_filesize: "Taille maximale, en méga octets, de fichier pour téléversement via l'interface standard AJAX. Sinon l'interface standard de Redmine doit être utilisée." + note_maximum_ajax_upload_filesize: "Taille maximale, en méga octets, de fichier pour téléversement via l'interface standard AJAX. Sinon l'interface standard de Redmine doit être utilisée." \ No newline at end of file diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 35ff8e62..3e8fe905 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -3,7 +3,7 @@ # Redmine plugin for Document Management System "Features" # # Copyright (C) 2011 Vít Jonáš -# Copyright (C) 2011-15 Karel Pičman +# Copyright (C) 2011-16 Karel Pičman # # # This program is free software; you can redistribute it and/or @@ -157,8 +157,7 @@ ja: permission_file_manipulation: ファイルの操作 permission_force_file_unlock: ファイルの強制ロック解除 permission_manage_workflows: ワークフロー管理 - permission_file_delete: ファイルの削除 - permission_file_approval: ファイルの承認 + permission_file_delete: ファイルの削除 label_file: ファイル field_folder: フォルダ error_create_cycle_in_folder_dependency: フォルダの依存関係が循環しています @@ -219,8 +218,7 @@ ja: notice_folder_locked: "フォルダをロックしました" warning_folder_not_locked: "フォルダをロックすることができませんでした" notice_folder_unlocked: "フォルダのロックを解除しました" - error_only_user_that_locked_folder_can_unlock_it: "このフォルダのロックを解除する権限がありません" - title_folder_parent_locked: "親フォルダ %{name} はロックされています" + error_only_user_that_locked_folder_can_unlock_it: "このフォルダのロックを解除する権限がありません" title_unlock_folder: "ロックを解除し他メンバが更新できるようにします" title_lock_folder: "ロックし他メンバとの競合を回避します" @@ -294,13 +292,14 @@ ja: label_notifications_off: 通知オフ field_target_file: リンク元ファイル title_download_entries: ダウンロード記録 + label_external: 外部 + label_link_name: リンク名 label_link_external_url: URL label_target_folder: リンク先フォルダ label_source_folder: リンク元フォルダ label_target_project: リンク先プロジェクト - label_source_project: リンク元プロジェクト - label_external: 外部 + label_source_project: リンク元プロジェクト text_email_doc_updated_subject: "プロジェクト'%{project}'のファイルが更新されました" text_email_doc_updated: が次のファイルを更新しました。 @@ -333,5 +332,4 @@ ja: open_approvals: 未承認 label_maximum_ajax_upload_filesize: アップロードファイルサイズ上限 - note_maximum_ajax_upload_filesize: アップロード可能なファイルサイズの上限。AjaxおよびRedmineの仕様に制限される(2ギガバイト程度までは確認済み)単位はMB。 - + note_maximum_ajax_upload_filesize: アップロード可能なファイルサイズの上限。AjaxおよびRedmineの仕様に制限される(2ギガバイト程度までは確認済み)単位はMB。 \ No newline at end of file diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 0e94fc16..b19bed33 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -4,9 +4,8 @@ # # Copyright (C) 2011 Vít Jonáš # Copyright (C) 2012 Daniel Munn -# Copyright (C) 2011-15 Karel Pičman +# Copyright (C) 2011-16 Karel Pičman # Polish translation created by Sebastian Białas www.bs-it.pl -# # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 @@ -220,7 +219,6 @@ pl: warning_folder_not_locked: Niestety folder nie może zostać zablokowany notice_folder_unlocked: Folder został odblokowany error_only_user_that_locked_folder_can_unlock_it: Nie posiadasz uprawnień do odblokowania tego folderu - title_folder_parent_locked: "Folder nadrzędny %{name} jest zablokowany" title_unlock_folder: Odblokuj w celu umożliwienia wprowadzania zmian innym użytkownikom title_lock_folder: Zablokuj aby zabezpieczyć przed wprowadzaniem zmian przez innych użytkowników @@ -238,6 +236,7 @@ pl: field_label_dmsf_workflow: Proces akceptacji field_label_dmsf_workflow_name: Nazwa procesu akceptacji label_dmsf_workflow_plural: Procesy akceptacji + label_dmsf_workflow_plural_num: Procesy akceptacji (%{count}) label_dmsf_workflow_step: Krok label_dmsf_workflow_step_plural: Kroki label_dmsf_workflow_approval: Akceptacja diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 11acc558..c5739415 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -4,7 +4,7 @@ # # Copyright (C) 2011 Vít Jonáš # Copyright (C) 2012 Daniel Munn -# Copyright (C) 2011-15 Karel Pičman +# Copyright (C) 2011-16 Karel Pičman # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -219,7 +219,6 @@ pt-BR: warning_folder_not_locked: A pasta não pode ser bloqueada notice_folder_unlocked: A pasta foi desbloqueada com sucesso error_only_user_that_locked_folder_can_unlock_it: Você não está autorizado a desbloquear esta pasta - title_folder_parent_locked: "A pasta %{name} está bloqueada" title_unlock_folder: Clique aqui para desbloquear e permitir alterações por outros usuários title_lock_folder: Clique aqui para impedir alterações por outros usuários diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 6f661767..97c238e7 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -2,8 +2,8 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright (C) 2011 Vít Jonáš -# Copyright (C) 2011-15 Karel Pičman +# Copyright (C) 2011 Vít Jonáš +# Copyright (C) 2011-16 Karel Pičman # # # This program is free software; you can redistribute it and/or @@ -219,7 +219,6 @@ ru: warning_folder_not_locked: "К сожалению, папка не может быть заблокирована" notice_folder_unlocked: "Папка была успешно разблокирована" error_only_user_that_locked_folder_can_unlock_it: "Только пользователь, который заблокировал папку, может её разблокировать" - title_folder_parent_locked: "Родительская папка %{name} заблокирована" title_unlock_folder: "Разблокируйте папку, чтобы разрешить изменение её другими участниками" title_lock_folder: "Заблокируйте папку, чтобы запретить ёё изменение другими участниками" diff --git a/config/locales/sl.yml b/config/locales/sl.yml index 9b02cf00..7b39b918 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -2,8 +2,8 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright (C) 2011 -# Copyright (C) 2011-15 Karel Pičman +# Copyright (C) 2011 Zdravko Balorda +# Copyright (C) 2011-16 Karel Pičman # # # This program is free software; you can redistribute it and/or @@ -219,7 +219,6 @@ sl: warning_folder_not_locked: Ne, ta mapa ne more biti zaklenjena notice_folder_unlocked: Mapa je uspešno odklenjena error_only_user_that_locked_folder_can_unlock_it: Nimate privilegijev, da bi odklenili to mapo - title_folder_parent_locked: "Nadrejena mapa %{name} je zaklenjena" title_unlock_folder: Odkleni, da bi drugim članom omogočil spreminjanje title_lock_folder: Zakleni, da bi drugim članom preprečil spreminjanje diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 04333d55..94f28e1c 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -2,9 +2,9 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright (C) 2011 Vít Jonáš -# Copyright (C) 2011-15 Karel Pičman -# Copyright (C) 2013 Aecho Liu +# Copyright (C) 2011 Vít Jonáš +# Copyright (C) 2011-16 Karel Pičman +# Copyright (C) 2013 Aecho Liu # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -219,7 +219,6 @@ zh-TW: warning_folder_not_locked: 不好意思,這個資料夾無法被鎖定。 notice_folder_unlocked: 這個資料夾己經成功地解除鎖定了。 error_only_user_that_locked_folder_can_unlock_it: 您未被授權,解除這個資料夾的鎖定狀態。 - title_folder_parent_locked: "上層資料夾 %{name} 被鎖定了。" title_unlock_folder: 解除鎖定。允許其它使用者修改。 title_lock_folder: 鎖定資料夾。禁止其它使用者修改。 diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 508ed8d8..2a299542 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2,8 +2,8 @@ # # Redmine plugin for Document Management System "Features" # -# Copyright (C) 2011 Vít Jonáš -# Copyright (C) 2011-15 Karel Pičman +# Copyright (C) 2011 Vít Jonáš +# Copyright (C) 2011-16 Karel Pičman # # # This program is free software; you can redistribute it and/or @@ -219,7 +219,6 @@ zh: warning_folder_not_locked: Unfortunately, the folder could not be locked notice_folder_unlocked: The folder was successfully unlocked error_only_user_that_locked_folder_can_unlock_it: You are not authorised to unlock this folder - title_folder_parent_locked: "Parent folder %{name} is locked" title_unlock_folder: Unlock to allow changes for other members title_lock_folder: Lock to prevent changes for other members diff --git a/init.rb b/init.rb index 5cdd5cf7..9e4d9f41 100644 --- a/init.rb +++ b/init.rb @@ -93,7 +93,9 @@ Redmine::Plugin.register :redmine_dmsf do # Administration menu extension Redmine::MenuManager.map :admin_menu do |menu| - menu.push :approvalworkflows, {:controller => 'dmsf_workflows', :action => 'index'}, :caption => :label_dmsf_workflow_plural + menu.push :approvalworkflows, + {:controller => 'dmsf_workflows', :action => 'index'}, + :caption => :label_dmsf_workflow_plural end Redmine::WikiFormatting::Macros.register do