Merge branch 'dev_hjq' of http://repository.trustie.net/xianbo/trustie2 into dev_hjq

Conflicts:
	app/models/system_message.rb
	app/views/admin/messages.html.erb

处理冲突、发布系统消息JS提醒!
This commit is contained in:
ouyangxuhua 2015-09-11 16:11:34 +08:00
commit b053a1e43c
95 changed files with 3257 additions and 969 deletions

View File

@ -42,6 +42,9 @@ group :development, :test do
gem 'pry-byebug'
end
gem 'pry-stack_explorer'
if RUBY_PLATFORM =~ /darwin/
gem 'puma'
end
end
gem 'rspec-rails', '~> 3.0'

View File

@ -3,6 +3,8 @@ class HomeworkCommonController < ApplicationController
require 'json'
require "base64"
layout "base_courses"
include StudentWorkHelper
before_filter :find_course, :only => [:index,:new,:create,:next_step]
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy]
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment]
@ -18,265 +20,147 @@ class HomeworkCommonController < ApplicationController
end
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
respond_to do |format|
format.html
end
end
#新建作业下一步
def next_step
@homework_type = params[:homework_common_type]
@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
render_404
# @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
end
#新建作业,在个人作业列表创建作业
def create
if params[:homework_common]
homework = HomeworkCommon.new
homework.name = params[:homework_common][:name]
homework.description = params[:homework_common][:description]
homework.end_time = params[:homework_common][:end_time]
homework.publish_time = params[:homework_common][:publish_time]
homework.homework_type = params[:homework_common][:homework_type]
homework.late_penalty = params[:late_penalty]
homework.user_id = User.current.id
homework.course_id = @course.id
homework.save_attachments(params[:attachments])
render_attachment_warning_if_needed(homework)
if homework.homework_type == 2
homework_detail_programing = HomeworkDetailPrograming.new
homework_detail_programing.language = params[:language]
homework_detail_programing.standard_code = params[:standard_code]
homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6
question = {title:homework.name,content:homework.description}
question[:input] = []
question[:output] = []
if params[:input] && params[:output] && params[:result]
params[:input].each do |k,v|
if params[:output].include? k
homework_test = HomeworkTest.new
homework_test.input = v
homework_test.output = params[:output][k]
homework_test.result = params[:result][k]
homework_test.error_msg = params[:error_msg]
homework.homework_tests << homework_test
question[:input] << homework_test.input
question[:output] << homework_test.output
end
end
end
# uri = URI('http://192.168.80.21:8080/api/questions.json')
# body = question.to_json
# res = Net::HTTP.new(uri.host, uri.port).start do |client|
# request = Net::HTTP::Post.new(uri.path)
# request.body = body
# request["Content-Type"] = "application/json"
# client.request(request)
# end
# result = JSON.parse(res.body)
# homework_detail_programing.question_id = result["id"] if result["status"] && result["status"] == 0
homework.homework_detail_programing = homework_detail_programing
else
#匿评作业相关属性
homework_detail_manual = HomeworkDetailManual.new
homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
homework_detail_manual.comment_status = 1
homework_detail_manual.evaluation_start = params[:evaluation_start]
homework_detail_manual.evaluation_end = params[:evaluation_end]
homework_detail_manual.evaluation_num = params[:evaluation_num]
homework_detail_manual.absence_penalty = params[:absence_penalty]
homework.homework_detail_manual = homework_detail_manual
end
if homework.save
homework_detail_programing.save if homework_detail_programing
homework_detail_manual.save if homework_detail_manual
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_create)
redirect_to homework_common_index_path(:course => @course.id)
}
end
return
end
end
respond_to do |format|
format.html {
flash[:notice] = l(:notice_failed_create)
redirect_to new_homework_common_path(:course => @course.id)
}
end
redirect_to user_homeworks_user_path(User.current.id)
# if params[:homework_common]
# homework = HomeworkCommon.new
# homework.name = params[:homework_common][:name]
# homework.description = params[:homework_common][:description]
# homework.end_time = params[:homework_common][:end_time]
# homework.publish_time = params[:homework_common][:publish_time]
# homework.homework_type = params[:homework_common][:homework_type]
# homework.late_penalty = params[:late_penalty]
# homework.user_id = User.current.id
# homework.course_id = @course.id
#
# homework.save_attachments(params[:attachments])
# render_attachment_warning_if_needed(homework)
#
# if homework.homework_type == 2
# homework_detail_programing = HomeworkDetailPrograming.new
# homework_detail_programing.language = params[:language]
# homework_detail_programing.standard_code = params[:standard_code]
# homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6
# question = {title:homework.name,content:homework.description}
# question[:input] = []
# question[:output] = []
# if params[:input] && params[:output] && params[:result]
# params[:input].each do |k,v|
# if params[:output].include? k
# homework_test = HomeworkTest.new
# homework_test.input = v
# homework_test.output = params[:output][k]
# homework_test.result = params[:result][k]
# homework_test.error_msg = params[:error_msg]
# homework.homework_tests << homework_test
# question[:input] << homework_test.input
# question[:output] << homework_test.output
# end
# end
# end
#
# # uri = URI('http://192.168.80.21:8080/api/questions.json')
# # body = question.to_json
# # res = Net::HTTP.new(uri.host, uri.port).start do |client|
# # request = Net::HTTP::Post.new(uri.path)
# # request.body = body
# # request["Content-Type"] = "application/json"
# # client.request(request)
# # end
# # result = JSON.parse(res.body)
# # homework_detail_programing.question_id = result["id"] if result["status"] && result["status"] == 0
#
# homework.homework_detail_programing = homework_detail_programing
# else
# #匿评作业相关属性
# homework_detail_manual = HomeworkDetailManual.new
# homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
# homework_detail_manual.comment_status = 1
# homework_detail_manual.evaluation_start = params[:evaluation_start]
# homework_detail_manual.evaluation_end = params[:evaluation_end]
# homework_detail_manual.evaluation_num = params[:evaluation_num]
# homework_detail_manual.absence_penalty = params[:absence_penalty]
# homework.homework_detail_manual = homework_detail_manual
# end
#
# if homework.save
# homework_detail_programing.save if homework_detail_programing
# homework_detail_manual.save if homework_detail_manual
# respond_to do |format|
# format.html {
# flash[:notice] = l(:notice_successful_create)
# redirect_to homework_common_index_path(:course => @course.id)
# }
# end
# return
# end
# end
#
# respond_to do |format|
# format.html {
# flash[:notice] = l(:notice_failed_create)
# redirect_to new_homework_common_path(:course => @course.id)
# }
# end
end
def edit
@user = User.current
respond_to do |format|
format.html
format.html{render :layout => 'new_base_user'}
end
end
def update
@homework.name = params[:homework_common][:name]
@homework.description = params[:homework_common][:description]
@homework.end_time = params[:homework_common][:end_time]
@homework.publish_time = params[:homework_common][:publish_time]
@homework.homework_type = params[:homework_common][:homework_type] if params[:homework_common][:homework_type]
unless @homework.late_penalty == params[:late_penalty]
@homework.student_works.where("created_at > '#{@homework.end_time} 23:59:59'").each do |student_work|
student_work.late_penalty = params[:late_penalty]
student_work.save
end
@homework.late_penalty = params[:late_penalty]
end
# @homework.course_id = @course.id
if params[:homework_common]
@homework.name = params[:homework_common][:name]
@homework.description = params[:homework_common][:description]
@homework.end_time = params[:homework_common][:end_time] || Time.now
@homework.course_id = params[:course_id]
#匿评作业相关属性
if @homework.homework_type == 1 && @homework_detail_manual
@homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
@homework_detail_manual.evaluation_start = params[:evaluation_start]
@homework_detail_manual.evaluation_end = params[:evaluation_end]
@homework_detail_manual.evaluation_num = params[:evaluation_num]
unless @homework_detail_manual.absence_penalty == params[:absence_penalty]
if @homework_detail_manual.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
end
@homework_detail_manual.absence_penalty = params[:absence_penalty]
end
elsif @homework.homework_type == 0 #普通作业缺评扣分为0分每个作品的缺评扣分改为0分防止某些作业在结束匿评之后改为普通作业
@homework.student_works.where("absence_penalty != 0").each do |student_work|
student_work.late_penalty = 0
student_work.save
end
@homework_detail_manual.absence_penalty = 0 if @homework_detail_manual
end
@homework.save_attachments(params[:attachments])
render_attachment_warning_if_needed(@homework)
#编程作业相关属性
if @homework.homework_type == 2
if @homework.homework_type == 2 && @homework_detail_programing #编程作业
@homework_detail_programing.language = params[:language]
@homework_detail_programing.standard_code = params[:standard_code]
@homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6
homework_tests = @homework.homework_tests
#需要删除的测试
ids = homework_tests.map(&:id) - params[:input].keys.map(&:to_i)
ids.each do |id|
homework_test = HomeworkTest.find id
homework_test.destroy if homework_test
end
if params[:input] && params[:output] && params[:result]
params[:input].each do |k,v|
if params[:output].include? k
homework_test = HomeworkTest.find_by_id k
if homework_test #已存在的测试,修改
homework_test.input = v
homework_test.output = params[:output][k]
homework_test.result = params[:result][k]
homework_test.error_msg = params[:error_msg]
else #不存在的测试,增加
homework_test = HomeworkTest.new
homework_test.input = v
homework_test.output = params[:output][k]
homework_test.result = params[:result][k]
homework_test.error_msg = params[:error_msg]
homework_test.homework_common = @homework
end
homework_test.save
end
end
end
#发送修改作业的请求
question = {title:@homework.name,content:@homework.description}
question[:input] = []
question[:output] = []
@homework.homework_tests.each do |test|
question[:input] << test.input
question[:output] << test.output
end
# uri = URI("http://192.168.80.21:8080/api/questions/#{@homework_detail_programing.question_id}.json")
# body = question.to_json
# res = Net::HTTP.new(uri.host, uri.port).start do |client|
# request = Net::HTTP::Put.new(uri.path)
# request.body = body
# request["Content-Type"] = "application/json"
# client.request(request)
# end
# result = JSON.parse(res.body)
end
@homework.save_attachments(params[:attachments])
render_attachment_warning_if_needed(@homework)
if @homework.save
@homework_detail_manual.save if @homework_detail_manual
@homework_detail_programing.save if @homework_detail_programing
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_edit)
redirect_to homework_common_index_path(:course => @course.id)
}
end
return
else
respond_to do |format|
format.html {
flash[:notice] = l(:notice_failed_edit)
redirect_to edit_homework_common_path(@homework)
}
if @homework.save
@homework_detail_manual.save if @homework_detail_manual
@homework_detail_programing.save if @homework_detail_programing
redirect_to user_homeworks_user_path(User.current.id)
end
end
end
@ -284,7 +168,7 @@ class HomeworkCommonController < ApplicationController
def destroy
if @homework.destroy
respond_to do |format|
format.html {redirect_to homework_common_index_path(:course => @course.id)}
format.html {redirect_to user_homeworks_user_path(User.current.id)}
end
end
end

View File

@ -89,72 +89,54 @@ class MessagesController < ApplicationController
# Create a new topic
def new
@message = Message.new
@message.author = User.current
@message.board = @board
@message.safe_attributes = params[:message]
if request.post?
@message.save_attachments(params[:attachments])
if @message.save
# 更新kindeditor上传的图片资源所有者
if params[:asset_id]
ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,@message.id,OwnerTypeHelper::MESSAGE
end
# # 与我相关动态的记录add start
# if(@board && @board.course) #项目的先不管
# teachers = searchTeacherAndAssistant(@board.course)
# for teacher in teachers
# if(teacher.user_id != User.current.id)
# notify = ActivityNotify.new()
# if(@board.course)
# notify.activity_container_id = @board.course_id
# notify.activity_container_type = 'Course'
# else
# notify.activity_container_id = @board.project_id
# notify.activity_container_type = 'Project'
# end
# notify.activity_id = @message.id
# notify.activity_type = 'Message'
# notify.notify_to = teacher.user_id
# notify.is_read = 0
# notify.save()
# end
# end
# end
# 与我相关动态的记录add end
if User.current.logged?
@message = Message.new
@message.author = User.current
@message.board = @board
@message.safe_attributes = params[:message]
if request.post?
@message.save_attachments(params[:attachments])
if @message.save
# 更新kindeditor上传的图片资源所有者
if params[:asset_id]
ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,@message.id,OwnerTypeHelper::MESSAGE
end
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
render_attachment_warning_if_needed(@message)
if params[:is_board]
if @project
redirect_to project_boards_path(@project)
elsif @course
redirect_to course_boards_path(@course)
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
render_attachment_warning_if_needed(@message)
if params[:is_board]
if @project
redirect_to project_boards_path(@project)
elsif @course
redirect_to course_boards_path(@course)
end
else
redirect_to board_message_url(@board, @message)
end
else
redirect_to board_message_url(@board, @message)
if params[:is_board]
if @project
redirect_to project_boards_path(@project, :flag => true)
elsif @course
redirect_to course_boards_path(@course, :flag => true)
end
else
layout_file = @project ? 'base_projects' : 'base_courses'
render :action => 'new', :layout => layout_file
end
end
else
if params[:is_board]
if @project
redirect_to project_boards_path(@project, :flag => true)
elsif @course
redirect_to course_boards_path(@course, :flag => true)
end
else
layout_file = @project ? 'base_projects' : 'base_courses'
render :action => 'new', :layout => layout_file
respond_to do |format|
format.html {
layout_file = @project ? 'base_projects' : 'base_courses'
render :layout => layout_file
}
end
end
else
respond_to do |format|
format.html {
layout_file = @project ? 'base_projects' : 'base_courses'
render :layout => layout_file
}
end
redirect_to signin_path
end
end

View File

@ -14,8 +14,8 @@ class StudentWorkController < ApplicationController
def program_test
is_test = params[:is_test] == 'true'
resultObj = {status: 0, results: [], error_msg: '', time: Time.now.strftime('%Y-%m-%d %T')}
unless is_test
student_work = find_or_save_student_work
student_work = find_or_save_student_work(is_test)
unless student_work
resultObj[:status] = 100
@ -42,26 +42,6 @@ class StudentWorkController < ApplicationController
end
end
else
if @homework.homework_type == 2 && @homework.homework_detail_programing
result = test_realtime(student_work, params[:src])
logger.debug result
resultObj[:status] = result["status"]
resultObj[:results] = result["results"]
resultObj[:error_msg] = result["error_msg"]
results = result["results"]
if result["status"].to_i == -2 #编译错误
results = [result["error_msg"]]
end
resultObj[:status] = result["status"].to_i
resultObj[:time] = Time.now.strftime('%Y-%m-%d %T')
resultObj[:index] = 0
end
end
render :json => resultObj
end
@ -192,24 +172,23 @@ class StudentWorkController < ApplicationController
def create
if params[:student_work]
stundet_work = StudentWork.find(params[:student_work_id]) if params[:student_work_id]
stundet_work ||= StudentWork.new
stundet_work.name = params[:student_work][:name]
stundet_work.description = params[:student_work][:description]
stundet_work.project_id = params[:student_work][:project_id]
stundet_work.homework_common_id = @homework.id
stundet_work.user_id = User.current.id
stundet_work.save_attachments(params[:attachments])
student_work = StudentWork.find(params[:student_work_id]) if params[:student_work_id]
student_work ||= StudentWork.new
student_work.name = params[:student_work][:name]
student_work.description = params[:student_work][:description]
student_work.project_id = params[:student_work][:project_id]
student_work.homework_common_id = @homework.id
student_work.user_id = User.current.id
student_work.save_attachments(params[:attachments])
if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
stundet_work.late_penalty = @homework.late_penalty
student_work.late_penalty = @homework.late_penalty
else
stundet_work.late_penalty = 0
student_work.late_penalty = 0
end
render_attachment_warning_if_needed(stundet_work)
if stundet_work.save
if @homework.homework_type == 2 && @homework.homework_detail_programing #编程作业,学生提交作品后计算系统得分
end
render_attachment_warning_if_needed(student_work)
if student_work.save
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_create)
@ -650,15 +629,17 @@ class StudentWorkController < ApplicationController
xls_report.string
end
def find_or_save_student_work
student_work = @homework.student_works.where(user_id: User.current.id).first
def find_or_save_student_work(is_test)
student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first
if student_work.nil?
@homework.student_works.build(
name: params[:title],
description: params[:src],
user_id: User.current.id
user_id: User.current.id,
is_test: is_test
)
unless @homework.save
logger.debug @homework.errors.full_messages
else
student_work = @homework.student_works.where(user_id: User.current.id).first
end

View File

@ -44,6 +44,13 @@ class SystemMessagesController < ApplicationController
if @system_messages.save
format.html {redirect_to user_message_path(User.current, :type => "system_message")}
flash[:notice] = l(:notice_successful_message)
else
if params[:system_message][:content].empty?
flash[:error] = l(:label_content_blank_fail)
else
flash[:error] = l(:label_admin_message_fail)
end
format.html {redirect_to admin_messages_path}
end
end
end

View File

@ -324,8 +324,9 @@ class UsersController < ApplicationController
def user_homeworks
if User.current == @user
@page = params[:page] ? params[:page].to_i + 1 : 0
user_course_ids = "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
user_course_ids = @user.courses.empty? ? "(-1)" :"(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
@homework_commons = HomeworkCommon.where("course_id in #{user_course_ids}").order("created_at desc").limit(10).offset(@page * 10)
@is_teacher = User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)
respond_to do |format|
format.js
format.html {render :layout => 'new_base_user'}
@ -392,9 +393,29 @@ class UsersController < ApplicationController
end
end
#修改编程作业
def edit_user_commit_homework
if User.current.logged?
respond_to do |format|
format.js
format.html {render :layout => 'new_base_user'}
end
else
render_403
end
end
def user_commit_homework
flash[:notice] = l(:notice_successful_create)
redirect_to student_work_index_url(:homework => params[:homework])
homework = HomeworkCommon.find(params[:homework])
student_work = homework.student_works.where(user_id: User.current.id).first
if student_work
student_work.save
flash[:notice] = l(:notice_successful_create)
redirect_to student_work_index_url(:homework => params[:homework])
else
render_403
end
end
def user_new_homework
@ -413,21 +434,21 @@ class UsersController < ApplicationController
homework.save_attachments(params[:attachments])
render_attachment_warning_if_needed(homework)
#匿评作业相关属性
if homework.homework_type == 1
homework_detail_manual = HomeworkDetailManual.new
homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
homework_detail_manual.comment_status = 1
homework_detail_manual.evaluation_start = Time.now
homework_detail_manual.evaluation_end = Time.now
homework_detail_manual.evaluation_num = params[:evaluation_num] || 3
homework_detail_manual.absence_penalty = 2
homework.homework_detail_manual = homework_detail_manual
else
homework_detail_manual = HomeworkDetailManual.new
homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
homework_detail_manual.comment_status = 1
homework_detail_manual.evaluation_start = Time.now
homework_detail_manual.evaluation_end = Time.now
homework_detail_manual.evaluation_num = params[:evaluation_num] || 3
homework_detail_manual.absence_penalty = 2
homework.homework_detail_manual = homework_detail_manual
#编程作业相关属性
if homework.homework_type == 2
homework_detail_programing = HomeworkDetailPrograming.new
homework.homework_detail_programing = homework_detail_programing
homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6
homework_detail_programing.language = params[:program][:language].to_i
homework_detail_programing.language = params[:language_type].to_i
inputs = params[:program][:input]
if Array === inputs
@ -826,11 +847,13 @@ class UsersController < ApplicationController
@user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('created_at desc').limit(10).offset(@page * 10)
when "project_message"
@user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('created_at desc').limit(10).offset(@page * 10)
when "current_user"
@user_activities = UserActivity.where("user_id = #{User.current.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('created_at desc').limit(10).offset(@page * 10)
else
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids}) and act_type in #{course_types}").order('created_at desc').limit(10).offset(@page * 10)
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('created_at desc').limit(10).offset(@page * 10)
end
else
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids}) and act_type in #{course_types}").order('created_at desc').limit(10).offset(@page * 10)
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('created_at desc').limit(10).offset(@page * 10)
end
# @user_activities = paginateHelper @user_activities,500
@type = params[:type]

View File

@ -202,11 +202,15 @@ class WordsController < ApplicationController
#给用户留言
def leave_user_message
@user = User.find(params[:id])
if params[:new_form][:user_message].size>0 && User.current.logged? && @user
@user.add_jour(User.current, params[:new_form][:user_message])
if User.current.logged?
@user = User.find(params[:id])
if params[:new_form][:user_message].size>0 && User.current.logged? && @user
@user.add_jour(User.current, params[:new_form][:user_message])
end
redirect_to feedback_path(@user)
else
render_403
end
redirect_to feedback_path(@user)
end
# add by nwb

View File

@ -2297,25 +2297,27 @@ module ApplicationHelper
#获取匿评相关连接代码
def homework_anonymous_comment homework
if homework.homework_type == 1 && homework.homework_detail_manual #匿评作业
if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
link = "<span class='fr mr10 pr_join_span ' title='作业截止日期之前不可以启动匿评'>启动匿评</span>".html_safe
elsif homework.student_works.count >= 2 #作业份数大于2
case homework.homework_detail_manual.comment_status
when 1
link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'fr mr10 work_edit'
when 2
link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'fr mr10 work_edit'
when 3
link = "<span class='fr pr_join_span mr10' title='匿评结束'>匿评结束</span>".html_safe
end
else
link = "<span class='fr mr10 pr_join_span ' title='学生提交作业数大于2时才可以启动匿评'>启动匿评</span>".html_safe
# if homework.homework_type == 1 && homework.homework_detail_manual #匿评作业
#
# elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业作业
# link = "<span class='fr mr10 pr_join_span ' title='编程作业'>编程作业</span>".html_safe
# else
# link = "<span class='fr mr10 pr_join_span ' title='未开启匿评作业不可以启动匿评'>启动匿评</span>".html_safe
# end
if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
link = "<span class='fr mr10 pr_join_span ' title='作业截止日期之前不可以启动匿评'>启动匿评</span>".html_safe
elsif homework.student_works.count >= 2 #作业份数大于2
case homework.homework_detail_manual.comment_status
when 1
link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'fr mr10 work_edit'
when 2
link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'fr mr10 work_edit'
when 3
link = "<span class='fr pr_join_span mr10' title='匿评结束'>匿评结束</span>".html_safe
end
elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业作业
link = "<span class='fr mr10 pr_join_span ' title='编程作业'>编程作业</span>".html_safe
else
link = "<span class='fr mr10 pr_join_span ' title='未开启匿评作业不可以启动匿评'>启动匿评</span>".html_safe
link = "<span class='fr mr10 pr_join_span ' title='学生提交作业数大于2时才可以启动匿评'>启动匿评</span>".html_safe
end
link
end
@ -2334,6 +2336,20 @@ module ApplicationHelper
end
end
end
#动态列表中,确定学生是该提交还是进列表
def student_work_activity_submit_status(opt={})
default_opt = {class: 'c_blue'}.merge(opt)
is_teacher = User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)
homework = default_opt[:homework]
work = cur_user_works_for_homework homework
if work.nil? && !is_teacher
link_to "提交("+homework.student_works.count.to_s+")", new_student_work_path(:homework => homework.id), :class=> default_opt[:class]
else
link_to "提交("+homework.student_works.count.to_s+")", student_work_index_path(:homework => homework.id), :class=> default_opt[:class]
end
end
#根据传入作业确定显示为编辑作品还是新建作品,或者显示作品数量
def user_for_homework_common homework,is_teacher
@ -2345,7 +2361,7 @@ module ApplicationHelper
link_to "提交作品", new_student_work_path(:homework => homework.id),:class => 'c_blue'
else
if homework.homework_type == 1 && homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前
link_to "修改作品", "", :class => 'c_blue', :title => "开启匿评后不可修改作品"
link_to "作品已交", "", :class => 'c_blue', :title => "开启匿评后不可修改作品"
elsif homework.homework_type == 2 #编程作业不能修改作品
link_to "作品已交", student_work_index_path(:homework => homework.id),:class => 'c_blue',:title => "编程作业不可修改作品"
else

View File

@ -1,4 +1,5 @@
# encoding: utf-8
include UsersHelper
module HomeworkCommonHelper
#迟交扣分下拉框
def late_penalty_option

View File

@ -19,6 +19,7 @@ class CourseActivity < ActiveRecord::Base
user_activity.act_type = self.course_act_type
user_activity.container_type = "Course"
user_activity.container_id = self.course_id
user_activity.user_id = self.user_id
user_activity.save
end
end

View File

@ -10,7 +10,7 @@ class HomeworkCommon < ActiveRecord::Base
has_one :homework_detail_manual, :dependent => :destroy
has_one :homework_detail_programing, :dependent => :destroy
has_many :homework_tests, :dependent => :destroy
has_many :student_works, :dependent => :destroy
has_many :student_works, :dependent => :destroy, :conditions => "is_test=0"
has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动
# 课程动态
@ -56,6 +56,10 @@ class HomeworkCommon < ActiveRecord::Base
Mailer.run.homework_added(self)
end
def is_program_homework?
self.homework_type == 2 && self.homework_detail_programing
end
delegate :language_name, :to => :homework_detail_programing
end

View File

@ -1,6 +1,6 @@
#学生提交作品表
class StudentWork < ActiveRecord::Base
attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :project_id
attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :project_id, :is_test
belongs_to :homework_common
belongs_to :user
@ -10,10 +10,32 @@ class StudentWork < ActiveRecord::Base
has_many :student_work_tests, order: 'id desc'
before_destroy :delete_praise
before_save :set_program_score, :set_src
acts_as_attachable
def delete_praise
PraiseTread.where("praise_tread_object_id = #{self.id} AND praise_tread_object_type = 'StudentWork'").destroy_all
end
def last_test
student_work_tests.order('id desc').first
end
private
def set_program_score
if homework_common.is_program_homework? #编程作业,学生提交作品后计算系统得分
#根据最后一次测试计算得分
unless last_test
self.system_score = 0
else
self.system_score = last_test.test_score
end
end
end
def set_src
self.description = last_test.src if last_test
end
end

View File

@ -34,10 +34,19 @@ class StudentWorkTest < ActiveRecord::Base
def test_score
if self.status.to_i == 0
format("%.1f",100.0 / self.student_work.homework_common.homework_tests.count)
else
100
elsif self.results.empty?
0
else
get_success_count * 100 / self.results.count
end
end
private
def get_success_count
self.results.inject(0) do |sum, result|
sum += (result["status"].to_i == 0 ? 1 : 0)
end || 0
end
end

View File

@ -3,5 +3,5 @@ class SystemMessage < ActiveRecord::Base
belongs_to :user
validates :content, presence: true
validates_length_of :content, maximum:255
validates_length_of :content, maximum: 255
end

View File

@ -54,7 +54,7 @@
<%=@count %>
</td>
<td align="center">
<%=format_date(user.last_login_on) %>
<%=format_time(user.last_login_on) %>
</td>
<td align="center">
<%=user.id %>
@ -70,18 +70,20 @@
<%=link_to(user.login, user_path(user)) %>
</td>
<td align="center">
<% case user.user_extensions.identity %>
<% when 0 %>
<%='老师' %>
<% when 1 %>
<%='学生' %>
<% when 2 %>
<%='企业' %>
<% when 3 %>
<%='开发者' %>
<% else %>
<%='未知身份' %>
<% end %>
<%if user.user_extensions%>
<% case user.user_extensions.identity %>
<% when 0 %>
<%='老师' %>
<% when 1 %>
<%='学生' %>
<% when 2 %>
<%='企业' %>
<% when 3 %>
<%='开发者' %>
<% else %>
<%='未知身份' %>
<% end %>
<% end%>
</td>
</tr>
<% end %>

View File

@ -1,4 +1,5 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'prettify','/assets/kindeditor/pasteimg' %>
<%= stylesheet_link_tag 'prettify'%>
<%= labelled_form_for @bid,:html => { :multipart => true } do |f| %>
<%= render :partial => 'new_homework_form', :locals => { :bid => @bid, :bid_id => "edit_bid_#{@bid.id}",:f=>f,:edit_mode => true} %>
<% end %>

View File

@ -82,13 +82,19 @@ function nh_init_board(params){
var editor = params.kindutil.create(params.textarea, {
// allowPreviewEmoticons : false,
// allowImageUpload : false,
autoHeightMode : true,
resizeType : 1,minWidth:"1px",width:"560px",height:"150px",
allowFileManager:true,uploadJson:"/kindeditor/upload",
fileManagerJson:"/kindeditor/filemanager",
afterChange:function(){//按键事件
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
// var edit = this.edit;
// var body = edit.doc.body;
// edit.iframe.height(minHeight);
// this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + 30, minHeight));
},
afterCreate:function(){
this.loadPlugin("autoheight");
var userAgent = navigator.userAgent.toLowerCase();
if(/trident/.test(userAgent)){
$("div.talk_new .ke-container").css({'margin-left':'0px'});

View File

@ -10,11 +10,11 @@
div.respond-form .reply_btn{margin-left:565px;margin-top:5px;}
div.recall_con{width:570px;}
div.recall_con .reply_btn{margin-left:525px;margin-top:5px;}
.ke-container{height: 80px !important;}
/*.ke-container{height: 80px !important;}*/
</style>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_KindEditor" %>
<script >
init_KindEditor_data('');
init_KindEditor_data('',80);
</script>
<div class="msg_box fl mb10" id='leave-message'>
<h4><%= l(:label_leave_message) %></h4>
@ -62,6 +62,7 @@
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form);
params.height = 55;
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);

View File

@ -1,24 +1,23 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<%= error_messages_for 'homework_common' %>
<div class="project_r_h">
<h2 class="project_h2">
<%= l(:label_course_homework_edit)%>
</h2>
<script type="text/javascript">
function reset_homework(){
$("#homework_name").val("");
$("#homework_end_time").val("");
$("#course_id").val($("#option_select").val());
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new })%>");
homework_description_editor.html("");
$("#homework_editor").toggle();
}
</script>
<div class="homepageRightBanner mb10">
<div class="NewsBannerName">编辑作业</div>
</div>
<div class="hwork_new">
<%if @homework.homework_type == 2%>
<%= form_for @homework do |f| %>
<%= render :partial => 'homework_common/homework_detail_programing_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('edit_homework_common_<%= @homework.id%>');" >提交</a>
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
<% end%>
<% else %>
<%= form_for @homework do |f| %>
<%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('edit_homework_common_<%= @homework.id%>');" >提交</a>
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
<% end%>
<% end%>
</div><!--hwork_new end-->
<div class="cl"></div>
<!-- 老师身份才可以发布作业 -->
<div class="HomeWork mb10">
<%= form_for @homework do |f| %>
<div id="HomeWorkCon">
<%= render :partial => 'users/user_homework_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
</div>
<% end%>
</div><!----HomeWork end-->

View File

@ -98,17 +98,17 @@
<div class="cl"></div>
<% end%>
<div class="mt5">
<!--div class="mt5">
<span class="tit_fb" style="width: auto;"> 扣分标准:</span>
<div class="fl mb5 c_red">
<% if homework.homework_type == 1%>
<%= 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%>
<%# if homework.homework_type == 1%>
<%#= 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>
<div class="cl"></div>
<div class="cl"></div-->
<span class="fl"><%= l(:label_end_time)%><%= homework.end_time%></span>
<% if betweentime(homework.end_time) < 0 %>

View File

@ -78,11 +78,11 @@
</div>
</div>
<div class="navHomepageProfile">
<div class="navHomepageProfile" id="navHomepageProfile">
<ul>
<li class="homepageProfileMenuIcon">
<%= link_to "<div class='mt5 mb8'>#{image_tag(url_to_avatar(User.current),:width =>"40",:height => "40",:class => "portraitRadius",:alt=>"头像", :id => "nh_user_logo")}</div>".html_safe,user_activities_path(User.current.id)%>
<ul class="topnav_login_list">
<li class="homepageProfileMenuIcon" id="homepageProfileMenuIcon">
<%= link_to "<div class='mt5 mb8' id='user_avatar'>#{image_tag(url_to_avatar(User.current),:width =>"40",:height => "40",:class => "portraitRadius",:alt=>"头像", :id => "nh_user_logo")}</div>".html_safe,user_activities_path(User.current.id)%>
<ul class="topnav_login_list none" id="topnav_login_list">
<li>
<%= link_to "修改资料", my_account_path, :class => "menuGrey"%>
</li>
@ -110,6 +110,15 @@
$("#navHomepageSearchType").hide();
});
$("#user_avatar img").mouseenter(function(){
$("#homepageProfileMenuIcon").addClass("homepageProfileMenuIconhover");
$("#topnav_login_list").show();
});
$("#navHomepageProfile").mouseleave(function(){
$("#homepageProfileMenuIcon").removeClass("homepageProfileMenuIconhover");
$("#topnav_login_list").hide();
});
function signout(){
$.post(
'<%= signout_path%>',

View File

@ -8,11 +8,11 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application','prettify', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "jquery.leanModal.min" %>
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
<%= javascript_include_tag 'seems_rateable/jRating','prettify', 'seems_rateable/rateable'%>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->

View File

@ -17,8 +17,8 @@
<%= javascript_heads %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= stylesheet_link_tag 'public', 'leftside', 'jquery/jquery-ui-1.9.2', 'courses','header'%>
<%= javascript_include_tag "course","header","attachments" %>
<%= stylesheet_link_tag 'public', 'leftside', 'jquery/jquery-ui-1.9.2','prettify', 'courses','header'%>
<%= javascript_include_tag "course","header","attachments",'prettify' %>
<!-- page specific tags -->
<%= yield :header_tags -%>
</head>

View File

@ -7,10 +7,10 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application','prettify', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' ,'prettify' %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>

View File

@ -7,12 +7,12 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application','prettify', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= javascript_include_tag "ckeditor/ckeditor.js" %>
<%= javascript_include_tag "ckeditor/ckeditor.js",'prettify' %>
<!-- page specific tags -->
<%= yield :header_tags -%>
<%= stylesheet_link_tag 'base','header', :media => 'all'%>

View File

@ -12,8 +12,8 @@
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= stylesheet_link_tag 'public', 'pleft', 'project','jquery/jquery-ui-1.9.2','header' %>
<%= javascript_include_tag 'cookie','project', 'header','select_list_move' %>
<%= stylesheet_link_tag 'public', 'pleft', 'project','prettify','jquery/jquery-ui-1.9.2','header' %>
<%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move' %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>
@ -21,7 +21,7 @@
</head>
<!--add by huang-->
<body>
<body onload=" ">
<div class="navContainer mb10">
<% if User.current.logged? %>
<%= render :partial => 'layouts/logined_header' %>

View File

@ -12,8 +12,9 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application','prettify', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_include_tag 'prettify' %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>

View File

@ -13,10 +13,10 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application','prettify', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag 'prettify' %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->

View File

@ -14,10 +14,10 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'public_new', 'leftside_new','users', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'public_new', 'leftside_new',prettify,'users', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "avatars"%>
<%= javascript_include_tag "avatars",'prettify'%>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= yield :header_tags -%>

View File

@ -12,10 +12,10 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan','prettify', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "jquery.leanModal.min" %>
<%= javascript_include_tag "jquery.leanModal.min",'prettify' %>
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>

View File

@ -13,8 +13,8 @@
<%= javascript_heads %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= stylesheet_link_tag 'public', 'leftside', 'courses','header'%>
<%= javascript_include_tag "course","header" %>
<%= stylesheet_link_tag 'public', 'leftside', 'courses','header','prettify'%>
<%= javascript_include_tag "course","header",'prettify' %>
<!-- page specific tags -->
<%= yield :header_tags -%>
</head>

View File

@ -7,10 +7,10 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'new_user', 'user_leftside','users',:media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'new_user', 'user_leftside','prettify','users',:media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","new_user"%>
<%= javascript_include_tag "bootstrap","avatars","new_user",'prettify'%>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= yield :header_tags -%>
@ -27,6 +27,8 @@
</div>
<div class="homepageContentContainer">
<!--div class="homepageRightBannerImg"></div-->
<div class="cl"></div>
<div class="homepageContent">
<div class="homepageLeft" id="LSide">
<div class="homepagePortraitContainer">

View File

@ -7,10 +7,10 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan','prettify', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "jquery.leanModal.min" %>
<%= javascript_include_tag "jquery.leanModal.min",'prettify' %>
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>

View File

@ -7,10 +7,10 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan','prettify', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "jquery.leanModal.min" %>
<%= javascript_include_tag "jquery.leanModal.min" ,'prettify'%>
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>

View File

@ -213,6 +213,7 @@
<% occupation1 = User.current.user_extensions.occupation %>
<% occupation = User.current.user_extensions.occupation %>
<% title = User.current.user_extensions.technical_title %>
<% gender = User.current.user_extensions.gender %>
<% language = User.current.language %>
<% else %>
<% province = "湖南省" %>
@ -510,6 +511,13 @@
}
}
}
function init_gender(pField, gender) {
for (var i=0; i<pField.options.length; i++) {
if (pField.options[i].value == gender) {
pField.selectedIndex = i;
}
}
}
$(function(){
//学校
$("#province").attr("href", "#WOpenWindow")
@ -527,6 +535,10 @@
var occupation1 = "<%= "#{occupation}" %>"
init_identity_and_title(document.getElementById('userIdentity'), identity, document.getElementById('userTechnical_title'), title, language);
//sex
var gender = "<%= "#{gender}" %>"
init_gender(document.getElementById('gender'), gender);
$("#userIdentity").change();
<% if( !@act.nil? && @act == 'password') %>
$("#users_tb_2").click();

View File

@ -12,14 +12,6 @@
<p style="padding-right: 20px;">
<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:0px;" %>
</p><!--by young-->
<p>
<%#= f.text_field :enterprise_name, :size => 60, :style => "width:490px;" %>
<label for="project_description">
<%= l(:field_enterprise_name)%>
<span class="required">&nbsp;&nbsp;</span>
</label>
<%= select_tag :organization_id,options_for_select(project_organizations_id_option,@project.organization_id),{} %>
</p>
<p style="display: none" >
<%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH,
value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}" %>

View File

@ -19,11 +19,6 @@
<textarea class="w543" id="project_description" name="project[description]" rows="8" placeholder="最多3000个汉字(或6000个英文字符)"><%= @project.description%></textarea>
<div class="cl"></div>
</li>
<li >
<label class="label02">&nbsp;组织&nbsp;&nbsp;</label>
<%= select_tag :organization_id,options_for_select(project_organizations_id_option,@project.organization_id),{} %>
</li>
<div class="cl"></div>
<li >
<label class="label02">公开&nbsp;&nbsp;</label>
<input id="project_is_public" name="project[is_public]" type="checkbox" <%= @project.is_public ? "checked" : ""%>>

View File

@ -1,54 +1,62 @@
<div class="HomeWork" id="RSide">
<div class="RightBanner">
<div class="NewsBannerName">编辑作品</div>
</div>
<div class="Newwork">
<div class="hwork_ctt">
<div class="hwork_dis" id="tbc_01">
<%= labelled_form_for @work,:html => { :multipart => true } do |f|%>
<div class="N_con">
<p>
<label class="fl"><span class="c_red">*</span>&nbsp;&nbsp;作品名称&nbsp;&nbsp;&nbsp;&nbsp;</label>
<input type="text" name="student_work[name]" id="student_work_name" class="bo fl" maxlength="200" onkeyup="regexStudentWorkName();" value="<%= @work.name%>">
<a href="javascript:void(0)" class="fl ml10 mt3" onclick="show_project();" >项目信息
<img class="ml5 " src="/images/bid/pic_question.png" width="15" height="15" Title="项目是一种由用户创建的基于&#10;网络的协作空间,能够为个人&#10;或小组提供分布式的协同交流&#10;和资料管理等方面的。">
</a>
<div class="cl"></div>
<p id="student_work_name_span" class="c_red ml90 mb10"></p>
</p>
<div class="cl"></div>
<div class="homepageRightBanner mb10">
<div class="NewsBannerName">编辑作品</div>
</div>
<div class="cl"></div>
<p id="about_project" class="about_project" style="<%= @work.project.nil? ? '' : 'display:block;'%>">
<label class="fl">&nbsp;&nbsp;&nbsp;关联项目&nbsp;&nbsp;&nbsp;&nbsp;</label>
<%= f.select :project,options_for_select(user_projects_option,@work.project_id), {},{:class => "bo02 mb10"} %>
</p>
<div class="cl"></div>
<p>
<label class="fl">
<span class="c_red">*</span>
&nbsp;作品描述&nbsp;&nbsp;&nbsp;&nbsp;
</label>
<textarea name="student_work[description]" placeholder="最多3000个汉字(或6000个英文字符)" id="student_work_description" class="w620 hwork_txt" maxlength="6000" onkeyup="regexStudentWorkDescription();"><%= @work.description%></textarea>
<p id="student_work_description_textarea" class="c_red ml90 mb10"></p>
</p>
<div class="cl"></div>
<p>
<label class="fl">&nbsp;&nbsp;&nbsp;添加附件&nbsp;&nbsp;&nbsp;&nbsp;</label>
<%= render :partial => 'attachments/new_form',:locals => {:container => @work} %>
</p>
<div class="cl"></div>
<p class="ml80 ">
<a href="javascript:void(0)" class="blue_btn fl c_white mt10" onclick="edit_student_work(<%= @work.id%>);">提交作品</a>
<%= link_to "返&nbsp;&nbsp;回".html_safe, student_work_index_path(:homework => @homework), :class => "blue_btn grey_btn fl c_white mt10 ml10"%>
<div class="cl"></div>
</p>
</div><!---创建作业内容结束-->
<% end%>
<div class="HomeWork" id="users_setting">
<div class="HomeWorkBox">
<div class="">
<div class="homepagePostTitle fl">
<%= @homework.name%>(作业名称)
</div>
<span class="fr c_grey">
截止时间:<%= @homework.end_time%>
</span>
<div class="cl"></div>
<a href="javascript:void(0);" class="c_blue">
<%= link_to @homework.user.show_name, user_activities_path(@homework.user_id), :class => "c_blue"%>
</a>
<div class="cl"></div>
<div class="HomeWorkP">
<%= @homework.description.html_safe %>
</div>
</div>
</div>
</div><!--新建作业结束-->
<div class="cl"></div>
</div><!----HomeWorkBox end-->
<div class="cl"></div>
<div class="HomeWorkCon mt15">
<%= labelled_form_for @work,:html => { :multipart => true } do |f|%>
<div class=" c_red mb10">
提示:作品名称和描述中不要出现真实的姓名信息
</div>
<div class="cl"></div>
<div>
<input type="text" name="student_work[name]" id="student_work_name" placeholder="请简洁的概括作品的功能或特性" class="InputBox W700" maxlength="200" onkeyup="regexStudentWorkName();" value="<%= @work.name%>">
<div class="cl"></div>
<p id="student_work_name_span" class="c_red mb10"></p>
</div>
<div class="mt10">
<textarea name="student_work[description]" id="student_work_description" placeholder="请介绍你的作品" class="InputBox W700 H150" maxlength="6000" onkeyup="regexStudentWorkDescription();"><%= @work.description%></textarea>
<script>
var text = document.getElementById("student_work_description");
autoTextarea(text);// 调用
</script>
<div class="cl"></div>
<p id="student_work_description_textarea" class="c_red mb10"></p>
</div>
<div id="homework_attachments">
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => @work, :has_program=>false} %>
</div>
<div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="edit_student_work(<%= @work.id%>);">确定</a>
<span class="fr mr10 mt3">或</span>
<%= link_to "取消", student_work_index_path(:homework => @homework), :class => "fr mr10 mt3"%>
</div>
<div class="cl"></div>
<% end%>
</div><!----HomeWorkCon end-->
</div>

View File

@ -185,18 +185,18 @@
</div>
<div class="cl"></div>
<div class="mt5">
<!--div class="mt5">
<span class="tit_fb" style="width: auto;"> 扣分标准:</span>
<div class="fl mb5 c_red">
<% if @homework.homework_type == 1%>
<%= 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%>
<%# if @homework.homework_type == 1%>
<%#= 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>
<div class="cl"></div>
<div class="cl"></div-->
<span class="fl">截止时间:<%= @homework.end_time%></span>
<div >
<% if betweentime(@homework.end_time) < 0 %>

View File

@ -1,207 +1,86 @@
<% content_for :header_tags do %>
<%= javascript_include_tag 'homework','baiduTemplate' %>
<% end %>
<% if @homework.homework_type == 1 %>
<!-- 此界面只用来新建匿评作业作品 -->
<script type="text/javascript">
<%if @homework.homework_type == 1 && @homework.homework_detail_manual.comment_status != 1%>
<%if @homework.homework_detail_manual.comment_status != 1%>
$(function(){
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/new_student_work_alert') %>');
showModal('ajax-modal', '360px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().css("top","30%").css("left","40%");
$('#ajax-modal').parent().addClass("anonymos_work");
// alert("当前作业已开启匿评,您提交作品后将不会收到任何匿评作品,您的作品也不会被其他用户匿评,如需获得最终成绩,请您联系主讲老师对您的作品单独进行评分");
});
<% end%>
//匿评弹框取消按钮
function clickCanel(){hideModal("#popbox02");}
</script>
<div class="HomeWork" id="RSide">
<div class="RightBanner">
<div class="NewsBannerName">提交作品</div>
<div class="homepageRightBanner mb10">
<div class="NewsBannerName">提交作品</div>
</div>
<div class="cl"></div>
<div class="HomeWork" id="users_setting">
<div class="HomeWorkBox">
<div class="">
<div class="homepagePostTitle fl">
<%= @homework.name%>(作业名称)
</div>
<div class="Newwork">
<div class="hwork_ctt">
<div class="hwork_dis" id="tbc_01">
<%= form_for(@student_work,
:html => { :multipart => true },
:url => {:controller => 'student_work',
:action => 'create',
:homework => @homework.id
}) do |f|%>
<div class="N_con">
<% if @homework.homework_type == 1%>
<div class=" c_red mb10 ml90">
提示:匿评作业提交的作品,作品名称和描述中不能出现真实的姓名信息
</div>
<% end%>
<p>
<label class="fl"><span class="c_red">*</span>&nbsp;&nbsp;作品名称&nbsp;&nbsp;&nbsp;&nbsp;</label>
<%= f.text_field "name", :required => true, :size => 60, :class => "bo fl", :maxlength => 200, :placeholder => "作品名称", :onkeyup => "regexStudentWorkName();" %>
<% if @homework.homework_type != 2%>
<a href="javascript:void(0)" class="fl ml10 mt3" onclick=" $('#about_project').slideToggle();" >
项目信息
<img class="ml5 " src="../images/bid/pic_question.png" width="15" height="15" Title="项目是一种由用户创建的基于&#10;网络的协作空间,能够为个人&#10;或小组提供分布式的协同交流&#10;和资料管理等方面的。">
</a>
<% end%>
<div class="cl"></div>
<p id="student_work_name_span" class="c_red ml90 mb10"></p>
</p>
<div class="cl"></div>
<p id="about_project" class="about_project" >
<label class="fl">&nbsp;&nbsp;&nbsp;选择项目&nbsp;&nbsp;&nbsp;&nbsp;</label>
<%= f.select :project_id,options_for_select(user_projects_option), {},{:class => "bo02 mb10"} %>
</p>
<div class="cl"></div>
<p>
<label class="fl">
<span class="c_red">*</span>&nbsp;
<%= @homework.homework_type == 2 ? "提交代码" : "作品描述"%>
&nbsp;&nbsp;&nbsp;
</label>
<% 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%>
<div class="cl"></div>
<p id="student_work_description_textarea" class="c_red ml90 mb10"></p>
</p>
<div class="cl"></div>
<% if @homework.homework_type != 2%>
<p>
<label class="fl">&nbsp;&nbsp;&nbsp;添加附件&nbsp;&nbsp;&nbsp;&nbsp;</label>
<%= render :partial => 'attachments/new_form' %>
</p>
<div class="cl"></div>
<% end%>
<p class="ml80 ">
<a href="javascript:void(0)" class="blue_btn fl c_white mt10" onclick="new_student_work();">提交作品</a>
<%= link_to "返&nbsp;&nbsp;回".html_safe, student_work_index_path(:homework => @homework), :class => "blue_btn grey_btn fl c_white mt10 ml10"%>
<div class="cl"></div>
</p>
</div><!---创建作业内容结束-->
<% end%>
</div>
</div>
</div><!--新建作业结束-->
<span class="fr c_grey">
截止时间:<%= @homework.end_time%>
</span>
<div class="cl"></div>
</div>
<% else %>
<!-- 模板1开始可以使用scripttype设置为text/html来存放模板片段并且用id标示 -->
<script id="t:result-list" type="text/html">
<div class="ProResultTop">
<p class="c_blue fl">第<!=index!>次测试</p><span class="fr c_grey"><!= time !></span>
<a href="javascript:void(0);" class="c_blue">
<%= link_to @homework.user.show_name, user_activities_path(@homework.user_id), :class => "c_blue"%>
</a>
<div class="cl"></div>
</div>
<! if(status == -2){!>
<div class="ProResultCon "><!= error_msg !></div>
<!}else{!>
<div class="ProResultTable " >
<ul class="ProResultUl " >
<! for(var i =0; i <results.length; ++i){ !>
<li ><span class="w60 T_C">测试<!=i+1!></span>
<! if(results[i]["status"]!=0){ !>
<span class="w150 c_red">测试错误!</span>
<span class="w60">您的输出:</span>
<span class="W200"><!=results[i]["result"]!></span>
<span class="w60">正确输出:</span>
<span class="W200"><!=results[i]["output"]!></span>
<div class="cl"></div>
</li>
<!}else{!>
<span class="w150 c_green">测试正确!</span>
<div class="cl"></div>
</li>
<!}!>
<!}!>
</ul>
<div class="HomeWorkP">
<%= @homework.description.html_safe %>
</div>
<! } !>
</div>
</div><!----HomeWorkBox end-->
<div class="cl"></div>
</script>
<!-- 模板1结束 -->
<div class="HomeWork" id="RSide">
<div class="RightBanner">
<div class="NewsBannerName">提交作品</div>
<div class="HomeWorkCon mt15">
<%= form_for(@student_work,
:html => { :multipart => true },
:url => {:controller => 'student_work',
:action => 'create',
:homework => @homework.id
}) do |f|%>
<div class=" c_red mb10">
提示:作品名称和描述中不要出现真实的姓名信息
</div>
<div class="HomeWorkBox">
<div class="">
<div class="homepagePostTitle fl"><%= @homework.name %></div><span class="fr c_grey">截止时间:<%= @homework.end_time %></span>
<div class="cl"></div>
<a href="javascript:void(0);" class="c_blue"><%= @homework.user.show_name %></a>
<p class="HomeWorkP"><%= @homework.description %> <br />
输入 2 1 1 4 4 2 3 6 5 <br />
输出 15<br />
</p>
</div>
<p class="c_grey mt15">注:迟交扣<span class="c_red">2</span>分,缺评一个作品扣<span class="c_red">2</span>分</p>
</div><!---HomeWorkBox end -->
<div class="HomeWorkCon">
<%= form_for(@student_work,
:html => { :multipart => true },
:url => {:controller => 'student_work',
:action => 'create',
:student_work_id => @student_work.id,
:homework => @homework.id
},
:method => :post) do |f|%>
<div class="cl"></div>
<div class="mt15">
<span>请使用 <%= @homework.language_name %> 语言编写</span>
</div>
<div class="mt10">
<%= f.text_area :name, id: 'program-title', class:"InputBox W700", placeholder:"请概括你的代码的功能" %>
</div>
<div class="mt10">
<%= f.text_area :description, id: 'program-src', class:" W700 H150", placeholder:"请贴入你的代码", rows: 10 %>
</div>
<div class="mt10">
<a href="javascript:void(0);" class="BlueCirBtn fl" data-homework-id="<%=@homework.id%>" data-student-work-id="<%=@student_work.id%>" id="test-program-btn">测试代码</a>
<a href="javascript:void(0);" class="BlueCirBtn fr" id="commit-program-work-btn">提交代码</a>
<div class="cl"></div>
</div>
<% end %>
</div><!----HomeWorkCon end-->
</div><!----HomeWork end-->
<div class="ProResult mt10">
<% @student_work.student_work_tests.each_with_index do |test, index| %>
<div class="ProResultTop">
<p class="c_blue fl">第<%= @student_work.student_work_tests.count - index%>次测试</p><span class="fr c_grey"><%= test.created_at.to_s(:db) %></span>
<div class="cl"></div>
</div>
<% if test.status.to_i == -2 %>
<div class="ProResultCon "><%= test.results.first %></div>
<% else %>
<div class="ProResultTable " >
<ul class="ProResultUl " >
<% test.results.each_with_index do |x, i| %>
<li ><span class="w60 T_C">测试<%=i+1%></span>
<% if x["status"].to_i != 0 %>
<span class="w150 c_red">测试错误!</span>
<span class="w60">您的输出:</span>
<span class="W200"><%=x["result"]%></span>
<span class="w60">正确输出:</span>
<span class="W200"><%=x["output"]%></span>
<div class="cl"></div>
</li>
<% else %>
<span class="w150 c_green">测试正确!</span>
<div class="cl"></div>
</li>
<% end %>
<% end %>
</ul>
</div>
<% end %>
<% end %>
</div><!----ProResult end-->
<div>
<%= f.text_field "name", :required => true, :size => 60, :class => "InputBox W700", :maxlength => 200, :placeholder => "请简洁的概括作品的功能或特性", :onkeyup => "regexStudentWorkName();" %>
<div class="cl"></div>
<p id="student_work_name_span" class="c_red mb10"></p>
</div>
<div class="mt10">
<%= f.text_area "description", :class => "InputBox W700 H150", :placeholder => "请介绍你的作品", :onkeyup => "regexStudentWorkDescription();"%>
<script>
var text = document.getElementById("student_work_description");
autoTextarea(text);// 调用
</script>
<div class="cl"></div>
<p id="student_work_description_textarea" class="c_red mb10"></p>
</div>
<% end %>
<div id="homework_attachments">
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false} %>
</div>
<div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="new_student_work();">确定</a>
<span class="fr mr10 mt3">或</span>
<%= link_to "取消", user_homeworks_user_path(User.current.id), :class => "fr mr10 mt3"%>
</div>
<div class="cl"></div>
<% end%>
</div><!----HomeWorkCon end-->
</div>

View File

@ -17,7 +17,7 @@
</div>
<div class="homepagePostSubmitContainer">
<div class="homepagePostSubmit">
<%= link_to "提交("+activity.student_works.count.to_s+")", student_work_index_path(:homework => activity.id), :class=> "c_blue" %>
<%= student_work_activity_submit_status(homework: activity) %>
</div>
<div class="homepagePostDeadline">截止时间:<%= activity.end_time.to_s %></div>
</div>

View File

@ -72,7 +72,7 @@
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
<input type="hidden" name="quote[quote]" value="">
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px;"></div>
<a id="new_message_cancel_btn_<%= user_activity_id%>" href="javascript:void(0)" class="grey_n_btn fr " style="margin-top:6px;">取消</a>

View File

@ -44,7 +44,7 @@
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" nhname='new_message_textarea_<%= user_activity_id%>' name="comment"></textarea>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="comment"></textarea>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px;"></div>
<a id="new_message_cancel_btn_<%= user_activity_id%>" href="javascript:void(0)" class="grey_n_btn fr " style="margin-top:6px;">取消</a>

View File

@ -1,6 +1,6 @@
<% has_commit = has_commit_poll?(activity.id ,User.current)%>
<% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%>
<% if has_commit || activity.user_id == User.current %>
<% if ( activity.polls_status==2) %>
<div class="resources mt10">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">

View File

@ -82,7 +82,7 @@
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => add_journal_issue_path(activity.id),:method => "post", :remote => true) do |f|%>
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" nhname='new_message_textarea_<%= user_activity_id%>' name="notes"></textarea>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="notes"></textarea>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px;"></div>
<a id="new_message_cancel_btn_<%= user_activity_id%>" href="javascript:void(0)" class="grey_n_btn fr " style="margin-top:6px;">取消</a>
@ -130,4 +130,18 @@
</div>
<% end %>
</div>
</div>
</div>
<script type="text/javascript">
$(function(){
var images=$("div#activity_description_<%= user_activity_id %>").find("img");
if (images.length>0) {
for (var i=0; i<images.length; i++){
var image=$(images[i]);
var element=$("<a></a>").attr("href",image.attr('src'));
image.wrap(element);
}
}
$('#activity_description_<%= user_activity_id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false});
});
</script>

View File

@ -58,7 +58,7 @@
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
<input type="hidden" name="quote[quote]" value="">
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px;"></div>
<a id="new_message_cancel_btn_<%= user_activity_id%>" href="javascript:void(0)" class="grey_n_btn fr " style="margin-top:6px;">取消</a>

View File

@ -30,11 +30,11 @@
<div class="courseReferContainer">
<% if !projects.empty? %>
<% projects.each do |project| %>
<ul class="courseSend fl">
<li class="fl">
<ul class="courseSend">
<li class="" style="display:inline-block">
<input name="projects_ids[]" type="checkbox" value="<%= project.id %>" class="courseSendCheckbox"/>
</li>
<li class="sendCourseName fl"><%= project.name%></li>
<li class="sendCourseName"><%= project.name%></li>
</ul>
<% end %>
</div>

View File

@ -30,11 +30,11 @@
<div class="courseReferContainer">
<% if !courses.empty? %>
<% courses.each do |course| %>
<ul class="courseSend fl">
<li class="fl">
<ul class="courseSend">
<li class="" style="display:inline-block">
<input name="course_ids[]" type="checkbox" value="<%= course.id %>" class="courseSendCheckbox"/>
</li>
<li class="sendCourseName fl"><%= course.name%></li>
<li class="sendCourseName"><%= truncate(course.name,:lendght=>25) + '['+course.time.to_s+course.term + ']'%></li>
</ul>
<% end %>
</div>

View File

@ -11,7 +11,7 @@
</li>
<li class="resourcesListName fl">
<!--<a href="javascript:void(0);" class="resourcesBlack"><%#=truncate(attach.filename,:length=>18)%></a>-->
<%= link_to truncate(attach.filename,:length=>18), download_named_attachment_path(attach.id, attach.filename),
<%= link_to truncate(attach.filename,:length=>30), download_named_attachment_path(attach.id, attach.filename),
:title => attach.filename,:class=>'resourcesBlack'%>
</li>
<li class="resourcesListSize fl"><%= number_to_human_size(attach.filesize) %></li>

View File

@ -9,7 +9,6 @@
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
div.ke-toolbar .ke-outline{border:none;}
.ke-inline-block{display: none;}
.ke-container{height: 30px !important;}
</style>
<% user_activities.each do |user_activity|
if user_activities %>
@ -63,5 +62,12 @@
<% end %>
<% if user_activities.count == 10%>
<%= link_to "点击展开更多",user_activities_path(@user.id,:type => type,:page => page),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%>
<div id="show_more_activities" class="loadMore mt10 f_grey">展开更多<%=link_to "", user_activities_path(@user.id,:type => type,:page => page),:id => "more_activities_link",:remote => "true",:class => "none" %></div>
<%#= link_to "点击展开更多",user_activities_path(@user.id,:type => type,:page => page),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%>
<% end%>
<script type="text/javascript">
$("#show_more_activities").mouseover(function(){
$("#more_activities_link").click();
});
</script>

View File

@ -49,6 +49,10 @@
<!-- , user_import_resource_user_path(User.current.id,:homework_id=>container.id) -->
<a href="javascript:void(0);" class="AnnexBtn fl mt3" onclick="$('#_file').click();">上传附件</a>
<%= link_to "资源库",{:controller => 'users',:action=>'user_import_resource',:id=>User.current.id,:homework_id=>container.id},:class => "FilesBtn fl mr15 mt3",:remote => true%>
<% if defined?(has_program) && has_program %>
<a href="javascript:void(0);" class="ProBtn fl mt3">编程</a>
<span class="fl C_lgrey mt3 program_detail_info"></span>
<% end %>
</div>
<% content_for :header_tags do %>

View File

@ -1,27 +1,26 @@
<% content_for :header_tags do %>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg'%>
<%= javascript_include_tag 'homework','baiduTemplate' %>
<% end %>
<div class="HomeWorkCon">
<div>
<input type="text" name="homework_common[name]" id="homework_name" class="InputBox w712" maxlength="255" onfocus="$('#homework_editor').show()" onkeyup="regex_homework_name();" placeholder="请输入作业标题" value="<%= homework.name%>" >
<input type="text" name="homework_common[name]" id="homework_name" class="InputBox w701" maxlength="255" onfocus="$('#homework_editor').show()" onkeyup="regex_homework_name();" placeholder="请输入作业标题" value="<%= homework.name%>" >
<p id="homework_name_span" class="c_red mt5"></p>
</div>
<div class="cl"></div>
<div class=" mt10">
<%= link_to "导入作业", user_import_homeworks_user_path(User.current.id),:class => "BlueCirBtn fl mr10",:remote => true%>
<%= link_to("导入作业", user_import_homeworks_user_path(User.current.id),:class => "BlueCirBtn fl mr10",:remote => true) unless edit_mode%>
<div class="calendar_div fl">
<input type="text" name="homework_common[end_time]" id="homework_end_time" placeholder="截止日期" class="InputBox fl W120 calendar_input" readonly="readonly" >
<input type="text" name="homework_common[end_time]" id="homework_end_time" placeholder="截止日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.end_time%>" >
<%= calendar_for('homework_end_time')%>
</div>
</div>
<div class="cl"></div>
<p id="homework_end_time_span" class="c_red mt5"></p>
<div class="cl"></div>
<div id="homework_editor" style="display: none">
<div id="homework_editor" style="display: <%= edit_mode ? 'block':'none'%>">
<div class="mt10">
<% if edit_mode %>
<%= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px", :owner_id => homework.id, :owner_type => OwnerTypeHelper::HOMEWORKCOMMON %>
@ -34,46 +33,30 @@
<div class="mt10">
<%= select_tag :course_id, options_for_select(get_as_teacher_courses(User.current), homework.course_id), {:class => "InputBox w720",:value => "请选择发布作业的课程"} %>
<%= select_tag :course_id, options_for_select(get_as_teacher_courses(User.current), homework.course_id), {:class => "InputBox w709",:value => "请选择发布作业的课程"} %>
</div>
<p id="homework_course_id_span" class="c_red mt5"></p>
<div class="cl"></div>
<div id="homework_attachments">
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => homework} %>
<!-- 编辑作业 && 作业类型为匿评作业 时没有编程选项-->
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => homework, :has_program=>!(edit_mode && homework.homework_type == 1)} %>
</div>
<div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick=" submit_comm_homework('new_homework_common');">发送</a>
<span class="fr mr10 mt3">或</span>
<a href="javascript:void(0);" class=" fr mr10 mt3" onclick="reset_homework();">取消</a>
<% if edit_mode %>
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_homework('edit_homework_common_<%= homework.id%>');">确定</a>
<span class="fr mr10 mt3">或</span>
<%= link_to "取消",user_homeworks_user_path(User.current.id),:class => "fr mr10 mt3"%>
<% else %>
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_homework('new_homework_common');">发送</a>
<span class="fr mr10 mt3">或</span>
<a href="javascript:void(0);" class=" fr mr10 mt3" onclick="reset_homework();">取消</a>
<% end %>
<div class="cl"></div>
</div>
<div class="mt10">
<a href="javascript:void(0);" class=" fl DropBtn">编程选项</a>
<div class="DropLine"></div>
<div class="cl"></div>
</div>
<div class="advanced_option" style="display:none;">
<div class="mt10">
<select class="InputBox W120" name="program[language]">
<option value="1" selected>C语言</option>
<option value="2">C++</option>
</select>
</div>
<div class="mt10">
<textarea class="InputBox W320 fl mr10" placeholder="测试输入" name="program[input][]"></textarea><textarea class="InputBox W320 fl mr5" placeholder="测试输出" name="program[output][]"></textarea>
<a href="javascript:void(0);" class=" fl icon_add" title="增加测试组"></a>
<div class="cl"></div>
</div>
</div>
<input type="hidden" name="homework_type" value="1">
</div>
@ -82,9 +65,46 @@
<script id="t:test-answer-list" type="text/html">
<div class="mt10">
<textarea class="InputBox W320 fl mr10" placeholder="测试输入" required name="program[input][]"></textarea><textarea class="InputBox W320 fl mr5" placeholder="测试输出" required name="program[output][]"></textarea>
<textarea class="InputBox W320 fl mr10" placeholder="测试输入" name="program[input][]"></textarea><textarea class="InputBox W320 fl mr5" placeholder="测试输出" name="program[output][]"></textarea>
<a href="javascript:void(0);" class=" fl icon_add" title="增加测试组"></a>
<a href="javascript:void(0);" class=" fl icon_remove" title="删除测试组"></a>
<div class="cl"></div>
</div>
</script>
<script type="text/html" id="t:program-input-list">
<div class="program-input">
<input type="hidden" name="language_type" value="<!= language_type !>" />
<! for(var i=0; i< input_groups.length; ++i) { !>
<input name="program[input][]" type="hidden" value="<!= input_groups[i].input !>" />
<input name="program[output][]" type="hidden" value="<!= input_groups[i].output !>" />
<! } !>
</div>
</script>
<div class="BluePopupBox" id="BluePopupBox" style="display:none">
<a href="javascript:void(0);" class="CloseBtn" title="关闭弹框"></a>
<h2 class="BluePopuph2 fl">编程作业的测试集设置</h2>
<div class="cl"></div>
<div class="HomeWorkCon">
<div class="mt15">
<select class="InputBox W120 language_type" >
<option value="1" selected>C语言</option>
<option value="2">C++</option>
</select>
</div>
<div class="mt10">
<textarea class="InputBox W320 fl mr10" placeholder="测试输入" id="textarea_input_test"></textarea><textarea class="InputBox W320 fl mr5" placeholder="测试输出"></textarea>
<a href="javascript:void(0);" class=" fl icon_add" title="增加测试组"></a>
<div class="cl"></div>
</div>
<div class="mt10">
<a href="javascript:void(0);" class="BlueCirBtn fr">确&nbsp;&nbsp;定</a>
<div class="cl"></div>
</div>
</div><!----HomeWorkCon end-->
</div><!----BluePopupBox end-->

View File

@ -21,7 +21,7 @@
</div>
<% if homework_common.homework_type == 2 && is_teacher%>
<div class="homepagePostSubmit">
<%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: homework_common.id, is_test: true), class: 'c_blue' %>
<%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: homework_common.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
</div>
<% end %>
<div class="homepagePostDeadline">
@ -35,8 +35,8 @@
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework_common.attachments} %>
<div class="cl"></div>
</div>
<%# if is_teacher%>
<% if false%>
<% if is_teacher%>
<%# if false%>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">

View File

@ -38,11 +38,15 @@
</script>
<!-- 模板1结束 -->
<div class="homepageRight">
<div class="ProgramHomework">
<div class="homepageRightBanner mb10">
<div class="NewsBannerName"><%= @is_test ? '模拟答题' : '提交作品' %></div>
</div>
<div class="cl"></div>
<div class="HomeWork">
<div class="RightBanner">
<div class="NewsBannerName"><%= @is_test ? '模拟答题' : '提交作品' %></div>
</div>
<div class="HomeWorkBox">
<div class="">
<div class="homepagePostTitle fl"><%= @homework.name %></div><span class="fr c_grey">截止时间:<%= @homework.end_time %></span>
@ -70,7 +74,7 @@
<%= f.text_area :name, id: 'program-title', class:"InputBox W700", placeholder:"请概括你的代码的功能" %>
</div>
<div class="mt10">
<%= f.text_area :description, id: 'program-src', class:" W700 H150", placeholder:"请贴入你的代码", rows: 10 %>
<%= f.text_area :description, id: 'program-src', class:"InputBox W700 H150", placeholder:"请贴入你的代码", rows: 10 %>
</div>
<div class="mt10">
<a href="javascript:void(0);" class="BlueCirBtn fl" data-homework-id="<%=@homework.id%>" data-student-work-id="<%=@student_work.id%>" id="test-program-btn">测试代码</a>

View File

@ -1,40 +1,41 @@
<input type="hidden" value="<%= @type%>" name="type" id="user_activities_type">
<div class="homepageRightBanner">
<div class="homepageRightBanner">
<div class="NewsBannerName">最新动态</div>
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="homepagePostType">
<li>
<ul class="homepagePostTypeHomework fl">
<li class="f14">课程动态</li>
<li><%= link_to "作业动态", {:controller => "users", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%>
<!--<a href="javascript:void(0);" class="homepagePostTypeAssignment postTypeGrey">作业动态</a>--></li>
<li><%= link_to "通知动态", {:controller => "users", :action => "show", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeNotice postTypeGrey">通知动态</a></li>-->
<li><%= link_to "论坛动态", {:controller => "users", :action => "show", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
<li><%= link_to "问卷动态", {:controller => "users", :action => "show", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuiz postTypeGrey">问卷动态</a></li>-->
</ul>
</li>
<li>
<ul class="homepagePostTypeProject fl">
<li class="f14">项目动态</li>
<li><%= link_to "问题动态", {:controller => "users", :action => "show", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%>
<li><%= link_to "论坛动态", {:controller => "users", :action => "show", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuestion postTypeGrey">问题动态</a></li>
<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
</ul>
</li>
<li>
<ul class="homepagePostTypeProject fl">
<li class="f14">更多</li>
<li class="mt-4"><%= link_to "全部动态", {:controller => "users", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%>
</ul>
</li>
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="homepagePostType">
<li>
<ul class="homepagePostTypeHomework fl">
<li class="f14">课程动态</li>
<li><%= link_to "作业动态", {:controller => "users", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%>
<!--<a href="javascript:void(0);" class="homepagePostTypeAssignment postTypeGrey">作业动态</a>--></li>
<li><%= link_to "通知动态", {:controller => "users", :action => "show", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeNotice postTypeGrey">通知动态</a></li>-->
<li><%= link_to "论坛动态", {:controller => "users", :action => "show", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
<li><%= link_to "问卷动态", {:controller => "users", :action => "show", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuiz postTypeGrey">问卷动态</a></li>-->
</ul>
</li>
<li>
<ul class="homepagePostTypeProject fl">
<li class="f14">项目动态</li>
<li><%= link_to "问题动态", {:controller => "users", :action => "show", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%>
<li><%= link_to "论坛动态", {:controller => "users", :action => "show", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuestion postTypeGrey">问题动态</a></li>
<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
</ul>
</li>
<li>
<ul class="homepagePostTypeProject fl">
<li class="f14">更多</li>
<li class="mt-4"><%= link_to "我的动态", {:controller => "users", :action => "show", :type => "current_user"}, :class =>"homepagePostTypeAll postTypeGrey"%>
<li class="mt-4"><%= link_to "全部动态", {:controller => "users", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%>
</ul>
</li>
</ul>
</div>
</li>
</ul>
</div>
<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities,:page => 0,:type => @type} %>

View File

@ -3,7 +3,7 @@
$("#homework_name").val("");
$("#homework_end_time").val("");
$("#course_id").val($("#option_select").val());
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new })%>");
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true })%>");
homework_description_editor.html("");
$("#homework_editor").toggle();
}
@ -17,7 +17,7 @@
</div>
<div class="cl"></div>
<% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
<% if @is_teacher%>
<!-- 老师身份才可以发布作业 -->
<div class="HomeWork mb10">
<% homework = HomeworkCommon.new %>

View File

@ -4,5 +4,5 @@ $('#ajax-modal').css('height','500px').css("width","730px");
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<div class='resourcePopupClose mt5 mr-5'>" +
"<a href='javascript:void(0)' class='resourceClose' onclick='hideModal();'></a></div>");
$('#ajax-modal').parent().css("top","").css("left","").css("position","fixed").css("padding-left","16px").css("padding-bottom","16px").css("padding-right","16px");
$('#ajax-modal').parent().css("top","30%").css("left","").css("position","fixed").css("padding-left","16px").css("padding-bottom","16px").css("padding-right","16px");
$('#ajax-modal').parent().addClass("popbox").addClass("referenceResourcesPopup");

View File

@ -36,7 +36,7 @@
<% if params[:type].nil? || params[:type] == "unviewed" %>
<div class="newsReadSetting">
有&nbsp;<span class="c_red"><%= unviewed_message(@user) %></span>&nbsp;条未读
<% unless unviewed_message(@user) == 0 %>
<% unless (unviewed_message(@user) == 0 || User.current != @user) %>
<a href="javascript:void(0);" class="ml15"><%= link_to "全部设为已读", user_message_path(User.current, :viewed => 'all') %></a>
<% end %>
</div>
@ -57,12 +57,12 @@
</li>
<li class="homepageNewsContent fl">
<%= link_to usm.content.html_safe, {:controller => 'system_messages', :action => 'index'},
:class => "newsGrey",
:class => "newsRed",
:onmouseover => "message_titile_show($(this),event);",
:onmouseout => "message_titile_hide($(this));"
%>
</li>
<div style="display:none;" class="message_title">
<div style="display:none;" class="message_title_red">
<%= usm.content.html_safe %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(usm.created_at).html_safe %> </li>
@ -356,7 +356,7 @@
:onmouseout => "message_titile_hide($(this));"
%>
</li>
<div style="display:none;" class="message_title">
<div style="display:none;" class="message_title_red">
<%= ma.content.html_safe%>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>

View File

@ -8,7 +8,7 @@
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;}
.ke-container{height: 80px !important;}
/*.ke-container{height: 80px !important;}*/
</style>
<div >
<div class="homepageRightBanner mb10">
@ -20,7 +20,7 @@
<div class="message_box mb10" id="users_setting">
<div nhname='new_message' style="display:none;">
<%= form_for('new_form',:url => leave_user_message_path(@user.id),:method => "post") do |f|%>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" nhname='new_message_textarea' name="new_form[user_message]"></textarea>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea' name="new_form[user_message]"></textarea>
<p nhname='contentmsg'></p>
<div nhname='toolbar_container' style="float:left;padding-top:3px;"></div>
<a id="new_message_cancel_btn" href="javascript:void(0)" class="grey_n_btn fr " style="margin-top:6px;">取消</a>

View File

@ -2,4 +2,6 @@
closeModal();
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
//这里不能将翻页的更新
$("#res_all_count").html(parseInt($("#res_all_count").html())+1);
$("#res_all_count").html(parseInt($("#res_all_count").html())+1);
$("#res_count").html(0);
$("#checkboxAll").attr('checked',false);

View File

@ -3,6 +3,6 @@ hideModal('#coursesChoosePopup');
$("#homework_name").val("<%= @homework.name%>");
$("#homework_end_time").val("<%= @homework.end_time%>");
$("#course_id").val("<%= @homework.course_id%>");
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => @homework })%>");
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => @homework,:has_program => true })%>");
homework_description_editor.html("<%= escape_javascript(@homework.description.html_safe)%>");
$("#homework_editor").show();

View File

@ -15,4 +15,6 @@ zh:
label_registration_automatic_activation: 自动激活帐号
label_system_message: 系统消息
label_admin_message_fail: 消息内容过长!
label_content_blank_fail: 消息内容不能为空!

View File

@ -1,13 +1,6 @@
class DeleteAnonymousJour < ActiveRecord::Migration
def up
jour_count = Journal.all.count / 30 + 2
transaction do
for i in 1 ... jour_count do i
Journal.page(i).per(30).each do |jour|
jour.destroy if jour.user_id == 2
end
end
end
Journal.where("user_id = 2").destroy_all
end
def down

View File

@ -0,0 +1,8 @@
class DeleteAnonymousFeedback < ActiveRecord::Migration
def up
JournalsForMessage.where("user_id = 2").destroy_all
end
def down
end
end

View File

@ -0,0 +1,8 @@
class DeleteAnonymousMessage < ActiveRecord::Migration
def up
Message.where("author_id = 2").destroy_all
end
def down
end
end

View File

@ -0,0 +1,5 @@
class AddUserIdToUserActivities < ActiveRecord::Migration
def change
add_column :user_activities, :user_id, :int
end
end

View File

@ -0,0 +1,40 @@
class UpdateUserActivities < ActiveRecord::Migration
def up
count = UserActivity.all.count / 30 + 2
transaction do
for i in 1 ... count do i
UserActivity.page(i).per(30).each do |activity|
if activity.container_type.to_s == 'Project'
forge_activity = ForgeActivity.where("forge_act_type = '#{activity.act_type.to_s}' and forge_act_id = #{activity.act_id}").first
if forge_activity
activity.user_id = forge_activity.user_id
else
activity.user_id = 0
end
elsif activity.container_type.to_s == 'Course'
course_activity = CourseActivity.where("course_act_type = '#{activity.act_type.to_s}' and course_act_id = #{activity.act_id}").first
if course_activity
activity.user_id = course_activity.user_id
else
activity.user_id = 0
end
end
activity.save
end
end
end
end
def down
count = UserActivity.all.count / 30 + 2
transaction do
for i in 1 ... count do i
UserActivity.page(i).per(30).each do |activity|
activity.user_id = nil
activity.save
end
end
end
end
end

View File

@ -0,0 +1,5 @@
class AddIsTestToStudentWorks < ActiveRecord::Migration
def change
add_column :student_works, :is_test, :boolean, default: false
end
end

View File

@ -0,0 +1,25 @@
class AboutProgramingHomework < ActiveRecord::Migration
def up
HomeworkCommon.where(:homework_type => 2).each do |homework|
unless homework.homework_detail_manual
homework_detail_manual = HomeworkDetailManual.new
homework_detail_manual.ta_proportion = 0.6
homework_detail_manual.comment_status = 1
homework_detail_manual.evaluation_start = homework.created_at
homework_detail_manual.evaluation_end = homework.created_at
homework_detail_manual.evaluation_num = 3
homework_detail_manual.absence_penalty = 2
homework_detail_manual.homework_common_id = homework.id
homework_detail_manual.save
end
end
end
def down
HomeworkCommon.where(:homework_type => 2).each do |homework|
if homework.homework_detail_manual
homework.homework_detail_manual.destroy
end
end
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150909062619) do
ActiveRecord::Schema.define(:version => 20150911031029) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -1328,6 +1328,7 @@ ActiveRecord::Schema.define(:version => 20150909062619) do
t.integer "late_penalty", :default => 0
t.integer "absence_penalty", :default => 0
t.integer "system_score"
t.boolean "is_test", :default => false
end
create_table "student_works_evaluation_distributions", :force => true do |t|
@ -1438,6 +1439,7 @@ ActiveRecord::Schema.define(:version => 20150909062619) do
t.integer "container_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "user_id"
end
create_table "user_extensions", :force => true do |t|

View File

@ -7,7 +7,10 @@ module RailsKindeditor
input_html = input_html.merge(style: 'display:none')
output = ActiveSupport::SafeBuffer.new
output << text_area_tag(name, content, input_html)
output << javascript_tag(js_replace(id, options.merge(window_onload: 'true')))
output << javascript_tag(js_replace(id, options.merge(window_onload: 'true',
:autoHeightMode=>true,
afterCreate: 'eval(function(){enablePasteImg(self);this.loadPlugin("autoheight")})'
)))
end
def kindeditor(name, method, options = {})
@ -17,7 +20,9 @@ module RailsKindeditor
output_buffer = ActiveSupport::SafeBuffer.new
output_buffer << build_text_area_tag(name, method, self, options, input_html)
output_buffer << javascript_tag(js_replace(input_html['id'],options.merge(window_onload: 'true',
afterCreate: 'eval(function(){enablePasteImg(self);})')))
:autoHeightMode=>true,
afterCreate: 'eval(function(){enablePasteImg(self);this.loadPlugin("autoheight")})'
)))
end
def kindeditor_upload_json_path(*args)

View File

@ -258,16 +258,16 @@ K.options = {
fullscreenShortcut : false,
bodyClass : 'ke-content',
indentChar : '\t',
cssPath : '',
cssPath : K.basePath +'plugins/code/previewcode.css',
cssData : '',
minWidth : 650,
minHeight : 100,
minChangeSize : 50,
zIndex : 811213,
items : [ 'emoticons',
'source','plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', '|',
'formatblock', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
'italic', 'underline', 'removeformat', '|','imagedirectupload','table', 'media',"more"
items : ['code', 'emoticons','fontname',
'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|',
'formatblock', 'fontsize', '|','indent', 'outdent',
'|','imagedirectupload','table', 'media', 'preview',"more"
],
noDisableItems : ['source', 'fullscreen'],
colorTable : [
@ -4986,17 +4986,17 @@ KEditor.prototype = {
htmlList.unshift('<div style="display:block" id="define"/>')
htmlList.push('</div>')
var htmlListFull = [];
var fullItems = [
'emoticons',
'source','plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', '|',
'formatblock', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
'italic', 'underline', 'removeformat', '|','imagedirectupload','table', 'media', "less",
var fullItems = ['code',
'emoticons','fontname',
'forecolor', 'hilitecolor', 'bold','|', 'justifyleft', 'justifycenter', 'insertorderedlist', 'insertunorderedlist', '|',
'formatblock', 'fontsize', '|', 'indent', 'outdent',
'|','imagedirectupload','table', 'media', 'preview', "less",
'/',
'undo', 'redo', '|', 'preview', 'print', 'template',
'justifyfull', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
'superscript', 'clearhtml', 'quickformat', /* 'selectall',*/ 'fontname',
'italic', 'underline', 'undo', 'redo', '|', 'removeformat',
'justifyright','justifyfull', 'source','plainpaste', 'wordpaste', 'subscript',
'superscript', 'clearhtml', 'quickformat', /* 'selectall',*/
'strikethrough', 'lineheight', 'hr', 'pagebreak',
'anchor' , 'link','unlink'
'link','unlink', 'print'
]
K.each(fullItems, function(i, name) {
if (name == '|') {
@ -5069,6 +5069,7 @@ KEditor.prototype = {
}
self.updateState();
self.addBookmark();
prettyPrint("",self.edit.doc.body);
if (self.options.afterChange) {
self.options.afterChange.call(self);
}
@ -5550,6 +5551,7 @@ _plugin('core', function(K) {
self.afterSetHtml(function() {
if (self.options.afterChange) {
self.options.afterChange.call(self);
}
});
self.afterCreate(function() {

View File

@ -27,7 +27,9 @@ KindEditor.plugin('autoheight', function(K) {
var edit = self.edit;
var body = edit.doc.body;
edit.iframe.height(minHeight);
self.resize(null, Math.max((K.IE ? body.scrollHeight : body.offsetHeight) + 76, minHeight));
self.resize(null, Math.max(
(K.IE ? body.scrollHeight : body.offsetHeight)
+ 76, minHeight));
}
function init() {
@ -35,7 +37,12 @@ KindEditor.plugin('autoheight', function(K) {
self.edit.afterChange(resetHeight);
hideScroll();
resetHeight();
var edit = self.edit;
var body = edit.doc.body;
edit.iframe.height(minHeight);
self.resize(null, Math.max(
((K.IE ? body.scrollHeight : body.offsetHeight) > 500 ? 500 : (K.IE ? body.scrollHeight : body.offsetHeight)) //限制初始化太高的情况
+ 76, minHeight));
}
if (self.isCreated) {

View File

@ -23,10 +23,9 @@ KindEditor.plugin('code', function(K) {
'<option value="php">PHP</option>',
'<option value="pl">Perl</option>',
'<option value="py">Python</option>',
'<option value="rb">Ruby</option>',
'<option value="java">Java</option>',
'<option value="vb">ASP/VB</option>',
'<option value="cpp">C/C++</option>',
'<option value="c">C/C++</option>',
'<option value="cs">C#</option>',
'<option value="xml">XML</option>',
'<option value="bsh">Shell</option>',
@ -46,7 +45,7 @@ KindEditor.plugin('code', function(K) {
var type = K('.ke-code-type', dialog.div).val(),
code = textarea.val(),
cls = type === '' ? '' : ' lang-' + type,
html = '<pre class="prettyprint' + cls + '">\n' + K.escape(code) + '</pre> ';
html = '<pre class="prettyprint linenums ' + cls + '">\n' + K.escape(code) + '</pre> ';
if (K.trim(code) === '') {
alert(lang.pleaseInput);
textarea[0].focus();

View File

@ -1,13 +0,0 @@
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
pre.prettyprint {
border: 0;
border-left: 3px solid rgb(204, 204, 204);
margin-left: 2em;
padding: 0.5em;
font-size: 110%;
display: block;
font-family: "Consolas", "Monaco", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace;
margin: 1em 0px;
white-space: pre;
}

View File

@ -1,28 +0,0 @@
var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a=
[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c<i;++c){var j=f[c];if(/\\[bdsw]/i.test(j))a.push(j);else{var j=m(j),d;c+2<i&&"-"===f[c+1]?(d=m(f[c+2]),c+=2):d=j;b.push([j,d]);d<65||j>122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;c<b.length;++c)i=b[c],i[0]<=j[1]+1?j[1]=Math.max(j[1],i[1]):f.push(j=i);b=["["];o&&b.push("^");b.push.apply(b,a);for(c=0;c<
f.length;++c)i=f[c],b.push(e(i[0])),i[1]>i[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c<b;++c){var j=f[c];j==="("?++i:"\\"===j.charAt(0)&&(j=+j.substring(1))&&j<=i&&(d[j]=-1)}for(c=1;c<d.length;++c)-1===d[c]&&(d[c]=++t);for(i=c=0;c<b;++c)j=f[c],j==="("?(++i,d[i]===void 0&&(f[c]="(?:")):"\\"===j.charAt(0)&&
(j=+j.substring(1))&&j<=i&&(f[c]="\\"+d[i]);for(i=c=0;c<b;++c)"^"===f[c]&&"^"!==f[c+1]&&(f[c]="");if(a.ignoreCase&&s)for(c=0;c<b;++c)j=f[c],a=j.charAt(0),j.length>=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p<d;++p){var g=a[p];if(g.ignoreCase)l=!0;else if(/[a-z]/i.test(g.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){s=!0;l=!1;break}}for(var r=
{b:8,t:9,n:10,v:11,f:12,r:13},n=[],p=0,d=a.length;p<d;++p){g=a[p];if(g.global||g.multiline)throw Error(""+g);n.push("(?:"+y(g)+")")}return RegExp(n.join("|"),l?"gi":"g")}function M(a){function m(a){switch(a.nodeType){case 1:if(e.test(a.className))break;for(var g=a.firstChild;g;g=g.nextSibling)m(g);g=a.nodeName;if("BR"===g||"LI"===g)h[s]="\n",t[s<<1]=y++,t[s++<<1|1]=a;break;case 3:case 4:g=a.nodeValue,g.length&&(g=p?g.replace(/\r\n?/g,"\n"):g.replace(/[\t\n\r ]+/g," "),h[s]=g,t[s<<1]=y,y+=g.length,
t[s++<<1|1]=a)}}var e=/(?:^|\s)nocode(?:\s|$)/,h=[],y=0,t=[],s=0,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=document.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);m(a);return{a:h.join("").replace(/\n$/,""),c:t}}function B(a,m,e,h){m&&(a={a:m,d:a},e(a),h.push.apply(h,a.e))}function x(a,m){function e(a){for(var l=a.d,p=[l,"pln"],d=0,g=a.a.match(y)||[],r={},n=0,z=g.length;n<z;++n){var f=g[n],b=r[f],o=void 0,c;if(typeof b===
"string")c=!1;else{var i=h[f.charAt(0)];if(i)o=f.match(i[1]),b=i[0];else{for(c=0;c<t;++c)if(i=m[c],o=f.match(i[1])){b=i[0];break}o||(b="pln")}if((c=b.length>=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),
l=[],p={},d=0,g=e.length;d<g;++d){var r=e[d],n=r[3];if(n)for(var k=n.length;--k>=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/,
q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g,
"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a),
a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}
for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g<d.length;++g)e(d[g]);m===(m|0)&&d[0].setAttribute("value",
m);var r=s.createElement("OL");r.className="linenums";for(var n=Math.max(0,m-1|0)||0,g=0,z=d.length;g<z;++g)l=d[g],l.className="L"+(g+n)%10,l.firstChild||l.appendChild(s.createTextNode("\xa0")),r.appendChild(l);a.appendChild(r)}function k(a,m){for(var e=m.length;--e>=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*</.test(m)?"default-markup":"default-code";return A[a]}function E(a){var m=
a.g;try{var e=M(a.h),h=e.a;a.a=h;a.c=e.c;a.d=0;C(m,h)(a);var k=/\bMSIE\b/.test(navigator.userAgent),m=/\n/g,t=a.a,s=t.length,e=0,l=a.c,p=l.length,h=0,d=a.e,g=d.length,a=0;d[g]=s;var r,n;for(n=r=0;n<g;)d[n]!==d[n+2]?(d[r++]=d[n++],d[r++]=d[n++]):n+=2;g=r;for(n=r=0;n<g;){for(var z=d[n],f=d[n+1],b=n+2;b+2<=g&&d[b+1]===f;)b+=2;d[r++]=z;d[r++]=f;n=b}for(d.length=r;h<p;){var o=l[h+2]||s,c=d[a+2]||s,b=Math.min(o,c),i=l[h+1],j;if(i.nodeType!==1&&(j=t.substring(e,b))){k&&(j=j.replace(m,"\r"));i.nodeValue=
j;var u=i.ownerDocument,v=u.createElement("SPAN");v.className=d[a+1];var x=i.parentNode;x.replaceChild(v,i);v.appendChild(i);e<o&&(l[h+1]=i=u.createTextNode(t.substring(b,o)),x.insertBefore(i,v.nextSibling))}e=b;e>=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],
H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+
I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),
["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",
/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),
["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",
hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p<h.length&&l.now()<e;p++){var n=h[p],k=n.className;if(k.indexOf("prettyprint")>=0){var k=k.match(g),f,b;if(b=
!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p<h.length?setTimeout(m,
250):a&&a()}for(var e=[document.getElementsByTagName("pre"),document.getElementsByTagName("code"),document.getElementsByTagName("xmp")],h=[],k=0;k<e.length;++k)for(var t=0,s=e[k].length;t<s;++t)h.push(e[k][t]);var e=q,l=Date;l.now||(l={now:function(){return+new Date}});var p=0,d,g=/\blang(?:uage)?-([\w.]+)(?!\S)/;m()};window.PR={createSimpleLexer:x,registerLangHandler:k,sourceDecorator:u,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",
PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ"}})();

View File

@ -0,0 +1,76 @@
/* Pretty printing styles. Used with prettify.js. */
/* SPAN elements with the classes below are added by prettyprint. */
.pln { color: #000 } /* plain text */
@media screen {
.str { color: #080 } /* string content */
.kwd { color: #008 } /* a keyword */
.com { color: #800 } /* a comment */
.typ { color: #606 } /* a type name */
.lit { color: #066 } /* a literal value */
/* punctuation, lisp open bracket, lisp close bracket */
.pun, .opn, .clo { color: #660 }
.tag { color: #008 } /* a markup tag name */
.atn { color: #606 } /* a markup attribute name */
.atv { color: #080 } /* a markup attribute value */
.dec, .var { color: #606 } /* a declaration; a variable name */
.fun { color: red } /* a function name */
}
/* Use higher contrast and text-weight for printable form. */
@media print, projection {
.str { color: #060 }
.kwd { color: #006; font-weight: bold }
.com { color: #600; font-style: italic }
.typ { color: #404; font-weight: bold }
.lit { color: #044 }
.pun, .opn, .clo { color: #440 }
.tag { color: #006; font-weight: bold }
.atn { color: #404 }
.atv { color: #060 }
}
/* Put a border around prettyprinted code snippets. */
pre.prettyprint { padding: 2px;
border-left:1px solid #ccc;
border-bottom: 1px solid #ccc;
border-right: 1px solid #ccc,
border-top: 1px solid #ccc }
pre li,ul,ol {
list-style-type: none;
}
/* Specify class=linenums on a pre to get line numbering */
ol.linenums { margin-top: 0; margin-bottom: 0 } /* IE indents via margin-left */
li.L0,
li.L1,
li.L2,
li.L3,
li.L5,
li.L6,
li.L7,
li.L8 { list-style-type: none }
/* Alternate shading for lines */
li.L1,
li.L3,
li.L5,
li.L7,
li.L9 { background: #eee }
.prettyprint *{font-family:'courier new',monospace;}
/*.prettyprint .com { color: #93a1a1; }*/
/*.prettyprint .lit { color: #AE81FF; }*/
/*.prettyprint .pun,*/
/*.prettyprint .opn,*/
/*.prettyprint .clo { color: #F8F8F2; }*/
/*.prettyprint .fun { color: #dc322f; }*/
/*.prettyprint .str,*/
/*.prettyprint .atv { color: #E6DB74; }*/
/*.prettyprint .kwd,*/
/*.prettyprint .tag { color: #F92659; }*/
/*.prettyprint .typ,*/
/*.prettyprint .atn,*/
/*.prettyprint .dec,*/
/*.prettyprint .var { color: #A6E22E; }*/
/*.prettyprint .pln { color: #66D9EF; }*/

BIN
public/images/CloseBtn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -4,7 +4,7 @@ $(function(){
var bt=baidu.template;
bt.LEFT_DELIMITER='<!';
bt.RIGHT_DELIMITER='!>';
var tested = false;
var valid_form = function() {
var src = $('#program-src').val();
@ -42,7 +42,7 @@ $(function(){
data.index = $('.ProResultTop').length+1;
}
if (typeof cb == 'function') {cb(); return;}
if (typeof cb == 'function') {cb(data); return;}
var html=bt('t:result-list',data);
@ -58,10 +58,10 @@ $(function(){
);
};
$('#test-program-btn').on('click', test_program);
$('#test-program-btn').live('click', test_program);
$('#commit-program-work-btn').on('click', function(){
$('#commit-program-work-btn').live('click', function(){
if(!valid_form()){
return;
}
@ -74,7 +74,13 @@ $(function(){
}
if (!tested) {
test_program(function(){
test_program(function(data){
if (data.status!=0) {
var r=confirm("测试不通过,是否强制提交?");
if (!r) {
return;
}
};
$(".HomeWorkCon form").submit();
});
return;
@ -83,55 +89,85 @@ $(function(){
$(".HomeWorkCon form").submit();
});
$('form.edit_student_work').on('keydown', '#program-src', function(){
$('form.edit_student_work').live('keydown', '#program-src', function(){
tested = false;
});
//发布作业
var isProgramHomework = function(){
return !$(".advanced_option").is(":hidden");
}
var submit_comm_homework = function(id){
var valid = true;
if (isProgramHomework()) {
$.each($('.advanced_option textarea.InputBox'), function(i, val){
if ($(val).val().length<=0) {
$(val).focus();
valid = false;
return false;
}
});
if (valid) {
$('input[name=homework_type]').val(2);
};
}
if (valid) {
submit_homework(id);
}
}
window.submit_comm_homework = submit_comm_homework;
$('#program-src').focus(function(){
$(this).css('height', '100px');
});
var datepickerOptions={dateFormat:'yy-mm-dd',firstDay:0,showWeek:true,showOtherMonths:true,selectOtherMonths:true};
$('input.date-input').datepicker(datepickerOptions);
$('a.pic_date').on('click', function(){
$('a.pic_date').live('click', function(){
$(this).parent().prev().first().focus();
})
$('a.DropBtn').on('click', function(){
$(".advanced_option").toggle();
$('a.ProBtn').live('click', function(){
$("#BluePopupBox").dialog({
modal: true,
dialogClass: 'BluePopupBox',
minWidth: 753
});
$(".ui-dialog-titlebar").hide();
$("a.CloseBtn").live('click', function(){
$("#BluePopupBox" ).dialog("close");
});
$('#textarea_input_test').focus();
$("#BluePopupBox a.BlueCirBtn").live('click', function(){
var test_numbers = 0;
var valid = true;
var input = null;
var output = null;
var input_groups = [];
$.each($('#BluePopupBox textarea.InputBox'), function(i, val){
if ($(val).val().length<=0) {
$(val)[0].focus();
valid =false;
return false;
}
if (test_numbers %2==0) {
input = $(val).val();
} else {
output = $(val).val();
input_groups.push({input: input, output: output});
}
test_numbers += 1;
});
var language = $('select.language_type').val() == 1 ? 'C语言' : 'C++语言';
if (valid) {
$("input[name=homework_type]").val(2);
$('span.program_detail_info').text('('+language+''+test_numbers/2+'组测试)');
//保存js值
var data = {
language_type: $('select.language_type').val(),
input_groups: input_groups
};
//构建到form中
$('.program-input').remove();
var html=bt('t:program-input-list',data);
$("input[name=homework_type]").after(html);
$("#BluePopupBox" ).dialog( "close" );
}
});
});
$(".HomeWork").on('click', 'a.icon_add', function(){
$("#BluePopupBox").live('click', 'a.icon_add', function(){
var html = bt('t:test-answer-list', null);
$(this).parent('.mt10').after(html);
});
$(".HomeWork").on('click', 'a.icon_remove', function(){
$("#BluePopupBox").live('click', 'a.icon_remove', function(){
$(this).parent('.mt10').remove();
});
});

View File

@ -1,14 +1,35 @@
function init_editor(params){
// var minHeight; //最小高度
var paramsHeight = params.height; //设定的高度
var editor = params.kindutil.create(params.textarea, {
resizeType : 1,minWidth:"1px",width:"100%",height:"80px",
items:['emoticons'],
resizeType : 1,minWidth:"1px",width:"100%",
height:"30px",// == undefined ? "30px":paramsHeight+"px",
minHeight:"30px",// == undefined ? "30px":paramsHeight+"px",
items:['emoticons'],
afterChange:function(){//按键事件
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
var edit = this.edit;
var body = edit.doc.body;
edit.iframe.height(paramsHeight);
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + (paramsHeight == undefined ? 30:paramsHeight), paramsHeight));
},
afterCreate:function(){
var toolbar = $("div[class='ke-toolbar']",params.div_form);
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
params.toolbar_container.append(toolbar);
//init
var edit = this.edit;
var body = edit.doc.body;
edit.iframe[0].scroll = 'no';
body.style.overflowY = 'hidden';
//reset height
var edit = this.edit;
var body = edit.doc.body;
paramsHeight = paramsHeight == undefined ? params.kindutil.removeUnit(this.height) : paramsHeight;
edit.iframe.height(paramsHeight);
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+ (paramsHeight == undefined ? 30:paramsHeight) , paramsHeight));
}
}).loadPlugin('paste');
return editor;
@ -66,8 +87,9 @@ function nh_reset_form(params){
}
params.contentmsg.hide();
}
//第二个参数是高度,可以传,可以不传
function init_KindEditor_data(id){
var height = arguments[1] ? arguments[1] : undefined;
KindEditor.ready(function (K) {
$("div[nhname='new_message_" + id + "']").each(function () {
var params = {};
@ -82,7 +104,7 @@ function init_KindEditor_data(id){
params.toolbar_container = $("div[nhname='toolbar_container_" + id + "']", params.div_form);
params.cancel_btn = $("#new_message_cancel_btn_" + id);
params.submit_btn = $("#new_message_submit_btn_" + id);
params.height = height;
if (params.textarea.data('init') == undefined) {
params.editor = init_editor(params);
init_form(params);

View File

@ -0,0 +1,274 @@
/*!
Autosize 1.18.13
license: MIT
http://www.jacklmoore.com/autosize
*/
(function ($) {
var
defaults = {
className: 'autosizejs',
id: 'autosizejs',
append: '\n',
callback: false,
resizeDelay: 10,
placeholder: true
},
// border:0 is unnecessary, but avoids a bug in Firefox on OSX
copy = '<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; padding: 0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden; transition:none; -webkit-transition:none; -moz-transition:none;"/>',
// line-height is conditionally included because IE7/IE8/old Opera do not return the correct value.
typographyStyles = [
'fontFamily',
'fontSize',
'fontWeight',
'fontStyle',
'letterSpacing',
'textTransform',
'wordSpacing',
'textIndent',
'whiteSpace'
],
// to keep track which textarea is being mirrored when adjust() is called.
mirrored,
// the mirror element, which is used to calculate what size the mirrored element should be.
mirror = $(copy).data('autosize', true)[0];
// test that line-height can be accurately copied.
mirror.style.lineHeight = '99px';
if ($(mirror).css('lineHeight') === '99px') {
typographyStyles.push('lineHeight');
}
mirror.style.lineHeight = '';
$.fn.autosize = function (options) {
if (!this.length) {
return this;
}
options = $.extend({}, defaults, options || {});
if (mirror.parentNode !== document.body) {
$(document.body).append(mirror);
}
return this.each(function () {
var
ta = this,
$ta = $(ta),
maxHeight,
minHeight,
boxOffset = 0,
callback = $.isFunction(options.callback),
originalStyles = {
height: ta.style.height,
overflow: ta.style.overflow,
overflowY: ta.style.overflowY,
wordWrap: ta.style.wordWrap,
resize: ta.style.resize
},
timeout,
width = $ta.width(),
taResize = $ta.css('resize');
if ($ta.data('autosize')) {
// exit if autosize has already been applied, or if the textarea is the mirror element.
return;
}
$ta.data('autosize', true);
if ($ta.css('box-sizing') === 'border-box' || $ta.css('-moz-box-sizing') === 'border-box' || $ta.css('-webkit-box-sizing') === 'border-box'){
boxOffset = $ta.outerHeight() - $ta.height();
}
// IE8 and lower return 'auto', which parses to NaN, if no min-height is set.
minHeight = Math.max(parseInt($ta.css('minHeight'), 10) - boxOffset || 0, $ta.height());
$ta.css({
overflow: 'hidden',
overflowY: 'hidden',
wordWrap: 'break-word' // horizontal overflow is hidden, so break-word is necessary for handling words longer than the textarea width
});
if (taResize === 'vertical') {
$ta.css('resize','none');
} else if (taResize === 'both') {
$ta.css('resize', 'horizontal');
}
// The mirror width must exactly match the textarea width, so using getBoundingClientRect because it doesn't round the sub-pixel value.
// window.getComputedStyle, getBoundingClientRect returning a width are unsupported, but also unneeded in IE8 and lower.
function setWidth() {
var width;
var style = window.getComputedStyle ? window.getComputedStyle(ta, null) : false;
if (style) {
width = ta.getBoundingClientRect().width;
if (width === 0 || typeof width !== 'number') {
width = parseInt(style.width,10);
}
$.each(['paddingLeft', 'paddingRight', 'borderLeftWidth', 'borderRightWidth'], function(i,val){
width -= parseInt(style[val],10);
});
} else {
width = $ta.width();
}
mirror.style.width = Math.max(width,0) + 'px';
}
function initMirror() {
var styles = {};
mirrored = ta;
mirror.className = options.className;
mirror.id = options.id;
maxHeight = parseInt($ta.css('maxHeight'), 10);
// mirror is a duplicate textarea located off-screen that
// is automatically updated to contain the same text as the
// original textarea. mirror always has a height of 0.
// This gives a cross-browser supported way getting the actual
// height of the text, through the scrollTop property.
$.each(typographyStyles, function(i,val){
styles[val] = $ta.css(val);
});
$(mirror).css(styles).attr('wrap', $ta.attr('wrap'));
setWidth();
// Chrome-specific fix:
// When the textarea y-overflow is hidden, Chrome doesn't reflow the text to account for the space
// made available by removing the scrollbar. This workaround triggers the reflow for Chrome.
if (window.chrome) {
var width = ta.style.width;
ta.style.width = '0px';
var ignore = ta.offsetWidth;
ta.style.width = width;
}
}
// Using mainly bare JS in this function because it is going
// to fire very often while typing, and needs to very efficient.
function adjust() {
var height, original;
if (mirrored !== ta) {
initMirror();
} else {
setWidth();
}
if (!ta.value && options.placeholder) {
// If the textarea is empty, copy the placeholder text into
// the mirror control and use that for sizing so that we
// don't end up with placeholder getting trimmed.
mirror.value = ($ta.attr("placeholder") || '');
} else {
mirror.value = ta.value;
}
mirror.value += options.append || '';
mirror.style.overflowY = ta.style.overflowY;
original = parseInt(ta.style.height,10);
// Setting scrollTop to zero is needed in IE8 and lower for the next step to be accurately applied
mirror.scrollTop = 0;
mirror.scrollTop = 9e4;
// Using scrollTop rather than scrollHeight because scrollHeight is non-standard and includes padding.
height = mirror.scrollTop;
if (maxHeight && height > maxHeight) {
ta.style.overflowY = 'scroll';
height = maxHeight;
} else {
ta.style.overflowY = 'hidden';
if (height < minHeight) {
height = minHeight;
}
}
height += boxOffset;
if (original !== height) {
ta.style.height = height + 'px';
if (callback) {
options.callback.call(ta,ta);
}
$ta.trigger('autosize.resized');
}
}
function resize () {
clearTimeout(timeout);
timeout = setTimeout(function(){
var newWidth = $ta.width();
if (newWidth !== width) {
width = newWidth;
adjust();
}
}, parseInt(options.resizeDelay,10));
}
if ('onpropertychange' in ta) {
if ('oninput' in ta) {
// Detects IE9. IE9 does not fire onpropertychange or oninput for deletions,
// so binding to onkeyup to catch most of those occasions. There is no way that I
// know of to detect something like 'cut' in IE9.
$ta.on('input.autosize keyup.autosize', adjust);
} else {
// IE7 / IE8
$ta.on('propertychange.autosize', function(){
if(event.propertyName === 'value'){
adjust();
}
});
}
} else {
// Modern Browsers
$ta.on('input.autosize', adjust);
}
// Set options.resizeDelay to false if using fixed-width textarea elements.
// Uses a timeout and width check to reduce the amount of times adjust needs to be called after window resize.
if (options.resizeDelay !== false) {
$(window).on('resize.autosize', resize);
}
// Event for manual triggering if needed.
// Should only be needed when the value of the textarea is changed through JavaScript rather than user input.
$ta.on('autosize.resize', adjust);
// Event for manual triggering that also forces the styles to update as well.
// Should only be needed if one of typography styles of the textarea change, and the textarea is already the target of the adjust method.
$ta.on('autosize.resizeIncludeStyle', function() {
mirrored = null;
adjust();
});
$ta.on('autosize.destroy', function(){
mirrored = null;
clearTimeout(timeout);
$(window).off('resize', resize);
$ta
.off('autosize')
.off('.autosize')
.css(originalStyles)
.removeData('autosize');
});
// Call adjust in case the textarea already contains text.
adjust();
});
};
}(jQuery || $)); // jQuery or jQuery-like library, such as Zepto

View File

@ -71,6 +71,7 @@ function submit_homework(id)
$("#course_id").focus();
}
else{
homework_description_editor.sync();
$("#"+id).submit();
}
@ -177,4 +178,75 @@ function regexStudentWorkDescription()
$("#student_work_description_textarea").text("");
return true;
}
}
}
//textarea自适应高度 纯js写的 有浏览器判断
/**
* 文本框根据输入内容自适应高度
* @param {HTMLElement} 输入框元素
* @param {Number} 设置光标与输入框保持的距离(默认0)
* @param {Number} 设置最大高度(可选)
*/
var autoTextarea = function (elem, extra, maxHeight) {
extra = extra || 0;
var isFirefox = !!document.getBoxObjectFor || 'mozInnerScreenX' in window,
isOpera = !!window.opera && !!window.opera.toString().indexOf('Opera'),
addEvent = function (type, callback) {
elem.addEventListener ?
elem.addEventListener(type, callback, false) :
elem.attachEvent('on' + type, callback);
},
getStyle = elem.currentStyle ? function (name) {
var val = elem.currentStyle[name];
if (name === 'height' && val.search(/px/i) !== 1) {
var rect = elem.getBoundingClientRect();
return rect.bottom - rect.top -
parseFloat(getStyle('paddingTop')) -
parseFloat(getStyle('paddingBottom')) + 'px';
};
return val;
} : function (name) {
return getComputedStyle(elem, null)[name];
},
minHeight = parseFloat(getStyle('height'));
elem.style.resize = 'none';
var change = function () {
var scrollTop, height,
padding = 0,
style = elem.style;
if (elem._length === elem.value.length) return;
elem._length = elem.value.length;
if (!isFirefox && !isOpera) {
padding = parseInt(getStyle('paddingTop')) + parseInt(getStyle('paddingBottom'));
};
scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
elem.style.height = minHeight + 'px';
if (elem.scrollHeight > minHeight) {
if (maxHeight && elem.scrollHeight > maxHeight) {
height = maxHeight - padding;
style.overflowY = 'auto';
} else {
height = elem.scrollHeight - padding;
style.overflowY = 'hidden';
};
style.height = height + extra + 'px';
scrollTop += parseInt(style.height) - elem.currHeight;
document.body.scrollTop = scrollTop;
document.documentElement.scrollTop = scrollTop;
elem.currHeight = parseInt(style.height);
};
};
addEvent('propertychange', change);
addEvent('input', change);
addEvent('focus', change);
change();
};

File diff suppressed because it is too large Load Diff

View File

@ -8,11 +8,12 @@ $(function(){
params.div_form = $("div[nhname='div_form']",params.container);
params.form = $("form",params.div_form);
params.textarea = $("textarea[name='user_notes']",params.div_form);
params.textarea.prev('div').css("height","60px");
//params.textarea.prev('div').css("height","60px");
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("a[nhname='cancel_btn']",params.div_form);
params.submit_btn = $("a[nhname='submit_btn']",params.div_form);
params.height = 55;
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
@ -42,11 +43,12 @@ $(function(){
params.div_form = $("div[nhname='sub_div_form']",params.container);
params.form = $("form",params.div_form);
params.textarea = $("textarea[name='user_notes']",params.div_form);
params.textarea.prev('div').css("height","60px");
//params.textarea.prev('div').css("height","60px");
params.contentmsg = $("p[nhname='sub_contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='sub_toolbar_container']",params.div_form);
params.cancel_btn = $("a[nhname='sub_cancel_btn']",params.div_form);
params.submit_btn = $("a[nhname='sub_submit_btn']",params.div_form);
params.height = 45;
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
@ -82,7 +84,7 @@ $(function(){
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("#new_message_cancel_btn");
params.submit_btn = $("#new_message_submit_btn");
params.height = 80;
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);

View File

@ -2807,4 +2807,6 @@ img.school_avatar {
width: 100px;
height: 100px;
max-width: none;
}
}
.admin_message_warn{font-size: 12px;color: red;}

View File

@ -16,10 +16,10 @@ a.homepageSearchIcon:hover {background:url(../images/nav_icon.png) -49px 3px no-
.homepageNewsIcon {background:url(../images/nav_icon.png) -5px -85px no-repeat; width:30px; height:35px; display:block;}
.newsActive {width:10px; height:10px; border-radius:50%; border:2px solid #ffffff; background-color:#ff0000; position:absolute; left:17px; top:5px;}
.navHomepageProfile {width:65px; display:block; float:right; margin-left:33px;}
.homepageProfileMenuIcon {background:url(../images/nav_icon.png) 30px -155px no-repeat; width:65px; height:54px; position:relative; display:inline-block;}
.homepageProfileMenuIcon:hover {background:url(../images/nav_icon.png) 30px -122px no-repeat;}
.navHomepageProfile ul li ul {display:none;}
.navHomepageProfile ul li:hover ul {display:block;}
.homepageProfileMenuIcon {background:url(../images/nav_icon.png) 30px -155px no-repeat; width:65px; height:54px; position:relative; display:inline-block; line-height:0;}
.homepageProfileMenuIconhover {background:url(../images/nav_icon.png) 30px -122px no-repeat;}
/*.navHomepageProfile ul li ul {display:none;}
.navHomepageProfile ul li:hover ul {display:block;}*/
.homepageLeft {width:240px; float:left; margin-right:10px; margin-bottom:10px;}
.homepageRight {width:750px; float:left; margin-top:15px; margin-bottom:10px;}
.homepagePortraitContainer {width:238px; border:1px solid #dddddd; background-color:#ffffff; margin-top:15px; padding-bottom:15px;}
@ -31,6 +31,7 @@ a.homepageSearchIcon:hover {background:url(../images/nav_icon.png) -49px 3px no-
.homepageEditProfileIcon {background:url(../images/homepage_icon.png) -11px -35px no-repeat; width:20px; height:20px; display:block;}
.homepageImageName {font-size:16px; color:#484848; margin-left:15px; margin-right:8px; height:21px; float:left;}
.homepageImageSex {top:116px; left:5px; width:20px; height:20px; background:url(../images/homepage_icon.png) -10px -112px no-repeat; float:left;}
.homepageImageSexMan {top:116px; left:5px; width:20px; height:20px; background:url(../images/homepage_icon.png) -10px -112px no-repeat; float:left;}
.homepageImageSexWomen {width: 20px;height: 20px;background: url(../images/homepage_icon.png) -10px -149px no-repeat;float: left;}
.homepageSignatureTextarea {width:207px; height:80px; max-width:207px; max-height:80px; border:1px solid #d9d9d9; outline:none; margin:0px 0px 12px 15px;;}
.homepageSignature {font-size:12px; color:#888888; margin-left:15px; margin-top:10px; margin-bottom:12px; width:208px;}
@ -77,6 +78,8 @@ a.menuGrey {color:#808080;}
a.menuGrey:hover {color:#fe7d68;}
.navSearchTypeBox {width:368px; height:35px; position:absolute; border:1px solid #e1e1e1; background-color:#ffffff; padding-left:10px; display:none; color:#3e3e3e; font-size:14px;}
#navSearchAlert {display:none;}
.none{display: none;}
.db {display:block !important;}
/*myctrip*/
.userImage{position:absolute; right:140px; top:5px; width:30px;height:30px; background: url(../images/item.png) 2px 4px no-repeat; line-height:1.4;}
@ -90,9 +93,10 @@ li.menuArrow:hover {background:url(../images/item.png) -20px -70px no-repeat;}
a.topnav_login_box:hover {color:#a1ebff;}
.navRow1 {margin:0; padding:0;}
.navRow2 {margin:0; padding:0;}
.topnav_login_list{ border:1px solid #15bccf; background:#fff; padding-left:10px; padding-bottom:10px; padding-top:8px; width:60px; left:-7px; position:absolute; z-index:9999; line-height:2;margin-top: -5px;}
.topnav_login_list a{color:#15bccf;}
.topnav_login_list{ border:1px solid #269ac9; background:#fff; padding-left:10px; padding-bottom:10px; padding-top:8px; width:60px; left:-7px; position:absolute; z-index:9999; line-height:2;}
.topnav_login_list a{color:#269ac9;}
.topnav_login_list li{ }
.portraitRadius {border-radius: 3px;}
/*底部*/
#Footer{background-color:#ffffff; padding-bottom:15px; color:#666666;} /*margin-bottom:10px;*/

View File

@ -296,7 +296,7 @@ a:hover.search_btn{ background: #0fa9bb;}
a.resourcesGrey {font-size:12px; color:#888888;}
a.resourcesGrey:hover {font-size:12px; color:#269ac9;}
.resourcesBanner ul li:hover ul.resourcesType {display:block;}
ul li:hover ul {display:block;}
.resourcesSelected:hover ul {display:block;}
.resourcesUploadBox {float:right; width:103px; height:34px; background-color:#269ac9; line-height:34px; vertical-align:middle; text-align:center; margin-left:12px;}
.resourcesUploadBox:hover {background-color:#297fb8;}
.uploadIcon {background:url(images/resource_icon_list.png) -35px 10px no-repeat; float:left; display:block; width:30px; height:30px; margin-left:-3px;}
@ -313,10 +313,10 @@ a.uploadText {color:#ffffff; font-size:14px;}
/*.resourcesListType {width:150px; height:40px; line-height:40px; text-align:center;}*/
/*.resourcesListUploader {width:130px; height:40px; line-height:40px; text-align:center;}*/
/*.resourcesListTime {width:165px; height:40px; line-height:40px; text-align:center;}*/
.resourcesListName {width:180px; height:40px; line-height:40px; text-align:left;}
.resourcesListSize {width:105px; height:40px; line-height:40px; text-align:center;}
.resourcesListType {width:150px; height:40px; line-height:40px; text-align:center;}
.resourcesListUploader {width:160px; height:40px; line-height:40px; text-align:center;}
.resourcesListName {width:340px; height:40px; line-height:40px; text-align:left;}
.resourcesListSize {width:85px; height:40px; line-height:40px; text-align:center;}
.resourcesListType {width:85px; height:40px; line-height:40px; text-align:center;}
.resourcesListUploader {width:85px; height:40px; line-height:40px; text-align:center;}
.resourcesListTime {width:95px; height:40px; line-height:40px; text-align:center;}
/*.resourcesList {width:730px; height:39px; background-color:#ffffff; border-bottom:1px dashed #eaeaea; color:#9a9a9a; font-size:12px;}*/
a.resourcesBlack {font-size:12px; color:#4c4c4c;white-space: nowrap;text-align: left}
@ -410,9 +410,9 @@ a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat;
.searchResourcePopup {border:none; outline:none; background-color:#ffffff; width:184px; height:25px; padding-left:10px; display:inline-block; float:left;}
.searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(images/resource_icon_list.png) -40px -18px no-repeat; display:inline-block; float:left;}
.searchIconPopup:hover {cursor: pointer}
.courseSend {width:260px; height:15px; line-height:15px; margin-bottom:10px;}
.courseSend {width:390px; height:15px; line-height:15px; margin-bottom:10px;display:block;white-space:nowrap;}
.courseSendCheckbox {padding:0px; margin:0px; width:12px; height:12px; margin-right:10px; display:inline-block; margin-top:2px;}
.sendCourseName {font-size:12px; color:#5f6060;}
.sendCourseName {font-size:12px; color:#5f6060;display:inline-block}
.courseSendSubmit {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#269ac9; margin-right:25px; float:left;cursor: pointer;}
.courseSendSubmit:hover {background-color:#297fb8;}
.courseSendCancel {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#c1c1c1; float:left}
@ -460,13 +460,13 @@ a.homepageSearchIcon:hover {background:url(../images/nav_icon.png) -49px 3px no-
.newsActive {width:10px; height:10px; border-radius:50%; border:2px solid #ffffff; background-color:#ff0000; position:absolute; left:17px; top:5px;}
.navHomepageProfile {width:65px; display:block; float:right; margin-left:33px;}
.portraitRadius {border-radius: 3px;}
.homepageProfileMenuIcon {background:url(../images/nav_icon.png) 30px -155px no-repeat; width:65px; height:54px; position:relative; display:inline-block;}
.homepageProfileMenuIcon:hover {background:url(../images/nav_icon.png) 30px -122px no-repeat;}
.navHomepageProfile ul li ul {display:none;}
.navHomepageProfile ul li:hover ul {display:block;}
.homepageProfileMenuIcon {background:url(../images/nav_icon.png) 30px -155px no-repeat; width:65px; height:54px; position:relative; display:inline-block; line-height:0;}
.homepageProfileMenuIconhover {background:url(../images/nav_icon.png) 30px -122px no-repeat;}
/*.navHomepageProfile ul li ul {display:none;}
.navHomepageProfile ul li:hover ul {display:block;}*/
.homepageLeft {width:240px; float:left; margin-right:10px; margin-bottom:10px;}
.homepageRight {width:750px; float:left; margin-top:15px; margin-bottom:10px;}
.homepagePortraitContainer {width:208px; border:1px solid #dddddd; background-color:#ffffff; margin-top:15px; padding:15px;}
.homepageRight {width:750px; float:left; margin-top:10px; margin-bottom:10px;}
.homepagePortraitContainer {width:208px; border:1px solid #dddddd; background-color:#ffffff; margin-top:10px; padding:15px;}
.homepagePortraitImage {width:78px; height:78px; position:relative; border:1px solid #cbcbcb; padding: 2px;}
.homepagePortraitImage:hover {border:1px solid #269ac9;}
.homepageFollow {background:url(../images/homepage_icon.png) -10px -8px no-repeat; width:20px; height:20px; position:absolute; right:9px; top:9px;}
@ -499,12 +499,13 @@ a.coursesLineGrey:hover {color:#ffffff;}
.homepageLeftMenuMore {height:18px;}
.homepageLeftMenuMore:hover {background-color:#269ac9;}
.homepageLeftMenuMoreIcon {background:url(../images/homepage_icon.png) -74px -240px no-repeat; display:block; height:18px;}
.homepageMenuSetting {display:inline-block; background:url(../images/homepage_icon.png) -190px -365px no-repeat; width:15px; height:15px; margin-top: 16px; margin-right: 15px;}
.homepageMenuSetting:hover {background:url(../images/homepage_icon.png) -190px -407px no-repeat;}
.homepageMenuSetting {display:inline-block; background:url(../images/homepage_icon2.png) -190px -365px no-repeat; width:15px; height:15px; margin-top: 16px; margin-right: 15px;}
.homepageMenuSetting:hover {background:url(../images/homepage_icon2.png) -190px -407px no-repeat;}
a.homepageMenuText {color:#484848; font-size:16px; margin-left:20px;}
.homepageLeftLabelContainer {width:238px; border:1px solid #dddddd; background-color:#ffffff; margin-top:10px;}
.homepageLabelText {color:#484848; font-size:16px; margin-left:10px; margin-bottom:12px; display:block;}
.homepageRightBanner {width:718px; margin:0px auto; float:right; background-color: #ffffff; padding:10px 15px; border:1px solid #dddddd;}
.homepageRightBannerImg{width:1000px; margin:0px auto; height: 60px; margin-top: 10px; background:url(../images/TeachersDay.jpg)}
.NewsBannerName {font-size:16px; color:#4b4b4b; display:block; width:150px; float:left;}
.newsType {width:60px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:5px 10px; left:-40px; font-size:12px; color:#888888; display:none; line-height:2; z-index:9999;}
.newsReadSetting {width:700px; background-color:#f6f6f6; border-bottom:1px solid #eeeeee; margin:10px auto; height:39px; line-height:39px; vertical-align:middle; font-size:14px; color:#7a7a7a; padding-left:10px;}
@ -546,7 +547,7 @@ a.homepagePostTypeNotice {background:url(../images/homepage_icon.png) -87px -280
a.homepagePostTypeForum {background:url(../images/homepage_icon.png) -10px -310px no-repeat; padding-left:23px;}
a.homepagePostTypeQuiz {background:url(../images/homepage_icon.png) -90px -124px no-repeat; padding-left:23px;}
a.homepagePostTypeQuestion {background:url(../images/homepage_icon.png) -10px -273px no-repeat; padding-left:23px;}
a.homepagePostTypeAll {background:url(../images/homepage_icon.png) -10px -360px no-repeat; padding-left:23px;}
a.homepagePostTypeAll {background:url(../images/homepage_icon2.png) -10px -360px no-repeat; padding-left:23px;}
a.postTypeGrey {color:#888888;}
a.postTypeGrey:hover {color:#269ac9;}
.homepagePostBrief {width:710px; margin:0px auto; position:relative;}
@ -580,6 +581,7 @@ a.postReplyCancel:hover {color:#ffffff;}
.homepagePostReplyInput2 {width:588px; height:45px; max-width:588px; max-height:45px; border:1px solid #d9d9d9; outline:none; margin:0px auto 10px auto;}
.homepagePostReplyContainer {border-bottom:1px solid #e3e3e3; width:680px; margin:0px auto; margin-top:15px; min-height:60px;}
.homepagePostSetting {position:absolute; width:20px; height:20px; right:0px; top:0px;}
.homepagePostSetting ul li:hover ul {display:block;}
.homepagePostSettingIcon {background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px;}
.homepagePostSettiongText {width:85px; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-68px; top:20px; padding:5px 0px; display:none;}
.homepagePostSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;}
@ -860,6 +862,8 @@ a:hover.BlueCirBtn{ background:#269ac9; color:#fff;}
.w708{width: 708px;}
.w712{width:712px;max-width:712px;min-width: 712px;}
.w720{width:721px;}
.w709{width: 709px;}
.w701{width: 701px;}
a.AnnexBtn{ background: url(../images/homepage_icon2.png) 0px -343px no-repeat; width:70px; height:20px; display:block; padding-left:20px; color:#888888;}
a:hover.AnnexBtn{background: url(../images/homepage_icon2.png) -90px -343px no-repeat; color:#269ac9;}
a.FilesBtn{ background: url(../images/homepage_icon2.png) 0px -373px no-repeat; width:70px; height:20px; display:block; padding-left:20px; color:#888888;}
@ -869,17 +873,39 @@ a:hover.BlueCirBtnMini{ background:#269ac9; color:#fff;}
a.DropBtn{background: url(../images/homepage_icon2.png) -125px -339px no-repeat; width:85px; height:20px; display:block; color:#888888; font-size:14px;}
a:hover.DropBtn{background: url(../images/homepage_icon2.png) -125px -370px no-repeat;}
.DropLine{border-top:1px solid #d9d9d9; float:left; width:623px; height:10px; margin-top:10px;}
/*20150820课程作业 LB*/
.HomeWork {width:708px; background-color:#ffffff; padding:20px; border:1px solid #dddddd;}
.RightBanner {font-size:16px; width:733px; color:#4b4b4b; padding:10px 0 0 15px; margin-bottom:10px; background:#fff; border:1px solid #dddddd;height:34px;}
select.InputBox,input.InputBox,textarea.InputBox{ border:1px solid #d9d9d9; color:#888888; height:28px; line-height:28px; padding-left:5px; font-size:14px;}
a.BlueCirBtn{ display:block;width:75px; height:28px; background-color:#fff; line-height:28px; vertical-align:middle; text-align:center; border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
a:hover.BlueCirBtn{ background:#3598db; color:#fff;}
.W440{ width:440px;}
.W120{ width:110px;}
.W700{ width:700px;}
a.AnnexBtn{ background: url(../images/homepage_icon.png) 0px -343px no-repeat; width:70px; height:20px; display:block; padding-left:20px; color:#888888;}
a:hover.AnnexBtn{background: url(../images/homepage_icon.png) -90px -343px no-repeat; color:#3598db;}
a.FilesBtn{ background: url(../images/homepage_icon.png) 0px -373px no-repeat; width:70px; height:20px; display:block; padding-left:20px; color:#888888;}
a:hover.FilesBtn{background: url(../images/homepage_icon.png) -89px -372px no-repeat; color:#3598db;}
a.BlueCirBtnMini{ display:block;width:40px; height:22px; background-color:#ffffff; line-height:24px; vertical-align:middle; text-align:center; border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
a:hover.BlueCirBtnMini{ background:#3598db; color:#fff;}
a.ProBtn{background: url(../images/homepage_icon.png) -86px -396px no-repeat; width:35px; height:20px; display:block; padding-left:20px; color:#888888;}
a:hover.ProBtn{background: url(../images/homepage_icon.png) -86px -426px no-repeat; color:#3598db;}
a.DropBtn{background: url(../images/homepage_icon.png) -125px -339px no-repeat; width:85px; height:20px; display:block; color:#888888; font-size:14px;}
a:hover.DropBtn{background: url(../images/homepage_icon.png) -125px -370px no-repeat;}
.DropLine{border-top:1px solid #d9d9d9; float:left; width:623px; height:10px; margin-top:10px;}
/*20150820编程作业 LB*/
.W320{ width:320px; max-width: 320px; min-width: 320px;}
.icon_add{ background:url(images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:left; margin-right:5px;}
a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;}
.icon_remove{background:url(images/icons.png) 0px -338px no-repeat; width:16px; height:27px; display:block;float:left;}
a:hover.icon_remove{background:url(images/icons.png) -20px -338px no-repeat;}
.W320{ width:320px;}
.icon_add{ background:url(../images/course/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:left; margin-right:5px;}
a:hover.icon_add{background:url(../images/course/icons.png) -20px -310px no-repeat;}
.icon_remove{background:url(../images/course/icons.png) 0px -338px no-repeat; width:16px; height:27px; display:block;float:left;}
a:hover.icon_remove{background:url(../images/course/icons.png) -20px -338px no-repeat;}
/*20150820提交作业 LB*/
.HomeWorkBox{ background:#f6f6f6; padding:10px; margin:10px 0;}
.c_grey{ color:#888888;}
.c_dark_grey{color:#a9a9a9 !important;}
.HomeWorkP{ width:690px; font-size:14px;}
.HomeWorkP p{background-color: transparent !important;}
.HomeWorkP div{background-color: transparent !important;}
.H150{ height:150px;}
.ProResult{width:748px; background-color:#fff; border:1px solid #dddddd;border-bottom:none; }
.ProResultTop{ height:38px; line-height:38px; border-bottom:1px solid #dddddd; background:#f2f2f2; padding:0 10px;}
@ -899,6 +925,33 @@ a.FilesName02{ max-width:665px;overflow:hidden; white-space:nowrap; text-overflo
.ProResultUl li{ line-height:35px; border-bottom:1px solid #dddddd; }
.DateBorder{border:1px solid #d9d9d9; border-left:none; padding:7px 6px 6px 6px;}
a.UsersEditBtn{ display:block; width:55px; height:20px; border:1px solid #6d6d6d; color:#fff; background:#888888 url(../images/homepage_icon.png) -11px -35px no-repeat; padding-left:25px; line-height:1.9;-moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px;}
a:hover.UsersEditBtn{ color:#484848; background:#888888 url(../images/homepage_icon.png) -11px -74px no-repeat;}
a.UsersAttBtn{ display:block; width:55px; height:20px; border:1px solid #d3d3d3; color:#888888; background:#f2f3f3 url(../images/homepage_icon.png) -9px -6px no-repeat; padding-left:25px; line-height:1.9;-moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px;}
a:hover.UsersAttBtn{border:1px solid #888888; }
a.UsersApBtn{ display:block; width:55px; height:20px; border:1px solid #d3d3d3; color:#888888; background:#f2f3f3 url(../images/homepage_icon.png) -177px -6px no-repeat; padding-left:25px; line-height:1.9;-moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px;}
a:hover.UsersApBtn{border:1px solid #888888; }
/*20150906编程作业设置弹框 LB*/
.C_lgrey{ color:#a5a5a5;}
.C_Blue{ color:#3598db;}
a.C_Blue{ color:#3598db;}
a:hover.C_Blue{ color:#297fb8;}
.BluePopupBox{ border:3px solid #3598db; padding:20px; background:#fff; width:707px;}
/*.BluePopupBox:hover{ border:3px solid #297fb8; }*/
a.CloseBtn{background:url(../images/CloseBtn.png) 0px 0px no-repeat; width:13px; height:13px; display:block; float:right;}
a:hover.CloseBtn{background:url(../images/CloseBtn.png) 0px -24px no-repeat; }
.BluePopuph2{ font-size:16px; font-weight:bold; color:#3598db; }
.ProBoxResult{width:706px; background-color:#fff; border:1px solid #dddddd;border-bottom:none; max-height:300px; overflow:auto; }
.W108{ width:108px;}
.HomeWorkCon{ width:706px;}
/*20150906导入作业弹框 LB*/
.ImportBox{ width:708px; max-height:300px;overflow:auto;}
.ImportBox li{ margin-bottom:10px;}
.WorkTitle{ max-width:660px; font-size:14px; font-weight:bold; color:#484848;}
.W520{ width:680px;}
.ImportSearchIcon{background:url(../images/homepage_icon.png) 656px -393px no-repeat; }
.ImportSearchIcon:hover{background:url(../images/homepage_icon.png) 656px -419px no-repeat; }
/*日历选择图*/
img.ui-datepicker-trigger {
display:block;
@ -931,6 +984,8 @@ img.ui-datepicker-trigger {
margin-bottom: 3px;
}
.message_title{border: 1px solid #D4D4D4;padding: 0.6em;margin-left: 1.4em;margin-right: 0.4em;border-radius: 4px;font-family: "Microsoft YaHei";background-size: 100% 100%;margin-bottom: 5px;background-color: #E8E8E8;}
.message_title_red{border: 1px solid #D4D4D4;padding: 0.6em;margin-left: 1.4em;margin-right: 0.4em;border-radius: 4px;font-family: "Microsoft YaHei";background-size: 100% 100%;margin-bottom: 5px;background-color: #E8E8E8;color: red}
.description{display: none !important;}
.ispublic-label{display: none !important;}
.is_public_checkbox{display: none !important;}
@ -960,7 +1015,7 @@ blockquote {
}
/* 创建作品 work */
.Newwork{ width:668px; height:418px;}
.Newwork{ width:668px;}
.N_top{ float:right; margin-left:390px; }
.N_con{ color:#484747; font-weight:bold; width:660px; margin-top:10px; }
.N_con p{ }
@ -1006,3 +1061,56 @@ a:hover.tijiao{ background:#0f99a9;}
.about_project{ overflow:hidden;display:none;}
.project_r_h{ width:670px; height:40px; background:#eaeaea; margin-bottom:10px;}
.project_r_h02{ width:920px; height:40px; background:#eaeaea; margin-bottom:10px;}
/* colorbox
*******************************************************************************/
/*
Colorbox Core Style:
The following CSS is consistent between example themes and should not be altered.
*/
#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
#cboxWrapper {max-width:none;}
#cboxOverlay{position:fixed; width:100%; height:100%;}
#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
#cboxContent{position:relative;}
#cboxLoadedContent{overflow:auto; -webkit-overflow-scrolling: touch;}
#cboxTitle{margin:0;}
#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%; height:100%;}
#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
.cboxPhoto{float:left; margin:auto; border:0; display:block; max-width:none; -ms-interpolation-mode:bicubic;}
.cboxIframe{width:100%; height:100%; display:block; border:0; padding:0; margin:0;}
#colorbox, #cboxContent, #cboxLoadedContent{box-sizing:content-box; -moz-box-sizing:content-box; -webkit-box-sizing:content-box;}
/*
User Style:
Change the following styles to modify the appearance of Colorbox. They are
ordered & tabbed in a way that represents the nesting of the generated HTML.
*/
#cboxOverlay{background:#fff;}
#colorbox{outline:0;}
#cboxTopLeft{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat 0 0;}
#cboxTopCenter{height:25px; background:url(../images/colorbox/border1.png) repeat-x 0 -50px;}
#cboxTopRight{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat -25px 0;}
#cboxBottomLeft{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat 0 -25px;}
#cboxBottomCenter{height:25px; background:url(../images/colorbox/border1.png) repeat-x 0 -75px;}
#cboxBottomRight{width:25px; height:25px; background:url(../images/colorbox/border1.png) no-repeat -25px -25px;}
#cboxMiddleLeft{width:25px; background:url(../images/colorbox/border2.png) repeat-y 0 0;}
#cboxMiddleRight{width:25px; background:url(../images/colorbox/border2.png) repeat-y -25px 0;}
#cboxContent{background:#fff; overflow:hidden;}
.cboxIframe{background:#fff;}
#cboxError{padding:50px; border:1px solid #ccc;}
#cboxLoadedContent{margin-bottom:20px;}
#cboxTitle{position:absolute; bottom:0px; left:0; text-align:center; width:100%; color:#999;}
#cboxCurrent{position:absolute; bottom:0px; left:100px; color:#999;}
#cboxLoadingOverlay{background:#fff url(../images/colorbox/loading.gif) no-repeat 5px 5px;}
/* these elements are buttons, and may need to have additional styles reset to avoid unwanted base styles */
#cboxPrevious, #cboxNext, #cboxSlideshow, #cboxClose {border:0; padding:0; margin:0; overflow:visible; width:auto; background:none; }
/* avoid outlines on :active (mouseclick), but preserve outlines on :focus (tabbed navigating) */
#cboxPrevious:active, #cboxNext:active, #cboxSlideshow:active, #cboxClose:active {outline:0;}
#cboxSlideshow{position:absolute; bottom:0px; right:42px; color:#444;}
#cboxPrevious{position:absolute; bottom:0px; left:0; color:#444;}
#cboxNext{position:absolute; bottom:0px; left:63px; color:#444;}
#cboxClose{position:absolute; bottom:0; right:0; display:block; color:#444;}

View File

@ -0,0 +1,77 @@
/* Pretty printing styles. Used with prettify.js. */
/* SPAN elements with the classes below are added by prettyprint. */
.pln { color: #000 } /* plain text */
@media screen {
.str { color: #080 } /* string content */
.kwd { color: #008 } /* a keyword */
.com { color: #800 } /* a comment */
.typ { color: #606 } /* a type name */
.lit { color: #066 } /* a literal value */
/* punctuation, lisp open bracket, lisp close bracket */
.pun, .opn, .clo { color: #660 }
.tag { color: #008 } /* a markup tag name */
.atn { color: #606 } /* a markup attribute name */
.atv { color: #080 } /* a markup attribute value */
.dec, .var { color: #606 } /* a declaration; a variable name */
.fun { color: red } /* a function name */
}
/* Use higher contrast and text-weight for printable form. */
@media print, projection {
.str { color: #060 }
.kwd { color: #006; font-weight: bold }
.com { color: #600; font-style: italic }
.typ { color: #404; font-weight: bold }
.lit { color: #044 }
.pun, .opn, .clo { color: #440 }
.tag { color: #006; font-weight: bold }
.atn { color: #404 }
.atv { color: #060 }
}
/* Put a border around prettyprinted code snippets. */
pre.prettyprint { padding: 2px;
border-left:30px solid #ccc;
border-bottom: 1px solid #ccc;
border-right: 1px solid #ccc,
border-top: 1px solid #ccc }
pre li,ul,ol {
list-style-type: decimal;
}
/* Specify class=linenums on a pre to get line numbering */
ol.linenums { margin-top: 0; margin-bottom: 0;line-height: 3px } /* IE indents via margin-left */
li.L0,
li.L1,
li.L2,
li.L3,
li.L5,
li.L6,
li.L7,
li.L8 { list-style-type: decimal; }
/* Alternate shading for lines */
li.L1,
li.L3,
li.L5,
li.L7,
li.L9 { background: #eee }
.prettyprint *{font-family:'courier new',monospace;}
/*.prettyprint .com { color: #93a1a1; }*/
/*.prettyprint .lit { color: #AE81FF; }*/
/*.prettyprint .pun,*/
/*.prettyprint .opn,*/
/*.prettyprint .clo { color: #F8F8F2; }*/
/*.prettyprint .fun { color: #dc322f; }*/
/*.prettyprint .str,*/
/*.prettyprint .atv { color: #E6DB74; }*/
/*.prettyprint .kwd,*/
/*.prettyprint .tag { color: #F92659; }*/
/*.prettyprint .typ,*/
/*.prettyprint .atn,*/
/*.prettyprint .dec,*/
/*.prettyprint .var { color: #A6E22E; }*/
/*.prettyprint .pln { color: #66D9EF; }*/

View File

@ -482,7 +482,7 @@ img,embed{max-width: 100%;}
a.resourcesGrey {font-size:12px; color:#888888;}
a.resourcesGrey:hover {font-size:12px; color:#15bccf;}
.resourcesBanner ul li:hover ul.resourcesType {display:block;}
ul li:hover ul {display:block;}
.resourcesSelected:hover ul {display:block;}
.resourcesUploadBox {float:right; width:103px; height:34px; background-color:#64bdd9; line-height:34px; vertical-align:middle; text-align:center; margin-left:12px;}
.uploadIcon {background:url(../images/resource_icon_list.png) -35px 10px no-repeat; float:left; display:block; width:30px; height:30px; margin-left:-3px;}
a.uploadText {color:#ffffff; font-size:14px;}
@ -534,3 +534,7 @@ a.resourcesBlack:hover {font-size:12px; color:#000000;}
background-color: #64bdd9;
outline:none;
}
.AgreementBox{margin: 20px 0; color: #666666; font-size: 14px; line-height: 1.9;}
.AgreementTxt{text-indent: 2em; margin-bottom: 15px;}
.AgreementImg{margin: 0px auto; width: 820px;}

View File

@ -19,6 +19,7 @@ table{ background:#fff;}
.line{border-bottom:1px dashed #d4d4d4; padding-bottom:10px; margin-bottom:10px;}
.no_border{ border:none;background:none;}
.min_search{ width:150px; height:20px; border:1px solid #d0d0d0; color:#666; background:url(../images/public_icon.png) 135px -193px no-repeat; cursor:pointer;}
.none{display: none;}
/* font & color */
h2{ font-size:18px; color:#15bccf;}
@ -459,7 +460,7 @@ div.ke-statusbar{height:1px; border-top:none;}
a.resourcesGrey {font-size:12px; color:#888888;}
a.resourcesGrey:hover {font-size:12px; color:#15bccf;}
.resourcesBanner ul li:hover ul.resourcesType {display:block;}
ul li:hover ul {display:block;}
.resourcesSelected:hover ul {display:block;}
.resourcesUploadBox {float:right; width:103px; height:34px; background-color:#64bdd9; line-height:34px; vertical-align:middle; text-align:center; margin-left:12px;}
.resourcesUploadBox:hover {background-color:#0781b4;}
.uploadIcon {background:url(images/resource_icon_list.png) -35px 10px no-repeat; float:left; display:block; width:30px; height:30px; margin-left:-3px;}
@ -495,7 +496,7 @@ a.resourcesBlack:hover {font-size:12px; color:#000000;}
a.sendButtonBlue {color:#15bccf;}
a.sendButtonBlue:hover {color:#ffffff;}
.resourcesSelectSendButton:hover {background-color:#15bccf;}
.db {display:block;}
.db {display:block !important;}
.dropdown-menu {
position: absolute;
@ -572,7 +573,7 @@ a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat;
.searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(images/resource_icon_list.png) -40px -18px no-repeat; display:inline-block; float:left;}
.courseSend {width:260px; height:15px; line-height:15px; margin-bottom:10px;}
.courseSendCheckbox {padding:0px; margin:0px; width:12px; height:12px; margin-right:10px; display:inline-block; margin-top:2px;}
.sendCourseName {font-size:12px; color:#5f6060;}
.sendCourseName {font-size:12px; color:#5f6060;display:inline-block}
.courseSendSubmit {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#64bdd9; margin-right:25px; float:left;}
.courseSendCancel {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#c1c1c1; float:left}
a.sendSourceText {font-size:14px; color:#ffffff;}
@ -699,8 +700,8 @@ a.homepageSearchIcon:hover {background:url(../images/nav_icon.png) -49px 3px no-
.homepageNewsIcon {background:url(../images/nav_icon.png) -5px -85px no-repeat; width:30px; height:29px; display:block;}
.newsActive {width:10px; height:10px; border-radius:50%; border:2px solid #ffffff; background-color:#ff0000; position:absolute; left:17px; top:5px;}
.navHomepageProfile {width:65px; display:block; float:right; margin-top:8px; margin-left:33px;}
.homepageProfileMenuIcon {background:url(../images/nav_icon.png) -8px -175px no-repeat; width:20px; height:25px; float:left; margin-top:15px;}
a.homepageProfileMenuIcon:hover {background:url(../images/nav_icon.png) -8px -175px no-repeat; width:12px; height:12px; float:left;}
.homepageProfileMenuIcon {background:url(../images/nav_icon.png) -8px -175px no-repeat; width:20px; height:25px; float:left; margin-top:15px; line-height:0;}
a.homepageProfileMenuIconhover {background:url(../images/nav_icon.png) -8px -175px no-repeat; width:12px; height:12px; float:left;}
.homepageLeft {width:240px; float:left; margin-right:10px;}
.homepageRight {width:750px; float:left;}
.homepagePortraitContainer {width:238px; height:348px; border:1px solid #dddddd; background-color:#ffffff; margin-top:15px;}
@ -738,7 +739,7 @@ a.newsBlack {color:#4b4b4b; font-size:12px;}
a.newsBlack:hover {color:#0781b4;}
a.resourcesGrey {font-size:12px; color:#888888;}
a.resourcesGrey:hover {font-size:12px; color:#15bccf;}
.portraitRadius {border-radius: 3px;}
/***** Flash & error messages ****/
#errorExplanation, div.flash, .nodata, .warning, .conflict {