#95 DMSF tab missing on closed projects
This commit is contained in:
parent
c2117d561a
commit
d423d471fe
@ -33,6 +33,9 @@ class DmsfController < ApplicationController
|
||||
helper :all
|
||||
|
||||
def show
|
||||
@folder_manipulation_allowed = User.current.allowed_to?(:folder_manipulation, @project)
|
||||
@file_manipulation_allowed = User.current.allowed_to?(:folder_manipulation, @project)
|
||||
|
||||
unless @folder
|
||||
@subfolders = @project.dmsf_folders.visible
|
||||
@files = @project.dmsf_files.visible
|
||||
|
||||
@ -109,7 +109,7 @@
|
||||
<th class="hidden"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tbody>
|
||||
<% @subfolders.each do |subfolder| %>
|
||||
<% locked_for_user = subfolder.locked_for_user? %>
|
||||
<% locked = subfolder.locked? %>
|
||||
@ -134,60 +134,59 @@
|
||||
<td class="workflow"></td>
|
||||
<td class="author"><%= h(subfolder.user) %></td>
|
||||
<td class="actions">
|
||||
<% if User.current.allowed_to?(:file_approval, @project) %>
|
||||
<div class="right_icon_box" style="width:26px;">
|
||||
<% if subfolder.notification %>
|
||||
<%= link_to_function(image_tag('notify.png', :plugin => :redmine_dmsf),
|
||||
"manipulation_link('#{url_for(:action => 'notify_deactivate', :id => @project, :folder_id => subfolder)}')",
|
||||
:title => l(:title_notifications_active_deactivate)) %>
|
||||
<% else %>
|
||||
<%= link_to_function(image_tag('notifynot.png', :plugin => :redmine_dmsf),
|
||||
"manipulation_link('#{url_for(:action => 'notify_activate', :id => @project, :folder_id => subfolder)}')",
|
||||
:title => l(:title_notifications_not_active_activate)) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="right_icon_box" style="width: 70px;">
|
||||
<% if User.current.allowed_to?(:folder_manipulation, @project) %>
|
||||
<div style="float: left">
|
||||
<%= link_to(image_tag('edit.png', :class =>'detail_icon'),
|
||||
{:action => 'edit', :id => @project, :folder_id => subfolder },
|
||||
:title => l(:link_edit, :title => h(subfolder.title))) unless locked_for_user %>
|
||||
</div>
|
||||
<% if @folder_manipulation_allowed %>
|
||||
<% if User.current.allowed_to?(:file_approval, @project) %>
|
||||
<div class="right_icon_box" style="width:26px;">
|
||||
<% if subfolder.notification %>
|
||||
<%= link_to_function(image_tag('notify.png', :plugin => :redmine_dmsf),
|
||||
"manipulation_link('#{url_for(:action => 'notify_deactivate', :id => @project, :folder_id => subfolder)}')",
|
||||
:title => l(:title_notifications_active_deactivate)) %>
|
||||
<% else %>
|
||||
<%= link_to_function(image_tag('notifynot.png', :plugin => :redmine_dmsf),
|
||||
"manipulation_link('#{url_for(:action => 'notify_activate', :id => @project, :folder_id => subfolder)}')",
|
||||
:title => l(:title_notifications_not_active_activate)) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div style="float: right; width: 44px;">
|
||||
<% unless locked_for_user && !User.current.allowed_to?(:force_file_unlock, @project)%>
|
||||
<% if locked %>
|
||||
<% if subfolder.unlockable? %>
|
||||
<%= link_to_function(image_tag('unlock.png', :plugin => :redmine_dmsf),
|
||||
"manipulation_link('#{url_for(:controller => 'dmsf', :action => 'unlock',
|
||||
:id => @project, :folder_id => subfolder)}')",
|
||||
:title => l(:title_unlock_file))%>
|
||||
<div class="right_icon_box" style="width: 70px;">
|
||||
<div style="float: left">
|
||||
<%= link_to(image_tag('edit.png', :class =>'detail_icon'),
|
||||
{:action => 'edit', :id => @project, :folder_id => subfolder },
|
||||
:title => l(:link_edit, :title => h(subfolder.title))) unless locked_for_user %>
|
||||
</div>
|
||||
<div style="float: right; width: 44px;">
|
||||
<% unless locked_for_user && !User.current.allowed_to?(:force_file_unlock, @project)%>
|
||||
<% if locked %>
|
||||
<% if subfolder.unlockable? %>
|
||||
<%= link_to_function(image_tag('unlock.png', :plugin => :redmine_dmsf),
|
||||
"manipulation_link('#{url_for(:controller => 'dmsf', :action => 'unlock',
|
||||
:id => @project, :folder_id => subfolder)}')",
|
||||
:title => l(:title_unlock_file))%>
|
||||
<% else %>
|
||||
<%= image_tag('locked.png', :plugin => :redmine_dmsf,
|
||||
:title => l(:title_folder_parent_locked, :name => subfolder.lock.reverse[0].folder.title)) %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= image_tag('locked.png', :plugin => :redmine_dmsf,
|
||||
:title => l(:title_folder_parent_locked, :name => subfolder.lock.reverse[0].folder.title)) %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= link_to_function(image_tag('lock.png', :plugin => :redmine_dmsf),
|
||||
"manipulation_link('#{url_for(:controller => 'dmsf', :action => 'lock',
|
||||
:id => @project, :folder_id => subfolder)}')",
|
||||
:title => l(:title_lock_file)) %>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
<% jetzt = Time.now %>
|
||||
<%= link_to_function(image_tag('delete.png', :plugin => :redmine_dmsf),
|
||||
"confirmation_link('#{url_for(:action => 'delete', :id => @project, :folder_id => @folder, :delete_folder_id => subfolder)}', '#{l(:question_do_you_really_want_to_delete_this_entry)}')",
|
||||
:title => l(:title_delete)) unless locked_for_user %>
|
||||
<%= link_to_function(image_tag('lock.png', :plugin => :redmine_dmsf),
|
||||
"manipulation_link('#{url_for(:controller => 'dmsf', :action => 'lock',
|
||||
:id => @project, :folder_id => subfolder)}')",
|
||||
:title => l(:title_lock_file)) %>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
<%= link_to_function(image_tag('delete.png', :plugin => :redmine_dmsf),
|
||||
"confirmation_link('#{url_for(:action => 'delete', :id => @project, :folder_id => @folder, :delete_folder_id => subfolder)}', '#{l(:question_do_you_really_want_to_delete_this_entry)}')",
|
||||
:title => l(:title_delete)) unless locked_for_user %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br class="clear" />
|
||||
<br class="clear" />
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="hidden">0</td>
|
||||
<td class="hidden">0</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% workflows_available = DmsfWorkflow.where(['project_id = ? OR project_id IS NULL', @project.id]).count > 0 %>
|
||||
<% workflows_available = DmsfWorkflow.where(['project_id = ? OR project_id IS NULL', @project.id]).count > 0 %>
|
||||
<% @files.each do |file| %>
|
||||
<% unless file.last_revision %>
|
||||
<% Rails.logger.error "Error: dmsf_file id #{file.id} has no revision!" %>
|
||||
@ -219,8 +218,8 @@
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="version"><%= file.last_revision.version %></td>
|
||||
<td class="workflow">
|
||||
<% if wf %>
|
||||
<td class="workflow">
|
||||
<% if wf && @file_manipulation_allowed %>
|
||||
<%= link_to(
|
||||
file.last_revision.workflow_str(false),
|
||||
log_dmsf_workflow_path(
|
||||
@ -235,97 +234,99 @@
|
||||
</td>
|
||||
<td class="author"><%= h(file.last_revision.user) %></td>
|
||||
<td class="actions">
|
||||
<% if User.current.allowed_to?(:file_approval, @project) %>
|
||||
<div class="right_icon_box" style="width:26px;">
|
||||
<% if file.notification %>
|
||||
<%= link_to_function(image_tag('notify.png', :plugin => :redmine_dmsf),
|
||||
"manipulation_link('#{url_for(:controller => 'dmsf_files', :action => 'notify_deactivate', :id => file)}')",
|
||||
:title => l(:title_notifications_active_deactivate)) %>
|
||||
<% else %>
|
||||
<%= link_to_function(image_tag('notifynot.png', :plugin => :redmine_dmsf),
|
||||
"manipulation_link('#{url_for(:controller => 'dmsf_files', :action => 'notify_activate', :id => file)}')",
|
||||
:title => l(:title_notifications_not_active_activate)) %>
|
||||
<% end %>
|
||||
<% 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) %>
|
||||
<% if @file_manipulation_allowed %>
|
||||
<% if User.current.allowed_to?(:file_approval, @project) %>
|
||||
<div class="right_icon_box" style="width:26px;">
|
||||
<% if file.notification %>
|
||||
<%= link_to_function(image_tag('notify.png', :plugin => :redmine_dmsf),
|
||||
"manipulation_link('#{url_for(:controller => 'dmsf_files', :action => 'notify_deactivate', :id => file)}')",
|
||||
:title => l(:title_notifications_active_deactivate)) %>
|
||||
<% else %>
|
||||
<%= link_to_function(image_tag('notifynot.png', :plugin => :redmine_dmsf),
|
||||
"manipulation_link('#{url_for(:controller => 'dmsf_files', :action => 'notify_activate', :id => file)}')",
|
||||
:title => l(:title_notifications_not_active_activate)) %>
|
||||
<% end %>
|
||||
<% 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 %>
|
||||
<%= image_tag('waiting_for_approval.png', :title => "#{l(:label_dmsf_wokflow_action_approve)} #{l(:label_dmsf_wokflow_action_reject)} #{l(:label_dmsf_wokflow_action_delegate)}", :plugin => :redmine_dmsf) %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= image_tag('waiting_for_approval.png', :title => "#{l(:label_dmsf_wokflow_action_approve)} #{l(:label_dmsf_wokflow_action_reject)} #{l(:label_dmsf_wokflow_action_delegate)}", :plugin => :redmine_dmsf) %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= image_tag('waiting_for_approval.png', :title => "#{l(:label_dmsf_wokflow_action_approve)} #{l(:label_dmsf_wokflow_action_reject)} #{l(:label_dmsf_wokflow_action_delegate)}", :plugin => :redmine_dmsf) %>
|
||||
<% end %>
|
||||
<% when DmsfWorkflow::STATE_APPROVED %>
|
||||
<%= image_tag('approved.png', :title => l(:title_approved), :plugin => :redmine_dmsf) %>
|
||||
<% when DmsfWorkflow::STATE_ASSIGNED %>
|
||||
<% if User.current && (file.last_revision.dmsf_workflow_assigned_by == User.current.id) && wf %>
|
||||
<%= link_to_function(image_tag('assigned.png', :plugin => :redmine_dmsf),
|
||||
"manipulation_link('#{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 %>
|
||||
<%= image_tag('assigned.png', :title => l(:label_dmsf_wokflow_action_start), :plugin => :redmine_dmsf) %>
|
||||
<% end %>
|
||||
<% when DmsfWorkflow::STATE_REJECTED %>
|
||||
<%= image_tag('rejected.png', :title => l(:title_rejected), :plugin => :redmine_dmsf) %>
|
||||
<% 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 %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="right_icon_box" style="width: 70px">
|
||||
<div style="float: left">
|
||||
<%= link_to(image_tag('filedetails.png', :plugin => :redmine_dmsf, :class =>'detail_icon'),
|
||||
{:controller => 'dmsf_files', :action => :show, :id => file },
|
||||
:title => l(:link_details, :title =>h(file.last_revision.title))) %>
|
||||
</div>
|
||||
<div style="float: right; width: 44px;">
|
||||
<% unless locked_for_user && !User.current.allowed_to?(:force_file_unlock, @project)%>
|
||||
<% if locked %>
|
||||
<% if file.unlockable? %>
|
||||
<%= link_to_function(image_tag('unlock.png', :plugin => :redmine_dmsf),
|
||||
"manipulation_link('#{url_for(:controller => 'dmsf_files', :action => 'unlock', :id => file)}')",
|
||||
:title => l(:title_unlock_file))%>
|
||||
<% else %>
|
||||
<%= image_tag('locked.png', :plugin => :redmine_dmsf,
|
||||
:title => l(:title_file_parent_locked, :name => file.folder.lock.reverse[0].folder.title)) %>
|
||||
<% end%>
|
||||
<% else %>
|
||||
<%= link_to_function(image_tag('lock.png', :plugin => :redmine_dmsf),
|
||||
"manipulation_link('#{url_for(:controller => 'dmsf_files', :action => 'lock', :id => file)}')",
|
||||
:title => l(:title_lock_file)) %>
|
||||
<% end %>
|
||||
|
||||
<% when DmsfWorkflow::STATE_APPROVED %>
|
||||
<%= image_tag('approved.png', :title => l(:title_approved), :plugin => :redmine_dmsf) %>
|
||||
<% when DmsfWorkflow::STATE_ASSIGNED %>
|
||||
<% if User.current && (file.last_revision.dmsf_workflow_assigned_by == User.current.id) && wf %>
|
||||
<%= link_to_function(image_tag('assigned.png', :plugin => :redmine_dmsf),
|
||||
"manipulation_link('#{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 %>
|
||||
<%= image_tag('assigned.png', :title => l(:label_dmsf_wokflow_action_start), :plugin => :redmine_dmsf) %>
|
||||
<% end %>
|
||||
<% when DmsfWorkflow::STATE_REJECTED %>
|
||||
<%= image_tag('rejected.png', :title => l(:title_rejected), :plugin => :redmine_dmsf) %>
|
||||
<% 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 %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if User.current.allowed_to?(:file_manipulation, @project) && !locked_for_user %>
|
||||
<%= link_to_function(image_tag('delete.png', :plugin => :redmine_dmsf),
|
||||
"confirmation_link('#{url_for(:controller => 'dmsf_files', :action => 'delete', :id => file)}', '#{l(:question_do_you_really_want_to_delete_this_entry)}')",
|
||||
:title => l(:title_delete)) %>
|
||||
<% end %>
|
||||
<div class="right_icon_box" style="width: 70px">
|
||||
<div style="float: left">
|
||||
<%= link_to(image_tag('filedetails.png', :plugin => :redmine_dmsf, :class =>'detail_icon'),
|
||||
{:controller => 'dmsf_files', :action => :show, :id => file },
|
||||
:title => l(:link_details, :title =>h(file.last_revision.title))) %>
|
||||
</div>
|
||||
<div style="float: right; width: 44px;">
|
||||
<% unless locked_for_user && !User.current.allowed_to?(:force_file_unlock, @project)%>
|
||||
<% if locked %>
|
||||
<% if file.unlockable? %>
|
||||
<%= link_to_function(image_tag('unlock.png', :plugin => :redmine_dmsf),
|
||||
"manipulation_link('#{url_for(:controller => 'dmsf_files', :action => 'unlock', :id => file)}')",
|
||||
:title => l(:title_unlock_file))%>
|
||||
<% else %>
|
||||
<%= image_tag('locked.png', :plugin => :redmine_dmsf,
|
||||
:title => l(:title_file_parent_locked, :name => file.folder.lock.reverse[0].folder.title)) %>
|
||||
<% end%>
|
||||
<% else %>
|
||||
<%= link_to_function(image_tag('lock.png', :plugin => :redmine_dmsf),
|
||||
"manipulation_link('#{url_for(:controller => 'dmsf_files', :action => 'lock', :id => file)}')",
|
||||
:title => l(:title_lock_file)) %>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
<% unless locked_for_user %>
|
||||
<%= link_to_function(image_tag('delete.png', :plugin => :redmine_dmsf),
|
||||
"confirmation_link('#{url_for(:controller => 'dmsf_files', :action => 'delete', :id => file)}', '#{l(:question_do_you_really_want_to_delete_this_entry)}')",
|
||||
:title => l(:title_delete)) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br class="clear" />
|
||||
<br class="clear" />
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="hidden">1</td>
|
||||
<td class="hidden"><%= file.last_revision.size %></td>
|
||||
@ -411,5 +412,5 @@ sUrl = "jquery.dataTables/#{I18n.locale.to_s.downcase}.json" if I18n.locale && !
|
||||
</script>
|
||||
<% end %>
|
||||
|
||||
<%= render(:partial => 'multi_upload') if (User.current.allowed_to?(:file_manipulation, @project) && !@locked_for_user) %>
|
||||
<%= render(:partial => 'multi_upload') if (@file_manipulation_allowed && !@locked_for_user) %>
|
||||
<br/>
|
||||
|
||||
6
init.rb
6
init.rb
@ -49,10 +49,10 @@ Redmine::Plugin.register :redmine_dmsf do
|
||||
activity_provider :dmsf_files, :class_name => 'DmsfFileRevision', :default => true
|
||||
|
||||
project_module :dmsf do
|
||||
permission :view_dmsf_folders, {:dmsf => [:show], :dmsf_folders_copy => [:new, :copy_to, :move_to]}
|
||||
permission :view_dmsf_folders, {:dmsf => [:show], :dmsf_folders_copy => [:new, :copy_to, :move_to]}, :read => true
|
||||
permission :user_preferences, {:dmsf_state => [:user_pref_save]}
|
||||
permission :view_dmsf_files, {:dmsf => [:entries_operation, :entries_email],
|
||||
:dmsf_files => [:show], :dmsf_files_copy => [:new, :create, :move]}
|
||||
:dmsf_files => [:show], :dmsf_files_copy => [:new, :create, :move]}, :read => true
|
||||
permission :folder_manipulation, {:dmsf => [:new, :create, :delete, :edit, :save, :edit_root, :save_root, :lock, :unlock]}
|
||||
permission :file_manipulation, {:dmsf_files => [:create_revision, :delete, :lock, :unlock],
|
||||
:dmsf_upload => [:upload_files, :upload_file, :commit_files]}
|
||||
@ -60,7 +60,7 @@ Redmine::Plugin.register :redmine_dmsf do
|
||||
:dmsf => [:notify_activate, :notify_deactivate],
|
||||
:dmsf_workflows => [:index, :new, :create, :destroy, :edit, :add_step, :remove_step, :reorder_steps, :update, :start, :assign, :assignment, :action, :new_action, :log, :autocomplete_for_user]}
|
||||
permission :force_file_unlock, {}
|
||||
end
|
||||
end
|
||||
|
||||
# Administration menu extension
|
||||
Redmine::MenuManager.map :admin_menu do |menu|
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user