Merge branch 'develop' into sw_new_course

Conflicts:
	app/views/homework_common/index.html.erb
This commit is contained in:
sw 2015-07-10 15:42:53 +08:00
commit aeb0d23289
53 changed files with 832 additions and 569 deletions

View File

@ -26,7 +26,8 @@ module Mobile
present :data, {token: key.access_token, user: api_user}, using: Entities::Auth
present :status, 0
else
raise "无效的用户名或密码"
present :message, "无效的用户名或密码"
present :status,1
end
end

View File

@ -113,6 +113,20 @@ module Mobile
present :status, 0
end
desc '通知评论列表'
params do
requires :token, type: String
requires :notice_id,type:Integer,desc:'通知id'
optional :page,type:Integer,desc:'页码'
end
get ':notice_id/notice_comments' do
cs = CommentService.new
comments = cs.notice_comments params,current_user
present :data, comments, with: Mobile::Entities::Comment
present :status, 0
end
end
end
end

View File

@ -312,16 +312,19 @@ module Mobile
present :status,0
end
desc '课程历次作业总成绩列表'
desc '总成绩 or 活跃度列表'
params do
requires :token,type:String
requires :course_id,type:Integer,desc:'课程id'
optional :page,type:Integer,desc:'页码'
optional :type,type:Integer,desc:'0是活跃度1是成绩'
end
get ':course_id/students_score_list' do
cs = CoursesService.new
news = cs.students_score_list params,current_user
present :data,news,with:Mobile::Entities::User
present :data,news[:user_list],with:Mobile::Entities::User
present :maxSize,news[:max_size]
present :status,0
end
desc '课程某次作业提交列表 并显示成绩'
@ -337,18 +340,7 @@ module Mobile
present :data,student_works.all,with:Mobile::Entities::StudentWork
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

View File

@ -31,33 +31,33 @@ module Mobile
present :status, 0
end
desc "启动匿评"
params do
requires :token, type: String
end
post ':id/start_anonymous_comment' do
statue = Homeworks.get_service.start_anonymous_comment params,current_user.nil? ? User.find(2):current_user
messages = ""
case statue
when 1
messages = "启动成功"
when 2
messages = "启动失败作业总数大于等于2份时才能启动匿评"
when 3
messages = "已开启匿评,请务重复开启"
end
present :data,messages
present :status, statue
end
desc "关闭匿评"
params do
requires :token, type: String
end
post ':id/stop_anonymous_comment' do
Homeworks.get_service.stop_anonymous_comment params,current_user.nil? ? User.find(2):current_user
present :status, 0
end
# desc "启动匿评"
# params do
# requires :token, type: String
# end
# post ':id/start_anonymous_comment' do
# statue = Homeworks.get_service.start_anonymous_comment params,current_user.nil? ? User.find(2):current_user
# messages = ""
# case statue
# when 1
# messages = "启动成功"
# when 2
# messages = "启动失败作业总数大于等于2份时才能启动匿评"
# when 3
# messages = "已开启匿评,请务重复开启"
# end
# present :data,messages
# present :status, statue
# end
#
# desc "关闭匿评"
# params do
# requires :token, type: String
# end
# post ':id/stop_anonymous_comment' do
# Homeworks.get_service.stop_anonymous_comment params,current_user.nil? ? User.find(2):current_user
# present :status, 0
# end
desc "匿评作品详情"
params do
@ -111,6 +111,45 @@ module Mobile
present :status, 0
end
desc '开启匿评'
params do
requires :token,type:String
requires :course_id,type:Integer,desc:'课程id'
requires :homework_id,type:Integer,desc:'作业id'
end
post ':homework_id/start_anonymous_comment' do
hs = Homeworks.get_service
status = hs.start_anonymous_comment params,current_user
messages = ""
case status[:status]
when 1
messages = "启动成功"
when 2
messages = "启动失败作业总数大于等于2份时才能启动匿评"
when 3
messages = "已开启匿评,请务重复开启"
when 4
messages = "没有开启匿评的权限"
when 5
messages = "截止日期之前不可启动匿评"
end
present :data,messages
present :status,0
end
desc '关闭匿评'
params do
requires :token,type:String
requires :course_id,type:Integer,desc:'课程id'
requires :homework_id,type:Integer,desc:'作业id'
end
post ':homework_id/stop_anonymous_comment' do
hs = Homeworks.get_service
hs.stop_anonymous_comment params,current_user
message = "成功关闭"
present :data, message
present :status,0
end
end
end

View File

@ -58,7 +58,11 @@ module Mobile
course_dynamic_expose :document_count
course_dynamic_expose :topic_count
course_dynamic_expose :homework_count
#在dynamics里解析出四种动态
course_dynamic_expose :course_student_num
course_dynamic_expose :time_from_now
course_dynamic_expose :current_user_is_member
course_dynamic_expose :current_user_is_teacher
expose :documents,using:Mobile::Entities::Attachment do |f,opt|
obj = nil
f[:dynamics].each do |d|
@ -107,6 +111,16 @@ module Mobile
obj
end
expose :active_students,using:Mobile::Entities::User do |f,opt|
obj = nil
f[:dynamics].each do |d|
if d[:type] == 7
obj = d[:active_students]
end
end
obj
end
end
end
end

View File

@ -24,12 +24,19 @@ module Mobile
f.course.members.count - f.student_works.count
when :homework_submit_num
f.student_works.count
when :homework_status
when :homework_status_student
get_homework_status f
when :homework_times
f.course.homework_commons.index(f) + 1
when :homework_status_desc
when :homework_status_teacher
homework_status_desc f
when :student_evaluation_part
get_evaluation_part f ,3
when :ta_evaluation_part
get_evaluation_part f , 2
when :homework_anony_type
val = f.homework_type == 1 && !f.homework_detail_manual.nil?
val
end
end
end
@ -79,11 +86,13 @@ module Mobile
homework_expose :homework_submit_num
homework_expose :homework_notsubmit_num
expose :submit_student_list ,using: Mobile::Entities::User do |f,opt|
get_submit_sutdent_list f
end
homework_expose :homework_status #作业的状态
homework_expose :homework_status_desc #状态的解释
homework_expose :homework_status_student #学生看到的作业的状态
homework_expose :homework_status_teacher #老师看到的状态
homework_expose :student_evaluation_part #学生匿评比率
homework_expose :ta_evaluation_part #教辅评价比率
homework_expose :homework_anony_type #是否是匿评作业
end
end

View File

@ -56,6 +56,8 @@ module Mobile
expose :comments, using: Mobile::Entities::Comment do |f, opt|
if f.is_a?(Hash) && f.key?(:comments)
f[:comments]
elsif f.is_a?(::News) && f.respond_to?(:comments)
f.send(:comments)
end
end

View File

@ -53,6 +53,8 @@ module Mobile
user_expose :score
#学号
user_expose :student_num
# 活跃值
user_expose :active_count
end
end

View File

@ -22,6 +22,9 @@ class ActivityNotifysController < ApplicationController
list = query.order('is_read,id desc').limit(limit).offset(@obj_pages.offset).all();
events=[];
for item in list
if item.activity.nil?
next
end
event = item.activity;
event.set_notify_id(item.id)
event.set_notify_is_read(item.is_read)

View File

@ -86,7 +86,7 @@ class ForumsController < ApplicationController
order(sort_clause).
preload(:author, {:last_reply => :author}).
all
@memos
flash.now[:error] = "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}"
# back_error_page = @memo.parent_id.nil? ? forum_path(@forum) : forum_memo_path(@forum, @memo.parent_id)
format.html { render action: :show, layout: 'base_forums' }#, error: "#{l :label_memo_create_fail}: #{@memo.errors.full_messages[0]}" }
@ -122,14 +122,14 @@ class ForumsController < ApplicationController
@topic_count = @forum.topics.count
@topic_pages = Paginator.new @topic_count, per_page_option, params['page']
@memos = @forum.topics.
reorder("#{Memo.table_name}.sticky DESC").
# reorder("#{Memo.table_name}.sticky DESC").
includes(:last_reply).
limit(@topic_pages.per_page).
offset(@topic_pages.offset).
order(sort_clause).
preload(:author, {:last_reply => :author}).
all
@memos
# @offset, @limit = api_offset_and_limit({:limit => 10})
# @forum = Forum.find(params[:id])
# @memos_all = @forum.topics

View File

@ -1,5 +1,5 @@
class OrganizationController < ApplicationController
layout 'base_projects'
# layout 'base_projects'
before_filter :require_admin, :except => [:index]
def index

View File

@ -104,13 +104,20 @@ class UsersController < ApplicationController
#added by young
def user_projects
if User.current.admin?
@memberships = @user.memberships.all(conditions: "projects.project_type = #{Project::ProjectType_project}")
else
cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1"
@memberships = @user.memberships.all(:conditions => cond)
end
@memberships = @memberships.sort {|a,b| b.created_on.to_i <=> a.created_on.to_i}
# unless @memberships.nil?
# @user_projects = []
# @memberships.each do |membership|
# @user_projects << membership.project
# end
# @user_projects = @user_projects.sort {|a,b| b.created_on.to_i <=> a.created_on.to_i}
# end
#events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20)
#@events_by_day = events.group_by(&:event_date)
@state = 0
@ -256,9 +263,7 @@ class UsersController < ApplicationController
membership.sort! {|older, newer| newer.created_on <=> older.created_on }
@memberships = []
membership.collect { |e|
@memberships.push(e)
}
membership.collect { |e| @memberships.push(e)}
## 判断课程是否过期 [需封装]
@memberships_doing = []
@memberships_done = []

View File

@ -93,7 +93,7 @@ module ApiHelper
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 = "截止日期之前不可启动匿评"
link = show_homework_deadline homework
elsif homework.student_works.count >= 2 #作业份数大于2
case homework.homework_detail_manual.comment_status
when 1
@ -104,10 +104,10 @@ module ApiHelper
link = " 匿评结束"
end
else
link = "提交作业数大于2才可启动匿评"
link = "提交作业数过少"
end
else
link = "未开启匿评作业不可启动匿评"
link = "未开启匿评作业"
end
link
end
@ -129,9 +129,39 @@ module ApiHelper
def show_homework_deadline homework
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 << ""
"距作业截止还有" << day.to_s << ""
else
"已截止,但可补交"
end
end
#获取作业中学生的匿评比率
# 匿评比率 = 学生总共评价的作业的作业份数 / 作业份数 * 分配数 * 100%
# 教辅匿评比率 = 教辅已经评价的作业份数 / 总的作业份数 * 100%
def get_evaluation_part homework,role
homework_eva_completed_task_num = 0
homework_eva_task_num = 0
#匿评作业 # 且匿评状态不是还没有开启匿评
if homework.homework_type == 1 && homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1
# 总共需要评价的任务数
homework_eva_task_num = homework.homework_detail_manual.evaluation_num * homework.student_works.count
unless homework_eva_task_num == 0 #总任务数不为0 的情况下
#获取已经评价了多少的份作业 student_work_score里记录了评价情况每条记录有提交作业的id
#先求出提交作业的id集合
work_ids = "(" + homework.student_works.map(&:id).join(",") + ")"
#只要 student_work_score 中的 student_work_id在work_ids集合中那么久说明这个任务被完成了
sql = "select count(1) from student_works_scores where reviewer_role = #{role} and student_work_id in #{work_ids} "
homework_eva_completed_task_num = ActiveRecord::Base.connection().select_value(sql)
end
end
if homework_eva_task_num == 0
0
else
( homework_eva_completed_task_num / homework_eva_task_num.to_f * 100 ) .round(1)
end
end
end

View File

@ -520,10 +520,14 @@ module CoursesHelper
option1 << l(:label_spring)
option1 << l(:label_spring)
option2 = []
option2 << l(:label_autumn)
option2 << l(:label_autumn)
option2 << l(:label_summer)
option2 << l(:label_summer)
option3 = []
option3 << l(:label_autumn)
option3 << l(:label_autumn)
type << option1
type << option2
type << option3
type
end
@ -546,8 +550,9 @@ module CoursesHelper
end
if cur_course_term == "秋季学期" && course.time == (year_now + 1) && course.term == "春季学期"
is_next_term = true
elsif cur_course_term == "春季学期" && course.time == year_now && course.term == "季学期"
elsif cur_course_term == "春季学期" && course.time == year_now && course.term == "季学期"
is_next_term = true
elsif cur_course_term == "夏季学期" && course.time == year_now && course.term == "秋季学期"
end
is_current_term || is_next_term
end

View File

@ -3,7 +3,8 @@ module HomeworkCommonHelper
#迟交扣分下拉框
def late_penalty_option
type = []
for i in (0..5)
type << l(:lable_unset)
for i in (1..5)
option = []
option << i
option << i
@ -29,7 +30,8 @@ module HomeworkCommonHelper
#缺评扣分
def absence_penalty_option
type = []
i = 0
i = 1
type << l(:lable_unset)
while i <= 5
option = []
option << i
@ -50,4 +52,32 @@ module HomeworkCommonHelper
end
link
end
#评分规则显示
def scoring_rules late_penalty,homework_id,is_teacher,absence_penalty=nil
if absence_penalty
if late_penalty.to_i == 0 && absence_penalty.to_i == 0
notice = "尚未设置评分规则"
if is_teacher
notice += ",请&nbsp" + link_to("设置",edit_homework_common_path(homework_id),:class => "c_green")
end
elsif late_penalty.to_i != 0 && absence_penalty.to_i == 0
notice = "迟交扣#{late_penalty}分,缺评扣分未设置"
elsif late_penalty.to_i == 0 && absence_penalty.to_i != 0
notice = "迟交扣分未设置,缺评一个作品扣#{absence_penalty}"
elsif late_penalty.to_i != 0 && absence_penalty.to_i != 0
notice = "迟交扣#{late_penalty}分,缺评一个作品扣#{absence_penalty}"
end
else
if late_penalty.to_i == 0
notice = "尚未设置评分规则"
if is_teacher
notice += ",请&nbsp" + link_to("设置",edit_homework_common_path(homework_id),:class => "c_green")
end
else
notice = "迟交扣#{late_penalty}"
end
end
notice.html_safe
end
end

View File

@ -68,24 +68,36 @@ module IssuesHelper
end
#获取跟踪类型及样式
#REDO:时间紧可以优化.
def get_issue_type(value)
issuetype = []
if value == "缺陷" || value == 1
issuetype << "red_btn_cir ml10"
issuetype << "缺陷"
issuetype << "issues fl"
elsif value == "功能" || value == 2
issuetype << "blue_btn_cir ml10"
issuetype << "功能"
issuetype << "duty fl"
elsif value == "支持" || value == 3
issuetype << "green_btn_cir ml10"
issuetype << "支持"
issuetype << "support fl"
elsif value == "任务" || value == 4
issuetype << "function fl"
else
issuetype << "weekly fl"
end
end
# 获取优先级样式 value值1 2 低
def get_issue_priority(value)
issuetype = []
if value == "紧急" || value == 4
issuetype << "red_btn_cir ml10"
issuetype << "紧急"
elsif value == "正常" || value == 2
issuetype << "green_btn_cir ml10"
issuetype << "正常"
elsif value == "" || value == 3
issuetype << "orange_btn_cir ml10"
issuetype << "任务"
issuetype << ""
else
issuetype << "bgreen_btn_cir ml10"
issuetype << "周报"
issuetype << ""
end
end

View File

@ -433,7 +433,7 @@ module UserScoreHelper
#协同得分
def collaboration(option_number)
option_number.memo * 2 + option_number.messages_for_issues + option_number.issues_status + option_number.replay_for_message + option_number.replay_for_memo
option_number.messages_for_issues + option_number.issues_status + option_number.replay_for_message + option_number.replay_for_memo
end
#影响力得分
def influence(option_number)
@ -445,7 +445,7 @@ module UserScoreHelper
end
#项目贡献得分
def active(option_number)
option_number.changeset * 4 + option_number.document * 4 + option_number.attachment * 4 + option_number.issue_done_ratio * 2 + option_number.post_issue * 4
option_number.changeset * 4 + option_number.document * 4 + option_number.attachment * 4 + option_number.issue_done_ratio * 2 + option_number.post_issue * 4 + option_number.memo * 2
end
#更新发帖数

View File

@ -169,14 +169,14 @@ module WatchersHelper
if joined
link_to text, {:controller => "courses", :action => "join_group", :object_id => "#{group.id}"},
:remote => true, :method => 'delete',
:id => "#{group.id}", :style => "padding: 8px 8px 4px; ",
:id => "#{group.id}", :style => "padding: 2px 8px 2px; background-color:#15bccf; color:#fff; ",
:confirm => l(:text_are_you_sure_out_group), :class => 'group_in'
end
else
text = l(:label_new_join_group)
form_tag({:controller => "courses", :action => "join_group", :object_id => "#{group.id}"}, :remote => true, :method => 'post') do
submit_tag text, class: "group_in", style: "width: 90px;height: 21px;"
submit_tag text, class: "group_in", style: "width: 90px;height: 21px; background-color:#15bccf; color:#fff;"
end
end
end

View File

@ -1,5 +1,6 @@
class OptionNumber < ActiveRecord::Base
attr_accessible :attachment, :changeset, :document, :follow, :issue_done_ratio, :issues_status, :memo, :messages_for_issues, :post_issue, :praise_by_one, :praise_by_three, :praise_by_two, :replay_for_memo, :replay_for_message, :score_type, :total_score, :tread, :tread_by_one, :tread_by_three, :tread_by_two, :user_id
attr_accessible :attachment, :changeset, :document, :follow, :issue_done_ratio, :issues_status, :memo, :messages_for_issues, :post_issue,
:praise_by_one, :praise_by_three, :praise_by_two, :replay_for_memo, :replay_for_message, :score_type, :total_score, :tread, :tread_by_one, :tread_by_three, :tread_by_two, :user_id
def self.get_user_option_number user_id
result = nil

View File

@ -66,9 +66,9 @@ class User < Principal
#每日一报、一事一报、不报
MAIL_NOTIFICATION_OPTIONS = [
['all', :label_user_mail_option_all],
#['week', :label_user_mail_option_week],
['day', :label_user_mail_option_day],
['all', :label_user_mail_option_all],
['none', :label_user_mail_option_none]
]

View File

@ -112,6 +112,9 @@ class CommentService
end
end
# 获取课程里的某个通知的所有回复
def notice_comments params,current_user
News.find(params[:notice_id]).comments.page(params[:page] || 1).per(10)
end
end

View File

@ -4,6 +4,7 @@ class CoursesService
include CoursesHelper
include HomeworkAttachHelper
include ApiHelper
include ActionView::Helpers::DateHelper
#参数school_id为0或不传时返回所有课程否则返回对应学校的课程
#参数per_page_count分页功能每页显示的课程数
@ -332,7 +333,7 @@ class CoursesService
def homework_list params,current_user
course = Course.find(params[:id])
if course.is_public != 0 || current_user.member_of_course?(course)
bids = course.homework_commons.page(1).per(20).order('created_at DESC')
bids = course.homework_commons.page(params[:page] || 1).per(20).order('created_at DESC')
bids = bids.like(params[:name]) if params[:name].present?
homeworks = []
bids.each do |bid|
@ -551,17 +552,28 @@ class CoursesService
else
end
end
studentlist = []
bid.student_works.order("created_at desc").page(1).per(6).each do |work|
studentlist << work.user
end
unless is_course_teacher
homework_for_anonymous_comments = get_student_batch_homework_list bid,current_user
end
# studentlist = []
# bid.student_works.order("created_at desc").page(1).per(6).each do |work|
# studentlist << work.user
# end
# unless is_course_teacher
# homework_for_anonymous_comments = get_student_batch_homework_list bid,current_user
# end
#end
open_anonymous_evaluation = bid.homework_detail_manual.comment_status
{:course_name => course.name,:course_id => course.id,:id => bid.id, :author => bid.user,:author_real_name => author_real_name, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => 0,
:description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation,:homework_for_anonymous_comments => homework_for_anonymous_comments,:created_on => bid.created_at,:deadline => bid.end_time,:studentlist => studentlist}
{:course_name => course.name,:course_id => course.id,:id => bid.id,
:author => bid.user,:author_real_name => author_real_name,
:homework_times => many_times, :homework_name => name,
:homework_count => homework_count,:student_questions_count => 0,
:description => description, :homework_state => state,
:open_anonymous_evaluation => open_anonymous_evaluation,
#:homework_for_anonymous_comments => homework_for_anonymous_comments,
:created_on => bid.created_at,:deadline => bid.end_time,
:homework_notsubmit_num => bid.course.members.count - bid.student_works.count,
:homework_submit_num => bid.student_works.count,
:homework_status_student => get_homework_status( bid),:homework_status_teacher => homework_status_desc( bid),
:student_evaluation_part => get_evaluation_part( bid ,3),
:ta_evaluation_part => get_evaluation_part( bid ,2),:homework_anony_type => bid.homework_type == 1 && !bid.homework_detail_manual.nil?}
end
@ -657,22 +669,12 @@ class CoursesService
membership.each do |mp|
course = mp.course
latest_course_dynamics = []
dynamics_count = 0
# 课程学霸 学生总分数排名靠前的5个人
homework_count = course.homework_commons.count
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"
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
end
# 课程通知
latest_news = course.news.page(1).per(2).order("created_on desc")
unless latest_news.first.nil?
latest_course_dynamics << {:type => 1, :time => latest_news.first.created_on,:count=>course.news.count,
:news => latest_news.all}
dynamics_count += 1
end
# 课程讨论区
@ -694,12 +696,31 @@ class CoursesService
homeworks = course.homework_commons.page(1).per(2).order('created_at desc')
unless homeworks.first.nil?
latest_course_dynamics << {:type => 4, :time => homeworks.first.updated_at, :count=>course.homework_commons.count , :homeworks => homeworks}
dynamics_count += 1
end
latest_course_dynamics.sort! { |order, newer| newer[:time] <=> order[:time] }
# 课程学霸 学生总分数排名靠前的5个人
homework_count = course.homework_commons.count
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,4"
better_students = User.find_by_sql(sql)
# 找出在课程讨论区发帖回帖数最多的
active_students = []
sql1 = " select users.*,count(author_id) active_count from messages " <<
" LEFT JOIN users on messages.author_id = users.id " <<
" where messages.board_id in (select id from boards where boards.course_id = #{course.id} ) " <<
" GROUP BY messages.author_id ORDER BY count(author_id) desc " <<
" limit 0,4"
active_students = User.find_by_sql(sql1)
if homework_count != 0 && !better_students.empty?
latest_course_dynamics <<{:type=> 6,:time=>Time.now.to_s,:count=> 4,:better_students=> better_students}
end
unless active_students.empty?
latest_course_dynamics <<{:type=> 7,:time=>Time.now.to_s,:count=> 4,:active_students=>active_students}
end
latest_course_dynamic = latest_course_dynamics.first
unless latest_course_dynamic.nil?
result << {:course_name => course.name, :course_id => course.id, :course_img_url => url_to_avatar(course), :course_time => course.time, :course_term => course.term,:message => dynamics_count, :dynamics => latest_course_dynamics, :count => dynamics_count}
result << {:course_name => course.name,:current_user_is_member => current_user.member_of_course?(course),:current_user_is_teacher => is_course_teacher(current_user,course), :course_id => course.id, :course_img_url => url_to_avatar(course), :course_time => course.time, :course_term => course.term,:message => "", :dynamics => latest_course_dynamics,
:course_student_num=>course ? course.members.count : 0,:time_from_now=> distance_of_time_in_words(Time.now, latest_course_dynamic[:time].to_time) << ""}
end
end
#返回数组集合
@ -709,11 +730,33 @@ class CoursesService
# 获取课程历次作业的学生总成绩
def students_score_list params,current_user
homework_count = Course.find(params[:course_id]).homework_commons.count
page = (params[:page] || 1) - 1
user_list = []
max_size = 0
if params[:type] == 1
homework_count = Course.find(params[:course_id]).homework_commons.count
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 = #{params[:course_id]}) GROUP BY student_works.user_id ORDER BY score limit #{page*10},10"
User.find_by_sql(sql)
sql_count = " select count(distinct(student_works.user_id) ) " <<
" 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 = #{params[:course_id]}) "
max_size = ActiveRecord::Base.connection().select_value(sql_count)
user_list = User.find_by_sql(sql)
else
sql1 = " select users.*,count(author_id)*2 active_count from messages " <<
" LEFT JOIN users on messages.author_id = users.id " <<
" where messages.board_id in (select id from boards where boards.course_id = #{params[:course_id]} ) " <<
" GROUP BY messages.author_id ORDER BY count(author_id) desc " <<
" limit #{page*10},10"
sql1_count = " select count(DISTINCT(messages.author_id))" <<
" from messages LEFT JOIN users on messages.author_id = users.id " <<
" where messages.board_id in (select id from boards where boards.course_id = #{params[:course_id]} )"
max_size = ActiveRecord::Base.connection().select_value(sql1_count)
user_list = User.find_by_sql(sql1)
end
{:user_list=>user_list,:max_size=>max_size}
end
# 获取某次作业的所有作业列表
@ -746,41 +789,41 @@ class CoursesService
student_works
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
# # 开启匿评
# #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

View File

@ -57,46 +57,96 @@ class HomeworkService
[@bid,@totle_size,@cur_size,@percent]
end
#启动匿评
#statue 1:启动成功2启动失败作业总数大于等于2份时才能启动匿评3:已开启匿评,请务重复开启
# 启动匿评 操作 逻辑改变,暂不删除
# #启动匿评
# #statue 1:启动成功2启动失败作业总数大于等于2份时才能启动匿评3:已开启匿评,请务重复开启
# def start_anonymous_comment params,current_user
# @bid = Bid.find(params[:id])
# @course = @bid.courses.first
# unless is_course_teacher(current_user,@course) || current_user.admin?
# @statue = 4
# raise '403'
# end
# if(@bid.comment_status == 0)
# homeworks = @bid.homeworks
# if(homeworks && homeworks.size >= 2)
# homeworks.each_with_index do |homework, index|
# user = homework.user
# n = @bid.evaluation_num
# n = n < homeworks.size ? n : homeworks.size - 1
# assigned_homeworks = get_assigned_homeworks(homeworks, n, index)
# assigned_homeworks.each do |h|
# @homework_evaluation = HomeworkEvaluation.new(user_id: user.id, homework_attach_id: h.id)
# @homework_evaluation.save
# end
# end
# @bid.update_column('comment_status', 1)
# @statue = 1
# else
# @statue = 2
# end
# else
# @statue = 3
# end
# @statue
# end
# #关闭匿评
# def stop_anonymous_comment params,current_user
# @bid = Bid.find(params[:id])
# @course = @bid.courses.first
# unless is_course_teacher(current_user,@course) || current_user.admin?
# raise '403'
# end
# @bid.update_column('comment_status', 2)
# end
# 开启匿评
#statue 1:启动成功2启动失败作业总数大于等于2份时才能启动匿评3:已开启匿评,请务重复开启,4:没有开启匿评的权限
def start_anonymous_comment params,current_user
@bid = Bid.find(params[:id])
@course = @bid.courses.first
unless is_course_teacher(current_user,@course) || current_user.admin?
@statue = 4
raise '403'
end
if(@bid.comment_status == 0)
homeworks = @bid.homeworks
if(homeworks && homeworks.size >= 2)
homeworks.each_with_index do |homework, index|
user = homework.user
n = @bid.evaluation_num
n = n < homeworks.size ? n : homeworks.size - 1
assigned_homeworks = get_assigned_homeworks(homeworks, n, index)
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|
@homework_evaluation = HomeworkEvaluation.new(user_id: user.id, homework_attach_id: h.id)
@homework_evaluation.save
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id)
student_works_evaluation_distributions.save
end
end
@bid.update_column('comment_status', 1)
@statue = 1
homework_detail_manual.update_column('comment_status', 2)
statue = 1
else
@statue = 2
statue = 2
end
else
@statue = 3
statue = 3
end
@statue
{:status => statue}
end
#关闭匿评
def get_assigned_homeworks(student_works, n, index)
student_works += student_works
student_works[index + 1 .. index + n]
end
def stop_anonymous_comment params,current_user
@bid = Bid.find(params[:id])
@course = @bid.courses.first
unless is_course_teacher(current_user,@course) || current_user.admin?
raise '403'
homework = HomeworkCommon.find(params[:homework_id])
homework_detail_manual = homework.homework_detail_manual
homework_detail_manual.update_column('comment_status', 3)
work_ids = "(" << homework.student_works.map(&:id).join(",") << ")"
homework.student_works.each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
student_work.save
end
@bid.update_column('comment_status', 2)
end
# 匿评作品详情

View File

@ -32,33 +32,31 @@
<hr/>
</div>
<% end %>
<p class="c_dark mb5">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p>
<p class="c_dark mb5 f14">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p>
<% if @topics.any? %>
<% @topics.each do |topic| %>
<div class="talkmain_box" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;" id="topic<%= topic.id %>" nhname="container_board" mhname="container_board_reply">
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
<div class="talkmain_txt fl mt5">
<div class="talkmain_txt fl mt5 f14">
<% author = topic.author.to_s %>
<div style="max-width:60px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;">
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl ",:title=>author,
:style=>'max-width:60px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;' %>
<div style="max-width:120px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;">
<%= link_to User.current.member_of_course?(@board.course) ? "#{topic.author.show_name}(#{topic.author.login})" : "#{topic.author}" , user_path(topic.author),
:class =>"talkmain_name fl f14",:title=>author,
:style=>'max-width:120px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;' %>
</div>
<p style="float:left;color:#ff5722;">&nbsp;&nbsp;:</p>
<p class="talkmain_tit fl fb break_word" title="<%= h(topic.subject) %>" style="width:auto;float:left;max-width:415px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;">&nbsp;&nbsp;<%= h(topic.subject) %></p>
<p class="talkmain_tit fl fb break_word f14" title="<%= h(topic.subject) %>" style="width:auto;float:left;max-width:415px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;">&nbsp;&nbsp;<%= h(topic.subject) %></p>
<% if topic.course_editable_by?(User.current) %>
<a href="javascript:void(0)" nhname="showbtn" style="color: #426e9a;float: right;
margin-right: 10px;"><%= l(:button_edit) %></a>
<% end %>
<%= link_to(
l(:button_delete),
{:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'},
<%= link_to(l(:button_delete), {:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'talk_edit fr',
:style => ' margin-right: 10px;'
) if topic.destroyable_by?(User.current) %>
:style => ' margin-right: 10px;') if topic.destroyable_by?(User.current) %>
<% if topic.sticky? %>
<a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%= l(:label_board_sticky)%></a>
@ -101,7 +99,7 @@
// }
});
</script>
<div class="project_board_content break_word" id="content_<%=topic.id%>">
<div class="project_board_content break_word f14" id="content_<%=topic.id%>">
<div id="contentmessage<%=topic.id %>" class="upload_img">
<%= topic.content.html_safe %>
<!-- -->
@ -122,7 +120,7 @@
<%= l(:label_activity_time)%>&nbsp;&nbsp;<%= format_time topic.created_on %>
</div>
<a href="javascript:void(0)" nhname="showbtn_reply" class="c_dblue fr" style="margin-right:10px;"><%= l(:button_reply) %></a>
<a href="javascript:void(0)" nhname="showbtn_reply" class="c_dblue fr f14" style="margin-right:10px;"><%= l(:button_reply) %></a>
<div class="cl"></div>
@ -165,15 +163,15 @@
<li nhname="reply_rec" style="display:<%= replies_all_i>2?'none':'' %>" id="topic<%=message.id%>">
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class => 'Msg_pic' %>
<div class="Msg_txt">
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
<%= link_to User.current.member_of_course?(@board.course) ? "#{message.author.show_name}(#{message.author.login})" : "#{message.author}", user_path(message.author),:class => 'fl c_orange f14 ' %>
<br/>
<div class="fl break_word">
<div class="fl break_word f14">
<%= textAreailizable message,:content,:attachments => message.attachments %>
<!-- -->
</div>
<input nhname="nh_content_val" value="<%= message.content %>" type="hidden"/>
<br/><div class="cl"></div>
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
<span class=" c_grey fl f14"><%= format_time(message.created_on) %></span>
<%= link_to(
l(:button_delete),
@ -181,13 +179,13 @@
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete),
:class => ' c_dblue fr'
:class => ' c_dblue fr f14'
) if message.course_destroyable_by?(User.current) %>
<%= link_to(
l(:button_reply),
'javascript:;',
:nhname =>'showbtn_child_reply',
:class => ' c_dblue fr',
:class => ' c_dblue fr f14',
:style => 'margin-right: 10px;',
'data-topic-id' =>message.id,
:title => l(:button_reply)) if !topic.locked? && authorize_for('messages', 'reply') %>

View File

@ -28,32 +28,29 @@
</div>
</div>
<div class=" talklist_box" >
<p class="c_dark mb5">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p>
<p class="c_dark mb5 f14">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p>
<% if @topics.any? %>
<% @topics.each do |topic| %>
<div class="talkmain_box" id="topic<%= topic.id %>" nhname="container_board" mhname="container_board_reply" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;">
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
<div class="talkmain_txt fl mt5">
<div class="talkmain_txt fl mt5 f14">
<% author = topic.author.to_s %>
<div style="max-width:60px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;">
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl ",:title=>author,
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl f14",:title=>author,
:style=>'max-width:60px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;' %>
</div>
<p style="float:left;color:#ff5722;">&nbsp;&nbsp;:</p>
<p class="talkmain_tit fl fb break_word" title="<%= h(topic.subject) %>" style="width:auto;float:left;max-width:415px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;">&nbsp;&nbsp;<%= h(topic.subject) %></p>
<p class="talkmain_tit fl fb break_word f14" title="<%= h(topic.subject) %>" style="width:auto;float:left;max-width:415px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;">&nbsp;&nbsp;<%= h(topic.subject) %></p>
<div style="float:right;max-width:110px;">
<% if topic.editable_by?(User.current) %>
<a href="javascript:void(0)" nhname="showbtn" style="color: #426e9a;float: right;margin-right: 10px;"><%= l(:button_edit) %></a>
<% end %>
<%= link_to(
l(:button_delete),
{:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'},
<%= link_to(l(:button_delete), {:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'talk_edit fr',
:style => ' margin-right: 10px;'
) if topic.destroyable_by?(User.current) %>
:style => ' margin-right: 10px;') if topic.destroyable_by?(User.current) %>
<% if topic.sticky? %>
<a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%= l(:label_board_sticky)%></a>
<% end %>
@ -95,7 +92,7 @@
</script>
</div>
<div class="cl"></div>
<div class="project_board_content break_word" id="content_<%=topic.id%>">
<div class="project_board_content break_word f14" id="content_<%=topic.id%>">
<div id="contentmessage<%=topic.id %>" class="upload_img">
<%= topic.content.html_safe %>
<!-- -->
@ -111,7 +108,7 @@
<%= l(:label_activity_time)%>&nbsp;&nbsp;<%= format_time topic.created_on %>
</div>
<% if User.current.logged? %>
<a href="javascript:void(0)" nhname="showbtn_reply" class="c_dblue fr" style="margin-right:10px;"><%= l(:button_reply) %></a>
<a href="javascript:void(0)" nhname="showbtn_reply" class="c_dblue fr f14" style="margin-right:10px;"><%= l(:button_reply) %></a>
<% end %>
<div class="cl"></div>
<div class="talk_new ml15 mb10" nhname='about_talk' id="about_newtalk<%=topic.id%>" style="display: none;border-top: 1px dashed #d9d9d9;padding-top:5px;margin-left:0px;padding-left:15px;">
@ -141,8 +138,7 @@
</div>
<% end %>
<div class="cl"></div>
<% replies_all = topic.children.includes(:author, :attachments, {:board => :project}).
reorder("#{Message.table_name}.id desc").all %>
<% replies_all = topic.children.includes(:author, :attachments, {:board => :project}).reorder("#{Message.table_name}.id desc").all %>
<% unless replies_all.empty? %>
<div class="talkWrapMsg" nhname="nh_reply_div" id="nh_reply_div_<%= topic.id %>">
<ul>
@ -152,29 +148,23 @@
<li nhname="reply_rec" style="display:<%= replies_all_i>2?'none':'' %>">
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
<div class="Msg_txt">
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
<%= link_to_user_header message.author,false,:class => 'fl c_orange f14 ' %>
<br/>
<div class="fl break_word">
<div class="fl break_word f14">
<%= textAreailizable message,:content,:attachments => message.attachments %>
<!-- -->
</div>
<input nhname="nh_content_val" type="hidden" value="<%= message.content %>"/>
<br/><div class="cl"></div>
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
<%= link_to(
l(:button_delete),
{:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
<span class=" c_grey fl f14"><%= format_time(message.created_on) %></span>
<%= link_to(l(:button_delete),{:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete),
:class => ' c_dblue fr'
) if message.course_destroyable_by?(User.current) %>
<%= link_to(
l(:button_reply),
'javascript:;',
:class => ' c_dblue fr f14') if message.course_destroyable_by?(User.current) %>
<%= link_to(l(:button_reply), 'javascript:;',
:nhname =>'showbtn_child_reply',
:class => ' c_dblue fr',
:class => ' c_dblue fr f14',
:style => 'margin-right: 10px;',
:title => l(:button_reply)) if !topic.locked? && authorize_for('messages', 'reply') %>
</div>

View File

@ -50,9 +50,6 @@
}
}
</script>
<div class="add_frame_header" >
<%= l(:bale_news_notice) %>
</div>
<div class="box tabular">
<p>
<%= f.text_field :title,

View File

@ -6,12 +6,12 @@
<%= link_to image_tag(url_to_avatar(journal.user),:width => '46',:height => '46'), user_path(journal.user) %>
</div>
<div class="ping_discon upload_img" style="width: 610px;">
<div class="ping_distop">
<div class="ping_distop f14">
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
<span>
<%= link_to "#{journal.user.show_name}(#{journal.user.login})", user_path(journal.user),:class => 'c_blue fb fl mb10', :target => "_blank"%>
<%= link_to User.current.member_of_course?(@course) ? "#{journal.user.show_name}(#{journal.user.login})" : "#{journal.user.login}", user_path(journal.user),:class => 'c_blue fb fl mb10 f14', :target => "_blank"%>
</span>
<span class="c_grey fr">
<span class="c_grey fr f14">
<%= format_time(journal.created_on) %>
</span>
<div class="cl"></div>
@ -20,12 +20,11 @@
</p>
<div class="cl"></div>
</div>
<div class="ping_disfoot">
<div class="ping_disfoot f14">
<% ids = 'project_respond_form_'+ journal.id.to_s%>
<% if journal.user == User.current|| User.current.admin? || (@course && User.current.allowed_to?(:as_teacher,@course)) %>
<%= link_to(l(:label_bid_respond_delete),
{:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user},
<%= link_to(l(:label_bid_respond_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete',
:class => "delete", :title => l(:button_delete)) %>
<% end %>
@ -43,9 +42,7 @@
</div>
<% end %>
<div class="cl"></div>
<%= render :partial => "words/journal_reply", :locals => {:journal => journal, :show_name => true , :allow_delete => @course && User.current.allowed_to?(:as_teacher,@course)} %>
</div>
<div class="cl"></div>
</div>

View File

@ -21,7 +21,7 @@
<img src="/images/pic_del.gif" width="11" height="12" alt="删除班级" title="删除该班级" />
</a>
<% end%>
<a href="javascript:void(0)" class="f_l" style="padding-left: 5px;" onclick="$('#group_name_<%= group.id %>').val('');$('#edit_group_<%= group.id %>').slideToggle();">
<a href="javascript:void(0)" class="f_l" style="padding-left: 5px;" onclick="$('#group_name_<%= group.id %>').val('');$('#edit_group_<%= group.id %>').slideToggle();$('#new_group_name').hide();">
<img src="/images/pic_edit.png" width="14" height="15" alt="编辑班级" />
</a>
<% end %>
@ -42,7 +42,7 @@
<% if @canShowCode %>
<li style="margin-left:15px;margin-top: 2px;">
<a href="javascript:void(0)" class="st_add f_l" onclick="$('#group_name').value='';$('#new_group_name').slideToggle();">+添加分班</a>
<a href="javascript:void(0)" class="st_add f_l" onclick="$('#group_name').value='';$('#new_group_name').slideToggle();$('#edit_group_36').hide();">+添加分班</a>
</li>
<li >
<span id="new_group_name" style="display:none; vertical-align: middle;" class="ml10 f_l">

View File

@ -41,7 +41,7 @@
<div class="re_top">
<%= form_tag( search_project_project_files_path(@project), method: 'get',:class => "re_search f_l",:remote=>true) do %>
<%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%>
<%= submit_tag "内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()" %>
<%= submit_tag "项目内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()", :style =>"width:72px;" %>
<%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
<% end %>
<% manage_allowed = User.current.allowed_to?(:manage_files, @project) %>

View File

@ -30,25 +30,13 @@
<% end %>
</div>
<!--modified by huang-->
<% #= link_to '发布帖子', new_forum_memo_path(@forum), :class => 'icon icon-add' %>
<span class="contextual-borad">
<%= link_to(
image_tag('edit.png')+l(:label_forum_edit),
{:action => 'edit', :id => @forum},
:method => 'get',
:title => l(:button_edit)
) if @forum.editable_by?(User.current) %>
<%= link_to(
image_tag('delete.png')+'删除讨论区',
{:action => 'destroy', :id => @forum},
:method => :delete,
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
<%= link_to(image_tag('edit.png')+l(:label_forum_edit),{:action => 'edit', :id => @forum}, :method => 'get', :title => l(:button_edit)) if @forum.editable_by?(User.current) %>
<%= link_to(image_tag('delete.png')+'删除讨论区', {:action => 'destroy', :id => @forum}, :method => :delete, :data => {:confirm => l(:text_are_you_sure)}, :title => l(:button_delete)
) if @forum.destroyable_by?(User.current) %>
</span>
<span>
<%= link_to l(:label_memo_new_from_forum), new_forum_memo_path(@forum), :class => 'icon icon-add',
:onclick => 'showAndScrollTo("add-memo", "memo_subject"); return false;' if User.current.logged? %>
</span>
<%= render :partial => 'forums/show_topics', :locals => {:memos => @memos} %>

View File

@ -61,13 +61,10 @@
<div class="mt5">
<span class="tit_fb" style="width: auto;"> 扣分标准:</span>
<div class="fl mb5 c_red">
迟交扣
<%= homework.late_penalty%>
<% if homework.homework_type == 1%>
,缺评一个作品扣
<%= homework.homework_detail_manual.absence_penalty%>
<%= scoring_rules homework.late_penalty,homework.id,@is_teacher,homework.homework_detail_manual.absence_penalty%>
<% else%>
<%= scoring_rules homework.late_penalty,homework.id,@is_teacher%>
<% end%>
</div>
</div>

View File

@ -7,12 +7,12 @@
<div class="problem_main">
<% column_content = ( query.inline_columns.map {|column| "#{column_content_new(column, issue)}"}) %>
<% unless issue.author.nil? || issue.author.name == "Anonymous" %>
<span class="issues_icon fl"></span>
<span class ="<%= get_issue_type(column_content[1])[0] %>"></span>
<div class="problem_txt 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>
<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_priority(column_content[3])[0]}'>#{get_issue_priority(column_content[3])[1]}</span>".html_safe, issue_path(issue.id), :class => "problem_tit_a break_word",:target => "_blank" %>
</div>
<div class="cl"></div>
<p>

View File

@ -14,8 +14,9 @@
</div>
<div class="talk_txt fl">
<p class="pro_page_tit" style="word-break:break-all;">
<%= @issue.subject %>
<span class='<%= "#{get_issue_type(@issue.tracker_id)[0]}" %>'><%= get_issue_type(@issue.tracker_id)[1] %></span>
<span class='<%= "#{get_issue_type(@issue.tracker_id)[0]} fl" %>'><%= get_issue_type(@issue.tracker_id)[1] %></span>
<span style="padding-left: 5px;"><%= @issue.subject %></span>
<span class='<%= "#{get_issue_priority(@issue.priority_id)[0]} " %>'><%= get_issue_priority(@issue.priority_id)[1] %></span>
</p><br/>
<div class="cl"></div>

View File

@ -26,7 +26,7 @@
<li id="my_courses_li">
<%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id},target:"_blank", :class => "parent" %>
<ul id="my_courses_ul">
<% user_course.each do |course| %>
<% user_course.reverse.each do |course| %>
<li title="<%=course.name%>">
<%= link_to course.name, {:controller => 'courses',:action => 'show',:id => course.id},target:"_blank" %>
</li>
@ -40,7 +40,7 @@
<li id="my_projects_li">
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name},target:"_blank", :class => "parent" %>
<ul id="my_projects_ul" >
<% User.current.projects.each do |project| %>
<% User.current.projects.reverse.each do |project| %>
<li title="<%=project.name%>">
<%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name }, target:"_blank" %>
</li>

View File

@ -4,7 +4,7 @@
<ul class="course_sub_menu">
<% course_index = 0 %>
<% User.current.courses.each do |course| %>
<% User.current.courses.reverse.each do |course| %>
<% if !course_endTime_timeout?(course) %>
<%= render :partial => 'layouts/user_homework_list', :locals => {:course => course,:course_index => course_index} %>
<% course_index += 1 %>

View File

@ -2,7 +2,7 @@
<li id="project_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name} %>
<ul class="project_sub_menu" style="top:<%= hasCourse ? 35 : 0 %>px;">
<% User.current.projects.each do |project| %>
<% User.current.projects.reverse.each do |project| %>
<li style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%=project.name%>">
<%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name } %>
</li>

View File

@ -66,7 +66,8 @@
<%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => 'regexName1();', :width => "125px", :style=>"float:left" %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" >
<!--<a href="#" onclick="submitSerch();" class="ButtonColor" style="float:left;padding-top: 3px; margin: 0px;padding-bottom:0px; padding-left:8px;" >-->
<a href="#" onclick="submitSerch();" class="enterprise" style="padding-top: 3px; margin: 0px;padding-bottom:0px; margin-top: 1px; margin-left: 3px; background:#15bccf repeat">
<%= l(:label_search)%>
</a>
<br />

View File

@ -4,15 +4,15 @@
<div class="ping_C" id='word_li_<%= journal.id.to_s %>'>
<div class="ping_dispic"><%= link_to image_tag(url_to_avatar(journal.user),:width => '46',:height => '46'), user_path(journal.user) %></div>
<div class="ping_discon" style="width: 610px;">
<div class="ping_distop">
<div class="ping_distop f14">
<!-- <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), :class => 'c_blue fb fl mb10', :target => "_blank" %>
</span><span class="c_grey fr"><%= format_time(journal.created_on) %></span>
<span><%= link_to journal.user, user_path(journal.user), :class => 'c_blue fb fl mb10 f14', :target => "_blank" %>
</span><span class="c_grey fr f14"><%= format_time(journal.created_on) %></span>
<div class="cl"></div>
<!--<p><%#= textilizable journal.notes%></p>-->
<p><%=journal.notes.html_safe%>
</div>
<div class="ping_disfoot">
<div class="ping_disfoot f14">
<% ids = 'project_respond_form_'+ journal.id.to_s%>
<% if journal.user == User.current|| User.current.admin? %>
<%= link_to(l(:label_bid_respond_delete),
@ -31,7 +31,7 @@
<div class="cl"></div>
<% ids = 'project_respond_form_'+ journal.id.to_s%>
<% if reply_allow %>
<div id='<%= ids %>' class="respond-form">
<div id='<%= ids %>' class="respond-form f14">
<%= render :partial => 'words/new_respond_project', :locals => {:journal => journal, :m_reply_id => journal,:show_name => true} %>
</div>
<% end %>

View File

@ -4,4 +4,5 @@
<div>&nbsp;&nbsp;&nbsp; <%= l('userscore.active.commit.attachments')%> * 4 = <%= option_num.attachment %> * 4 = <%= option_num.attachment * 4 %></div>
<div>&nbsp;&nbsp;&nbsp; <%= l('userscore.active.update_issues')%> * 2 = <%= option_num.issue_done_ratio %> * 2 = <%= option_num.issue_done_ratio * 2 %></div>
<div>&nbsp;&nbsp;&nbsp; <%= l('userscore.active.release_issues')%> * 4 = <%= option_num.post_issue %> * 4 = <%= option_num.post_issue * 4 %></div>
<div>&nbsp;&nbsp;&nbsp; <%= l(:label_user_score_of_active)%> = <%= option_num.changeset * 4 %> + <%= option_num.document * 4 %> + <%= option_num.attachment * 4 %> + <%= option_num.issue_done_ratio * 2 %> + <%= option_num.post_issue * 4 %> = <%= active(option_num) %> </div>
<div>&nbsp;&nbsp;&nbsp; <%= l('userscore.active.release_messages')%> * 1 = <%= option_num.memo %> * 2 = <%= option_num.memo * 2 %></div>
<div>&nbsp;&nbsp;&nbsp; <%= l(:label_user_score_of_active)%> = <%= option_num.changeset * 4 %> + <%= option_num.document * 4 %> + <%= option_num.attachment * 4 %> + <%= option_num.issue_done_ratio * 2 %> + <%= option_num.post_issue * 4 %> + <%= option_num.memo * 2 %> = <%= active(option_num) %> </div>

View File

@ -1,7 +1,5 @@
<div>&nbsp;&nbsp;&nbsp; <%= l('userscore.collaboration.memos')%> * 2 = <%= option_num.memo %> * 2 = <%= option_num.memo * 2 %></div>
<div>&nbsp;&nbsp;&nbsp; <%= l('userscore.collaboration.message_for_issues')%> * 1 = <%= option_num.messages_for_issues %> * 1 = <%= option_num.messages_for_issues * 1 %></div>
<div>&nbsp;&nbsp;&nbsp; <%= l('userscore.collaboration.issue_status')%> * 1 = <%= option_num.issues_status %> * 1= <%= option_num.issues_status * 1 %></div>
<div>&nbsp;&nbsp;&nbsp; <%= l('userscore.collaboration.reply_for_messages')%> * 1 = <%= option_num.replay_for_message %> * 1 = <%= option_num.replay_for_message * 1 %></div>
<div>&nbsp;&nbsp;&nbsp; <%= l('userscore.collaboration.reply_for_memos')%> * 1 = <%= option_num.replay_for_memo %> * 1 = <%= option_num.replay_for_memo * 1 %></div>
<div>&nbsp;&nbsp;&nbsp; <%= l(:label_user_score_of_collaboration)%> = <%= option_num.memo * 2 %> + <%= option_num.messages_for_issues * 1 %> + <%= option_num.issues_status * 1 %> + <%= option_num.replay_for_message * 1 %> + <%= option_num.replay_for_memo * 1 %> = <%= collaboration(option_num) %>  </div>
<div>&nbsp;&nbsp;&nbsp; <%= l(:label_user_score_of_collaboration)%> = <%= option_num.messages_for_issues * 1 %> + <%= option_num.issues_status * 1 %> + <%= option_num.replay_for_message * 1 %> + <%= option_num.replay_for_memo * 1 %> = <%= collaboration(option_num) %>  </div>

View File

@ -387,7 +387,7 @@
<%= l(:label_i_new_activity) %>
</span>
&nbsp;
<%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %>
<%= link_to format_activity_title(" #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %>
</td>
<% else %>
<td colspan="2" valign="top">

View File

@ -28,7 +28,7 @@
<td colspan="2" valign="top" width="50" ><img src="/images/new/news.png" width="40" height="40"/></td>
<td><table width="580" border="0">
<tr>
<td colspan="2" valign="top"><strong> <%= content_tag('span', h(e.project), :class => 'project') %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span>
<td colspan="2" valign="top"><strong> <%= content_tag('span', h(e.project), :class => 'project') %></strong>
<% if e.event_type.eql?("message") || e.event_type.eql?("reply") %>
<%= link_to format_activity_title(e.event_title), e.board.project ? project_boards_path(e.board.project,:topic_id => e.id):course_boards_path(e.board.course,:topic_id => e.id) %>
<%else %>

View File

@ -6,21 +6,27 @@
<div class="recall" id='word_li_<%=reply.id.to_s%>' onmouseover="$('#<%= ids_r %>').show()" onmouseout="$('#<%= ids_r %>').hide()">
<div class="recall_head">
<% if show_name %>
<%= image_tag url_to_avatar(reply.user.show_name),:width => '30',:height => '30' %>
<%= image_tag url_to_avatar(journal.user),:width => '30',:height => '30' %>
<% else %>
<%= image_tag url_to_avatar(nil),:width => '30',:height => '30' %>
<% end %>
</div>
<div class="recall_con">
<div class="recall_con f14">
<% id = 'project_respond_form_'+ reply.id.to_s %>
<%= link_to "#{reply.user.show_name}(#{reply.user.login})", user_path(reply.user) %>
<% if User.current.member_of_course?(@course) %>
<%= link_to User.current.member_of_course?(@course)? "#{reply.user.show_name}(#{reply.user.login})" : "#{reply.user.login}" , user_path(reply.user) %>
<%= l(:label_reply_to)%>
<% if show_name %>
<%= link_to "#{parent_jour.user.show_name}(#{parent_jour.user.login})", user_path(parent_jour.user) %>
<% else %>
<%= l(:label_anonymous) %>
<%#= 之所以改成这样是因为觉得没有真实姓名的用“匿名用户”替换不合理 %>
<%= link_to "#{parent_jour.user}", user_path(parent_jour.user) %>
<% end %>
<% else %>
<%= link_to "#{reply.user}", user_path(reply.user) %>
<%= l(:label_reply_to)%>
<%= link_to "#{parent_jour.user}", user_path(parent_jour.user) %>
<% end %>
<p>
<%= reply.notes.html_safe %>
</p>

View File

@ -68,6 +68,7 @@ zh:
attachments: 提交附件次数
update_issues: 更新缺陷完成度次数
release_issues: 发布缺陷数量
release_messages: 发布帖子数量
label_score_less_than_zero: 得分小于0修正为0
label_user_info: "个人简介"

View File

@ -1903,9 +1903,9 @@ zh:
lable_teacher_evaluation: 作业综评
lable_course_teacher: 主讲老师
lable_course_end: 课程学期已结束
label_no_contest_news_description: 竞赛描述不能为空
label_no_contest_news_description: 竞赛通知描述不能为空
label_contest_news_condition: 竞赛描述超过5000个汉字
label_no_contest_news_title: 竞赛标题不能为空
label_no_contest_news_title: 竞赛通知标题不能为空
label_contest_news_title_condition: 竞赛标题超过255个汉字
label_course_organizers: 开设单位
@ -2025,6 +2025,7 @@ zh:
label_evaluation_time: 匿评时间
label_file_lost_list: 缺失文件列表
lable_unset: 未设置

View File

@ -723,6 +723,16 @@ ActiveRecord::Schema.define(:version => 20150709071731) do
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
create_table "journal_details_copy", :force => true do |t|
t.integer "journal_id", :default => 0, :null => false
t.string "property", :limit => 30, :default => "", :null => false
t.string "prop_key", :limit => 30, :default => "", :null => false
t.text "old_value"
t.text "value"
end
add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id"
create_table "journal_replies", :id => false, :force => true do |t|
t.integer "journal_id"
t.integer "user_id"

View File

@ -522,8 +522,7 @@
/* statusbar */
.ke-statusbar {
position: relative;
background-color: #F0F0EE;
border-top: 1px solid #CCCCCC;
font-size: 0;
line-height: 0;
*height: 12px;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -3,7 +3,7 @@
}
.jstEditor textarea, .jstEditor iframe {
margin: 0;
margin-left: 80px;
margin-left: 0px;
}
.jstHandle {

View File

@ -95,6 +95,12 @@ a.pro_mes_w_news{ height:20px; float:right;display:block; color:#999999;}
.pro_info_box ul li{ height:24px;}
.pro_info_p{color:#0781b4 !important; float:left; width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; }
.edit_pro_box{overflow:hidden;display:none; margin-bottom:30px; border-bottom:1px dashed #CCC; padding-bottom:10px;}
/*问题状态图片*/
.issues{ background:url(../images/public_icon.png) -66px 5px no-repeat; width:16px; height:21px;}
.duty{ background:url(../images/public_icon.png) -66px -18px no-repeat; width:16px; height:21px;}
.support{ background:url(../images/public_icon.png) -66px -45px no-repeat; width:16px; height:21px;}
.function{ background:url(../images/public_icon.png) -66px -70px no-repeat; width:16px; height:21px;}
.weekly{ background:url(../images/public_icon.png) -66px -95px no-repeat; width:16px; height:21px;}
/****翻页***/
ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }
ul.wlist li{float: left;}
@ -153,7 +159,7 @@ a:hover.c_dblue{ color: #0781b4;}
.re_top input{ float:left;}
.re_search{ margin-top:7px; margin-left:5px;}
.re_schbox{ width:240px; height:24px; border:1px solid #64bdd9; color:#666666;}
.re_schbtn{ width:60px; height:26px; color:#fff; margin-right:5px; border:none; margin-left:0px; }
.re_schbtn{ width: 60px;height: 26px;color: #FFF;margin-right: 5px;margin-left: 0px;padding-left: 0px;border: medium none; }
a.re_fabu { display:block; width:90px; height:30px; font-size:14px; color:#fff; text-align:center; padding-top:10px; }
a:hover.re_fabu{background:#55a1b9;}
.re_con{ margin:5px; width:665px;}

View File

@ -1698,6 +1698,23 @@ div.project-search {
}
/*huang*/
/*zhangshen*/
a.enterprise {
float:left;
text-align: center;
width: 40px;
height: 18px;
font-family: '微软雅黑',Arial,Helvetica,sans-serif;
font-size: 12px;
color:#fff;
padding: 0px;
border-radius:4px;
border: 1px solid rgb(148, 148, 148);
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.2), 0px 0px 2px rgb(255, 255, 255) inset;
text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.1), 0px 0px 0px rgb(255, 255, 255);
cursor: pointer;
}
input.enterprise[type="button"] {
padding-bottom: 5px;
width: 55px;