Merge branch 'develop' into dev_daiao

Conflicts:
	app/controllers/games_controller.rb
	app/views/challenges/edit.html.erb
	app/views/games/_game_show.html.erb
	public/stylesheets/css/edu-common.css
This commit is contained in:
daiao 2017-09-15 09:10:36 +08:00
commit ec22bbe0c1
145 changed files with 2406 additions and 1457 deletions

View File

@ -109,7 +109,9 @@ class AccountController < ApplicationController
if User.current.anonymous? if User.current.anonymous?
redirect_to signin_path redirect_to signin_path
else else
UserActions.create(:action_id => User.current.id, :action_type => "Logout", :user_id => User.current.id)
logout_user logout_user
# 记录用户登出行为
redirect_to signin_path redirect_to signin_path
end end
# display the logout form # display the logout form
@ -516,15 +518,19 @@ class AccountController < ApplicationController
end end
if @user.save && @se.save if @user.save && @se.save
@user.update_attributes(:professional_certification => 0) @user.update_attributes(:professional_certification => 0)
diskfile2 = disk_auth_filename('UserAuthentication', @user.id, 'PRO') if @se.identity == 1
diskfilePRO = diskfile2 + 'temp'
begin
FileUtils.mv diskfilePRO, diskfile2, force: true if File.exist? diskfilePRO
ensure
File.delete(diskfilePRO) if File.exist?(diskfilePRO)
end
if File.exist?(diskfile2)
ApplyUserAuthentication.create(:user_id => @user.id, :status => 0, :auth_type => 2) ApplyUserAuthentication.create(:user_id => @user.id, :status => 0, :auth_type => 2)
else
diskfile2 = disk_auth_filename('UserAuthentication', @user.id, 'PRO')
diskfilePRO = diskfile2 + 'temp'
begin
FileUtils.mv diskfilePRO, diskfile2, force: true if File.exist? diskfilePRO
ensure
File.delete(diskfilePRO) if File.exist?(diskfilePRO)
end
if File.exist?(diskfile2)
ApplyUserAuthentication.create(:user_id => @user.id, :status => 0, :auth_type => 2)
end
end end
end end
redirect_to professional_certification_account_path redirect_to professional_certification_account_path
@ -812,6 +818,8 @@ class AccountController < ApplicationController
call_hook(:controller_account_success_authentication_after, {:user => user }) call_hook(:controller_account_success_authentication_after, {:user => user })
code = /\d*/ code = /\d*/
# 记录用户登录行为
UserActions.create(:action_id => User.current.id, :action_type => "Login", :user_id => User.current.id)
#根据home_url生产正则表达式 #根据home_url生产正则表达式
eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/") eval("code = " + "/^" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index\\\/*.*)?\$/")
if (code=~params[:back_url] || params[:back_url].to_s.include?('lost_password')) && last_login_on != '' if (code=~params[:back_url] || params[:back_url].to_s.include?('lost_password')) && last_login_on != ''

View File

@ -219,12 +219,12 @@ class ApplicationController < ActionController::Base
# Logs out current user # Logs out current user
def logout_user def logout_user
if User.current.logged? if User.current.logged?
# if Redmine::Configuration['cookie_domain'].present? if Redmine::Configuration['cookie_domain'].present?
# cookies.delete(autologin_cookie_name, domain: 'www.educoder.net') logger.info("##########################{Redmine::Configuration['cookie_domain']}")
# cookies.delete(autologin_cookie_name, domain: 'educoder.trustie.net') cookies.delete(autologin_cookie_name, domain: Redmine::Configuration['cookie_domain'])
# else else
cookies.delete '_educoder_session' cookies.delete autologin_cookie_name
# end end
# Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin']) # Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin'])
self.logged_user = nil self.logged_user = nil
end end

View File

@ -44,30 +44,29 @@ class CoursesController < ApplicationController
@user = User.current @user = User.current
@search = params[:search].nil? ? '' : params[:search] @search = params[:search].nil? ? '' : params[:search]
@select = params[:select].nil? ? '' : params[:select] @select = params[:select].nil? ? '' : params[:select]
@is_end = params[:is_end].nil? ? 0 : params[:is_end].to_i # 是否归档
@is_over = params[:is_over] # 是否是新建课程页面跳转的查看归档 @is_over = params[:is_over] # 是否是新建课程页面跳转的查看归档
@syllabuses_num = Course.where("is_end = #{@is_end} and is_delete = 0").count @syllabuses_num = Course.all.count
#@syllabus_count = all_syllabuses.count #@syllabus_count = all_syllabuses.count
# 我创建的课堂 # 我创建的课堂
create_syllabuses = Course.where(:tea_id => @user.id) create_syllabuses = Course.where(:tea_id => @user.id)
# 我参与的课堂 # 我参与的课堂
join_syllabuses = @user.courses.where("is_delete = 0 and tea_id != #{@user.id}") join_syllabuses = @user.courses.where("is_delete = 0 and tea_id != #{@user.id}")
@join_syllabuses_count = join_syllabuses.where(:is_end => @is_end, :is_delete => 0).count @join_syllabuses_count = join_syllabuses.where(:is_end => 0, :is_delete => 0).count
@create_syllabuses_count = create_syllabuses.where(:is_end => @is_end, :is_delete => 0).count @create_syllabuses_count = create_syllabuses.where(:is_end => 0, :is_delete => 0).count
# 页面筛选的课程 # 页面筛选的课程
if @select == "create" if @select == "create"
@syllabuses = create_syllabuses.where("is_end = #{@is_end} and is_delete = 0 and name like '%#{@search}%'") @syllabuses = create_syllabuses.where("is_end = 0 and is_delete = 0 and name like '%#{@search}%'")
elsif @select == "join" elsif @select == "join"
@syllabuses = join_syllabuses.where("is_end = #{@is_end} and is_delete = 0 and tea_id != #{@user.id} and name like '%#{@search}%'") @syllabuses = join_syllabuses.where("is_end = 0 and is_delete = 0 and tea_id != #{@user.id} and name like '%#{@search}%'")
elsif @select == "end" elsif @select == "end"
# 归档的课堂 # 归档的课堂
end_syllabuses = Course.where("is_end = #{@is_end} and name like '%#{@search}%'") end_syllabuses = Course.where("is_end = 1 and name like '%#{@search}%'")
@syllabuses = end_syllabuses @syllabuses = end_syllabuses
else else
# 全部课堂 # 全部课堂
all_syllabuses = Course.where("is_end = #{@is_end} and is_delete = 0 and name like '%#{@search}%'") all_syllabuses = Course.where("is_end = 0 and is_delete = 0 and name like '%#{@search}%'")
@syllabuses = all_syllabuses @syllabuses = all_syllabuses
end end
@ -1849,9 +1848,9 @@ class CoursesController < ApplicationController
#sheet1.row(0).default_format = blue #sheet1.row(0).default_format = blue
#sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_class),l(:excel_f_score),l(:excel_commit_time)]) #sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_class),l(:excel_f_score),l(:excel_commit_time)])
sheet1[0,0] = "课程编号" sheet1[0,0] = "课程编号"
sheet1[0,1] = course.syllabus.id sheet1[0,1] = course.course_list_id
sheet1[1,0] = "课程名称" sheet1[1,0] = "课程名称"
sheet1[1,1] = course.syllabus.title sheet1[1,1] = course.course_list_name
sheet1[2,0] = "班级编号" sheet1[2,0] = "班级编号"
sheet1[2,1] = course.id sheet1[2,1] = course.id
sheet1[3,0] = "班级名称" sheet1[3,0] = "班级名称"
@ -1902,9 +1901,9 @@ class CoursesController < ApplicationController
homeworks.each_with_index do |home, i| homeworks.each_with_index do |home, i|
sheet = book.create_worksheet :name => "#{i+1}次作业" sheet = book.create_worksheet :name => "#{i+1}次作业"
sheet[0,0] = "课程编号" sheet[0,0] = "课程编号"
sheet[0,1] = course.syllabus.id sheet[0,1] = course.course_list_id
sheet[1,0] = "课程名称" sheet[1,0] = "课程名称"
sheet[1,1] = course.syllabus.title sheet[1,1] = course.course_list_name
sheet[2,0] = "班级编号" sheet[2,0] = "班级编号"
sheet[2,1] = course.id sheet[2,1] = course.id
sheet[3,0] = "班级名称" sheet[3,0] = "班级名称"

View File

@ -600,7 +600,7 @@ class FilesController < ApplicationController
attachment.save attachment.save
resource_bank = ResourceBank.create(:course_id => @course.id, :attachment_id => attachment.id, :filename => attachment.filename, :disk_filename => attachment.disk_filename, :filesize => attachment.filesize, :digest => attachment.digest, :downloads => 0, resource_bank = ResourceBank.create(:course_id => @course.id, :attachment_id => attachment.id, :filename => attachment.filename, :disk_filename => attachment.disk_filename, :filesize => attachment.filesize, :digest => attachment.digest, :downloads => 0,
:user_id => attachment.author_id, :description => attachment.description, :disk_directory => attachment.disk_directory, :is_public => attachment.is_public, :copy_from => attachment.copy_from, :user_id => attachment.author_id, :description => attachment.description, :disk_directory => attachment.disk_directory, :is_public => attachment.is_public, :copy_from => attachment.copy_from,
:quotes => 1, :applicable_syllabus => @course.syllabus.title, :major_level => @course.syllabus.major_level, :discipline_category_id => @course.syllabus.discipline_category_id, :first_level_discipline_id => @course.syllabus.first_level_discipline_id, :content_type => attachment.content_type) :quotes => 1, :applicable_syllabus => @course.course_list_name, :content_type => attachment.content_type)
attachment.update_column('resource_bank_id', resource_bank.id) attachment.update_column('resource_bank_id', resource_bank.id)
end end
end end

View File

@ -3,7 +3,7 @@ class GamesController < ApplicationController
layout "base_myshixun" layout "base_myshixun"
skip_before_filter :verify_authenticity_token, :only => [:file_update] skip_before_filter :verify_authenticity_token, :only => [:file_update]
before_filter :find_myshixun, :only => [:index] before_filter :find_myshixun, :only => [:index]
before_filter :find_game, :only => [:show, :game_build, :entry,:next_step, :outputs_show, :file_edit, :file_update, :get_waiting_time, before_filter :find_game, :only => [:show, :game_build, :entry,:next_step, :prev_step,:outputs_show, :file_edit, :file_update, :get_waiting_time,
:game_status, :change_status, :answer, :minus_score, :refresh_game_list, :reset_original_code, :reset_new_code, :evaluating_choice] :game_status, :change_status, :answer, :minus_score, :refresh_game_list, :reset_original_code, :reset_new_code, :evaluating_choice]
before_filter :find_repository, :only => [:show, :entry, :file_edit, :file_update, :reset_original_code, :reset_new_code, :html_show] before_filter :find_repository, :only => [:show, :entry, :file_edit, :file_update, :reset_original_code, :reset_new_code, :html_show]
before_filter :allowd_manager before_filter :allowd_manager
@ -94,7 +94,7 @@ class GamesController < ApplicationController
@language = @game_challenge.shixun.language @language = @game_challenge.shixun.language
error_position = had_test.blank? ? nil : had_test.select{|had_test| had_test.result == false}.last 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?}") logger.info("latest output id is #{error_position.id unless error_position.blank?}")
@latest_output = error_position.try(:out_put).gsub(/\n/, '<br />').gsub(/\t/, '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;').to_json unless error_position.try(:out_put).blank? @latest_output = error_position.try(:out_put).gsub(/\n/, '<br/>').gsub(/\t/, '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;').to_json unless error_position.try(:out_put).blank?
logger.info(@latest_output) logger.info(@latest_output)
respond_to do |format| respond_to do |format|
@ -156,13 +156,14 @@ class GamesController < ApplicationController
shixun_tomcat = Redmine::Configuration['shixun_tomcat'] shixun_tomcat = Redmine::Configuration['shixun_tomcat']
uri = "#{shixun_tomcat}/bridge/game/getWaitingTime" uri = "#{shixun_tomcat}/bridge/game/getWaitingTime"
params = {:tpiID => "#{@myshixun.id}"} params = {:tpiID => "#{@myshixun.id}"}
resubmit = @_params['resubmit']
res = uri_exec uri, params res = uri_exec uri, params
if (res && res['code'] != 0) if (res && res['code'] != 0)
@message = "实训云平台繁忙繁忙等级94" @message = "实训云平台繁忙繁忙等级94"
raise("实训云平台繁忙繁忙等级94") raise("实训云平台繁忙繁忙等级94")
end end
render :json => {:result => "success", :onRun => res['onRun'], :waitNum => res['waitNum'], :waitingTime => res['waitingTime'] } render :json => {:result => "success", :onRun => res['onRun'], :waitNum => res['waitNum'], :waitingTime => res['waitingTime'], :resubmit => resubmit }
#render :json => {:result => "success", :onRun => 1, :waitNum => 12, :waitingTime => 546 } #render :json => {:result => "success", :onRun => 0, :waitNum => 12, :waitingTime => 1234 }
rescue Exception => e rescue Exception => e
render :json => {:result => "failed"} render :json => {:result => "failed"}
end end
@ -276,7 +277,8 @@ class GamesController < ApplicationController
@had_passed_testsests_public_count = had_test.blank? ? 0 : had_test.select{|had_test| had_test.result == true && had_test.is_public == true}.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? || shixun.status <= 1) ? 0 : @game.final_score.to_i) @final_score = ((@game.answer_open? || shixun.status <= 1) ? 0 : @game.final_score.to_i)
error_position = had_test.blank? ? nil : had_test.select{|had_test| had_test.result == false}.last 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? @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?
logger.info("@compile_success###################{@compile_success}")
@language = game_challenge.shixun.language @language = game_challenge.shixun.language
render :json => {test_sets: total_test_sets, render :json => {test_sets: total_test_sets,
test_sets_count: @test_sets_count, test_sets_count: @test_sets_count,
@ -292,7 +294,9 @@ class GamesController < ApplicationController
had_done: had_done, had_done: had_done,
language: @language, language: @language,
score: score, score: score,
tag_count: tag_count} tag_count: tag_count,
position: game_challenge.position
}
end end
# 选择题评测(选择题不需要重新评测) # 选择题评测(选择题不需要重新评测)
@ -379,6 +383,13 @@ class GamesController < ApplicationController
end end
end end
def prev_step
prev_game = @game.prev_game
respond_to do |format|
format.js{ redirect_to myshixun_game_path(prev_game, :myshixun_id => @myshixun)}
end
end
# 获取答案,第一次查看需扣掉该关卡的积分 # 获取答案,第一次查看需扣掉该关卡的积分
# 如果已看过,下次可以免费查看 # 如果已看过,下次可以免费查看
# viewed 1: 直接查看 2弹框提示将要扣除积分确定后显示内容 3弹框提示分数不够 # viewed 1: 直接查看 2弹框提示将要扣除积分确定后显示内容 3弹框提示分数不够
@ -504,8 +515,9 @@ class GamesController < ApplicationController
output = Output.where(:game_id => @game.id, :test_set_position => test_set.position).first output = Output.where(:game_id => @game.id, :test_set_position => test_set.position).first
actual_output = (output.try(:actual_output).gsub(/\n/, '<br/>').gsub(/\t/, '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;') unless output.try(:actual_output).blank?) actual_output = (output.try(:actual_output).gsub(/\n/, '<br/>').gsub(/\t/, '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;') unless output.try(:actual_output).blank?)
result = output.try(:result) result = output.try(:result)
compile_success = (actual_output.blank? || !actual_output.downcase.match(/error/).blank?) ? 0 : 1
public_result = {:is_public => (test_set.is_public ? 1 : 0), :result => result, :input => test_set.input, public_result = {:is_public => (test_set.is_public ? 1 : 0), :result => result, :input => test_set.input,
:actual_output => actual_output, :output => test_set.output} :actual_output => actual_output, :output => test_set.output, :compile_success => compile_success}
logger.info("1111#################################{public_result.to_json}") logger.info("1111#################################{public_result.to_json}")
test_result << public_result.to_json test_result << public_result.to_json
end end

View File

@ -5,6 +5,7 @@ class HomeworkCommonController < ApplicationController
layout "base_courses" layout "base_courses"
include StudentWorkHelper include StudentWorkHelper
include ApplicationHelper
before_filter :find_course, :only => [:index,:new,:create] before_filter :find_course, :only => [:index,:new,:create]
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set, before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,
:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works, :set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works,
@ -250,7 +251,7 @@ class HomeworkCommonController < ApplicationController
@homework_detail_programing.ta_proportion = 0 if @homework_detail_programing @homework_detail_programing.ta_proportion = 0 if @homework_detail_programing
end end
if @homework_detail_manual.comment_status < 4 if @homework_detail_manual.comment_status < 4
if params[:homework_anonymous_appeal] if params[:homework_anonymous_comment] && params[:homework_anonymous_appeal]
@homework.anonymous_appeal = 1 @homework.anonymous_appeal = 1
@homework_detail_manual.appeal_time = params[:homework_appeal_time] if params[:homework_appeal_time] @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] @homework_detail_manual.appeal_penalty = params[:homework_appeal_penalty] if params[:homework_appeal_penalty]
@ -332,6 +333,14 @@ class HomeworkCommonController < ApplicationController
end end
if @homework.homework_type == 4 if @homework.homework_type == 4
if @homework_detail_manual.answer_open_evaluation != params[:answer_open_evaluation].to_i
@homework_detail_manual.answer_open_evaluation = params[:answer_open_evaluation].to_i
if @homework.end_time < Time.now
@homework.student_works.each do |student_work|
set_shixun_final_score @homework, student_work, @homework_detail_manual.answer_open_evaluation
end
end
end
@homework.score_open = params[:homework_score_open] ? 1 : 0 @homework.score_open = params[:homework_score_open] ? 1 : 0
else else
@homework.work_public = params[:homework_work_public] ? 1 : 0 @homework.work_public = params[:homework_work_public] ? 1 : 0

View File

@ -147,6 +147,15 @@ class ManagementsController < ApplicationController
end end
end end
# 用户修改界面
def update_user
@menu_type = 7
@sub_type = 1
respond_to do |format|
format.js
format.html
end
end
# 实训留言 # 实训留言
def shixun_feedback def shixun_feedback
@menu_type = 9 @menu_type = 9
@ -168,7 +177,7 @@ class ManagementsController < ApplicationController
# 专业列表 # 专业列表
def profession def profession
@major=Major.where("0=0") @major=Major.where("0=0")
@menu_type = 12 # @menu_type = 12
@sub_type = 1 @sub_type = 1
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order] @sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
major_level_option = params[:major_level] if params[:major_level] major_level_option = params[:major_level] if params[:major_level]
@ -224,9 +233,9 @@ class ManagementsController < ApplicationController
# 实训适用课程 # 实训适用课程
def applicable_course def applicable_course
@menu_type = 12 # @menu_type = 12
@sub_type = 2 @sub_type = 2
@major = Major.where(:major_level => 2) @major = Major.where(:major_level => 2,:support_shixuns => 1)
@courselist = CourseList.where("0=0") @courselist = CourseList.where("0=0")
search=params[:search] search=params[:search]
unless search.blank? unless search.blank?
@ -273,7 +282,8 @@ end
if search.blank? if search.blank?
@department = @department @department = @department
else else
@department = @department.where("name like '%#{search}%'") apply = School.where("name like '%#{search}%'").map(&:id)
@department = @department.where(:school_id => apply)
end end
@department = @department.reorder("created_at #{@sx_order}") @department = @department.reorder("created_at #{@sx_order}")
@department_count =@department.count @department_count =@department.count
@ -601,65 +611,53 @@ end
def classroom def classroom
@menu_type = 2 @menu_type = 2
@sub_type = 1 @sub_type = 1
@syllabus = Syllabus.where("0=0") @courselist = CourseList.where("0=0")
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order] @sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
major_level_option = params[:major_level] if params[:major_level]
discipline_category_option = params[:discipline_category_id] if params[:discipline_category_id]
first_level_discipline_option = params[:first_level_discipline_id] if params[:first_level_discipline_id]
syllabus_major_option = params[:major_id] if params[:major_id]
keyword = params[:keyword] keyword = params[:keyword]
search = params[:search] search = params[:search]
if major_level_option && major_level_option != '0' if params[:support_shixuns_search_title]
@syllabus = @syllabus.where(:major_level=>major_level_option) @courselist = @courselist.where(:support_shixuns_search => params[:support_shixuns_search_title].to_i)
end end
if discipline_category_option && discipline_category_option != '0'
@syllabus=@syllabus.where(:discipline_category_id=>discipline_category_option)
end
if first_level_discipline_option && first_level_discipline_option != '0'
@syllabus=@syllabus.where(:first_level_discipline_id=>first_level_discipline_option)
end
if syllabus_major_option && syllabus_major_option != '0'
@syllabus=@syllabus.where(:major_id=>syllabus_major_option)
end
if params[:school_id] && params[:school_id] != ''
@syllabus = @syllabus.includes(:user => {:user_extensions => []}).where("user_extensions.school_id = #{params[:school_id]}")
end
if search.blank? if search.blank?
@syllabus = @syllabus @courselist = @courselist
else else
if "u_name" == keyword if "u_name" == keyword
user_id = User.where("concat(lastname, firstname) like '%#{search}%'") user_id = User.where("concat(lastname, firstname) like '%#{search}%'")
@syllabus = @syllabus.includes(:user).where("concat(users.lastname, users.firstname) like '%#{search}%'") @courselist = @courselist.includes(:user).where("concat(users.lastname, users.firstname) like '%#{search}%'")
else else
@syllabus= @syllabus.where("title like '%#{search}%'") @courselist= @courselist.where("name like '%#{search}%'")
end end
end end
@courselist_count = @courselist.count
@syllabus = @syllabus.order("syllabuses.created_at #{@sx_order}")
@syllabus_count = @syllabus.count
limit = 20 limit = 20
@is_remote = true @is_remote = true
@syllabus_pages = Paginator.new @syllabus_count, limit, params['page'] || 1 @courselist_pages = Paginator.new @courselist_count, limit, params['page'] || 1
@offset ||= @syllabus_pages.offset @offset ||= @courselist_pages.offset
@syllabus = paginateHelper @syllabus, limit @courselist = paginateHelper @courselist, limit
# @courselist = @courselist.order("courselist.created_at #{@sx_order}")
respond_to do |format| respond_to do |format|
format.js format.js
format.html format.html
end end
end end
# 支撑实训检索
def support_shixuns_search
if params[:shixun_id]
courselist = CourseList.find params[:shixun_id]
courselist.update_attributes(:support_shixuns_search => !courselist.support_shixuns_search)
end
end
# 课堂列表 # 课堂列表
def classroom_classment def classroom_classment
@menu_type = 2 @menu_type = 2
@sub_type = 2 @sub_type = 2
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order] @sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
@courses = Course.where("0=0") @courses = Course.where("0=0")
@course_lists = CourseList.where(:id => @courses.where("course_list_id is not null").map(&:course_list_id))
@timing=Course.where(:is_end=>false).count @timing=Course.where(:is_end=>false).count
@end=Course.where(:is_end=>true).count @end=Course.where(:is_end=>true).count
unless params[:school_id] || params[:search] || params[:keyword] || params[:status] unless params[:school_id] || params[:search] || params[:keyword] || params[:status]
@ -669,6 +667,7 @@ end
@search = params[:search] # 搜索字 @search = params[:search] # 搜索字
@keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/课程名搜索 @keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/课程名搜索
status = params[:status].to_i status = params[:status].to_i
courselist = params[:course_list]
if params[:school_id] && params[:school_id] != '' if params[:school_id] && params[:school_id] != ''
@school_id = params[:school_id] @school_id = params[:school_id]
@ -679,6 +678,9 @@ end
@courses = @courses.where(:homepage_show => params[:homepage_show].to_i) @courses = @courses.where(:homepage_show => params[:homepage_show].to_i)
end end
if params[:course_list] && params[:course_list] != ''
@courses = @courses.where(:course_list_id => courselist)
end
if params[:status] && params[:status]!='' if params[:status] && params[:status]!=''
@status = params[:status] @status = params[:status]
@courses =@courses.where(:is_end =>status) @courses =@courses.where(:is_end =>status)
@ -803,25 +805,31 @@ end
# 0 全部1 活动的; 2 已注册; 3 锁定 # 0 全部1 活动的; 2 已注册; 3 锁定
def users def users
@menu_type =7 @menu_type
@sub_type = 1 @sub_type = 1
status = params[:user_status].nil? ? 0 : params[:user_status].to_i status = params[:user_status].nil? ? 0 : params[:user_status].to_i
@us_order = params[:us_order].blank? ? "desc" : params[:us_order] # 排序 @us_order = params[:us_order].blank? ? "desc" : params[:us_order] # 排序
@order_key = params[:order_key].blank? ? "created_on" : params[:order_key] # 排序关键字 @order_key = params[:order_key].blank? ? "last_login_on" : params[:order_key] # 排序关键字
condition = (params[:research_condition].nil? || params[:research_condition] == "name") ? "concat(lastname, firstname)" : params[:research_condition] condition = (params[:research_condition].nil? || params[:research_condition] == "name") ? "concat(lastname, firstname)" : params[:research_condition]
if 0 == status if 0 == status
if params[:research_condition] == "phone" && params[:research_contents].blank? if params[:research_condition] == "phone" && params[:research_contents].blank?
@users = User.order("#{@order_key} #{@us_order}").all @users = User.reorder("#{@order_key} #{@us_order}")
else else
@users = User.where("#{condition} like '%#{params[:research_contents]}%'").order("#{@order_key} #{@us_order}").all @users = User.where("#{condition} like '%#{params[:research_contents]}%'")
end end
else else
if params[:research_condition] == "phone" && params[:research_contents].blank? if params[:research_condition] == "phone" && params[:research_contents].blank?
@users = User.where(:status => status).order("#{@order_key} #{@us_order}").all @users = User.where(:status => status)
else else
@users = User.where("status = #{status} and #{condition} like '%#{params[:research_contents]}%'").order("#{@order_key} #{@us_order}").all @users = User.where("status = #{status} and #{condition} like '%#{params[:research_contents]}%'")
end end
end end
school_name = params[:school]
school = School.where("name like '%#{school_name}%'")
school_id = school.map(&:id)
user_id = UserExtensions.where(:school_id => school_id).map(&:user_id)
@users = @users.where(:id => user_id).reorder("#{@order_key} #{@us_order}")
@users_count = @users.count @users_count = @users.count
@limit = 20 @limit = 20
@is_remote = true @is_remote = true
@ -951,7 +959,7 @@ end
def users_trial def users_trial
@menu_type = 7 @menu_type = 7
@sub_type = 2 @sub_type = 2
@users = User.where(:status => 1).order("created_on desc").all @users = User.where(:status => 1).order("last_login_on desc").all
@users_count = @users.count @users_count = @users.count
@limit = 20 @limit = 20
@is_remote = true @is_remote = true
@ -1043,16 +1051,17 @@ end
user_id = s_user_id & d_user_id & apply_user_id user_id = s_user_id & d_user_id & apply_user_id
if params[:research_condition] == "name" if params[:research_condition] == "name"
@users = User.where(:id => user_id).where("concat(lastname, firstname) like '%#{params[:research_contents]}%'").order("created_on desc") @users = User.where(:id => user_id).where("concat(lastname, firstname) like '%#{params[:research_contents]}%'").order("last_login_on desc")
elsif params[:research_condition] == "email" elsif params[:research_condition] == "email"
@users = User.where(:id => user_id).where("mail like '%#{params[:research_contents]}%'").order("created_on desc") @users = User.where(:id => user_id).where("mail like '%#{params[:research_contents]}%'").order("last_login_on desc")
elsif params[:research_condition] == "phone" elsif params[:research_condition] == "phone"
@users = User.where(:id => user_id).where("phone like '%#{params[:research_contents]}%'").order("last_login_on desc")
elsif params[:research_condition] == "nickname"
if params[:research_contents].blank? if params[:research_contents].blank?
@users = User.where(:id => user_id).order("created_on desc") @users = User.where(:id => user_id).order("last_login_on desc")
else else
@users = User.where(:id => user_id).where("phone like '%#{params[:research_contents]}%'").order("created_on desc") @users = User.where(:id => user_id).where("nickname like '%#{params[:research_contents]}%'").order("last_login_on desc")
end end
end end
@users_count = @users.count @users_count = @users.count
@ -1147,7 +1156,9 @@ end
@type = trial_authorization_status(params[:type]) @type = trial_authorization_status(params[:type])
type = params[:type] || 0 # 存在type 就用type 没有就为 0 type = params[:type] || 0 # 存在type 就用type 没有就为 0
user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{params[:name]}%'") 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, :auth_type => 1).order("updated_at desc")
# @unapproved_user = ApplyUserAuthentication.where(:status => @type, :user_id => user_id, :auth_type => 1).find_by_sql("SELECT s.*, TIMESTAMPDIFF(SECOND, s.updated_at, now()) diff FROM `apply_user_authentications` s order by diff asc")
@unapproved_user = ApplyUserAuthentication.where(:status => @type, :user_id => user_id, :auth_type => 1).order("updated_at desc")
respond_to do |format| respond_to do |format|
format.html format.html
format.js format.js
@ -1160,6 +1171,7 @@ end
@type = trial_authorization_status(params[:type]) @type = trial_authorization_status(params[:type])
type = params[:type] || 0 # 存在type 就用type 没有就为 0 type = params[:type] || 0 # 存在type 就用type 没有就为 0
user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{params[:name]}%'") 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, :auth_type => 2).find_by_sql("SELECT s.*, TIMESTAMPDIFF(SECOND, s.updated_at, now()) diff FROM `apply_user_authentications` s order by diff asc")
@unapproved_user = ApplyUserAuthentication.where(:status => @type, :user_id => user_id, :auth_type => 2).order("updated_at desc") @unapproved_user = ApplyUserAuthentication.where(:status => @type, :user_id => user_id, :auth_type => 2).order("updated_at desc")
respond_to do |format| respond_to do |format|
format.html format.html
@ -1302,4 +1314,26 @@ end
format.js format.js
end end
end end
# 课程删除
before_filter :find_courselist, :only => [:destroy]
# 课程列表的删除
def destroy
if @courselist
CourseList.where(:id => @courselist.id).destroy_all
respond_to do |format|
format.js
end
end
end
private
# Find courselist of id params[:id]
def find_courselist
@courselist = CourseList.find_by_id(params[:id])
render_404 if @courselist.nil?
rescue ActiveRecord::RecordNotFound
render_404
end
end end

View File

@ -154,7 +154,7 @@ class MyController < ApplicationController
if @user.nickname.nil? || @user.lastname.nil? || ue.try(:identity).nil? || ue.try(:location).nil? || ue.try(:location).nil? if @user.nickname.nil? || @user.lastname.nil? || ue.try(:identity).nil? || ue.try(:location).nil? || ue.try(:location).nil?
@require_auth = true @require_auth = true
else else
if User.current.certification != 1 && (@trail_authentication.blank? || (@trail_authentication.status == 2 && (@trail_authentication.updated_at.to_i + 24*60*60) < Time.now.to_i)) if User.current.certification != 1 && (@trail_authentication.blank? || (@trail_authentication.status == 2 && (@trail_authentication.updated_at.to_i + 5*60) < Time.now.to_i))
@require_trail_auth = true @require_trail_auth = true
end end
end end

View File

@ -109,16 +109,18 @@ class MyshixunsController < ApplicationController
resubmit = jsonTestDetails['resubmit'] resubmit = jsonTestDetails['resubmit']
outPut = tran_base64_decode64(jsonTestDetails['outPut']) outPut = tran_base64_decode64(jsonTestDetails['outPut'])
jenkins_testsets = jsonTestDetails['msg'] jenkins_testsets = jsonTestDetails['msg']
compile_success = jsonTestDetails['compileSuccess']
# message = Base64.decode64(params[:msg]) unless params[:msg].blank? # message = Base64.decode64(params[:msg]) unless params[:msg].blank?
logger.info(outPut) logger.info(outPut)
logger.info("##################"+ compile_success)
game = Game.find(game_id) game = Game.find(game_id)
challenge = game.challenge challenge = game.challenge
unless jenkins_testsets.blank? unless jenkins_testsets.blank?
jenkins_testsets.each do |j_test_set| jenkins_testsets.each do |j_test_set|
actual_output = tran_base64_decode64(j_test_set['output']) actual_output = tran_base64_decode64(j_test_set['output'])
game_outputs = Output.create(:code => status, :game_id => game_id, :out_put => outPut, :test_set_position => j_test_set['caseId'], game_outputs = Output.create(:code => status, :game_id => game_id, :out_put => outPut, :test_set_position => j_test_set['caseId'],
:actual_output => actual_output, :result => j_test_set['passed'].to_i, :query_index => game.query_index) :actual_output => actual_output, :result => j_test_set['passed'].to_i, :query_index => game.query_index, :compile_success => compile_success.to_i)
logger.info("compile_success:"+ compile_success)
# output = Output.where(:game_id => game.id, :test_set_position => j_test_set['caseId'].to_i).first # output = Output.where(:game_id => game.id, :test_set_position => j_test_set['caseId'].to_i).first
# logger.info("#############{outPut}") # logger.info("#############{outPut}")
# if output.nil? # if output.nil?

View File

@ -144,8 +144,8 @@ class ShixunsController < ApplicationController
@shixun_my_score = Experience.find_by_sql("SELECT sum(score) as score FROM `experiences` where user_id=#{User.current.id}").first.try(:score).to_i @shixun_my_score = Experience.find_by_sql("SELECT sum(score) as score FROM `experiences` where user_id=#{User.current.id}").first.try(:score).to_i
@current_user_had_passed = Myshixun.find_by_sql("select count(*) as had_passed from myshixuns where status =1 and user_id=#{User.current.id} @current_user_had_passed = Myshixun.find_by_sql("select count(*) as had_passed from myshixuns where status =1 and user_id=#{User.current.id}
and shixun_id in (SELECT id FROM `shixuns` where status > 1)").first.try(:had_passed).to_i and shixun_id in (SELECT id FROM `shixuns` where status > 1)").first.try(:had_passed).to_i
@majors = Major.where(:id => [635, 636, 637, 638, 639, 622, 619]) #@majors = Major.where(:id => [635, 636, 637, 638, 639, 622, 619])
@courses = CourseList.where(:id => MajorCourse.where(:major_id => @majors.map(&:id)).map(&:course_list_id)) @courses = CourseList.where(:support_shixuns_search => 1)
@shixuns_count = @shixuns.count @shixuns_count = @shixuns.count
@limit = 16 @limit = 16
@is_remote = true @is_remote = true
@ -246,7 +246,7 @@ class ShixunsController < ApplicationController
@status = params[:status].to_i @status = params[:status].to_i
@shixun_status = params[:shixun_status] # 2是已发布 3是未发布 @shixun_status = params[:shixun_status] # 2是已发布 3是未发布
@search = params[:search] @search = params[:search]
@major = params[:major] #@major = params[:major]
@course = params[:course] @course = params[:course]
@trainee = params[:trainee] @trainee = params[:trainee]
#ids = Shixun.find_by_sql("select group_concat(id) as allId from shixuns where id in (SELECT distinct(shixun_id) FROM `challenges`)") #ids = Shixun.find_by_sql("select group_concat(id) as allId from shixuns where id in (SELECT distinct(shixun_id) FROM `challenges`)")
@ -254,18 +254,20 @@ class ShixunsController < ApplicationController
@shixuns = Shixun.where("hidden = 0") @shixuns = Shixun.where("hidden = 0")
@shixuns = @shixuns.where(:language => @language) unless @language.blank? @shixuns = @shixuns.where(:language => @language) unless @language.blank?
@shixuns = @shixuns.where("name like ?", "%#{@search}%") unless @search.blank? @shixuns = @shixuns.where("name like ?", "%#{@search}%") unless @search.blank?
if !@major.blank? # if !@major.blank?
@shixuns = @shixuns.where(:major_id => @major.to_i) # @shixuns = @shixuns.where(:major_id => @major.to_i)
@courses = CourseList.where(:id => MajorCourse.where(:major_id => @major).map(&:course_list_id)) # @courses = CourseList.where(:id => MajorCourse.where(:major_id => @major).map(&:course_list_id))
else # else
@courses = CourseList.where(:id => MajorCourse.where(:major_id => [635, 636, 637, 638, 639, 622, 619]).map(&:course_list_id)) # @courses = CourseList.where(:id => MajorCourse.where(:major_id => [635, 636, 637, 638, 639, 622, 619]).map(&:course_list_id))
end # end
if !@course.blank? && (@major.blank? || MajorCourse.where(:major_id => @major, :course_list_id => @course).count == 1) @courses = CourseList.where(:support_shixuns_search => 1)
@shixuns = @shixuns.where(:id => ShixunMajorCourse.where(:course_list_id => @course).map(&:shixun_id)) #if !@course.blank? && (@major.blank? || MajorCourse.where(:major_id => @major, :course_list_id => @course).count == 1)
end if !@course.blank?
if !@major.blank? && MajorCourse.where(:major_id => @major, :course_list_id => @course).count == 0 @shixuns = @shixuns.where(:id => ShixunMajorCourse.where(:course_list_id => @course).map(&:shixun_id))
@course = nil
end end
# if !@major.blank? && MajorCourse.where(:major_id => @major, :course_list_id => @course).count == 0
# @course = nil
# end
@shixuns = @shixuns.where(:trainee => @trainee) unless @trainee.blank? @shixuns = @shixuns.where(:trainee => @trainee) unless @trainee.blank?
case @status case @status
when 1, 0 when 1, 0
@ -381,19 +383,31 @@ class ShixunsController < ApplicationController
redirect_to myshixun_game_path(myshixun.current_task, :myshixun_id => myshixun) redirect_to myshixun_game_path(myshixun.current_task, :myshixun_id => myshixun)
return return
end end
repository = @shixun.repository
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
begin begin
@g = Gitlab.client shixun_tomcat = Redmine::Configuration['shixun_tomcat']
code = down_generate_identifier("myshixun")
myshixun = Myshixun.create!(:shixun_id => @shixun.id, :user_id => User.current.id, :identifier => code)
# fork版本库如果用户没有同步则先同步用户
g = Gitlab.client
if User.current.gid.nil? if User.current.gid.nil?
s = Trustie::Gitlab::Sync.new s = Trustie::Gitlab::Sync.new
s.sync_user(User.current) s.sync_user(User.current)
end end
gshixun = @g.fork(@shixun.gpid, User.current.gid) gshixun = g.fork(@shixun.gpid, User.current.gid)
logger.info("#############gshixun is #{gshixun}") if !gshixun.try(:id).blank?
if !gshixun.id.nil? myshixun.update_column(:gpid, gshixun.id) if myshixun.try(:gpid).blank? # 为了防止多次fork
# 防止fork多次的问题 rep = Repository.create!(:myshixun_id => myshixun.id, :identifier => gshixun.name,:project_id => -1, :shixun_id => -2)
myshixun = copy_myshixun(@shixun, gshixun) rep.update_column(:type, "Repository::Gitlab")
rep_url = Base64.urlsafe_encode64(git_shixun_url_ip @shixun, "educoder") # 注意educoder为默认给实训创建版本库的用户如果换成别的用户名字要相应的修改
uri = "#{shixun_tomcat}/bridge/game/openGameInstance"
params = {tpiID: "#{myshixun.id}", tpmID: "#{@shixun.id}", instanceGitURL:rep_url, operationEnvironment:"#{@shixun.try(:language)}"}
logger.info("openGameInstance params is #{params}")
res = uri_exec uri, params
if (res && res['code'].to_i != 0)
raise("实训云平台繁忙繁忙等级83")
end
# 其它操作
challenges = @shixun.challenges challenges = @shixun.challenges
# 之所以增加user_id是为了方便统计查询性能 # 之所以增加user_id是为了方便统计查询性能
challenges.each_with_index do |challenge, index| challenges.each_with_index do |challenge, index|
@ -420,7 +434,7 @@ class ShixunsController < ApplicationController
rescue Exception => e rescue Exception => e
flash[:error] = e.message flash[:error] = e.message
logger.info("failed to exec shixun: current task id is #{e}") logger.info("failed to exec shixun: current task id is #{e}")
@g.delete_project(gshixun.id) if !gshixun.id.nil? g.delete_project(gshixun.id) if !gshixun.id.nil?
redirect_to shixun_challenges_path(@shixun) redirect_to shixun_challenges_path(@shixun)
raise ActiveRecord::Rollback raise ActiveRecord::Rollback
end end
@ -463,14 +477,20 @@ class ShixunsController < ApplicationController
@shixun = Shixun.new(params[:shixun]) @shixun = Shixun.new(params[:shixun])
@shixun.user_id = User.current.id @shixun.user_id = User.current.id
@shixun.language = params[:language] @shixun.language = params[:language]
@shixun.major_id = params[:major_id] #@shixun.major_id = params[:major_id]
@shixun.trainee = params[:trainee] @shixun.trainee = params[:trainee]
@shixun.webssh = params[:webssh].to_i @shixun.webssh = params[:webssh].to_i
@shixun.identifier = identifier @shixun.identifier = identifier
if params[:course_id] # if params[:course_id]
params[:course_id].each do |course_id| # params[:course_id].each do |course_id|
@shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => params[:major_id], :course_list_id => course_id) # @shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => params[:major_id], :course_list_id => course_id)
end # end
# end
if CourseList.where(:name => params[:course_list].strip).count > 0
@shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => -1, :course_list_id => CourseList.where(:name => params[:course_list].strip).first.id)
else
course_list = CourseList.create(:name => params[:course_list].strip, :user_id => User.current.id, :is_admin => 0)
@shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => -1, :course_list_id => course_list.id)
end end
(params[:shixun][:is_public] == "1" ? @shixun.is_public = true : @shixun.is_public = false) (params[:shixun][:is_public] == "1" ? @shixun.is_public = true : @shixun.is_public = false)
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
@ -534,13 +554,23 @@ class ShixunsController < ApplicationController
@shixun.language = params[:language] @shixun.language = params[:language]
@shixun.trainee = params[:trainee] @shixun.trainee = params[:trainee]
@shixun.webssh = params[:webssh].to_i @shixun.webssh = params[:webssh].to_i
if params[:course_id] # if params[:course_id]
@shixun.shixun_major_courses.destroy_all # @shixun.shixun_major_courses.destroy_all
params[:course_id].each do |course_id| # params[:course_id].each do |course_id|
@shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => params[:major_id], :course_list_id => course_id) # @shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => params[:major_id], :course_list_id => course_id)
# end
# end
# @shixun.major_id = params[:major_id]
@shixun.shixun_major_courses.destroy_all
course_lists = params[:course_list].strip.split(",")
course_lists.each do |course|
if CourseList.where(:name => course).count > 0
@shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => -1, :course_list_id => CourseList.where(:name => course.strip).first.id)
else
course_list = CourseList.create(:name => course.strip, :user_id => User.current.id, :is_admin => 0)
@shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => -1, :course_list_id => course_list.id)
end end
end end
@shixun.major_id = params[:major_id]
params[:shixun][:is_public] == "on" ? @shixun.is_public = 1 : @shixun.is_public = 0 params[:shixun][:is_public] == "on" ? @shixun.is_public = 1 : @shixun.is_public = 0
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
begin begin
@ -654,6 +684,49 @@ class ShixunsController < ApplicationController
@mail = User.current.mail.blank? @mail = User.current.mail.blank?
end end
# 实训的发送至课堂:搜索课堂
def search_user_courses
@user = User.current
if !params[:search].nil?
search = "%#{params[:search].to_s.strip.downcase}%"
@courses = @user.courses.not_deleted_not_end.where("#{Course.table_name}.name like :p",:p=>search).select{|course| @user.has_teacher_role(course)}
else
@courses = @user.courses.not_deleted_not_end.select{|course| @user.has_teacher_role(course)}
end
@pages = Paginator.new @courses.count, 8, params['page'] || 1
@offset ||= @pages.offset
@courses = paginateHelper @courses, 8
respond_to do |format|
format.js
end
end
# 将实训发送到课程
def send_to_course
homework = HomeworkCommon.new
homework.name = @shixun.name
homework.description = @shixun.description
homework.anonymous_comment = 1
homework.homework_type = 4
homework.late_penalty = 0
homework.teacher_priority = 1
homework.user_id = User.current.id
homework.course_id = params[:course]
homework_detail_manual = HomeworkDetailManual.new
homework_detail_manual.te_proportion = 1.0
homework_detail_manual.ta_proportion = 0
homework_detail_manual.comment_status = 0
homework_detail_manual.evaluation_num = 0
homework_detail_manual.absence_penalty = 0
homework.homework_detail_manual = homework_detail_manual
if homework.save!
homework_detail_manual.save if homework_detail_manual
HomeworkCommonsShixuns.create(:homework_common_id => homework.id, :shixun_id => @shixun.id)
redirect_to setting_homework_common_path(homework, :is_new => 1)
end
end
private private
# REDO: 新增类型copy的时候 # REDO: 新增类型copy的时候
# 复制项目 # 复制项目

View File

@ -377,11 +377,11 @@ class StudentWorkController < ApplicationController
end end
#开放作品 || 老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表 #开放作品 || 老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表
if (@homework.is_open == 1 && User.current.member_of_course?(@course) && @homework.homework_detail_manual.comment_status == 6) || @is_teacher || User.current.admin? if (@homework.work_public && User.current.member_of_course?(@course) && @homework.homework_detail_manual.comment_status == 6) || @is_teacher || User.current.admin?
@stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}") @stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}")
@show_all = true @show_all = true
elsif User.current.member_of_course?(@course) elsif User.current.member_of_course?(@course)
if @homework.homework_detail_manual.comment_status == 1 || @homework.homework_detail_manual.comment_status == 2 #学生 && 未开启匿评 只看到自己的 if @homework.homework_detail_manual.comment_status == 1 || @homework.homework_detail_manual.comment_status == 2 || @homework.homework_detail_manual.comment_status == 5 || @homework.homework_detail_manual.comment_status == 6 #学生 && 未开启匿评 只看到自己的
if @homework.homework_type == 3 if @homework.homework_type == 3
my_work = @homework.student_works.where(:user_id => User.current.id) my_work = @homework.student_works.where(:user_id => User.current.id)
@stundet_works = !my_work.balnk? ? (my_work.first.group_id != 0 ? @homework.student_works.select("student_works.*,student_works.work_score as score").where(:group_id => my_work.first.group_id) : my_work) : [] @stundet_works = !my_work.balnk? ? (my_work.first.group_id != 0 ? @homework.student_works.select("student_works.*,student_works.work_score as score").where(:group_id => my_work.first.group_id) : my_work) : []
@ -391,14 +391,14 @@ class StudentWorkController < ApplicationController
elsif @homework.homework_detail_manual.comment_status == 3 || @homework.homework_detail_manual.comment_status == 4 #学生 && 开启匿评 看到匿评列表 elsif @homework.homework_detail_manual.comment_status == 3 || @homework.homework_detail_manual.comment_status == 4 #学生 && 开启匿评 看到匿评列表
my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id).first my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id).first
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id} @stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
elsif @homework.homework_detail_manual.comment_status == 5 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的 # elsif @homework.homework_detail_manual.comment_status == 5 || @homework.homework_detail_manual.comment_status == 6 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id).first # my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id).first
if !my_work || my_work.status == 0 # if !my_work || my_work.status == 0
@stundet_works = [] # @stundet_works = []
else # else
@stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}") # @stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}")
@show_all = true # @show_all = true
end # end
else else
@stundet_works = [] @stundet_works = []
end end
@ -408,11 +408,11 @@ class StudentWorkController < ApplicationController
end end
else else
if (@homework.is_open == 1 && User.current.member_of_course?(@course) && @homework.homework_detail_manual.comment_status == 6) || @is_teacher || User.current.admin? if (@homework.work_public && User.current.member_of_course?(@course) && @homework.homework_detail_manual.comment_status == 6) || @is_teacher || User.current.admin?
@stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").includes(:user => {:user_extensions => []}, :project => {}, :student_works_scores => {}).order("#{@order} #{@b_sort}") @stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").includes(:user => {:user_extensions => []}, :project => {}, :student_works_scores => {}).order("#{@order} #{@b_sort}")
@show_all = true @show_all = true
elsif User.current.member_of_course?(@course) elsif User.current.member_of_course?(@course)
if @homework.homework_detail_manual.comment_status == 1 || @homework.homework_detail_manual.comment_status == 2 #学生 && 未开启匿评 只看到自己的 if @homework.homework_detail_manual.comment_status == 1 || @homework.homework_detail_manual.comment_status == 2 || @homework.homework_detail_manual.comment_status == 5 || @homework.homework_detail_manual.comment_status == 6 #学生 && 未开启匿评 只看到自己的
if @homework.homework_type == 3 if @homework.homework_type == 3
my_work = @homework.student_works.where(:user_id => User.current.id) my_work = @homework.student_works.where(:user_id => User.current.id)
@stundet_works = !my_work.blank? ? (my_work.first.group_id != 0 ? @homework.student_works.select("student_works.*,student_works.work_score as score").where(:group_id => my_work.first.group_id) : my_work) : [] @stundet_works = !my_work.blank? ? (my_work.first.group_id != 0 ? @homework.student_works.select("student_works.*,student_works.work_score as score").where(:group_id => my_work.first.group_id) : my_work) : []
@ -422,14 +422,14 @@ class StudentWorkController < ApplicationController
elsif @homework.homework_detail_manual.comment_status == 3 || @homework.homework_detail_manual.comment_status == 4 #学生 && 开启匿评 看到匿评列表 elsif @homework.homework_detail_manual.comment_status == 3 || @homework.homework_detail_manual.comment_status == 4 #学生 && 开启匿评 看到匿评列表
my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id).first my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id).first
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id} @stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
elsif @homework.homework_detail_manual.comment_status == 5 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的 # elsif @homework.homework_detail_manual.comment_status == 5 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id).first # my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id).first
if !my_work || my_work.status == 0 # if !my_work || my_work.work_status == 0
@stundet_works = [] # @stundet_works = []
else # else
@stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").order("#{@order} #{@b_sort}") # @stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").order("#{@order} #{@b_sort}")
@show_all = true # @show_all = true
end # end
else else
@stundet_works = [] @stundet_works = []
end end

View File

@ -14,24 +14,35 @@ class SyllabusesController < ApplicationController
def index def index
@status = params[:type].nil? ? 1 : params[:type].to_i # 1表示正在进行2表示已结束 @status = params[:type].nil? ? 1 : params[:type].to_i # 1表示正在进行2表示已结束
@tab = params[:tab].nil? ? 1 : params[:tab].to_i
@my_syllabuses = "我的课堂"
user = User.current user = User.current
@my_syllabuses = user.syllabuses if @status == 1
case @tab
when 2
@courses = user.courses.not_deleted_not_end.order("updated_at desc").select{ |course| user.has_teacher_role(course)}
when 3
@courses = user.courses.not_deleted_not_end.order("updated_at desc").select{ |course| !user.has_teacher_role(course)}
when 1
@courses = user.courses.not_deleted_not_end.order("updated_at desc")
end
else
case @tab
when 2
@courses = user.courses.not_deleted_but_is_end.order("updated_at desc").select{ |course| user.has_teacher_role(course)}
when 3
@courses = user.courses.not_deleted_but_is_end.order("updated_at desc").select{ |course| !user.has_teacher_role(course)}
when 1
@courses = user.courses.not_deleted_but_is_end.order("updated_at desc")
end
end
archive_ids = Course.where("tea_id = #{user.id} and is_delete = 1 and syllabus_id is NOT NULL").blank? ? "(-1)" : "(" + Course.where("tea_id = #{user.id} and is_delete = 1 and syllabus_id is NOT NULL").map{|course| course.syllabus_id}.join(",") + ")" @limit = 15
@archive_syllabuses = Syllabus.where("id in #{archive_ids}") @is_remote = true
@courses_count = @courses.count
sy_courses = user.courses.visible.not_deleted @courses_pages = Paginator.new @courses_count, @limit, params['page'] || 1
syllabus_ids = sy_courses.empty? ? '(-1)' : "(" + sy_courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")" @offset ||= @courses_pages.offset
syllabus_members = SyllabusMember.where("user_id = #{user.id}") @courses = paginateHelper @courses, @limit
syllabus_member_ids = syllabus_members.empty? ? "(-1)" : "(" + syllabus_members.map{|syl_mem| syl_mem.syllabus_id}.join(',') + ")"
@join_syllabuses = Syllabus.where("(id in #{syllabus_ids} or id in #{syllabus_member_ids}) and user_id != #{user.id}")
@my_syllabuses = syllabus_course_list_sort @my_syllabuses
@join_syllabuses = syllabus_course_list_sort @join_syllabuses
@my_syllabuses = @my_syllabuses.sort{|x,y| y[:last_update] <=> x[:last_update]}
@join_syllabuses = @join_syllabuses.sort{|x,y| y[:last_update] <=> x[:last_update]}
@is_course = 1
respond_to do |format| respond_to do |format|
format.html{ render :layout => 'base_edu'} format.html{ render :layout => 'base_edu'}

View File

@ -683,17 +683,43 @@ class UsersController < ApplicationController
# 我发布的实训 # 我发布的实训
def shixuns def shixuns
@my_shixun = true @my_shixun = true
@type = params[:type] filter = params[:filter]
if @type == "1" if filter == "shixun_cooperative"
ids = Shixun.find_by_sql("select shixun_id from shixun_members where role=2 and user_id=#{@user.id}") # 合作者的实训id
id = Shixun.find_by_sql("select shixun_id from shixun_members where user_id=#{@user.id} and role = 2").map(&:shixun_id)
if @user == User.current
@shixuns = Shixun.where(:id => id).order("updated_at desc")
else
@shixuns = Shixun.where(:id => id).visible.order("updated_at desc")
end
elsif filter == "shixun_create"
if @user == User.current
@shixuns = Shixun.where(:user_id => @user).order("updated_at desc")
else
@shixuns = Shixun.where(:user_id => @user).visible.order("updated_at desc")
end
elsif filter == "shixun_challenge"
# 已挑战过
id = Shixun.find_by_sql("select id from shixuns where id in (select shixun_id from myshixuns where user_id = #{@user.id})")
if @user == User.current
@shixuns = Shixun.where(:id => id).order("updated_at desc")
else
@shixuns = Shixun.where(:id => id).visible.order("updated_at desc")
end
elsif
# 合作者及创建者
ids = Shixun.find_by_sql("select shixun_id from shixun_members where 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})") 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.shixun_id} unless ids.blank? ids = ids.map{|shixun| shixun.shixun_id} unless ids.blank?
ids2 = ids2.map{|shixun| shixun.id} unless ids2.blank? ids2 = ids2.map{|shixun| shixun.id} unless ids2.blank?
id = ids + ids2 id = ids + ids2
id = id.uniq id = id.uniq
@shixuns = Shixun.where(:id => id).order("updated_at desc") if @user == User.current
else @shixuns = Shixun.where(:id => id).order("updated_at desc")
@shixuns = Shixun.where(:user_id => @user.id).order("updated_at desc") else
@shixuns = Shixun.where(:id => id).visible.order("updated_at desc")
end
end end
@shixuns_count = @shixuns.count @shixuns_count = @shixuns.count
@limit = 10 @limit = 10

View File

@ -267,6 +267,26 @@ module ApplicationHelper
end end
end end
# 已通过的关卡数 返回int类型(包含查看参考答案的)
def had_passed_changllenge_num shixun, user
myshixun = Myshixun.where(:shixun_id => shixun.id, :user_id => user.id).first
if myshixun.nil?
0
else
myshixun.games.select{|game| game.status == 2}.count
end
end
# 已通过的关卡数 返回int类型(未查看参考答案)
def had_passed_no_ans_changllenge_num shixun, user
myshixun = Myshixun.where(:shixun_id => shixun.id, :user_id => user.id).first
if myshixun.nil?
0
else
myshixun.games.select{|game| game.status == 2 && !game.answer_open}.count
end
end
# TPI状态 :已通关、未通关、未开启 # TPI状态 :已通关、未通关、未开启
def my_shixun_status shixun, user def my_shixun_status shixun, user
status = "" status = ""
@ -338,18 +358,23 @@ module ApplicationHelper
day = time / 86400 day = time / 86400
hour = time % (24*60*60) / (60*60) hour = time % (24*60*60) / (60*60)
min = time % (24*60*60) % (60*60) / 60 min = time % (24*60*60) % (60*60) / 60
sec = time % (24*60*60) % (60*60) % 60
if day < 1 if day < 1
if hour < 1 if hour < 1
if time < 1 if min < 1
time = time == 0 ? "--" : "小于1分钟" if sec < 1
time = "--"
else
time = "#{sec}"
end
else else
time = "#{min} 分钟" time = "#{min}分钟 #{sec}"
end end
else else
time = "#{hour}小时 : #{min}" time = "#{hour}小时 #{min}#{sec}"
end end
else else
time = "#{day}#{hour}小时 #{min}" time = "#{day}#{hour}小时 #{min}#{sec}"
end end
return time return time
end end
@ -4716,6 +4741,7 @@ end
def get_hw_index(hw,is_teacher,type=0) def get_hw_index(hw,is_teacher,type=0)
homework_commons = hw.course.homework_commons homework_commons = hw.course.homework_commons
Rails.logger.info("----------------------------------------------"+hw.course.to_s)
if is_teacher if is_teacher
if type != 0 if type != 0
homeworks = homework_commons.where("homework_commons.homework_type = #{type}").order("created_at asc") homeworks = homework_commons.where("homework_commons.homework_type = #{type}").order("created_at asc")
@ -4729,7 +4755,8 @@ def get_hw_index(hw,is_teacher,type=0)
homeworks = homework_commons.where("publish_time <= '#{Time.now}'").order("created_at asc") homeworks = homework_commons.where("publish_time <= '#{Time.now}'").order("created_at asc")
end end
end end
hw_ids = homeworks.map{|hw| hw.id} if !homeworks.empty? Rails.logger.info("----------------------------------------------"+homeworks.count.to_s)
hw_ids = homeworks.map{|hw| hw.id} if !homeworks.blank?
index = hw_ids.index(hw.id) index = hw_ids.index(hw.id)
return index return index
end end
@ -4875,8 +4902,8 @@ end
def add_to_homework_bank_f homework def add_to_homework_bank_f homework
homework_bank = HomeworkBank.new(:name => homework.name, :description => homework.description, :user_id => User.current.id, :homework_type => homework.homework_type, homework_bank = HomeworkBank.new(:name => homework.name, :description => homework.description, :user_id => User.current.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.course_list_name, :homework_common_id => homework.id,
:reference_answer => homework.reference_answer, :syllabus_id => homework.course.syllabus_id) :reference_answer => homework.reference_answer, :course_list_id => homework.course.course_list_id)
if homework.homework_type == 2 && homework.homework_detail_programing if homework.homework_type == 2 && homework.homework_detail_programing
homework_bank.language = homework.homework_detail_programing.language homework_bank.language = homework.homework_detail_programing.language
homework.homework_tests.each_with_index do |homework_test| homework.homework_tests.each_with_index do |homework_test|
@ -5061,13 +5088,13 @@ def visable_course_homework course, type=0
if type != 0 if type != 0
homework_num = course.homework_commons.where(:homework_type => type).count homework_num = course.homework_commons.where(:homework_type => type).count
else else
homework_num = course.homework_commons.count homework_num = course.homework_commons.where(:homework_type => [1, 4]).count
end end
else else
if type != 0 if type != 0
homework_num = course.homework_commons.where(:homework_type => type).where("publish_time <= '#{Time.now}'").count homework_num = course.homework_commons.where(:homework_type => type).where("publish_time <= '#{Time.now}'").count
else else
homework_num = course.homework_commons.where("publish_time <= '#{Time.now}'").count homework_num = course.homework_commons.where("homework_type in (1, 4) and publish_time <= '#{Time.now}'").count
end end
end end
homework_num homework_num
@ -5198,6 +5225,17 @@ def set_final_score homework,student_work
end end
end end
# 实训作业的评分
def set_shixun_final_score homework, student_work, answer_open_evaluation
unless student_work.work_status == 0
shixun = homework.homework_commons_shixuns.shixun
passed_count = answer_open_evaluation ? had_passed_changllenge_num(shixun, student_work.user) : had_passed_no_ans_changllenge_num(shixun, student_work.user)
final_score =(passed_count.to_f / shixun.challenges.count) * 100
student_work.update_column("final_score", format("%.2f",final_score.to_f))
score = student_work.final_score - student_work.late_penalty
student_work.update_column("work_score", format("%.2f",(score < 0 ? 0 : score).to_f)) if score
end
end
def quote_resource_bank resource, course 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, atta = Attachment.new(:filename => resource.filename, :disk_filename => resource.disk_filename, :filesize => resource.filesize, :digest => resource.digest, :downloads => 0, :is_publish => 0,

View File

@ -99,32 +99,32 @@ module StudentWorkHelper
project = cur_user_projects_for_homework homework project = cur_user_projects_for_homework homework
if work.nil? && homework.end_time >= Time.now if work.nil? && homework.end_time >= Time.now
if homework.homework_type == 4 if homework.homework_type == 4
link_to "关联实战", relate_myshixun_student_work_index_path(:homework => homework.id),:class => 'task-btn task-btn-blue fr',:remote => true link_to "关联实战", relate_myshixun_student_work_index_path(:homework => homework.id),:class => 'task-btn task-btn-blue fr mr10 mt8',:remote => true
else else
link_to "提交作品", new_student_work_url_without_domain(homework.id),:class => 'task-btn task-btn-blue fr' link_to "提交作品", new_student_work_url_without_domain(homework.id),:class => 'task-btn task-btn-blue fr mr10 mt8'
end end
elsif work.nil? && homework.end_time < Time.now elsif work.nil? && homework.end_time < Time.now
if homework.allow_late && homework.homework_detail_manual.comment_status < 6 if homework.allow_late && homework.homework_detail_manual.comment_status < 6
if homework.homework_type == 4 if homework.homework_type == 4
link_to "关联实战", relate_myshixun_student_work_index_path(:homework => homework.id),:class => 'task-btn task-btn-blue fr',:remote => true link_to "关联实战", relate_myshixun_student_work_index_path(:homework => homework.id),:class => 'task-btn task-btn-blue fr mr10 mt8',:remote => true
else else
link_to "补交作品", new_student_work_url_without_domain(homework.id),:class => 'task-btn task-btn-blue fr' link_to "补交作品", new_student_work_url_without_domain(homework.id),:class => 'task-btn task-btn-blue fr mr10 mt8'
end end
end end
elsif work elsif work
if homework.homework_type == 4 if homework.homework_type == 4
myshixun = Myshixun.find work.myshixun_id myshixun = Myshixun.find work.myshixun_id
link_to "继续实战", myshixun_game_path(myshixun.current_task, :myshixun_id => myshixun), :class => "task-btn task-btn-blue fr mr10",:target => "_blank" if myshixun link_to "继续实战", myshixun_game_path(myshixun.current_task, :myshixun_id => myshixun), :class => "task-btn task-btn-blue fr mr10 mt8",:target => "_blank" if myshixun
else else
work_ids = "(" + homework.student_works.has_committed.map(&:id).join(",") + ")" work_ids = "(" + homework.student_works.has_committed.map(&:id).join(",") + ")"
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3 && User.current.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count > 0 #匿评作业,且作业状态不是在开启匿评之前 if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3 && User.current.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count > 0 #匿评作业,且作业状态不是在开启匿评之前
link_to "匿评作品", student_work_index_url_in_org(homework.id, 2), :class => 'task-btn task-btn-blue fr', :title => "开启匿评后不可修改作品" link_to "匿评作品", student_work_index_url_in_org(homework.id, 2), :class => 'task-btn task-btn-blue fr mr10 mt8', :title => "开启匿评后不可修改作品"
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status > 3 elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status > 3
link_to "查看作品", student_work_path(work), :class => 'task-btn task-btn-blue fr', :title => "匿评已结束" link_to "查看作品", student_work_path(work), :class => 'task-btn task-btn-blue fr mr10 mt8', :title => "匿评已结束"
elsif homework.end_time >= Time.now && work.user_id == User.current.id elsif homework.end_time >= Time.now && work.user_id == User.current.id
link_to "修改作品", edit_student_work_url_without_domain(work.id),:class => 'task-btn task-btn-blue fr' link_to "修改作品", edit_student_work_url_without_domain(work.id),:class => 'task-btn task-btn-blue fr mr10 mt8'
else else
link_to "查看作品", student_work_path(work), :class => 'task-btn task-btn-blue fr mt8 mr15', :title => "作业截止后不可修改作品" link_to "查看作品", student_work_path(work), :class => 'task-btn task-btn-blue fr mr10 mt8', :title => "作业截止后不可修改作品"
end end
end end
end end

View File

@ -63,6 +63,11 @@ class Challenge < ActiveRecord::Base
Challenge.where(:position => (self.position + 1), :shixun_id => self.shixun).first Challenge.where(:position => (self.position + 1), :shixun_id => self.shixun).first
end end
def prev_challenge
render_404 if self.position == 1
Challenge.where(:position => (self.position - 1), :shixun_id => self.shixun).first
end
def last_challenge def last_challenge
render_404 if self.position < 2 render_404 if self.position < 2
position = self.position - 1 position = self.position - 1

View File

@ -3,5 +3,5 @@ class CourseList < ActiveRecord::Base
has_many :shixun_major_courses has_many :shixun_major_courses
has_many :courses has_many :courses
belongs_to :user belongs_to :user
attr_accessible :name, :user_id, :is_admin attr_accessible :name, :user_id, :is_admin,:support_shixuns_search
end end

View File

@ -46,6 +46,14 @@ class Game < ActiveRecord::Base
return game return game
end end
def prev_game
challenge = self.challenge
prev_challenge_id = challenge.prev_challenge
game = Game.where(:myshixun_id => self.myshixun_id, :challenge_id => prev_challenge_id).first
render_404 if game.nil?
return game
end
# 获取game最新的一条输出结果 # 获取game最新的一条输出结果
def latest_output def latest_output
outputs = Output.where(:game_id => self.id).order("created_at desc") outputs = Output.where(:game_id => self.id).order("created_at desc")

View File

@ -126,7 +126,7 @@ class HomeworkCommon < ActiveRecord::Base
count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count
if count == 0 if count == 0
ws = WechatService.new ws = WechatService.new
name = self.course.syllabus.nil? ? self.course.name : self.course.syllabus.title+""+self.course.name name = self.course.course_list.nil? ? self.course.name : self.course.course_list_name+""+self.course.name
ws.homework_message_notice(m.user_id, "homework", self.id, "#{m.user.show_name}#{l(:label_new_homework_template)}", name, "新作业:"+ self.name.html_safe, "作业内容请点击“详情”查看。") ws.homework_message_notice(m.user_id, "homework", self.id, "#{m.user.show_name}#{l(:label_new_homework_template)}", name, "新作业:"+ self.name.html_safe, "作业内容请点击“详情”查看。")
end end
end end

View File

@ -1,7 +1,7 @@
#手动评分作业表 #手动评分作业表
#comment_status: 0挂起 1提交2补交去掉3匿评中4申诉中5评阅中6已结束 #comment_status: 0挂起 1提交2补交去掉3匿评中4申诉中5评阅中6已结束
class HomeworkDetailManual < ActiveRecord::Base class HomeworkDetailManual < ActiveRecord::Base
attr_accessible :ta_proportion, :comment_status, :evaluation_start, :evaluation_end, :evaluation_num, :absence_penalty, :homework_common_id, :no_anon_penalty attr_accessible :ta_proportion, :comment_status, :evaluation_start, :evaluation_end, :evaluation_num, :absence_penalty, :homework_common_id, :no_anon_penalty, :answer_open_evaluation
belongs_to :homework_common belongs_to :homework_common
end end

View File

@ -848,7 +848,7 @@ class Mailer < ActionMailer::Base
def lost_password(token, code="111111") def lost_password(token, code="111111")
set_language_if_valid(token.user.language) set_language_if_valid(token.user.language)
@login = token.user.try(:login) @login = token.user.show_real_name
@token = token @token = token
@code = code @code = code
mail :to => token.user.mail, mail :to => token.user.mail,

View File

@ -1,6 +1,6 @@
# status 1:完成实训 # status 1:完成实训
class Myshixun < ActiveRecord::Base class Myshixun < ActiveRecord::Base
attr_accessible :description, :name, :parent_id, :user_id, :gpid, :forked_from, :visits, :is_public, :identifier attr_accessible :description, :name, :parent_id, :user_id, :gpid, :forked_from, :visits, :is_public, :identifier, :shixun_id
# has_many :users, :through => :myshixun_members # has_many :users, :through => :myshixun_members
has_many :myshixun_members, :dependent => :destroy has_many :myshixun_members, :dependent => :destroy
has_one :repository, :dependent => :destroy has_one :repository, :dependent => :destroy
@ -32,7 +32,7 @@ class Myshixun < ActiveRecord::Base
time = 0 time = 0
self.games.each do |game| self.games.each do |game|
if game.status == 2 if game.status == 2
time += (game.end_time -game.open_time).to_i > 0 ? (game.end_time -game.open_time).to_i : 0 time += (game.end_time.to_i - game.open_time.to_i) > 0 ? (game.end_time.to_i - game.open_time.to_i) : 0
end end
end end
time time

View File

@ -1,6 +1,7 @@
class Output < ActiveRecord::Base class Output < ActiveRecord::Base
# attr_accessible :title, :body # attr_accessible :title, :body
# actual_output 编程题:实际输出, 选择题: 用户提交的答案(如: 014 对应用户选择为A B E # actual_output 编程题:实际输出, 选择题: 用户提交的答案(如: 014 对应用户选择为A B E
# compile_success 1 表示程序未报错,有正常输出, 0.表示程序抛异常了,报错!
default_scope :order => 'query_index desc' default_scope :order => 'query_index desc'
belongs_to :game belongs_to :game

View File

@ -56,7 +56,10 @@ class Repository < ActiveRecord::Base
'path_encoding', 'path_encoding',
'log_encoding', 'log_encoding',
'is_default', 'is_default',
'type' 'type',
'myshixun_id',
'shixun_id',
'project_id'
safe_attributes 'url', safe_attributes 'url',
:if => lambda {|repository, user| repository.new_record?} :if => lambda {|repository, user| repository.new_record?}

View File

@ -13,7 +13,7 @@ class StudentWork < ActiveRecord::Base
# course's message # course's message
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
has_many :attachments, :dependent => :destroy has_many :attachments, :dependent => :destroy
has_one :myshixun belongs_to :myshixun
scope :has_committed, lambda{where("work_status != 0 and work_status != 3")} scope :has_committed, lambda{where("work_status != 0 and work_status != 3")}
scope :all_commit, lambda{where("work_status != 0")} scope :all_commit, lambda{where("work_status != 0")}
@ -51,7 +51,7 @@ class StudentWork < ActiveRecord::Base
#成绩计算 #成绩计算
def set_final_score homework,student_work def set_final_score homework,student_work
if homework && homework.homework_detail_manual if homework && homework.homework_type != 4 && homework.homework_detail_manual
if homework.homework_type != 2 #非编程作业 if homework.homework_type != 2 #非编程作业
if homework.teacher_priority == 1 #教师优先 if homework.teacher_priority == 1 #教师优先
if student_work.teacher_score if student_work.teacher_score

View File

@ -574,10 +574,12 @@ class User < Principal
def identity def identity
ue = self.user_extensions ue = self.user_extensions
unless ue.blank? unless ue.blank?
if ue.technical_title.blank? if ue.identity == 0
ue.identity == 0 ? "老师" : (ue.identity == 1 ? "学生" : "专业人士") result = ue.technical_title ? ue.technical_title : "老师"
elsif ue.identity == 1
result = "学生"
else else
result = ue.technical_title result = ue.technical_title ? ue.technical_title : "专业人士"
end end
end end
end end

View File

@ -584,7 +584,7 @@ class CoursesService
type = "review_class_member" type = "review_class_member"
end end
name = course.syllabus.nil? ? course.name : course.syllabus.title+""+course.name name = course.course_list.nil? ? course.name : course.course_list_name+""+course.name
ws = WechatService.new ws = WechatService.new
ws.class_notice user.id, type, course.id, title,name, user.show_name, format_time(Time.now), content, remark,uid ws.class_notice user.id, type, course.id, title,name, user.show_name, format_time(Time.now), content, remark,uid
@ -689,7 +689,7 @@ class CoursesService
rolename = role_ids.include?("7") ? "助教" : "教师" rolename = role_ids.include?("7") ? "助教" : "教师"
content = current_user.show_name + "申请以"+rolename+"身份加入班级,等待您的审批。" content = current_user.show_name + "申请以"+rolename+"身份加入班级,等待您的审批。"
name = course.syllabus.nil? ? course.name : course.syllabus.title+""+course.name name = course.course_list.nil? ? course.name : course.course_list_name+""+course.name
ws = WechatService.new ws = WechatService.new
ws.class_notice tea_user.id, "review_class_member", course.id, "班级成员审批通知。", name, tea_user.show_name, format_time(Time.now), content, "点击查看申请详情。",current_user.id ws.class_notice tea_user.id, "review_class_member", course.id, "班级成员审批通知。", name, tea_user.show_name, format_time(Time.now), content, "点击查看申请详情。",current_user.id
end end

View File

@ -35,14 +35,14 @@
</select> </select>
<div class="cl"></div> <div class="cl"></div>
<span class="color-orange fl hint none" id="identity_hint" style="margin-left:90px;"><i class="fa fa-exclamation-circle mr5"></i>请选择你的职业/职称</span> <span class="color-orange fl hint none" id="identity_hint" style="margin-left:20%;"><i class="fa fa-exclamation-circle mr5"></i>请选择你的职业/职称</span>
</li> </li>
<li class="clearfix mt20" id="number"> <li class="clearfix mt20" id="number">
<label class="rz-label fl"><span class="color-red">*</span>学号:</label> <label class="rz-label fl"><span class="color-red">*</span>学号:</label>
<input type="text" nhname="tag_1" nh_tag_1="true" id="user_student_id" class="input-height select-width panel-box-sizing fl" name="no" value="<%= @user.user_extensions.student_id %>" placeholder="填写您的学号"> <input type="text" nhname="tag_1" nh_tag_1="true" id="user_student_id" class="input-height select-width panel-box-sizing fl" name="no" value="<%= @user.user_extensions.student_id %>" placeholder="填写您的学号">
<div class="cl"></div> <div class="cl"></div>
<span class="color-orange fl hint none" id="student_id_hint" style="margin-left:90px;"><i class="fa fa-exclamation-circle mr5"></i>学号不能为空</span> <span class="color-orange fl hint none" id="student_id_hint" style="margin-left:20%;"><i class="fa fa-exclamation-circle mr5"></i>学号不能为空</span>
</li> </li>
<li class="clearfix mt20"> <li class="clearfix mt20">
<label class="rz-label fl"><span class="color-red">*</span>单位名称:</label> <label class="rz-label fl"><span class="color-red">*</span>单位名称:</label>
@ -50,7 +50,7 @@
<input nhname="tag" nh_tag_4="true" class="fl" id="occupation" name="occupation" style="display: none;" type="text" value="<%= @user.user_extensions.school.try(:id) %>"/> <!-- 单位名称的test框选中下拉列表框的id --> <input nhname="tag" nh_tag_4="true" class="fl" id="occupation" name="occupation" style="display: none;" type="text" value="<%= @user.user_extensions.school.try(:id) %>"/> <!-- 单位名称的test框选中下拉列表框的id -->
<p id="no_school_hint" class="none fl ml10 mt8">你的单位不在列表中?请点击<a href="javascript:void(0);" class="link-color-blue">申请添加</a></p> <p id="no_school_hint" class="none fl ml10 mt8">你的单位不在列表中?请点击<a href="javascript:void(0);" class="link-color-blue">申请添加</a></p>
<div class="cl"></div> <div class="cl"></div>
<span class="color-orange fl none" id="school_name_hint" style="margin-left:90px;"><i class="fa fa-exclamation-circle mr5"></i>请从下拉列表中选择你的单位</span> <span class="color-orange fl none" id="school_name_hint" style="margin-left:20%;"><i class="fa fa-exclamation-circle mr5"></i>请从下拉列表中选择你的单位</span>
</li> </li>
<li class="clearfix mt20 <%= @user.user_extensions.school.blank? ? 'none' : '' %>" id="user_department_li"> <li class="clearfix mt20 <%= @user.user_extensions.school.blank? ? 'none' : '' %>" id="user_department_li">
<label class="rz-label fl">部门名称:</label> <label class="rz-label fl">部门名称:</label>
@ -61,7 +61,7 @@
</li> </li>
<li class="clearfix mt20"> <li class="clearfix mt20">
<label class="rz-label fl"><span class="color-red">*</span>职业证正面照:</label> <label class="rz-label fl"><span id="pro_cer_img_notice" class="color-red">*</span>职业证正面照:</label>
<%= file_field_tag 'avatar[image]', <%= file_field_tag 'avatar[image]',
:id => "upload_img_pro", :id => "upload_img_pro",
:style => 'display:none;',#added by young :style => 'display:none;',#added by young
@ -398,7 +398,37 @@
var title = "<%= "#{title}" %>"; var title = "<%= "#{title}" %>";
init_identity_and_title(document.getElementById('userIdentity'), identity, title); init_identity_and_title(document.getElementById('userIdentity'), identity, title);
$("#userIdentity").change(); if(identity == "1"){
$("#pro_cer_img_notice").html("");
}
$("#userIdentity").change(function(){
var option = $("#userIdentity option:selected");
if(option.val()=="1"){
$("#identity_hint").hide();
$("#number").show();
$("#user_student_id").show();
$("#teacher").hide();
$("#profession").hide();
$("#pro_cer_img_notice").html("");
}else if(option.val()=="2"){
$("#number").hide();
$("#user_student_id").hide();
$("#identity_hint").hide();
$("#teacher").hide();
$("#profession").show();
$("#pro_cer_img_notice").html("*");
}else if(option.val()=="0"){
$("#number").hide();
$("#user_student_id").hide();
$("#identity_hint").hide();
$("#profession").hide();
$("#teacher").show();
$("#pro_cer_img_notice").html("*");
}else{
$("#identity_hint").hide();
$("#pro_cer_img_notice").html("*");
}
});
var image = $("#nh_source_pro"); var image = $("#nh_source_pro");
var element = $("<a></a>").attr("href", image.attr('src')+".png"); var element = $("<a></a>").attr("href", image.attr('src')+".png");

View File

@ -1,4 +1,4 @@
<div class="task-pm-box mt20 mb20"> <div class="task-pm-box mt30 mb30 box_bg_shandow">
<div class="panel-header clearfix" style="height: 40px;border-bottom:0px;"> <div class="panel-header clearfix" style="height: 40px;border-bottom:0px;">
<h3 class="fl mt5 shixun_title">全部任务</h3> <h3 class="fl mt5 shixun_title">全部任务</h3>
<% if @challenges.count != 0 %> <% if @challenges.count != 0 %>

View File

@ -35,9 +35,7 @@
<li class="clearfix"> <li class="clearfix">
<p class="clearfix"> <p class="clearfix">
<span class="color-green fb">测试集<%= index + 1 %></span> <span class="color-green fb">测试集<%= index + 1 %></span>
<% if test.is_public? %> <% unless test.is_public? %>
<i class="fa fa-unlock-alt font-grey ml5" ></i>
<% else %>
<i class="fa fa-lock font-grey ml5" ></i> <i class="fa fa-lock font-grey ml5" ></i>
<% end %> <% end %>
</p> </p>
@ -62,5 +60,14 @@
$("#edit_task_pass").click(function(){ $("#edit_task_pass").click(function(){
$("#evaluating_edit").show(); $("#evaluating_edit").show();
$("#evaluating_show").hide(); $("#evaluating_show").hide();
// 设置textarea的宽度到140以后出现滚动条
var test_set_inputs = document.getElementsByName("test_set[input][]");
var test_set_outputs = document.getElementsByName("test_set[output][]");
if (test_set_inputs.length == test_set_outputs.length) {
for (var i = 0; i < test_set_inputs.length; i++) {
autoTextarea(test_set_inputs[i], 0, 140);
autoTextarea(test_set_outputs[i], 0, 140);
}
}
}) })
</script> </script>

View File

@ -157,15 +157,6 @@
}); });
}); });
// 设置textarea的宽度到140以后出现滚动条
var test_set_inputs = document.getElementsByName("test_set[input][]");
var test_set_outputs = document.getElementsByName("test_set[output][]");
if (test_set_inputs.length == test_set_outputs.length) {
for (var i = 0; i < test_set_inputs.length; i++) {
autoTextarea(test_set_inputs[i], 0, 140);
autoTextarea(test_set_outputs[i], 0, 140);
}
}
// 判断测试集是否锁定, 0未锁定1锁定 // 判断测试集是否锁定, 0未锁定1锁定
function test_set_whether_lock(){ function test_set_whether_lock(){
var lock = document.getElementsByName("test_set[lock][]"); var lock = document.getElementsByName("test_set[lock][]");

View File

@ -15,8 +15,8 @@
} }
</style> </style>
<div class="task-pm-content mb20"> <div class="task-pm-content" style = "margin:30px auto;">
<div class="task-pm-box mt20"> <div class="task-pm-box ">
<div class="panel-header clearfix user_bg_shadow" style="height: 40px;border-bottom:0px;padding:10px 15px 0px 15px;"> <div class="panel-header clearfix user_bg_shadow" style="height: 40px;border-bottom:0px;padding:10px 15px 0px 15px;">
<% if @st == 0 %> <% if @st == 0 %>
<span class="panel-inner-icon mr10 fl mt5"> <span class="panel-inner-icon mr10 fl mt5">
@ -56,9 +56,9 @@
<li class="fl <%= @tab == 3 ? "check_nav" : "" %>"> <li class="fl <%= @tab == 3 ? "check_nav" : "" %>">
<a href="<%= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => 3) %>" class="color-black">参考答案</a> <a href="<%= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => 3) %>" class="color-black">参考答案</a>
</li> </li>
<!-- <li class="fl <%#= @tab == 6 ? "check_nav" : "" %> <li class="fl <%= @tab == 6 ? "check_nav" : "" %>
<a href="<%#= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => 6) %>" class="color-black">预备知识</a> <a href="<%= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => 6) %>" class="color-black">预备知识</a>
</li>--> </li>
<li class="fl <%= @tab == 4 ? "check_nav" : "" %>"> <li class="fl <%= @tab == 4 ? "check_nav" : "" %>">
<a href="<%= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => 4) %>" class="color-black">评分设置</a> <a href="<%= edit_shixun_challenge_path(@challenge, :shixun_id => @shixun, :tab => 4) %>" class="color-black">评分设置</a>
</li> </li>
@ -77,8 +77,8 @@
<%= render :partial => "edit_scoring" %> <%= render :partial => "edit_scoring" %>
<% elsif @tab == 5 %> <% elsif @tab == 5 %>
<%= render :partial => "edit_skill" %> <%= render :partial => "edit_skill" %>
<%# elsif @tab == 6 %> <% elsif @tab == 6 %>
<%#= render :partial => "edit_propaedeutics" %> <%= render :partial => "edit_propaedeutics" %>
<% end %> <% end %>
</div> </div>
</div> </div>
@ -88,4 +88,20 @@
</div> </div>
<div class="save-tip"> <div class="save-tip">
<div class="save-tip-content">已保存</div> <div class="save-tip-content">已保存</div>
</div> </div>
<script>
$(function(){
<% if @tab >0 %>
$("#shixun_tab").addClass("active");
<% end %>
<% if notice && @tab == 5 %>
<% notice = nil %>
$(".save-tip").show();
setTimeout(function(){
$(".save-tip").hide();
}, 2000);
<% end %>
})
</script>

View File

@ -8,9 +8,9 @@
</style> </style>
<div class="task-pm-content"> <div class="task-pm-content">
<% if @shixun.status == 1 && (User.current.manager_of_shixun?(@shixun) || User.current.admin?) %> <% if @shixun.status == 1 && (User.current.manager_of_shixun?(@shixun) || User.current.admin?) %>
<div class="alert alert-orange mb15 mt15">正在等待管理员的审核。如果需要编辑更新,请先撤销发布</div> <div class="alert alert-orange mb15 mt15">正在等待管理员的审核。如果需要重新编辑评测设置,请先撤销发布 </div>
<% end %> <% end %>
<div class="task-pm-box mt20"> <div class="task-pm-box mt30 box_bg_shandow">
<div class="panel-header"> <div class="panel-header">
<h3 class="shixun_title" style="height:40px;line-height:40px;">简介</h3> <h3 class="shixun_title" style="height:40px;line-height:40px;">简介</h3>
</div> </div>

View File

@ -1,6 +1,6 @@
<%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c" %> <%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c" %>
<%= stylesheet_link_tag "/assets/codemirror/codemirror" %> <%= stylesheet_link_tag "/assets/codemirror/codemirror" %>
<div class="task-pm-box mt20"> <div class="task-pm-box mt30 mb30 box_bg_shandow bor-grey-e ">
<div class="panel-header clearfix"> <div class="panel-header clearfix">
<h3 class="fl mt5">新建阶段</h3> <h3 class="fl mt5">新建阶段</h3>
</div> </div>
@ -12,5 +12,8 @@
</ul> </ul>
</div> </div>
</div> </div>
<script>
$("#shixun_tab").addClass("active");
</script>

View File

@ -9,7 +9,7 @@
<% end %> <% end %>
<% sy_author = User.find(sy.tea_id) %> <% sy_author = User.find(sy.tea_id) %>
<div class="task-index-list-box-top"> <div class="task-index-list-box-top">
<a href="<%= course_path(sy) %>" title="<%= sy.name %>" target="_blank"> <a href="<%= course_path(sy) %>" target="_blank">
<p class="font-14 task-index-list-title two_lines_show"> <p class="font-14 task-index-list-title two_lines_show">
<%= sy.name %> <%= sy.name %>
</p> </p>
@ -58,7 +58,7 @@
</div> </div>
</div> </div>
<% else %> <% else %>
<div class="edu-tab-con-box edu-tab-con-box user_bg_shadow"> <div class="edu-tab-con-box edu-tab-con-box box_bg_shandow bor-grey-e">
<img src="../images/bigdata/edu-class/edu-nodata.png" class="edu-nodata-img"> <img src="../images/bigdata/edu-class/edu-nodata.png" class="edu-nodata-img">
<p class="edu-nodata-p mb30">没有数据可以显示!</p> <p class="edu-nodata-p mb30">没有数据可以显示!</p>
</div> </div>

View File

@ -1,33 +1,17 @@
<form action="<%= courses_path(:select => @select, :is_end => @is_end) %>" data-remote="true" class="fl ml15" id="search_syllabuses_name" > <form action="<%= courses_path(:select => @select) %>" data-remote="true" class="fr ml15" id="search_syllabuses_name" >
<div class="searchFor fr" style="margin-top: -3px"> <div class="searchFor fr" style="margin-top: -3px">
<div class="searchCon"> <div class="searchCon">
<input type="text" class="searchinput" name="search" value="<%= @search %>" placeholder="请输入实训名称的关键字进行搜索" style="background: none;"/> <input type="text" class="searchinput" name="search" value="<%= @search %>" placeholder="请输入课堂名称的关键字进行搜索" style="background: none;"/>
<i class="fa fa-close mr5 color-dark-grey" onclick="colse_searchbox();" title="搜索"></i> <i class="fa fa-close mr5 color-dark-grey" onclick="colse_searchbox();" title="搜索"></i>
</div> </div>
<i class="fa fa-search mr5 color-dark-grey search_icon" onclick="search_shixun()" style="margin:10px" title="搜索"></i> <i class="fa fa-search mr5 color-dark-grey search_icon" onclick="$('#search_syllabuses_name').submit();" style="margin:10px" data-tip-down="搜索"></i>
</div> </div>
</form> </form>
<script> <script>
//搜索实训 //清空搜索框
function search_shixun(){
if($(".searchCon").is(":visible")){
$("#search_syllabuses_name").submit();
} else{
$(".searchCon").show();
}
}
//关闭搜索框
function colse_searchbox(){ function colse_searchbox(){
$('.searchCon').hide(); $('.searchinput').val('');
if($('.searchinput').val().trim() != ""){ $("#search_syllabuses_name").submit();
$('.searchinput').val('');
$("#search_syllabuses_name").submit();
}
} }
$(function(){
<% if @search != "" %>
$(".searchCon").show();
<% end %>
});
</script> </script>

View File

@ -1,22 +1,31 @@
<div class="active-class"> <div class="active-class">
<div class="task-index-head mt30 mb30 bor-grey-e"> <div class="task-index-head mt30 mb30 bor-grey-e">
<div class="task-index-head-top-course"> <div class="" style="position: relative" >
<h2 class="fl task-inde-head-title">在线课堂</h2> <h2 class="fl task-inde-head-title">
<canvas id="myCanvas" ></canvas>
<div class="logo" border="0"></div>
</h2>
<h2 class="fl task-inde-head-title" style="position: absolute;left:550px;top: 25px;letter-spacing:0.8em;text-shadow: 0 1px 2px #000;">
在线课堂
</h2>
<p class="fl task-inde-head-title" style="position: absolute;left:420px;top:65px;text-shadow: 0 1px 2px #000;">
One who is anxious to learn, can always learn from others.
</p>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<ul class="task-index-head-info clearfix"> <ul class="task-index-head-info clearfix">
<li><span class="color-orange font-bd" id="all_syllabuses"><%= @syllabuses_num %></span><br/><span >全部</span></li> <li><span class="color-orange font-bd" id="all_syllabuses"><%= @syllabuses_num %></span><br/><span >全部</span></li>
<li><span class="color-orange font-bd" id="my_syllabuses"><%= @create_syllabuses_count + @join_syllabuses_count %></span><br/><span>我的课堂</span></li> <li><span class="color-orange font-bd" id="my_syllabuses"><%= @create_syllabuses_count + @join_syllabuses_count %></span><br/><span>我的课堂</span></li>
<%= link_to "+&nbsp;新建".html_safe, new_course_path, :class => "color-light-green fr font-16" , :style => "line-height:56px"%> <%= link_to "+&nbsp;新建".html_safe, new_course_path, :class => "fr font-16 white-btn orange-btn mt10" %>
<%= link_to "+&nbsp;加入课堂".html_safe, join_private_courses_courses_path, :remote => true, :method => "post", :class => "color-light-green fr mr30 font-16" , :style => "line-height:56px" %> <%= link_to "+&nbsp;加入课堂".html_safe, join_private_courses_courses_path, :remote => true, :method => "post", :class => "fr mr30 font-16 white-btn orange-btn mt10" %>
<!-- <li><span class="color-orange font-bd"><%#= @create_syllabuses_count %></span><br/><span>你已创建</span></li>--> <!-- <li><span class="color-orange font-bd"><%#= @create_syllabuses_count %></span><br/><span>你已创建</span></li>-->
</ul> </ul>
</div> </div>
<div class="clearfix mb15 fl"> <div class="clearfix mb15 fl" style="width:100%;">
<a href="<%= courses_path(:select => "all", :is_end => @is_end,:search => @search) %>" id="courses_index_syllabuses_1" class="course_filtrate fl course_filtrate_bg" data-tab="all" data-remote="true">全部课堂</a> <a href="<%= courses_path(:select => "all",:search => @search) %>" id="courses_index_syllabuses_1" class="edu-filter-cir-grey mr20 active fl" data-tab="all" data-remote="true">全部课堂</a>
<a href="<%= courses_path(:select => "create", :is_end => @is_end, :search => @search) %>" id="courses_index_syllabuses_2" class="course_filtrate fl" data-tab="create" data-remote="true">我管理的</a> <a href="<%= courses_path(:select => "create", :search => @search) %>" id="courses_index_syllabuses_2" class="edu-filter-cir-grey mr20 fl" data-tab="create" data-remote="true">我管理的</a>
<a href="<%= courses_path(:select => "join", :is_end => @is_end, :search => @search) %>" id="courses_index_syllabuses_3" class="course_filtrate fl" data-tab="join" data-remote="true">我参与的</a> <a href="<%= courses_path(:select => "join", :search => @search) %>" id="courses_index_syllabuses_3" class="edu-filter-cir-grey mr20 fl" data-tab="join" data-remote="true">我参与的</a>
<a href="<%= courses_path(:select => "end") %>" id="courses_index_syllabuses_4" class="edu-filter-cir-grey fl" data-tab="end" data-remote="true">查看归档</a>
<!-- <li class="edu-dropdown fl ml15 mr5" id="thirdly_select" style="width: 100px"> <!-- <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 ml20"></i></a> <a href="javascript:void(0);" class="edu-dropdown-toggle" id="all_syllabuses" >所有课程<i class="fa fa-caret-down ml20"></i></a>
@ -29,24 +38,29 @@
<%= render :partial => "course_index_search" %> <%= render :partial => "course_index_search" %>
</div> </div>
<a href="<%= courses_path(:select => "end", :is_end => 1) %>" id="courses_index_syllabuses_4" class="color-grey fr" data-tab="end" data-remote="true">查看归档</a> <!--<a href="<%#= courses_path(:select => "end", :is_end => 1) %>" id="courses_index_syllabuses_4" class="color-grey fr" data-tab="end" data-remote="true">查看归档</a>-->
<a href="<%= courses_path(:select => "return", :is_end => 0) %>" class="color-grey fr undis" id="courses_index_syllabuses_5" data-remote="true">返回</a> <!--<a href="<%#= courses_path(:select => "return", :is_end => 0) %>" class="color-grey fr undis" id="courses_index_syllabuses_5" data-remote="true">返回</a>-->
<div class="cl"></div> <div class="cl"></div>
<div class="content clearfix" id="intelligence_course_list"> <div class="content clearfix" id="intelligence_course_list">
<%= render :partial => 'courses/courseList' %> <%= render :partial => 'courses/courseList' %>
</div> </div>
</div> </div>
<%= render :partial => 'layouts/public_left_info' %> <%= render :partial => 'layouts/public_left_info' %>
<style>body{background: #FFFFFF}</style><!--后续需要删除--> <%= javascript_include_tag 'edu/shixun_course_path' %>
<script> <script>
$(function(){ $(function(){
<% unless @is_over.blank? %> <% unless @is_over.blank? %>
$.ajax({ $.ajax({
url: '<%= courses_path(:select => "end", :is_end => 1) %>', url: '<%= courses_path(:select => "end") %>',
dataType: 'script' dataType: 'script'
}); });
<% end %> <% end %>
$(".edu-filter-cir-grey").live("click", function(){
$(this).addClass("active");
$(this).siblings().removeClass("active");
});
}); });
/* ------------------- 添加或取消收藏 ---------------------- */ /* ------------------- 添加或取消收藏 ---------------------- */
@ -144,18 +158,18 @@
}); });
/* -------------------恢复标签到初始位置-------------------- */ /* -------------------恢复标签到初始位置-------------------- */
function reset_label_status(){ // function reset_label_status(){
$(".course_filtrate").removeClass("course_filtrate_bg"); // $(".course_filtrate").removeClass("course_filtrate_bg");
$("#courses_index_syllabuses_1").addClass("course_filtrate_bg"); // $("#courses_index_syllabuses_1").addClass("course_filtrate_bg");
$("input[name='search']").val(""); // $("input[name='search']").val("");
} // }
/* ---------------点击查看归档的返回----------------- */ // /* ---------------点击查看归档的返回----------------- */
$("#courses_index_syllabuses_5").on("click", function(){ // $("#courses_index_syllabuses_5").on("click", function(){
reset_label_status() // reset_label_status()
}); // });
//
/* ------------------查看归档----------------------- */ // /* ------------------查看归档----------------------- */
$("#courses_index_syllabuses_4").on("click", function(){ // $("#courses_index_syllabuses_4").on("click", function(){
reset_label_status() // reset_label_status()
}); // });
</script> </script>

View File

@ -1,14 +1,3 @@
$("#intelligence_course_list").html("<%= j(render :partial => "courses/courseList") %>"); $("#intelligence_course_list").html("<%= j(render :partial => "courses/courseList") %>");
$("#courses_index_syllabuses_1").attr('href', '<%= courses_path(:select => "all", :is_end => @is_end, :search => @search) %>');
$("#courses_index_syllabuses_2").attr('href', '<%= courses_path(:select => "create", :is_end => @is_end, :search => @search) %>');
$("#courses_index_syllabuses_3").attr('href', '<%= courses_path(:select => "join", :is_end => @is_end, :search => @search) %>');
<% if params[:select] == "end" %>
$("#courses_index_syllabuses_4").hide();
$("#courses_index_syllabuses_5").show();
<% elsif params[:select] == "return" %>
$("#courses_index_syllabuses_4").show();
$("#courses_index_syllabuses_5").hide();
<% end %>
$("#all_syllabuses").html("<%= @syllabuses_num %>");
$("#my_syllabuses").html("<%= @join_syllabuses_count + @create_syllabuses_count %>");
$("#search_syllabuses_name").replaceWith("<%= j(render :partial => 'course_index_search') %>"); $("#search_syllabuses_name").replaceWith("<%= j(render :partial => 'course_index_search') %>");

View File

@ -2,9 +2,8 @@
<p style="line-height: 2.0;"> <p style="line-height: 2.0;">
<i class="fa fa-map-marker mr5 color-grey"></i> <i class="fa fa-map-marker mr5 color-grey"></i>
<%= link_to User.current.show_real_name, user_path(User.current) %> > <%= link_to '在线课堂', courses_path %> > <%= link_to '新建课堂' %> <%= link_to User.current.show_real_name, user_path(User.current) %> > <%= link_to '在线课堂', courses_path %> > <%= link_to '新建课堂' %>
</p> </p>
<div class="user_bg_shadow bor-grey-e"> <div class="user_bg_shadow mt10 bor-grey-e">
<div class="edu-con-top "> <div class="edu-con-top ">
<span class="ml15 color-grey font-16">新建课堂</span> <span class="ml15 color-grey font-16">新建课堂</span>
</div> </div>
@ -83,41 +82,62 @@
</div> </div>
<script> <script>
$(function(){ $(function(){
$("#new_course_list").on('input', function(e){ var course_list_name = "";
throttle(search_course_list, window, e); $('#new_course_end_date').datetimepicker({
}); allowBlank:true,
$("#new_course_list").on('blur', function(e){ lang:'ch',
$("#new_course_name").val($("#new_course_list").val()); format:'Y-m-d',
}); formatDate:'Y-m-d',
$("#new_course_list").on('focus', function (e) { timepicker:false,
if ($("#new_course_list").val().trim() != '') { //如果已经有id了。肯定存在不用去找了。 validateOnBlur:false
return; });
} else{
search_course_ajax('');
}
});
//var date = new Date();//获取当前时间
//var nextDate = new Date(date.getTime() + 24*60*60*1000);//设置天数 +1 天
$('#new_course_end_date').datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d',
formatDate:'Y-m-d',
timepicker:false,
validateOnBlur:false
});
$(".course_list_ul").on('click', 'p',function(event) { $("body").click(function(event){
$("#new_course_list").val($(this).html()); $(".course_list_ul").hide();
$("#new_course_name").val($("#new_course_list").val()); event.stopPropagation();
$(".course_list_ul").hide(); });
event.stopPropagation();
});
$("body").click(function(event){ $("#new_course_list").on('input', function(e){
$(".course_list_ul").hide(); throttle(search_course_list, window, e);
event.stopPropagation(); });
}); $("#new_course_list").on('blur', function(e){
if($("#new_course_name").val() == ""){
$("#new_course_name").val($("#new_course_list").val());
} else{
if($("#new_course_name").val().indexOf(course_list_name) == 0){
$("#new_course_name").val($("#new_course_name").val().replace(course_list_name, $("#new_course_list").val()));
} else{
$("#new_course_name").val($("#new_course_list").val() + $("#new_course_name").val());
}
}
regex_course_name('new');
course_list_name = $("#new_course_list").val();
});
$("#new_course_list").on('click', function (e) {
if ($("#new_course_list").val().trim() != '') { //如果已经有id了。肯定存在不用去找了。
event.stopPropagation();
return;
} else{
search_course_ajax('');
event.stopPropagation();
}
});
$(".course_list_ul").on('click', 'p', function(event) {
$("#new_course_list").val($(this).html());
if($("#new_course_name").val() == ""){
$("#new_course_name").val($("#new_course_list").val());
} else{
if($("#new_course_name").val().indexOf(course_list_name) == 0){
$("#new_course_name").val($("#new_course_name").val().replace(course_list_name, $("#new_course_list").val()));
} else{
$("#new_course_name").val($("#new_course_list").val() + $("#new_course_name").val());
}
}
regex_course_name('new');
$(".course_list_ul").hide();
course_list_name = $(this).html();
event.stopPropagation();
});
}); });
</script> </script>

View File

@ -33,40 +33,52 @@
<label class="panel-form-label label fl"><span class="color-orange mr5">*</span>课程名称&nbsp;&nbsp;&nbsp;&nbsp; <label class="panel-form-label label fl"><span class="color-orange mr5">*</span>课程名称&nbsp;&nbsp;&nbsp;&nbsp;
</label> </label>
<div class="pr fl with75"> <div class="pr fl with75">
<input type="text" name="course[course_list]" autocomplete="off" style="width: 100%;" id="edit_course_list" value="<%= @course.course_list_name %>" class="task task-height-40 panel-box-sizing fl color-grey" maxlength="100" placeholder="例如:计算机基础"> <input type="text" name="course[course_list]" autocomplete="off" style="width: 100%;" id="edit_course_list" value="<%= @course.course_list_name %>" class="task task-height-40 panel-box-sizing fl color-grey" maxlength="100" placeholder="例如:数据结构">
<ul class="course_list_ul"> <ul class="course_list_ul">
</ul> </ul>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<span class="color-orange fl none" id="edit_course_syllabus_notice" style="margin-left:25%;"><i class="fa fa-exclamation-circle mr5" ></i>请先输入课程</span> <span class="color-orange fl none" id="edit_course_syllabus_notice" style="margin-left:25%;"><i class="fa fa-exclamation-circle mr5" ></i>请先输入课程</span>
</li> </li>
<li class="pt20 clearfix"> <li class="pt20 clearfix mb40">
<label class="panel-form-label label fl"><span class="color-orange mr5">*</span>课堂名称&nbsp;&nbsp;&nbsp;&nbsp; <label class="panel-form-label label fl"><span class="color-orange mr5">*</span>课堂名称&nbsp;&nbsp;&nbsp;&nbsp;
</label> </label>
<input type="text" name="course[name]" id="edit_course_name" value="<%= @course.name %>" class="task task-height-40 panel-box-sizing fl color-grey" maxlength="100" placeholder="例如:软件工程计算机系2016秋季A班" onkeyup="regex_course_name('edit');"> <input type="text" name="course[name]" id="edit_course_name" value="<%= @course.name %>" class="task task-height-40 panel-box-sizing fl color-grey" maxlength="100" placeholder="例如:数据结构2016秋季班级" onkeyup="regex_course_name('edit');">
<div class="cl"></div> <div class="cl"></div>
<span class="color-orange fl none" id="edit_course_name_notice" style="margin-left:25%;"><i class="fa fa-exclamation-circle mr5" ></i>课堂名称不能为空且至少有两个字符</span> <span class="color-orange fl none" id="edit_course_name_notice" style="margin-left:25%;"><i class="fa fa-exclamation-circle mr5" ></i>课堂名称不能为空且至少有两个字符</span>
<div class="cl"></div> <div class="cl"></div>
<li class="ml125 mb5 fontGrey3" style="margin-left:25%;"><i class="fa fa-check-circle color-light-green mr5"></i>正确示例软件工程计算机系2016秋季A班</li> <!--<li class="ml125 mb5 fontGrey3" style="margin-left:25%;"><i class="fa fa-check-circle color-light-green mr5"></i>正确示例软件工程计算机系2016秋季A班</li>
<li class="ml125 fontGrey3" style="margin-left:25%;"><i class="fa fa-times-circle color-orange mr5"></i>错误示例计算机系2016秋季A班</li> <li class="ml125 fontGrey3" style="margin-left:25%;"><i class="fa fa-times-circle color-orange mr5"></i>错误示例计算机系2016秋季A班</li>-->
<div class="tusi" style="left:108% ">
<div class="entry">
<em></em>
<span class="after"></span>
<p class="color-grey mt10" style="height: 26px;line-height: 26px;">注意1、课堂名称 = 课程名称 + 学期信息 + 其它</p>
<p class="color-grey ml50" style="height: 26px;line-height: 26px;margin-left: 55px;"><i class="fa fa-check-circle color-light-green mr5"></i>正确示例数据结构2016秋季班级</p>
<p class="color-grey" style="height: 26px;line-height: 26px;margin-left: 55px;"><i class="fa fa-times-circle color-orange mr5"></i>错误示例:数据结构班级</p>
<p class="color-grey" style="height: 26px;line-height: 26px;margin-left: 42px;">2、如果本学期包含多个班级只需创建一个课堂</p>
<p class="color-grey mb10" style="height: 26px;line-height: 26px;margin-left: 65px;">然后在课堂内部建立不同的分班</p>
</div>
</div>
</li> </li>
<li class="pt20 clearfix"> <li class="pt20 clearfix">
<label class="panel-form-label label fl">总学时&nbsp;&nbsp;&nbsp;&nbsp;</label> <label class="panel-form-label label fl">总学时&nbsp;&nbsp;&nbsp;&nbsp;</label>
<input type="text" name="period" id="edit_class_period" value="<%= @course.class_period %>" class="task task-height-40 panel-box-sizing fl cut color-grey" onkeyup="regex_course_class_period('edit');" placeholder="例如&nbsp;&nbsp;30" maxlength="6"> <input type="text" name="period" id="edit_class_period" value="<%= @course.class_period %>" class="task task-height-40 panel-box-sizing fl color-grey" onkeyup="regex_course_class_period('edit');" placeholder="例如&nbsp;&nbsp;30" maxlength="6">
<div class="cl"></div> <div class="cl"></div>
<span class="color-orange fl none" id="edit_course_class_period_notice" style="margin-left:25%;"><i class="fa fa-exclamation-circle mr5" ></i>请输入正整数</span> <span class="color-orange fl none" id="edit_course_class_period_notice" style="margin-left:25%;"><i class="fa fa-exclamation-circle mr5" ></i>请输入正整数</span>
</li> </li>
<li class="pt20 clearfix"> <li class="pt20 clearfix">
<label class="panel-form-label label fl">学分&nbsp;&nbsp;&nbsp;&nbsp;</label> <label class="panel-form-label label fl">学分&nbsp;&nbsp;&nbsp;&nbsp;</label>
<input type="text" id="edit_course_credit" value="<%= @course.credit %>" name="credit" maxlength="4" class="task task-height-40 panel-box-sizing fl cut color-grey" onkeyup="regex_course_credit('edit');" placeholder="例如&nbsp;&nbsp;4"> <input type="text" id="edit_course_credit" value="<%= @course.credit %>" name="credit" maxlength="4" class="task task-height-40 panel-box-sizing fl color-grey" onkeyup="regex_course_credit('edit');" placeholder="例如&nbsp;&nbsp;4">
<div class="cl"></div> <div class="cl"></div>
<span class="color-orange fl none" id="edit_course_credit_notice" style="margin-left:25%;"><i class="fa fa-exclamation-circle mr5" ></i>请输入正整数或保留一位小数的浮点数</span> <span class="color-orange fl none" id="edit_course_credit_notice" style="margin-left:25%;"><i class="fa fa-exclamation-circle mr5" ></i>请输入正整数或保留一位小数的浮点数</span>
</li> </li>
<li class="pt20 clearfix"> <li class="pt20 clearfix">
<label class="panel-form-label label fl">结束时间&nbsp;&nbsp;&nbsp;&nbsp;</label> <label class="panel-form-label label fl">结束时间&nbsp;&nbsp;&nbsp;&nbsp;</label>
<input type="text" id="edit_course_end_date" value="<%= @course.end_date %>" class="task task-height-40 panel-box-sizing fl cut color-grey" name="end_date" placeholder="请选择结束日期"> <input type="text" id="edit_course_end_date" value="<%= @course.end_date %>" class="task task-height-40 panel-box-sizing fl color-grey" name="end_date" placeholder="请选择结束日期">
<div class="cl"></div> <div class="cl"></div>
<div class="tusi"> <div class="tusi"style="left:108% ">
<div class="entry"> <div class="entry">
<em></em> <em></em>
<span class="after"></span> <span class="after"></span>
@ -83,7 +95,7 @@
</li> </li>
<li class="mt20 clearfix pb20"> <li class="mt20 clearfix pb20">
<label class="panel-form-label label fl">&nbsp;&nbsp;</label> <label class="panel-form-label label fl">&nbsp;&nbsp;</label>
<a href="javascript:void(0);" class="task-btn task-btn-blue fl mr10" onclick="submit_edit_course(<%= @course.id%>);">保存</a> <a href="javascript:void(0);" class="task-btn task-btn-blue fl mr20" onclick="submit_edit_course(<%= @course.id%>);">保存</a>
<%= link_to '取消', course_path(@course), :class => 'task-btn fl ' %> <%= link_to '取消', course_path(@course), :class => 'task-btn fl ' %>
</li> </li>
</ul> </ul>
@ -116,33 +128,30 @@
</div> </div>
<script> <script>
var course_list_name = "";
$(function () { $(function () {
$("#edit_course_list").on('input', function(e){ $("body").click(function(event){
throttle(search_course_list, window, e); $(".course_list_ul").hide();
}); //event.stopPropagation();
$("#edit_course_list").on('focus', function (e) {
if ($("#edit_course_list").val().trim() != '') { //如果已经有id了。肯定存在不用去找了。
return;
} else{
search_course_ajax('');
}
});
$("#edit_course_list").on('blur', function(e){
$("#edit_course_name").val($("#edit_course_list").val());
}); });
$(".course_list_ul").on('click', 'p',function(event) { $(".course_list_ul").on('click', 'p',function(event) {
$("#edit_course_list").val($(this).html()); $("#edit_course_list").val($(this).html());
$("#edit_course_name").val($("#edit_course_list").val()); if($("#edit_course_name").val() == ""){
$("#edit_course_name").val($("#edit_course_list").val());
} else{
if($("#edit_course_name").val().indexOf(course_list_name) == 0){
$("#edit_course_name").val($("#edit_course_name").val().replace(course_list_name, $("#edit_course_list").val()));
} else{
$("#edit_course_name").val($("#edit_course_list").val() + $("#edit_course_name").val());
}
}
regex_course_name('edit');
$(".course_list_ul").hide(); $(".course_list_ul").hide();
course_list_name = $(this).html();
event.stopPropagation(); event.stopPropagation();
}); });
$("body").click(function(event){
$(".course_list_ul").hide();
//event.stopPropagation();
});
<% if @select_tab == 'member'%> <% if @select_tab == 'member'%>
$(".stud-class-set .news .nav p[data-option='member']").click(); $(".stud-class-set .news .nav p[data-option='member']").click();
<% if @role && @role == 'as' %> <% if @role && @role == 'as' %>

View File

@ -5,7 +5,7 @@
</li> </li>
<li class="ml45 mb10"> <li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_syllabus_name)%>&nbsp;&nbsp;</label> <label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_syllabus_name)%>&nbsp;&nbsp;</label>
<span id="edit_syllabus_id"><%=@course.syllabus.title %></span> <span id="edit_syllabus_id"><%#=@course.syllabus.title %></span>
<%#= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"edit_syllabus_id", :class=>"syllabus_input", :style=>'width:210px'} %> <%#= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"edit_syllabus_id", :class=>"syllabus_input", :style=>'width:210px'} %>
<!--<span class="c_red" id="edit_syllabus_notice">如果列表中没有对应的课程,请您先<%#=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%>,然后【刷新】</span>--> <!--<span class="c_red" id="edit_syllabus_notice">如果列表中没有对应的课程,请您先<%#=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%>,然后【刷新】</span>-->
</li> </li>

View File

@ -1,5 +1,5 @@
<span class="mt10 -flex c_grey ml15" id="time-consuming"></span> <span class="mt10 -flex c_grey ml15" id="time-consuming"></span>
<span class="mt10 mr15" style="color: #2dad96;" id="game_wating_time"></span> <!--<span class="mt10 mr15" style="color: #2dad96;" id="game_wating_time"></span>-->
<% if @st == 0 %> <% if @st == 0 %>
<div id="reset_code_to_bengin" class="<%= @game.status == 2 ? "" : "undis" %>"> <div id="reset_code_to_bengin" class="<%= @game.status == 2 ? "" : "undis" %>">
<a href="javascript:void(0)" class="shixun-task-btn task-btn-green mr15 mt8" onclick="delete_confirm_box('<%= reset_new_code_myshixun_game_path(@game, :myshixun_id => @myshixun, :path => @path) %>', '你在本关中修改的内容将丢失<br />是否确定重新加载上次通过的代码');">加载上次通过的代码</a> <a href="javascript:void(0)" class="shixun-task-btn task-btn-green mr15 mt8" onclick="delete_confirm_box('<%= reset_new_code_myshixun_game_path(@game, :myshixun_id => @myshixun, :path => @path) %>', '你在本关中修改的内容将丢失<br />是否确定重新加载上次通过的代码');">加载上次通过的代码</a>
@ -12,6 +12,12 @@
<a href="javascript:void(0)" class="shixun-task-btn task-btn-blue mr15 mt8" onclick="choice_submmit();">评测</a> <a href="javascript:void(0)" class="shixun-task-btn task-btn-blue mr15 mt8" onclick="choice_submmit();">评测</a>
<% end %> <% end %>
</div> </div>
<div id="prev_step_area">
<% if @game.challenge.position > 1 %>
<%= link_to "上一关 ", {:controller => 'games', :action => "prev_step", :id => @game, :myshixun_id => @myshixun},
:class => "shixun-task-btn task-btn-blue mr15 mt8", :id => "prev_step", :remote => true %>
<% end %>
</div>
<div id="code_estimate"> <div id="code_estimate">
<% if @game.status == 1 %> <% if @game.status == 1 %>
<a class="shixun-task-btn mt8 mr15" id="code_testing">评测中..</a> <a class="shixun-task-btn mt8 mr15" id="code_testing">评测中..</a>
@ -72,15 +78,6 @@
$("#time-consuming").html("耗时:" + days + " 天 " + hours + " 小时 " + minutes + " 分钟 " + seconds + " 秒 "); $("#time-consuming").html("耗时:" + days + " 天 " + hours + " 小时 " + minutes + " 分钟 " + seconds + " 秒 ");
} }
/* -----------------下一关增加loading效果--------------------- */
$("#next_step").live("click", function(){
if($("#next_step").attr("href") != "javascript:void(0);"){
nNext = $("#code_estimate");
html = "<a href='javascript:void(0);' class='task-btn mr15 mt8'>下一关<img src='/images/bigdata/loading2.svg' style='width:25px;float:left;margin-top: 3px' /></a>";
nNext.html(html);
}
});
// 选择题提交评测 // 选择题提交评测
// answer 选择的答案 // answer 选择的答案
function choice_submmit(){ function choice_submmit(){
@ -131,7 +128,11 @@
$("#code_estimate").html("<a href='javascript:void(0);' class='task-btn mr15 mt8'>下一关</a>"); $("#code_estimate").html("<a href='javascript:void(0);' class='task-btn mr15 mt8'>下一关</a>");
} else if($("#exit_shixun").length > 0){ } else if($("#exit_shixun").length > 0){
$("#code_estimate").html("<a href='javascript:void(0);' class='task-btn mr15 mt8'>退出实训</a>"); $("#code_estimate").html("<a href='javascript:void(0);' class='task-btn mr15 mt8'>退出实训</a>");
}$(".blacktab_con").eq(1).trigger("click"); // 回到测试结果页面 }
if($("#prev_step").length > 0){
$("#prev_step_area").html("<a href='javascript:void(0);' class='task-btn mr15 mt8'>上一关</a>");
}
$(".blacktab_con").eq(1).trigger("click"); // 回到测试结果页面
// 保存版本库代码 // 保存版本库代码
var fileUpdateUrl = $("#current_repository_path").html(); var fileUpdateUrl = $("#current_repository_path").html();
$.ajax({ $.ajax({
@ -148,6 +149,7 @@
timeID = setInterval(function(){ timeID = setInterval(function(){
$.ajax({ $.ajax({
url: '<%= get_waiting_time_myshixun_game_path(@game, :myshixun_id => @myshixun) %>', url: '<%= get_waiting_time_myshixun_game_path(@game, :myshixun_id => @myshixun) %>',
data:{resubmit:data.resubmit},
async: false, async: false,
success: function(data){ success: function(data){
console.log(data); console.log(data);
@ -188,7 +190,8 @@
data.had_passed_testsests_public_count, data.had_passed_testsests_public_count,
data.final_score, data.final_score,
data.latest_output, data.latest_output,
data.language data.language,
data.compile_success
); );
$("#blacktab_nav_1").trigger("click"); $("#blacktab_nav_1").trigger("click");
if(data.status == 2){ if(data.status == 2){
@ -218,6 +221,9 @@
} }
var html = "<a href='javascript:void(0)' class='task-btn task-btn-blue mr15 mt8' onclick='training_task_submmit();'>评测</a>"; var html = "<a href='javascript:void(0)' class='task-btn task-btn-blue mr15 mt8' onclick='training_task_submmit();'>评测</a>";
$("#code_test").html(html); // 恢复评测 $("#code_test").html(html); // 恢复评测
if(data.position > 1){
$("#prev_step_area").html("<a href='<%= prev_step_myshixun_game_path(@game, :myshixun_id => @myshixun) %>' class='task-btn task-btn-blue mr15 mt8' id='prev_step' data-remote='true'>上一关</a>")
}
var codeEstimate = $("#code_estimate").children("a").html(); var codeEstimate = $("#code_estimate").children("a").html();
if(codeEstimate == undefined){ if(codeEstimate == undefined){
return; return;
@ -239,6 +245,9 @@
nInfoAjaxLoading.val(""); nInfoAjaxLoading.val("");
nAjaxLoading.hide(); nAjaxLoading.hide();
nInfoAjaxLoading.hide(); nInfoAjaxLoading.hide();
if(data.position > 1){
$("#prev_step_area").html("<a href='<%= prev_step_myshixun_game_path(@game, :myshixun_id => @myshixun) %>' class='task-btn task-btn-blue mr15 mt8' id='prev_step' data-remote='true'>上一关</a>")
}
if( data.had_done == 0 ) { if( data.had_done == 0 ) {
$("#code_estimate").html("<a href='<%= next_step_myshixun_game_path(@game, :myshixun_id => @myshixun) %>' class='task-btn task-btn-blue mr15 mt8' id='next_step' data-remote='true'>下一关</a>"); $("#code_estimate").html("<a href='<%= next_step_myshixun_game_path(@game, :myshixun_id => @myshixun) %>' class='task-btn task-btn-blue mr15 mt8' id='next_step' data-remote='true'>下一关</a>");
} }

View File

@ -21,7 +21,7 @@
<script> <script>
<%# test_sets测试集had_test_count输出集的个数test_sets_count测试集的个数had_passed_testsests_error_count测试集报错数test_sets_hidden_count隐藏测试集的个数 %> <%# test_sets测试集had_test_count输出集的个数test_sets_count测试集的个数had_passed_testsests_error_count测试集报错数test_sets_hidden_count隐藏测试集的个数 %>
<%# test_sets_public_count公开测试集的个人had_passed_testsests_hidden_count通过的隐藏集个数had_passed_testsests_public_count通过的公开测试集个数 %> <%# test_sets_public_count公开测试集的个人had_passed_testsests_hidden_count通过的隐藏集个数had_passed_testsests_public_count通过的公开测试集个数 %>
<%# final_score最终得分had_done通过的是否是最后一关latest_output最新的输出language实训的语言 %> <%# final_score最终得分had_done通过的是否是最后一关latest_output最新的输出language实训的语言, @compile_success表示代码是否抛异常 %>
$(function(){ $(function(){
code_evaluation( code_evaluation(
[<%= @test_sets.html_safe unless @test_sets.blank? %>], [<%= @test_sets.html_safe unless @test_sets.blank? %>],

View File

@ -16,6 +16,7 @@
<li id="tab_nav_1" class="tab_hover" onclick="HoverLi1(1);"> <li id="tab_nav_1" class="tab_hover" onclick="HoverLi1(1);">
<a href="javascript:void(0);" class="tab_type" style="font-size: 16px">过关任务</a> <a href="javascript:void(0);" class="tab_type" style="font-size: 16px">过关任务</a>
</li> </li>
<% unless @myshixun.shixun.try(:propaedeutics).blank? %>
<li id="tab_nav_2" onclick="HoverLi1(2);"> <li id="tab_nav_2" onclick="HoverLi1(2);">
<a href="javascript:void(0);" class="tab_type" style="font-size: 16px">背景知识</a> <a href="javascript:void(0);" class="tab_type" style="font-size: 16px">背景知识</a>
</li> </li>
@ -31,7 +32,7 @@
</li> </li>
<% end %> <% end %>
<li id="tab_nav_4"> <li id="tab_nav_4">
<%= link_to '评论', shixun_discuss_shixun_path(@shixun), :class => "tab_type", :style => "font-size: 16px", :remote => true %> <%= link_to '评论', shixun_discuss_shixun_path(@myshixun.shixun), :class => "tab_type", :style => "font-size: 16px", :remote => true %>
</li> </li>
<% if @st == 0 %> <% if @st == 0 %>
<span class="btn-cir-big fr mt8 mr15" >经验值:<%= @game_challenge.score %></span> <span class="btn-cir-big fr mt8 mr15" >经验值:<%= @game_challenge.score %></span>
@ -55,7 +56,7 @@
<div class="fit -scroll"> <div class="fit -scroll">
<div class="-layout-v -fit"> <div class="-layout-v -fit">
<div class="-flex -scroll task-padding16 panel-box-sizing new_li read_only" unselectable="on" 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> <textarea style="display:none;"><%= @myshixun.shixun.propaedeutics %></textarea>
</div> </div>
</div> </div>
</div> </div>
@ -122,11 +123,12 @@
</div> </div>
</div> </div>
<!--按钮的操作--> <!--按钮的操作-->
<div class="-layout-h -center -bg-grey-90 -grey-20 -bg-darkblack " style="height:48px; "> <div class="-layout-h -center -bg-grey-90 -grey-20 -bg-darkblack" style="height:48px; ">
<div class="-flex -layout-h" id="game_operate_action"> <div class="-flex -layout-h" id="game_operate_action">
<%= render :partial => "games/code_actions" %> <%= render :partial => "games/code_actions" %>
</div> </div>
</div> </div>
<div class="-bg-darkblack" style="color:#2dad96;padding-left:15px" id="game_wating_time"></div>
</div> </div>
</div> </div>

View File

@ -12,7 +12,7 @@
<% if game.try(:status) == 0 %> <% if game.try(:status) == 0 %>
<h4 class=" -task-list-title fl"><%= link_to challenge.try(:subject), myshixun_game_path(game, :myshixun_id => @myshixun), :remote => true %></h4> <h4 class=" -task-list-title fl"><%= link_to challenge.try(:subject), myshixun_game_path(game, :myshixun_id => @myshixun), :remote => true %></h4>
<% if @myshixun.shixun.try(:status) == 2 %> <% if @myshixun.shixun.try(:status) == 2 %>
<a class="fr " data-tip-down="待完成"><i class="fa fa-play-circle color-light-green fr font-18 mt5 -text-danger w20_center" ></i></a> <a class="fr"><i data-tip-down="待完成" class="fa fa-play-circle color-light-green fr font-18 mt5 -text-danger w20_center" ></i></a>
<% end %> <% end %>
<% elsif game.try(:status) == 1 %> <% elsif game.try(:status) == 1 %>
<% if @myshixun.shixun.try(:status) == 2 %> <% if @myshixun.shixun.try(:status) == 2 %>
@ -24,12 +24,12 @@
<% elsif game.try(:status) == 2 %> <% elsif game.try(:status) == 2 %>
<h4 class="-task-list-title fl"> <%= link_to challenge.try(:subject), myshixun_game_path(game, :myshixun_id => @myshixun), :remote => true %></h4> <h4 class="-task-list-title fl"> <%= link_to challenge.try(:subject), myshixun_game_path(game, :myshixun_id => @myshixun), :remote => true %></h4>
<% if @myshixun.shixun.try(:status) == 2 %> <% if @myshixun.shixun.try(:status) == 2 %>
<a class="fr" data-tip-down="已解决"><i class="fa fa-check-circle fr font-18 mt5 color-light-green w20_center" ></i></a> <a class="fr"><i data-tip-down="已解决" class="fa fa-check-circle fr font-18 mt5 color-light-green w20_center" ></i></a>
<% end %> <% end %>
<% elsif game.try(:status) == 3 %> <% elsif game.try(:status) == 3 %>
<% if @myshixun.shixun.try(:status) == 2 %> <% if @myshixun.shixun.try(:status) == 2 %>
<h4 class="-task-list-title fl"> <%= challenge.try(:subject) %></h4> <h4 class="-task-list-title fl"> <%= challenge.try(:subject) %></h4>
<a class="fr" data-tip-down="未解锁"><i class="fa fa-play-circle fr font-18 mt5 color-grey w20_center" ></i></a> <a class="fr"><i data-tip-down="未解锁" class="fa fa-play-circle fr font-18 mt5 color-grey w20_center" ></i></a>
<% else %> <% else %>
<h4 class="-task-list-title fl"> <%= link_to challenge.try(:subject), myshixun_game_path(game, :myshixun_id => @myshixun), :remote => true %></h4> <h4 class="-task-list-title fl"> <%= link_to challenge.try(:subject), myshixun_game_path(game, :myshixun_id => @myshixun), :remote => true %></h4>
<% end %> <% end %>

View File

@ -2,9 +2,9 @@
<li id="codetab_nav_1" class="blacktab_hover" onclick="HoverLi_new(1);"> <li id="codetab_nav_1" class="blacktab_hover" onclick="HoverLi_new(1);">
<a href="javascript:void(0);" class="tab_type tab_color" >代码</a> <a href="javascript:void(0);" class="tab_type tab_color" >代码</a>
</li> </li>
<li id="codetab_nav_2" data-tab="2" class="add-webssh"> <li id="codetab_nav_2" data-tab="2" class="add-webssh" onclick="LoadingWebssh(2);">
<% if @myshixun.shixun.try(:webssh) %> <% if @myshixun.shixun.try(:webssh) %>
<a href="javascript:void(0);" class="tab_type tab_color" >命令行</a> <a href="javascript:void(0);" class="tab_type tab_color">命令行</a>
<% end %> <% end %>
</li> </li>
<li id="codetab_nav_add" class="undis c_white " style="padding-left:10px;"> <li id="codetab_nav_add" class="undis c_white " style="padding-left:10px;">
@ -96,7 +96,7 @@
if($(".add-webssh").length == 5){ if($(".add-webssh").length == 5){
$(this).hide(); $(this).hide();
} }
LoadingWebssh(); LoadingWebssh(H);
$('#blacktab_nav').find("li").click(function(){ $('#blacktab_nav').find("li").click(function(){
if($(this).attr("id")=="codetab_nav_"+H+""){ if($(this).attr("id")=="codetab_nav_"+H+""){
HoverLi_new(H); HoverLi_new(H);
@ -115,7 +115,7 @@
} }
}); });
function LoadingWebssh(){ function LoadingWebssh(H){
$.ajax({ $.ajax({
url: "<%= open_webssh_myshixun_path(@myshixun) %>", url: "<%= open_webssh_myshixun_path(@myshixun) %>",
success: function(data){ success: function(data){
@ -126,9 +126,10 @@
var line_h = (navigator.userAgent.indexOf('Firefox') >= 0 ? 19 : 18); var line_h = (navigator.userAgent.indexOf('Firefox') >= 0 ? 19 : 18);
var rows = parseInt(h / line_h); var rows = parseInt(h / line_h);
// 测试版 // 测试版
var html = "<iframe src='<%= Redmine::Configuration['tomcat_webssh'] %>/?Host=" + data.host + "&Port=" + data.port + "&Username=" + data.username + "&Password=" + data.password + "&Gameid=" + data.game_id + "&Rows=" + rows + "'" + " style='width:100%;border:0;' scrolling='no' class='game_webssh'></iframe><div class='-brother undis'></div>"; var html = "<iframe src='<%= Redmine::Configuration['tomcat_webssh'] %>/?Host=" + data.host + "&Port=" + data.port + "&Username=" + data.username + "&Password=" + data.password + "&Gameid=" + data.game_id + "&Rows=" + rows + "'" + " style='width:100%;border:0;' scrolling='no' class='game_webssh'></iframe>";
// 本地版 // 本地版
var html_local ="<iframe src='http://127.0.0.1:9527?Host=106.75.96.108&Port=40054&Username=root&Password=123123&Gameid=" +data.game_id + "&Rows=" + rows + "'" + " style='width:100%;border:0;' scrolling='no' class='game_webssh'></iframe><div class='-brother undis'></div>"; var html_local ="<iframe src='http://127.0.0.1:9527?Host=106.75.96.108&Port=40054&Username=root&Password=123123&Gameid=" +data.game_id + "&Rows=" + rows + "'" + " style='width:100%;border:0;' scrolling='no' class='game_webssh'></iframe><div class='undis'></div>";
console.log(html);
$("#codetab_con_"+H).html(html); $("#codetab_con_"+H).html(html);
$(".game_webssh").css("min-height", h); $(".game_webssh").css("min-height", h);
$(".game_webssh").css("max-height", h); $(".game_webssh").css("max-height", h);

View File

@ -2,6 +2,7 @@
notice_sure_box('<%= @error_messages %>'); notice_sure_box('<%= @error_messages %>');
<% else %> <% else %>
$("#games_repository_contents").html('<%= escape_javascript(render :partial => 'games/repository') %>'); $("#games_repository_contents").html('<%= escape_javascript(render :partial => 'games/repository') %>');
HoverLi_new(1);
<% end %> <% end %>
//$("#coding_area").show(); //$("#coding_area").show();
$("#coding_ajax_loading").css("display", "none"); $("#coding_ajax_loading").css("display", "none");

View File

@ -37,7 +37,7 @@
<i class="fa fa-lock ml5 mt8 color-grey font-16 fl"></i> <i class="fa fa-lock ml5 mt8 color-grey font-16 fl"></i>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
<p class="color-grey font-12 ml15"> <p class="color-grey font-12 mt3 ml25">
<span class="">更新于<%= time_from_now homework.updated_at %></span> <span class="">更新于<%= time_from_now homework.updated_at %></span>
<span class="ml30"><%= homework.quotes %> 次引用</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> <span class="ml30"><%= StudentWork.where(:is_delete => 0, :work_status => [1, 2, 3], :homework_common_id => homework.homework_commons.map(&:id)).count %> 次答题</span>

View File

@ -22,7 +22,7 @@
</li> </li>
</ul> </ul>
<div class="cl"></div> <div class="cl"></div>
<div id="edu-tab-con-1"> <div id="edu-tab-con-1" class="box_bg_shandow">
<%= render :partial => 'homework_bank/homework_bank_list' %> <%= render :partial => 'homework_bank/homework_bank_list' %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>

View File

@ -19,7 +19,7 @@
<p class="mb10"> <p class="mb10">
<i class="fa fa-map-marker mr5 color-grey"></i> <i class="fa fa-map-marker mr5 color-grey"></i>
<%= link_to User.current.show_real_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> <%= link_to User.current.show_real_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"> <div class="edu-con-top clearfix box_bg_shandow task-pm-box">
<p class="ml15 fl color-grey"> <p class="ml15 fl color-grey">
<% unless @homework.is_public %> <% unless @homework.is_public %>
<i class="fa fa-lock mr5"></i> <i class="fa fa-lock mr5"></i>
@ -42,7 +42,7 @@
<% end %> <% end %>
</ul> </ul>
<div class="cl"></div> <div class="cl"></div>
<div id="edu-tab-con-1"> <div id="edu-tab-con-1" class="box_bg_shandow">
<div class="" style="padding:0 15px;"> <div class="" style="padding:0 15px;">
<div class="fr edu-position edu-position-hidebox"> <div class="fr edu-position edu-position-hidebox">
<a href="javascript:void(0);" class="font-16"><i class="fa fa-bars"></i></a> <a href="javascript:void(0);" class="font-16"><i class="fa fa-bars"></i></a>
@ -162,7 +162,7 @@
<% end %> <% end %>
<%# end %> <%# end %>
</div> </div>
<div id="edu-tab-con-2" class="undis"> <div id="edu-tab-con-2" class="undis box_bg_shandow">
<div class="edu-tab-con-box"> <div class="edu-tab-con-box">
<div> <div>
<% unless @homework.reference_answer.blank? %> <% unless @homework.reference_answer.blank? %>

View File

@ -1,6 +1,46 @@
<div class="edu-con-top clearfix mb15"> <div class="edu-con-top clearfix mb15">
<p class="ml15 fl">评分设置</p> <p class="ml15 fl">评分设置</p>
</div> </div>
<% if @homework.homework_type == 4 %>
<div class="ml30 mr30 pb10">
<div class="clearfix pr">
<ul>
<li class="clearfix">
<label class="panel-form-label fl mr10" style="width: 20%">查看参考答案后通过评测的任务</label>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<input id="answer_open_evaluation_0" class="magic-radio fl mt6" type="radio" name="answer_open_evaluation" value="0" <%= @homework_detail_manual.answer_open_evaluation ? '' : 'checked' %>>
<label for="answer_open_evaluation_0" class="fl mt6 mr30">零分</label>
<input id="answer_open_evaluation_1" class="magic-radio fl mt6" type="radio" name="answer_open_evaluation" value="1" <%= @homework_detail_manual.answer_open_evaluation ? 'checked' : '' %>>
<label for="answer_open_evaluation_1" class="fl mt6">满分</label>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">
<em></em>
<span></span>
<p>零分:查看参考答案才完成的任务,在系统评分时属于未完成任务<br/>
零分:查看参考答案才完成的任务,在系统评分时属于已完成任务 <br/>
</p>
</div>
</li>
<li class="clearfix mt10">
<label class="panel-form-label fl mr10">最终成绩组成</label>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">系统评分</label>
<input type="text" disabled class="fl task-form-15 task-height-40 panel-box-sizing" value="100%" placeholder="100%" />
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">
<em></em>
<span></span>
<p>系统评分是根据学生的任务完成情况,按照百分比计算 <br/>
例如实训任务5关学生A完成3关则最终成绩为 3 / 5 * 100 = 60分 <br/>
注意:学生完成实训后,必须关联实训项目,否则成绩为零
</p>
</div>
</li>
</ul>
</div>
</div>
<% else %>
<div class="ml30 mr30"> <div class="ml30 mr30">
<div class="clearfix"> <div class="clearfix">
<ul> <ul>
@ -122,4 +162,5 @@
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
<% end %>

View File

@ -1,124 +1,164 @@
<div class="edu-con-top clearfix mb15"> <div class="edu-con-top clearfix mb15">
<p class="ml15 fl">评分设置</p> <p class="ml15 fl">评分设置</p>
</div> </div>
<div class="ml30 mr30"> <% if @homework.homework_type == 4 %>
<div class="clearfix"> <div class="ml30 mr30 pb10">
<ul> <div class="clearfix pr">
<li class="clearfix"> <ul>
<label class="panel-form-label fl mr10">助教评分</label> <li class="clearfix">
</li> <label class="panel-form-label fl mr10" style="width: 20%">查看参考答案后通过评测的任务</label>
<li class="clearfix"> </li>
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5">
<input class="magic-radio" disabled type="radio" <%= @homework_detail_manual.ta_mode == 1 ? 'checked' : '' %>>
<label>普通模式</label>
</span>
<span class="fl color-grey">(选中则取各助教最终评分的平均分)</span>
</li>
<li class="clearfix ">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5">
<input class="magic-radio" disabled type="radio" <%= @homework_detail_manual.ta_mode == 0 ? 'checked' : '' %>>
<label>复审模式</label>
</span>
<span class="fl color-grey">(选中则只取最终次的助教评分)</span>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">最终成绩组成</label>
</li>
<li class="clearfix edu-position">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5">
<input class="magic-radio" type="radio" disabled <%= @homework_detail_manual.final_mode ? '' : 'checked' %>>
<label>多项评分配比</label>
</span>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">
<em></em>
<span></span>
<% if @homework.homework_type != 2 %>
<p>计算说明:<br/>
教师评分 * 其百分比 + 助教评分 * 其百分比 + 学生匿评平均分 * 其百<br/>分比 - ( 迟交扣分 + 缺评扣分 * 缺评数 + 违规匿评扣分 * 违规匿评数 )<br/>
注意:<br/>
非零百分比的评分选项,在没有评分记录的情况下,其百分比平摊到<br/>另外的评分选项上。例如教师评分40% + 助教评分35% + 学生匿<br/>评25%学生A没有得到教师评分则最终成绩将按照助教评分55%<br/> + 学生匿评45%进行计算
</p>
<% else %>
<p>计算说明:<br/>
教师评分 * 其百分比 + 助教评分 * 其百分比 + 系统评分 * 其百分比 <br/>+ 学生匿评平均分 * 其百分比 - ( 迟交扣分 + 缺评扣分 * 缺评数 + 违规<br/>匿评扣分 * 违规匿评数 )
注意:<br/>
非零百分比的评分选项,在没有评分记录的情况下,其百分比平摊到<br/>另外的评分选项上。例如教师评分30% + 助教评分30% + 系统评<br/>分20% + 学生匿评20%学生A没有得到教师评分则最终成绩将按照<br/>助教评分40% + 系统评分30% + 学生匿评30%进行计算
</p>
<% end %>
</div>
</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>
<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>
<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 %>
<li class="clearfix"> <li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label> <label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5 task-form-30 ml20"> <input class="magic-radio fl mt6" type="radio" disabled value="1" <%= @homework_detail_manual.answer_open_evaluation ? '' : 'checked' %>>
<label class="mr5">系统评分</label> <label class="fl mt6 mr30">零分</label>
<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> <input class="magic-radio fl mt6" type="radio" disabled value="0" <%= @homework_detail_manual.answer_open_evaluation ? 'checked' : '' %>>
</span> <label class="fl mt6">满分</label>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">
<em></em>
<span></span>
<p>零分:查看参考答案才完成的任务,在系统评分时属于未完成任务<br/>
零分:查看参考答案才完成的任务,在系统评分时属于已完成任务 <br/>
</p>
</div>
</li>
<li class="clearfix mt10">
<label class="panel-form-label fl mr10">最终成绩组成</label>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">系统评分</label>
<input type="text" disabled class="fl task-form-15 task-height-40 panel-box-sizing" value="100%" placeholder="100%" />
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">
<em></em>
<span></span>
<p>系统评分是根据学生的任务完成情况,按照百分比计算 <br/>
例如实训任务5关学生A完成3关则最终成绩为 3 / 5 * 100 = 60分 <br/>
注意:学生完成实训后,必须关联实训项目,否则成绩为零
</p>
</div>
</li>
</ul>
</div>
</div>
<% else %>
<div class="ml30 mr30">
<div class="clearfix">
<ul>
<li class="clearfix">
<label class="panel-form-label fl mr10">助教评分</label>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5">
<input class="magic-radio" disabled type="radio" <%= @homework_detail_manual.ta_mode == 1 ? 'checked' : '' %>>
<label>普通模式</label>
</span>
<span class="fl color-grey">(选中则取各助教最终评分的平均分)</span>
</li>
<li class="clearfix ">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5">
<input class="magic-radio" disabled type="radio" <%= @homework_detail_manual.ta_mode == 0 ? 'checked' : '' %>>
<label>复审模式</label>
</span>
<span class="fl color-grey">(选中则只取最终次的助教评分)</span>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">最终成绩组成</label>
</li>
<li class="clearfix edu-position">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5">
<input class="magic-radio" type="radio" disabled <%= @homework_detail_manual.final_mode ? '' : 'checked' %>>
<label>多项评分配比</label>
</span>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">
<em></em>
<span></span>
<% if @homework.homework_type != 2 %>
<p>计算说明:<br/>
教师评分 * 其百分比 + 助教评分 * 其百分比 + 学生匿评平均分 * 其百<br/>分比 - ( 迟交扣分 + 缺评扣分 * 缺评数 + 违规匿评扣分 * 违规匿评数 )<br/>
注意:<br/>
非零百分比的评分选项,在没有评分记录的情况下,其百分比平摊到<br/>另外的评分选项上。例如教师评分40% + 助教评分35% + 学生匿<br/>评25%学生A没有得到教师评分则最终成绩将按照助教评分55%<br/> + 学生匿评45%进行计算
</p>
<% else %>
<p>计算说明:<br/>
教师评分 * 其百分比 + 助教评分 * 其百分比 + 系统评分 * 其百分比 <br/>+ 学生匿评平均分 * 其百分比 - ( 迟交扣分 + 缺评扣分 * 缺评数 + 违规<br/>匿评扣分 * 违规匿评数 )
注意:<br/>
非零百分比的评分选项,在没有评分记录的情况下,其百分比平摊到<br/>另外的评分选项上。例如教师评分30% + 助教评分30% + 系统评<br/>分20% + 学生匿评20%学生A没有得到教师评分则最终成绩将按照<br/>助教评分40% + 系统评分30% + 学生匿评30%进行计算
</p>
<% end %>
</div>
</li> </li>
<li class="clearfix"> <li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label> <label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5 task-form-30 ml20"> <span class="fl mr5 task-form-30 ml20">
<label class="mr5">学生匿评</label> <label class="mr5">教师评分</label>
<input type="text" class="task-height-40 task-form-30 panel-box-sizing disabled-bg" value="<%= 100 - (@homework_detail_manual.te_proportion * 100).to_i - (@homework_detail_manual.ta_proportion * 100).to_i - (@homework_detail_programing.ta_proportion * 100).to_i%>%" disabled> <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> </span>
</li> </li>
<% else %> <li class="clearfix ">
<li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label> <label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5 task-form-30 ml20"> <span class="fl mr5 task-form-30 ml20">
<label class="mr5">学生匿评</label> <label class="mr5">助教评分</label>
<input type="text" class="task-height-40 task-form-30 panel-box-sizing disabled-bg" value="<%= 100 - (@homework_detail_manual.te_proportion * 100).to_i - (@homework_detail_manual.ta_proportion * 100).to_i %>%" disabled> <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> </span>
</li> </li>
<% end %>
<li class="clearfix mt30 edu-position">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5">
<input class="magic-radio" type="radio" disabled <%= @homework_detail_manual.final_mode ? 'checked' : '' %>>
<label>单项评分优先</label>
</span>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px; width:405px;">
<em></em>
<span></span>
<p>计算说明:<br/>
优先顺序排前的非零评分 * 100% - <br/>
( 迟交扣分 + 缺评扣分 * 缺评数 + 违规匿评扣分 * 违规匿评数 )
注意:<br/>
有教师评分则教师评分100%否则教辅评分100%,依次类推
</p>
</div>
</li>
<li class="clearfix mb50">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl ml25">
<% if @homework.homework_type == 2 %> <% if @homework.homework_type == 2 %>
教师评分 → 教辅评分 → 系统评分 → 学生匿评评分 <li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5 task-form-30 ml20">
<label class="mr5">系统评分</label>
<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">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5 task-form-30 ml20">
<label class="mr5">学生匿评</label>
<input type="text" class="task-height-40 task-form-30 panel-box-sizing disabled-bg" value="<%= 100 - (@homework_detail_manual.te_proportion * 100).to_i - (@homework_detail_manual.ta_proportion * 100).to_i - (@homework_detail_programing.ta_proportion * 100).to_i%>%" disabled>
</span>
</li>
<% else %> <% else %>
教师评分 → 教辅评分 → 学生匿评评分 <li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl mr5 task-form-30 ml20">
<label class="mr5">学生匿评</label>
<input type="text" class="task-height-40 task-form-30 panel-box-sizing disabled-bg" value="<%= 100 - (@homework_detail_manual.te_proportion * 100).to_i - (@homework_detail_manual.ta_proportion * 100).to_i %>%" disabled>
</span>
</li>
<% end %> <% end %>
</span> <li class="clearfix mt30 edu-position">
</li> <label class="panel-form-label fl mr10">&nbsp;</label>
</ul> <span class="fl mr5">
</div> <input class="magic-radio" type="radio" disabled <%= @homework_detail_manual.final_mode ? 'checked' : '' %>>
</div> <label>单项评分优先</label>
</span>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px; width:405px;">
<em></em>
<span></span>
<p>计算说明:<br/>
优先顺序排前的非零评分 * 100% - <br/>
( 迟交扣分 + 缺评扣分 * 缺评数 + 违规匿评扣分 * 违规匿评数 )
注意:<br/>
有教师评分则教师评分100%否则教辅评分100%,依次类推
</p>
</div>
</li>
<li class="clearfix mb50">
<label class="panel-form-label fl mr10">&nbsp;</label>
<span class="fl ml25">
<% if @homework.homework_type == 2 %>
教师评分 → 教辅评分 → 系统评分 → 学生匿评评分
<% else %>
教师评分 → 教辅评分 → 学生匿评评分
<% end %>
</span>
</li>
</ul>
</div>
</div>
<% end %>
<script> <script>
function score_cancel_edit(){ function score_cancel_edit(){
hideModal(); hideModal();

View File

@ -9,7 +9,7 @@
> <%= link_to "#{@homework.homework_type_ch}作业", homework_common_index_path(:course => @course.id, :homework_type => @homework.homework_type) %> > #<%= link_to (get_hw_index(@homework, @is_teacher, @homework.homework_type) + 1), student_work_index_path(:homework => @homework.id) %> > <%= link_to "#{@homework.homework_type_ch}作业", homework_common_index_path(:course => @course.id, :homework_type => @homework.homework_type) %> > #<%= link_to (get_hw_index(@homework, @is_teacher, @homework.homework_type) + 1), student_work_index_path(:homework => @homework.id) %>
</p> </p>
<div class="edu-con-top clearfix user_bg_shadow"> <div class="edu-con-top clearfix user_bg_shadow bor-grey-e">
<p class="ml15 color-grey fl"> <p class="ml15 color-grey fl">
<% if !@homework.is_public %> <% if !@homework.is_public %>
<i class="fa fa-lock mr5"></i> <i class="fa fa-lock mr5"></i>
@ -19,7 +19,7 @@
</div> </div>
<%= form_tag(homework_setting_homework_common_path(@homework), :method => "post", :id => 'homework_setting_form') do |f| %> <%= form_tag(homework_setting_homework_common_path(@homework), :method => "post", :id => 'homework_setting_form') do |f| %>
<div class="edu-con-bg01 mt15 user_bg_shadow" id="homework_publish_setting"> <div class="edu-con-bg01 mt15 user_bg_shadow bor-grey-e" id="homework_publish_setting">
<% edit_mode = @is_new && @is_teacher %> <% edit_mode = @is_new && @is_teacher %>
<div class="<%= edit_mode ? 'none' : '' %>" id="show_publish_setting"> <div class="<%= edit_mode ? 'none' : '' %>" id="show_publish_setting">
<%= render :partial => 'show_publish_setting' %> <%= render :partial => 'show_publish_setting' %>
@ -29,7 +29,7 @@
</div> </div>
</div> </div>
<div class="edu-con-bg01 mt15 user_bg_shadow" id="homework_late_setting"> <div class="edu-con-bg01 mt15 user_bg_shadow bor-grey-e" id="homework_late_setting">
<div class="<%= edit_mode ? 'none' : '' %>" id="show_late_setting"> <div class="<%= edit_mode ? 'none' : '' %>" id="show_late_setting">
<%= render :partial => 'show_late_setting' %> <%= render :partial => 'show_late_setting' %>
</div> </div>
@ -39,7 +39,7 @@
</div> </div>
<% if @homework.homework_type != 4 %> <% if @homework.homework_type != 4 %>
<div class="edu-con-bg01 mt15 user_bg_shadow" id="homework_anon_setting"> <div class="edu-con-bg01 mt15 user_bg_shadow bor-grey-e" id="homework_anon_setting">
<div class="<%= edit_mode ? 'none' : '' %>" id="show_anon_setting"> <div class="<%= edit_mode ? 'none' : '' %>" id="show_anon_setting">
<%= render :partial => 'show_anon_setting' %> <%= render :partial => 'show_anon_setting' %>
</div> </div>
@ -49,42 +49,15 @@
</div> </div>
<% end %> <% end %>
<div class="edu-con-bg01 mt15 user_bg_shadow" id="homework_score_setting"> <div class="edu-con-bg01 mt15 user_bg_shadow bor-grey-e" id="homework_score_setting">
<% if @homework.homework_type == 4 %> <div class="<%= edit_mode ? 'none' : '' %>" id="show_score_setting">
<div class="edu-con-top clearfix mb15"> <%= render :partial => 'show_score_setting' %>
<p class="ml15 fl">评分设置</p> </div>
</div> <div class="<%= edit_mode ? '' : 'none' %>" id="edit_score_setting">
<div class="ml30 mr30 pb10"> <%= render :partial => 'edit_score_setting' %>
<div class="clearfix pr"> </div>
<ul>
<li class="clearfix">
<label class="panel-form-label fl mr10">最终成绩组成</label>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">系统评分</label>
<input type="text" disabled class="fl task-form-15 task-height-40 panel-box-sizing" value="100%" placeholder="100%" />
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">
<em></em>
<span></span>
<p>系统评分是根据学生的任务完成情况,按照百分比计算 <br/>
例如实训任务5关学生A完成3关则最终成绩为 3 / 5 * 100 = 60分 <br/>
注意:学生完成实训后,必须关联实训项目,否则成绩为零
</p>
</div>
</li>
</ul>
</div>
</div>
<% else %>
<div class="<%= edit_mode ? 'none' : '' %>" id="show_score_setting">
<%= render :partial => 'show_score_setting' %>
</div>
<div class="<%= edit_mode ? '' : 'none' %>" id="edit_score_setting">
<%= render :partial => 'edit_score_setting' %>
</div>
<% end %>
</div> </div>
<div class="edu-con-bg01 mt15 user_bg_shadow" id="homework_public_setting"> <div class="edu-con-bg01 mt15 user_bg_shadow bor-grey-e" id="homework_public_setting">
<div class="<%= edit_mode ? 'none' : '' %>" id="show_public_setting"> <div class="<%= edit_mode ? 'none' : '' %>" id="show_public_setting">
<%= render :partial => 'show_public_setting' %> <%= render :partial => 'show_public_setting' %>
</div> </div>

View File

@ -12,23 +12,23 @@
<p class="footer_con-p">Copyright 2007~2017, All Rights Reserved.&nbsp;&nbsp;湘ICP备17009477号<br />Powered by Trustie and IntelliDE.</p> <p class="footer_con-p">Copyright 2007~2017, All Rights Reserved.&nbsp;&nbsp;湘ICP备17009477号<br />Powered by Trustie and IntelliDE.</p>
</div> </div>
<div class="fr mt20"> <div class="fr mt20">
<ul class="saoma-box fl mr30"> <!--<ul class="saoma-box fl mr30">-->
<li> <!--<li>-->
<img src="/images/inner/img-back-weixin.png" width="50" height="50" alt="高校智能化教学与实训平台" class="img-show" > <!--<img src="/images/inner/img-back-weixin.png" width="50" height="50" alt="高校智能化教学与实训平台" class="img-show" >-->
</li> <!--</li>-->
</ul> <!--</ul>-->
<ul class="saoma-box fl mr30"> <!--<ul class="saoma-box fl mr30">-->
<li> <!--<li>-->
<a target="_blank" href="//shang.qq.com/wpa/qunwpa?idkey=ef458840dfd0f60fbffff84ea9927a8e48954f8e73b2fb2c03feacdb4139076b"><img src="/images/inner/img-back-qq.png" width="50" height="50" alt="高校智能化教学与实训平台" class="img-show" ></a> <!--<a target="_blank" href="//shang.qq.com/wpa/qunwpa?idkey=ef458840dfd0f60fbffff84ea9927a8e48954f8e73b2fb2c03feacdb4139076b"><img src="/images/inner/img-back-qq.png" width="50" height="50" alt="高校智能化教学与实训平台" class="img-show" ></a>-->
<ul class="saoma-img-box"> <!--<ul class="saoma-img-box">-->
<font></font> <!--<font></font>-->
<li> <!--<li>-->
<a target="_blank" href="//shang.qq.com/wpa/qunwpa?idkey=ef458840dfd0f60fbffff84ea9927a8e48954f8e73b2fb2c03feacdb4139076b"><img src="/images/inner/saoma-qq.jpg" width="191" height="252" alt="高校智能化教学与实训平台" class="img-saoma" ></a> <!--<a target="_blank" href="//shang.qq.com/wpa/qunwpa?idkey=ef458840dfd0f60fbffff84ea9927a8e48954f8e73b2fb2c03feacdb4139076b"><img src="/images/inner/saoma-qq.jpg" width="191" height="252" alt="高校智能化教学与实训平台" class="img-saoma" ></a>-->
</li> <!--</li>-->
</ul> <!--</ul>-->
</li> <!--</li>-->
</ul> <!--</ul>-->
<%= link_to image_tag("/images/bigdata/edu-footer-logo.png", width:"50px", height: "50px", alt:"高校智能化教学与实训平台", class:"fl edu-footer-logo"), home_path %> <%#= link_to image_tag("/images/bigdata/edu-footer-logo.png", width:"50px", height: "50px", alt:"高校智能化教学与实训平台", class:"fl edu-footer-logo"), home_path %>
<!-- <p class="inner-footer-p-big fr ml30">高校智能化教学与实训平台</p>--> <!-- <p class="inner-footer-p-big fr ml30">高校智能化教学与实训平台</p>-->
</div> </div>
<div class="cl"></div> <div class="cl"></div>

View File

@ -108,19 +108,14 @@
$(".inner-nav-user i").addClass("fa-sort-down mt10"); $(".inner-nav-user i").addClass("fa-sort-down mt10");
}); });
$("#header_keyword_search").live("click", function(){ function search_res(){
var keyword = $("input[name='search_keyword']").val(); // 搜索关键字 var keyword = $("input[name='search_keyword']").val(); // 搜索关键字
var index = $("#all_status_show_value").text(); // 搜索课程/项目 var index = $("#all_status_show_value").text(); // 搜索课程/项目
index = index == "课堂" ? 1 : 2; index = index == "课堂" ? 1 : 2;
// console.log("课堂" === index);
// console.log("实训" === index);
window.location.href = "<%= search_shixuns_or_courses_users_path %>" + "?search=" + keyword + "&index=" + index; window.location.href = "<%= search_shixuns_or_courses_users_path %>" + "?search=" + keyword + "&index=" + index;
/* $.ajax({ }
url: "<%#= search_shixuns_or_courses_users_path %>",
data: {search: keyword, index:index}, $("#header_keyword_search").live("click", search_res);
dataType: "html"
});*/
});
// 如果是搜索的进来 保留搜索内容 // 如果是搜索的进来 保留搜索内容
<% if !@search.blank? && params[:action] == "search_shixuns_or_courses" %> <% if !@search.blank? && params[:action] == "search_shixuns_or_courses" %>
@ -129,5 +124,20 @@
$("#all_status_show_value").text("实训"); $("#all_status_show_value").text("实训");
<% end %> <% end %>
<% end %> <% end %>
$("input[name='search_keyword']").on("keydown", function(event){
var code;
if (!event) {
event = window.event; //针对ie浏览器
code = event.keyCode;
}
else {
code = event.keyCode;
}
if(code == 13) {
search_res();
return false;
}
});
}); });
</script> </script>

View File

@ -41,7 +41,7 @@
</script> </script>
</head> </head>
<!--add by huang--> <!--add by huang-->
<body onload="prettyPrint();" style="height: 100%"> <body onload="prettyPrint();" style="height: 100%;">
<div class="newContainer"> <!-- 页面全部内容 --> <div class="newContainer"> <!-- 页面全部内容 -->
<div class="newHeader"> <!-- 头部 --> <div class="newHeader"> <!-- 头部 -->
<% if User.current.logged? %> <% if User.current.logged? %>
@ -169,6 +169,8 @@
<%# end %> <%# end %>
<%# end %> <%# end %>
</ul> </ul>
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @course %>
<span class="font-12 fr" style="color:#ccc;"><i class="fa fa-eye mr5" ></i><%= @course.visits %> 次访问</span> <span class="font-12 fr" style="color:#ccc;"><i class="fa fa-eye mr5" ></i><%= @course.visits %> 次访问</span>
</div> </div>
</div> </div>

View File

@ -30,7 +30,7 @@
}); });
</script> </script>
</head> </head>
<body onload="prettyPrint();" style="height: 100%"> <body onload="prettyPrint();" style="height: 100%; background: #fff;">
<div class="newContainer"> <!-- 页面全部内容 --> <div class="newContainer"> <!-- 页面全部内容 -->
<div class="newHeader"> <!-- 头部 --> <div class="newHeader"> <!-- 头部 -->
<%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %> <%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %>

View File

@ -42,9 +42,9 @@
<div class="alert alert-orange mb15 mt15" style="width: 1180px; margin:20px auto;"> <div class="alert alert-orange mb15 mt15" style="width: 1180px; margin:20px auto;">
试用申请已提交,我们将在一个工作日内完成审核 试用申请已提交,我们将在一个工作日内完成审核
</div> </div>
<% elsif User.current.certification == 2 || (@trail_authentication.status == 2 && (@trail_authentication.updated_at.to_i + 24*60*60) > Time.now.to_i) %> <% elsif User.current.certification == 2 || (@trail_authentication.status == 2 && (@trail_authentication.updated_at.to_i + 5*60) > Time.now.to_i) %>
<div class="alert alert-orange mb15 mt15" style="width: 1180px; margin:20px auto;"> <div class="alert alert-orange mb15 mt15" style="width: 1180px; margin:20px auto;">
您的试用申请已被拒绝,原因:<%= @trail_authentication.reason %>,请于24小时后重新申请 您的试用申请已被拒绝,原因:<%= @trail_authentication.reason %>,请于5分钟后重新申请
</div> </div>
<% end %> <% end %>
<% end %> <% end %>

View File

@ -14,7 +14,7 @@
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<%= yield :header_tags -%> <%= yield :header_tags -%>
</head> </head>
<body onload="prettyPrint();"> <body onload="prettyPrint();" style="">
<div class="newContainer"> <!-- 页面全部内容 --> <div class="newContainer"> <!-- 页面全部内容 -->
<div class="newHeader"> <!-- 头部 --> <div class="newHeader"> <!-- 头部 -->
<div class="header"><%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %></div> <div class="header"><%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %></div>

View File

@ -30,28 +30,32 @@
<% when 3 %> <% when 3 %>
<%= @sub_type == 1 ? "实训列表" :(@sub_type == 2 ? "已发布的实训": (@sub_type == 3 ? "已关闭的实训": "镜像管理")) %> <%= @sub_type == 1 ? "实训列表" :(@sub_type == 2 ? "已发布的实训": (@sub_type == 3 ? "已关闭的实训": "镜像管理")) %>
<% when 4 %> <% when 4 %>
<%= @sub_type == 1 ? "实训路径" : "已发布实训套件" %> <%= @sub_type == 1 ? "实训路径列表" : "已发布实训路径" %>
<% when 5 %> <% when 5 %>
竞赛 竞赛
<% when 6 %> <% when 6 %>
<%= @sub_type == 1 ? "单位列表" :"单位部门列表" %> <%= @sub_type == 1 ? "单位列表" :"单位部门列表" %>
<% when 7 %> <% when 7 %>
<%= @sub_type == 1 ? "用户列表" :"试用授权列表" %> <%= @sub_type == 1 ? "用户列表" :"试用授权列表" %>
<!--<%# case @next_type %>-->
<!--<%# when 1 %>-->
<!--&gt;用户列表-->
<!--<%# end %>-->
<% when 8 %> <% when 8 %>
消息 消息
<% when 9 %> <% when 9 %>
<%= @sub_type == 1 ? "实训留言列表" : "" %> <%= @sub_type == 1 ? "实训留言列表" : "" %>
<% when 10 %> <% when 10 %>
<%= @sub_type == 1 ? "实名认证":(@sub_type == 2? "试用授权":(@sub_type == 3?"部门审批":(@sub_type == 4?"单位审批":(@sub_type == 5?"全部实训发布":(@sub_type == 6?"课程实训发布":"职业认证")))))%> <%= @sub_type == 1 ? "实名认证":(@sub_type == 2? "试用授权":(@sub_type == 3?"部门审批":(@sub_type == 4?"单位审批":(@sub_type == 5?"实训发布":(@sub_type == 6?"实训路径发布":"职业认证")))))%>
<% when 11 %> <% when 11 %>
工程认证+ 工程认证+
<% when 12 %> <% when 12 %>
<%= @sub_type == 1 ?"专业列表" : "实训适用课程列表" %> <%#= @sub_type == 1 ?"专业列表" : "实训适用课程列表" %>
<% end %> <% end %>
</span> </span>
</p> </p>
<ul class="edu-admin-nav clearfix "> <ul class="edu-admin-nav clearfix ">
<li class="fl edu-admin-nav-li"><a href="javascript:void(0);" class="edu-admin-nav-a">主页</a></li> <!--<li class="fl edu-admin-nav-li"><a href="javascript:void(0);" class="edu-admin-nav-a">主页</a></li>-->
<li class="fl edu-admin-nav-li edu-position <%= 'active' if @menu_type == 2 %>"><a href="javascript:void(0);" class="edu-admin-nav-a">课堂+</a> <li class="fl edu-admin-nav-li edu-position <%= 'active' if @menu_type == 2 %>"><a href="javascript:void(0);" class="edu-admin-nav-a">课堂+</a>
<ul class="edu-admin-nav-inner edu-absolute"> <ul class="edu-admin-nav-inner edu-absolute">
<li><%= link_to "课程列表", classroom_managements_path %></li> <li><%= link_to "课程列表", classroom_managements_path %></li>
@ -68,8 +72,8 @@
</li> </li>
<li class="fl edu-admin-nav-li edu-position <%= 'active' if @menu_type == 4 %>" style="width: 100px"><a href="javascript:void(0);" class="edu-admin-nav-a" >实训路径+</a> <li class="fl edu-admin-nav-li edu-position <%= 'active' if @menu_type == 4 %>" style="width: 100px"><a href="javascript:void(0);" class="edu-admin-nav-a" >实训路径+</a>
<ul class="edu-admin-nav-inner edu-absolute"> <ul class="edu-admin-nav-inner edu-absolute">
<li style="width: 100px"><%= link_to "实训套件列表", class_shixuns_managements_path %></li> <li style="width: 100px"><%= link_to "实训路径列表", class_shixuns_managements_path %></li>
<li style="width: 100px"><%= link_to "已发布实训套件", class_publish_shixuns_managements_path %></li> <li style="width: 100px"><%= link_to "已发布实训路径", class_publish_shixuns_managements_path %></li>
</ul> </ul>
</li> </li>
<li class="fl edu-admin-nav-li"><a href="javascript:void(0);" class="edu-admin-nav-a">竞赛+</a></li> <li class="fl edu-admin-nav-li"><a href="javascript:void(0);" class="edu-admin-nav-a">竞赛+</a></li>
@ -99,16 +103,16 @@
<li><%= link_to "试用授权", :controller => "managements", :action => "trial_authorization" %></li> <li><%= link_to "试用授权", :controller => "managements", :action => "trial_authorization" %></li>
<li><%= link_to "部门审批", depart_managements_path %></li> <li><%= link_to "部门审批", depart_managements_path %></li>
<li><%= link_to '单位审批', unit_managements_path %></li> <li><%= link_to '单位审批', unit_managements_path %></li>
<li><%= link_to '全部实训发布', shixun_authorization_managements_path %></li> <li><%= link_to '实训发布', shixun_authorization_managements_path %></li>
<li><%= link_to '课程实训发布', subject_authorization_managements_path %></li> <li><%= link_to '实训路径发布', subject_authorization_managements_path %></li>
</ul> </ul>
</li> </li>
<li class="fl edu-admin-nav-li "><a href="javascript:void(0);" class="edu-admin-nav-a">工程认证+</a></li> <li class="fl edu-admin-nav-li "><a href="javascript:void(0);" class="edu-admin-nav-a">工程认证+</a></li>
<li class="fl edu-admin-nav-li edu-position <%= 'active' if @menu_type == 12 %>" style="width: 120px"><a href="javascript:void(0);" class="edu-admin-nav-a" style="border-right:none;">其它</a> <li class="fl edu-admin-nav-li edu-position <%= 'active' if @menu_type == 12 %>" ><a href="javascript:void(0);" class="edu-admin-nav-a" style="border-right:none;">其它</a>
<ul class="edu-admin-nav-inner"> <!--<ul class="edu-admin-nav-inner">-->
<li style="width: 120px"><%= link_to "专业列表",profession_managements_path %></li> <!--<li style="width: 120px"><%#= link_to "专业列表",profession_managements_path %></li>-->
<li style="width: 120px"><%= link_to "实训适用课程列表", applicable_course_managements_path %></li> <!--<li style="width: 120px"><%#= link_to "实训适用课程列表", applicable_course_managements_path %></li>-->
</ul> <!--</ul>-->
</li> </li>
</ul> </ul>
<%= render_flash_messages %> <%= render_flash_messages %>

View File

@ -15,7 +15,7 @@
<%= yield :header_tags -%> <%= yield :header_tags -%>
</head> </head>
<!--add by huang--> <!--add by huang-->
<body onload="prettyPrint();" style="height: 100%"> <body onload="prettyPrint();" style="height: 100%;background:#fff;">
<div class="newContainer"> <!-- 页面全部内容 --> <div class="newContainer"> <!-- 页面全部内容 -->
<div class="newHeader"> <!-- 头部 --> <div class="newHeader"> <!-- 头部 -->
<%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %> <%= render :partial => User.current.logged? ? 'layouts/logined_header' : 'layouts/unlogin_header' %>
@ -24,9 +24,9 @@
<div id="shixun_top"> <div id="shixun_top">
<%= render :partial => 'shixuns/shixun_top' %> <%= render :partial => 'shixuns/shixun_top' %>
</div> </div>
<div class="task-header-nav"> <div class="task-header-nav box_bg_shandow" style="background: #fff">
<ul class="task-header-navs clearfix"> <ul class="task-header-navs clearfix">
<li><a href="<%= shixun_challenges_url(@shixun) %>" class="<%= params[:action] == "index" ? "active" : "" %>" >实训</a></li> <li><a href="<%= shixun_challenges_url(@shixun) %>" class="<%= params[:action] == "index" ? "active" : "" %>" id="shixun_tab">实训</a></li>
<li><a href="<%= propaedeutics_shixun_path(@shixun) %>" class="<%= params[:action] == "propaedeutics" ? "active" : "" %>" >背景知识</a></li> <li><a href="<%= propaedeutics_shixun_path(@shixun) %>" class="<%= params[:action] == "propaedeutics" ? "active" : "" %>" >背景知识</a></li>
<% if User.current.manager_of_shixun?(@shixun) %> <% if User.current.manager_of_shixun?(@shixun) %>
<li> <li>

View File

@ -64,7 +64,7 @@
}) })
</script> </script>
</head> </head>
<body onload="prettyPrint();"> <body onload="prettyPrint();" style="height:100%">
<div class="newContainer"> <!-- 页面全部内容 --> <div class="newContainer"> <!-- 页面全部内容 -->
<div class="newHeader"> <div class="newHeader">
<% is_current_user = User.current.logged? && User.current == @user %> <% is_current_user = User.current.logged? && User.current == @user %>

View File

@ -28,17 +28,17 @@
<div class="new_content"> <div class="new_content">
<div style="width: 598px; background:#fff; margin:20px auto; font-size:14px; "> <div style="width: 598px; background:#fff; margin:20px auto; font-size:14px; ">
<div style="height:50px; width: 578px; background:#46484c; padding:9px 10px 6px;border:1px solid #ddd; border-bottom:none;"> <div style="height:50px; width: 578px; background:#46484c; padding:9px 10px 6px;border:1px solid #ddd; border-bottom:none;">
<a href="bdweb.trustie.net" > <a href="https://www.educoder.net">
<img src="http://bdweb.trustie.org/images/bigdata/new-logo.png?1485311929" width="45" height="45" style=" float:left;" > <img src="https://www.educoder.net/images/bigdata/bigdata-logo.png" width="45" height="45" style=" float:left;" >
<p style="color:#fff; float:left; margin-top:15px; margin-left:15px;">高校大数据教育平台</p> <p style="color:#fff; float:left; margin-top:15px; margin-left:15px;">Educoder</p>
</a> </a>
<div style="clear:both; overflow:hidden;"></div> <div style="clear:both; overflow:hidden;"></div>
</div> </div>
<div style="width: 558px; border-left:1px solid #ddd;border-right:1px solid #ddd; background:#fff; padding:50px 20px; color:#333; line-height: 1.9;"> <div style="width: 558px; border-left:1px solid #ddd;border-right:1px solid #ddd; background:#fff; padding:50px 20px; color:#333; line-height: 1.9;">
<p style="color:#333; font-size:16px; margin-bottom:15px;"> <p style="color:#333; font-weight: bold; font-size:16px; margin-bottom:15px;">
亲爱的<span style="font-weight:bold;color:#3b94d6; margin-left:5px; margin-right:5px;"><%= @login %></span>,您好! 亲爱的<span style="font-weight:bold;color:#3b94d6; margin-left:5px; margin-right:5px;"><%= @login %></span>,您好~
</p> </p>
<p style="color:#333;">欢迎使用高校大数据教育平台找回密码功能。<br/> <p style="color:#333;">欢迎使用Educoder平台找回密码功能。<br/>
您此次找回密码的验证码如下,请在<span style=" color:#e72c37;"> 10 分钟</span>内在找回密码页输入此验证码,并进行下一步操作。 您此次找回密码的验证码如下,请在<span style=" color:#e72c37;"> 10 分钟</span>内在找回密码页输入此验证码,并进行下一步操作。
如非你本人操作,请忽略此邮件。<br/> 如非你本人操作,请忽略此邮件。<br/>
</p> </p>
@ -48,7 +48,7 @@
</div> </div>
<span style="font-weight: normal;color:#666;"> <span style="font-weight: normal;color:#666;">
此邮件为系统所发,请勿直接回复。<br/> 此邮件为系统所发,请勿直接回复。<br/>
要解决问题或了解您的帐户详情,您可以访问 <a href="http://bdweb.trustie.org/forums/1/memos/1168" style="font-weight: normal; color:#3b94d6;">帮助中心</a>。 <!--要解决问题或了解您的帐户详情,您可以访问 <a href="http://bdweb.trustie.org/forums/1/memos/1168" style="font-weight: normal; color:#3b94d6;">帮助中心</a>。-->
</span> </span>
</div> </div>
<p style="color:#666; margin-top:30px;"> <p style="color:#666; margin-top:30px;">
@ -56,7 +56,7 @@
</p> </p>
</div> </div>
<div style="padding:20px; color:#333; line-height: 1.9;background:#46484c;border:1px solid #ddd; border-top:none; width: 558px;"> <div style="padding:20px; color:#333; line-height: 1.9;background:#46484c;border:1px solid #ddd; border-top:none; width: 558px;">
<a href="http://bdweb.trustie.org/" style="font-weight: normal; color:#fff;">bdweb.trustie.org</a> <a href="https://www.educoder.net" style="font-weight: normal; color:#fff;">www.educoder.net</a>
</div> </div>
</div> </div>
</div> </div>

View File

@ -21,34 +21,34 @@
<body style="background:#fff;"> <body style="background:#fff;">
<div class="new_content"> <div class="new_content">
<div style="width: 598px; background:#fff; margin:20px auto;"> <div style="width: 598px; background:#fff; margin:20px auto; font-size:14px; ">
<div style="height:50px; width: 578px; background:#3b94d6; padding:9px 10px 6px;border:1px solid #ddd; border-bottom:none;"> <div style="height:50px; width: 578px; background:#46484c; padding:9px 10px 6px;border:1px solid #ddd; border-bottom:none;">
<a href="https://www.trustie.net/"><img src="http://www.trustie.net/images/nav_logo.png" width="51" height="45" ></a> <a href="https://www.educoder.net">
<p style="color:#fff; float:right; margin-top:15px;">确实让创新更美好</p> <img src="https://www.educoder.net/images/bigdata/bigdata-logo.png" width="45" height="45" style=" float:left;" >
<p style="color:#fff; float:left; margin-top:15px; margin-left:15px;">Educoder</p>
</a>
<div style="clear:both; overflow:hidden;"></div> <div style="clear:both; overflow:hidden;"></div>
</div> </div>
<div style="width: 558px; border-left:1px solid #ddd;border-right:1px solid #ddd; background:#fff; padding:20px; color:#333; line-height: 1.9;"> <div style="width: 558px; border-left:1px solid #ddd;border-right:1px solid #ddd; background:#fff; padding:50px 20px; color:#333; line-height: 1.9;">
<p style="color:#333; font-weight: bold; font-size:16px; margin-bottom:15px;">
亲爱的<span style="font-weight:bold;color:#3b94d6; margin-left:5px; margin-right:5px;"><%= @login %></span>,您好~
</p>
<p style="font-size: 14px; color:#333;"> <p style="font-size: 14px; color:#333;">
您好!<br/> 您已经成功注册为Educoder用户请在24小时内点击以下链接激活您的账号<br/>
您已经成功注册为Trustie用户<br/> 如非本人操作,请忽略此邮件。<br/>
请点击以下链接激活您的帐号:<br/>
<%= link_to h(@url), @url, :style => "font-weight: normal; color:#3b94d6;" %><br/> <%= link_to h(@url), @url, :style => "font-weight: normal; color:#3b94d6;" %><br/>
<span style="font-weight: normal;color:#666;font-size: 12px;"> <span style="font-weight: normal;color:#666;font-size: 12px;">
(如果链接点击无效,请手动复制链接并粘贴到浏览器地址栏中,然后按“回车”打开页面即可) (如果链接点击无效,请手动复制链接并粘贴到浏览器地址栏中,然后按“回车”打开页面即可)
</span> </span><br/><br/>
此邮件为系统所发,请勿直接回复。<br/>
</p> </p>
<div style="width: 100%; border-top: 1px solid #ddd; margin:10px 0;"></div> <p style="color:#666; margin-top:30px;">
<img src="https://www.trustie.net/images/wechat/trustie_QR.jpg" width="120" height="120" > 如果您并未发过此请求,则可能是因为其他用户在尝试重设密码时误输了您的邮件地址,而使您收到了这封邮件,那么您可以放心的忽略此邮件,无需进一步采取任何操作。
<p style=" color:#666;">
扫一扫,关注 Trustie 微信公众号,更方便获任务通知,作业等提醒<br/>
想了解更多信息,请访问 <a href="https://www.trustie.net/" style=" color:#3b94d6;"> www.trustie.net</a>
</p> </p>
</div> </div>
<div style="padding:20px; color:#333; line-height: 1.9;background: #eee;border:1px solid #ddd; border-top:none; width: 558px;">
<p style="color:#888; float:left;">如果您在使用中有任何的疑问和建议,欢迎您给我们反馈意见<br/> <div style="padding:20px; color:#333; line-height: 1.9;background:#46484c;border:1px solid #ddd; border-top:none; width: 558px;">
联系电话13467631747 QQ群373967360</p> <a href="https://www.educoder.net" style="font-weight: normal; color:#fff;">www.educoder.net</a>
<p style="color:#888; float:right;font-weight: bold;font-size: 16px;">Trustie团队</p>
<div style="clear:both; overflow:hidden;"></div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -2,7 +2,7 @@
<thead> <thead>
<tr> <tr>
<th width="9%">ID</th> <th width="9%">ID</th>
<th width="20%" class="edu-txt-left">课堂名称</th> <th width="18%" class="edu-txt-left">课堂名称</th>
<th width="4%">成员</th> <th width="4%">成员</th>
<th width="4%">资源</th> <th width="4%">资源</th>
<th width="4%">作业</th> <th width="4%">作业</th>
@ -10,9 +10,9 @@
<th width="4%">私有</th> <th width="4%">私有</th>
<th width="8%">状态</th> <th width="8%">状态</th>
<th width="13%" class="edu-txt-left">创建者单位</th> <th width="13%" class="edu-txt-left">创建者单位</th>
<th width="11%">创建者</th> <th width="8%">创建者</th>
<th class="eud-pointer" width="11%">动态时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5" title="功能完善中,敬请期待"></i></th> <th class="eud-pointer" width="11%">动态时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5" title="功能完善中,敬请期待"></i></th>
<th>首页显示</th> <th>操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -27,11 +27,12 @@
<td><%= course.is_public.to_i == 1 ? '--' : '√' %></td> <td><%= course.is_public.to_i == 1 ? '--' : '√' %></td>
<td><%= course.is_end ? "已结束" : "正在进行" %></td> <td><%= course.is_end ? "已结束" : "正在进行" %></td>
<td class="edu-txt-left"><%= course.teacher.try(:user_extensions).try(:school).try(:name).blank? ? "--" : course.teacher.try(:user_extensions).try(:school) %></td> <td class="edu-txt-left"><%= course.teacher.try(:user_extensions).try(:school).try(:name).blank? ? "--" : course.teacher.try(:user_extensions).try(:school) %></td>
<td> <%= link_to course.teacher.show_real_name, user_path(course.teacher) %></td> <td> <%= course.teacher ? link_to(course.teacher.try(:lastname)+course.teacher.try(:firstname), user_path(course.teacher)) : "" %></td>
<td> <%= format_time(course.updatetime) %></td> <td> <%= format_time(course.updatetime) %></td>
<td> <td>
<a href="script:void(0)">删除</a>
<input type="checkbox" name="homepage_show" value="<%= course.id %>" <%= course.homepage_show ? "checked" : "" %> class="ml-3 mr5 magic-checkbox" id="join_course_role_<%= course.id %>"> <input type="checkbox" name="homepage_show" value="<%= course.id %>" <%= course.homepage_show ? "checked" : "" %> class="ml-3 mr5 magic-checkbox" id="join_course_role_<%= course.id %>">
<label style="top:-14px;padding-left: 55px;float:right;" for="join_course_role_<%= course.id %>"></label> <label style="top:0px;padding-left: 25px;float:right; margin-right: 10px" for="join_course_role_<%= course.id %>">首页显示</label>
</td> </td>
</tr> </tr>
<% end %> <% end %>

View File

@ -2,36 +2,57 @@
<thead> <thead>
<tr> <tr>
<th width="9%">ID</th> <th width="9%">ID</th>
<th width="10%">层级</th> <!--<th width="10%">层级</th>-->
<th width="12%" class="edu-txt-left">学科门类</th> <!--<th width="12%" class="edu-txt-left">学科门类</th>-->
<th width="12%">一级学科</th> <!--<th width="12%">一级学科</th>-->
<th width="12%">专业名称</th> <!--<th width="12%">专业名称</th>-->
<th width="15%" class="edu-txt-left">课程名称</th> <th width="35%" class="edu-txt-left">课程名称</th>
<th width="12%">创建者</th> <th width="8%">课堂</th>
<th class="eud-pointer">创建时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5"></i></th> <th width="8%">实训</th>
<th width="10%">创建者</th>
<th width="15%" class="eud-pointer">创建时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5"></i></th>
<th>操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<% @syllabus.each_with_index do |syllabus,index| %> <% @courselist.each_with_index do |courselist, index| %>
<tr> <tr id="courselist_show_<%= courselist.id %>">
<td><%= index + 1 %></td> <td><%= index + 1 %></td>
<td><%= syllabus.syllabus_major_level == '' ? "--" : syllabus.syllabus_major_level %></td> <!--<td><%#= syllabus.syllabus_major_level == '' ? "--" : syllabus.syllabus_major_level %></td>-->
<td class="edu-txt-left"><%= syllabus.syllabus_discipline_category == '' ? "--" : syllabus.syllabus_discipline_category %></td> <!--<td class="edu-txt-left"><%#= syllabus.syllabus_discipline_category == '' ? "--" : syllabus.syllabus_discipline_category %></td>-->
<td><%= syllabus.syllabus_first_level_discipline == "" ? "--" : syllabus.syllabus_first_level_discipline %></td> <!--<td><%#= syllabus.syllabus_first_level_discipline == "" ? "--" : syllabus.syllabus_first_level_discipline %></td>-->
<td><%= syllabus.syllabus_major == "" ? "--" : syllabus.syllabus_major %></td> <!--<td><%#= syllabus.syllabus_major == "" ? "--" : syllabus.syllabus_major %></td>-->
<td class="edu-txt-left"> <td class="edu-txt-left">
<%= link_to syllabus.title,syllabus_path(syllabus.id) %> <%= link_to courselist.name,course_path(courselist.id) %>
</td>
<td>
<%= courselist.courses.count %>
</td>
<td>
<%= ShixunMajorCourse.where(:course_list_id => courselist.id).map(&:shixun_id).count %>
</td>
<td>
<%= courselist.user.try(:show_real_name) %>
</td>
<td><%= format_time courselist.created_at %></td>
<td>
<% if courselist.courses.count != 0 || ShixunMajorCourse.where(:course_list_id => courselist.id).map(&:shixun_id).count !=0 %>
--
<% else %>
<a href="javascript:void(0);" onclick="delete_confirm_box_2('<%= management_path(courselist) %>', '确定要删除吗?')" class="fl ml10">删除&nbsp;</a>
<% end %>
<input type="checkbox" name="support_shixuns_search" value="<%= courselist.id %>" <%= courselist.support_shixuns_search ? "checked" : "" %> class="ml-3 mr5 magic-checkbox" id="join_course_role_<%= courselist.id %>">
<label style="top:0px;padding-left: 22px;float:right;padding-right: 30px" for="join_course_role_<%= courselist.id %>">支持实训检索</label>
</td> </td>
<td><%= link_to syllabus.user.show_real_name, user_path(syllabus.user) %></td>
<td><%= format_time syllabus.created_at %></td>
</tr> </tr>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>
<div class="cl"></div>
<div style="text-align:center;" class="new_expand"> <div style="text-align:center;" class="new_expand">
<div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;"> <div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;">
<ul id="homework_pository_ref_pages"> <ul id="homework_pository_ref_pages">
<%= pagination_links_full @syllabus_pages, @syllabus_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true %> <%= pagination_links_full @courselist_pages, @courselist_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>
</ul> </ul>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
@ -47,5 +68,14 @@
dateType: "script" dateType: "script"
}); });
}); });
$("input[name='support_shixuns_search']").click(function(){
var support_shixuns_search_val = $(this).val();
$.ajax({
url:"<%= support_shixuns_search_managements_path %>",
data: {shixun_id: support_shixuns_search_val},
type: 'post',
dateType: "script"
});
})
</script> </script>

View File

@ -26,7 +26,7 @@
</tbody> </tbody>
</table> </table>
<% else %> <% else %>
<%= render :partial => "welcome/no_data" %> <%= render :partial => "welcome/management_no_data" %>
<% end %> <% end %>
<div style="text-align:center;" class="new_expand"> <div style="text-align:center;" class="new_expand">
<div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;"> <div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;">

View File

@ -21,9 +21,9 @@
<td><%= format_time department.created_at %></td> <td><%= format_time department.created_at %></td>
<td> <td>
<% if UserExtensions.where(:department_id => department.id,:school_id => department.school_id ).count == 0 %> <% if UserExtensions.where(:department_id => department.id,:school_id => department.school_id ).count == 0 %>
<a href="javascript:void(0);" onclick="delete_confirm_box_2('<%= department_path(department.department_id) %>', '确定要删除该部门吗?')">删除&nbsp;</a> <a href="javascript:void(0);" onclick="delete_confirm_box_2('<%= department_path(department.department_id) %>', '确定要删除该部门吗?')">删除&nbsp;</a>
<% else %> <% else %>
-- --
<% end %> <% end %>
<%= link_to '更改', update_department_managements_path(:school_id=> department.school_id,:department_id => department.department_id), :remote => true, :class => "application-default-link" %> <%= link_to '更改', update_department_managements_path(:school_id=> department.school_id,:department_id => department.department_id), :remote => true, :class => "application-default-link" %>
</td> </td>

View File

@ -25,7 +25,7 @@
</span> </span>
</td> </td>
<td><%= schools.province %></td> <td><%= schools.province %></td>
<td class="edu-txt-left"><%= schools.province == nil ? "--" :schools.province%><%= schools.city == nil ? "" :schools.city %><%= schools.address == nil ? "" :schools.address %></td> <td class="edu-txt-left"><%= ApplyAddSchools.where(:school_id => schools.id,:status => 1).map(&:address).join("-") %></td>
<td><%= UserExtensions.where(:school_id => schools.id).count %></td> <td><%= UserExtensions.where(:school_id => schools.id).count %></td>
<td><%= schools.departments.count %></td> <td><%= schools.departments.count %></td>
<td><%= format_time schools.created_at %></td> <td><%= format_time schools.created_at %></td>

View File

@ -83,9 +83,8 @@
</tbody> </tbody>
</table> </table>
<% else %> <% else %>
<%= render :partial => "welcome/no_data" %> <%= render :partial => "welcome/management_no_data" %>
<% end %> <% end %>
<div style="text-align:center;" class="new_expand"> <div style="text-align:center;" class="new_expand">
<div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;"> <div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;">
<ul id="homework_pository_ref_pages"> <ul id="homework_pository_ref_pages">

View File

@ -15,7 +15,9 @@
<% @users.each do |user| %> <% @users.each do |user| %>
<tr> <tr>
<td><%= user.login %></td> <td><%= user.login %></td>
<td><a href="<%= user_path(user) %>" class="edu-txt-w100 task-hide" title="<%= user.try(:show_real_name) %>"><%= user.try(:show_real_name) %></a></td> <td>
<%= link_to user.try(:show_real_name),user_path(user) %>
</td>
<td><span class="edu-txt-w140 task-hide" title="<%= user.mail.blank? ? "--" : user.mail %>"><%= user.mail.blank? ? "--" : user.mail %></span></td> <td><span class="edu-txt-w140 task-hide" title="<%= user.mail.blank? ? "--" : user.mail %>"><%= user.mail.blank? ? "--" : user.mail %></span></td>
<td title="<%= user.phone.blank? ? "--" : user.phone %>"><%= user.phone.blank? ? "--" : user.phone %></td> <td title="<%= user.phone.blank? ? "--" : user.phone %>"><%= user.phone.blank? ? "--" : user.phone %></td>
<td> <td>

View File

@ -4,12 +4,14 @@
<th >&nbsp;</th> <th >&nbsp;</th>
<th>ID</th> <th>ID</th>
<th>真实姓名</th> <th>真实姓名</th>
<th>昵称</th>
<th>职业</th> <th>职业</th>
<th><a href="javascript:void(0);">学号</a></th> <th><a href="javascript:void(0);">学号</a></th>
<th>实名</th> <th>实名</th>
<th>职业</th> <th>职业</th>
<th>单位</th> <th>单位</th>
<th>子单位</th> <th>子单位</th>
<th>最后登录时间</th>
<th>试用状态</th> <th>试用状态</th>
</tr> </tr>
</thead> </thead>
@ -26,12 +28,14 @@
<td> <td>
<%= link_to user.try(:show_real_name), user_path(user), :class => "edu-txt-w100 task-hide2" %> <%= link_to user.try(:show_real_name), user_path(user), :class => "edu-txt-w100 task-hide2" %>
</td> </td>
<td><%= user.nickname == ""? "--" : user.nickname %></td>
<td><%= user.identity %></td> <td><%= user.identity %></td>
<td><%= user.try(:user_extensions).try(:student_id).blank? ? "--" : user.try(:user_extensions).try(:student_id) %></td> <td><%= user.try(:user_extensions).try(:student_id).blank? ? "--" : user.try(:user_extensions).try(:student_id) %></td>
<td><%= user.authentication ? "已认证" : "未认证" %></td> <td><%= user.authentication ? "已认证" : "未认证" %></td>
<td><%= user.professional_certification ? "已认证" : "未认证" %></td> <td><%= user.professional_certification ? "已认证" : "未认证" %></td>
<td ><span class="edu-txt-w140 task-hide2" title="<%= user.try(:user_extensions).try(:school).try(:name) %>"><%= user.try(:user_extensions).try(:school).try(:name).blank? ? "--" : user.try(:user_extensions).try(:school) %></span></td> <td ><span class="edu-txt-w140 task-hide2" title="<%= user.try(:user_extensions).try(:school).try(:name) %>"><%= user.try(:user_extensions).try(:school).try(:name).blank? ? "--" : user.try(:user_extensions).try(:school) %></span></td>
<td ><span class="edu-txt-w140 task-hide2"><%= user.try(:user_extensions).department ? user.try(:user_extensions).try(:department).try(:name).to_s : '--' %></span></td> <td ><span class="edu-txt-w140 task-hide2"><%= user.try(:user_extensions).department ? user.try(:user_extensions).try(:department).try(:name).to_s : '--' %></span></td>
<td><%= user.last_login_on.blank? ? "--" : (format_time user.last_login_on) %></td>
<td><%= identity_authentication_status(user) %></td> <td><%= identity_authentication_status(user) %></td>
</tr> </tr>
<% end %> <% end %>

View File

@ -1,16 +1,16 @@
<%= form_tag(url_for(classroom_managements_path),:id=>"classroom",:method => "post",:remote=>true) do %> <%= form_tag(url_for(classroom_managements_path),:id=>"classroom",:method => "post",:remote=>true) do %>
<div class="edu-con-top clearfix xmt10"> <div class="edu-con-top clearfix xmt10">
<%= select_tag :major_level,options_for_select(major_level_option, 0), {:id=>"major_level", :class=>"fl task-form-15 task-height-30", :style => "margin:0px 10px 0px 25px;"} %> <%#= select_tag :major_level,options_for_select(major_level_option, 0), {:id=>"major_level", :class=>"fl task-form-15 task-height-30", :style => "margin:0px 10px 0px 25px;"} %>
<%= select_tag :discipline_category_id,options_for_select(discipline_category_option, nil), {:id=>"discipline_category_id", :class=>"fl task-form-15 task-height-30", :style => "margin:0px 30px 0px 50px;"} %> <%#= select_tag :discipline_category_id,options_for_select(discipline_category_option, nil), {:id=>"discipline_category_id", :class=>"fl task-form-15 task-height-30", :style => "margin:0px 30px 0px 50px;"} %>
<%= select_tag :first_level_discipline_id,options_for_select(first_level_discipline_option, nil), {:id=>"first_level_discipline_id", :class=>"fl task-form-20 task-height-30", :style => "margin:0px 30px 0px 25px;"} %> <%#= select_tag :first_level_discipline_id,options_for_select(first_level_discipline_option, nil), {:id=>"first_level_discipline_id", :class=>"fl task-form-20 task-height-30", :style => "margin:0px 30px 0px 25px;"} %>
<%= select_tag :major_id,options_for_select(syllabus_major_option, nil), {:id=>"major_id", :class=>"fl task-form-20 task-height-30", :style => "margin:0px 30px 0px 25px;"} %> <%#= select_tag :major_id,options_for_select(syllabus_major_option, nil), {:id=>"major_id", :class=>"fl task-form-20 task-height-30", :style => "margin:0px 30px 0px 25px;"} %>
<li class="clearfix mb10 ml35 mt15 fl" style="display: inline-block"> <!--<li class="clearfix mb10 ml35 mt15 fl" style="display: inline-block">-->
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="school" class="task-height-40 panel-box-sizing fl" type="text" placeholder="请选择学校" style="width: 330px" /> <!--<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="school" class="task-height-40 panel-box-sizing fl" type="text" placeholder="请选择学校" style="width: 330px" />-->
<input nhname="tag" nh_tag_5="true" class="fl" id="school_id" name="school_id" style="display:none;" type="text"/> <!-- 单位名称的test框选中下拉列表框的id --> <!--<input nhname="tag" nh_tag_5="true" class="fl" id="school_id" name="school_id" style="display:none;" type="text"/> &lt;!&ndash; 单位名称的test框选中下拉列表框的id &ndash;&gt;-->
<div class="cl"></div> <!--<div class="cl"></div>-->
</li> <!--</li>-->
<div id="search_school_result_list" style="width: 330px;line-height: 1.5;min-height:20px; max-height: 200px; height: auto !important;display:none;background: white;overflow: scroll;border: solid 1px #cccccc; overflow-x: hidden; overflow-y: auto;"> <!--<div id="search_school_result_list" style="width: 330px;line-height: 1.5;min-height:20px; max-height: 200px; height: auto !important;display:none;background: white;overflow: scroll;border: solid 1px #cccccc; overflow-x: hidden; overflow-y: auto;">-->
</div> <!--</div>-->
<!--</select>--> <!--</select>-->
<select class="fl task-form-15 task-height-30" style="margin:20px 0px 10px 25px;width: 11%" name="keyword" id="condition"> <select class="fl task-form-15 task-height-30" style="margin:20px 0px 10px 25px;width: 11%" name="keyword" id="condition">
<option value="u_name">创建者姓名搜索</option> <option value="u_name">创建者姓名搜索</option>
@ -19,6 +19,10 @@
<input class="fl task-form-20 task-height-30 mt20" name="search" maxlength="" placeholder="输入关键字进行搜索" type="text" style="height: 21px;" id="Look_name"> <input class="fl task-form-20 task-height-30 mt20" name="search" maxlength="" placeholder="输入关键字进行搜索" type="text" style="height: 21px;" id="Look_name">
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5 mt20" onclick="$('#classroom').submit();">搜索</a> <a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5 mt20" onclick="$('#classroom').submit();">搜索</a>
<a href="javascript:clearSearchCondition()" class="fl task-btn ml5 mt2 mt20" id="clear_contents">清除</a> <a href="javascript:clearSearchCondition()" class="fl task-btn ml5 mt2 mt20" id="clear_contents">清除</a>
<span class="fr shixun_webssh">
<input type="checkbox" class="mr5 magic-checkbox" name="support_shixuns_search_title" value="1" id="join_course_role_0">
<label style="top:2px;padding-left:23px;" for="join_course_role_0"><span class="only_view">支持实训检索</span></label>
</span>
<input name="sx_order" type="hidden"> <input name="sx_order" type="hidden">
</div> </div>
<% end %> <% end %>
@ -26,14 +30,18 @@
<%= render :partial => "managements/classroom_list" %> <%= render :partial => "managements/classroom_list" %>
</div> </div>
<script> <script>
//支持实训检索
$("#join_course_role_0").on("click",function(){
$('#classroom').submit();
});
function clearSearchCondition(){ function clearSearchCondition(){
$("#part").val(""); // $("#part").val("");
$("#condition").val("u_name"); $("#condition").val("u_name");
$("#Look_name").val(""); $("#Look_name").val("");
$("#major_level").val(""); // $("#major_level").val("");
$("#discipline_category_id").val(""); // $("#discipline_category_id").val("");
$("#major_id").val("0"); // $("#major_id").val("0");
$("#first_level_discipline_id").val(""); // $("#first_level_discipline_id").val("");
$.get('<%= classroom_managements_path() %>'); $.get('<%= classroom_managements_path() %>');
} }
$("input[name='school']").on('input', function (e) { $("input[name='school']").on('input', function (e) {

View File

@ -1,29 +1,35 @@
<%= form_tag(url_for(classroom_classment_managements_path), :id => "class_publish_shixuns_search", :method => "post", :remote => true ) do %> <%= form_tag(url_for(classroom_classment_managements_path), :id => "class_publish_shixuns_search", :method => "post", :remote => true ) do %>
<div class="edu-con-top clearfix xmt10"> <div class="edu-con-top clearfix xmt10">
<select class="fl task-form-10 task-height-30" style="margin:0px 10px 0px 25px;" id="status" name="status"> <select class="task-form-10 task-height-30 fl" style="margin:0px 10px 0px 25px;" id="status" name="status">
<option value="" selected="selected">全部状态</option> <option value="" selected="selected">全部状态</option>
<option value="0">正在进行(<%= @timing %>)</option> <option value="0">正在进行(<%= @timing %>)</option>
<option value="1">已结束(<%= @end %>)</option> <option value="1">已结束(<%= @end %>)</option>
</select> </select>
<li class="fl task-height-30 mb10 ml35" style="display: inline-block"> <li class="task-height-30 ml15 fl" style="display: inline-block;">
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="school" class="task-height-40 panel-box-sizing fl" type="text" placeholder="请选择学校" style="width: 330px" /> <input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="school" class="task-height-40 panel-box-sizing fl" type="text" placeholder="请选择学校" style="width: 330px;height:32px" />
<input nhname="tag" nh_tag_5="true" class="fl" id="school_id" name="school_id" style="display:none;" type="text"/> <!-- 单位名称的test框选中下拉列表框的id --> <input nhname="tag" nh_tag_5="true" class="fl" id="school_id" name="school_id" style="display:none;" type="text"/> <!-- 单位名称的test框选中下拉列表框的id -->
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<div id="search_school_result_list" style="width: 330px;line-height: 1.5;min-height:20px; max-height: 200px; height: auto !important;display:none;background: white;overflow: scroll;border: solid 1px #cccccc; overflow-x: hidden; overflow-y: auto;"> <div id="search_school_result_list" style="width: 330px;line-height: 1.5;min-height:20px; max-height: 200px; height: auto !important;display:none;background: white;overflow: scroll;border: solid 1px #cccccc; overflow-x: hidden; overflow-y: auto;">
</div> </div>
<select class="fl task-form-15 task-height-30" style="margin:0px 0px 10px 25px;width: 11%" name="keyword" id="condition_status"> <select class="task-form-15 task-height-30 fl" style="margin:0px 0px 0px 25px;width: 11%" name="keyword" id="condition_status">
<option value="u_name">创建者姓名搜索</option> <option value="u_name">创建者姓名搜索</option>
<option value="cla_name">班级名称搜索</option> <option value="cla_name">课程名称搜索</option>
</select> </select>
<input class="fl task-form-20 task-height-30" name="search" maxlength="" placeholder="输入关键字进行搜索" type="text" style="height: 21px;" id="Look_name" > <input class="task-form-20 task-height-30 fl" name="search" maxlength="" placeholder="输入关键字进行搜索" type="text" style="height: 21px;" id="Look_name" >
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5" onclick="$('#class_publish_shixuns_search').submit();">搜索</a> <a href="javascript:void(0);" class=" task-btn task-btn-blue ml5 mt3 fl mb5 " onclick="$('#class_publish_shixuns_search').submit();">搜索</a>
<a href="javascript:clearSearchCondition();" class="fl task-btn ml5 mt2 " id="clear_contents">清除</a> <a href="javascript:clearSearchCondition();" class="task-btn ml5 mt3 fl mb5" id="clear_contents" >清除</a>
<span class="fr shixun_webssh"> <span class="fr shixun_webssh">
<input type="checkbox" class="mr5 magic-checkbox" name="homepage_show" value="1" id="join_course_role_0"> <input type="checkbox" class="mr5 magic-checkbox" name="homepage_show" value="1" id="join_course_role_0">
<label style="top:2px;padding-left:23px;" for="join_course_role_0"><span class="only_view">只看首页显示</span></label> <label style="top:2px;padding-left:23px;" for="join_course_role_0"><span class="only_view">只看首页显示</span></label>
</span> </span>
<select class="mt10 task-form-20 task-height-30 ml25 fl" name="course_list" id="course_list">
<option value="" selected="selected">课程名称</option>
<% @course_lists.each do |course_list| %>
<option value="<%= course_list.id %>"><%= course_list.name %></option>
<% end %>
</select>
<input name="sx_order" type="hidden"> <input name="sx_order" type="hidden">
</div> </div>
<% end %> <% end %>
@ -36,6 +42,7 @@
$("#part").val(""); $("#part").val("");
$("#condition_status").val("uname") $("#condition_status").val("uname")
$("#Look_name").val(""); $("#Look_name").val("");
$("#course_list").val("");
$.get('<%= classroom_classment_managements_path() %>') $.get('<%= classroom_classment_managements_path() %>')
}; };

View File

@ -1,6 +1,6 @@
<%= form_tag(url_for(departments_managements_path),:id=>"department_search",:method => "post",:remote=>true) do %> <%= form_tag(url_for(departments_managements_path),:id=>"department_search",:method => "post",:remote=>true) do %>
<div class="edu-con-top clearfix mb20 xmt10"> <div class="edu-con-top clearfix mb20 xmt10">
<input class="fl task-form-20 task-height-30 ml35" id="shixun_Look_name" name="search" maxlength="" placeholder="输入关键字进行搜索" type="text" style="height: 21px;" onkeyup="myFunction()"> <input class="fl task-form-20 task-height-30 ml35" id="shixun_Look_name" name="search" maxlength="" placeholder="输入关键字进行搜索" type="text" style="height: 21px;">
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5 mt2" onclick="$('#department_search').submit();">搜索</a> <a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5 mt2" onclick="$('#department_search').submit();">搜索</a>
<a href="javascript:clearSearchCondition();" class="fl task-btn ml5 mt2" id="clear_contents">清除</a> <a href="javascript:clearSearchCondition();" class="fl task-btn ml5 mt2" id="clear_contents">清除</a>
<%= link_to '创建',{:controller => 'managements', :action => 'create_departments'}, :remote => true, :class => "task-btn task-btn-green fr mt6 mr30" %> <%= link_to '创建',{:controller => 'managements', :action => 'create_departments'}, :remote => true, :class => "task-btn task-btn-green fr mt6 mr30" %>

View File

@ -0,0 +1,5 @@
for(var i=0; i<$("#courselist_show_<%= @courselist.id %>").nextAll().length; i++){
var index = parseInt($($("#courselist_show_<%= @courselist.id %>").nextAll()[i]).children(":first").html());
$($("#courselist_show_<%= @courselist.id %>").nextAll()[i]).children(":first").html(index - 1);
}
$("#courselist_show_<%= @courselist.id %>").remove();

View File

@ -20,13 +20,78 @@
</ul> </ul>
</div> </div>
<div class="fl with30"> <div class="fl with30">
<input type="text" class="fl task-form-60 task-height-40 panel-box-sizing" name="research_contents" placeholder="输入关键字进行搜索"> <input type="text" class="fl task-form-100 task-height-40 panel-box-sizing" name="research_contents" placeholder="输入关键字进行搜索">
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5 mt5" onclick="$('#managements_users_search').submit();">搜索</a>
<a href="javascript:void(0);" class="fl task-btn ml5 mt5" id="clear_contents">清除</a>
</div> </div>
<!-- <a href="javascript:void(0);" class="fr task-btn task-btn-green mt5">新建用户</a>--> <li class="fl task-height-30 mb10 ml35" style="display: inline-block">
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="school" class="task-height-40 panel-box-sizing fl" type="text" placeholder="请输入单位名称关键字进行搜索" style="width: 330px" />
<input nhname="tag" nh_tag_5="true" class="fl" id="school_id" name="school_id" style="display:none;" type="text"/> <!-- 单位名称的test框选中下拉列表框的id -->
<div class="cl"></div>
</li>
<div id="search_school_result_list" style="width: 330px;line-height: 1.5;min-height:20px; max-height: 200px; height: auto !important;display:none;background: white;overflow: scroll;border: solid 1px #cccccc; overflow-x: hidden; overflow-y: auto;">
</div>
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5 mt5" onclick="$('#managements_users_search').submit();">搜索</a>
<a href="javascript:void(0);" class="fl task-btn ml5 mt5" id="clear_contents">清除</a>
<!-- <a href="javascript:void(0);" class="fr task-btn task-btn-green mt5"> 新建用户</a>-->
<% end %> <% end %>
</div> </div>
<div class="edu-con-bg01 mt15" id="managements_user_list"> <div class="edu-con-bg01 mt15" id="managements_user_list">
<%= render :partial => "managements/user_list" %> <%= render :partial => "managements/user_list" %>
</div> </div>
<script>
$("input[name='school']").on('input', function (e) {
throttle(department_search_fn, window, e);
});
var d_lastSearchCondition = '';
var d_page = 1; //唯一控制页码 变量
var d_count = 0; //查询结果的总量
var d_maxPage = 0;//最大页面值
function department_search_fn(e) {
if($(e.target).val().trim() == ''){
$("#search_school_result_list").hide();
$("input[name='school_id']").val("");
return;
}
if ($(e.target).val().trim() == d_lastSearchCondition && $(e.target).val().trim() != '') {//如果输入框没有改变或者输入框为空就返回
return;
}
d_lastSearchCondition = $(e.target).val().trim();
page = 1; //有新的搜索页面重置为1
$.ajax({
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value + '&school_id=' + $("input[name='occupation']").val() + '&page=' + d_page,
type: 'post',
success: function (data) {
d_schoolsResult = data.schools;
count = data.count;
maxPage = Math.ceil(count / 100); //最大页码值
if (d_schoolsResult.length != undefined && d_schoolsResult.length != 0) {
var i = 0;
$("#search_school_result_list").html('');
for (; i < d_schoolsResult.length; i++) {
link = '<a onclick="window.changeSchoolValue(\'' + d_schoolsResult[i].school.name.replace(/\s/g, " ") + '\',\'' + d_schoolsResult[i].school.id + '\')" href="javascript:void(0)">' + d_schoolsResult[i].school.name + '</a><br/>';
$("#search_school_result_list").append(link);
}
$("#search_school_result_list").css('left', $(e.target).offset().left);
$("#search_school_result_list").css('top', $(e.target).offset().top + 40);
$("#search_school_result_list").css("position", "absolute");
$("#search_school_result_list").show();
} else {
$("#search_school_result_list").css('left', $(e.target).offset().left);
$("#search_school_result_list").css('top', $(e.target).offset().top + 40);
$("#search_school_result_list").css("position", "absolute");
$("#search_school_result_list").html('你的学校不在列表中?请确认后输入');
$("#search_school_result_list").show();
}
}
});
}
//修改部门
function changeSchoolValue(value, data) {
console.log(value+","+data)
$("input[name='school']").val(value);
$("input[name='school_id']").val(data);
$("#search_school_result_list").hide();
}
</script>

View File

@ -26,6 +26,7 @@
<li data-val="name">真实姓名搜索</li> <li data-val="name">真实姓名搜索</li>
<li data-val="email">邮箱地址搜索</li> <li data-val="email">邮箱地址搜索</li>
<li data-val="phone">手机号码搜索</li> <li data-val="phone">手机号码搜索</li>
<li data-val="nickname">用户昵称搜索</li>
</ul> </ul>
</div> </div>
<div class="fl with30"> <div class="fl with30">

View File

@ -59,7 +59,7 @@
</div> </div>
<% end %> <% end %>
</div> </div>
<% end %> <% end %>
<div class="comment_content clearfix" onmouseover="$('#delete_reply_<%=activity.id %>_<%=comment.id %>').show();" onmouseout="$('#delete_reply_<%=activity.id %>_<%=comment.id %>').hide();"> <div class="comment_content clearfix" onmouseover="$('#delete_reply_<%=activity.id %>_<%=comment.id %>').show();" onmouseout="$('#delete_reply_<%=activity.id %>_<%=comment.id %>').hide();">
<div class="t_txt"><%= comment.content_detail.html_safe %></div> <div class="t_txt"><%= comment.content_detail.html_safe %></div>
<div class=""> <div class="">

View File

@ -6,11 +6,11 @@
<%= link_to @course.name, course_path(@course), :title => "班级" %> &gt; <%= link_to "讨论区列表", course_boards_path(@course) %> &gt; <span>新建</span> <%= link_to @course.name, course_path(@course), :title => "班级" %> &gt; <%= link_to "讨论区列表", course_boards_path(@course) %> &gt; <span>新建</span>
</p> </p>
<div class="edu-con-top"> <div class="edu-con-top box_bg_shandow bor-grey-e">
<p class="ml15 color-grey">新建帖子</p> <p class="ml15 color-grey">新建帖子</p>
</div> </div>
<div class="panel-content-box clearfix mt15"> <div class="panel-content-box clearfix mt15 box_bg_shandow bor-grey-e">
<%= form_for @message, :url => create_board_message_path(:board_id => @board.id), :html => {:multipart => true, :id => 'message-form'} do |f| %> <%= form_for @message, :url => create_board_message_path(:board_id => @board.id), :html => {:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => "form_course", :locals => {:f => f} %> <%= render :partial => "form_course", :locals => {:f => f} %>
<% end %> <% end %>

View File

@ -25,7 +25,7 @@
<div class="edu-tab clearfix mb20 user_bg_shadow"> <div class="edu-tab clearfix mb20 user_bg_shadow">
<div class="panel-inner-fourm nobg"> <div class="panel-inner-fourm nobg">
<%= link_to image_tag(url_to_avatar(@topic.author), :width => 60, :height => 60, :alt => "用户头像", :class => "panel-list-img mr15"), user_path(@topic.author) %> <%= link_to image_tag(url_to_avatar(@topic.author), :width => 60, :height => 60, :alt => "用户头像", :class => "panel-list-img mr15"), user_path(@topic.author) %>
<div class="panel-list-infobox clearfix"> <div class="panel-list-infobox clearfix" style="margin-top:0">
<h6 class="panel-list-title fl"> <h6 class="panel-list-title fl">
<%= @topic.subject %> <%= @topic.subject %>
<% if @topic.sticky == 1 %> <% if @topic.sticky == 1 %>
@ -36,13 +36,13 @@
<p class="fr mt3 font-16"> <p class="fr mt3 font-16">
<!--<a href="javascript:void(0);" class="mr10" title="发送" onclick="show_send(<%#= @topic.id %>, <%#= User.current.id %>, 'message');"><i class="fa fa-send-o"></i></a>--> <!--<a href="javascript:void(0);" class="mr10" title="发送" onclick="show_send(<%#= @topic.id %>, <%#= User.current.id %>, 'message');"><i class="fa fa-send-o"></i></a>-->
<% if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) || User.current == @topic.author %> <% if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) || User.current == @topic.author %>
<a href="<%= edit_board_message_path(@topic.board_id, @topic) %>" class="mr10" title="编辑"><i class="fa fa-edit"></i></a> <a href="<%= edit_board_message_path(@topic.board_id, @topic) %>" class="mr10" data-tip-down="编辑"><i class="fa fa-edit"></i></a>
<% end %> <% end %>
<% if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) %> <% if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) %>
<a href="<%= sticky_topic_board_message_path(@topic.board_id, @topic) %>" class="mr10" title="<%= @topic.sticky == 1 ? '取消置顶' : '置顶' %>"><i class="fa <%= @topic.sticky == 1 ? 'fa-arrow-circle-o-down' : 'fa-arrow-circle-o-up' %>"></i></a> <a href="<%= sticky_topic_board_message_path(@topic.board_id, @topic) %>" class="mr10" data-tip-down="<%= @topic.sticky == 1 ? '取消置顶' : '置顶' %>"><i class="fa <%= @topic.sticky == 1 ? 'fa-arrow-circle-o-down' : 'fa-arrow-circle-o-up' %>"></i></a>
<% end %> <% end %>
<% if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) || User.current == @topic.author %> <% if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) || User.current == @topic.author %>
<a href="javascript:void(0);" class="mr10" title="删除"><i class="fa fa-trash-o"></i></a> <a href="javascript:void(0);" class="mr10" data-tip-down="删除"><i class="fa fa-trash-o"></i></a>
<% end %> <% end %>
</p> </p>
<% end %> <% end %>

View File

@ -8,7 +8,7 @@
<label class="fl panel-form-label"><span class="color-red mr5">*</span>标题:</label> <label class="fl panel-form-label"><span class="color-red mr5">*</span>标题:</label>
<input type="text" class="panel-form-width-690 panel-form-height-30 fl panel-box-sizing" value="<%= @message.subject %>" name="message[subject]" id="course_message_subject" maxlength="100" onkeyup="regexSubject();" placeholder="字数100以内"/> <input type="text" class="panel-form-width-690 panel-form-height-30 fl panel-box-sizing" value="<%= @message.subject %>" name="message[subject]" id="course_message_subject" maxlength="100" onkeyup="regexSubject();" placeholder="字数100以内"/>
<div class="cl"></div> <div class="cl"></div>
<span class="color-orange fl none" id="new_course_message_notice" style="margin-left:10%;"><i class="fa fa-exclamation-circle mr5" ></i>课程名称不能为空</span> <span class="color-orange fl none" id="new_course_message_notice" style="margin-left:10%;"><i class="fa fa-exclamation-circle mr5" ></i>帖子名称不能为空</span>
</li> </li>
<% if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) %> <% if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) %>
<li class="clearfix"> <li class="clearfix">

View File

@ -261,7 +261,7 @@
<div id="show_account_div" class=""> <div id="show_account_div" class="">
<div class="panel-form mr15 mt30"> <div class="panel-form mr15 mt30">
<a href="javascript:void(0);" class="fr mb10" id="edit_my_account"><i class="fa fa-pencil font-16" data-tip-down="编辑资料"></i></a> <a href="javascript:void(0);" class="fr mb10" id="edit_my_account"><i class="fa fa-pencil font-16" data-tip-down="编辑资料"></i><span class="ml10 color-grey">编辑</span></a>
<div class="cl"></div> <div class="cl"></div>
<ul> <ul>

View File

@ -1,5 +1,5 @@
<div class="autoscroll"> <div class="autoscroll">
<table class="list entries mt5" id="browser" style="table-layout: fixed;"> <table class="list entries mt5 box_bg_shandow" id="browser" style="table-layout: fixed;">
<% unless @path.blank? %> <% unless @path.blank? %>
<tbody> <tbody>
<tr style="border: 1px solid #DDD; border-bottom:none;"> <tr style="border: 1px solid #DDD; border-bottom:none;">

View File

@ -1,4 +1,4 @@
<div class="new_roadmap_conbox mb10" > <div class="new_roadmap_conbox mb10 mt15">
<div class=" clear"> <div class=" clear">
<ul class="reply-container-branch fl" > <ul class="reply-container-branch fl" >
<%= render :partial => 'shixun_navigation' %> <%= render :partial => 'shixun_navigation' %>

View File

@ -1,4 +1,4 @@
<div class="container-big"> <div class="container-big mt15">
<div class="new_roadmap_conbox mb10" > <div class="new_roadmap_conbox mb10" >
<div class="new_roadmap_info_top clear "> <div class="new_roadmap_info_top clear ">
<%=link_to "<span class='new_roadmap_icons_back mr5'></span>返回提交历史".html_safe, <%=link_to "<span class='new_roadmap_icons_back mr5'></span>返回提交历史".html_safe,

View File

@ -3,13 +3,18 @@
<em></em> <em></em>
<span></span> <span></span>
<p class="font-12"> <p class="font-12">
使用Git提交代码时请在Git客户端填写如下信息<br/> 提交代码的方法:<br/>
* 用户名:请使用您绑定的邮箱<br/> 1、在你自己的电脑安装Git tortoise客户端<br/>
* 口令:请使用您的登录口令<br/> 或者其他你熟悉的Git客户端<br/>
2、在Git客户端向左侧的地址提交代码。<br/>
注意:<br/>
请务必在Git客户端填写如下信息<br/>
* 用户名:使用您在本平台绑定的邮箱<br/>
* 口令:使用您在本平台的登录口令<br/>
</p> </p>
</div> </div>
<div class="repository_con" style="line-height:1.9;"> <div class="repository_con" style="line-height:1.9;">
<ul class="clearfix pro-top-info mb10"> <ul class="clearfix pro-top-info mb10 box_bg_shandow">
<li style="width: 459px;"><i class="icon-time mr5 c_grey02 f16 fb"></i> <li style="width: 459px;"><i class="icon-time mr5 c_grey02 f16 fb"></i>
<%=link_to "#{choise_commit_count(@changesets_all_count, @g_project.commit_count.to_i)}", <%=link_to "#{choise_commit_count(@changesets_all_count, @g_project.commit_count.to_i)}",
{:action => 'commits', :path => to_path_param(@path), :id => @shixun, :repository_id => @repository.identifier_param, {:action => 'commits', :path => to_path_param(@path), :id => @shixun, :repository_id => @repository.identifier_param,

View File

@ -1,6 +1,6 @@
<%= stylesheet_link_tag '/editormd/css/editormd' %> <%= stylesheet_link_tag '/editormd/css/editormd' %>
<%= javascript_include_tag '/editormd/editormd' %> <%= javascript_include_tag '/editormd/editormd' %>
<div class="edu-con-bg01 user_bg_shadow mb20" style="padding:30px 0;"> <div class="edu-con-bg01 mb20" style="padding:30px 0;">
<div class="ml30 mr30"> <div class="ml30 mr30">
<div> <div>
<ul> <ul>
@ -37,24 +37,23 @@
<p id="e_tips_pr" style="margin-left: 10%" class="c_grey"></p> <p id="e_tips_pr" style="margin-left: 10%" class="c_grey"></p>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<li class="clearfix mb15"> <!--<li class="clearfix mb15">-->
<label class="panel-form-label fl"><span class="color-orange mr5">*</span>适用专业&nbsp;&nbsp;&nbsp;</label> <!--<label class="panel-form-label fl"><span class="color-orange mr5">*</span>适用专业&nbsp;&nbsp;&nbsp;</label>-->
<%#= select_tag :major_id, options_for_select(shixun_major_option, 0), :id => 'shixun_major', :class => "fl task-form-30 task-height-40"%> <!--<%#= select_tag :major_id, options_for_select(shixun_major_option, 0), :id => 'shixun_major', :class => "fl task-form-30 task-height-40"%>-->
<select class="fl task-form-30 task-height-40" id="shixun_major" name="major_id"> <!--<select class="fl task-form-30 task-height-40" id="shixun_major" name="major_id">-->
<option value="0" selected="selected">选择实训适用专业</option> <!--<option value="0" selected="selected">选择实训适用专业</option>-->
<% @support.each do |support| %> <!--<%# @support.each do |support| %>-->
<option value="<%= support.id %>"><%= support.name %></option> <!--<option value="<%#= support.id %>"><%#= support.name %></option>-->
<% end %> <!--<%# end %>-->
</select> <!--</select>-->
<div class="cl"></div> <!--<div class="cl"></div>-->
<p class="text-danger ml115" id="shixun_major_notice" style="display: none;">请选择适用专业</p> <!--<p class="text-danger ml115" id="shixun_major_notice" style="display: none;">请选择适用专业</p>-->
</li> <!--</li>-->
<li class="clearfix mb15 pr"> <li class="clearfix mb15 pr">
<label class="panel-form-label fl"><span class="color-orange mr5">*</span>适用课程&nbsp;&nbsp;&nbsp;</label> <label class="panel-form-label fl"><span class="color-orange mr5">*</span>适用课程&nbsp;&nbsp;&nbsp;</label>
<div id="shixun[lesson]" class="fl task-form-28 task-height-40 lesson pr"> <div id="shixun[lesson]" class="pr fl with30">
<input type="text" class="lesson_content" readonly placeholder="选择实训适用的课程"> <input type="text" name="course_list" autocomplete="off" style="border: 1px solid #eee;width: 100%;padding: 5px;" id="new_course_list" class="task-height-40 panel-box-sizing fl color-grey" maxlength="100" placeholder="选择实训适用的课程">
<i class="fa fa-sort-desc lesson_img"></i> <ul class="course_list_ul">
<ul class="lesson_checkbox" showul="0">
</ul> </ul>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
@ -88,93 +87,36 @@
$(function(){ $(function(){
$("#websh").on("click", function(){ $("#websh").on("click", function(){
$(this).val() == '0' ? $(this).val('1') : $(this).val("0"); $(this).val() == '0' ? $(this).val('1') : $(this).val("0");
}) });
// 实训简介自动保存 // 实训简介自动保存
md_elocalStorage(shixun_editormd, "shixun_in_<%= User.current.id %>", "in"); md_elocalStorage(shixun_editormd, "shixun_in_<%= User.current.id %>", "in");
md_elocalStorage(shixun_propaedeutics, "shixun_pr_<%= User.current.id %>", "pr"); md_elocalStorage(shixun_propaedeutics, "shixun_pr_<%= User.current.id %>", "pr");
//$("textarea[name='shixun[description]']").md_elocalStorage(); //$("textarea[name='shixun[description]']").md_elocalStorage();
// 防止刷新页面后适用课程的下拉列表为空 $("#new_course_list").on('input', function(e){
$("#shixun_major").val("0"); throttle(search_course_list, window, e);
$(".lesson_content").val("");
//多选适用课程
$("body").click(function(event){
$(".lesson_checkbox").hide();
$(".lesson_checkbox").attr("showul","0");
event.stopPropagation();
}); });
$(".lesson").click(function(event){ $("#new_course_list").on('focus', function (e) {
if($("#shixun_major").val() == "0") { if ($("#new_course_list").val().trim() != '') { //如果已经有id了。肯定存在不用去找了。
$("#shixun_major_course_notice").html("请先选择适用专业").show(); return;
} else{ } else{
var showul=$(this).find("ul").attr("showul"); search_course_ajax('');
if(showul=="0"){
$(this).find("ul").show();
$(this).find("ul").attr("showul","1");
if($(this).find("ul input").length>5){
$(this).find("ul").css("overflow-y","scroll");
}
event.stopPropagation();
}else{
$(this).find("ul").hide();
$(this).find("ul").attr("showul","0");
event.stopPropagation();
}
} }
}); });
$(".lesson_checkbox").on('click', 'label', function(event) {
$(".course_list_ul").on('click', 'p',function(event) {
$("#new_course_list").val($(this).html());
$(".course_list_ul").hide();
event.stopPropagation(); event.stopPropagation();
}); });
$(".lesson_checkbox").on('click', 'input',function(event) {
if ($(this).is(':checked')) { $("body").click(function(event){
if ($(".lesson_content").val() == "") { $(".course_list_ul").hide();
$(".lesson_content").val($(this).attr("data-val")); event.stopPropagation();
} else {
$(".lesson_content").val($(".lesson_content").val() + "," + $(this).attr("data-val"));
}
$("#shixun_major_course_notice").hide();
event.stopPropagation();
} else {
var valueCon = $(".lesson_content").val().split(",");
var list = [];
for (var i = 0; i < valueCon.length; i++) {
if (valueCon[i] != $(this).attr("data-val")) {
list.push(valueCon[i]);
}
}
$(".lesson_content").val(list);
event.stopPropagation();
}
}); });
}); });
$("#shixun_major").on("change", function(){
if($("#shixun_major").val() != "0"){
$.ajax({
url: '/shixuns/shixun_courses',
type: 'get',
data: {major_id:$("#shixun_major").val()},
success: function(data){
if (data.result == 1){
$(".lesson_content").val("");
$(".lesson_checkbox").html("");
for(var i=0; i<data.options.length; i++){
$(".lesson_checkbox").append('<li><input type="checkbox" name="course_id[]" data-val="'+ data.options[i][0] +'" value="'+ data.options[i][1] +'" id="join_course_role_'+ i +'" class="ml-3 mr5 magic-checkbox"><label for="join_course_role_'+ i +'">'+ data.options[i][0] +'</label></li>');
}
$("#shixun_major_notice").hide();
}
else{
$(".lesson_content").val("");
$(".lesson_checkbox").html("");
}
}
});
} else{
$(".lesson_content").val("");
$(".lesson_checkbox").html("");
}
});
/* ------------------------------- 简介md ------------------------------*/ /* ------------------------------- 简介md ------------------------------*/
var shixun_editormd = editormd("shixun_introduction", { var shixun_editormd = editormd("shixun_introduction", {
width : "89.7%", width : "89.7%",
@ -235,7 +177,7 @@
//提交新建项目 //提交新建项目
function submit_new_project() function submit_new_project()
{ {
if(regex_shixun_name() && regex_major() && regex_major_course()) if(regex_shixun_name() && regex_major_course())
{ {
$("#new_shixun").submit(); $("#new_shixun").submit();
} }

View File

@ -0,0 +1,28 @@
<div class="clearfix mb5 edu-bg-light-blue edu-h260">
<ul class="">
<% unless @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" 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 %>
</ul>
</div>
<p><span class="c_red undis notice" id="search_course_notice">请至少选择一个实训</span></p>
<div>
<div class="fl pages_little_show">
<ul>
<%= pagination_links_full @pages, @courses.count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
<a href="javascript:void(0);" class="task-btn task-btn-blue fr" id="submit_send_shixun">确定</a>
<a href="javascript:void(0);" onclick="hideModal();" class="pop_close task-btn fr mr10">取消</a>
<div class="cl"></div>
</div>

View File

@ -10,41 +10,37 @@
选择的实训将会发送到指定课堂 选择的实训将会发送到指定课堂
</div> </div>
<div class="mb10 edu-position"> <div class="mb10 edu-position">
<input class="task-form-100 task-height-40 panel-box-sizing" id="hb_search_course_input" name="search" placeholder="输入实训名称的关键字进行搜索" type="text" > <%= form_tag(search_user_courses_shixun_path(@shixun), :remote => true, :method => 'get', :id => "search_user_courses_form") do %>
<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 task-height-40 panel-box-sizing" maxlength="50" id="hb_search_course_input" name="search" placeholder="输入课堂名称的关键字进行搜索" type="text" >
</div> <a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt5" id="search_icon"><i class="fa fa-search"></i></a>
<div class="clearfix mb5 edu-bg-light-blue edu-max-h260"> <% end %>
<input type="hidden" name="homework_id[]">
<ul class="" id="search_course_list">
<li class="clearfix">
<label class="fl mt5 ml5 edu-class-pop-label edu-color-grey">
<input id="send_shixun_1" type="checkbox" class="fl mt8 mr5 magic-checkbox" name="shixun" value="0">
<label for="send_shixun_1" class="edu-info-dark task-hide fl" title="C++基本课程">C++基本课程</label>
</label>
</li>
<li class="clearfix">
<label class="fl mt5 ml5 edu-class-pop-label edu-color-grey">
<input id="send_shixun_2" type="checkbox" class="fl mt8 mr5 magic-checkbox" name="shixun" value="1">
<label for="send_shixun_2" class="edu-info-dark task-hide fl" title="软件测试">软件测试</label>
</label>
</li>
</ul>
</div>
<p><span class="c_red undis notice">请至少选择一个实训</span></p>
<div>
<div class="fl pages_little_show">
<ul>
<li><a href="" class="pages-big" data-remote="true">上一页</a></li>
<li><a class="active">1</a></li>
<li><a href="" class="pages-big pages-border-right" data-remote="true">下一页</a></li>
</ul>
<div class="cl"></div>
</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">确定</a>
<a href="javascript:void(0);" class="pop_close task-btn fr mr10">取消</a>
<div class="cl"></div>
</div> </div>
<%= form_tag(send_to_course_shixun_path(@shixun), :id => "choose_course_to_shixun") do %>
<div id="search_course_list">
<%= render :partial => "shixuns/search_course_list" %>
</div>
<% end %>
</div> </div>
</div> </div>
</div> </div>
<script>
$(function(){
var last_search = "";
$("#search_icon").on('click', function(){
if($("#hb_search_course_input").val().trim() != last_search){
last_search = $("#hb_search_course_input").val().trim();
$("#search_user_courses_form").submit();
}
});
});
$("#search_course_list").on("click", "#submit_send_shixun", function(){
if($("input[name='course']:checked").length == 0){
$("#search_course_notice").show();
} else{
$("#search_course_notice").hide();
$("#choose_course_to_shixun").submit();
hideModal();
}
});
</script>

View File

@ -14,18 +14,17 @@
<p id="e_tip_in" style="margin-left: 10%" class="c_grey"></p> <p id="e_tip_in" style="margin-left: 10%" class="c_grey"></p>
<p id="e_tips_in" style="margin-left: 10%" class="c_grey"></p> <p id="e_tips_in" style="margin-left: 10%" class="c_grey"></p>
</li> </li>
<li class="clearfix mb15"> <!--<li class="clearfix mb15">-->
<label class="panel-form-label fl"><span class="color-orange mr5">*</span>适用专业&nbsp;&nbsp;&nbsp;</label> <!--<label class="panel-form-label fl"><span class="color-orange mr5">*</span>适用专业&nbsp;&nbsp;&nbsp;</label>-->
<%= select_tag :major_id, options_for_select(shixun_major_option, @shixun.major_id ? @shixun.major_id : 0), :id => 'shixun_major', :class => "fl task-form-30 task-height-40"%> <!--<%#= select_tag :major_id, options_for_select(shixun_major_option, @shixun.major_id ? @shixun.major_id : 0), :id => 'shixun_major', :class => "fl task-form-30 task-height-40"%>-->
<div class="cl"></div> <!--<div class="cl"></div>-->
<p class="-text-danger ml95" id="shixun_major_notice" style="display: none;">请选择适用专业</p> <!--<p class="-text-danger ml95" id="shixun_major_notice" style="display: none;">请选择适用专业</p>-->
</li> <!--</li>-->
<li class="clearfix pr"> <li class="clearfix pr">
<label class="panel-form-label fl"><span class="color-orange mr5">*</span>适用课程&nbsp;&nbsp;&nbsp;</label> <label class="panel-form-label fl"><span class="color-orange mr5">*</span>适用课程&nbsp;&nbsp;&nbsp;</label>
<div id="shixun[lesson]" class="fl task-form-28 task-height-40 lesson pr"> <div id="shixun[lesson]" class="pr fl with30">
<input type="text" class="lesson_content" readonly placeholder="选择实训适用的课程"> <input type="text" name="course_list" value="<%= @shixun.shixun_major_courses.blank? ? "" : CourseList.where(:id => @shixun.shixun_major_courses.map(&:course_list_id)).map(&:name).join(",") %>" autocomplete="off" style="border: 1px solid #eee;width: 100%;padding: 5px;" id="new_course_list" class="task-height-40 panel-box-sizing fl" maxlength="100" placeholder="选择实训适用的课程">
<i class="fa fa-sort-desc lesson_img"></i> <ul class="course_list_ul">
<ul class="lesson_checkbox" showul="0">
</ul> </ul>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
@ -62,7 +61,7 @@
<script type="text/javascript"> <script type="text/javascript">
//配置-信息提交 //配置-信息提交
function submit_edit_shixun(id) { function submit_edit_shixun(id) {
if (regex_shixun_name() && regex_major() && regex_major_course()) { if (regex_shixun_name() && regex_major_course()) {
$("#edit_shixun_" + id).submit(); $("#edit_shixun_" + id).submit();
} }
} }
@ -70,100 +69,30 @@
$(function(){ $(function(){
$("#webssh").on("click", function(){ $("#webssh").on("click", function(){
$(this).val() == '0' ? $(this).val('1') : $(this).val("0"); $(this).val() == '0' ? $(this).val('1') : $(this).val("0");
})
<% if @shixun.major_id %>
<% major_courses = @shixun.major.major_courses %>
<% CourseList.where(:id => major_courses.map(&:course_list_id)).each_with_index do |course, index| %>
$(".lesson_checkbox").append('<li><input type="checkbox" name="course_id[]" data-val="<%= course.name %>" value="<%= course.id %>" id="join_course_role_<%= index %>" class="ml-3 mr5 magic-checkbox"><label for="join_course_role_<%= index %>"><%= course.name %></label></li>');
<% end %>
<% @shixun.shixun_major_courses.each_with_index do |shixun_course, index| %>
$(".lesson_content").val($(".lesson_content").val() + "<%= index == 0 ? '' : ',' %>" + "<%= shixun_course.course_list.name %>");
$("input[value='<%= shixun_course.course_list_id %>']").attr("checked", true);
<% end %>
<% end %>
//多选适用课程
$("body").click(function(event){
if ($(event.target).attr("id") != "shixun_operation"){
$(".lesson_checkbox").hide();
$(".lesson_checkbox").attr("showul","0");
event.stopPropagation();
}
}); });
$(".lesson").click(function(event){ $("#new_course_list").on('input', function(e){
if($("#shixun_major").val() == "0") { throttle(search_course_list, window, e);
$("#shixun_major_course_notice").html("请先选择适用专业").show(); });
$("#new_course_list").on('focus', function (e) {
if ($("#new_course_list").val().trim() != '') { //如果已经有id了。肯定存在不用去找了。
return;
} else{ } else{
var showul=$(this).find("ul").attr("showul"); search_course_ajax('');
if(showul=="0"){
$(this).find("ul").show();
$(this).find("ul").attr("showul","1");
if($(this).find("ul input").length>5){
$(this).find("ul").css("overflow-y","scroll");
}
event.stopPropagation();
}else{
$(this).find("ul").hide();
$(this).find("ul").attr("showul","0");
event.stopPropagation();
}
} }
}); });
$(".lesson_checkbox").on('click', 'label', function(event) {
$(".course_list_ul").on('click', 'p',function(event) {
$("#new_course_list").val($(this).html());
$(".course_list_ul").hide();
event.stopPropagation(); event.stopPropagation();
}); });
$(".lesson_checkbox").on('click', 'input',function(event) {
if ($(this).is(':checked')) { $("body").click(function(event){
if ($(".lesson_content").val() == "") { $(".course_list_ul").hide();
$(".lesson_content").val($(this).attr("data-val")); event.stopPropagation();
} else {
$(".lesson_content").val($(".lesson_content").val() + "," + $(this).attr("data-val"));
}
$("#shixun_major_course_notice").hide();
event.stopPropagation();
} else {
var valueCon = $(".lesson_content").val().split(",");
var list = [];
for (var i = 0; i < valueCon.length; i++) {
if (valueCon[i] != $(this).attr("data-val")) {
list.push(valueCon[i]);
}
}
$(".lesson_content").val(list);
event.stopPropagation();
}
}); });
}); });
$("#shixun_major").on("change", function(){
if($("#shixun_major").val() != "0"){
$.ajax({
url: '/shixuns/shixun_courses',
type: 'get',
data: {major_id:$("#shixun_major").val()},
success: function(data){
if (data.result == 1){
$(".lesson_content").val("");
$(".lesson_checkbox").html("");
for(var i=0; i<data.options.length; i++){
$(".lesson_checkbox").append('<li><input type="checkbox" name="course_id[]" data-val="'+ data.options[i][0] +'" value="'+ data.options[i][1] +'" id="join_course_role_'+ i +'" class="ml-3 mr5 magic-checkbox"><label for="join_course_role_'+ i +'">'+ data.options[i][0] +'</label></li>');
}
$("#shixun_major_notice").hide();
}
else{
$(".lesson_content").val("");
$(".lesson_checkbox").html("");
}
}
});
} else{
$(".lesson_content").val("");
$(".lesson_checkbox").html("");
}
// 实训简介自动保存
md_elocalStorage(setting_editormd, "challenge_in_<%= User.current.id %>", "in");
});
// md恢复上次数据 // md恢复上次数据
function md_rec_data(k,mdu,id){ function md_rec_data(k,mdu,id){

View File

@ -24,12 +24,12 @@
<textarea style="display:none;"><%= @shixun.description %></textarea> <textarea style="display:none;"><%= @shixun.description %></textarea>
</div> </div>
</li> </li>
<li class="clearfix"> <!--<li class="clearfix">-->
<label class="panel-form-label fl">适用专业:</label> <!--<label class="panel-form-label fl">适用专业:</label>-->
<div class="fl task-bg-grey panel-box-sizing panel-form-width-690"> <!--<div class="fl task-bg-grey panel-box-sizing panel-form-width-690">-->
<%= @shixun.major ? @shixun.major.try(:name) : "" %> <!--<%= @shixun.major ? @shixun.major.try(:name) : "" %>-->
</div> <!--</div>-->
</li> <!--</li>-->
<li class="clearfix"> <li class="clearfix">
<label class="panel-form-label fl">适用课程:</label> <label class="panel-form-label fl">适用课程:</label>
<div class="fl task-bg-grey panel-box-sizing panel-form-width-690"> <div class="fl task-bg-grey panel-box-sizing panel-form-width-690">
@ -122,7 +122,7 @@
imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"], 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 imageUploadURL : "<%= upload_with_markdown_path(:container_id => @shixun.id, :container_type => @shixun.class) %>" //url
}); });
md_elocalStorage(setting_editormd,"shixun_in_<%= User.current.id %>_<%= @shixun.id %>","in"); md_elocalStorage(setting_editormd, "challenge_in_<%= User.current.id %>", "in");
editor = setting_editormd; editor = setting_editormd;
} }

View File

@ -2,13 +2,13 @@
<li class="fl <%= @order == 'myshixun_count' ? 'check_nav' : "" %>"> <li class="fl <%= @order == 'myshixun_count' ? 'check_nav' : "" %>">
<%= link_to "最热", search_shixuns_path(:order => "myshixun_count", :shixun_status => @shixun_status, :status => @status, :language => @language, :search => @search, :trainee => @trainee, :major =>@major, :course => @course, :sort => @sort), :remote => true %> <%= link_to "最热", search_shixuns_path(:order => "myshixun_count", :shixun_status => @shixun_status, :status => @status, :language => @language, :search => @search, :trainee => @trainee, :major =>@major, :course => @course, :sort => @sort), :remote => true %>
</li> </li>
<li class="fl <%= @order == 'created_at' ? 'check_nav' : "" %>"> <li class="fl <%= @order == 'created_at' ? 'check_nav' : "" %>" id="nav_check_item_2">
<%= link_to "最新", search_shixuns_path(:order => "created_at", :shixun_status => @shixun_status, :status => @status, :language => @language, :search => @search, :trainee => @trainee, :major =>@major, :course => @course, :sort => @sort), :remote => true %> <%= link_to "最新", search_shixuns_path(:order => "created_at", :shixun_status => @shixun_status, :status => @status, :language => @language, :search => @search, :trainee => @trainee, :major =>@major, :course => @course, :sort => @sort), :remote => true %>
</li> </li>
</ul> </ul>
<div class="task-index-list clearfix mb20 mh320"> <div class="task-index-list clearfix mb20 mh320">
<% if @shixuns.blank? %> <% if @shixuns.blank? %>
<div style="background: #fff;padding-bottom: 15px;" class="user_bg_shadow"> <div style="background: #fff;padding-bottom: 15px;" class="box_bg_shandow bor-grey-e ">
<%= render :partial => "welcome/no_data" %> <%= render :partial => "welcome/no_data" %>
</div> </div>
<% else %> <% else %>

View File

@ -1,11 +1,11 @@
<% update_visiti_count @shixun %> <% update_visiti_count @shixun %>
<div class="task-header"> <div class="task-header">
<div class="task-header-info"> <div class="task-header-info">
<h2 class="fl"> <h2 class="fl font-24">
<a href="<%= user_path(@shixun.owner) %>" class="task-header-name fl"><%= @shixun.owner.try(:show_name) %></a> <a href="<%= user_path(@shixun.owner) %>" class="task-header-name fl"><%= @shixun.owner.try(:show_name) %></a>
<span class="ml5 mr5 fl">/ </span><p class="task-header-title fl" title="<%= @shixun.name %>"><%= @shixun.name %></p> <span class="ml5 mr5 fl">/ </span><p class="task-header-title fl"><%= @shixun.name %></p>
</h2> </h2>
<!-- <div><%#= link_to "测试", shixun_test_shixun_path(@shixun), :class => "fl ml10 mr10" %></div>--> <!-- <div><%#= link_to "测试", shixun_test_shixun_path(@shixun), :class => "fl ml10 mr10" %></div>-->
<% myshixun = Myshixun.where(:user_id => User.current.id, :shixun_id => @shixun.id).first %> <% myshixun = Myshixun.where(:user_id => User.current.id, :shixun_id => @shixun.id).first %>
<% if allow_shixun_exec(@shixun) %> <% if allow_shixun_exec(@shixun) %>
<% if @shixun.status == 0 %> <% if @shixun.status == 0 %>
@ -13,38 +13,34 @@
<%= link_to "模拟实战", operation_shixun_path(@shixun, :myshixun_id => myshixun.try(:id)), :class => "fr shixun-task-btn task-btn-orange mr15", :id => "shixun_operation",:remote => true %> <%= link_to "模拟实战", operation_shixun_path(@shixun, :myshixun_id => myshixun.try(:id)), :class => "fr shixun-task-btn task-btn-orange mr15", :id => "shixun_operation",:remote => true %>
<%#= link_to_shixun_exec myshixun, @shixun, '模拟实战' %> <%#= link_to_shixun_exec myshixun, @shixun, '模拟实战' %>
<a href="javascript:void(0);" data-option="1" onclick="apply_publish_shixun('<%= publish_shixun_path(@shixun) %>')" id="apply_publish_shixun" class="fr shixun-task-btn task-btn-green mr15">申请发布</a> <a href="javascript:void(0);" data-option="1" onclick="apply_publish_shixun('<%= publish_shixun_path(@shixun) %>')" id="apply_publish_shixun" class="fr shixun-task-btn task-btn-green mr15">申请发布</a>
<%#= link_to "申请发布", publish_shixun_path(@shixun), :class => "fr shixun-task-btn task-btn-green mr15", :id => "challenge_begin", :remote => true %> <%#= link_to "申请发布", publish_shixun_path(@shixun), :class => "fr shixun-task-btn task-btn-green mr15 mt10", :id => "challenge_begin", :remote => true %>
<% end %> <% end %>
<% elsif @shixun.status == 1 %> <% elsif @shixun.status == 1 %>
<%= link_to "模拟实战", operation_shixun_path(@shixun, :myshixun_id => myshixun.try(:id)), :class => "fr shixun-task-btn task-btn-orange mr15", :id => "shixun_operation", :remote => true %> <%= link_to "模拟实战", operation_shixun_path(@shixun, :myshixun_id => myshixun.try(:id)), :class => "fr shixun-task-btn task-btn-orange mr15", :id => "shixun_operation", :remote => true %>
<%#= link_to_shixun_exec myshixun, @shixun, '模拟实战' %> <%#= link_to_shixun_exec myshixun, @shixun, '模拟实战' %>
<% if User.current.manager_of_shixun?(@shixun) %> <% if User.current.manager_of_shixun?(@shixun) %>
<%= link_to "撤销发布", cancel_publish_shixun_path(@shixun), :class => "fr shixun-task-btn task-btn-grey-white mr15", :id => "challenge_begin" %> <%= link_to "撤销发布", cancel_publish_shixun_path(@shixun), :class => "fr shixun-task-btn task-btn-grey-white mr15 ", :id => "challenge_begin" %>
<% end %> <% end %>
<% elsif @shixun.status == 2 %> <% elsif @shixun.status == 2 %>
<% if myshixun.blank? %> <% if myshixun.blank? %>
<%= link_to "开始实战", operation_shixun_path(@shixun, :myshixun_id => myshixun.try(:id)), :class => "fr shixun-task-btn task-btn-orange mr15", :id => "shixun_operation", :remote => true %> <%= link_to "开始实战", operation_shixun_path(@shixun, :myshixun_id => myshixun.try(:id)), :class => "fr shixun-task-btn task-btn-orange mr15 ", :id => "shixun_operation", :remote => true %>
<%#= link_to_shixun_exec myshixun, @shixun, '开始实战' %> <%#= link_to_shixun_exec myshixun, @shixun, '开始实战' %>
<% else %> <% else %>
<%= link_to "继续实战", operation_shixun_path(@shixun, :myshixun_id => myshixun.try(:id)), :class => "fr shixun-task-btn task-btn-orange mr15", :id => "shixun_operation", :remote => true %> <%= link_to "继续实战", operation_shixun_path(@shixun, :myshixun_id => myshixun.try(:id)), :class => "fr shixun-task-btn task-btn-orange mr15 ", :id => "shixun_operation", :remote => true %>
<!--<a href="javascript:void(0);" onclick="apply_send_shixun()" id="apply_send_shixun" class="fr shixun-task-btn task-btn-green mr15">发送至</a>-->
<% end %> <% end %>
<%# if User.current.manager_of_shixun?(@shixun) %> <%= link_to '发送至', search_user_courses_shixun_path(@shixun), :remote => true, :class => "fr shixun-task-btn task-btn-green mr15" %>
<!--<a href="javascript:void(0);" class="fr shixun-task-btn task-btn-grey-white mr15" id="challenge_begin" onclick="s_op_confirm_box('<%#= close_shixun_path(@shixun) %>', '关闭后,用户不能再开始挑战了<br/>是否确认关闭')">永久关闭</a>-->
<%# end %>
<% elsif @shixun.status == 3 %> <% elsif @shixun.status == 3 %>
<% unless myshixun.blank? %> <% unless myshixun.blank? %>
<%= link_to "继续实战", operation_shixun_path(@shixun, :myshixun_id => myshixun.try(:id)), :class => "fr shixun-task-btn task-btn-orange mr15", :id => "shixun_operation", :remote => true %> <%= link_to "继续实战", operation_shixun_path(@shixun, :myshixun_id => myshixun.try(:id)), :class => "fr shixun-task-btn task-btn-orange mr15 ", :id => "shixun_operation", :remote => true %>
<!--<a href="javascript:void(0);" onclick="apply_send_shixun()" id="apply_send_shixun" class="fr shixun-task-btn task-btn-green mr15">发送至</a>-->
<% end %> <% end %>
<a href="javascript:void(0);" class="fr shixun-task-ban-btn mr15">已关闭</a> <a href="javascript:void(0);" class="fr shixun-task-ban-btn mr15">已关闭</a>
<% end %> <% end %>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
<% unless User.current.manager_of_shixun?(@shixun) %> <% unless User.current.manager_of_shixun?(@shixun) %>
<span class="font-12 color-grey fl"><%= @shixun.language %></span> <span class="font-16 color-grey fl" data-tip-down = "技术平台"><%= @shixun.language %></span>
<span class="font-12 color-grey fl ml20"><%= @shixun.shixun_trainee %></span> <span class="font-16 color-grey fl ml20" data-tip-down = "面向学员"><%= @shixun.shixun_trainee %></span>
<span class="font-12 color-grey fl ml20"><%= @shixun.shixun_major_courses.blank? ? "" : CourseList.where(:id => @shixun.shixun_major_courses.map(&:course_list_id)).map(&:name).join("、") %></span> <span class="font-16 color-grey fl ml20" data-tip-down = "适用课程"><%= @shixun.shixun_major_courses.blank? ? "" : CourseList.where(:id => @shixun.shixun_major_courses.map(&:course_list_id)).map(&:name).join("、") %></span>
<% end %> <% end %>
</div> </div>
</div> </div>
@ -55,18 +51,18 @@
</div> </div>
</div> </div>
<script> <script>
function apply_publish_shixun(url){ //计算开启实训等按钮的marginTop值使其居中显示
if($("#apply_publish_shixun").attr("data-option") == '1'){ $(".task-header-info .shixun-task-btn").css("margin-top",$(".task-header-info").height() / 2 - 15);
$("#apply_publish_shixun").attr("data-option", 0); $(".shixun-task-ban-btn").css("margin-top",$(".task-header-info").height() / 2 - 15);
$("#apply_publish_shixun").addClass("disabled-grey-bg");
$.ajax({ function apply_publish_shixun(url){
url: url, if($("#apply_publish_shixun").attr("data-option") == '1'){
type: 'get' $("#apply_publish_shixun").attr("data-option", 0);
}); $("#apply_publish_shixun").addClass("disabled-grey-bg");
} $.ajax({
} url: url,
function apply_send_shixun(){ type: 'get'
var htmlvalue = "<%= escape_javascript(render :partial => 'shixuns/send_shixuns') %>"; });
pop_box_new(htmlvalue,460,416); }
} }
</script> </script>

View File

@ -1,4 +1,4 @@
<div class="task-pm-content white_bg" style="margin-top:20px;"> <div class="task-pm-content white_bg box_bg_shandow bor-grey-e" style="margin:30px 0;">
<div class="clearfix task-partner-list"> <div class="clearfix task-partner-list">
<a class="fl"><%= image_tag(url_to_avatar(@shixun.owner), :width => 60, :height => 60, :class => 'panel-list-img mr15 mt5') %></a> <a class="fl"><%= image_tag(url_to_avatar(@shixun.owner), :width => 60, :height => 60, :class => 'panel-list-img mr15 mt5') %></a>
<ul class="fl font-12 color-grey"> <ul class="fl font-12 color-grey">

View File

@ -1,8 +1,16 @@
<div class="task-index"> <div class="task-index">
<div class="task-index-head mt30 mb30 box_bg_shandow bor-grey-e"> <div class="task-index-head mt30 mb30 box_bg_shandow bor-grey-e">
<div class="task-index-head-top pr"> <div class="" style="position: relative" >
<!--<div id="triangle" class="top-xz" style="left: 20%;top:10px;"></div>--> <h2 class="fl task-inde-head-title">
<h2 class="fl task-inde-head-title">全部实训</h2> <canvas id="myCanvas" ></canvas>
<div class="logo" border="0"></div>
</h2>
<h2 class="fl task-inde-head-title" style="position: absolute;left:550px;top: 25px;letter-spacing:0.8em; text-shadow: 0 1px 2px #000;">
实训项目
</h2>
<p class="fl task-inde-head-title" style="position: absolute;left:500px;top:65px;text-shadow: 0 1px 2px #000;">
Talk is cheap, show me the code.
</p>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<ul class="task-index-head-info clearfix"> <ul class="task-index-head-info clearfix">
@ -10,19 +18,12 @@
<li><span class="color-orange font-bd"><%= @current_user_had_passed %></span><br/><span>你已通过</span></li> <li><span class="color-orange font-bd"><%= @current_user_had_passed %></span><br/><span>你已通过</span></li>
<li><span class="color-orange font-bd"><%= @shixun_my_score %></span><br/><span>累计经验值</span></li> <li><span class="color-orange font-bd"><%= @shixun_my_score %></span><br/><span>累计经验值</span></li>
<%#= link_to "+&nbsp;新建".html_safe, new_shixun_path, :class => "color-light-green fr font-16" , :style => "line-height:56px" %> <%#= link_to "+&nbsp;新建".html_safe, new_shixun_path, :class => "color-light-green fr font-16" , :style => "line-height:56px" %>
<a href="javascript:void(0);" class="color-light-green fr font-16" style="line-height:56px" onclick="shixun_new(<%= @mail %>)">+&nbsp;新建</a> <a href="javascript:void(0);" class="white-btn orange-btn fr font-16 mt10" onclick="shixun_new(<%= @mail %>)">+&nbsp;新建</a>
</ul> </ul>
</div> </div>
<div class="clearfix"> <div class="clearfix">
<form id="shixun_index_search_form"> <form id="shixun_index_search_form">
<div class="course-nav-box width1 edu-bg box_bg_shandow bor-grey-e"> <div class="course-nav-box width1 edu-bg box_bg_shandow bor-grey-e">
<div class="course-nav-row bottomdashed1 clearfix">
<span class="fl color-grey check_item">适用专业</span>
<div class="course-nav-row_item fl" id="shixun_major_search">
<%= render :partial => 'shixun_major_search' %>
</div>
</div>
<div class="course-nav-row bottomdashed1 clearfix pr lesson_content" style="width: 100%"> <div class="course-nav-row bottomdashed1 clearfix pr lesson_content" style="width: 100%">
<span class="fl color-grey check_item">适用课程</span> <span class="fl color-grey check_item">适用课程</span>
<div class="course-nav-row_item fl with87 lesson_item" id="shixun_course_search"> <div class="course-nav-row_item fl with87 lesson_item" id="shixun_course_search">
@ -30,11 +31,11 @@
</div> </div>
<span class="fr more_check geng_down"> <span class="fr more_check geng_down">
<span class="color-grey">更多</span> <span class="color-grey">更多</span>
<i class="fa fa-angle-down mr5 color-grey" title="更多"></i> <i class="fa fa-angle-down mr5 color-grey" data-tip-down="更多"></i>
</span> </span>
<span class="fr more_check shou_up" style="display: none;"> <span class="fr more_check shou_up" style="display: none;">
<span class="color-grey">收起</span> <span class="color-grey">收起</span>
<i class="fa fa-angle-up mr5 color-grey shou_up" title="收起"></i> <i class="fa fa-angle-up mr5 color-grey shou_up" data-tip-down="收起"></i>
</span> </span>
</div> </div>
<div class="course-nav-row bottomdashed1 clearfix"> <div class="course-nav-row bottomdashed1 clearfix">
@ -170,23 +171,31 @@
<div class="searchFor fr"> <div class="searchFor fr">
<div class="searchCon"> <div class="searchCon">
<input type="text" class="searchinput" name="search" placeholder="请输入实训名称的关键字进行搜索"/> <input type="text" class="searchinput" name="search" placeholder="请输入实训名称的关键字进行搜索"/>
<i class="fa fa-close mr5 color-dark-grey" onclick="colse_searchbox();" title="搜索"></i> <i class="fa fa-close mr5 color-dark-grey" onclick="colse_searchbox();" data-tip-down="关闭"></i>
</div> </div>
<i class="fa fa-search mr5 color-dark-grey search_icon" onclick="search_shixun()" style="margin:10px" title="搜索"></i> <i class="fa fa-search mr5 color-dark-grey search_icon" onclick="search_shixun()" style="margin:10px" data-tip-down="搜索"></i>
</div> </div>
</div> </div>
</div> </div>
</form> </form>
<div id="shixun_list_content"> <div id="shixun_list_content">
<%= render "shixun_list" %> <%= render "shixun_list" %>
</div> </div>
</div> </div>
</div> </div>
<!----------------------- 左侧导航栏 -----------------------------> <!----------------------- 左侧导航栏 ----------------------------->
<%= render :partial => 'layouts/public_left_info' %> <%= render :partial => 'layouts/public_left_info' %>
<%= javascript_include_tag 'edu/shixun_course_path' %>
<style>body{background: #FFFFFF}</style><!--后续需要删除--> <style>body{background: #FFFFFF}</style><!--后续需要删除-->
<script> <script>
$("#nav_check_item_1").click(function(){
<%=@order == 'myshixun_count'%>
});
$("#nav_check_item_2").click(function(){
<%=@order == 'created_at'%>
});
function searchToggle(obj, evt){ function searchToggle(obj, evt){
var container = $(obj).closest('.search-wrapper'); var container = $(obj).closest('.search-wrapper');
@ -255,11 +264,7 @@
},function(){ },function(){
$(this).find("ul").hide(); $(this).find("ul").hide();
}); });
//最新和最热的切换
// $(".nav_check_item li").click(function(){
// $(".nav_check_item li").removeClass("check_nav");
// $(this).addClass("check_nav");
// });
//选择查询条件 //选择查询条件
$(".course-nav-row_item").on('click', 'input', function(event){ $(".course-nav-row_item").on('click', 'input', function(event){
$(this).parent("li").siblings("li").removeClass("check_on"); $(this).parent("li").siblings("li").removeClass("check_on");
@ -314,26 +319,11 @@
$(".lesson_item").scrollTop(0); $(".lesson_item").scrollTop(0);
$(".shou_up").hide(); $(".shou_up").hide();
$(".geng_down").show(); $(".geng_down").show();
}) });
//点击搜索图标,显示搜索框
$(".search_icon").click(function(){
if($(".searchCon").is(":visible")){
$.ajax({
url: '/shixuns/search',
type: 'post',
data: $("#shixun_index_search_form").serialize(),
remote: true,
success: function(data){
}
});
} else{
$(".searchCon").show();
}
})
}); });
$(".searchCon").on("keydown", "input[name='search']", function(event){ $(".searchCon").on("keydown", "input[name='search']", function(event){
var target, code, tag; var code;
if (!event) { if (!event) {
event = window.event; //针对ie浏览器 event = window.event; //针对ie浏览器
code = event.keyCode; code = event.keyCode;
@ -349,33 +339,26 @@
//搜索实训 //搜索实训
function search_shixun(){ function search_shixun(){
if($(".searchCon").is(":visible")){ $.ajax({
$.ajax({ url: '/shixuns/search',
url: '/shixuns/search', type: 'post',
type: 'post', data: $("#shixun_index_search_form").serialize(),
data: $("#shixun_index_search_form").serialize(), remote: true,
remote: true, success: function(data){
success: function(data){ }
} });
});
} else{
$(".searchCon").show();
}
} }
//关闭搜索框 //关闭搜索框
function colse_searchbox(){ function colse_searchbox(){
$('.searchCon').hide(); $('.searchinput').val('');
if($('.searchinput').val().trim() != ""){ $.ajax({
$('.searchinput').val(''); url: '/shixuns/search',
$.ajax({ type: 'post',
url: '/shixuns/search', data: $("#shixun_index_search_form").serialize(),
type: 'post', remote: true,
data: $("#shixun_index_search_form").serialize(), success: function(data){
remote: true, }
success: function(data){ });
}
});
}
} }
// 新建实训 // 新建实训

View File

@ -1,9 +1,12 @@
<div class="task-pm-content" > <div class="task-pm-content " >
<p class="mb10 mt10"><i class="fa fa-map-marker mr5 color-grey" ></i> <p class="mb10 mt10"><i class="fa fa-map-marker mr5 color-grey" ></i>
<a href="<%= user_path(User.current) %>"><%= User.current.show_name %></a> > <a href="<%= shixuns_path %>">全部实训</a> > 新建实训 <a href="<%= user_path(User.current) %>"><%= User.current.show_name %></a> > <a href="<%= shixuns_path %>">全部实训</a> > 新建实训
</p> </p>
<div class="edu-con-top user_bg_shadow"> <div class="box_bg_shandow bor-grey-e mb30">
<div class="edu-con-top">
<p class="ml15 color-grey">新建实训</p> <p class="ml15 color-grey">新建实训</p>
</div> </div>
<%= render :partial => 'form' %> <%= render :partial => 'form' %>
</div>
</div> </div>

View File

@ -6,11 +6,11 @@
width: 96%; width: 96%;
} }
</style> </style>
<div class="task-pm-content mb20" > <div class="task-pm-content " >
<div class="task-pm-box mt20"> <div class="task-pm-box mt30 mb30 box_bg_shandow">
<div class="panel-header clearfix"> <div class="panel-header clearfix">
<h3 class="shixun_title fl mt5">背景知识</h3> <h3 class="shixun_title fl mt5">背景知识</h3>
<% if @shixun.status == 0 && User.current.manager_of_shixun?(@shixun) %> <% if User.current.manager_of_shixun?(@shixun) %>
<a href="JavaScript:void(0);" class="shixun-task-btn task-btn-green fr" id="edit_propaedeutics" style="margin: 5px 0;">编辑</a> <a href="JavaScript:void(0);" class="shixun-task-btn task-btn-green fr" id="edit_propaedeutics" style="margin: 5px 0;">编辑</a>
<% end %> <% end %>
</div> </div>
@ -33,7 +33,7 @@
</ul> </ul>
</div> </div>
<div id="no_data"> <div id="no_data">
<% if @shixun.propaedeutics.nil? %> <% if @shixun.propaedeutics.blank? %>
<%= render :partial => "welcome/no_data" %> <%= render :partial => "welcome/no_data" %>
<% else %> <% else %>
<div class="task-paner-con break_full_word new_li" id="challenge_editorMd_propaedeutics"> <div class="task-paner-con break_full_word new_li" id="challenge_editorMd_propaedeutics">

View File

@ -1,2 +1 @@
$("#shixun_course_search").html("<%= escape_javascript( render :partial => 'shixuns/shixun_course_search') %>");
$("#shixun_list_content").html('<%= escape_javascript( render :partial => 'shixuns/shixun_list') %>'); $("#shixun_list_content").html('<%= escape_javascript( render :partial => 'shixuns/shixun_list') %>');

View File

@ -0,0 +1,6 @@
<% if params[:search] || params[:page] %>
$("#search_course_list").html("<%= j(render :partial => "shixuns/search_course_list") %>");
<% else %>
var htmlvalue = "<%= escape_javascript(render :partial => 'shixuns/send_shixuns') %>";
pop_box_new(htmlvalue,550,520);
<% end %>

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