diff --git a/app/controllers/dmsf_files_controller.rb b/app/controllers/dmsf_files_controller.rb index f87fed4c..acc0b6a2 100644 --- a/app/controllers/dmsf_files_controller.rb +++ b/app/controllers/dmsf_files_controller.rb @@ -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 diff --git a/app/controllers/dmsf_files_copy_controller.rb b/app/controllers/dmsf_files_copy_controller.rb index 016d0402..ecfb3a4f 100644 --- a/app/controllers/dmsf_files_copy_controller.rb +++ b/app/controllers/dmsf_files_copy_controller.rb @@ -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 diff --git a/app/controllers/dmsf_folders_copy_controller.rb b/app/controllers/dmsf_folders_copy_controller.rb index 19697e35..d5e3306d 100644 --- a/app/controllers/dmsf_folders_copy_controller.rb +++ b/app/controllers/dmsf_folders_copy_controller.rb @@ -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 diff --git a/app/controllers/dmsf_state_controller.rb b/app/controllers/dmsf_state_controller.rb index b1dd41f8..ef292491 100644 --- a/app/controllers/dmsf_state_controller.rb +++ b/app/controllers/dmsf_state_controller.rb @@ -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 diff --git a/app/controllers/dmsf_upload_controller.rb b/app/controllers/dmsf_upload_controller.rb index d85e8557..db3ef456 100644 --- a/app/controllers/dmsf_upload_controller.rb +++ b/app/controllers/dmsf_upload_controller.rb @@ -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), diff --git a/app/helpers/dmsf_helper.rb b/app/helpers/dmsf_helper.rb index a70628d2..384b4229 100644 --- a/app/helpers/dmsf_helper.rb +++ b/app/helpers/dmsf_helper.rb @@ -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 diff --git a/app/models/dmsf_file_revision_access.rb b/app/models/dmsf_file_revision_access.rb index 4bc7ba5e..e644d250 100644 --- a/app/models/dmsf_file_revision_access.rb +++ b/app/models/dmsf_file_revision_access.rb @@ -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 diff --git a/app/models/dmsf_lock.rb b/app/models/dmsf_lock.rb index 2e308fe8..c58f59d9 100644 --- a/app/models/dmsf_lock.rb +++ b/app/models/dmsf_lock.rb @@ -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 diff --git a/app/models/dmsf_mailer.rb b/app/models/dmsf_mailer.rb index 7b0bd73c..5d3d9ed3 100644 --- a/app/models/dmsf_mailer.rb +++ b/app/models/dmsf_mailer.rb @@ -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 diff --git a/app/views/dmsf/_multi_upload.html.erb b/app/views/dmsf/_multi_upload.html.erb index 9331b77c..79157aee 100644 --- a/app/views/dmsf/_multi_upload.html.erb +++ b/app/views/dmsf/_multi_upload.html.erb @@ -18,142 +18,140 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%>
-
-<%= file_field_tag("uploaded_files[1]", :size => 30, :id => nil) %>
-
-
-<%= 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) %>)
-
-
+
+ <%= file_field_tag('uploaded_files[1]', :size => 30, :id => nil) %>
+
+
+ <%= 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) %>)
+
+
- <%= label_tag("dmsf_folder_title", l(:label_title) + ":") %> - <%= f.text_field(:title, :size => "32", :required => true) %> -
-- <%= 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))) - %> -
-- <%= label_tag("dmsf_folder_description", l(:label_description) + ":") %> -
-<%= custom_field_tag_with_label(:dmsf_folder, value) %>
- <% end %> -+ <%= label_tag('dmsf_folder_title', "#{l(:label_title)}:") %> + <%= f.text_field(:title, :size => '32', :required => true) %> +
++ <%= 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))) + %> +
++ <%= label_tag('dmsf_folder_description', "#{l(:label_description)}:") %> +
+<%= custom_field_tag_with_label(:dmsf_folder, value) %>
+ <% end %> +- <%= label_tag("", l(:label_email_from) + ":") %> - <%= h(User.current.mail) %> -
-- <%= label_tag("email[to]", l(:label_email_to) + ":") %> - <%= text_field_tag("email[to]", @email_params["to"], :style => "width: 90%;") %> -
-- <%= label_tag("email[cc]", l(:label_email_cc) + ":") %> - <%= text_field_tag("email[cc]", @email_params["cc"], :style => "width: 90%;") %> -
-- <%= label_tag("email[subject]", l(:label_email_subject) + ":") %> - <%= text_field_tag("email[subject]", @email_params["subject"], :style => "width: 90%;") %> -
-- <%= label_tag("", l(:label_email_documents) + ":") %> - Documents.zip - <%= hidden_field_tag("email[zipped_content]", @email_params["zipped_content"]) %> -
-- <%= label_tag("email[body]", l(:label_email_body) + ":") %> - <%= text_area_tag("email[body]", @email_params["body"], :rows=> "20", :style => "width: 90%;") %> -
-<%= submit_tag(l(:label_email_send)) %>
-+ <%= label_tag('', "#{l(:label_email_from)}:") %> + <%= h(User.current.mail) %> +
++ <%= label_tag('email[to]', "#{l(:label_email_to)}:") %> + <%= text_field_tag('email[to]', @email_params['to'], :style => 'width: 90%;') %> +
++ <%= label_tag('email[cc]', "#{l(:label_email_cc)}:") %> + <%= text_field_tag('email[cc]', @email_params['cc'], :style => 'width: 90%;') %> +
++ <%= label_tag('email[subject]', "#{l(:label_email_subject)}:") %> + <%= text_field_tag('email[subject]', @email_params['subject'], :style => 'width: 90%;') %> +
++ <%= label_tag('', "#{l(:label_email_documents)}:") %> + Documents.zip + <%= hidden_field_tag('email[zipped_content]', @email_params['zipped_content']) %> +
++ <%= label_tag('email[body]', "#{l(:label_email_body)}:") %> + <%= text_area_tag('email[body]', @email_params['body'], :rows=> '20', :style => 'width: 90%;') %> +
+<%= submit_tag(l(:label_email_send)) %>
+- - <%= select_tag("target_project_id", - project_tree_options_for_select(DmsfFile.allowed_target_projects_on_copy, :selected => @target_project)) %> -
-- <%= 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?))) %> -
-+ + <%= select_tag('target_project_id', + project_tree_options_for_select(DmsfFile.allowed_target_projects_on_copy, :selected => @target_project)) %> +
++ <%= 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))) %> +
+- - <%= select_tag("target_project_id", - project_tree_options_for_select(DmsfFolder.allowed_target_projects_on_copy, :selected => @target_project)) %> -
-- <%= 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?))) %> -
-+ + <%= select_tag('target_project_id', + project_tree_options_for_select(DmsfFolder.allowed_target_projects_on_copy, :selected => @target_project)) %> +
++ <%= 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))) %> +
+
- <%= 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? %>
-
<%= h(file.last_revision.comment) %>
- <% 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? %>
+
<%= h(file.last_revision.comment) %>
+ <% end %>
Dear <%= @user.name %>,
+<%= @user.name %>,
<%= @text1 %>
diff --git a/app/views/dmsf_mailer/workflow_notification.text.erb b/app/views/dmsf_mailer/workflow_notification.text.erb index 87235d3a..17fa7989 100644 --- a/app/views/dmsf_mailer/workflow_notification.text.erb +++ b/app/views/dmsf_mailer/workflow_notification.text.erb @@ -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) %>. diff --git a/app/views/dmsf_upload/_upload_file_locked.html.erb b/app/views/dmsf_upload/_upload_file_locked.html.erb index 8248bbc8..10cdd406 100644 --- a/app/views/dmsf_upload/_upload_file_locked.html.erb +++ b/app/views/dmsf_upload/_upload_file_locked.html.erb @@ -18,45 +18,45 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%><%= l(:info_file_locked) %>
- -- <%= label_tag("", l(:label_title) + ":") %> - <%= h(upload.title) %> -
-- <%= label_tag("", l(:label_filename) + ":") %> - <%= h(upload.name) %> -
-- <%= label_tag("", l(:label_description) + ":") %> -
-- <%= label_tag("", l(:label_version) + ":") %> - <%= upload.major_version %>.<%= upload.minor_version %> -
-- <%= label_tag("", l(:label_mime) + ":") %> - <%= h(upload.mime_type) %> -
-- <%= label_tag("", l(:label_size) + ":") %> - <%= number_to_human_size(upload.size) %> -
-<%= l(:info_file_locked) %>
+ ++ <%= label_tag('', "#{l(:label_title)}:") %> + <%= h(upload.title) %> +
++ <%= label_tag('', "#{l(:label_filename)}:") %> + <%= h(upload.name) %> +
++ <%= label_tag('', "#{l(:label_description)}:") %> +
++ <%= label_tag('', "#{l(:label_version)}:") %> + <%= upload.major_version %>.<%= upload.minor_version %> +
++ <%= label_tag('', "#{l(:label_mime)}:") %> + <%= h(upload.mime_type) %> +
++ <%= label_tag('', "#{l(:label_size)}:") %> + <%= number_to_human_size(upload.size) %> +
+
- <%=content_tag(:label, l(:label_maximum_files_upload) + ":") %>
- <%=text_field_tag "settings[dmsf_max_file_upload]", @settings["dmsf_max_file_upload"], :size=>10 %>
- (<%=l(:label_default)%>: 0)
-
- <%= l(:note_maximum_number_of_files_uploaded) %>
-
- <%=content_tag(:label, l(:label_maximum_files_download) + ":") %>
- <%=text_field_tag "settings[dmsf_max_file_download]", @settings["dmsf_max_file_download"], :size=>10 %>
- (<%=l(:label_default)%>: 0)
-
- <%= l(:note_maximum_number_of_files_downloaded) %>
-
- <%=content_tag(:label, l(:label_maximum_email_filesize) + ":") %>
- <%=text_field_tag "settings[dmsf_max_email_filesize]", @settings["dmsf_max_email_filesize"], :size=>10 %>
- (<%=l(:label_default)%>: 0)
-
- <%= l(:note_maximum_email_filesize) %>
-
- <%=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 %>
- (<%=l(:label_default)%>: <%="#{Rails.root}/files/dmsf"%>)
-
<%= l(:error_file_storage_directory_does_not_exist) %>
-<% end - end %> -<% testfilename = "#{storage_dir}/test.test" - if File.exists?(storage_dir) - begin - File.open(testfilename, "wb") do |file| - end - rescue %> -<%= l(:error_file_can_not_be_created) %>
-<% ensure - File.delete(testfilename) if File.exists?(testfilename) - end - end %> - -
- <%=content_tag(:label, l(:label_physical_file_delete) + ":") %>
- <%= check_box_tag("settings[dmsf_really_delete_files]", true, @settings["dmsf_really_delete_files"]) %>
- (<%=l(:label_default)%>: <%=l(:general_text_No)%>)
-
- <%=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"])) %>
- (<%=l(:label_default)%>: <%=l(:select_option_deactivated)%>)
-
- <%=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"])) %>
- (<%=l(:label_default)%>: <%=l(:select_option_activated)%>)
-
- <%= l(:note_webdav).html_safe %>
-
- <%=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"])) %>
- (<%=l(:label_default)%>: <%=l(:select_option_webdav_readonly)%>)
-
- <%= l(:note_webdav_strategy).html_safe %>
-
<%= l(:warning_xapian_not_available) %>
-<% xapian_disabled = true - end %> - -
- <%=content_tag(:label, l(:label_index_database) + ":") %>
- <%=text_field_tag 'settings[dmsf_index_database]', @settings['dmsf_index_database'], :disabled => xapian_disabled, :size=>50 %>
- (<%=l(:label_default)%>: <%="#{Rails.root}/files/dmsf_index"%>)
-
- <%=content_tag(:label, l(:label_stemming_language) + ":") %>
- <%=text_field_tag 'settings[dmsf_stemming_lang]', @settings['dmsf_stemming_lang'], :disabled => xapian_disabled %>
- (<%=l(:label_default)%>: english )
-
- <%=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)%>)
-
- <%=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)%>
- <%=radio_button_tag 'settings[dmsf_stemming_strategy]', 'STEM_SOME', @settings['dmsf_stemming_strategy'] == 'STEM_SOME', :disabled => xapian_disabled %> <%=l(:option_stem_some)%>
- <%=radio_button_tag 'settings[dmsf_stemming_strategy]', 'STEM_ALL', @settings['dmsf_stemming_strategy'] == 'STEM_ALL', :disabled => xapian_disabled %> <%=l(:option_stem_all)%>
-
- <%=l(:label_stemming_description)%>:
-
- STEM_NONE: <%=l(:note_do_not_stem)%>
- STEM_SOME: <%=l(:note_stem_some)%>
- STEM_ALL: <%=l(:note_stem_all)%>
-
- <%=l(:note_stemming_applied)%>
-
+ <%= content_tag(:label, "#{l(:label_maximum_files_upload)}:") %>
+ <%= text_field_tag 'settings[dmsf_max_file_upload]', @settings['dmsf_max_file_upload'], :size => 10 %>
+ (<%= l(:label_default) %>: 0)
+
+ <%= l(:note_maximum_number_of_files_uploaded) %>
+
+ <%= content_tag(:label, "#{l(:label_maximum_files_download)}:") %>
+ <%= text_field_tag 'settings[dmsf_max_file_download]', @settings['dmsf_max_file_download'], :size => 10 %>
+ (<%= l(:label_default) %>: 0)
+
+ <%= l(:note_maximum_number_of_files_downloaded) %>
+
+ <%= content_tag(:label, "#{l(:label_maximum_email_filesize)}:") %>
+ <%= text_field_tag 'settings[dmsf_max_email_filesize]', @settings['dmsf_max_email_filesize'], :size => 10 %>
+ (<%= l(:label_default) %>: 0)
+
+ <%= l(:note_maximum_email_filesize) %>
+
+ <%= 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 %>
+ (<%= l(:label_default) %>: <%= "#{Rails.root}/files/dmsf" %>)
+
<%= l(:error_file_storage_directory_does_not_exist) %>
+ <% end %> +<% end %> +<% testfilename = "#{storage_dir}/test.test" %> +<% if File.exists?(storage_dir) %> + <% begin %> + <% File.open(testfilename, 'wb') do |file| %> + <% end %> + <% rescue %> +<%= l(:error_file_can_not_be_created) %>
+ <% ensure %> + <% File.delete(testfilename) if File.exists?(testfilename) %> + <% end %> +<% end %> + +
+ <%= content_tag(:label, "#{l(:label_physical_file_delete)}:") %>
+ <%= check_box_tag('settings[dmsf_really_delete_files]', true, @settings['dmsf_really_delete_files']) %>
+ (<%=l(:label_default)%>: <%=l(:general_text_No)%>)
+
+ <%= 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'])) %>
+ (<%= l(:label_default) %>: <%= l(:select_option_deactivated) %>)
+
+ <%= 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'])) %>
+ (<%= l(:label_default) %>: <%= l(:select_option_activated) %>)
+
+ <%= l(:note_webdav).html_safe %>
+
+ <%= 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'])) %>
+ (<%= l(:label_default) %>: <%= l(:select_option_webdav_readonly) %>)
+
+ <%= l(:note_webdav_strategy).html_safe %>
+
<%= l(:warning_xapian_not_available) %>
+ <% xapian_disabled = true %> +<% end %> + +
+ <%= content_tag(:label, "#{l(:label_index_database)}:") %>
+ <%= text_field_tag 'settings[dmsf_index_database]', @settings['dmsf_index_database'], :disabled => xapian_disabled, :size => 50 %>
+ (<%= l(:label_default) %>: <%= "#{Rails.root}/files/dmsf_index" %>)
+
+ <%= content_tag(:label, "#{l(:label_stemming_language)}:") %>
+ <%= text_field_tag 'settings[dmsf_stemming_lang]', @settings['dmsf_stemming_lang'], :disabled => xapian_disabled %>
+ (<%= l(:label_default)%>: english )
+
+ <%= 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) %>)
+ <%= 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) %>
+ <%= radio_button_tag 'settings[dmsf_stemming_strategy]', 'STEM_SOME', @settings['dmsf_stemming_strategy'] == 'STEM_SOME', :disabled => xapian_disabled %> <%= l(:option_stem_some) %>
+ <%= radio_button_tag 'settings[dmsf_stemming_strategy]', 'STEM_ALL', @settings['dmsf_stemming_strategy'] == 'STEM_ALL', :disabled => xapian_disabled %> <%= l(:option_stem_all) %>
+
+ <%= l(:label_stemming_description) %>:
+
+ STEM_NONE: <%=l(:note_do_not_stem) %>
+ STEM_SOME: <%=l(:note_stem_some) %>
+ STEM_ALL: <%=l(:note_stem_all) %>
+
+ <%= l(:note_stemming_applied) %>
+