diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb
index ee95277ce..811b19ad6 100644
--- a/app/controllers/homework_attach_controller.rb
+++ b/app/controllers/homework_attach_controller.rb
@@ -473,8 +473,10 @@ class HomeworkAttachController < ApplicationController
#保存评论
@is_comprehensive_evaluation = @is_teacher ? 1 : (@is_anonymous_comments ? 2 : 3) #判断当前评论是老师评论?匿评?留言
- if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" #有没有留言
- @homework.addjours User.current.id, params[:new_form][:user_message],0,@is_comprehensive_evaluation
+ if params[:new_form] && params[:new_form][:user_message] #有没有留言
+ @homework.addjours(User.current.id, params[:new_form][:user_message],0,@is_comprehensive_evaluation) if @is_teacher
+ else
+ @homework.addjours User.current.id, "",0,@is_comprehensive_evaluation if @is_teacher
end
@teacher_stars = @stars_reates.where("is_teacher_score = 1") #老师评分列表
diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb
index c1695e384..94a5a8194 100644
--- a/app/controllers/zipdown_controller.rb
+++ b/app/controllers/zipdown_controller.rb
@@ -180,6 +180,8 @@ class ZipdownController < ApplicationController
def zipping(zip_name_refer, files_paths, output_path, is_attachment=false, not_exist_file=[])
+ ic = Iconv.new('GBK//IGNORE', 'UTF-8//IGNORE')
+
rename_zipfile = zip_name_refer ||= "#{Time.now.to_i.to_s}.zip"
zipfile_name = "#{output_path}/#{rename_zipfile}"
Zip.unicode_names = true
@@ -187,8 +189,9 @@ class ZipdownController < ApplicationController
Dir.mkdir(File.dirname(zipfile_name)) unless File.exist?(File.dirname(zipfile_name))
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
files_paths.each do |filename|
- rename_file = File.basename(filename)
- rename_file = filename_to_real( File.basename(filename)) if is_attachment
+ rename_file = ic.iconv( (File.basename(filename)) ).to_s
+ rename_file = ic.iconv( filename_to_real( File.basename(filename))).to_s if is_attachment
+
begin
zipfile.add(rename_file, filename)
rescue Exception => e
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index fed074bdb..3feb49547 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -329,7 +329,7 @@ module ApplicationHelper
imagesize = attachment.thumbnail(:size => "50*50")
imagepath = named_attachment_path(attachment, attachment.filename)
if imagesize
- link_to image_tag(thumbnail_path(attachment,"50")),
+ link_to image_tag(thumbnail_path(attachment), height: '73', width: '100'),
imagepath,
:title => attachment.filename
else
diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb
index 396501862..0a6944e3b 100644
--- a/app/models/journals_for_message.rb
+++ b/app/models/journals_for_message.rb
@@ -56,7 +56,7 @@ class JournalsForMessage < ActiveRecord::Base
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
- validates :notes, presence: true
+ validates :notes, presence: true, if: :is_homework_jour?
after_create :act_as_activity #huang
after_create :reset_counters!
after_destroy :reset_counters!
@@ -88,6 +88,10 @@ class JournalsForMessage < ActiveRecord::Base
self.find(message_id).destroy
# self.destroy_all "id = #{message_id}"
end
+
+ def is_homework_jour?
+ self.jour_type != "HomeworkAttach"
+ end
def reference_user
User.find(reply_id)
diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb
index 7b2acd875..1769b1a45 100644
--- a/app/views/files/_course_file.html.erb
+++ b/app/views/files/_course_file.html.erb
@@ -62,11 +62,11 @@
上传:
- 课件 |
- 软件 |
- 媒体 |
- 代码 |
- 其他
+ 课件 |
+ 软件 |
+ 媒体 |
+ 代码 |
+ 其他
<% end %>
diff --git a/app/views/homework_attach/_review.html.erb b/app/views/homework_attach/_review.html.erb
index 1666d8a43..921f16c8e 100644
--- a/app/views/homework_attach/_review.html.erb
+++ b/app/views/homework_attach/_review.html.erb
@@ -36,7 +36,8 @@
<% end %>
- <%= textilizable jour.nil? ? "" : jour.notes%>
+ <% notes = textilizable(jour.nil? ? "" : jour.notes)%>
+ <%= notes.empty? ? "".html_safe : notes%>
<% unless jour.nil? %>
<% ids = 'project_respond_form_'+ jour.id.to_s%>
diff --git a/app/views/homework_attach/new.html.erb b/app/views/homework_attach/new.html.erb
index 8697ff7ab..cf182716e 100644
--- a/app/views/homework_attach/new.html.erb
+++ b/app/views/homework_attach/new.html.erb
@@ -72,7 +72,7 @@
<%= f.text_field "name", :required => true, :size => 60, :class => "w430 bo", :maxlength => 254, :placeholder => "作品名称", :onkeyup => "regexName();" %>
-
+
<%= f.text_area "description", :class => "w620", :maxlength => 3000, :style => "width:430px", :placeholder => "最多3000个汉字", :onkeyup => "regexDescription();"%>
-
-
+
-
-
-
- <%= render :partial => 'attachments/form' %>
-
+
+
+ 添加附件 :
+
+ <%= render :partial => 'attachments/form' %>
+
+