Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop

This commit is contained in:
Linda 2017-06-18 17:28:54 +08:00
commit 8f0928c93d
329 changed files with 14878 additions and 1481 deletions

View File

@ -28,25 +28,25 @@
<data-source source="LOCAL" name="Rails bigdata: production" uuid="a2967bb5-941b-447d-ba0e-5e62ade5fb7d">
<driver-ref>mysql</driver-ref>
<jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://127.0.0.1/trustie2</jdbc-url>
<jdbc-url>jdbc:mysql://127.0.0.1/0604new</jdbc-url>
<user-name>root</user-name>
<user-password>df9bdf98df99df9edf9fdf9c</user-password>
<user-password>df9bdf98df99df9e</user-password>
<libraries />
</data-source>
<data-source source="LOCAL" name="Rails bigdata: development" uuid="ea7cc5a3-1ef5-4a23-93bb-2c9650c10d07">
<driver-ref>mysql</driver-ref>
<jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://127.0.0.1/trustie2</jdbc-url>
<jdbc-url>jdbc:mysql://127.0.0.1/20161227data</jdbc-url>
<user-name>root</user-name>
<user-password>df9bdf98df99df9edf9fdf9c</user-password>
<user-password>df9bdf98df99df9e</user-password>
<libraries />
</data-source>
<data-source source="LOCAL" name="Rails bigdata: test" uuid="9f93a163-6133-42ac-a16d-9bd67f458fd6">
<driver-ref>mysql</driver-ref>
<jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://127.0.0.1/trustie2</jdbc-url>
<jdbc-url>jdbc:mysql://127.0.0.1/0623newblank</jdbc-url>
<user-name>root</user-name>
<user-password>df9bdf98df99df9edf9fdf9c</user-password>
<user-password>df9bdf98df99df9e</user-password>
<libraries />
</data-source>
</component>

View File

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

View File

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

View File

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

View File

@ -0,0 +1,3 @@
// Place all the styles related to the HomeworkBank controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@ -0,0 +1,3 @@
// Place all the styles related to the management controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@ -0,0 +1,3 @@
// Place all the styles related to the managements controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@ -452,6 +452,16 @@ class AccountController < ApplicationController
render :layout => 'base_edu_account'
end
def apply_trail
apply_action = ApplyAction.where(:user_id => User.current.id, :container_type => "TrialAuthorization").first
if apply_action.blank?
ApplyAction.create(:user_id => User.current.id, :status => 0, :container_type => "TrialAuthorization")
end
respond_to do |format|
format.js
end
end
def user_auth
@user = User.current
diskfile1 = disk_auth_filename('UserAuthentication', @user.id, 'ID')

View File

@ -45,8 +45,8 @@ class ApplicationController < ActionController::Base
before_filter :find_first_page
before_filter :find_web_footer
before_filter :session_expiration, :user_setup, :check_if_login_required, :set_localization, :check_authentication
before_filter :user_agent
before_filter :session_expiration, :user_setup, :check_if_login_required, :set_localization
before_filter :user_agent
rescue_from ActionController::InvalidAuthenticityToken, :with => :invalid_authenticity_token
rescue_from ::Unauthorized, :with => :deny_access
@ -61,20 +61,18 @@ class ApplicationController < ActionController::Base
end
# 判断用户是否认证
def check_authentication
return true
=begin
uthentication = AuthenticationsUsers.where(:user_id => User.current.id).first
user_account = User.current.user_extensions.try(:occupation)
if uthentication.blank? || user_account.blank?
redirect_to my_account_path
return
elsif User.current.authentications == 0
redirect_to authentication_account_path
return
end
=end
end
# def check_authentication
# # return true
# if params[:action] == "on_search" || params[:action] == "apply_trail" # 之所以这样处理是为了避开account页面ajax加载
# return true
# end
# authentication = ApplyAction.where(:user_id => User.current.id, :status => 1).first
# user_identity = User.current.try(:user_extensions).try(:identity)
# if user_identity.blank? || authentication.blank?
# redirect_to my_account_path
# return
# end
# end
def session_expiration
if session[:user_id]

View File

@ -14,6 +14,7 @@ class CoursesController < ApplicationController
before_filter :auth_login1, :only => [:show, :course_activity, :feedback]
skip_before_filter :verify_authenticity_token, :only => [:update_position]
before_filter :check_authentication, :except => [:update_position]
menu_item :overview
menu_item :feedback, :only => :feedback
menu_item :homework, :only => :homework
@ -851,17 +852,7 @@ class CoursesController < ApplicationController
@teacher_count = @teachers.count
@student_count = studentCount(@course)
@no_group_count = @course.members.where(:course_group_id => 0).select{|m| m.roles.to_s.include?("Student")}.count
@roles = Role.givable.all[3..5]
@members = @course.member_principals.includes(:roles, :principal).all.sort
course_org_ids = OrgCourse.find_by_sql("select distinct organization_id from org_courses where course_id = #{@course.id}").map(&:organization_id)
if course_org_ids.empty?
@orgs_not_in_course = User.current.organizations
else
course_org_ids = "(" + course_org_ids.join(',') + ")"
@orgs_not_in_course = User.current.organizations.where("organizations.id not in #{course_org_ids}")
end
@apply_users = CourseMessage.where(:course_id => @course.id,:course_message_type => 'JoinCourseRequest', :status => 0)
course_module = @course.course_modules
if course_module.blank?

View File

@ -8,6 +8,7 @@ class ForumsController < ApplicationController
before_filter :authenticate_user_edit, :only => [:edit, :update]
before_filter :authenticate_user_destroy, :only => [:destroy]
before_filter :require_login, :only => [:new, :create,:destroy,:update,:edit]
before_filter :check_authentication
helper :sort
include SortHelper

View File

@ -81,7 +81,7 @@ class GamesController < ApplicationController
@had_passed_testsests_error_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == false}.count
@had_passed_testsests_hidden_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == true && had_test.is_public == false}.count
@had_passed_testsests_public_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == true && had_test.is_public == true}.count
@final_score = (@game.answer_open == 1 ? 0 : @game.final_score.to_i)
@final_score = (@game.answer_open? ? 0 : @game.final_score.to_i)
@had_done = ((@myshixun.games.where(:status => 2).count == @myshixun.games.count && @game_challenge.position == @myshixun.games.count) ? 1 : 0)
error_position = had_test.blank? ? nil : had_test.select{|had_test| had_test.result == false}.last
logger.info("latest output id is #{error_position.id unless error_position.blank?}")
@ -225,7 +225,7 @@ class GamesController < ApplicationController
@had_passed_testsests_error_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == false}.count
@had_passed_testsests_hidden_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == true && had_test.is_public == false}.count
@had_passed_testsests_public_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == true && had_test.is_public == true}.count
@final_score = (@game.answer_open == 1 ? 0 : @game.final_score.to_i)
@final_score = (@game.answer_open? ? 0 : @game.final_score.to_i)
error_position = had_test.blank? ? nil : had_test.select{|had_test| had_test.result == false}.last
@latest_output = error_position.try(:out_put).gsub(/\n/, '<br />').gsub(/\t/, '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;') unless error_position.try(:out_put).blank?
render :json => {test_sets: total_test_sets,
@ -253,6 +253,27 @@ class GamesController < ApplicationController
render :json => {status: @game.status, output: "服务器网络异常", results: outputs, had_done: 0}
end
# 获取等待的任务数
# 如果没有等待任务页面上将不显示
# msg -1 不存在等待的任务
# 如果该方法异常则直接返回0跳过等待
def waiting_info
begin
jenkins_shixuns = Redmine::Configuration['jenkins_shixuns']
params = {:buildID => "#{@game.id}"}
uri = URI("#{jenkins_shixuns}/jenkins-exec/api/getWaitingTime")
res = uri_exec uri, params
if (res && res['code'] != 0)
raise("获取等待任务数异常")
end
task_count = res['msg'].to_i
task_count > 0 ? task_count : 0
render :json => {task_count: task_count}
rescue
render :json => {task_count: 0}
end
end
# 自动推送下一个任务
def next_step
render_403 if @game.status != 2

View File

@ -0,0 +1,233 @@
class HomeworkBankController < ApplicationController
before_filter :require_login, :only => [:index, :show, :new, :create, :edit, :update, :destroy, :destroy_all, :choose_user_course, :send_h_bank_to_course]
before_filter :find_homework_bank, :only => [:show, :edit, :update, :destroy]
def index
@order,@b_sort = params[:order] || "updated_at",params[:sort] || "desc"
@user = User.current
@r_sort = @b_sort == "desc" ? "asc" : "desc"
@search = params[:search]
if(params[:type].blank? || params[:type] == "1") #我的题库
@homeworks = @user.homework_banks.where("name like ?", "%#{@search}%")
elsif params[:type] == "2" #公共题库
@homeworks = HomeworkBank.where(:is_public => true).where("name like ?", "%#{@search}%")
end
if params[:property]
@property = params[:property].to_i
@homeworks = @homeworks.where(:homework_type => params[:property].to_i)
end
@homeworks = @homeworks.reorder("#{@order} #{@b_sort}")
@type = params[:type] ? params[:type] : '1'
@limit = 15
@is_remote = true
@hw_count = @homeworks.count
@hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1
@offset ||= @hw_pages.offset
@homeworks = paginateHelper @homeworks,15
respond_to do |format|
format.js
format.html {render :layout => 'base_edu'}
end
end
def show
@is_admin = User.current == @homework.user || User.current.admin?
respond_to do |format|
format.html {render :layout => 'base_edu'}
end
end
def new
@homework_type = params[:homework_type].to_i
@homework = HomeworkBank.new
respond_to do |format|
format.html{render :layout => 'base_edu'}
end
end
# 新建实训作业
def shixuns
search = params[:search]
@homework = HomeworkBank.new
@shixuns = Shixun.where(:authentication => 1).where("name like ?", "%#{search}%")
@shixuns_count = @shixuns.count
@limit = 10
@is_remote = true
@shixun_pages = Paginator.new @shixuns_count, @limit, params['page'] || 1
@offset ||= @shixun_pages.offset
@shixuns = paginateHelper @shixuns, @limit
respond_to do |format|
format.js
end
end
def create
if params[:homework_bank] || params[:shixun_homework]
homework = HomeworkBank.new
if params[:shixun_homework]
shixun = Shixun.find(params[:shixun_homework])
homework.name = shixun.name
homework.description = shixun.description
else
homework.name = params[:homework_bank][:name]
homework.description = params[:homework_bank][:description]
homework.reference_answer = params[:homework_bank][:reference_answer]
homework.save_attachments(params[:attachments])
render_attachment_warning_if_needed(homework)
end
homework.is_public = 0
homework.quotes = 0
homework.homework_type = params[:shixun_homework] ? 4 : (params[:homework_type].to_i || 1)
homework.user_id = User.current.id
homework.syllabus_id = params[:syllabus_id] if params[:syllabus_id] && params[:syllabus_id] != '0'
#编程作业相关属性
if homework.homework_type == 2
homework.language = params[:language_type].to_i
sample_inputs = params[:sample][:input]
if Array === sample_inputs
sample_inputs.each_with_index do |val, i|
homework.homework_bank_samples << HomeworkBankSample.new(
input: val,
output: params[:sample][:output][i]
)
end
end
inputs = params[:program][:input]
if Array === inputs
inputs.each_with_index do |val, i|
homework.homework_bank_tests << HomeworkBankTest.new(
input: val,
output: params[:program][:output][i]
)
end
end
end
#分组作业
if homework.homework_type == 3
homework.min_num = params[:min_num].to_i
homework.max_num = params[:max_num].to_i
end
if homework.save
if homework.homework_type == 4
HomeworkBankShixun.create(:homework_bank_id => homework.id, :shixun_id => shixun.id)
end
redirect_to homework_bank_path(homework)
end
end
end
def edit
@homework_type = @homework.homework_type
respond_to do |format|
format.html{render :layout => 'base_edu'}
end
end
def update
if params[:homework_bank]
@homework.name = params[:homework_bank][:name]
@homework.description = params[:homework_bank][:description]
@homework.reference_answer = params[:homework_bank][:reference_answer]
@homework.syllabus_id = params[:syllabus_id] ? (params[:syllabus_id] == '0' ? nil : params[:syllabus_id].to_i) : nil
@homework.save_attachments(params[:attachments])
render_attachment_warning_if_needed(@homework)
#编程作业相关属性
if @homework.homework_type == 2
@homework.language = params[:language_type].to_i if params[:language_type]
@homework.homework_bank_samples.delete_all if params[:sample]
sample_inputs = params[:sample][:input] if params[:sample]
if Array === sample_inputs
sample_inputs.each_with_index do |val, i|
@homework.homework_bank_samples << HomeworkBankSample.new(
input: val,
output: params[:sample][:output][i]
)
end
end
@homework.homework_bank_tests.delete_all if params[:program]
inputs = params[:program][:input] if params[:program]
if Array === inputs
inputs.each_with_index do |val, i|
@homework.homework_bank_tests << HomeworkBankTest.new(
input: val,
output: params[:program][:output][i]
)
end
end
end
#分组作业
if @homework.homework_type == 3
@homework.min_num = params[:min_num].to_i if params[:min_num]
@homework.max_num = params[:max_num].to_i if params[:max_num]
end
if @homework.save
redirect_to homework_bank_path(@homework)
end
end
end
def destroy
@homework.homework_commons.update_all(:homework_bank_id => nil)
@homework.destroy
redirect_to homework_bank_index_path()
end
def destroy_all
if params[:check_homework_bank] && !params[:check_homework_bank].blank?
params[:check_homework_bank].each do |hb_id|
homework = HomeworkBank.find hb_id
if homework && homework.user == User.current
HomeworkCommon.where(:homework_bank_id => homework.id).update_all(:homework_bank_id => nil)
homework.destroy
end
end
end
redirect_to homework_bank_index_path
end
def choose_user_course
if !params[:search].nil?
search = "%#{params[:search].to_s.strip.downcase}%"
@courses = User.current.courses.where("is_delete = 0 and is_end = 0 and (#{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p)",:p=>search).select{ |course| User.current.has_teacher_role(course)}
else
@courses = User.current.courses.where("is_delete = 0 and is_end = 0").select{ |course| User.current.has_teacher_role(course)}
end
@homework_ids = params[:check_homework_bank] if params[:check_homework_bank]
@search = params[:search]
respond_to do |format|
format.js
end
end
def send_h_bank_to_course
course = Course.find params[:course_id]
if course
params[:homework_id].each do |homework_id|
homework = HomeworkBank.find homework_id
quote_homework_bank homework, course
end
end
end
def set_public
@homework.update_attributes(:is_public => true)
redirect_to homework_bank_index_path()
end
private
def find_homework_bank
@homework = HomeworkBank.find params[:id]
rescue ActiveRecord::RecordNotFound
render_404
end
end

View File

@ -41,18 +41,12 @@ class HomeworkCommonController < ApplicationController
case @order
when '1'
@homework_commons = @homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status = #{@order} and end_time > '#{Time.now}'").order("homework_commons.created_at desc")
when '2'
@homework_commons = @homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status = #{@order} and late_time > '#{Time.now}'").order("homework_commons.created_at desc")
when '3'
@homework_commons = @homework_commons.includes(:homework_detail_manual).where("(homework_detail_manuals.comment_status = #{@order} and homework_detail_manuals.evaluation_end > '#{Time.now}')
or (homework_detail_manuals.comment_status = 1 and end_time < '#{Time.now}' and allow_late = 0 and anonymous_comment = 0 and homework_detail_manuals.evaluation_start >= '#{Time.now}')
or (homework_detail_manuals.comment_status = 2 and late_time < '#{Time.now}' and anonymous_comment = 0 and homework_detail_manuals.evaluation_start >= '#{Time.now}')").order("homework_commons.created_at desc")
@homework_commons = @homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status = #{@order} and homework_detail_manuals.evaluation_end > '#{Time.now}'").order("homework_commons.created_at desc")
when '4'
@homework_commons = @homework_commons.includes(:homework_detail_manual).where("(homework_detail_manuals.comment_status = #{@order} and homework_detail_manuals.appeal_time > '#{Time.now}')").order("homework_commons.created_at desc")
when '5'
@homework_commons = @homework_commons.includes(:homework_detail_manual).where("(homework_detail_manuals.comment_status = #{@order} and archive_time > '#{Time.now}')
or (homework_detail_manuals.comment_status = 1 and end_time < '#{Time.now}' and (anonymous_comment = 1 or (anonymous_comment = 0 and homework_detail_manuals.evaluation_start < '#{Time.now}')) and archive_time >= '#{Time.now}')
or (homework_detail_manuals.comment_status = 2 and late_time < '#{Time.now}' and (anonymous_comment = 1 or (anonymous_comment = 0 and homework_detail_manuals.evaluation_start < '#{Time.now}')) and archive_time >= '#{Time.now}')").order("homework_commons.created_at desc")
@homework_commons = @homework_commons.includes(:homework_detail_manual).where("(homework_detail_manuals.comment_status = #{@order} and archive_time > '#{Time.now}')").order("homework_commons.created_at desc")
else
@homework_commons = @homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status = #{@order}").order("homework_commons.created_at desc")
end
@ -60,7 +54,7 @@ class HomeworkCommonController < ApplicationController
@is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher))
@is_new = params[:is_new]
@homeworks = paginateHelper @homework_commons,10
@homeworks = paginateHelper @homework_commons,15
#设置at已读
ids = @homeworks.inject([]) do |ids, homework|
jids = homework.journals_for_messages.map(&:id)
@ -184,6 +178,8 @@ class HomeworkCommonController < ApplicationController
if homework.homework_type != 4 && homework_detail_manual.comment_status == 1
create_works_list homework
elsif homework.homework_type == 4
HomeworkCommonsShixuns.create(:homework_common_id => homework.id, :shixun_id => shixun.id)
end
if params[:quotes] && !params[:quotes].blank?
@ -214,7 +210,7 @@ class HomeworkCommonController < ApplicationController
def publish_setting
@homework.publish_time = params[:homework_publish_time] if params[:homework_publish_time]
@homework.end_time = params[:homework_end_time] if params[:homework_end_time]
@homework.archive_time = params[:homework_archive_time] if params[:homework_end_time]
@homework.archive_time = params[:homework_archive_time] if params[:homework_archive_time]
@homework.save
@is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
respond_to do |format|
@ -225,11 +221,11 @@ class HomeworkCommonController < ApplicationController
def late_setting
if params[:homework_allow_late] == '1'
@homework.allow_late = true
@homework.late_time = params[:homework_late_time]
#@homework.late_time = params[:homework_late_time]
@homework.late_penalty = params[:homework_late_penalty].to_i
else
@homework.allow_late = false
@homework.late_time = nil
#@homework.late_time = nil
@homework.late_penalty = 0
end
@homework.save
@ -238,32 +234,62 @@ class HomeworkCommonController < ApplicationController
def anon_setting
anonymous_comment = @homework.anonymous_comment
if params[:homework_anonymous_comment]
@homework.anonymous_comment = 0
@homework_detail_manual.evaluation_start = params[:homework_evaluation_start]
@homework_detail_manual.evaluation_end = params[:homework_evaluation_end]
@homework_detail_manual.evaluation_num = params[:homework_evaluation_num]
@homework_detail_manual.absence_penalty = params[:homework_absence_penalty]
absence_penalty = @homework_detail_manual.absence_penalty
appeal_penalty = @homework_detail_manual.appeal_penalty
if @homework_detail_manual.comment_status < 3
if params[:homework_anonymous_comment]
@homework.anonymous_comment = 0
@homework_detail_manual.evaluation_start = params[:homework_evaluation_start] if params[:homework_evaluation_start]
@homework_detail_manual.evaluation_end = params[:homework_evaluation_end] if params[:homework_evaluation_end]
@homework_detail_manual.evaluation_num = params[:homework_evaluation_num] if params[:homework_evaluation_num]
@homework_detail_manual.absence_penalty = params[:homework_absence_penalty] if params[:homework_absence_penalty]
else
@homework.anonymous_comment = 1
@homework_detail_manual.evaluation_start = nil
@homework_detail_manual.evaluation_end = nil
@homework_detail_manual.evaluation_num = 0
@homework_detail_manual.absence_penalty = 0
end
else
@homework.anonymous_comment = 1
@homework_detail_manual.evaluation_start = nil
@homework_detail_manual.evaluation_end = nil
@homework_detail_manual.evaluation_num = 0
@homework_detail_manual.absence_penalty = 0
@homework_detail_manual.evaluation_end = params[:homework_evaluation_end] if params[:homework_evaluation_end]
@homework_detail_manual.evaluation_num = params[:homework_evaluation_num] if params[:homework_evaluation_num]
@homework_detail_manual.absence_penalty = params[:homework_absence_penalty] if params[:homework_absence_penalty]
end
if anonymous_comment != @homework.anonymous_comment
@homework_detail_manual.te_proportion = 1
@homework_detail_manual.ta_proportion = 0
@homework_detail_program.te_proportion = 0 if @homework_detail_program
@homework_detail_programing.ta_proportion = 0 if @homework_detail_programing
end
if params[:homework_anonymous_appeal]
@homework.anonymous_appeal = 1
@homework_detail_manual.appeal_time = params[:homework_appeal_time]
@homework_detail_manual.appeal_penalty = params[:homework_appeal_penalty]
if @homework_detail_manual.comment_status < 4
if params[:homework_anonymous_appeal]
@homework.anonymous_appeal = 1
@homework_detail_manual.appeal_time = params[:homework_appeal_time] if params[:homework_appeal_time]
@homework_detail_manual.appeal_penalty = params[:homework_appeal_penalty] if params[:homework_appeal_penalty]
else
@homework.anonymous_appeal = 0
@homework_detail_manual.appeal_time = nil
@homework_detail_manual.appeal_penalty = 0
end
else
@homework.anonymous_appeal = 0
@homework_detail_manual.appeal_time = nil
@homework_detail_manual.appeal_penalty = 0
@homework_detail_manual.appeal_time = params[:homework_appeal_time] if params[:homework_appeal_time]
@homework_detail_manual.appeal_penalty = params[:homework_appeal_penalty] if params[:homework_appeal_penalty]
end
if absence_penalty != @homework_detail_manual.absence_penalty && @homework_detail_manual.comment_status >= 4
all_dis_eva = StudentWorksEvaluationDistribution.where(:student_work_id => @homework.student_works.map(&:id))
has_sw_count = all_dis_eva.select("distinct user_id").count
anon_count = all_dis_eva.count / has_sw_count
@homework.student_works.where("work_status != 0").each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where(:student_work_id => @homework.student_works.map(&:id)).count - student_work.user.student_works_scores.where(:student_work_id => @homework.student_works.map(&:id), :reviewer_role => 3).count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
student_work.save
end
end
if appeal_penalty != @homework_detail_manual.appeal_penalty && @homework_detail_manual.comment_status >= 4
@homework.student_works.each do |student_work|
appeal_penalty_count = student_work.user.student_works_scores.where(:student_work_id => @homework.student_works.map(&:id), :appeal_status => 3).count
student_work.appeal_penalty = appeal_penalty_count > 0 ? appeal_penalty_count * @homework_detail_manual.absence_penalty : 0
student_work.save
end
end
@homework.save
@homework_detail_manual.save
@ -356,7 +382,7 @@ class HomeworkCommonController < ApplicationController
def update
if params[:homework_common]
is_update = @homework.name != params[:homework_common][:name] || @homework.description != params[:homework_common][:description]
is_update = @homework.name != params[:homework_common][:name] || @homework.description != params[:homework_common][:description] || @homework.reference_answer != params[:homework_common][:reference_answer]
if params[:homework_type].to_i == 2
is_update = is_update || params[:language_type] != @homework.homework_detail_programing.language
if !is_update && params[:sample] && params[:program]
@ -478,24 +504,25 @@ class HomeworkCommonController < ApplicationController
end
homework_bank = add_to_homework_bank_f @homework
homework_bank.save
if @homework.homework_type == 4
HomeworkBankShixun.create(:homework_bank_id => homework_bank.id, :shixun_id => @homework.homework_commons_shixuns.shixun_id)
end
@homework.update_attributes(:homework_bank_id => homework_bank.id)
elsif params[:type].to_i == 2
homework_bank = HomeworkBank.where(:id => @homework.homework_bank_id).first
if homework_bank
homework_bank.update_attributes(:name => @homework.name, :description => @homework.description, :homework_type => @homework.homework_type)
homework_bank.update_attributes(:name => @homework.name, :description => @homework.description, :homework_type => @homework.homework_type, :reference_answer => @homework.reference_answer)
if @homework.homework_type == 2 && @homework.homework_detail_programing
homework_bank.update_attributes(:language => @homework.homework_detail_programing.language)
homework_bank.homework_bank_tests.destroy_all
@homework.homework_tests.each_with_index do |homework_test|
homework_bank.homework_bank_tests << HomeworkBankTest.new(
test_type: 1,
input: homework_test.input,
output: homework_test.output
)
end
@homework.homework_samples.each_with_index do |homework_test|
homework_bank.homework_bank_tests << HomeworkBankTest.new(
test_type: 0,
homework_bank.homework_bank_samples << HomeworkBankSample.new(
input: homework_test.input,
output: homework_test.output
)

View File

@ -0,0 +1,112 @@
class ManagementsController < ApplicationController
before_filter :require_admin
layout 'base_management'
include ManagementsHelper
include SortHelper
include UsersHelper
def users
@menu_type = 6
sort_init 'login', 'asc'
sort_update %w(login firstname lastname mail admin created_on last_login_on)
case params[:format]
when 'xml', 'json'
@offset, @limit = api_offset_and_limit({:limit => 50})
else
@limit = 50 #per_page_option
end
@status = params[:status] || 1
scope = User.logged.status(@status)
scope = User.like(params[:name]) if params[:name].present?
scope = scope.in_group(params[:group_id]) if params[:group_id].present?
@user_count = scope.count
@user_pages = Paginator.new @user_count, @limit, params['page']
@offset ||= @user_pages.offset
@users = scope.order(sort_clause).limit(@limit).offset(@offset).all
respond_to do |format|
format.html {
@groups = Group.all.sort
}
format.api
end
end
def users_trial
@menu_type = 6
@authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => 0).includes(:user)
end
def trial_authorization
@menu_type = 9
search = params[:search]
@status = trial_authorization_status(params[:status])
# @status = (params[:status].blank? || params[:status] == "0") ? 0 : [1,2]
if search.blank?
@authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => @status).includes(:user)
else
user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'")
@authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => @status, :user_id => user_id).includes(:user)
end
end
# params[:type] 1拒绝 0同意
# authentication 会有一个初始值,不同的值代表不同的权限
# REDO: 后面权限改了后,一并要改
def trial_authorization_operation
apply_action = ApplyAction.find(params[:apply_id])
type = params[:type]
search = params[:search]
if type == "0"
authentication_user = AuthenticationsUsers.where(:user_id => apply_action.user_id).first
if authentication_user.blank?
AuthenticationsUsers.create(:user_id => apply_action.user_id, :authentication_id => 1)
end
end
apply_action.update_attributes(:status => (params[:type] == "1" ? 2 : 1), :reason => params[:reject_reason], :dealer_id => User.current.id)
user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{search}%'")
@authorizations = ApplyAction.where(:container_type => "TrialAuthorization", :status => 0, :user_id => user_id).includes(:user)
respond_to do |format|
format.js
end
end
def index
end
# copy from admin
def identity_authentication
@menu_type = 9
type = params[:type] || 0 # 存在type 就用type 没有就为 0
user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{params[:name]}%'")
@unapproved_user = ApplyUserAuthentication.where(:status => type, :user_id => user_id).order("updated_at desc")
respond_to do |format|
format.html
format.js
end
end
# 拒绝身份认证
# copy from admin
def reject_authentication
apply_user = ApplyUserAuthentication.find(params[:apply_id])
reason = apply_user.update_attributes(:status => 2, :remarks => params[:reject_reason])
render :json => {success: reason}
end
# 统一身份认证
# copy from admin
def agree_authentication
apply_user = ApplyUserAuthentication.find(params[:apply_id])
user = User.find(apply_user.user_id)
apply_user.update_attribute(:status, 1)
user.update_attribute(:authentication, true)
@unapproved_user = ApplyUserAuthentication.where(:status => 0).order("updated_at desc")
respond_to do |format|
format.js
end
end
end

View File

@ -147,21 +147,35 @@ class MyController < ApplicationController
end
@user = User.current
# 基本资料不完善 @force为false 完善 @force为true
@force = false
if params[:tip]
@force = true
# 认证
ue = @user.user_extensions
@trail_authentication = ApplyAction.where(:user_id => User.current.id).first
@authentication = @user.authentication
if ue.identity.nil?
@require_auth = true
else
user = UserExtensions.where(:user_id => User.current.id).first
if user.gender.nil? || user.school_id.nil? || User.current.lastname.nil?
@force = true
elsif user.identity == 3 && user.school_id.nil?
@force = true
if @trail_authentication.blank?
@require_trail_auth = true
end
end
# 用户认证
@auth = @user.authentication ? false : true
# @require_auth = true
#
# # 基本资料不完善 @force为false 完善 @force为true
# @force = false
# # @authentication = @user.authentication
# @trail_authentication = AuthenticationsUsers.where(:user_id => User.current.id).first
# if params[:tip]
# @force = true
# else
# user = UserExtensions.where(:user_id => User.current.id).first
# if user.identity.nil? || user.school_id.nil? || User.current.lastname.nil?
# @force = false
# else
# @force = @trail_authentication.blank? ? false : true
# end
# end
# # 用户认证
# @auth = @user.authentication ? false : true
@s_message = AppliedMessage.where(:status => 3, :user_id => User.current.id, :viewed => 0, :applied_type => 'ApplyAddSchools').first
@d_message = AppliedMessage.where(:status => 3, :user_id => User.current.id, :viewed => 0, :applied_type => 'ApplyAddDepartment').first
@ -217,6 +231,7 @@ class MyController < ApplicationController
@se.brief_introduction = params[:brief_introduction]
if @user.save && @se.save
reward_grade(@user, @user.id, 'Account', 500)
# 修改邮箱的时候同步修改到gitlab
# if changed_mail || changed_login

View File

@ -3,6 +3,7 @@ class MyshixunsController < ApplicationController
layout 'base_myshixun'
skip_before_filter :verify_authenticity_token, :only => [:training_task_status]
before_filter :require_login, :except => [:training_task_status]
before_filter :check_authentication, :except => [:training_task_status]
before_filter :find_myshixun, :only => [:show, :myshixun_reset]
include ApplicationHelper
@ -77,7 +78,10 @@ class MyshixunsController < ApplicationController
if !resubmit.blank?
game.update_attributes(:retry_status => 2, :resubmit_identifier => resubmit)
else
game.update_attributes(:status => 2, :final_score => challenge.score, :end_time => Time.now)
game.update_attributes(:status => 2, :end_time => Time.now)
unless game.answer_open? # 如果没有查看答案,则获得该关卡得分
game.update_attribute(:final_score, challenge.score)
end
end
else
if !resubmit.blank?

View File

@ -929,10 +929,10 @@ class ProjectsController < ApplicationController
end
end
def uri_exec uri, params
res = Net::HTTP.post_form(uri, params).body
res = JSON.parse(res)
end
# def uri_exec uri, params
# # res = Net::HTTP.post_form(uri, params).body
# # res = JSON.parse(res)
# end
# 开启实训项目,学生会fork一个项目并自动发送任务
def training_project_extend

View File

@ -3,6 +3,7 @@
class ShixunsController < ApplicationController
layout 'base_shixun'
before_filter :require_login
before_filter :check_authentication
before_filter :find_shixun, :except => [ :index, :new, :create, :index, :search ]
before_filter :shixun_view_allow, :only => [:show]
before_filter :require_manager, :only => [ :settings, :add_script, :publish, :collaborators_delete, :shixun_members_added, :add_collaborators]

View File

@ -363,12 +363,13 @@ class StudentWorkController < ApplicationController
@homework_commons = @course.homework_commons.where("publish_time <= ?",Time.now).order("created_at desc")
@all_homework_commons = @course.homework_commons.order("created_at desc")
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
@is_evaluation = @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status == 3 && !@is_teacher #是不是匿评
@is_evaluation = @homework.homework_detail_manual && (@homework.homework_detail_manual.comment_status == 3 || @homework.homework_detail_manual.comment_status == 4) && !@is_teacher #是不是匿评
@show_all = false
# 0表示没有分组的学生-1表示所有分组的学生
if @group
group_students = Member.where(:course_group_id => @group)
group_students = @course.members.where(:course_group_id => @group).joins("join users on members.user_id = users.id").select{|m| m.roles.to_s.include?("Student")}
if group_students.empty?
student_in_group = '(-1)'
else
@ -503,6 +504,7 @@ class StudentWorkController < ApplicationController
@is_focus = params[:is_focus] ? params[:is_focus].to_i : 0
# 消息传过来的ID
@message_student_work_id = params[:student_work_id]
@no_group_count = @course.members.where(:course_group_id => 0).select{|m| m.roles.to_s.include?("Student")}.count
@left_nav_type = 3
@tab = params[:tab].to_i
respond_to do |format|
@ -559,7 +561,7 @@ class StudentWorkController < ApplicationController
student_work.homework_common_id = @homework.id
student_work.user_id = User.current.id
student_work.commit_time = Time.now
student_work.late_reason = params[:late_reason] if params[:late_reason]
#student_work.late_reason = params[:late_reason] if params[:late_reason]
student_work.group_id = @homework.student_works.all_commit.select("distinct group_id").count + 1
student_work.save_attachments(params[:attachments])
render_attachment_warning_if_needed(student_work)
@ -711,9 +713,10 @@ class StudentWorkController < ApplicationController
appeal_message.update_all(:viewed => true)
end
@is_focus = params[:is_focus] if params[:is_focus]
@score = student_work_score @work,User.current
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
if @homework.homework_detail_manual.comment_status == 2 && !@is_teacher && @work.user != User.current
if (@homework.homework_detail_manual.comment_status == 3 || @homework.homework_detail_manual.comment_status == 4) && !@is_teacher && @work.user != User.current
@student_work_scores = @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").order("updated_at desc")
else
@student_work_scores = student_work_score_record(@work)
@ -875,7 +878,10 @@ class StudentWorkController < ApplicationController
@is_last = params[:is_last] == "true"
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
#老师、教辅可以随时评分,学生只能在匿评作业的匿评阶段进行评分
render_403 and return unless @is_teacher || @homework.homework_detail_manual.comment_status == 2
unless @is_teacher || @homework.homework_detail_manual.comment_status == 3
render_403
return
end
@score = student_work_score @work,User.current
#@score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != ""
#@score.score = params[:score] if params[:score]
@ -967,8 +973,12 @@ class StudentWorkController < ApplicationController
update_org_activity(@homework.class,@homework.id)
if @work.save
@work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:id => @work.id).first
@count = @homework.student_works.has_committed.count
@student_work_scores = student_work_score_record @work
if @homework.homework_detail_manual.comment_status == 3 && !@is_teacher && @work.user != User.current
@student_work_scores = @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").order("updated_at desc")
else
@student_work_scores = student_work_score_record(@work)
end
@count = @student_work_scores.count
respond_to do |format|
format.js
end
@ -1360,10 +1370,7 @@ class StudentWorkController < ApplicationController
CourseMessage.create(:user_id => student_work.homework_common.user_id, :course_id => student_work.homework_common.course_id, :viewed => false,:course_message_id=>attachment.container_id,:course_message_type=>'StudentWork',:status=>2)
end
@work.update_attributes(:re_commit => 1)
respond_to do |format|
format.js
end
@homework = @work.homework_common
redirect_to student_work_path(@work)
end
def new_student_work_project

View File

@ -7,6 +7,7 @@ class SyllabusesController < ApplicationController
include SyllabusesHelper
include UsersHelper
before_filter :is_logged, :only => [:index, :show, :edit, :new, :update, :destroy, :delete_syllabus, :syllabus_resources, :syllabus_homeworks]
before_filter :check_authentication
before_filter :find_syllabus, :only => [:show, :edit, :update, :destroy, :syllabus_courselist, :edit_syllabus_eng_name, :edit_syllabus_title, :update_base_info, :delete_syllabus,
:delete_des, :members, :update_des, :edit_ref, :update_ref, :add_sy_member_alert, :search_not_sy_member, :syllabus_resources, :syllabus_homeworks,
:send_homeworks_to_course, :choose_user_course, :send_resources_to_course, :send_r_and_h_to_course]

View File

@ -35,6 +35,8 @@ class UsersController < ApplicationController
#
before_filter :can_show_course, :only => [:user_courses,:user_homeworks]
before_filter :check_authentication
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :unsolved_issues_list, :unfinished_homework_list, :user_manage_homeworks,
:unfinished_poll_list, :user_homeworks,:student_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :update_message_viewed,
:anonymous_evaluation_list,:unfinished_test_list, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, :user_receive_homeworks,
@ -43,7 +45,7 @@ class UsersController < ApplicationController
:user_courses4show,:user_projects4show,:user_contests4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction,
:user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list,
:sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses,:homepage, :user_issues, :course_community, :project_community, :contest_community,
:user_shixuns]
:shixuns]
before_filter :auth_user_extension, only: :show
before_filter :show_system_message, :only => [:show]
#before_filter :rest_user_score, only: :show
@ -654,10 +656,30 @@ class UsersController < ApplicationController
end
# 我发布的实训
def shixuns_zone
@shixuns = Shixun.where(:user_id => User.current)
def shixuns
type = params[:type]
# 我发布的
@shixuns = Shixun.where(:user_id => @user.id)
@shixuns_count = @shixuns.count
@limit = 10
@shixun_pages = Paginator.new @shixuns_count, @limit, params['page'] || 1
@offset ||= @shixun_pages.offset
@shixuns = paginateHelper @shixuns, @limit
# 我参入的
ids = Shixun.find_by_sql("select id from shixun_members where role=2 and user_id=#{@user.id}")
ids2 = Shixun.find_by_sql("select id from shixuns where id in (select shixun_id from myshixuns where user_id = #{@user.id})")
ids = ids.map{|shixun| shixun.id} unless ids.blank?
ids2 = ids2.map{|shixun| shixun.id} unless ids2.blank?
id = ids + ids2
id = id.uniq
@join_shixuns = Shixun.where(:id => id)
# @join_shixuns_count = @join_shixuns.count
# @join_shixuns_pages = Paginator.new @join_shixuns_count, @limit, params['page'] || 1
# @join_shixuns_offset ||= @join_shixuns_pages.offset
# @join_shixuns = paginateHelper @join_shixuns, @limit
respond_to do |format|
format.html{render :layout=>'base_users_new'}
format.html{render :layout=> 'base_edu'}
end
end
@ -721,11 +743,8 @@ class UsersController < ApplicationController
c = Course.find(@msg.course_id)
cs.send_wechat_join_class_notice apply_user,c,7,1
end
end
respond_to do |format|
format.js
end
redirect_to settings_course_path(@msg.course_id, :tab => 'member')
end
# 处理资源引用请求
@ -1710,7 +1729,7 @@ class UsersController < ApplicationController
# end
# end
@state = false
render :layout=>'new_base_user'
render :layout => 'edu_new_base_user'
end
#给某人留言
@ -2107,15 +2126,24 @@ class UsersController < ApplicationController
fan_query = @user.watcher_users;
@user_fanlist_count = fan_query.count();
@user_fanlist = fan_query.order("#{Watcher.table_name}.id desc").limit(12);
@courses = @user.courses.visible.not_deleted
@courses = @user.courses.visible.not_deleted_not_end
@courses_count = @courses.count
@courses = @courses.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc").limit(8)
@courses = @courses.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc")
@limit = 8
@is_remote = true
@courses_pages = Paginator.new @courses_count, @limit, params['page'] || 1
@offset ||= @courses_pages.offset
@courses = paginateHelper @courses, @limit
if @user == User.current
@shixuns = @user.shixuns
else
@shixuns = @user.shixuns.where(:authentication => 1)
end
@shixuns_count = @shixuns.count
@shixuns_pages = Paginator.new @shixuns_count, @limit, params['page'] || 1
@offset ||= @shixuns_pages.offset
@shixuns = paginateHelper @shixuns, @limit
# if User.current == @user
# # 点击小铃铛,更新点击时间
# update_onclick_time if params[:click_user_message] == 'true'

View File

@ -234,7 +234,14 @@ module ApiHelper
updateAtValue = timeIntoFormat.to_s + ""
end
updateAtValue
end
# 计算到结束还有多长时间 **天**小时**分
def how_much_time time
result = ""
result = ((time - Time.now.to_i).to_i / (24*60*60)).to_s + ""
result += (((time - Time.now.to_i).to_i % (24*60*60)) / (60*60)).to_s + " 小时 "
result += ((((time - Time.now.to_i).to_i % (24*60*60)) % (60*60)) / 60).to_s + ""
end
#日期转换为时间

View File

@ -33,6 +33,21 @@ module ApplicationHelper
extend Forwardable
def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter
# 判断用户是否认证
def check_authentication
# return true
# if params[:action] == "on_search" || params[:action] == "apply_trail" # 之所以这样处理是为了避开account页面ajax加载
# return true
# end
authentication = ApplyAction.where(:user_id => User.current.id, :status => 1).first
user_identity = User.current.try(:user_extensions).try(:identity)
if user_identity.blank? || authentication.blank?
redirect_to my_account_path
return
end
end
# 积分表中建立记录行为,有过奖励则不重复奖励
def reward_grade(user, container_id, container_type, score)
grade = Grade.where(:user_id => user.id, :container_id => container_id, :container_type => container_type).first
@ -253,7 +268,7 @@ module ApplicationHelper
res = JSON.parse(res)
rescue => e
logger.error("failed to create challenge by 'generatePipelineScriptForChallenge'! #{e}")
raise("实训云平台繁忙繁忙等级84")
raise("实训云平台繁忙繁忙等级84")
end
end
@ -306,6 +321,10 @@ module ApplicationHelper
style = 'edu-filter-btn-green'
when '已结束'
style = 'edu-filter-btn'
when '已开启补交'
style = 'edu-filter-btn-late'
when '未开启补交'
style = 'edu-filter-btn-no-late'
end
end
@ -337,51 +356,34 @@ module ApplicationHelper
case ho_detail_manual.comment_status
when 0
status = "挂起"
if homework_common.publish_time && homework_common.publish_time > Time.now
time = time_from_future(homework_common.publish_time).to_s + "后发布"
end
when 1
status = "提交中"
if homework_common.end_time && homework_common.end_time >= Time.now
time = time_from_future(homework_common.end_time).to_s + "后结束"
elsif homework_common.anonymous_comment == 0 && ho_detail_manual.evaluation_start && ho_detail_manual.evaluation_start >= Time.now
status = "匿评中"
time = time_from_future(ho_detail_manual.evaluation_start).to_s + "后开始"
elsif homework_common.archive_time && homework_common.archive_time >= Time.now
status = "评阅中"
time = time_from_future(homework_common.archive_time).to_s + "后结束"
end
when 2
status = "补交中"
if homework_common.late_time && homework_common.late_time >= Time.now
time = time_from_future(homework_common.late_time).to_s + "后结束"
elsif homework_common.anonymous_comment == 0 && ho_detail_manual.evaluation_start && ho_detail_manual.evaluation_start >= Time.now
status = "匿评中"
time = time_from_future(ho_detail_manual.evaluation_start).to_s + "后开始"
elsif homework_common.archive_time && homework_common.archive_time >= Time.now
status = "评阅中"
time = time_from_future(homework_common.archive_time).to_s + "后结束"
status = "提交中"
time = how_much_time(homework_common.end_time)
end
when 3
status = "匿评中"
if ho_detail_manual.evaluation_end && ho_detail_manual.evaluation_end > Time.now
time = time_from_future(ho_detail_manual.evaluation_end).to_s + "后结束"
status = "匿评中"
time = how_much_time(ho_detail_manual.evaluation_end)
end
when 4
status = "申诉中"
if ho_detail_manual.appeal_time && ho_detail_manual.appeal_time > Time.now
time = time_from_future(ho_detail_manual.appeal_time).to_s + "后结束"
status = "申诉中"
time = how_much_time(ho_detail_manual.appeal_time)
end
when 5
status = "评阅中"
if homework_common.archive_time && homework_common.archive_time > Time.now
time = time_from_future(homework_common.archive_time).to_s + "后结束"
status = "评阅中"
time = how_much_time(homework_common.archive_time)
end
when 6
status = "已结束"
time = format_time homework_common.archive_time
end
end
if status == "" && homework_common.allow_late && homework_common.archive_time > Time.now
time = how_much_time homework_common.archive_time
end
result[:status] = status
result[:time] = time
result
@ -1773,6 +1775,8 @@ module ApplicationHelper
title << "酷得网 - 互联网教学实训平台"
elsif @course
title << (@course.name.nil? ? "智能课堂" : @course.name)
elsif params[:controller] == "homework_bank"
title << ("智能课堂")
elsif params[:controller] == "courses" && params[:action] == "index"
title << ("智能课堂")
elsif @contest
@ -2806,6 +2810,20 @@ module ApplicationHelper
end
end
def identity_authentication_status user_id
apply = ApplyUserAuthentication.where(:user_id => user_id).first
case apply.try(:status)
when nil
"未认证"
when 0
"等待认证审批"
when 1
"认证已通过"
when 2
"认证被拒绝"
end
end
def date_format_local(time)
date = time.strftime("%Y年%m月%d日")
end
@ -3554,10 +3572,10 @@ module ApplicationHelper
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
link_to "提交作品(#{count})","javascript:void(0)", :class => 'c_grey homepagePostSubmit',:style=>"cursor:not-allowed",:title => '请先关联项目再提交作品'
else
link_to "提交作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
link_to "提交作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue homepagePostSubmit'
end
elsif work.nil? && homework.end_time < Time.now
if homework.allow_late
if homework.allow_late && homework.homework_detail_manual.comment_status < 6
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
link_to "补交作品(#{count})","javascript:void(0)", :class => 'c_grey homepagePostSubmit',:style=>"cursor:not-allowed",:title => '请先关联项目再补交作品'
else
@ -4553,19 +4571,18 @@ end
def add_to_homework_bank_f homework
homework_bank = HomeworkBank.new(:name => homework.name, :description => homework.description, :user_id => homework.user_id, :homework_type => homework.homework_type,
:quotes => 1, :is_public => homework.course.is_public, :applicable_syllabus => homework.course.syllabus.title, :homework_common_id => homework.id)
:quotes => 1, :is_public => homework.course.is_public, :applicable_syllabus => homework.course.syllabus.title, :homework_common_id => homework.id,
:reference_answer => homework.reference_answer, :syllabus_id => homework.course.syllabus_id)
if homework.homework_type == 2 && homework.homework_detail_programing
homework_bank.language = homework.homework_detail_programing.language
homework.homework_tests.each_with_index do |homework_test|
homework_bank.homework_bank_tests << HomeworkBankTest.new(
test_type: 1,
input: homework_test.input,
output: homework_test.output
)
end
homework.homework_samples.each_with_index do |homework_test|
homework_bank.homework_bank_tests << HomeworkBankTest.new(
test_type: 0,
homework_bank.homework_bank_samples << HomeworkBankSample.new(
input: homework_test.input,
output: homework_test.output
)
@ -4848,3 +4865,75 @@ def set_final_score homework,student_work
end
end
def quote_resource_bank resource, course
atta = Attachment.new(:filename => resource.filename, :disk_filename => resource.disk_filename, :filesize => resource.filesize, :digest => resource.digest, :downloads => 0, :is_publish => 0,
:author_id => User.current.id, :description => resource.description, :disk_directory => resource.disk_directory, :is_public => 0, :copy_from => resource.copy_from.nil? ? resource.id : resource.copy_from,
:quotes => 0, :resource_bank_id => resource.id, :created_on => Time.now, :content_type =>resource.content_type)
if course.attachments << atta
# 更新引用次数
quotes = resource.quotes.to_i + 1
resource.update_attribute(:quotes, quotes)
end
end
def quote_homework_bank homework, course
new_homework = HomeworkCommon.new(:name => homework.name, :user_id => User.current.id, :description => homework.description, :homework_type => homework.homework_type, :late_penalty => 0,
:course_id => course.id, :teacher_priority => 1, :anonymous_comment => 1, :quotes => 0, :is_open => 0, :homework_bank_id => homework.id, :score_open => 1,
:anonymous_appeal => 0, :is_public => 0, :reference_answer => homework.reference_answer, :answer_public => 1, :allow_late => 1)
new_homework.homework_detail_manual = HomeworkDetailManual.new
new_homework_detail_manual = new_homework.homework_detail_manual
new_homework_detail_manual.te_proportion = 1.0
new_homework_detail_manual.ta_proportion = 0
new_homework_detail_manual.comment_status = 0
new_homework_detail_manual.evaluation_num = 0
new_homework_detail_manual.absence_penalty = 0
if new_homework.homework_type == 2
new_homework.homework_detail_programing = HomeworkDetailPrograming.new
new_homework.homework_detail_programing.ta_proportion = 0
new_homework.homework_detail_programing.language = homework.language
homework.homework_bank_tests.each_with_index do |homework_test|
new_homework.homework_tests << HomeworkTest.new(
input: homework_test.input,
output: homework_test.output
)
end
homework.homework_bank_samples.each_with_index do |homework_test|
new_homework.homework_samples << HomeworkSample.new(
input: homework_test.input,
output: homework_test.output
)
end
end
if new_homework.homework_type == 3
new_homework.homework_detail_group = HomeworkDetailGroup.new
new_homework.homework_detail_group.min_num = homework.min_num
new_homework.homework_detail_group.max_num = homework.max_num
new_homework.homework_detail_group.base_on_project = homework.base_on_project
end
homework.attachments.each do |attachment|
att = attachment.copy
att.container_id = nil
att.container_type = nil
att.author_id = homework.user_id
att.copy_from = attachment.id
att.save
new_homework.attachments << att
end
if new_homework.save
if new_homework.homework_type == 4
HomeworkCommonsShixuns.create(:homework_common_id => new_homework.id, :shixun_id => homework.homework_bank_shixun.shixun_id)
end
new_homework_detail_manual.save if new_homework_detail_manual
new_homework.homework_detail_programing.save if new_homework.homework_detail_programing
new_homework.homework_detail_group.save if new_homework.homework_detail_group
homework.update_column(:quotes, homework.quotes+1)
end
end

View File

@ -90,7 +90,7 @@ module CoursesHelper
#生成课程学生列表连接
def course_student_link student_num
if User.current.allowed_to?(:as_teacher, @course)
link_to "#{student_num}", settings_course_path(@course, :tab => 'member', :role => 'as'), :class => 'mr5 link-color-blue', :id => 'teacher_number'
link_to "#{student_num}", settings_course_path(@course, :tab => 'member', :role => 'as'), :class => 'mr5 link-color-blue', :id => 'student_number'
elsif (User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course))
link_to "#{student_num}", course_member_path(@course, :role => 'as'), :class => 'mr5 link-color-blue', :id => "student_number"
else
@ -101,9 +101,9 @@ module CoursesHelper
# 生成分班列表连接
def course_group_link group_num
if User.current.allowed_to?(:as_teacher, @course)
link_to "#{group_num}", settings_course_path(@course, :tab => 'member', :role => @course.course_groups.first.id), :class => 'mr5 link-color-blue', :id => 'teacher_number'
link_to "#{group_num}", settings_course_path(@course, :tab => 'member', :role => @course.course_groups.first.id), :class => 'mr5 link-color-blue', :id => 'group_number'
elsif (User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course))
link_to "#{group_num}", course_member_path(@course, :role => @course.course_groups.first.id), :class => 'sy_cblue', :id => "student_number"
link_to "#{group_num}", course_member_path(@course, :role => @course.course_groups.first.id), :class => 'mr5 link-color-blue', :id => "group_number"
else
content_tag 'span',group_num, :class => 'sy_cblue'
end

View File

@ -0,0 +1,2 @@
module HomeworkBankHelper
end

View File

@ -0,0 +1,2 @@
module ManagementHelper
end

View File

@ -0,0 +1,15 @@
module ManagementsHelper
def trial_authorization_status status
case status
when "0", nil
0
when "1"
1
when "2"
2
else
[1,2]
end
end
end

View File

@ -14,4 +14,5 @@ module OwnerTypeHelper
CONTEST = 13
HOMEWORKREFERENCEANSWER = 14
STUDENTWORK = 15
HOMEWORKBANK = 16
end

View File

@ -100,7 +100,7 @@ module StudentWorkHelper
if work.nil? && homework.end_time >= Time.now
link_to "提交作品", new_student_work_url_without_domain(homework.id),:class => 'task-btn task-btn-blue fr'
elsif work.nil? && homework.end_time < Time.now
if homework.allow_late
if homework.allow_late && homework.homework_detail_manual.comment_status < 6
link_to "补交作品", new_student_work_url_without_domain(homework.id),:class => 'task-btn task-btn-blue fr'
end
elsif work

View File

@ -131,60 +131,4 @@ module SyllabusesHelper
content
end
def quote_resource_bank resource, course
atta = Attachment.new(:filename => resource.filename, :disk_filename => resource.disk_filename, :filesize => resource.filesize, :digest => resource.digest, :downloads => 0, :is_publish => 0,
:author_id => User.current.id, :description => resource.description, :disk_directory => resource.disk_directory, :is_public => 0, :copy_from => resource.copy_from.nil? ? resource.id : resource.copy_from,
:quotes => 0, :resource_bank_id => resource.id, :created_on => Time.now, :content_type =>resource.content_type)
if course.attachments << atta
# 更新引用次数
quotes = resource.quotes.to_i + 1
resource.update_attribute(:quotes, quotes)
end
end
def quote_homework_bank homework, course
new_homework = HomeworkCommon.new(:name => homework.name, :user_id => User.current.id, :description => homework.description, :homework_type => homework.homework_type, :late_penalty => 0,
:course_id => course.id, :teacher_priority => 1, :anonymous_comment => 1, :quotes => 0, :is_open => 0,
:homework_bank_id => homework.id, :score_open => 1, :anonymous_appeal => 0)
new_homework.homework_detail_manual = HomeworkDetailManual.new
new_homework_detail_manual = new_homework.homework_detail_manual
new_homework_detail_manual.ta_proportion = new_homework.homework_type == 2 ? 0.4 : 1.0
new_homework_detail_manual.comment_status = 0
new_homework_detail_manual.evaluation_num = 3
new_homework_detail_manual.absence_penalty = 0
if new_homework.homework_type == 2
new_homework.homework_detail_programing = HomeworkDetailPrograming.new
new_homework.homework_detail_programing.ta_proportion = 0.6
new_homework.homework_detail_programing.language = homework.language
homework.homework_bank_tests.each_with_index do |homework_test|
if homework_test.test_type
new_homework.homework_tests << HomeworkTest.new(
input: homework_test.input,
output: homework_test.output
)
else
new_homework.homework_samples << HomeworkSample.new(
input: homework_test.input,
output: homework_test.output
)
end
end
end
if new_homework.homework_type == 3
new_homework.homework_detail_group = HomeworkDetailGroup.new
new_homework.homework_detail_group.min_num = homework.min_num
new_homework.homework_detail_group.max_num = homework.max_num
new_homework.homework_detail_group.base_on_project = homework.base_on_project
end
if new_homework.save
new_homework_detail_manual.save if new_homework_detail_manual
new_homework.homework_detail_programing.save if new_homework.homework_detail_programing
new_homework.homework_detail_group.save if new_homework.homework_detail_group
homework.update_column(:quotes, homework.quotes+1)
end
end
end

View File

@ -0,0 +1,6 @@
# status0 审核中 1 同意 2 拒绝
class ApplyAction < ActiveRecord::Base
attr_accessible :container_id, :container_type, :dealer_id, :reason, :user_id, :status
belongs_to :user
end

View File

@ -109,7 +109,7 @@ class Course < ActiveRecord::Base
acts_as_customizable
scope :not_deleted, lambda{where(is_delete: 0)}
scope :not_deleted_not_end, lambda{where(is_delete: 0, is_end: 1)}
scope :not_deleted_not_end, lambda{where(is_delete: 0, is_end: 0)}
scope :not_deleted_but_is_end, lambda{where(is_end: 1, is_delete: 0)}
scope :all_course
scope :active, lambda { where(:status => STATUS_ACTIVE) }

View File

@ -2,7 +2,11 @@
class HomeworkBank < ActiveRecord::Base
# attr_accessible :title, :body
belongs_to :user
has_many :homework_bank_tests
belongs_to :syllabus
has_many :homework_bank_tests, :dependent => :destroy
has_many :homework_bank_samples, :dependent => :destroy
has_many :homework_commons
has_one :homework_bank_shixun
acts_as_attachable
def language_name

View File

@ -0,0 +1,4 @@
class HomeworkBankSample < ActiveRecord::Base
belongs_to :homework_bank
attr_accessible :input, :output, :homework_bank_id
end

View File

@ -0,0 +1,5 @@
class HomeworkBankShixun < ActiveRecord::Base
belongs_to :homework_bank
belongs_to :shixun
attr_accessible :homework_bank_id, :shixun_id
end

View File

@ -1,6 +1,7 @@
# status 控制实训的状态0未开启1: 已开启TPM; 2已认证
# 繁忙等级参数80发布实训失败返回code为-181实训开启的时候fork失败;83job创建失败84jenkins系统异常post数据不成功
# 繁忙等级参数80发布实训失败返回code为-181实训开启的时候fork失败;83j 84jenkins系统异常post数据不成功
# 85challenge创建的时候Jenkins处理异常;86实训评测失败jenkins返回错误结果; 87版本库删除异常88点击评测失败没返回数据89重置链接jenkins返回失败
# 116challenge创建关卡的时候返回结果错误
class Shixun < ActiveRecord::Base
attr_accessible :description, :is_public, :name, :changeset_num, :status, :user_id, :gpid, :language, :identifier, :authentication, :myshixun_count, :propaedeutics

View File

@ -20,6 +20,7 @@ class Syllabus < ActiveRecord::Base
belongs_to :user
has_many :courses
has_many :homework_banks
has_many :reference_materials, :dependent => :destroy
has_many :syllabus_update_records, :dependent => :destroy
has_many :journals_for_messages, :as => :jour, :dependent => :destroy

View File

@ -200,6 +200,9 @@ class User < Principal
#####
has_many :shares ,:dependent => :destroy
###
has_many :apply_actions, :dependent => :destroy
has_one :user_wechat
has_one :sso

View File

@ -5,7 +5,7 @@
已认证
<% end %>
</div>
<% if !@user.authentication && @apply_user_auth && @apply_user_auth.status == 0 %>
<% if false %>
<%= render :partial => "welcome/one_btn_mask_pop",
:locals => {
:tip1 => "更多功能,需要经过管理员的授权审核",

View File

@ -0,0 +1 @@
$("body").append('<%= j( render :partial => 'welcome/one_btn_mask_pop', :locals => {:btn => "确定", :tip1 => "申请成功,我们将在一个工作日内完成审核", :url => "javascript:void(0);"}) %>');

View File

@ -141,11 +141,10 @@
if (o.status !=0 ){
console.log(o.message);
} else {
long_notice_box("上传成功");
window.location.reload();
notice_box_redirect('<%= avatar_account_path() %>' ,"上传成功");
}
} else {
long_notice_box("上传出错");
notice_box("上传出错");
}
},

View File

@ -3,8 +3,8 @@
<h2 class="fl">找回密码</h2>
<p class="fr mt20 font-16">
<%= link_to '首页', home_path %>
<span class="ml5 mr5">|</span>
<%= link_to "帮助中心", "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168" %>
<!-- <span class="ml5 mr5">|</span>-->
<%#= link_to "帮助中心", "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168" %>
</p>
</div>
<div class="password-header clearfix">

View File

@ -76,7 +76,7 @@
<ul >
<li class="new_loggin_users">
<i class="fa fa-envelope-o font-16 ml10 color-grey"></i>
<input type="text" class="new_loggin_input" name="user[mail]" id="user_email_addr" style="width: 286px;" autocomplete="off" placeholder="请输入有效的邮箱地址">
<input type="text" class="new_loggin_input" name="user[mail]" id="user_new_email_addr" style="width: 286px;" autocomplete="off" placeholder="请输入有效的邮箱地址">
<i class="fa font-16 mr5" id="user_email_check"></i>
<div class="new-login-error" style="display: none;">
<p id="user_email_addr_notice"></p>
@ -178,7 +178,7 @@
var $passwd_2_correct = false;
jQuery(document).ready(function () {
var $phone_num = $('#user_phone_num');
var $mail = $('#user_email_addr');
var $mail = $('#user_new_email_addr');
var $password1 = $('#user_password_1');
var $password2 = $('#user_password_2');
$phone_num.val("");
@ -223,7 +223,7 @@
$mail_correct = false;
return ;
}
if ($(this).is('#user_email_addr')) {
if ($(this).is('#user_new_email_addr')) {
$.get('<%=account_valid_ajax_path%>',
{ valid: "mail",
value: this.value },
@ -234,7 +234,7 @@
$("#user_email_check").removeClass("fa-times-circle").removeClass("color-orange").addClass("fa-check-circle").addClass("color-light-green");
$mail_correct = true;
} else {
$('#user_email_addr_notice').html(data.message);
$('#user_email_addr_notice').html("该邮箱已被注册");
$('#user_email_addr_notice').parent().show();
$("#user_email_check").removeClass("fa-check-circle").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orange");
$mail_correct = false;

View File

@ -1,43 +1,47 @@
<% @unapproved_user.each do |apply_user| %>
<% user = User.find(apply_user.user_id) %>
<div class="admin-bg-grey admin-con-box clearfix">
<a href="<%= user_path(user) %>" target="_blank" class="fl with10 edu-ad-user">
<%= image_tag(url_to_avatar(user), :class => "fl with10 edu-ad-user", :alt => "头像", :width => "50", :height => "50" ) %>
</a>
<div class="fl with90">
<ul>
<li class="clearfix mb5">
<a href="<%= user_path(user) %>" class="fl"><%= user.show_name %></a>
<span class="fl ml30 font-12 color-grey"><%= time_from_now(apply_user.updated_at) %></span>
<a href="javascript:void(0)" class="fr color-orange" onclick="reject_authentication_reason(this);" >拒绝</a>
<a href="<%= admin_agree_authentication_path(:apply_id => apply_user.id) %>" class="fr mr15 color-orange" data-remote="true" >同意</a>
</li>
<li class="clearfix mb10">
<% if !user.user_extensions.school_id.blank? && user.user_extensions.school %>
<span><%= user.user_extensions.school.name %><%= user.user_extensions.department ? ' - '+user.user_extensions.department.name.to_s : '' %></span>
<% end %>
<% if user.user_extensions && user.user_extensions.identity %>
<span class="ml30"><%= get_user_roll user %></span>
<% if user.user_extensions.identity == 1 && user.user_extensions.try(:student_id) %>
<span class="ml30"><%= user.user_extensions.try(:student_id) %></span>
<% unless @unapproved_user.blank? %>
<% @unapproved_user.each do |apply_user| %>
<% user = User.find(apply_user.user_id) %>
<div class="admin-bg-grey admin-con-box clearfix">
<a href="<%= user_path(user) %>" target="_blank" class="fl with10 edu-ad-user">
<%= image_tag(url_to_avatar(user), :class => "fl with10 edu-ad-user", :alt => "头像", :width => "50", :height => "50" ) %>
</a>
<div class="fl with90">
<ul>
<li class="clearfix mb5">
<a href="<%= user_path(user) %>" class="fl"><%= user.show_name %></a>
<span class="fl ml30 font-12 color-grey"><%= time_from_now(apply_user.updated_at) %></span>
<a href="javascript:void(0)" class="fr color-orange" onclick="reject_authentication_reason(this);" >拒绝</a>
<a href="<%= admin_agree_authentication_path(:apply_id => apply_user.id) %>" class="fr mr15 color-orange" data-remote="true" >同意</a>
</li>
<li class="clearfix mb10">
<% if !user.user_extensions.school_id.blank? && user.user_extensions.school %>
<span><%= user.user_extensions.school.name %><%= user.user_extensions.department ? ' - '+user.user_extensions.department.name.to_s : '' %></span>
<% end %>
<% end %>
</li>
<li class="clearfix mb10">
<%= image_tag(url_to_auth_img(user.id, 'PRO'), :width => 200, :height => 150, :class => 'edu-renzheng-img fl mr20') %>
<%= image_tag(url_to_auth_img(user.id, 'ID'), :width => 200, :height => 150, :class => 'edu-renzheng-img fl mr20') %>
</li>
<div class="undis">
<li class="clearfix edu-form-border mb10">
<label class="edu-form-label fl">原因:</label>
<input type="text" class="task-form-90 task-height-40 panel-box-sizing fl edu-form-noborder" placeholder="我得说点儿什么最多200个字符">
</li>
<li class="clearfix">
<a href="javascript:void(0);" class="task-btn task-btn-blue fr" onclick="submit_reject_reason('<%= apply_user.id %>', this);" >确定</a>
<a href="javascript:void(0);" class="task-btn fr mr10" onclick="hide_reject_reason(this);" >取消</a>
</li>
<% if user.user_extensions && user.user_extensions.identity %>
<span class="ml30"><%= get_user_roll user %></span>
<% if user.user_extensions.identity == 1 && user.user_extensions.try(:student_id) %>
<span class="ml30"><%= user.user_extensions.try(:student_id) %></span>
<% end %>
<% end %>
</li>
<li class="clearfix mb10">
<%= image_tag(url_to_auth_img(user.id, 'PRO'), :width => 200, :height => 150, :class => 'edu-renzheng-img fl mr20') %>
<%= image_tag(url_to_auth_img(user.id, 'ID'), :width => 200, :height => 150, :class => 'edu-renzheng-img fl mr20') %>
</li>
<div class="undis">
<li class="clearfix edu-form-border mb10">
<label class="edu-form-label fl">原因:</label>
<input type="text" class="task-form-90 task-height-40 panel-box-sizing fl edu-form-noborder" placeholder="我得说点儿什么最多200个字符">
</li>
<li class="clearfix">
<a href="javascript:void(0);" class="task-btn task-btn-blue fr" onclick="submit_reject_reason('<%= apply_user.id %>', this);" >确定</a>
<a href="javascript:void(0);" class="task-btn fr mr10" onclick="hide_reject_reason(this);" >取消</a>
</li>
</div>
</ul>
</div>
</ul>
</div>
</div>
<% end %>
</div>
<% end %>
<% else %>
<%= render :partial => "welcome/no_data" %>
<% end %>

View File

@ -32,7 +32,7 @@
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=shixun.name%>'>
<span>
<%= link_to(shixun.name, shixun_path(shixun.id)) %>
<%= link_to(shixun.name, shixun_path(shixun)) %>
</span>
</td>
<td align="center">

View File

@ -46,7 +46,7 @@
<div class="cl"></div>
</div>
</div>
<p id="reply_message_<%= comment.id%>"></p>
<div id="reply_message_<%= comment.id%>" class="reply_to_message"></div>
<% end %>
</div>
<div class="cl"></div>

View File

@ -1,8 +1,9 @@
if($("#reply_message_<%= @blogComment.id%>").length > 0) {
if($("#reply_message_<%= @blogComment.id%>").html() == "") {
$(".reply_to_message").html("");
$("#reply_message_<%= @blogComment.id%>").replaceWith("<%= escape_javascript(render :partial => 'blog_comments/simple_ke_reply_form', :locals => {:reply => @blogComment,:temp =>@temp,:course_id=>@course_id}) %>");
$(function(){
sd_create_editor_from_data(<%= @blogComment.id%>,null,"100%", "<%=@blogComment.class.to_s%>");
});
}else if($("#reply_to_message_<%= @blogComment.id%>").length >0) {
$("#reply_to_message_<%= @blogComment.id%>").replaceWith("<p id='reply_message_<%= @blogComment.id%>'></p>");
}else {
$("#reply_message_<%= @reply.id%>").html("");
}

View File

@ -24,7 +24,7 @@
<% end %>
</h4>
<% if User.current.manager_of_shixun?(@shixun) %>
<p class="fr challange_operate" id="shixun_icon_<%= index %>">
<p class="fr" id="shixun_icon_<%= index %>">
<% unless challenge.position < 2 %>
<a href="<%= index_up_shixun_challenge_path(challenge, :shixun_id => @shixun) %>" title="上移" data-remote="true"><i class="fa fa-long-arrow-up color-grey font-16 mr5" ></i></a>
<% end %>

View File

@ -28,7 +28,11 @@
toolbarIcons : function() {
// Or return editormd.toolbarModes[name]; // full, simple, mini
// Using "||" set icons align right.
return ["bold", "italic", "|", "list-ul", "list-ol", "|", "image", "code", "code-block", "|", "table", "watch", "clear"]
return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear" ]
},
toolbarCustomIcons : {
testIcon : "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>",
testIcon1 : "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>"
},
//这个配置在simple.html中并没有但是为了能够提交表单使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中方便post提交表单。
saveHTMLToTextarea : true,
@ -50,7 +54,11 @@
toolbarIcons : function() {
// Or return editormd.toolbarModes[name]; // full, simple, mini
// Using "||" set icons align right.
return ["bold", "italic", "|", "list-ul", "list-ol", "|", "image", "code", "code-block", "|", "table", "watch", "clear"]
return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear" ]
},
toolbarCustomIcons : {
testIcon : "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>",
testIcon1 : "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>"
},
//这个配置在simple.html中并没有但是为了能够提交表单使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中方便post提交表单。
saveHTMLToTextarea : true,
@ -61,7 +69,6 @@
imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"],
imageUploadURL : "<%= upload_with_markdown_path(:container_id => @shixun.id, :container_type => @shixun.class) %>"//url
});
});
</script>
@ -108,6 +115,12 @@
<%= select_tag :evaluation_way, options_for_select([["输入输出", 1]]), :name => 'challenge[evaluation_way]', :class => " fl", :style => "height: 40px; width:200px;" %>
<span class="fl ml15 mt8">请选择自动检测学员是否完成本任务的评测标准</span>
</li>
<!--
<li class="clearfix">
<label class="panel-form-label fl">代码行标:</label>
<%= f.text_field :code_line, :class => "panel-form-width-200 panel-box-sizing fl", :no_label => true %>
</li>
-->
<li class="clearfix">
<% if params[:action] == "edit" && @challenge.test_sets.count > 0 %>
@ -154,7 +167,7 @@
<% end %>
</li>
<li class="clearfix">
<label class=" panel-form-label fl"> 知识/技能点</label>
<label class=" panel-form-label fl"> 技能标签</label>
<div class="fl task-bd-grey">
<% if params[:action] == "edit" && @challenge_tags.count > 0 %>
<% @challenge_tags.each do |tag| %>
@ -309,6 +322,44 @@
});
});
window.onload = function(){
$("#challenge_task_pass [type=\"latex\"]").bind("click", function(){
taskpass_editormd.cm.replaceSelection("```latex");
taskpass_editormd.cm.replaceSelection("\n");
taskpass_editormd.cm.replaceSelection("\n");
taskpass_editormd.cm.replaceSelection("```");
var __Cursor = taskpass_editormd.cm.getDoc().getCursor();
taskpass_editormd.cm.setCursor(__Cursor.line-1, 0);
});
$("#challenge_answer [type=\"latex\"]").bind("click", function(){
taskanswer_editormd.cm.replaceSelection("```latex");
taskanswer_editormd.cm.replaceSelection("\n");
taskanswer_editormd.cm.replaceSelection("\n");
taskanswer_editormd.cm.replaceSelection("```");
var __Cursor = taskanswer_editormd.cm.getDoc().getCursor();
taskanswer_editormd.cm.setCursor(__Cursor.line-1, 0);
});
$("#challenge_task_pass [type=\"inline\"]").bind("click", function(){
taskpass_editormd.cm.replaceSelection("$$$$");
var __Cursor = taskpass_editormd.cm.getDoc().getCursor();
taskpass_editormd.cm.setCursor(__Cursor.line, __Cursor.ch-2);
taskpass_editormd.cm.focus();
});
$("#challenge_answer [type=\"inline\"]").bind("click", function(){
taskanswer_editormd.cm.replaceSelection("$$$$");
var __Cursor = taskanswer_editormd.cm.getDoc().getCursor();
taskanswer_editormd.cm.setCursor(__Cursor.line, __Cursor.ch-2);
taskanswer_editormd.cm.focus();
});
$("[type=\"inline\"]").attr("title", "行内公式");
$("[type=\"latex\"]").attr("title", "多行公式");
}
// 设置textarea的宽度到140以后出现滚动条
var test_set_inputs = document.getElementsByName("test_set[input][]");
var test_set_outputs = document.getElementsByName("test_set[output][]");

View File

@ -1,4 +1,4 @@
<%= stylesheet_link_tag '/editormd/css/editormd','/editormd/css/editormd.min' %>
<%= stylesheet_link_tag '/editormd/css/editormd','/editormd/css/editormd.min.css' %>
<%= javascript_include_tag '/editormd/lib/marked.min.js','/editormd/lib/prettify.min.js','/editormd/lib/raphael.min.js','/editormd/lib/underscore.min.js','/editormd/lib/sequence-diagram.min.js',
'/editormd/lib/flowchart.min.js','/editormd/lib/jquery.flowchart.min.js','/editormd/editormd.js'%>
<style>

View File

@ -1,7 +1,7 @@
<%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c" %>
<%= stylesheet_link_tag "/assets/codemirror/codemirror" %>
<%= stylesheet_link_tag '/editormd/css/editormd','/editormd/css/editormd.min' %>
<%= stylesheet_link_tag '/editormd/css/editormd','/editormd/css/editormd.min.css' %>
<%= javascript_include_tag '/editormd/lib/marked.min.js','/editormd/lib/prettify.min.js','/editormd/lib/raphael.min.js','/editormd/lib/underscore.min.js','/editormd/lib/sequence-diagram.min.js',
'/editormd/lib/flowchart.min.js','/editormd/lib/jquery.flowchart.min.js','/editormd/editormd.js'%>
@ -27,7 +27,8 @@
<div class="clearfix mb20">
<h3 class="fl panel-inner-title"><span class="color-red mr10">第<%= @challenge.position %>关</span><%= @challenge.subject %></h3>
<p class="fr">
<a href="<%= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun) %>" title="编辑"><i class="fa fa-pencil-square-o color-grey font-16 mr5"></i></a>
<!-- <a href="<%#= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun) %>" title="编辑"><i class="fa fa-pencil-square-o color-grey font-16 mr5"></i></a>-->
<a href="<%= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun) %>" class="shixun-task-btn task-btn-green fr">编辑</a>
<!-- <a href="<%#= shixun_challenge_path(@challenge, :shixun_id => @shixun) %>" title="删除" method="delete" ><i class="fa fa-trash-o color-grey font-16 mr5"></i></a>-->
<!--<a href="#" title="复制"><i class="fa fa-files-o color-grey font-16 mr5"></i></a>-->
</p>
@ -131,6 +132,5 @@
flowChart : true, // 默认不解析
sequenceDiagram : true // 默认不解析
});
})
});
</script>

View File

@ -1,8 +1,9 @@
if($("#reply_message_<%= @comment.id%>").length > 0) {
if($("#reply_message_<%= @comment.id%>").html() == "") {
$(".reply_to_message").html("");
$("#reply_message_<%= @comment.id%>").replaceWith("<%= escape_javascript(render :partial => 'comments/simple_ke_reply_form', :locals => {:reply => @comment}) %>");
$(function(){
sd_create_editor_from_data(<%= @comment.id%>,null,"100%", "<%=@comment.class.to_s%>");
});
}else if($("#reply_to_message_<%= @comment.id %>").length >0) {
$("#reply_to_message_<%= @comment.id%>").replaceWith("<p id='reply_message_<%= @comment.id %>'></p>");
}else {
$("#reply_message_<%= @message.id%>").html("");
}

View File

@ -86,7 +86,7 @@
<%#= link_to "导出作业附件", "javascript:void(0)", class: "hworkExport resourcesGrey", :onclick => "alert('没有学生提交作业,无法下载附件')" %>
<% else%>
<%= link_to "导出作业附件", zipdown_assort_path(obj_class: @contestwork.class, obj_id: @contestwork, format: :json),
remote: true, class: "hworkExport resourcesGrey", :id => "download_homework_attachments" %>
remote: true, class: "hworkExport resourcesGrey download_homework_attachments" %>
<% end%>
</li>
</ul>

View File

@ -13,7 +13,7 @@
</div>
<div class="clearfix mb15 fl">
<li class="edu-dropdown fl ml15 mr5" id="thirdly_select" style="width: 100px">
<a href="javascript:void(0);" class="edu-dropdown-toggle" id="all_syllabuses" >所有课程<i class="fa fa-caret-down ml5" ></i></a>
<a href="javascript:void(0);" class="edu-dropdown-toggle" id="all_syllabuses" >所有课程<i class="fa fa-caret-down ml20"></i></a>
<ul class="edu-dropdown-menu" id="all_syllabuses_list">
<li onclick="change_language(this);"><a id="courses_index_syllabuses_1" href="<%= courses_path(:select => "all", :search => @search) %>" data-remote="true">所有课程</a></li>
<li onclick="change_language(this);"><a id="courses_index_syllabuses_2" href="<%= courses_path(:select => "create", :search => @search) %>" data-remote="true">我发布的课程</a></li>
@ -21,9 +21,10 @@
</ul>
</li>
<form action="<%= courses_path(:select => @select) %>" data-remote="true" onsubmit="submitFn(this, event);" class="fl ml15" >
<form action="<%= courses_path() %>" data-remote="true" onsubmit="submitFn(this, event);" class="fl ml15" id="search_syllabuses_name" >
<div class="search-wrapper">
<div class="input-holder">
<input type="hidden" name="select" id="input_select_val" value="<%= @select %>">
<input type="text" class="search-input" name="search" placeholder="输入课程关键字进行搜索" />
<button class="search-icon" onclick="searchToggle(this, event);"><i class="fa fa-search font-16 mt5"></i></button>
</div>
@ -104,6 +105,7 @@
container.find('.search-input').val('');
// clear and hide result container when we press close
container.find('.result-container').fadeOut(100, function(){$(this).empty();});
$("#search_syllabuses_name").submit();
}
}
function submitFn(obj, evt){

View File

@ -1,4 +1,5 @@
$("#intelligence_course_list").html("<%= j(render :partial => "courses/courseList") %>");
$("#courses_index_syllabuses_1").attr('href','<%= courses_path(:select => "all", :search => @search) %>');
$("#courses_index_syllabuses_2").attr('href','<%= courses_path(:select => "create", :search => @search) %>');
$("#courses_index_syllabuses_3").attr('href','<%= courses_path(:select => "join", :search => @search) %>');
$("#courses_index_syllabuses_3").attr('href','<%= courses_path(:select => "join", :search => @search) %>');
$("#input_select_val").val('<%= @select %>');

View File

@ -16,10 +16,10 @@
<i class="fa fa-caret-down color-blue font-12" style="display:none;" aria-hidden="true"></i>
</p>
<p class="fl font-16" data-option="module">
模块设置
<i class="fa fa-caret-down color-blue font-12" style="display:none;z-index:100;" aria-hidden="true"></i>
</p>
<!--<p class="fl font-16" data-option="module">-->
<!--模块设置-->
<!--<i class="fa fa-caret-down color-blue font-12" style="display:none;z-index:100;" aria-hidden="true"></i>-->
<!--</p>-->
</div>
<div class="container">
@ -115,9 +115,9 @@
</div>
</div>
<!--------------------模块设置-------------------->
<div class="module" id="setting_moduels_list" style="display:none;">
<%= render :partial => 'courses/settings/moduels' %>
</div>
<!--<div class="module" id="setting_moduels_list" style="display:none;">-->
<!--<%#= render :partial => 'courses/settings/moduels' %>-->
<!--</div>-->
</div>
</div>
</div>
@ -135,8 +135,8 @@
'/courses/<%= @course.id %>/has_group_student_list?group_id=<%= @role %>'
);
<% end %>
<% elsif @select_tab == 'module'%>
$(".stud-class-set .news .nav p[data-option='module']").click();
<%# elsif @select_tab == 'module'%>
// $(".stud-class-set .news .nav p[data-option='module']").click();
<% end %>
});

View File

@ -41,6 +41,21 @@
</td>
</tr>
<% end %>
<% @apply_users.each_with_index do |apply, index| %>
<% user = User.find(apply.course_message_id) %>
<tr id="setting_member_<%= user.id %>">
<td><%= @teacher_count + index + 1 %></td>
<td>
<%= link_to user.show_name, user_path(user), :target => '_blank', :class => 'edu-txt-w140 task-hide mt5' %>
</td>
<td><span class="edu-txt-w140 task-hide mt5"><%= user.try(:login) %></span></td>
<td><%= apply.content && apply.content.include?('9') ? "教师" : "助教" %></td>
<td>
<%= link_to '同意', dealwith_apply_request_user_path(User.current,:agree=>'Y',:msg_id=>apply.id), :class=>'color-red mr5'%>
<%= link_to '拒绝', dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>apply.id), :class=>'color-red'%>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@ -145,7 +145,7 @@
) if reply.author.id == User.current.id %>
</div>
</div>
<p id="reply_message_<%= reply.id%>"></p>
<div id="reply_message_<%= comment.id%>" class="reply_to_message"></div>
</div>
<div class="cl"></div>
</div>

View File

@ -133,6 +133,7 @@
</div>
<% end %>
</div>
<div class="cl"></div>
<div id="course_list">
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
</div>

View File

@ -13,7 +13,7 @@
<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true%>
</ul>
<% else %>
<div style="background-color: #fff;padding-bottom: 10px;">
<div class="mt10" style="background-color: #fff;padding-bottom: 10px; margin-left: 7px;">
<%= render :partial => "welcome/no_data" %>
</div>
<% end %>

View File

@ -116,6 +116,7 @@
latest_output: data.latest_output
});
$("#game_test_set_results").html(html);
$("#blacktab_nav_1").trigger("click");
if(data.status == 2){
clearInterval(cm);
clearInterval(intId);
@ -132,8 +133,8 @@
var html = "<a href='javascript:void(0)' class='task-btn task-btn-blue mr15 mt8' onclick='training_task_submmit();'>评测</a>";
$("#code_test").html(html);
}
// 访问30次即60s后后台还未改变状态即执行
if(i == 30){
// 访问60次即120s后后台还未改变状态即执行
if(i == 60){
clearInterval(intId);
nEvalContent.show();
nEvalInfo.show();

View File

@ -1,5 +1,6 @@
<style type="text/css">
.CodeMirror{line-height: 1.2; font-size: 14px}
.cm-s-railscasts span.cm-error{background:none;color: #d4cfc9;}
</style>
<form action="<%= file_update_myshixun_game_path(@game, :myshixun_id => @myshixun, :path => @path) %>" method="post" id="file_update_id" data-remote="true">
@ -10,11 +11,8 @@
<script type="text/javascript">
// 自动完成
CodeMirror.commands.autocomplete = function(cm) {
cm.showHint({hint: CodeMirror.hint.anyword});
};
var codeContents = $("#challenge-answer-edit-small").val(); // 获取版本库代码内容
var changeCode = codeContents;// 修改代码的内容(初始化时,与版本库代码一致,便于判断)
var changeCode = codeContents;// 修改代码的内容(初始化时,与版本库代码一致,便于判断)
$(function(){
loading = $("#ajax-indicator").children('span')[0]; // 加载中的html
});
@ -29,15 +27,28 @@
matchBrackets: true,
autoRefresh: true,
smartIndent: true,//智能换行
extraKeys: {"Ctrl-Q": "autocomplete"}
extraKeys: {"Ctrl-Q": "autocomplete"},
autofocus: true,
styleActiveLine: true,
lineWrapping: true,
lint: true,
gutters: ["CodeMirror-linenumbers", "breakpoints"]
});
editor_CodeMirror.on('change',function(cMirror){
// get value right from instance
$('#challenge-answer-edit-small').val(cMirror.getValue());
changeCode = cMirror.getValue(); // 获取修改后的代码
});
/* // 使用cursorActivity事件也能判断活动行但是执行添加代码后会执行活动行样式会吧添加的代码重新生成。
$(".CodeMirror-code").click(function(){
if((undefined === $(".CodeMirror-code").children('div').find(".fa-arrow-right")[0])) {
$(".CodeMirror-code").children('div').eq(12).find(".CodeMirror-gutter-wrapper").append(html);
}
});*/
editor_CodeMirror.setCursor(12, 0);
// 每10秒钟保存一次
editor_CodeMirror.on('focus',function(cMirror){
sh = setInterval(function(){
@ -123,6 +134,14 @@
{
var __Cursor = editor.getDoc().getCursor();
var __Token = editor.getTokenAt(__Cursor);
/* // 当前行变化时codemirror的js会改变gutter的结构因此要在此需要再增加标示
if(event.keyCode == 38 || event.keyCode == 40){
if((undefined === $(".CodeMirror-code").children('div').find(".fa-arrow-right")[0])) {
$(".CodeMirror-code").children('div').eq(12).find(".CodeMirror-gutter-wrapper").append(html);
}
}*/
console.log("####################################");
console.log(__Token);
if (!editor.state.completionActive &&
!ExcludedIntelliSenseTriggerKeys[(event.keyCode || event.which).toString()])
{
@ -141,8 +160,16 @@
}
}else if(__Token.string.match(/^[\u4e00-\u9fa5]+$/)){
return; // 输入的是中文,也不启动自动补全功能
}else if(event.shiftKey && event.keyCode == 51){
return;
}else if(__Token.string.indexOf("#") > -1 || __Token.type == null){
return;
}else if(event.ctrlKey){
return;
}
if((event.keyCode >= 65) && (event.keyCode <= 90)){
CodeMirror.commands.autocomplete(editor, null, { completeSingle: false }); // 开启自动补全
}
CodeMirror.commands.autocomplete(editor, null, { completeSingle: false }); // 开启自动补全
}
});
// 设置版本库字体间距
@ -157,5 +184,14 @@
// 由于codemirror加载过慢放在ready中的refresh失效所以该在页面加载完成之后触发refresh函数
$(window).load(function() {
editor_CodeMirror.refresh();
/* editor_CodeMirror.setCursor(12, 0);
var info = editor_CodeMirror.lineInfo(12);
editor_CodeMirror.setGutterMarker(12, "breakpoints", info.gutterMarkers ? null : makeMarker());
function makeMarker() {
var marker = document.createElement("div");
marker.style.color = "#fff";
marker.innerHTML = "<i class='fa fa-arrow-right' style='left: -30px;position: absolute;' aria-hidden='true'></i>";
return marker;
}*/
});
</script>

View File

@ -81,7 +81,7 @@
<ul>
<li><span class="-task-ces-info-left ">公开测试:</span><span class="color-light-green"><!= had_passed_testsests_public_count !>/<!= test_sets_public_count !></span></li>
<li><span class="-task-ces-info-left">隐藏测试:</span><span class="color-light-green"><!= had_passed_testsests_hidden_count !>/<!= test_sets_hidden_count !></span></li>
<li><span class="-task-ces-info-left">经验值:</span><span class="color-light-green">+ <!= final_score !></span></li>
<li><span class="-task-ces-info-left">经验值:</span><span class="color-light-green" id="experience_value">+ <!= final_score !></span></li>
</ul>
</div>
</div>
@ -115,6 +115,7 @@
}
);
$("#game_test_set_results").html(html);
$("#blacktab_nav_1").trigger("click");
});
// 公开的测试集允许展开与隐藏
function toggle_test_case(t_case, id){
@ -130,4 +131,13 @@
$("#test_case_"+id).toggle();
}
}
function g_new(o){return document.getElementById(o);}
function HoverLi(n){
for(var i=1;i<=2;i++){
g_new('blacktab_nav_'+i).className='blacktab_nomal';
g_new('blacktab_con_'+i).className='undis';
}
g_new('blacktab_con_'+n).className='dis';
g_new('blacktab_nav_'+n).className='blacktab_hover';
}
</script>

View File

@ -28,7 +28,7 @@
<div id="tab_con_1" class="tab-info" >
<div class="fit -scroll">
<div class="-layout-v -fit">
<div class="-flex -scroll task-padding16 panel-box-sizing new_li" id="game_task_pass">
<div class="-flex -scroll task-padding16 panel-box-sizing new_li read_only" unselectable="on" id="game_task_pass">
<textarea style="display:none;"><%= @game_challenge.task_pass %></textarea>
</div>
</div>
@ -37,7 +37,7 @@
<div id="tab_con_2" class="undis tab-info" >
<div class="fit -scroll">
<div class="-layout-v -fit">
<div class="-flex -scroll task-padding16 panel-box-sizing new_li" id="game_ready_knowledge">
<div class="-flex -scroll task-padding16 panel-box-sizing new_li read_only" unselectable="on" id="game_ready_knowledge">
<textarea style="display:none;"><%= @shixun.propaedeutics %></textarea>
</div>
</div>

View File

@ -1,5 +1,6 @@
$("#myshixun_top").html('<%= escape_javascript(render :partial => 'myshixuns/myshixun_top') %>');
$("#tab_con_3").html('<%= j (render :partial => 'games/acquire_answer') %>');
$("#experience_value").html("+ 0");
$("#tab_nav_1").removeClass('tab_hover');
$("#tab_nav_2").removeClass('tab_hover');
$("#tab_nav_3").addClass('tab_hover');

View File

@ -1,4 +1,4 @@
<%= javascript_include_tag "/codemirror/lib/codemirror", "/codemirror/mode/javascript/javascript", "/codemirror/addon/hint/show-hint", "/codemirror/addon/hint/javascript-hint" %>
<%= javascript_include_tag "/codemirror/lib/codemirror", "/codemirror/mode/javascript/javascript", "/codemirror/addon/hint/show-hint", "/codemirror/addon/hint/javascript-hint", "/codemirror/addon/selection/active-line", "/codemirror/addon/lint/javascript-lint", "/codemirror/addon/lint/css-lint", "/codemirror/addon/lint/lint", "/codemirror/addon/lint/json-lint", "/editormd/lib/codemirror/addon/lint/css-lint" %>
<%= stylesheet_link_tag "/codemirror/lib/codemirror" %>
<%= stylesheet_link_tag '/editormd/css/editormd','/editormd/css/editormd.min.css' %>
<%= javascript_include_tag '/editormd/lib/marked.min.js','/editormd/lib/prettify.min.js','/editormd/lib/raphael.min.js','/editormd/lib/underscore.min.js','/editormd/lib/sequence-diagram.min.js',

View File

@ -0,0 +1,84 @@
<div class="edu-class-innner-conbox">
<div class="edu-position task-form-20 mt15 ml15 mb10">
<input class="task-form-100 panel-box-sizing" placeholder="输入题目关键词进行搜索" id="homework_bank_search" value="<%= @search %>" type="text">
<a href="javascript:void(0);" remote="true" onclick="submit_homework_bank_search('<%= homework_bank_index_path(:type => @type, :order => @order, :sort => @r_sort, :property=>@property) %>')" class="edu-btn-search font-16 color-grey mt8"><i class="fa fa-search"></i></a>
</div>
<div class="panel-bg-grey clearfix color-grey font-12">
<p class="fl ml15">共 <span class="color-orange"><%= @hw_count %></span>个搜索结果</p>
<%= link_to '引用次数排序', homework_bank_index_path(:type => @type, :order => "quotes", :search => @search, :sort => @r_sort, :property=>@property), :class => "fr mr15 #{@order == 'quotes' ? 'color-blue' : ''}", :remote => true %>
<span class="mr5 ml5 fr">|</span>
<%= link_to '更新时间排序', homework_bank_index_path(:type => @type, :order => "updated_at", :search => @search, :sort => @r_sort, :property=>@property), :class => "fr #{@order == 'updated_at' ? 'color-blue' : ''}", :remote => true %>
</div>
<div class="edu-con-top clearfix">
<p class="fl task-form-50 ml15">
<%= link_to '全部', homework_bank_index_path(:type => @type), :class => 'edu-filter-cir-grey mr5 active', :id => 'homework_bank_pro_0', :remote => true %>
<%= link_to '编程', homework_bank_index_path(:type => @type, :property => 2), :class => 'edu-filter-cir-grey mr5', :id => 'homework_bank_pro_2', :remote => true %>
<%= link_to '普通', homework_bank_index_path(:type => @type, :property => 1), :class => 'edu-filter-cir-grey mr5', :id => 'homework_bank_pro_1', :remote => true %>
<%= link_to '分组', homework_bank_index_path(:type => @type, :property => 3), :class => 'edu-filter-cir-grey mr5', :id => 'homework_bank_pro_3', :remote => true %>
<%= link_to '实训', homework_bank_index_path(:type => @type, :property => 4), :class => 'edu-filter-cir-grey mr5', :id => 'homework_bank_pro_4', :remote => true %>
<%#= link_to '试卷', homework_bank_path(:type => @type, :property => 5), :class => 'edu-filter-cir-grey mr5', :remote => true %>
</p>
<a href="javascript:void(0)" onclick="alert_choose_homework_bank_type('<%= %>')" class="task-btn task-btn-blue fr mr15 mt5">新建</a>
<div class="cl"></div>
</div>
<div style="min-height: 380px;">
<% if @hw_count != 0 %>
<%= form_tag(choose_user_course_homework_bank_index_path(), :id => 'hb_search_course_h_form', :remote => true, :method => 'post') do %>
<% @homeworks.each do |homework| %>
<div class="clearfix edu-class-con-list">
<div class="fl ml15 task-form-90">
<input id="homework_bank_<%= homework.id %>" class="fl mt5 magic-checkbox" type="checkbox" value="<%= homework.id %>" name="check_homework_bank[]">
<label for="homework_bank_<%= homework.id %>" class="fl"></label>
<%= link_to homework.name, homework_bank_path(homework.id), :class => 'edu-class-inner-list fl ml25', :target => '_blank' %>
<% unless homework.is_public %>
<i class="fa fa-lock ml5 mt8 color-grey font-16 fl"></i>
<% end %>
<div class="cl"></div>
<p class="color-grey font-12 ml15">
<span class="">更新于<%= time_from_now homework.updated_at %></span>
<span class="ml30"><%= homework.quotes %> 次引用</span>
<span class="ml30"><%= StudentWork.where(:is_delete => 0, :work_status => [1, 2, 3], :homework_common_id => homework.homework_commons.map(&:id)).count %> 次答题</span>
<% if homework.syllabus_id && homework.syllabus.major_level %>
<% syllabus = homework.syllabus %>
<span class="ml30">
<%= syllabus.syllabus_major_level %> - <%= syllabus.syllabus_discipline_category %> - <%= syllabus.syllabus_first_level_discipline %> - <%= syllabus.title %>
</span>
<% end %>
</p>
</div>
<div class="fr edu-position edu-position-hidebox mr15 mt20">
<a href="javascript:void(0);"><i class="fa fa-ellipsis-v font-16"></i></a>
<ul class="edu-position-hide undis">
<li><%= link_to '预览', homework_bank_path(homework), :target => '_blank' %></li>
<li><%= link_to '发送', choose_user_course_homework_bank_index_path(:check_homework_bank => ["#{homework.id}"]), :remote => true %></li>
<% if @type.to_i == 1 %>
<li><a href="javascript:void(0)" onclick="delete_confirm_box_3('<%= homework_bank_path(homework) %>', '确定要删除该题吗?')">删除</a></li>
<% end %>
</ul>
</div>
</div>
<% end %>
<% end %>
<% else %>
<%= render :partial => 'welcome/no_data' %>
<% end %>
</div>
<ul class="sy_classlist clearfix">
<input class="magic-checkbox" type="checkbox" name="layout" id="homework_bank_all_select" class="fl">
<label for="homework_bank_all_select" class="fl mr15">全选</label>
<div class="fl resource_btns_bottom pt5">
<a href="javascript:void(0);" onclick="choose_course_to_send_hb();" class="fl mr10">发送</a>
<% if @type.to_i == 1 %>
<a href="javascript:void(0);" onclick="destroy_all_hb('<%= destroy_all_homework_bank_index_path() %>')" class="fl">删除</a>
<% end %>
<span id="choose_homework_bank_to_send_notice_h" class="fl ml20 color-red undis"></span>
</div>
<div class="fr pages_right_min pt15 pb15">
<ul>
<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true%>
</ul>
<div class="cl"></div>
</div>
</ul>
</div>

View File

@ -0,0 +1,12 @@
<% if @courses.count > 0 %>
<% @courses.each do |course| %>
<li class="clearfix">
<label class="fl mt5 ml5 edu-class-pop-label edu-color-grey">
<input id="send_course_<%= course.id %>" type="radio" class="fl mt8 mr5 magic-radio" name="course_id" value="<%= course.id %>">
<label for="send_course_<%= course.id %>" class="edu-info-dark task-hide fl" title="<%= course.name %>"><%= course.name %></label>
</label>
</li>
<% end %>
<% else %>
<% end %>

View File

@ -0,0 +1,77 @@
<div class="edu-con-top">
<p class="ml15 color-grey"><%= edit_mode ? '编辑' : '新建' %>普通作业</p>
</div>
<div class="alert alert-red mt15 none" id="new_homework_notice">
<button class="task-close fr" type="button">×</button>
有<span id="new_homework_notice_count">3</span> 处问题导致无法保存
<ul>
</ul>
</div>
<div class="edu-con-bg01 mt15" style="padding:30px 0;">
<div class="ml30 mr30">
<div class="">
<ul>
<input type="hidden" name="homework_type" value="<%= @homework_type %>">
<li class="clearfix mb20 pr">
<label class="panel-form-label fl">适用课程&nbsp;&nbsp;&nbsp;</label>
<%= select_tag :syllabus_id,options_for_select(course_syllabus_option,@homework.syllabus_id), {:id=>"new_syllabus_id", :class=>"fl task-height-40 task-form-30"} %>
<div class="bank_tusi">
<div class="entry">
<em></em>
<span class="after"></span>
<p class="color-grey">课程列表中没有?<%= link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'color-blue' %></p>
</div>
</div>
<div class="cl"></div>
</li>
<li class="clearfix mb15">
<label class="panel-form-label fl"><span class="color-orange mr5">*</span>标题&nbsp;&nbsp;&nbsp;</label>
<input type="text" name="homework_bank[name]" id="new_homework_name" value="<%= @homework.name %>" class="panel-form-width-690 panel-form-height-30 fl panel-box-sizing" maxlength="60" placeholder="最多60个字符" />
</li>
<li class="clearfix mb5">
<label class="panel-form-label fl"><span class="color-orange mr5">*</span>内容&nbsp;&nbsp;&nbsp;</label>
<%= hidden_field_tag :asset_id, params[:asset_id], :required => false, :style => 'display:none' %>
<textarea class="panel-form-width-690 panel-form-height-150 fl panel-box-sizing" style="display: none"></textarea>
<%= f.kindeditor :description, :editor_id => 'homework_description_editor',
:owner_id => @homework.nil? ? 0: @homework.id,
:owner_type => OwnerTypeHelper::HOMEWORKBANK,
:width => '89.7%',
:height => 200,
:minHeight=>200,
:class => 'talk_text fl',
:input_html => { :id => 'homework_content',
:class => 'talk_text fl',
:maxlength => 5000 }
%>
</li>
<li class="clearfix mb15">
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => @homework} %>
</li>
<li class="clearfix mb5">
<label class="panel-form-label fl"> 参考答案&nbsp;&nbsp;</label>
<textarea class="panel-form-width-690 panel-form-height-150 fl task-textarea-pd" style="display: none;"></textarea>
<%= f.kindeditor :reference_answer, :editor_id => 'homework_ref_answer_editor',
:owner_id => @homework.nil? ? 0: @homework.id,
:owner_type => OwnerTypeHelper::HOMEWORKBANK,
:width => '89.7%',
:height => 200,
:minHeight=>200,
:class => 'talk_text fl',
:input_html => { :id => 'homework_ref_answer',
:class => 'talk_text fl',
:maxlength => 5000 }
%>
</li>
<li class="clearfix mt10">
<a href="javascript:void(0);" onclick="submit_new_common_homework(1);" class="task-btn task-btn-blue fr">保存</a>
<% if edit_mode %>
<%= link_to '取消', homework_bank_path(@homework), :class => 'task-btn fr mr10' %>
<% else %>
<%= link_to '取消', homework_bank_index_path(), :class => 'task-btn fr mr10' %>
<% end %>
</li>
</ul>
</div>
</div>
</div>

View File

@ -0,0 +1,93 @@
<% not_allow_select = edit_mode && @homework.student_works.has_committed.count != 0 %>
<div class="edu-con-top">
<p class="ml15 color-grey"><%= edit_mode ? '编辑' : '新建' %>分组作业</p>
</div>
<div class="alert alert-red mt15 none" id="new_homework_notice">
<button class="task-close fr" type="button">×</button>
有<span id="new_homework_notice_count">3</span> 处问题导致无法保存
<ul>
</ul>
</div>
<div class="edu-con-bg01 mt15" style="padding:30px 0;">
<div class="ml30 mr30">
<div class="">
<ul>
<input type="hidden" name="homework_type" value="<%= @homework_type %>">
<li class="clearfix mb20 pr">
<label class="panel-form-label fl">适用课程&nbsp;&nbsp;&nbsp;</label>
<%= select_tag :syllabus_id,options_for_select(course_syllabus_option,@homework.syllabus_id), {:id=>"new_syllabus_id", :class=>"fl task-height-40 task-form-30"} %>
<div class="bank_tusi">
<div class="entry">
<em></em>
<span class="after"></span>
<p class="color-grey">课程列表中没有?<%= link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'color-blue' %></p>
</div>
</div>
<div class="cl"></div>
</li>
<li class="clearfix mb15">
<label class="panel-form-label fl"><span class="color-orange mr5">*</span>标题&nbsp;&nbsp;&nbsp;</label>
<input type="text" name="homework_bank[name]" id="new_homework_name" value="<%= @homework.name %>" class="panel-form-width-690 panel-form-height-30 fl panel-box-sizing" maxlength="60" placeholder="最多60个字符" />
</li>
<li class="clearfix mb5">
<label class=" panel-form-label fl"><span class="color-orange mr5">*</span>内容&nbsp;&nbsp;&nbsp;</label>
<%= hidden_field_tag :asset_id, params[:asset_id], :required => false, :style => 'display:none' %>
<textarea class="panel-form-width-690 panel-form-height-150 fl task-textarea-pd" style="display: none"></textarea>
<%= f.kindeditor :description, :editor_id => 'homework_description_editor',
:owner_id => @homework.nil? ? 0: @homework.id,
:owner_type => OwnerTypeHelper::HOMEWORKBANK,
:width => '89.7%',
:height => 200,
:minHeight=>200,
:class => 'talk_text fl',
:input_html => { :id => 'homework_content',
:class => 'talk_text fl',
:maxlength => 5000 }
%>
</li>
<li class="clearfix mb15">
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => @homework} %>
</li>
<li class="clearfix mb5">
<label class="panel-form-label fl"><span class="color-orange mr5">*</span>分组设置&nbsp;&nbsp;&nbsp;</label>
<ul class="fl edu-bg-grey mb15" style="padding-bottom:10px;" >
<li class="mt10 mr10 mb10 clearfix">
<span class="ml15 mr5">每组最小人数</span>
<input id="min_num" type="text" name="min_num" value="<%= @homework.min_num %>" class="task-form-10 task-height-40 mr5 panel-box-sizing" placeholder="2" /><span>人</span>
<span class="ml30 mr5">每组最大人数</span>
<input id="max_num" type="text" name="max_num" value="<%= @homework.max_num %>" class="task-form-10 task-height-40 mr5 panel-box-sizing" placeholder="10"/><span>人</span>
<span class="color-orange ml15 none" data-min-num="<%= @homework.min_num %>" data-max-num="<%= @homework.max_num %>" id="min_max_num_notice">
已有学生提交作品,只能扩大分组范围,原分组人数为<%= @homework.min_num %>-<%= @homework.max_num %>人
</span>
</li>
<span class="color-orange ml15 ">注:任一成员都可以提交作品,提交作品时需要关联同组成员,组内成员作品共享。</span>
</ul>
</li>
<li class="clearfix mb5">
<label class="panel-form-label fl"> 参考答案&nbsp;&nbsp;</label>
<textarea class="panel-form-width-690 panel-form-height-150 fl task-textarea-pd" style="display: none;"></textarea>
<%= f.kindeditor :reference_answer, :editor_id => 'homework_ref_answer_editor',
:owner_id => @homework.nil? ? 0: @homework.id,
:owner_type => OwnerTypeHelper::HOMEWORKBANK,
:width => '89.7%',
:height => 200,
:minHeight=>200,
:class => 'talk_text fl',
:input_html => { :id => 'homework_ref_answer',
:class => 'talk_text fl',
:maxlength => 5000 }
%>
</li>
<li class="clearfix mt10">
<a href="javascript:void(0);" onclick="submit_new_common_homework(3, true);" class="task-btn task-btn-blue fr">保存</a>
<% if edit_mode %>
<%= link_to '取消', homework_bank_path(@homework), :class => 'task-btn fr mr10' %>
<% else %>
<%= link_to '取消', homework_bank_index_path(), :class => 'task-btn fr mr10' %>
<% end %>
</li>
</ul>
</div>
</div>
</div>

View File

@ -0,0 +1,170 @@
<div class="edu-con-top">
<p class="ml15 color-grey"><%= edit_mode ? '编辑' : '新建' %>编程作业</p>
</div>
<div class="alert alert-red mt15 none" id="new_homework_notice">
<button class="task-close fr" type="button">×</button>
有<span id="new_homework_notice_count">3</span> 处问题导致无法保存
<ul>
</ul>
</div>
<div class="edu-con-bg01 mt15 program_homework" style="padding:30px 0;">
<div class="ml30 mr30">
<div class="">
<ul>
<input type="hidden" name="homework_type" value="<%= @homework_type %>">
<li class="clearfix mb20 pr">
<label class="panel-form-label fl">适用课程&nbsp;&nbsp;&nbsp;</label>
<%= select_tag :syllabus_id,options_for_select(course_syllabus_option,@homework.syllabus_id), {:id=>"new_syllabus_id", :class=>"fl task-height-40 task-form-30"} %>
<div class="bank_tusi">
<div class="entry">
<em></em>
<span class="after"></span>
<p class="color-grey">课程列表中没有?<%= link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'color-blue' %></p>
</div>
</div>
<div class="cl"></div>
</li>
<li class="clearfix mb15">
<label class="panel-form-label fl"><span class="color-orange mr5">*</span>标题&nbsp;&nbsp;&nbsp;</label>
<input type="text" name="homework_bank[name]" id="new_homework_name" value="<%= @homework.name %>" class="panel-form-width-690 panel-form-height-30 fl panel-box-sizing" maxlength="60" placeholder="最多60个字符" />
</li>
<li class="clearfix mb5">
<label class="panel-form-label fl"><span class="color-orange mr5">*</span>内容&nbsp;&nbsp;&nbsp;</label>
<%= hidden_field_tag :asset_id, params[:asset_id], :required => false, :style => 'display:none' %>
<textarea class="panel-form-width-690 panel-form-height-150 fl task-textarea-pd" style="display: none"></textarea>
<%= f.kindeditor :description, :editor_id => 'homework_description_editor',
:owner_id => @homework.nil? ? 0: @homework.id,
:owner_type => OwnerTypeHelper::HOMEWORKBANK,
:width => '89.7%',
:height => 200,
:minHeight=>200,
:class => 'talk_text fl',
:input_html => { :id => 'homework_content',
:class => 'talk_text fl',
:maxlength => 5000 }
%>
</li>
<li class="clearfix mb15">
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => @homework} %>
</li>
<li class="clearfix mb15">
<label class="panel-form-label fl"><span class="color-orange mr5">*</span>样例设置&nbsp;&nbsp;&nbsp;</label>
<ul class="fl edu-bg-grey">
<% if edit_mode && @homework.homework_bank_samples.count > 0 %>
<% @homework.homework_bank_samples.each_with_index do |sample, index| %>
<li class="clearfix mt10 ml10 mr10">
<p class="clearfix mb5">
<span class="color-green fb fl" name="sample_inputs_label">样例<%= index + 1 %></span>
<a href="javascript:void(0);" title="增加" class="sample_icon_add"><i class="fa fa-plus-circle color-grey font-16 ml10 fl mt5"></i></a>
<% if index != 0 %>
<a href="javascript:void(0);" title="删除" class="sample_icon_remove"><i class="fa fa-times-circle color-grey font-16 ml10 fl mt5"></i></a>
<% else %>
<span class="color-grey fr font-12">温馨提示:请至少输入一组样例供学生参考。</span>
<% end %>
</p>
<textarea class="task-form-100 task-height-40 mb10 panel-box-sizing" placeholder="样例输入" name="sample[input][]"><%= sample.input %></textarea>
<textarea class="task-form-100 task-height-40 mb10 panel-box-sizing" placeholder="样例输出" name="sample[output][]"><%= sample.output %></textarea>
</li>
<% end %>
<% else %>
<li class="clearfix mt10 ml10 mr10">
<p class="clearfix mb5">
<span class="color-green fb fl" name="sample_inputs_label">样例1</span>
<a href="javascript:void(0);" title="增加" class="sample_icon_add"><i class="fa fa-plus-circle color-grey font-16 ml10 fl mt5"></i></a>
<span class="color-grey fr font-12">温馨提示:请至少输入一组样例供学生参考。</span>
</p>
<textarea class="task-form-100 task-height-40 mb10 panel-box-sizing" placeholder="样例输入" name="sample[input][]"></textarea>
<textarea class="task-form-100 task-height-40 mb10 panel-box-sizing" placeholder="样例输出" name="sample[output][]"></textarea>
</li>
<% end %>
</ul>
</li>
<li class="clearfix mb15">
<label class="panel-form-label fl"><span class="color-orange mr5">*</span>测试集设置&nbsp;&nbsp;&nbsp;</label>
<ul class="fl edu-bg-grey">
<li class="clearfix mt10 ml10 mr10">
<p class="clearfix">
<select class="fl task-form-10 task-height-40" name="language_type">
<%= options_for_select({"C语言" => 1, "C++" => 2, "Python" => 3, "Java" => 4}, 1) %>
</select>
<span class="color-grey fr font-12" >温馨提示:您可以在发布后,通过"模拟答题"进行标准代码的检测。</span>
</p>
</li>
<% if edit_mode %>
<% @homework.homework_bank_tests.each_with_index do |test, index| %>
<li class="clearfix mt10 ml10 mr10">
<p class="clearfix mb5">
<span class="color-green fb fl" name="inputs_label">测试<%= index + 1 %></span>
<a href="javascript:void(0);" title="增加" class="test_icon_add"><i class="fa fa-plus-circle color-grey font-16 ml10 fl mt5"></i></a>
<% if index != 0 %>
<a href="javascript:void(0);" title="删除" class="test_icon_remove"><i class="fa fa-times-circle color-grey font-16 ml10 fl mt5"></i></a>
<% end %>
</p>
<textarea class="task-form-50 task-height-40 mb10 fl panel-box-sizing" placeholder="测试输入" name="program[input][]"><%= test.input %></textarea>
<textarea class="task-form-45 task-height-40 mb10 fl ml10 panel-box-sizing" placeholder="测试输出" name="program[output][]" style="width:49%;"><%= test.output %></textarea>
</li>
<% end %>
<% else %>
<li class="clearfix mt10 ml10 mr10">
<p class="clearfix mb5">
<span class="color-green fb fl" name="inputs_label">测试1</span>
<a href="javascript:void(0);" title="增加" class="test_icon_add"><i class="fa fa-plus-circle color-grey font-16 ml10 fl mt5"></i></a>
</p>
<textarea class="task-form-50 task-height-40 mb10 fl panel-box-sizing" placeholder="测试输入" name="program[input][]"></textarea>
<textarea class="task-form-45 task-height-40 mb10 fl ml10 panel-box-sizing" placeholder="测试输出" name="program[output][]" style="width:49%;"></textarea>
</li>
<% end %>
</ul>
</li>
<li class="clearfix mb5">
<label class="panel-form-label fl"> 参考答案&nbsp;&nbsp;</label>
<textarea class="panel-form-width-690 panel-form-height-150 fl task-textarea-pd" style="display: none;"></textarea>
<%= f.kindeditor :reference_answer, :editor_id => 'homework_ref_answer_editor',
:owner_id => @homework.nil? ? 0: @homework.id,
:owner_type => OwnerTypeHelper::HOMEWORKBANK,
:width => '89.7%',
:height => 200,
:minHeight=>200,
:class => 'talk_text fl',
:input_html => { :id => 'homework_ref_answer',
:class => 'talk_text fl',
:maxlength => 5000 }
%>
</li>
<li class="clearfix mt10">
<a href="javascript:void(0);" onclick="submit_new_common_homework(2);" class="task-btn task-btn-blue fr">保存</a>
<% if edit_mode %>
<%= link_to '取消', homework_bank_path(@homework), :class => 'task-btn fr mr10' %>
<% else %>
<%= link_to '取消', homework_bank_index_path(), :class => 'task-btn fr mr10' %>
<% end %>
</li>
</ul>
</div>
</div>
</div>
<script id="t:test-answer-list" type="text/html">
<li class="clearfix mt10 ml10 mr10">
<p class="clearfix mb5">
<span class="color-green fb fl" name="inputs_label"></span>
<a href="javascript:void(0);" title="增加" class="test_icon_add"><i class="fa fa-plus-circle color-grey font-16 ml10 fl mt5"></i></a>
<a href="javascript:void(0);" title="删除" class="test_icon_remove"><i class="fa fa-times-circle color-grey font-16 ml10 fl mt5"></i></a>
</p>
<textarea class="task-form-50 task-height-40 mb10 fl panel-box-sizing" placeholder="测试输入" name="program[input][]"></textarea>
<textarea class="task-form-45 task-height-40 mb10 fl ml10 panel-box-sizing" placeholder="测试输出" name="program[output][]" style="width:49%;"></textarea>
</li>
</script>
<script id="t:sample-answer-list" type="text/html">
<li class="clearfix mt10 ml10 mr10">
<p class="clearfix mb5">
<span class="color-green fb fl" name="sample_inputs_label"></span>
<a href="javascript:void(0);" title="增加" class="sample_icon_add"><i class="fa fa-plus-circle color-grey font-16 ml10 fl mt5"></i></a>
<a href="javascript:void(0);" title="删除" class="sample_icon_remove"><i class="fa fa-times-circle color-grey font-16 ml10 fl mt5"></i></a>
</p>
<textarea class="task-form-100 task-height-40 mb10 panel-box-sizing" placeholder="样例输入" name="sample[input][]"></textarea>
<textarea class="task-form-100 task-height-40 mb10 panel-box-sizing" placeholder="样例输出" name="sample[output][]"></textarea>
</li>
</script>

View File

@ -0,0 +1,34 @@
<div class="task-popup" style="width:450px;">
<div class="task-popup-title clearfix task-popup-bggrey">
<h3 class="fl">发送题库</h3>
<a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
</div>
<div class="task_popup_con">
<div class="newupload_conbox">
<div class="alert alert-orange mb15 font-12">
<button data-dismiss="alert" class="task-close fr" type="button">×</button>
选择的题将会发送到指定班级
</div>
<div class="mb10 edu-position">
<input class="task-form-100 task-height-40 panel-box-sizing" value="<%= @search %>" id="hb_search_course_input" name="search" placeholder="输入班级名称的关键字进行搜索" type="text" >
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt5" onclick="search_hw_course('<%= choose_user_course_homework_bank_index_path() %>');"><i class="fa fa-search"></i></a>
</div>
<%= form_tag(send_h_bank_to_course_homework_bank_index_path(), :id => 'send_hb_to_course_form', :remote => true, :method => 'post') do %>
<div class="clearfix mb15 edu-bg-light-blue edu-max-h200">
<% @homework_ids.each do |id| %>
<input type="hidden" name="homework_id[]" value="<%= id %>">
<% end %>
<ul class="" id="search_course_list">
<%= render :partial => 'homework_bank/hw_search_course_list' %>
</ul>
</div>
<% end %>
<div>
<span class="color-red undis fl" id="search_course_notice_h"></span>
<a href="javascript:void(0);" class="task-btn task-btn-blue fr" onclick="submit_send_hb_to_course();">确定</a>
<a href="javascript:void(0);" class="pop_close task-btn fr mr10">取消</a>
<div class="cl"></div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,52 @@
<div class="task-popup" style="width:650px;">
<div class="task-popup-title clearfix task-popup-bggrey">
<h3 class="fl">选择实训</h3>
<a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
</div>
<div class="task_popup_con">
<%= labelled_form_for @homework, :url =>{:controller=> 'homework_bank', :action => 'shixuns'}, :id => 'shixun_search_form', :method => "get", :remote => true do |f| %>
<div class="clearfix mb10">
<div class="task-form-50 edu-position fr" style="padding:0;">
<input class="task-form-100 panel-box-sizing" placeholder="输入实训名称的关键字搜索" type="text" name="search">
<a href="javascript:void(0);" onclick="$('#shixun_search_form').submit()" class="edu-btn-search font-16 color-grey mt5"><i class="fa fa-search"></i></a>
</div>
</div>
<% end %>
<%= labelled_form_for @homework, :url =>{:controller=> 'homework_bank', :action => 'create'}, :html => {:id => 'shixun_homework_bank_new'}, :method => "post" do |f| %>
<table class="edu-pop-table color-grey edu-txt-center table-pa5" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th>实训名称</th>
<th>导师姓名</th>
<th>学员数</th>
</tr>
</thead>
<span id="homework_type_notice" class="c_red none">请至少选中一个实训</span>
<tbody>
<% @shixuns.each do |shixun| %>
<tr>
<td class="clearfix">
<input name="shixun_homework" type="radio" class="mr5 fl mt7" value="<%= shixun.id %>">
<%= link_to shixun.name, shixun_path(shixun), :class => "edu-info-dark task-hide fl" %>
</td>
<td><%= link_to shixun.owner.try(:show_name), user_path(shixun.owner), :class => "edu-txt-w140 task-hide" %></td>
<td><%= shixun.myshixuns.count %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<div class="clearfix">
<div class="clearfix fr mt10">
<a href="javascript:void(0);" class="task-btn task-btn-blue fr" onclick="new_shixun_homework_bank();">选择</a>
<a href="javascript:void(0);" class="task-btn fr pop_close mr10">取消</a>
</div>
<div class="fr pages_right_min">
<ul>
<%= pagination_links_full @shixun_pages, @shixuns_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,6 @@
<% if params[:is_observe].nil? %>
var htmlvalue = "<%= escape_javascript(render :partial => 'homework_bank/send_homework_bank') %>";
pop_box_new(htmlvalue, 452, 463);
<% else %>
$("#search_course_list").html("<%= escape_javascript(render :partial => 'homework_bank/hw_search_course_list') %>");
<% end %>

View File

@ -0,0 +1,18 @@
<% content_for :header_tags do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
<% end %>
<div class="edu-class-container" style="min-height: 760px;">
<p class="mb10">
<i class="fa fa-map-marker mr5 color-grey" ></i>
<%= link_to User.current.show_name, user_path(User.current) %> > <%= link_to '智能课堂', courses_path() %> > <%= link_to '我的题库', homework_bank_index_path() %> > 编辑
</p>
<%= form_for @homework, :html => {:id => 'homework_common_submit_form'} do |f| %>
<% if @homework_type == 1 %>
<%= render :partial => 'new_common_homework', :locals => {:f => f, :edit_mode => true} %>
<% elsif @homework_type == 2 %>
<%= render :partial => 'new_program_homework', :locals => {:f => f, :edit_mode => true} %>
<% elsif @homework_type == 3 %>
<%= render :partial => 'new_group_homework', :locals => {:f => f, :edit_mode => true} %>
<% end %>
<% end %>
</div>

View File

@ -0,0 +1,33 @@
<script>
function g(o){return document.getElementById(o);}
function HoverLi(n, url){
for(var i=1;i<=3;i++){
$('#edu-tab-nav-'+i).removeClass('edu-new-tab-hover');
}
$('#edu-tab-nav-'+n).addClass('edu-new-tab-hover');
$.get(url, {}, function(data){});
}
</script>
<div class="edu-class-container">
<p class="mb10"><i class="fa fa-map-marker mr5 color-grey"></i><%= link_to User.current.show_name, user_path(User.current) %> > <%= link_to '智能课堂', courses_path() %> > 题库</p>
<div class="edu-con-bg01 mt15">
<div class="">
<div class="edu-tab clearfix mb20">
<ul id="edu-tab-nav">
<li id="edu-tab-nav-1" class="edu-new-tab-hover" onclick="HoverLi(1, '<%= homework_bank_index_path() %>');">
<a href="javascript:void(0);" class="tab_type">我的题库</a>
</li>
<li id="edu-tab-nav-2" onclick="HoverLi(2, '<%= homework_bank_index_path(:type => 2) %>');">
<a href="javascript:void(0);" class="tab_type">公共题库</a>
</li>
</ul>
<div class="cl"></div>
<div id="edu-tab-con-1">
<%= render :partial => 'homework_bank/homework_bank_list' %>
</div>
<div class="cl"></div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,20 @@
$("#edu-tab-con-1").html("<%= j(render :partial => 'homework_bank/homework_bank_list') %>");
<% if params[:property] %>
$(".edu-filter-cir-grey").removeClass("active");
<% case params[:property].to_i %>
<% when 1 %>
$("#homework_bank_pro_1").addClass("active");
<% when 2 %>
$("#homework_bank_pro_2").addClass("active");
<% when 3 %>
$("#homework_bank_pro_3").addClass("active");
<% when 4 %>
$("#homework_bank_pro_4").addClass("active");
<% else %>
$("#homework_bank_pro_0").addClass("active");
<% end %>
<% end %>
if(<%= params[:type] == '2' %>){
$("#edu-tab-nav-1").removeClass("edu-new-tab-hover");
$("#edu-tab-nav-2").addClass("edu-new-tab-hover");
}

View File

@ -0,0 +1,18 @@
<% content_for :header_tags do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
<% end %>
<div class="edu-class-container" style="min-height: 760px;">
<p class="mb10">
<i class="fa fa-map-marker mr5 color-grey" ></i>
<%= link_to User.current.show_name, user_path(User.current) %> > <%= link_to '智能课堂', courses_path() %> > <%= link_to '我的题库', homework_bank_index_path() %> > 新建
</p>
<%= labelled_form_for @homework, :url =>{:controller=>'homework_bank',:action => 'create'}, :html => {:id => 'homework_common_submit_form'}, :method => "post" do |f| %>
<% if @homework_type == 1 %>
<%= render :partial => 'new_common_homework', :locals => {:f => f, :edit_mode => false} %>
<% elsif @homework_type == 2 %>
<%= render :partial => 'new_program_homework', :locals => {:f => f, :edit_mode => false} %>
<% elsif @homework_type == 3 %>
<%= render :partial => 'new_group_homework', :locals => {:f => f, :edit_mode => false} %>
<% end %>
<% end %>
</div>

View File

@ -0,0 +1 @@
yes_notice_box("已发送到目标班级的作业列表<br/>但需要您设置发布和截止时间,以激活相应作业,谢谢!");

View File

@ -0,0 +1,2 @@
var htmlvalue = "<%= escape_javascript(render :partial => 'homework_bank/shixuns') %>";
pop_box_new(htmlvalue, 680, 454);

View File

@ -0,0 +1,177 @@
<% content_for :header_tags do %>
<%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c" %>
<%= javascript_include_tag "resizeable_table" %>
<%= stylesheet_link_tag "/assets/codemirror/codemirror" %>
<% end %>
<script type="text/javascript">
function HoverLi(n){
for(var i=1;i<=2;i++){
$('#edu-tab-nav-'+i).removeClass('edu-new-tab-hover');
$('#edu-tab-con-'+i).addClass('undis');
}
$('#edu-tab-con-'+n).removeClass('undis');
$('#edu-tab-nav-'+n).addClass('edu-new-tab-hover');
}
</script>
<div class="edu-class-container">
<p class="mb10">
<i class="fa fa-map-marker mr5 color-grey"></i>
<%= link_to User.current.show_name, user_path(User.current) %> > <%= link_to '智能课堂', courses_path() %> > <%= @homework.user == User.current ? link_to('我的题库', homework_bank_index_path()) : link_to('公共题库', homework_bank_index_path(:type => 2)) %></p>
<div class="edu-con-top clearfix">
<p class="ml15 fl color-grey">
<% unless @homework.is_public %>
<i class="fa fa-lock mr5"></i>
<% end %>
<%= @homework.name %>
</p>
<%= link_to '返回', @homework.user == User.current ? homework_bank_index_path() : homework_bank_index_path(:type => 2), :class => 'fr font-12 mr15 mt3 link-color-grey' %>
</div>
<div class="edu-con-bg01 mt15">
<div class="">
<div class="edu-tab clearfix mb20">
<ul id="edu-tab-nav">
<li id="edu-tab-nav-1" class="edu-new-tab-hover" onclick="HoverLi(1);">
<a href="javascript:void(0);" class="tab_type">详情</a>
</li>
<% if @is_admin %>
<li id="edu-tab-nav-2" onclick="HoverLi(2);">
<a href="javascript:void(0);" class="tab_type">参考答案</a>
</li>
<% end %>
</ul>
<div class="cl"></div>
<div id="edu-tab-con-1">
<div class="" style="padding:0 15px;">
<% if @is_admin %>
<div class="fr edu-position edu-position-hidebox">
<a href="javascript:void(0);" class="font-16"><i class="fa fa-bars"></i></a>
<ul class="edu-position-hide undis" style="left:-85px;">
<% if @homework.homework_type != 4 %>
<li>
<%= link_to l(:button_edit), edit_homework_bank_path(@homework) %>
</li>
<% end %>
<li>
<%= link_to '发送', choose_user_course_homework_bank_index_path(:check_homework_bank => ["#{@homework.id}"]), :remote => true %>
</li>
<% unless @homework.is_public %>
<li>
<a href="javascript:void(0);" onclick="s_op_confirm_box('<%= set_public_homework_bank_path(@homework) %>', '您确定要公开吗?<br/>公开后不能重设为私有')">设为公开</a>
</li>
<% end %>
<li>
<a href="javascript:void(0)" onclick="delete_confirm_box_3('<%= homework_bank_path(@homework) %>', '您确定要删除吗?')">删除</a>
</li>
</ul>
</div>
<% elsif @homework.is_public %>
<li>
<%= link_to '发送', choose_user_course_homework_bank_index_path(:check_homework_bank => ["#{@homework.id}"]), :remote => true %>
</li>
<% end %>
<div class="cl"></div>
<div class="upload_img list_style">
<%= @homework.description.html_safe %>
</div>
</div>
<ul class="panel-mes-head">
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @homework} %>
</ul>
<% if @homework.homework_type == 3 %>
<div class="edu-con-bg01">
<div class="edu-con-top clearfix mb15">
<p class="ml15 fl font-14 font-bd">分组要求</p>
</div>
<div class="edu-line font-14 pl15 pr15 pd15">
<p>分组人数: <%= @homework.min_num %> - <%= @homework.max_num %> 人</p>
<span class="color-orange">注:任一成员都可以提交作品,提交作品时需要关联同组成员,组内成员作品共享。</span>
</div>
</div>
<% end %>
<% if @homework.homework_type == 2 %>
<% samples = @homework.homework_bank_samples %>
<% unless samples.empty? %>
<div class="edu-con-bg01">
<div class="edu-con-top clearfix mb15">
<p class="ml15 fl font-14 font-bd">输入输出样例:<%= samples.count %> 组</p>
</div>
<div class="edu-line font-14">
<% samples.each_with_index do |sample, index| %>
<div class="clearfix mr15">
<ul>
<li class="clearfix">
<label class="panel-form-label fl">&nbsp;&nbsp;</label>
<span class="color-green font-bd fl">样例<%= index + 1 %></span>
</li>
<li class="clearfix mb15">
<label class="panel-form-label fl color-grey">样例输入&nbsp;&nbsp;&nbsp;</label>
<div class="fl edu-bg-grey">
<pre class="mt10 ml10 mr10 mb10" style="font-family: '微软雅黑','宋体'; word-wrap:break-word; white-space:pre-wrap;"><%=sample.input.blank? ? " " : sample.input %></pre>
</div>
</li>
<li class="clearfix mb15">
<label class="panel-form-label fl color-grey">样例输出&nbsp;&nbsp;&nbsp;</label>
<div class="fl edu-bg-grey">
<pre class="mt10 ml10 mr10 mb10" style="font-family: '微软雅黑','宋体'; word-wrap:break-word; white-space:pre-wrap;"><%=sample.output.blank? ? " " : sample.output %></pre>
</div>
</li>
</ul>
</div>
<% end %>
</div>
</div>
<% end %>
<%# if @is_teacher %>
<div class="edu-con-bg01">
<div class="edu-con-top clearfix mb15">
<p class="ml15 fl font-14 font-bd">测试集:<%=@homework.homework_bank_tests.count %> 组</p>
</div>
<div class="edu-line font-14">
<table class="edu-pop-table table-pa5 table-line mb15 ml15" style="width:97.5%;" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th class="edu-txt-center">序号</th>
<th>测试集输入</th>
<th>测试集输出</th>
</tr>
</thead>
<tbody>
<% @homework.homework_bank_tests.each_with_index do |test, i| %>
<tr>
<td class="edu-txt-center"><%=i+1 %></td>
<td style="height:100%; width:48%;">
<div style="height:100%; width:100%;"><pre style="font-family: '微软雅黑','宋体'; word-wrap:break-word; white-space:pre-wrap;"><%=test.input.blank? ? " " : test.input %></pre></div>
</td>
<td style="height:100%; width:48%;">
<div style=" height:100%; width:100%;"><pre style="font-family: '微软雅黑','宋体'; word-wrap:break-word; white-space:pre-wrap;"><%=test.output.blank? ? " " : test.output %></pre></div>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
<% end %>
<%# end %>
</div>
<div id="edu-tab-con-2" class="undis">
<div class="edu-tab-con-box">
<div>
<% unless @homework.reference_answer.blank? %>
<%= @homework.reference_answer.html_safe %>
<% else %>
<img src="../images/bigdata/edu-class/edu-nodata.png" width="200" height="" class="edu-nodata-img">
<p class="edu-nodata-p mb30">暂未设置参考答案 ~ </p>
<% end %>
</div>
</div>
</div>
<div class="cl"></div>
</div>
</div>
</div>
</div>

View File

@ -9,7 +9,7 @@
<ul>
<li class="clearfix edu-position">
<label class="panel-form-label fl mr10">&nbsp;</label>
<input id="homework_anonymous_comment" class="magic-checkbox fl mt5" type="checkbox" value="1" name="homework_anonymous_comment" <%= @homework.anonymous_comment == 1 ? '' : 'checked' %>>
<input id="homework_anonymous_comment" class="magic-checkbox fl mt5 <%= @homework_detail_manual.comment_status >= 3 ? 'disabled-bg' : '' %>" <%= @homework_detail_manual.comment_status >= 3 ? 'disabled' : '' %> type="checkbox" value="1" name="homework_anonymous_comment" <%= @homework.anonymous_comment == 1 ? '' : 'checked' %>>
<label for="homework_anonymous_comment" class="fl">启用匿评</label>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">
<em></em>
@ -20,17 +20,17 @@
</li>
<li class="clearfix mb15">
<label class="panel-form-label fl mr10">开始时间</label>
<input type="text" <%= @homework.anonymous_comment == 1 ? 'disabled' : '' %> name="homework_evaluation_start" readonly value="<%= format_time @homework_detail_manual.evaluation_start %>" class="fl task-form-15 task-height-40 panel-box-sizing <%= @homework.anonymous_comment == 1 ? 'disabled-bg' : '' %>" placeholder="选择匿评开启时间" />
<input type="text" <%= @homework.anonymous_comment == 1 || @homework_detail_manual.comment_status >= 3 ? 'disabled' : '' %> name="homework_evaluation_start" readonly value="<%= format_time @homework_detail_manual.evaluation_start %>" class="fl task-form-15 task-height-40 panel-box-sizing <%= @homework.anonymous_comment == 1 || @homework_detail_manual.comment_status >= 3 ? 'disabled-bg' : '' %>" placeholder="选择匿评开启时间" />
<span class="color-orange fl ml20 mt5 none" id="homework_evaluation_start_notice"><i class="fa fa-exclamation-circle mr5 color-orange"></i></span>
</li>
<li class="clearfix mb15 ">
<label class="panel-form-label fl mr10">结束时间</label>
<input type="text" <%= @homework.anonymous_comment == 1 ? 'disabled' : '' %> name="homework_evaluation_end" readonly value="<%= format_time @homework_detail_manual.evaluation_end %>" class=" fl task-form-15 task-height-40 panel-box-sizing <%= @homework.anonymous_comment == 1 ? 'disabled-bg' : '' %>" placeholder="选择匿评结束时间" />
<input type="text" <%= @homework.anonymous_comment == 1 || @homework_detail_manual.comment_status >= 4 ? 'disabled' : '' %> name="homework_evaluation_end" readonly value="<%= format_time @homework_detail_manual.evaluation_end %>" class=" fl task-form-15 task-height-40 panel-box-sizing <%= @homework.anonymous_comment == 1 || @homework_detail_manual.comment_status >= 4 ? 'disabled-bg' : '' %>" placeholder="选择匿评结束时间" />
<span class="color-orange fl ml20 mt5 none" id="homework_evaluation_end_notice"><i class="fa fa-exclamation-circle mr5 color-orange"></i></span>
</li>
<li class="clearfix mb15 ">
<label class=" panel-form-label fl mr10">匿评数量</label>
<input type="text" <%= @homework.anonymous_comment == 1 ? 'disabled' : '' %> name="homework_evaluation_num" value="<%= @homework_detail_manual.evaluation_num %>" class="fl task-form-15 task-height-40 panel-box-sizing <%= @homework.anonymous_comment == 1 ? 'disabled-bg' : '' %>" placeholder="3" />
<input type="text" <%= @homework.anonymous_comment == 1 || @homework_detail_manual.comment_status >= 3 ? 'disabled' : '' %> name="homework_evaluation_num" value="<%= @homework_detail_manual.evaluation_num %>" class="fl task-form-15 task-height-40 panel-box-sizing <%= @homework.anonymous_comment == 1 || @homework_detail_manual.comment_status >= 3 ? 'disabled-bg' : '' %>" placeholder="3" />
<span class="color-orange fl ml20 mt5 none" id="homework_evaluation_num_notice"><i class="fa fa-exclamation-circle mr5 color-orange"></i></span>
</li>
<li class="clearfix mb15 ">
@ -39,10 +39,10 @@
<span class="color-orange fl ml20 mt5 none" id="homework_absence_penalty_notice"><i class="fa fa-exclamation-circle mr5 color-orange"></i></span>
</li>
</ul>
<ul class="mt50 mb50 <%= @homework.anonymous_appeal == 1 ? '' : 'none' %>" id="anon_relate_setting_ul" style="padding-bottom:5px;">
<ul class="mt50 mb50 <%= @homework.anonymous_comment == 0 ? '' : 'none' %>" id="anon_relate_setting_ul" style="padding-bottom:5px;">
<li class="clearfix edu-position">
<label class=" panel-form-label fl mr10">&nbsp;</label>
<input id="homework_anonymous_appeal" class="magic-checkbox fl mt5" type="checkbox" value="1" name="homework_anonymous_appeal" <%= @homework.anonymous_appeal == 0 ? '' : 'checked' %>>
<input id="homework_anonymous_appeal" class="magic-checkbox fl mt5 <%= @homework_detail_manual.comment_status >= 4 ? 'disabled-bg' : '' %>" type="checkbox" value="1" name="homework_anonymous_appeal" <%= @homework.anonymous_appeal == 0 ? '' : 'checked' %> <%= @homework_detail_manual.comment_status >= 4 ? 'disabled' : '' %>>
<label for="homework_anonymous_appeal" class="fl">启用匿评申诉</label>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">
<em></em>
@ -59,13 +59,13 @@
</li>
<li class="clearfix mb15">
<label class="panel-form-label fl mr10">申诉结束时间</label>
<input type="text" <%= @homework.anonymous_appeal == 1 ? '' : 'disabled' %> name="homework_appeal_time" readonly value="<%= format_time @homework_detail_manual.appeal_time %>" class="fl task-form-15 task-height-40 panel-box-sizing <%= @homework.anonymous_comment == 1 ? 'disabled-bg' : '' %>" placeholder="选择匿评开启时间" />
<input type="text" <%= @homework.anonymous_appeal == 1 && @homework_detail_manual.comment_status < 5 ? '' : 'disabled' %> name="homework_appeal_time" readonly value="<%= format_time @homework_detail_manual.appeal_time %>" class="fl task-form-15 task-height-40 panel-box-sizing <%= @homework.anonymous_appeal == 1 && @homework_detail_manual.comment_status < 5 ? '' : 'disabled-bg' %>" placeholder="选择匿评开启时间" />
<span class="color-orange fl ml20 mt5 none" id="homework_appeal_time_notice"><i class="fa fa-exclamation-circle mr5 color-orange"></i></span>
</li>
<li class="clearfix mb15">
<label class="panel-form-label fl mr10">违规匿评扣分</label>
<input type="text" <%= @homework.anonymous_appeal == 1 ? '' : 'disabled' %> name="homework_appeal_penalty" value="<%= @homework_detail_manual.appeal_penalty %>" class="fl task-form-15 task-height-40 panel-box-sizing <%= @homework.anonymous_comment == 1 ? 'disabled-bg' : '' %>" placeholder="3" />
<input type="text" <%= @homework.anonymous_appeal == 1 ? '' : 'disabled' %> name="homework_appeal_penalty" value="<%= @homework_detail_manual.appeal_penalty %>" class="fl task-form-15 task-height-40 panel-box-sizing <%= @homework.anonymous_appeal == 1 ? '' : 'disabled-bg' %>" placeholder="3" />
<span class="color-orange fl ml20 mt5 none" id="homework_appeal_penalty_notice"><i class="fa fa-exclamation-circle mr5 color-orange"></i></span>
</li>
</ul>

View File

@ -4,36 +4,32 @@
<a href="javascript:void(0);" class="link-color-grey fr font-16 " onclick="setting_cancel_edit('late_cancel_edit');" title="取消"><i class="fa fa-times mr15"></i></a>
</div>
<div class="ml30 mr30" style="padding-bottom:20px;">
<div class="clearfix " >
<div class="clearfix">
<%= form_tag(late_setting_homework_common_path(@homework), :remote => true, :method => "post", :id => 'late_setting_form') do |f| %>
<ul >
<li class="clearfix mb20 edu-position">
<label class="task-height-40 fl mr10">是否允许在截止日期之后进行补交</label>
<span class="fl mr15">
<input id="edit_allow_late_1" class="magic-radio" type="radio" name="homework_allow_late" value="1" <%= @homework.allow_late ? 'checked' : '' %>>
<label for="edit_allow_late_1">允许</label>
</span>
<span class="fl mr15">
<input id="edit_allow_late_0" class="magic-radio" type="radio" name="homework_allow_late" value="0" <%= @homework.allow_late ? '' : 'checked' %>>
<label for="edit_allow_late_0">禁止</label>
</span>
<label class="panel-form-label fl mr10">作品补交</label>
<input id="edit_allow_late_1" class="magic-radio fl mt6" type="radio" name="homework_allow_late" value="1" <%= @homework.allow_late ? 'checked' : '' %>>
<label for="edit_allow_late_1" class="fl mr30 mt6">允许补交</label>
<input id="edit_allow_late_0" class="magic-radio fl mt6" type="radio" name="homework_allow_late" value="0" <%= @homework.allow_late ? '' : 'checked' %>>
<label for="edit_allow_late_0" class="fl mt6">禁止补交</label>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">
<em></em>
<span></span>
<p>允许补交,则在补交截止日期之前,学生可以修改作品和追加附件 <br/>
但是在发布截止时间 ~ 补交截止时间内才提交作品的学生,将被扣迟交分
</p>
<% if @homework.allow_late %>
<p id="edit_late_notice">允许补交,则在结束日期之前,学生可以补交作品 <br/>
但是在提交截止时间之后才提交作品的学生,将被扣迟交分
</p>
<% else %>
<p id="edit_late_notice">禁止补交,则在提交截止时间之后,学生不能再提交作品
</p>
<% end %>
</div>
</li>
</ul>
<ul class="<%= @homework.allow_late ? '' : 'none' %>" id="late_relate_setting_ul">
<ul id="late_relate_setting_ul">
<li class="clearfix mb15">
<label class=" panel-form-label fl mr10">截止时间</label>
<input type="text" class="fl task-form-15 task-height-40 panel-box-sizing" readonly value="<%= format_time @homework.late_time %>" name="homework_late_time" placeholder="截止时间" />
<span class="color-orange fl ml20 mt5 none" id="homework_late_time_notice"><i class="fa fa-exclamation-circle mr5 color-orange"></i></span>
</li>
<li class="clearfix mb15">
<label class=" panel-form-label fl mr10">迟交扣分</label>
<label class="panel-form-label fl mr10">迟交扣分</label>
<input type="text" class="fl task-form-15 task-height-40 panel-box-sizing" value="<%= @homework.late_penalty %>" name="homework_late_penalty" placeholder="5" />
<span class="color-orange fl ml20 mt5 none" id="homework_late_penalty_notice"><i class="fa fa-exclamation-circle mr5 color-orange"></i></span>
</li>

View File

@ -10,9 +10,6 @@
<li class="clearfix mb15 edu-position">
<label class="panel-form-label fl mr10">发布时间</label>
<input type="text" name="homework_publish_time" readonly value="<%=format_time @homework.publish_time %>" <%= @homework.homework_detail_manual.try(:comment_status) > 0 ? 'disabled' : '' %> class="fl task-form-15 task-height-40 panel-box-sizing <%= @homework.homework_detail_manual.try(:comment_status) > 0 ? 'disabled-bg' : '' %>" placeholder="<%= Time.parse((Time.now + 1.days).to_s).strftime("%Y-%m-%d") %> 0000"/>
<% if @homework.homework_detail_manual.try(:comment_status) == 0 %>
<a href="javascript:void(0);" id="reset_publish_time" class="fl ml15 mt5 <%= @homework.publish_time.nil? ? 'none' : '' %>">清除</a>
<% end %>
<span class="color-orange fl ml20 mt5 none" id="homework_publish_time_notice"><i class="fa fa-exclamation-circle mr5 color-orange"></i></span>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px; width:405px;">
@ -24,10 +21,7 @@
</li>
<li class="clearfix mb15 edu-position">
<label class="panel-form-label fl mr10">截止时间</label>
<input type="text" name="homework_end_time" readonly value="<%=format_time @homework.end_time %>" <%= @homework.homework_detail_manual.try(:comment_status) > 1 ? 'disabled' : '' %> class="fl task-form-15 task-height-40 panel-box-sizing <%= @homework.homework_detail_manual.try(:comment_status) > 1 ? 'disabled-bg' : '' %>" placeholder="<%= Time.parse((Time.now + 1.days).to_s).strftime("%Y-%m-%d") %> 1000"/>
<% if @homework.homework_detail_manual.try(:comment_status) == 0 %>
<a href="javascript:void(0);" id="reset_end_time" class="fl ml15 mt5 <%= @homework.end_time.nil? ? 'none' : '' %>">清除</a>
<% end %>
<input type="text" name="homework_end_time" readonly value="<%=format_time @homework.end_time %>" <%= !@homework.end_time.nil? && @homework.end_time <= Time.now ? 'disabled' : '' %> class="fl task-form-15 task-height-40 panel-box-sizing <%= !@homework.end_time.nil? && @homework.end_time <= Time.now ? 'disabled-bg' : '' %>" placeholder="<%= Time.parse((Time.now + 1.days).to_s).strftime("%Y-%m-%d") %> 1000"/>
<span class="color-orange fl ml20 mt5 none" id="homework_end_time_notice"><i class="fa fa-exclamation-circle mr5 color-orange"></i></span>

View File

@ -81,7 +81,7 @@
<span class="fl mr5 task-form-30 ml20">
<label class="mr5">学生匿评</label>
<select class="task-height-40 task-form-30 <%= @homework.anonymous_comment == 1 ? 'disabled-bg' : 'normal-bg' %>" name="st_proportion" <%= @homework.anonymous_comment == 1 ? 'disabled' : '' %>>
<%= options_for_select(ta_proportion_option,(1 - @homework_detail_manual.te_proportion - @homework_detail_manual.ta_proportion - @homework_detail_programing.ta_proportion)) %>
<%= options_for_select(ta_proportion_option,(100 - @homework_detail_manual.te_proportion*100.round() - @homework_detail_manual.ta_proportion*100.round() - @homework_detail_programing.ta_proportion*100.round())/100) %>
</select>
</span>
</li>
@ -91,7 +91,7 @@
<span class="fl mr5 task-form-30 ml20">
<label class="mr5">学生匿评</label>
<select class="task-height-40 task-form-30 <%= @homework.anonymous_comment == 1 ? 'disabled-bg' : 'normal-bg' %>" name="st_proportion" <%= @homework.anonymous_comment == 1 ? 'disabled' : '' %>>
<%= options_for_select(ta_proportion_option,(1 - @homework_detail_manual.te_proportion - @homework_detail_manual.ta_proportion)) %>
<%= options_for_select(ta_proportion_option,(100 - @homework_detail_manual.te_proportion*100.round() - @homework_detail_manual.ta_proportion*100.round())/100) %>
</select>
</span>
</li>

View File

@ -1,10 +1,16 @@
<% if homework_commons.count != 0 %>
<% homework_commons.each_with_index do |homework_common, index|%>
<div class=" clearfix edu-class-con-list">
<div class="fl ml15 task-form-90 ">
<div class="clearfix edu-class-con-list">
<div class="fl ml15 task-form-90 ">
<% homework_curr_status = homework_curr_time(homework_common) %>
<%= link_to homework_common.name.to_s, student_work_index_path(:homework => homework_common.id,:host=> Setting.host_course), :class => "edu-class-inner-list fl"%>
<span class="edu-filter-btn <%= homework_status_color homework_curr_status[:status] %> ml10 fl mt3"><%= homework_curr_status[:status] %></span>
<% if homework_curr_status[:status] != "" %>
<span class="edu-filter-btn <%= homework_status_color homework_curr_status[:status] %> ml10 fl mt3"><%= homework_curr_status[:status] %></span>
<% end %>
<% if homework_common.homework_detail_manual.try(:comment_status) != 0 && homework_common.homework_detail_manual.try(:comment_status) != 6 %>
<% allow_late = homework_common.allow_late ? '已开启补交' : '未开启补交' %>
<span class="edu-filter-btn <%= homework_status_color allow_late %> ml10 fl mt3"><%= allow_late %></span>
<% end %>
<div class="cl"></div>
<p class="color-grey font-12">
<span class=""># <%= get_hw_index(homework_common, @is_teacher) + 1 %></span>
@ -49,13 +55,15 @@
<%= link_to "设置", setting_homework_common_path(homework_common) %>
</li>
<li><%= link_to "导出成绩", student_work_index_path(:homework => homework_common, :format => 'xls'), :id => "export_student_work" %></li>
<% if homework_common.homework_type == 1 || homework_common.homework_type == 3 %>
<li>
<% if homework_common.student_works.has_committed.empty?%>
<a href="javascript:void(0)" onclick="notice_box('没有学生提交作业,暂无附件可下载');">导出作品附件</a>
<% else%>
<%= link_to "导出作品附件", zipdown_assort_path(obj_class: homework_common.class,obj_id: homework_common.id, format: :json), remote: true, :id => "download_homework_attachments" %>
<%= link_to "导出作品附件", zipdown_assort_path(obj_class: homework_common.class,obj_id: homework_common, format: :json), remote: true, :class => "download_homework_attachments" %>
<% end%>
</li>
<% end %>
<% unless homework_common.is_public %>
<li id="set_homework_public_<%= homework_common.id %>">
<a href="javascript:void(0);" onclick="delete_confirm_box('<%= set_public_homework_common_path(homework_common) %>', '您确定要公开吗?<br/>公开后不能重设为私有')">设为公开</a>

View File

@ -3,7 +3,6 @@
<a href="<%= homework_common_index_path(:course => @course.id, :order => 0, :search => @search) %>" class="<%= @order == "0" ? "active" : "" %> edu-filter-cir-grey mr5" data-remote="true">挂起</a>
<% end %>
<a href="<%= homework_common_index_path(:course => @course.id, :order => 1, :search => @search) %>" class="<%= @order == "1" ? "active" : "" %> edu-filter-cir-grey mr5" data-remote="true">提交中</a>
<a href="<%= homework_common_index_path(:course => @course.id, :order => 2, :search => @search) %>" class="<%= @order == "2" ? "active" : "" %> edu-filter-cir-grey mr5" data-remote="true">补交中</a>
<a href="<%= homework_common_index_path(:course => @course.id, :order => 3, :search => @search) %>" class="<%= @order == "3" ? "active" : "" %> edu-filter-cir-grey mr5" data-remote="true">匿评中</a>
<a href="<%= homework_common_index_path(:course => @course.id, :order => 4, :search => @search) %>" class="<%= @order == "4" ? "active" : "" %> edu-filter-cir-grey mr5" data-remote="true">申诉中</a>
<a href="<%= homework_common_index_path(:course => @course.id, :order => 5, :search => @search) %>" class="<%= @order == "5" ? "active" : "" %> edu-filter-cir-grey mr5" data-remote="true">评阅中</a>

View File

@ -76,8 +76,11 @@
<!--</li>-->
<li class="clearfix mt10">
<a href="javascript:void(0);" onclick="submit_new_common_homework(3, true);" class="task-btn task-btn-blue fr">保存</a>
<%= link_to '取消', homework_common_index_path(:course => @course), :class => 'task-btn fr mr10' %>
</li>
<% if edit_mode %>
<%= link_to '取消', student_work_index_path(:homework => @homework.id), :class => 'task-btn fr mr10' %>
<% else %>
<%= link_to '取消', homework_common_index_path(:course => @course), :class => 'task-btn fr mr10' %>
<% end %> </li>
</ul>
</div>
</div>

View File

@ -129,7 +129,11 @@
<!--</li>-->
<li class="clearfix mt10">
<a href="javascript:void(0);" onclick="submit_new_common_homework(2);" class="task-btn task-btn-blue fr">保存</a>
<%= link_to '取消', homework_common_index_path(:course => @course), :class => 'task-btn fr mr10' %>
<% if edit_mode %>
<%= link_to '取消', student_work_index_path(:homework => @homework.id), :class => 'task-btn fr mr10' %>
<% else %>
<%= link_to '取消', homework_common_index_path(:course => @course), :class => 'task-btn fr mr10' %>
<% end %>
</li>
</ul>
</div>
@ -143,7 +147,7 @@
<a href="javascript:void(0);" title="增加" class="test_icon_add"><i class="fa fa-plus-circle color-grey font-16 ml10 fl mt5"></i></a>
<a href="javascript:void(0);" title="删除" class="test_icon_remove"><i class="fa fa-times-circle color-grey font-16 ml10 fl mt5"></i></a>
</p>
<textarea class="task-form-50 task-height-40 mb10 fl panel-box-sizing" placeholder="测试输入" name="program[output][]"></textarea>
<textarea class="task-form-50 task-height-40 mb10 fl panel-box-sizing" placeholder="测试输入" name="program[input][]"></textarea>
<textarea class="task-form-45 task-height-40 mb10 fl ml10 panel-box-sizing" placeholder="测试输出" name="program[output][]" style="width:49%;"></textarea>
</li>
</script>
@ -156,6 +160,6 @@
<a href="javascript:void(0);" title="删除" class="sample_icon_remove"><i class="fa fa-times-circle color-grey font-16 ml10 fl mt5"></i></a>
</p>
<textarea class="task-form-100 task-height-40 mb10 panel-box-sizing" placeholder="样例输入" name="sample[input][]"></textarea>
<textarea class="task-form-100 task-height-40 mb10 panel-box-sizing" placeholder="样例输出" name="sample[input][]"></textarea>
<textarea class="task-form-100 task-height-40 mb10 panel-box-sizing" placeholder="样例输出" name="sample[output][]"></textarea>
</li>
</script>

View File

@ -1,14 +1,14 @@
<div class="task-popup" style="width:650px;">
<div class=" task-popup-title clearfix task-popup-bggrey">
<h3 class="fl ">选择实训</h3>
<a href="#" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
<div class="task-popup-title clearfix task-popup-bggrey">
<h3 class="fl">选择实训</h3>
<a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
</div>
<div class="task_popup_con ">
<%= labelled_form_for @homework, :url =>{:controller=> 'homework_common', :action => 'shixuns', :course => @course.id}, :method => "get", :remote => true do |f| %>
<div class="task_popup_con">
<%= labelled_form_for @homework, :url =>{:controller=> 'homework_common', :action => 'shixuns', :course => @course.id}, :id => 'shixun_search_form', :method => "get", :remote => true do |f| %>
<div class=" clearfix mb10">
<div class="task-form-50 edu-position fr" style="padding:0;">
<input class="task-form-100 panel-box-sizing" placeholder="输入实训名称的关键字搜索" type="text" name="search">
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt5"><i class="fa fa-search"></i></a>
<input class="task-form-100 panel-box-sizing" placeholder="输入实训名称的关键字搜索" type="text" name="search">
<a href="javascript:void(0);" onclick="$('#shixun_search_form').submit()" class="edu-btn-search font-16 color-grey mt5"><i class="fa fa-search"></i></a>
</div>
</div>
<% end %>
@ -37,9 +37,9 @@
</table>
<% end %>
<div class="clearfix">
<div class="clearfix fl mt10">
<a href="#" class="task-btn fr pop_close">取消</a>
<a href="javascript:void(0);" class=" task-btn task-btn-blue fr mr10" onclick="new_shixun_homework();">选择</a>
<div class="clearfix fr mt10">
<a href="javascript:void(0);" class="task-btn task-btn-blue fr" onclick="new_shixun_homework();">选择</a>
<a href="javascript:void(0);" class="task-btn fr pop_close mr10">取消</a>
</div>
<div class="fr pages_right_min">
<ul>

View File

@ -9,7 +9,7 @@
<ul>
<li class="clearfix edu-position">
<label class="panel-form-label fl mr10">&nbsp;</label>
<input class="magic-checkbox fl mt5" disabled type="checkbox" <%= @homework.anonymous_comment == 1 ? '' : 'checked' %>>
<input class="magic-checkbox fl mt5 magic-checkbox_show" disabled type="checkbox" <%= @homework.anonymous_comment == 1 ? '' : 'checked' %>>
<label class="fl">启用匿评</label>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">
<em></em>
@ -64,4 +64,30 @@
</li>
</ul>
</div>
</div>
</div>
<script>
function anon_cancel_edit(){
hideModal();
$('#show_anon_setting').show();
$('#edit_anon_setting').html("<%= j(render :partial => 'edit_anon_setting') %>").hide();
$("input[name='homework_evaluation_start']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false
});
$("input[name='homework_evaluation_end']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false
});
$("input[name='homework_appeal_time']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false
});
}
</script>

View File

@ -8,33 +8,38 @@
<div class="clearfix">
<ul>
<li class="clearfix mb20 edu-position">
<label class="task-height-40 fl mr10">是否允许在截止日期之后进行补交</label>
<span class="fl mr15">
<input class="magic-radio" type="radio" disabled value="1" <%= @homework.allow_late ? 'checked' : '' %>>
<label>允许</label>
</span>
<span class="fl mr15">
<input class="magic-radio" type="radio" disabled value="0" <%= @homework.allow_late ? '' : 'checked' %>>
<label>禁止</label>
</span>
<label class="panel-form-label fl mr10">作品补交</label>
<input class="magic-radio fl mt6" type="radio" disabled value="1" <%= @homework.allow_late ? 'checked' : '' %>>
<label class="fl mt6 mr30">允许补交</label>
<input class="magic-radio fl mt6" type="radio" disabled value="0" <%= @homework.allow_late ? '' : 'checked' %>>
<label class="fl mt6">禁止补交</label>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">
<em></em>
<span></span>
<p>允许补交,则在补交截止日期之前,学生可以修改作品和追加附件 <br/>
但是在发布截止时间 ~ 补交截止时间内才提交作品的学生,将被扣迟交分
</p>
<% if @homework.allow_late %>
<p>允许补交,则在结束日期之前,学生可以补交作品 <br/>
但是在提交截止时间之后才提交作品的学生,将被扣迟交分
</p>
<% else %>
<p>禁止补交,则在提交截止时间之后,学生不能再提交作品
</p>
<% end %>
</div>
</li>
</ul>
<ul class="<%= @homework.allow_late ? '' : 'none' %>">
<li class="clearfix mb15">
<label class="panel-form-label fl mr10">截止时间</label>
<input type="text" value="<%=format_time @homework.late_time %>" id="show_late_time" disabled class="fl task-form-15 task-height-40 panel-box-sizing disabled-bg" placeholder="选择补交截止时间" />
</li>
<ul>
<li class="clearfix mb15">
<label class="panel-form-label fl mr10">迟交扣分</label>
<input type="text" value="<%= @homework.late_penalty %>" disabled class="fl task-form-15 task-height-40 panel-box-sizing disabled-bg" placeholder="5" />
</li>
</ul>
</div>
</div>
</div>
<script>
function late_cancel_edit(){
hideModal();
$('#show_late_setting').show();
$('#edit_late_setting').html("<%= j(render :partial => 'edit_late_setting') %>").hide();
}
</script>

View File

@ -1,3 +1,12 @@
<style>
.magic-checkbox + label, .magic-radio + label{
top:0
}
.magic-radio + label:before, .magic-checkbox_show + label:before{
width: 16px;
height: 16px;
}
</style>
<div class="edu-con-top clearfix mb15">
<p class="ml15 fl">公开设置</p>
<% if @is_teacher %>
@ -10,25 +19,38 @@
<% if @homework.homework_type != 4 %>
<li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<input class="magic-checkbox fl mt5" type="checkbox" disabled <%= @homework.work_public ? 'checked' : '' %>>
<input class="magic-checkbox fl mt5 magic-checkbox_show" type="checkbox" disabled <%= @homework.work_public ? 'checked' : '' %>>
<label class="fl">公开作品</label>
<span class="fl color-grey">(选中则在作业结束时间之后对班级学生公开所有作品,否则作品不公开)</span>
</li>
<% end %>
<li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<input class="magic-checkbox fl mt5" type="checkbox" disabled <%= @homework.score_open == 1 ? 'checked' : '' %>>
<input class="magic-checkbox fl mt5 magic-checkbox_show" type="checkbox" disabled <%= @homework.score_open == 1 ? 'checked' : '' %>>
<label class="fl">公开成绩</label>
<span class="fl color-grey">(选中则在作业结束时间之后对班级学生公开作品成绩,否则成绩不公开)</span>
</li>
<% if @homework.homework_type != 4 %>
<li class="clearfix ">
<label class=" panel-form-label fl mr10">&nbsp;</label>
<input class="magic-checkbox fl mt5" type="checkbox" disabled <%= @homework.answer_public ? 'checked' : '' %>>
<input class="magic-checkbox fl mt5 magic-checkbox_show" type="checkbox" disabled <%= @homework.answer_public ? 'checked' : '' %>>
<label class=" fl">公开答案</label>
<span class=" fl color-grey">(选中则在作业结束时间之后对班级学生公开作业答案,否则答案不公开)</span>
</li>
<% end %>
</ul>
</div>
</div>
</div>
<script>
function score_cancel_edit(){
hideModal();
$('#show_score_setting').show();
$('#edit_score_setting').html("<%= j(render :partial => 'edit_score_setting') %>").hide();
}
function public_cancel_edit(){
hideModal();
$('#show_public_setting').show();
$('#edit_public_setting').html("<%= j(render :partial => 'edit_public_setting') %>").hide();
}
</script>

View File

@ -37,4 +37,52 @@
</li>
</ul>
</div>
</div>
</div>
<script>
function publish_cancel_edit(){
hideModal();
$('#show_publish_setting').show();
$('#edit_publish_setting').html("<%= j(render :partial => 'edit_publish_setting') %>").hide();
$("input[name='homework_publish_time']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false,
onSelectDate:function() {
$("#reset_publish_time").show();
if($.trim($("input[name='homework_archive_time']").val()) == ""){
var date = new Date(Date.parse($("input[name='homework_publish_time']").val().replace(/-/g, "/")));
$("input[name='homework_archive_time']").val(formate_time(new Date(date.setMonth(date.getMonth()+1))));
}
},
onSelectTime:function() {
$("#reset_publish_time").show();
if($.trim($("input[name='homework_archive_time']").val()) == ""){
var date = new Date(Date.parse($("input[name='homework_publish_time']").val().replace(/-/g, "/")));
$("input[name='homework_archive_time']").val(formate_time(new Date(date.setMonth(date.getMonth()+1))));
}
}
});
$("input[name='homework_end_time']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false,
onSelectDate:function() {
$("#reset_end_time").show();
},
onSelectTime:function() {
$("#reset_end_time").show();
}
});
$("input[name='homework_archive_time']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false
});
}
</script>

View File

@ -57,18 +57,14 @@
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5 task-form-30 ml20">
<label class="mr5">教师评分</label>
<select class="task-height-40 task-form-30 disabled-bg" disabled>
<option><%= (@homework_detail_manual.te_proportion * 100).to_i %>%</option>
</select>
<input type="text" class="task-height-40 task-form-30 panel-box-sizing disabled-bg" value="<%= (@homework_detail_manual.te_proportion * 100).to_i %>%" disabled>
</span>
</li>
<li class="clearfix ">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5 task-form-30 ml20">
<label class="mr5">助教评分</label>
<select class="task-height-40 task-form-30 disabled-bg" disabled>
<option><%= (@homework_detail_manual.ta_proportion * 100).to_i %>%</option>
</select>
<input type="text" class="task-height-40 task-form-30 panel-box-sizing disabled-bg" value="<%= (@homework_detail_manual.ta_proportion * 100).to_i %>%" disabled>
</span>
</li>
<% if @homework.homework_type == 2 %>
@ -76,9 +72,7 @@
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5 task-form-30 ml20">
<label class="mr5">系统评分</label>
<select class="task-height-40 task-form-30 disabled-bg" disabled>
<option><%= (@homework_detail_programing.ta_proportion * 100).to_i %>%</option>
</select>
<input type="text" class="task-height-40 task-form-30 panel-box-sizing disabled-bg" value="<%= (@homework_detail_programing.ta_proportion * 100).to_i %>%" disabled>
</span>
</li>
<li class="clearfix">
@ -126,4 +120,12 @@
</li>
</ul>
</div>
</div>
</div>
<script>
function score_cancel_edit(){
hideModal();
$('#show_score_setting').show();
$('#edit_score_setting').html("<%= j(render :partial => 'edit_score_setting') %>").hide();
}
</script>

View File

@ -1,4 +1,23 @@
$("#show_anon_setting").html("<%= j(render :partial => 'show_anon_setting') %>").show();
$("#show_score_setting").html("<%= j(render :partial => 'show_score_setting') %>");
$("#edit_score_setting").html("<%= j(render :partial => 'edit_score_setting') %>");
$("#edit_anon_setting").html("<%= j(render :partial => 'edit_anon_setting') %>").hide();
$("#edit_anon_setting").html("<%= j(render :partial => 'edit_anon_setting') %>").hide();
$("input[name='homework_evaluation_start']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false
});
$("input[name='homework_evaluation_end']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false
});
$("input[name='homework_appeal_time']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false
});

View File

@ -5,4 +5,44 @@ $("#homework_late_setting").html('<div id="show_late_setting"><%= j(render :part
$("#homework_anon_setting").html('<div id="show_anon_setting"><%= j(render :partial => 'show_anon_setting') %></div><div class="none" id="edit_anon_setting"><%= j(render :partial => 'edit_anon_setting') %></div>');
$("#homework_score_setting").html('<div id="show_score_setting"><%= j(render :partial => 'show_score_setting') %></div><div class="none" id="edit_score_setting"><%= j(render :partial => 'edit_score_setting') %></div>');
$("#homework_public_setting").html('<div id="show_public_setting"><%= j(render :partial => 'show_public_setting') %></div><div class="none" id="edit_public_setting"><%= j(render :partial => 'edit_public_setting') %></div>');
<% end %>
<% end %>
$("input[name='homework_publish_time']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false,
onSelectDate:function() {
$("#reset_publish_time").show();
if($.trim($("input[name='homework_archive_time']").val()) == ""){
var date = new Date(Date.parse($("input[name='homework_publish_time']").val().replace(/-/g, "/")));
$("input[name='homework_archive_time']").val(formate_time(new Date(date.setMonth(date.getMonth()+1))));
}
},
onSelectTime:function() {
$("#reset_publish_time").show();
if($.trim($("input[name='homework_archive_time']").val()) == ""){
var date = new Date(Date.parse($("input[name='homework_publish_time']").val().replace(/-/g, "/")));
$("input[name='homework_archive_time']").val(formate_time(new Date(date.setMonth(date.getMonth()+1))));
}
}
});
$("input[name='homework_end_time']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false,
onSelectDate:function() {
$("#reset_end_time").show();
},
onSelectTime:function() {
$("#reset_end_time").show();
}
});
$("input[name='homework_archive_time']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false
});

View File

@ -120,97 +120,4 @@
</div>
<% end %>
</div>
</div>
<script>
function publish_cancel_edit(){
hideModal();
$('#show_publish_setting').show();
$('#edit_publish_setting').html("<%= j(render :partial => 'edit_publish_setting') %>").hide();
$("input[name='homework_publish_time']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false,
onSelectDate:function() {
$("#reset_publish_time").show();
if($.trim($("input[name='homework_archive_time']").val()) == ""){
var date = new Date(Date.parse($("input[name='homework_publish_time']").val().replace(/-/g, "/")));
$("input[name='homework_archive_time']").val(formate_time(new Date(date.setMonth(date.getMonth()+1))));
}
},
onSelectTime:function() {
$("#reset_publish_time").show();
if($.trim($("input[name='homework_archive_time']").val()) == ""){
var date = new Date(Date.parse($("input[name='homework_publish_time']").val().replace(/-/g, "/")));
$("input[name='homework_archive_time']").val(formate_time(new Date(date.setMonth(date.getMonth()+1))));
}
}
});
$("input[name='homework_end_time']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false,
onSelectDate:function() {
$("#reset_end_time").show();
},
onSelectTime:function() {
$("#reset_end_time").show();
}
});
$("input[name='homework_archive_time']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false
});
}
function late_cancel_edit(){
hideModal();
$('#show_late_setting').show();
$('#edit_late_setting').html("<%= j(render :partial => 'edit_late_setting') %>").hide();
$("input[name='homework_late_time']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false
});
}
function anon_cancel_edit(){
hideModal();
$('#show_anon_setting').show();
$('#edit_anon_setting').html("<%= j(render :partial => 'edit_anon_setting') %>").hide();
$("input[name='homework_evaluation_start']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false
});
$("input[name='homework_evaluation_end']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false
});
$("input[name='homework_appeal_time']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false
});
}
function score_cancel_edit(){
hideModal();
$('#show_score_setting').show();
$('#edit_score_setting').html("<%= j(render :partial => 'edit_score_setting') %>").hide();
}
function public_cancel_edit(){
hideModal();
$('#show_public_setting').show();
$('#edit_public_setting').html("<%= j(render :partial => 'edit_public_setting') %>").hide();
}
</script>
</div>

View File

@ -3,8 +3,8 @@
<ul class="clearfix inner-footer-nav">
<li><a href="<%= home_path %>" class="fl" target="_blank">网站首页</a></li>
<li><a href="<%= agreement_path %>" class="fl" target="_blank">服务协议</a></li>
<li><%= link_to "支持", "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "fl", :target=>"_blank" %></li>
<li><a href="<%= forums_path %>" class="fl" target="_blank">社区</a></li>
<!-- <li><%#= link_to "支持", "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "fl", :target=>"_blank" %></li>
<li><a href="<%#= forums_path %>" class="fl" target="_blank">社区</a></li>-->
</ul>
<div class="cl"></div>
<div class="fl mt20" style="width:440px;height: 50px">

Some files were not shown because too many files have changed in this diff Show More