diff --git a/app/controllers/dmsf_controller.rb b/app/controllers/dmsf_controller.rb
index ac639b34..5baaa487 100644
--- a/app/controllers/dmsf_controller.rb
+++ b/app/controllers/dmsf_controller.rb
@@ -616,7 +616,8 @@ class DmsfController < ApplicationController
def find_folder_by_title
# find by title has to be scoped to project
- @folder = DmsfFolder.find_by(title: params[:folder_title], project_id: params[:id]) if params[:folder_title].present?
+ project = Project.find(params[:id])
+ @folder = DmsfFolder.find_by(title: params[:folder_title], project_id: project.id) if params[:folder_title].present?
rescue DmsfAccessError
render_403
rescue ActiveRecord::RecordNotFound
diff --git a/app/controllers/dmsf_links_controller.rb b/app/controllers/dmsf_links_controller.rb
index fcc1434c..a6162211 100644
--- a/app/controllers/dmsf_links_controller.rb
+++ b/app/controllers/dmsf_links_controller.rb
@@ -87,7 +87,7 @@ class DmsfLinksController < ApplicationController
@dmsf_link.project_id = params[:dmsf_link][:project_id]
@dmsf_link.dmsf_folder_id = params[:dmsf_link][:dmsf_folder_id]
else
- # An issue link
+ # A container link
@dmsf_link.project_id = -1
@dmsf_link.dmsf_folder_id = nil
end
diff --git a/app/controllers/dmsf_upload_controller.rb b/app/controllers/dmsf_upload_controller.rb
index b0b57189..f7cd5065 100644
--- a/app/controllers/dmsf_upload_controller.rb
+++ b/app/controllers/dmsf_upload_controller.rb
@@ -24,11 +24,11 @@ class DmsfUploadController < ApplicationController
menu_item :dmsf
- before_action :find_project, :except => [:upload, :delete_dmsf_attachment]
- before_action :authorize, :except => [:upload, :delete_dmsf_attachment]
- before_action :authorize_global, :only => [:upload, :delete_dmsf_attachment]
- before_action :find_folder, :except => [:upload_file, :upload, :commit, :delete_dmsf_attachment]
- before_action :permissions, :except => [:upload_file, :upload, :commit, :delete_dmsf_attachment]
+ before_action :find_project, :except => [:upload, :delete_dmsf_attachment, :delete_dmsf_link_attachment]
+ before_action :authorize, :except => [:upload, :delete_dmsf_attachment, :delete_dmsf_link_attachment]
+ before_action :authorize_global, :only => [:upload, :delete_dmsf_attachment, :delete_dmsf_link_attachment]
+ before_action :find_folder, :except => [:upload_file, :upload, :commit, :delete_dmsf_attachment, :delete_dmsf_link_attachment]
+ before_action :permissions, :except => [:upload_file, :upload, :commit, :delete_dmsf_attachment, :delete_dmsf_link_attachment]
helper :all
helper :dmsf_workflows
@@ -75,7 +75,7 @@ class DmsfUploadController < ApplicationController
end
end
- # REST API document upload
+ # REST API and Redmine attachment form
def upload
unless request.content_type == 'application/octet-stream'
render :nothing => true, :status => 406
@@ -130,6 +130,13 @@ class DmsfUploadController < ApplicationController
render_404
end
+ def delete_dmsf_link_attachment
+ link = DmsfLink.find(params[:id])
+ link.destroy
+ rescue ActiveRecord::RecordNotFound
+ render_404
+ end
+
private
def commit_files_internal(commited_files)
diff --git a/app/controllers/dmsf_workflows_controller.rb b/app/controllers/dmsf_workflows_controller.rb
index d4112bf9..34ef049c 100644
--- a/app/controllers/dmsf_workflows_controller.rb
+++ b/app/controllers/dmsf_workflows_controller.rb
@@ -321,7 +321,7 @@ class DmsfWorkflowsController < ApplicationController
end
def new_step
- @steps = @dmsf_workflow.dmsf_workflow_steps.select('step, MAX(name) AS name').group(:step)
+ @steps = @dmsf_workflow.dmsf_workflow_steps.select('step, MAX(name) AS name').group(:step, :operator)
respond_to do |format|
format.html
@@ -332,7 +332,7 @@ class DmsfWorkflowsController < ApplicationController
def add_step
if request.post?
if params[:step] == '0'
- step = @dmsf_workflow.dmsf_workflow_steps.collect{|s| s.step}.distinct.count + 1
+ step = @dmsf_workflow.dmsf_workflow_steps.collect{|s| s.step}.uniq.count + 1
else
step = params[:step].to_i
end
diff --git a/app/helpers/dmsf_helper.rb b/app/helpers/dmsf_helper.rb
index 9020c9be..99576739 100644
--- a/app/helpers/dmsf_helper.rb
+++ b/app/helpers/dmsf_helper.rb
@@ -59,10 +59,12 @@ module DmsfHelper
extension = File.extname(filename)
extension = extension[1, extension.length-1]
if File.exist?("#{File.dirname(__FILE__)}/../../assets/images/filetypes/#{extension}.png")
- "filetype-#{extension}";
+ cls = "filetype-#{extension}";
else
- Redmine::MimeType.css_class_of(filename)
+ cls = Redmine::MimeType.css_class_of(filename)
end
+ cls << ' dmsf-icon-file' if cls
+ cls
end
def plugin_asset_path(plugin, asset_type, source)
diff --git a/app/models/dmsf_file.rb b/app/models/dmsf_file.rb
index bc5a91d3..d802220d 100644
--- a/app/models/dmsf_file.rb
+++ b/app/models/dmsf_file.rb
@@ -507,7 +507,7 @@ class DmsfFile < ActiveRecord::Base
end
def extension
- $1 if self.last_revision && self.last_revision.disk_filename =~ /\.(.+)$/
+ File.extname(self.last_revision.disk_filename).strip.downcase[1..-1] if self.last_revision
end
include ActionView::Helpers::NumberHelper
diff --git a/app/views/dmsf/_dir.html.erb b/app/views/dmsf/_dir.html.erb
index 8edf4824..534dfb15 100644
--- a/app/views/dmsf/_dir.html.erb
+++ b/app/views/dmsf/_dir.html.erb
@@ -83,45 +83,45 @@
<% if @folder_manipulation_allowed && !(subfolder && subfolder.system) %>
<% if subfolder && subfolder.locked? %>
-
+
<% if subfolder.unlockable? && (!subfolder.locked_for_user? || @force_file_unlock_allowed) %>
<%= link_to('', unlock_dmsf_path(:id => project, :folder_id => subfolder),
:title => subfolder.get_locked_title,
- :class => 'icon icon-unlock') %>
+ :class => 'icon-only icon-unlock') %>
<% else %>
-
+
<% end %>
<% else %>
<% if subfolder %>
<%= link_to('', edit_dmsf_path(:id => project, :folder_id => subfolder),
:title => l(:link_edit, :title => h(subfolder.title)),
- :class => 'icon icon-edit') %>
+ :class => 'icon-only icon-edit') %>
<% else %>
<%= link_to('', edit_root_dmsf_path(:id => @project),
:title => l(:link_edit, :title => l(:link_documents)),
- :class => 'icon icon-edit') %>
+ :class => 'icon-only icon-edit') %>
<% end %>
<% if subfolder %>
<%= link_to('', lock_dmsf_path(:id => project, :folder_id => subfolder),
:title => l(:title_lock_file),
- :class => 'icon icon-lock') %>
+ :class => 'icon-only icon-lock') %>
<% else %>
-
+
<% end %>
<% if (subfolder && subfolder.notification) || (!subfolder && project.dmsf_notification) %>
<%= link_to('', notify_deactivate_dmsf_path(:id => project, :folder_id => subfolder),
:title => l(:title_notifications_active_deactivate),
- :class => 'icon icon-email') %>
+ :class => 'icon-only icon-email') %>
<% else %>
<%= link_to('', notify_activate_dmsf_path(:id => project, :folder_id => subfolder),
:title => l(:title_notifications_not_active_activate),
- :class => 'icon icon-email-add') %>
+ :class => 'icon-only icon-email-add') %>
<% end %>
<%= link_to('', link ? dmsf_link_path(link) : delete_dmsf_path(:id => project, :folder_id => subfolder),
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:title_delete),
:method => :delete,
- :class => 'icon icon-del') %>
+ :class => 'icon-only icon-del') %>
<% end %>
<% end %>
|
diff --git a/app/views/dmsf/_dir_trash.html.erb b/app/views/dmsf/_dir_trash.html.erb
index 6ccde20e..bc581341 100644
--- a/app/views/dmsf/_dir_trash.html.erb
+++ b/app/views/dmsf/_dir_trash.html.erb
@@ -69,19 +69,19 @@
<% if @folder_manipulation_allowed %>
<%= link_to('', link ? restore_dmsf_link_path(:id => link) : restore_dmsf_path(:id => project, :folder_id => subfolder),
:title => l(:title_restore),
- :class => 'icon icon-cancel') %>
+ :class => 'icon-only icon-cancel') %>
<% if link %>
<%= link_to('', dmsf_link_path(:id => link, :commit => 'yes'),
:data => {:confirm => l(:text_are_you_sure)},
:method => :delete,
:title => l(:title_delete),
- :class => 'icon icon-delete') %>
+ :class => 'icon-only icon-delete') %>
<% else %>
<%= link_to('', delete_dmsf_path(:id => project, :folder_id => subfolder, :commit => 'yes'),
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:title_delete),
:method => :delete,
- :class => 'icon icon-delete') %>
+ :class => 'icon-only icon-del') %>
<% end %>
<% end %>
diff --git a/app/views/dmsf/_file.html.erb b/app/views/dmsf/_file.html.erb
index 16669a7f..c63d87f6 100644
--- a/app/views/dmsf/_file.html.erb
+++ b/app/views/dmsf/_file.html.erb
@@ -89,48 +89,48 @@
<% if @file_manipulation_allowed %>
<%= link_to('', dmsf_file_path(:id => file),
:title => l(:link_details, :title => h(file.last_revision.title)),
- :class => 'icon icon-edit') %>
+ :class => 'icon-only icon-edit') %>
<% if !file.locked? %>
<%= link_to('', lock_dmsf_files_path(:id => file),
:title => l(:title_lock_file),
- :class => 'icon icon-lock') %>
+ :class => 'icon-only icon-lock') %>
<% elsif file.unlockable? && (!file.locked_for_user? || @force_file_unlock_allowed) %>
<%= link_to('', unlock_dmsf_files_path(:id => file),
:title => file.get_locked_title,
- :class => 'icon icon-unlock') %>
+ :class => 'icon-only icon-unlock') %>
<% else %>
-
+
<% end %>
<% unless file.locked? %>
<% if file.notification %>
<%= link_to('', notify_deactivate_dmsf_files_path(:id => file),
:title => l(:title_notifications_active_deactivate),
- :class => 'icon icon-email') %>
+ :class => 'icon-only icon-email') %>
<% else %>
<%= link_to('', notify_activate_dmsf_files_path(:id => file),
:title => l(:title_notifications_not_active_activate),
- :class => 'icon icon-email-add') %>
+ :class => 'icon-only icon-email-add') %>
<% end %>
<% if link %>
<%= link_to('', dmsf_link_path(link),
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:title_delete),
:method => :delete,
- :class => 'icon icon-del') %>
+ :class => 'icon-only icon-del') %>
<% else %>
<% if @file_delete_allowed %>
<%= link_to('', dmsf_file_path(:id => file),
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:title_delete),
:method => :delete,
- :class => 'icon icon-del') %>
+ :class => 'icon-only icon-del') %>
<% else %>
-
+
<% end %>
<% end %>
<% else %>
-
-
+
+
<% end %>
<% end %>
<%= render(:partial => 'dmsf_files/approval_workflow_button',
diff --git a/app/views/dmsf/_file_trash.html.erb b/app/views/dmsf/_file_trash.html.erb
index a3635e6c..55f54355 100644
--- a/app/views/dmsf/_file_trash.html.erb
+++ b/app/views/dmsf/_file_trash.html.erb
@@ -69,14 +69,14 @@
<% if @file_manipulation_allowed %>
<%= link_to('', link ? restore_dmsf_link_path(:id => link) : restore_dmsf_file_path(:id => file),
:title => l(:title_restore),
- :class => 'icon icon-cancel') %>
+ :class => 'icon-only icon-cancel') %>
<% end %>
<% if @file_delete_allowed %>
<%= link_to('', link ? dmsf_link_path(:id => link, :commit => 'yes') : dmsf_file_path(:id => file, :commit => 'yes'),
:data => {:confirm => l(:text_are_you_sure)},
:method => :delete,
:title => l(:title_delete),
- :class => 'icon icon-delete') %>
+ :class => 'icon-only icon-del') %>
<% end %>
1 |
diff --git a/app/views/dmsf/show.html.erb b/app/views/dmsf/show.html.erb
index 7539f9ff..e7c5096c 100644
--- a/app/views/dmsf/show.html.erb
+++ b/app/views/dmsf/show.html.erb
@@ -215,7 +215,7 @@
<% end %>
<% if (@file_manipulation_allowed && !@locked_for_user && !@system_folder) %>
- <%= render(:partial => 'dmsf_upload/multi_upload') %>
+ <%= render(:partial => 'dmsf_upload/multi_upload', :local => { :lbl => true }) %>
<% end %>
<% unless @system_folder %>
diff --git a/app/views/dmsf_files/_approval_workflow_button.html.erb b/app/views/dmsf_files/_approval_workflow_button.html.erb
index 66b8f68e..08536151 100644
--- a/app/views/dmsf_files/_approval_workflow_button.html.erb
+++ b/app/views/dmsf_files/_approval_workflow_button.html.erb
@@ -35,12 +35,12 @@
:dmsf_file_revision_id => file.last_revision.id),
:title => l(:title_waiting_for_approval),
:remote => true,
- :class => 'icon icon-wf-waiting') %>
+ :class => "icon-only icon-wf-waiting") %>
<% else %>
-
+
<% end %>
<% else %>
-
+
<% end %>
<% when DmsfWorkflow::STATE_ASSIGNED %>
<% if User.current && (file.last_revision.dmsf_workflow_assigned_by == User.current.id) && wf %>
@@ -49,12 +49,12 @@
:id => file.last_revision.dmsf_workflow_id,
:dmsf_file_revision_id => file.last_revision.id),
:title => l(:label_dmsf_wokflow_action_start),
- :class => 'icon icon-wf-assigned') %>
+ :class => 'icon-only icon-wf-assigned') %>
<% else %>
<% end %>
<% when DmsfWorkflow::STATE_APPROVED, DmsfWorkflow::STATE_REJECTED %>
-
+
<% else %>
<% if workflows_available %>
<%= link_to('',
@@ -69,9 +69,9 @@
:dmsf_file_revision_id => file.last_revision.id),
:title => l(:label_dmsf_wokflow_action_assign),
:remote => true,
- :class => 'icon icon-wf-none') %>
+ :class => 'icon-only icon-wf-none') %>
<% else %>
-
+
<% end %>
<% end %>
<% end %>
diff --git a/app/views/dmsf_files/_file_new_revision.html.erb b/app/views/dmsf_files/_file_new_revision.html.erb
index b80e0cdf..b1a44be8 100644
--- a/app/views/dmsf_files/_file_new_revision.html.erb
+++ b/app/views/dmsf_files/_file_new_revision.html.erb
@@ -78,7 +78,8 @@
<%= label_tag('file_upload', l(:label_new_content)) %>
- <%= render :partial => 'dmsf_upload/form', :locals => { :multiple => false, :container => nil } %>
+ <%= render :partial => 'dmsf_upload/form',
+ :locals => { :multiple => false, :container => nil, :description => false, :awf => false } %>
diff --git a/app/views/dmsf_files/_link.html.erb b/app/views/dmsf_files/_link.html.erb
index 8a884fea..0278770e 100644
--- a/app/views/dmsf_files/_link.html.erb
+++ b/app/views/dmsf_files/_link.html.erb
@@ -46,36 +46,36 @@
<% if User.current.allowed_to? :file_manipulation, dmsf_file.project %>
<%= link_to('', dmsf_file_path(:id => dmsf_file),
:title => l(:link_details, :title => h(dmsf_file.last_revision.title)),
- :class => 'icon icon-edit') %>
+ :class => 'icon-only icon-edit') %>
<% else %>
-
+
<% end %>
<% # Email %>
<%= link_to('', entries_operations_dmsf_path(:id => dmsf_file.project, :email_entries => 'email', :files => [dmsf_file.id]), :method => :post,
:title => l(:heading_send_documents_by_email),
- :class => 'icon icon-email-disabled') %>
+ :class => 'icon-only icon-email-disabled') %>
<% # Lock %>
<% if !dmsf_file.locked? %>
<%= link_to('', lock_dmsf_files_path(:id => dmsf_file),
:title => l(:title_lock_file),
- :class => 'icon icon-lock') %>
+ :class => 'icon-only icon-lock') %>
<% elsif dmsf_file.unlockable? && (!dmsf_file.locked_for_user? || User.current.allowed_to?(:force_file_unlock, dmsf_file.project)) %>
<%= link_to('', unlock_dmsf_files_path(:id => dmsf_file),
:title => dmsf_file.get_locked_title,
- :class => 'icon icon-unlock') %>
+ :class => 'icon-only icon-unlock') %>
<% else %>
-
+
<% end %>
<% unless dmsf_file.locked? %>
<% # Notifications %>
<% if dmsf_file.notification %>
<%= link_to('', notify_deactivate_dmsf_files_path(:id => dmsf_file),
:title => l(:title_notifications_active_deactivate),
- :class => 'icon icon-email') %>
+ :class => 'icon-only icon-email') %>
<% else %>
<%= link_to('', notify_activate_dmsf_files_path(:id => dmsf_file),
:title => l(:title_notifications_not_active_activate),
- :class => 'icon icon-email-add') %>
+ :class => 'icon-only icon-email-add') %>
<% end %>
<% # Delete %>
<% if @issue.attributes_editable? && User.current.allowed_to?(:file_delete, dmsf_file.project) %>
@@ -84,11 +84,11 @@
:data => {:confirm => l(:text_are_you_sure)},
:method => :delete,
:title => l(:title_delete),
- :class => 'icon icon-del') %>
+ :class => 'icon-only icon-del') %>
<% end %>
<% else %>
-
-
+
+
<% end %>
<% # Approval workflow %>
<% wf = DmsfWorkflow.find_by_id(dmsf_file.last_revision.dmsf_workflow_id) if dmsf_file.last_revision.dmsf_workflow_id %>
diff --git a/app/views/dmsf_files/_thumbnails.html.erb b/app/views/dmsf_files/_thumbnails.html.erb
index 3e545d58..2812061d 100644
--- a/app/views/dmsf_files/_thumbnails.html.erb
+++ b/app/views/dmsf_files/_thumbnails.html.erb
@@ -24,17 +24,21 @@
<% if defined?(thumbnails) && thumbnails %>
<% images = links.map{ |x| x[0] }.select(&:image?) %>
<% if images.any? %>
-
+ <% if link_to # Redmine classic %>
+
+ <% end %>
<% images.each do |file| %>
<% if link_to # Redmine classic %>
<%= link_to image_tag(dmsf_thumbnail_path(file)), view_dmsf_file_path(file), :alt => file.title %>
<% else # jQuery gallery %>
- <%= image_tag(dmsf_thumbnail_path(file),
- { :'data-fullsrc' => view_dmsf_file_path(file), :alt => file.title }) %>
+ <%= image_tag(dmsf_thumbnail_path(file),
+ { :'data-fullsrc' => view_dmsf_file_path(file), :alt => file.title }) %>
<% end %>
<% end %>
-
+ <% if link_to # Redmine classic %>
+
+ <% end %>
<% end %>
<% end %>
diff --git a/app/views/dmsf_files/show.html.erb b/app/views/dmsf_files/show.html.erb
index 73c2dc14..9dd32195 100644
--- a/app/views/dmsf_files/show.html.erb
+++ b/app/views/dmsf_files/show.html.erb
@@ -81,13 +81,13 @@