Merge branch 'develop' of http://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
huang 2015-12-11 17:58:37 +08:00
commit 6b9a612594
84 changed files with 1739 additions and 172 deletions

View File

@ -418,6 +418,8 @@ class ApplicationController < ActionController::Base
@project = Project.find(params[:project_id])
elsif params[:course_id]
@course = Course.find(params[:course_id])
elsif params[:org_subfield_id]
@org_subfield = OrgSubfield.find(params[:org_subfield_id])
end
rescue ActiveRecord::RecordNotFound
render_404

View File

@ -240,6 +240,8 @@ class AttachmentsController < ApplicationController
format.html { redirect_to_referer_or respond_path(@attachment.container) }
elsif !@attachment.container.nil? && @attachment.container.is_a?(PhoneAppVersion)
format.html { redirect_to_referer_or mobile_version_path }
elsif !@attachment.container.nil? && @attachment.container.is_a?(OrgSubfield)
format.html {redirect_to_referer_or org_subfield_files_path(@attachment.container)}
else
if @project.nil?
format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) }

View File

@ -18,13 +18,13 @@ class ExerciseController < ApplicationController
end_exercises.each do |exercise|
exercise.update_column('exercise_status', 3)
end
if @course.is_public == 0 && !User.current.member_of_course?(@course)
if @course.is_public == 0 && !(User.current.member_of_course?(@course)||User.current.admin?)
render_403
return
end
remove_invalid_exercise(@course)
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
if @is_teacher
if @is_teacher || User.current.admin?
exercises = @course.exercises.order("created_at asc")
else
exercises = @course.exercises.where(:exercise_status => 2).order("created_at asc")
@ -48,13 +48,13 @@ class ExerciseController < ApplicationController
end_exercises.each do |exercise|
exercise.update_column('exercise_status', 3)
end
unless User.current.member_of_course?(@course)
unless User.current.member_of_course?(@course) || User.current.admin?
render_403
return
end
@exercise = Exercise.find params[:id]
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
if @exercise.exercise_status != 2 && (!User.current.allowed_to?(:as_teacher,@course) || User.current.admin?)
if @exercise.exercise_status != 2 && (!(User.current.allowed_to?(:as_teacher,@course) || User.current.admin?))
render_403
return
end

View File

@ -299,6 +299,10 @@ class FilesController < ApplicationController
render :layout => 'base_courses'
elsif params[:org_subfield_id]
@container_type = 2
@organization = Organization.find(params[:organization_id])
@containers = [ OrgSubfield.includes(:attachments).reorder(sort).find(@org_subfield.id)]
show_attachments @containers
render :layout => 'base_org'
# @subfield = params[:org_subfield_id]
end
@ -424,8 +428,39 @@ class FilesController < ApplicationController
redirect_to course_files_url(@course)
}
end
end
elsif @org_subfield
@addTag=false
# if params[:in_org_subfield_toolbar]
# @in_org_subfield_toolbar = params[:in_org_subfield_toolbar]
# end
attachments = Attachment.attach_filesex(@org_subfield, params[:attachments], params[:org_subfield_attachment_type])
# if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
# Mailer.run.attachments_added(attachments[:files])
# end
# TODO: 临时用 nyan
sort_init 'created_on', 'desc'
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
'filename' => "#{Attachment.table_name}.filename",
'size' => "#{Attachment.table_name}.filesize",
'downloads' => "#{Attachment.table_name}.downloads"
@containers = [OrgSubfield.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@org_subfield.id)] #modify by Long Jun
# @containers += @org_subfield.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
show_attachments @containers
@attachtype = 0
@contenttype = 0
respond_to do |format|
format.js
format.html {
redirect_to org_subfield_files_url(@org_subfield)
}
end
end
end
end

View File

@ -126,14 +126,33 @@ class HomeworkCommonController < ApplicationController
if @homework_detail_manual.comment_status == 1
student_works = @homework.student_works
if student_works && student_works.size >= 2
student_works.each_with_index do |work, index|
user = work.user
n = @homework_detail_manual.evaluation_num
n = n < student_works.size ? n : student_works.size - 1
assigned_homeworks = get_assigned_homeworks(student_works, n, index)
assigned_homeworks.each do |h|
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id)
student_works_evaluation_distributions.save
if @homework.homework_type == 3
student_work_projects = @homework.student_work_projects.where("student_work_id is not null")
student_work_projects.each_with_index do |pro_work, pro_index|
n = @homework_detail_manual.evaluation_num
n = n < student_works.size ? n : student_works.size - 1
work_index = -1
student_works.each_with_index do |stu_work, stu_index|
if stu_work.id.to_i == pro_work.student_work_id.to_i
work_index = stu_index
end
end
assigned_homeworks = get_assigned_homeworks(student_works, n, work_index)
assigned_homeworks.each do |h|
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id)
student_works_evaluation_distributions.save
end
end
else
student_works.each_with_index do |work, index|
user = work.user
n = @homework_detail_manual.evaluation_num
n = n < student_works.size ? n : student_works.size - 1
assigned_homeworks = get_assigned_homeworks(student_works, n, index)
assigned_homeworks.each do |h|
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id)
student_works_evaluation_distributions.save
end
end
end
@homework_detail_manual.update_column('comment_status', 2)
@ -143,7 +162,8 @@ class HomeworkCommonController < ApplicationController
Mailer.send_mail_anonymous_comment_open(@homework).deliver
else
@statue = 2
end
end
else
@statue = 3
end
@ -277,6 +297,7 @@ class HomeworkCommonController < ApplicationController
@homework = HomeworkCommon.find params[:id]
@homework_detail_manual = @homework.homework_detail_manual
@homework_detail_programing = @homework.homework_detail_programing
@homework_detail_group = @homework.homework_detail_group
@course = @homework.course
rescue
render_404

View File

@ -129,7 +129,7 @@ class MyController < ApplicationController
@user.safe_attributes = params[:user]
@user.pref.attributes = params[:pref]
@user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
@user.login = params[:login]
#@user.login = params[:login]
unless @user.user_extensions.nil?
if @user.user_extensions.identity == 2
@user.firstname = params[:enterprise_name]

View File

@ -17,4 +17,8 @@ class OrgSubfieldsController < ApplicationController
@organization = Organization.find(@subfield.organization_id)
@subfield.update_attributes(:name => params[:name])
end
def show
end
end

View File

@ -3,7 +3,7 @@ class StudentWorkController < ApplicationController
include StudentWorkHelper
require 'bigdecimal'
require "base64"
before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule,:forbidden_anonymous_comment,:delete_work]
before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,:search_course_students]
before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work,:retry_work,:revise_attachment]
before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score, :praise_student_work]
before_filter :author_of_work, :only => [:edit, :update, :destroy]
@ -95,12 +95,27 @@ class StudentWorkController < ApplicationController
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
@show_all = true
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
else
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
end
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
my_work = @homework.student_works.where(:user_id => User.current.id)
if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
my_work = @homework.student_works.where(:id => pro.student_work_id)
else
my_work = @homework.student_works.where(:user_id => User.current.id)
end
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
else
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
end
if my_work.empty?
@stundet_works = []
else
@ -116,12 +131,27 @@ class StudentWorkController < ApplicationController
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
@show_all = true
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
else
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
end
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
my_work = @homework.student_works.where(:user_id => User.current.id)
if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
my_work = @homework.student_works.where(:id => pro.student_work_id)
else
my_work = @homework.student_works.where(:user_id => User.current.id)
end
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
else
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
end
if my_work.empty?
@stundet_works = []
else
@ -190,6 +220,10 @@ class StudentWorkController < ApplicationController
student_work.user_id = User.current.id
student_work.save_attachments(params[:attachments])
render_attachment_warning_if_needed(student_work)
if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1
@student_work_project = @homework.student_work_projects.where("user_id = #{User.current.id}").first
student_work.project_id = @student_work_project.project_id
end
#提交作品时,计算是否迟交
if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
student_work.late_penalty = @homework.late_penalty
@ -197,6 +231,35 @@ class StudentWorkController < ApplicationController
student_work.late_penalty = 0
end
if student_work.save
if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1
@student_work_project.student_work_id = student_work.id
@student_work_project.save
members = params[:group_member_ids].split(',')
for i in 1 .. members.count-1
stu_project = StudentWorkProject.new
stu_project.homework_common_id = @homework.id
stu_project.student_work_id = student_work.id
stu_project.project_id = @student_work_project.project_id
stu_project.user_id = members[i].to_i
stu_project.is_leader = 0
stu_project.save
end
elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0
members = params[:group_member_ids].split(',')
for i in 0 .. members.count-1
stu_project = StudentWorkProject.new
stu_project.homework_common_id = @homework.id
stu_project.student_work_id = student_work.id
stu_project.project_id = -1
stu_project.user_id = members[i].to_i
if i == 0
stu_project.is_leader = 1
else
stu_project.is_leader = 0
end
stu_project.save
end
end
course_activity = CourseActivity.where("course_act_type='HomeworkCommon' and course_act_id =#{@homework.id}").first
if course_activity
course_activity.updated_at = Time.now
@ -276,6 +339,18 @@ class StudentWorkController < ApplicationController
def destroy
if @work.destroy
if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1
pros = @work.student_work_projects.where("is_leader = 0")
pros.each do |pro|
pro.destroy
end
project = @work.student_work_projects.where("is_leader = 1").first
project.update_attributes(:student_work_id => nil)
elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0
@work.student_work_projects.each do |pro2|
pro2.destroy
end
end
respond_to do |format|
format.html {
redirect_to student_work_index_url(:homework => @homework.id)
@ -288,12 +363,36 @@ class StudentWorkController < ApplicationController
@work = StudentWork.where("user_id =? and homework_common_id =?", User.current.id, @homework.id).first
if @work
@work.destroy
if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1
pros = @work.student_work_projects.where("is_leader = 0")
pros.each do |pro|
pro.destroy
end
project = @work.student_work_projects.where("is_leader = 1").first
project.update_attributes(:student_work_id => nil)
elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0
@work.student_work_projects.each do |pro2|
pro2.destroy
end
end
end
redirect_to user_homeworks_user_path(User.current.id)
end
def retry_work
if @work.destroy
if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1
pros = @work.student_work_projects.where("is_leader = 0")
pros.each do |pro|
pro.destroy
end
project = @work.student_work_projects.where("is_leader = 1").first
project.update_attributes(:student_work_id => nil)
elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0
@work.student_work_projects.each do |pro2|
pro2.destroy
end
end
@student_work = StudentWork.new
respond_to do |format|
format.js
@ -540,7 +639,89 @@ class StudentWorkController < ApplicationController
end
end
def new_student_work_project
@user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i
@course_activity = params[:course_activity].to_i
respond_to do |format|
format.js
end
end
#创建作业的关联项目
def student_work_project
@project = StudentWorkProject.new
@project.homework_common_id = @homework.id
@project.project_id = (Project.find params[:projectName].to_i).id
@project.user_id = User.current.id
@project.is_leader = 1
if @project.save
@user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i
@course_activity = params[:course_activity].to_i
respond_to do |format|
format.js
end
end
end
#查找学生创建的项目列表
def search_user_projects
condition = '%%'
if !params[:name].nil?
condition = "%#{params[:name].strip}%".gsub(" ","")
end
@project_ids = Project.where("user_id = #{User.current.id} and name like '#{condition}'")
@first = params[:first].to_i
respond_to do |format|
format.js
end
end
#查找课程的学生
def search_course_students
name = ""
unless params[:name].nil?
name = params[:name]
end
all_student_ids = "(" + @homework.course.student.map{|student| student.student_id}.join(",") + ")"
all_students = User.where("id in #{all_student_ids}")
@users = searchstudent_by_name all_students,name
respond_to do |format|
format.js
end
end
def cancel_relate_project
relate_pro = StudentWorkProject.where("user_id = #{User.current.id} and homework_common_id = #{@homework.id}").first
if relate_pro.destroy
@user_activity_id = params[:user_activity_id].to_i
@is_in_course = params[:is_in_course].to_i
@course_activity = params[:course_activity].to_i
respond_to do |format|
format.js
end
end
end
private
def searchstudent_by_name users, name
mems = []
if name != ""
name = name.to_s.downcase
users.each do |m|
username = m.lastname.to_s.downcase + m.firstname.to_s.downcase
if(m.login.to_s.downcase.include?(name) || m.user_extensions[:student_id].to_s.downcase.include?(name) || username.include?(name))
mems << m
end
end
else
mems = users
end
mems
end
def hsd_committed_work?(user, homework)
sw = StudentWork.where("user_id =? and homework_common_id =?", user, homework).first
sw.nil? ? result = false : result = true

View File

@ -551,12 +551,21 @@ class UsersController < ApplicationController
)
end
end
end
#分组作业
if homework.homework_type == 3
homework_detail_group = HomeworkDetailGroup.new
homework.homework_detail_group = homework_detail_group
homework_detail_group.min_num = params[:min_num].to_i
homework_detail_group.max_num = params[:max_num].to_i
homework_detail_group.base_on_project = params[:base_on_project].to_i
end
if homework.save
homework_detail_manual.save if homework_detail_manual
homework_detail_programing.save if homework_detail_programing
homework_detail_group.save if homework_detail_group
if params[:is_in_course] == "1"
redirect_to homework_common_index_path(:course => homework.course_id)

View File

@ -161,7 +161,7 @@ class WelcomeController < ApplicationController
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','name','description^0.5','filename']
fields: ['login', 'firstname','lastname','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
@ -173,10 +173,12 @@ class WelcomeController < ApplicationController
lastname: {},
name:{},
description:{},
filename:{}
filename:{},
subject:{},
content:{}
}
}
},[User,Course,Attachment,Project] ).page(params[:page] || 1).per(20).results
},[User,Course,Attachment,Project,Memo] ).page(params[:page] || 1).per(20).results
when 'user'
@users = User.search(@name).page(params[:page] || 1).per(20)
when 'project'
@ -185,6 +187,8 @@ class WelcomeController < ApplicationController
@courses = Course.search(@name).page(params[:page] || 1).per(20).results
when 'attachment'
@attachments = Attachment.search(@name).page(params[:page] || 1).per(20).results
when 'memo'
@memos = Memo.search(@name).page(params[:page] || 1).per(20).results
else
@alls = Elasticsearch::Model.search({
query: {
@ -192,7 +196,7 @@ class WelcomeController < ApplicationController
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','name','description^0.5','filename']
fields: ['login', 'firstname','lastname','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
@ -204,10 +208,12 @@ class WelcomeController < ApplicationController
lastname: {},
name:{},
description:{},
filename:{}
filename:{},
subject:{},
content:{}
}
}
},[User,Course,Attachment,Project] ).page(params[:page] || 1).per(20).results
},[User,Course,Attachment,Project,Memo] ).page(params[:page] || 1).per(20).results
end
@ -216,13 +222,14 @@ class WelcomeController < ApplicationController
@course_count = Course.search(@name).results.total
@attach_count = Attachment.search(@name).results.total
@project_count = Project.search(@name).results.total
@memo_count = Memo.search(@name).results.total
@total_count = Elasticsearch::Model.search({
query: {
multi_match: {
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','name','description^0.5','filename']
fields: ['login', 'firstname','lastname','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
@ -234,10 +241,12 @@ class WelcomeController < ApplicationController
lastname: {},
name:{},
description:{},
filename:{}
filename:{},
subject:{},
content:{}
}
}
},[User,Course,Attachment,Project] ).results.total
},[User,Course,Attachment,Project,Memo] ).results.total
# search_type = params[:search_type].to_sym unless search_condition.blank?
# search_by = params[:search_by]
#

View File

@ -2435,10 +2435,19 @@ module ApplicationHelper
link_to "作品(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
else #学生显示提交作品、修改作品等按钮
work = cur_user_works_for_homework homework
project = cur_user_projects_for_homework homework
if work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
link_to "提交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue'
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
link_to "提交作品(#{homework.student_works.count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再提交作品'
else
link_to "提交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue'
end
elsif work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d")
link_to "补交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_red'
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
link_to "补交作品(#{homework.student_works.count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再补交作品'
else
link_to "补交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_red'
end
else
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前
link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品"
@ -2459,6 +2468,24 @@ module ApplicationHelper
end
def relate_project homework,is_teacher,is_in_course,user_activity_id,course_activity
if User.current.member_of_course?(homework.course)
if is_teacher
#link_to "已关联(#{homework.student_work_projects.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
else
projects = cur_user_projects_for_homework homework
works = cur_user_works_for_homework homework
if works.nil? && projects.nil?
link_to "关联项目",new_student_work_project_student_work_index_path(:homework => homework.id,:is_in_course=>is_in_course,:user_activity_id=>user_activity_id,:course_activity=>course_activity),remote: true,:class=> 'c_blue', :title=> '请选择分组作业关联的项目'
elsif works.nil?
link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => homework.id,:is_in_course=>is_in_course,:user_activity_id=>user_activity_id,:course_activity=>course_activity), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目'
else
#link_to "已关联(#{homework.student_work_projects.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
end
end
end
end
def student_anonymous_comment homework
if homework.homework_detail_manual
case homework.homework_detail_manual.comment_status
@ -2474,7 +2501,20 @@ module ApplicationHelper
#获取当前用户在指定作业下提交的作业的集合
def cur_user_works_for_homework homework
homework.student_works.where("user_id = ?",User.current).first
work = homework.student_works.where("user_id = ?",User.current).first
if homework.homework_type == 3
pro = homework.student_work_projects.where("user_id = #{User.current.id}").first
if pro.nil? || pro.student_work_id == "" || pro.student_work_id.nil?
work = nil
else
work = StudentWork.find pro.student_work_id
end
end
work
end
#获取当前用户在指定作业下关联的项目的集合
def cur_user_projects_for_homework homework
homework.student_work_projects.where("user_id = ?",User.current).first
end
def file_preview_tag(file, html_options={})

View File

@ -113,7 +113,8 @@ module FilesHelper
if attachment.is_public? ||
(attachment.container_type == "Project" && User.current.member_of?(attachment.project)) ||
(attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)))||
attachment.author_id == User.current.id
attachment.author_id == User.current.id ||
attachment.container_type == "OrgSubfield"
result << attachment
end
end

View File

@ -22,6 +22,7 @@ class Attachment < ActiveRecord::Base
belongs_to :container, :polymorphic => true
belongs_to :project, foreign_key: 'container_id', conditions: "attachments.container_type = 'Project'"
belongs_to :course, foreign_key: 'container_id', conditions: "attachments.container_type = 'Course'"
belongs_to :org_subfield, foreign_key: 'container_id', conditions: "attachements.container_type = 'OrgSubfield'"
belongs_to :softapplication, foreign_key: 'container_id', conditions: "attachments.container_type = 'Softapplication'"
belongs_to :author, :class_name => "User", :foreign_key => "author_id"
belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id"
@ -46,7 +47,7 @@ class Attachment < ActiveRecord::Base
settings index: { number_of_shards: 5 } do
mappings dynamic: 'false' do
indexes :filename, analyzer: 'smartcn',index_options: 'offsets'
indexes :downloads, analyzer: 'smartcn',index_options: 'offsets'
indexes :downloads, index:"not_analyzed",index_options: 'offsets'
end
end

View File

@ -16,7 +16,7 @@ class Course < ActiveRecord::Base
mappings dynamic: 'false' do
indexes :name, analyzer: 'smartcn',index_options: 'offsets'
indexes :description, analyzer: 'smartcn',index_options: 'offsets'
indexes :updated_at, analyzer: 'smartcn',index_options: 'offsets',type:"date"
indexes :updated_at, index:"not_analyzed",type:"date"
end
end

View File

@ -9,6 +9,8 @@ class HomeworkCommon < ActiveRecord::Base
belongs_to :user
has_one :homework_detail_manual, :dependent => :destroy
has_one :homework_detail_programing, :dependent => :destroy
has_one :homework_detail_group, :dependent => :destroy
has_many :student_work_projects, :dependent => :destroy
has_many :homework_tests, :dependent => :destroy
has_many :student_works, :dependent => :destroy, :conditions => "is_test=0"
has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表
@ -74,6 +76,10 @@ class HomeworkCommon < ActiveRecord::Base
self.homework_type == 2 && self.homework_detail_programing
end
def is_group_homework?
self.homework_type == 3 && self.homework_detail_group
end
###添加回复
def self.add_homework_jour(user, notes, id , options = {})
homework = HomeworkCommon.find(id)

View File

@ -0,0 +1,4 @@
class HomeworkDetailGroup < ActiveRecord::Base
belongs_to :homework_common
attr_accessible :base_on_project, :homework_common_id, :max_num, :min_num
end

View File

@ -1,7 +1,9 @@
require 'elasticsearch/model'
class Memo < ActiveRecord::Base
include Redmine::SafeAttributes
include UserScoreHelper
include ApplicationHelper
include Elasticsearch::Model
belongs_to :forum
has_many_kindeditor_assets :assets, :dependent => :destroy
belongs_to :author, :class_name => "User", :foreign_key => 'author_id'
@ -12,6 +14,18 @@ class Memo < ActiveRecord::Base
validates_length_of :content, maximum: 30000
validate :cannot_reply_to_locked_topic, :on => :create
#elasticsearch kaminari init
Kaminari::Hooks.init
Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
settings index: { number_of_shards: 5 } do
mappings dynamic: 'false' do
indexes :subject, analyzer: 'smartcn',index_options: 'offsets'
indexes :content, analyzer: 'smartcn',index_options: 'offsets'
indexes :updated_at,index:"not_analyzed" ,type:'date'
end
end
acts_as_tree :counter_cache => :replies_count, :order => "#{Memo.table_name}.created_at ASC"
acts_as_attachable
has_many :user_score_details, :class_name => 'UserScoreDetails',:as => :score_changeable_obj
@ -47,9 +61,9 @@ class Memo < ActiveRecord::Base
"parent_id",
"replies_count"
after_create :add_author_as_watcher, :reset_counters!, :send_mail, :send_message
# after_update :update_memos_forum
after_destroy :reset_counters!,:delete_kindeditor_assets#,:down_user_score -- 公共区发帖暂不计入得分
after_create :add_author_as_watcher, :reset_counters!, :send_mail, :send_message,:create_memo_ealasticsearch_index
after_update :update_memo_ealasticsearch_index
after_destroy :reset_counters!,:delete_kindeditor_assets,:delete_memo_ealasticsearch_index#,:down_user_score -- 公共区发帖暂不计入得分,
# after_create :send_notification
# after_save :plusParentAndForum
# after_destroy :minusParentAndForum
@ -57,6 +71,36 @@ class Memo < ActiveRecord::Base
# scope :visible, lambda { |*args|
# includes(:forum => ).where()
# }
scope :indexable,lambda {
where('parent_id is null')
}
def self.search(query)
__elasticsearch__.search(
{
query: {
multi_match: {
query: query,
type:"most_fields",
operator: "or",
fields: ['subject','content^0.5']
}
},
sort: {
_score:{order: "desc" },
updated_at:{order: "desc" }
},
highlight: {
pre_tags: ['<span class="c_red">'],
post_tags: ['</span>'],
fields: {
subject: {},
content: {}
}
}
}
)
end
def send_mail
Mailer.run.forum_message_added(self) if Setting.notified_events.include?('forum_message_added')
@ -203,6 +247,22 @@ class Memo < ActiveRecord::Base
# Author lizanle
# Description 从硬盘上删除资源
def delete_kindeditor_assets
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::MEMO
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::MEMO
end
def create_memo_ealasticsearch_index
if self.parent_id.nil?
self.__elasticsearch__.index_document
end
end
def update_memo_ealasticsearch_index
if self.parent_id.nil?
self.__elasticsearch__.update_document
end
end
def delete_memo_ealasticsearch_index
if self.parent_id.nil?
self.__elasticsearch__.delete_document
end
end
end

View File

@ -1,4 +1,9 @@
class OrgSubfield < ActiveRecord::Base
belongs_to :organization, :foreign_key => :organization_id
has_many :org_document_comments, :dependent => :destroy
has_many :files
acts_as_attachable
def project
end
end

View File

@ -39,10 +39,11 @@ class Project < ActiveRecord::Base
mappings dynamic: 'false' do
indexes :name, analyzer: 'smartcn',index_options: 'offsets'
indexes :description, analyzer: 'smartcn',index_options: 'offsets'
indexes :updated_on, analyzer: 'smartcn',index_options: 'offsets', type:'date'
indexes :updated_on, index:"not_analyzed", type:'date'
end
end
has_many :student_work_projects,:dependent => :destroy
has_many :student_works
has_many :time_entry_activities
has_many :members, :include => [:principal, :roles], :conditions => "#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE}"
@ -86,6 +87,7 @@ class Project < ActiveRecord::Base
# end
#ADDED BY NIE
has_one :project_score, :dependent => :destroy
has_many :project_infos, :dependent => :destroy
has_one :project_status, :class_name => "ProjectStatus", :dependent => :destroy
has_many :user_grades, :class_name => "UserGrade", :dependent => :destroy

View File

@ -4,6 +4,7 @@ class StudentWork < ActiveRecord::Base
belongs_to :homework_common
belongs_to :user
has_many :student_work_projects
has_many :student_works_evaluation_distributions, :dependent => :destroy
has_many :student_works_scores, :dependent => :destroy
belongs_to :project

View File

@ -0,0 +1,7 @@
class StudentWorkProject < ActiveRecord::Base
# attr_accessible :title, :body
belongs_to :homework_common
belongs_to :student_work
belongs_to :project
belongs_to :user
end

View File

@ -35,7 +35,7 @@ class User < Principal
indexes :login, analyzer: 'smartcn',index_options: 'offsets'
indexes :firstname, analyzer: 'smartcn',index_options: 'offsets'
indexes :lastname, analyzer: 'smartcn',index_options: 'offsets'
indexes :last_login_on, analyzer: 'smartcn',index_options: 'offsets',type: 'date'
indexes :last_login_on, index:"not_analyzed",type: 'date'
end
end
@ -107,6 +107,7 @@ class User < Principal
has_many :student_works, :dependent => :destroy
has_many :student_works_evaluation_distributions, :dependent => :destroy
has_many :student_works_scores, :dependent => :destroy
has_many :student_work_projects, :dependent => :destroy
#end
has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)},

View File

@ -20,6 +20,25 @@
:lebel_file_uploding => l(:lebel_file_uploding),
:delete_all_files => l(:text_are_you_sure_all)
} %>
<% elsif @project %>
<%= 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'),
: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)
} %>
<% else %>
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',

View File

@ -0,0 +1,56 @@
<% delete_allowed = User.current.admin? %>
<div class="re_con_top">
<p class="f_l c_blue f_b f_14">共有&nbsp;<%= all_attachments.count%>&nbsp;个资源</p>
<p class="f_r" style="color: #808080">
<% if order == "asc" %>
按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %>&nbsp;/&nbsp;
<%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>&nbsp;/&nbsp;
<%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %>&nbsp;排序
<% else %>
按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %>&nbsp;/&nbsp;
<%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>&nbsp; /&nbsp;
<%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %>&nbsp;排序
<% end %>
</p>
</div>
<div class="cl"></div>
<!--<div class="files_tag" id="files_tag">-->
<!--<%#= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => course,:tag_name => @tag_name}%>-->
<!--</div>-->
<div class="cl"></div>
<div class="for_img_thumbnails">
<% org_subfield_attachments.each do |file| %>
<% if 1 %>
<div class="re_con_box" id="container_files_<%= file.id %>">
<div class="">
<%= link_to truncate(file.filename,length: 35, omission: '...'),
download_named_attachment_path(file.id, file.filename),
:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
<% if User.current.logged? %>
<%= file_preview_tag(file, class: 'f_l re_open', style:'text-align: center;') %>
<% end %>
</div>
<div class="cl"></div>
<div class="mt5">
<p class="f_l mb5 c_grey02">文件大小:<%= number_to_human_size(file.filesize) %></p>
<%= link_to( l(:button_delete), attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @org_subfield.id && file.container_type == "OrgSubfield"%>
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>&nbsp;&nbsp;|&nbsp;&nbsp;下载<%= file.downloads %>&nbsp;&nbsp;|&nbsp;&nbsp;引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
</div>
<div class="cl"></div>
<!--<div class="tag_h">-->
<!--&lt;!&ndash; container_type = 1 代表是课程里的资源 &ndash;&gt;-->
<!--<%#= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>-->
<!--<%#= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>-->
<!--</div>-->
<div class="cl"></div>
</div><!---re_con_box end-->
<% end %>
<% end %>
</div>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
</ul>
<div class="cl"></div>

View File

@ -0,0 +1,97 @@
<%= stylesheet_link_tag 'courses' %>
<script>
function searchone4reload(fileid){
var url = "<%= searchone4reload_org_subfield_files_path(@org_subfield)%>";
var data = {};data.fileid=fileid;
$.ajax({
url:url,dataType:'text',data:data,success:function(text){
var container_file_div = $("#container_files_"+fileid);
container_file_div.after(text);
container_file_div.remove();
}
});
}
function show_upload(obj)
{
switch(obj)
{
case 1:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 1}) %>');
break;
case 2:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 2}) %>');
break;
case 3:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 3}) %>');
break;
case 4:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 4}) %>');
break;
case 6:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 6}) %>');
break;
default:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 5}) %>');
}
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("popbox_polls");
}
function closeModal()
{
hideModal($("#popbox_upload"));
}
function presscss(id)
{
if(id == "inorg_subfield")
{
$('#inorg_subfield').attr("class", "re_schbtn b_dblue");
$('#insite').attr("class", "re_schbtn b_lblue");
}
else
{
$('#inorg_subfield').attr("class", "re_schbtn b_lblue");
$('#insite').attr("class", "re_schbtn b_dblue");
}
}
function buttoncss()
{
$('#inorg_subfield').attr("class", "re_schbtn b_lblue");
$('#insite').attr("class", "re_schbtn b_lblue");
}
</script>
<div class="container">
<div class="resources"><!--资源库内容开始--->
<div class="re_top" style="width:710px;">
<%= form_tag( search_org_subfield_files_path(@org_subfield), method: 'get',:class => "re_search f_l",:remote=>true) do %>
<%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%>
<%= submit_tag "栏目内搜索", :class => "re_schbtn b_lblue",:name => "inorg_subfield",:id => "inorg_subfield", :onmouseover => "presscss('inorg_subfield')",:onmouseout =>"buttoncss()" %>
<%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
<% end %>
<%# if is_org_subfield_teacher(User.current,@org_subfield) || (@org_subfield.publish_resource==1 && User.current.member_of_org_subfield?(@org_subfield) ) %> <!-- show_window('light','fade','20%','35%')-->
<!--<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload();">上传资源</a>-->
<p class="c_grey fr mt10 mr5">
上传:
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(1);">课件</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(2);">软件</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(3);">媒体</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(4);">代码</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(6);">论文</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(5);">其他</a>
</p>
<%# end %>
</div><!---re_top end-->
<div class="cl"></div>
<div class="re_con" id="org_subfield_list">
<%= render :partial => 'org_subfield_list',:locals => {org_subfield: @org_subfield,all_attachments: @all_attachments,sort:@sort,order:@order,org_subfield_attachments:@obj_attachments} %>
</div><!---re_con end-->
</div>
</div>
<% html_title(l(:label_attachment_plural)) -%>

View File

@ -0,0 +1,55 @@
<% delete_allowed = User.current.admin? %>
<div class="re_con_top">
<p class="f_l c_blue f_b f_14">共有&nbsp;<%= all_attachments.count%>&nbsp;个资源</p>
<p class="f_r" style="color: #808080">
<% if order == "asc" %>
按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %>&nbsp;/&nbsp;
<%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>&nbsp;/&nbsp;
<%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %>&nbsp;排序
<% else %>
按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %>&nbsp;/&nbsp;
<%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %>&nbsp; /&nbsp;
<%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %>&nbsp;排序
<% end %>
</p>
</div>
<div class="cl"></div>
<div class="files_tag" id="files_tag">
<%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => course,:tag_name => @tag_name}%>
</div>
<div class="cl"></div>
<div class="for_img_thumbnails">
<% curse_attachments.each do |file| %>
<% if file.is_public? || User.current.admin? %>
<div class="re_con_box" id="container_files_<%= file.id %>">
<div class="">
<%= link_to truncate(file.filename,length: 35, omission: '...'),
download_named_attachment_path(file.id, file.filename),
:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
</div>
<div class="cl"></div>
<div class="mt5">
<p class="f_l mb5 c_grey02">文件大小:<%= number_to_human_size(file.filesize) %></p>
<%= link_to( l(:button_delete), attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @org_subfield.id && file.container_type == "OrgSubfield"%>
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>&nbsp;&nbsp;|&nbsp;&nbsp;下载<%= file.downloads %>&nbsp;&nbsp;|&nbsp;&nbsp;引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
</div>
<div class="cl"></div>
<div class="tag_h">
<!-- container_type = 1 代表是课程里的资源 -->
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
</div>
<div class="cl"></div>
</div><!---re_con_box end-->
<% else %>
<div class="re_con_box"><span class='fr mr10 pr_join_span '><%= file.filename %>是私有资源</span></div>
<% end %>
<% end %>
</div>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
</ul>
<div class="cl"></div>

View File

@ -0,0 +1,31 @@
<div id="popbox_upload" class="mb10" style="margin-top: -30px;color:#15bccf; font-size:16px;">
<div class="upload_con">
<h2 style="text-align: center"><%= l(:label_upload_files)%></h2>
<div class="upload_box">
<%= error_messages_for 'attachment' %>
<div id="network_issue" style="color: red; display: none;"><%= l(:label_file_upload_error_messages)%></div>
<%= form_tag(org_subfield_files_path(org_subfield), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
<!-- <label style="margin-top:3px;"><#%= l(:label_file_upload)%></label> -->
<!--<input type="hidden" name="in_org_subfield_toolbar" value="Y">-->
<input type="hidden" name="org_subfield_attachment_type" value="<%= org_subfield_attachment_type%>">
<%= render :partial => 'files/attachement_list',:locals => {:org_subfield => org_subfield} %>
<div class="cl"></div>
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%= l(:button_confirm)%></a>
<% end %>
</div>
</div>
<% content_for :header_tags do %>
<%= javascript_include_tag 'attachments' %>
<% end %>
</div>
<script>
function submit_resource()
{
$('#submit_resource').parent().submit();
}
</script>

View File

@ -52,6 +52,17 @@ $('#upload_file_div').slideToggle('slow');
setTimeout( function(){div.remove();},3000)
<% end %>
<%end%>
<% elsif @org_subfield %>
hideModal();
$("#resource_list").html('<%= j(render partial: "subfield_files" ,locals: {org_subfield: @org_subfield}) %>');
// $("#courses_files_count_info").html("<%#= @all_attachments.count%>");
// $("#courses_files_count_nav").html("(<%#= @all_attachments.count%>)")
// 添加文件上传成功提示,
<% unless params[:attachments].nil? %>
var div = $('<div id="addBox" class="flash notice">文件上传成功!</div>');
$("#org_subfield_list").prepend(div);
setTimeout( function(){div.remove();},3000)
<% end %>
<% end %>
<% end %>
$(document).ready(img_thumbnails);

View File

@ -1,8 +1,10 @@
<div id="resource_list">
<% if @isproject %>
<% if @container_type == 0 %>
<%= render :partial => 'project_file_new', locals: {project: @project} %>
<% else %>
<% elsif @container_type == 1 %>
<%= render :partial => 'course_file', locals: {course: @course} %>
<% elsif @container_type == 2 %>
<%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %>
<% end %>
</div>

View File

@ -4,7 +4,7 @@
$("#homework_publish_time").val("");
$("#homework_end_time").val("");
$("#course_id").val($("#option_select").val());
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true })%>");
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true,:has_group => true})%>");
homework_description_editor.html("");
$("#homework_editor").toggle();
}

View File

@ -30,7 +30,7 @@
<li>&nbsp;&nbsp;</li>
</ul>
<ul class="setting_right ">
<li><%= f.text_field :login,:no_label=>true, :required => true, :nh_required=>"1", :name => "login",:class=>"w210"%></li>
<li><%= f.text_field :login,:no_label=>true, :required => true, :nh_required=>"1",:disabled=>'disabled', :name => "login",:class=>"w210"%></li>
<li><%= f.text_field :mail,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210"%></li>
<li>

View File

@ -1,18 +1,19 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<li>
<label><span class="c_red">*</span>&nbsp;<%= l(:field_title) %>&nbsp;&nbsp;</label>
<input type="text" name="news[title]" class="hwork_input_news" id="news_title" width="576px" onblur="regexTitle();" maxlength="60" placeholder="60个字符以内" value="<%= is_new ? '' : @news.title %>">
<label style="float: left"><span class="c_red">*</span>&nbsp;<%= l(:field_title) %>&nbsp;&nbsp;</label>
<input type="text" name="news[title]" class="hwork_input_news fl" id="news_title" width="576px" onblur="regexTitle();" maxlength="60" placeholder="60个字符以内" value="<%= is_new ? '' : @news.title %>">
<div class="cl"></div>
<p id="title_notice_span" class="ml55"></p>
</li>
<li class="mb10">
<% if is_new %>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<label class="fl" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;&nbsp;</label>
<%= f.kindeditor :description,:width=>'91%',:editor_id=>'project_news_description_editor' %>
<%= f.kindeditor :description,:width=>'90%',:editor_id=>'project_news_description_editor' %>
<p id="description_notice_span" class="ml55"></p>
<% else %>
<label class="fl" ><span class="c_red">*</span>&nbsp;<%= l(:field_description) %>&nbsp;&nbsp;</label>
<%= f.kindeditor :description,:width=>'91%', :editor_id=>'project_news_description_editor', :owner_id => @news.id, :owner_type => OwnerTypeHelper::NEWS %>
<%= f.kindeditor :description,:width=>'90%', :editor_id=>'project_news_description_editor', :owner_id => @news.id, :owner_type => OwnerTypeHelper::NEWS %>
<p id="description_notice_span" class="ml55"></p>
<% end %>

View File

@ -0,0 +1,96 @@
<script>
function searchone4reload(fileid){
var url = "<%= searchone4reload_course_files_path(@course)%>";
var data = {};data.fileid=fileid;
$.ajax({
url:url,dataType:'text',data:data,success:function(text){
var container_file_div = $("#container_files_"+fileid);
container_file_div.after(text);
container_file_div.remove();
}
});
}
function show_upload(obj)
{
switch(obj)
{
case 1:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 1}) %>');
break;
case 2:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 2}) %>');
break;
case 3:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 3}) %>');
break;
case 4:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 4}) %>');
break;
case 6:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 6}) %>');
break;
default:
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show',:locals => {:course => @course,:course_attachment_type => 5}) %>');
}
showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("popbox_polls");
}
function closeModal()
{
hideModal($("#popbox_upload"));
}
function presscss(id)
{
if(id == "incourse")
{
$('#incourse').attr("class", "re_schbtn b_dblue");
$('#insite').attr("class", "re_schbtn b_lblue");
}
else
{
$('#incourse').attr("class", "re_schbtn b_lblue");
$('#insite').attr("class", "re_schbtn b_dblue");
}
}
function buttoncss()
{
$('#incourse').attr("class", "re_schbtn b_lblue");
$('#insite').attr("class", "re_schbtn b_lblue");
}
</script>
<div class="container">
<div class="resource"><!--资源库内容开始--->
<div class="re_top">
<%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search f_l",:remote=>true) do %>
<%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%>
<%= submit_tag "课内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()" %>
<%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
<% end %>
<% if is_course_teacher(User.current,@course) || (@course.publish_resource==1 && User.current.member_of_course?(@course) ) %> <!-- show_window('light','fade','20%','35%')-->
<!--<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload();">上传资源</a>-->
<p class="c_grey fr mt10 mr5">
上传:
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(1);">课件</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(2);">软件</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(3);">媒体</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(4);">代码</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(6);">论文</a>&nbsp;|&nbsp;
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(5);">其他</a>
</p>
<% end %>
</div><!---re_top end-->
<div class="cl"></div>
<div class="re_con" id="course_list">
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
</div><!---re_con end-->
</div>
</div>
<% html_title(l(:label_attachment_plural)) -%>

View File

@ -29,7 +29,8 @@
<%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %>
<%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子"%>
<% else %>
<%#= link_to "#{field.name}", org_subfield_files_path(field), :class => "homepageMenuText" %>
<%#= link_to "#{field.name}", org_subfield_files_path(field, :organization_id => organization.id), :class => "homepageMenuText" %>
<a href="javascript:void(0);" class="homepageMenuText"><%= field.name %></a>
<% end %>
</div>
<div class="homepageLeftMenuCourses" id="homepageLeftMenuField_<%= field.id %>" style="display:none;">

View File

@ -1,2 +1,2 @@
//location.reload();
window.location.href ='<%= organization_path(@org, :show_homepage => params[:show_homepage])%>';
window.location.href ='<%= organization_path(@org, :show_homepage => 1)%>';

View File

@ -0,0 +1,96 @@
<div id="popbox02">
<div>
<div class="relateText fl">请添加小组成员</div>
</div>
<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="clickCanel();"></a></div>
<div class="cl"></div>
<div>
<form class="resourcesSearchBox">
<input type="text" name="serach" placeholder="输入关键字搜索" class="searchResourcePopup" />
</form>
</div>
<ul class="addMemberC fl" id="all_students_list"></ul>
<div class="rightArrow"><img src="/images/course/right-arrow.png" width="16" height="30" /></div>
<ul class="addMemberC fr" id="choose_students_list">
<li id="choose_student_<%=User.current.id %>"><%=User.current.show_name %>
<% unless User.current.user_extensions.student_id == "" %>
(<%=User.current.user_extensions.student_id %>)
<% end %>
</li>
</ul>
<div class="cl"></div>
<div class="courseSendCancel mr15" style="float:right;"><a href="javascript:void(0);" class="sendSourceText" onclick="clickCanel();">取消</a></div>
<div class="courseSendSubmit" style="float:right;"><a href="javascript:void(0);" class="sendSourceText" onclick="clickOK()">确定</a></div>
<div class="cl"></div>
</div>
<script type="text/javascript">
var lastSearchCondition = '';
var count = 0;
function search_stus(e){
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
{
return;
}
lastSearchCondition = $(e.target).val().trim();
$.ajax({
url: '<%= url_for(:controller => 'student_work', :action => 'search_course_students') %>'+'?name='+ e.target.value+'&homework='+<%=@homework.id %>,
type:'get'
});
}
function throttle(method,context,e){
clearTimeout(method.tId);
method.tId=setTimeout(function(){
method.call(context,e);
},500);
}
//查询
$("input[name='serach']").on('input', function (e) {
throttle(search_stus,window,e);
});
function clickOK() {
var str="";
var show = "合作成员:";
var lists = $("#choose_students_list li");
if(lists.length > 0) {
for(var i=0; i<lists.length; i++) {
var id = $(lists[i]).attr("id").replace(/[^0-9]/ig,"");
str += id;
var show_name = $(lists[i]).html();
var index = show_name.indexOf("(");
if (index != -1) {
var name = show_name.substring(0,show_name.indexOf("("));
} else {
var name = show_name;
}
show += name;
if (i == 0) {
show += "(组长)";
}
if (i != lists.length -1) {
str += ",";
show += "、";
}
}
$("#group_member_ids").val(str);
}
hideModal("#popbox02");
$("#group_members_show").show().html(show);
}
function delete_student(id) {
$("#choose_student_"+id).remove();
$("#student_"+id).one("click",function choose_student() {
$("#choose_students_list").append("<li id='choose_student_"+id+"' onclick='delete_student("+id+");'>"+$("#student_"+id).html()+"</li>");
});
}
$(document).ready(function(){
$.ajax({
url: '<%= url_for(:controller => 'student_work', :action => 'search_course_students') %>'+'?homework='+<%=@homework.id %>,
type:'get'
});
});
</script>

View File

@ -1,8 +1,12 @@
<ul class="hworkUl">
<li class="hworkList340 hworkH30 width505">
<span class="HomeworkNameTitle f14 fb fl">作品名称</span>
<span class="HomeworkStuTitle f14 fb fl">姓名</span>
<span class="HomeworkStuTitle f14 fb fl">学号</span>
<% if @homework.homework_type != 3 %>
<span class="HomeworkStuTitle f14 fb fl">姓名</span>
<span class="HomeworkStuTitle f14 fb fl">学号</span>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<span class="HomeworkStuTitle f14 fb fl">关联项目</span>
<% end %>
</li>
<li class="hworkList130 hworkH30 fb ml10">

View File

@ -1,8 +1,12 @@
<ul class="hworkUl">
<li class="hworkList340 hworkH30 <%= @homework.homework_type == 2 ? '' : 'width385'%>">
<span class="c_dark f14 fb fl <%= @homework.homework_type == 2 ? 'mr90 ml50' : 'mr140 ml50'%>">作品名称</span>
<span class="c_dark f14 fb fl mr50">姓名</span>
<span class="c_dark f14 fb fl">学号</span>
<% if @homework.homework_type != 3 %>
<span class="c_dark f14 fb fl mr50">姓名</span>
<span class="c_dark f14 fb fl">学号</span>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<span class="c_dark f14 fb fl">关联项目</span>
<% end %>
</li>
<li class="hworkList130 hworkH30">

View File

@ -13,14 +13,22 @@
</div>
</li>
<li>
<ul class="mt10 fl">
<li class="hworkStName mr10 mt16" title="姓名">
<%= student_work.user.show_name%>
</li>
<li class="hworkStID mt16" title="学号">
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
</li>
</ul>
<% if @homework.homework_type != 3 %>
<ul class="mt10 fl">
<li class="hworkStName mr10 mt16" title="姓名">
<%= student_work.user.show_name%>
</li>
<li class="hworkStID mt16" title="学号">
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
</li>
</ul>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<ul class="mt10 fl">
<li class="hworkPrName mr10 mt12" title="项目名称">
<%= student_work.project.name %>
</li>
</ul>
<% end %>
</li>
</div>
</ul>

View File

@ -1,6 +1,11 @@
<!-- 匿评作品列表,显示某一个作品的信息 -->
<ul class="hworkListRow" id="student_work_<%= student_work.id%>">
<% is_my_work = student_work.user == User.current%>
<% if @homework.homework_type != 3 %>
<% is_my_work = student_work.user == User.current%>
<% else %>
<% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %>
<% is_my_work = pro && pro.student_work_id == student_work.id%>
<% end %>
<li class="hworkList340 width525">
<ul>
<% if is_my_work%>
@ -14,14 +19,22 @@
</div>
</li>
<li onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;" class="student_work_<%= student_work.id%>">
<ul class="mt10 fl">
<li class="hworkStName mr10 mt16" title="姓名">
<%= student_work.user.show_name%>
</li>
<li class="hworkStID mt16" title="学号">
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
</li>
</ul>
<% if @homework.homework_type != 3 %>
<ul class="mt10 fl">
<li class="hworkStName mr10 mt16" title="姓名">
<%= student_work.user.show_name%>
</li>
<li class="hworkStID mt16" title="学号">
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
</li>
</ul>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<ul class="mt10 fl">
<li class="hworkPrName mr10 mt12" title="项目名称">
<%= student_work.project.name %>
</li>
</ul>
<% end %>
</li>
<% else%>
<li class="hworkPortrait mt15 mr10">
@ -33,14 +46,22 @@
</div>
</li>
<li onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;" class="student_work_<%= student_work.id%>">
<ul class="mt10 fl">
<li class="hworkStName mr10 mt16" title="姓名">
匿名
</li>
<li class="hworkStID mt16" title="学号">
--
</li>
</ul>
<% if @homework.homework_type != 3 %>
<ul class="mt10 fl">
<li class="hworkStName mr10 mt16" title="姓名">
匿名
</li>
<li class="hworkStID mt16" title="学号">
--
</li>
</ul>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<ul class="mt10 fl">
<li class="hworkPrName mr10 mt12" title="项目名称">
匿名
</li>
</ul>
<% end %>
</li>
<% end%>

View File

@ -0,0 +1,58 @@
<div id="popbox02" style="">
<span class="f16 fontBlue">关联项目</span>
<a href="javascript:void(0);" class="popClose" onclick="clickCanel();"></a>
<%=form_tag url_for(:controller=>'student_work',:action=>'student_work_project',:homework=>@homework.id,:user_activity_id=>@user_activity_id,:is_in_course=>@is_in_course,:course_activity =>@course_activity),:id =>'student_work_relate_project',:class=>'resourcesSearchBox',:remote => true do %>
<input type="text" name="project" placeholder="输入项目名称进行搜索" class="searchResourcePopup mb10" />
<div class="cl"></div>
<p id="no_search_result" class="c_red" style="width:220px;display: none">您当前尚未参与任何项目,请先加入项目再关联。</p>
<ul id="search_project_list" class="maxHeight100"></ul>
<p id="notes" class="c_red"></p>
<div class="courseSendSubmit mt10"><a href="javascript:void(0);" class="sendSourceText" onclick="clickOK();">确定</a></div>
<div class="courseSendCancel mt10"><a href="javascript:void(0);" class="sendSourceText" onclick="clickCanel();">取消</a></div>
<div class="cl"></div>
<% end %>
</div>
<script type="text/javascript">
var lastSearchCondition = '';
var count = 0;
function search_pros(e){
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
{
return;
}
lastSearchCondition = $(e.target).val().trim();
$.ajax({
url: '<%= url_for(:controller => 'student_work', :action => 'search_user_projects') %>'+'?name='+ e.target.value,
type:'get'
});
}
function throttle(method,context,e){
clearTimeout(method.tId);
method.tId=setTimeout(function(){
method.call(context,e);
},500);
}
//查询项目
$("input[name='project']").on('input', function (e) {
throttle(search_pros,window,e);
});
$(document).ready(function(){
$.ajax({
url: '<%= url_for(:controller => 'student_work', :action => 'search_user_projects') %>'+'?first=1',
type:'get'
});
});
function clickOK() {
var radio = $("input[name='projectName']:checked");
if(radio.length < 1) {
$("#notes").html("请先选择一个项目");
return false;
} else {
$("#student_work_relate_project").submit();
}
}
</script>

View File

@ -1,5 +1,12 @@
<div class="show_hwork_arrow"></div>
<div class="showHwork">
<% is_teacher = User.current.allowed_to?(:as_teacher, @homework.course) || User.current.admin? %>
<% if @homework.homework_type != 3 %>
<% is_my_work = work.user == User.current%>
<% else %>
<% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %>
<% is_my_work = pro && pro.student_work_id == work.id%>
<% end %>
<ul>
<li class="fl" >
<span class="tit_fb">上交时间:</span>
@ -15,7 +22,7 @@
<%= link_to "",edit_student_work_path(work),:class => "pic_edit",:title => "修改"%>
</li>
<% end%>
<% if @homework.homework_detail_manual.comment_status == 3 && work.user != User.current%>
<% if @homework.homework_detail_manual.comment_status == 3 && !is_my_work %>
<!-- 匿评结束阶段,显示点赞按钮 -->
<li class="fr" id="student_work_praise_<%= work.id%>">
<%= render :partial => 'student_work_praise' %>
@ -25,11 +32,24 @@
<!--<li ><span class="tit_fb"> 参与人员:</span>程梦雯&nbsp;&nbsp;王强</li>-->
<% if work.project%>
<li >
<span class="tit_fb"> 关联项目:</span>
<%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
<% if @homework.homework_type == 3 && work.student_work_projects && (@homework.homework_detail_manual.comment_status != 2 || is_my_work || is_teacher ) %>
<div class="cl"></div>
<li>
<span class="tit_fb"> 参与人员:</span>
<%= link_to(work.user.show_name+"(组长)", user_path(work.user.id), :class => "linkBlue" )%>
<% members = work.student_work_projects.where("is_leader = 0") %>
<% members.each do |member| if !members.empty? %>
、<%=link_to((User.find member.user_id).show_name, user_path(member.user.id), :class => "linkBlue" ) %>
<% end %>
<% end %>
</li>
<% if @homework.homework_detail_group.base_on_project == 1 %>
<li>
<span class="tit_fb"> 关联项目:</span>
<%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
<span class="ml5">(综合评分:<font class="c_red"><%=work.project.project_score.score.to_i %></font>)</span>
</li>
<% end %>
<% end%>
<li >
@ -52,7 +72,7 @@
<div class="cl"></div>
</li>
<li >
<% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current)%>
<% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && !is_my_work)%>
<!-- 老师 || 开启匿评状态 && 不是当前用户自己的作品 -->
<div id="add_student_score_<%= work.id%>" class="mt10 evaluation">
<%= render :partial => 'add_score',:locals => {:work => work,:score => score}%>

View File

@ -40,12 +40,17 @@
<% end%>
<div class="cl"></div>
<div id="about_hwork_<%= student_work.id%>">
<% if student_work.user == User.current && !@is_evaluation %>
<% if @homework.homework_type != 3 && student_work.user == User.current && !@is_evaluation %>
<% if @homework.homework_type == 2%>
<%=render :partial => 'programing_work_show', :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %>
<% else %>
<%=render :partial => 'show' , :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %>
<% end %>
<% elsif @homework.homework_type == 3 %>
<% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %>
<% if pro && pro.student_work_id == student_work.id && !@is_evaluation %>
<%=render :partial => 'show' , :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %>
<% end %>
<% end %>
</div>
<div class="cl"></div>

View File

@ -0,0 +1,7 @@
<% if @user_activity_id != -1 %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity => @course_activity}) %>");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
<% else%>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework,:is_in_course => @is_in_course}) %>");
init_activity_KindEditor_data(<%= @homework.id%>,"","87%");
<% end %>

View File

@ -48,7 +48,7 @@
</div>
<div id="homework_attachments">
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => @work, :has_program=>false} %>
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => @work, :has_program=>false,:has_group=>false} %>
</div>
<div class="mt5">

View File

@ -34,6 +34,44 @@
)
}
}
// 添加组成员
function show_group_member() {
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/choose_group_member',:locals => {:homework=>@homework}) %>');
showModal('ajax-modal', '528px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("addMemberCP");
}
// 关联项目
function show_project() {
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/relate_project',:locals => {:homework=>@homework}) %>');
showModal('ajax-modal', '320px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("groupPopUp");
}
// 作品校验
function popupRegex(){
if(regexStudentWorkName()&&regexStudentWorkDescription())
{
if($("#group_member_ids").length > 0) {
if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) {
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("anonymos");
}
} else {
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("anonymos");
}
}
}
</script>
<div class="homepageRightBanner mb10">
@ -78,7 +116,11 @@
提示:作品名称和描述中不要出现真实的姓名信息
</div>
<div class="cl"></div>
<% if @homework.homework_type == 3 %>
<span id="min_num_member" style="display: none"><%=@homework.homework_detail_group.min_num %></span>
<span id="max_num_member" style="display: none"><%=@homework.homework_detail_group.max_num %></span>
<%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>User.current.id %>
<% end %>
<div>
<%= f.text_field "name", :required => true, :size => 60, :class => "InputBox W700", :maxlength => 200, :placeholder => "请简洁的概括作品的功能或特性", :onkeyup => "regexStudentWorkName();" %>
<div class="cl"></div>
@ -95,20 +137,29 @@
</div>
<div id="homework_attachments">
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false} %>
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false,:has_group=>false} %>
</div>
<div id="group_member">
</div>
<div id="relate_project">
</div>
<div class="mt5 fl">
<a href="javascript:void(0);" class="RalationIcon fl mt3" onclick="show_project();">关联项目</a>
</div>
<div class="cl"></div>
<% if @homework.homework_type == 3 %>
<div class="mt5 fl">
<a href="javascript:void(0);" class="memberBtn fl mt3 mr15" title="请添加小组的其他成员" onclick="show_group_member();">合作成员</a>
</div>
<% end %>
<div class="mt10 none" id="about_project">
<%= select_tag :project_id, options_for_select(user_projects_option, @student_work.project_id), {:class => "InputBox W680 fl"} %>
<!--<div class="mt5 fl">
<a href="javascript:void(0);" class="RalationIcon fl mt3" title="请选择作业的关联项目" onclick="show_project();">关联项目</a>
</div>-->
<!--<div class="mt10 none" id="about_project">
<%#= select_tag :project_id, options_for_select(user_projects_option, @student_work.project_id), {:class => "InputBox W680 fl"} %>
<%#=link_to "", new_project_path, :class => "ml5 mt5 SetUpIcon fl", :title => "快速创建"%>
<a class=" ml5 mt5 SetUpIcon fl" href="javascript:void(0)" title="快速创建" onclick="new_project();"></a>
<div class="cl"></div>
</div>
</div>-->
<div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="popupRegex();new_student_work();">提交</a>
@ -118,16 +169,4 @@
<div class="cl"></div>
<% end%>
</div><!----HomeWorkCon end-->
</div>
<script type="text/javascript">
function popupRegex(){
if(regexStudentWorkName()&&regexStudentWorkDescription())
{
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("anonymos");
}
}
</script>
</div>

View File

@ -0,0 +1,5 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/relate_project') %>');
showModal('ajax-modal', '320px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("groupPopUp");

View File

@ -1,2 +1,2 @@
hideModal('#popbox02');
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false})%>");
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false,:has_group=>false})%>");

View File

@ -0,0 +1,33 @@
$("#all_students_list").empty();
<% @users.each do |user|%>
var link = "<li id='student_<%=user.id %>'><%=user.show_name %>";
<% unless user.user_extensions.student_id == "" %>
link += "(<%=user.user_extensions.student_id %>)";
<% end %>
link += "</li>";
$("#all_students_list").append(link);
var str = "";
var lists = $("#choose_students_list li");
if(lists.length > 0) {
for(var i=0; i<lists.length; i++) {
var id = $(lists[i]).attr("id").replace(/[^0-9]/ig,"");
str += id;
if (i != lists.length -1) {
str += ",";
}
}
}
<% if user.id.to_i != User.current.id.to_i %>
if (str.indexOf(<%=user.id.to_s %>) < 0) {
$("#student_<%=user.id %>").one("click",function choose_student() {
var li = "<li id='choose_student_<%=user.id %>'";
<% if user.id.to_i != User.current.id.to_i %>
li += " onclick='delete_student(<%=user.id %>);'";
<% end %>
li += ">" + $("#student_<%=user.id %>").html()+"</li>";
$("#choose_students_list").append(li);
});
}
<% end %>
<% end %>

View File

@ -0,0 +1,9 @@
<% if @first == 1 && @project_ids.empty? %>
$("#no_search_result").show();
<% else %>
$("#search_project_list").html("");
<% @project_ids.each do |project|%>
link = "<li><label><input type='radio' class='courseSendCheckbox' name='projectName' value='<%=project.id%>'/><span class='sendCourseName'> <%=project.name %> </span></label></li>";
$("#search_project_list").append(link );
<% end %>
<% end %>

View File

@ -0,0 +1,8 @@
hideModal("#popbox02");
<% if @user_activity_id != -1 %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity => @course_activity}) %>");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
<% else%>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework,:is_in_course => @is_in_course}) %>");
init_activity_KindEditor_data(<%= @homework.id%>,"","87%");
<% end %>

View File

@ -44,7 +44,27 @@
<span class="green_homework_btn_cir ml5" title="目前教师和教辅正在评阅">教师评阅中</span>
<% end%>
<% end%>
<div class="cl"></div>
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1%>
<span class="c_red">系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span>
<% elsif activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 0%>
<span class="c_red">系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!</span>
<% end %>
<div class="homepagePostSubmitContainer">
<% if activity.homework_type == 3 && !is_teacher && activity.homework_detail_group.base_on_project == 1 %>
<% projects = cur_user_projects_for_homework activity %>
<% works = cur_user_works_for_homework activity %>
<% if works.nil? && projects.nil? %>
<div class="homepagePostSubmit">
<%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => activity.id,:is_in_course=>-1,:user_activity_id=>user_activity_id,:course_activity=>course_activity),remote: true,:class=> 'c_blue', :title=> '请选择分组作业关联的项目' %>
<%#= relate_project(activity,is_teacher,-1,user_activity_id,course_activity) %>
</div>
<% elsif works.nil? %>
<div class="homepagePostSubmit">
<%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => activity.id,:is_in_course=>-1,:user_activity_id=>user_activity_id,:course_activity=>course_activity), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %>
</div>
<% end %>
<% end %>
<div class="homepagePostSubmit">
<% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
<%= user_for_homework_common activity,is_teacher %>
@ -77,6 +97,26 @@
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => activity.attachments} %>
<div class="cl"></div>
</div>
<% if activity.homework_type == 3 && !activity.student_work_projects.empty? && activity.homework_detail_group.base_on_project == 1 %>
<div class="mt10">
<div class="fl mr5 fontGrey3">
<!--<img src="/images/course/proRelated.png" width="25" height="25" class="borderRadius mt7 ml7" title="已关联项目" />-->
已关联项目:
</div>
<% activity.student_work_projects.where("is_leader = 1").each do |pro| %>
<div class="mr10 mb10 fl">
<% project = Project.find pro.project_id || User.current.member_of?(project) || User.current.admin? %>
<% if project.is_public || project.user_id == User.current.id %>
<%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:alt =>"项目头像" %>
<% else %>
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius") %>
<% end %>
<p class="c_red tac" title="综合评分"><%=project.project_score.score.to_i %></p>
</div>
<% end %>
</div>
<% end %>
<div class="cl"></div>
<% if is_teacher%>
<% comment_status = activity.homework_detail_manual.comment_status %>
<div class="homepagePostSetting">

View File

@ -0,0 +1,31 @@
<span class="f16 fontBlue">分组设置</span>
<a href="javascript:void(0);" class="popClose" title="关闭弹框"></a>
<div class="mt10">
<span class="f14 fontGrey3 mr5">每组最小人数:</span>
<input id="min_num" type="text" name="" class="markInput" value="<%=(edit_mode && homework.is_group_homework?) ? homework.homework_detail_group.min_num : 2 %>" />人
</div>
<div class="mt10">
<span class="f14 fontGrey3 mr5">每组最大人数:</span>
<input id="max_num" type="text" name="" class="markInput" value="<%=(edit_mode && homework.is_group_homework?) ? homework.homework_detail_group.max_num : 10 %>" />人
</div>
<div class="mb10 mt10">
<label>
<input type="checkbox" class="mr5" name="base_on_project" value="<%=(edit_mode && homework.is_group_homework?) ? homework.homework_detail_group.base_on_project : 0 %>" id="base_on_project"/>
<span class="f14 fontGrey3 mr10">是否基于项目实施</span>
</label>
<p class="c_red">提醒勾选后各小组必须在Trustie平台创建项目教师可随时观察平台对各小组最新进展的实时统计。</p>
</div>
<div class="courseSendSubmit">
<a href="javascript:void(0);" class="group_btn sendSourceText">确定</a>
</div>
<div class="courseSendCancel">
<a href="javascript:void(0);" class="sendSourceText linkGrey6" id="cancel_group">取消</a>
</div>
<div class="cl"></div>
<script type="text/javascript">
$(function(){
if($.trim($("#base_on_project").val()) == 1) {
$("#base_on_project").attr('checked','checked');
}
});
</script>

View File

@ -43,16 +43,38 @@
:lebel_file_uploding => l(:lebel_file_uploding),
:delete_all_files => l(:text_are_you_sure_all)
} %>
<span class="fl fontGrey2 group_detail_info"></span>
<div class="cl"></div>
<span class="fl fontGrey2" id="group_members"></span>
<div class="cl"></div>
<% if @homework && @homework.homework_type == 3 %>
<sapn class="fl fontGrey2" id="group_members_show">
合作成员:<%=User.current.show_name %>(组长)
</sapn>
<span id="student_work_group_textarea" class="ml10 c_red fl"></span>
<% end %>
<div class="cl"></div>
<span class="fl fontGrey2" id="relate_project_show">
<% if @homework %>
<% unless @homework.student_work_projects.where("user_id = #{User.current.id}").empty? %>
<% project = Project.find @homework.student_work_projects.where("user_id = #{User.current.id}").first.project_id %>
关联项目:<%=project.name %>
<% end %>
<% end %>
</span>
</div>
<div class="cl"></div>
<div class="mt5 fl">
<!-- , user_import_resource_user_path(User.current.id,:homework_id=>container.id) -->
<a href="javascript:void(0);" class="AnnexBtn fl mt3 mr20" onclick="$('#_file').click();">上传附件</a>
<%= link_to "资源库",{:controller => 'users',:action=>'user_import_resource',:id=>User.current.id,:homework_id=>container.id},:class => "FilesBtn fl mt3 mr20",:remote => true%>
<a href="javascript:void(0);" class="AnnexBtn fl mt3 mr15" onclick="$('#_file').click();" title="请选择文件上传">上传附件</a>
<%= link_to "资源库",{:controller => 'users',:action=>'user_import_resource',:id=>User.current.id,:homework_id=>container.id},:class => "FilesBtn fl mt3 mr15",:title=>"请从资源库中选择文件作为作品的附件",:remote => true%>
<% if defined?(has_program) && has_program %>
<a href="javascript:void(0);" class="ProBtn fl mt3">编程</a>
<span class="fl C_lgrey mt3 program_detail_info"></span>
<a href="javascript:void(0);" class="ProBtn fl mt3" title="请设置编程语言和输入测试集">编程</a>
<span class="fl C_lgrey mt3 program_detail_info mr15"></span>
<% end %>
<% if defined?(has_group) && has_group %>
<a href="javascript:void(0);" class="groupBtn fl mt3" title="请设置分组作业的相关参数">分组</a>
<% end %>
</div>

View File

@ -44,8 +44,25 @@
<span class="green_homework_btn_cir ml5" title="目前教师和教辅正在评阅">教师评阅中</span>
<% end%>
<% end%>
<div class="cl"></div>
<% if homework_common.homework_type == 3%>
<span class="c_red">系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span>
<% end %>
<div class="homepagePostSubmitContainer">
<% if homework_common.homework_type == 3 && !is_teacher && homework_common.homework_detail_group.base_on_project == 1%>
<% projects = cur_user_projects_for_homework homework_common %>
<% works = cur_user_works_for_homework homework_common %>
<% if works.nil? && projects.nil? %>
<div class="homepagePostSubmit">
<%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => homework_common.id,:is_in_course=>is_in_course,:user_activity_id=>-1,:course_activity=>-1),remote: true,:class=> 'c_blue', :title=> '请选择分组作业关联的项目' %>
<%#= relate_project(activity,is_teacher,-1,user_activity_id,course_activity) %>
</div>
<% elsif works.nil? %>
<div class="homepagePostSubmit">
<%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => homework_common.id,:is_in_course=>is_in_course,:user_activity_id=>-1,:course_activity=>-1), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %>
</div>
<% end %>
<% end %>
<div class="homepagePostSubmit">
<%= user_for_homework_common homework_common,is_teacher %>
</div>
@ -82,6 +99,26 @@
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework_common.attachments} %>
<div class="cl"></div>
</div>
<% if homework_common.homework_type == 3 && !homework_common.student_work_projects.empty? && homework_common.homework_detail_group.base_on_project == 1 %>
<div class="mt10">
<div class="fl mr5 fontGrey3">
<!--<img src="/images/course/proRelated.png" width="25" height="25" class="borderRadius mt7 ml7" title="已关联项目" />-->
已关联项目:
</div>
<% homework_common.student_work_projects.where("is_leader = 1").each do |pro| %>
<div class="mr10 mb10 fl">
<% project = Project.find pro.project_id %>
<% if project.is_public == 1 || User.current.member_of?(project) || User.current.admin? %>
<%=link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name) %>
<% else %>
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius") %>
<% end %>
<p class="c_red tac" title="综合评分"><%=project.project_score.score.to_i %></p>
</div>
<% end %>
</div>
<% end %>
<div class="cl"></div>
<% if is_teacher%>
<% comment_status = homework_common.homework_detail_manual.comment_status%>
<div class="homepagePostSetting">

View File

@ -4,6 +4,9 @@
<script type="text/javascript">
$(function(){
$("#BluePopupBox a.BlueCirBtn").click();
<% if edit_mode && homework.is_group_homework? %>
$("#GroupPopupBox a.group_btn").click();
<% end %>
});
</script>
<% end %>
@ -54,7 +57,7 @@
<div id="homework_attachments">
<!-- 编辑作业 && 作业类型为匿评作业 时没有编程选项-->
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => homework, :has_program=>!(edit_mode && homework.homework_type == 1)} %>
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => homework, :has_program=>!(edit_mode && homework.homework_type != 2), :has_group=>!(edit_mode && homework.homework_type != 3)} %>
</div>
@ -97,7 +100,18 @@
</div>
</script>
<script id="t:group-input-list" type="text/html">
<div class="group-input">
<input type="hidden" name="min_num" value="<!= min_num !>" />
<input type="hidden" name="max_num" value="<!= max_num !>" />
<input type="hidden" name="base_on_project" value="<!= base_on_project !>" />
</div>
</script>
<div class="BluePopupBox" id="BluePopupBox" style="display:none">
<%= render :partial => 'users/user_programing_attr', :locals => {:edit_mode => edit_mode, :homework=>homework} %>
</div><!----BluePopupBox end-->
<div class="BluePopupBox" style="display:none" id="GroupPopupBox">
<%= render :partial => 'users/user_group_attr', :locals => {:edit_mode => edit_mode, :homework=>homework}%>
</div>

View File

@ -45,12 +45,12 @@
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<% if !User.current.allowed_to?(:as_teacher, ma.course_message.course) && cur_user_works_for_homework(ma.course_message).nil? %>
<%= link_to "作业题" + ma.course_message.name, new_student_work_path(:homework => ma.course_message.id),
<%= link_to "作业题:" + ma.course_message.name, new_student_work_path(:homework => ma.course_message.id),
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %>
<% else %>
<%= link_to "作业题" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
<%= link_to "作业题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover => "message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %>
@ -103,7 +103,7 @@
user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :title => "#{ma.course_message.user.lastname + ma.course_message.user.firstname}老师" %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布的作业:</span></li>
<li class="homepageHomeworkContent fl">
<%= link_to "作业题" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
<%= link_to "作业题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover => "message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %>
@ -142,7 +142,7 @@
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">启动了作业匿评:</span>
</li>
<li class="homepageNewsContent fl">
<%= link_to "作业题" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
<%= link_to "作业题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover => "message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %>
</li>
@ -173,19 +173,25 @@
<%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">关闭了作业匿评:</span></li>
<li class="homepageNewsContent fl">
<%= link_to "作业题" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
<%= link_to "作业题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
:onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))"%>
</li>
<div style="display: none" class="message_title_red system_message_style">
<p>
<%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
<%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>关闭了匿评,作业详情如下:
该作业已经被关闭了匿评。作业信息如下:
</p>
<ul class="ul_grey">
<li>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)</li>
<li>作业标题:<%= ma.course_message.name %></li>
</ul>
<p></p>
<p class="c_red">注缺省情况下系统将在作业提交截止日期后14天自动关闭匿评。</p>
<p></p>
<% if User.current.allowed_to?(:as_teacher,ma.course_message.course)%>
<p>祝您的教学活动高效、顺利、愉快!</p>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
@ -202,7 +208,7 @@
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">启动作业匿评失败</span>
</li>
<li class="homepageNewsContent fl">
<%= link_to "作业题目:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
<%= link_to truncate(ma.course_message.name,:length=>25)+'(失败原因提交作品的人数低于2人)', student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "c_red" : "newsGrey "}",
:onmouseover => "message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %>
</li>
@ -213,7 +219,6 @@
</p>
<ul class="ul_normal_color">
<li>失败原因:<span style="color:red;">提交作品的人数低于2人</span></li>
<li>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年' + ma.course_message.course.term %>)</li>
<li>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></li>
<li>提交截止:<span style="color:Red;"><%= ma.course_message.end_time%>&nbsp;&nbsp;23:59</span></li>
@ -385,7 +390,7 @@
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布的作业:</span>
</li>
<li class="homepageHomeworkContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to "作业题" + ma.course_message.homework_common.name, student_work_index_path(:homework => ma.course_message.homework_common_id),
<%= link_to "作业题:" + ma.course_message.homework_common.name, student_work_index_path(:homework => ma.course_message.homework_common_id),
:class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
:onmouseover => "message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %></a>

View File

@ -15,4 +15,6 @@ $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closePopUp();' style='margin-left: 435px;' class='resourceClose'></a>");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
var val = $("#search_course_input").val();
$("#search_course_input").val("").focus().val(val);

View File

@ -12,3 +12,6 @@ $('#ajax-modal').before("<a href='javascript:void(0)' onclick='closePopUp();' st
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("resourceUploadPopup").addClass("popbox")
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
//$("#search_project_input").focus();
var val = $("#search_project_input").val();
$("#search_project_input").val("").focus().val(val);

View File

@ -4,7 +4,7 @@
$("#homework_publish_time").val("");
$("#homework_end_time").val("");
$("#course_id").val($("#option_select").val());
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true })%>");
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true,:has_group => true })%>");
homework_description_editor.html("");
$("#homework_editor").toggle();
}

View File

@ -361,12 +361,11 @@
if(user_id === '<%= User.current.id%>') {
res_name = line.children().eq(1).children().attr('title');
res_link = line.children().eq(1).html();
line.children().eq(1).html('<%= form_tag(url_for(:controller => 'users',:action => 'rename_resource',:method => 'post',:remote=>true,:id=>@user.id),:id=>"res_name_form" ) do%>' +
line.children().eq(1).html(
'<input name="res_name" id="res_name" ' +
'style="height: 2em;line-height: 2em;overflow: hidden;" onblur="restore();" ' +
'style="height: 2em;line-height: 2em;overflow: hidden;" onblur="restore();" onkeypress="if(event.keyCode==13){event.preventDefault();this.blur();}" ' +
'value="'+res_name+
'"/> <input type="hidden" id ="res_id" name="res_id" value="'+id+'"/>'+
'<% end %>');
'"/> <input type="hidden" id ="res_id" name="res_id" value="'+id+'"/>');
$("#res_name").focus();
$("html,body").animate({scrollTop:$("#res_name").offset().top},1000)
}else{
@ -382,6 +381,8 @@
return str.slice(0, i + 1);
}
//恢复编辑状态到链接状态
//如果当前是编辑状态,任何的不在输入框里的单击右键事件都需要将编辑状态变回链接状态
//如果是编辑状态,且做了修改,那么久要进行修改,并且将修改值经过处理替换到页面显示
@ -395,22 +396,22 @@
if( name && name != res_name.trim()){
if(confirm('确定修改为 '+name)){
$.post(
'<%=rename_resource_user_path(@user) %>',
"res_name="+$('#res_name').val()+"&res_id="+$("#res_id").val(),
function (data){
if(data != 'fail'){//修改成功,那么将链接恢复,并且将链接的显示内容改变。链接可以不变
$.ajax({
url: '<%=rename_resource_user_path(@user) %>'+ "?res_name="+$('#res_name').val() + "&res_id=" + $("#res_id").val(),
type:'get',
success:function (data)
{
if (data != 'fail') {//修改成功,那么将链接恢复,并且将链接的显示内容改变。链接可以不变
last_line.children().eq(1).html(res_link);
last_line.children().eq(1).children().attr('title',name);
last_line.children().eq(1).children().attr('href',data);
last_line.children().eq(1).children().html(name.length > 17? name.substring(0,17)+'...' : name);
}else{
last_line.children().eq(1).children().attr('title', name);
last_line.children().eq(1).children().attr('href', data);
last_line.children().eq(1).children().html(name.length > 17 ? name.substring(0, 17) + '...' : name);
} else {
last_line.children().eq(1).html(res_link);
res_link = null; //如果修改失败恢复之后将res_link置空
}
},
'text'
);
}
} );
}else{
last_line.children().eq(1).html(res_link);
res_link = null; //如果没有做修改恢复之后将res_link置空

View File

@ -5,7 +5,7 @@ $("#homework_end_time").val("<%= @homework.end_time%>");
<% if @select_course == "0"%>
$("#course_id").val("<%= @homework.course_id%>");
<% end%>
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => @homework,:has_program => true })%>");
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => @homework,:has_program => true,:has_group => true })%>");
homework_description_editor.html("<%= escape_javascript(@homework.description.html_safe)%>");
$("#BluePopupBox").html("<%=escape_javascript( render :partial => 'users/user_programing_attr', :locals => {:edit_mode => true, :homework => @homework})%>");
//$("input[name='homework_type']").val("<%#= @homework.homework_type%>");

View File

@ -72,6 +72,22 @@
</li>
<div class="cl"></div>
</ul>
<% when 'memo'%>
<ul class="searchContent">
<li class="fl">
</li>
<li class="fl searchContentDes">
<ul class="fl">
<li class="f16 mb5"><a href="<%= forum_memo_path(:forum_id=>item.forum_id,:id=>item.id)%>" class="fontGrey3 fl"><%= item.try(:highlight).try(:subject) ? item.highlight.subject[0].html_safe : item.subject %></a>
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag">帖子</span></div>
<div class="cl"></div>
</li>
<li class="fontGrey3 mb5"><%= item.try(:highlight).try(:content) ? item.highlight.content[0].html_safe : item.content.html_safe%></li>
<li class="f12 fontGrey2"><span class="mr30">发帖人:<%= item.author_id ? User.find(item.author_id).login : '无' %></span><span class="mr30">创建时间:<%= format_date( item.created_at) %></span></li>
</ul>
</li>
<div class="cl"></div>
</ul>
<%end %>
<% end %>
<div class="pageRoll">

View File

@ -0,0 +1,24 @@
<% unless memos.nil? || memos.empty?%>
<% memos.each do |memo|%>
<ul class="searchContent">
<li class="fl">
<!--<img src="images/homepageImage.jpg" alt="个人图片" width="75" height="75" class="searchCourseImage" />-->
<%= link_to image_tag(url_to_avatar(User.find(memo.author_id)), :width => "75", :height => "75",:class=>'searchCourseImage'), forum_memo_path(:forum_id=>memo.forum_id,:id=>memo.id), :alt => "贴吧图片" %>
</li>
<li class="fl searchContentDes">
<ul class="fl">
<li class="f16 mb5"><a href="<%= forum_memo_path(:forum_id=>memo.forum_id,:id=>memo.id)%>" class="fontGrey3 fl"><%= memo.try(:highlight).try(:subject) ? memo.highlight.subject[0].html_safe : memo.subject %></a>
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag">帖子</span></div>
<div class="cl"></div>
</li>
<li class="fontGrey3 mb5"><%= memo.try(:highlight).try(:content) ? memo.highlight.content[0].html_safe : memo.content.html_safe%></li>
<li class="f12 fontGrey2"><span class="mr30">发帖人:<%= memo.author_id ? User.find(memo.author_id).login : '无' %></span><span class="mr30">创建时间:<%= format_date( memo.created_at) %></span></li>
</ul>
</li>
<div class="cl"></div>
</ul>
<% end %>
<div class="pageRoll">
<%= paginate memos,:params => {:controller => 'welcome', :action => 'search',:search_type=>'memo'}%>
</div>
<% end %>

View File

@ -3,7 +3,7 @@
function g(o){return document.getElementById(o);}
function HoverLi(n){
//如果有N个标签,就将i<=N;
for(var i=1;i<=5;i++){
for(var i=1;i<=6;i++){
g('searchBaner_'+i).className='searchBannerNormal';
g('searchContent_'+i).className='undis';g('searchNum_'+i).className="numRed";
g('searchType_'+i).className="fontGrey2 f14";
@ -28,6 +28,8 @@
search('attachment')
}else if(n == 5){
search('project')
}else if(n == 6){
search('memo')
}
}
@ -56,6 +58,10 @@
}else if('<%= @search_type%>' == 'project'){
HoverLi(5)
$("#searchContent_5").html('<%= escape_javascript(render :partial => 'search_project_results',:locals => {:projects=>@projects})%>');
}else if('<%= @search_type%>' == 'memo')
{
HoverLi(6)
$("#searchContent_6").html('<%= escape_javascript(render :partial => 'search_memo_results',:locals => {:memos=>@memos})%>');
}
})
//如果要做成点击后再转到请将<li>中的onmouseover 改成 onclick;
@ -76,6 +82,7 @@
<li id="searchBaner_3" onclick="HoverLi(3);on_click_search(3);"><a href="javascript:void(0);" id="searchType_3" class="fontGrey2 f14">课程<span style="font-weight:normal;"><font id="searchNum_3" class="numRed">(<%=@course_count%>)</font></span></a></li>
<li id="searchBaner_4" onclick="HoverLi(4);on_click_search(4);"><a href="javascript:void(0);" id="searchType_4" class="fontGrey2 f14">资源<span class="numRed" style="font-weight:normal;"><font id="searchNum_4" class="numRed">(<%= @attach_count%>)</font></span></a></li>
<li id="searchBaner_5" onclick="HoverLi(5);on_click_search(5);"><a href="javascript:void(0);" id="searchType_5" class="fontGrey2 f14">项目<span class="numRed" style="font-weight:normal;"><font id="searchNum_5" class="numRed">(<%= @project_count%>)</font></span></a></li>
<li id="searchBaner_6" onclick="HoverLi(6);on_click_search(6);"><a href="javascript:void(0);" id="searchType_6" class="fontGrey2 f14">帖子<span class="numRed" style="font-weight:normal;"><font id="searchNum_6" class="numRed">(<%= @memo_count%>)</font></span></a></li>
<div class="cl"></div>
</ul>
<ul id="searchTips" style="display:none;">
@ -94,6 +101,9 @@
</div>
<div id="searchContent_5" class="undis">
</div>
<div id="searchContent_6" class="undis">
</div>
</div>
</div>

View File

@ -9,5 +9,7 @@ $("#searchContent_3").html('<%= escape_javascript(render :partial => 'search_cou
$("#searchContent_5").html('<%= escape_javascript(render :partial => 'search_project_results',:locals => {:projects=>@projects})%>');
<% when 'attachment'%>
$("#searchContent_4").html('<%= escape_javascript(render :partial => 'search_attachment_results',:locals => {:attachments=>@attachments})%>');
<% when 'memo'%>
$("#searchContent_6").html('<%= escape_javascript(render :partial => 'search_memo_results',:locals => {:memos=>@memos})%>');
<%else%>
<%end %>

View File

@ -72,7 +72,17 @@ RedmineApp::Application.routes.draw do
end
resources :org_subfields do
resources :files, :only => [:index, :new, :create] do
collection do
match "getattachtype", :via => [:get, :post]
match "search",:via => [:post,:get]
match "searchone4reload",:via => [:post,:get]
match "search_tag_attachment", :via => [:post,:get]
end
member do
match "quote_resource_show", :via => [:get]
end
end
end
resources :org_document_comments do
@ -219,6 +229,11 @@ RedmineApp::Application.routes.draw do
end
collection do
post 'add_score_reply'
post 'student_work_project'
get 'new_student_work_project'
get 'search_user_projects'
get 'search_course_students'
get 'cancel_relate_project'
get 'delete_work'
get 'destroy_score_reply'
get 'student_work_absence_penalty'
@ -485,7 +500,7 @@ RedmineApp::Application.routes.draw do
post "add_exist_file_to_course"
post "add_exist_file_to_project"
get 'resource_preview'
post 'rename_resource'
get 'rename_resource'
get 'search_user_project'
get 'user_resource_type'
get 'user_ref_resource_search'

View File

@ -0,0 +1,14 @@
class CreateHomeworkDetailGroups < ActiveRecord::Migration
def change
create_table :homework_detail_groups do |t|
t.integer :homework_common_id
t.integer :min_num
t.integer :max_num
t.integer :base_on_project
t.references :homework_common
t.timestamps
end
add_index :homework_detail_groups, :homework_common_id
end
end

View File

@ -0,0 +1,13 @@
class CreateStudentWorkProjects < ActiveRecord::Migration
def change
create_table :student_work_projects do |t|
t.integer :homework_common_id
t.integer :student_work_id
t.integer :project_id
t.integer :user_id
t.integer :is_leader
t.timestamps
end
end
end

View File

@ -0,0 +1,8 @@
class AddIndexToStudentWorkProject < ActiveRecord::Migration
def change
add_index :student_work_projects, :homework_common_id
add_index :student_work_projects, :user_id
add_index :student_work_projects, :project_id
add_index :student_work_projects, :student_work_id
end
end

View File

@ -745,6 +745,17 @@ ActiveRecord::Schema.define(:version => 20151209085942) do
add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id"
create_table "homework_detail_groups", :force => true do |t|
t.integer "homework_common_id"
t.integer "min_num"
t.integer "max_num"
t.integer "base_on_project"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "homework_detail_groups", ["homework_common_id"], :name => "index_homework_detail_groups_on_homework_common_id"
create_table "homework_detail_manuals", :force => true do |t|
t.float "ta_proportion"
t.integer "comment_status"
@ -1500,6 +1511,21 @@ ActiveRecord::Schema.define(:version => 20151209085942) do
t.integer "project_id"
end
create_table "student_work_projects", :force => true do |t|
t.integer "homework_common_id"
t.integer "student_work_id"
t.integer "project_id"
t.integer "user_id"
t.integer "is_leader"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "student_work_projects", ["homework_common_id"], :name => "index_student_work_projects_on_homework_common_id"
add_index "student_work_projects", ["project_id"], :name => "index_student_work_projects_on_project_id"
add_index "student_work_projects", ["student_work_id"], :name => "index_student_work_projects_on_student_work_id"
add_index "student_work_projects", ["user_id"], :name => "index_student_work_projects_on_user_id"
create_table "student_work_tests", :force => true do |t|
t.integer "student_work_id"
t.datetime "created_at", :null => false

View File

@ -28,4 +28,11 @@ namespace :importer do
ENV['BATCH']='1000'
Rake::Task["elasticsearch:import:model"].invoke
end
task :importmemo do
ENV['CLASS']='Memo'
ENV['SCOPE']='indexable'
ENV['FORCE']='y'
ENV['BATCH']='1000'
Rake::Task["elasticsearch:import:model"].invoke
end
end

View File

@ -14,14 +14,33 @@ namespace :homework_evaluation do
if homework_common.anonymous_comment == 0 && homework_detail_manual.comment_status == 1 #新建状态才可开启匿评
student_works = homework_common.student_works
if student_works && student_works.size >= 2
student_works.each_with_index do |work, index|
user = work.user
n = homework_detail_manual.evaluation_num
n = n < student_works.size ? n : student_works.size - 1
assigned_homeworks = get_assigned_homeworks(student_works, n, index)
assigned_homeworks.each do |h|
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id)
student_works_evaluation_distributions.save
if homework_common.homework_type == 3
student_work_projects = homework_common.student_work_projects.where("student_work_id is not null")
student_work_projects.each_with_index do |pro_work, pro_index|
n = homework_detail_manual.evaluation_num
n = n < student_works.size ? n : student_works.size - 1
work_index = -1
student_works.each_with_index do |stu_work, stu_index|
if stu_work.id.to_i == pro_work.student_work_id.to_i
work_index = stu_index
end
end
assigned_homeworks = get_assigned_homeworks(student_works, n, work_index)
assigned_homeworks.each do |h|
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id)
student_works_evaluation_distributions.save
end
end
else
student_works.each_with_index do |work, index|
user = work.user
n = homework_detail_manual.evaluation_num
n = n < student_works.size ? n : student_works.size - 1
assigned_homeworks = get_assigned_homeworks(student_works, n, index)
assigned_homeworks.each do |h|
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id)
student_works_evaluation_distributions.save
end
end
end
homework_detail_manual.update_column('comment_status', 2)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -960,13 +960,31 @@ function regexStudentWorkDescription()
}
}
function regexStudentWorkMember(min, max) {
var members = $.trim($("#group_member_ids").val()).split(',');
if ( min <= members.length && members.length <= max ){
$("#student_work_group_textarea").text("");
return true;
} else {
$("#student_work_group_textarea").text("合作成员人数应为:"+min+"-"+max+"人");
return false;
}
}
//提交新建作品
function new_student_work()
{
if(regexStudentWorkName()&&regexStudentWorkDescription())
{
$("#new_student_work").submit();
$("#ajax-indicator").hide();
if($("#group_member_ids").length > 0) {
if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) {
$("#new_student_work").submit();
$("#ajax-indicator").hide();
}
} else {
$("#new_student_work").submit();
$("#ajax-indicator").hide();
}
}
}
@ -1369,4 +1387,4 @@ function submit_course_feedback() {
$("#course_feedback_new").submit();
var flag = true
}
}
}

View File

@ -124,7 +124,6 @@ $(function(){
$('#textarea_input_test').focus();
});
var saveProgramAnswers = function() {
var test_numbers = 0;
var valid = true;
@ -198,6 +197,68 @@ $(function(){
$(this).parent('.mt10').remove();
});
//分组作业
$("#GroupPopupBox").dialog({
modal: true,
autoOpen: false,
dialogClass: 'BluePopupBox',
minWidth: 290
});
$('a.groupBtn').live('click', function(){
$("#GroupPopupBox").dialog("open");
$(".ui-dialog-titlebar").hide();
$("a.popClose").on('click', function(){
$("#GroupPopupBox" ).dialog("close");
});
$("#cancel_group").on('click', function(){
$("#GroupPopupBox" ).dialog("close");
});
$('#min_num').focus();
});
var saveGroupAttr = function() {
var valid = true;
var base_on_project = 0;
var min = $.trim($("#min_num").val());
var max = $.trim($("#max_num").val());
if(min.length <= 0) {
$("#min_num").focus();
valid = false;
return false;
}
if(max.length <= 0) {
$("#max_num").focus();
valid = false;
return false;
}
if ($("#base_on_project").is(":checked")) {
base_on_project = 1;
}
if (valid) {
$("input[name=homework_type]").val(3);
$('span.group_detail_info').text('分组人数:'+min+'-'+max+' 人');
//保存js值
var data = {
base_on_project: base_on_project,
min_num: min,
max_num: max
};
//构建到form中
$('.group-input').remove();
var html=bt('t:group-input-list',data);
$("input[name=homework_type]").after(html);
}
return valid;
};
$("#GroupPopupBox a.group_btn").live('click', function(){
if(saveGroupAttr()){
if($( "#GroupPopupBox" ).dialog( "isOpen" )){
$("#GroupPopupBox").dialog( "close" );
}
}
});
//代码编辑器
if (typeof CodeMirror != "undefined") {

View File

@ -251,8 +251,15 @@ function new_student_work()
{
if(regexStudentWorkName()&&regexStudentWorkDescription())
{
$("#new_student_work").submit();
$("#ajax-indicator").hide();
if($("#group_member_ids").length > 0) {
if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) {
$("#new_student_work").submit();
$("#ajax-indicator").hide();
}
} else {
$("#new_student_work").submit();
$("#ajax-indicator").hide();
}
}
}
@ -298,12 +305,36 @@ function regexStudentWorkDescription()
}
}
function regexStudentWorkMember(min, max) {
var members = $.trim($("#group_member_ids").val()).split(',');
if ( min <= members.length && members.length <= max ){
$("#student_work_group_textarea").text("");
return true;
} else {
$("#student_work_group_textarea").text("合作成员人数应为:"+min+"-"+max+"人");
return false;
}
}
//学生作品
function show_project()
{
$("#about_project").slideToggle();
}
//添加分组成员
function show_group_member(){
$("#chooseGroupMember").dialog("open");
$(".ui-dialog-titlebar").hide();
$("a.popClose").on('click', function(){
$("#chooseGroupMember" ).dialog("close");
});
$("#cancel_add").on('click', function(){
$("#chooseGroupMember" ).dialog("close");
});
//$('#min_num').focus();
}
//textarea自适应高度 纯js写的 有浏览器判断
/**
* 文本框根据输入内容自适应高度

View File

@ -1182,21 +1182,32 @@ a:hover.testBtn{background: url(/images/course/hwork_icon.png) -81px -5px no-rep
a.groupBtn{ background: url(/images/course/hwork_icon.png) -2px -61px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
a:hover.groupBtn{background: url(/images/course/hwork_icon.png) -80px -61px no-repeat !important; color:#3598db; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
.markInput { outline:none; border:1px solid #e6e6e6; height:30px; width:50px; color:#3d3c3c; margin-right:5px; text-align:center; padding-left:0px;}
.groupPopUp {width:290px; height:auto; padding:15px; background-color:#ffffff; z-index:1000; position:relative;}
.groupPopUp {border:3px solid #269ac9; width:290px; height:auto; padding:15px; background-color:#ffffff; position:fixed !important;left:50%;top:50%;margin:-100px 0 0 -150px; -moz-border-radius:5px;}
.popClose {background:url(/images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:2px; top:3px;}
a.memberBtn{ background: url(/images/course/hwork_icon.png) -7px -90px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
a:hover.memberBtn{background: url(/images/course/hwork_icon.png) -80px -90px no-repeat !important; color:#3598db; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
.addMemberC {float:left; max-height:150px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:227px; background-color:#f1f1f1; min-height:150px; padding-top:10px;}
.addMemberC li {padding-left:10px; line-height:18px;}
.addMemberC li:hover {cursor:pointer; background-color:#cccccc;}
.addMemberCP {width:514px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; z-index:1000;}
.addMemberCP {width:514px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:fixed !important;left:50%;top:50%;margin:-100px 0 0 -150px; -moz-border-radius:5px;}
.rightArrow {margin:50px 15px 0px 15px; float:left;}
.relateText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight: bold;}
.maxHeight100 {max-height:100px; overflow-x:hidden; overflow-y:auto;}
.resubAtt {border-top:1px solid #dddddd; position:relative; margin-top:15px;}
.resubTitle {position:absolute; top:-10px; left:5px; background-color:#ffffff; display:block; font-weight:bold; padding:0px 2px;}
a.blueCir{ display:inline-block; padding:2px 5px; background-color:#ffffff;border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
a:hover.blueCir{ background:#3598db; color:#fff;}
.proList {background-color:#eaeaea; padding:5px 10px; display:block; max-width:655px; float:left;}
.borderRadius {border-radius:5px;}
.maxHeight100 {max-height:100px; overflow-x:hidden; overflow-y:auto;}
.proRelateWrap {width:38px; height:38px; border:1px solid #cecece; border-radius:3px; background-color:#f1f1f1;}
.mt7 {margin-top:7px;}
.ml7 {margin-left:7px;}
.tac {text-align:center;}
.proHelp {background:url(/images/course/hwork_icon.png) -5px -124px no-repeat; display:inline-block; width:15px; height:15px; display:inline-block;}
.hworkPrName {width:110px; max-width:110px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:18px; line-height:18px; font-size:12px; color:#888888; text-align:center;}
.mr150 {margin-right:150px;}
/*上传资源弹窗*/
.resourceUploadPopup {width:400px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;}
@ -1213,4 +1224,8 @@ a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat;
.uploadKeyword {margin-bottom:10px; outline:none; border:1px solid #e6e6e6; height:30px; width:280px;}
.mb10 {margin-bottom: 10px}
.mb15 {margin-bottom: 15px}
div.disable_link {background-color: #c1c1c1 !important;}
div.disable_link {background-color: #c1c1c1 !important;}
/*新课程资源库*/
.reCon{ margin:5px; width:710px;}
.reTop{width:710px; height:40px; background:#eaeaea; padding:5px;}

View File

@ -1355,13 +1355,29 @@ a:hover.testBtn{background: url(/images/course/hwork_icon.png) -81px -5px no-rep
a.groupBtn{ background: url(/images/course/hwork_icon.png) -2px -61px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
a:hover.groupBtn{background: url(/images/course/hwork_icon.png) -80px -61px no-repeat !important; color:#3598db; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
.markInput { outline:none; border:1px solid #e6e6e6; height:30px; width:50px; color:#3d3c3c; margin-right:5px; text-align:center; padding-left:0px;}
.groupPopUp {width:290px; height:auto; padding:15px; background-color:#ffffff; z-index:1000; position:relative;}
.groupPopUp {border:3px solid #269ac9; width:290px; height:auto; padding:15px; background-color:#ffffff;position:fixed !important;left:50%;top:50%;margin:-100px 0 0 -150px; -moz-border-radius:5px;}
.popClose {background:url(/images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:2px; top:3px;}
a.memberBtn{ background: url(/images/course/hwork_icon.png) -7px -90px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
a:hover.memberBtn{background: url(/images/course/hwork_icon.png) -80px -90px no-repeat !important; color:#3598db; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
.addMemberC {float:left; max-height:150px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:227px; background-color:#f1f1f1; min-height:150px; padding-top:10px;}
.addMemberC li {padding-left:10px; line-height:18px;}
.addMemberC li:hover {cursor:pointer; background-color:#cccccc;}
.addMemberCP {width:514px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; z-index:1000;}
.addMemberCP {width:514px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:fixed !important;left:50%;top:50%;margin:-100px 0 0 -150px; -moz-border-radius:5px;}
.rightArrow {margin:50px 15px 0px 15px; float:left;}
.relateText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight: bold;}
.maxHeight100 {max-height:100px; overflow-x:hidden; overflow-y:auto;}
.resubAtt {border-top:1px solid #dddddd; position:relative; margin-top:15px;}
.resubTitle {position:absolute; top:-10px; left:5px; background-color:#ffffff; display:block; font-weight:bold; padding:0px 2px;}
a.blueCir{ display:inline-block; padding:2px 5px; background-color:#ffffff;border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
a:hover.blueCir{ background:#3598db; color:#fff;}
.proList {background-color:#eaeaea; padding:5px 10px; display:block; max-width:655px; float:left;}
.borderRadius {border-radius:5px;}
.maxHeight100 {max-height:100px; overflow-x:hidden; overflow-y:auto;}
.proRelateWrap {width:38px; height:38px; border:1px solid #cecece; border-radius:3px; background-color:#f1f1f1;}
.mt7 {margin-top:7px;}
.ml7 {margin-left:7px;}
.tac {text-align:center;}
.proHelp {background:url(/images/course/hwork_icon.png) -5px -124px no-repeat; display:inline-block; width:15px; height:15px; display:inline-block;}
.hworkPrName {width:110px; max-width:110px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:18px; line-height:18px; font-size:12px; color:#888888; text-align:center;}
.mr150 {margin-right:150px;}

View File

@ -70,4 +70,17 @@ a.linkGrey8:hover {color:#585858;}
.org_login_list{ border:1px solid #eaeaea; background:#fff; padding-left:10px; padding-bottom:10px; padding-top:8px; width:60px; left:-53px; position:absolute; z-index:9999; line-height:2; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); margin-top: 30px;}
#orgUserName {max-width:50px; overflow:hidden; white-space: nowrap; text-overflow: ellipsis; display:inline-block;}
.orgListStatus {width:55px; float:left;}
.orgListStatus {width:55px; float:left;}
.reCon{ margin:5px; width:710px;}
.retop{width:710px; height:40px; background:#eaeaea; padding:5px;}
.resources {width:718px; background-color:#ffffff; padding:15px; border:1px solid #dddddd;float: right}
.re_search{ margin-top:7px; margin-left:5px;}
.re_search{ margin-top:7px; margin-left:5px;}
.re_schbox{ width:240px; height:24px; border:1px solid #64bdd9; color:#666666;}
.re_schbtn{ width:60px; height:26px; color:#fff; margin-right:5px; border:none; margin-left:0px;padding-left: 0px;}
.b_lblue{ background:#64bdd9;}
.c_grey{ color:#888888;}
.re_con{ margin:5px; width:665px;}
.re_con_top{color:#494949; }
.re_con_top span{ color:#999999; font-weight:bold;}
ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }

View File

@ -0,0 +1,11 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :homework_detail_group do
homework_common_id 1
min_num 1
max_num 1
base_on_project 1
homework_common nil
end
end

View File

@ -0,0 +1,6 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :student_work_project do
end
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe HomeworkDetailGroup, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe StudentWorkProject, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end