Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts: db/schema.rb
This commit is contained in:
commit
58613e843b
|
@ -39,9 +39,14 @@ class CoursesController < ApplicationController
|
|||
else
|
||||
@state = 5 #未登录
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js { render :partial => 'set_join', :locals => {:user => user, :course => course, :object_id => params[:object_id]} }
|
||||
end
|
||||
# if @state == 1 || @state == 3
|
||||
# respond_to course_path(course.id)
|
||||
# else
|
||||
respond_to do |format|
|
||||
format.js { render :partial => 'set_join', :locals => {:user => user, :course => course, :object_id => params[:object_id]} }
|
||||
end
|
||||
#end
|
||||
|
||||
rescue Exception => e
|
||||
@state = 4 #已经加入了课程
|
||||
respond_to do |format|
|
||||
|
@ -101,74 +106,17 @@ class CoursesController < ApplicationController
|
|||
# 课程搜索
|
||||
# add by nwb
|
||||
def search
|
||||
courses_all = Course.all_course
|
||||
name = params[:name]
|
||||
if name.blank?
|
||||
@courses = []
|
||||
@courses_all = []
|
||||
@course_count = 0
|
||||
@course_pages = Paginator.new @course_count, per_page_option, params['page']
|
||||
if params[:name].empty?
|
||||
courses = Course.visible
|
||||
@courses = paginateHelper courses,10
|
||||
else
|
||||
@courses = courses_all.visible
|
||||
if params[:name].present?
|
||||
@courses_all = @courses.like(params[:name])
|
||||
else
|
||||
@courses_all = @courses;
|
||||
end
|
||||
@course_count = @courses_all.count
|
||||
@course_pages = Paginator.new @course_count, per_page_option, params['page']
|
||||
|
||||
# 课程的动态数
|
||||
@course_activity_count=Hash.new
|
||||
@courses_all.each do |course|
|
||||
@course_activity_count[course.id]=0
|
||||
end
|
||||
|
||||
case params[:course_sort_type]
|
||||
when '0'
|
||||
@courses = @courses_all.order("created_at desc")
|
||||
@s_type = 0
|
||||
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
|
||||
|
||||
@course_activity_count=get_course_activity @courses,@course_activity_count
|
||||
|
||||
when '1'
|
||||
@courses = @courses_all.order("course_ac_para desc")
|
||||
@s_type = 1
|
||||
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
|
||||
|
||||
@course_activity_count=get_course_activity @courses,@course_activity_count
|
||||
|
||||
when '2'
|
||||
@courses = @courses_all.order("watchers_count desc")
|
||||
@s_type = 2
|
||||
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
|
||||
|
||||
@course_activity_count=get_course_activity @courses,@course_activity_count
|
||||
|
||||
when '3'
|
||||
@course_activity_count=get_course_activity @courses_all,@course_activity_count_array
|
||||
@courses=handle_course @courses_all,@course_activity_count
|
||||
@s_type = 3
|
||||
@courses = @courses[@course_pages.offset, @course_pages.per_page]
|
||||
|
||||
else
|
||||
@s_type = 0
|
||||
@courses = @courses_all.order("created_at desc")
|
||||
@courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page)
|
||||
|
||||
@course_activity_count=get_course_activity @courses,@course_activity_count
|
||||
|
||||
end
|
||||
courses = Course.visible.where("LOWER(name) like '%#{params[:name].to_s.downcase}%'")
|
||||
@courses = paginateHelper courses,10
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render :layout => 'course_base'
|
||||
scope = Course
|
||||
unless params[:closed]
|
||||
scope = scope.active
|
||||
end
|
||||
}
|
||||
format.atom {
|
||||
courses = Course.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all
|
||||
|
@ -658,92 +606,9 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
if params[:jump] && redirect_to_course_menu_item(@course, params[:jump])
|
||||
return
|
||||
end
|
||||
@users_by_role = @course.users_by_role
|
||||
if(User.find_by_id(CourseInfos.find_by_course_id(@course.id).try(:user_id)))
|
||||
@user = User.find_by_id(CourseInfos.find_by_course_id(@course.id).user_id)
|
||||
end
|
||||
@key = User.current.rss_key
|
||||
#新增内容
|
||||
@days = Setting.activity_days_default.to_i
|
||||
if params[:from]
|
||||
begin; @date_to = params[:from].to_date + 1; rescue; end
|
||||
end
|
||||
has = {
|
||||
"show_course_files" => true,
|
||||
"show_course_news" => true,
|
||||
"show_course_messages" => true,
|
||||
#"show_course_journals_for_messages" => true,
|
||||
# "show_bids" => true,
|
||||
# "show_homeworks" => true,
|
||||
"show_polls" => true
|
||||
}
|
||||
@date_to ||= Date.today + 1
|
||||
@date_from = (@date_to - @days) > @course.created_at.to_date ? (@date_to - @days) : @course.created_at.to_date
|
||||
@author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
|
||||
if @author.nil?
|
||||
# 显示老师和助教的活动
|
||||
# @authors = searchTeacherAndAssistant(@course)
|
||||
@authors = course_all_member(@course)
|
||||
events = []
|
||||
key = "course_events_#{@course.id}".to_sym
|
||||
if Rails.env.production? && Setting.course_cahce_enabled?
|
||||
events = Rails.cache.read(key) || []
|
||||
end
|
||||
if events.empty?
|
||||
@authors.each do |author|
|
||||
@activity = Redmine::Activity::Fetcher.new(User.current, :course => @course,
|
||||
:with_subprojects => false,
|
||||
:author => author.user)
|
||||
|
||||
@activity.scope_select {|t| has["show_#{t}"]}
|
||||
# modify by nwb
|
||||
# 添加私密性判断
|
||||
if User.current.member_of_course?(@course)|| User.current.admin?
|
||||
events += @activity.events(@days, @course.created_at)
|
||||
else
|
||||
events += @activity.events(@days, @course.created_at, :is_public => 1)
|
||||
end
|
||||
end
|
||||
Rails.cache.write(key, events) if Rails.env.production? && Setting.course_cahce_enabled?
|
||||
end
|
||||
else
|
||||
# @author = @course.teacher
|
||||
@activity = Redmine::Activity::Fetcher.new(User.current, :course => @course,
|
||||
:with_subprojects => false,
|
||||
:author => @author)
|
||||
|
||||
@activity.scope_select {|t| has["show_#{t}"]}
|
||||
# modify by nwb
|
||||
# 添加私密性判断
|
||||
if User.current.member_of_course?(@course)|| User.current.admin?
|
||||
events = @activity.events(@days, @course.created_at)
|
||||
else
|
||||
events = @activity.events(@days, @course.created_at, :is_public => 1)
|
||||
end
|
||||
end
|
||||
|
||||
# 无新动态时,显示老动态
|
||||
if events.count == 0
|
||||
if User.current.member_of_course?(@course)|| User.current.admin?
|
||||
events = @activity.events
|
||||
else
|
||||
events = @activity.events(:is_public => 1)
|
||||
end
|
||||
end
|
||||
@sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category'
|
||||
if(User.find_by_id(CourseInfos.find_by_course_id(@course.id).try(:user_id)))
|
||||
@user = User.find_by_id(CourseInfos.find_by_course_id(@course.id).user_id)
|
||||
end
|
||||
|
||||
sorted_events = sort_activity_events_course(events)
|
||||
events = paginateHelper sorted_events,10
|
||||
@events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)}
|
||||
# documents
|
||||
|
||||
|
||||
course_activities = @course.course_activities.order("created_at desc")
|
||||
@canShowRealName = User.current.member_of_course? @course
|
||||
@course_activities = paginateHelper course_activities,10
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_courses'}
|
||||
format.api
|
||||
|
|
|
@ -177,11 +177,11 @@ class FilesController < ApplicationController
|
|||
def index
|
||||
@flag = params[:flag] || false
|
||||
#sort_init 'filename', 'asc'
|
||||
sort_init 'created_on', 'desc'
|
||||
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
|
||||
'filename' => "#{Attachment.table_name}.filename",
|
||||
'size' => "#{Attachment.table_name}.filesize",
|
||||
'downloads' => "#{Attachment.table_name}.downloads"
|
||||
# sort_init 'created_on', 'desc'
|
||||
# sort_update 'created_on' => "#{Attachment.table_name}.created_on",
|
||||
# 'filename' => "#{Attachment.table_name}.filename",
|
||||
# 'size' => "#{Attachment.table_name}.filesize",
|
||||
# 'downloads' => "#{Attachment.table_name}.downloads"
|
||||
sort = ""
|
||||
@sort = ""
|
||||
@order = ""
|
||||
|
|
|
@ -19,28 +19,28 @@ class HomeworkCommonController < ApplicationController
|
|||
end
|
||||
|
||||
def new
|
||||
# @homework_type = "1"
|
||||
#
|
||||
# @homework = HomeworkCommon.new
|
||||
# @homework.safe_attributes = params[:homework_common]
|
||||
# @homework.late_penalty = 2
|
||||
# @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
|
||||
# @homework.publish_time = Time.now.strftime('%Y-%m-%d')
|
||||
#
|
||||
# if @homework_type == "1"
|
||||
# #匿评作业相关属性
|
||||
# @homework_detail_manual = HomeworkDetailManual.new
|
||||
# @homework_detail_manual.ta_proportion = 0.6
|
||||
# @homework_detail_manual.absence_penalty = 2
|
||||
# @homework_detail_manual.evaluation_num = 3
|
||||
# @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
|
||||
# @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
|
||||
# @homework.homework_detail_manual = @homework_detail_manual
|
||||
# elsif @homework_type == "2"
|
||||
# #编程作业相关属性
|
||||
# @homework_detail_programing = HomeworkDetailPrograming.new
|
||||
# @homework.homework_detail_programing = @homework_detail_programing
|
||||
# end
|
||||
@homework_type = "1"
|
||||
|
||||
@homework = HomeworkCommon.new
|
||||
@homework.safe_attributes = params[:homework_common]
|
||||
@homework.late_penalty = 2
|
||||
@homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
|
||||
@homework.publish_time = Time.now.strftime('%Y-%m-%d')
|
||||
|
||||
if @homework_type == "1"
|
||||
#匿评作业相关属性
|
||||
@homework_detail_manual = HomeworkDetailManual.new
|
||||
@homework_detail_manual.ta_proportion = 0.6
|
||||
@homework_detail_manual.absence_penalty = 2
|
||||
@homework_detail_manual.evaluation_num = 3
|
||||
@homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
|
||||
@homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
|
||||
@homework.homework_detail_manual = @homework_detail_manual
|
||||
elsif @homework_type == "2"
|
||||
#编程作业相关属性
|
||||
@homework_detail_programing = HomeworkDetailPrograming.new
|
||||
@homework.homework_detail_programing = @homework_detail_programing
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
|
|
|
@ -72,7 +72,7 @@ class NewsController < ApplicationController
|
|||
|
||||
@news_count = scope.count
|
||||
@q = params[:subject]
|
||||
if params[:subject].nil?
|
||||
if params[:subject].nil? || params[:subject].blank?
|
||||
scope_order = scope.all(:include => [:author, :course],
|
||||
:order => "#{News.table_name}.created_on DESC")
|
||||
else
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#encoding utf-8
|
||||
class PollController < ApplicationController
|
||||
before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result,:close_poll,:export_poll]
|
||||
before_filter :find_container, :only => [:new,:create, :index]
|
||||
|
@ -412,8 +413,10 @@ class PollController < ApplicationController
|
|||
|
||||
# 将其他地方的问卷导出来
|
||||
def other_poll
|
||||
# 查作者是我,且不在当前课程内的问卷 进行导入
|
||||
@polls = Poll.where("user_id = #{User.current.id} and polls_type = 'course' and polls_group_id != #{params[:polls_group_id]}")
|
||||
# 查作者是我,或者作者是当前课程的老师,且不在当前课程内的问卷 进行导入
|
||||
tea_ids = '('
|
||||
tea_ids << Course.find(params[:polls_group_id]).tea_id.to_s << ','<< User.current.id.to_s << ')'
|
||||
@polls = Poll.where("user_id in #{tea_ids} and polls_type = 'course' and polls_group_id != #{params[:polls_group_id]}")
|
||||
@polls_group_id = params[:polls_group_id]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
@ -427,7 +430,7 @@ class PollController < ApplicationController
|
|||
params[:polls].each_with_index do |p,i|
|
||||
poll = Poll.find(p)
|
||||
option = {
|
||||
:polls_name => poll.polls_name,
|
||||
:polls_name => poll.polls_name || l(:label_poll_new),
|
||||
:polls_type => 'Course',
|
||||
:polls_group_id => course_id,
|
||||
:polls_status => 1,
|
||||
|
|
|
@ -86,8 +86,14 @@ class ProjectsController < ApplicationController
|
|||
@project_pages = Project.project_entities.visible.like(params[:name]).page(params[:page]).per(10)
|
||||
else
|
||||
@project_pages = Project.project_entities.visible.page(params[:page] ).per(10)
|
||||
@project_pages = Project.project_entities.visible.page(params[:page] ).per(10)
|
||||
end
|
||||
@projects = @project_pages.order("created_on desc")
|
||||
@limit = 10#per_page_option
|
||||
|
||||
@project_count = Project.project_entities.visible.like(params[:name]).page(params[:page]).count
|
||||
@project_pages = Paginator.new @project_count, @limit, params['page']
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render :layout => 'base'
|
||||
|
|
|
@ -118,7 +118,7 @@ class UsersController < ApplicationController
|
|||
return
|
||||
end
|
||||
end
|
||||
projects = @user.projects.visible.order("updated_on desc")
|
||||
projects = @user.projects.visible.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc")
|
||||
if(params[:status] == '1')
|
||||
projects = projects.where("projects.user_id = ?",@user.id)
|
||||
elsif(params[:status] == '2')
|
||||
|
@ -248,7 +248,7 @@ class UsersController < ApplicationController
|
|||
return
|
||||
end
|
||||
end
|
||||
courses = @user.courses.visible.order("created_at desc")
|
||||
courses = @user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc")
|
||||
if(params[:status] == '1')
|
||||
courses = courses.where("endup_time >= ? or endup_time is null or endup_time=''",Time.now)
|
||||
elsif(params[:status] == '2')
|
||||
|
@ -262,9 +262,11 @@ class UsersController < ApplicationController
|
|||
# modified by fq
|
||||
def user_newfeedback
|
||||
jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
jours.update_all(:is_readed => true, :status => false)
|
||||
jours.each do |journal|
|
||||
fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
|
||||
if User.current == @user
|
||||
jours.update_all(:is_readed => true, :status => false)
|
||||
jours.each do |journal|
|
||||
fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
|
||||
end
|
||||
end
|
||||
@jour = paginateHelper jours,10
|
||||
@state = false
|
||||
|
|
|
@ -1812,7 +1812,7 @@ module ApplicationHelper
|
|||
#获取用户未过期的课程
|
||||
def get_user_course user
|
||||
courses_doing = []
|
||||
user.courses.each do |course|
|
||||
user.courses.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").each do |course|
|
||||
if !course_endTime_timeout?(course)
|
||||
courses_doing.push course
|
||||
end
|
||||
|
@ -2379,17 +2379,18 @@ module ApplicationHelper
|
|||
notice.html_safe
|
||||
end
|
||||
|
||||
def stantard_code
|
||||
"// 这是一个C语言的样例程序
|
||||
// 功能:输入两个整数,输出两者之和
|
||||
// 测试:老师可以给出以下测试集:
|
||||
// 输入1和2,输出3
|
||||
// 输入3和4,输出7
|
||||
// 那么下面这段代码将得到满分
|
||||
#老师C语言的标准代码
|
||||
def c_stantard_code_teacher
|
||||
"// 老师您好!这是一个C语言的样例程序
|
||||
// 程序功能:输入两个整数,输出两者之和
|
||||
// 测试集合:老师可以给出多组测试集,例如:
|
||||
// 输入1和2,输出3
|
||||
// 输入3和4,输出7
|
||||
// ... ...
|
||||
// 系统将根据您给出的测试集对学生代码进行自动评分
|
||||
|
||||
// 注意:编程作业采用命令行传参方式
|
||||
// 程序的所有输入都通过argv传入
|
||||
// 否则您的程序将被判错
|
||||
// 特别提醒:程序采用命令行传参方式,输入通过argv传入
|
||||
// 否则您的作业标准代码将不能通过测试
|
||||
|
||||
#include <stdio.h> //引用必须头文件
|
||||
int main(int argc, char** argv) {
|
||||
|
@ -2398,6 +2399,77 @@ int main(int argc, char** argv) {
|
|||
|
||||
printf(\"%d\",a+b); //输出a+b
|
||||
return 0;
|
||||
}".html_safe
|
||||
end
|
||||
|
||||
#老师C++语言的标准代码
|
||||
def c_stantard_code_teacher_
|
||||
"// 老师您好!这是一个C++语言的样例程序
|
||||
// 程序功能:输入两个整数,输出两者之和
|
||||
// 测试集合:老师可以给出多组测试集,例如:
|
||||
// 输入1和2,输出3
|
||||
// 输入3和4,输出7
|
||||
// ... ...
|
||||
// 系统将根据您给出的测试集对学生代码进行自动评分
|
||||
|
||||
// 特别提醒:程序采用命令行传参方式,输入通过argv传入
|
||||
// 否则您的作业标准代码将不能通过测试
|
||||
|
||||
#include <iostream> //引用必须头文件
|
||||
#include <cstdlib>
|
||||
using namespace std;
|
||||
int main(int argc, char** argv){
|
||||
int a = atoi(argv[1]); //将第一个输入转成整型
|
||||
int b = atoi(argv[2]); //将第二个输入转换为整型
|
||||
cout<<a+b; //输出a+b
|
||||
return 0;
|
||||
}".html_safe
|
||||
end
|
||||
|
||||
#学生C语言的标准代码
|
||||
def c_stantard_code_student
|
||||
"// 同学好!这是一个C语言的样例程序
|
||||
// 程序功能:输入两个整数,输出两者之和
|
||||
// 测试集合:老师可以给出多组测试集,例如:
|
||||
// 输入1和2,输出3
|
||||
// 输入3和4,输出7
|
||||
// ... ...
|
||||
// 系统将根据您给出的测试集对学生代码进行自动评分
|
||||
|
||||
// 特别提醒:程序采用命令行传参方式,输入通过argv传入
|
||||
// 否则您的作业标准代码将不能通过测试
|
||||
|
||||
#include <stdio.h> //引用必须头文件
|
||||
int main(int argc, char** argv) {
|
||||
int a = atoi(argv[1]); //将第一个输入转成整型
|
||||
int b = atoi(argv[2]); //将第二个输入转换为整型
|
||||
|
||||
printf(\"%d\",a+b); //输出a+b
|
||||
return 0;
|
||||
}".html_safe
|
||||
end
|
||||
|
||||
#学生C++语言的标准代码
|
||||
def c_stantard_code_student_
|
||||
"// 同学好!这是一个C++语言的样例程序
|
||||
// 程序功能:输入两个整数,输出两者之和
|
||||
// 测试集合:老师可以给出多组测试集,例如:
|
||||
// 输入1和2,输出3
|
||||
// 输入3和4,输出7
|
||||
// ... ...
|
||||
// 系统将根据您给出的测试集对学生代码进行自动评分
|
||||
|
||||
// 特别提醒:程序采用命令行传参方式,输入通过argv传入
|
||||
// 否则您的作业标准代码将不能通过测试
|
||||
|
||||
#include <iostream> //引用必须头文件
|
||||
#include <cstdlib>
|
||||
using namespace std;
|
||||
int main(int argc, char** argv){
|
||||
int a = atoi(argv[1]); //将第一个输入转成整型
|
||||
int b = atoi(argv[2]); //将第二个输入转换为整型
|
||||
cout<<a+b; //输出a+b
|
||||
return 0;
|
||||
}".html_safe
|
||||
end
|
||||
end
|
||||
|
|
|
@ -676,4 +676,61 @@ module CoursesHelper
|
|||
end
|
||||
result
|
||||
end
|
||||
|
||||
#生成课程相关动态的链接
|
||||
def course_activity_link activity
|
||||
# activity = CourseActivity.first
|
||||
title = ""
|
||||
url = ""
|
||||
if activity.course_act
|
||||
case activity.course_act_type
|
||||
when "Course"
|
||||
title = activity.course_act.name
|
||||
url = course_path activity.course
|
||||
when "HomeworkCommon"
|
||||
title = "作业 " + activity.course_act.name
|
||||
url = student_work_index_path(:homework => activity.course_act.id)
|
||||
when "News"
|
||||
title = "通知公告 " + activity.course_act.title
|
||||
url = course_news_index_path(activity.course)
|
||||
when "Attachment"
|
||||
title = "课件 " + activity.course_act.filename
|
||||
url = course_files_path(activity.course)
|
||||
when "Message"
|
||||
title = "课程讨论区 " + activity.course_act.subject
|
||||
url = course_boards_path(activity.course,:parent_id => activity.course_act.parent_id ? activity.course_act.parent_id : activity.course_act.id, :topic_id => activity.course_act.id)
|
||||
when "JournalsForMessage"
|
||||
title = "留言 " + activity.course_act.notes
|
||||
url = course_feedback_path(activity.course)
|
||||
when "Poll"
|
||||
title = "问卷 " + activity.course_act.polls_name
|
||||
url = poll_path(activity.course_act_id)
|
||||
end
|
||||
end
|
||||
link_to title.gsub(/<(?!img)[^>]*>/,'').html_safe, url, :class => "problem_tit c_dblue fl fb"
|
||||
end
|
||||
|
||||
#课程动态的描述
|
||||
def course_activity_desc activity
|
||||
desc = ""
|
||||
if activity.course_act
|
||||
case activity.course_act_type
|
||||
when "Course"
|
||||
desc = ""
|
||||
when "HomeworkCommon"
|
||||
desc = activity.course_act.description
|
||||
when "News"
|
||||
desc = activity.course_act.description
|
||||
when "Attachment"
|
||||
desc = ""
|
||||
when "Message"
|
||||
desc = activity.course_act.content
|
||||
when "JournalsForMessage"
|
||||
desc = ""
|
||||
when "Poll"
|
||||
desc = activity.course_act.polls_description
|
||||
end
|
||||
end
|
||||
desc.html_safe
|
||||
end
|
||||
end
|
||||
|
|
|
@ -78,7 +78,7 @@ module PollHelper
|
|||
def poll_check_box_tags(name,polls,current_poll)
|
||||
s = ''
|
||||
polls.each do |poll|
|
||||
s << "<label>#{ check_box_tag name, poll.id, false, :id => nil } #{h poll.polls_name} [#{ h Course.find(poll.polls_group_id).name}]</label><br/>"
|
||||
s << "<label>#{ check_box_tag name, poll.id, false, :id => nil } #{h poll.polls_name.blank? ? l(:label_poll_new) : poll.polls_name } [#{ h Course.find(poll.polls_group_id).name}]</label><br/>"
|
||||
end
|
||||
s.html_safe
|
||||
end
|
||||
|
|
|
@ -27,6 +27,8 @@ class Attachment < ActiveRecord::Base
|
|||
belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id"
|
||||
# 被ForgeActivity虚拟关联
|
||||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
# 课程动态
|
||||
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
|
||||
# end
|
||||
include UserScoreHelper
|
||||
|
||||
|
@ -71,8 +73,8 @@ class Attachment < ActiveRecord::Base
|
|||
cattr_accessor :thumbnails_storage_path
|
||||
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
|
||||
|
||||
before_save :files_to_final_location
|
||||
after_create :office_conver, :be_user_score,:act_as_forge_activity# user_score
|
||||
before_save :files_to_final_location,:act_as_course_activity
|
||||
after_create :office_conver, :be_user_score,:act_as_forge_activity
|
||||
after_update :office_conver, :be_user_score
|
||||
after_destroy :delete_from_disk,:down_user_score
|
||||
|
||||
|
@ -552,4 +554,10 @@ class Attachment < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
#课程动态公共表记录
|
||||
def act_as_course_activity
|
||||
if self.container_type == "Course" && self.course_acts.empty?
|
||||
self.course_acts << CourseActivity.new(:user_id => self.author_id,:course_id => self.container_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -33,6 +33,10 @@ class Course < ActiveRecord::Base
|
|||
has_many :student_works, :through => :homework_commons, :dependent => :destroy
|
||||
|
||||
has_many :course_groups, :dependent => :destroy
|
||||
# 课程动态
|
||||
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
|
||||
|
||||
has_many :course_activities
|
||||
|
||||
acts_as_taggable
|
||||
acts_as_nested_set :order => 'name', :dependent => :destroy
|
||||
|
@ -44,7 +48,7 @@ class Course < ActiveRecord::Base
|
|||
validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]+$/
|
||||
validates_length_of :description, :maximum => 10000
|
||||
before_save :self_validate
|
||||
after_create :create_board_sync
|
||||
after_create :create_board_sync, :act_as_course_activity
|
||||
before_destroy :delete_all_members
|
||||
|
||||
safe_attributes 'extra',
|
||||
|
@ -310,6 +314,11 @@ class Course < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
#课程动态公共表记录
|
||||
def act_as_course_activity
|
||||
self.course_acts << CourseActivity.new(:user_id => self.tea_id,:course_id => self.id)
|
||||
end
|
||||
|
||||
#项目与课程分离后,很多课程的名称等信息为空,这些数据信息存储在项目表中!!就是数据兼容的问题
|
||||
#def name
|
||||
# read_attribute('name') || Project.find_by_identifier(self.extra).try(:name)
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
class CourseActivity < ActiveRecord::Base
|
||||
attr_accessible :user_id, :course_act_id,:course_act_type,:course_id
|
||||
# 虚拟关联
|
||||
belongs_to :course_act ,:polymorphic => true
|
||||
belongs_to :course
|
||||
belongs_to :user
|
||||
end
|
|
@ -13,17 +13,27 @@ class HomeworkCommon < ActiveRecord::Base
|
|||
has_many :student_works, :dependent => :destroy
|
||||
has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表
|
||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动
|
||||
# 课程动态
|
||||
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
|
||||
acts_as_attachable
|
||||
acts_as_event :title => Proc.new {|o| "#{l(:label_course_homework)} ##{o.id}: #{o.name}" },
|
||||
:description => :description,
|
||||
:author => :author,
|
||||
:url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}}
|
||||
after_create :act_as_activity, :send_mail
|
||||
after_create :act_as_activity, :send_mail, :act_as_course_activity
|
||||
after_destroy :delete_kindeditor_assets
|
||||
|
||||
def act_as_activity
|
||||
self.acts << Activity.new(:user_id => self.user_id)
|
||||
end
|
||||
|
||||
#课程动态公共表记录
|
||||
def act_as_course_activity
|
||||
if self.course
|
||||
self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.course_id)
|
||||
end
|
||||
end
|
||||
|
||||
#删除对应的图片
|
||||
def delete_kindeditor_assets
|
||||
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::HOMEWORKCOMMON
|
||||
|
|
|
@ -56,9 +56,11 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
acts_as_attachable
|
||||
|
||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||
# 课程动态
|
||||
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
|
||||
|
||||
validates :notes, presence: true, if: :is_homework_jour?
|
||||
after_create :act_as_activity #huang
|
||||
after_create :act_as_activity, :act_as_course_activity
|
||||
after_create :reset_counters!
|
||||
after_destroy :reset_counters!
|
||||
after_save :be_user_score
|
||||
|
@ -177,4 +179,11 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
def delete_kindeditor_assets
|
||||
delete_kindeditor_assets_from_disk self.id,7
|
||||
end
|
||||
|
||||
#课程动态公共表记录
|
||||
def act_as_course_activity
|
||||
if self.jour_type == 'Course'
|
||||
self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.jour_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,6 +32,8 @@ class Message < ActiveRecord::Base
|
|||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||
# 被ForgeActivity虚拟关联
|
||||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
# 课程动态
|
||||
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
|
||||
# end
|
||||
|
||||
has_many :ActivityNotifies,:as => :activity, :dependent => :destroy
|
||||
|
@ -68,7 +70,7 @@ class Message < ActiveRecord::Base
|
|||
after_update :update_messages_board
|
||||
after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets
|
||||
|
||||
after_create :act_as_activity,:be_user_score,:act_as_forge_activity, :send_mail
|
||||
after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :send_mail
|
||||
#before_save :be_user_score
|
||||
|
||||
scope :visible, lambda {|*args|
|
||||
|
@ -186,6 +188,13 @@ class Message < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
#课程动态公共表记录
|
||||
def act_as_course_activity
|
||||
if self.course
|
||||
self.course_acts << CourseActivity.new(:user_id => self.author_id,:course_id => self.board.course_id)
|
||||
end
|
||||
end
|
||||
|
||||
#更新用户分数 -by zjc
|
||||
def be_user_score
|
||||
#新建message且无parent的为发帖
|
||||
|
|
|
@ -28,6 +28,8 @@ class News < ActiveRecord::Base
|
|||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||
# 被ForgeActivity虚拟关联
|
||||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
# 课程动态
|
||||
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
|
||||
# end
|
||||
|
||||
has_many :ActivityNotifies,:as => :activity, :dependent => :destroy
|
||||
|
@ -49,7 +51,7 @@ class News < ActiveRecord::Base
|
|||
:author_key => :author_id
|
||||
acts_as_watchable
|
||||
|
||||
after_create :act_as_activity,:act_as_forge_activity,:add_author_as_watcher, :send_mail
|
||||
after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity,:add_author_as_watcher, :send_mail
|
||||
|
||||
after_destroy :delete_kindeditor_assets
|
||||
|
||||
|
@ -121,6 +123,13 @@ class News < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
#课程动态公共表记录
|
||||
def act_as_course_activity
|
||||
if self.course
|
||||
self.course_acts << CourseActivity.new(:user_id => self.author_id,:course_id => self.course_id)
|
||||
end
|
||||
end
|
||||
|
||||
# Time 2015-03-31 13:50:54
|
||||
# Author lizanle
|
||||
# Description 删除news后删除对应的资源
|
||||
|
|
|
@ -8,7 +8,9 @@ class Poll < ActiveRecord::Base
|
|||
has_many :users, :through => :poll_users #该文件被哪些用户提交答案过
|
||||
# 添加课程的poll动态
|
||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||
after_create :act_as_activity
|
||||
# 课程动态
|
||||
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
|
||||
before_save :act_as_activity, :act_as_course_activity
|
||||
|
||||
acts_as_event :title => Proc.new {|o| "#{l(:label_course_poll)}: #{o.polls_name}" },
|
||||
:description => :polls_description,
|
||||
|
@ -27,4 +29,14 @@ class Poll < ActiveRecord::Base
|
|||
self.acts << Activity.new(:user_id => self.user_id)
|
||||
end
|
||||
|
||||
#课程动态公共表记录
|
||||
def act_as_course_activity
|
||||
if self.polls_type == "Course"
|
||||
if self.polls_status == 2 #问卷是发布状态
|
||||
self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.polls_group_id)
|
||||
elsif self.polls_status == 1 #问卷是新建状态
|
||||
self.course_acts.destroy_all
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -292,8 +292,9 @@ class User < Principal
|
|||
end
|
||||
## end
|
||||
|
||||
# 查询用户未读过的记录
|
||||
def count_new_jour
|
||||
count = self.new_jours.count
|
||||
count = self.journals_for_messages.where("status=?", 1).count
|
||||
end
|
||||
|
||||
#added by nie
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<%= error_messages_for @board %>
|
||||
|
||||
<div class="box tabular">
|
||||
<p style="width:666;">
|
||||
<p style="width:666px;">
|
||||
<%= f.text_field :name, :required => true %>
|
||||
</p><!--by young-->
|
||||
<p>
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
<style type="text/css">
|
||||
div.talk_new .ke-container{margin-left:2px;}
|
||||
/*div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
|
||||
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
|
||||
span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
|
||||
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
|
||||
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
|
||||
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
|
||||
div.ke-toolbar .ke-outline{border:none;}*/
|
||||
.break_word {width:100%;}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
|
@ -16,14 +9,14 @@
|
|||
for (var i=0; i<menuids.length; i++){
|
||||
var div = document.getElementById(menuids[i]);
|
||||
if(div == undefined)continue;
|
||||
var ultags=div.getElementsByTagName("ul")
|
||||
var ultags=div.getElementsByTagName("ul");
|
||||
for (var t=0; t<ultags.length; t++){
|
||||
ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle"
|
||||
ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle";
|
||||
ultags[t].parentNode.onmouseover=function(){
|
||||
this.getElementsByTagName("ul")[0].style.display="block"
|
||||
this.getElementsByTagName("ul")[0].style.display="block";
|
||||
}
|
||||
ultags[t].parentNode.onmouseout=function(){
|
||||
this.getElementsByTagName("ul")[0].style.display="none"
|
||||
this.getElementsByTagName("ul")[0].style.display="none";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,46 +39,6 @@
|
|||
|
||||
<script type="text/javascript">//侧导航
|
||||
|
||||
//window.onload = function () {
|
||||
// var topic_id = getParam('topic_id');
|
||||
// document.getElementById(topic_id).focus();
|
||||
//}
|
||||
//
|
||||
//var getParam = function(name){
|
||||
// var search = document.location.search;
|
||||
// var pattern = new RegExp("[?&]"+name+"\=([^&]+)", "g");
|
||||
// var matcher = pattern.exec(search);
|
||||
// var items = null;
|
||||
// if(null != matcher){
|
||||
// try{
|
||||
// items = decodeURIComponent(decodeURIComponent(matcher[1]));
|
||||
// }catch(e){
|
||||
// try{
|
||||
// items = decodeURIComponent(matcher[1]);
|
||||
// }catch(e){
|
||||
// items = matcher[1];
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return items;
|
||||
//};
|
||||
//
|
||||
//function show_newtalk()
|
||||
//{
|
||||
// $("#about_newtalk").toggle();
|
||||
//
|
||||
//
|
||||
//
|
||||
//}
|
||||
//
|
||||
//function show_newtalk1(id)
|
||||
//{
|
||||
// $(id).toggle();
|
||||
// $(id).focus();
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
||||
function nh_check_field(params){
|
||||
var result=true;
|
||||
if(params.subject!=undefined){
|
||||
|
|
|
@ -61,8 +61,8 @@
|
|||
|
||||
<!--gcm-->
|
||||
<p class="stats">
|
||||
<%= content_tag('span', link_to("#{course_activity_count @course}", course_path(@course)), :class => "info") %>
|
||||
<%= content_tag('span', l(:label_x_activity, :count => @course_activity_count[@course.id])) %>
|
||||
<%= content_tag('span', link_to("#{@course.course_activities.count}", course_path(@course)), :class => "info") %>
|
||||
<%= content_tag('span', l(:label_x_activity, :count => @course.course_activities.count)) %>
|
||||
</p>
|
||||
<!--gcm-->
|
||||
|
||||
|
|
|
@ -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();$('#new_group_name').hide();">
|
||||
<a href="javascript:void(0)" class="f_l" style="padding-left: 5px;" onclick="$('#group_name_<%= group.id %>').val('<%= group.name%>');$('#edit_group_<%= group.id %>').slideToggle();$('#new_group_name').hide();">
|
||||
<img src="/images/pic_edit.png" width="14" height="15" alt="编辑班级" />
|
||||
</a>
|
||||
<% end %>
|
||||
|
|
|
@ -6,12 +6,14 @@
|
|||
alert("加入成功");
|
||||
hideModal($("#popbox02"));
|
||||
$("#try_join_course_link").replaceWith("<a href='<%=url_for(:controller => 'homework_common', :action => 'index',:course=>course.id, :host=>Setting.host_course)%>' target='_blank' class='blue_n_btn fr mt20'>提交作品</a>");
|
||||
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= course.id%>"
|
||||
<% elsif @state == 1 %>
|
||||
alert("密码错误");
|
||||
<% elsif @state == 2 %>
|
||||
alert("课程已过期\n请联系课程管理员重启课程。(在配置课程处)");
|
||||
<% elsif @state == 3 %>
|
||||
alert("您已经加入了课程");
|
||||
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= course.id%>"
|
||||
<% elsif @state == 4 %>
|
||||
alert("您加入的课程不存在");
|
||||
<% elsif @state == 5 %>
|
||||
|
|
|
@ -39,17 +39,17 @@
|
|||
<% end %>
|
||||
</div>
|
||||
|
||||
<% if @courses.size == 0 %>
|
||||
<%= render :partial => 'layouts/no_content'%>
|
||||
<% if @courses && !@courses.empty? %>
|
||||
<div id="courses-index">
|
||||
<%= render_course_hierarchy(@courses)%>
|
||||
</div>
|
||||
<% else %>
|
||||
<div id="courses-index">
|
||||
<%= render_course_hierarchy(@courses)%>
|
||||
</div>
|
||||
<%= render :partial => 'layouts/no_content'%>
|
||||
<% end %>
|
||||
|
||||
<div class="pagination">
|
||||
<ul>
|
||||
<%= pagination_links_full @course_pages %>
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,83 +1,37 @@
|
|||
<div class="project_r_h">
|
||||
<% if @controller_name=='ActivityNotifys' %>
|
||||
<a class="fl about_me" style="width:80px;" href="<%=course_path(@course)%>"><%= l(:label_activity)%></a>
|
||||
<h2 class="fl project_h2" style="width:100px;">与我相关
|
||||
<span class="c_orange f12" style="display:none;">(<font id="new_notify_count"><%=get_new_notify_count(@course,'Course')%></font>)</span>
|
||||
</h2>
|
||||
<div class="fr mt10 mr5 c_grey02">
|
||||
<a class="c_dblue">
|
||||
<label class="mr5" style="cursor:pointer;" data-href="<%= course_activity_notifys_path(@course) %>/chang_read_flag" nhname='nh_act_link_all'>全部标为已读</label>
|
||||
</a>
|
||||
</div>
|
||||
<% else %>
|
||||
<h2 class="fl project_h2"><%= l(:label_activity)%></h2>
|
||||
<% if User.current.logged? %>
|
||||
<a class="fl about_me" href="<%=course_activity_notifys_path(@course)%>">与我相关
|
||||
<span class="c_orange f12" style="display:none;">(<font id="new_notify_count"><%=get_new_notify_count(@course,'Course')%></font>)</span>
|
||||
</a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% if @events_by_day != nil && @events_by_day.size >0 %>
|
||||
<% @events_by_day.keys.sort.reverse.each do |day| %>
|
||||
<% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%>
|
||||
<div class="problem_main" nhname="container">
|
||||
<a class="problem_pic fl">
|
||||
<%= image_tag(url_to_avatar(e.event_author), :width => "42", :height => "42") %>
|
||||
</a>
|
||||
<div class="problem_txt fl mt5 upload_img">
|
||||
<%= link_to_user_header(e.event_author,false,:class => 'problem_name c_orange fl') if e.respond_to?(:event_author) %>
|
||||
<%= link_to_user_header("(#{e.event_author})", @canShowRealName,:class => 'problem_name c_orange fl') if @canShowRealName && e.respond_to?(:event_author) %>
|
||||
<span class="fl"> </span>
|
||||
<span class="fl"> <%= l(:label_new_activity) %>:</span>
|
||||
<%
|
||||
link = (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) :
|
||||
(e.event_type.eql?("bid") ? homework_course_path(@course) :
|
||||
(e.event_type.eql?("message") || e.event_type.eql?("reply") ?
|
||||
course_boards_path(@course,:topic_id => e.id,:parent_id=>(e.parent_id ? e.parent_id : e.id)) : e.event_url))
|
||||
%>
|
||||
<%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), link,
|
||||
:class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type,
|
||||
'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link",
|
||||
'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%>
|
||||
<%if @controller_name=='ActivityNotifys' && e.get_notify_is_read!=1%>
|
||||
<span nhname="nh_act_flag" class="ml10 fl"><img src="/images/new.png" width="35" height="15"/></span>
|
||||
<%end%>
|
||||
<br />
|
||||
<p class="mt5 break_word"><%= e.event_description.html_safe %>
|
||||
<br />
|
||||
<div class="cl"></div>
|
||||
<%= l :label_activity_time %> : <%= format_activity_day(day) %> <%= format_time(e.event_datetime, false) %>
|
||||
</p>
|
||||
<%= link_to_attachments_course(e) if e.class.to_s == "News" %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--课程动态 end-->
|
||||
<% end%>
|
||||
<% end%>
|
||||
<% elsif @controller_name=='ActivityNotifys' %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end%>
|
||||
<% if @obj_pages.next_page.nil? && @controller_name!='ActivityNotifys' %>
|
||||
<div class="problem_main">
|
||||
<a class="problem_pic fl">
|
||||
<%= image_tag(url_to_avatar(@user), :width => "42", :height => "42") %>
|
||||
</a>
|
||||
<div class="problem_txt fl mt5">
|
||||
<%= link_to_user_header(@user,false,:class => 'problem_name c_orange fl') %>
|
||||
<%= link_to_user_header("(#{@user})", @canShowRealName,:class => 'problem_name c_orange fl') if @canShowRealName %>
|
||||
<span class="fl"> <%= l(:label_user_create_project) %>:</span>
|
||||
<%= link_to @course.name,course_path(@course),:class => "problem_tit c_dblue fl fb"%>
|
||||
<br />
|
||||
<p class="mt5">
|
||||
<br />
|
||||
<%= l :label_create_time %> : <%= format_time(@course.created_at) %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--课程动态 end-->
|
||||
<%@course_activities.each do |activity|%>
|
||||
<div class="problem_main" nhname="container">
|
||||
<a class="problem_pic fl">
|
||||
<%= image_tag(url_to_avatar(activity.user), :width => "42", :height => "42") %>
|
||||
</a>
|
||||
<div class="problem_txt fl mt5 upload_img">
|
||||
<%= link_to_user_header(activity.user,false,:class => 'problem_name c_orange fl') %>
|
||||
<span class="fl"> </span>
|
||||
<span class="fl"> <%= activity.course_act_type == "Course" ? "创建了课程" : l(:label_new_activity) %>:</span>
|
||||
<%#= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), link,
|
||||
:class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type,
|
||||
'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link",
|
||||
'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%>
|
||||
<%#if @controller_name=='ActivityNotifys' && e.get_notify_is_read!=1%>
|
||||
<!--span nhname="nh_act_flag" class="ml10 fl"><img src="/images/new.png" width="35" height="15"/></span-->
|
||||
<%#end%>
|
||||
<%= link_to course_activity_link activity%>
|
||||
<div class="cl"></div>
|
||||
<p class="mt5 break_word">
|
||||
<%= course_activity_desc activity%>
|
||||
<br />
|
||||
<div class="cl"></div>
|
||||
<%= activity.course_act_type == "Course" ? l(:label_create_time) : l(:label_activity_time) %> : <%= format_time(activity.created_at) %>
|
||||
</p>
|
||||
<%= link_to_attachments_course(activity.course_act) if activity.course_act_type.to_s == "News" %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--课程动态 end-->
|
||||
<% end%>
|
||||
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||
</ul>
|
||||
|
|
|
@ -48,11 +48,12 @@
|
|||
<ul class="ml10">
|
||||
<li>
|
||||
<label class="label02">迟交扣分: </label>
|
||||
<%= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %>
|
||||
<%#= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %>
|
||||
<input type="number" value="<%= homework.late_penalty%>" min="0" max="50" class="fl mb10 h26 w70" name="late_penalty" onkeyup="check_late_penalty()">
|
||||
<span class="fl mt5"> 分</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li >
|
||||
<li style="display: none;">
|
||||
<label class="label02" >是否匿评: </label>
|
||||
<%= f.check_box :homework_type, :class => "mb10 mt5 fl" %>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -43,7 +43,8 @@
|
|||
|
||||
<li>
|
||||
<label class="label02">迟交扣分: </label>
|
||||
<%= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %>
|
||||
<%#= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %>
|
||||
<input type="number" value="<%= homework.late_penalty%>" min="0" max="50" class="fl mb10 h26 w70" name="late_penalty" onkeyup="check_late_penalty()">
|
||||
<span class="fl mt5"> 分</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
@ -56,7 +57,7 @@
|
|||
<ul>
|
||||
<li >
|
||||
<label class="label02"> 开发语言: </label>
|
||||
<%= select_tag :language,options_for_select(programing_languages_options,homework.homework_detail_programing.language.to_i), {:class => "fl mb10 h26 w70"} %>
|
||||
<%= select_tag :language,options_for_select(programing_languages_options,homework.homework_detail_programing.language.to_i), {:class => "fl mb10 h26 w70",:onchange => "homework_language_change($(this));"} %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
||||
|
@ -78,7 +79,7 @@
|
|||
|
||||
<li >
|
||||
<label class="label02"> 标准代码: </label>
|
||||
<textarea name="standard_code" class=" w547 h350 mb10 fl" oninput="init_programing_test();" onpropertychange="init_programing_test()"><%= homework.homework_detail_programing.standard_code || stantard_code%></textarea>
|
||||
<textarea name="standard_code" class=" w547 h400 mb10 fl" oninput="init_programing_test();" onpropertychange="init_programing_test()"><%= homework.homework_detail_programing.standard_code || c_stantard_code_teacher%></textarea>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
||||
|
@ -173,4 +174,20 @@
|
|||
$(this).next("input").val("");
|
||||
});
|
||||
}
|
||||
|
||||
function homework_language_change(obj)
|
||||
{
|
||||
if(obj.val() == "1")
|
||||
{
|
||||
// alert(1);
|
||||
$("textarea[name='standard_code']").val("<%= escape_javascript c_stantard_code_teacher%>");
|
||||
|
||||
}
|
||||
else if(obj.val() == "2")
|
||||
{
|
||||
// alert(2);
|
||||
$("textarea[name='standard_code']").val("<%= escape_javascript c_stantard_code_teacher_%>");
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -1,27 +1,17 @@
|
|||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
||||
<%= error_messages_for 'homework_common' %>
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2">
|
||||
<%= l(:label_course_homework_new)%>
|
||||
</h2>
|
||||
</div>
|
||||
<div class="hwork_new" id="hwork_new">
|
||||
<%= form_for("new_homework_common",:url => next_step_homework_common_index_path) do |f|%>
|
||||
<input type="hidden" name="course" value="<%= @course.id%>">
|
||||
<h3 class="c_blue f16 mb10">
|
||||
请选择将要发布的作业类型
|
||||
</h3>
|
||||
<input type="radio" class="mb10 fl" name="homework_common_type" value="1" id="homework_detail_manual_radio" checked/>
|
||||
<span class="ml5 fl">
|
||||
人工评分的作业(支持匿名互评、灵活设置评分比例)
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
<input type="radio" class="mb20 fl" name="homework_common_type" value="2" id="homework_detail_programing_radio"/>
|
||||
<span class="ml5 fl">
|
||||
自动评测的编程作业(支持C/C++程序的自动评分)
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
<a href="javascript:void(0);" class=" orange_btn" onclick="$(this).parent().submit();">
|
||||
下一步
|
||||
</a>
|
||||
<div class="hwork_new">
|
||||
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %>
|
||||
<%= hidden_field_tag "course",@course.id%>
|
||||
<%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
|
||||
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('new_homework_common');" >提交</a>
|
||||
<%#= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
|
||||
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
|
||||
<% end%>
|
||||
</div><!--hwork_new end-->
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<ul class="sub_menu">
|
||||
<% if @show_course == 1 && !visiable %>
|
||||
<% hasCourse=false %>
|
||||
<% User.current.courses.each do |course| %>
|
||||
<% User.current.courses.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").each do |course| %>
|
||||
<% if !course_endTime_timeout?(course) %>
|
||||
<% hasCourse=true %>
|
||||
<% break %>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<li>
|
||||
<a href="<%= url_for(:controller => 'users', :action => 'user_courses', :id=>User.current.id, :host=>Setting.host_user) %>" class="parent">我的课程</a>
|
||||
<ul>
|
||||
<% User.current.courses.each do |course| %>
|
||||
<% User.current.courses.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").each do |course| %>
|
||||
<% if !course_endTime_timeout?(course) %>
|
||||
<li title="<%=course.name%>"><a href="<%= url_for(:controller => 'courses', :action=>"show", :id=>course.id, :host=>Setting.host_course) %>"><%= course.name %></a>
|
||||
<% end %>
|
||||
|
@ -41,8 +41,12 @@
|
|||
<li>
|
||||
<a href="<%= url_for(:controller => 'users', :action => 'user_projects', :id=>User.current.id, :host=>Setting.host_user) %>" class="parent">我的项目</a>
|
||||
<ul>
|
||||
<% User.current.projects.each do |project| %>
|
||||
<li title="<%=project.name%>"><a href="<%= url_for(:controller => 'projects', :action=>"show", :id=>project.id, :host=>Setting.host_name) %>"><%=project.name%></a></li>
|
||||
<% User.current.projects.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").each do |project| %>
|
||||
<li title="<%=project.name%>">
|
||||
<a href="<%= url_for(:controller => 'projects', :action=>"show", :id=>project.id, :host=>Setting.host_name) %>">
|
||||
<%=project.name%>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
@ -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.reverse.each do |course| %>
|
||||
<% user_course.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.reverse.each do |project| %>
|
||||
<% User.current.projects.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").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>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<ul class="course_sub_menu">
|
||||
<% course_index = 0 %>
|
||||
|
||||
<% User.current.courses.reverse.each do |course| %>
|
||||
<% User.current.courses.each do |course| %>
|
||||
<% if !course_endTime_timeout?(course) %>
|
||||
<%= render :partial => 'layouts/user_homework_list', :locals => {:course => course,:course_index => course_index} %>
|
||||
<% course_index += 1 %>
|
||||
|
|
|
@ -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.reverse.each do |project| %>
|
||||
<% User.current.projects.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").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>
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
<div class="subNav">
|
||||
<%= link_to l(:label_activity), course_path(@course), :class => "f14 c_blue02" %>
|
||||
<!--暂时不显示课程动态数,优化后在显示-->
|
||||
<%= link_to "(#{course_activity_count @course})", course_path(@course), :class => "subnav_num c_orange"%>
|
||||
<%= link_to "(#{@course.course_activities.count})", course_path(@course), :class => "subnav_num c_orange"%>
|
||||
</div>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f14 c_blue02"%>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div id="popbox_upload" style="margin-top: -30px;margin-left: -20px;margin-right: -10px;">
|
||||
<div class="upload_con">
|
||||
<h2>将以下问卷导入本课程</h2>
|
||||
<h2>选择问卷导入本课程</h2>
|
||||
<div class="upload_box">
|
||||
<div id="error_show" style="color: red;"></div>
|
||||
<%= form_tag import_other_poll_poll_index_path,
|
||||
|
@ -8,7 +8,7 @@
|
|||
remote: true,
|
||||
id: "relation_file_form" do %>
|
||||
<input type="hidden" name="course_id" value="<%= polls_group_id%>" />
|
||||
<%= content_tag('div', poll_check_box_tags('polls[]', polls,polls_group_id), :id => 'courses')%>
|
||||
<%= content_tag('div', poll_check_box_tags('polls[]', polls,polls_group_id), :id => 'courses',:style=> 'width: 300px;')%>
|
||||
<a id="submit_quote" href="javascript:void(0)" class="blue_btn fl c_white" style="margin-left: 0px !important;" onclick="submit_quote();">导 入</a>
|
||||
<a href="javascript:void(0)" class="blue_btn grey_btn fl c_white " onclick="closeModal();">取 消</a>
|
||||
<% end -%>
|
||||
|
@ -19,9 +19,19 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
function submit_quote()
|
||||
{
|
||||
$('#submit_quote').parent().submit();
|
||||
closeModal();
|
||||
function submit_quote() {
|
||||
$('#error_show').html('');
|
||||
var selected = false;
|
||||
for(var i = 0; i < $("input[name='polls[]']").length;i++){
|
||||
if($("input[name='polls[]']")[i].checked){
|
||||
selected = true;
|
||||
}
|
||||
}
|
||||
if (selected){
|
||||
$('#submit_quote').parent().submit();
|
||||
closeModal();
|
||||
}else{
|
||||
$('#error_show').html('您没有选择任何问卷');
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -2,11 +2,13 @@
|
|||
<% poll_name = poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name%>
|
||||
<% if @is_teacher%>
|
||||
<li title="<%= poll.polls_name %>">
|
||||
<% if has_commit %>
|
||||
<%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue"%>
|
||||
<% else %>
|
||||
<%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %>
|
||||
<% end %>
|
||||
<div style="width: 310px;float: left;">
|
||||
<% if has_commit %>
|
||||
<%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue"%>
|
||||
<% else %>
|
||||
<%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<% if poll.polls_status == 1%>
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>');
|
||||
<% if @polls.empty? %>
|
||||
alert('您目前还没有自己新建的问卷');
|
||||
<% else %>
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>');
|
||||
|
||||
|
||||
showModal('ajax-modal', '513px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
showModal('ajax-modal', '513px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
<% end %>
|
|
@ -104,9 +104,13 @@
|
|||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="pagination">
|
||||
<ul>
|
||||
<%= pagination_links_full @project_pages, @project_count %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<%= paginate @project_pages %>
|
||||
<%#= paginate @project_pages %>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -54,8 +54,8 @@
|
|||
<%= @homework.homework_type == 2 ? "提交代码" : "作品描述"%>
|
||||
:
|
||||
</label>
|
||||
<% if @homework.homework_type == 2%>
|
||||
<%= f.text_area "description", :class => "w620 hwork_txt h350", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();", :value => stantard_code%>
|
||||
<% if @homework.homework_type == 2 && @homework.homework_detail_programing%>
|
||||
<%= f.text_area "description", :class => "w620 hwork_txt h400", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();", :value => @homework.homework_detail_programing.language == "1" ? c_stantard_code_student : c_stantard_code_student_%>
|
||||
<% else %>
|
||||
<%= f.text_area "description", :class => "w620 hwork_txt", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();"%>
|
||||
<% end%>
|
||||
|
|
|
@ -23,8 +23,19 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<%= l(:label_x_has_fans,:count=>user.watcher_users.count)%>
|
||||
<%= l(:label_has_watchers,:count=>User.watched_by(user.id).count) %>
|
||||
<%= l(:label_x_has_fans,:count=>user.watcher_users.count, :remote => true)%>
|
||||
<%= l(:label_has_watchers,:count=>User.watched_by(user.id).count, :remote => true) %>
|
||||
<% if User.current.logged?%>
|
||||
<% if User.current == user%>
|
||||
<a href="<%= url_for(:controller => 'my', :action => 'account') %>" class="fr gz_btn mr10 ">编辑资料</a>
|
||||
<%else%>
|
||||
<%if(user.watched_by?(User.current))%>
|
||||
<a id="user_watch_id" href="<%= watch_path(:object_type=> 'user',:object_id=>user.id,:target_id=>user.id) %>" class="fr qx_btn mr10" data-method="delete" data-remote="true" title="取消关注">取消关注</a>
|
||||
<% else %>
|
||||
<a id="user_watch_id" href="<%= watch_path(:object_type=>'user',:object_id=>user.id,:target_id=>user.id) %>" class="fr gz_btn mr10" data-method="post" data-remote="true" title="添加关注">添加关注</a>
|
||||
<% end %>
|
||||
<% end%>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
@ -33,7 +33,6 @@ zh:
|
|||
label_account_identity_studentID: 请输入学号
|
||||
|
||||
field_brief_introduction_my: 个人签名
|
||||
field_description: 个人简介
|
||||
field_is_required: 必填
|
||||
field_firstname: 名字或组织名
|
||||
firstname_empty: 名字不能为空
|
||||
|
|
|
@ -363,7 +363,6 @@ zh:
|
|||
#
|
||||
label_project_new_description: '项目可以是软件开发项目,也可以是协作研究项目。'
|
||||
field_name: 名称
|
||||
field_description: 描述
|
||||
field_identifier: 标识
|
||||
field_enterprise_name: 组织名称
|
||||
label_organization_choose: --请选择组织--
|
||||
|
|
|
@ -691,7 +691,7 @@ zh:
|
|||
label_sort_lowest: 置底
|
||||
label_roadmap_due_in: "截止日期到 %{value}"
|
||||
label_roadmap_overdue: "%{value} 延期"
|
||||
label_roadmap_no_issues: 该版本还没有对应的缺陷,可以在“发布问题”的“目标版本”中设置!
|
||||
label_roadmap_no_issues: 该版本还没有对应的缺陷,可以在“发布问题”的“目标版本”中指定版本!
|
||||
label_user_search_type: 搜索类型
|
||||
label_search_by_login: 登录名
|
||||
label_search_by_name: 名字
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
class AddCourseActivities < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :course_activities do |t|
|
||||
t.integer :user_id
|
||||
t.integer :course_id
|
||||
t.integer :course_act_id
|
||||
t.string :course_act_type
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :course_activities
|
||||
end
|
||||
end
|
|
@ -0,0 +1,40 @@
|
|||
#encoding=UTF-8
|
||||
class CourseActivities < ActiveRecord::Migration
|
||||
def up
|
||||
Course.all.each do |course|
|
||||
transaction do
|
||||
course.course_acts << CourseActivity.new(:user_id => course.tea_id,:course_id => course.id)
|
||||
#作业
|
||||
course.homework_commons.each do |homework_common|
|
||||
homework_common.course_acts << CourseActivity.new(:user_id => homework_common.user_id,:course_id => course.id)
|
||||
end
|
||||
#通知
|
||||
course.news.each do |new|
|
||||
new.course_acts << CourseActivity.new(:user_id => new.author_id,:course_id => course.id)
|
||||
end
|
||||
#资源
|
||||
course.attachments.each do |attachment|
|
||||
attachment.course_acts << CourseActivity.new(:user_id => attachment.author_id,:course_id => course.id)
|
||||
end
|
||||
#讨论区
|
||||
if course.boards.first
|
||||
course.boards.first.messages.each do |message|
|
||||
message.course_acts << CourseActivity.new(:user_id => message.author_id,:course_id => course.id)
|
||||
end
|
||||
end
|
||||
#留言
|
||||
course.journals_for_messages.each do |jour|
|
||||
jour.course_acts << CourseActivity.new(:user_id => jour.user_id,:course_id => course.id)
|
||||
end
|
||||
#问卷
|
||||
Poll.where("polls_type = 'Course' and polls_group_id = #{course.id}").each do |poll|
|
||||
poll.course_acts << CourseActivity.new(:user_id => poll.user_id,:course_id => course.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
CourseActivity.destroy_all
|
||||
end
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
class ChangeAttachmentTime < ActiveRecord::Migration
|
||||
def up
|
||||
Attachment.where("container_type = 'Course'").each do |attachment|
|
||||
if attachment.container && attachment.container.created_at.to_i > attachment.created_on.to_i
|
||||
attachment.created_on = attachment.container.created_at + 3600 * 24
|
||||
attachment.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,22 @@
|
|||
class UpdateCourseActivityTime < ActiveRecord::Migration
|
||||
def up
|
||||
count = CourseActivity.all.count / 10 + 1
|
||||
transaction do
|
||||
for i in 1 ... count do i
|
||||
CourseActivity.page(i).per(10).each do |activity|
|
||||
if activity.course_act
|
||||
if activity.course_act.respond_to?("created_at")
|
||||
activity.created_at = activity.course_act.created_at
|
||||
elsif activity.course_act.respond_to?("created_on")
|
||||
activity.created_at = activity.course_act.created_on
|
||||
end
|
||||
activity.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class AddSystemScoreToStudentWork < ActiveRecord::Migration
|
||||
def up
|
||||
add_column :student_works,:system_score,:integer
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :student_works,:system_score
|
||||
end
|
||||
end
|
|
@ -412,6 +412,24 @@ function regex_homework_name()
|
|||
}
|
||||
}
|
||||
|
||||
//处理迟交扣分
|
||||
function check_late_penalty()
|
||||
{
|
||||
var obj = $("input[name='late_penalty']");
|
||||
var regex = /^\d+$/;
|
||||
if(regex.test(obj.val()))
|
||||
{
|
||||
if(obj.val() > 50)
|
||||
{
|
||||
obj.val("50");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
obj.val("0");
|
||||
}
|
||||
}
|
||||
|
||||
//验证匿评数量
|
||||
function regex_evaluation_num()
|
||||
{
|
||||
|
|
|
@ -55,7 +55,7 @@ a:hover.problem_pic{border:1px solid #64bdd9;}
|
|||
.problem_txt{ width:610px; margin-left:10px; color:#777777;word-break: break-all;word-wrap: break-word;}
|
||||
a.problem_name{ color:#ff5722;max-width:60px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
|
||||
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;vertical-align: top;}
|
||||
a.pro_mes_w{ height:20px; float:right;display:block; color:#999999;}
|
||||
a:hover.problem_tit{ color:#09658c; }
|
||||
.problem_main{ border-bottom:1px dashed #d4d4d4; padding-bottom:10px; margin-bottom:10px;}
|
||||
|
@ -226,7 +226,7 @@ a:hover.ping_sub{ background:#14a8b9;}
|
|||
.w430{ width:470px;}
|
||||
.w557{ width:557px;}
|
||||
.w350{ width:350px;}
|
||||
.h350{height: 350px !important;}
|
||||
.h400{height: 400px !important;}
|
||||
.w620{ width:480px; height:160px; border:1px solid #CCC;}
|
||||
.bo{height:26px; border:1px solid #CCC; padding-left:5px; background:#fff;width:470px; }
|
||||
.bo02{height:26px; border:1px solid #CCC; padding-left:5px; background:#fff;width:480px; margin-left:2px; color: #999; }
|
||||
|
|
|
@ -130,7 +130,7 @@ a:hover.btn_de{ background:#ff5d31;}
|
|||
a.btn_pu{ border:1px solid #3cb761; color:#3cb761; }
|
||||
a:hover.btn_pu{ background:#3cb761;}
|
||||
.pollsbtn_grey{ border:1px solid #b1b1b1; color:#b1b1b1; padding:0px 9px; height:19px; padding-top:3px; }
|
||||
.polls_title_w { width:280px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
|
||||
.polls_title_w { max-width:280px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
|
||||
.polls_title_st { max-width:530px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
|
||||
.polls_de_grey{ color:#b1b1b1; margin-top:3px;}
|
||||
.ml5{ margin-left:5px;}
|
||||
|
|
Loading…
Reference in New Issue