This commit is contained in:
sw 2015-07-03 16:09:21 +08:00
commit e44cecaa23
28 changed files with 236 additions and 81 deletions

View File

@ -336,6 +336,19 @@ module Mobile
student_works = cs.student_work_list params,current_user student_works = cs.student_work_list params,current_user
present :data,student_works.all,with:Mobile::Entities::StudentWork present :data,student_works.all,with:Mobile::Entities::StudentWork
end end
desc '开启匿评'
params do
requires :token,type:String
requires :course_id,type:Integer,desc:'课程id'
requires :homework_id,type:Integer,desc:'作业id'
end
get ':course_id/start_anonymous_comment' do
cs = CoursesService.new
status = cs.start_anonymous_comment params,current_user
present :data,status
present :status,0
end
end end
end end
end end

View File

@ -14,9 +14,10 @@ module Mobile
f.send(field) f.send(field)
end end
else else
#case field case field
# when "" when :file_dir
#end "attachments/download/" << f.send(:id).to_s << '/'
end
end end
end end
end end
@ -27,6 +28,7 @@ module Mobile
attachment_expose :downloads attachment_expose :downloads
attachment_expose :quotes attachment_expose :quotes
attachment_expose :created_on attachment_expose :created_on
attachment_expose :file_dir
end end
end end
end end

View File

@ -28,6 +28,8 @@ module Mobile
get_homework_status f get_homework_status f
when :homework_times when :homework_times
f.course.homework_commons.index(f) + 1 f.course.homework_commons.index(f) + 1
when :homework_status_desc
homework_status_desc f
end end
end end
end end
@ -80,7 +82,8 @@ module Mobile
expose :submit_student_list ,using: Mobile::Entities::User do |f,opt| expose :submit_student_list ,using: Mobile::Entities::User do |f,opt|
get_submit_sutdent_list f get_submit_sutdent_list f
end end
homework_expose :homework_status homework_expose :homework_status #作业的状态
homework_expose :homework_status_desc #状态的解释
end end
end end

View File

@ -6,6 +6,7 @@ class ActivityNotifysController < ApplicationController
# accept_rss_auth :index, :show # accept_rss_auth :index, :show
helper :activities helper :activities
helper :attachments
def index def index
query = nil query = nil
if @course if @course

View File

@ -34,6 +34,20 @@ class CommentsController < ApplicationController
ids = params[:asset_id].split(',') ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,@comment.id,OwnerTypeHelper::COMMENT update_kindeditor_assets_owner ids,@comment.id,OwnerTypeHelper::COMMENT
end end
# 与我相关动态的记录add start
if( @comment.id && @news.course )
if(@news.author_id != User.current.id)
notify = ActivityNotify.new()
notify.activity_container_id = @news.course.id
notify.activity_container_type = 'Course'
notify.activity_id = @comment.id
notify.activity_type = 'Comment'
notify.notify_to = @news.author_id
notify.is_read = 0
notify.save()
end
end
# 与我相关动态的记录add end
flash[:notice] = l(:label_comment_added) flash[:notice] = l(:label_comment_added)
end end

View File

@ -74,7 +74,7 @@ class JournalsController < ApplicationController
text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]') text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
@content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> " @content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> "
@content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
@content = "<blockquote style='word-break: break-all;word-wrap: break-word;'>" << @content # @content = "<blockquote style='word-break: break-all;word-wrap: break-word;'>" << @content
@id = user.id @id = user.id
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render_404 render_404

View File

@ -141,6 +141,21 @@ class NewsController < ApplicationController
ids = params[:asset_id].split(',') ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS
end end
# 与我相关动态的记录add start
teachers = searchTeacherAndAssistant(@course)
for teacher in teachers
if(teacher.user_id != User.current.id)
notify = ActivityNotify.new()
notify.activity_container_id = @course.id
notify.activity_container_type = 'Course'
notify.activity_id = @news.id
notify.activity_type = 'News'
notify.notify_to = teacher.user_id
notify.is_read = 0
notify.save()
end
end
# 与我相关动态的记录add end
render_attachment_warning_if_needed(@news) render_attachment_warning_if_needed(@news)
flash[:notice] = l(:notice_successful_create) flash[:notice] = l(:notice_successful_create)
redirect_to course_news_index_url(@course) redirect_to course_news_index_url(@course)

View File

@ -89,6 +89,29 @@ module ApiHelper
homework_status homework_status
end end
#获取作业的是否可以匿评的描述
def homework_status_desc homework
if homework.homework_type == 1 && homework.homework_detail_manual #匿评作业
if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
link = "<span class='fr mr10 pr_join_span ' title='作业截止日期之前不可以启动匿评'>启动匿评</span>".html_safe
elsif homework.student_works.count >= 2 #作业份数大于2
case homework.homework_detail_manual.comment_status
when 1
link = '启动匿评'
when 2
link = '关闭匿评'
when 3
link = " 匿评结束"
end
else
link = "学生提交作业数大于2时才可以启动匿评"
end
else
link = "未开启匿评作业不可以启动匿评"
end
link
end
#获取 #获取
def get_submit_sutdent_list homework def get_submit_sutdent_list homework
studentlist = [] studentlist = []
@ -104,6 +127,11 @@ module ApiHelper
#计算作业的截止日期,剩余日期 #计算作业的截止日期,剩余日期
def show_homework_deadline homework def show_homework_deadline homework
"距作业截止还有" << (Date.parse(Time.now.to_s) - Date.parse(homework.end_time.to_s)).to_i.to_s << "" day = 0
if (day = (Date.parse(homework.end_time.to_s) - Date.parse(Time.now.to_s)).to_i) > 0
"距作业截止还有" << (Date.parse(Time.now.to_s) - Date.parse(homework.end_time.to_s)).to_i.to_s << ""
else
"已截止,但可补交"
end
end end
end end

View File

@ -19,6 +19,14 @@ class Comment < ActiveRecord::Base
include Redmine::SafeAttributes include Redmine::SafeAttributes
include ApplicationHelper include ApplicationHelper
has_many_kindeditor_assets :assets, :dependent => :destroy has_many_kindeditor_assets :assets, :dependent => :destroy
has_many :ActivityNotifies,:as => :activity, :dependent => :destroy
acts_as_event :datetime => :updated_on,
:description => :comments,
:type => 'news',
:title=>Proc.new {|o| "RE: #{o.commented.title}" },
:url => Proc.new {|o| {:controller => 'news', :action => 'show', :id => o.commented.id} }
belongs_to :commented, :polymorphic => true, :counter_cache => true belongs_to :commented, :polymorphic => true, :counter_cache => true
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
validates_presence_of :commented, :author, :comments validates_presence_of :commented, :author, :comments
@ -38,4 +46,17 @@ class Comment < ActiveRecord::Base
def delete_kindeditor_assets def delete_kindeditor_assets
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::COMMENT delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::COMMENT
end end
def set_notify_id(notify_id)
@notify_id= notify_id
end
def get_notify_id()
return @notify_id
end
def set_notify_is_read(notify_is_read)
@notify_is_read = notify_is_read
end
def get_notify_is_read()
return @notify_is_read
end
end end

View File

@ -104,13 +104,13 @@ class Mailer < ActionMailer::Base
# 查询user的缺陷项目中成员都能收到 # 查询user的缺陷项目中成员都能收到
sql = "select DISTINCT * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}' sql = "select DISTINCT * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}'
and (i.updated_on between '#{date_from}' and '#{date_to}') order by i.updated_on desc" and (i.updated_on between '#{date_from}' and '#{date_to}') order by i.project_id, i.updated_on desc"
@issues = Issue.find_by_sql(sql) @issues = Issue.find_by_sql(sql)
# issue回复 # issue回复
@issues_journals = Journal.find_by_sql("select j.* from journals j, members m, projects p, issues i @issues_journals = Journal.find_by_sql("select j.* from journals j, members m, projects p, issues i
where m.user_id = '#{user.id}' and p.id = m.project_id and i.project_id = p.id and j.journalized_id = i.id where m.user_id = '#{user.id}' and p.id = m.project_id and i.project_id = p.id and j.journalized_id = i.id
and j.journalized_type='Issue' and (j.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") and j.journalized_type='Issue' and (j.created_on between '#{date_from}' and '#{date_to}') order by i.project_id, created_on desc")
# @bids 查询课程作业包括老师发布的作业以及user提交作业 # @bids 查询课程作业包括老师发布的作业以及user提交作业
# @attachments查询课程课件更新 # @attachments查询课程课件更新
@ -120,17 +120,17 @@ class Mailer < ActionMailer::Base
count = courses.count count = courses.count
count = count - 1 count = count - 1
for i in 0..count do for i in 0..count do
bids = courses[i].homework_commons.where("homework_commons.created_at between '#{date_from}' and '#{date_to}'").order("homework_commons.created_at desc") bids = courses[i].homework_commons.where("homework_commons.created_at between '#{date_from}' and '#{date_to}'").order(" '#{courses[i].id}', homework_commons.created_at desc")
attachments = courses[i].attachments.where("attachments.created_on between '#{date_from}' and '#{date_to}'").order('attachments.created_on DESC') attachments = courses[i].attachments.where("attachments.created_on between '#{date_from}' and '#{date_to}'").order(" '#{courses[i].id}',attachments.created_on DESC' ")
@bids += bids if bids.count > 0 @bids += bids if bids.count > 0
@attachments += attachments if attachments.count > 0 @attachments += attachments if attachments.count > 0
end end
@bids.sort {|a, b| a.created_at <=> b.created_at} # @bids = @bids.sort_by { |obj| obj.created_at }
end end
# 项目附件 # 项目附件
@project_attachments = Attachment.find_by_sql("select DISTINCT a.* from members m, attachments a @project_attachments = Attachment.find_by_sql("select DISTINCT a.* from members m, attachments a
where a.container_id = m.project_id and m.user_id='#{user.id}' and container_type = 'Project' and (a.created_on between '#{date_from}' and '#{date_to}') order by a.created_on desc") where a.container_id = m.project_id and m.user_id='#{user.id}' and container_type = 'Project' and (a.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, a.created_on desc")
# user 提交的作业 # user 提交的作业
# @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc") # @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
@ -138,18 +138,18 @@ class Mailer < ActionMailer::Base
# 查询user所在项目添加wiki # 查询user所在项目添加wiki
@wiki_contents = WikiContent.find_by_sql("select DISTINCT wc.* from wikis w, members m, projects p, wiki_pages wp, wiki_contents wc where @wiki_contents = WikiContent.find_by_sql("select DISTINCT wc.* from wikis w, members m, projects p, wiki_pages wp, wiki_contents wc where
m.user_id = '#{user.id}' and m.project_id = p.id and w.project_id = p.id and w.id = wp.wiki_id and wc.page_id = wp.id and w.project_id>0 m.user_id = '#{user.id}' and m.project_id = p.id and w.project_id = p.id and w.id = wp.wiki_id and wc.page_id = wp.id and w.project_id>0
and (wc.updated_on between '#{date_from}' and '#{date_to}') order by updated_on desc") and (wc.updated_on between '#{date_from}' and '#{date_to}') order by m.project_id, updated_on desc")
# 查询user在课程中发布的讨论帖子 # 查询user在课程中发布的讨论帖子
course_mesages = Message.find_by_sql("select DISTINCT me.* from messages me, boards b, members m where course_mesages = Message.find_by_sql("select DISTINCT me.* from messages me, boards b, members m where
b.id = me.board_id and b.course_id = m.course_id b.id = me.board_id and b.course_id = m.course_id
and b.course_id is not Null and m.user_id = '#{user.id}' and b.course_id is not Null and m.user_id = '#{user.id}'
and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") and (me.created_on between '#{date_from}' and '#{date_to}') order by m.course_id, created_on desc")
# 查询user在项目中发布的讨论帖子 # 查询user在项目中发布的讨论帖子
project_messages = Message.find_by_sql("select DISTINCT me.* from messages me, boards b, members m where project_messages = Message.find_by_sql("select DISTINCT me.* from messages me, boards b, members m where
b.id = me.board_id and b.project_id = m.project_id b.id = me.board_id and b.project_id = m.project_id
and b.project_id != '-1' and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") and b.project_id != '-1' and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, created_on desc")
# messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") # messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
@course_messages ||= [] @course_messages ||= []
@project_messages ||= [] @project_messages ||= []
@ -168,31 +168,31 @@ class Mailer < ActionMailer::Base
# 查询user在课程中发布的通知和回复通知 # 查询user在课程中发布的通知和回复通知
@course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n @course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n
where n.course_id in (#{course_ids}) where n.course_id in (#{course_ids})
and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : [] and (created_on between '#{date_from}' and '#{date_to}') order by n.course_id, created_on desc") : []
@course_news_comments = Comment.find_by_sql("select cm.* from comments cm, members m, courses c, news n @course_news_comments = Comment.find_by_sql("select cm.* from comments cm, members m, courses c, news n
where m.user_id = '#{user.id}' and c.id = m.course_id and n.course_id = c.id and cm.commented_id = n.id where m.user_id = '#{user.id}' and c.id = m.course_id and n.course_id = c.id and cm.commented_id = n.id
and cm.commented_type ='News' and (cm.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") and cm.commented_type ='News' and (cm.created_on between '#{date_from}' and '#{date_to}') order by m.course_id, created_on desc")
# 查询user在项目中添加新闻和回复新闻 # 查询user在项目中添加新闻和回复新闻
@project_news = (project_ids && !project_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n where n.project_id in (#{project_ids}) @project_news = (project_ids && !project_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n where n.project_id in (#{project_ids})
and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : [] and (created_on between '#{date_from}' and '#{date_to}') order by n.project_id, created_on desc") : []
@project_news_comments = Comment.find_by_sql("select c.* from comments c, members m, projects p, news n @project_news_comments = Comment.find_by_sql("select c.* from comments c, members m, projects p, news n
where m.user_id = '#{user.id}' and p.id = m.project_id and n.project_id = p.id and c.commented_id = n.id where m.user_id = '#{user.id}' and p.id = m.project_id and n.project_id = p.id and c.commented_id = n.id
and c.commented_type ='News' and (c.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") and c.commented_type ='News' and (c.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, created_on desc")
# 查询user在课程及个人中留言 # 查询user在课程及个人中留言
@course_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT jfm.* from journals_for_messages jfm, members m, courses c @course_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT jfm.* from journals_for_messages jfm, members m, courses c
where m.user_id = '#{user.id}' and c.id = m.course_id and jfm.jour_id = c.id where m.user_id = '#{user.id}' and c.id = m.course_id and jfm.jour_id = c.id
and jfm.jour_type='Course' and (jfm.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") and jfm.jour_type='Course' and (jfm.created_on between '#{date_from}' and '#{date_to}') order by m.course_id, created_on desc")
@user_journal_messages = user.journals_for_messages.where("jour_type='Principal' and (created_on between '#{date_from}' and '#{date_to}')").order('created_on DESC') @user_journal_messages = user.journals_for_messages.where("jour_type='Principal' and (created_on between '#{date_from}' and '#{date_to}')").order('created_on DESC')
# 查询user在项目中留言用户反馈 # 查询user在项目中留言用户反馈
@project_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT jfm.* from journals_for_messages jfm, members m, projects p @project_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT jfm.* from journals_for_messages jfm, members m, projects p
where m.user_id = '#{user.id}' and p.id = m.project_id and jfm.jour_id = p.id where m.user_id = '#{user.id}' and p.id = m.project_id and jfm.jour_id = p.id
and jfm.jour_type='Project' and (jfm.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") and jfm.jour_type='Project' and (jfm.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, created_on desc")
# 查询user新建贴吧或发布帖子 # 查询user新建贴吧或发布帖子
@forums = Forum.find_by_sql("select DISTINCT * from forums where creator_id = #{user.id} and (created_at between '#{date_from}' and '#{date_to}') order by created_at desc") @forums = Forum.find_by_sql("select DISTINCT * from forums where creator_id = #{user.id} and (created_at between '#{date_from}' and '#{date_to}') order by created_at desc")

View File

@ -9,7 +9,7 @@ class Memo < ActiveRecord::Base
# 若是主题帖,则内容可以是空 # 若是主题帖,则内容可以是空
#validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? } #validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? }
validates_length_of :subject, maximum: 50 validates_length_of :subject, maximum: 50
#validates_length_of :content, maximum: 3072 validates_length_of :content, maximum: 5000
validate :cannot_reply_to_locked_topic, :on => :create validate :cannot_reply_to_locked_topic, :on => :create
acts_as_tree :counter_cache => :replies_count, :order => "#{Memo.table_name}.created_at ASC" acts_as_tree :counter_cache => :replies_count, :order => "#{Memo.table_name}.created_at ASC"

View File

@ -30,6 +30,8 @@ class News < ActiveRecord::Base
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
# end # end
has_many :ActivityNotifies,:as => :activity, :dependent => :destroy
validates_presence_of :title, :description validates_presence_of :title, :description
validates_length_of :title, :maximum => 60 validates_length_of :title, :maximum => 60
validates_length_of :summary, :maximum => 255 validates_length_of :summary, :maximum => 255
@ -85,6 +87,19 @@ class News < ActiveRecord::Base
#description #description
end end
def set_notify_id(notify_id)
@notify_id= notify_id
end
def get_notify_id()
return @notify_id
end
def set_notify_is_read(notify_is_read)
@notify_is_read = notify_is_read
end
def get_notify_is_read()
return @notify_is_read
end
private private
def add_author_as_watcher def add_author_as_watcher

View File

@ -434,24 +434,15 @@ class CoursesService
# 课程课件 # 课程课件
def course_attachments params def course_attachments params
result = [] result = []
@course = Course.find(params[:course_id]) course = Course.find(params[:course_id])
@attachments = @course.attachments.order("created_on desc") attachments = course.attachments.order("created_on ")
if !params[:name].nil? && params[:name] != "" if !params[:name].nil? && params[:name] != ""
@attachments.each do |atta| attachments.each do |atta|
result << {:filename => atta.filename, result << atta if atta.filename.include?(params[:name])
:description => atta.description,
:downloads => atta.downloads,
:quotes => atta.quotes.nil? ? 0 :atta.quotes } if atta.filename.include?(params[:name])
end end
else else
@attachments.each do |atta| result = attachments
result << {:filename => atta.filename,
:description => atta.description,
:downloads => atta.downloads,
:quotes => atta.quotes.nil? ? 0 :atta.quotes }
end
end end
result result
end end
@ -651,9 +642,9 @@ class CoursesService
return return
end end
if current_user == @user || current_user.admin? if current_user == @user || current_user.admin?
membership = @user.coursememberships.page(1).per(10) membership = @user.coursememberships.page(1).per(15)
else else
membership = @user.coursememberships.page(1).per(10).all(:conditions => Course.visible_condition(current_user)) membership = @user.coursememberships.page(1).per(15).all(:conditions => Course.visible_condition(current_user))
end end
if membership.nil? || membership.count == 0 if membership.nil? || membership.count == 0
raise l(:label_no_courses, :locale => get_user_language(current_user)) raise l(:label_no_courses, :locale => get_user_language(current_user))
@ -669,10 +660,11 @@ class CoursesService
dynamics_count = 0 dynamics_count = 0
# 课程学霸 学生总分数排名靠前的5个人 # 课程学霸 学生总分数排名靠前的5个人
homework_count = course.homework_commons.count homework_count = course.homework_commons.count
unless homework_count == 0 sql = "select users.*,sum(IFNULL(0,student_works.final_score))/#{homework_count} score from student_works left outer join users on student_works.user_id = users.id" <<
sql = "select users.*,sum(IFNULL(0,student_works.final_score))/#{homework_count} score from student_works left outer join users on student_works.user_id = users.id" <<
" where homework_common_id in ( select id from homework_commons where homework_commons.course_id = #{course.id}) GROUP BY student_works.user_id ORDER BY score limit 0,6" " where homework_common_id in ( select id from homework_commons where homework_commons.course_id = #{course.id}) GROUP BY student_works.user_id ORDER BY score limit 0,6"
latest_course_dynamics <<{:type=> 6,:time=>Time.now.to_s,:count=> 6,:better_students=> User.find_by_sql(sql)} better_students = User.find_by_sql(sql)
if homework_count != 0 && !better_students.empty?
latest_course_dynamics <<{:type=> 6,:time=>Time.now.to_s,:count=> 6,:better_students=> better_students}
dynamics_count += 1 dynamics_count += 1
end end
# 课程通知 # 课程通知
@ -754,5 +746,41 @@ class CoursesService
student_works student_works
end end
# 开启匿评
#statue 1:启动成功2启动失败作业总数大于等于2份时才能启动匿评3:已开启匿评,请务重复开启,4:没有开启匿评的权限
def start_anonymous_comment params,current_user
homework = HomeworkCommon.find(params[:homework_id])
return {:status=>4} unless current_user.admin? || current_user.allowed_to?(:as_teacher,Course.find(params[:course_id]))
return {:status=>5} if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
homework_detail_manual = homework.homework_detail_manual
if homework_detail_manual.comment_status == 1
student_works = homework.student_works
if student_works && student_works.size >=2
student_works.each_with_index do |work, index|
user = work.user
n = homework_detail_manual.evaluation_num
n = n < student_works.size ? n : student_works.size - 1
assigned_homeworks = get_assigned_homeworks(student_works, n, index)
assigned_homeworks.each do |h|
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id)
student_works_evaluation_distributions.save
end
end
homework_detail_manual.update_column('comment_status', 2)
statue = 1
else
statue = 2
end
else
statue = 3
end
{:status => statue}
end
def get_assigned_homeworks(student_works, n, index)
student_works += student_works
student_works[index + 1 .. index + n]
end
end end

View File

@ -9,7 +9,7 @@
<div class="ping_distop"> <div class="ping_distop">
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> --> <!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
<span> <span>
<%= link_to journal.user.show_name, user_path(journal.user),:class => 'c_blue fb fl mb10', :target => "_blank"%> <%= link_to "#{journal.user.show_name}(#{journal.user.login})", user_path(journal.user),:class => 'c_blue fb fl mb10', :target => "_blank"%>
</span> </span>
<span class="c_grey fr"> <span class="c_grey fr">
<%= format_time(journal.created_on) %> <%= format_time(journal.created_on) %>

View File

@ -21,14 +21,26 @@
$("#attachments_fields").children().remove(); $("#attachments_fields").children().remove();
$("#upload_file_count").text("未上传文件"); $("#upload_file_count").text("未上传文件");
$('#upload_file_div').slideToggle('slow'); $('#upload_file_div').slideToggle('slow');
<% if @project%> <% if @project %>
closeModal(); closeModal();
$("#resource_list").html('<%= j(render partial: "project_file_new" ,locals: {project: @project}) %>'); $("#resource_list").html('<%= j(render partial: "project_file_new" ,locals: {project: @project}) %>');
// 添加文件上传成功提示
<% unless params[:attachments].nil? %>
var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>');
$("#course_list").prepend(div);
setTimeout( function(){div.remove();},3000)
<% end %>
<%elsif @course%> <%elsif @course%>
closeModal(); closeModal();
$("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>'); $("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>');
$("#courses_files_count_info").html("<%= @all_attachments.count%>"); $("#courses_files_count_info").html("<%= @all_attachments.count%>");
$("#courses_files_count_nav").html("(<%= @all_attachments.count%>)") $("#courses_files_count_nav").html("(<%= @all_attachments.count%>)")
// 添加文件上传成功提示,
<% unless params[:attachments].nil? %>
var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>');
$("#course_list").prepend(div);
setTimeout( function(){div.remove();},3000)
<% end %>
<% end %> <% end %>
<% end %> <% end %>
$(document).ready(img_thumbnails); $(document).ready(img_thumbnails);

View File

@ -23,7 +23,7 @@
<div id="journal_issue_note" class="wiki"></div> <div id="journal_issue_note" class="wiki"></div>
<input name="issue_quote_new" type="hidden" value="<%= %>" /> <input name="issue_quote_new" type="hidden" value="<%= %>" />
<fieldset><legend>回复</legend> <fieldset><legend>回复</legend>
<%= f.text_area :notes, :style => "width:99%;", :rows => "5", :no_label => true %> <%= f.text_area :notes, :style => "width:99%;", :rows => "5", :no_label => true %>
</fieldset> </fieldset>
<!--<%# if @issue.safe_attribute? 'private_notes' %>--> <!--<%# if @issue.safe_attribute? 'private_notes' %>-->
<!--<label for="issue_private_notes"><%#= f.check_box :private_notes, :no_label => true %> <%#= l(:field_private_notes) %></label>--> <!--<label for="issue_private_notes"><%#= f.check_box :private_notes, :no_label => true %> <%#= l(:field_private_notes) %></label>-->

View File

@ -1,33 +1,31 @@
<% reply_links = authorize_for('issues', 'edit') -%> <% reply_links = authorize_for('issues', 'edit') -%>
<% journals.reverse.each do |journal| %> <% journals.reverse.each do |journal| %>
<!-- modified by bai --> <!-- modified by bai -->
<div id="change-<%= journal.id %>" class="<%= journal.css_classes %>" style=" word-wrap: break-word; word-break: break-all"> <div id="change-<%= journal.id %>" class="<%= journal.css_classes %>" style=" word-wrap: break-word; word-break: break-all">
<!-- end --> <!-- end -->
<div class="ping_C mb10"> <div class="ping_C mb10 ml10">
<div class="ping_dispic"><a href="#" target="_blank"><%= image_tag(url_to_avatar(journal.user), :class => "ping_dispic",:width => 46,:height => 46) %></a></div> <div class="ping_dispic"><a href="#" target="_blank"><%= image_tag(url_to_avatar(journal.user), :class => "ping_dispic",:width => 46,:height => 46) %></a></div>
<div class="ping_discon"> <div class="ping_discon" style="width: 600px;">
<div class="ping_distop"> <div class="ping_distop">
<a href="#" target="_blank" class="c_blue fb fl mb10 "><%= journal.user %></a><span class="c_grey fr"><%= format_time journal.created_on %></span> <a href="#" target="_blank" class="c_blue fb fl mb10 "><%= journal.user %></a><span class="c_grey fr"><%= format_time journal.created_on %></span>
<div class="cl"></div>
<p>
<% if journal.details.any? %>
<% details_to_strings(journal.details).each do |string| %>
<p><%= string %></p>
<% end %>
<% end %>
</p>
</div>
<!--编辑、引用、回复按钮-->
<div class="ping_disfoot"><%= render_links_easy(issue, journal, :reply_links => reply_links) unless journal.notes.blank? %></div>
<!--回复内容、引用内容-->
<p><%= render_notes_issue(issue, journal, :reply_links => reply_links) unless journal.notes.blank? %></p>
<div class="cl"></div>
</div>
<div class="cl"></div> <div class="cl"></div>
<p>
<% if journal.details.any? %>
<% details_to_strings(journal.details).each do |string| %>
<p><%= string %></p>
<% end %>
<% end %>
</p>
</div> </div>
<!--编辑、引用、回复按钮-->
<div class="ping_disfoot"><%= render_links_easy(issue, journal, :reply_links => reply_links) unless journal.notes.blank? %></div>
<!--回复内容、引用内容-->
<p>
<%= render_notes_issue(issue, journal, :reply_links => reply_links) unless journal.notes.blank? %>
</p>
<div class="cl"></div>
</div> </div>
<div class="cl"></div>
</div>
</div>
<%= call_hook(:view_issues_history_journal_bottom, { :journal => journal }) %> <%= call_hook(:view_issues_history_journal_bottom, { :journal => journal }) %>
<% end %> <% end %>

View File

@ -11,7 +11,7 @@
<div class="problem_txt fl"> <div class="problem_txt fl">
<%= link_to issue.author.name, user_path(issue.author), :class => "problem_name c_orange fl" %> <%= link_to issue.author.name, user_path(issue.author), :class => "problem_name c_orange fl" %>
<span class="fl"><%= l(:label_post_on_issue) %>(<%= "#{raw column_content[2]}" %>)</span> <span class="fl"><%= l(:label_post_on_issue) %>(<%= "#{raw column_content[2]}" %>)</span>
<div class="problem_tit_div fl"> <div class="problem_tit_div fl break_word">
<%=link_to "#{column_content[4]}<span class = '#{get_issue_type(column_content[1])[0]}'>#{get_issue_type(column_content[1])[1]}</span>".html_safe, issue_path(issue.id), :class => "problem_tit_a break_word",:target => "_blank" %> <%=link_to "#{column_content[4]}<span class = '#{get_issue_type(column_content[1])[0]}'>#{get_issue_type(column_content[1])[1]}</span>".html_safe, issue_path(issue.id), :class => "problem_tit_a break_word",:target => "_blank" %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>

View File

@ -1,5 +1,5 @@
<h3><%=h @issue.tracker %> #<%= @issue.id %></h3> <h3><%=h @issue.tracker %> #<%= @issue.id %></h3>
<p><%= authoring @journal.created_on, @journal.user, :label => :label_updated_time_by %></p> <p>由<%= @journal.user %> 更新于 <%= format_time @journal.created_on %></p>
<div class="text-diff"> <div class="text-diff">
<%= simple_format_without_paragraph @diff.to_html %> <%= simple_format_without_paragraph @diff.to_html %>

View File

@ -1,11 +1,11 @@
$('#journal_issue_note').html("<%= raw escape_javascript(@content.html_safe) %>"); $('#issue_notes').val("<%= raw escape_javascript(@content) %>");
$("input[name='issue_quote_new']").val("<%= raw escape_javascript(@content.html_safe) %>");
<% <%
# when quoting a private journal, check the private checkbox # when quoting a private journal, check the private checkbox
if @journal && @journal.private_notes? if @journal && @journal.private_notes?
%> %>
$('#issue_private_notes').attr('checked', true); $('#issue_private_notes').attr('checked', true);
<% end %> <% end %>
showAndScrollTo("update", "notes"); showAndScrollTo("update", "notes");
$('#notes').scrollTop = $('#notes').scrollHeight - $('#notes').clientHeight; $('#notes').scrollTop = $('#notes').scrollHeight - $('#notes').clientHeight;

View File

@ -34,6 +34,7 @@
<%= l(:label_release_news) %> <%= l(:label_release_news) %>
</span> </span>
<%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %> <%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %>
<%=link_to "<span class = 'pic_mes'>#{news.comments.all.count}</span>".html_safe, news_path(news.id), :class => "pro_mes_w" %>
<br /> <br />
<div class="cl mb5"></div> <div class="cl mb5"></div>
<script> <script>

View File

@ -27,7 +27,8 @@
<%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %> <%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %>
<div class="problem_txt fl mt5"> <div class="problem_txt fl mt5">
<%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %> <%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %>
<span class="fl"> <%= l(:label_add_news) %></span><%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %><br /> <span class="fl"> <%= l(:label_add_news) %></span><%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %>
<%=link_to "<span class = 'pic_mes'>#{news.comments.all.count}</span>".html_safe, news_path(news.id), :class => "pro_mes_w_news" %><br />
<div class="cl mb5"></div> <div class="cl mb5"></div>
<p id="news_description_<%= news.id %>" class="mt5 break_word"><%=textAreailizable news.description %><br /> </p> <p id="news_description_<%= news.id %>" class="mt5 break_word"><%=textAreailizable news.description %><br /> </p>
<div class="news_foot" style="display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>"><%= l(:label_expend_information) %> <span class="g-arr-down"><img src="/images/jiantou.jpg" width="12" height="6" /></span></div> <div class="news_foot" style="display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>"><%= l(:label_expend_information) %> <span class="g-arr-down"><img src="/images/jiantou.jpg" width="12" height="6" /></span></div>

View File

@ -116,9 +116,9 @@
</p> </p>
<% end %> <% end %>
<% other_formats_links do |f| %> <%# other_formats_links do |f| %>
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> <%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
<% end %> <%# end %>
<% content_for :sidebar do %> <% content_for :sidebar do %>
<%= form_tag({}, :method => :get) do %> <%= form_tag({}, :method => :get) do %>

View File

@ -9,7 +9,7 @@
<div class="ping_discon" style="width: 85%;"> <div class="ping_discon" style="width: 85%;">
<div class="ping_distop"> <div class="ping_distop">
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> --> <!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
<span><%= link_to journal.user, user_path(journal.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%></span><span style="color:#a6a6a6; margin-right:40px; margin-left:30px;"><%= format_time(journal.created_on) %></span> <span><%= link_to "#{journal.user.show_name}(#{journal.user.login})", user_path(journal.user),:style => " font-weight:bold; color:#15bccf; margin-right:30px; background:none;", :target => "_blank"%></span><span style="color:#a6a6a6; margin-right:40px; margin-left:30px;"><%= format_time(journal.created_on) %></span>
<div class="cl"></div> <div class="cl"></div>
<!--<p><%#= textilizable journal.notes%></p>--> <!--<p><%#= textilizable journal.notes%></p>-->
<p><%=journal.notes.html_safe%></p> <p><%=journal.notes.html_safe%></p>

View File

@ -13,10 +13,10 @@
</div> </div>
<div class="recall_con"> <div class="recall_con">
<% id = 'project_respond_form_'+ reply.id.to_s %> <% id = 'project_respond_form_'+ reply.id.to_s %>
<%= link_to reply.user.show_name, user_path(reply.user) %> <%= link_to "#{reply.user.show_name}(#{reply.user.login})", user_path(reply.user) %>
<%= l(:label_reply_to)%> <%= l(:label_reply_to)%>
<% if show_name %> <% if show_name %>
<%= link_to parent_jour.user.show_name, user_path(parent_jour.user) %> <%= link_to "#{parent_jour.user.show_name}(#{parent_jour.user.login})", user_path(parent_jour.user) %>
<% else %> <% else %>
<%= l(:label_anonymous) %> <%= l(:label_anonymous) %>
<% end %> <% end %>

View File

@ -399,6 +399,7 @@ zh:
label_issue_number: issue的数量 label_issue_number: issue的数量
label_issue_journal_number: issue的留言数量 label_issue_journal_number: issue的留言数量
label_project_mail_feedback: 项目留言 label_project_mail_feedback: 项目留言
label_project_issue_feedback: 留言
label_news_score: 新闻得分 label_news_score: 新闻得分
label_new_number: 新闻的数量 label_new_number: 新闻的数量

View File

@ -52,6 +52,7 @@ a:hover.problem_pic{border:1px solid #64bdd9;}
a.problem_name{ color:#ff5722;max-width:60px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;} a.problem_name{ color:#ff5722;max-width:60px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
a:hover.problem_name{ color:#d33503;} a:hover.problem_name{ color:#d33503;}
a.problem_tit{ color:#0781b4; max-width:410px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} a.problem_tit{ color:#0781b4; max-width:410px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
a.pro_mes_w{ height:20px; float:right;display:block; color:#999999;}
a:hover.problem_tit{ color:#09658c; } a:hover.problem_tit{ color:#09658c; }
.problem_main{ border-bottom:1px dashed #d4d4d4; padding-bottom:10px; margin-bottom:10px;} .problem_main{ border-bottom:1px dashed #d4d4d4; padding-bottom:10px; margin-bottom:10px;}
/****翻页***/ /****翻页***/

View File

@ -84,6 +84,7 @@ a:hover.problem_tit,a:hover.problem_tit02{ color:#09658c; }
.problem_main{ border-bottom:1px dashed #d4d4d4; padding-bottom:10px; margin-bottom:10px;} .problem_main{ border-bottom:1px dashed #d4d4d4; padding-bottom:10px; margin-bottom:10px;}
a.pro_mes{ float:left; color:#a0a0a0; display:block; width:100px; height:20px; } a.pro_mes{ float:left; color:#a0a0a0; display:block; width:100px; height:20px; }
a.pro_mes_w{ height:20px; float:left;display:block; color:#999999;} a.pro_mes_w{ height:20px; float:left;display:block; color:#999999;}
a.pro_mes_w_news{ height:20px; float:right;display:block; color:#999999;}
.pro_page_top{ font-size:14px; border-bottom:2px solid #64bdd9; margin-bottom:10px; padding-bottom:5px;} .pro_page_top{ font-size:14px; border-bottom:2px solid #64bdd9; margin-bottom:10px; padding-bottom:5px;}
.pro_page_tit{color:#3e4040; font-weight:bold;width:480px; float:left; font-size:14px; margin-bottom:5px;} .pro_page_tit{color:#3e4040; font-weight:bold;width:480px; float:left; font-size:14px; margin-bottom:5px;}