diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index aacb32990..42fd40606 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -99,6 +99,7 @@ class FilesController < ApplicationController
end
def index
+ @flag = params[:flag] || false
#sort_init 'filename', 'asc'
sort_init 'created_on', 'desc'
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index f83580fba..4f84212b4 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -334,8 +334,7 @@ class ProjectsController < ApplicationController
end
def send_mail_to_member
-
- if !params[:mail].nil? && User.find_by_mail(params[:mail].to_s).nil?
+ if !params[:mail].blank? && User.find_by_mail(params[:mail].to_s).nil?
email = params[:mail]
Mailer.send_invite_in_project(email, @project, User.current).deliver
@is_zhuce =false
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 30b2e7a21..a36f4b183 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1198,6 +1198,17 @@ module ApplicationHelper
html_safe
end
+ def wiki_simple_format_without_paragraph(text)
+ text.to_s.
+ gsub(/\r\n?/, "\n"). # \r\n and \r -> \n
+ gsub(/\n\n+/, "
"). # 2+ newline -> 2 br
+ gsub(/([^\n]\n)(?=[^\n])/, '\1
'). # 1 newline -> br
+ gsub(" ", " "). #gsub(/<\/?.*?>/,"").
+ gsub(/<\/?.*?>/, "").
+ gsub(""", "'").
+ html_safe
+ end
+
def lang_options_for_select(blank=true)
{ 'Chinese简体中文 '=> 'zh', :English => :en}
end
diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb
index aace20e6c..9eff409ff 100644
--- a/app/helpers/files_helper.rb
+++ b/app/helpers/files_helper.rb
@@ -48,7 +48,7 @@ module FilesHelper
def courses_check_box_tags(name,courses,current_course,attachment)
s = ''
courses.each do |course|
- if !(attachment.container_type && attachment.container_id == course.id) && is_course_teacher(User.current,course) && course_in_current_or_next_term(course)
+ if !course_contains_attachment?(course,attachment) && is_course_teacher(User.current,course) && course_in_current_or_next_term(course)
s << " [#{get_course_term course}]
"
end
end
diff --git a/app/views/files/_project_file.html.erb b/app/views/files/_project_file.html.erb
index e204030f1..aa597f3f2 100644
--- a/app/views/files/_project_file.html.erb
+++ b/app/views/files/_project_file.html.erb
@@ -11,7 +11,7 @@
<%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @project) %>
<%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %>