project_pack
hjm 6 years ago
commit 8f24626349

@ -55,6 +55,7 @@ gem 'chinese_pinyin'
# gem 'sunspot'
# gem 'progress_bar'
gem 'ansi'
gem 'diff-lcs', '~> 1.3'
gem 'kaminari'
gem 'elasticsearch-model'
@ -66,6 +67,9 @@ gem 'oauth2'
gem 'axlsx', '3.0.0.pre'
gem 'axlsx_rails', '0.3.0'
# state machine
gem 'aasm'
#Ruby 2.2+ has removed test/unit from the core library.
if RUBY_VERSION>='2.2'
gem 'test-unit', '~> 3.0'

@ -145,6 +145,7 @@ class AccountController < ApplicationController
@com_coop_img = CooImg.where(:img_type => 'com_coop').order("position asc")
@edu_coop_img = CooImg.where(:img_type => 'edu_coop').order("position asc")
@alliance_img = CooImg.where(:img_type => 'alliance_coop').order("position asc")
render :layout => 'base_edu'
end
@ -152,6 +153,7 @@ class AccountController < ApplicationController
def update_help
@edu_coop = "edu_coop"
@com_coop = "com_coop"
@alliance_coop = "alliance_coop"
end
def update_agreement
@ -232,7 +234,7 @@ class AccountController < ApplicationController
end
if File.exist?(diskfile1)
pos = CooImg.order("position asc").last.position
CooImg.create(:src_states =>params[:img_url] ,:url_states => diskfile2,:img_type =>params[:sourse_type], :position => pos)
CooImg.create(:src_states =>params[:img_url] ,:url_states => diskfile2,:img_type => params[:sourse_type], :position => pos)
end
redirect_to help_path(:index => 3)
end
@ -876,7 +878,7 @@ class AccountController < ApplicationController
if ApplyUserAuthentication.where(:user_id => @user.id, :status => 0, :auth_type => 1).count == 0
ApplyUserAuthentication.create(:user_id => @user.id, :status => 0, :auth_type => 1)
begin
status = Trustie::Sms.send(mobile: '18173242757', send_type:'apply_auth' , name: '管理员')
status = Trustie::Sms.send(mobile: '18711085785', send_type:'apply_auth' , name: '管理员')
rescue => e
Rails.logger.error "发送验证码出错: #{e}"
end
@ -935,7 +937,7 @@ class AccountController < ApplicationController
if ApplyUserAuthentication.where(:user_id => @user.id, :status => 0, :auth_type => 2).count == 0
ApplyUserAuthentication.create(:user_id => @user.id, :status => 0, :auth_type => 2)
begin
status = Trustie::Sms.send(mobile: '18173242757', send_type:'apply_pro_certification' , name: '管理员')
status = Trustie::Sms.send(mobile: '18711085785', send_type:'apply_pro_certification' , name: '管理员')
rescue => e
Rails.logger.error "发送验证码出错: #{e}"
end
@ -944,7 +946,7 @@ class AccountController < ApplicationController
if File.exist?(diskfile2)
ApplyUserAuthentication.create(:user_id => @user.id, :status => 0, :auth_type => 2)
begin
status = Trustie::Sms.send(mobile: '18173242757', send_type:'apply_pro_certification' , name: '管理员')
status = Trustie::Sms.send(mobile: '18711085785', send_type:'apply_pro_certification' , name: '管理员')
rescue => e
Rails.logger.error "发送验证码出错: #{e}"
end

@ -61,6 +61,9 @@ class ApplicationController < ActionController::Base
# rescue_from ActionController::InvalidAuthenticityToken, :with => :invalid_authenticity_token
rescue_from ::Unauthorized, :with => :deny_access
rescue_from ::ActionView::MissingTemplate, :with => :missing_template
rescue_from ::ActiveRecord::RecordNotFound do
render_404
end
include Redmine::Search::Controller
include Redmine::MenuManager::MenuController

@ -893,6 +893,8 @@ class AttachmentsController < ApplicationController
@subject = @attachment.container
elsif @attachment.container_type == 'School'
@school = @attachment.container
elsif @attachment.container_type == 'Library'
@library = @attachment.container
else
unless @attachment.container_type == 'Syllabus' || @attachment.container_type == 'Bid' || @attachment.container_type == 'Organization' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type == 'StudentWorksScore' || @attachment.container_type == 'StudentWork' || @attachment.container_type == 'Work'|| @attachment.container_type == 'ContestantWork'|| @attachment.container_type == 'Contest' || @attachment.container_type == 'HomeworkBank' || @attachment.container_type == 'Exercise' || @attachment.container_type == 'ExerciseBank' || @attachment.container_type == 'Career' || @attachment.container_type == 'EcTemplate'
@project = @attachment.project

@ -38,32 +38,34 @@ class CompetitionTeamsController < ApplicationController
end
def create
if params[:name]
# 判断用户是否已创建过战队
if @competition.competition_teams.where(:user_id => User.current.id).count > 0 && !User.current.is_teacher
@status = 1
else
invite_code = generate_team_code
teacher_id = User.current.user_extensions.identity == 0 ? User.current.id : params[:teacher]
new_team = CompetitionTeam.create(:competition_id => @competition.id, :name => params[:name],
:invite_code => invite_code, :user_id => User.current.id, :teacher_id => teacher_id)
new_team.team_members << TeamMember.new(:user_id => User.current.id, :role => 1, :competition_id => @competition.id, :is_teacher => User.current.user_extensions.identity == 0 ? 1 : 0)
if params[:member_ids]
params[:member_ids].each do |user_id|
new_team.team_members << TeamMember.new(:user_id => user_id, :role => 2, :competition_id => @competition.id)
end
end
if params[:teacher] && params[:teacher].strip != ""
new_team.team_members << TeamMember.new(:user_id => params[:teacher], :role => 2, :competition_id => @competition.id, :is_teacher => 1)
# 创建成功且配置了指导老师
@status = 0
elsif User.current.user_extensions.identity != 0
# 创建成功未配置指导老师
@status = 2
elsif User.current.user_extensions.identity == 0
@status = 0
end
# 判断用户是否已创建过战队
if @competition.competition_teams.where(:user_id => User.current.id).count > 0 && !User.current.is_teacher
@status, @message = -1, '您已创建过战队,不能重复创建'
return
end
if params[:name].blank?
@status, @message = -1, '战队名称不能为空'
return
end
is_teacher = User.current.user_extensions.identity == 0
return unless member_and_teacher_count_valid?(is_teacher)
ActiveRecord::Base.transaction do
invite_code = generate_team_code
new_team = CompetitionTeam.create(:competition_id => @competition.id, :name => params[:name],
:invite_code => invite_code, :user_id => User.current.id)
new_team.team_members.create!(user_id: User.current.id, role: 1, competition_id: @competition.id, is_teacher: User.current.user_extensions.identity == 0 ? 1 : 0)
params[:member_ids].try(:each) do |user_id|
next if user_id.to_i == User.current.id
new_team.team_members.create!(user_id: user_id, role: 2, competition_id: @competition.id)
end
params[:teacher_ids].try(:each) do |user_id|
next if user_id.to_i == User.current.id
new_team.team_members.create!(user_id: user_id, role: 3, competition_id: @competition.id, is_teacher: 1)
end
end
end
@ -89,79 +91,80 @@ class CompetitionTeamsController < ApplicationController
end
def update
unless @competition.enroll_end_time.present? && @competition.enroll_end_time < Time.now
if params[:name]
teacher_id = User.current.user_extensions.identity == 0 ? User.current.id : params[:teacher]
@team.update_attributes(:name => params[:name], :teacher_id => teacher_id)
@team.team_members.update_all(:is_teacher => 0)
if @team.user.user_extensions.identity == 0
@team.team_members.where(:user_id => @team.user_id).update_all(:is_teacher => 1)
end
is_teacher = @team.user.user_extensions.identity == 0
return unless member_and_teacher_count_valid?(is_teacher)
ActiveRecord::Base.transaction do
unless @competition.enroll_end_time.present? && @competition.enroll_end_time < Time.now
@team.update_attributes(name: params[:name]) if params[:name].present?
team_member_ids = @team.team_members.where(:role => 2, :is_teacher => 0).map(&:user_id)
new_member_ids = (params[:member_ids] || []).collect(&:to_i)
team_member_ids = @team.team_members.where(role: 2, is_teacher: 0).pluck(:user_id)
new_member_ids = (params[:member_ids].presence || []).map(&:to_i)
new_member_ids << @team.user_id unless is_teacher
# 删除的成员
delete_member_ids = team_member_ids - new_member_ids
@team.team_members.where(:role => 2, :user_id => delete_member_ids).destroy_all
@team.team_members.where(role: 2, user_id: delete_member_ids).delete_all
# 新增加的成员
(new_member_ids - team_member_ids).each do |user_id|
@team.team_members << TeamMember.new(:user_id => user_id, :role => 2, :competition_id => @competition.id)
next if user_id.to_i == @team.user_id
@team.team_members.create!(user_id: user_id, role: 2, competition_id: @competition.id)
end
end
end
# 判断之前是否已存在指导老师,不存在则创建 否则更新
if params[:teacher] && params[:teacher].strip != ""
o_teacher = @team.team_members.where(:is_teacher => 1).first
unless o_teacher.present? && o_teacher.user_id == params[:teacher].to_i
if o_teacher.present?
o_teacher.update_attributes(:user_id => params[:teacher])
else
teacher = @team.team_members.where(:user_id => params[:teacher]).first
if teacher.present?
teacher.update_column("is_teacher", 1)
else
@team.team_members << TeamMember.new(:user_id => params[:teacher], :role => 2, :competition_id => @competition.id, :is_teacher => 1)
end
end
teacher_ids = @team.teachers.pluck(:user_id)
new_teacher_ids = (params[:teacher_ids].presence || []).map(&:to_i)
new_teacher_ids << @team.user_id if is_teacher
# 删除的老师
delete_teacher_ids = teacher_ids - new_teacher_ids
@team.team_members.where(role: 3, user_id: delete_teacher_ids).delete_all
# 新增加的老师
(new_teacher_ids - teacher_ids).each do |user_id|
next if user_id.to_i == @team.user_id
@team.team_members.create!(user_id: user_id, role: 3, competition_id: @competition.id, is_teacher: true)
end
@team.update_attributes(:teacher_id => params[:teacher])
elsif @team.user.user_extensions.identity != 0
@team.update_attributes(:teacher_id => nil)
@team.team_members.where(:is_teacher => 1).destroy_all
end
end
# @status:提示语标志0加入成功1邀请码错误2已经加入了其他队, 3超过人数限制4已有指导老师5只有学生和老师身份的用户才能加入战队
def join_team
team = @competition.competition_teams.where(:invite_code => params[:code]).first
if team.present?
if TeamMember.where(:user_id => User.current.id, :competition_team_id => @competition.competition_teams.map(&:id), :is_teacher => 0).count > 0
@status = 2
else
# 老师身份加入战队判断是否已有指导老师
if User.current.user_extensions.identity == 0
if team.teacher_id.present?
@status = 4
else
@status = 0
team.update_attributes(:teacher_id => User.current.id)
team.team_members << TeamMember.new(:user_id => User.current.id, :role => 2, :competition_id => @competition.id, :is_teacher => 1)
end
elsif User.current.user_extensions.identity == 1
if team.team_members.count < @competition.max_num.to_i
team.team_members << TeamMember.new(:user_id => User.current.id, :role => 2, :competition_id => @competition.id)
@status = 0
else
@status = 3
end
else
@status = 5
end
team = @competition.competition_teams.where(invite_code: params[:code]).first
if team.blank?
@status, @message = -1, '战队邀请码错误'
return
end
if TeamMember.where(:user_id => User.current.id, :competition_team_id => @competition.competition_teams.map(&:id), :is_teacher => 0).count > 0
@status, @message = -1, '您已加入战队,不能重复加'
return
end
if team.team_members.where(user_id: User.current.id).exists?
@status, @message = -1, '您已加入该战队'
return
end
# 老师身份加入战队
if User.current.user_extensions.identity == 0
teacher_staff = @competition.competition_staffs.where(category: 'teacher').first
if teacher_staff.blank?
@status, @message = -1, '该竞赛不能配备导师'
return
end
if team.teachers.count + 1 > teacher_staff.maximum
@status, @message = -1, '该战队导师人数已满'
return
end
team.team_members.create!(user_id: User.current.id, role: 3, competition_id: @competition.id, is_teacher: true)
else
@status = 1
max_member_count = @competition.competition_staffs.where('category != "teacher"').sum(:maximum)
if team.members.count + 1 > max_member_count
@status, @message = -1, '该战队成员人数已满'
return
end
team.team_members.create!(user_id: User.current.id, role: 2, competition_id: @competition.id)
end
end
@ -169,9 +172,6 @@ class CompetitionTeamsController < ApplicationController
def exit_team
team_member = @team.team_members.where(:user_id => User.current.id).first
if team_member.present?
if team_member.is_teacher
@team.update_attributes(:teacher_id => nil)
end
if team_member.user_id != @team.user_id
team_member.destroy
@status = 1
@ -214,4 +214,33 @@ class CompetitionTeamsController < ApplicationController
rescue ActiveRecord::RecordNotFound
render_404
end
def member_and_teacher_count_valid?(is_teacher)
teacher_staff = @competition.competition_staffs.where(category: 'teacher').first
teacher_count = params[:teacher_ids].try(:size) || 0
teacher_count += 1 if is_teacher
# 检查老师数量
if teacher_staff.blank? && teacher_count > 0
@status, @message = -1, '该竞赛不能配备导师'
return false
elsif teacher_staff.present? && (teacher_staff.minimum > teacher_count || teacher_staff.maximum < teacher_count)
@status = -1
@message = teacher_staff.maximum == teacher_staff.maximum ? "导师数量应为#{teacher_staff.minimum}" : "导师数量应为#{teacher_staff.minimum}-#{teacher_staff.maximum}"
return false
end
member_relations = @competition.competition_staffs.where('category != "teacher"')
min_member_count = member_relations.sum(:minimum)
max_member_count = member_relations.sum(:maximum)
member_count = params[:member_ids].try(:size) || 0
member_count += 1 unless is_teacher
# 检查成员数据
if min_member_count > member_count || member_count > max_member_count
@status = -1
@message = min_member_count == max_member_count ? "成员数量应为#{max_member_count}" : "成员数量应为#{min_member_count}-#{max_member_count}"
return false
end
true
end
end

@ -20,6 +20,8 @@ class CompetitionsController < ApplicationController
def show
@images = @competition.attachments
@user = current_user
@enrolled = @user && @user.logged? && @competition.team_members.exists?(user_id: @user.id)
end
def index
@ -110,8 +112,12 @@ class CompetitionsController < ApplicationController
@team_members_count = TeamMember.where(:competition_team_id => @teams.pluck(:id)).count
@is_enroll = CompetitionTeam.where(:id => TeamMember.where(:user_id => @user, :competition_team_id => @competition.competition_teams.map(&:id)).pluck(:competition_team_id)).reorder("created_at desc")
@show_notice = (@competition.identifier == "gcc-dev-2018" || @competition.identifier == "gcc-annotation-2018") && @competition.competition_teams.where(:user_id => User.current.id, :teacher_id => nil).count > 0
@teams = paginateHelper @teams, 50
@show_notice = (@competition.identifier == "gcc-dev-2018" || @competition.identifier == "gcc-annotation-2018") &&
@competition.competition_teams.joins(:team_members).where(:user_id => User.current.id).group('competition_teams.id').sum('IF(team_members.is_teacher=1, 1, 0)').values.any?(&:zero?)
@teams = paginateHelper @teams.includes(:user, teachers: :user, members: :user), 50
@minimum_staff = @competition.competition_staffs.sum(:minimum)
@maximum_staff = @competition.competition_staffs.sum(:maximum)
respond_to do |format|
format.js
format.html
@ -443,7 +449,7 @@ class CompetitionsController < ApplicationController
def new_competition
if params[:com_name] && params[:com_name].strip != ""
visits = rand(400..1000)
Competition.create(:name => params[:com_name], :start_time => params[:start_time], :end_time => params[:end_time], :visits => visits)
Competition.create(:name => params[:com_name], sub_title: params[:sub_title].to_s.strip, :start_time => params[:start_time], :end_time => params[:end_time], :visits => visits)
end
redirect_to competition_managements_path
end
@ -451,48 +457,58 @@ class CompetitionsController < ApplicationController
def edit_competition
competition = Competition.find params[:id]
if params[:com_name] && params[:com_name].strip != ""
competition.update_attributes(:name => params[:com_name], :start_time => params[:start_time], :end_time => params[:end_time])
competition.update_attributes(:name => params[:com_name], sub_title: params[:sub_title].to_s.strip, :start_time => params[:start_time], :end_time => params[:end_time])
end
redirect_to competition_managements_path
end
def competition_setting
# @competition = Competition.find params[:id]
if params[:md_name]
md_modules = @competition.competition_modules.where(:md_edit => true)
md_modules.destroy_all if md_modules
params[:md_name].each_with_index do |name, index|
hidden = params[:md_checked][index].to_i == 0 ? 1 : 0
cm = CompetitionModule.create(:competition_id => @competition.id,:name => name, :position => params[:md_position][index], :hidden => hidden, :md_edit => true)
# 创建md_contents
CompetitionModuleMdContent.create(:competition_module_id => cm.id)
ActiveRecord::Base.transaction do
if params[:md_name]
md_modules = @competition.competition_modules.where(:md_edit => true)
md_modules.destroy_all if md_modules
params[:md_name].each_with_index do |name, index|
hidden = params[:md_checked][index].to_i == 0 ? 1 : 0
cm = CompetitionModule.create(:competition_id => @competition.id,:name => name, :position => params[:md_position][index], :hidden => hidden, :md_edit => true)
# 创建md_contents
CompetitionModuleMdContent.create(:competition_module_id => cm.id)
end
end
end
if params[:competition_module]
@competition.competition_modules.where(:id => params[:competition_module], :md_edit => false).update_all(:hidden => 0)
none_modules = @competition.competition_modules.where("name != '首页' and md_edit = false").map(&:id).join(",").split(",") - params[:competition_module]
@competition.competition_modules.where(:id => none_modules).update_all(:hidden => 1)
end
if params[:name]
@competition.competition_modules.where("name not in ('首页', '报名', '通知公告', '排行榜', '资料下载') and md_edit = false").each_with_index do |mod, index|
mod.update_attribute("name", params[:name][index])
if params[:competition_module]
@competition.competition_modules.where(:id => params[:competition_module], :md_edit => false).update_all(:hidden => 0)
none_modules = @competition.competition_modules.where("name != '首页' and md_edit = false").map(&:id).join(",").split(",") - params[:competition_module]
@competition.competition_modules.where(:id => none_modules).update_all(:hidden => 1)
end
end
if params[:url]
@competition.competition_modules.where("name not in ('首页', '报名', '通知公告', '排行榜') and md_edit = false").each_with_index do |mod, index|
mod.update_attribute("url", params[:url][index])
if params[:name]
@competition.competition_modules.where("name not in ('首页', '报名', '通知公告', '排行榜', '资料下载') and md_edit = false").each_with_index do |mod, index|
mod.update_attribute("name", params[:name][index])
end
end
end
if params[:position]
@competition.competition_modules.where(:md_edit => false).each_with_index do |mod, index|
mod.update_attribute("position", params[:position][index])
if params[:url]
@competition.competition_modules.where("name not in ('首页', '报名', '通知公告', '排行榜') and md_edit = false").each_with_index do |mod, index|
mod.update_attribute("url", params[:url][index])
end
end
end
@competition.update_attributes(:identifier => params[:identifier], :min_num => params[:min_num], :max_num => params[:max_num], :enroll_end_time => params[:enroll_end_time])
if params[:new_name]
params[:new_name].each_with_index do |new_module, index|
@competition.competition_modules << CompetitionModule.new(:name => new_module, :position => params[:new_position][index], :hidden => 0, :url => params[:new_url][index])
if params[:position]
@competition.competition_modules.where(:md_edit => false).each_with_index do |mod, index|
mod.update_attribute("position", params[:position][index])
end
end
@competition.update_attributes(:identifier => params[:identifier], :enroll_end_time => params[:enroll_end_time])
if params[:competition_staffs].present?
@competition.competition_staffs.delete_all
params[:competition_staffs].each_with_index do |staff_params, index|
@competition.competition_staffs.create(staff_params.merge(position: index + 1))
end
end
if params[:new_name]
params[:new_name].each_with_index do |new_module, index|
@competition.competition_modules << CompetitionModule.new(:name => new_module, :position => params[:new_position][index], :hidden => 0, :url => params[:new_url][index])
end
end
end
end

@ -1176,7 +1176,7 @@ class CoursesController < ApplicationController
def export_course_member_excel
q = params[:name] ? "#{params[:name].strip}" : ""
filename="#{@course.teacher.show_real_name.to_s }_#{@course.name}_#{l(:excel_member_list)}";
filename="#{@course.teacher.show_real_name.to_s }_#{@course.name}_#{l(:excel_member_list)}"
if params[:group_id] && params[:group_id] != "0" && params[:group_id] != "-1"
group = CourseGroup.find params[:group_id]
unless group.nil?
@ -1194,12 +1194,14 @@ class CoursesController < ApplicationController
@exercises = @course.exercises.where("publish_time <= '#{Time.now}'").order("publish_time asc, created_at asc")
@tasks = @course.graduation_tasks.where("publish_time <= '#{Time.now}'").order("publish_time asc, created_at asc")
=begin
@homeworks.where(:homework_type => 4).each do |homework|
items = homework.student_works.where("work_status != 0")
if items.count == 0 && homework.publish_time < Time.now && !@course.is_end
update_shixun_work_status homework
end
end
=end
respond_to do |format|
format.xls {
@ -2383,12 +2385,13 @@ class CoursesController < ApplicationController
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
#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)])
teacher_co = (searchTeacherAndAssistant course).map{|member| member.user.show_real_name}.join('、')
sheet1[0,0] = "课程编号"
sheet1[0,1] = course.id
sheet1[1,0] = "课程名称"
sheet1[1,1] = course.name
sheet1[2,0] = "教师团队"
sheet1[2,1] = (searchTeacherAndAssistant course).map{|member| member.user.show_real_name}.join('、')
sheet1[2,1] = teacher_co
sheet1[3,0] = "主讲教师"
sheet1[3,1] = course.teacher.show_real_name
sheet1[4,0] = "排名"
@ -2401,17 +2404,17 @@ class CoursesController < ApplicationController
homeworks.where(:homework_type => 4).each do |homework|
sheet1[4,current_col+=1] = "#{homework.name}"
end
for i in 0 ... homeworks.where(:homework_type => 1).count
sheet1[4,current_col+=1] = "普通作业第"+(i+1).to_s+""
homeworks.where(:homework_type => 1).each do |homework|
sheet1[4,current_col+=1] = "#{homework.name}"
end
for i in 0 ... homeworks.where(:homework_type => 3).count
sheet1[4,current_col+=1] = "分组作业第"+(i+1).to_s+""
homeworks.where(:homework_type => 3).each do |homework|
sheet1[4,current_col+=1] = "#{homework.name}"
end
for i in 0 ... exercises.count
sheet1[4,current_col+=1] = "试卷第"+(i+1).to_s+""
exercises.each do |exercise|
sheet1[4,current_col+=1] = "#{exercise.exercise_name}"
end
for i in 0 ... tasks.count
sheet1[4,current_col+=1] = "毕设任务第"+(i+1).to_s+""
tasks.each do |task|
sheet1[4,current_col+=1] = "#{task.name}"
end
sheet1[4,current_col+=1] = "实训作业总得分"
@ -2431,51 +2434,51 @@ class CoursesController < ApplicationController
sheet1[count_row,column+=1] = member.user.login
sheet1[count_row,column+=1] = member.user.mail
sheet1[count_row,column+=1] = member.user.user_extensions.student_id
sheet1[count_row,column+=1] = member.course_group_id == 0 ? "暂无" : member.course_group.name
sheet1[count_row,column+=1] = member.course_group_id == 0 ? "暂无" : member.course_group.try(:name)
# current_col = 5
shixun_score = 0
homeworks.where(:homework_type => 4).includes(:student_works).each do |homework|
student_works = homework.student_works.where("user_id = #{member.user.id}")
if student_works.empty?
homeworks.where(:homework_type => 4).each do |homework|
student_works = homework.score_student_works.find_by_user_id(member.user.id)
if student_works.nil?
sheet1[count_row,column+=1] = 0
else
work_score = student_works.first.work_score.nil? ? 0 : student_works.first.work_score
work_score = student_works.work_score.nil? ? 0 : student_works.work_score
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
shixun_score += work_score < 0 ? 0 : work_score.round(1)
end
# current_col += 1
end
common_score = 0
homeworks.where(:homework_type => 1).includes(:student_works).each do |homework|
student_works = homework.student_works.where("user_id = #{member.user.id}")
if student_works.empty?
homeworks.where(:homework_type => 1).each do |homework|
student_works = homework.score_student_works.find_by_user_id(member.user.id)
if student_works.nil?
sheet1[count_row,column+=1] = 0
else
work_score = student_works.first.work_score.nil? ? 0 : student_works.first.work_score
work_score = student_works.work_score.nil? ? 0 : student_works.work_score
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
common_score += work_score < 0 ? 0 : work_score.round(1)
end
# current_col += 1
end
group_score = 0
homeworks.where(:homework_type => 3).includes(:student_works).each do |homework|
student_works = homework.student_works.where("user_id = #{member.user.id}")
if student_works.empty?
homeworks.where(:homework_type => 3).each do |homework|
student_works = homework.score_student_works.find_by_user_id(member.user.id)
if student_works.nil?
sheet1[count_row,column+=1] = 0
else
work_score = student_works.first.work_score.nil? ? 0 : student_works.first.work_score
work_score = student_works.work_score.nil? ? 0 : student_works.work_score
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
group_score += work_score < 0 ? 0 : work_score.round(1)
end
# current_col += 1
end
exercise_score = 0
exercises.includes(:exercise_users).each do |exercise|
exercise_user = exercise.exercise_users.where("user_id = #{member.user.id}")
if exercise_user.empty?
exercises.each do |exercise|
exercise_user = exercise.score_exercise_users.find_by_user_id(member.user.id)
if exercise_user.nil?
sheet1[count_row,column+=1] = 0
else
work_score = exercise_user.first.score.nil? ? 0 : exercise_user.first.score
work_score = exercise_user.score.nil? ? 0 : exercise_user.score
sheet1[count_row,column+=1] = work_score < 0 ? 0 : work_score.round(1)
exercise_score += work_score < 0 ? 0 : work_score.round(1)
end
@ -2483,7 +2486,7 @@ class CoursesController < ApplicationController
end
graduation_score = 0
tasks.includes(:graduation_works).each do |task|
tasks.each do |task|
graduation_works = task.graduation_works.where("user_id = #{member.user.id}")
if graduation_works.empty?
sheet1[count_row,column+=1] = 0
@ -2511,15 +2514,15 @@ class CoursesController < ApplicationController
sheet = book.create_worksheet :name => "分班信息"
sheet.row(0).concat(["课程编号", course.id])
sheet.row(1).concat(["课程名称", course.name])
sheet.row(2).concat(["教师团队", (searchTeacherAndAssistant course).map{|member| member.user.show_real_name}.join('、')])
sheet.row(2).concat(["教师团队", teacher_co])
sheet.row(3).concat(["主讲教师", course.teacher.show_real_name])
sheet.row(4).concat(["序号", "分班名称", "邀请码", "学生数量"])
current_row = 5
course.course_groups.each do |course_group|
course.course_groups.includes(:members).each do |course_group|
sheet[current_row,0]= current_row - 4
sheet[current_row,1]= course_group.name
sheet[current_row,2]= course_group.invite_code
sheet[current_row,3]= course_group.members.count
sheet[current_row,3]= course_group.members.size
current_row += 1
end
end
@ -2530,7 +2533,7 @@ class CoursesController < ApplicationController
sheet2[1,0] = "课程名称"
sheet2[1,1] = course.name
sheet2[2,0] = "教师团队"
sheet2[2,1] = (searchTeacherAndAssistant course).map{|member| member.user.show_real_name}.join('、')
sheet2[2,1] = teacher_co
sheet2[3,0] = "主讲教师"
sheet2[3,1] = course.teacher.show_real_name
sheet2.row(4).concat(["排名","学生姓名","昵称","学号","分班","作业完成数(*10","试卷完成数(*10","问卷完成数(*7","资源发布数(*5","帖子发布数(*2","帖子回复数(*1","作业回复数(*1","活跃度"])
@ -2547,7 +2550,7 @@ class CoursesController < ApplicationController
sheet2[count_row,1] = act_member.user.show_real_name
sheet2[count_row,2] = act_member.user.login
sheet2[count_row,3] = act_member.user.user_extensions.student_id
sheet2[count_row,4] = act_member.course_group_id == 0 ? "暂无" : act_member.course_group.name
sheet2[count_row,4] = act_member.course_group_id == 0 ? "暂无" : act_member.course_group.try(:name)
sheet2[count_row,5]= act_member.homework_num.to_i + act_member.graduation_num.to_i
sheet2[count_row,6]= act_member.exercise_num
sheet2[count_row,7]= act_member.poll_num
@ -2559,48 +2562,49 @@ class CoursesController < ApplicationController
count_row += 1
end
homeworks.where(:homework_type => 4).includes(:student_works).each_with_index do |home, i|
homeworks.where(:homework_type => 4).includes(:score_student_works).each_with_index do |home, i|
sheet = book.create_worksheet :name => "#{home.name}"
sheet[0,0] = "课程编号"
sheet[0,1] = course.id
sheet[1,0] = "课程名称"
sheet[1,1] = course.name
sheet[2,0] = "教师团队"
sheet[2,1] = (searchTeacherAndAssistant course).map{|member| member.user.show_real_name}.join('、')
sheet[2,1] = teacher_co
sheet[3,0] = "主讲教师"
sheet[3,1] = course.teacher.show_real_name
sheet[3,0] = "作业批次"
sheet[3,1] = "#{i+1}"
sheet[3,0] = "作业名称"
sheet[3,1] = home.name
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_homework_des),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),"分班",l(:excel_homework_des),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
count_row = 5
items = home.student_works.where("work_status != 0").order("work_score desc")
if items.count == 0 && home.publish_time < Time.now && !course.is_end
update_shixun_work_status home
items = StudentWork.where("work_status != 0 and homework_common_id = #{home.id}").order("work_score desc")
end
items = home.score_student_works
# if items.count == 0 && home.publish_time < Time.now && !course.is_end
# update_shixun_work_status home
# items = StudentWork.where("work_status != 0 and homework_common_id = #{home.id}").order("work_score desc")
# end
items.each_with_index do |stu, j|
sheet[count_row,0]= j + 1
sheet[count_row,1] = stu.user.show_real_name
sheet[count_row,2] = stu.user.login
sheet[count_row,3] = stu.user.user_extensions.student_id
sheet[count_row,4] = strip_html stu.description
sheet[count_row,5] = stu.late_penalty
sheet[count_row,6] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
sheet[count_row,7] = format_time(stu.commit_time)
sheet[count_row,4] = member_group_name course.members, stu.user_id
sheet[count_row,5] = strip_html stu.description
sheet[count_row,6] = stu.late_penalty
sheet[count_row,7] = stu.work_score.nil? ? l(:label_without_score) : stu.work_score.round(1)
sheet[count_row,8] = format_time(stu.commit_time)
count_row += 1
end
end
homeworks.where(:homework_type => 1).includes(:student_works).each_with_index do |home, i|
sheet = book.create_worksheet :name => "普通作业第#{i+1}"
homeworks.where(:homework_type => 1).includes(:score_student_works).each_with_index do |home, i|
sheet = book.create_worksheet :name => "#{home.name}"
sheet[0,0] = "课程编号"
sheet[0,1] = course.id
sheet[1,0] = "课程名称"
sheet[1,1] = course.name
sheet[2,0] = "教师团队"
sheet[2,1] = (searchTeacherAndAssistant course).map{|member| member.user.show_real_name}.join('、')
sheet[2,1] = teacher_co
sheet[3,0] = "主讲教师"
sheet[3,1] = course.teacher.show_real_name
sheet[3,0] = "作业批次"
@ -2615,7 +2619,7 @@ class CoursesController < ApplicationController
l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
end
count_row = 5
items = home.student_works.where("work_status != 0").order("work_score desc")
items = home.score_student_works
items.each_with_index do |stu, j|
sheet[count_row,0]= j + 1
sheet[count_row,1] = stu.user.show_real_name
@ -2640,14 +2644,14 @@ class CoursesController < ApplicationController
end
homeworks.where(:homework_type => 3).includes(:student_works).each_with_index do |home, i|
sheet = book.create_worksheet :name => "分组作业第#{i+1}"
homeworks.where(:homework_type => 3).includes(:score_student_works).each_with_index do |home, i|
sheet = book.create_worksheet :name => "#{home.name}"
sheet[0,0] = "课程编号"
sheet[0,1] = course.id
sheet[1,0] = "课程名称"
sheet[1,1] = course.name
sheet[2,0] = "教师团队"
sheet[2,1] = (searchTeacherAndAssistant course).map{|member| member.user.show_real_name}.join('、')
sheet[2,1] = teacher_co
sheet[3,0] = "主讲教师"
sheet[3,1] = course.teacher.show_real_name
sheet[3,0] = "作业批次"
@ -2663,7 +2667,7 @@ class CoursesController < ApplicationController
l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_commit_time)])
end
count_row = 5
items = home.student_works.where("work_status != 0").order("work_score desc")
items = home.score_student_works
items.each_with_index do |stu, j|
sheet[count_row,0] = j + 1
sheet[count_row,1] = stu.user.show_real_name
@ -2688,14 +2692,14 @@ class CoursesController < ApplicationController
end
end
exercises.each_with_index do |exercise, i|
sheet = book.create_worksheet :name => "试卷第#{i+1}"
exercises.includes(:score_exercise_users).each_with_index do |exercise, i|
sheet = book.create_worksheet :name => "#{exercise.exercise_name}"
sheet[0,0] = "课程编号"
sheet[0,1] = course.id
sheet[1,0] = "课程名称"
sheet[1,1] = course.name
sheet[3,0] = "教师团队"
sheet[3,1] = (searchTeacherAndAssistant course).map{|member| member.user.show_real_name}.join('、')
sheet[3,1] = teacher_co
sheet[3,0] = "主讲教师"
sheet[3,1] = course.teacher.show_real_name
sheet[3,0] = "试卷批次"
@ -2705,7 +2709,7 @@ class CoursesController < ApplicationController
sheet.row(4).concat([l(:excel_rank),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_objective_score),l(:excel_subjective_score),l(:excel_f_score),l(:excel_answer_time)])
count_row = 5
items = exercise.exercise_users.where("commit_status != 0").order("score desc")
items = exercise.score_exercise_users
items.each_with_index do |stu, j|
sheet[count_row,0] = j + 1
sheet[count_row,1] = stu.user.show_real_name
@ -2720,13 +2724,13 @@ class CoursesController < ApplicationController
end
tasks.each_with_index do |task, i|
sheet = book.create_worksheet :name => "毕设任务第#{i+1}"
sheet = book.create_worksheet :name => "#{task.name}"
sheet[0,0] = "课程编号"
sheet[0,1] = course.id
sheet[1,0] = "课程名称"
sheet[1,1] = course.name
sheet[2,0] = "教师团队"
sheet[2,1] = (searchTeacherAndAssistant course).map{|member| member.user.show_real_name}.join('、')
sheet[2,1] = teacher_co
sheet[3,0] = "主讲教师"
sheet[3,1] = course.teacher.show_real_name
sheet[3,0] = "作业批次"

@ -879,7 +879,7 @@ class ExerciseController < ApplicationController
if @order == "student_id"
@exercise_users_list = @exercise_users_list.includes(:user => {:user_extensions => []}).order("user_extensions.student_id #{@b_sort}")
else
@exercise_users_list = @exercise_users_list.includes(:user => {:user_extensions => []}).order("#{@order} #{@b_sort}")
@exercise_users_list = @exercise_users_list.includes(:user => {:user_extensions => []}).order("#{@order} #{@b_sort}, id desc")
end
end

@ -229,12 +229,6 @@ class IssuesController < ApplicationController
User.current.at_messages.unviewed('Journal', j.id).each {|x| x.viewed!}
end
# 缺陷状态消息更新
query_journals_ids = @issue.journals.map{|journal| journal.id}
if query_journals_ids.length > 0
query_journals = ForgeMessage.where("user_id =? and forge_message_type =? and forge_message_id in (#{query_journals_ids.join(",")})", User.current.id, "Journal")
query_journals.update_all(:viewed => true)
end
@jour_reply = Journal.new
@journals = @issue.journals.includes(:user, :details).reorder("#{Journal.table_name}.id desc").all

@ -0,0 +1,125 @@
class LibrariesController < ApplicationController
layout 'base_library'
before_filter :require_login, :except => [:index]
def index
libraries = Library.where(nil)
libraries =
if params[:type] == 'mine'
libraries.where(user_id: current_user.id).order('created_at desc')
else
libraries.where(status: :published).order('visited_count desc')
end
search = params[:search].to_s.strip
libraries = libraries.where('title LIKE :search OR uuid LIKE :search', search: "%#{search}%") if search.present?
per_page = params[:per_page].to_i <= 0 ? 20 : params[:per_page].to_i
@libraries = paginateHelper libraries.includes(user: :user_extensions), per_page
end
def show
@library = current_library
return render_403 unless admin_or_self? || @library.published?
@library_applies = @library.library_applies.where(status: :refused).order('created_at desc')
@library.increment_visited_count!
end
def new
@library = current_user.libraries.new
end
def create
@library = current_user.libraries.new
Libraries::SaveService.new(@library, current_user, form_params).call
if with_publish?
Libraries::SubmitService.new(@library).call
redirect_to publish_success_libraries_path
else
flash[:message] = '保存成功'
redirect_to edit_library_path(id: @library.id)
end
rescue ActiveRecord::RecordInvalid => _
render 'new'
rescue Libraries::SubmitService::Error => ex
flash[:message] = ex.message
render 'new'
end
def edit
return render_403 unless admin_or_self?
@library = current_library
end
def update
return render_403 unless admin_or_self?
@library = current_library
Libraries::SaveService.new(@library, current_user, form_params).call
if with_publish?
Libraries::SubmitService.new(@library).call
redirect_to publish_success_libraries_path
else
flash[:message] = '保存成功'
redirect_to edit_library_path(id: @library.id)
end
rescue ActiveRecord::RecordInvalid => _
render 'edit'
rescue Libraries::SubmitService::Error => ex
flash[:message] = ex.message
render 'edit'
end
def destroy
if admin_or_business?
current_library.destroy
elsif current_library.user_id == current_user.id
unless current_library.pending?
render json: { status: -1, message: '只有草稿才能删除' }
return
end
current_library.destroy
else
render_403
return
end
render json: { status: 0, message: 'success' }
end
def publish
Libraries::SubmitService.new(current_library).call
render json: { status: 0 }
rescue Libraries::SubmitService::Error => ex
render json: { status: 0, message: ex.message }
end
def publish_success
end
private
def current_library
@_current_library ||= Library.find(params[:id])
end
def form_params
@_form_params ||= begin
hash = params[:library].presence || {}
hash[:attachment_ids] = (params[:attachments].presence || []).values.map{|h| h[:attachment_id]}
hash
end
end
def with_publish?
params[:apply_publish].to_s == 'true'
end
def admin_or_self?
current_library.user_id == current_user.id || admin_or_business?
end
end

@ -0,0 +1,47 @@
class Managements::LibraryAppliesController < Managements::BaseController
before_filter :set_menu_type
def index
applies = LibraryApply.order('library_applies.updated_at desc')
search = params[:search].to_s.strip
if search.present?
applies = applies.joins(:library)
.where('libraries.uuid like :search or libraries.title like :search', search: "%#{search}%")
end
applies = applies.where(status: params[:status].presence || :pending)
@library_applies = paginateHelper applies.includes(library: { user: :user_extensions })
respond_to do |format|
format.js
format.html
end
end
def agree
Libraries::AgreeApplyService.new(current_library_apply, current_user).call
render json: { status: 0 }
rescue Libraries::AgreeApplyService::Error => e
render json: { status: -1, message: e.message }
end
def refuse
Libraries::RefuseApplyService.new(current_library_apply, current_user, reason: params[:reason]).call
render json: { status: 0 }
rescue Libraries::RefuseApplyService::Error => e
render json: { status: -1, message: e.message }
end
private
def current_library_apply
@_current_library_apply ||= LibraryApply.find(params[:id])
end
def set_menu_type
@menu_type = 10
@sub_type = 8
end
end

@ -346,19 +346,19 @@ class ManagementsController < ApplicationController
if mirror.blank?
raise("choose_update_mirror exception")
end
shixun_tomcat = Redmine::Configuration['shixun_tomcat']
params = {imageName: mirror.name, imageID: old_id, flag: flag}
uri = "#{shixun_tomcat}/bridge/docker/updateImage"
res = uri_exec uri, params
if (res && res['code'] != 0)
raise("choose_update_mirror exception")
end
#shixun_tomcat = Redmine::Configuration['shixun_tomcat']
#params = {imageName: mirror.name, imageID: old_id, flag: flag}
#uri = "#{shixun_tomcat}/bridge/docker/updateImage"
#res = uri_exec uri, params
# if (res && res['code'] != 0)
#raise("choose_update_mirror exception")
#end
if flag == 0
mirror.update_attributes(:mirrorID => change_id, :status => 0)
mirror.update_attributes(:mirrorID => change_id, :status => 1)
# 用户操作的的行为需要记录 user_id 中间层操作的行为user_id = -1
MirrorOperationRecord.create!(:mirror_repository_id => mirror.id, :mirror_id => change_id, :mirror_name => mirror.name, :status => 1, :user_id => User.current.id, :old_tag => old_id, :new_tag => change_id)
else
mirror.update_attribute(:status, 0)
mirror.update_attribute(:status, 1)
end
respond_to do |format|
format.js{ redirect_to mirror_repository_managements_path(:reaction => "choose_update_mirror")}
@ -720,20 +720,25 @@ class ManagementsController < ApplicationController
shixun_tomcat = Redmine::Configuration['shixun_tomcat']
params = {imageName: @mirror.name}
# 主从节点同步镜像
uri = "#{shixun_tomcat}/bridge/docker/syncImage"
res = uri_exec uri, params
if (res && res['code'] != 0)
raise("Synchronize Mirror exception")
end
#uri = "#{shixun_tomcat}/bridge/docker/syncImage"
#res = uri_exec uri, params
#if (res && res['code'] != 0)
# raise("Synchronize Mirror exception")
#end
end
if @_params[:type_name] != @mirror.type_name
MirrorOperationRecord.create!(:mirror_repository_id => @mirror.id, :status => 5, :user_id => User.current.id, :old_tag => @mirror.type_name, :new_tag => @_params[:type_name])
MirrorOperationRecord.create!(:mirror_repository_id => @mirror.id, :status => 5,
:user_id => User.current.id, :old_tag => @mirror.type_name,
:new_tag => @_params[:type_name])
elsif @_params[:status].to_i != @mirror.status
MirrorOperationRecord.create!(:mirror_repository_id => @mirror.id, :status => 6, :user_id => User.current.id, :old_tag => @mirror.status, :new_tag => @_params[:status])
MirrorOperationRecord.create!(:mirror_repository_id => @mirror.id, :status => 6,
:user_id => User.current.id, :old_tag => @mirror.status,
:new_tag => @_params[:status])
end
@mirror.update_attributes(:description => @_params[:description], :status => @_params[:status], :main_type => @_params[:mirror_type],
:type_name => @_params[:type_name], :resource_limit => @_params[:mirror_resource_limit], :cpu_limit => @_params[:mirror_cpu_limit],
:memory_limit => @_params[:mirror_memory_limit], :time_limit => @_params[:mirror_time_limit])
@mirror.update_attributes(:description => @_params[:description], :status => @_params[:status],
:main_type => @_params[:mirror_type], :type_name => @_params[:type_name],
:resource_limit => @_params[:mirror_resource_limit], :cpu_limit => @_params[:mirror_cpu_limit],
:memory_limit => @_params[:mirror_memory_limit], :time_limit => @_params[:mirror_time_limit])
@index = MirrorRepository.order("created_at desc").map(&:id).index(@mirror.id)
respond_to do |format|
format.js
@ -3384,7 +3389,7 @@ end
@is_remote = true
@users_pages = Paginator.new @users_count, @limit, params['page'] || 1
@offset ||= @users_pages.offset
@users = paginateHelper users.includes(:real_name_authentication_apply, :professional_authentication_apply,
@users = paginateHelper users.preload(:real_name_authentication_apply, :professional_authentication_apply,
user_extensions: [:department, :school]), @limit
respond_to do |format|

@ -333,7 +333,7 @@ class MyshixunsController < ApplicationController
shixun_tomcat = Redmine::Configuration['shixun_tomcat']
uri = "#{shixun_tomcat}/bridge/webssh/getConnectInfo"
user_id = User.current.id
params = {tpiID:@myshixun.id, podType:@myshixun.shixun.try(:webssh), containers:(Base64.urlsafe_encode64(container_limit @myshixun.shixun.mirror_repositories))}
params = {tpiID:@myshixun.id, podType:@myshixun.shixun.try(:webssh), containers:(Base64.urlsafe_encode64(shixun_container_limit @myshixun.shixun))}
res = uri_exec uri, params
if res && res['code'].to_i != 0
raise("实训云平台繁忙繁忙等级92")
@ -362,7 +362,7 @@ class MyshixunsController < ApplicationController
begin
uri = "#{shixun_tomcat}/bridge/vnc/getvnc"
shixun = @myshixun.shixun
params = {tpiID: @myshixun.id, :containers => "#{Base64.urlsafe_encode64(container_limit(shixun.mirror_repositories))}"}
params = {tpiID: @myshixun.id, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"}
res = uri_exec uri, params
if res && res['code'].to_i != 0
raise("实训云平台繁忙繁忙等级99")

@ -332,9 +332,7 @@ class ProjectsController < ApplicationController
def show
# 顶部导航
@project_menu_type = 1
# 更新消息为已读
update_message_status(User.current, @project)
# over
if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
return
end

@ -749,6 +749,7 @@ class ShixunsController < ApplicationController
@main_type = MirrorRepository.published_main_mirror
@small_type = MirrorRepository.published_small_mirror
respond_to do |format|
format.html{render :layout => 'base_edu'}
format.json
@ -791,7 +792,7 @@ class ShixunsController < ApplicationController
shixun_script = modify_shixun_script @shixun, shixun_script
end
end
@shixun.evaluate_script = shixun_script
#@shixun.evaluate_script = shixun_script
ActiveRecord::Base.transaction do
begin
@ -808,13 +809,16 @@ class ShixunsController < ApplicationController
@shixun.shixun_members << m
# 镜像-实训关联表
ShixunMirrorRepository.create!(:shixun_id => @shixun.id, :mirror_repository_id => main_type.to_i) if main_type.present?
# 创建Pod配置信息
ShixunServiceConfig.create!(:shixun_id => @shixun.id, :mirror_repository_id => main_type.to_i)
if sub_type.present?
sub_mirrors = sub_type.split(",").map(&:to_i)
sub_mirrors.each do |mirror|
ShixunMirrorRepository.create!(:shixun_id => @shixun.id, :mirror_repository_id => mirror)
ShixunServiceConfig.create!(:shixun_id => @shixun.id, :mirror_repository_id => mirror)
end
end
# 自动构建版本库
#自动构建版本库
repository = Repository.new
repository.shixun = @shixun
repository.type = 'Repository::Gitlab'
@ -874,6 +878,16 @@ class ShixunsController < ApplicationController
ShixunTagRepertoire.create!(:tag_repertoire_id => str.tag_repertoire_id, :shixun_id => new_shixun.id)
end
# 同步配置
@shixun.shixun_service_configs.each do |config|
ShixunServiceConfig.create!(:shixun_id => new_shixun.id,
:cpu_limit => config.cpu_limit,
:lower_cpu_limit => config.lower_cpu_limit,
:memory_limit => config.memory_limit,
:request_limit => config.request_limit,
:mirror_repository_id => config.mirror_repository_id)
end
# 同步复制版本库先fork再修改版本库名
# eduforge用户作为版本库的创建者
repository = Repository.new
@ -1025,6 +1039,7 @@ class ShixunsController < ApplicationController
end
def update
logger.info("#######-----#{params[:config]}")
@shixun.attributes = params[:shixun]
#@shixun.language = params[:language]
@shixun.trainee = params[:trainee]
@ -1046,6 +1061,7 @@ class ShixunsController < ApplicationController
mirror_ids = (@shixun.shixun_mirror_repositories.blank? ? [] : @shixun.shixun_mirror_repositories.map(&:id))
update_miiror_id = []
@shixun.shixun_mirror_repositories.destroy_all
if params[:main_type].present?
update_miiror_id << params[:main_type].to_i
ShixunMirrorRepository.create(:shixun_id => @shixun.id, :mirror_repository_id => params[:main_type])
@ -1057,7 +1073,17 @@ class ShixunsController < ApplicationController
ShixunMirrorRepository.create(:shixun_id => @shixun.id, :mirror_repository_id => mirror)
end
end
# 超级管理员才能保存 中间层服务器pod信息的配置
@shixun.shixun_service_configs.destroy_all
params[:mirror_id].each_with_index do |mirror_id, index|
ShixunServiceConfig.create!(:shixun_id => @shixun.id,
:cpu_limit => params[:cpu_limit][index],
:lower_cpu_limit => params[:lower_cpu_limit][index],
:memory_limit => params[:memory_limit][index],
# :resource_limit => params[:resource_limit][index],
:request_limit => params[:request_limit][index],
:mirror_repository_id => mirror_id)
end
ActiveRecord::Base.transaction do
begin
@ -1143,6 +1169,8 @@ class ShixunsController < ApplicationController
@small_type = MirrorRepository.published_small_mirror
@shixun_main_mirror = @shixun.mirror_repositories.published_main_mirror.first
# 权限
logger.info("###########{User.current.admin?}")
logger.info("#########business:##{User.current.business?}")
@power = (@shixun.status < 2 ? true : ( User.current.admin? ? true : false))
# unless @repository.nil?
# gitlab_address = Redmine::Configuration['gitlab_address']

@ -2017,10 +2017,10 @@ class StudentWorkController < ApplicationController
if @homework.homework_type == 1 #普通作业
if @homework.anonymous_comment ==0
sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_course_group),l(:excel_homework_des),
l(:excel_t_score),l(:excel_ta_score), l(:excel_n_score),l(:excel_a_penalty),l(:excel_l_penalty),l(:excel_f_score),l(:excel_update_time)])
l(:excel_t_score),l(:excel_ta_score), l(:excel_n_score),l(:excel_a_penalty),l(:excel_l_penalty),l(:excel_f_score),l(:excel_update_time), "评语"])
else
sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_course_group),l(:excel_homework_des),
l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_update_time)])
l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_update_time), "评语"])
end
count_row = 1
items.each do |homework|
@ -2039,10 +2039,12 @@ class StudentWorkController < ApplicationController
sheet1[count_row,11] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,12] = homework.respond_to?("work_score") ? homework.work_score.nil? ? l(:label_without_score) : homework.work_score.round(1) : l(:label_without_score)
sheet1[count_row,13] = format_time(homework.update_time)
sheet1[count_row,14] = work_comment(homework)
else
sheet1[count_row,9] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,10] = homework.respond_to?("work_score") ? homework.work_score.nil? ? l(:label_without_score) : homework.work_score.round(1) : l(:label_without_score)
sheet1[count_row,11] = format_time(homework.update_time)
sheet1[count_row,12] = work_comment(homework)
end
count_row += 1
end
@ -2082,10 +2084,10 @@ class StudentWorkController < ApplicationController
elsif @homework.homework_type == 3 #分组作业
if @homework.anonymous_comment ==0
sheet1.row(0).concat([l(:excel_group),l(:excel_group_member),l(:excel_course_group),l(:excel_homework_des),
l(:excel_t_score),l(:excel_ta_score),l(:excel_n_score),l(:excel_a_penalty),l(:excel_l_penalty),l(:excel_f_score),l(:excel_update_time)])
l(:excel_t_score),l(:excel_ta_score),l(:excel_n_score),l(:excel_a_penalty),l(:excel_l_penalty),l(:excel_f_score),l(:excel_update_time), "评语"])
else
sheet1.row(0).concat([l(:excel_group),l(:excel_group_member),l(:excel_course_group),l(:excel_homework_des),
l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_update_time)])
l(:excel_t_score),l(:excel_ta_score),l(:excel_l_penalty),l(:excel_f_score),l(:excel_update_time), "评语"])
end
count_row = 1
items.each do |homework|
@ -2101,16 +2103,18 @@ class StudentWorkController < ApplicationController
sheet1[count_row,8] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,9] = homework.respond_to?("work_score") ? homework.work_score.nil? ? l(:label_without_score) : homework.work_score.round(1) : l(:label_without_score)
sheet1[count_row,10] = format_time(homework.update_time)
sheet1[count_row,11] = work_comment(homework)
else
sheet1[count_row,6] = (@homework.teacher_priority == 1 && !homework.teacher_score.nil?) ? 0 : homework.late_penalty
sheet1[count_row,7] = homework.respond_to?("work_score") ? homework.work_score.nil? ? l(:label_without_score) : homework.work_score.round(1) : l(:label_without_score)
sheet1[count_row,8] = format_time(homework.update_time)
sheet1[count_row,9] = work_comment(homework)
end
count_row += 1
end
elsif @homework.homework_type == 4 #实训作业
sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_course_group),l(:excel_homework_complete_time),
l(:excel_homework_complete_status), l(:excel_homework_evaluate_times), l(:excel_homework_spend_time),l(:excel_homework_total_exp),l(:excel_l_penalty),l(:excel_f_score),l(:excel_update_time)])
l(:excel_homework_complete_status), l(:excel_homework_evaluate_times), l(:excel_homework_spend_time),l(:excel_homework_total_exp),l(:excel_l_penalty),l(:excel_f_score),l(:excel_update_time), "评语"])
count_row = 1
shixun = @homework.homework_commons_shixuns.shixun
items.each do |homework|
@ -2129,6 +2133,7 @@ class StudentWorkController < ApplicationController
sheet1[count_row,11] = homework.late_penalty
sheet1[count_row,12] = homework.respond_to?("work_score") ? homework.work_score.nil? ? "--" : homework.work_score.round(1) : "--"
sheet1[count_row,13] = homework.update_time ? format_time(homework.update_time) : "--"
sheet1[count_row,14] = work_comment(homework)
count_row += 1
end

@ -29,9 +29,16 @@ class TrainingsController < ApplicationController
def enroll
@training = current_training || Training.new
if @training.training_payinfo.present? && params[:disable_redirect].blank?
redirect_to result_training_path(id: friendly_id)
return
if params[:disable_redirect].blank?
if @training.training_payinfo.present?
redirect_to result_training_path(id: friendly_id)
return
end
unless @training.new_record?
redirect_to training_path(id: friendly_id)
return
end
end
end
@ -149,7 +156,6 @@ class TrainingsController < ApplicationController
training_info.save!
if params[:js] == 'true' && training_info.not_payed?
Rails.logger.info("### start wechat pay => fee: #{training_info.fee}")
_pay_js(training_info.fee)
else
redirect_to result_training_path(id: friendly_id)
@ -179,6 +185,7 @@ class TrainingsController < ApplicationController
#js获取支付参数
def _pay_js(fee)
Rails.logger.info("### start wechat pay => fee: #{fee}")
@training = current_training
js_function_call do
out_trade_no = Wechat.pay.gen_trade_no

@ -4178,7 +4178,8 @@ class UsersController < ApplicationController
###add by huang
def user_watchlist
watch_query = User.watched_by(@user.id)
watch_query = User.joins('left join watchers on watchers.watchable_id = users.id and watchers.watchable_type in ("Principal", "User")')
.where('watchers.user_id = ?', @user.id)
@user_watchlist_count = watch_query.size
@user_watchlist = watch_query.order("#{Watcher.table_name}.id desc")
@limit = 10
@ -4191,7 +4192,8 @@ class UsersController < ApplicationController
###add by huang
def user_fanslist
fan_query = @user.watcher_users
fan_query = User.joins('left join watchers on watchers.user_id = users.id and watchers.watchable_type in ("Principal", "User")')
.where('watchers.watchable_id = ?', @user.id)
@user_fanlist_count = fan_query.size
@user_fanlist = fan_query.order("#{Watcher.table_name}.id desc")
@ -4204,10 +4206,12 @@ class UsersController < ApplicationController
end
def user_wathlist_and_fanslist
watch_query = User.watched_by(@user.id)
watch_query = User.joins('left join watchers on watchers.watchable_id = users.id and watchers.watchable_type in ("Principal", "User")')
.where('watchers.user_id = ?', @user.id)
@user_watchlist_count = watch_query.count
@user_watchlist = watch_query.order("#{Watcher.table_name}.id desc")
fan_query = @user.watcher_users
fan_query = User.joins('left join watchers on watchers.user_id = users.id and watchers.watchable_type in ("Principal", "User")')
.where('watchers.watchable_id = ?', @user.id)
@user_fanlist_count = fan_query.count
@user_fanlist = fan_query.order("#{Watcher.table_name}.id desc")
respond_to do |format|

@ -268,6 +268,24 @@ module ApplicationHelper
return container.to_json
end
def shixun_container_limit shixun
container = []
shixun.shixun_service_configs.each do |config|
mirror = config.mirror_repository
if mirror.name.present?
container << {:image => mirror.name,
:cpuLimit => config.cpu_limit,
:cpuRequest => config.lower_cpu_limit,
:memoryLimit => "#{config.memory_limit}M",
:memoryRequest => "#{config.request_limit}M",
:resourceLimit => "#{config.resource_limit}K",
:type => mirror.try(:main_type) == "1" ? "main" : "sub"}
end
end
Rails.logger.info("#########container: #{container.to_json}")
return container.to_json
end
# 实训作品列表的提交状态
def list_work_status work, homework, course_group_id
if work.work_status == 0
@ -727,16 +745,17 @@ module ApplicationHelper
when 9
sub_type == 1 ? "实训留言列表" : ""
when 10
sub_type == 1 ? "实名认证" :
(sub_type == 2 ? "试用授权" :
(sub_type == 3 ? "部门审批" :
(sub_type == 4 ? "单位审批" :
(sub_type == 5 ? "实训发布" :
(sub_type == 6 ? "实训课程发布" : "职业认证")
)
)
)
)
case sub_type
when 1 then '实名认证'
when 2 then '试用授权'
when 3 then '部门审批'
when 4 then '单位审批'
when 5 then '实训发布'
when 6 then '实训课程发布'
when 7 then '职业认证'
when 8 then '教学案例发布'
else '职业认证'
end
when 11
"工程认证+"
when 12
@ -2996,9 +3015,9 @@ module ApplicationHelper
elsif params[:controller] == "courses" && params[:action] == "index"
title << ("翻转课堂")
elsif params[:controller] == "competitions" && params[:action] == "index"
title << ("竞赛")
title << ("在线竞赛")
elsif @competition
title << (@competition.name.nil? ? "竞赛" : @competition.name)
title << (@competition.name.nil? ? "在线竞赛" : @competition.name)
elsif @contest
title << (@contest.name.nil? ? "创新源于实践" : @contest.name)
elsif @shixun
@ -3008,13 +3027,13 @@ module ApplicationHelper
elsif params[:controller] == "shixuns" && params[:action] == "index"
title << ("开发社区")
elsif @subject
title << (@subject.name.nil? ? "课程" : @subject.name)
title << (@subject.name.nil? ? "课程" : @subject.name)
elsif params[:controller] == "subjects" && params[:action] == "index"
title << ("课程")
title << ("课程")
elsif @organization
title << (@organization.name.nil? ? "创新源于实践" : @organization.name)
elsif @forum || params[:controller] == "forums"
title << "讨论区"
title << "交流问答"
elsif @my_syllabuses
title << "我的课堂"
elsif params[:controller] == 'ecs'
@ -3061,7 +3080,7 @@ module ApplicationHelper
elsif @syllabus
title << (@syllabus.title.nil? ? "课堂" : @syllabus.title)
else
title << (User.current.id == 2 ? "未登录" : User.current.show_name)
title << (User.current.anonymous? ? "EduCoder实践教学" : User.current.show_name)
end
# if first_page.nil? || first_page.web_title.nil?
# title << Setting.app_title unless Setting.app_title == title.last
@ -4349,6 +4368,8 @@ module ApplicationHelper
elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses
course = attachment.container.courses.first
candown = User.current.member_of_course?(attachment.container.courses.first) || (course.is_public == 1 && attachment.is_public == 1)
elsif attachment.container_type == "Library" #教学案例允许下载
candown = true
else
candown = (attachment.is_public == 1 || attachment.is_public == true)
end
@ -6469,7 +6490,7 @@ def visable_attachemnts_incourse course
member = course.members.where(:user_id => User.current.id).first
if member.try(:course_group_id).to_i == 0 && attachment.unified_setting
result << attachment
elsif attachment.attachment_group_settings.where("course_group_id = #{member.try(:course_group_id)} and publish_time > '#{Time.now}'").count == 0
elsif attachment.attachment_group_settings.where("course_group_id = #{member.try(:course_group_id).to_i} and publish_time > '#{Time.now}'").count == 0
result << attachment
end
end
@ -6581,7 +6602,7 @@ def update_shixun_work_status homework
myshixuns.each do |myshixun|
work = student_works.where(:user_id => myshixun.user_id).first
member = homework.course.members.find_by_user_id(work.user_id)
setting_time = homework_group_setting homework, member.try(:course_group_id)
setting_time = homework_group_setting homework, member.try(:course_group_id).to_i
games = myshixun.games.where(:challenge_id => challeng_ids)
myshixun_endtime = games.select{|game| game.status == 2}.size == games.size ? games.map(&:end_time).max : nil
compelete_status = 0
@ -6592,12 +6613,14 @@ def update_shixun_work_status homework
compelete_status = 1
end
end
if setting_time.end_time > Time.now
work.update_attributes(:work_status => 1, :late_penalty => 0, :commit_time => myshixun.updated_at, :update_time => myshixun.updated_at, :myshixun_id => myshixun.id, :compelete_status => compelete_status)
else
work.update_attributes(:work_status => ((myshixun.is_complete? && (myshixun.done_time < setting_time.end_time)) ? 1 : 2), :late_penalty => (myshixun.is_complete? && (myshixun.done_time < setting_time.end_time) ? 0 : homework.late_penalty), :commit_time => myshixun.updated_at, :update_time => myshixun.updated_at, :myshixun_id => myshixun.id, :compelete_status => compelete_status)
if setting_time.publish_time && setting_time.publish_time < Time.now && setting_time.end_time
if setting_time.end_time > Time.now
work.update_attributes(:work_status => 1, :late_penalty => 0, :commit_time => myshixun.updated_at, :update_time => myshixun.updated_at, :myshixun_id => myshixun.id, :compelete_status => compelete_status)
else
work.update_attributes(:work_status => ((myshixun.is_complete? && (myshixun.done_time < setting_time.end_time)) ? 1 : 2), :late_penalty => (myshixun.is_complete? && (myshixun.done_time < setting_time.end_time) ? 0 : homework.late_penalty), :commit_time => myshixun.updated_at, :update_time => myshixun.updated_at, :myshixun_id => myshixun.id, :compelete_status => compelete_status)
end
set_shixun_final_score work, homework.homework_detail_manual.answer_open_evaluation, homework_challenge_settings
end
set_shixun_final_score work, homework.homework_detail_manual.answer_open_evaluation, homework_challenge_settings
end
# 更新所有学生的效率分
update_student_eff_score HomeworkCommon.where(:id => homework.id).first
@ -7231,11 +7254,9 @@ end
# 作业的分班设置时间
def homework_group_setting homework, group_id
setting = nil
if homework.homework_group_settings.where(:course_group_id => group_id).first
setting = homework
if homework.homework_group_settings.where(:course_group_id => group_id).first.present?
setting = homework.homework_group_settings.where(:course_group_id => group_id).first
else
setting = homework
end
setting
end
@ -7430,6 +7451,8 @@ def tiding_url tiding
project_pull_requests_path(tiding.parent_container_id)
when 'Department'
my_account_path
when 'Library'
tiding.tiding_type == 'Apply' ? library_applies_path : library_path(tiding.container_id)
end
end

@ -3,6 +3,17 @@ include UserScoreHelper
module StudentWorkHelper
# 作品的评语(拼接导出excel成绩)
def work_comment work
comment = ""
work_scores = work.student_works_scores.order("created_at desc")
work_scores.each do |score|
comment += "#{score.user.show_real_name} #{format_time(score.created_at)} #{score.score}\n"
comment += "#{score.comment}\n\n"
end
comment
end
#获取当前用户的项目列表
def user_projects_option
projects = User.current.projects.visible

@ -0,0 +1,7 @@
module Util
module_function
def generate_time_uuid
"#{Time.zone.now.strftime('%Y%m%d%H%M%S')}#{Random.rand(10**8).to_i}"
end
end

@ -20,7 +20,7 @@ class Challenge < ActiveRecord::Base
# validates_presence_of :score
validates_presence_of :task_pass
validates_length_of :subject, :maximum => 255
scope :min, lambda { select([:id, :subject, :position, :shixun_id, :st, :score, :path, :task_pass, :modify_time, :web_route, :answer]) }
scope :min, lambda { select([:id, :subject, :position, :shixun_id, :st, :score, :exec_time, :path, :task_pass, :modify_time, :web_route, :answer]) }
scope :choose_type, lambda{where(st: 1)}
scope :practice_type, lambda{where(st: 0)}

@ -2,7 +2,7 @@
class Competition < ActiveRecord::Base
# status 0下架 1上架
attr_accessible :end_time, :identifier, :name, :online_time, :start_time, :status, :visits, :competition_lists_count,
:min_num, :max_num, :enroll_end_time
:min_num, :max_num, :enroll_end_time, :sub_title
has_many :competition_modules, :dependent => :destroy
has_many :competition_stages, :dependent => :destroy
@ -13,6 +13,7 @@ class Competition < ActiveRecord::Base
has_many :chart_rules, :dependent => :destroy
has_many :competition_scores, :dependent => :destroy
has_many :competition_text_configs, :dependent => :destroy
has_many :competition_staffs, dependent: :destroy
acts_as_attachable
after_create :create_competition_modules
@ -29,6 +30,6 @@ class Competition < ActiveRecord::Base
end
def member_count
self.team_members.count + 268
self.team_members.count == 0 ? 0 : self.team_members.count + 268
end
end

@ -0,0 +1,22 @@
class CompetitionStaff < ActiveRecord::Base
default_scope order: 'position asc'
attr_accessible :minimum, :maximum, :category, :position
belongs_to :competition
validates :position, numericality: { only_integer: true }
validates :minimum, numericality: { only_integer: true, greater_than_or_equal_to: 0 }
validates :maximum, numericality: { only_integer: true, greater_than_or_equal_to: lambda { |obj| obj.minimum } }
validates :category, presence: true, inclusion: { in: %w(all teacher student profession) }
def category_text
I18n.t("competition_staff.category.#{category}", locale: 'zh')
end
def self.category_options
%w(all teacher student profession).map do |category|
[I18n.t("competition_staff.category.#{category}", locale: 'zh'), category]
end
end
end

@ -2,7 +2,10 @@
class CompetitionTeam < ActiveRecord::Base
belongs_to :user
belongs_to :competition
has_many :team_members, :dependent => :destroy
has_many :members, conditions: 'is_teacher = 0', class_name: 'TeamMember'
has_many :teachers, conditions: 'is_teacher = 1', class_name: 'TeamMember'
has_many :competition_scores, :dependent => :destroy
# team_type 0组队 1个人
# attr_accessible :invite_code, :name, :team_type

@ -7,6 +7,7 @@ class Exercise < ActiveRecord::Base
has_many :exercise_group_settings, :dependent => :destroy
has_many :exercise_questions, :dependent => :destroy,:order => "#{ExerciseQuestion.table_name}.question_number"
has_many :exercise_users, :dependent => :destroy, :conditions => "exercise_users.is_delete = 0"
has_many :score_exercise_users, :class_name => "ExerciseUser", :conditions => "exercise_users.is_delete = 0 and commit_status != 0", :order => "exercise_users.score desc"
has_many :users, :through => :exercise_users #该测试被哪些用户提交答案过
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
# 课程消息

@ -28,6 +28,7 @@ class HomeworkCommon < ActiveRecord::Base
# has_many :homework_tests, :dependent => :destroy
# has_many :homework_samples, :dependent => :destroy
has_many :student_works, :conditions => "student_works.is_test=0 and student_works.is_delete != 1"
has_many :score_student_works, :class_name => "StudentWork", :conditions => "student_works.is_test=0 and student_works.is_delete != 1 and work_status != 0", :order => "work_score desc"
has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :apply_homeworks

@ -91,10 +91,10 @@ class Issue < ActiveRecord::Base
attr_reader :current_journal
# fq
after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity, :add_issues_count, :send_tiding
after_create :act_as_forge_activity, :add_issues_count, :send_tiding
after_update :be_user_score, :update_activity
after_update :be_user_score,:update_activity
after_destroy :down_user_score, :decrease_issues_count
# after_create :be_user_score
# end

@ -0,0 +1,48 @@
class Library < ActiveRecord::Base
include AASM
belongs_to :user
has_many :library_applies, dependent: :delete_all
has_many :attachments, as: :container
attr_accessible :title, :content
validates :title, presence: true
validates :content, presence: true
validates :uuid, presence: true, uniqueness: true
acts_as_attachable
aasm(:status) do
state :pending, initiali: true
state :processing
state :refused
state :published
event :submit do
transitions from: [:pending, :refused], to: :processing
end
event :refuse do
transitions from: :processing, to: :refused
end
event :publish do
transitions from: :processing, to: :published
end
end
def generate_uuid
uuid = Util.generate_time_uuid
while Library.exists?(uuid: uuid)
uuid = Util.generate_time_uuid
end
self.uuid = uuid
end
def increment_visited_count!
Library.connection.execute("update libraries set visited_count = COALESCE(visited_count, 0) + 1 where id = #{id}")
end
end

@ -0,0 +1,19 @@
class LibraryApply < ActiveRecord::Base
include AASM
belongs_to :library
aasm(:status) do
state :pending, initiali: true
state :refused
state :agreed
event :refuse do
transitions from: :pending, to: :refused
end
event :agree do
transitions from: :pending, to: :agreed
end
end
end

@ -53,7 +53,7 @@ class Message < ActiveRecord::Base
has_many :tidings, :as => :container , :dependent => :destroy
belongs_to :reply, :class_name => 'Message', :foreign_key => 'reply_id'
has_one :message_detail, :dependent => :destroy
#has_one :message_detail, :dependent => :destroy
#转发表
has_many :forwards, :as => :from, :dependent => :destroy

@ -52,10 +52,10 @@ class Shixun < ActiveRecord::Base
has_many :exercise_bank_shixun_challenges, :dependent => :destroy
has_many :tag_repertoires, :through => :shixun_tag_repertoires
has_many :shixun_tag_repertoires, :dependent => :destroy
has_many :shixun_service_configs, :dependent => :destroy
scope :visible, lambda{where(status: [2,3])}
scope :min, lambda { select([:id, :name, :gpid, :modify_time, :reset_time, :language, :propaedeutics, :status, :identifier,
scope :min, lambda { select([:id, :name, :gpid, :modify_time, :reset_time, :language, :status, :identifier,
:test_set_permission, :hide_code, :forbid_copy, :hidden, :webssh, :user_id, :code_hidden,
:task_pass, :exec_time, :multi_webssh, :vnc]) }
scope :published, lambda{where(status: 2)}
@ -66,6 +66,18 @@ class Shixun < ActiveRecord::Base
#scope :visible, -> { where(status: -1) }
after_create :send_tiding
def description
self.has_attribute?(:description) ? self[:description] : ""
end
def propaedeutics
self.has_attribute?(:propaedeutics) ? self[:propaedeutics] : ""
end
def evaluate_script
self.has_attribute?(:evaluate_script) ? self[:evaluate_script] : ""
end
def should_compile?
self.mirror_repositories.published_main_mirror.first.try(:should_compile)
end
@ -261,6 +273,10 @@ class Shixun < ActiveRecord::Base
return name
end
def child_mirror_ids
self.mirror_repositories.where(:main_type => 0).pluck(:id)
end
def mirror_name
self.mirror_repositories.map(&:type_name).blank? ? "" : self.mirror_repositories.map(&:type_name)
end

@ -0,0 +1,7 @@
class ShixunServiceConfig < ActiveRecord::Base
# attr_accessible :title, :body
# image_type: 镜像类型: 1 主镜像、2子镜像
belongs_to :shixun
belongs_to :mirror_repository
end

@ -3,5 +3,5 @@ class TeamMember < ActiveRecord::Base
belongs_to :competition
belongs_to :user
# role 1创建者 2成员 3指导老师
# attr_accessible :role
attr_accessible :role, :user_id, :competition_id, :is_teacher
end

@ -252,7 +252,7 @@ class Tiding < ActiveRecord::Base
if self.tiding_type == "Mentioned"
"@了你:" + message_content(container.notes)
elsif self.tiding_type == "Comment"
"评论了你" + (container.parent.present? ? "的回复:" : "发布的项目issue") + message_content(container.notes)
container.present? ? ("评论了你" + (container.parent.present? ? "的回复:" : "发布的项目issue") + message_content(container.notes)) : ""
else
"更新了Issue#{container.issue.subject}"
end
@ -358,6 +358,14 @@ class Tiding < ActiveRecord::Base
" "
when 'Department'
"你选填的二级单位:#{self.container.try(:name)}(#{self.container.try(:school).name})因不符合规范,已被系统删除.请重新选择"
when 'Library'
library = Library.find_by_id(container_id)
if tiding_type == 'Apply'
"申请发布教学案例:#{library.try(:title)}"
elsif tiding_type == 'System'
text = status == 1 ? "审核已通过" : "审核未通过,<br/>原因:#{extra}"
"你提交的发布教学案例申请:#{library.try(:title)}#{text}"
end
else
logger.error "error type: 1"
end

@ -1,7 +1,7 @@
#encoding: utf-8
class Training < ActiveRecord::Base
attr_accessible :address, :email, :name, :phone, :position, :school, :sex, :openid, :training_type,
:major, :student_id
:major, :student_id, :job_title, :uncertified_major
# training_type 1 2018-培训会 2 警察学院大数据培训会 3 大数据和人工智能 4 工程教育认证
@ -28,7 +28,7 @@ class Training < ActiveRecord::Base
def pay_order_title
case training_type
when 3 then '全国高校大数据和人工智能暑期师资培训会-报名费'
when 4 then '工程教育认证培训会-报名费'
when 4 then '工程教育专业认证师资培训会-报名费'
end
end
@ -38,7 +38,7 @@ class Training < ActiveRecord::Base
# 三人以上 8折
num >= 3 ? 3000.0 * 0.8 * num : 3000.0 * num
when 4 then
1200.0 * num
500.0 * num
else
raise ArgumentError
end

@ -250,6 +250,7 @@ class User < Principal
has_many :ec_course_users
has_many :libraries, dependent: :destroy
#####
scope :logged, lambda { where("#{User.table_name}.status <> #{STATUS_ANONYMOUS}") }

@ -42,7 +42,7 @@ class GamesService
is_teacher = (user.user_extensions.identity == 0)
tpm_identifier = shixun.try(:identifier)
# 实训超时设置
time_limit = shixun.exec_time
time_limit = game_challenge.exec_time
# 高性能取上一关、下一关
prev_game = Game.prev_identifier(shixun.id, game.myshixun_id, game_challenge.position)
@ -82,7 +82,7 @@ class GamesService
shixun_tomcat = Redmine::Configuration['shixun_tomcat']
service_host = Redmine::Configuration['vnc_url']
uri = "#{shixun_tomcat}/bridge/vnc/getvnc"
params = {tpiID: myshixun.id, :containers => "#{Base64.urlsafe_encode64(container_limit(shixun.mirror_repositories))}"}
params = {tpiID: myshixun.id, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"}
res = uri_exec uri, params
if res && res['code'].to_i != 0
raise("实训云平台繁忙繁忙等级99")
@ -568,12 +568,11 @@ class GamesService
testCases = Base64.urlsafe_encode64(testSet.to_json) unless testSet.blank?
# 注意:这个地方的参数写的时候不能换行
content_modified = params[:content_modified] # 决定文件内容是否有修改有修改如果中间成pull没有更新则轮询等待更新
params = {:tpiID => "#{myshixun.id}", :tpiGitURL => "#{gitUrl}", :buildID => "#{taskId}",:instanceChallenge => "#{step}",
:testCases => "#{testCases}", :resubmit => "#{resubmit}", :times => params[:first].to_i, :podType => shixun.webssh,
:containers => "#{Base64.urlsafe_encode64(container_limit(shixun.mirror_repositories))}", :tpmScript => "#{tpmScript}",
:containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}", :tpmScript => "#{tpmScript}",
:timeLimit => "#{shixun.exec_time}", :content_modified => content_modified, :persistenceName => shixun.identifier,
:isPublished => (shixun.status < 2 ? 0 : 1), :sec_key => params[:sec_key]}
@ -584,11 +583,11 @@ class GamesService
params[:needPortMapping] = 8080 if myshixun.mirror_name.include?("Web")
# 中间层交互
if shixun.sigle_training
uri = "#{shixun_tomcat}/bridge/game/persistence/gameEvaluate"
else
#if shixun.sigle_training
# uri = "#{shixun_tomcat}/bridge/game/persistence/gameEvaluate"
#else
uri = "#{shixun_tomcat}/bridge/game/gameEvaluate"
end
#end
res = interface_post uri, params, 502
# 单评测类型(比较快的类型实时返回结果即不用中间层再回调trainint_task_status)

@ -0,0 +1,32 @@
class Libraries::AgreeApplyService
Error = Class.new(StandardError)
attr_reader :library_apply, :library, :user
def initialize(library_apply, user)
@library_apply = library_apply
@library = library_apply.library
@user = user
end
def call
raise Error, '该状态下不能进行此操作' unless library_apply.may_agree?
ActiveRecord::Base.transaction do
library_apply.agree!
library_apply.library.publish!
# 将消息改为已处理
Tiding.where(container_id: library.id, container_type: 'Library', tiding_type: 'Apply', status: 0).update_all(status: 1)
notify_library_author!
end
end
private
def notify_library_author!
Tiding.create!(user_id: library.user_id, trigger_user_id: 1,
container_id: library.id, container_type: 'Library',
tiding_type: 'System', status: 1)
end
end

@ -0,0 +1,39 @@
class Libraries::RefuseApplyService
Error = Class.new(StandardError)
attr_reader :library_apply, :library, :user, :params
def initialize(library_apply, user, params)
@library_apply = library_apply
@library = library_apply.library
@user = user
@params = params
end
def call
reason = params[:reason].to_s.strip
raise Error, '原因不能为空' if reason.blank?
raise Error, '该状态下不能进行此操作' unless library_apply.may_refuse?
ActiveRecord::Base.transaction do
library_apply.reason = reason
library_apply.refused_at = Time.current
library_apply.refuse
library_apply.save!
library.refuse!
# 将消息改为已处理
Tiding.where(container_id: library.id, container_type: 'Library', tiding_type: 'Apply', status: 0).update_all(status: 1)
notify_library_author!
end
end
private
def notify_library_author!
Tiding.create!(user_id: library.user_id, trigger_user_id: 1,
container_id: library.id, container_type: 'Library',
tiding_type: 'System', status: 2, extra: library_apply.reason)
end
end

@ -0,0 +1,37 @@
class Libraries::SaveService
Error = Class.new(StandardError)
attr_reader :library, :user, :params
def initialize(library, user, params)
@library = library
@user = user
@params = params
end
def call
validate_params!
if library.new_record?
library.user_id = user.id
library.generate_uuid
end
attachment_ids = params.delete(:attachment_ids).try(:compact)
ActiveRecord::Base.transaction do
library.assign_attributes(params)
library.save!
Attachment.where(id: attachment_ids).update_all(container_id: library.id, container_type: 'Library')
end
library
end
private
def validate_params!
raise Error, '附件不能为空' if params[:attachment_ids].try(:compact).blank?
end
end

@ -0,0 +1,33 @@
class Libraries::SubmitService
Error = Class.new(StandardError)
attr_reader :library
def initialize(library)
@library = library
end
def call
return if library.processing? || library.published?
raise Error, '该状态下不能提交审核' unless library.may_submit?
ActiveRecord::Base.transaction do
library.published_at = Time.current
library.submit
library.save!
library.library_applies.create!
send_library_apply_notify!
end
end
private
def send_library_apply_notify!
Tiding.create!(user_id: 1, trigger_user_id: library.user_id,
container_id: library.id, container_type: 'Library',
tiding_type: 'Apply', status: 0)
Trustie::Sms.send(mobile: '18711011226', send_type:'publish_library' , name: '管理员') rescue nil
end
end

@ -343,7 +343,7 @@ class UsersService
g = Gitlab.client
g.edit_user(@current_user.gid, :password => params[:new_password])
rescue Exception => e
logger.error "change users password failed! ===> #{e}"
Rails.logger.error "change users password failed! ===> #{e.message}"
end
end
#raise @current_user.errors.full_message

@ -1,8 +1,28 @@
<%= stylesheet_link_tag 'css/public','css/common'%>
<div class="edu-back-white ml20 clearfix">
<p class="font-16 edu-line padding30-20">合作伙伴</p>
<div class="clearfix">
<p class="font-16 ml20 mb15 mt15"> 产学联盟 </p>
<ul class='edu-cooperation clearfix cooperation-team' id="sortable2">
<% @alliance_img.each do |alliance_img| %>
<li class="bor-grey-e pr" data-id="<%= alliance_img.id %>" data-position="<%= alliance_img.position %>">
<% if User.current.admin? %>
<a href="javascript:void(0)" onclick="delete_confirm_box('<%= delete_coop_path(:id => alliance_img.id) %>', '确定要删除该图片吗?')"><i data-tip-down="删除" class="fa fa-times-circle mr10 color-orange05 font-16" style="position:absolute;right:0px;top:8px"></i></a>
<% end %>
<a href="<%= alliance_img.src_states == '' ? 'javascript:void(0)' : alliance_img.src_states %>" target="_blank">
<img src="<%= alliance_img.url_states %>" alt=""/>
</a>
</li>
<% end %>
<% if User.current.admin? %>
<li style="border: 1px dashed #FF7500" class="font-16"><a href="<%= update_help_path(:tab => 3,:resubmit => @resubmit)%>" data-remote="true">+ &nbsp;新建</a></li>
<% end %>
</ul>
</div>
<div class="clearfix">
<p class="font-16 ml20 mb15 mt15"> 企业合作 </p>
<p class="font-16 ml20 mb15 mt15"> 知名企业 </p>
<ul class='edu-cooperation clearfix cooperation-item' id="sortable">
<% @com_coop_img.each do |coop_img| %>
<li class="bor-grey-e pr" data-id="<%= coop_img.id %>" data-position="<%= coop_img.position %>">
@ -21,7 +41,7 @@
</div>
<div class="clearfix">
<p class="font-16 ml20 mb15">高校合作 </p>
<p class="font-16 ml20 mb15">各类院校 </p>
<ul class='edu-cooperation cooperation-school clearfix' id="sortable1">
<% @edu_coop_img.each do |coop_img| %>
<li class="bor-grey-e pr" data-id="<%= coop_img.id %>" data-position="<%= coop_img.position %>">
@ -51,6 +71,8 @@
var id = 0;
var pos_1 = 0;
var id_1 = 0;
var pos_2 = 0;
var id_2 = 0;
$( "#sortable" ).sortable({
containment:".cooperation-item",
sort:function(e, ui){
@ -121,7 +143,40 @@
});
$( "#sortable1" ).disableSelection();
$( "#sortable2" ).sortable({
containment:".cooperation-team",
sort:function(e, ui){
select_item = ui.item; //当前拖动的元素
pos_2 = $(select_item[0]).prev().attr("data-position");
id_2 = $(select_item[0]).attr("data-id");
if(pos == undefined || id == undefined){
pos_2 = 0;
}
},
stop:function(e, ui){
select_item = ui.item; //当前拖动的元素
console.log(ui.item);
pos_2 = $(select_item[0]).prev().attr("data-position");
id_2 = $(select_item[0]).attr("data-id");
if(pos_2 == undefined || id_2 == undefined){
pos_2 = 0;
}
console.log("pos: " + pos_2);
$.ajax({
url: "<%= change_coop_position_path %>",
data: {id: id_2, position: pos_2, type: "alliance_coop"},
success: function(data) {
if(data.status == 1){
console.log("更新成功!");
$(select_item[0]).attr("data-position", pos_2+1)
}
}
});
}
});
$( "#sortable2" ).disableSelection();
})

@ -1,7 +1,10 @@
<% if params[:tab] == '1' %>
var htmlvalue = "<%= escape_javascript(render :partial => 'account/new_coop',:locals => {:resubmit =>params[:resubmit],:sourse_type => @com_coop}) %>";
pop_box_new(htmlvalue, 400, 260);
<% else %>
<% elsif params[:tab] == '2' %>
var htmlvalue = "<%= escape_javascript(render :partial => 'account/new_coop',:locals => {:resubmit => params[:resubmit],:sourse_type => @edu_coop}) %>";
pop_box_new(htmlvalue, 400, 260);
<% else %>
var htmlvalue = "<%= escape_javascript(render :partial => 'account/new_coop',:locals => {:resubmit => params[:resubmit],:sourse_type => @alliance_coop}) %>";
pop_box_new(htmlvalue, 400, 260);
<% end %>

@ -0,0 +1,63 @@
<div class="librariesField">
<li>
<a href="javascript:void(0)" class="color-blue font-18" onclick="$('#_file').click();" data-tip-down="请选择文件上传">上传附件</a>
<!--<p class="color-grey-c">(单个文件<%#= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>以内)</p>-->
<p class="color-grey-c mt7">从我的电脑选择要上传的文档按住CTRL可以上传多份文档</p>
<div id="network_issue" class="fl ml10 color-red none">上传出现错误,请检查您的网络环境,并刷新页面重新上传。</div>
</li>
</div>
<div id="attachments_fields" class="attachments_fields">
<% if defined?(container) && container && container.saved_attachments %>
<% container.attachments.each_with_index do |attachment, i| %>
<span class="attachment clearfix" id="attachments_p<%= i %>">
<i class="iconfont icon-fujian mr5 color-green fl font-14" aria-hidden="true"></i>
<% size = judge_Chinese_num attachment.filename %>
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'upload_filename readonly hidden color-grey fl', :size => size, :style => 'border:none; max-width:980px;white-space: nowrap; text-overflow:ellipsis;font-family: Consolas;', :readonly => 'readonly') %>
<span class="color-grey mr10 fl"><%= number_to_human_size attachment.filesize %></span>
<%= link_to('<i class="fa fa-trash-o mr5"></i>'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
<%= hidden_field_tag "attachments[p#{i}][attachment_id]", attachment.id %>
</span>
<% end %>
<% container.saved_attachments.each_with_index do |attachment, i| %>
<span class="attachment clearfix" id="attachments_p<%= i %>">
<label class="panel-form-label fl">&nbsp;</label>
<i class="iconfont icon-fujian mr5 color-green fl font-14" aria-hidden="true"></i>
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'hidden atta_input readonly color-grey fl', :style => 'border:none; max-width:980px;', :readonly => 'readonly') %>
<%= link_to('<i class="fa fa-trash-o mr5"></i>'.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload fl mt2') unless attachment.id.nil? %>
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
</span>
<% end %>
<% end %>
</div>
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',
:class => ie8? ? '' : 'file_selector',
:multiple => true,
:onchange => 'addInputFiles(this);',
:style => ie8? ? '' : 'display:none',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
:upload_path => uploads_path(:format => 'js',:project =>nil),
:description_placeholder => l(:label_optional_description),
:field_is_public => l(:field_is_public),
:are_you_sure => l(:text_are_you_sure),
:file_count => l(:label_file_count),
:lebel_file_uploding => l(:lebel_file_uploding),
:delete_all_files => l(:text_are_you_sure_all)
} %>
<%= javascript_include_tag 'attachments' %>
<style>
.ui-widget-content{
/*height: 16px;*/
/*width: 200px;*/
top: 320px !important;
float: left;
margin: 5px 10px 0px 10px;
}
</style>

@ -82,6 +82,52 @@
<span class="color-orange mt7 fl ml20 none" id="stage_name_notice"><i class="fa fa-exclamation-circle mr3"></i>必填项</span>
</div>
</div>
<div class="edu-back-white padding40-20 mb20">
<p class="color-grey-6 font-16 mb30">服务配置</p>
<div class="clearfix mb5">
<label class="panel-form-label fl">评测时限(S)</label>
<div class="pr fl with80 status_con">
<input type="text" name="challenge[exec_time]" value="<%= @challenge.exec_time %>" class="panel-box-sizing task-form-100 task-height-40"
placeholder="请输入类别名称"/>
</div>
<div class="cl"></div>
</div>
<%# if User.current.admin? %>
<!-- <div class="clearfix mb5">-->
<!-- <label class="panel-form-label fl">CPU(核)</label>-->
<!-- <div class="pr fl with80 status_con">-->
<!-- <input type="text" name="challenge[cpu_limit]" value="<%#= @challenge.cpu_limit %>" class="panel-box-sizing task-form-100 task-height-40"-->
<!-- placeholder="请输入类别名称"/>-->
<!-- </div>-->
<!-- <div class="cl"></div>-->
<!-- </div>-->
<!-- <div class="clearfix mb5">-->
<!-- <label class="panel-form-label fl">最低CPU(核)</label>-->
<!-- <div class="pr fl with80 status_con">-->
<!-- <input type="text" name="challenge[lower_cpu_limit]" value="<%#= @challenge.lower_cpu_limit %>" class="panel-box-sizing task-form-100 task-height-40"-->
<!-- placeholder="请输入类别名称"/>-->
<!-- </div>-->
<!-- <div class="cl"></div>-->
<!-- </div>-->
<!-- <div class="clearfix mb5">-->
<!-- <label class="panel-form-label fl">内存限制(M)</label>-->
<!-- <div class="pr fl with80 status_con">-->
<!-- <input type="text" name="challenge[memory_limit]" value="<%#= @challenge.memory_limit %>" class="panel-box-sizing task-form-100 task-height-40"-->
<!-- placeholder="请输入类别名称"/>-->
<!-- </div>-->
<!-- <div class="cl"></div>-->
<!-- </div>-->
<!-- <div class="clearfix mb5">-->
<!-- <label class="panel-form-label fl">内存要求(M)</label>-->
<!-- <div class="pr fl with80 status_con">-->
<!-- <input type="text" name="challenge[request_limit]" value="<%#= @challenge.request_limit %>" class="panel-box-sizing task-form-100 task-height-40"-->
<!-- placeholder="请输入类别名称"/>-->
<!-- </div>-->
<!-- <div class="cl"></div>-->
<!-- </div>-->
<%# end %>
</div>
<% end %>
<div class="clearfix mt30">
<a href="javascript:void(0)" class="defalutSubmitbtn fl mr20" onclick="challenge_update()">提交</a>

@ -55,6 +55,20 @@
<% end %>
</div>
</div>
<div class="edu-back-white padding40-20 mb20">
<p class="color-grey-6 font-16 ">评测时限(S)</p>
<input type="text" value="<%= @challenge.exec_time %>" class="winput-240-40" disabled/>
<%# if User.current.admin? %>
<!-- <p class="color-grey-6 font-16 mt10">CPU(核)</p>-->
<!-- <input type="text" value="<%#= @challenge.cpu_limit %>" class="winput-240-40" disabled/>-->
<!-- <p class="color-grey-6 font-16 mt10">最低CPU(核)</p>-->
<!-- <input type="text" value="<%#= @challenge.lower_cpu_limit %>" class="winput-240-40" disabled/>-->
<!-- <p class="color-grey-6 font-16 mt10">内存限制(M)</p>-->
<!-- <input type="text" value="<%#= @challenge.memory_limit %>" class="winput-240-40" disabled/>-->
<!-- <p class="color-grey-6 font-16 mt10">内存要求(M)</p>-->
<!-- <input type="text" value="<%#= @challenge.request_limit %>" class="winput-240-40" disabled/>-->
<%# end %>
</div>
<% end %>
<script>
$(document).ready(function() {

@ -1,7 +1,12 @@
<% none_edit = @team.try(:id).present? && @competition.enroll_end_time.present? && @competition.enroll_end_time < Time.now %>
<%= labelled_form_for @team, :html => {:id => 'competition_team_form', :multipart => true, :remote => true} do |f| %>
<input type="hidden" id="max_num" value="<%= @competition.max_num %>">
<input type="hidden" id="min_num" value="<%= @competition.min_num %>">
<% teacher_staff = @competition.competition_staffs.where(category: 'teacher').first %>
<% min_member_staff = @competition.competition_staffs.where('category != "teacher"').sum(:minimum) %>
<% max_member_staff = @competition.competition_staffs.where('category != "teacher"').sum(:maximum) %>
<input type="hidden" id="teacher_maximum" value="<%= teacher_staff.try(:maximum) || 0 %>">
<input type="hidden" id="teacher_minimum" value="<%= teacher_staff.try(:minimum) || 0 %>">
<input type="hidden" id="member_maximum" value="<%= max_member_staff || 0 %>">
<input type="hidden" id="member_minimum" value="<%= min_member_staff || 0 %>">
<input type="hidden" id="team_id" value="<%= @team.try(:id) %>">
<input type="hidden" name="com_id" value="<%= @competition.id %>">
@ -11,14 +16,15 @@
<div class="df pl20 pr20 mt10">
<label class="mt3"><span class="mr3 color-orange">*</span>队名:</label>
<input type="text" name="name" autocomplete="off" <%= none_edit ? "disabled" : "" %> maxlength="20" value="<%= @team.try(:name) %>" class="input-flex-35" style="margin-right: 102px;" placeholder="请输入您的组队名称"/>
<input type="text" name="name" autocomplete="off" <%= none_edit ? "disabled" : "" %> maxlength="20" value="<%= @team.try(:name) %>" class="input-flex-35" placeholder="请输入您的组队名称"/>
</div>
<p style="line-height: 27px;height: 27px"><span id="team_name_notice" class="color-orange-tip ml73 none"></span></p>
<div class="df pl20 pr20">
<% if teacher_staff.present? %>
<div class="df pl20 pr20">
<label class="ml10 mt3">导师:</label>
<div class="flex1 pr search-new">
<input type="text" class="input-100-35 fl" <%= @team_user.user_extensions.identity == 0 ? "disabled" : "" %> autocomplete="off" placeholder="请您输入老师姓名进行搜索" id="teacher_search_input"
<input type="text" class="input-100-35 fl" <%= @team_user.user_extensions.identity == 0 ? "disabled" : "" %> autocomplete="off" placeholder="请您输入老师姓名进行搜索;可以后续再添加导师" id="teacher_search_input"
value="<%= @team.try(:id).present? ? @team.teacher.try(:show_name) : (@team_user.user_extensions.identity == 0 ? @team_user.show_name : "") %>">
<input type="hidden" id="teacher_id" data-select="0" value="<%= @team.try(:id).present? ? @team.try(:teacher_id) : (@team_user.user_extensions.identity == 0 ? @team_user.id : "") %>">
<input type="hidden" id="teacher_name" value="<%= @team.try(:id).present? ? @team.teacher.try(:show_name) : (@team_user.user_extensions.identity == 0 ? @team_user.show_name : "") %>">
@ -28,76 +34,85 @@
<ul class="pointerTeacher none" id="pointerTeacher">
</ul>
</div>
<a class="fl ml20 white-btn edu-blueback-btn mt4" onclick="add_teacher()">添加导师</a>
<a class="fl ml20 white-btn edu-blueback-btn mt4 add-teacher-btn" style="display: none;" onclick="add_teacher()">添加导师</a>
</div>
<p style="line-height: 27px;height: 27px"><span id="teacher_notice" class="color-orange-tip ml73 none"></span></p>
<div class="df pl20 pr20">
<label class="mt3"><span class="mr3 color-orange">*</span>队员:</label>
<div class="flex1 search-new">
<input type="text" class="search-new-input fl" <%= none_edit ? "disabled" : "" %> autocomplete="off" style="width: 100%" placeholder="请您输入想要添加的成员搜索" id="user_search_input">
<span class="search-span" style="background: #fff;"></span>
<input type="hidden" id="member_id" data-select="0">
<input type="hidden" id="member_name">
<input type="hidden" id="member_school">
<input type="hidden" id="member_student_id">
<a class="fl searchicon" style="top:0px;" onclick="search_non_member_user()"><i class="iconfont icon-sousuo fl"></i></a>
<ul class="pointerTeacher none" id="pointerStudent">
</ul>
<% end %>
<% if min_member_staff > 0 %>
<div class="df pl20 pr20">
<label class="mt3"><span class="mr3 color-orange">*</span>队员:</label>
<div class="flex1 search-new">
<input type="text" class="search-new-input fl" <%= none_edit ? "disabled" : "" %> autocomplete="off" style="width: 100%" placeholder="请您输入想要添加的成员搜索" id="user_search_input">
<span class="search-span" style="background: #fff;"></span>
<input type="hidden" id="member_id" data-select="0">
<input type="hidden" id="member_name">
<input type="hidden" id="member_school">
<input type="hidden" id="member_student_id">
<a class="fl searchicon" style="top:0px;" onclick="search_non_member_user()"><i class="iconfont icon-sousuo fl"></i></a>
<ul class="pointerTeacher none" id="pointerStudent">
</ul>
</div>
<a class="fl ml20 white-btn edu-blueback-btn mt4 add-member-btn" style="display: none;" onclick="<%= none_edit ? '' : 'add_member()' %>">添加成员</a>
</div>
<a class="fl ml20 white-btn edu-blueback-btn mt4" onclick="<%= none_edit ? '' : 'add_member()' %>">添加成员</a>
</div>
<p style="line-height: 27px;height: 27px"><span id="member_notice" class="color-orange-tip ml73 none"></span></p>
<% end %>
<div class="bor-grey-e ml20 mr20 mt5" id="member_block">
<p class="pt10 pb10 clearfix bor-bottom-greyE personListLine">
<span class="t-c-1">姓名</span>
<span class="t-c-2">角色</span>
<span class="t-c-3">单位</span>
<span class="t-c-4">其他</span>
<span class="t-c-5">操作</span>
<div class="bor-grey-e ml20 mr20 mt5" id="member_block">
<p class="pt10 pb10 clearfix bor-bottom-greyE personListLine">
<span class="t-c-1">姓名</span>
<span class="t-c-2">角色</span>
<span class="t-c-3">单位</span>
<span class="t-c-4">其他</span>
<span class="t-c-5">操作</span>
</p>
<% if @team.try(:id).present? %>
<% creator_teacher = @team.user.user_extensions.identity == 0 %>
<p class="personListLine clearfix pt5 pb5 personListMember <%= creator_teacher ? 'team-teacher' : 'team-member' %>" id="create_li">
<span class="t-c-1"><%= @team.user.show_name %></span>
<span class="t-c-2"><%= @team.user.user_extensions.identity == 0 ? "导师/创建者" : "创建者" %></span>
<span class="t-c-3"><%= @team.user.school_name %></span>
<span class="t-c-4"><%= @team.user.user_extensions.identity == 0 ? "职称:#{@team.user.identity}" : "学号:#{@team.user.user_extensions.student_id.present? ? @team.user.user_extensions.student_id : "--"}" %></span>
<span class="t-c-5"></span>
</p>
<% if @team.try(:id).present? %>
<p class="personListLine clearfix pt5 pb5 personListMember" id="create_li">
<span class="t-c-1"><%= @team.user.show_name %></span>
<span class="t-c-2"><%= @team.user.user_extensions.identity == 0 ? "导师/创建者" : "创建者" %></span>
<span class="t-c-3"><%= @team.user.school_name %></span>
<span class="t-c-4"><%= @team.user.user_extensions.identity == 0 ? "职称:#{@team.user.identity}" : "学号:#{@team.user.user_extensions.student_id.present? ? @team.user.user_extensions.student_id : "--"}" %></span>
<span class="t-c-5"></span>
<% @team.teachers.includes(user: :user_extensions).each do |teacher| %>
<% next if teacher.user_id == @team.user_id %>
<p class="personListLine clearfix pt5 pb5 personListMember team-teacher team-teacher-<%= teacher.user.id %>">
<input type="hidden" name="teacher_ids[]" value="<%= teacher.user.id %>">
<span class="t-c-1"><%= teacher.user.show_name %></span>
<span class="t-c-2">导师</span>
<span class="t-c-3"><%= teacher.user.school_name %></span>
<span class="t-c-4">职称:<%= teacher.user.identity %></span>
<span class="t-c-5"><span class="delete_member" data-tip-down="删除"><i class="iconfont icon-guanbi font-14 color-grey-c"></i></span></span>
</p>
<% if @team.teacher.present? && @team.teacher != @team.user %>
<p class="personListLine clearfix pt5 pb5 personListMember">
<input type="hidden" name="teacher" value="<%= @team.teacher_id %>">
<span class="t-c-1"><%= @team.teacher.show_name %></span>
<span class="t-c-2">导师</span>
<span class="t-c-3"><%= @team.teacher.school_name %></span>
<span class="t-c-4">职称:<%= @team.teacher.identity %></span>
<span class="t-c-5"><span class="delete_member" data-tip-down="删除"><i class="iconfont icon-guanbi font-14 color-grey-c"></i></span></span>
</p>
<% end %>
<% @team.team_members.where(:role => 2, :is_teacher => 0).each do |team_user| %>
<p class="personListLine clearfix pt3 pb3 personListMember">
<input type="hidden" name="member_ids[]" value="<%= team_user.user_id %>">
<span class="t-c-1"><%= team_user.user.show_name %></span>
<span class="t-c-2">成员</span>
<span class="t-c-3"><%= team_user.user.school_name %></span>
<span class="t-c-4">学号:<%= team_user.user.user_extensions.student_id.present? ? team_user.user.user_extensions.student_id : "--" %></span>
<span class="t-c-5">
<% unless none_edit %>
<span class="delete_member" data-tip-down="删除"><i class="iconfont icon-guanbi font-14 color-grey-c"></i></span>
<% end %>
</span>
</p>
<% end %>
<% else %>
<p class="personListLine clearfix pt5 pb5 personListMember" id="create_li">
<span class="t-c-1"><%= @team_user.show_name %></span>
<span class="t-c-2"><%= @team_user.user_extensions.identity == 0 ? "导师/创建者" : "创建者" %></span>
<span class="t-c-3"><%= @team_user.school_name %></span>
<span class="t-c-4"><%= @team_user.user_extensions.identity == 0 ? "职称:#{@team_user.identity}" : "学号:#{@team_user.user_extensions.student_id.present? ? @team_user.user_extensions.student_id : "--"}" %></span>
<span class="t-c-5"></span>
<% end %>
<% @team.members.includes(user: :user_extensions).each do |team_user| %>
<% next if team_user.user_id == @team.user_id %>
<p class="personListLine clearfix pt3 pb3 personListMember team-member">
<input type="hidden" name="member_ids[]" value="<%= team_user.user_id %>">
<span class="t-c-1"><%= team_user.user.show_name %></span>
<span class="t-c-2">成员</span>
<span class="t-c-3"><%= team_user.user.school_name %></span>
<span class="t-c-4">学号:<%= team_user.user.user_extensions.student_id.present? ? team_user.user.user_extensions.student_id : "--" %></span>
<span class="t-c-5">
<% unless none_edit %>
<span class="delete_member" data-tip-down="删除"><i class="iconfont icon-guanbi font-14 color-grey-c"></i></span>
<% end %>
</span>
</p>
<% end %>
</div>
<% else %>
<% creator_teacher = @team_user.user_extensions.identity == 0 %>
<p class="personListLine clearfix pt5 pb5 personListMember <%= creator_teacher ? 'team-teacher' : 'team-member' %>" id="create_li">
<span class="t-c-1"><%= @team_user.show_name %></span>
<span class="t-c-2"><%= @team_user.user_extensions.identity == 0 ? "导师/创建者" : "创建者" %></span>
<span class="t-c-3"><%= @team_user.school_name %></span>
<span class="t-c-4"><%= @team_user.user_extensions.identity == 0 ? "职称:#{@team_user.identity}" : "学号:#{@team_user.user_extensions.student_id.present? ? @team_user.user_extensions.student_id : "--"}" %></span>
<span class="t-c-5"></span>
</p>
<% end %>
</div>
<p class="color-orange none ml20" id="competition_team_form_notice"></p>
<div class="clearfix edu-txt-center mt20">
@ -111,69 +126,81 @@
<script>
function submit_competition_team_form(){
if($("input[name='name']").val().trim() == ""){
$("#team_name_notice").html("请输入战队名").show();
} else{
var max_num = parseInt($("#max_num").val());
var min_num = parseInt($("#min_num").val());
if($("#member_block .personListMember").length > max_num || $("#member_block .personListMember").length < min_num){
$("#competition_team_form_notice").html("战队成员需为"+min_num+"-"+max_num+"人").show();
} else{
$("#team_name_notice").hide();
$("#competition_team_form_notice").hide();
$("#competition_team_form").submit();
hideModal();
}
$("#team_name_notice").html("请输入战队名").show();
return;
}
var teacherMaximum = parseInt($("#teacher_maximum").val());
var teacherMinimum = parseInt($("#teacher_minimum").val());
var memberMaximum = parseInt($("#member_maximum").val());
var memberMinimum = parseInt($("#member_minimum").val());
var teacherCount = $("#member_block .personListMember.team-teacher").length;
if (teacherMaximum != 0 && teacherCount > teacherMaximum || teacherMinimum != 0 && teacherCount < teacherMinimum) {
$("#competition_team_form_notice").html("战队导师需为"+teacherMinimum+"-"+teacherMaximum+"人,现为" + teacherCount + '人').show();
return;
}
var memberCount = $("#member_block .personListMember.team-member").length;
if (memberMaximum != 0 && memberCount > memberMaximum || memberMinimum != 0 && memberCount < memberMinimum) {
$("#competition_team_form_notice").html("战队成员需为"+memberMinimum+"-"+memberMaximum+"人,现为" + memberCount + '人').show();
return;
}
$("#team_name_notice").hide();
$("#competition_team_form_notice").hide();
$("#competition_team_form").submit();
hideModal();
}
function add_teacher(){
if($("#teacher_search_input").attr("disabled") != "disabled"){
if($("#teacher_name").val() == "" || $("#teacher_name").val() != $("#teacher_search_input").val()){
$("#teacher_id").attr("data-select", 0);
$("#teacher_notice").html("指导老师需从搜索下拉列表中选择").show();
} else{
if($("#teacher_id").attr("data-select") == 1){
$("#teacher_notice").html("该老师已添加").show();
} else{
$("#teacher_notice").hide();
$("input[name='teacher']").parent().remove();
var li = '<p class="personListLine clearfix pt3 pb3 personListMember">' +
' <input type="hidden" name="teacher" value="'+$("#teacher_id").val()+'">' +
' <span class="t-c-1">'+$("#teacher_name").val()+'</span>' +
' <span class="t-c-2">导师</span>' +
' <span class="t-c-3">'+$("#teacher_school").val()+'</span>' +
' <span class="t-c-4">职称:'+$("#teacher_title").val()+'</span>' +
' <span class="t-c-5"><span class="delete_member" data-tip-down="删除"><i class="iconfont icon-guanbi font-14 color-grey-c"></i></span></span>' +
' </p>';
$(li).insertAfter($("#create_li"));
$("#teacher_id").attr("data-select", 1);
}
}
if($("#teacher_search_input").attr("disabled") != "disabled"){
if($("#teacher_name").val() == "" || $("#teacher_name").val() != $("#teacher_search_input").val()){
$("#teacher_id").attr("data-select", 0);
$("#teacher_notice").html("指导老师需从搜索下拉列表中选择").show();
return;
}
if($("#teacher_id").attr("data-select") == 1 || $(".team-teacher.team-teacher-" + $("#teacher_id").val()).length != 0){
$("#teacher_notice").html("该老师已添加").show();
return;
}
$("#teacher_notice").hide();
var li = '<p class="personListLine clearfix pt3 pb3 personListMember team-teacher team-teacher-' + $("#teacher_id").val() + '">' +
' <input type="hidden" name="teacher_ids[]" value="'+$("#teacher_id").val()+'">' +
' <span class="t-c-1">'+$("#teacher_name").val()+'</span>' +
' <span class="t-c-2">导师</span>' +
' <span class="t-c-3">'+$("#teacher_school").val()+'</span>' +
' <span class="t-c-4">职称:'+$("#teacher_title").val()+'</span>' +
' <span class="t-c-5"><span class="delete_member" data-tip-down="删除"><i class="iconfont icon-guanbi font-14 color-grey-c"></i></span></span>' +
' </p>';
$(li).insertAfter($("#create_li"));
$("#teacher_id").attr("data-select", 1);
}
}
function add_member(){
$("#member_notice").hide();
if($("#member_name").val() == "" || $("#member_name").val() != $("#user_search_input").val()){
$("#member_id").attr("data-select", 0);
$("#member_notice").html("队员需从搜索下拉列表中选择").show();
} else{
if($("#member_id").attr("data-select") == 1){
$("#member_notice").html("该队员已添加").show();
} else{
$("#member_notice").hide();
var li = '<p class="personListLine clearfix pt3 pb3 personListMember">' +
' <input type="hidden" name="member_ids[]" value="'+$("#member_id").val()+'">' +
' <span class="t-c-1">'+$("#member_name").val()+'</span>' +
' <span class="t-c-2">成员</span>' +
' <span class="t-c-3">'+$("#member_school").val()+'</span>' +
' <span class="t-c-4">学号:'+$("#member_student_id").val()+'</span>' +
' <span class="t-c-5"><span class="delete_member" data-tip-down="删除"><i class="iconfont icon-guanbi font-14 color-grey-c"></i></span></span>' +
' </p>';
$("#member_block").append(li);
$("#member_id").attr("data-select", 1);
}
}
$("#member_notice").hide();
if($("#member_name").val() == "" || $("#member_name").val() != $("#user_search_input").val()){
$("#member_id").attr("data-select", 0);
$("#member_notice").html("队员需从搜索下拉列表中选择").show();
return;
}
if($("#member_id").attr("data-select") == 1 || $(".team-member.team-member-" + $("#member_id").val()).length != 0){
$("#member_notice").html("该队员已添加").show();
return;
}
$("#member_notice").hide();
var li = '<p class="personListLine clearfix pt3 pb3 personListMember team-member team-member-' + $("#member_id").val() + '">' +
' <input type="hidden" name="member_ids[]" value="'+$("#member_id").val()+'">' +
' <span class="t-c-1">'+$("#member_name").val()+'</span>' +
' <span class="t-c-2">成员</span>' +
' <span class="t-c-3">'+$("#member_school").val()+'</span>' +
' <span class="t-c-4">学号:'+$("#member_student_id").val()+'</span>' +
' <span class="t-c-5"><span class="delete_member" data-tip-down="删除"><i class="iconfont icon-guanbi font-14 color-grey-c"></i></span></span>' +
' </p>';
$("#member_block").append(li);
$("#member_id").attr("data-select", 1);
}
$("#user_search_input").on("keydown", function(event){

@ -28,6 +28,8 @@
$("#member_notice").hide();
$("#pointerStudent").hide();
e.stopPropagation();
$('.add-member-btn').trigger('click');
});
$("body").click(function(){
$(".pointerTeacher").hide();

@ -1,4 +1,4 @@
<p class="pl30 color-orange-tip mt5 pb5 bor-bottom-greyE">只能指定1名指导老师,允许修改</p>
<p class="pl30 color-orange-tip mt5 pb5 bor-bottom-greyE">请选择指导老师,允许修改</p>
<% @teachers.each do |teacher| %>
<li class="clearfix">
<input type="hidden" value="<%= teacher.id %>">
@ -25,6 +25,7 @@
$("#pointerTeacher").hide();
$("#teacher_notice").hide();
e.stopPropagation();
$('.add-teacher-btn').trigger('click');
});
$("body").click(function(){
$(".pointerTeacher").hide();

@ -1,7 +1,5 @@
<% if @status == 0 %>
<% if @status == -1 %>
notice_box("<%= @message %>");
<% else %>
notice_box_redirect("<%= enroll_competition_path(@competition) %>", "创建成功");
<% elsif @status == 2 %>
notice_box_redirect("<%= enroll_competition_path(@competition) %>", "创建成功,请尽快填写指导老师");
<% elsif @status == 1 %>
notice_box("您已创建过战队,不能重复创建");
<% end %>
<% end %>

@ -1,13 +1,5 @@
<% if @status == 0 %>
notice_box_redirect("<%= enroll_competition_path(@competition) %>", "加入成功");
<% elsif @status == 1 %>
notice_box("战队邀请码错误");
<% elsif @status == 2 %>
notice_box("您已加入战队,不能重复加");
<% elsif @status == 3 %>
notice_box("战队成员已满,无法加入");
<% elsif @status == 4 %>
notice_box("战队已有指导老师,无法加入");
<% elsif @status == 5 %>
notice_box("非老师/学生身份无法加入战队");
<% if @status != -1 %>
notice_box_redirect("<%= enroll_competition_path(@competition) %>", "加入成功");
<% else %>
notice_box('<%= @message %>')
<% end %>

@ -1 +1,5 @@
notice_box_redirect("<%= enroll_competition_path(@competition) %>", "更新成功");
<% if @status != -1 %>
notice_box_redirect("<%= enroll_competition_path(@competition) %>", "更新成功");
<% else %>
notice_box("<%= @message %>")
<% end %>

@ -0,0 +1,134 @@
<% index = 0 %>
<p class="second_code_1" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1%>
<p class="second_code_2" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1 %>
<%
challenge_description_extra = [
"模拟赛选择了第一届标注大赛正式赛第一阶段的三个项目供大家体验熟悉平台、学习其他人的标注,模拟赛标注不计分。",
"第一阶段比赛得分占正赛总比分的30%。",
"第二阶段比赛得分占正赛总比分的70%。"
]
data = [
[
{
name: 'Java项目',
description: "Weka是基于Java的机器学习与数据挖掘平台汇集了最前沿的机器学习算法包括处理标准数据挖掘问题的几乎所有方法回归、分类、聚类、关联规则以及属性选择等是Java机器学习入门的首选平台。<br/><br/>本项目的Clusters目录中包含了K-Means、层次聚类等多种聚类算法以及相应的聚类效果评估方法的java实现",
task: '标注../weka/clusterers/目录下的所有代码文件。',
link_name: 'CSDN经典聚类算法',
link_url: 'https://blog.csdn.net/qq_30262201/article/details/78799926'
},
{
name: 'C++项目',
description: "该项目是GitHub上最受欢迎的C++语言实现经典算法与数据结构的项目之一,内容涵盖排序、链表、树结构、图搜索、贪心算法等。学习这些算法的代码实现,可以深刻理解和掌握算法的核心思想,感受算法之美,代码之美,是人工智能时代的基础入门一课。<br/><br/>本项目的sort_search_problems目录涵盖了冒泡排序、快速排序等各类经典排序算法的C++实现。",
task: '标注../sort_search_problems目录下的所有代码文件及对应引用的../include目录中自定义的头文件。',
link_name: 'CSDN十大经典排序算法',
link_url: 'https://blog.csdn.net/wfq784967698/article/details/79551476'
},
{
name: 'Python项目',
description: "该项目是GitHub上最受欢迎的Python语言实现经典算法的项目之一包含了前沿的神经网络和经典数据结构及算法的Python实现。项目具有兼顾经典和前沿的特点。学习经典算法的源码实现感受经典算法的思想之美、代码之美。<br/><br/>本项目的Sorts目录中包含了冒泡排序、快速排序等各类经典排序算法的Python实现。",
task: '标注../sorts/目录下的所有代码文件。',
link_name: 'CSDN十大经典排序算法',
link_url: 'https://blog.csdn.net/wfq784967698/article/details/79551476'
},
],
[{},{},{}],
[{},{},{}]
]
%>
<% @competition.competition_stages.includes(:competition_stage_sections).each_with_index do |stage, i| %>
<div class="second_code_<%= index + 1 %>" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;">
<%
first_section = stage.competition_stage_sections[0]
second_section = stage.competition_stage_sections[1]
%>
<div class="enter_panel" style="<%= i.zero? ? "height: 1212px" : ''%>">
<% if i.zero? %>
<p class="challenge_title"><%= stage.name %></p>
<% end %>
<ul class="clearfix challenge_sub_title">
<li class="fl">
<span class="mr20"><%= first_section.try(:name) %></span>
<span><%= format_time first_section.start_time %> ~ <%= com_end_time first_section.end_time %></span>
</li>
<li class="fr">
<span class="mr20"><%= second_section.try(:name) %></span>
<span><%= format_time second_section.try(:start_time) %> ~ <%= com_end_time second_section.try(:end_time) %></span>
</li>
</ul>
<p class="break_word font-18 challenge_describe">
标注说明:每个小组选择一种编程语言的题目,针对标注任务中指定的标注模块,要求对代码模块、模块中的代码文件, 以及文件中的函数必须进行标注,关键代码块、代码行及关键变量等由参赛者自由选择进行标注。 正式赛第一阶段的比赛在标注阶段就开放查看所有人的标注,请大家根据个人理解,写出自己的风格。我们将综合考虑标注的原创性、准确性、 完整性和多样性等不同的维度对标注质量进行评分。<%= challenge_description_extra[i] %>
</p>
<ul class="mt30">
<% first_section.competition_entries.each_with_index do |entry, j| %>
<% row_data = data[i][j] %>
<li class="challenge_box">
<p class="challenge_b_t"><%= row_data[:name] || entry.name %></p>
<p class="enter_btn mb40 clearfix">
<%
is_start = Time.now > first_section.start_time
competition_url = User.current.logged? ? "#{entry.url}?eid=#{User.current.id}" : "#{entry.url}"
btn_url = is_start ? "#{competition_url}" : "javascript:void(0);"
%>
<a class="setNewBnt <%= is_start ? 'active' : '' %>"
href="javascript:void(0);"
data-url="<%= btn_url %>"><%= entry.name %></a>
</p>
<% if row_data.present? %>
<p class="challenge_b_d">项目简介</p>
<p class="break-word challenge_b_des"><%= raw row_data[:description] %></p>
<p class="challenge_b_d">标注任务</p>
<p class="break-word challenge_b_des" style="color: #FC2F78;min-height: 60px"><%= row_data[:task] %></p>
<p class="challenge_b_d">经典算法解读:</p>
<ul class="clearfix algorithm">
<a href="<%= row_data[:link_url] %>" target="_blank"><%= row_data[:link_name] %></a>
</ul>
<p class="enter_btn clearfix">
<a href="javascript:void(0);"
data-url="<%= btn_url %>"
class="setNewBnt <%= is_start ? 'active' : '' %>">点击进入代标注模块</a>
</p>
<% end %>
</li>
<% end %>
</ul>
</div>
</div>
<% index += 1 %>
<% end %>
<p class="second_code_6" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1 %>
<p class="second_code_7" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<% index += 1 %>
<p class="second_code_8" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></p>
<script>
$(function(){
var userLogged = <%= @user.present? && @user.logged? %>;
var userEnrolled = <%= @enrolled %>;
$(".enter_btn .setNewBnt.active").on("click", function(){
var url = $(this).data("url");
if (!userLogged) {
location.href = "<%= signin_url(back_url: competition_path(id: params[:id])) %>";
return;
}
if (!userEnrolled) {
sure_box_redirect_without_newtab_btn("<%= enroll_competition_path(id: params[:id]) %>", "完成报名后即可参赛", "我要报名");
return;
}
var newTab = window.open("_blank");
newTab.location = url;
})
})
</script>

@ -0,0 +1,60 @@
<% index = 0 %>
<div class="second_1" style="background: url(<%= named_attachment_path(@images.first, @images.first.try(:filename)) %>) no-repeat top center;"></div>
<% index += 1 %>
<div class="second_2" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></div>
<% index += 1 %>
<% @competition.competition_stages.each_with_index do |stage, i| %>
<div class="second_3" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;">
<div class="enter_panel">
<% stage.competition_stage_sections.each do |section| %>
<ul class="mb40">
<p class="mb30 font-22 enter_title">
<span class="mr20 font-bd"><%= section.name %></span>
<span><%= format_time section.start_time %> ~ <%= com_end_time section.end_time %></span>
</p>
<li class="inline enter_btn">
<% "@urls[i][j][k]表示: 第i个比赛的第j个对象的第k个url入口" %>
<% is_start = Time.now > section.start_time %>
<% section.competition_entries.each_with_index do |entry| %>
<%= link_to entry.name, 'javascript:void(0);',
class: "li-1 #{ is_start ? 'active' : ''}",
data: { url: is_start ? entry.url : 'javascript:void(0);' } %>
<% end %>
</li>
</ul>
<% end %>
</div>
</div>
<% index += 1 %>
<% end %>
<div class="second_6" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></div>
<% index += 1 %>
<div class="second_7" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></div>
<% index += 1 %>
<div class="second_8" style="background: url(<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>) no-repeat top center;"></div>
<script>
$(function(){
var userLogged = <%= @user.present? && @user.logged? %>;
var userEnrolled = <%= @enrolled %>;
$(".enter_btn a.active").on("click", function(){
var url = $(this).data("url");
if (!userLogged) {
location.href = "<%= signin_url(back_url: competition_path(id: params[:id])) %>";
return;
}
if (!userEnrolled) {
sure_box_redirect_without_newtab_btn("<%= enroll_competition_path(id: params[:id]) %>", "完成报名后即可参赛", "我要报名");
return;
}
var newTab = window.open("_blank");
newTab.location = url;
})
})
</script>

@ -0,0 +1,30 @@
<% index = 0 %>
<p class="second_course_1" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></p>
<% index += 1 %>
<p class="second_course_2" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></p>
<% index += 1 %>
<p class="second_course_3" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></p>
<% index += 1 %>
<p class="second_course_4" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></p>
<% index += 1 %>
<%
stage = @competition.competition_stages.first
first_section = stage.competition_stage_sections.first
is_start = Time.now > first_section.start_time
%>
<div class="second_course_5" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;">
<div class="enter_panel" style="height: 500px">
<div class="course_competition_panel">
<a href="<%= is_start ? first_section.competition_entries[0].url : 'javascript:void(0)'%>"
class="<%= is_start ? 'active' : '' %>" target="_blank"><%= first_section.competition_entries[0].name %></a>
<a href="<%= is_start ? first_section.competition_entries[1].url : 'javascript:void(0)'%>"
class="<%= is_start ? 'active' : '' %>" target="_blank"><%= first_section.competition_entries[1].name %></a>
</div>
<a href="<%= is_start ? first_section.competition_entries[2].url : 'javascript:void(0)'%>"
class="ex_submit"><%= first_section.competition_entries[2].name %></a>
</div>
</div>
<% index += 1 %>
<p class="second_course_6" style="background: url('<%= named_attachment_path(@images[index], @images[index].try(:filename)) %>') no-repeat top center;"></p>

@ -5,19 +5,19 @@
<% @teams.each do |team| %>
<li class="clearfix">
<%= link_to image_tag(url_to_avatar(team.user), :width => "40", :height => "40", :class => "radius fl mr10"), user_path(team.user), :title => team.user.show_name, :target => "_blank", :alt => "用户头像" %>
<span class="fl task-hide mr20 mt10" style="width: 130px;" data-tip-down="<%= @competition.max_num > 1 ? team.name : team.user.show_name %>"><%= @competition.max_num > 1 ? team.name : team.user.show_name %></span>
<% if @competition.max_num > 1 %>
<span class="fl mr40 mt10" style="width: 270px;">
<% if team.teacher_id.present? %>
<a href="<%= user_path(team.teacher) %>" class="fl" target="_blank" data-tip-down="指导老师:<%= team.teacher.show_name %>"><%= image_tag(url_to_avatar(team.teacher), :width => "26", :height => "26", :class => "radius fl mr4") %></a>
<% end %>
<% team.team_members.where("user_id != #{team.teacher_id.present? ? team.teacher_id : '-1'}")[0, 9].each do |member| %>
<%= link_to image_tag(url_to_avatar(member.user), :width => "20", :height => "20", :class => "radius fl mr4 mt3"), user_path(member.user), :title => member.user.show_name, :target => "_blank", :class => "fl", :alt => "用户头像" %>
<% end %>
<% if team.team_members.size > 9 %>
<span class="team-p-s mt3">...</span>
<% end %>
</span>
<span class="fl task-hide mr20 mt10" style="width: 130px;" data-tip-down="<%= @maximum_staff > 1 ? team.name : team.user.show_name %>"><%= @maximum_staff > 1 ? team.name : team.user.show_name %></span>
<% if @maximum_staff > 1 %>
<span class="fl mr40 mt10" style="width: 270px;">
<% team.teachers.each do |teacher| %>
<%= link_to image_tag(url_to_avatar(teacher.user), width: 26, height: 26, class: 'radius fl mr4'), user_path(teacher.user), class: 'fl', target: '_blank', data: { 'tip-down' => "指导老师:#{teacher.user.show_name}" } %>
<% end %>
<% team.members.each do |member| %>
<%= link_to image_tag(url_to_avatar(member.user), :width => "20", :height => "20", :class => "radius fl mr4 mt3"), user_path(member.user), :title => member.user.show_name, :target => "_blank", :class => "fl", :alt => "用户头像" %>
<% end %>
<% if team.members.size > 9 %>
<span class="team-p-s mt3">...</span>
<% end %>
</span>
<% end %>
<span class="color-grey-6 fl edu-txt-left task-hide mt10" style="width: 180px;"><%= team.user.school_name %></span>
<span class="color-grey-9 fr mt10"><%= format_time team.created_at %></span>

@ -1,8 +1,10 @@
<div class="enroll-b">
<div class="enroll-t" style="background:url(<%= @competition.identifier == 'gcc-dev-2018' ? '/images/educoder/competition/dev.jpg' : '/images/educoder/competition/anon.jpg' %>) no-repeat top center;">
<div class="educontent">
<% if @competition.max_num > 1 %>
<p class="clearfix edu-txt-right mb30">
<div class="enroll-t" style="background:url('/images/educoder/competition/anon.png') no-repeat top center;">
<div class="educontent edu-txt-center">
<p class="main_title"><%= @competition.name %></p>
<% if @minimum_staff > 1 %>
<p class="sub_title"><%= @competition.sub_title %></p>
<p class="edu-txt-right inline mt20">
<% unless User.current.logged? %>
<%= link_to "创建战队", signin_path, :remote => true, :class => "enroll-in-b enroll-in-b-green fr" %>
<% else %>
@ -16,8 +18,7 @@
<a onclick="notice_box('报名已截止')" class="enroll-in-b enroll-in-b-green fr">创建战队</a>
<% end %>
<% end %>
</p>
<p class="clearfix edu-txt-right">
<% unless User.current.logged? %>
<%= link_to "加入战队", signin_path, :remote => true, :class => "enroll-in-b fr" %>
<% else %>
@ -35,8 +36,9 @@
<% else %>
<!--个人报名-->
<% unless User.current.logged? %>
<%= link_to "立即报名", signin_path, :remote => true, :class => "enroll-in-b enroll-in-b-green fr" %>
<p class="edu-txt-right inline mt20"><%= link_to "立即报名", signin_path, :remote => true, :class => "enroll-in-b fr" %></p>
<% else %>
<p class="edu-txt-right inline mt20">
<% unless @competition.enroll_end_time.present? && @competition.enroll_end_time < Time.now %>
<% if @is_enroll.present? %>
<a href="javascript:void(0)" onclick="notice_box('您已报名')" class="enroll-in-b enroll-in-b-green fr">立即报名</a>
@ -46,6 +48,7 @@
<% else %>
<a onclick="notice_box('报名已截止')" class="enroll-in-b enroll-in-b-green fr">立即报名</a>
<% end %>
</p>
<% end %>
<% end %>
</div>
@ -59,7 +62,7 @@
<div class="educontent" style="width: 934px;">
<% if @is_enroll.present? %>
<div class="pb30">
<% if @competition.max_num > 1 %>
<% if @maximum_staff > 1 %>
<!--战队报名显示-->
<div class="clearfix mt30 pr88">
<% @is_enroll.each do |team| %>
@ -83,7 +86,7 @@
</span>
<span class="fl mr40 mt13 font-16">邀请码:<label class="color-orange"><%= team.invite_code %></label></span>
<% if @competition.enroll_end_time.present? && @competition.enroll_end_time < Time.now %>
<% if (User.current.admin? || User.current == team.user) && team.user_id != team.teacher_id %>
<% if User.current.admin? || User.current == team.user %>
<a href="<%= edit_competition_team_path(team) %>" data-remote="true" class="fl mt13 mr20" data-tip-down="编辑"><i class="iconfont icon-bianjidaibeijing color-blue fl"></i></a>
<% end %>
<% else %>
@ -112,21 +115,25 @@
<img src="/images/educoder/competition/noTeam.png"/>
</div>
<% end %>
<% if User.current.admin? && @teams.present? %>
<input class="fl ml20 mb5" style="padding: 5px; width: 200px; line-height: 20px;" maxlength="10" placeholder="输入学校名称进行搜索" type="text" id="school_name">
<a href="javascript:void(0);" class="fl task-btn task-btn-orange ml5 mb5" onclick="search_enroll_team();">搜索</a>
<span class="fl mb5 ml10 pr5 none">战队数:<span id="search_teams_count" class="color-orange"></span>个</span>
<span class="fl mb5 ml10 pr5 none">成员数:<span id="team_members_count" class="color-orange"></span>个</span>
<span class="fr mb5 pr5"><%= @competition.max_num > 1 ? "战队总数" : "报名人数" %><span class="color-orange"><%= @team_count %></span>个</span>
<div class="cl"></div>
<%= render :partial => "competitions/team_list" %>
<% else %>
<% unless @teams.present? %>
<div class="edu-txt-center">
<p class="font-30 color-green mb30">您还未参与报名哦,赶紧来挑战吧~</p>
<img src="/images/educoder/competition/noTeam.png"/>
</div>
<% end %>
<% if User.current.admin?%>
<div class="mt20">
<input class="fl ml20 mb5" style="padding: 5px; width: 200px; line-height: 20px;" maxlength="10" placeholder="输入学校名称进行搜索" type="text" id="school_name">
<a href="javascript:void(0);" class="fl task-btn task-btn-orange ml5 mb5" onclick="search_enroll_team();">搜索</a>
<span class="fl mb5 ml10 pr5 none">战队数:<span id="search_teams_count" class="color-orange"></span>个</span>
<span class="fl mb5 ml10 pr5 none">成员数:<span id="team_members_count" class="color-orange"></span>个</span>
<span class="fr mb5 pr5"><%= @maximum_staff > 1 ? "战队总数" : "报名人数" %><span class="color-orange"><%= @team_count %></span>个</span>
<div class="cl"></div>
<% if @teams.present? %>
<%= render :partial => "competitions/team_list" %>
<% else %>
<div class="edu-txt-center">
<p class="font-30 color-green mb30">还没有人报名~</p>
<img src="/images/educoder/competition/noTeam.png"/>
</div>
<% end %>
</div>
<% end %>
</div>
</div>

@ -8,7 +8,7 @@
<%= image_tag(url_to_avatar(competition), :width => "100%", :height => "100%") %>
</a>
<div class="pt20 pl20 mb10 clearfix">
<a href="<%= competition_path(competition) %>" style="max-width: 400px;" class="font-16 task-hide fl" target="_blank"><%= competition.name %></a>
<a href="<%= competition_path(competition) %>" style="max-width: 400px;" class="font-16 task-hide fl" target="_blank"><%= [competition.name, competition.sub_title.presence].compact.join('——') %></a>
<% if competition.start_time > Time.now %>
<% unless competition.enroll_end_time.present? && competition.enroll_end_time < Time.now %>
<div class="fr status-orange">

@ -7,5 +7,11 @@
<%= render :partial => "qg_competition" %>
<% elsif @competition.identifier == "gcc-annotation-2018" %>
<%= render :partial => "annotation_2018_competition" %>
<% elsif @competition.identifier == "gcc-task-2019" %>
<%= render :partial => "qg_second_competition" %>
<% elsif @competition.identifier == "gcc-annotation-2019" %>
<%= render :partial => "gq_second_code_competition" %>
<% elsif @competition.identifier == "gcc-course-2019" %>
<%= render :partial => "qg_second_course_competition" %>
<% end %>
</div>

@ -8,9 +8,9 @@
<ul>
<li class="clearfix mb10">
<label class="panel-form-label fl">课堂邀请码:</label>
<input type="text" class="input-60-40 fl" name="invite_code" placeholder="请输入五位课堂邀请码" value="<%= @invitation_code %>">
<input type="text" class="input-60-40 fl" name="invite_code" placeholder="请输入5位课堂邀请码或6位分班邀请码" style="width: 70%;" value="<%= @invitation_code %>">
</li>
<p id="none_invite_code_notice" class="color-orange none f12" style="margin-left: 90px;">请输入五位课堂邀请码</p>
<p id="none_invite_code_notice" class="color-orange none f12" style="margin-left: 90px;">请输入5位课堂邀请码或6位分班邀请码</p>
<li class="clearfix ">
<label class="panel-form-label fl">身份:</label>
<span class="fl mr20 mt2">

@ -5,7 +5,9 @@
<tr class="eduCenternew">
<th width="10%" class="tabeltext-alignleft">用户ID</th>
<th width="10%" class="tabeltext-alignleft">姓名</th>
<th width="10%" class="tabeltext-alignleft">学号</th>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<th width="10%" class="tabeltext-alignleft">学号</th>
<% end %>
<th width="10%" class="tabeltext-alignleft">分班</th>
<!--<th width="13%" style="white-space:nowrap; overflow:hidden; text-overflow:ellipsis" class="tabeltext-alignleft">课堂成绩</th>
<th width="10%">活跃度</th>-->
@ -22,9 +24,11 @@
<% end %>
<span class="edu-txt-w140 task-hide mt5"><%= user.login %></span></td>
<td class="tabeltext-alignleft"><%= link_to user.show_real_name, user_path(user), :class => 'edu-txt-w140 task-hide mt5 color-grey-3', :target => '_blank' %></td>
<td class="tabeltext-alignleft">
<span class="edu-txt-w140 task-hide mt5"><%= user.user_extensions ? user.user_extensions.student_id : '' %></span>
</td>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<td class="tabeltext-alignleft">
<span class="edu-txt-w140 task-hide mt5"><%= user.user_extensions ? user.user_extensions.student_id : '' %></span>
</td>
<% end %>
<td class="tabeltext-alignleft"><%= member.course_group_id == 0 || member.course_group_id.nil? ? '未分班' : member.course_group.name %></td>
<% if false %>
<td class="tabeltext-alignleft"><%= format("%.1f", member.course_score) %></td><!--课堂成绩-->

@ -200,7 +200,11 @@
}
</script>
<input name="exercise_choice_<%= exercise_question.id %>" class="magic-radio fl mt5 magic-checkbox_show" id="exercise_<%= exercise_choice.id %>_exercise_choice_id" onclick="click_<%= exercise_choice.id %>(this);return false;" type="radio" <%= !@can_edit_excercise ? "disabled" : "" %> <%= answer_be_selected?(exercise_choice, User.current) ? "checked" : "" %>>
<label class="fl color-grey3" for="exercise_<%= exercise_choice.id %>_exercise_choice_id"><%= convert_to_char((index + 1).to_s) %>&nbsp;&nbsp;<%= exercise_choice.choice_text %></label>
<label class="fl color-grey3" for="exercise_<%= exercise_choice.id %>_exercise_choice_id">
<div class="fl">
<%= convert_to_char((index + 1).to_s) %>
</div><xmp class="fl ml10 xmplist"><%= exercise_choice.choice_text %></xmp>
</label>
</li>
<% end %>
</div>
@ -243,7 +247,11 @@
}
</script>
<input name="exercise_choice_<%= exercise_question.id %>" class="magic-checkbox fl mt5 magic-checkbox_show" id="exercise_<%= exercise_choice.id %>_exercise_choice_id" onclick="click_<%= exercise_choice.id %>(this);return false;" type="checkbox" <%= !@can_edit_excercise ? "disabled" : "" %> <%= answer_be_selected?(exercise_choice, User.current) ? "checked" : "" %>>
<label class="fl color-grey3" for="exercise_<%= exercise_choice.id %>_exercise_choice_id"><%= convert_to_char((index + 1).to_s) %>&nbsp;&nbsp;<%= exercise_choice.choice_text %></label>
<label class="fl color-grey3" for="exercise_<%= exercise_choice.id %>_exercise_choice_id">
<div class="fl">
<%= convert_to_char((index + 1).to_s) %>
</div><xmp class="fl ml10 xmplist"><%= exercise_choice.choice_text %></xmp>
</label>
</li>
<% end %>
</div>

@ -153,7 +153,11 @@
id="exercise_<%= exercise_choice.id %>_exercise_choice_id" type="radio" disabled
<%= answer_be_selected?(exercise_choice, user) ? "checked" : "" %>>
<label class="fl color-grey3" for="exercise_<%= exercise_choice.id %>_exercise_choice_id"><%= convert_to_char((index + 1).to_s) %>&nbsp;&nbsp;<%= exercise_choice.choice_text %></label>
<label class="fl color-grey3" for="exercise_<%= exercise_choice.id %>_exercise_choice_id">
<div class="fl">
<%= convert_to_char((index + 1).to_s) %>
</div><xmp class="fl ml10 xmplist"><%= exercise_choice.choice_text %></xmp>
</label>
</li>
<% end %>
</div>
@ -168,7 +172,11 @@
<% exercise_choices.each_with_index do |exercise_choice, index| %>
<li class="clearfix">
<input name="exercise_choice_<%= exercise_question.id %>" class="magic-checkbox fl mt5 magic-checkbox_show" id="exercise_<%= exercise_choice.id %>_exercise_choice_id" type="checkbox" disabled <%= answer_be_selected?(exercise_choice, user) ? "checked" : "" %>>
<label class="fl color-grey3" for="exercise_<%= exercise_choice.id %>_exercise_choice_id"><%= convert_to_char((index + 1).to_s) %>&nbsp;&nbsp;<%= exercise_choice.choice_text %></label>
<label class="fl color-grey3" for="exercise_<%= exercise_choice.id %>_exercise_choice_id">
<div class="fl">
<%= convert_to_char((index + 1).to_s) %>
</div><xmp class="fl ml10 xmplist"><%= exercise_choice.choice_text %></xmp>
</label>
</li>
<% end %>
</div>
@ -287,7 +295,7 @@
<a href="javascript:void(0)" onclick="toggle_comment_block(<%= exercise_question.id %>, <%= exercise_shixun_answer.id %>)" data-remote="true" class="mr15 color-blue">调分</a>
<% end %>
<% if game.present? && game.status == 2 && !is_answer_correct && game.answer_open %>
<% if game.present? && game.status == 2 && @exercise_user.end_at && game.end_time < @exercise_user.end_at && !is_answer_correct && game.answer_open %>
<span class="color-red mr5">(答案抄袭)</span>
<% end %>
<% score = exercise_shixun_answer.present? ? exercise_shixun_answer.try(:score) : 0 %>

@ -23,7 +23,7 @@
<label class="fl color-grey3" for="sx_<%= exercise_choice.id %>">
<div class="fl">
<%= convert_to_char((index+1).to_s)%>
</div><pre class="fl ml10"><%= exercise_choice.choice_text%></pre>
</div><xmp class="fl ml10 xmplist"><%= exercise_choice.choice_text%></xmp>
</label>
</li>
<% end %>

@ -23,7 +23,7 @@
<label class="fl color-grey3" for="dx_<%= exercise_choice.id %>">
<div class="fl">
<%= convert_to_char((index+1).to_s)%>
</div><pre class="fl ml10"><%= exercise_choice.choice_text%></pre>
</div><xmp class="fl ml10 xmplist"><%= exercise_choice.choice_text%></xmp>
</label>
</li>
<% end %>

@ -17,9 +17,9 @@
</li>
<% exercise_question.exercise_choices.reorder("choice_position").each do |exercise_choice| %>
<li class="clearfix">
<p class="pl5 <%= exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s.split('').include?(exercise_choice.choice_position.to_s) ? 'color-light-green' : '' %>">
<%= exercise_choice.choice_text %>
</p>
<div class="width698 fl pl5 <%= exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s.split('').include?(exercise_choice.choice_position.to_s) ? 'color-light-green' : '' %>">
<xmp class="xmplist"><%= exercise_choice.choice_text %></xmp>
</div>
<% count = exercise_choice.exercise_answers.where(:user_id => @user_ids).count %>
<p class="color-dark-grey"><%= count %></p>
<div class="panel-slider-bg mt13 fl">

@ -12,7 +12,9 @@
<th>序号</th>
<th>姓名</th>
<th class="with10">分班</th>
<th>学号</th>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<th>学号</th>
<% end %>
<th>提交状态</th>
<th>提交时间</th>
<th>客观题得分</th>
@ -32,12 +34,14 @@
<%= link_to exercise.user.show_real_name, user_path(exercise.user),:class=>"color-grey-3" %>
</td>
<% member = @course.members.where(:user_id => exercise.user_id).first %>
<td title="<%= member.try(:course_group_id).to_i == 0 ? '未分班' : member.course_group.name %>">
<span class="task-hide" style="display: block;max-width: 120px;"><%= member.try(:course_group_id).to_i == 0 ? '未分班' : member.course_group.name %></span>
</td>
<td title="<%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id %>">
<%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id %>
<td title="<%= member.try(:course_group_id).to_i == 0 ? '未分班' : member.course_group.try(:name) %>">
<span class="task-hide" style="display: block;max-width: 120px;"><%= member.try(:course_group_id).to_i == 0 ? '未分班' : member.course_group.try(:name) %></span>
</td>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<td title="<%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id %>">
<%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id %>
</td>
<% end %>
<td>
<%= (ex_poll_work_status exercise.commit_status).html_safe %>
</td>

@ -268,7 +268,11 @@
<% exercise_choices.each_with_index do |exercise_choice, index| %>
<div class="clearfix">
<input name="exercise_choice_<%= exercise_question.id %>" class="magic-radio fl mt5 magic-checkbox_show" id="exercise_<%= exercise_choice.id %>_exercise_choice_id" type="radio">
<label class="fl color-grey3" for="exercise_<%= exercise_choice.id %>_exercise_choice_id"><%= convert_to_char((index + 1).to_s) %>&nbsp;&nbsp;<%= exercise_choice.choice_text %></label>
<label class="fl color-grey3" for="exercise_<%= exercise_choice.id %>_exercise_choice_id">
<div class="fl">
<%= convert_to_char((index + 1).to_s) %>
</div><xmp class="fl ml10 xmplist"><%= exercise_choice.choice_text %></xmp>
</label>
</div>
<% end %>
</div>
@ -281,7 +285,11 @@
<% exercise_choices.each_with_index do |exercise_choice, index| %>
<div class="clearfix">
<input name="exercise_choice_<%= exercise_question.id %>" class="magic-checkbox fl mt5 magic-checkbox_show" id="exercise_<%= exercise_choice.id %>_exercise_choice_id" type="checkbox">
<label class="fl color-grey3" for="exercise_<%= exercise_choice.id %>_exercise_choice_id"><%= convert_to_char((index + 1).to_s) %>&nbsp;&nbsp;<%= exercise_choice.choice_text %></label>
<label class="fl color-grey3" for="exercise_<%= exercise_choice.id %>_exercise_choice_id">
<div class="fl">
<%= convert_to_char((index + 1).to_s) %>
</div><xmp class="fl ml10 xmplist"><%= exercise_choice.choice_text %></xmp>
</label>
</div>
<% end %>
</div>

@ -16,27 +16,29 @@
</div>
</div>
<div class="clearfix minH-280">
<table cellpadding="0" cellspacing="0" class="edu-txt-center edu-pop-table aroundRange">
<table class="edu-pop-table edu-txt-center hover-td" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th width="4%">序号</th>
<th>序号</th>
<th width="10%">姓名</th>
<th class="flex1">学号</th>
<th width="7%">分班</th>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<th>学号</th>
<% end %>
<th>分班</th>
<% if @task.task_type == 2 %>
<th width="7%">分组</th>
<th>分组</th>
<% if @task.base_on_project %>
<th width="12%">关联项目</th>
<th>关联项目</th>
<% end %>
<% end %>
<th width="6%">提交状态</th>
<th width="12%">更新时间</th>
<th width="8%">教师评分</th>
<th>提交状态</th>
<th>更新时间</th>
<th>教师评分</th>
<% if @task.cross_comment %>
<th width="8%">交叉评分</th>
<th>交叉评分</th>
<% end %>
<th width="8%">最终成绩</th>
<th width="11%">操作</th>
<th>最终成绩</th>
<th>操作</th>
</tr>
</thead>
<tbody>
@ -44,16 +46,20 @@
<% @works.each_with_index do |work, i| %>
<% score_open = task_score_open || work.user == User.current %>
<tr>
<td width="4%"><%= (@page - 1) * @limit + i + 1 %></td>
<td width="10%"><%= link_to work.user.show_real_name, user_path(work.user), :target => "_blank" %></td>
<% student_id = work.user.user_extensions.nil? ? "--" : work.user.user_extensions.student_id %>
<td class="task-hide flex1"><%= student_id %></td>
<td><%= (@page - 1) * @limit + i + 1 %></td>
<td><%= link_to work.user.show_real_name, user_path(work.user), :target => "_blank" %></td>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<% student_id = work.user.user_extensions.nil? ? "--" : work.user.user_extensions.student_id %>
<td class="task-hide"><%= student_id %></td>
<% end %>
<% group_name = member_group_name @course.members, work.user_id %>
<td width="7%" class="task-hide" title="<%= group_name %>"><%= group_name %></td>
<td title="<%= group_name %>">
<span class="task-hide" style="display: block;max-width: 120px;"><%= group_name %></span>
</td>
<% if @task.task_type == 2 %>
<td width="7%" class="task-hide"><%= work.group_id == 0 ? '--' : '分组'+work.group_id.to_s %></td>
<td class="task-hide"><%= work.group_id == 0 ? '--' : '分组'+work.group_id.to_s %></td>
<% if @task.base_on_project %>
<td width="12%" class="student_score_info edu-position">
<td class="student_score_info edu-position">
<% if work.project %>
<% project = work.project %>
<% if project.status != 9 && (project.is_public || User.current.member_of?(project) || @is_teacher) %>
@ -85,18 +91,18 @@
</td>
<% end %>
<% end %>
<td width="6%"><%= (ex_poll_work_status work.work_status).html_safe %></td>
<td width="12%" class="color-grey-9"><%= work.work_status == 0 ? '--' : format_time(work.update_time) %></td>
<td width="8%" class="<%= score_color (!score_open || work.teacher_score.nil? ? nil : work.teacher_score)%>">
<td><%= (ex_poll_work_status work.work_status).html_safe %></td>
<td class="color-grey-9"><%= work.work_status == 0 ? '--' : format_time(work.update_time) %></td>
<td class="<%= score_color (!score_open || work.teacher_score.nil? ? nil : work.teacher_score)%>">
<%= work.work_status == 0 ? '--' : (work.teacher_score.nil? ? "未批阅" : (!score_open ? "**" : format("%.1f", work.teacher_score.round(1)))) %>
</td>
<% if @task.cross_comment %>
<td width="8%" class="<%= score_color (!score_open || work.cross_score.nil? ? nil : work.cross_score)%>">
<td class="<%= score_color (!score_open || work.cross_score.nil? ? nil : work.cross_score)%>">
<%= work.work_status == 0 ? '--' : (work.cross_score.nil? ? "未批阅" : (!score_open ? "**" : (format("%.1f", work.cross_score.round(1)) + "#{work.graduation_work_scores.where(:reviewer_role => 2).group_by(&:user_id).count}"))) %>
</td>
<% end %>
<% score = work.work_score %>
<td width="8%" class="<%= score_color (!score_open || score.nil? ? nil : score)%> edu-position">
<td class="<%= score_color (!score_open || score.nil? ? nil : score)%> edu-position">
<%= score.nil? ? "--" : (!score_open ? "**" : format("%.1f",score<0 ? 0 : score.round(1)))%>
<% if score.present? %>
<div class="popup_tip_box-black" style="left: 65px;">
@ -110,7 +116,7 @@
</div>
<% end %>
</td>
<td width="11%">
<td>
<% if @is_teacher && @task.cross_comment && @task.comment_status == 2 %>
<a href="<%= assign_teacher_graduation_work_path(work) %>" data-remote="true" class="color-blue ml5 mr5 allotTeacher">分配</a>
<% end %>

@ -3,7 +3,9 @@
<p>
<span>序号</span>
<span class="s-w">姓名</span>
<span class="m-w">学号</span>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<span class="m-w">学号</span>
<% end %>
<span class="m-w">分班</span>
<span class="m-w">选题时间</span>
<span class="l-w flex1">确认结果</span>
@ -15,8 +17,10 @@
<p>
<span class="color-grey-6"><%= index + 1 %></span>
<span class="s-w color-grey-3"><a href="<%= user_path(student_topic.user) %>" target="_blank"><%= student_topic.user.show_real_name %></a></span>
<% student_id = student_topic.user.user_extensions.try(:student_id).present? ? student_topic.user.user_extensions.student_id : "--" %>
<span class="m-w"><%= student_id %></span>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<% student_id = student_topic.user.user_extensions.try(:student_id).present? ? student_topic.user.user_extensions.student_id : "--" %>
<span class="m-w"><%= student_id %></span>
<% end %>
<span class="m-w"><%= student_topic.member.course_group.try(:name) %></span>
<span class="m-w"><%= format_time student_topic.created_at %></span>
<%= (student_topic_status student_topic.status).html_safe %>

@ -1,21 +1,19 @@
<% project_file_num = Attachment.where(:container_type => "Project", :container_id => @project.id).count %>
<% project_issue_count = @project.issues.count %>
<% training_tasks_count = @project.training_tasks.count %>
<% project_acts = ForgeActivity.where("project_id = ?", @project.id).count %>
<% raodmaps = Version.where("project_id = ?", @project.id).count %>
<% project_score = @project.project_score %>
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count(@project) if @project.try(:id) %>
<% update_visiti_count(@project) if @project.try(:id) %>
<div class="pro_new">
<div class="pro_new_top clear">
<div class="fl pro_new_name clear">
<% unless @project.is_public %><i class="fa fa-lock color-grey-c mr5 font-24 fl "></i><% end %>
<% if @project.is_training_project? %>
<%=link_to "#{@project.owner.try(:show_name)}导师<span class='ml5 mr5'>/</span>".html_safe, user_path(@project.owner), :class => "pro_new_username" %>
<%= link_to "#{@project.owner.try(:show_name)}导师<span class='ml5 mr5'>/</span>".html_safe, user_path(@project.owner), :class => "pro_new_username" %>
<% else %>
<%=link_to "#{@project.owner.try(:show_name)}<span class='ml5 mr5'>/</span>".html_safe, user_path(@project.owner), :class => "pro_new_username" %>
<%= link_to "#{@project.owner.try(:show_name)}<span class='ml5 mr5'>/</span>".html_safe, user_path(@project.owner), :class => "pro_new_username" %>
<% end %>
<%=link_to @project.name, project_path(@project), :class => "pro_new_username break_word" %>
<%= link_to @project.name, project_path(@project), :class => "pro_new_username break_word" %>
</div>
<!--加入、退出、关注项目-->
@ -52,14 +50,6 @@
<%= link_to project_issue_count > 0 ? "#{l(:label_issue_tracking)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k project_issue_count}</span>".html_safe : "#{l(:label_issue_tracking)}", project_issues_path(@project, :remote => true), :class => "pro_new_proname" %>
</li>
<% end %>
<!--实训任务-->
<% if !@project.enabled_modules.where("name = 'training_tasks'").empty? %>
<% if User.current.admin? || is_project_manager?(User.current.id, @project.id) || is_project_manager?(User.current, @project.try(:forked_from_project_id)) %>
<li id="project_menu_011">
<%= link_to training_tasks_count > 0 ? "#{l(:project_module_training_tasks)}<span class='issues_nav_tag ml5'>#{switch_integer_into_k training_tasks_count}</span>".html_safe : "#{l(:project_module_training_tasks)}", project_training_tasks_url(@project), :class => "pro_new_proname" %>
</li>
<% end %>
<% end %>
<!--资源库-->
<% unless @project.enabled_modules.where("name = 'files'").empty? %>

@ -16,7 +16,8 @@
</ul>
</div>
<div>
<p class="footer_con-p inline lineh-30"><span class="font-18 fl">©</span>&nbsp;2019&nbsp;EduCoder<span class="ml15 mr15">湘ICP备17009477号</span><a href="https://team.trustie.net" style="color: #888;" target="_blank">Trustie</a>&nbsp;&nbsp;&nbsp;&&nbsp;&nbsp;&nbsp;IntelliDE inside.</p>
<p class="footer_con-p inline lineh-30"><span class="font-18 fl">©</span>&nbsp;2019&nbsp;EduCoder<a style="color: #888;" target="_blank" href="http://beian.miit.gov.cn/" class="ml15 mr15">湘ICP备17009477号</a>
<a href="https://team.trustie.net" style="color: #888;" target="_blank">Trustie</a>&nbsp;&nbsp;&nbsp;&&nbsp;&nbsp;&nbsp;IntelliDE inside. <span class="ml15 mr15">版权所有 湖南智擎科技有限公司</span></p>
</div>
<div class="cl"></div>
</div>

@ -2,7 +2,7 @@
<%= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台", class:"logoimg"), home_path %>
<div class="head-nav pr">
<ul id="header-nav">
<li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实课程", subjects_path %></li>
<li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实课程", subjects_path %></li>
<li class="<%= course_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "翻转课堂", courses_path %></li>
<!-- 精选实训 -->
<li class="pr <%= shixuns_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "开发社区", shixuns_path %><img src="/images/educoder/hot-h.png" class="nav-img" /></li>
@ -18,11 +18,11 @@
</ul>
</li>
<% end %>
<li class="<%= params[:controller] == "competitions" ? " active" : "" %>"><%= link_to "竞赛", competitions_path %></li>
<li class="<%= params[:controller] == "forums" ? " active" : "" %>"><%= link_to "问答", forums_path %></li>
<li class="<%= params[:controller] == "competitions" ? " active" : "" %>"><%= link_to "在线竞赛", competitions_path %></li>
<li class="<%= params[:controller] == "forums" ? " active" : "" %>"><%= link_to "交流问答", forums_path %></li>
<% if User.current.ec_school.present? %>
<li class="<%= ecs_controller.include?(params[:controller]) ? " active" : "" %>" id="ec_banner">
<%= link_to "认证", department_ecs_path(:school_id => User.current.ec_school) %>
<%= link_to "工程认证", department_ecs_path(:school_id => User.current.ec_school) %>
</li>
<% end %>
</ul>
@ -51,7 +51,7 @@
<span class="bor-bottom-greyE currentName task-hide"><%= User.current.show_name %></span>
<li><%= link_to '我的课堂', user_path(User.current) %></li>
<li><%= link_to '我的实训', user_path(User.current, :type => 'a_shixun') %></li>
<li><%= link_to '我的实课程', user_path(User.current, :type => 'a_path') %></li>
<li><%= link_to '我的实课程', user_path(User.current, :type => 'a_path') %></li>
<% if User.current.partner.present? %>
<li><%= link_to '客户管理', partner_list_cooperate_path(User.current.partner) %></li>
<% end %>
@ -75,7 +75,7 @@
<ul class="fl with50 edu-txt-center pr ul-leftline">
<li><%= link_to '新建课堂', new_course_path() %></li>
<li><%= link_to '新建实训', new_shixun_path() %></li>
<li><%= link_to '新建实课程', new_subject_path() %></li>
<li><%= link_to '新建实课程', new_subject_path() %></li>
<li><%= link_to '新建项目', new_project_path() %></li>
</ul>
<ul class="fl with50 edu-txt-center">

@ -3,7 +3,7 @@
<div class="head-nav pr">
<ul id="header-nav">
<li class="active" style="display: none"><%= link_to "首页", home_path %></li>
<li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实课程", subjects_path %></li>
<li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实课程", subjects_path %></li>
<li class="<%= course_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "翻转课堂", courses_path %></li>
<li class="pr <%= shixuns_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "开发社区", shixuns_path %><img src="/images/educoder/hot-h.png" class="nav-img" /></li>
@ -19,8 +19,8 @@
</ul>
</li>
<% end %>
<li class="<%= params[:controller] == "competitions" ? " active" : "" %>"><%= link_to "竞赛", competitions_path %></li>
<li class="<%= params[:controller] == "forums" ? " active" : "" %>"><%= link_to "问答", forums_path %></li>
<li class="<%= params[:controller] == "competitions" ? " active" : "" %>"><%= link_to "在线竞赛", competitions_path %></li>
<li class="<%= params[:controller] == "forums" ? " active" : "" %>"><%= link_to "交流问答", forums_path %></li>
<!--<li><%#= link_to "活动竞赛", competitions_path %></li>-->
</ul>
<div class="posi-search unlogin" id="posi-search" style="display: none" >
@ -62,7 +62,7 @@
<ul class="fl with50 edu-txt-center pr ul-leftline">
<li><%= link_to '新建课堂', new_course_path() %></li>
<li><%= link_to '新建实训', new_shixun_path() %></li>
<li><%= link_to '新建实课程', new_subject_path() %></li>
<li><%= link_to '新建实课程', new_subject_path() %></li>
<li><%= link_to '新建项目', new_project_path() %></li>
</ul>
<ul class="fl with50 edu-txt-center">
@ -76,7 +76,7 @@
<ul class="edu-menu-list" style="top:60px">
<li><%#= link_to '新建课堂', new_course_path() %></li>
<li><%#= link_to '新建实训', new_shixun_path() %></li>
<li><%#= link_to '新建实课程', new_subject_path() %></li>
<li><%#= link_to '新建实课程', new_subject_path() %></li>
<li><%#= link_to '新建项目', new_project_path() %></li>
</ul>
</div>-->

@ -11,7 +11,7 @@
<%= favicon %>
<%= javascript_heads %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'educoder/edu-main', 'educoder/edu-all', 'educoder/magic-check' %>
<%= javascript_include_tag 'educoder/edu_application' %>
<%= javascript_include_tag 'educoder/edu_application', 'edu/application' %>
<script type="text/javascript"
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">

@ -0,0 +1,77 @@
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="utf-8">
<title>
<%= h html_title %>
</title>
<meta name="description" content="高校智能课堂与综合实训平台"/>
<meta name="keywords" content="智能课堂,实训项目"/>
<%= csrf_meta_tag %>
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'css/courses','educoder/magic-check', 'css/edu-common', 'educoder/edu-main', 'educoder/edu-all' %>
<%= javascript_include_tag "avatars", "header", "attachments", 'prettify', "edu/application", 'jquery.datetimepicker.js', 'educoder/edu_application', 'educoder/edu_file' %>
<%= javascript_include_tag "/codemirror/lib/codemirror", "/codemirror/mode/javascript/javascript", "/codemirror/addon/hint/show-hint", "/codemirror/addon/hint/javascript-hint", "/codemirror/addon/selection/active-line", "/codemirror/addon/lint/javascript-lint", "/codemirror/addon/lint/css-lint", "/codemirror/addon/lint/lint", "/codemirror/addon/lint/json-lint", "/editormd/lib/codemirror/addon/lint/css-lint" %>
<%= stylesheet_link_tag "/codemirror/lib/codemirror" %>
<%= stylesheet_link_tag '/editormd/css/editormd' %>
<%= javascript_include_tag '/editormd/editormd', '/editormd/lib/marked.min.js', '/editormd/lib/prettify.min.js', '/editormd/lib/raphael.min.js', '/editormd/lib/underscore.min.js', '/editormd/lib/sequence-diagram.min.js',
'/editormd/lib/flowchart.min.js', '/editormd/lib/jquery.flowchart.min.js', '/editormd/editormd.js' %>
<%= yield :header_tags -%>
<!-- MathJax的配置 -->
<script type="text/javascript" src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showMathMenu: false,
showMathMenuMSIE: false,
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
</head>
<!--add by huang-->
<body onload="prettyPrint();" style="height: 100%;background: #fff">
<div class="newContainer"> <!-- 页面全部内容 -->
<div class="newHeader" id="nHeader"> <!-- 头部 -->
<% if User.current.logged? %>
<%= render :partial => 'layouts/logined_header' %>
<% else %>
<%= render :partial => 'layouts/unlogin_header' %>
<% end %>
</div>
<div class="cl"></div>
<div class="newMain clearfix">
<%= yield %>
<!-------------------侧边提示区域-------------------------->
<%= render :partial => 'users/returnTop_btn' %>
</div>
<!----------------------- 左侧导航栏 ----------------------------->
<%#= render :partial => 'layouts/public_left_info' %>
<%= render :partial => 'layouts/footer' %>
<div class="cl"></div>
<%#= render :partial => 'layouts/new_feedback' %>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<div id="ajax-notice" style="display: none; text-align: center; bottom: 200px; left: 50%; margin-left: -70px; background: #a1a1a1; width: 140px; height: 80px; position: absolute; z-index: 999999;">
<p id="ajax_notice_p" style="text-align: center; color: #fff; font-size: 18px; padding-top: 26px;">分数已保存</p>
</div>
<div id="ajax-modal" style="display:none;"></div>
<%= call_hook :view_layouts_base_body_bottom %>
</div>
</body>
<script>
$(function(){
var message = '<%= flash[:message] %>';
if (message.length > 0) {
sure_confirm_box("提示",450,200,message);
}
})
</script>
</html>

@ -63,12 +63,12 @@
<!--<li><%#= link_to "镜像类别图片",mirror_picture_shixuns_path %></li>-->
</ul>
</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">
<li style="width: 120px"><%= link_to "实课程等级体系", subject_level_system_managements_path %></li>
<li style="width: 120px"><%= link_to "实课程列表", class_shixuns_managements_path %></li>
<li style="width: 120px"><%= link_to "实课程配置", subject_setting_list_managements_path %></li>
<li style="width: 120px"><%= link_to "已发布实课程", class_publish_shixuns_managements_path %></li>
<li style="width: 120px"><%= link_to "实课程等级体系", subject_level_system_managements_path %></li>
<li style="width: 120px"><%= link_to "实课程列表", class_shixuns_managements_path %></li>
<li style="width: 120px"><%= link_to "实课程配置", subject_setting_list_managements_path %></li>
<li style="width: 120px"><%= link_to "已发布实课程", class_publish_shixuns_managements_path %></li>
</ul>
</li>
<li class="fl edu-admin-nav-li edu-position <%= 'active' if @menu_type == 13 %>"><a href="<%= career_list_managements_path %>" class="edu-admin-nav-a">职业路径</a></li>
@ -115,7 +115,8 @@
<li><%= link_to "部门审批", depart_managements_path %></li>
<li><%= link_to '单位审批', unit_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>
<li><%= link_to '教学案例发布', library_applies_path(status: :pending) %></li>
</ul>
</li>
<li class="fl edu-admin-nav-li edu-position"><a href="javascript:void(0);" class="edu-admin-nav-a">认证+</a>
@ -137,7 +138,7 @@
<li style="width: 120px"><%= link_to "技术体系", tech_system_managements_path %></li>
<li style="width: 120px"><%= link_to "升级通知", update_notice_managements_path %></li>
<li style="width: 120px"><%= link_to "门户banner设置", setting_banner_managements_path %></li>
<li style="width: 120px"><%= link_to "2018培训会", training_2018_managements_path %></li>
<li style="width: 120px"><%= link_to "培训会", training_2018_managements_path %></li>
</ul>
</li>
</ul>

@ -18,7 +18,6 @@
<%= yield :header_tags -%>
</head>
<!--add by huang-->
<body onload="prettyPrint();">
<div class="newContainer">
<div class="newHeader" id="nHeader">

@ -0,0 +1,125 @@
<p class="lineh-25 font-22 mb20">上传教学案例</p>
<div class="library-form-container">
<%= form_for(@library) do |f| %>
<%= hidden_field_tag :apply_publish, false %>
<div class="edu-back-white">
<div class="padding30">
<div class="clearfix mb20">
<span class="upload_Title">标题</span>
<li class="fl">
<%= f.text_field :title, placeholder: '例如:软件工程教学案例', class: 'greyInput winput-300-35 mr20 fl' %>
<p style="height:20px;line-height:20px;"><span class="color-red none" id="title_notice">请输入标题</span></p>
</li>
<span class="color-grey-c font-12 fl mt6">简明扼要介绍文档/视频所包含的主要的内容</span>
</div>
</div>
<div class="padding30 bor-top-greyE">
<div class="clearfix df">
<span class="upload_Title">描述</span>
<div class="flex1">
<div id="libraries_description" style="margin:0px">
<%= f.text_area :content %>
</div>
<p style="height:22px;line-height:22px;"><span class="color-red none" id="des_notice">请输入描述内容</span></p>
</div>
</div>
<div>
<%= render partial: 'attachments/from_libraries', locals: { container: @library } %>
<p s
tyle="height:22px;line-height:22px;"><span class="color-red none" id="file_notice">请上传附件</span></p>
</div>
</div>
<div class="padding30 bor-top-greyE">
<li class="lineh-25 color-grey-6 font-18 mb20">审核说明</li>
<ul class="font-16">
<li>平台管理员将对每天新上传的文档进行审核,审核通过的文档将公开显示,否则将私有化或移除</li>
</ul>
</div>
<div class="padding30 bor-top-greyE">
<li class="lineh-25 color-grey-6 font-18 mb20">温馨提示</li>
<ul class="font-16">
<li>1.请勿上传已设置加密口令的文档资源;</li>
<li>2.可以上传符合教学案例标准的文档资料,如<a class="color-blue" target="_blank" href="https://www.educoder.net/boards/5909/topics/34799">案例入库标准</a>、<a target="_blank" class="color-blue" href="https://www.educoder.net/boards/5909/topics/34798">案例使用说明书</a>以及其他资料等上传支持的文件最大容量100MB</li>
<li>3.请确保上传内容无侵权或违反国家关于互联网政策的不良行为;</li>
<li>4.请使用ChromeFirefoxSafariIE11及以上版本浏览器</li>
</ul>
</div>
</div>
<div class="operate mt20 mb20 clearfix">
<% unless @library.published? %>
<%= link_to '申请发布', 'javascript:void(0)', class: 'white-btn edu-blueback-btn changebtn mr20 fl apply-publish-btn' %>
<% end %>
<%= link_to '保存', 'javascript:void(0)', class: 'white-btn edu-blueline-btn changebtn mr20 fl submit-btn' %>
</div>
<% end %>
</div>
<script>
/* ------------------------------- 描述md ------------------------------*/
editormd("libraries_description", {
width: "100%",
height: 210,
syncScrolling: "single",
//你的lib目录的路径我这边用JSP做测试的
path: "/editormd/lib/",
tex: true,
watch:false,
toolbarIcons: function () {
// Or return editormd.toolbarModes[name]; // full, simple, mini
// Using "||" set icons align right.
return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"]
},
toolbarCustomIcons: {
testIcon: "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>",
testIcon1: "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>"
},
//这个配置在simple.html中并没有但是为了能够提交表单使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中方便post提交表单。
saveHTMLToTextarea: true,
autoFocus: false,
// 用于增加自定义工具栏的功能可以直接插入HTML标签不使用默认的元素创建图标
dialogMaskOpacity: 0.6,
placeholder: "请添加描述",
imageUpload: true,
imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"],
imageUploadURL: "<%= upload_with_markdown_path(container_id: 0, container_type: 'MarkDown') %>" //url
});
var submitForm = function(){
var title = $("input[name='library[title]']").val();
var content = $("textarea[name='library[content]']").val();
if (!title || title.length == 0) {
$("#title_notice").removeClass("none");
return
}else{
$("#title_notice").addClass("none");
}
if (!content || content.length == 0) {
$("#des_notice").removeClass("none");
return
}else{
$("#des_notice").addClass("none");
}
if($('.attachments_fields .attachment').length == 0){
$("#file_notice").removeClass("none");
return
}else{
$("#file_notice").addClass("none");
}
$('.library-form-container form').submit();
};
$(function(){
$('.apply-publish-btn').on('click', function(){
$("input[name='apply_publish']").val(true);
submitForm();
});
$('.submit-btn').on('click', submitForm);
});
</script>

@ -0,0 +1,32 @@
<div class="library_list">
<% if @libraries.present? %>
<% @libraries.each do |library| %>
<li class="library_list_item">
<%= link_to image_tag(url_to_avatar(library.user), width: 50, height: 50, class: 'radius mr15 mt3'), user_path(library.user) %>
<div class="flex1">
<p class="task-hide font-16 mb15 lineh-20"><%= link_to library.title, library_path(library) %></p>
<p class="clearfix lineh-20">
<span class="color-grey-3 mr20"><%= link_to library.user.show_real_name, user_path(library.user) %></span>
<span class="color-grey-c mr20"><%= library.visited_count || 0 %> 浏览</span>
<% if params[:type] == 'mine' %>
<span class="color-grey-c mr20">上传时间:<%= library.created_at.strftime('%Y-%m-%d %H:%M') %></span>
<% else %>
<span class="color-grey-c mr20">发布时间:<%= library.published_at.try(:strftime, '%Y-%m-%d %H:%M') %></span>
<% end %>
</p>
</div>
</li>
<% end %>
<% else %>
<%= render :partial => "welcome/no_data" %>
<% end %>
</div>
<div class="mt30 mb50 edu-txt-center clearfix">
<!--这里放分页-->
<div class="inline pages_user_show">
<ul>
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>

@ -0,0 +1,8 @@
<div class="educontent mb50">
<p class="mt10 mb20 clearfix lineh-20">
<%= link_to '教学案例', libraries_path, class: 'color-grey-9' %> &gt;
<span class="color-grey-3">编辑</span>
</p>
<%= render partial: 'form' %>
</div>

@ -0,0 +1,52 @@
<img src="/images/educoder/teach_ex.png" width="100%"/>
<div class="educontent">
<div class="edu-back-white mb30 mt30">
<p class="padding20-30 clearfix bor-bottom-greyE">
<span class="font-18 fl color-grey-3">教学案例</span>
<%= link_to '新建', new_library_path, class: 'fr color-blue font-16 mt3' %>
</p>
<div class="clearfix pt20 pl30 pr30">
<ul class="fl library_nav">
<li class="<%= params[:type] == 'mine' ? '' : 'active' %>">
<%= link_to '全部', libraries_path(search: params[:search]), remote: true %>
</li>
<li class="<%= params[:type] == 'mine' ? 'active' : '' %>">
<%= link_to '我的', libraries_path(search: params[:search], type: 'mine'), remote: true %>
</li>
</ul>
<div class="edu-position fr">
<%= hidden_field_tag(:type, params[:type]) %>
<input class="winput-300-35 panel-box-sizing" placeholder="输入教学案例标题、编号进行检索" type="text" id="search_name">
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey" id="search"><i class="fa fa-search"></i></a>
</div>
</div>
</div>
<div class="library-list-container">
<%= render partial: 'library_list' %>
</div>
</div>
<script>
$(function(){
$(".library_nav").on("click","li",function(){
$(".library_nav li").removeClass("active");
$(this).addClass("active");
});
var searchFunc = function() {
var search = $("#search_name").val();
var type = $("input[name='type']").val();
$.ajax({
url: "<%= libraries_path %>",
dataType: 'script',
data: {search: search, type: type}
});
};
$("#search").live("click", searchFunc);
$('#search_name').bind('keypress',function(event) {
if (event.keyCode == "13") {
searchFunc();
}
});
})
</script>

@ -0,0 +1,3 @@
$('input[name="type"]').val('<%= params[:type].to_s %>');
$('#search_name').val('<%= params[:search].to_s %>');
$('.library-list-container').html('<%= j render(partial: 'library_list') %>')

@ -0,0 +1,8 @@
<div class="educontent mb50">
<p class="mt10 mb20 clearfix lineh-20">
<%= link_to '教学案例', libraries_path, class: 'color-grey-9' %> &gt;
<span class="color-grey-3">新建</span>
</p>
<%= render partial: 'form' %>
</div>

@ -0,0 +1,14 @@
<div class="educontent edu-back-white mt20 successPage">
<div>
<img src="/images/educoder/success.png" width="100" class="mb30">
<div class="lineh-30 ed-txt-center font-24 color-grey-3 font-bd mb15">
<p>恭喜!</p>
<p>文档上传成功</p>
</div>
<p class="lineh-30 ed-txt-center font-16 color-grey-9 font-bd mb15">通过平台管理员审核后,即可公开显示</p>
<li class="inline">
<%= link_to '查看已上传文档', libraries_path(type: 'mine'), class: 'white-btn edu-blueline-btn changebtn mr20 fl' %>
<%= link_to '继续上传', new_library_path, class: 'white-btn edu-blueback-btn changebtn fl' %>
</li>
</div>
</div>

@ -0,0 +1,137 @@
<%
admin_or_self = admin_or_business? || @library.user_id == User.current.id
%>
<div class="educontent mb50">
<p class="mt10 mb20 clearfix lineh-20">
<%= link_to '教学案例', libraries_path, class: 'color-grey-9' %> &gt;
<span class="color-grey-3">详情</span>
</p>
<p class="lineh-25 mb20 clearfix">
<span class="font-22 fl mr10 task-hide" style="max-width: 800px"><%= @library.title %></span>
<% if admin_or_self %>
<% if @library.pending? %>
<span class="fl edu-filter-btn edu-activity-green mt5">草稿</span>
<% elsif @library.processing? %>
<span class="fl edu-filter-btn edu-activity-green mt5">审核中</span>
<% elsif @library.refused? %>
<span class="fl edu-filter-btn edu-activity-orange mt5">未通过</span>
<% end %>
<% end %>
<%= link_to('返回', libraries_path, class: 'fr color-grey-9 mt5') %>
</p>
<div class="edu-back-white">
<% if admin_or_self && !@library.published? && @library_applies.size > 0 %>
<div class="padding30 bor-bottom-greyE">
<p class="mb10 clearfix">
<span class="color-grey-6 font-16 mr10">私有化原因</span>
<span class="color-grey-c font-12">(请按照提示修改,并在完成编辑后重新提交)</span>
<a href="javascript:void(0)" class="color-blue fr" id="actionPanel" at="0" onclick="getMore(this)"></a>
<div class="private_reason">
<ul id="private_reason_ul">
<% @library_applies.each do |apply| %>
<li>
<p class="color-grey-9"><%= apply.updated_at.strftime('%Y-%m-%d %H:%M') %></p>
<p class="lineh-25 font-16 break-word"><%= apply.reason %></p>
</li>
<% end %>
</ul>
</div>
</div>
<% end %>
<div class="padding30">
<p class="mb10 clearfix">
<span class="color-grey-6 font-16 mr10">详情</span>
<% if admin_or_business? || @library.user_id == User.current.id && @library.pending? %>
<%= link_to '删除', 'javascript:void(0);', data: { id: @library.id },
class: 'white-btn edu-blueline-btn fr ml20 delete-btn' %>
<% end %>
<% if admin_or_self %>
<%= link_to '编辑', edit_library_path(id: @library.id), class: 'white-btn edu-blueline-btn fr' %>
<% end %>
</p>
<div class="df mb20">
<%= link_to image_tag(url_to_avatar(@library.user), width: 50, height: 50, class: 'radius mr15 mt3'), user_path(@library.user) %>
<div class="flex1">
<li class="font-16"><%= @library.user.show_real_name %></li>
<li class="clearfix">
<span class="fl color-grey-9 mr20"><%= @library.user.school_name %></span>
<span class="fl color-grey-9"><%= @library.user.identity %></span>
<span class="fr">
<span class="fl color-grey-9 mr30">编码:<span class="color-grey-6"><%= @library.uuid %></span></span>
<% if @library.published? %>
<span class="fl color-grey-9">发布时间:<span class="color-grey-6"><%= @library.published_at.strftime('%Y-%m-%d %H:%M') %></span></span>
<% else %>
<span class="fl color-grey-9">上传时间:<span class="color-grey-6"><%= @library.created_at.strftime('%Y-%m-%d %H:%M') %></span></span>
<% end %>
</span>
</li>
</div>
</div>
<div>
<div class="break_full_word new_li" id="labraries_editorMd_content" style="box-sizing: border-box">
<textarea style="display:none;"><%= @library.content %></textarea>
</div>
<div class="mt10">
<%= render partial: 'attachments/links', locals: { attachments: @library.attachments, options: {} } %>
</div>
</div>
</div>
</div>
</div>
<script>
function getMore(item) {
var at=$(item).attr("at");
var one=parseInt($("#private_reason_ul").find("li").eq(0).height())+10;
var two=parseInt($("#private_reason_ul").find("li").eq(1).height());
var plus=one+two;
if(at=="0"){
$(item).html('点击收起<i class="iconfont icon-shangjiantou color-blue font-14 ml5"></i>');
$(item).attr("at","1");
$(".private_reason").css({maxHeight:"unset"});
}else{
$(item).html('点击展开<i class="iconfont icon-xiajiantou color-blue font-14 ml5"></i>');
$(item).attr("at","0");
$(".private_reason").css({maxHeight:plus+"px"});
}
}
var homeworkDescr = editormd.markdownToHTML("labraries_editorMd_content", {
htmlDecode: "style,script,iframe", // you can filter tags decode
taskList: true,
tex: true, // 默认不解析
flowChart: true, // 默认不解析
sequenceDiagram: true // 默认不解析
});
$(function(){
// 删除
$('.delete-btn').on('click', function(){
var id = $(this).data('id');
op_confirm_tip_1("是否确认删除?", "destroyLibrary(" + id + ");")
});
if ($('#private_reason_ul').length != 0) {
var height=document.getElementById("private_reason_ul").offsetHeight;
var one=parseInt($("#private_reason_ul").find("li").eq(0).height())+10;
var two=parseInt($("#private_reason_ul").find("li").eq(1).height());
var plus=one+two;
if(parseInt(height)>166){
$("#actionPanel").html('点击展开<i class="iconfont icon-xiajiantou color-blue font-14 ml5"></i>');
$(".private_reason").css({maxHeight:plus+"px"});
}
}
})
function destroyLibrary (id) {
$.ajax({
type: "DELETE",
url: "<%= libraries_path %>/" + id,
success: function (data) {
if(data && data.status == 0){
notice_box_redirect("<%= libraries_path %>", "删除成功");
} else {
notice_box(data.message);
}
}
});
}
</script>

@ -3,11 +3,12 @@
<table class="edu-pop-table interval-td edu-txt-center clearfix color-dark" cellspacing="0" cellpadding="0">
<thead>
<th>序号</th>
<th width="22%">竞赛名称</th>
<th>开始时间</th>
<th>截止时间</th>
<th width="15%">竞赛名称</th>
<th width="10%">副标题</th>
<th width="10%">开始时间</th>
<th width="10%">截止时间</th>
<th width="18%">竞赛活动图</th>
<th>创建时间<a href="javascript:void(0)" onclick="changeTimeArray(this);" data-index=0><i class="iconfont icon-xiajiang color-green font-14 ml3"></i></a>
<th width="10%">创建时间<a href="javascript:void(0)" onclick="changeTimeArray(this);" data-index=0><i class="iconfont icon-xiajiang color-green font-14 ml3"></i></a>
</th>
<th>操作</th>
</thead>
@ -20,10 +21,14 @@
<input type="text" class="input-100-35 mt5 mb5 none editTitlevalue" id="edit_competition_name_<%= competition.id %>" placeholder="请输入竞赛名称" value="<%= competition.name %>"/>
</td>
<td>
<input type="text" placeholder="请选择开始时间" id="edit_start_time_<%= competition.id %>" class="winput-200-35 mt5 mb5 game_begin_time" value="<%= format_time competition.start_time %>"/>
<p class="break_word showSubTitlevalue" style="max-width: 263px"><%= competition.sub_title %></p>
<input type="text" class="input-100-35 mt5 mb5 none editSubTitlevalue" id="edit_competition_sub_title_<%= competition.id %>" placeholder="请输入副标题" value="<%= competition.sub_title %>"/>
</td>
<td>
<input type="text" placeholder="请选择结束时间" id="edit_end_time_<%= competition.id %>" class="winput-200-35 mt5 mb5 game_end_time" value="<%= format_time competition.end_time %>"/>
<input type="text" placeholder="请选择开始时间" id="edit_start_time_<%= competition.id %>" class="winput-150-30 mt5 mb5 game_begin_time" value="<%= format_time competition.start_time %>"/>
</td>
<td>
<input type="text" placeholder="请选择结束时间" id="edit_end_time_<%= competition.id %>" class="winput-150-30 mt5 mb5 game_end_time" value="<%= format_time competition.end_time %>"/>
</td>
<td>
<%= file_field_tag 'avatar[image]',
@ -101,9 +106,10 @@
function setCompetition() {
if($("#addLine").length == 0){
var html = '<tr id="addLine"><td></td><td>' +
'<input type="text" class="input-100-35 mt5 mb5" name="com_name" id="inputTitlevalue" placeholder="请输入竞赛名称"/>' +
'</td><td><input type="text" placeholder="请选择开始时间" autocomplete="off" readonly name="start_time" class="winput-200-35 mt5 mb5 game_begin_time"/></td>' +
'<td><input type="text" placeholder="请选择结束时间" autocomplete="off" readonly name="end_time" class="winput-200-35 mt5 mb5 game_end_time"/></td>' +
'<input type="text" class="input-100-35 mt5 mb5" name="com_name" id="inputTitlevalue" placeholder="请输入竞赛名称"/></td>' +
'<td><input type="text" class="input-100-35 mt5 mb5" name="com_sub_title" id="inputSubTitlevalue" placeholder="请输入副标题"/>' +
'</td><td><input type="text" placeholder="请选择开始时间" autocomplete="off" readonly name="start_time" class="winput-150-30 mt5 mb5 game_begin_time"/></td>' +
'<td><input type="text" placeholder="请选择结束时间" autocomplete="off" readonly name="end_time" class="winput-150-30 mt5 mb5 game_end_time"/></td>' +
'<td colspan="3" class="edu-txt-right">' +
'<a href="javascript:void(0)" class="mr10" onclick="cancelAdd();">取消</a>' +
'<a href="javascript:void(0)" class="mr10" onclick="saveAdd();" data-status="0">保存</a>' +
@ -136,7 +142,8 @@
return;
} else{
$.post("<%= new_competition_competitions_path %>",
{"com_name": $("#inputTitlevalue").val().trim(), "start_time": $("input[name='start_time']").val().trim(),
{"com_name": $("#inputTitlevalue").val().trim(), "sub_title": $("#inputSubTitlevalue").val().trim()
, "start_time": $("input[name='start_time']").val().trim(),
"end_time": $("input[name='end_time']").val().trim()});
}
}
@ -158,6 +165,8 @@
var trIndex = $(item).parents("tr");
$(trIndex).find(".editTitlevalue").removeClass("none").focus();
$(trIndex).find(".showTitlevalue").addClass("none");
$(trIndex).find(".editSubTitlevalue").removeClass("none");
$(trIndex).find(".showSubTitlevalue").addClass("none");
$(item).hide();
$(item).next().show();
$(item).next().next().show();
@ -166,6 +175,7 @@
// 保存
function update_competition(id){
var $competition = $("#edit_competition_name_"+id);
var $competitionSubTitle = $("#edit_competition_sub_title_"+id);
if($competition.val().trim() == ""){
$competition.focus();
} else {
@ -175,7 +185,11 @@
url: "/competitions/"+id+"/edit_competition",
type: "POST",
datatype: "script",
data:{com_name: $competition.val().trim(), start_time: start_time, end_time: end_time}
data:{
com_name: $competition.val().trim(),
sub_title: $competitionSubTitle.val().trim(),
start_time: start_time, end_time: end_time
}
});
}
}

@ -68,13 +68,29 @@
<% end %>
<% if com_module.name == "报名" %>
<div class="fl ContentFillinthebox">
<input type="text" autocomplete="off" class="Other_boxinput" name="min_num" placeholder="1" value="<%= @competition.min_num %>"/> ~
<input type="text" autocomplete="off" class="Other_boxinput" name="max_num" placeholder="1" value="<%= @competition.max_num %>"/> 人
</div>
<div class="fl ml20">
<span>报名截止:</span>
<input type="text" class="winput-240-30" readonly placeholder="请选择截止时间" value="<%= format_time @competition.enroll_end_time %>" name="enroll_end_time" id="enroll_end_time"/>
<div class="fl">
<div class="ContentFillinthebox mb10">
<span>报名截止时间:</span>
<input type="text" class="winput-240-30" readonly placeholder="请选择截止时间" value="<%= format_time @competition.enroll_end_time %>" name="enroll_end_time" id="enroll_end_time"/>
</div>
<div class="competition-staff">
<div>报名要求:<i class="fa fa-plus-circle color-green font-16 ml10 add-competition-staff-btn"></i></div>
<div class="competition-staff-settings mb10 ml30">
<% @competition.competition_staffs.each do |staff| %>
<div class="competition-staff-row mb10">
<%= select_tag('competition_staffs[][category]', options_for_select(CompetitionStaff.category_options, staff.category), class: 'winput-120-30') %>
<input type="text" autocomplete="off" class="Other_boxinput" name="competition_staffs[][minimum]" value="<%= staff.minimum %>"/>
&nbsp;&nbsp;~&nbsp;&nbsp;
<input type="text" autocomplete="off" class="Other_boxinput" name="competition_staffs[][maximum]" value="<%= staff.maximum %>"/>
<span class="competition-staff-operate ml10">
<i class="fa fa-trash-o ml5 font-16 delete-icon"></i>
<i class="fa fa-plus-circle color-green font-16 ml10 add-icon"></i>
</span>
</div>
<% end %>
</div>
</div>
</div>
<% end %>
<% if com_module.name != "首页" && com_module.name != "报名" && com_module.name != "通知公告" && com_module.name != "排行榜" %>
@ -149,6 +165,20 @@
</div>
</div>
<div class="competition-staff-row-example" style="display: none">
<div class="competition-staff-row mb10">
<%= select_tag('competition_staffs[][category]', options_for_select(CompetitionStaff.category_options, ''), class: 'winput-120-30') %>
<input type="text" autocomplete="off" class="Other_boxinput" name="competition_staffs[][minimum]" value="1"/>
&nbsp;&nbsp;~&nbsp;&nbsp;
<input type="text" autocomplete="off" class="Other_boxinput" name="competition_staffs[][maximum]" value="1"/>
<span class="competition-staff-operate ml10">
<i class="fa fa-trash-o ml5 font-16 delete-icon"></i>
<i class="fa fa-plus-circle color-green font-16 ml10 add-icon"></i>
</span>
</div>
</div>
<% content_for :header_tags do %>
@ -504,4 +534,17 @@
}
})
}
$(function(){
$('.add-competition-staff-btn').on('click', function(){
$('.competition-staff-settings').append($('.competition-staff-row-example').html());
});
$('.competition-staff-settings').on('click', '.add-icon', function(){
$('.competition-staff-settings').append($('.competition-staff-row-example').html());
});
$('.competition-staff-settings').on('click', '.delete-icon', function(){
$(this).parents('.competition-staff-row').remove();
});
})
</script>

@ -0,0 +1,78 @@
<% if @library_applies.present? %>
<% @library_applies.each do |apply| %>
<% user = apply.library.user %>
<% library = apply.library %>
<div class="admin-con-box apply-<%= apply.id %> clearfix">
<a href="<%= user_path(user) %>" target="_blank" class="fl with10 edu-ad-user">
<%= image_tag(url_to_avatar(user), :class => "fl with10 edu-ad-user", :alt => "头像", :width => "50", :height => "50" ) %>
</a>
<div class="fl with90">
<ul>
<li class="clearfix mb5">
<a href="<%= user_path(user) %>" class="fl"><%= user.try(:show_real_name) %></a>
<span class="fl ml30 font-12 mt3 color-grey"><%= time_from_now(apply.created_at) %></span>
<% if apply.pending? %>
<a href="javascript:void(0);" class="fr color-orange" onclick="reject_library_authentication_reason(this);" >拒绝</a>
<a href="javascript:void(0);" class="fr mr15 color-orange" data-remote="true" onclick="library_authorization_gree('<%= apply.id %>');">同意</a>
<% else %>
<a href="javascript:void(0);" class="<%= apply.agreed? ? 'task-btn-green' : '' %> task-btn fr"><%= apply.agreed? ? "已同意" : "已拒绝" %></a>
<% end %>
</li>
<li class="clearfix mb10">
<%= link_to library.title, library_path(library), :target => "_blank" %>
<br>
<%= library.content[0..100] %>
</li>
<% if apply.pending? %>
<div class="undis">
<li class="clearfix edu-form-border mb10">
<label class="edu-form-label fl">原因:</label>
<input type="text" class="task-form-90 task-height-40 panel-box-sizing fl edu-form-noborder" placeholder="我得说点儿什么最多200个字符">
</li>
<li class="clearfix">
<a href="javascript:void(0);" class="task-btn task-btn-orange fr" onclick="library_submit_reject_reason('<%= apply.id %>', this);" >确定</a>
<a href="javascript:void(0);" class="task-btn fr mr10" onclick="library_hide_reject_reason(this);" >取消</a>
</li>
</div>
<% else %>
<% if apply.refused? %>
<li>原因:<span class="color-orange"><%= apply.reason %></span></li>
<% end %>
<% end %>
</ul>
</div>
</div>
<% end %>
<div class="mt20 mb20" style="text-align:center;">
<div class="pages_user_show" style="width:auto; display:inline-block;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
<% else %>
<%= render :partial => "welcome/no_data" %>
<% end %>
<script type="text/javascript">
function library_authorization_gree(id){
$.ajax({
url: '/managements/library_applies/' + id + '/agree',
type: 'post',
success: function(data){
if (data && data.status != -1) {
$('#authentication_list .admin-con-box.apply-' + id).remove();
if($('#authentication_list .admin-con-box').length == 0){
location.reload();
}
} else {
alert(data.message);
}
}
})
}
</script>

@ -0,0 +1,120 @@
<div class="edu-class-container mb15">
<div class="edu-con-top clearfix">
<p class="ml15 fl color-grey">教学案例发布</p>
</div>
<div class="edu-con-bg01 mt15">
<div class="edu-tab clearfix mb20">
<ul id="edu-tab-nav" class="border-bottom-orange">
<li id="edu-tab-nav-1" class="new-tab-nav background-orange" onclick="HoverLi(1);">
<%= link_to "待审批", library_applies_path(status: :pending), class: 'tab_type', remote: true %>
</li>
<li id="edu-tab-nav-2" class="new-tab-nav" onclick="HoverLi(2);">
<%= link_to "已审批", library_applies_path(status: [:refused, :agreed]), class: 'tab_type', remote: true %>
</li>
</ul>
<div class="cl"></div>
<div id="edu-tab-con-1">
<div class="mt10">
<div class="edu-position fr task-form-30 mb10 mr15">
<input class="task-form-100 panel-box-sizing" placeholder="输入教学案例标题、编号进行检索" type="text" id="search_name">
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt10" id="search"><i class="fa fa-search"></i></a>
</div>
<div class="cl"></div>
<div id="authentication_list" class="auth_table">
<%= render :partial => "managements/library_applies/library_apply_list"%>
</div>
</div>
</div>
<div id="edu-tab-con-2" class="undis">
<div class="mt10">
<p class="fl task-form-60 mt8 ml15 clearfix">
<%= link_to "全部", library_applies_path(status: [:refused, :agreed]), :class => "edu-filter-cir-grey mr5 fl font-12 active", :id => "library_all_authentication", :remote => true %>
<%= link_to "同意", library_applies_path(status: :agreed), :class => "edu-filter-cir-grey mr5 fl font-12", :id => "library_agree_authentication", :remote => true %>
<%= link_to "拒绝", library_applies_path(status: :refused), :class => "edu-filter-cir-grey mr5 fl font-12", :id => "library_reject_authentication", :remote => true %>
</p>
<div class="edu-position fr task-form-30 mb10 fr mr15">
<input class="task-form-100 panel-box-sizing" placeholder="输入教学案例标题、编号进行检索" type="text" id="library_search_name">
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt10" id="library_search"><i class="fa fa-search"></i></a>
</div>
<div class="cl"></div>
<div id="library_authentication_list" class="auth_table">
</div>
</div>
</div>
<div class="cl"></div>
</div>
</div>
</div>
<script>
/* -------------------------- 拒绝 ------------------------------------ */
function reject_library_authentication_reason(nThis){
var reason = $(nThis).parent().parent().find('div');
reason.find("input").val("");
reason.toggle();
}
/* -------------------------- 取消 ------------------------------------ */
function library_hide_reject_reason(nThis){
var reason = $(nThis).parent().parent();
reason.find("input").val("");
reason.hide();
}
/* ------------------------- 提交拒绝原因 --------------------------------- */
function library_submit_reject_reason(id, nThis){
var nReason = $(nThis).parent().parent();
var reason = nReason.find("input").val();
if (reason == '') {
alert('请输入原因');
return;
}
$.ajax({
url: '/managements/library_applies/' + id + '/refuse',
type: 'post',
data: {reason: reason},
success: function(data){
if (data && data.status != -1) {
$('#authentication_list .admin-con-box.apply-' + id).remove();
if($('#authentication_list .admin-con-box').length == 0){
location.reload();
}
} else {
alert(data.message);
}
}
});
}
/* -------------------------- 按名字进行搜索(未审批) ----------------------------- */
$("#search").live("click", function(){
var iName = $("#search_name").val();
$.ajax({
url: "/managements/library_applies",
dataType: 'script',
data: { search: iName, status: 'pending' }
});
});
/* ------------------- 按名字进行搜索(已审批)-------------------- */
$("#library_search").live("click", function(){
var iName = $("#library_search_name").val();
var id = $("#library_all_authentication").parent().find(".active").attr("id");
var status = '';
if(id == "library_all_authentication"){
status = ['refused', 'agreed'];
}else if(id=="library_agree_authentication"){
status = 'agreed';
}else{
status = 'refused';
}
$.ajax({
url: "/managements/library_applies",
dataType: 'script',
data: { search: iName, status: status}
});
});
</script>

@ -0,0 +1,30 @@
var nTabIcon_1 = $("#edu-tab-con-1");
var nTabIcon_2 = $("#edu-tab-con-2");
var nTabNav_1 = $("#edu-tab-nav-1");
var nTabNav_2 = $("#edu-tab-nav-2");
var nAudit = $("#library_all_authentication").parent();
<% if params[:status].to_s == 'pending' %>
$("#authentication_list").html("<%= j( render :partial => "managements/library_applies/library_apply_list" ) %>");
nTabNav_1.addClass("background-orange");
nTabNav_2.removeClass("background-orange");
nTabIcon_1.show();
nTabIcon_2.hide();
<% else %>
$("#library_authentication_list").html("<%= j( render :partial => "managements/library_applies/library_apply_list" ) %>");
nTabNav_1.removeClass("background-orange");
nTabNav_2.addClass("background-orange");
nTabIcon_1.hide();
nTabIcon_2.show();
/* -------------------------- 未审批(全部、同意、拒绝点击时动态样式) ------------------------------ */
if(<%= params[:status].to_s == 'agreed' %>){
nAudit.find(".active").removeClass("active");
$("#library_agree_authentication").addClass("active");
}else if(<%= params[:status].to_s == 'refused' %>){
nAudit.find(".active").removeClass("active");
$("#library_reject_authentication").addClass("active");
}else{
nAudit.find(".active").removeClass("active");
$("#library_all_authentication").addClass("active");
}
<% end %>

@ -19,8 +19,7 @@
<thead>
<tr>
<th width="6%">序号</th>
<th width="10%">ID</th>
<th width="20%" class="edu-txt-left">单位名称</th>
<th width="30%" class="edu-txt-left">单位名称</th>
<th width="22%">时段一<br><%= "#{params[:begin_date]} 05:00至#{(Time.zone.parse(params[:end_date]) + 1.days).strftime('%Y-%m-%d')} 05:00" %></th>
<th width="22%">时段二<br><%= "#{params[:other_begin_date]} 05:00至#{(Time.zone.parse(params[:other_end_date]) + 1.days).strftime('%Y-%m-%d')} 05:00" %></th>
<th width="20%" colspan="2">
@ -33,8 +32,10 @@
<% @reports.each_with_index do |report, index| %>
<tr>
<td><%= (@obj_pages.page - 1) * @obj_pages.per_page + index + 1 %></td>
<td><%= report.school_id %></td>
<td class="edu-txt-left"><%= report.school_name %></td>
<td class="edu-txt-left">
<%= link_to report.school_name, statistics_college_path(id: report.school_id),
target: '_blank', data: { tip_down: '点击查看学校统计概况'} %>
</td>
<td><%= report['total'] %></td>
<td><%= report['other_total'] %></td>
<%

@ -20,9 +20,7 @@
<thead>
<tr>
<th width="6%">序号</th>
<th width="10%">ID</th>
<th width="24%" class="edu-txt-left">单位名称</th>
<th width="12%"><%= sort_tag('新增教师', name: 'teacher_increase_count', path: school_data_grow_managements_path) %></th>
<th width="12%"><%= sort_tag('新增学生', name: 'student_increase_count', path: school_data_grow_managements_path) %></th>
<th width="12%"><%= sort_tag('新增课堂', name: 'course_increase_count', path: school_data_grow_managements_path) %></th>
@ -36,8 +34,10 @@
<% @reports.each_with_index do |report, index| %>
<tr>
<td><%= (@obj_pages.page - 1) * @obj_pages.per_page + index + 1 %></td>
<td><%= report.school_id %></td>
<td class="edu-txt-left"><%= report.school_name %></td>
<td class="edu-txt-left">
<%= link_to report.school_name, statistics_college_path(id: report.school_id),
target: '_blank', data: { tip_down: '点击查看学校统计概况'} %>
</td>
<td><%= report.teacher_increase_count.to_i %></td>
<td><%= report.student_increase_count.to_i %></td>
<td><%= report.course_increase_count.to_i %></td>

@ -2,8 +2,7 @@
<thead>
<tr>
<th width="6%">序号</th>
<th width="6%">ID</th>
<th width="12%" class="edu-txt-left">单位名称</th>
<th width="18%" class="edu-txt-left">单位名称</th>
<th width="10%"><%= sort_tag('教师总人数', name: 'teacher_count', path: school_report_managements_path) %></th>
<th width="10%"><%= sort_tag('学生总人数', name: 'student_count', path: school_report_managements_path) %></th>
@ -23,8 +22,7 @@
<% @schools.each_with_index do |school, index| %>
<tr>
<td><%= (@obj_pages.page - 1) * @obj_pages.per_page + index + 1 %></td>
<td><%= school[:id] %></td>
<td class="edu-txt-left"><%= school[:name] %></td>
<td class="edu-txt-left"><%= link_to school[:name], statistics_college_path(id: school[:id]), target: '_blank', data: { tip_down: '点击查看学校统计概况'} %></td>
<td><%= school[:teacher_count].to_i %></td>
<td><%= school[:student_count].to_i %></td>
<td><%= school[:course_count].to_i %></td>

@ -10,7 +10,9 @@
<th>序号</th>
<th>姓名</th>
<th class="with20">分班</th>
<th>学号</th>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<th>学号</th>
<% end %>
<th>提交状态</th>
<th>提交时间</th>
<% if @poll.un_anonymous && @is_teacher %>
@ -29,9 +31,11 @@
<td title="<%= member.try(:course_group_id).to_i == 0 ? '未分班' : member.course_group.name %>">
<span class="task-hide" style="display: block;max-width: 230px;"><%= member.try(:course_group_id).to_i == 0 ? '未分班' : member.course_group.name %></span>
</td>
<td title="<%= poll.user.user_extensions.nil? ? "--" : poll.user.user_extensions.student_id %>">
<%= poll.user.user_extensions.nil? ? "--" : poll.user.user_extensions.student_id %>
</td>
<% if User.current.admin || User.current.member_of_course?(@course) %>
<td title="<%= poll.user.user_extensions.nil? ? "--" : poll.user.user_extensions.student_id %>">
<%= poll.user.user_extensions.nil? ? "--" : poll.user.user_extensions.student_id %>
</td>
<% end %>
<td>
<%= (ex_poll_work_status poll.commit_status).html_safe %>
</td>

@ -11,31 +11,7 @@
TO
<%= link_to activity.project.name.to_s+" | 项目问题", project_issues_path(activity.project), :class => "color-orange05 ml15"%>
</div>
<% if User.current.logged? %>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<%= link_to l(:button_edit), edit_issue_path(activity.id), :class => 'postOptionLink', :accesskey => accesskey(:edit) if activity.editable? && User.current.allowed_to?(:edit_issues, activity.project) %>
</li>
<li>
<% if !defined?(project_id) && !defined?(user_id) %>
<%= link_to l(:button_delete), issue_path(activity.id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'postOptionLink' if User.current.allowed_to?(:delete_issues, activity.project) %>
<% elsif defined?(project_id) %>
<%= link_to l(:button_delete), issue_path(activity.id, :page_classify => "project_page", :page_id => project_id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'postOptionLink' if User.current.allowed_to?(:delete_issues, activity.project) %>
<% elsif defined?(user_id) %>
<%= link_to l(:button_delete), issue_path(activity.id, :page_classify => "user_page", :page_id => user_id), :data => {:confirm => issues_destroy_confirmation_message(activity)}, :method => :delete, :class => 'postOptionLink' if User.current.allowed_to?(:delete_issues, activity.project) %>
<% end %>
</li>
<li>
<%= link_to l(:button_copy), project_copy_issue_path(activity.project, activity), :class => 'postOptionLink' if User.current.allowed_to?(:add_issues, activity.project) %>
</li>
</ul>
</li>
</ul>
</div>
<% end %>
<div class="homepagePostTitle break_word">
<span class="fl">【<%= get_issue_type_new(activity.tracker_id) %>】</span>
@ -61,9 +37,6 @@
</div>
<div class="cl"></div>
</div>
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id => user_activity_id, :content => activity.description} %>
<div id="intro_content_show_<%= user_activity_id %>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
<div id="intro_content_hide_<%= user_activity_id %>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
<div class="cl"></div>
<%# 局部刷新修改xissue属性 %>
<% if User.current.member_of?(activity.project) && !activity.nil? && !activity.status.nil? %>
@ -74,15 +47,10 @@
<% end %>
<% end %>
<div class="cl"></div>
<div class="mb10" style="font-weight:normal;">
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
</div>
</div>
<div class="cl"></div>
</div>
<div id="div_user_issue_reply_<%=user_activity_id%>">
<%= render :partial => 'projects/project_issue_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id} %>
</div>
</div>
<script type="text/javascript">
$(function(){

@ -48,48 +48,10 @@
<div class="mt10" style="font-weight:normal;">
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
</div>
<% if User.current.logged? %>
<div class="homepagePostSetting" id="message_setting_<%= user_activity_id%>" style="display: block">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<% if activity.author.id == User.current.id%>
<li>
<%= link_to(
l(:button_edit),
edit_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board),
:class => 'postOptionLink'
) if activity.editable_by?(User.current) %>
</li>
<li>
<%= link_to(
l(:button_delete),
delete_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board),
:method => :post,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if activity.destroyable_by?(User.current) %>
</li>
<% end %>
<% if hidden_unproject_infos %>
<li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %></li>
<% else %>
<li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send_hidden(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %></li>
<% end %>
</ul>
</li>
</ul>
</div>
<% end %>
</div>
<div class="cl"></div>
</div>
<div class="bor-grey-e edu-back-white">
<div id="activity_post_reply_<%=user_activity_id %>">
<%=render :partial => 'projects/project_message_post_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id} %>
</div>
</div>
</div>
<script type="text/javascript">
$(function(){

@ -40,13 +40,7 @@
<!--缺陷动态-->
<% when "Issue" %>
<%= render :partial => 'projects/act_issues', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :project_id => activity.project_id} %>
<% when "TrainingTask" %>
<% if User.current.admin? || is_project_manager?(User.current.id, @project.id) || is_project_manager?(User.current, @project.try(:forked_from_project_id)) %>
<div id="project_show_training_task_<%= @project.id %>">
<%= render :partial => 'projects/act_training_tasks', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :project_id => activity.project_id} %>
</div>
<% end %>
<!--message-->
<% when "Message" %>
<%= render :partial => 'projects/act_messages', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :is_course => 1, :is_board => 0} %>
<!--Attachment -->

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

Loading…
Cancel
Save