Code revision from coding style point of view
This commit is contained in:
parent
42d29398ad
commit
f655adaaa6
@ -61,7 +61,7 @@ class DmsfFilesController < ApplicationController
|
||||
# TODO: line bellow is to handle old instalations with errors in data handling
|
||||
@revision.name = @file.name
|
||||
|
||||
@revision_pages = Paginator.new self, @file.revisions.visible.count, params["per_page"] ? params["per_page"].to_i : 25, params["page"]
|
||||
@revision_pages = Paginator.new self, @file.revisions.visible.count, params['per_page'] ? params['per_page'].to_i : 25, params['page']
|
||||
|
||||
render :layout => !request.xhr?
|
||||
end
|
||||
@ -69,12 +69,12 @@ class DmsfFilesController < ApplicationController
|
||||
#TODO: don't create revision if nothing change
|
||||
def create_revision
|
||||
unless params[:dmsf_file_revision]
|
||||
redirect_to :action => "show", :id => @file
|
||||
redirect_to :action => 'show', :id => @file
|
||||
return
|
||||
end
|
||||
if @file.locked_for_user?
|
||||
flash[:error] = l(:error_file_is_locked)
|
||||
redirect_to :action => "show", :id => @file
|
||||
redirect_to :action => 'show', :id => @file
|
||||
else
|
||||
#TODO: validate folder_id
|
||||
@revision = DmsfFileRevision.new(params[:dmsf_file_revision])
|
||||
@ -86,8 +86,7 @@ class DmsfFilesController < ApplicationController
|
||||
@revision.user = User.current
|
||||
|
||||
@revision.major_version = last_revision.major_version
|
||||
@revision.minor_version = last_revision.minor_version
|
||||
#@revision.workflow = last_revision.workflow
|
||||
@revision.minor_version = last_revision.minor_version
|
||||
version = params[:version].to_i
|
||||
file_upload = params[:file_upload]
|
||||
if file_upload.nil?
|
||||
@ -100,8 +99,7 @@ class DmsfFilesController < ApplicationController
|
||||
@revision.size = file_upload.size
|
||||
@revision.disk_filename = @revision.new_storage_filename
|
||||
@revision.mime_type = Redmine::MimeType.of(file_upload.original_filename)
|
||||
end
|
||||
#@revision.set_workflow(params[:dmsf_workflow_id], params[:commit])
|
||||
end
|
||||
|
||||
@file.name = @revision.name
|
||||
@file.folder = @revision.folder
|
||||
@ -109,14 +107,14 @@ class DmsfFilesController < ApplicationController
|
||||
if @revision.valid? && @file.valid?
|
||||
@revision.save!
|
||||
@revision.assign_workflow(params[:dmsf_workflow_id])
|
||||
unless file_upload.nil?
|
||||
if file_upload
|
||||
@revision.copy_file_content(file_upload)
|
||||
end
|
||||
|
||||
if @file.locked? && !@file.locks.empty?
|
||||
begin
|
||||
@file.unlock!
|
||||
flash[:notice] = l(:notice_file_unlocked) + ", "
|
||||
flash[:notice] = "#{l(:notice_file_unlocked)}, "
|
||||
rescue
|
||||
#Nothing to do here
|
||||
end
|
||||
@ -124,44 +122,44 @@ class DmsfFilesController < ApplicationController
|
||||
@file.save!
|
||||
@file.reload
|
||||
|
||||
flash[:notice] = (flash[:notice].nil? ? "" : flash[:notice]) + l(:notice_file_revision_created)
|
||||
log_activity("new revision")
|
||||
flash[:notice] = (flash[:notice].nil? ? '' : flash[:notice]) + l(:notice_file_revision_created)
|
||||
log_activity('new revision')
|
||||
begin
|
||||
DmsfMailer.files_updated(User.current, [@file]).deliver
|
||||
rescue ActionView::MissingTemplate => e
|
||||
Rails.logger.error "Could not send email notifications: #{e.message}"
|
||||
end
|
||||
redirect_to :action => "show", :id => @file
|
||||
redirect_to :action => 'show', :id => @file
|
||||
else
|
||||
render :action => "show"
|
||||
render :action => 'show'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def delete
|
||||
if !@file.nil?
|
||||
if @file
|
||||
if @file.delete
|
||||
flash[:notice] = l(:notice_file_deleted)
|
||||
log_activity("deleted")
|
||||
log_activity('deleted')
|
||||
DmsfMailer.files_deleted(User.current, [@file]).deliver
|
||||
else
|
||||
flash[:error] = l(:error_file_is_locked)
|
||||
end
|
||||
end
|
||||
redirect_to :controller => "dmsf", :action => "show", :id => @project, :folder_id => @file.folder
|
||||
redirect_to :controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @file.folder
|
||||
end
|
||||
|
||||
def delete_revision
|
||||
if !@revision.nil? && !@revision.deleted
|
||||
if @revision && !@revision.deleted
|
||||
if @revision.delete
|
||||
flash[:notice] = l(:notice_revision_deleted)
|
||||
log_activity("deleted")
|
||||
log_activity('deleted')
|
||||
else
|
||||
# TODO: check this error handling
|
||||
@revision.errors.each {|e,msg| flash[:error] = msg}
|
||||
end
|
||||
end
|
||||
redirect_to :action => "show", :id => @file
|
||||
redirect_to :action => 'show', :id => @file
|
||||
end
|
||||
|
||||
def lock
|
||||
@ -172,11 +170,11 @@ class DmsfFilesController < ApplicationController
|
||||
flash[:notice] = l(:notice_file_locked)
|
||||
end
|
||||
redirect_to params[:current] ? params[:current] :
|
||||
{:controller => "dmsf", :action => "show", :id => @project, :folder_id => @file.folder}
|
||||
{:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @file.folder}
|
||||
end
|
||||
|
||||
def unlock
|
||||
if !@file.locked?
|
||||
unless @file.locked?
|
||||
flash[:warning] = l(:warning_file_not_locked)
|
||||
else
|
||||
if @file.locks[0].user == User.current || User.current.allowed_to?(:force_file_unlock, @file.project)
|
||||
@ -187,7 +185,7 @@ class DmsfFilesController < ApplicationController
|
||||
end
|
||||
end
|
||||
redirect_to params[:current] ? params[:current] :
|
||||
{:controller => "dmsf", :action => "show", :id => @project, :folder_id => @file.folder}
|
||||
{:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @file.folder}
|
||||
end
|
||||
|
||||
def notify_activate
|
||||
@ -198,18 +196,18 @@ class DmsfFilesController < ApplicationController
|
||||
flash[:notice] = l(:notice_file_notifications_activated)
|
||||
end
|
||||
redirect_to params[:current] ? params[:current] :
|
||||
{:controller => "dmsf", :action => "show", :id => @project, :folder_id => @file.folder}
|
||||
{:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @file.folder}
|
||||
end
|
||||
|
||||
def notify_deactivate
|
||||
if !@file.notification
|
||||
unless @file.notification
|
||||
flash[:warning] = l(:warning_file_notifications_already_deactivated)
|
||||
else
|
||||
@file.notify_deactivate
|
||||
flash[:notice] = l(:notice_file_notifications_deactivated)
|
||||
end
|
||||
redirect_to params[:current] ? params[:current] :
|
||||
{:controller => "dmsf", :action => "show", :id => @project, :folder_id => @file.folder}
|
||||
{:controller => 'dmsf', :action => 'show', :id => @project, :folder_id => @file.folder}
|
||||
end
|
||||
|
||||
private
|
||||
@ -219,14 +217,14 @@ class DmsfFilesController < ApplicationController
|
||||
end
|
||||
|
||||
def send_revision
|
||||
log_activity("downloaded")
|
||||
log_activity('downloaded')
|
||||
access = DmsfFileRevisionAccess.new(:user_id => User.current.id, :dmsf_file_revision_id => @revision.id,
|
||||
:action => DmsfFileRevisionAccess::DownloadAction)
|
||||
access.save!
|
||||
send_file(@revision.disk_file,
|
||||
:filename => filename_for_content_disposition(@revision.name),
|
||||
:type => @revision.detect_content_type,
|
||||
:disposition => "attachment")
|
||||
:disposition => 'attachment')
|
||||
end
|
||||
|
||||
def find_file
|
||||
@ -242,7 +240,7 @@ class DmsfFilesController < ApplicationController
|
||||
end
|
||||
|
||||
def check_project(entry)
|
||||
if !entry.nil? && entry.project != @project
|
||||
if entry && entry.project != @project
|
||||
raise DmsfAccessError, l(:error_entry_project_does_not_match_current_project)
|
||||
end
|
||||
end
|
||||
|
||||
@ -52,30 +52,30 @@ class DmsfFilesCopyController < ApplicationController
|
||||
raise DmsfAccessError, l(:error_entry_project_does_not_match_current_project)
|
||||
end
|
||||
|
||||
if (!@target_folder.nil? && @target_folder == @file.folder) ||
|
||||
if (@target_folder && @target_folder == @file.folder) ||
|
||||
(@target_folder.nil? && @file.folder.nil? && @target_project == @file.project)
|
||||
flash[:error] = l(:error_target_folder_same)
|
||||
redirect_to :action => "new", :id => @file, :target_project_id => @target_project, :target_folder_id => @target_folder
|
||||
redirect_to :action => 'new', :id => @file, :target_project_id => @target_project, :target_folder_id => @target_folder
|
||||
return
|
||||
end
|
||||
|
||||
new_file = @file.copy_to(@target_project, @target_folder)
|
||||
|
||||
unless new_file.errors.empty?
|
||||
flash[:error] = "#{l(:error_file_cannot_be_copied)}: #{new_file.errors.full_messages.join(", ")}"
|
||||
redirect_to :action => "new", :id => @file, :target_project_id => @target_project, :target_folder_id => @target_folder
|
||||
flash[:error] = "#{l(:error_file_cannot_be_copied)}: #{new_file.errors.full_messages.join(', ')}"
|
||||
redirect_to :action => 'new', :id => @file, :target_project_id => @target_project, :target_folder_id => @target_folder
|
||||
return
|
||||
end
|
||||
|
||||
flash[:notice] = l(:notice_file_copied)
|
||||
log_activity(new_file, "was copied (is copy)")
|
||||
log_activity(new_file, 'was copied (is copy)')
|
||||
begin
|
||||
DmsfMailer.files_updated(User.current, [new_file]).deliver
|
||||
rescue ActionView::MissingTemplate => e
|
||||
Rails.logger.error "Could not send email notifications: #{e.message}"
|
||||
end
|
||||
|
||||
redirect_to :controller => "dmsf_files", :action => "show", :id => new_file
|
||||
redirect_to :controller => 'dmsf_files', :action => 'show', :id => new_file
|
||||
end
|
||||
|
||||
def move
|
||||
@ -85,27 +85,27 @@ class DmsfFilesCopyController < ApplicationController
|
||||
return
|
||||
end
|
||||
@target_folder = DmsfFolder.visible.find(params[:target_folder_id]) unless params[:target_folder_id].blank?
|
||||
if !@target_folder.nil? && @target_folder.project != @target_project
|
||||
if @target_folder && @target_folder.project != @target_project
|
||||
raise DmsfAccessError, l(:error_entry_project_does_not_match_current_project)
|
||||
end
|
||||
|
||||
if (!@target_folder.nil? && @target_folder == @file.folder) ||
|
||||
if (@target_folder && @target_folder == @file.folder) ||
|
||||
(@target_folder.nil? && @file.folder.nil? && @target_project == @file.project)
|
||||
flash[:error] = l(:error_target_folder_same)
|
||||
redirect_to :action => "new", :id => @file, :target_project_id => @target_project, :target_folder_id => @target_folder
|
||||
redirect_to :action => 'new', :id => @file, :target_project_id => @target_project, :target_folder_id => @target_folder
|
||||
return
|
||||
end
|
||||
|
||||
unless @file.move_to(@target_project, @target_folder)
|
||||
flash[:error] = "#{l(:error_file_cannot_be_moved)}: #{@file.errors.full_messages.join(", ")}"
|
||||
redirect_to :action => "new", :id => @file, :target_project_id => @target_project, :target_folder_id => @target_folder
|
||||
flash[:error] = "#{l(:error_file_cannot_be_moved)}: #{@file.errors.full_messages.join(', ')}"
|
||||
redirect_to :action => 'new', :id => @file, :target_project_id => @target_project, :target_folder_id => @target_folder
|
||||
return
|
||||
end
|
||||
|
||||
@file.reload
|
||||
|
||||
flash[:notice] = l(:notice_file_moved)
|
||||
log_activity(@file, "was moved (is copy)")
|
||||
log_activity(@file, 'was moved (is copy)')
|
||||
begin
|
||||
# TODO: implement proper mail notification
|
||||
DmsfMailer.files_updated(User.current, [@file]).deliver
|
||||
@ -113,7 +113,7 @@ class DmsfFilesCopyController < ApplicationController
|
||||
Rails.logger.error "Could not send email notifications: #{e.message}"
|
||||
end
|
||||
|
||||
redirect_to :controller => "dmsf_files", :action => "show", :id => @file
|
||||
redirect_to :controller => 'dmsf_files', :action => 'show', :id => @file
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@ -24,8 +24,6 @@ class DmsfFoldersCopyController < ApplicationController
|
||||
before_filter :find_folder
|
||||
before_filter :authorize
|
||||
|
||||
# verify :method => :post, :only => [:copy_to], :render => { :nothing => true, :status => :method_not_allowed }
|
||||
|
||||
def new
|
||||
@target_project = DmsfFolder.allowed_target_projects_on_copy.detect {|p| p.id.to_s == params[:target_project_id]} if params[:target_project_id]
|
||||
@target_project ||= @project if User.current.allowed_to?(:folder_manipulation, @project)
|
||||
@ -52,25 +50,25 @@ class DmsfFoldersCopyController < ApplicationController
|
||||
raise DmsfAccessError, l(:error_entry_project_does_not_match_current_project)
|
||||
end
|
||||
|
||||
if (!@target_folder.nil? && @target_folder == @folder.folder) ||
|
||||
if (@target_folder && @target_folder == @folder.folder) ||
|
||||
(@target_folder.nil? && @folder.folder.nil? && @target_project == @folder.project)
|
||||
flash[:error] = l(:error_target_folder_same)
|
||||
redirect_to :action => "new", :id => @folder, :target_project_id => @target_project, :target_folder_id => @target_folder
|
||||
redirect_to :action => 'new', :id => @folder, :target_project_id => @target_project, :target_folder_id => @target_folder
|
||||
return
|
||||
end
|
||||
|
||||
new_folder = @folder.copy_to(@target_project, @target_folder)
|
||||
|
||||
unless new_folder.errors.empty?
|
||||
flash[:error] = "#{l(:error_folder_cannot_be_copied)}: #{new_folder.errors.full_messages.join(", ")}"
|
||||
redirect_to :action => "new", :id => @folder, :target_project_id => @target_project, :target_folder_id => @target_folder
|
||||
flash[:error] = "#{l(:error_folder_cannot_be_copied)}: #{new_folder.errors.full_messages.join(', ')}"
|
||||
redirect_to :action => 'new', :id => @folder, :target_project_id => @target_project, :target_folder_id => @target_folder
|
||||
return
|
||||
end
|
||||
|
||||
new_folder.reload
|
||||
|
||||
flash[:notice] = l(:notice_folder_copied)
|
||||
log_activity(new_folder, "was copied (is copy)")
|
||||
log_activity(new_folder, 'was copied (is copy)')
|
||||
|
||||
#TODO: implement proper notification for all new files
|
||||
#begin
|
||||
@ -79,7 +77,7 @@ class DmsfFoldersCopyController < ApplicationController
|
||||
# Rails.logger.error "Could not send email notifications: " + e
|
||||
#end
|
||||
|
||||
redirect_to :controller => "dmsf", :action => "show", :id => @target_project, :folder_id => new_folder
|
||||
redirect_to :controller => 'dmsf', :action => 'show', :id => @target_project, :folder_id => new_folder
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@ -35,7 +35,7 @@ class DmsfStateController < ApplicationController
|
||||
else
|
||||
flash[:warning] = l(:user_is_not_project_member)
|
||||
end
|
||||
redirect_to :controller => "projects", :action => 'settings', :tab => 'dmsf', :id => @project
|
||||
redirect_to :controller => 'projects', :action => 'settings', :tab => 'dmsf', :id => @project
|
||||
end
|
||||
|
||||
private
|
||||
@ -45,7 +45,7 @@ class DmsfStateController < ApplicationController
|
||||
end
|
||||
|
||||
def check_project(entry)
|
||||
if !entry.nil? && entry.project != @project
|
||||
if entry && entry.project != @project
|
||||
raise DmsfAccessError, l(:error_entry_project_does_not_match_current_project)
|
||||
end
|
||||
end
|
||||
|
||||
@ -55,7 +55,7 @@ class DmsfUploadController < ApplicationController
|
||||
return
|
||||
end
|
||||
@disk_filename = DmsfHelper.temp_filename(@tempfile.original_filename)
|
||||
File.open("#{DmsfHelper.temp_dir}/#{@disk_filename}", "wb") do |f|
|
||||
File.open("#{DmsfHelper.temp_dir}/#{@disk_filename}", 'wb') do |f|
|
||||
while (buffer = @tempfile.read(8192))
|
||||
f.write(buffer)
|
||||
end
|
||||
@ -65,7 +65,7 @@ class DmsfUploadController < ApplicationController
|
||||
File.delete("#{DmsfHelper.temp_dir}/#{@disk_filename}")
|
||||
rescue
|
||||
end
|
||||
render :layout => nil, :json => { :jsonrpc => "2.0",
|
||||
render :layout => nil, :json => { :jsonrpc => '2.0',
|
||||
:error => {
|
||||
:code => 103,
|
||||
:message => l(:header_minimum_filesize),
|
||||
|
||||
@ -16,8 +16,8 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
require "tmpdir"
|
||||
require "digest/md5"
|
||||
require 'tmpdir'
|
||||
require 'digest/md5'
|
||||
|
||||
module DmsfHelper
|
||||
|
||||
@ -72,7 +72,7 @@ module DmsfHelper
|
||||
# Why can't Mysql::Time conform to time object? - without a utc? method it breaks redmine's
|
||||
# rendering method, so we convert it to string, and back into time - not the most efficient
|
||||
# of methods - however seems functional. Not sure if MySQL
|
||||
return obj.to_s.to_time(ActiveRecord::Base.default_timezone) if obj.class.name == "Mysql::Time"
|
||||
return obj.to_s.to_time(ActiveRecord::Base.default_timezone) if obj.class.name == 'Mysql::Time'
|
||||
return obj
|
||||
end
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
class DmsfFileRevisionAccess < ActiveRecord::Base
|
||||
unloadable
|
||||
belongs_to :revision, :class_name => "DmsfFileRevision", :foreign_key => "dmsf_file_revision_id"
|
||||
belongs_to :revision, :class_name => 'DmsfFileRevision', :foreign_key => 'dmsf_file_revision_id'
|
||||
belongs_to :user
|
||||
|
||||
DownloadAction = 0
|
||||
|
||||
@ -19,8 +19,8 @@
|
||||
|
||||
class DmsfLock < ActiveRecord::Base
|
||||
before_create :generate_uuid
|
||||
belongs_to :file, :class_name => "DmsfFile", :foreign_key => "entity_id"
|
||||
belongs_to :folder, :class_name => "DmsfFolder", :foreign_key => "entity_id"
|
||||
belongs_to :file, :class_name => 'DmsfFile', :foreign_key => 'entity_id'
|
||||
belongs_to :folder, :class_name => 'DmsfFolder', :foreign_key => 'entity_id'
|
||||
belongs_to :user
|
||||
|
||||
#At the moment apparently we're only supporting a write lock?
|
||||
@ -68,6 +68,5 @@ class DmsfLock < ActiveRecord::Base
|
||||
def self.find_by_param(*args)
|
||||
self.find(*args)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
require "mailer"
|
||||
require 'mailer'
|
||||
|
||||
class DmsfMailer < Mailer
|
||||
|
||||
@ -31,29 +31,29 @@ class DmsfMailer < Mailer
|
||||
@project = project
|
||||
|
||||
mail :to => get_notify_user_emails(user, files),
|
||||
:subject => project.name + ": Dmsf files updated"
|
||||
:subject => "#{project.name}: Dmsf files updated"
|
||||
end
|
||||
|
||||
def files_deleted(user, files)
|
||||
project = files[0].project
|
||||
files = files.select { |file| file.notify? }
|
||||
|
||||
redmine_headers "Project" => project.identifier
|
||||
redmine_headers 'Project' => project.identifier
|
||||
|
||||
@user = user
|
||||
@files = files
|
||||
@project = project
|
||||
|
||||
mail :to => get_notify_user_emails(user, files),
|
||||
:subject => project.name + ": Dmsf files deleted"
|
||||
:subject => "#{project.name}: Dmsf files deleted"
|
||||
end
|
||||
|
||||
def send_documents(user, email_to, email_cc, email_subject, zipped_content, email_plain_body)
|
||||
zipped_content_data = open(zipped_content, "rb") {|io| io.read }
|
||||
zipped_content_data = open(zipped_content, 'rb') {|io| io.read }
|
||||
|
||||
@body = email_plain_body
|
||||
|
||||
attachments['Documents.zip'] = {:content_type => "application/zip", :content => zipped_content_data}
|
||||
attachments['Documents.zip'] = {:content_type => 'application/zip', :content => zipped_content_data}
|
||||
mail(:to => email_to, :cc => email_cc, :subject => email_subject, :from => user.mail)
|
||||
end
|
||||
|
||||
|
||||
@ -18,142 +18,140 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%>
|
||||
|
||||
<div class="box">
|
||||
<%= form_tag({:controller => "dmsf_upload", :action => "upload_files", :id => @project, :folder_id => @folder},
|
||||
:id => "uploadform", :method=>:post, :multipart => true) do %>
|
||||
<% if Setting.attachment_max_size.to_i >= 102400 %>
|
||||
<div class="upload_select">
|
||||
<%= l(:label_file_size) %>: <select id="uploader_select"><option value="1">< 100 MB</option><option value="2">> 100 MB</option></select>
|
||||
</div>
|
||||
<% end %>
|
||||
<h3><%= l(:heading_file_upload) %></h3>
|
||||
<div style="padding-bottom: 6px; line-height: 1.4em; font-size: 0.9em;">
|
||||
<span>
|
||||
<% max_file_upload = Setting.plugin_redmine_dmsf["dmsf_max_file_upload"].to_i %>
|
||||
<%= l(:note_uploaded_maximum_files_at_once, :number => max_file_upload) if max_file_upload > 0 %>
|
||||
<%= l(:note_upload_files_greater_than_two_gb) if Setting.attachment_max_size.to_i >= 2097151 %>
|
||||
</span>
|
||||
</div>
|
||||
<div id="uploader">
|
||||
<p>
|
||||
<span id="uploaded_files_fields">
|
||||
<%= file_field_tag("uploaded_files[1]", :size => 30, :id => nil) %>
|
||||
</span>
|
||||
<br />
|
||||
<small><%= link_to(l(:label_add_another_file), "#", :onclick => "dmsfAddFileField(); return false;" ) %>
|
||||
(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
|
||||
</small>
|
||||
</p>
|
||||
<%= submit_tag(l(:submit_upload_files)) %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= form_tag({:controller => 'dmsf_upload', :action => 'upload_files', :id => @project, :folder_id => @folder},
|
||||
:id => 'uploadform', :method=>:post, :multipart => true) do %>
|
||||
<% if Setting.attachment_max_size.to_i >= 102400 %>
|
||||
<div class="upload_select">
|
||||
<%= l(:label_file_size) %>: <select id="uploader_select"><option value="1">< 100 MB</option><option value="2">> 100 MB</option></select>
|
||||
</div>
|
||||
<% end %>
|
||||
<h3><%= l(:heading_file_upload) %></h3>
|
||||
<div style="padding-bottom: 6px; line-height: 1.4em; font-size: 0.9em;">
|
||||
<span>
|
||||
<% max_file_upload = Setting.plugin_redmine_dmsf['dmsf_max_file_upload'].to_i %>
|
||||
<%= l(:note_uploaded_maximum_files_at_once, :number => max_file_upload) if max_file_upload > 0 %>
|
||||
<%= l(:note_upload_files_greater_than_two_gb) if Setting.attachment_max_size.to_i >= 2097151 %>
|
||||
</span>
|
||||
</div>
|
||||
<div id="uploader">
|
||||
<p>
|
||||
<span id="uploaded_files_fields">
|
||||
<%= file_field_tag('uploaded_files[1]', :size => 30, :id => nil) %>
|
||||
</span>
|
||||
<br />
|
||||
<small><%= link_to(l(:label_add_another_file), '#', :onclick => 'dmsfAddFileField(); return false;' ) %>
|
||||
(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
|
||||
</small>
|
||||
</p>
|
||||
<%= submit_tag(l(:submit_upload_files)) %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var originalUploaderContent;
|
||||
|
||||
var uploader = jQuery('#uploader');
|
||||
|
||||
originalUploaderContent = uploader.html();
|
||||
|
||||
jQuery('#uploader_select').change(function() {
|
||||
if(jQuery(this).val() == 2) {
|
||||
uploader.html(originalUploaderContent);
|
||||
} else {
|
||||
initPlUploader(uploader);
|
||||
}
|
||||
});
|
||||
|
||||
initPlUploader(uploader);
|
||||
|
||||
var dmsfFileFieldCount = 1;
|
||||
var originalUploaderContent;
|
||||
var uploader = jQuery('#uploader');
|
||||
|
||||
function dmsfAddFileField() {
|
||||
if (dmsfFileFieldCount >= 10) return false
|
||||
dmsfFileFieldCount++;
|
||||
originalUploaderContent = uploader.html();
|
||||
|
||||
var f = document.createElement("input");
|
||||
f.type = "file";
|
||||
f.name = "uploaded_files[" + dmsfFileFieldCount + "]";
|
||||
f.size = 30;
|
||||
|
||||
var p = document.getElementById("uploaded_files_fields");
|
||||
p.appendChild(document.createElement("br"));
|
||||
p.appendChild(f);
|
||||
}
|
||||
jQuery('#uploader_select').change(function() {
|
||||
if(jQuery(this).val() === 2) {
|
||||
uploader.html(originalUploaderContent);
|
||||
} else {
|
||||
initPlUploader(uploader);
|
||||
}
|
||||
});
|
||||
|
||||
initPlUploader(uploader);
|
||||
|
||||
var dmsfFileFieldCount = 1;
|
||||
|
||||
function dmsfAddFileField() {
|
||||
if (dmsfFileFieldCount >= 10) return false;
|
||||
dmsfFileFieldCount++;
|
||||
|
||||
var f = document.createElement('input');
|
||||
f.type = 'file';
|
||||
f.name = 'uploaded_files[' + dmsfFileFieldCount + ']';
|
||||
f.size = 30;
|
||||
|
||||
var p = document.getElementById('uploaded_files_fields');
|
||||
p.appendChild(document.createElement('br'));
|
||||
p.appendChild(f);
|
||||
}
|
||||
</script>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= javascript_include_tag "bowser.min.js", :plugin => "redmine_dmsf" %>
|
||||
<%= javascript_include_tag "plupload/plupload.js", :plugin => "redmine_dmsf" %>
|
||||
<%= javascript_include_tag "plupload/plupload.flash.js", :plugin => "redmine_dmsf" %>
|
||||
<%= javascript_include_tag "plupload/plupload.html5.js", :plugin => "redmine_dmsf" %>
|
||||
<%= javascript_include_tag "plupload/plupload.html4.js", :plugin => "redmine_dmsf" %>
|
||||
<%= javascript_include_tag "plupload/jquery.ui.plupload/jquery.ui.plupload.js", :plugin => "redmine_dmsf" %>
|
||||
<%= javascript_include_tag("plupload/i18n/#{I18n.locale.to_s.downcase}.js", :plugin => "redmine_dmsf") if I18n.locale && !I18n.locale.to_s.match(/^en.*/) %>
|
||||
|
||||
<script type="text/javascript">
|
||||
function initPlUploader(uploader) {
|
||||
uploader.html("<div></div>");
|
||||
uploader = jQuery("div",uploader);
|
||||
uploader.plupload({
|
||||
runtimes : 'html5,flash,html4',
|
||||
url : '<%= url_for({:controller => "dmsf_upload", :action => "upload_file", :id => @project}) %>',
|
||||
max_file_size : "100mb",
|
||||
max_file_count: '<%= Setting.plugin_redmine_dmsf["dmsf_max_file_upload"].to_i if Setting.plugin_redmine_dmsf["dmsf_max_file_upload"].to_i > 0 %>',
|
||||
multipart: true,
|
||||
multipart_params : {authenticity_token : jQuery("input[name=authenticity_token]").val()},
|
||||
|
||||
// Rename files by clicking on their titles
|
||||
rename: true,
|
||||
|
||||
// Flash settings
|
||||
flash_swf_url : '<%= plugin_asset_path(:redmine_dmsf, "javascripts", "plupload/plupload.flash.swf") %>'
|
||||
});
|
||||
jQuery(".plupload_scroll",uploader).resizable({
|
||||
handles: "s"
|
||||
});
|
||||
var pluploader = uploader.plupload('getUploader');
|
||||
|
||||
pluploader.bind('FileUploaded', function(pluploader, file, response) {
|
||||
var responseObject = jQuery.parseJSON(response.response);
|
||||
if (responseObject == null) { //Bug: on Firefox folders entries act unexpectedly.
|
||||
file.status = plupload.FAILED;
|
||||
pluploader.trigger('UploadProgress', file);
|
||||
pluploader.trigger('QueueChanged');
|
||||
} else {
|
||||
if (responseObject.error == null) {
|
||||
var disk_filename_input = jQuery("<input/>").attr("type","hidden")
|
||||
.attr("name","uploaded[" + dmsfFileFieldCount + "][disk_filename]")
|
||||
.val(responseObject.disk_filename);
|
||||
uploader.append(disk_filename_input);
|
||||
var content_type_input = jQuery("<input/>").attr("type","hidden")
|
||||
.attr("name","uploaded[" + dmsfFileFieldCount + "][content_type]")
|
||||
.val(responseObject.content_type);
|
||||
uploader.append(content_type_input);
|
||||
var original_filename_input = jQuery("<input/>").attr("type","hidden")
|
||||
.attr("name","uploaded[" + dmsfFileFieldCount + "][original_filename]")
|
||||
.val(responseObject.original_filename);
|
||||
uploader.append(original_filename_input);
|
||||
} else {
|
||||
file.status = plupload.FAILED;
|
||||
// responseObject.error.file = file;
|
||||
// pluploader.trigger('Error', responseObject.error);
|
||||
pluploader.trigger('UploadProgress', file);
|
||||
pluploader.trigger('QueueChanged');
|
||||
/*
|
||||
To-do: Though this is the documented method of reporting an error, on chrome this seems
|
||||
to result in a bug, where the file afterwards seems to be out of sync and fired at the same
|
||||
time as another, however this will only process one return from this. If I notify of a file fault, but don't
|
||||
trigger a message, all seems to work as indtended.
|
||||
*/
|
||||
}
|
||||
}
|
||||
if(pluploader.total.uploaded == pluploader.files.length) jQuery('#uploadform').submit();
|
||||
else if(pluploader.total.uploaded + pluploader.total.failed == pluploader.files.length) setTimeout(function() {jQuery('#uploadform').submit();}, 2000)
|
||||
else dmsfFileFieldCount++;
|
||||
return true;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<% end %>
|
||||
<%= javascript_include_tag 'bowser.min.js', :plugin => 'redmine_dmsf' %>
|
||||
<%= javascript_include_tag 'plupload/plupload.js', :plugin => 'redmine_dmsf' %>
|
||||
<%= javascript_include_tag 'plupload/plupload.flash.js', :plugin => 'redmine_dmsf' %>
|
||||
<%= javascript_include_tag 'plupload/plupload.html5.js', :plugin => 'redmine_dmsf' %>
|
||||
<%= javascript_include_tag 'plupload/plupload.html4.js', :plugin => 'redmine_dmsf' %>
|
||||
<%= javascript_include_tag 'plupload/jquery.ui.plupload/jquery.ui.plupload.js', :plugin => 'redmine_dmsf' %>
|
||||
<%= javascript_include_tag('plupload/i18n/#{I18n.locale.to_s.downcase}.js', :plugin => 'redmine_dmsf') if I18n.locale && !I18n.locale.to_s.match(/^en.*/) %>
|
||||
|
||||
<script type="text/javascript">
|
||||
function initPlUploader(uploader) {
|
||||
uploader.html('<div></div>');
|
||||
uploader = jQuery('div', uploader);
|
||||
uploader.plupload({
|
||||
runtimes : 'html5,flash,html4',
|
||||
url : '<%= url_for({:controller => 'dmsf_upload', :action => 'upload_file', :id => @project}) %>',
|
||||
max_file_size : '100mb',
|
||||
max_file_count: '<%= Setting.plugin_redmine_dmsf['dmsf_max_file_upload'].to_i if Setting.plugin_redmine_dmsf['dmsf_max_file_upload'].to_i > 0 %>',
|
||||
multipart: true,
|
||||
multipart_params : {authenticity_token : jQuery('input[name=authenticity_token]').val()},
|
||||
|
||||
// Rename files by clicking on their titles
|
||||
rename: true,
|
||||
|
||||
// Flash settings
|
||||
flash_swf_url : '<%= plugin_asset_path(:redmine_dmsf, 'javascripts', 'plupload/plupload.flash.swf') %>'
|
||||
});
|
||||
jQuery('.plupload_scroll',uploader).resizable({
|
||||
handles: 's'
|
||||
});
|
||||
var pluploader = uploader.plupload('getUploader');
|
||||
|
||||
pluploader.bind('FileUploaded', function(pluploader, file, response) {
|
||||
var responseObject = jQuery.parseJSON(response.response);
|
||||
if (responseObject == null) { //Bug: on Firefox folders entries act unexpectedly.
|
||||
file.status = plupload.FAILED;
|
||||
pluploader.trigger('UploadProgress', file);
|
||||
pluploader.trigger('QueueChanged');
|
||||
} else {
|
||||
if (responseObject.error == null) {
|
||||
var disk_filename_input = jQuery('<input/>').attr('type', 'hidden')
|
||||
.attr('name', 'uploaded[' + dmsfFileFieldCount + '][disk_filename]')
|
||||
.val(responseObject.disk_filename);
|
||||
uploader.append(disk_filename_input);
|
||||
var content_type_input = jQuery('<input/>').attr('type', 'hidden')
|
||||
.attr('name', 'uploaded[' + dmsfFileFieldCount + '][content_type]')
|
||||
.val(responseObject.content_type);
|
||||
uploader.append(content_type_input);
|
||||
var original_filename_input = jQuery('<input/>').attr('type', 'hidden')
|
||||
.attr('name', 'uploaded[' + dmsfFileFieldCount + '][original_filename]')
|
||||
.val(responseObject.original_filename);
|
||||
uploader.append(original_filename_input);
|
||||
} else {
|
||||
file.status = plupload.FAILED;
|
||||
// responseObject.error.file = file;
|
||||
// pluploader.trigger('Error', responseObject.error);
|
||||
pluploader.trigger('UploadProgress', file);
|
||||
pluploader.trigger('QueueChanged');
|
||||
/*
|
||||
To-do: Though this is the documented method of reporting an error, on chrome this seems
|
||||
to result in a bug, where the file afterwards seems to be out of sync and fired at the same
|
||||
time as another, however this will only process one return from this. If I notify of a file fault, but don't
|
||||
trigger a message, all seems to work as indtended.
|
||||
*/
|
||||
}
|
||||
}
|
||||
if(pluploader.total.uploaded === pluploader.files.length) jQuery('#uploadform').submit();
|
||||
else if(pluploader.total.uploaded + pluploader.total.failed === pluploader.files.length) setTimeout(function() {jQuery('#uploadform').submit();}, 2000);
|
||||
else dmsfFileFieldCount++;
|
||||
return true;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<% end %>
|
||||
@ -20,12 +20,12 @@
|
||||
<% html_title(l(:dmsf)) %>
|
||||
|
||||
<div class="contextual">
|
||||
<%= link_to(image_tag("copy.png"), {:controller => :dmsf_folders_copy, :action => "new", :id => @folder }, :title => l(:title_copy)) unless @folder.id.nil? %>
|
||||
<%= link_to(image_tag('copy.png'),
|
||||
{:controller => :dmsf_folders_copy, :action => 'new', :id => @folder },
|
||||
:title => l(:title_copy)) if @folder.id %>
|
||||
</div>
|
||||
|
||||
<%
|
||||
create = @pathfolder == @parent
|
||||
%>
|
||||
<% create = @pathfolder == @parent %>
|
||||
|
||||
<h2>
|
||||
<% path = @pathfolder ? @pathfolder.dmsf_path : [] %>
|
||||
@ -37,43 +37,43 @@
|
||||
<%= "/ #{l(:heading_new_folder)}" if create %>
|
||||
</h2>
|
||||
|
||||
<%= form_for(@folder, :url => {:action => create ? "create" : "save", :id => @project, :folder_id => @folder, :parent_id => @parent},
|
||||
:html => {:method=>:post}) do |f| %>
|
||||
<%= error_messages_for(@folder) %>
|
||||
<div class="box dmsf_detail">
|
||||
<div class="clear">
|
||||
<div class="splitcontentleft">
|
||||
<p>
|
||||
<%= label_tag("dmsf_folder_title", l(:label_title) + ":") %>
|
||||
<%= f.text_field(:title, :size => "32", :required => true) %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="splitcontentright">
|
||||
<p>
|
||||
<%= label_tag("", l(:field_folder) + ":") %>
|
||||
<%= f.select(:dmsf_folder_id,
|
||||
options_for_select(DmsfFolder.directory_tree(@project, @folder),
|
||||
:selected => @parent? @parent.id : (@pathfolder.id if @pathfolder)))
|
||||
%>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<p class="no-ident">
|
||||
<%= label_tag("dmsf_folder_description", l(:label_description) + ":") %>
|
||||
</p>
|
||||
<div class="wiki data clear">
|
||||
<%= f.text_area(:description, :rows => 15, :class => "wiki-edit") %>
|
||||
</div>
|
||||
<% values = @folder ? @folder.custom_field_values : @parent ? @parent.custom_field_values : DmsfFolder.new(:project => @project).custom_field_values %>
|
||||
<% values.each do |value| %>
|
||||
<p><%= custom_field_tag_with_label(:dmsf_folder, value) %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= submit_tag(create ? l(:submit_create) : l(:submit_save)) %>
|
||||
<%= form_for(@folder, :url => {:action => create ? 'create' : 'save', :id => @project, :folder_id => @folder, :parent_id => @parent},
|
||||
:html => {:method=>:post}) do |f| %>
|
||||
<%= error_messages_for(@folder) %>
|
||||
<div class="box dmsf_detail">
|
||||
<div class="clear">
|
||||
<div class="splitcontentleft">
|
||||
<p>
|
||||
<%= label_tag('dmsf_folder_title', "#{l(:label_title)}:") %>
|
||||
<%= f.text_field(:title, :size => '32', :required => true) %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="splitcontentright">
|
||||
<p>
|
||||
<%= label_tag('', "#{l(:field_folder)}:") %>
|
||||
<%= f.select(:dmsf_folder_id,
|
||||
options_for_select(DmsfFolder.directory_tree(@project, @folder),
|
||||
:selected => @parent? @parent.id : (@pathfolder.id if @pathfolder)))
|
||||
%>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<p class="no-ident">
|
||||
<%= label_tag('dmsf_folder_description', "#{l(:label_description)}:") %>
|
||||
</p>
|
||||
<div class="wiki data clear">
|
||||
<%= f.text_area(:description, :rows => 15, :class => 'wiki-edit') %>
|
||||
</div>
|
||||
<% values = @folder ? @folder.custom_field_values : @parent ? @parent.custom_field_values : DmsfFolder.new(:project => @project).custom_field_values %>
|
||||
<% values.each do |value| %>
|
||||
<p><%= custom_field_tag_with_label(:dmsf_folder, value) %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= submit_tag(create ? l(:submit_create) : l(:submit_save)) %>
|
||||
<% end %>
|
||||
|
||||
<%= wikitoolbar_for "dmsf_folder_description" %>
|
||||
<%= wikitoolbar_for 'dmsf_folder_description' %>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag "dmsf", :plugin => "redmine_dmsf" %>
|
||||
<%= stylesheet_link_tag 'dmsf', :plugin => 'redmine_dmsf' %>
|
||||
<% end %>
|
||||
|
||||
@ -33,34 +33,34 @@
|
||||
|
||||
<h3><%= l(:heading_send_documents_by_email) %></h3>
|
||||
|
||||
<%= form_tag({:action => "entries_email", :id => @project, :folder_id => @folder},
|
||||
{ :method=>:post, :class => "tabular"}) do %>
|
||||
<div class="box">
|
||||
<p>
|
||||
<%= label_tag("", l(:label_email_from) + ":") %>
|
||||
<%= h(User.current.mail) %>
|
||||
</p>
|
||||
<p>
|
||||
<%= label_tag("email[to]", l(:label_email_to) + ":") %>
|
||||
<%= text_field_tag("email[to]", @email_params["to"], :style => "width: 90%;") %>
|
||||
</p>
|
||||
<p>
|
||||
<%= label_tag("email[cc]", l(:label_email_cc) + ":") %>
|
||||
<%= text_field_tag("email[cc]", @email_params["cc"], :style => "width: 90%;") %>
|
||||
</p>
|
||||
<p>
|
||||
<%= label_tag("email[subject]", l(:label_email_subject) + ":") %>
|
||||
<%= text_field_tag("email[subject]", @email_params["subject"], :style => "width: 90%;") %>
|
||||
</p>
|
||||
<p>
|
||||
<%= label_tag("", l(:label_email_documents) + ":") %>
|
||||
<strong>Documents.zip</strong>
|
||||
<%= hidden_field_tag("email[zipped_content]", @email_params["zipped_content"]) %>
|
||||
</p>
|
||||
<p>
|
||||
<%= label_tag("email[body]", l(:label_email_body) + ":") %>
|
||||
<%= text_area_tag("email[body]", @email_params["body"], :rows=> "20", :style => "width: 90%;") %>
|
||||
</p>
|
||||
<p><%= submit_tag(l(:label_email_send)) %></p>
|
||||
</div>
|
||||
<%= form_tag({:action => 'entries_email', :id => @project, :folder_id => @folder},
|
||||
{ :method=>:post, :class => 'tabular'}) do %>
|
||||
<div class="box">
|
||||
<p>
|
||||
<%= label_tag('', "#{l(:label_email_from)}:") %>
|
||||
<%= h(User.current.mail) %>
|
||||
</p>
|
||||
<p>
|
||||
<%= label_tag('email[to]', "#{l(:label_email_to)}:") %>
|
||||
<%= text_field_tag('email[to]', @email_params['to'], :style => 'width: 90%;') %>
|
||||
</p>
|
||||
<p>
|
||||
<%= label_tag('email[cc]', "#{l(:label_email_cc)}:") %>
|
||||
<%= text_field_tag('email[cc]', @email_params['cc'], :style => 'width: 90%;') %>
|
||||
</p>
|
||||
<p>
|
||||
<%= label_tag('email[subject]', "#{l(:label_email_subject)}:") %>
|
||||
<%= text_field_tag('email[subject]', @email_params['subject'], :style => 'width: 90%;') %>
|
||||
</p>
|
||||
<p>
|
||||
<%= label_tag('', "#{l(:label_email_documents)}:") %>
|
||||
<strong>Documents.zip</strong>
|
||||
<%= hidden_field_tag('email[zipped_content]', @email_params['zipped_content']) %>
|
||||
</p>
|
||||
<p>
|
||||
<%= label_tag('email[body]', "#{l(:label_email_body)}:") %>
|
||||
<%= text_area_tag('email[body]', @email_params['body'], :rows=> '20', :style => 'width: 90%;') %>
|
||||
</p>
|
||||
<p><%= submit_tag(l(:label_email_send)) %></p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@ -30,49 +30,47 @@
|
||||
<%= link_to h(path_element.title), {:controller => 'dmsf', :action => 'show', :id=> @project, :folder_id => path_element} %>
|
||||
<% end %>
|
||||
/
|
||||
<%= link_to(h(@file.title), {:controller => "dmsf_files", :action => "show", :id=> @file}) %>
|
||||
<%= image_tag("notify.png", :plugin => "redmine_dmsf", :title => l(:title_notifications_active)) if @file.notification %>
|
||||
<%= link_to(h(@file.title), {:controller => 'dmsf_files', :action => 'show', :id=> @file}) %>
|
||||
<%= image_tag('notify.png', :plugin => 'redmine_dmsf', :title => l(:title_notifications_active)) if @file.notification %>
|
||||
</h2>
|
||||
|
||||
<% unless DmsfFile.allowed_target_projects_on_copy.blank? %>
|
||||
<%= form_tag({:action => "create", :id => @file}, :id => "copyForm") do |f| %>
|
||||
<div class="box dmsf_detail">
|
||||
<p>
|
||||
<label for="target_project_id"><%=l(:label_target_project)%>:</label>
|
||||
<%= select_tag("target_project_id",
|
||||
project_tree_options_for_select(DmsfFile.allowed_target_projects_on_copy, :selected => @target_project)) %>
|
||||
</p>
|
||||
<p>
|
||||
<%= label_tag("target_folder_id", l(:label_target_folder) + ":") %>
|
||||
<%= select_tag("target_folder_id",
|
||||
options_for_select(DmsfFolder.directory_tree(@target_project),
|
||||
:selected => (@target_folder.id unless @target_folder.nil?))) %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
<%= submit_tag(l(:button_copy)) %>
|
||||
<% if User.current.allowed_to?(:file_manipulation, @project) %>
|
||||
<button type="button" id="move_button" title="<%=l(:button_move)%>"><%=l(:button_move)%></button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if DmsfFile.allowed_target_projects_on_copy.present? %>
|
||||
<%= form_tag({:action => 'create', :id => @file}, :id => 'copyForm') do |f| %>
|
||||
<div class="box dmsf_detail">
|
||||
<p>
|
||||
<label for="target_project_id"><%=l(:label_target_project)%>:</label>
|
||||
<%= select_tag('target_project_id',
|
||||
project_tree_options_for_select(DmsfFile.allowed_target_projects_on_copy, :selected => @target_project)) %>
|
||||
</p>
|
||||
<p>
|
||||
<%= label_tag('target_folder_id', "#{l(:label_target_folder)}:") %>
|
||||
<%= select_tag('target_folder_id',
|
||||
options_for_select(DmsfFolder.directory_tree(@target_project),
|
||||
:selected => (@target_folder.id if @target_folder))) %>
|
||||
</p>
|
||||
</div>
|
||||
<%= submit_tag(l(:button_copy)) %>
|
||||
<% if User.current.allowed_to?(:file_manipulation, @project) %>
|
||||
<button type="button" id="move_button" title="<%= l(:button_move) %>"><%= l(:button_move) %></button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery("#move_button").click(function(event) {
|
||||
jQuery("#copyForm").attr("action", "<%= url_for(:action => 'move', :id => @file) %>");
|
||||
jQuery("#copyForm").submit();
|
||||
});
|
||||
jQuery('#move_button').click(function(event) {
|
||||
jQuery('#copyForm').attr('action', "<%= url_for(:action => 'move', :id => @file) %>");
|
||||
jQuery('#copyForm').submit();
|
||||
});
|
||||
|
||||
jQuery("#target_project_id").change(function () {
|
||||
jQuery("#content").load("<%= url_for(:action => 'new') %>", jQuery("#copyForm").serialize());
|
||||
});
|
||||
jQuery('#target_project_id').change(function () {
|
||||
jQuery('#content').load("<%= url_for(:action => 'new') %>", jQuery('#copyForm').serialize());
|
||||
});
|
||||
</script>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag "dmsf", :plugin => "redmine_dmsf" %>
|
||||
<%= javascript_include_tag "jquery-1.6.1.min.js", :plugin => "redmine_dmsf" %>
|
||||
<script type="text/javascript">
|
||||
jQuery.noConflict();
|
||||
</script>
|
||||
<%= stylesheet_link_tag 'dmsf', :plugin => 'redmine_dmsf' %>
|
||||
<%= javascript_include_tag 'jquery-1.6.1.min.js', :plugin => 'redmine_dmsf' %>
|
||||
<script type="text/javascript">
|
||||
jQuery.noConflict();
|
||||
</script>
|
||||
<% end %>
|
||||
|
||||
@ -19,8 +19,7 @@
|
||||
|
||||
<% html_title(l(:dmsf)) %>
|
||||
|
||||
<div class="contextual">
|
||||
</div>
|
||||
<div class="contextual"></div>
|
||||
|
||||
<h2>
|
||||
<%= link_to l(:link_documents), {:controller => 'dmsf', :action => 'show', :id=> @project } %>
|
||||
@ -31,35 +30,34 @@
|
||||
</h2>
|
||||
|
||||
<% unless DmsfFolder.allowed_target_projects_on_copy.blank? %>
|
||||
<%= form_tag({:action => "copy_to", :id => @folder}, :id => "copyForm") do |f| %>
|
||||
<div class="box dmsf_detail">
|
||||
<p>
|
||||
<label for="target_project_id"><%=l(:label_target_project)%>:</label>
|
||||
<%= select_tag("target_project_id",
|
||||
project_tree_options_for_select(DmsfFolder.allowed_target_projects_on_copy, :selected => @target_project)) %>
|
||||
</p>
|
||||
<p>
|
||||
<%= label_tag("target_folder_id", l(:label_target_folder) + ":") %>
|
||||
<%= select_tag("target_folder_id",
|
||||
options_for_select(DmsfFolder.directory_tree(@target_project, @folder),
|
||||
:selected => (@target_folder.id unless @target_folder.nil?))) %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<%= submit_tag(l(:button_copy)) %>
|
||||
<% end %>
|
||||
<%= form_tag({:action => 'copy_to', :id => @folder}, :id => 'copyForm') do |f| %>
|
||||
<div class="box dmsf_detail">
|
||||
<p>
|
||||
<label for="target_project_id"><%= l(:label_target_project) %>:</label>
|
||||
<%= select_tag('target_project_id',
|
||||
project_tree_options_for_select(DmsfFolder.allowed_target_projects_on_copy, :selected => @target_project)) %>
|
||||
</p>
|
||||
<p>
|
||||
<%= label_tag('target_folder_id', "#{l(:label_target_folder)}:") %>
|
||||
<%= select_tag('target_folder_id',
|
||||
options_for_select(DmsfFolder.directory_tree(@target_project, @folder),
|
||||
:selected => (@target_folder.id if @target_folder))) %>
|
||||
</p>
|
||||
</div>
|
||||
<%= submit_tag(l(:button_copy)) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery("#target_project_id").change(function () {
|
||||
jQuery("#content").load("<%= url_for(:action => 'new') %>", jQuery("#copyForm").serialize());
|
||||
});
|
||||
jQuery('#target_project_id').change(function () {
|
||||
jQuery('#content').load("<%= url_for(:action => 'new') %>", jQuery('#copyForm').serialize());
|
||||
});
|
||||
</script>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag "dmsf", :plugin => "redmine_dmsf" %>
|
||||
<%= javascript_include_tag "jquery-1.6.1.min.js", :plugin => "redmine_dmsf" %>
|
||||
<script type="text/javascript">
|
||||
jQuery.noConflict();
|
||||
</script>
|
||||
<%= stylesheet_link_tag 'dmsf', :plugin => 'redmine_dmsf' %>
|
||||
<%= javascript_include_tag 'jquery-1.6.1.min.js', :plugin => 'redmine_dmsf' %>
|
||||
<script type="text/javascript">
|
||||
jQuery.noConflict();
|
||||
</script>
|
||||
<% end %>
|
||||
|
||||
@ -17,21 +17,21 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%>
|
||||
|
||||
User <%= link_to(h(@user), {:only_path => false, :controller => "users", :action => "show", :id => @user }) %>
|
||||
User <%= link_to(h(@user), {:only_path => false, :controller => 'users', :action => 'show', :id => @user }) %>
|
||||
actualized DMSF files in project <%= @project.name %>:
|
||||
<% @files.each do |file| %>
|
||||
<p>
|
||||
<%= link_to(h(file.dmsf_path_str),
|
||||
{:only_path => false, :controller => "dmsf_files", :action => "show", :id => file,
|
||||
:download => ""}) %> (<%= file.name %>),
|
||||
<%= number_to_human_size(file.last_revision.size) %>,
|
||||
version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %>,
|
||||
<%= "#{file.last_revision.workflow_str(true)}," unless file.last_revision.workflow_str(true).blank? %>
|
||||
<%= link_to("Details",
|
||||
{:only_path => false, :controller => "dmsf_files", :action => "show", :id => file}) %>
|
||||
<% unless file.last_revision.comment.blank? %>
|
||||
<br /><span style="font-size: 0.9em"> <em><%= h(file.last_revision.comment) %></em></span>
|
||||
<% end %>
|
||||
<%= link_to(h(file.dmsf_path_str),
|
||||
{:only_path => false, :controller => 'dmsf_files', :action => 'show', :id => file,
|
||||
:download => ''}) %> (<%= file.name %>),
|
||||
<%= number_to_human_size(file.last_revision.size) %>,
|
||||
version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %>,
|
||||
<%= "#{file.last_revision.workflow_str(true)}," if file.last_revision.workflow_str(true).present? %>
|
||||
<%= link_to('Details',
|
||||
{:only_path => false, :controller => 'dmsf_files', :action => 'show', :id => file}) %>
|
||||
<% if file.last_revision.comment.present? %>
|
||||
<br /><span style="font-size: 0.9em"> <em><%= h(file.last_revision.comment) %></em></span>
|
||||
<% end %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
|
||||
User <%= @user %> actualized DMSF files in project <%= @project.name %>:
|
||||
<% @files.each do |file| %>
|
||||
<%= file.dmsf_path_str %> (<%= file.name %>), <%= number_to_human_size(file.last_revision.size) %>, version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %><%= ", #{file.last_revision.workflow_str(true)}" unless file.last_revision.workflow_str(true).blank? %>
|
||||
<%= url_for({:only_path => false, :controller => "dmsf_files", :action => "show", :id => file}) %>
|
||||
<% unless file.last_revision.comment.blank? %> comment: <%= file.last_revision.comment %><% end %>
|
||||
<%= file.dmsf_path_str %> (<%= file.name %>), <%= number_to_human_size(file.last_revision.size) %>, version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %><%= ", #{file.last_revision.workflow_str(true)}" unless file.last_revision.workflow_str(true).blank? %>
|
||||
<%= url_for({:only_path => false, :controller => 'dmsf_files', :action => 'show', :id => file}) %>
|
||||
<% if file.last_revision.comment.present? %> comment: <%= file.last_revision.comment %><% end %>
|
||||
<% end %>
|
||||
@ -16,7 +16,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%>
|
||||
|
||||
<p>Dear <%= @user.name %>,</p>
|
||||
<p><%= @user.name %>,</p>
|
||||
<p>
|
||||
<%= @text1 %>
|
||||
</p>
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%>
|
||||
|
||||
Dear <%= @user.name %> ,
|
||||
<%= @user.name %> ,
|
||||
<%= @text1 %>
|
||||
<% unless @revision.folder %>
|
||||
<%= @text2 %> <%= url_for(:controller => 'dmsf', :action => 'show', :id => @revision.file.project, :only_path => false) %>.
|
||||
|
||||
@ -18,45 +18,45 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%>
|
||||
|
||||
<div class="box dmsf_detail">
|
||||
<%= hidden_field_tag("commited_files[#{i}][disk_filename]", upload.disk_filename) %>
|
||||
<%= hidden_field_tag("commited_files[#{i}][name]", upload.name) %>
|
||||
<p class="warning"><%= l(:info_file_locked) %></p>
|
||||
|
||||
<div class="clear">
|
||||
<div class="splitcontentleft">
|
||||
<p>
|
||||
<%= label_tag("", l(:label_title) + ":") %>
|
||||
<%= h(upload.title) %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="splitcontentright">
|
||||
<p>
|
||||
<%= label_tag("", l(:label_filename) + ":") %>
|
||||
<%= h(upload.name) %>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<p class="no-ident">
|
||||
<%= label_tag("", l(:label_description) + ":") %>
|
||||
</p>
|
||||
<div class="wiki data clear">
|
||||
<%= textilizable(upload.description) %>
|
||||
</div>
|
||||
<div class="splitcontentleft">
|
||||
<p>
|
||||
<%= label_tag("", l(:label_version) + ":") %>
|
||||
<%= upload.major_version %>.<%= upload.minor_version %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="splitcontentright clear">
|
||||
<p>
|
||||
<%= label_tag("", l(:label_mime) + ":") %>
|
||||
<%= h(upload.mime_type) %>
|
||||
</p>
|
||||
<p>
|
||||
<%= label_tag("", l(:label_size) + ":") %>
|
||||
<%= number_to_human_size(upload.size) %>
|
||||
</p>
|
||||
</div>
|
||||
<br style="clear: both"/>
|
||||
<%= hidden_field_tag("commited_files[#{i}][disk_filename]", upload.disk_filename) %>
|
||||
<%= hidden_field_tag("commited_files[#{i}][name]", upload.name) %>
|
||||
<p class="warning"><%= l(:info_file_locked) %></p>
|
||||
|
||||
<div class="clear">
|
||||
<div class="splitcontentleft">
|
||||
<p>
|
||||
<%= label_tag('', "#{l(:label_title)}:") %>
|
||||
<%= h(upload.title) %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="splitcontentright">
|
||||
<p>
|
||||
<%= label_tag('', "#{l(:label_filename)}:") %>
|
||||
<%= h(upload.name) %>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<p class="no-ident">
|
||||
<%= label_tag('', "#{l(:label_description)}:") %>
|
||||
</p>
|
||||
<div class="wiki data clear">
|
||||
<%= textilizable(upload.description) %>
|
||||
</div>
|
||||
<div class="splitcontentleft">
|
||||
<p>
|
||||
<%= label_tag('', "#{l(:label_version)}:") %>
|
||||
<%= upload.major_version %>.<%= upload.minor_version %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="splitcontentright clear">
|
||||
<p>
|
||||
<%= label_tag('', "#{l(:label_mime)}:") %>
|
||||
<%= h(upload.mime_type) %>
|
||||
</p>
|
||||
<p>
|
||||
<%= label_tag('', "#{l(:label_size)}:") %>
|
||||
<%= number_to_human_size(upload.size) %>
|
||||
</p>
|
||||
</div>
|
||||
<br style="clear: both"/>
|
||||
</div>
|
||||
|
||||
@ -37,26 +37,25 @@
|
||||
|
||||
<h3><%=l(:heading_uploaded_files)%></h3>
|
||||
<% i = 1 %>
|
||||
<%= form_tag({:action => "commit_files", :id => @project, :folder_id => @folder},
|
||||
:method=>:post) do %>
|
||||
<% @uploads.each do |upload| %>
|
||||
<% if upload.locked %>
|
||||
<%= render(:partial => 'upload_file_locked', :locals => {:upload => upload, :i => i}) %>
|
||||
<% else %>
|
||||
<%= render(:partial => 'upload_file', :locals => {:upload => upload, :i => i}) %>
|
||||
<% end %>
|
||||
<% i += 1 %>
|
||||
<% end %>
|
||||
<%= submit_tag(l(:submit_commit)) %>
|
||||
<%= form_tag({:action => 'commit_files', :id => @project, :folder_id => @folder},
|
||||
:method=>:post) do %>
|
||||
<% @uploads.each do |upload| %>
|
||||
<% if upload.locked %>
|
||||
<%= render(:partial => 'upload_file_locked', :locals => {:upload => upload, :i => i}) %>
|
||||
<% else %>
|
||||
<%= render(:partial => 'upload_file', :locals => {:upload => upload, :i => i}) %>
|
||||
<% end %>
|
||||
<% i += 1 %>
|
||||
<% end %>
|
||||
<%= submit_tag(l(:submit_commit)) %>
|
||||
<% end %>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag "dmsf", :plugin => "redmine_dmsf" %>
|
||||
<%= javascript_include_tag "jquery-1.6.1.min.js", :plugin => "redmine_dmsf" %>
|
||||
<script type="text/javascript">
|
||||
jQuery.noConflict();
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
});
|
||||
</script>
|
||||
<%= stylesheet_link_tag 'dmsf', :plugin => 'redmine_dmsf' %>
|
||||
<%= javascript_include_tag 'jquery-1.6.1.min.js', :plugin => 'redmine_dmsf' %>
|
||||
<script type="text/javascript">
|
||||
jQuery.noConflict();
|
||||
jQuery(document).ready(function() {
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
|
||||
@ -1,151 +0,0 @@
|
||||
<%# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
|
||||
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
|
||||
#
|
||||
# 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
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%>
|
||||
|
||||
<p>
|
||||
<%=content_tag(:label, l(:label_maximum_files_upload) + ":") %>
|
||||
<%=text_field_tag "settings[dmsf_max_file_upload]", @settings["dmsf_max_file_upload"], :size=>10 %><br/>
|
||||
(<%=l(:label_default)%>: 0)
|
||||
<br/>
|
||||
<%= l(:note_maximum_number_of_files_uploaded) %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%=content_tag(:label, l(:label_maximum_files_download) + ":") %>
|
||||
<%=text_field_tag "settings[dmsf_max_file_download]", @settings["dmsf_max_file_download"], :size=>10 %><br/>
|
||||
(<%=l(:label_default)%>: 0)
|
||||
<br/>
|
||||
<%= l(:note_maximum_number_of_files_downloaded) %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%=content_tag(:label, l(:label_maximum_email_filesize) + ":") %>
|
||||
<%=text_field_tag "settings[dmsf_max_email_filesize]", @settings["dmsf_max_email_filesize"], :size=>10 %><br/>
|
||||
(<%=l(:label_default)%>: 0)
|
||||
<br/>
|
||||
<%= l(:note_maximum_email_filesize) %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%=content_tag(:label, l(:label_file_storage_directory) + ":") %>
|
||||
<%
|
||||
storage_dir = @settings["dmsf_storage_directory"].strip
|
||||
storage_dir = "#{Rails.root}/files/dmsf" if storage_dir.blank?
|
||||
%>
|
||||
<%=text_field_tag "settings[dmsf_storage_directory]", storage_dir, :size=>50 %><br/>
|
||||
(<%=l(:label_default)%>: <%="#{Rails.root}/files/dmsf"%>)
|
||||
</p>
|
||||
<% unless File.exists?(storage_dir)
|
||||
begin
|
||||
Dir.mkdir(storage_dir)
|
||||
rescue %>
|
||||
<p class="warning"><%= l(:error_file_storage_directory_does_not_exist) %></p>
|
||||
<% end
|
||||
end %>
|
||||
<% testfilename = "#{storage_dir}/test.test"
|
||||
if File.exists?(storage_dir)
|
||||
begin
|
||||
File.open(testfilename, "wb") do |file|
|
||||
end
|
||||
rescue %>
|
||||
<p class="warning"><%= l(:error_file_can_not_be_created) %></p>
|
||||
<% ensure
|
||||
File.delete(testfilename) if File.exists?(testfilename)
|
||||
end
|
||||
end %>
|
||||
|
||||
<p>
|
||||
<%=content_tag(:label, l(:label_physical_file_delete) + ":") %>
|
||||
<%= check_box_tag("settings[dmsf_really_delete_files]", true, @settings["dmsf_really_delete_files"]) %><br/>
|
||||
(<%=l(:label_default)%>: <%=l(:general_text_No)%>)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%=content_tag(:label, l(:label_default_notifications) + ":") %>
|
||||
<%=select_tag("settings[dmsf_default_notifications]",
|
||||
options_for_select([
|
||||
[l(:select_option_deactivated), nil],
|
||||
[l(:select_option_activated), "1"]],
|
||||
:selected => @settings["dmsf_default_notifications"])) %><br/>
|
||||
(<%=l(:label_default)%>: <%=l(:select_option_deactivated)%>)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%=content_tag(:label, l(:label_webdav) + ":") %>
|
||||
<%=select_tag("settings[dmsf_webdav]",
|
||||
options_for_select([
|
||||
[l(:select_option_deactivated), nil],
|
||||
[l(:select_option_activated), "1"]],
|
||||
:selected => @settings["dmsf_webdav"])) %><br/>
|
||||
(<%=l(:label_default)%>: <%=l(:select_option_activated)%>)
|
||||
<br/>
|
||||
<%= l(:note_webdav).html_safe %>
|
||||
</p>
|
||||
|
||||
<% if @settings["dmsf_webdav"].nil? || !@settings["dmsf_webdav"].empty? %>
|
||||
<p>
|
||||
<%=content_tag(:label, l(:label_webdav_strategy) + ":") %>
|
||||
<%=select_tag("settings[dmsf_webdav_strategy]",
|
||||
options_for_select([
|
||||
[l(:select_option_webdav_readonly), "WEBDAV_READ_ONLY"],
|
||||
[l(:select_option_webdav_readwrite), "WEBDAV_READ_WRITE"]],
|
||||
:selected => @settings["dmsf_webdav_strategy"])) %><br/>
|
||||
(<%=l(:label_default)%>: <%=l(:select_option_webdav_readonly)%>)
|
||||
<br/>
|
||||
<%= l(:note_webdav_strategy).html_safe %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
|
||||
<hr />
|
||||
<% begin
|
||||
require 'xapian'
|
||||
xapian_disabled = false
|
||||
rescue LoadError %>
|
||||
<p class="warning"><%= l(:warning_xapian_not_available) %></p>
|
||||
<% xapian_disabled = true
|
||||
end %>
|
||||
|
||||
<p>
|
||||
<%=content_tag(:label, l(:label_index_database) + ":") %>
|
||||
<%=text_field_tag 'settings[dmsf_index_database]', @settings['dmsf_index_database'], :disabled => xapian_disabled, :size=>50 %><br/>
|
||||
(<%=l(:label_default)%>: <%="#{Rails.root}/files/dmsf_index"%>)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%=content_tag(:label, l(:label_stemming_language) + ":") %>
|
||||
<%=text_field_tag 'settings[dmsf_stemming_lang]', @settings['dmsf_stemming_lang'], :disabled => xapian_disabled %><br/>
|
||||
(<%=l(:label_default)%>: english )<br/>
|
||||
<br/>
|
||||
<%=l(:note_possible_values)%>: danish dutch english finnish french german german2 hungarian italian kraaij_pohlmann lovins norwegian porter portuguese romanian russian spanish swedish turkish (<%=l(:note_pass_none_to_disable_stemming)%>)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%=content_tag(:label, l(:label_stem_strategy) + ":")%>
|
||||
<%=radio_button_tag 'settings[dmsf_stemming_strategy]', 'STEM_NONE', @settings['dmsf_stemming_strategy'] == 'STEM_NONE', :disabled => xapian_disabled, :checked=>true %> <%=l(:option_stem_none)%><br>
|
||||
<%=radio_button_tag 'settings[dmsf_stemming_strategy]', 'STEM_SOME', @settings['dmsf_stemming_strategy'] == 'STEM_SOME', :disabled => xapian_disabled %> <%=l(:option_stem_some)%><br>
|
||||
<%=radio_button_tag 'settings[dmsf_stemming_strategy]', 'STEM_ALL', @settings['dmsf_stemming_strategy'] == 'STEM_ALL', :disabled => xapian_disabled %> <%=l(:option_stem_all)%><br>
|
||||
<br/>
|
||||
<%=l(:label_stemming_description)%>:
|
||||
<br>
|
||||
STEM_NONE: <%=l(:note_do_not_stem)%><br>
|
||||
STEM_SOME: <%=l(:note_stem_some)%><br>
|
||||
STEM_ALL: <%=l(:note_stem_all)%><br>
|
||||
<br/>
|
||||
<%=l(:note_stemming_applied)%><br>
|
||||
</p>
|
||||
152
app/views/settings/_dmsf_settings.html.erb
Normal file
152
app/views/settings/_dmsf_settings.html.erb
Normal file
@ -0,0 +1,152 @@
|
||||
<%# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
|
||||
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
|
||||
#
|
||||
# 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
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%>
|
||||
|
||||
<p>
|
||||
<%= content_tag(:label, "#{l(:label_maximum_files_upload)}:") %>
|
||||
<%= text_field_tag 'settings[dmsf_max_file_upload]', @settings['dmsf_max_file_upload'], :size => 10 %><br/>
|
||||
(<%= l(:label_default) %>: 0)
|
||||
<br/>
|
||||
<%= l(:note_maximum_number_of_files_uploaded) %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= content_tag(:label, "#{l(:label_maximum_files_download)}:") %>
|
||||
<%= text_field_tag 'settings[dmsf_max_file_download]', @settings['dmsf_max_file_download'], :size => 10 %><br/>
|
||||
(<%= l(:label_default) %>: 0)
|
||||
<br/>
|
||||
<%= l(:note_maximum_number_of_files_downloaded) %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= content_tag(:label, "#{l(:label_maximum_email_filesize)}:") %>
|
||||
<%= text_field_tag 'settings[dmsf_max_email_filesize]', @settings['dmsf_max_email_filesize'], :size => 10 %><br/>
|
||||
(<%= l(:label_default) %>: 0)
|
||||
<br/>
|
||||
<%= l(:note_maximum_email_filesize) %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= content_tag(:label, "#{l(:label_file_storage_directory)}:") %>
|
||||
<%
|
||||
storage_dir = @settings['dmsf_storage_directory'].strip
|
||||
storage_dir = "#{Rails.root}/files/dmsf" if storage_dir.blank?
|
||||
%>
|
||||
<%= text_field_tag 'settings[dmsf_storage_directory]', storage_dir, :size => 50 %><br/>
|
||||
(<%= l(:label_default) %>: <%= "#{Rails.root}/files/dmsf" %>)
|
||||
</p>
|
||||
<% unless File.exists?(storage_dir) %>
|
||||
<% begin %>
|
||||
<% Dir.mkdir(storage_dir) %>
|
||||
<% rescue %>
|
||||
<p class="warning"><%= l(:error_file_storage_directory_does_not_exist) %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% testfilename = "#{storage_dir}/test.test" %>
|
||||
<% if File.exists?(storage_dir) %>
|
||||
<% begin %>
|
||||
<% File.open(testfilename, 'wb') do |file| %>
|
||||
<% end %>
|
||||
<% rescue %>
|
||||
<p class="warning"><%= l(:error_file_can_not_be_created) %></p>
|
||||
<% ensure %>
|
||||
<% File.delete(testfilename) if File.exists?(testfilename) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<p>
|
||||
<%= content_tag(:label, "#{l(:label_physical_file_delete)}:") %>
|
||||
<%= check_box_tag('settings[dmsf_really_delete_files]', true, @settings['dmsf_really_delete_files']) %><br/>
|
||||
(<%=l(:label_default)%>: <%=l(:general_text_No)%>)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= content_tag(:label, "#{l(:label_default_notifications)}:") %>
|
||||
<%= select_tag('settings[dmsf_default_notifications]',
|
||||
options_for_select([
|
||||
[l(:select_option_deactivated), nil],
|
||||
[l(:select_option_activated), '1']],
|
||||
:selected => @settings['dmsf_default_notifications'])) %><br/>
|
||||
(<%= l(:label_default) %>: <%= l(:select_option_deactivated) %>)
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<p>
|
||||
<%= content_tag(:label, "#{l(:label_webdav)}:") %>
|
||||
<%= select_tag('settings[dmsf_webdav]',
|
||||
options_for_select([
|
||||
[l(:select_option_deactivated), nil],
|
||||
[l(:select_option_activated), '1']],
|
||||
:selected => @settings['dmsf_webdav'])) %><br/>
|
||||
(<%= l(:label_default) %>: <%= l(:select_option_activated) %>)
|
||||
<br/>
|
||||
<%= l(:note_webdav).html_safe %>
|
||||
</p>
|
||||
|
||||
<% if @settings['dmsf_webdav'].nil? || !@settings['dmsf_webdav'].empty? %>
|
||||
<p>
|
||||
<%= content_tag(:label, "#{l(:label_webdav_strategy)}:") %>
|
||||
<%= select_tag('settings[dmsf_webdav_strategy]',
|
||||
options_for_select([
|
||||
[l(:select_option_webdav_readonly), 'WEBDAV_READ_ONLY'],
|
||||
[l(:select_option_webdav_readwrite), 'WEBDAV_READ_WRITE']],
|
||||
:selected => @settings['dmsf_webdav_strategy'])) %><br/>
|
||||
(<%= l(:label_default) %>: <%= l(:select_option_webdav_readonly) %>)
|
||||
<br/>
|
||||
<%= l(:note_webdav_strategy).html_safe %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<hr />
|
||||
|
||||
<% begin %>
|
||||
<% require 'xapian' %>
|
||||
<% xapian_disabled = false %>
|
||||
<% rescue LoadError %>
|
||||
<p class="warning"><%= l(:warning_xapian_not_available) %></p>
|
||||
<% xapian_disabled = true %>
|
||||
<% end %>
|
||||
|
||||
<p>
|
||||
<%= content_tag(:label, "#{l(:label_index_database)}:") %>
|
||||
<%= text_field_tag 'settings[dmsf_index_database]', @settings['dmsf_index_database'], :disabled => xapian_disabled, :size => 50 %><br/>
|
||||
(<%= l(:label_default) %>: <%= "#{Rails.root}/files/dmsf_index" %>)
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= content_tag(:label, "#{l(:label_stemming_language)}:") %>
|
||||
<%= text_field_tag 'settings[dmsf_stemming_lang]', @settings['dmsf_stemming_lang'], :disabled => xapian_disabled %><br/>
|
||||
(<%= l(:label_default)%>: english )<br/>
|
||||
<br/>
|
||||
<%= l(:note_possible_values)%>: danish dutch english finnish french german german2 hungarian italian kraaij_pohlmann lovins norwegian porter portuguese romanian russian spanish swedish turkish (<%= l(:note_pass_none_to_disable_stemming) %>)</p>
|
||||
|
||||
<p>
|
||||
<%= content_tag(:label, l(:label_stem_strategy) + ":")%>
|
||||
<%= radio_button_tag 'settings[dmsf_stemming_strategy]', 'STEM_NONE', @settings['dmsf_stemming_strategy'] == 'STEM_NONE', :disabled => xapian_disabled, :checked=>true %> <%= l(:option_stem_none) %><br>
|
||||
<%= radio_button_tag 'settings[dmsf_stemming_strategy]', 'STEM_SOME', @settings['dmsf_stemming_strategy'] == 'STEM_SOME', :disabled => xapian_disabled %> <%= l(:option_stem_some) %><br>
|
||||
<%= radio_button_tag 'settings[dmsf_stemming_strategy]', 'STEM_ALL', @settings['dmsf_stemming_strategy'] == 'STEM_ALL', :disabled => xapian_disabled %> <%= l(:option_stem_all) %><br>
|
||||
<br/>
|
||||
<%= l(:label_stemming_description) %>:
|
||||
<br>
|
||||
STEM_NONE: <%=l(:note_do_not_stem) %><br>
|
||||
STEM_SOME: <%=l(:note_stem_some) %><br>
|
||||
STEM_ALL: <%=l(:note_stem_all) %><br>
|
||||
<br/>
|
||||
<%= l(:note_stemming_applied) %><br>
|
||||
</p>
|
||||
@ -19,11 +19,11 @@
|
||||
class Dmsf120 < ActiveRecord::Migration
|
||||
|
||||
class DmsfFileRevision < ActiveRecord::Base
|
||||
belongs_to :file, :class_name => "DmsfFile", :foreign_key => "dmsf_file_id"
|
||||
belongs_to :source_revision, :class_name => "DmsfFileRevision", :foreign_key => "source_dmsf_file_revision_id"
|
||||
belongs_to :file, :class_name => 'DmsfFile', :foreign_key => 'dmsf_file_id'
|
||||
belongs_to :source_revision, :class_name => 'DmsfFileRevision', :foreign_key => 'source_dmsf_file_revision_id'
|
||||
belongs_to :user
|
||||
belongs_to :folder, :class_name => "DmsfFolder", :foreign_key => "dmsf_folder_id"
|
||||
belongs_to :deleted_by_user, :class_name => "User", :foreign_key => "deleted_by_user_id"
|
||||
belongs_to :folder, :class_name => 'DmsfFolder', :foreign_key => 'dmsf_folder_id'
|
||||
belongs_to :deleted_by_user, :class_name => 'User', :foreign_key => 'deleted_by_user_id'
|
||||
belongs_to :project
|
||||
end
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ class Dmsf144 < ActiveRecord::Migration
|
||||
|
||||
|
||||
class DmsfFileLock < ActiveRecord::Base
|
||||
belongs_to :file, :class_name => "DmsfFile", :foreign_key => "dmsf_file_id"
|
||||
belongs_to :file, :class_name => 'DmsfFile', :foreign_key => 'dmsf_file_id'
|
||||
belongs_to :user
|
||||
end
|
||||
|
||||
@ -70,7 +70,7 @@ class Dmsf144 < ActiveRecord::Migration
|
||||
|
||||
#We need to force our newly found
|
||||
|
||||
say "Applying default lock scope / type - Exclusive / Write"
|
||||
say 'Applying default lock scope / type - Exclusive / Write'
|
||||
DmsfFileLock.update_all ['entity_type = ?, lock_type_cd = ?, lock_scope_cd = ?', 0, 0, 0]
|
||||
|
||||
#These are not null-allowed columns
|
||||
@ -107,9 +107,9 @@ class Dmsf144 < ActiveRecord::Migration
|
||||
say "Migration: #{existing} -> #{new_path} failed"
|
||||
end
|
||||
}
|
||||
say "Action was successful"
|
||||
say 'Action was successful'
|
||||
rescue Exception => e
|
||||
say "Action was not successful"
|
||||
say 'Action was not successful'
|
||||
puts e.message
|
||||
puts e.backtrace.inspect #See issue 86
|
||||
#Nothing here, we just dont want a migration to break
|
||||
@ -123,10 +123,10 @@ class Dmsf144 < ActiveRecord::Migration
|
||||
add_column :dmsf_file_locks, :locked, :boolean, :default => false, :null => false
|
||||
|
||||
#Data cleanup - delete all expired locks, or any folder locks
|
||||
say "Removing all expired and/or folder locks"
|
||||
say 'Removing all expired and/or folder locks'
|
||||
DmsfFileLock.delete_all ['expires_at < ? OR entity_type = 1', Time.now]
|
||||
|
||||
say "Changing all records to be locked"
|
||||
say 'Changing all records to be locked'
|
||||
DmsfFileLock.update_all ['locked = ?', true]
|
||||
|
||||
rename_column :dmsf_file_locks, :entity_id, :dmsf_file_id
|
||||
@ -139,7 +139,7 @@ class Dmsf144 < ActiveRecord::Migration
|
||||
|
||||
#Not sure if this is the right place to do this, as its file manipulation, not database (stricly)
|
||||
begin
|
||||
say "restoring old file-structure"
|
||||
say 'restoring old file-structure'
|
||||
DmsfFileRevision.visible.each {|rev|
|
||||
next if rev.project.nil?
|
||||
project = rev.project.identifier.gsub(/[^\w\.\-]/,'_')
|
||||
|
||||
@ -31,9 +31,9 @@ module RedmineDmsf
|
||||
unloadable
|
||||
alias_method_chain :copy, :dmsf
|
||||
|
||||
has_many :dmsf_files, :class_name => "DmsfFile", :foreign_key => "project_id", :conditions => { :dmsf_folder_id => nil }
|
||||
has_many :dmsf_files, :class_name => 'DmsfFile', :foreign_key => 'project_id', :conditions => { :dmsf_folder_id => nil }
|
||||
#Fix: should only be root folders not, all folders
|
||||
has_many :dmsf_folders, :class_name => "DmsfFolder", :foreign_key => "project_id", :conditions => {:dmsf_folder_id => nil}, :dependent => :destroy
|
||||
has_many :dmsf_folders, :class_name => 'DmsfFolder', :foreign_key => 'project_id', :conditions => {:dmsf_folder_id => nil}, :dependent => :destroy
|
||||
has_many :dmsf_workflows, :dependent => :destroy
|
||||
end
|
||||
|
||||
@ -57,7 +57,7 @@ module RedmineDmsf
|
||||
project = project.is_a?(Project) ? project : Project.find(project)
|
||||
|
||||
to_be_copied = %w(dmsf)
|
||||
to_be_copied = to_be_copied & options[:only].to_a unless options[:only].nil?
|
||||
to_be_copied = to_be_copied & options[:only].to_a if options[:only].present?
|
||||
|
||||
if save
|
||||
to_be_copied.each do |name|
|
||||
|
||||
@ -22,12 +22,11 @@ module RedmineDmsf
|
||||
module Test
|
||||
class IntegrationTest < ActionController::IntegrationTest
|
||||
def self.fixtures(*table_names)
|
||||
dir = File.join(File.dirname(__FILE__), "../../../test/fixtures" )
|
||||
modified_tables = table_names.reject{|x| !File.exist?(dir + "/" + x.to_s + ".yml") }
|
||||
dir = File.join(File.dirname(__FILE__), '../../../test/fixtures')
|
||||
modified_tables = table_names.reject{|x| !File.exist?("#{dir}/#{x}.yml") }
|
||||
ActiveRecord::Fixtures.create_fixtures(dir, modified_tables) unless modified_tables.empty?
|
||||
table_names -= modified_tables
|
||||
super(table_names-modified_tables)
|
||||
|
||||
super(table_names-modified_tables)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -26,9 +26,9 @@ module RedmineDmsf
|
||||
# Ultimately it allows for better integration without blowing redmine fixtures up,
|
||||
# and allowing us to suppliment redmine fixtures if we need to.
|
||||
def self.fixtures(*table_names)
|
||||
dir = File.join( File.dirname(__FILE__), "../../../test/fixtures" )
|
||||
dir = File.join( File.dirname(__FILE__), '../../../test/fixtures')
|
||||
table_names.each{|x|
|
||||
ActiveRecord::Fixtures.create_fixtures(dir, x) if File.exist?(dir + "/" + x.to_s + ".yml")
|
||||
ActiveRecord::Fixtures.create_fixtures(dir, x) if File.exist?("#{dir}/#{x}.yml")
|
||||
}
|
||||
super(table_names)
|
||||
end
|
||||
|
||||
@ -26,13 +26,13 @@ module RedmineDmsf
|
||||
# Ultimately it allows for better integration without blowing redmine fixtures up,
|
||||
# and allowing us to suppliment redmine fixtures if we need to.
|
||||
def self.fixtures(*table_names)
|
||||
dir = File.expand_path( File.dirname(__FILE__) + "../../../../test/fixtures" )
|
||||
dir = File.expand_path( File.dirname(__FILE__) + '../../../../test/fixtures')
|
||||
table_names.each{|x,i|
|
||||
ActiveRecord::Fixtures.create_fixtures(dir, x) if File.exist?(dir + "/" + x.to_s + ".yml")
|
||||
ActiveRecord::Fixtures.create_fixtures(dir, x) if File.exist?("#{dir}/#{x}.yml")
|
||||
}
|
||||
super(table_names)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -24,7 +24,7 @@ Available options:
|
||||
Example:
|
||||
rake redmine:dmsf_alert_approvals RAILS_ENV="production"
|
||||
END_DESC
|
||||
require File.expand_path(File.dirname(__FILE__) + "/../../../../config/environment")
|
||||
require File.expand_path(File.dirname(__FILE__) + '/../../../../config/environment')
|
||||
|
||||
class DmsfAlertApprovals
|
||||
|
||||
|
||||
@ -34,36 +34,36 @@ require File.expand_path(File.dirname(__FILE__) + "/../../../../config/environme
|
||||
class DmsfConvertDocuments
|
||||
|
||||
def self.convert(options={})
|
||||
dry = options[:dry] ? options[:dry] == "true" : false
|
||||
replace = options[:invalid] ? options[:invalid] == "replace" : false
|
||||
dry = options[:dry] ? options[:dry] == 'true' : false
|
||||
replace = options[:invalid] ? options[:invalid] == 'replace' : false
|
||||
|
||||
projects = options[:project] ? [Project.find(options[:project])] : Project.find(:all)
|
||||
|
||||
projects.reject! {|project| project.module_enabled?("dmsf") }
|
||||
projects.reject! {|project| !project.module_enabled?("documents") }
|
||||
projects.reject! {|project| project.module_enabled?('dmsf') }
|
||||
projects.reject! {|project| !project.module_enabled?('documents') }
|
||||
|
||||
unless projects.nil? || projects.empty?
|
||||
projects.each do |project|
|
||||
puts "Processing project: " + project.identifier
|
||||
puts "Processing project: #{project.identifier}"
|
||||
|
||||
project.enabled_module_names = (project.enabled_module_names << "dmsf").uniq unless dry
|
||||
project.enabled_module_names = (project.enabled_module_names << 'dmsf').uniq unless dry
|
||||
project.save! unless dry
|
||||
|
||||
fail = false
|
||||
folders = []
|
||||
project.documents.each do |document|
|
||||
puts "Processing document: " + document.title
|
||||
puts "Processing document: #{document.title}"
|
||||
|
||||
folder = DmsfFolder.new
|
||||
|
||||
folder.project = project
|
||||
folder.user = (a = document.attachments.find(:first, :order => "created_on ASC")) ? a.author : User.find(:first)
|
||||
folder.user = (a = document.attachments.find(:first, :order => 'created_on ASC')) ? a.author : User.find(:first)
|
||||
|
||||
folder.title = document.title
|
||||
folder.title.gsub!(/[\/\\\?":<>]/,"-") if replace
|
||||
folder.title.gsub!(/[\/\\\?":<>]/, '-') if replace
|
||||
|
||||
i = 1
|
||||
suffix = ""
|
||||
suffix = ''
|
||||
while folders.index{|f| f.title == (folder.title + suffix)}
|
||||
i+=1
|
||||
suffix = "_#{i}"
|
||||
@ -73,16 +73,16 @@ class DmsfConvertDocuments
|
||||
folder.description = document.description
|
||||
|
||||
if dry
|
||||
puts "Dry check folder: " + folder.title
|
||||
puts "Dry check folder: #{folder.title}"
|
||||
if folder.invalid?
|
||||
folder.errors.each {|e,msg| puts "#{e}: #{msg}"}
|
||||
end
|
||||
else
|
||||
begin
|
||||
folder.save!
|
||||
puts "Created folder: " + folder.title
|
||||
puts "Created folder: #{folder.title}"
|
||||
rescue Exception => e
|
||||
puts "Creating folder: " + folder.title + " failed"
|
||||
puts "Creating folder: #{folder.title} failed"
|
||||
puts e
|
||||
fail = true
|
||||
next
|
||||
@ -91,8 +91,7 @@ class DmsfConvertDocuments
|
||||
|
||||
folders << folder;
|
||||
|
||||
files = []
|
||||
failed_files = []
|
||||
files = []
|
||||
document.attachments.each do |attachment|
|
||||
begin
|
||||
file = DmsfFile.new
|
||||
@ -112,13 +111,13 @@ class DmsfConvertDocuments
|
||||
file.name = DmsfFileRevision.remove_extension(file.name) + suffix + File.extname(file.name)
|
||||
|
||||
unless File.exist?(attachment.diskfile)
|
||||
puts "Creating file: " + attachment.filename + " failed, attachment file doesn't exist"
|
||||
puts "Creating file: #{attachment.filename} failed, attachment file doesn't exist"
|
||||
fail = true
|
||||
next
|
||||
end
|
||||
|
||||
if dry
|
||||
puts "Dry check file: " + file.name
|
||||
puts "Dry check file: #{file.name}"
|
||||
if file.invalid?
|
||||
file.errors.each {|e,msg| puts "#{e}: #{msg}"}
|
||||
end
|
||||
@ -138,14 +137,14 @@ class DmsfConvertDocuments
|
||||
revision.updated_at = attachment.created_on
|
||||
revision.major_version = 0
|
||||
revision.minor_version = 1
|
||||
revision.comment = "Converted from documents"
|
||||
revision.comment = 'Converted from documents'
|
||||
revision.mime_type = attachment.content_type
|
||||
|
||||
revision.disk_filename = revision.new_storage_filename
|
||||
attachment_file = File.open(attachment.diskfile, "rb")
|
||||
attachment_file = File.open(attachment.diskfile, 'rb')
|
||||
|
||||
unless dry
|
||||
File.open(revision.disk_file, "wb") do |f|
|
||||
File.open(revision.disk_file, 'wb') do |f|
|
||||
while (buffer = attachment_file.read(8192))
|
||||
f.write(buffer)
|
||||
end
|
||||
@ -156,7 +155,7 @@ class DmsfConvertDocuments
|
||||
attachment_file.close
|
||||
|
||||
if dry
|
||||
puts "Dry check revision: " + revision.title
|
||||
puts "Dry check revision: #{revision.title}"
|
||||
if revision.invalid?
|
||||
revision.errors.each {|e,msg| puts "#{e}: #{msg}"}
|
||||
end
|
||||
@ -168,9 +167,9 @@ class DmsfConvertDocuments
|
||||
|
||||
attachment.destroy unless dry
|
||||
|
||||
puts "Created file: " + file.name unless dry
|
||||
puts "Created file: #{file.name}" unless dry
|
||||
rescue Exception => e
|
||||
puts "Creating file: " + attachment.filename + " failed"
|
||||
puts "Creating file: #{attachment.filename} failed"
|
||||
puts e
|
||||
fail = true
|
||||
end
|
||||
@ -179,7 +178,7 @@ class DmsfConvertDocuments
|
||||
document.destroy unless dry || fail
|
||||
|
||||
end
|
||||
project.enabled_module_names = project.enabled_module_names.reject {|mod| mod == "documents"} unless dry || fail
|
||||
project.enabled_module_names = project.enabled_module_names.reject {|mod| mod == 'documents'} unless dry || fail
|
||||
project.save! unless dry
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user