Internal Error 500 when dmsf page is accessed #380
This commit is contained in:
parent
28aac0314c
commit
266676d9a9
@ -240,20 +240,15 @@ class DmsfController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def entries_email
|
||||
if (Rails::VERSION::MAJOR > 3)
|
||||
@email_params = e_params
|
||||
else
|
||||
@email_params = params[:email]
|
||||
end
|
||||
if @email_params[:to].strip.blank?
|
||||
def entries_email
|
||||
if params[:email][:to].strip.blank?
|
||||
flash.now[:error] = l(:error_email_to_must_be_entered)
|
||||
render :action => 'email_entries'
|
||||
return
|
||||
end
|
||||
DmsfMailer.send_documents(@project, User.current, @email_params).deliver
|
||||
File.delete(@email_params['zipped_content'])
|
||||
flash[:notice] = l(:notice_email_sent, @email_params['to'])
|
||||
DmsfMailer.send_documents(@project, User.current, params[:email]).deliver
|
||||
File.delete(params[:email][:zipped_content])
|
||||
flash[:notice] = l(:notice_email_sent, params[:email][:to])
|
||||
|
||||
redirect_to dmsf_folder_path(:id => @project, :folder_id => @folder)
|
||||
end
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright (C) 2011-15 Karel Pičman <karel.picman@kontron.com>
|
||||
@ -24,12 +26,9 @@ class DmsfLinksController < ApplicationController
|
||||
before_filter :find_link_project
|
||||
before_filter :authorize
|
||||
|
||||
def new
|
||||
if (Rails::VERSION::MAJOR > 3)
|
||||
@dmsf_link = DmsfLink.new(l_params)
|
||||
else
|
||||
@dmsf_link = DmsfLink.new(:project_id => params[:project_id])
|
||||
end
|
||||
def new
|
||||
@dmsf_link = DmsfLink.new
|
||||
@dmsf_link.project_id = params[:project_id]
|
||||
|
||||
if params[:dmsf_link].present?
|
||||
# Reload
|
||||
|
||||
@ -53,12 +53,8 @@ class DmsfUploadController < ApplicationController
|
||||
end
|
||||
|
||||
# async single file upload handling
|
||||
def upload_file
|
||||
if (Rails::VERSION::MAJOR > 3)
|
||||
@tempfile = params.require(:file)
|
||||
else
|
||||
@tempfile = params[:file]
|
||||
end
|
||||
def upload_file
|
||||
@tempfile = params[:file]
|
||||
unless @tempfile.original_filename
|
||||
render_404
|
||||
return
|
||||
@ -107,13 +103,8 @@ class DmsfUploadController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def commit_files
|
||||
if (Rails::VERSION::MAJOR > 3)
|
||||
commited_files = params.require(:commited_files)
|
||||
else
|
||||
commited_files = params[:commited_files]
|
||||
end
|
||||
commit_files_internal commited_files
|
||||
def commit_files
|
||||
commit_files_internal params[:commited_files]
|
||||
end
|
||||
|
||||
# REST API file commit
|
||||
|
||||
@ -95,15 +95,13 @@ class DmsfLink < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def path
|
||||
if self.target_type == DmsfFile.model_name
|
||||
file = self.target_file
|
||||
path = file.dmsf_path.map { |element| element.is_a?(DmsfFile) ? element.name : element.title }.join('/') if file
|
||||
else
|
||||
folder = self.target_folder
|
||||
path = folder.dmsf_path_str if folder
|
||||
if self.target_type == DmsfFile.model_name
|
||||
path = self.target_file.dmsf_path.map { |element| element.is_a?(DmsfFile) ? element.name : element.title }.join('/') if self.target_file
|
||||
else
|
||||
path = self.target_folder ? self.target_folder.dmsf_path_str : ''
|
||||
end
|
||||
path.insert(0, "#{self.target_project.name}:") if self.project_id != self.target_project_id && path
|
||||
if path.length > 50
|
||||
path.insert(0, "#{self.target_project.name}:") if self.project_id != self.target_project_id
|
||||
if path && path.length > 50
|
||||
return "#{path[0, 25]}...#{path[-25, 25]}"
|
||||
end
|
||||
path
|
||||
|
||||
@ -20,8 +20,8 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
%>
|
||||
|
||||
<% locked_for_user = subfolder.locked_for_user? %>
|
||||
<% locked = subfolder.locked? %>
|
||||
<% locked_for_user = subfolder && subfolder.locked_for_user? %>
|
||||
<% locked = subfolder && subfolder.locked? %>
|
||||
|
||||
<td class="check"><%= check_box_tag(name, id, false,
|
||||
:title => l(:title_check_for_zip_download_or_email)) %></td>
|
||||
@ -36,7 +36,7 @@
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="size"></td>
|
||||
<td class="modified"><%= format_time(subfolder.modified) %>
|
||||
<td class="modified"><%= format_time(subfolder.modified) if subfolder %>
|
||||
<% if locked_for_user %>
|
||||
<% if subfolder.lock.reverse[0].user %>
|
||||
<%= link_to('',
|
||||
@ -54,20 +54,24 @@
|
||||
</td>
|
||||
<td class="version"></td>
|
||||
<td class="workflow"></td>
|
||||
<td class="author"><%= h(subfolder.user) %></td>
|
||||
<td class="author"><%= h(subfolder.user) if subfolder %></td>
|
||||
<td class="actions">
|
||||
<% if @folder_manipulation_allowed %>
|
||||
<div class="right_icon_box">
|
||||
<% unless locked %>
|
||||
<%= link_to('',
|
||||
edit_dmsf_path(:id => project, :folder_id => subfolder),
|
||||
:title => l(:link_edit, :title => h(subfolder.title)),
|
||||
:title => l(:link_edit, :title => subfolder ? h(subfolder.title) : project.name),
|
||||
:class => 'icon icon-edit') %>
|
||||
<%= link_to('',
|
||||
lock_dmsf_path(:id => project, :folder_id => subfolder),
|
||||
:title => l(:title_lock_file),
|
||||
:class => 'icon icon-dmsf-lock') %>
|
||||
<% if subfolder.notification %>
|
||||
<% if subfolder %>
|
||||
<%= link_to('',
|
||||
lock_dmsf_path(:id => project, :folder_id => subfolder),
|
||||
:title => l(:title_lock_file),
|
||||
:class => 'icon icon-dmsf-lock') %>
|
||||
<% else %>
|
||||
<span class="icon"></span>
|
||||
<% 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),
|
||||
@ -106,5 +110,5 @@
|
||||
</td>
|
||||
<td class="invisible">0</td>
|
||||
<td class="invisible">0</td>
|
||||
<td class="invisible"><%= subfolder.updated_at.to_i %></td>
|
||||
<td class="invisible"><%= subfolder.updated_at.to_i if subfolder %></td>
|
||||
<td class="invisible">0</td>
|
||||
@ -1,4 +1,6 @@
|
||||
<%#=
|
||||
# encode: utf-8
|
||||
#
|
||||
# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright (C) 2011-15 Karel Pičman <karel.picman@kontron.com>
|
||||
|
||||
@ -154,7 +154,7 @@
|
||||
</tr>
|
||||
<% end %>
|
||||
<% @dir_links.each do |link| %>
|
||||
<% unless (link.target_project && link.target_folder) %>
|
||||
<% unless link.target_project %>
|
||||
<% Rails.logger.error "Error: dmsf_link id #{link.id} has no target!" %>
|
||||
<% next %>
|
||||
<% end %>
|
||||
|
||||
@ -90,7 +90,7 @@
|
||||
<i><%= l(:info_revision, :rev => revision.id) %></i>
|
||||
<%= (revision.source_revision.nil? ? l(:label_created) : l(:label_changed)).downcase %>
|
||||
<%= l(:info_changed_by_user, :changed => format_time(revision.updated_at)) %>
|
||||
<%= link_to(revision.user.name, user_path(revision.user)) %>
|
||||
<%= link_to(revision.user.name, user_path(revision.user)) if revision.user %>
|
||||
</div>
|
||||
</div>
|
||||
<div style="border: 1px solid #e4e4e4;">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user