Merge branch 'develop' into dev_hjq
This commit is contained in:
commit
9d7bc17115
10
Gemfile
10
Gemfile
|
@ -30,11 +30,21 @@ gem 'rails_kindeditor',path:'lib/rails_kindeditor'
|
|||
#gem "rmagick", ">= 2.0.0"
|
||||
gem 'binding_of_caller'
|
||||
gem 'chinese_pinyin'
|
||||
# gem 'sunspot_rails', '~> 1.3.3'
|
||||
# gem 'sunspot_solr'
|
||||
# gem 'sunspot'
|
||||
# gem 'progress_bar'
|
||||
gem 'ansi'
|
||||
|
||||
gem 'kaminari'
|
||||
gem 'elasticsearch-model'
|
||||
gem 'elasticsearch-rails'
|
||||
|
||||
group :development do
|
||||
gem 'grape-swagger'
|
||||
gem 'better_errors', '~> 1.1.0'
|
||||
gem 'rack-mini-profiler', '~> 0.9.3'
|
||||
gem 'win32console'
|
||||
end
|
||||
|
||||
group :development, :test do
|
||||
|
|
|
@ -374,6 +374,7 @@ class CoursesController < ApplicationController
|
|||
|
||||
def settings
|
||||
if User.current.allowed_to?(:as_teacher,@course)
|
||||
@select_tab = params[:tab]
|
||||
@issue_custom_fields = IssueCustomField.sorted.all
|
||||
@issue_category ||= IssueCategory.new
|
||||
@member ||= @course.members.new
|
||||
|
|
|
@ -6,6 +6,18 @@ class ExerciseController < ApplicationController
|
|||
include ExerciseHelper
|
||||
|
||||
def index
|
||||
publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now)
|
||||
publish_exercises.each do |exercise|
|
||||
exercise.update_column('exercise_status', 2)
|
||||
course = exercise.course
|
||||
course.members.each do |m|
|
||||
exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
|
||||
end
|
||||
end
|
||||
end_exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now)
|
||||
end_exercises.each do |exercise|
|
||||
exercise.update_column('exercise_status', 3)
|
||||
end
|
||||
if @course.is_public == 0 && !User.current.member_of_course?(@course)
|
||||
render_403
|
||||
return
|
||||
|
@ -24,6 +36,18 @@ class ExerciseController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now)
|
||||
publish_exercises.each do |exercise|
|
||||
exercise.update_column('exercise_status', 2)
|
||||
course = exercise.course
|
||||
course.members.each do |m|
|
||||
exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
|
||||
end
|
||||
end
|
||||
end_exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now)
|
||||
end_exercises.each do |exercise|
|
||||
exercise.update_column('exercise_status', 3)
|
||||
end
|
||||
unless User.current.member_of_course?(@course)
|
||||
render_403
|
||||
return
|
||||
|
@ -316,6 +340,9 @@ class ExerciseController < ApplicationController
|
|||
@exercise.exercise_status = 2
|
||||
@exercise.publish_time = Time.now
|
||||
if @exercise.save
|
||||
@exercise.course.members.each do |m|
|
||||
@exercise.course_messages << CourseMessage.create(:user_id =>m.user_id, :course_id => @exercise.course.id, :viewed => false,:status=>2)
|
||||
end
|
||||
#redirect_to exercise_index_url(:course_id=> @course.id)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
@ -331,6 +358,7 @@ class ExerciseController < ApplicationController
|
|||
@exercise.exercise_questions.each do |exercise_question|
|
||||
exercise_question.exercise_answers.destroy_all
|
||||
end
|
||||
@exercise.course_messages.destroy_all
|
||||
@exercise.exercise_users.destroy_all
|
||||
@exercise.exercise_status = 1
|
||||
@exercise.publish_time = nil
|
||||
|
@ -484,6 +512,10 @@ class ExerciseController < ApplicationController
|
|||
@exercise.update_attributes(:show_result => params[:show_result])
|
||||
@exercise.update_attributes(:exercise_status => 2)
|
||||
@exercise.update_attributes(:publish_time => Time.now)
|
||||
course = @exercise.course
|
||||
course.members.each do |m|
|
||||
@exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
|
||||
end
|
||||
redirect_to exercise_url(@exercise)
|
||||
return
|
||||
elsif @exercise.publish_time > Time.now
|
||||
|
|
|
@ -73,6 +73,7 @@ class MemosController < ApplicationController
|
|||
end
|
||||
end
|
||||
#end
|
||||
format.js
|
||||
format.html { redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}" }
|
||||
format.json { render json: @memo, status: :created, location: @memo }
|
||||
else
|
||||
|
@ -152,6 +153,7 @@ class MemosController < ApplicationController
|
|||
end
|
||||
|
||||
def update
|
||||
@flag = false
|
||||
respond_to do |format|
|
||||
if( #@memo.update_column(:subject, params[:memo][:subject]) &&
|
||||
@memo.update_column(:content, params[:memo][:content]) &&
|
||||
|
@ -159,10 +161,12 @@ class MemosController < ApplicationController
|
|||
@memo.update_column(:lock, params[:memo][:lock]) &&
|
||||
@memo.update_column(:subject,params[:memo][:subject]))
|
||||
@memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads]))
|
||||
@memo.save
|
||||
@flag = @memo.save
|
||||
# @memo.root.update_attribute(:updated_at, @memo.updated_at)
|
||||
format.js
|
||||
format.html {redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}"}
|
||||
else
|
||||
format.js
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @person.errors, status: :unprocessable_entity }
|
||||
end
|
||||
|
|
|
@ -64,32 +64,53 @@ class RepositoriesController < ApplicationController
|
|||
end
|
||||
|
||||
def forked
|
||||
# 被forked的标识如果不满足单个用户唯一性,则不执行fork
|
||||
if is_sigle_identifier?(User.current, @repository.identifier)
|
||||
# REDO: 那些人有权限forked项目
|
||||
g = Gitlab.client
|
||||
gproject = g.post ("/projects/fork/#{@project.gpid}?user_id=#{User.current.gid}")
|
||||
if gproject
|
||||
copy_project(@project, gproject)
|
||||
end
|
||||
# 如果当前用户已经fork过该项目,不会新fork项目,则跳至已fork的项
|
||||
unless has_forked?(@project, User.current)
|
||||
project = project_from_current_project(@project.id, User.current.id)
|
||||
redirect_to project_path(project)
|
||||
else
|
||||
flash[:notice] = l(:project_gitlab_fork_double_message)
|
||||
redirect_to settings_project_url(@project, :tab => 'repositories')
|
||||
# 单个用户只能拥有一个名字一样的版本库,否则不能fork
|
||||
# if is_sigle_identifier?(User.current, @repository.identifier)
|
||||
# REDO: 那些人有权限forked项目
|
||||
g = Gitlab.client
|
||||
gproject = g.fork(@project.gpid, User.current.gid)
|
||||
if gproject
|
||||
copy_project(@project, gproject)
|
||||
forked_count = @project.forked_count.to_i + 1
|
||||
@project.update_attributes(:forked_count => forked_count)
|
||||
end
|
||||
# else
|
||||
# flash[:notice] = l(:project_gitlab_fork_double_message)
|
||||
# redirect_to settings_project_url(@project, :tab => 'repositories')
|
||||
# end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# 判断用户是否已经fork过该项目
|
||||
def has_forked?(project, user)
|
||||
projects = Project.where("user_id =?", user)
|
||||
projects.map(&:forked_from_project_id).detect{|s| s == @project.id}.nil? ? true : false
|
||||
end
|
||||
|
||||
# 获取当前用户fork过的项目
|
||||
def project_from_current_project(project, user)
|
||||
project = Project.where("user_id =? and forked_from_project_id =?",user, project).first
|
||||
end
|
||||
|
||||
# copy a project for fork
|
||||
def copy_project(project, gproject)
|
||||
def copy_project(tproject, gproject)
|
||||
project = Project.new
|
||||
project.name = @project.name
|
||||
project.is_public = @project.is_public
|
||||
project.status = @project.status
|
||||
project.description = @project.description
|
||||
project.hidden_repo = @project.hidden_repo
|
||||
project.name = tproject.name
|
||||
project.is_public = tproject.is_public
|
||||
project.status = tproject.status
|
||||
project.description = tproject.description
|
||||
project.hidden_repo = tproject.hidden_repo
|
||||
project.user_id = User.current.id
|
||||
project.project_type = 0
|
||||
project.project_new_type = @project.project_new_type
|
||||
project.project_new_type = tproject.project_new_type
|
||||
project.gpid = gproject.id
|
||||
project.forked_from_project_id = tproject.id
|
||||
if project.save
|
||||
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
|
||||
m = Member.new(:user => User.current, :roles => [r])
|
||||
|
@ -124,16 +145,16 @@ class RepositoriesController < ApplicationController
|
|||
|
||||
def copy_repository(project, gproject)
|
||||
# 避免
|
||||
if is_sigle_identifier?(project.user_id, gproject.name)
|
||||
# if is_sigle_identifier?(project.user_id, gproject.name)
|
||||
repository = Repository.factory('Git')
|
||||
repository.project_id = project.id
|
||||
repository.type = 'Repository::Gitlab'
|
||||
repository.url = gproject.name
|
||||
repository.identifier = gproject.name
|
||||
repository = repository.save
|
||||
else
|
||||
flash[:notice] = l(:project_gitlab_create_double_message)
|
||||
end
|
||||
# else
|
||||
# flash[:notice] = l(:project_gitlab_create_double_message)
|
||||
# end
|
||||
end
|
||||
|
||||
def newrepo
|
||||
|
|
|
@ -3,8 +3,8 @@ 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]
|
||||
before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_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]
|
||||
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]
|
||||
before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :set_score_rule, :forbidden_anonymous_comment]
|
||||
|
@ -222,7 +222,7 @@ class StudentWorkController < ApplicationController
|
|||
|
||||
def edit
|
||||
@user = User.current
|
||||
if !User.current.admin? && @homework.homework_type == 2 #编程作业不能修改作业
|
||||
if (!User.current.admin? && @homework.homework_type == 2) || Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") #编程作业不能修改作业|| 截止日期已到不能修改作业
|
||||
render_403
|
||||
else
|
||||
respond_to do |format|
|
||||
|
@ -284,6 +284,23 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def delete_work
|
||||
@work = StudentWork.where("user_id =? and homework_common_id =?", User.current.id, @homework.id).first
|
||||
if @work
|
||||
@work.destroy
|
||||
end
|
||||
redirect_to user_homeworks_user_path(User.current.id)
|
||||
end
|
||||
|
||||
def retry_work
|
||||
if @work.destroy
|
||||
@student_work = StudentWork.new
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#添加评分,已评分则为修改评分
|
||||
def add_score
|
||||
@is_last = params[:is_last] == "true"
|
||||
|
@ -510,6 +527,18 @@ class StudentWorkController < ApplicationController
|
|||
@course_activity = params[:course_activity].to_i
|
||||
end
|
||||
|
||||
def revise_attachment
|
||||
Attachment.attach_filesex(@work, params[:attachments], params[:attachment_type])
|
||||
revise_attachments = @work.attachments.where("attachtype = 7").reorder("created_on desc")
|
||||
if revise_attachments.count == 2
|
||||
revise_attachments.last.destroy
|
||||
end
|
||||
#@attachment = @work.attachments.where("attachtype = 7").order("created_on desc").first
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def hsd_committed_work?(user, homework)
|
||||
sw = StudentWork.where("user_id =? and homework_common_id =?", user, homework).first
|
||||
|
|
|
@ -92,7 +92,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
# 用户消息
|
||||
# 说明: homework 发布作业;message:讨论区; news:新闻; poll:问卷;works_reviewers:作品评阅;works_reply:作品回复
|
||||
# 说明: homework 发布作业;message:讨论区; news:新闻; poll:问卷;works_reviewers:作品评阅;works_reply:作品回复,exercise:课程测验
|
||||
# issue:问题;journal:缺陷状态更新; forum:公共贴吧: user_feedback: 用户留言; new_reply:新闻回复(comment)
|
||||
def user_messages
|
||||
if !User.current.logged?
|
||||
|
@ -128,7 +128,7 @@ class UsersController < ApplicationController
|
|||
|
||||
#课程相关消息
|
||||
when 'homework'
|
||||
@message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage','StudentWork') and user_id =?", @user).order("created_at desc")
|
||||
@message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage','StudentWork','Exercise') and user_id =?", @user).order("created_at desc")
|
||||
when 'course_message'
|
||||
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc")
|
||||
when 'course_news'
|
||||
|
@ -1367,7 +1367,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
if(params[:type].blank? || params[:type] == "1") #全部
|
||||
if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') #全部
|
||||
if User.current.id.to_i == params[:id].to_i
|
||||
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
||||
|
@ -1429,6 +1429,7 @@ class UsersController < ApplicationController
|
|||
@course = @user.courses
|
||||
.select { |course| @user.allowed_to?(:as_teacher,course)}
|
||||
end
|
||||
@search = params[:search]
|
||||
#这里仅仅是传递需要发送的资源id
|
||||
@send_id = params[:send_id]
|
||||
@send_ids = params[:checkbox1] || params[:send_ids]
|
||||
|
@ -1445,6 +1446,7 @@ class UsersController < ApplicationController
|
|||
else
|
||||
@projects = @user.projects
|
||||
end
|
||||
@search = params[:search]
|
||||
#这里仅仅是传递需要发送的资源id
|
||||
@send_id = params[:send_id]
|
||||
@send_ids = params[:checkbox1] || params[:send_ids] #搜索的时候 和 直接 用表格提交的时候的send_ids
|
||||
|
@ -1856,7 +1858,7 @@ class UsersController < ApplicationController
|
|||
# 根据资源关键字进行搜索
|
||||
def resource_search
|
||||
search = params[:search].to_s.strip.downcase
|
||||
if(params[:type].nil? || params[:type] == "1") #全部
|
||||
if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') #全部
|
||||
if User.current.id.to_i == params[:id].to_i
|
||||
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 取交集并查询
|
||||
@attachments = Attachment.where("((author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
||||
|
|
|
@ -151,36 +151,104 @@ class WelcomeController < ApplicationController
|
|||
end
|
||||
|
||||
def search
|
||||
search_condition = params[:q]
|
||||
search_type = params[:search_type].to_sym unless search_condition.blank?
|
||||
search_by = params[:search_by]
|
||||
@name = params[:q]
|
||||
@search_type = params[:search_type]
|
||||
case params[:search_type]
|
||||
when 'all'
|
||||
@alls = Elasticsearch::Model.search({
|
||||
query: {
|
||||
multi_match: {
|
||||
query: @name,
|
||||
type:"most_fields",
|
||||
operator: "or",
|
||||
fields: ['login', 'firstname','lastname','name','description^0.5','filename']
|
||||
}
|
||||
},
|
||||
highlight: {
|
||||
pre_tags: ['<span class="c_red">'],
|
||||
post_tags: ['</span>'],
|
||||
fields: {
|
||||
login: {},
|
||||
firstname: {},
|
||||
lastname: {},
|
||||
name:{},
|
||||
description:{},
|
||||
filename:{}
|
||||
}
|
||||
}
|
||||
},[User,Course,Attachment,Project] ).page(params[:page] || 1).per(20).results
|
||||
when 'user'
|
||||
@users = User.search(@name).page(params[:page] || 1).per(20)
|
||||
when 'project'
|
||||
@projects = Project.search(@name).page(params[:page] || 1).per(20).results
|
||||
when 'course'
|
||||
@courses = Course.search(@name).page(params[:page] || 1).per(20).results
|
||||
when 'attachment'
|
||||
@attachments = Attachment.search(@name).page(params[:page] || 1).per(20).results
|
||||
else
|
||||
@alls = Elasticsearch::Model.search({
|
||||
query: {
|
||||
multi_match: {
|
||||
query: @name,
|
||||
type:"most_fields",
|
||||
operator: "or",
|
||||
fields: ['login', 'firstname','lastname','name','description^0.5','filename']
|
||||
}
|
||||
},
|
||||
highlight: {
|
||||
pre_tags: ['<span class="c_red">'],
|
||||
post_tags: ['</span>'],
|
||||
fields: {
|
||||
login: {},
|
||||
firstname: {},
|
||||
lastname: {},
|
||||
name:{},
|
||||
description:{},
|
||||
filename:{}
|
||||
}
|
||||
}
|
||||
},[User,Course,Attachment,Project] ).page(params[:page] || 1).per(20).results
|
||||
|
||||
if search_type.nil? && params[:contests_search] && params[:name] != ""
|
||||
search_type = :contests
|
||||
search_condition = params[:name]
|
||||
end
|
||||
|
||||
@users_count = User.search(@name).results.total
|
||||
|
||||
@course_count = Course.search(@name).results.total
|
||||
@attach_count = Attachment.search(@name).results.total
|
||||
@project_count = Project.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']
|
||||
}
|
||||
},
|
||||
highlight: {
|
||||
pre_tags: ['<span class="c_red">'],
|
||||
post_tags: ['</span>'],
|
||||
fields: {
|
||||
login: {},
|
||||
firstname: {},
|
||||
lastname: {},
|
||||
name:{},
|
||||
description:{},
|
||||
filename:{}
|
||||
}
|
||||
}
|
||||
},[User,Course,Attachment,Project] ).results.total
|
||||
# search_type = params[:search_type].to_sym unless search_condition.blank?
|
||||
# search_by = params[:search_by]
|
||||
#
|
||||
# if search_type.nil? && params[:contests_search] && params[:name] != ""
|
||||
# search_type = :contests
|
||||
# search_condition = params[:name]
|
||||
# end
|
||||
|
||||
respond_to do |format|
|
||||
format.html{
|
||||
case search_type
|
||||
when :projects
|
||||
redirect_to projects_search_url(:name => search_condition,
|
||||
:project_type => Project::ProjectType_project)
|
||||
when :courses
|
||||
redirect_to courses_search_url(:name => search_condition)
|
||||
when :contests
|
||||
redirect_to contests_url(:name => search_condition)
|
||||
when :users
|
||||
redirect_to users_search_url(:name => search_condition,:search_by => search_by)
|
||||
when :users_teacher
|
||||
redirect_to users_search_url(:name => search_condition, :search_by => search_by, :role => :teacher)
|
||||
when :users_student
|
||||
redirect_to users_search_url(:name => search_condition, :search_by => search_by, :role => :student)
|
||||
else
|
||||
#redirect_to home_path, :alert => l(:label_sumbit_empty)
|
||||
(redirect_to signin_path, :notice => l(:label_sumbit_empty);return) #if params[:name].blank?
|
||||
end
|
||||
}
|
||||
format.js
|
||||
format.html{ render :layout=>'users_base'}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
class WordsController < ApplicationController
|
||||
include ApplicationHelper
|
||||
before_filter :find_user, :only => [:new, :create, :destroy, :more, :back]
|
||||
before_filter :require_login, :only => [:create_reply]
|
||||
|
||||
def create
|
||||
if params[:new_form][:user_message].size>0 && User.current.logged?
|
||||
unless params[:user_id].nil?
|
||||
|
|
|
@ -1869,6 +1869,23 @@ module ApplicationHelper
|
|||
s
|
||||
end
|
||||
|
||||
def get_user_identity identity
|
||||
s = ""
|
||||
case identity
|
||||
when 0
|
||||
s = '教师'
|
||||
when 1
|
||||
s = '学生'
|
||||
when 2
|
||||
s = '组织'
|
||||
when 3
|
||||
s= '开发者'
|
||||
else
|
||||
s = '学生'
|
||||
end
|
||||
s
|
||||
end
|
||||
|
||||
def get_memo
|
||||
@new_memo = Memo.new
|
||||
@public_forum = Forum.find(1) rescue ActiveRecord::RecordNotFound
|
||||
|
|
|
@ -126,4 +126,15 @@ module StudentWorkHelper
|
|||
end
|
||||
type
|
||||
end
|
||||
|
||||
def revise_attachment_status homework, attach
|
||||
date = Time.parse(format_time(attach.created_on.to_s)).strftime("%Y-%m-%d")
|
||||
status = ""
|
||||
if homework.homework_detail_manual && ((homework.anonymous_comment == 0 &&homework.homework_detail_manual.evaluation_start.to_s <= date) || (homework.anonymous_comment == 1 && homework.end_time < date))
|
||||
status = "此时其他同学作品已公开"
|
||||
else
|
||||
status = "此时其他同学作品尚未公开"
|
||||
end
|
||||
return status
|
||||
end
|
||||
end
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
require "digest/md5"
|
||||
require "fileutils"
|
||||
|
||||
require 'elasticsearch/model'
|
||||
class Attachment < ActiveRecord::Base
|
||||
belongs_to :container, :polymorphic => true
|
||||
belongs_to :project, foreign_key: 'container_id', conditions: "attachments.container_type = 'Project'"
|
||||
|
@ -38,6 +38,18 @@ class Attachment < ActiveRecord::Base
|
|||
validates :description, length: {maximum: 254}
|
||||
validate :validate_max_file_size
|
||||
|
||||
#elasticsearch
|
||||
include Elasticsearch::Model
|
||||
#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 :filename, analyzer: 'smartcn',index_options: 'offsets'
|
||||
indexes :downloads, analyzer: 'smartcn',index_options: 'offsets'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
acts_as_taggable
|
||||
acts_as_event :title => :filename,
|
||||
|
@ -74,9 +86,9 @@ class Attachment < ActiveRecord::Base
|
|||
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
|
||||
|
||||
before_save :files_to_final_location,:act_as_course_activity
|
||||
after_create :office_conver, :be_user_score,:act_as_forge_activity
|
||||
after_update :office_conver, :be_user_score
|
||||
after_destroy :delete_from_disk,:down_user_score
|
||||
after_create :office_conver, :be_user_score,:act_as_forge_activity,:create_attachment_ealasticsearch_index
|
||||
after_update :office_conver, :be_user_score,:update_attachment_ealasticsearch_index
|
||||
after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index
|
||||
|
||||
# add by nwb
|
||||
# 获取所有可公开的资源文件列表
|
||||
|
@ -92,7 +104,35 @@ class Attachment < ActiveRecord::Base
|
|||
" LEFT JOIN #{News.table_name} ON #{Attachment.table_name}.container_type='News' AND (#{News.table_name}.project_id in "+self.public_project_id + " OR #{News.table_name}.course_id in " + self.public_course_id + ")" +
|
||||
" LEFT JOIN #{HomeworkAttach.table_name} ON #{Attachment.table_name}.container_type='HomeworkAttach' AND #{HomeworkAttach.table_name}.bid_id in "+self.public_bid_id)
|
||||
}
|
||||
scope :indexable,lambda { where('is_public = 1 and ((container_type in ("Principal")) ' +
|
||||
'or (container_type = "Course" and container_id in( SELECT `courses`.id FROM `courses` WHERE (courses.status <> 9 AND courses.is_public = 1)) )'+
|
||||
'or (container_type = "Project" and container_id in(SELECT `projects`.id FROM `projects` WHERE (projects.status <> 9 AND projects.is_public = 1) ))' +')')} #用于elastic建索引的scope
|
||||
def self.search(query)
|
||||
__elasticsearch__.search(
|
||||
{
|
||||
query: {
|
||||
multi_match: {
|
||||
query: query,
|
||||
type:"most_fields",
|
||||
operator: "or",
|
||||
fields: ['filename']
|
||||
}
|
||||
},
|
||||
sort:{
|
||||
_score:{order:"desc"},
|
||||
downloads: {order:"desc"}
|
||||
|
||||
},
|
||||
highlight: {
|
||||
pre_tags: ['<span class="c_red">'],
|
||||
post_tags: ['</span>'],
|
||||
fields: {
|
||||
filename: {}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
end
|
||||
# add by nwb
|
||||
# 公开的项目id列表
|
||||
def self.public_project_id
|
||||
|
@ -561,4 +601,46 @@ class Attachment < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def create_attachment_ealasticsearch_index
|
||||
if self.is_public == 1 && ( (self.container_type == 'Project' && Project.find(self.container_id).is_public == 1) ||
|
||||
( self.container_type == 'Course' && Course.find(self.container_id).is_public == 1) ||
|
||||
self.container_type == 'Principal')
|
||||
self.__elasticsearch__.index_document
|
||||
end
|
||||
end
|
||||
def update_attachment_ealasticsearch_index
|
||||
if self.is_public == 1 && ( (self.container_type == 'Project' && Project.find(self.container_id).is_public == 1) ||
|
||||
( self.container_type == 'Course' && Course.find(self.container_id).is_public == 1) ||
|
||||
self.container_type == 'Principal')
|
||||
begin
|
||||
self.__elasticsearch__.update_document
|
||||
rescue => e
|
||||
end
|
||||
else
|
||||
begin
|
||||
self.__elasticsearch__.delete_document
|
||||
rescue => e
|
||||
end
|
||||
end
|
||||
end
|
||||
def delete_attachment_ealasticsearch_index
|
||||
begin
|
||||
self.__elasticsearch__.delete_document
|
||||
rescue => e
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Delete the previous articles index in Elasticsearch
|
||||
# Attachment.__elasticsearch__.client.indices.delete index: Attachment.index_name rescue nil
|
||||
#
|
||||
# # Create the new index with the new mapping
|
||||
# Attachment.__elasticsearch__.client.indices.create \
|
||||
# index: Attachment.index_name,
|
||||
# body: { settings: Attachment.settings.to_hash, mappings: Attachment.mappings.to_hash }
|
||||
|
||||
# Index all article records from the DB to Elasticsearch
|
||||
#暂时只做公开课程/项目里的公开资源 和其他的公开资源
|
||||
#Attachment.where('is_public = 1 and ((container_type in ("Principal")) ' +
|
||||
# 'or (container_type = "Course" and container_id in( SELECT `courses`.id FROM `courses` WHERE (courses.status <> 9 AND courses.is_public = 1)) )'+
|
||||
# 'or (container_type = "Project" and container_id in(SELECT `projects`.id FROM `projects` WHERE (projects.status <> 9 AND projects.is_public = 1) ))' +')').import :force=>true
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
class Board < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
belongs_to :project
|
||||
belongs_to :course
|
||||
belongs_to :project,:touch => true
|
||||
belongs_to :course,:touch=>true
|
||||
has_many :topics, :class_name => 'Message', :conditions => "#{Message.table_name}.parent_id IS NULL", :order => "#{Message.table_name}.created_on DESC"
|
||||
has_many :messages, :dependent => :destroy, :order => "#{Message.table_name}.created_on DESC"
|
||||
belongs_to :last_message, :class_name => 'Message', :foreign_key => :last_message_id
|
||||
|
|
|
@ -31,7 +31,7 @@ class Comment < ActiveRecord::Base
|
|||
:title=>Proc.new {|o| "RE: #{o.commented.title}" },
|
||||
:url => Proc.new {|o| {:controller => 'news', :action => 'show', :id => o.commented.id} }
|
||||
|
||||
belongs_to :commented, :polymorphic => true, :counter_cache => true
|
||||
belongs_to :commented, :polymorphic => true, :counter_cache => true,:touch => true
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
validates_presence_of :commented, :author, :comments
|
||||
safe_attributes 'comments'
|
||||
|
@ -81,8 +81,10 @@ class Comment < ActiveRecord::Base
|
|||
|
||||
# 课程成员得分(英雄榜)
|
||||
def act_as_student_score
|
||||
unless self.author.allowed_to?(:as_teacher, self.commented.course)
|
||||
course_member_score(self.commented.course.id, self.author_id, "NewReply")
|
||||
if self.commented.course
|
||||
unless self.author.allowed_to?(:as_teacher, self.commented.course)
|
||||
course_member_score(self.commented.course.id, self.author_id, "NewReply")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
require 'elasticsearch/model'
|
||||
class Course < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
|
||||
|
@ -6,6 +6,20 @@ class Course < ActiveRecord::Base
|
|||
STATUS_CLOSED = 5
|
||||
STATUS_ARCHIVED = 9
|
||||
|
||||
#elasticsearch
|
||||
include Elasticsearch::Model
|
||||
|
||||
#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 :name, analyzer: 'smartcn',index_options: 'offsets'
|
||||
indexes :description, analyzer: 'smartcn',index_options: 'offsets'
|
||||
indexes :updated_at, analyzer: 'smartcn',index_options: 'offsets',type:"date"
|
||||
end
|
||||
end
|
||||
|
||||
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student, :enterprise_name
|
||||
#belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier
|
||||
belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher,该方法通过tea_id来调用User表
|
||||
|
@ -56,9 +70,9 @@ class Course < ActiveRecord::Base
|
|||
validates_length_of :description, :maximum => 10000
|
||||
before_save :self_validate
|
||||
# 公开课程变成私有课程,所有资源都变成私有
|
||||
after_update :update_files_public
|
||||
after_create :create_board_sync, :act_as_course_activity, :act_as_course_message
|
||||
before_destroy :delete_all_members
|
||||
after_update :update_files_public,:update_course_ealasticsearch_index
|
||||
after_create :create_board_sync, :act_as_course_activity, :act_as_course_message,:create_course_ealasticsearch_index
|
||||
before_destroy :delete_all_members,:delete_course_ealasticsearch_index
|
||||
|
||||
safe_attributes 'extra',
|
||||
'time',
|
||||
|
@ -100,6 +114,34 @@ class Course < ActiveRecord::Base
|
|||
where(" LOWER(name) LIKE :p ", :p => pattern)
|
||||
end
|
||||
}
|
||||
scope :indexable,lambda { where('is_public = 1') }
|
||||
def self.search(query)
|
||||
__elasticsearch__.search(
|
||||
{
|
||||
query: {
|
||||
multi_match: {
|
||||
query: query,
|
||||
type:"most_fields",
|
||||
operator: "or",
|
||||
fields: ['name', 'description^0.5']
|
||||
}
|
||||
},
|
||||
sort: {
|
||||
_score:{order: "desc" },
|
||||
updated_at:{order:"desc"}
|
||||
|
||||
},
|
||||
highlight: {
|
||||
pre_tags: ['<span class="c_red">'],
|
||||
post_tags: ['</span>'],
|
||||
fields: {
|
||||
name: {},
|
||||
description: {}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
def visible?(user=User.current)
|
||||
user.allowed_to?(:view_course, self)
|
||||
|
@ -344,6 +386,57 @@ class Course < ActiveRecord::Base
|
|||
#def name
|
||||
# read_attribute('name') || Project.find_by_identifier(self.extra).try(:name)
|
||||
#end
|
||||
|
||||
# after_commit on: [:create] do
|
||||
# __elasticsearch__.index_document
|
||||
# end
|
||||
#
|
||||
# after_commit on: [:update] do
|
||||
# __elasticsearch__.update_document
|
||||
# end
|
||||
#
|
||||
# after_commit on: [:destroy] do
|
||||
# __elasticsearch__.delete_document
|
||||
# end
|
||||
def create_course_ealasticsearch_index
|
||||
if self.is_public == 1
|
||||
self.__elasticsearch__.index_document
|
||||
end
|
||||
end
|
||||
def update_course_ealasticsearch_index
|
||||
if self.is_public == 1 #如果是初次更新成为公开的情况,会报错,那么这条记录尚未被索引过。没有报错就是更新的其他属性
|
||||
begin
|
||||
self.__elasticsearch__.update_document
|
||||
rescue => e
|
||||
self.__elasticsearch__.index_document
|
||||
end
|
||||
else #如果是更新成为私有的,那么索引就要被删除
|
||||
begin
|
||||
self.__elasticsearch__.delete_document
|
||||
rescue => e
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def delete_course_ealasticsearch_index
|
||||
begin
|
||||
self.__elasticsearch__.delete_document
|
||||
rescue => e
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Delete the previous articles index in Elasticsearch
|
||||
# Course.__elasticsearch__.client.indices.delete index: Course.index_name rescue nil
|
||||
#
|
||||
# # Create the new index with the new mapping
|
||||
# Course.__elasticsearch__.client.indices.create \
|
||||
# index: Course.index_name,
|
||||
# body: { settings: Course.settings.to_hash, mappings: Course.mappings.to_hash }
|
||||
|
||||
# Index all article records from the DB to Elasticsearch
|
||||
#Course.where('is_public = 1').import :force=>true
|
||||
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
class Document < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
belongs_to :project
|
||||
belongs_to :project,:touch=>true
|
||||
belongs_to :user
|
||||
belongs_to :category, :class_name => "DocumentCategory", :foreign_key => "category_id"
|
||||
include UserScoreHelper
|
||||
|
|
|
@ -2,7 +2,22 @@ class Exercise < ActiveRecord::Base
|
|||
#exercise_status: 1,新建;2,发布;3,关闭
|
||||
include Redmine::SafeAttributes
|
||||
belongs_to :user
|
||||
belongs_to :course ,:touch => true
|
||||
has_many :exercise_questions, :dependent => :destroy,:order => "#{ExerciseQuestion.table_name}.question_number"
|
||||
has_many :exercise_users, :dependent => :destroy
|
||||
has_many :users, :through => :exercise_users #该测试被哪些用户提交答案过
|
||||
# 课程消息
|
||||
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
||||
after_create :acts_as_course_message
|
||||
def acts_as_course_message
|
||||
if self.course
|
||||
if self.exercise_status == 2 #未发布
|
||||
#self.course.members.each do |m|
|
||||
self.course_messages << CourseMessage.create(:user_id => User.current.id, :course_id => self.course_id, :viewed => false,:status=>2)
|
||||
#end
|
||||
# else
|
||||
# self.course_messages.destroy_all 这里的destory_all值得商榷。因为我这里是通过status来控制不同的status的
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ class Issue < ActiveRecord::Base
|
|||
include Redmine::SafeAttributes
|
||||
include Redmine::Utils::DateCalculation
|
||||
include UserScoreHelper
|
||||
belongs_to :project
|
||||
belongs_to :project,:touch=> true
|
||||
belongs_to :tracker
|
||||
belongs_to :status, :class_name => 'IssueStatus', :foreign_key => 'status_id'
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
|
|
|
@ -21,9 +21,10 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
after_destroy :delete_kindeditor_assets
|
||||
belongs_to :project,
|
||||
:foreign_key => 'jour_id',
|
||||
:conditions => "#{self.table_name}.jour_type = 'Project' "
|
||||
:conditions => "#{self.table_name}.jour_type = 'Project' ",:touch => true
|
||||
|
||||
belongs_to :course,
|
||||
:foreign_key => 'jour_id'
|
||||
:foreign_key => 'jour_id',:touch=>true
|
||||
|
||||
|
||||
belongs_to :jour, :polymorphic => true
|
||||
|
|
|
@ -20,7 +20,7 @@ class Message < ActiveRecord::Base
|
|||
include UserScoreHelper
|
||||
include ApplicationHelper
|
||||
has_many_kindeditor_assets :assets, :dependent => :destroy
|
||||
belongs_to :board
|
||||
belongs_to :board,:touch => true
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
|
||||
|
||||
|
@ -287,13 +287,15 @@ class Message < ActiveRecord::Base
|
|||
|
||||
# 课程成员得分(英雄榜)
|
||||
def act_as_student_score
|
||||
unless self.author.allowed_to?(:as_teacher, self.course)
|
||||
if self.parent_id.nil?
|
||||
# 发帖
|
||||
course_member_score(self.course.id, self.author_id, "Message")
|
||||
else
|
||||
# 回帖
|
||||
course_member_score(self.course.id, self.author_id, "MessageReply")
|
||||
if self.course
|
||||
unless self.author.allowed_to?(:as_teacher, self.course)
|
||||
if self.parent_id.nil?
|
||||
# 发帖
|
||||
course_member_score(self.course.id, self.author_id, "Message")
|
||||
else
|
||||
# 回帖
|
||||
course_member_score(self.course.id, self.author_id, "MessageReply")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
|
||||
class News < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
belongs_to :project
|
||||
belongs_to :project,:touch => true
|
||||
include ApplicationHelper
|
||||
has_many_kindeditor_assets :assets, :dependent => :destroy
|
||||
#added by nwb
|
||||
belongs_to :course
|
||||
belongs_to :course,:touch => true
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
has_many :comments, :as => :commented, :dependent => :destroy, :order => "created_on"
|
||||
# fq
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
require 'elasticsearch/model'
|
||||
class Project < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
ProjectType_project = 0
|
||||
|
@ -30,6 +30,19 @@ class Project < ActiveRecord::Base
|
|||
|
||||
# Specific overidden Activities
|
||||
|
||||
#elasticsearch
|
||||
include Elasticsearch::Model
|
||||
#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 :name, analyzer: 'smartcn',index_options: 'offsets'
|
||||
indexes :description, analyzer: 'smartcn',index_options: 'offsets'
|
||||
indexes :updated_on, analyzer: 'smartcn',index_options: 'offsets', type:'date'
|
||||
end
|
||||
end
|
||||
|
||||
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}"
|
||||
|
@ -138,8 +151,9 @@ class Project < ActiveRecord::Base
|
|||
#ActiveModel::Dirty 这里有一个changed方法。对任何对象都可以用
|
||||
after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?}
|
||||
# 创建project之后默认创建一个board,之后的board去掉了board的概念
|
||||
after_create :create_board_sync,:acts_as_forge_activities
|
||||
before_destroy :delete_all_members
|
||||
after_create :create_board_sync,:acts_as_forge_activities,:create_project_ealasticsearch_index
|
||||
before_destroy :delete_all_members,:delete_project_ealasticsearch_index
|
||||
after_update :update_project_ealasticsearch_index
|
||||
def remove_references_before_destroy
|
||||
return if self.id.nil?
|
||||
Watcher.delete_all ['watchable_id = ?', id]
|
||||
|
@ -172,7 +186,33 @@ class Project < ActiveRecord::Base
|
|||
}
|
||||
scope :project_entities, -> { where(project_type: ProjectType_project) }
|
||||
scope :course_entities, -> { where(project_type: ProjectType_course) }
|
||||
|
||||
scope :indexable,lambda { where('is_public = 1')} #用于elastic建索引的scope
|
||||
def self.search(query)
|
||||
__elasticsearch__.search(
|
||||
{
|
||||
query: {
|
||||
multi_match: {
|
||||
query: query,
|
||||
type:"most_fields",
|
||||
operator: "or",
|
||||
fields: ['name','description^0.5']
|
||||
}
|
||||
},
|
||||
sort: {
|
||||
_score:{order: "desc" },
|
||||
updated_on:{order: "desc" }
|
||||
},
|
||||
highlight: {
|
||||
pre_tags: ['<span class="c_red">'],
|
||||
post_tags: ['</span>'],
|
||||
fields: {
|
||||
name: {},
|
||||
description: {}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
end
|
||||
def new_course
|
||||
self.where('project_type = ?', 1)
|
||||
end
|
||||
|
@ -1176,5 +1216,36 @@ class Project < ActiveRecord::Base
|
|||
end
|
||||
|
||||
|
||||
def create_project_ealasticsearch_index
|
||||
if self.is_public
|
||||
self.__elasticsearch__.index_document
|
||||
end
|
||||
end
|
||||
def update_project_ealasticsearch_index
|
||||
if self.is_public #如果是初次更新成为公开的情况,会报错,那么这条记录尚未被索引过。没有报错就是更新的其他属性
|
||||
begin
|
||||
self.__elasticsearch__.update_document
|
||||
rescue => e
|
||||
self.__elasticsearch__.index_document
|
||||
end
|
||||
else #如果是更新成为私有的,那么索引就要被删除
|
||||
begin
|
||||
self.__elasticsearch__.delete_document
|
||||
rescue => e
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
def delete_project_ealasticsearch_index
|
||||
begin
|
||||
self.__elasticsearch__.delete_document
|
||||
rescue => e
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
#Project.where('is_public = 1').import :force=>true
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
class ProjectTags < ActiveRecord::Base
|
||||
attr_accessible :description, :project_id, :tag_id, :user_id
|
||||
####################################################################################################添加代码
|
||||
belongs_to :project
|
||||
belongs_to :project,:touch => true
|
||||
belongs_to :tag
|
||||
belongs_to :user
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ class StudentWork < ActiveRecord::Base
|
|||
has_many :student_work_tests, order: 'id desc'
|
||||
# course's message
|
||||
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
||||
has_many :attachments, :dependent => :destroy
|
||||
|
||||
before_destroy :delete_praise
|
||||
before_save :set_program_score, :set_src
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
require "digest/sha1"
|
||||
|
||||
require 'elasticsearch/model'
|
||||
class User < Principal
|
||||
TEACHER = 0
|
||||
STUDENT = 1
|
||||
|
@ -25,6 +25,20 @@ class User < Principal
|
|||
|
||||
include Redmine::SafeAttributes
|
||||
seems_rateable_rater
|
||||
#elasticsearch
|
||||
include Elasticsearch::Model
|
||||
#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 :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'
|
||||
end
|
||||
end
|
||||
|
||||
# Different ways of displaying/sorting users
|
||||
USER_FORMATS = {
|
||||
:firstname_lastname => {
|
||||
|
@ -64,6 +78,7 @@ class User < Principal
|
|||
},
|
||||
}
|
||||
|
||||
|
||||
#每日一报、一事一报、不报
|
||||
MAIL_NOTIFICATION_OPTIONS = [
|
||||
#['week', :label_user_mail_option_week],
|
||||
|
@ -162,6 +177,7 @@ class User < Principal
|
|||
#####
|
||||
has_many :shares ,:dependent => :destroy
|
||||
|
||||
|
||||
# add by zjc
|
||||
has_one :level, :class_name => 'UserLevels', :dependent => :destroy
|
||||
has_many :memos , :foreign_key => 'author_id'
|
||||
|
@ -222,12 +238,12 @@ class User < Principal
|
|||
# validates_email_realness_of :mail
|
||||
before_create :set_mail_notification
|
||||
before_save :update_hashed_password
|
||||
before_destroy :remove_references_before_destroy
|
||||
before_destroy :remove_references_before_destroy,:delete_user_ealasticsearch_index
|
||||
# added by fq
|
||||
after_create :act_as_activity, :add_onclick_time, :act_as_principal_activity
|
||||
after_create :act_as_activity, :add_onclick_time, :act_as_principal_activity,:create_user_ealasticsearch_index
|
||||
# end
|
||||
# 更新邮箱用户或用户名的同事,同步更新邀请信息
|
||||
after_update :update_invite_list
|
||||
after_update :update_invite_list,:update_user_ealasticsearch_index
|
||||
|
||||
include Trustie::Gitlab::ManageUser
|
||||
|
||||
|
@ -240,7 +256,7 @@ class User < Principal
|
|||
where("#{User.table_name}.id NOT IN (SELECT gu.user_id FROM #{table_name_prefix}groups_users#{table_name_suffix} gu WHERE gu.group_id = ?)", group_id)
|
||||
}
|
||||
scope :sorted, lambda { order(*User.fields_for_order_statement)}
|
||||
|
||||
scope :indexable,lambda { where('id not in (2,4)')} #用于elastic建索引的scope,id为2是匿名用户,4是管理员,不能被索引
|
||||
scope :like, lambda {|arg, type|
|
||||
if arg.blank?
|
||||
where(nil)
|
||||
|
@ -258,7 +274,33 @@ class User < Principal
|
|||
end
|
||||
end
|
||||
}
|
||||
|
||||
def self.search(query)
|
||||
__elasticsearch__.search(
|
||||
{
|
||||
query: {
|
||||
multi_match: {
|
||||
query: query,
|
||||
type:"most_fields",
|
||||
operator: "or",
|
||||
fields: ['login', 'firstname','lastname']
|
||||
}
|
||||
},
|
||||
sort:{
|
||||
_score:{order:"desc"},
|
||||
last_login_on: {order:"desc"}
|
||||
},
|
||||
highlight: {
|
||||
pre_tags: ['<span class="c_red">'],
|
||||
post_tags: ['</span>'],
|
||||
fields: {
|
||||
login: {},
|
||||
firstname: {},
|
||||
lastname: {}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
# ======================================================================
|
||||
|
||||
|
@ -435,7 +477,7 @@ class User < Principal
|
|||
end
|
||||
if user
|
||||
# user is already in local database
|
||||
#return nil unless user.active?
|
||||
return nil if user.locked?
|
||||
return nil unless user.check_password?(password)
|
||||
else
|
||||
# user is not yet registered, try to authenticate with available sources
|
||||
|
@ -1119,6 +1161,23 @@ class User < Principal
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
def create_user_ealasticsearch_index
|
||||
if self.id != 2 && self.id != 4
|
||||
self.__elasticsearch__.index_document
|
||||
end
|
||||
end
|
||||
def update_user_ealasticsearch_index
|
||||
if self.id != 2 && self.id != 4
|
||||
self.__elasticsearch__.update_document
|
||||
end
|
||||
end
|
||||
def delete_user_ealasticsearch_index
|
||||
if self.id != 2 && self.id != 4
|
||||
self.__elasticsearch__.delete_document
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class AnonymousUser < User
|
||||
|
@ -1153,4 +1212,17 @@ class AnonymousUser < User
|
|||
def destroy
|
||||
false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# Delete the previous articles index in Elasticsearch
|
||||
# User.__elasticsearch__.client.indices.delete index: User.index_name rescue nil
|
||||
#
|
||||
# # Create the new index with the new mapping
|
||||
# User.__elasticsearch__.client.indices.create \
|
||||
# index: User.index_name,
|
||||
# body: { settings: User.settings.to_hash, mappings: User.mappings.to_hash }
|
||||
|
||||
# Index all article records from the DB to Elasticsearch
|
||||
# 匿名用户 角色 和 管理员角色不能被索引
|
||||
#User.where('id not in (2,4)').import :force=>true
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
<% if @is_destroy%>
|
||||
$("#attachment_<%= @attachment.id%>").remove();
|
||||
if(document.getElementById("uploadReviseBox")) {
|
||||
$("#uploadReviseBox").removeClass('disable_link');
|
||||
$("#choose_revise_attach").attr("onclick","_file.click();");
|
||||
}
|
||||
<%else%>
|
||||
var attachment_html_obj = $('#attachments_<%= j params[:attachment_id] %>');
|
||||
//modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 start
|
||||
|
@ -26,5 +30,10 @@
|
|||
$('#upload_file_count'+containerid).html("<span id=\"count\">"+count+"</span>"+"个文件"+"已上传");
|
||||
}
|
||||
}
|
||||
|
||||
if(document.getElementById("uploadReviseBox")) {
|
||||
$("#uploadReviseBox").removeClass('disable_link');
|
||||
$("#choose_revise_attach").attr("onclick","_file.click();");
|
||||
}
|
||||
//modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 end
|
||||
<% end%>
|
|
@ -1,5 +1,10 @@
|
|||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= @subPage_title%></h2>
|
||||
<h2 class="project_h2 fl"><%= @subPage_title%></h2>
|
||||
<% if User.current.allowed_to?(:as_teacher,@course) %>
|
||||
<span class="fr f14 fontGrey2" style="height: 40px; line-height: 40px; margin-right: 15px;">
|
||||
<%=link_to "修改角色", :controller => 'courses', :action => 'settings', :id => @course.id, :tab=>'member' %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if @subPage_title == l(:label_student_list)%>
|
||||
<%= render :partial => 'course_student', :locals => {:members => @members} %>
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= l(:label_course_modify_settings)%></h2>
|
||||
</div>
|
||||
<script>
|
||||
$(function(){
|
||||
<% if @select_tab == 'member'%>
|
||||
$("#tb_2").click();
|
||||
<% end %>
|
||||
})
|
||||
</script>
|
||||
<div class="hwork_new">
|
||||
<div id="tb_" class="hwork_tb_">
|
||||
<ul>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<a class="btn_submit c_white" data-button="ok" onclick="pollsSubmit($(this));">
|
||||
保存
|
||||
</a>
|
||||
<a class="btn_cancel" data-button="cancel" onclick="resetHead();pollsCancel();">
|
||||
<a class="btn_cancel" data-button="cancel" onclick="pollsCancel();">
|
||||
<%= l(:button_cancel)%>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -35,6 +35,5 @@
|
|||
$("#exercise_time").val("<%=exercise.time if exercise.time!= -1 %>");
|
||||
$("#exercise_publish_time").val("<%= Time.parse(format_time(exercise.publish_time)).strftime("%Y-%m-%d") if !exercise.publish_time.nil?%>");
|
||||
/*$("#exercise_description").text("<%#=exercise.exercise_description.html_safe %>");*/
|
||||
document.getElementById("exercise_description").innerText = <%=exercise.exercise_description.html_safe %>;
|
||||
}
|
||||
</script>
|
|
@ -16,7 +16,7 @@
|
|||
<div class="postDetailCreater">最后回复:<a href="<%= user_path(author) %>" class="linkBlue2" target="_blank"><%= author.name%></a></div>
|
||||
<div class="postDetailDate"><%= format_date(topic.last_reply.created_at)%></div>
|
||||
<% end%>
|
||||
|
||||
<span class=" fr" style="color: #888888; font-size: 12px;">更新时间:<%= format_date(topic.updated_at)%></span>
|
||||
</div>
|
||||
<div class="postDetailReply">
|
||||
<a href="<%= forum_memo_path(topic.forum, topic)%>" class="postReplyIcon mr5" target="_blank"></a>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div class="postRightContainer">
|
||||
<div id="create_memo_div" style="display: none">
|
||||
<div id="error" class="red fl mb10" style="display: none">error</div>
|
||||
<%= labelled_form_for(@memo, :url => forum_memos_path(@forum)) do |f| %>
|
||||
<%= labelled_form_for(@memo, :url => forum_memos_path(@forum),:remote=>true) do |f| %>
|
||||
<div>
|
||||
<textarea type="text" name="memo[subject]" id="memo_subject" maxlength="50" onblur="check_memo_name();" onfocus="$('#error').hide();" onmouseover="this.style.borderColor='#d9d9d9'" class="postDetailInput" placeholder="输入帖子标题" ></textarea>
|
||||
<script>
|
||||
|
@ -112,7 +112,21 @@
|
|||
}
|
||||
if($("textarea[name='memo[subject]']").val().trim() != "" && !memo_content.isEmpty() ){
|
||||
memo_content.sync();
|
||||
$("#new_memo").submit();
|
||||
$.ajax({
|
||||
url:'/forums/'+'<%= @forum.id.to_s%>'+'/memos',
|
||||
type:'post',
|
||||
data:{
|
||||
'memo[content]':$("#memo_content").val(),
|
||||
'memo[subject]':$("#memo_subject").val()
|
||||
},
|
||||
success:function(data){
|
||||
|
||||
},
|
||||
error:function(){
|
||||
alert('请检查当前网络连接')
|
||||
}
|
||||
});
|
||||
//$("#new_memo").submit();
|
||||
}else if($("textarea[name='memo[subject]']").val().trim() == "" && memo_content.isEmpty()){
|
||||
$("#error").html("主题和内容不能为空").show();
|
||||
}
|
||||
|
|
|
@ -7,5 +7,5 @@
|
|||
remote: data-remote
|
||||
-%>
|
||||
|
||||
<%= link_to_unless current_page.last?, t('views.pagination.last').html_safe, url, :remote => remote %>
|
||||
<%= link_to_unless false, t('views.pagination.last').html_safe, url, :remote => remote %>
|
||||
|
||||
|
|
|
@ -7,5 +7,5 @@
|
|||
remote: data-remote
|
||||
-%>
|
||||
<li>
|
||||
<%= link_to_unless current_page.last?, t('views.pagination.next').html_safe, url, :rel => 'next', :remote => remote, :class => "next c_blue" %>
|
||||
<%= link_to_unless false, t('views.pagination.next').html_safe, url, :rel => 'next', :remote => remote, :class => "next c_blue" %>
|
||||
</li>
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
-%>
|
||||
<%= paginator.render do -%>
|
||||
<ul id="paginator" class="wlist">
|
||||
<%#= first_page_tag unless current_page.first? %>
|
||||
<%= prev_page_tag unless current_page.first? %>
|
||||
<%= prev_page_tag %>
|
||||
<% each_page do |page| -%>
|
||||
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
|
||||
<%= page_tag page %>
|
||||
|
@ -17,7 +16,7 @@
|
|||
<%= gap_tag %>
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
<%= next_page_tag unless current_page.last? %>
|
||||
<%= next_page_tag %>
|
||||
<!--<%#= last_page_tag unless current_page.last? %>-->
|
||||
</ul>
|
||||
<% end -%>
|
||||
|
|
|
@ -7,6 +7,6 @@
|
|||
remote: data-remote
|
||||
-%>
|
||||
<li >
|
||||
<%= link_to_unless current_page.first?, t('views.pagination.previous').html_safe, url, :rel => 'prev', :remote => remote ,:class=>"previous c_blue"%>
|
||||
<%= link_to_unless false, t('views.pagination.previous').html_safe, url, :rel => 'prev', :remote => remote ,:class=>"previous c_blue"%>
|
||||
</li>
|
||||
|
||||
|
|
|
@ -18,24 +18,24 @@
|
|||
</ul>
|
||||
</div>
|
||||
<script>
|
||||
<% type = type%>
|
||||
$(function (){
|
||||
if('<%= type %>' != null && '<%= type %>' == 'courses' ){
|
||||
$('input:radio[value="courses"]').attr('checked','checked');
|
||||
}
|
||||
if('<%= type %>' != null && '<%= type %>' == 'projects' ){
|
||||
$('input:radio[value="projects"]').attr('checked','checked');
|
||||
}
|
||||
if('<%= type %>' != null && '<%= type %>' == 'users' ){
|
||||
$('input:radio[value="users"]').attr('checked','checked');
|
||||
}
|
||||
});
|
||||
<%# type = type%>
|
||||
// $(function (){
|
||||
// if('<%#= type %>' != null && '<%#= type %>' == 'courses' ){
|
||||
// $('input:radio[value="courses"]').attr('checked','checked');
|
||||
// }
|
||||
// if('<%#= type %>' != null && '<%#= type %>' == 'projects' ){
|
||||
// $('input:radio[value="projects"]').attr('checked','checked');
|
||||
// }
|
||||
// if('<%#= type %>' != null && '<%#= type %>' == 'users' ){
|
||||
// $('input:radio[value="users"]').attr('checked','checked');
|
||||
// }
|
||||
// });
|
||||
|
||||
$(function(){
|
||||
$("#navHomepageSearchInput").keypress(function(e){
|
||||
var name = $.trim($('#navHomepageSearchInput').val());
|
||||
if (e.keyCode == '13' && name != "" && name.length != 0) {
|
||||
$('#type').val($('input[type=radio]:checked').val());
|
||||
//$('#type').val($('input[type=radio]:checked').val());
|
||||
$(this).parent().submit();
|
||||
}
|
||||
})
|
||||
|
@ -44,7 +44,7 @@
|
|||
function search_in_header(obj){
|
||||
var name = $.trim($('#navHomepageSearchInput').val());
|
||||
if (name != "" && name.length != 0) {
|
||||
$('#type').val($('input[type=radio]:checked').val());
|
||||
//$('#type').val($('input[type=radio]:checked').val());
|
||||
obj.parent().submit();
|
||||
}
|
||||
}
|
||||
|
@ -54,28 +54,28 @@
|
|||
<% name = name%>
|
||||
|
||||
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
|
||||
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词进行搜索"/>
|
||||
<input type="hidden" name="search_type" id="type" value=""/>
|
||||
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的课程、项目、用户以及资源"/>
|
||||
<input type="hidden" name="search_type" id="type" value="all"/>
|
||||
<input type="text" style="display: none;"/>
|
||||
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>
|
||||
<% end %>
|
||||
<div class="navSearchTypeBox" id="navHomepageSearchType">
|
||||
<div class="fl mr15 mt8">
|
||||
<input type="radio" value="courses" name="search_type" checked/>
|
||||
课程
|
||||
</div>
|
||||
<div class="fl mr15 mt8">
|
||||
<input type="radio" value="projects" name="search_type" />
|
||||
项目
|
||||
</div>
|
||||
<div class="fl mr15 mt8">
|
||||
<input type="radio" value="users" name="search_type" />
|
||||
用户
|
||||
</div>
|
||||
<div id="navSearchAlert" class="fr mr10">
|
||||
<span class="c_red">请选择搜索类型</span>
|
||||
</div>
|
||||
</div>
|
||||
<!--<div class="navSearchTypeBox" id="navHomepageSearchType">-->
|
||||
<!--<div class="fl mr15 mt8">-->
|
||||
<!--<input type="radio" value="courses" name="search_type" checked/>-->
|
||||
<!--课程-->
|
||||
<!--</div>-->
|
||||
<!--<div class="fl mr15 mt8">-->
|
||||
<!--<input type="radio" value="projects" name="search_type" />-->
|
||||
<!--项目-->
|
||||
<!--</div>-->
|
||||
<!--<div class="fl mr15 mt8">-->
|
||||
<!--<input type="radio" value="users" name="search_type" />-->
|
||||
<!--用户-->
|
||||
<!--</div>-->
|
||||
<!--<div id="navSearchAlert" class="fr mr10">-->
|
||||
<!--<span class="c_red">请选择搜索类型</span>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
</div>
|
||||
|
||||
<div class="navHomepageProfile" id="navHomepageProfile">
|
||||
|
|
|
@ -18,23 +18,23 @@
|
|||
// alert(3)
|
||||
$(doc).parent().submit();
|
||||
}
|
||||
<% type = type%>
|
||||
$(function (){
|
||||
if('<%= type %>' != null && '<%= type %>' == 'courses' ){
|
||||
$('input:radio[value="courses"]').attr('checked','checked');
|
||||
}
|
||||
if('<%= type %>' != null && '<%= type %>' == 'projects' ){
|
||||
$('input:radio[value="projects"]').attr('checked','checked');
|
||||
}
|
||||
if('<%= type %>' != null && '<%= type %>' == 'users' ){
|
||||
$('input:radio[value="users"]').attr('checked','checked');
|
||||
}
|
||||
});
|
||||
<!--<%# type = type%>-->
|
||||
// $(function (){
|
||||
// if('<%#= type %>' != null && '<%#= type %>' == 'courses' ){
|
||||
// $('input:radio[value="courses"]').attr('checked','checked');
|
||||
// }
|
||||
// if('<%#= type %>' != null && '<%#= type %>' == 'projects' ){
|
||||
// $('input:radio[value="projects"]').attr('checked','checked');
|
||||
// }
|
||||
// if('<%#= type %>' != null && '<%#= type %>' == 'users' ){
|
||||
// $('input:radio[value="users"]').attr('checked','checked');
|
||||
// }
|
||||
// });
|
||||
|
||||
function search_in_header(obj){
|
||||
var name = $.trim($('#navHomepageSearchInput').val());
|
||||
if (name != "" && name.length != 0) {
|
||||
$('#type').val($('input[type=radio]:checked').val());
|
||||
//$('#type').val($('input[type=radio]:checked').val());
|
||||
obj.parent().submit();
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@
|
|||
function search_in_header_I(e,obj){
|
||||
var name = $.trim($('#navHomepageSearchInput').val());
|
||||
if (e.keyCode == '13' && name != "" && name.length != 0) {
|
||||
$('#type').val($('input[type=radio]:checked').val());
|
||||
//$('#type').val($('input[type=radio]:checked').val());
|
||||
obj.parent().submit();
|
||||
}
|
||||
}
|
||||
|
@ -52,28 +52,28 @@
|
|||
<% name = name%>
|
||||
|
||||
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
|
||||
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词进行搜索" onkeypress="search_in_header_I(event,$(this));"/>
|
||||
<input type="hidden" name="search_type" id="type" value=""/>
|
||||
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的课程、项目、用户以及资源" onkeypress="search_in_header_I(event,$(this));"/>
|
||||
<input type="hidden" name="search_type" id="type" value="all"/>
|
||||
<input type="text" style="display: none;"/>
|
||||
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>
|
||||
<% end %>
|
||||
<div class="navSearchTypeBox" id="navHomepageSearchType">
|
||||
<div class="fl mr15 mt8">
|
||||
<input type="radio" value="courses" name="search_type" checked/>
|
||||
课程
|
||||
</div>
|
||||
<div class="fl mr15 mt8">
|
||||
<input type="radio" value="projects" name="search_type" />
|
||||
项目
|
||||
</div>
|
||||
<div class="fl mr15 mt8">
|
||||
<input type="radio" value="users" name="search_type" />
|
||||
用户
|
||||
</div>
|
||||
<div id="navSearchAlert" class="fr mr10">
|
||||
<span class="c_red">请选择搜索类型</span>
|
||||
</div>
|
||||
</div>
|
||||
<!--<div class="navSearchTypeBox" id="navHomepageSearchType">-->
|
||||
<!--<div class="fl mr15 mt8">-->
|
||||
<!--<input type="radio" value="courses" name="search_type" checked/>-->
|
||||
<!--课程-->
|
||||
<!--</div>-->
|
||||
<!--<div class="fl mr15 mt8">-->
|
||||
<!--<input type="radio" value="projects" name="search_type" />-->
|
||||
<!--项目-->
|
||||
<!--</div>-->
|
||||
<!--<div class="fl mr15 mt8">-->
|
||||
<!--<input type="radio" value="users" name="search_type" />-->
|
||||
<!--用户-->
|
||||
<!--</div>-->
|
||||
<!--<div id="navSearchAlert" class="fr mr10">-->
|
||||
<!--<span class="c_red">请选择搜索类型</span>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
|
||||
</div>
|
||||
<div id="loginInButton" class="fr ml20">
|
||||
|
|
|
@ -208,11 +208,11 @@
|
|||
<div class="cl"></div>
|
||||
<% unless contributor_course_scor(@course.id).count == 0 %>
|
||||
<ul class="rankList">
|
||||
<h4>课程贡献榜</h4>
|
||||
<h4>课程活跃度</h4>
|
||||
<% contributor_course_scor(@course.id).each do |contributor_score| %>
|
||||
<% unless contributor_score.total_score ==0 %>
|
||||
<li> <a href="javascript:void:(0);"><%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(contributor_score.user) %></a>
|
||||
<p><a href="javascript:void:(0);"><%=link_to contributor_score.user, user_path(contributor_score.user), :title => contributor_score.user %></a></p>
|
||||
<p><a href="javascript:void:(0);"><%=link_to contributor_score.user.show_name, user_path(contributor_score.user), :title => contributor_score.user.show_name %></a></p>
|
||||
<p><span class="c_green" style="cursor:pointer">
|
||||
<a onmouseover ="message_titile_show($(this),event)" onmouseout ="message_titile_hide($(this))" class="c_green"><%= contributor_score.total_score.to_i %></a></span></p>
|
||||
<div style="display: none" class="numIntro">
|
||||
|
@ -240,13 +240,13 @@
|
|||
<% end %>
|
||||
|
||||
<% hero_homework_scores = hero_homework_score(@course, "desc") %>
|
||||
<% unless hero_homework_scores.map(&:score).detect{|s| s != nil}.nil? %>
|
||||
<% unless hero_homework_scores.map(&:score).detect{|s| s.to_i != 0}.nil? %>
|
||||
<ul class="rankList">
|
||||
<h4>课程英雄榜</h4>
|
||||
<% hero_homework_scores.each do |student_score| %>
|
||||
<% unless student_score.score.nil? %>
|
||||
<% if student_score.score.to_i != 0 %>
|
||||
<li> <a href="javascript:void:(0);"><%=link_to image_tag(url_to_avatar(student_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(student_score.user) %></a>
|
||||
<p><a href="javascript:void:(0);"><%=link_to student_score.user, user_path(student_score.user), :title => student_score.user %></a></p>
|
||||
<p><a href="javascript:void:(0);"><%=link_to student_score.user.show_name, user_path(student_score.user), :title => student_score.user.show_name %></a></p>
|
||||
<p><span class="c_red" style="cursor:pointer" title="作业总分:<%= student_score.score %>"><%= student_score.score.to_i %></span></p>
|
||||
</li>
|
||||
<% end %>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','application','prettify', 'nyan','leftside', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag('jquery-1.8.3-ui-1.9.2-ujs-2.0.3', 'application', 'jquery.colorbox-min') %>
|
||||
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' ,'prettify' %>
|
||||
<%= heads_for_theme %>
|
||||
|
||||
|
@ -241,7 +241,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div>
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
<div class="cl"></div>
|
||||
<%= render :partial => 'layouts/footer' %>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<ul style="list-style-type:none; margin:0; padding:0;">
|
||||
<li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_content)%></strong></span>
|
||||
<span style="float: left; width: 526px">
|
||||
<p><%=link_to @author, user_url(@author) %> 发布的作业:<%=link_to @anonymous_comment_close_name, @anonymous_comment_close_url%> <span style="color: red; padding-left: 10px;">已经开启匿评了!</span></p>
|
||||
<p><%=link_to @author, user_url(@author) %> 发布的作业:<%=link_to @anonymous_comment_close_name, @anonymous_comment_close_url%> <span style="color: red; padding-left: 10px;">已经开启匿评了,请您关注!</span></p>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
window.location.href='<%= forum_memo_path(:forum_id=>@memo.forum_id,:id=>@memo.id ) %>'
|
|
@ -13,7 +13,21 @@
|
|||
return false;
|
||||
}
|
||||
memo_content.sync();
|
||||
$("#edit_memo").submit();
|
||||
$.ajax({
|
||||
url:' /forums/'+'<%= @memo.forum_id.to_s %>'+'/memos/<%= @memo.id.to_s%>',
|
||||
type:'put',
|
||||
data:{
|
||||
'memo[subject]':$("#memo_subject").val(),
|
||||
'memo[content]':$("#memo_content").val()
|
||||
},
|
||||
success:function(data){
|
||||
|
||||
},
|
||||
error:function(){
|
||||
alert('请检查当前网络连接')
|
||||
}
|
||||
});
|
||||
//$("#edit_memo").submit();
|
||||
}else if($("textarea[name='memo[subject]']").val().trim() == "" && !memo_content.isEmpty() ){
|
||||
$("#error").html("主题不能为空").show();
|
||||
}else if($("textarea[name='memo[subject]']").val().trim() != "" && memo_content.isEmpty()){
|
||||
|
|
|
@ -79,6 +79,8 @@
|
|||
<%= render :partial => 'attachments_links', :locals => {:attachments => @memo.attachments, :options => options, :is_float => true} %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<span class=" fr" style="color: #888888; font-size: 12px;">更新时间:<%= format_date(@memo.updated_at)%></span>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<% if @flag%>
|
||||
window.location.href='<%= forum_memo_path(:forum_id=>@memo.forum_id,:id=>@memo.id ) %>'
|
||||
<%else%>
|
||||
$("#error").html('内容填写存在错误');
|
||||
<% end %>
|
|
@ -1,16 +1,16 @@
|
|||
<%= form_tag(
|
||||
{:controller => 'repositories', :action => 'diff', :id => project,
|
||||
:repository_id => @repository.identifier_param, :path => to_path_param(path)},
|
||||
:method => :get
|
||||
:method => :get
|
||||
) do %>
|
||||
<table class="list changesets">
|
||||
<!--<thead><tr>-->
|
||||
<!--<th>#</th>-->
|
||||
<!--<th></th>-->
|
||||
<!--<th></th>-->
|
||||
<!--<th><%= l(:label_date) %></th>-->
|
||||
<!--<th><%= l(:field_author) %></th>-->
|
||||
<!--<th><%= l(:field_comments) %></th>-->
|
||||
<!--<th>#</th>-->
|
||||
<!--<th></th>-->
|
||||
<!--<th></th>-->
|
||||
<!--<th><%= l(:label_date) %></th>-->
|
||||
<!--<th><%= l(:field_author) %></th>-->
|
||||
<!--<th><%= l(:field_comments) %></th>-->
|
||||
<!--</tr></thead>-->
|
||||
<tbody>
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
|||
<strong class="str-truncated">
|
||||
<a class="commit-row-message"><%= textilizable(truncate_at_line_break(changeset.message)) %></a>
|
||||
</strong>
|
||||
|
||||
<div class="pull-right" title="修订号">
|
||||
<%= h truncate(changeset.short_id.to_s, :length => 20) %>
|
||||
</div>
|
||||
|
@ -31,13 +32,29 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="commit-row-info">
|
||||
<a class="commit-author-link has_tooltip"> <span class="commit-author-name">
|
||||
<%= image_tag(url_to_avatar(user_commit_rep(changeset.author_email)), :width => "20", :height => "20", :class => "fl portraitRadius mt2 ml4 mr5") %>
|
||||
<%= link_to user_commit_rep(changeset.author_email), user_path(user_commit_rep(changeset.author_email)), :length => 30 %></span></a>
|
||||
提交于
|
||||
<div class="committed_ago">
|
||||
<time class="time_ago js-timeago" title="<%= changeset.created_at %>"><%= time_tag(changeset.created_at) %> 前</time>
|
||||
</div>
|
||||
<% if !user_commit_rep(changeset.author_email).nil? %>
|
||||
<a class="commit-author-link has_tooltip"> <span class="commit-author-name">
|
||||
<%= image_tag(url_to_avatar(user_commit_rep(changeset.author_email)), :width => "20", :height => "20", :class => "fl portraitRadius mt2 ml4 mr5") %>
|
||||
<%= link_to user_commit_rep(changeset.author_email), user_path(user_commit_rep(changeset.author_email)), :length => 30 %></span></a>
|
||||
提交于
|
||||
<div class="committed_ago">
|
||||
<time class="time_ago js-timeago" title="<%= changeset.created_at %>"><%= time_tag(changeset.created_at) %>
|
||||
前
|
||||
</time>
|
||||
|
||||
</div>
|
||||
<% else %>
|
||||
<span class="commit-author-name"><%= changeset.author_email %></span>
|
||||
提交于
|
||||
<div class="committed_ago">
|
||||
<time class="time_ago js-timeago" title="<%= changeset.created_at %>"><%= time_tag(changeset.created_at) %>
|
||||
前
|
||||
</time>
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -50,7 +67,7 @@
|
|||
</p>
|
||||
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full commits_pages, commits_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||
<%= pagination_links_full commits_pages, commits_count, :per_page_links => false, :remote => false, :flag => true %>
|
||||
</ul>
|
||||
|
||||
<% end %>
|
||||
|
|
|
@ -15,18 +15,22 @@
|
|||
版本库地址:<%= @repos_url %>
|
||||
<% else %>
|
||||
版本库地址:<%= h @repository.url %>
|
||||
<% end %>
|
||||
<% end %>-
|
||||
<!-- added by bai -->
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => 'navigation' %>
|
||||
<div class="fl c_grey02 mt5 mr5">克隆网址:</div>
|
||||
<textarea id="copy_rep_content" class="cloneUrl mt5 fl" type="input" placeholder="http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git"><%=@repository.type.to_s=="Repository::Gitlab" ? @repos_url.to_s.lstrip : @repository.url %></textarea>
|
||||
<textarea id="copy_rep_content" class="cloneUrl mt5 fl" type="input" ><%=@repository.type.to_s=="Repository::Gitlab" ? @repos_url.to_s.lstrip : @repository.url %></textarea>
|
||||
<a href="javascript:void(0);" class="clone_btn mt5" onclick="jsCopy()"><span class="vl_copy" title="点击复制版本库地址"></span></a>
|
||||
<div class="fl mt5 ml15"><a href="javascript:void(0);" class="vl_btn fb" onclick="zip()"><span class="vl_zip"></span>ZIP</a> </div>
|
||||
<div class="fr mt5"><a href="javascript:void(0);" class="vl_btn fb" onclick="zip()"><span class="vl_fork"></span>Fork</a> <span href="javascript:void(0);" class="vl_btn_2 fb">0</span> </div>
|
||||
<!--<div class="fr mt5"><a href="javascript:void(0);" class="vl_btn fb" onclick="zip()"><span class="vl_fork"></span><%= link_to "Fork", :controller => 'repositories', :action => 'forked' %></a> <span href="javascript:void(0);" class="vl_btn_2 fb">0</span> </div>-->
|
||||
<!--<div class="fr mt5"><a href="javascript:void(0);" class="vl_btn fb" onclick="zip()"><span class="vl_fork"></span>Fork</a> <span href="javascript:void(0);" class="vl_btn_2 fb">0</span> </div>-->
|
||||
|
||||
<div class="fr mt5"><%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn"%>
|
||||
<%#= link_to "<span id='span'>My span </span>#{@user.profile.my_data}".html_safe, "#", class: 'button white' %>
|
||||
|
||||
<span href="javascript:void(0);" class="vl_btn_2 fb"><%= @project.forked_count.to_i %></span> </div>
|
||||
<div class="cl"></div>
|
||||
<div class="recordBanner mt10">
|
||||
<% if @changesets && !@changesets.empty? %>
|
||||
|
|
|
@ -89,6 +89,11 @@
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="revise_attachment">
|
||||
<%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="ping_box fl" id="score_list_<%= work.id%>" style="<%= work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
|
||||
<%student_work_scores.each do |student_score|%>
|
||||
<div id="work_score_<%= student_score.id%>">
|
||||
|
@ -100,3 +105,25 @@
|
|||
<a href="javascript:void(0);" class="fr linkBlue mt5 mb5" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function show_upload(){
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'student_work/upload_attachment' ,:locals => {:work=>work})%>');
|
||||
showModal('ajax-modal', '452px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal();' style='margin-left: 435px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').parent().css("top","40%").css("left","46%");
|
||||
$('#ajax-modal').parent().addClass("resourceUploadPopup");
|
||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
||||
}
|
||||
function submit_files(){
|
||||
$("#upload_form").submit();
|
||||
}
|
||||
function closeModal(){
|
||||
hideModal($(".uploadBoxContainer"));
|
||||
}
|
||||
function disable_choose(){
|
||||
if ($("#attachments_fields .attachment").size() >= 1) {
|
||||
$("#choose_revise_attach").attr("onclick","return false;").addClass(disable_link);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<% revise_attachment = work.attachments.where("attachtype = 7").first %>
|
||||
<% if @homework.end_time < Date.today %>
|
||||
<% if revise_attachment && @is_teacher %>
|
||||
<div class="resubAtt mb15">
|
||||
<span class="resubTitle">追加修订附件</span>
|
||||
</div>
|
||||
<div class="mb10">
|
||||
<span class="tit_fb"> 追加附件:</span>
|
||||
<%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 2} %>
|
||||
<span class="tit_fb">追加时间:</span><%=format_time revise_attachment.created_on.to_s %> (<%=revise_attachment_status @homework,revise_attachment %>)
|
||||
</div>
|
||||
<% end %>
|
||||
<% if work.user == User.current %>
|
||||
<div class="resubAtt mb15">
|
||||
<span class="resubTitle">追加修订附件</span>
|
||||
</div>
|
||||
<% if revise_attachment %>
|
||||
<div class="mb10">
|
||||
<span class="tit_fb"> 追加附件:</span>
|
||||
<%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 1} %>
|
||||
<span class="tit_fb">追加时间:</span><%=format_time revise_attachment.created_on.to_s %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="mb10">
|
||||
<a href="javascript:void(0);" onclick="show_upload();" class="blueCir ml5" title="请选择文件上传">上传附件</a>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -41,17 +41,18 @@
|
|||
</li>
|
||||
<li >
|
||||
<span class="tit_fb"> 附件:</span>
|
||||
<% if work.attachments.empty?%>
|
||||
<% com_attachments = work.attachments.where("attachtype IS NULL OR attachtype <> 7") %>
|
||||
<% if com_attachments.empty?%>
|
||||
<span style="color: #999999">尚未提交附件</span>
|
||||
<% else%>
|
||||
<div class="fl" style="width: 90%;">
|
||||
<%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments, :status => @homework.homework_detail_manual.comment_status} %>
|
||||
<%= render :partial => 'work_attachments_status', :locals => {:attachments => com_attachments, :status => @homework.homework_detail_manual.comment_status} %>
|
||||
</div>
|
||||
<% end%>
|
||||
<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 && work.user != User.current)%>
|
||||
<!-- 老师 || 开启匿评状态 && 不是当前用户自己的作品 -->
|
||||
<div id="add_student_score_<%= work.id%>" class="mt10 evaluation">
|
||||
<%= render :partial => 'add_score',:locals => {:work => work,:score => score}%>
|
||||
|
@ -61,6 +62,11 @@
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="revise_attachment">
|
||||
<%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="ping_box fl" id="score_list_<%= work.id%>" style="<%= work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
|
||||
<%student_work_scores.each do |student_score|%>
|
||||
<div id="work_score_<%= student_score.id%>">
|
||||
|
@ -72,3 +78,25 @@
|
|||
<a href="javascript:void(0);" class="fr linkBlue mt5 mb5" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function show_upload(){
|
||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'student_work/upload_attachment' ,:locals => {:work=>work})%>');
|
||||
showModal('ajax-modal', '452px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal();' style='margin-left: 435px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').parent().css("top","40%").css("left","46%");
|
||||
$('#ajax-modal').parent().addClass("resourceUploadPopup");
|
||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
||||
}
|
||||
function submit_files(){
|
||||
$("#upload_form").submit();
|
||||
}
|
||||
function closeModal(){
|
||||
hideModal($(".uploadBoxContainer"));
|
||||
}
|
||||
function disable_choose(){
|
||||
if ($("#attachments_fields .attachment").size() >= 1) {
|
||||
$("#choose_revise_attach").attr("onclick","return false;").addClass(disable_link);
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,50 @@
|
|||
<!--<div class="resourceUploadPopup">-->
|
||||
<span class="uploadDialogText">上传附件</span>
|
||||
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="closeModal();"></a></div>-->
|
||||
<div class="uploadBoxContainer">
|
||||
<%= form_tag(revise_attachment_student_work_path(work.id), :multipart => true,:remote => !ie8?,:name=>"upload_form",:id=>'upload_form') do %>
|
||||
<div>
|
||||
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html">
|
||||
</span>
|
||||
</div>
|
||||
<div class="uploadBox" id="uploadReviseBox">
|
||||
<input type="hidden" name="attachment_type" value="7">
|
||||
<a href="javascript:void(0);" class="uploadIcon f14" name="button" id="choose_revise_attach" onclick="_file.click();" onmouseover="" style="<%= ie8? ? 'display:none' : ''%>">
|
||||
<span class="chooseFile">选择文件</span></a>
|
||||
<%= file_field_tag 'attachments[dummy][file]',
|
||||
:id => '_file',
|
||||
:class => ie8? ? '':'file_selector',
|
||||
:multiple => true,
|
||||
:onchange => 'addReviseInputFiles(this,"'+'upload_files_submit_btn'+'");',
|
||||
: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)
|
||||
} %>
|
||||
<div class="cl"></div>
|
||||
<!--<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="closeModal();"><%#= l(:button_cancel)%></a>-->
|
||||
<!--<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%#= l(:button_confirm)%></a>-->
|
||||
</div>
|
||||
<div class="uploadResourceIntr">
|
||||
<div class="uploadResourceName">最多只能上传一个小于<span class="c_red">50MB</span>的附件</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div style="margin-top: 10px" >
|
||||
<div class="courseSendSubmit">
|
||||
<%= submit_tag '确定',:onclick=>'submit_files();',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %>
|
||||
</div>
|
||||
<div class="courseSendCancel">
|
||||
<a href="javascript:void(0);" id="upload_files_cancle_btn" class="sendSourceText" onclick="closeModal();">取消</a>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
|
@ -0,0 +1,33 @@
|
|||
<div id="popbox02">
|
||||
<div class="ni_con">
|
||||
<span class="f16 fontBlue fb">请您确认刚刚上传的作品信息</span>
|
||||
<p class="f14 mt5">
|
||||
<span class="fb">作品名称:</span><%=@student_work.name%>
|
||||
</p>
|
||||
<p class="f14 mt5">
|
||||
<span class="fb">作品描述:</span><%=@student_work.description%>
|
||||
</p>
|
||||
<p class="mt5">
|
||||
<span class="fl fb mr30">附</span><span class="fb fl">件:</span>
|
||||
<% if @student_work.attachments.empty? %>
|
||||
<span class="fl c_red"><%= "无附件"%></span>
|
||||
<% else %>
|
||||
<div class="fl grey_c">
|
||||
<%= render :partial => 'work_attachments_status', :locals => {:attachments => @student_work.attachments, :status => 2} %>
|
||||
</div>
|
||||
<% end %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<div class="ni_btn mt10">
|
||||
<a href="javascript:" class="tijiao" onclick="clickOK();" style="margin-bottom: 15px; margin-left: 55px;" >
|
||||
确 定
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function clickOK() {
|
||||
window.location.href = '<%= student_work_index_url(:homework => @homework.id)%>';
|
||||
}
|
||||
</script>
|
|
@ -19,9 +19,10 @@
|
|||
</p>
|
||||
<div class="cl"></div>
|
||||
<div class="ni_btn mt10">
|
||||
<a href="javascript:" class="tijiao" onclick="clickOK();" style="margin-bottom: 15px; margin-left: 55px;" >
|
||||
<a href="javascript:" class="tijiao" onclick="clickOK();" style="margin-bottom: 15px;margin-top:15px;" >
|
||||
确 定
|
||||
</a>
|
||||
<%= link_to("重试", retry_work_student_work_path(@student_work.id),:class => "tijiao",:style =>"margin-bottom: 15px;margin-top:15px;",:remote => true)%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
"<a href='/student_work/"+ <%=@student_work.id%> +"/retry_work' class='upload_btn' data-remote='true'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
||||
<% else %>
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
</div>
|
||||
|
||||
<div class="mt5 fl">
|
||||
<a href="javascript:void(0);" class="RalationIcon fl mt3" onclick="show_project();">关联项目</a>
|
||||
<a href="javascript:void(0);" class="RalationIcon fl mt3" onclick="show_project();">关联项目</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
|
@ -111,9 +111,9 @@
|
|||
</div>
|
||||
|
||||
<div class="mt5">
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="popupRegex();new_student_work();">确定</a>
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="popupRegex();new_student_work();">提交</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<%= link_to "取消", user_homeworks_user_path(User.current.id), :class => "fr mr10 mt3"%>
|
||||
<%= link_to "取消", delete_work_student_work_index_path(:homework =>@homework.id), :class => "fr mr10 mt3"%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end%>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
hideModal('#popbox02');
|
||||
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false})%>");
|
|
@ -0,0 +1,2 @@
|
|||
closeModal();
|
||||
$("#revise_attachment").html('<%= escape_javascript( render :partial => 'revise_attachment' ,:locals=>{ :work => @work})%>');
|
|
@ -1,5 +1,5 @@
|
|||
<% if @submit_result%>
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_information') %>');
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_edit_information') %>');
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<%= form_tag( url_for(:controller => 'users',:action => 'resource_search',:id=>user.id),
|
||||
:remote=>true ,:method => 'get',:class=>'resourcesSearchloadBox',:id=>'resource_search_form') do %>
|
||||
<input type="text" name="search" placeholder="输入资源关键词进行搜索" class="searchResource" />
|
||||
<%= hidden_field_tag(:type,type) %>
|
||||
<%= hidden_field_tag(:type,type.nil? ? 1 : type) %>
|
||||
<%= submit_tag '',:class=>'homepageSearchIcon',:onfocus=>'this.blur();',:style=>'border-style:none' %>
|
||||
<!--<a href="javascript:void(0);" onclick='this.parent.submit();return false;' class="searchIcon"></a>-->
|
||||
<% end %>
|
|
@ -17,7 +17,10 @@
|
|||
:remote=>true,:id=>'search_user_project_form',:class=>'resourcesSearchBox' do %>
|
||||
<%= hidden_field_tag(:send_id, send_id) %>
|
||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||
<input type="text" name="search" placeholder="输入项目ID或者名称搜索" class="searchResourcePopup" />
|
||||
<input type="text" id="search_project_input" value="<%= @search %>" name="search" placeholder="输入项目ID或者名称搜索" class="searchResourcePopup" />
|
||||
<script>
|
||||
observeSearchfieldOnInput('search_project_input','<%= search_user_project_user_path(user)%>','<%= send_id %>','<%= send_ids%>')
|
||||
</script>
|
||||
<!--<a href="javascript:void(0);" class="searchIconPopup"></a>-->
|
||||
<%= submit_tag '',:class=>'searchIconPopup',:onfocus=>"this.blur();",:style=>'border-style:none' %>
|
||||
<% end %>
|
||||
|
|
|
@ -17,7 +17,10 @@
|
|||
:remote=>true,:id=>'search_user_course_form',:class=>'resourcesSearchBox' do %>
|
||||
<%= hidden_field_tag(:send_id, send_id) %>
|
||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||
<input type="text" name="search" placeholder="输入课程ID或者名称搜索" class="searchResourcePopup" />
|
||||
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入课程ID或者名称搜索" class="searchResourcePopup" />
|
||||
<script>
|
||||
observeSearchfieldOnInput('search_course_input','<%= search_user_course_user_path(user)%>','<%= send_id %>','<%= send_ids%>')
|
||||
</script>
|
||||
<!--<a href="javascript:void(0);" class="searchIconPopup"></a>-->
|
||||
<%= submit_tag '',:class=>'searchIconPopup',:onfocus=>"this.blur();",:style=>'border-style:none' %>
|
||||
<% end %>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<!--</p>-->
|
||||
<% else %>
|
||||
<% attachments.each do |attach| %>
|
||||
<ul class="resourcesList" onmouseover="$(this).children().css('background-color', '#e1e1e1')" onmouseout="$(this).children().css('background-color', 'white')">
|
||||
<ul class="resourcesList" onmouseover="if($('#contextMenu').css('display') != 'block')$(this).children().css('background-color', '#e1e1e1')" onmouseout=" if($('#contextMenu').css('display') == 'none')$(this).children().css('background-color', 'white')">
|
||||
<li class="resourcesListCheckbox fl">
|
||||
<input name="checkbox1[]" type="checkbox" data-deleteble="<%= User.current.id ==attach.author_id ? 'Y' : 'N' %>" onclick="checkAllBox($(this));" value="<%= attach.id%>" class="resourcesCheckbox" />
|
||||
</li>
|
||||
|
|
|
@ -126,7 +126,7 @@
|
|||
</ul>
|
||||
<% end %>
|
||||
</div>
|
||||
<li class="homepageHomeworkContentWarn fl"> 截止时间快到了!</li>
|
||||
<li class="homepageHomeworkContentWarn fl"> 截止时间快到啦</li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
@ -158,7 +158,7 @@
|
|||
<li>匿评截止:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59</span></li>
|
||||
</ul>
|
||||
<% unless User.current.allowed_to?(:as_teacher, ma.course_message.course)%>
|
||||
<p>请您尽早完成匿评!如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。</p>
|
||||
<p>请您尽早完成匿评,如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。</p>
|
||||
<p>例如,您缺评了两份作品,则您的最终成绩将被扣除 <%= ma.course_message.homework_detail_manual.absence_penalty %> * 2 = <%= ma.course_message.homework_detail_manual.absence_penalty * 2 %>分</p>
|
||||
<% end%>
|
||||
</div>
|
||||
|
@ -209,7 +209,7 @@
|
|||
<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 + "老师") %>启动作业匿评失败!
|
||||
<%= User.current.eql?(ma.course_message.user) ?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname + "老师") %>启动作业匿评失败啦
|
||||
|
||||
</p>
|
||||
<ul class="ul_normal_color">
|
||||
|
@ -404,7 +404,7 @@
|
|||
</ul>
|
||||
<p>如需获得最终成绩,请您联系主讲老师对您的作品进行单独评分!</p>
|
||||
</div>
|
||||
<li class="homepageHomeworkContentWarn fl"> 您迟交了作品!</li>
|
||||
<li class="homepageHomeworkContentWarn fl"> 您成功提交了作品(但被标记为迟交啦)</li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
@ -579,7 +579,7 @@
|
|||
</ul>
|
||||
<% end %>
|
||||
|
||||
<!-被老师移出课程-->
|
||||
<!--被老师移出课程-->
|
||||
<% if ma.course_message_type == "RemoveFromCourse" %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl">
|
||||
|
@ -612,4 +612,74 @@
|
|||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<!--老师发布测验 发给学生看-->
|
||||
<% if ma.course_message_type == "Exercise" && ma.status == 2 %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<span><%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
|
||||
user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %></span><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了课程测验 :</span></li>
|
||||
<li class="homepageNewsContent fl">
|
||||
<%= link_to "测验题目:" + ma.course_message.exercise_name, exercise_path(:id => 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_normal_color">
|
||||
<li>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)</li>
|
||||
<li>测验标题:<%= ma.course_message.exercise_name %></li>
|
||||
<!--<li>测验描述:<%#= ma.course_message.exercise_description %></li>-->
|
||||
<!--<li>测验状态:<%#= ma.course_message.exercise_status == 1 ? '未发布':'已发布'%></li>-->
|
||||
<!--<%# if ma.course_message.publish_time %>-->
|
||||
<!--<li>发布时间:<%#= ma.course_message.publish_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %></li>-->
|
||||
<!--<%# end %>-->
|
||||
<li>截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %></li>
|
||||
<li>答题时长:<%= ma.course_message.time == -1 ? '不限时' : ma.course_message.time.to_s + '分钟' %></li>
|
||||
<% if !User.current.allowed_to?(:as_teacher,ma.course_message.course)%>
|
||||
<p>请记得在截止时间前完成测验噢,辛苦啦!</p>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
|
||||
<% if ma.course_message_type == "Exercise" && ma.status == 3 %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<span> <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
|
||||
user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %></span><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布的测验:</span></li>
|
||||
<li class="homepageHomeworkContent fl">
|
||||
<%= link_to "测验题目:" + ma.course_message.exercise_name, exercise_path(:id => 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_normal_color">
|
||||
<li>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)</li>
|
||||
<li>测验标题:<%= ma.course_message.exercise_name %></li>
|
||||
<li>截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %></li>
|
||||
<li>答题时长:<%= ma.course_message.time == -1 ? '无限制' : ma.course_message.time.to_s + '分钟' %></li>
|
||||
<p>请及时完成课程测验,辛苦啦!</p>
|
||||
</ul>
|
||||
</div>
|
||||
<li class="homepageHomeworkContentWarn fl">截止时间快到啦 </li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -5,5 +5,6 @@ $("#res_count").html(0);
|
|||
$("#checkboxAll").attr('checked',false);
|
||||
$("#res_all_count").html(<%= @atta_count%>);
|
||||
closePopUp();
|
||||
alert("发送成功")
|
||||
<% else%>
|
||||
<% end %>
|
|
@ -5,5 +5,6 @@ $("#res_count").html(0);
|
|||
$("#checkboxAll").attr('checked',false);
|
||||
$("#res_all_count").html(<%= @atta_count%>);
|
||||
closePopUp();
|
||||
alert("发送成功")
|
||||
<% else%>
|
||||
<% end %>
|
|
@ -143,7 +143,7 @@
|
|||
//资源名称的链接
|
||||
var res_link;
|
||||
var id; //资源id
|
||||
var sendType; //发送到课程 1 发送到项目 2
|
||||
var sendType = '1'; //发送到课程 1 发送到项目 2
|
||||
var lastSendType; //保存上次发送的发送类型
|
||||
$("#resources_list").mousedown(function(e) {
|
||||
//如果是右键的话
|
||||
|
@ -309,15 +309,15 @@
|
|||
document.oncontextmenu = function() {return true;}
|
||||
line.children().css("background-color",'white');
|
||||
id = line.children().last().html();
|
||||
if (lastSendType === '1'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
|
||||
if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(@user)%>' + '?send_id=' + id
|
||||
url: '<%= search_user_project_user_path(@user)%>' + '?send_id=' + id
|
||||
});
|
||||
}else{
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_project_user_path(@user)%>' + '?send_id=' + id
|
||||
url: '<%= search_user_course_user_path(@user)%>' + '?send_id=' + id
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -327,16 +327,17 @@
|
|||
alert('暂时不支持多页选择,您当前页没有选择任何资源');
|
||||
return ;
|
||||
}
|
||||
if (lastSendType === '1'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(@user)%>' + '?'+ $("#resources_list_form").serialize()
|
||||
});
|
||||
}else{
|
||||
if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_project_user_path(@user)%>' + '?' + $("#resources_list_form").serialize()
|
||||
});
|
||||
}else{
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(@user)%>' + '?'+ $("#resources_list_form").serialize()
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -480,54 +481,36 @@
|
|||
|
||||
lastSendType = sendType;
|
||||
}
|
||||
// var iWidth = document.documentElement.clientWidth;
|
||||
// var iHeight = document.documentElement.clientHeight;
|
||||
// var moveX = 0;
|
||||
// var moveY = 0;
|
||||
// var moveTop = 0;
|
||||
// var moveLeft = 0;
|
||||
// var moveable = false;
|
||||
// var docMouseMoveEvent = document.onmousemove;
|
||||
// var docMouseUpEvent = document.onmouseup;
|
||||
// $("#upload_box").mousedown(function() {
|
||||
// var evt = getEvent();
|
||||
// moveable = true;
|
||||
// moveX = evt.clientX;
|
||||
// moveY = evt.clientY;
|
||||
//
|
||||
// moveTop = parseInt($("#upload_box").css('top'));
|
||||
// moveLeft = parseInt($("#upload_box").css('left'));
|
||||
//
|
||||
// $(document).mousemove( function() {
|
||||
// if (moveable) {
|
||||
// var evt = getEvent();
|
||||
// var x = moveLeft + evt.clientX - moveX;
|
||||
// var y = moveTop + evt.clientY - moveY;
|
||||
// if ( x > 0 &&( x + 322 < iWidth) && y > 0 && (y + 257 < iHeight) ) {
|
||||
// $("#upload_box").css('left', x + "px");
|
||||
// $("#upload_box").css('top', y + "px");
|
||||
// console.log( moveX)
|
||||
// console.log( moveY)
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// $(document).mouseup (function () {
|
||||
// if (moveable) {
|
||||
// document.onmousemove = docMouseMoveEvent;
|
||||
// document.onmouseup = docMouseUpEvent;
|
||||
// moveable = false;
|
||||
// moveX = 0;
|
||||
// moveY = 0;
|
||||
// moveTop = 0;
|
||||
// moveLeft = 0;
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
//
|
||||
// // 获得事件Event对象,用于兼容IE和FireFox
|
||||
// function getEvent() {
|
||||
// return window.event || arguments.callee.caller.arguments[0];
|
||||
// }
|
||||
|
||||
function observeSearchfieldOnInput(fieldId, url,send_id,send_ids) {
|
||||
$('#'+fieldId).each(function() {
|
||||
var $this = $(this);
|
||||
$this.addClass('autocomplete');
|
||||
$this.attr('data-value-was', $this.val());
|
||||
var check = function() {
|
||||
var val = $this.val();
|
||||
if ($this.attr('data-value-was') != val){
|
||||
$this.attr('data-value-was', val);
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'get',
|
||||
data: {search: $this.val(),send_id:send_id,send_ids:send_ids},
|
||||
success: function(data){ },
|
||||
beforeSend: function(){ $this.addClass('ajax-loading'); },
|
||||
complete: function(){ $this.removeClass('ajax-loading'); }
|
||||
});
|
||||
}
|
||||
};
|
||||
var reset = function() {
|
||||
if (timer) {
|
||||
clearInterval(timer);
|
||||
timer = setInterval(check, 300);
|
||||
}
|
||||
};
|
||||
var timer = setInterval(check, 300);
|
||||
$this.bind('keyup click mousemove', reset);
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
<% unless all_results.nil? || all_results.empty?%>
|
||||
<% all_results.each do |item|%>
|
||||
<% case item.type %>
|
||||
<% when 'user'%>
|
||||
<ul class="searchContent">
|
||||
<li class="fl"></li>
|
||||
<li class="fl searchContentDes">
|
||||
<ul class="fl">
|
||||
<li class="f16 mb5"><a href="<%= user_path(item.id)%>" class="fontGrey3 fl">
|
||||
<%= item.try(:highlight).try(:login) ? item.highlight.login[0].html_safe : item.login %>
|
||||
<%if item.firstname.present? || item.lastname.present?%>
|
||||
(<%= item.try(:highlight).try(:lastname) ? item.highlight.lastname[0].html_safe : item.lastname%>
|
||||
<%= item.try(:highlight).try(:firstname) ? item.highlight.firstname[0].html_safe : item.firstname %>)
|
||||
<%end %>
|
||||
</a>
|
||||
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag"><%= get_user_identity(User.find(item.id).user_extensions.identity) %></span></div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class="fontGrey3 mb5"><%= User.find(item.id).user_extensions && User.find(item.id).user_extensions.brief_introduction.present? ? User.find(item.id).user_extensions.brief_introduction : '这位童鞋很懒,什么也没有留下~'%></li>
|
||||
<li class="f12 fontGrey2"><span class="mr30">加入时间:<%= format_date( User.find(item.id).created_on)%></span><span class="mr30"><%= User.find(item.id).user_extensions.occupation.present? ? '单位:'+User.find(item.id).user_extensions.occupation : ''%></span></li>
|
||||
</ul>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% when 'course'%>
|
||||
<ul class="searchContent">
|
||||
<li class="fl">
|
||||
</li>
|
||||
<li class="fl searchContentDes">
|
||||
<ul class="fl">
|
||||
<li class="f16 mb5">
|
||||
<a href="<%= course_path(item.id)%>" class="fontGrey3 fl"><%= item.try(:highlight).try(:name) ? item.highlight.name[0].html_safe : item.name %></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(:description) ? item.highlight.description[0].html_safe : item.description %></li>
|
||||
<li class="f12 fontGrey2"><span class="mr30">教师:<%= User.find(item.tea_id).realname %></span><span class="mr30">授课时间:<%= item.time.to_s + item.term%></span><span class="mr30"><%= User.find(item.tea_id).user_extensions.occupation.present? ? '单位:'+User.find(item.tea_id).user_extensions.occupation : ''%></span></li>
|
||||
</ul>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% when 'attachment'%>
|
||||
<ul class="searchContent">
|
||||
<li class="fl">
|
||||
</li>
|
||||
<li class="fl searchContentDes">
|
||||
<ul class="fl">
|
||||
<li class="f16 mb5 fontGrey3"><a href="<%= download_named_attachment_path(item.id,item.filename)%>" class="fontGrey3 mr10 fl"><%= item.try(:highlight).try(:filename) ? item.highlight.filename[0].html_safe : item.filename %></a><span class="f12 fl" style="padding-top: 5px">(<%= number_to_human_size(item.filesize)%>)</span>
|
||||
<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="f12 fontGrey2"><span class="mr30">发布者:<%= User.find(item.author_id).login%>(<%= User.find(item.author_id).realname%>)</span>
|
||||
<!--<span class="mr30">职称:<%#= get_technical_title User.find(item.author_id) %></span>-->
|
||||
<span class="mr30">发布时间:<%= format_date(item.created_on)%></span></li>
|
||||
</ul>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% when 'project'%>
|
||||
<ul class="searchContent">
|
||||
<li class="fl">
|
||||
</li>
|
||||
<li class="fl searchContentDes">
|
||||
<ul class="fl">
|
||||
<li class="f16 mb5"><a href="<%= project_path(item.id)%>" class="fontGrey3 fl"><%= item.try(:highlight).try(:name) ? item.highlight.name[0].html_safe : item.name %></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(:description) ? item.highlight.description[0].html_safe : item.description%></li>
|
||||
<li class="f12 fontGrey2"><span class="mr30">管理人员:<%= item.user_id ? User.find(item.user_id).login : '无' %></span><span class="mr30">创建时间:<%= date_format_local( Project.find(item.id).created_on) %></span></li>
|
||||
</ul>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<%end %>
|
||||
<% end %>
|
||||
<div class="pageRoll">
|
||||
<%= paginate all_results,:params => {:controller => 'welcome', :action => 'search',:search_type=>'all'}%>
|
||||
</div>
|
||||
<% end %>
|
|
@ -0,0 +1,24 @@
|
|||
<% unless attachments.nil? || attachments.empty?%>
|
||||
<% attachments.each do |attachment|%>
|
||||
<ul class="searchContent">
|
||||
<li class="fl">
|
||||
</li>
|
||||
<li class="fl searchContentDes">
|
||||
<ul class="fl">
|
||||
<li class="f16 mb5 fontGrey3">
|
||||
<a href="<%= download_named_attachment_path(attachment.id,attachment.filename)%>" class="fontGrey3 mr10 fl"><%= attachment.try(:highlight).try(:filename) ? attachment.highlight.filename[0].html_safe : attachment.filename %></a><span class="f12 fl" style="padding-top: 5px">(<%= number_to_human_size(attachment.filesize)%>)</span>
|
||||
<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="f12 fontGrey2"><span class="mr30">发布者:<%= User.find(attachment.author_id).login%>(<%= User.find(attachment.author_id).realname%>)</span>
|
||||
<!--<span class="mr30">职称:<%#= get_technical_title User.find(attachment.author_id) %></span>-->
|
||||
<span class="mr30">发布时间:<%= format_date(attachment.created_on)%></span></li>
|
||||
</ul>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% end %>
|
||||
<div class="pageRoll">
|
||||
<%= paginate attachments,:params => {:controller => 'welcome', :action => 'search',:search_type=>'attachment'}%>
|
||||
</div>
|
||||
<% end %>
|
|
@ -0,0 +1,24 @@
|
|||
<% unless courses.nil? || courses.empty?%>
|
||||
<% courses.each do |course|%>
|
||||
<ul class="searchContent">
|
||||
<li class="fl">
|
||||
<%= link_to image_tag(url_to_avatar(Course.find(course.id)), :width => "75", :height => "75",:class=>'searchCourseImage'), course_path(course.id), :alt => "课程图片" %>
|
||||
</li>
|
||||
<li class="fl searchContentDes">
|
||||
<ul class="fl">
|
||||
<li class="f16 mb5">
|
||||
<a href="<%= course_path(course.id)%>" class="fontGrey3 fl"><%= course.try(:highlight).try(:name) ? course.highlight.name[0].html_safe : course.name %></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"><%= course.try(:highlight).try(:description) ? course.highlight.description[0].html_safe : (course.description.present? ? course.description : '暂时没有该课程描述') %></li>
|
||||
<li class="f12 fontGrey2"><span class="mr30">教师:<%= User.find(course.tea_id).realname %></span><span class="mr30">授课时间:<%= course.time.to_s + course.term%></span><span class="mr30"><%= User.find(course.tea_id).user_extensions.occupation.present? ? '单位:'+User.find(course.tea_id).user_extensions.occupation : ''%></span></li>
|
||||
</ul>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% end %>
|
||||
<div class="pageRoll">
|
||||
<%= paginate courses,:params => {:controller => 'welcome', :action => 'search',:search_type=>'course'}%>
|
||||
</div>
|
||||
<% end %>
|
|
@ -0,0 +1,24 @@
|
|||
<% unless projects.nil? || projects.empty?%>
|
||||
<% projects.each do |project|%>
|
||||
<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(Project.find(project.id)), :width => "75", :height => "75",:class=>'searchCourseImage'), project_path(project.id), :alt => "项目图片" %>
|
||||
</li>
|
||||
<li class="fl searchContentDes">
|
||||
<ul class="fl">
|
||||
<li class="f16 mb5"><a href="<%= project_path(project.id)%>" class="fontGrey3 fl"><%= project.try(:highlight).try(:name) ? project.highlight.name[0].html_safe : project.name %></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"><%= project.try(:highlight).try(:description) ? project.highlight.description[0].html_safe : project.description%></li>
|
||||
<li class="f12 fontGrey2"><span class="mr30">管理人员:<%= project.user_id ? User.find(project.user_id).login : '无' %></span><span class="mr30">创建时间:<%= date_format_local( Project.find(project.id).created_on) %></span></li>
|
||||
</ul>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% end %>
|
||||
<div class="pageRoll">
|
||||
<%= paginate projects,:params => {:controller => 'welcome', :action => 'search',:search_type=>'project'}%>
|
||||
</div>
|
||||
<% end %>
|
|
@ -0,0 +1,24 @@
|
|||
<% unless users.nil? || users.empty?%>
|
||||
<% users.each do |user|%>
|
||||
<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(user.id)), :width => "75", :height => "75",:class=>'searchCourseImage'), user_path(user.id), :alt => "用户头像" %>
|
||||
</li>
|
||||
<li class="fl searchContentDes">
|
||||
<ul class="fl">
|
||||
<li class="f16 mb5"><a href="<%= user_path(user.id)%>" class="fontGrey3 fl"><%= user.try(:highlight).try(:login) ? user.highlight.login[0].html_safe : user.login %>(<%= user.try(:highlight).try(:lastname) ? user.highlight.lastname[0].html_safe : user.lastname%><%= user.try(:highlight).try(:firstname) ? user.highlight.firstname[0].html_safe : user.firstname %>)</a>
|
||||
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag"><%= get_user_identity(User.find(user.id).user_extensions.identity) %></span></div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class="fontGrey3 mb5"><%= User.find(user.id).user_extensions && User.find(user.id).user_extensions.brief_introduction.present? ? User.find(user.id).user_extensions.brief_introduction : '这位童鞋很懒,什么也没有留下~'%></li>
|
||||
<li class="f12 fontGrey2"><span class="mr30">加入时间:<%= format_date( User.find(user.id).created_on)%></span><span class="mr30"><%= User.find(user.id).user_extensions.occupation.present? ? '单位:'+User.find(user.id).user_extensions.occupation : ''%></span></li>
|
||||
</ul>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% end %>
|
||||
<div class="pageRoll">
|
||||
<%= paginate users,:params => {:controller => 'welcome', :action => 'search',:search_type=>'user'}%>
|
||||
</div>
|
||||
<% end %>
|
|
@ -0,0 +1,100 @@
|
|||
<script type="text/javascript" language="javascript">
|
||||
//搜索列表
|
||||
function g(o){return document.getElementById(o);}
|
||||
function HoverLi(n){
|
||||
//如果有N个标签,就将i<=N;
|
||||
for(var i=1;i<=5;i++){
|
||||
g('searchBaner_'+i).className='searchBannerNormal';
|
||||
g('searchContent_'+i).className='undis';g('searchNum_'+i).className="numRed";
|
||||
g('searchType_'+i).className="fontGrey2 f14";
|
||||
}
|
||||
g('searchContent_'+n).className='dis';
|
||||
g('searchBaner_'+n).className='searchBannerActive';
|
||||
g('searchNum_'+n).className="c_red";
|
||||
g('searchType_'+n).className="fontGrey3 f14";
|
||||
|
||||
}
|
||||
|
||||
function on_click_search(n){
|
||||
if(n == 1){
|
||||
search('all')
|
||||
//$("#searchContent_1").html('<%#= escape_javascript(render :partial => 'search_all_results',:locals => {:alls=> @results})%>');
|
||||
}else if( n == 2){
|
||||
//$("#searchContent_2").html('<%#= escape_javascript(render :partial => 'search_user_results',:locals => {:users=>@users})%>');
|
||||
search('user')
|
||||
}else if(n == 3){
|
||||
search('course')
|
||||
}else if(n == 4){
|
||||
search('attachment')
|
||||
}else if(n == 5){
|
||||
search('project')
|
||||
}
|
||||
}
|
||||
|
||||
function search(type){
|
||||
$.ajax({
|
||||
url:'<%= url_for(:controller => 'welcome',:action=>'search')%>' +'?q=<%= @name %>&search_type='+type,
|
||||
type:'get',
|
||||
success:function(data){
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
$(function(){
|
||||
if('<%= @search_type%>' == 'all'){
|
||||
HoverLi(1)
|
||||
$("#searchContent_1").html('<%= escape_javascript(render :partial => 'search_all_results',:locals => {:all_results=> @alls})%>');
|
||||
}else if('<%= @search_type%>' == 'user'){
|
||||
HoverLi(2)
|
||||
$("#searchContent_2").html('<%= escape_javascript(render :partial => 'search_user_results',:locals => {:users=>@users})%>');
|
||||
}else if('<%= @search_type%>' == 'course'){
|
||||
HoverLi(3)
|
||||
$("#searchContent_3").html('<%= escape_javascript(render :partial => 'search_course_results',:locals => {:courses=>@courses})%>');
|
||||
}else if('<%= @search_type%>' == 'attachment'){
|
||||
HoverLi(4)
|
||||
$("#searchContent_4").html('<%= escape_javascript(render :partial => 'search_attachment_results',:locals => {:attachments=>@attachments})%>');
|
||||
}else if('<%= @search_type%>' == 'project'){
|
||||
HoverLi(5)
|
||||
$("#searchContent_5").html('<%= escape_javascript(render :partial => 'search_project_results',:locals => {:projects=>@projects})%>');
|
||||
}
|
||||
})
|
||||
//如果要做成点击后再转到请将<li>中的onmouseover 改成 onclick;
|
||||
//]]>
|
||||
</script>
|
||||
<script>
|
||||
//搜索内容自动撑高到整屏
|
||||
var h1 = $(window).height();
|
||||
var h2 = $(".homepageContentContainer").height();
|
||||
|
||||
</script>
|
||||
<div class="homepageContentContainer">
|
||||
<div class="homepageContent">
|
||||
<div class="blocks mt10 mb10">
|
||||
<ul id="searchBanner">
|
||||
<li id="searchBaner_1" class="searchBannerActive" onclick="HoverLi(1);on_click_search(1);"><a href="javascript:void(0);" id="searchType_1" class="fontGrey3 f14">全部<span style="font-weight:normal;"><font id="searchNum_1" class="c_red">(<%= @total_count%>)</font></span></a></li>
|
||||
<li id="searchBaner_2" onclick="HoverLi(2);on_click_search(2);"><a href="javascript:void(0);" id="searchType_2" class="fontGrey2 f14">用户<span class="numRed" style="font-weight:normal;"><font id="searchNum_2" class="numRed">(<%= @users_count%>)</font></span></a></li>
|
||||
<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>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<ul id="searchTips" style="display:none;">
|
||||
<span class="fontGrey3">没有搜索到相关的内容!</span>
|
||||
</ul>
|
||||
<div id="searchContent_1">
|
||||
|
||||
</div>
|
||||
<div id="searchContent_2" class="undis">
|
||||
<%#= render :partial => 'search_user_results',:locals => {:users=>@users}%>
|
||||
</div>
|
||||
<div id="searchContent_3" class="undis">
|
||||
</div>
|
||||
<div id="searchContent_4" class="undis">
|
||||
|
||||
</div>
|
||||
<div id="searchContent_5" class="undis">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,13 @@
|
|||
<% case @search_type%>
|
||||
<% when 'all'%>
|
||||
$("#searchContent_1").html('<%= escape_javascript(render :partial => 'search_all_results',:locals => {:all_results=> @alls})%>');
|
||||
<% when 'user'%>
|
||||
$("#searchContent_2").html('<%= escape_javascript(render :partial => 'search_user_results',:locals => {:users=>@users})%>');
|
||||
<% when 'course'%>
|
||||
$("#searchContent_3").html('<%= escape_javascript(render :partial => 'search_course_results',:locals => {:courses=>@courses})%>');
|
||||
<% when 'project'%>
|
||||
$("#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})%>');
|
||||
<%else%>
|
||||
<%end %>
|
|
@ -2,7 +2,7 @@ require File.expand_path('../boot', __FILE__)
|
|||
|
||||
require 'rails/all'
|
||||
require 'sprockets/railtie'
|
||||
|
||||
require 'elasticsearch/model'
|
||||
if defined?(Bundler)
|
||||
# If you precompile assets before deploying to production, use this line
|
||||
Bundler.require(*Rails.groups(:assets => %w(development test)))
|
||||
|
@ -73,6 +73,17 @@ module RedmineApp
|
|||
end
|
||||
|
||||
config.after_initialize do
|
||||
if RbConfig::CONFIG['target_os'] == 'mingw32'
|
||||
Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true,log:true
|
||||
elsif RbConfig::CONFIG['target_os'] == 'linux' && ["fast76"].include?(`hostname`.gsub("\n",""))
|
||||
Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true,log:true
|
||||
elsif RbConfig::CONFIG['target_os'] == 'linux' && ["testtrustie11","agent12"].include?(`hostname`.gsub("\n",""))
|
||||
Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.11:9200','192.168.80.12:9200'], retry_on_failure: true
|
||||
elsif RbConfig::CONFIG['target_os'] == 'linux' && ["trustie168","trustieserver14","trustieserver16","Trustie18"].include?(`hostname`.gsub("\n",""))
|
||||
Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.168:9200'], retry_on_failure: true
|
||||
else
|
||||
Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true
|
||||
end
|
||||
end
|
||||
|
||||
if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
|
||||
|
|
|
@ -23,10 +23,10 @@
|
|||
Kaminari.configure do |config|
|
||||
# config.default_per_page = 25
|
||||
# config.max_per_page = nil
|
||||
config.window = 0
|
||||
config.window = 1
|
||||
# config.outer_window = 3
|
||||
# config.left = 2
|
||||
# config.right = 2
|
||||
config.left = 2
|
||||
config.right = 2
|
||||
# config.page_method_name = :page
|
||||
# config.param_name = :page
|
||||
end
|
||||
|
|
|
@ -26,6 +26,6 @@ zh:
|
|||
mail_attention: "请您关注!"
|
||||
mail_homework_endtime: "作业截止时间快到了!"
|
||||
mail_homework: "作业:"
|
||||
mail_anonymous_comment_close: "作业匿评已经关闭!"
|
||||
mail_anonymous_comment_open: "作业匿评已经开启!"
|
||||
mail_anonymous_comment_failed: "作业匿评开启失败!"
|
||||
mail_anonymous_comment_close: "作业匿评已经关闭,请您关注!"
|
||||
mail_anonymous_comment_open: "作业匿评已经开启,请您关注!"
|
||||
mail_anonymous_comment_failed: "作业匿评开启失败,请您关注!"
|
|
@ -109,7 +109,7 @@ RedmineApp::Application.routes.draw do
|
|||
resources :homework_users
|
||||
resources :no_uses
|
||||
delete 'no_uses', :to => 'no_uses#delete'
|
||||
|
||||
match 'site_search', :to => 'users#site_search', :as => 'site_search', :via => [:get, :post, :put]
|
||||
resources :apply_project_masters
|
||||
delete 'apply_project_masters', :to => 'apply_project_masters#delete'
|
||||
|
||||
|
@ -211,11 +211,14 @@ RedmineApp::Application.routes.draw do
|
|||
resources :student_work do
|
||||
member do
|
||||
post 'add_score'
|
||||
post 'revise_attachment'
|
||||
get 'retry_work'
|
||||
get 'praise_student_work'
|
||||
get 'forbidden_anonymous_comment'
|
||||
end
|
||||
collection do
|
||||
post 'add_score_reply'
|
||||
get 'delete_work'
|
||||
get 'destroy_score_reply'
|
||||
get 'student_work_absence_penalty'
|
||||
get 'absence_penalty_list'
|
||||
|
@ -502,6 +505,11 @@ RedmineApp::Application.routes.draw do
|
|||
end
|
||||
end
|
||||
end
|
||||
resources :blog_comments do
|
||||
collection do
|
||||
get :search
|
||||
end
|
||||
end
|
||||
match 'users/:id/user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "feedback"
|
||||
match 'users/:id/user_projects', :to => 'users#user_projects', :via => :get
|
||||
#消息
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddIndexToHomeworkCommons < ActiveRecord::Migration
|
||||
def change
|
||||
add_index :homework_commons, [:course_id, :id]
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddIndexToStudentWorks < ActiveRecord::Migration
|
||||
def change
|
||||
add_index :student_works, [:homework_common_id, :user_id]
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
# encoding: utf-8
|
||||
class AddAttachmentType < ActiveRecord::Migration
|
||||
def up
|
||||
Attachmentstype.create(typeId:3,typeName:'修订附件')
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddForkedFromProjectIdToProjects < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :projects, :forked_from_project_id, :integer
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddForkedCountToProjects < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :projects, :forked_count, :integer
|
||||
end
|
||||
end
|
68
db/schema.rb
68
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20151126160252) do
|
||||
ActiveRecord::Schema.define(:version => 20151204062220) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -543,26 +543,23 @@ ActiveRecord::Schema.define(:version => 20151126160252) do
|
|||
add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
|
||||
add_index "documents", ["project_id"], :name => "documents_project_id"
|
||||
|
||||
create_table "dts", :primary_key => "Num", :force => true do |t|
|
||||
t.string "Defect", :limit => 50
|
||||
t.string "Category", :limit => 50
|
||||
t.string "File"
|
||||
t.string "Method"
|
||||
t.string "Module", :limit => 20
|
||||
t.string "Variable", :limit => 50
|
||||
t.integer "StartLine"
|
||||
t.integer "IPLine"
|
||||
t.string "IPLineCode", :limit => 200
|
||||
t.string "Judge", :limit => 15
|
||||
t.integer "Review", :limit => 1
|
||||
create_table "dts", :force => true do |t|
|
||||
t.string "IPLineCode"
|
||||
t.string "Description"
|
||||
t.text "PreConditions", :limit => 2147483647
|
||||
t.text "TraceInfo", :limit => 2147483647
|
||||
t.text "Code", :limit => 2147483647
|
||||
t.string "Num"
|
||||
t.string "Variable"
|
||||
t.string "TraceInfo"
|
||||
t.string "Method"
|
||||
t.string "File"
|
||||
t.string "IPLine"
|
||||
t.string "Review"
|
||||
t.string "Category"
|
||||
t.string "Defect"
|
||||
t.string "PreConditions"
|
||||
t.string "StartLine"
|
||||
t.integer "project_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "id", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "enabled_modules", :force => true do |t|
|
||||
|
@ -736,6 +733,8 @@ ActiveRecord::Schema.define(:version => 20151126160252) do
|
|||
t.integer "anonymous_comment", :default => 0
|
||||
end
|
||||
|
||||
add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id"
|
||||
|
||||
create_table "homework_detail_manuals", :force => true do |t|
|
||||
t.float "ta_proportion"
|
||||
t.integer "comment_status"
|
||||
|
@ -892,6 +891,16 @@ ActiveRecord::Schema.define(:version => 20151126160252) do
|
|||
|
||||
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
|
||||
|
||||
create_table "journal_details_copy", :force => true do |t|
|
||||
t.integer "journal_id", :default => 0, :null => false
|
||||
t.string "property", :limit => 30, :default => "", :null => false
|
||||
t.string "prop_key", :limit => 30, :default => "", :null => false
|
||||
t.text "old_value"
|
||||
t.text "value"
|
||||
end
|
||||
|
||||
add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id"
|
||||
|
||||
create_table "journal_replies", :id => false, :force => true do |t|
|
||||
t.integer "journal_id"
|
||||
t.integer "user_id"
|
||||
|
@ -961,6 +970,7 @@ ActiveRecord::Schema.define(:version => 20151126160252) do
|
|||
t.integer "course_group_id", :default => 0
|
||||
end
|
||||
|
||||
add_index "members", ["course_id"], :name => "index_members_on_course_id"
|
||||
add_index "members", ["project_id"], :name => "index_members_on_project_id"
|
||||
add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true
|
||||
add_index "members", ["user_id"], :name => "index_members_on_user_id"
|
||||
|
@ -1294,27 +1304,29 @@ ActiveRecord::Schema.define(:version => 20151126160252) do
|
|||
end
|
||||
|
||||
create_table "projects", :force => true do |t|
|
||||
t.string "name", :default => "", :null => false
|
||||
t.string "name", :default => "", :null => false
|
||||
t.text "description"
|
||||
t.string "homepage", :default => ""
|
||||
t.boolean "is_public", :default => true, :null => false
|
||||
t.string "homepage", :default => ""
|
||||
t.boolean "is_public", :default => true, :null => false
|
||||
t.integer "parent_id"
|
||||
t.datetime "created_on"
|
||||
t.datetime "updated_on"
|
||||
t.string "identifier"
|
||||
t.integer "status", :default => 1, :null => false
|
||||
t.integer "status", :default => 1, :null => false
|
||||
t.integer "lft"
|
||||
t.integer "rgt"
|
||||
t.boolean "inherit_members", :default => false, :null => false
|
||||
t.boolean "inherit_members", :default => false, :null => false
|
||||
t.integer "project_type"
|
||||
t.boolean "hidden_repo", :default => false, :null => false
|
||||
t.integer "attachmenttype", :default => 1
|
||||
t.boolean "hidden_repo", :default => false, :null => false
|
||||
t.integer "attachmenttype", :default => 1
|
||||
t.integer "user_id"
|
||||
t.integer "dts_test", :default => 0
|
||||
t.integer "dts_test", :default => 0
|
||||
t.string "enterprise_name"
|
||||
t.integer "organization_id"
|
||||
t.integer "project_new_type"
|
||||
t.integer "gpid"
|
||||
t.integer "forked_from_project_id"
|
||||
t.integer "forked_count"
|
||||
end
|
||||
|
||||
add_index "projects", ["lft"], :name => "index_projects_on_lft"
|
||||
|
@ -1506,6 +1518,8 @@ ActiveRecord::Schema.define(:version => 20151126160252) do
|
|||
t.boolean "is_test", :default => false
|
||||
end
|
||||
|
||||
add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id"
|
||||
|
||||
create_table "student_works_evaluation_distributions", :force => true do |t|
|
||||
t.integer "student_work_id"
|
||||
t.integer "user_id"
|
||||
|
|
|
@ -241,8 +241,9 @@ class Gitlab::Client
|
|||
|
||||
# Forks a project into the user namespace of the authenticated user.
|
||||
# @param [Integer] - The ID of the project to be forked
|
||||
def fork(id)
|
||||
post("/projects/fork/#{id}")
|
||||
def fork(gpid, gid)
|
||||
post ("/projects/fork/#{gpid}?user_id=#{gid}")
|
||||
# post("/projects/fork/#{id}")
|
||||
end
|
||||
|
||||
# Mark this project as forked from the other
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
require 'elasticsearch/rails/tasks/import'
|
|
@ -0,0 +1,31 @@
|
|||
namespace :importer do
|
||||
task :importuser do
|
||||
ENV['CLASS']='User'
|
||||
ENV['SCOPE']='indexable'
|
||||
ENV['FORCE']='y'
|
||||
ENV['BATCH']='1000'
|
||||
Rake::Task["elasticsearch:import:model"].invoke
|
||||
end
|
||||
task :importproject do
|
||||
|
||||
ENV['CLASS']='Project'
|
||||
ENV['SCOPE']='indexable'
|
||||
ENV['FORCE']='y'
|
||||
ENV['BATCH']='1000'
|
||||
Rake::Task["elasticsearch:import:model"].invoke
|
||||
end
|
||||
task :importcourse do
|
||||
ENV['CLASS']='Course'
|
||||
ENV['SCOPE']='indexable'
|
||||
ENV['FORCE']='y'
|
||||
ENV['BATCH']='1000'
|
||||
Rake::Task["elasticsearch:import:model"].invoke
|
||||
end
|
||||
task :importattachment do
|
||||
ENV['CLASS']='Attachment'
|
||||
ENV['SCOPE']='indexable'
|
||||
ENV['FORCE']='y'
|
||||
ENV['BATCH']='1000'
|
||||
Rake::Task["elasticsearch:import:model"].invoke
|
||||
end
|
||||
end
|
|
@ -0,0 +1,21 @@
|
|||
#coding=utf-8
|
||||
#需要在0点以后执行
|
||||
namespace :exercise_deadline_warn do
|
||||
desc "exercise deadline warn"
|
||||
task :deadline_warn => :environment do
|
||||
#exercise_status 1 未发布 2 已发布 3已截止
|
||||
exercises = Exercise.where("exercise_status = 2 and date_format(end_time,'%Y-%m-%d')= '#{Date.today}'") #截止日期都是当天 23.59分,所以年月日相等的一定是今晚会截止的测验
|
||||
exercises.each do |exercise|
|
||||
course = exercise.course
|
||||
course.members.each do |m|
|
||||
#CourseMessage status 1 未发布 status 2 已发布 status 3 已发布快截止了
|
||||
exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 3) unless m.user.allowed_to?(:as_teacher,m)
|
||||
end
|
||||
# if homework.course_acts.size == 0
|
||||
# homework.course_acts << CourseActivity.new(:user_id => homework.user_id,:course_id => homework.course_id)
|
||||
# end
|
||||
# 邮件通知
|
||||
#Mailer.run.homework_added(homework)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,22 @@
|
|||
#coding=utf-8
|
||||
|
||||
namespace :exercise_publish do
|
||||
desc "publish exercise and end exercise"
|
||||
task :publish => :environment do
|
||||
exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now)
|
||||
exercises.each do |exercise|
|
||||
exercise.update_column('exercise_status', 2)
|
||||
course = exercise.course
|
||||
course.members.each do |m|
|
||||
exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
task :end => :environment do
|
||||
exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now)
|
||||
exercises.each do |exercise|
|
||||
exercise.update_column('exercise_status', 3)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -60,7 +60,7 @@ namespace :homework_evaluation do
|
|||
work_ids = "(" + homework_common.student_works.map(&:id).join(",") + ")"
|
||||
homework_common.student_works.each do |student_work|
|
||||
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
|
||||
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manuals.absence_penalty : 0
|
||||
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
|
||||
student_work.save
|
||||
end
|
||||
homework_detail_manual.update_column('comment_status', 3)
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace :homework_publishtime do
|
|||
end
|
||||
|
||||
task :end => :environment do
|
||||
homework_commons = HomeworkCommon.where("end_time < '#{Date.today}'")
|
||||
homework_commons = HomeworkCommon.where("end_time = '#{Date.today}'")
|
||||
homework_commons.each do |homework|
|
||||
if homework.anonymous_comment == 1
|
||||
homework_detail_manual = homework.homework_detail_manual
|
||||
|
|
|
@ -6,24 +6,30 @@ namespace :gitlab do
|
|||
users = User.find_by_sql("select * from users where gid is null")
|
||||
s = Trustie::Gitlab::Sync.new
|
||||
g = Gitlab.client
|
||||
logger = Logger.new('./log/add_gid.log', 'daily') #按天生成
|
||||
users.each do |user|
|
||||
us = g.get("/users?search=#{user.mail}")
|
||||
puts user.mail
|
||||
if us.blank?
|
||||
puts "55555555555555555"
|
||||
s.sync_user(user)
|
||||
else
|
||||
# 解决查询的时候出现多值的情况,比如:123@163.com和g123@163.com
|
||||
puts "66666666666666666666"
|
||||
puts user.id
|
||||
if Array === us
|
||||
us.each do |u|
|
||||
if u.email == user.mail
|
||||
user.gid = u.id
|
||||
user.save
|
||||
begin
|
||||
us = g.get("/users?search=#{user.mail}")
|
||||
puts user.mail
|
||||
if us.blank?
|
||||
puts "55555555555555555"
|
||||
s.sync_user(user)
|
||||
else
|
||||
# 解决查询的时候出现多值的情况,比如:123@163.com和g123@163.com
|
||||
puts "66666666666666666666"
|
||||
puts user.id
|
||||
if Array === us
|
||||
us.each do |u|
|
||||
if u.email == user.mail
|
||||
user.gid = u.id
|
||||
user.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
rescue => e
|
||||
logger.error("userid=#{user.id},mail=#{user.mail},login=#{user.login},error=#{e}")
|
||||
puts e
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace :sync_rep do
|
|||
if project.repositories && project.repositories.count == 1 && project.repositories.first.type == "Repository::Git"
|
||||
rep = project.repositories.first
|
||||
count = Repository.find_by_sql("SELECT * FROM `repositories` where identifier = '#{rep.identifier}'").count
|
||||
puts count
|
||||
puts project.id
|
||||
unless count > 1
|
||||
rep.identifier
|
||||
s = Trustie::Gitlab::Sync.new
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -154,6 +154,73 @@ function addFile(inputEl, file, eagerUpload,btnId) {
|
|||
}
|
||||
addFile.nextAttachmentId = 1;
|
||||
|
||||
function addReviseFile(inputEl, file, eagerUpload,btnId) {
|
||||
|
||||
var attachments_frame = '#attachments_fields';
|
||||
if ($(attachments_frame).children().length < 30) {
|
||||
deleteallfiles = $(inputEl).data('deleteAllFiles');
|
||||
var attachmentId = addFile.nextAttachmentId++;
|
||||
|
||||
var fileSpan = $('<span>', {
|
||||
'id': 'attachments_' + attachmentId,
|
||||
'class': 'attachment'
|
||||
});
|
||||
|
||||
fileSpan.append(
|
||||
$('<input>', {
|
||||
'type': 'text',
|
||||
'class': 'upload_filename readonly',
|
||||
'name': 'attachments[' + attachmentId + '][filename]',
|
||||
'readonly': 'readonly'
|
||||
}).val(file.name),
|
||||
// $('<input>', {
|
||||
// 'type': 'text',
|
||||
// 'class': 'description',
|
||||
// 'name': 'attachments[' + attachmentId + '][description]',
|
||||
// 'maxlength': 254,
|
||||
// 'placeholder': $(inputEl).data('descriptionPlaceholder')
|
||||
// }).toggle(!eagerUpload),
|
||||
// $('<span >' + $(inputEl).data('fieldIsPublic') + ':</span>').attr({
|
||||
// 'class': 'ispublic-label'
|
||||
// }),
|
||||
// $('<input>', {
|
||||
// 'type': 'checkbox',
|
||||
// 'class': 'is_public_checkbox',
|
||||
// 'value': 1,
|
||||
// 'name': 'attachments[' + attachmentId + '][is_public_checkbox]',
|
||||
// checked: 'checked'
|
||||
// }).toggle(!eagerUpload),
|
||||
$('<a> </a>').attr({
|
||||
'href': "#",
|
||||
'class': 'remove-upload'
|
||||
}).click(function() {
|
||||
if (confirm($(inputEl).data('areYouSure'))) {
|
||||
removeReviseFile();
|
||||
if (!eagerUpload) {
|
||||
(function(e) {
|
||||
reload(e);
|
||||
})(fileSpan);
|
||||
}
|
||||
}
|
||||
|
||||
}).toggle(!eagerUpload),
|
||||
$('<div>', {
|
||||
'class': 'div_attachments',
|
||||
'name': 'div_' + 'attachments_' + attachmentId
|
||||
})
|
||||
).appendTo('#attachments_fields');
|
||||
|
||||
$("#uploadReviseBox").addClass('disable_link');
|
||||
$("#choose_revise_attach").attr("onclick","return false;");
|
||||
|
||||
if (eagerUpload) {
|
||||
ajaxUpload(file, attachmentId, fileSpan, inputEl,btnId);
|
||||
}
|
||||
return attachmentId;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function ajaxUpload(file, attachmentId, fileSpan, inputEl,btnId) {
|
||||
//上传开始调用函数
|
||||
function onLoadstart(e) {
|
||||
|
@ -293,6 +360,13 @@ function removeFile() {
|
|||
return false;
|
||||
}
|
||||
|
||||
function removeReviseFile() {
|
||||
$(this).parent('span').remove();
|
||||
$("#uploadReviseBox").removeClass('disable_link');
|
||||
$("#choose_revise_attach").attr("onclick","_file.click();");
|
||||
return false;
|
||||
}
|
||||
|
||||
//gcm delete all file
|
||||
//modify by yutao 2015-5-14 <20><>1<EFBFBD><31>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD>ϴ<EFBFBD><CFB4>ؼ<EFBFBD>ʱ<EFBFBD>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>bug <20>ʸ<EFBFBD>֮ start
|
||||
function removeAll(containerid) {
|
||||
|
@ -346,6 +420,30 @@ function uploadBlob(blob, uploadUrl, attachmentId, options) {
|
|||
});
|
||||
}
|
||||
|
||||
function addReviseInputFiles(inputEl,btnId) {
|
||||
// var clearedFileInput = $(inputEl).clone().val('');
|
||||
if (inputEl.files) {
|
||||
uploadAndAttachReviseFiles(inputEl.files, inputEl,btnId);
|
||||
// $(inputEl).remove();
|
||||
} else {
|
||||
// browser not supporting the file API, upload on form submission
|
||||
var attachmentId;
|
||||
var aFilename = inputEl.value.split(/\/|\\/);
|
||||
var count = $('#attachments_fields>span').length;
|
||||
attachmentId = addReviseFile(inputEl, {
|
||||
name: aFilename[aFilename.length - 1]
|
||||
}, false);
|
||||
if (attachmentId) {
|
||||
$(inputEl).attr({
|
||||
name: 'attachments[' + attachmentId + '][file]'
|
||||
}).hide();
|
||||
if (count <= 0) count = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//clearedFileInput.insertAfter('#attachments_fields');
|
||||
}
|
||||
|
||||
function addInputFiles(inputEl,btnId) {
|
||||
// var clearedFileInput = $(inputEl).clone().val('');
|
||||
if (inputEl.files) {
|
||||
|
@ -405,6 +503,26 @@ function addInputFiles_board(inputEl, id,btnId) {
|
|||
//clearedFileInput.insertAfter('#attachments_fields');
|
||||
}
|
||||
|
||||
function uploadAndAttachReviseFiles(files, inputEl,btnId) {
|
||||
|
||||
var maxFileSize = $(inputEl).data('max-file-size');
|
||||
var maxFileSizeExceeded = $(inputEl).data('max-file-size-message');
|
||||
|
||||
var sizeExceeded = false;
|
||||
$.each(files, function() {
|
||||
if (this.size && maxFileSize != null && this.size > parseInt(maxFileSize)) {
|
||||
sizeExceeded = true;
|
||||
}
|
||||
});
|
||||
if (sizeExceeded) {
|
||||
window.alert(maxFileSizeExceeded);
|
||||
} else {
|
||||
$.each(files, function() {
|
||||
addReviseFile(inputEl, this, true,btnId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function uploadAndAttachFiles(files, inputEl,btnId) {
|
||||
|
||||
var maxFileSize = $(inputEl).data('max-file-size');
|
||||
|
|
|
@ -34,7 +34,7 @@ function submit_article()
|
|||
function regexTopicDescription()
|
||||
{
|
||||
var name = message_content_editor.html();
|
||||
if(name.length ==0)
|
||||
if(message_content_editor.isEmpty())
|
||||
{
|
||||
$("#message_content_span").text("描述不能为空");
|
||||
$("#message_content_span").css('color','#ff0000');
|
||||
|
@ -55,7 +55,7 @@ function regexTopicDescription()
|
|||
|
||||
function MessageReplayVevify() {
|
||||
var content = message_content_editor.html();//$.trim($("#message_content").val());
|
||||
if (content.length == 0) {
|
||||
if (message_content_editor.isEmpty()) {
|
||||
$("#message_content_span").text("回复不能为空");
|
||||
$("#message_content_span").css('color', '#ff0000');
|
||||
return false;
|
||||
|
|
|
@ -19,7 +19,7 @@ $(function(){
|
|||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
var test_program = function(cb){
|
||||
var homework_id = $('#test-program-btn').attr('data-homework-id');
|
||||
|
@ -171,7 +171,7 @@ $(function(){
|
|||
$("input[name=homework_type]").after(html);
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
};
|
||||
|
||||
$("#BluePopupBox a.BlueCirBtn").live('click', function(){
|
||||
if(saveProgramAnswers()){
|
||||
|
|
|
@ -1176,3 +1176,41 @@ a:hover.testEdit{ background:url(images/icons.png) -21px -272px no-repeat;}
|
|||
.rankPortrait {border-radius:50%; width:35px; height:35px;}
|
||||
.numIntro {position:absolute; text-align:left; z-index:999; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); border:1px solid #eaeaea; background-color:#ffffff; padding:3px 5px; left:15px; color:#585858; white-space: nowrap;}
|
||||
.font_cus {font-family: "微软雅黑","宋体"; font-size: 12px; line-height: 1.5;}
|
||||
/*20151130课程项目集成Tim*/
|
||||
a.testBtn{background: url(/images/course/hwork_icon.png) -2px -5px 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.testBtn{background: url(/images/course/hwork_icon.png) -81px -5px 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;}
|
||||
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;}
|
||||
.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;}
|
||||
.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;}
|
||||
|
||||
.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;}
|
||||
|
||||
/*上传资源弹窗*/
|
||||
.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;}
|
||||
.uploadDialogText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; width:140px; display:inline-block; font-weight: bold;}
|
||||
.uploadBoxContainer {height:33px; line-height:33px; margin-top:10px; position:relative}
|
||||
.uploadBox {width:100px; height:33px; line-height:33px; text-align:center; vertical-align:middle; background-color:#269ac9; border-radius:3px; float:left; margin-right:12px;}
|
||||
a.uploadBoxIcon {background:url(images/resource_icon_list.png) -35px 10px no-repeat; float:left; display:block; width:81px; height:30px; padding-left:22px; font-size:14px; color:#ffffff;}
|
||||
a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat; width:100px; height:33px;}
|
||||
.chooseFile {color:#ffffff; display:block; margin-left:32px;}
|
||||
.uploadResourceIntr {width:250px; height:33px; float:left; line-height:33px; font-size:12px;}
|
||||
.uploadResourceName {width:250px; display:inline-block; line-height:15px; font-size:12px; color:#444444; margin-bottom:2px;}
|
||||
.uploadResourceIntr2 {width:250px; display:inline-block; line-height:15px; font-size:12px; color:#444444;}
|
||||
.uploadType {margin:10px 0; border:1px solid #e6e6e6; width:100px; height:30px; outline:none; font-size:12px; color:#888888;}
|
||||
.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;}
|
|
@ -1329,3 +1329,39 @@ a:hover.link_file_a{ background:url(../images/pic_file.png) 0 -25px no-repeat; c
|
|||
span.author { font-size: 0.9em; color: #888; }
|
||||
.ReplyToMessageInputContainer {width: 582px;float: left;}
|
||||
|
||||
/*全站搜索*/
|
||||
.blocks {padding:15px; background-color:#ffffff; border:1px solid #dddddd;}
|
||||
#searchBanner {border-bottom:1px solid #d0d0d0;}
|
||||
#searchBanner li {float:left; width:88px; margin-right:3px; text-align:center; padding-bottom:10px; font-weight:bold;}
|
||||
#searchTips {padding:10px 5px; background-color:#f5f6f7;}
|
||||
.searchBannerActive {border-bottom:3px solid #3498db !important;}
|
||||
.searchBannerNormal {border-bottom:none !important;}
|
||||
.searchContent {min-height:74px; border-bottom:1px solid #ededed; padding:13px 0px;}
|
||||
.searchCourseware {min-height:44px; border-bottom:1px solid #ededed; padding:13px 0px; width:968px;}
|
||||
.searchCourseImage {width:75px; margin-right:10px;}
|
||||
.searchContentDes {width:883px;}
|
||||
.searchTag {font-size:12px; color:#ffffff; background-color:#7ec8e4; height:16px; min-height:16px; max-height:16px; float:left; line-height:16px; padding:0px 3px;}
|
||||
.undis {display:none;}
|
||||
.dis {display:inline-block;}
|
||||
.numRed {color:#FF6600;}
|
||||
.pageRoll {float:right; border-left:1px solid #dddddd; margin-top:15px;}
|
||||
.pageCell {border:1px solid #dddddd; padding:5px 12px; float:left; margin-left:-1px; position:relative;}
|
||||
.pageCell:hover {border:1px solid #3498db; z-index:10;}
|
||||
.pageCellActive {background-color:#3498db; border:1px solid #3498db !important; position:relative; color:#ffffff;}
|
||||
|
||||
/*20151130课程项目集成Tim*/
|
||||
a.testBtn{background: url(/images/course/hwork_icon.png) -2px -5px 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.testBtn{background: url(/images/course/hwork_icon.png) -81px -5px 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;}
|
||||
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;}
|
||||
.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;}
|
||||
.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;}
|
||||
|
|
|
@ -410,7 +410,7 @@ a:hover.search_btn{ background: #0fa9bb;}
|
|||
.resourcesSendTo {float:left; height:20px; margin-top:15px;}
|
||||
.resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;}
|
||||
.resourcePopupClose {width:20px; height:20px; display:inline-block; float:right;}
|
||||
.resourceClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block;}
|
||||
.resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000;}
|
||||
.resourcesSearchBox {border:1px solid #e6e6e6; width:225px; height:25px; background-color:#ffffff; margin-top:12px; margin-bottom:15px;}
|
||||
.searchResourcePopup {border:none; outline:none; background-color:#ffffff; width:184px; height:25px; padding-left:10px; display:inline-block; float:left;}
|
||||
.courseSend {width:260px; height:15px; line-height:15px; margin-bottom:10px;}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue