From 0621ceb8611997a68c63e96973aecb1d72a3a2fa Mon Sep 17 00:00:00 2001
From: XuCheng642 <287102909@qq.com>
Date: Thu, 27 Jul 2017 09:45:31 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86=E5=91=98?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/managements_controller.rb | 308 ++++-
app/helpers/application_helper.rb | 66 +
app/helpers/syllabuses_helper.rb | 66 -
app/models/course.rb | 1104 ++++++++---------
app/views/layouts/base_management.html.erb | 60 +-
.../_class_publish_shixuns_list.html.erb | 23 +
.../managements/_class_shixuns_list.html.erb | 33 +
.../_classroom_classment_list.html.erb | 49 +
.../managements/_classroom_list.html.erb | 41 +
app/views/managements/_depart_list.html.erb | 44 +
.../managements/_departments_list.html.erb | 42 +
.../_departments_part_list.html.erb | 60 +
.../_subject_authorization_list.html.erb | 48 +
...subject_authorization_passed_list.html.erb | 40 +
app/views/managements/_unit_list.html.erb | 103 ++
.../class_publish_shixuns.html.erb | 60 +-
.../managements/class_publish_shixuns.js.erb | 1 +
app/views/managements/class_shixuns.html.erb | 78 +-
app/views/managements/class_shixuns.js.erb | 1 +
app/views/managements/classroom.html.erb | 96 +-
app/views/managements/classroom.js.erb | 1 +
app/views/managements/classroom_classment.erb | 74 --
.../managements/classroom_classment.html.erb | 37 +
.../managements/classroom_classment.js.erb | 1 +
.../deal_subject_authorization.js.erb | 1 +
app/views/managements/delete_subject.js.erb | 1 +
app/views/managements/depart.html.erb | 106 +-
app/views/managements/depart.js.erb | 1 +
app/views/managements/departments.html.erb | 43 +-
app/views/managements/departments.js.erb | 1 +
.../managements/departments_part.html.erb | 69 +-
app/views/managements/departments_part.js.erb | 1 +
.../identity_authentication.html.erb | 72 +-
.../subject_authorization.html.erb | 77 +-
.../managements/subject_authorization.js.erb | 4 +-
app/views/managements/unit.html.erb | 140 +--
app/views/managements/unit.js.erb | 1 +
app/views/managements/users.html.erb | 62 +-
config/routes.rb | 11 +
public/javascripts/edu/base_edu.js | 3 +
public/stylesheets/css/edu-public.css | 6 +-
41 files changed, 1716 insertions(+), 1319 deletions(-)
create mode 100644 app/views/managements/_class_publish_shixuns_list.html.erb
create mode 100644 app/views/managements/_class_shixuns_list.html.erb
create mode 100644 app/views/managements/_classroom_classment_list.html.erb
create mode 100644 app/views/managements/_classroom_list.html.erb
create mode 100644 app/views/managements/_depart_list.html.erb
create mode 100644 app/views/managements/_departments_list.html.erb
create mode 100644 app/views/managements/_departments_part_list.html.erb
create mode 100644 app/views/managements/_subject_authorization_list.html.erb
create mode 100644 app/views/managements/_subject_authorization_passed_list.html.erb
create mode 100644 app/views/managements/_unit_list.html.erb
create mode 100644 app/views/managements/class_publish_shixuns.js.erb
create mode 100644 app/views/managements/class_shixuns.js.erb
create mode 100644 app/views/managements/classroom.js.erb
delete mode 100644 app/views/managements/classroom_classment.erb
create mode 100644 app/views/managements/classroom_classment.html.erb
create mode 100644 app/views/managements/classroom_classment.js.erb
create mode 100644 app/views/managements/deal_subject_authorization.js.erb
create mode 100644 app/views/managements/delete_subject.js.erb
create mode 100644 app/views/managements/depart.js.erb
create mode 100644 app/views/managements/departments.js.erb
create mode 100644 app/views/managements/departments_part.js.erb
create mode 100644 app/views/managements/unit.js.erb
diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb
index 06f6b3278..0015c0a8d 100644
--- a/app/controllers/managements_controller.rb
+++ b/app/controllers/managements_controller.rb
@@ -8,109 +8,316 @@ class ManagementsController < ApplicationController
include ApplicationHelper
# 单位部门列表
def departments
- @department =Department.all
+ @menu_type = 6
+ @sub_type = 2
+ @department =Department.where("0=0")
+ search=params[:search]
+ if search.blank?
+ @department = @department
+ else
+ @department = @department.where("name like '%#{search}%'")
+ end
+ @department_count =@department.count
+ limit = 20
+ @is_remote = true
+ @department_pages = Paginator.new @department_count, limit, params['page'] || 1
+ @offset ||=@department_pages.offset
+ @department = paginateHelper @department, limit
+ respond_to do |format|
+ format.js
+ format.html
+ end
end
# 单位列表
def departments_part
- @schools = School.all
- @schools_count = @schools.count
+ @menu_type = 6
+ @sub_type = 1
+ @schools = School.where("0=0")
+ search=params[:search]
+ if search.blank?
+ @schools = @schools
+ else
+ @schools = @schools.where("name like '%#{search}%'")
+ end
+ @schools_count = @schools.count
limit = 20
@is_remote = true
@schools_pages = Paginator.new @schools_count, limit, params['page'] || 1
@offset ||= @schools_pages.offset
- @schools = paginateHelper @schools, limit
+ @schools= paginateHelper @schools, limit
+
+ respond_to do |format|
+ format.js
+ format.html
+ end
end
# 部门审核
def depart
- @apply_status = ApplyAddSchools.all
+ @menu_type = 10
+ @sub_type = 3
+ search = params[:search]
+ @apply_status = ApplyAddDepartment.where("0=0")
+ if search.blank?
+ @apply_status = @apply_status.where("0=0")
+ else
+ @apply_status= @apply_status.where("name like '%#{search}%'")
+ end
@apply_status_count = @apply_status.count
limit = 20
@is_remote = true
@apply_status_pages = Paginator.new @apply_status_count, limit, params['page'] || 1
@offset ||=@apply_status_pages.offset
@apply_status = paginateHelper @apply_status, limit
+ respond_to do |format|
+ format.js
+ format.html
+ end
end
# 单位审批
def unit
- @apply_status= ApplyAddSchools.all
+ @menu_type = 10
+ @sub_type = 4
+ search = params[:search]
+ @apply_status = ApplyAddSchools.where("0=0")
+ if search.blank?
+ @apply_status = @apply_status.where("0=0")
+ else
+ @apply_status= @apply_status.where("name like '%#{search}%'")
+ end
@apply_status_count = @apply_status.count
limit = 20
@is_remote = true
@apply_status_pages = Paginator.new @apply_status_count, limit, params['page'] || 1
- @offset ||=@apply_status_pages.offset
+ @offset ||= @apply_status_pages.offset
@apply_status = paginateHelper @apply_status, limit
+
+ respond_to do |format|
+ format.js
+ format.html
+ end
end
# 课堂列表
def classroom
- @syllabus = Syllabus.all
+ @menu_type = 2
+ @sub_type = 1
+ @syllabus = Syllabus.where("0=0")
+ unless params[:school_id] || params[:search] || params[:keyword] || params[:status]
+ user_exs=UserExtensions.where(:user_id=> @syllabus.map(&:user_id))
+ @schools = School.where(:id =>user_exs.map(&:school_id))
+ end
+ major_level_option=params[:major_level_option]
+ discipline_category_option=params[:discipline_category_option]
+ first_level_discipline_option=params[:first_level_discipline_option]
+ syllabus_major_option=params[:syllabus_major_option]
+ keyword=params[:keyword]
+ search=params[:search]
+ if major_level_option!='0'
+ @syllabus=@syllabus.where(:major_level=>major_level_option)
+ else
+ @syllabus=@syllabus
+ end
+ if discipline_category_option !=nil
+ @syllabus=@syllabus.where(:discipline_category_id=>discipline_category_option)
+ end
+ if first_level_discipline_option!=nil
+ @syllabus=@syllabus.where(:first_level_discipline_id=>first_level_discipline_option)
+ end
+ if syllabus_major_option!=nil
+ @syllabus=@syllabus.where(:major_id=>syllabus_major_option)
+ end
+ if params[:school_id] && params[:school_id] != '0'
+ @syllabus = Syllabus.includes(:user => {:user_extensions => []}).where("user_extensions.school_id = #{params[:school_id]}")
+ else
+ @syllabus = @syllabus.where("0=0")
+ end
+ if "u_name" == keyword
+ if search.blank?
+ @syllabus = @syllabus
+ else
+ user_id = User.where("concat(lastname, firstname) like '%#{search}%'")
+ @syllabus = @syllabus.includes(:user).where("concat(users.lastname, users.firstname) like '%#{search}%'")
+ end
+ else
+ @syllabus= @syllabus.where("user_id like '%#{search}%'")
+ end
@syllabus_count = @syllabus.count
limit = 20
@is_remote = true
@syllabus_pages = Paginator.new @syllabus_count, limit, params['page'] || 1
@offset ||= @syllabus_pages.offset
@syllabus = paginateHelper @syllabus, limit
+ respond_to do |format|
+ format.html
+ format.js
+ end
end
# 班级列表
def classroom_classment
+ @menu_type = 2
+ @sub_type = 2
@courses = Course.where("0=0")
- @courses = @courses.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc")
- @course_count = @courses.count
+ # @courses = @courses.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc")
+ @timing=Course.where(:is_end=>false).count
+ @end=Course.where(:is_end=>true).count
+ unless params[:school_id] || params[:search] || params[:keyword] || params[:status]
+ user_exs=UserExtensions.where(:school_id=> @courses.map(&:school_id))
+ @schools = School.where(:id =>user_exs.map(&:school_id))
+ end
+ search = params[:search] # 搜索字
+ keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/课程名搜索
+ status = params[:status].to_i
+ if params[:school_id] && params[:school_id] != '0'
+ @courses =Course.joins("join users u on courses.tea_id = u.id").joins("join user_extensions ue on u.id = ue.user_id").where("ue.school_id = #{params[:school_id]}")
+ else
+ @courses = Course.where("0=0")
+ end
+ if params[:status] && params[:status]!=''
+ @courses =@courses.where(:is_end =>status)
+ end
+ if "u_name" == keyword
+ if search.blank?
+ @courses = @courses
+ else
+ user_id = User.where("concat(lastname, firstname) like '%#{search}%'")
+ @courses = @courses.joins("join users u on courses.tea_id = u.id").where("concat(u.lastname, u.firstname) like '%#{search}%'")
+ end
+ else
+ @courses= @courses.where("name like '%#{search}%'")
+ end
+ @courses = @courses.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").reorder("updatetime desc")
+ @courses_count = @courses.count
limit = 20
@is_remote = true
- @course_pages = Paginator.new @course_count, limit, params['page'] || 1
- @offset ||= @course_pages.offset
+ @courses_pages = Paginator.new @courses_count, limit, params['page'] || 1
+ @offset ||= @courses_pages.offset
@courses = paginateHelper @courses, limit
+ respond_to do |format|
+ format.js
+ format.html
+ end
end
# 课程实训
def class_shixuns
- @c_shixuns = Subject.all
+ @menu_type = 4
+ @sub_type = 1
+ @edit_class_sx_num=Subject.where(:status => 0).count
+ @audit_class_sx_num=Subject.where(:status => 1).count
+ @publish_class_sx_num=Subject.where(:status => 2).count
+ search = params[:search] # 搜索字
+ keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/课程名搜索
+ status = params[:status].to_i
+ if params[:school_id] && params[:school_id] != '0'
+ @c_shixuns = Subject.includes(:user => {:user_extensions => []}).where("user_extensions.school_id = #{params[:school_id]}")
+ else
+ @c_shixuns = Subject.where("0=0")
+ end
+ if params[:status] && params[:status]!=''
+ @c_shixuns= @c_shixuns.where(:status =>status)
+ end
+ if search.blank?
+ @c_shixuns = @c_shixuns
+ else
+ if "u_name" == keyword
+ user_id = User.where("concat(lastname, firstname) like '%#{search}%'")
+ @c_shixuns = @c_shixuns.includes(:user).where("concat(users.lastname, users.firstname) like '%#{search}%'")
+ else
+ @c_shixuns= @c_shixuns.where("name like '%#{search}%'")
+ end
+ end
+ unless params[:school_id] || params[:search] || params[:keyword] || params[:status]
+ user_exs = UserExtensions.where(:user_id => @c_shixuns.map(&:user_id))
+ @schools = School.where(:id => user_exs.map(&:school_id))
+ end
+ respond_to do |format|
+ format.js
+ format.html
+ end
end
+
# 已发布课程实训
def class_publish_shixuns
- @c_shixuns = Subject.where(:status => 1)
+ @menu_type = 4
+ @sub_type = 2
+ search = params[:search] # 搜索字
+ keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/课程名搜索
+ if params[:school_id] && params[:school_id] != '0'
+ @c_shixuns = Subject.includes(:user => {:user_extensions => []}).where("subjects.status = 2 and user_extensions.school_id = #{params[:school_id]}")
+ else
+ @c_shixuns = Subject.where(:status => 2)
+ end
+ if search.blank?
+ @c_shixuns = @c_shixuns
+ else
+ if "u_name" == keyword
+ # 如果用户搜索为空,不用遍历user表,直接查找所有实训, 有搜索时才查找user
+ user_id = User.where("concat(lastname, firstname) like '%#{search}%'")
+ @c_shixuns = @c_shixuns.includes(:user).where("concat(users.lastname, users.firstname) like '%#{search}%'")
+ else
+ @c_shixuns= @c_shixuns.where("name like '%#{search}%'")
+ end
+ end
+ unless params[:school_id] || params[:search] || params[:keyword]
+ user_exs = UserExtensions.where(:user_id => @c_shixuns.map(&:user_id))
+ @schools = School.where(:id => user_exs.map(&:school_id))
+ end
+ respond_to do |format|
+ format.js
+ format.html
+ end
+ end
+
+ def delete_subject
+ @subject = Subject.find params[:subject_id]
+ if @subject
+ @subject.destroy
+ respond_to do |format|
+ format.js
+ end
+ end
end
# 0 全部;1 活动的; 2 已注册; 3 锁定
def users
- status = params[:user_status].nil? ? 0 : params[:user_status].to_i
- @us_order = params[:us_order].blank? ? "desc" : params[:us_order] # 排序
- @order_key = params[:order_key].blank? ? "created_on" : params[:order_key] # 排序关键字
+ @menu_type =7
+ @sub_type = 1
+ status = params[:user_status].nil? ? 0 : params[:user_status].to_i
+ @us_order = params[:us_order].blank? ? "desc" : params[:us_order] # 排序
+ @order_key = params[:order_key].blank? ? "created_on" : params[:order_key] # 排序关键字
condition = (params[:research_condition].nil? || params[:research_condition] == "name") ? "concat(lastname, firstname)" : params[:research_condition]
if 0 == status
if params[:research_condition] == "phone" && params[:research_contents].blank?
- @users = User.order("#{@order_key} #{@us_order}").all
+ @users = User.order("#{@order_key} #{@us_order}").all
else
- @users = User.where("#{condition} like '%#{params[:research_contents]}%'").order("#{@order_key} #{@us_order}").all
+ @users = User.where("#{condition} like '%#{params[:research_contents]}%'").order("#{@order_key} #{@us_order}").all
end
else
if params[:research_condition] == "phone" && params[:research_contents].blank?
- @users = User.where(:status => status).order("#{@order_key} #{@us_order}").all
+ @users = User.where(:status => status).order("#{@order_key} #{@us_order}").all
else
- @users = User.where("status = #{status} and #{condition} like '%#{params[:research_contents]}%'").order("#{@order_key} #{@us_order}").all
+ @users = User.where("status = #{status} and #{condition} like '%#{params[:research_contents]}%'").order("#{@order_key} #{@us_order}").all
end
end
-
@users_count = @users.count
@limit = 20
@is_remote = true
@users_pages = Paginator.new @users_count, @limit, params['page'] || 1
@offset ||= @users_pages.offset
@users = paginateHelper @users, @limit
-
respond_to do |format|
- format.js
+ format.js
format.html
end
end
def shixuns
@menu_type = 3
+ @sub_type = 1
sx_status = params[:status].blank? ? [0, 1, 2, 3] : params[:status].to_i # 搜索实训的状态
keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/实训名搜索
search = params[:search] # 搜索的字
@@ -130,7 +337,6 @@ class ManagementsController < ApplicationController
@audit_sx_num = Shixun.where(:status => 1).count
@publish_sx_num =Shixun.where(:status => 2).count
@close_sx_num = Shixun.where(:status => 3).count
-
@shixuns_count = @shixuns.count
limit = 20
@shixuns_pages = Paginator.new @shixuns_count, limit, params['page'] || 1
@@ -145,6 +351,7 @@ class ManagementsController < ApplicationController
# 已发布的实训
def publish_shixuns
@menu_type = 3
+ @sub_type = 2
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order] # 排序
search = params[:search] # 搜索字
keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/实训名搜索
@@ -168,7 +375,6 @@ class ManagementsController < ApplicationController
@shixuns_pages = Paginator.new @shixuns_count, limit, params['page'] || 1
@offset ||= @shixuns_pages.offset
@shixuns = paginateHelper @shixuns, limit
-
respond_to do |format|
format.js
format.html
@@ -178,11 +384,11 @@ class ManagementsController < ApplicationController
# 已关闭的实训
def close_shixuns
@menu_type = 3
+ @sub_type = 3
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order] # 排序
search = params[:search] # 搜索字
keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/实训名搜索
reopen = params[:reopen] # 从新开启实训,参数是实训的Id
-
unless reopen.blank?
Shixun.find(reopen).update_attribute(:status, 2)
end
@@ -202,7 +408,6 @@ class ManagementsController < ApplicationController
@shixuns_pages = Paginator.new @shixuns_count, limit, params['page'] || 1
@offset ||= @shixuns_pages.offset
@shixuns = paginateHelper @shixuns, limit
-
respond_to do |format|
format.js
format.html
@@ -210,7 +415,8 @@ class ManagementsController < ApplicationController
end
def users_trial
- @menu_type = 6
+ @menu_type = 7
+ @sub_type = 2
@users = User.where(:status => 1).order("created_on desc").all
@users_count = @users.count
@limit = 20
@@ -218,7 +424,6 @@ class ManagementsController < ApplicationController
@users_pages = Paginator.new @users_count, @limit, params['page'] || 1
@offset ||= @users_pages.offset
@users = paginateHelper @users, @limit
-
end
def search_user
@@ -322,7 +527,8 @@ class ManagementsController < ApplicationController
def trial_authorization
- @menu_type = 9
+ @menu_type =10
+ @sub_type = 2
search = params[:search]
@status = trial_authorization_status(params[:status])
# @status = (params[:status].blank? || params[:status] == "0") ? 0 : [1,2]
@@ -380,7 +586,8 @@ class ManagementsController < ApplicationController
# copy from admin
def identity_authentication
- @menu_type = 9
+ @menu_type = 10
+ @sub_type = 1
@type = trial_authorization_status(params[:type])
type = params[:type] || 0 # 存在type 就用type 没有就为 0
user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{params[:name]}%'")
@@ -413,10 +620,18 @@ class ManagementsController < ApplicationController
end
def subject_authorization
+ @menu_type = 10
+ @sub_type == 6
@type = trial_authorization_status params[:type]
- @subject = ApplyAction.where(:container_type => "ApplySubject", :status => @type).order("created_at desc")
+ @authorizations = ApplyAction.where(:container_type => "ApplySubject", :status => @type).order("created_at desc")
# @subject=Subject.all
+ @authorizations_count = @authorizations.count
+ @limit = 15
+ @is_remote = true
+ @authorizations_pages = Paginator.new @authorizations_count, @limit, params['page'] || 1
+ @offset ||= @authorizations_pages.offset
+ @authorizations = paginateHelper @authorizations, @limit
respond_to do |format|
format.js
format.html
@@ -424,6 +639,8 @@ class ManagementsController < ApplicationController
end
def shixun_authorization
+ @menu_type = 10
+ @sub_type == 5
@type = trial_authorization_status params[:type]
@authorizations = ApplyAction.where(:container_type => "ApplyShixun", :status => @type).order("created_at desc")
search = params[:search]
@@ -446,27 +663,26 @@ class ManagementsController < ApplicationController
def deal_subject_authorization
apply_action = ApplyAction.find(params[:apply_id])
type = params[:type].to_i
- subject = subject.find apply_action.container_id
+ subject = Subject.find apply_action.container_id
if type == 0 #拒绝
subject.update_column('status', 0)
apply_action.update_attributes(:status => 2, :reason => params[:reject_reason], :dealer_id => User.current.id)
- notes = "您所在团队提交的项目实训发布申请:#{subject.name} ,审核未通过。 原因:#{params[:reject_reason]}"
+ notes = "您所在团队提交的课程实训发布申请:#{subject.name} ,审核未通过。 原因:#{params[:reject_reason]}"
JournalsForMessage.create(:jour_id => subject.user_id, :jour_type => 'Principal', :user_id => User.current.id, :notes => notes, :private => 1, :reply_id => 0)
else #同意
subject.update_column('status', 2)
apply_action.update_attributes(:status => 1, :dealer_id => User.current.id)
- subject_modify_status_without_publish subject, 1
end
- # @authorizations = ApplyAction.where(:container_type => "ApplyShixun", :status => 0)
- # @authorizations_count = @authorizations.count
- # @limit = 15
- # @is_remote = true
- # @authorizations_pages = Paginator.new @authorizations_count, @limit, params['page'] || 1
- # @offset ||= @authorizations_pages.offset
- # @authorizations = paginateHelper @authorizations, @limit
- # respond_to do |format|
- # format.js
- # end
+ @authorizations = ApplyAction.where(:container_type => "ApplySubject", :status => 0)
+ @authorizations_count = @authorizations.count
+ @limit = 15
+ @is_remote = true
+ @authorizations_pages = Paginator.new @authorizations_count, @limit, params['page'] || 1
+ @offset ||= @authorizations_pages.offset
+ @authorizations = paginateHelper @authorizations, @limit
+ respond_to do |format|
+ format.js
+ end
end
# 项目实训发布审批
def deal_shixun_authorization
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 728a8324a..3d4969b0c 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -5179,3 +5179,69 @@ def quote_homework_bank homework, course
end
end
+def major_level_option
+ content = []
+ option0 = []
+ option0 << "选择课程所属专业层级"
+ option0 << 0
+ option1 = []
+ option1 << "专科"
+ option1 << 3
+ option2 = []
+ option2 << "本科"
+ option2 << 2
+ option3 = []
+ option3 << "研究生"
+ option3 << 1
+ content << option0
+ content << option1
+ content << option2
+ content << option3
+ content
+end
+
+def discipline_category_option major_level = 3
+ content = []
+ option0 = []
+ option0 << "选择课程所属学科门类"
+ option0 << 0
+ content << option0
+ DisciplineCategory.where(:major_level => major_level).each do |dis|
+ option = []
+ option << dis.name.to_s
+ option << dis.id
+ content << option
+ end
+ content
+end
+
+def first_level_discipline_option disc_ca = 27
+ content = []
+ option0 = []
+ option0 << "选择课程所属一级学科"
+ option0 << 0
+ content << option0
+ FirstLevelDiscipline.where(:discipline_category_id => disc_ca).each do |fir_dis|
+ option = []
+ option << fir_dis.name.to_s
+ option << fir_dis.id
+ content << option
+ end
+ content
+end
+
+def syllabus_major_option fir_dis = 213
+ content = []
+ option0 = []
+ option0 << "选择课程所属专业"
+ option0 << 0
+ content << option0
+ Major.where(:first_level_discipline_id => fir_dis).each do |major|
+ option = []
+ option << major.name.to_s
+ option << major.id
+ content << option
+ end
+ content
+end
+
diff --git a/app/helpers/syllabuses_helper.rb b/app/helpers/syllabuses_helper.rb
index bfb5b199b..91b951d46 100644
--- a/app/helpers/syllabuses_helper.rb
+++ b/app/helpers/syllabuses_helper.rb
@@ -51,72 +51,6 @@ module SyllabusesHelper
count
end
- def major_level_option
- content = []
- option0 = []
- option0 << "选择课程所属专业层级"
- option0 << 0
- option1 = []
- option1 << "专科"
- option1 << 3
- option2 = []
- option2 << "本科"
- option2 << 2
- option3 = []
- option3 << "研究生"
- option3 << 1
- content << option0
- content << option1
- content << option2
- content << option3
- content
- end
-
- def discipline_category_option major_level = 3
- content = []
- option0 = []
- option0 << "选择课程所属学科门类"
- option0 << 0
- content << option0
- DisciplineCategory.where(:major_level => major_level).each do |dis|
- option = []
- option << dis.name.to_s
- option << dis.id
- content << option
- end
- content
- end
-
- def first_level_discipline_option disc_ca = 27
- content = []
- option0 = []
- option0 << "选择课程所属一级学科"
- option0 << 0
- content << option0
- FirstLevelDiscipline.where(:discipline_category_id => disc_ca).each do |fir_dis|
- option = []
- option << fir_dis.name.to_s
- option << fir_dis.id
- content << option
- end
- content
- end
-
- def syllabus_major_option fir_dis = 213
- content = []
- option0 = []
- option0 << "选择课程所属专业"
- option0 << 0
- content << option0
- Major.where(:first_level_discipline_id => fir_dis).each do |major|
- option = []
- option << major.name.to_s
- option << major.id
- content << option
- end
- content
- end
-
def syllabus_type_option
content = []
option0 = []
diff --git a/app/models/course.rb b/app/models/course.rb
index 77bc0e757..ccb4579a3 100644
--- a/app/models/course.rb
+++ b/app/models/course.rb
@@ -1,552 +1,552 @@
-#coding=utf-8
-
-require 'elasticsearch/model'
-class Course < ActiveRecord::Base
- include Redmine::SafeAttributes
-
- include CoursesHelper
-
- STATUS_ACTIVE = 1
- 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, index:"not_analyzed",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, :is_delete, :syllabus_id, :end_time, :end_term, :choose_group_allow, :is_end
- #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表
- belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school,该方法通过school_id来调用School表
- belongs_to :syllabus
- # has_many :bid
- has_many :members, :include => [:principal, :roles], :conditions => "#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE}"
- has_many :memberships, :class_name => 'Member'
- has_many :member_principals, :class_name => 'Member',
- :include => :principal,
- :conditions => "#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE})"
- has_many :principals, :through => :member_principals, :source => :principal
- has_many :users, :through => :members
- has_many :org_courses, :dependent => :destroy
- has_many :organizations, :through => :org_courses
- # has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy
- has_many :journals_for_messages, :as => :jour, :dependent => :destroy
- # has_many :homework_for_courses, :dependent => :destroy
- has_many :student, :class_name => 'StudentsForCourse', :source => :user
- has_many :course_infos, :class_name => 'CourseInfos',:dependent => :destroy
- has_many :enabled_modules, :dependent => :delete_all
- has_many :boards, :dependent => :destroy, :order => "position ASC"
- #has_many :course_journals_for_messages, :class_name => 'CourseJournalsForMessage', :as => :jour, :dependent => :destroy
- has_many :news, :dependent => :destroy, :include => :author
- has_one :course_status, :class_name => "CourseStatus", :dependent => :destroy
- has_many :student_work_projects, :dependent => :destroy
-
- has_many :homework_commons, :dependent => :destroy
- has_many :student_works, :through => :homework_commons, :dependent => :destroy
-
- has_many :course_groups, :dependent => :destroy, :order => "name ASC"
- has_many :course_homework_statisticss, :dependent => :destroy
- # 课程动态
- has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
-
- has_many :course_activities
- # 课程消息
- has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
- has_many :exercises, :dependent => :destroy
- # 课程贡献榜
- has_many :course_contributor_scores, :dependent => :destroy
-
- #课程模块
- has_many :course_modules, :dependent => :destroy
- acts_as_taggable
- acts_as_nested_set :order => 'name', :dependent => :destroy
- acts_as_attachable :view_permission => :view_course_files,
- :delete_permission => :manage_files
-
- validates_presence_of :name
- #validates_format_of :class_period, :with =>/^[1-9]\d*$/
- #validates_format_of :time, :with => /^\d{4}$/
- validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]*$/
- validates_length_of :description, :maximum => 10000
-
- before_save :self_validate
- # 公开课程变成私有课程,所有资源都变成私有
- 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
- after_save :log_infor
-
- safe_attributes 'extra',
- 'time',
- 'name',
- 'extra',
- 'code',
- 'location',
- 'tea_id',
- 'password',
- 'term',
- 'is_public',
- 'description',
- 'class_period',
- 'open_student',
- 'is_delete',
- 'syllabus_id',
- 'end_time',
- 'end_term',
- 'os_allow',
- 'choose_group_allow',
- 'credit'
-
- acts_as_customizable
-
- scope :not_deleted, lambda{where(is_delete: 0)}
- scope :not_deleted_not_end, lambda{where(is_delete: 0, is_end: 0)}
- scope :not_deleted_but_is_end, lambda{where(is_end: 1, is_delete: 0)}
- scope :all_course
- scope :active, lambda { where(:status => STATUS_ACTIVE) }
- scope :status, lambda {|arg| where(arg.blank? ? nil : {:status => arg.to_i}) }
- scope :all_public, lambda { where(:is_public => true) }
- scope :visible, lambda {|*args| where(Course.where("is_delete =?", 0).visible_condition(args.shift || User.current, *args)) }
- scope :allowed_to, lambda {|*args|
- user = User.current
- permission = nil
- if args.first.is_a?(Symbol)
- permission = args.shift
- else
- user = args.shift
- permission = args.shift
- end
- where(Course.allowed_to_condition(user, permission, *args))
- }
- scope :like, lambda {|arg|
- if arg.blank?
- where(nil)
- else
- pattern = "%#{arg.to_s.strip.downcase}%"
- where(" LOWER(name) LIKE :p ", :p => pattern)
- end
- }
- scope :indexable,lambda { where('is_public = 1 and is_delete = 0') }
- 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: [''],
- post_tags: [' '],
- fields: {
- name: {},
- description: {}
- }
- }
- }
- )
- end
-
- def self.e_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"}
-
- }
- }
- )
- end
-
- def delete!
- update_attribute(:is_delete, true)
- end
-
- def visible?(user=User.current)
- user.allowed_to?(:view_course, self)
- end
-
- def parent_id_changed?
- false
- end
-
- # Returns the mail adresses of users that should be always notified on project events
- def recipients
- notified_users.collect {|user| user.mail}
- end
-
- # Returns the users that should be notified on project events
- def notified_users
- # TODO: User part should be extracted to User#notify_about?
- members.select {|m| m.principal.present? && (m.mail_notification? || m.principal.mail_notification == 'all')}.collect {|m| m.principal}
- end
-
-
- # 课程的短描述信息
- def short_description(length = 255)
- description.gsub(/<\/?.*?>/,"").html_safe if description
- #description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
- end
-
- # 课程的短名称信息
- def short_name(length = 8)
- name.gsub(/<\/?.*?>/,"").html_safe if name
- end
-
- def strip_html(html)
- return html if html.empty? || !html.include?('<')
- output = ""
- tokenizer = HTML::Tokenizer.new(html)
- while token = tokenizer.next
- node = HTML::Node.parse(nil, 0, 0, token, false)
- output += token unless (node.kind_of? HTML::Tag) or (token =~ /^ ["#{Attachmentstype.table_name}.typeId= ?",self.attachmenttype ])
- end
-
-
- # 获取资源后缀名列表
- def contenttypes
- attachmenttypes
- if @attachmenttypes.length >0
- @attachmenttypes.last().suffixArr
- end
- end
-
- def active?
- self.status == STATUS_ACTIVE
- end
-
- #课程权限判断
- def allows_to?(action)
- if archived?
- # No action allowed on archived projects
- return false
- end
- unless active? || Redmine::AccessControl.read_action?(action)
- # No write action allowed on closed projects
- return false
- end
- # No action allowed on disabled modules
- if action.is_a? Hash
- allowed_actions.include? "#{action[:controller]}/#{action[:action]}"
- else
- allowed_permissions.include? action
- end
- end
-
- # 课程允许的权限集合
- def allowed_permissions
- @allowed_permissions ||= begin
- module_names = enabled_modules.all(:select => :name).collect {|m| m.name}
- Redmine::AccessControl.modules_permissions(module_names).collect {|p| p.name}
- end
- end
-
- # 课程允许的动作集合
- def allowed_actions
- @actions_allowed ||= allowed_permissions.inject([]) { |actions, permission| actions += Redmine::AccessControl.allowed_actions(permission) }.flatten
- end
-
- # 返回用户组可以访问的课程
- def users_by_role
- members.includes(:user, :roles).all.inject({}) do |h, m|
- m.roles.each do |r|
- h[r] ||= []
- h[r] << m.user
- end
- h
- end
- end
-
- #自定义验证
- def self_validate
-
- end
-
- def update_files_public
- unless self.is_public?
- self.attachments.each do |a|
- a.update_attributes(:is_public => false)
- end
- end
- end
-
-
- def update_default_value
- self.time = Time.now.year unless time
- self.term = cur_course_term unless term
- self.class_period = 10 unless class_period
- end
-
- # 创建课程讨论区
- def create_board_sync
- @board = self.boards.build
- #self.name=" #{l(:label_borad_course) }"
- @board.name = " #{l(:label_borad_course) }"#self.name
- @board.description = self.name.to_s
- @board.project_id = -1
- if @board.save
- logger.debug "[Course Model] ===> #{@board.to_json}"
- else
- logger.error "[Course Model] ===> Auto create board when course saved, because #{@board.full_messages}"
- end
- end
-
- # 新增课程留言
- # add by nwb
- def self.add_new_jour(user, notes, id, options={})
- course = Course.find(id)
- if options.count == 0
- pjfm = course.journals_for_messages.build(:user_id => user.id, :notes => notes, :reply_id => 0)
- else
- pjfm = course.journals_for_messages.build(options)
- end
- pjfm.save
- pjfm
- end
-
- # 删除课程所有成员
- def delete_all_members
- if self.members && self.members.count > 0
- me, mr = Member.table_name, MemberRole.table_name
- connection.delete("DELETE FROM #{mr} WHERE #{mr}.member_id IN (SELECT #{me}.id FROM #{me} WHERE #{me}.course_id = #{id})")
- Member.delete_all(['course_id = ?', id])
- end
- end
-
- # 创建课程模块
- def create_course_modules
- mod = self.course_modules
- if mod.blank?
- type = ["news", "boards", "attachment", "homework", "poll", "exercises", "statistics"]
- for i in 0..6
- CourseModule.create(:course_id => self.id, :module_type => type[i], :position => i + 1, :hidden => 0 )
- end
- mod = self.course_modules
- end
- return mod
- end
-
- def get_endup_time
- begin
- end_time = Time.parse(self.endup_time)
- rescue Exception => e
- end_time = Time.parse("3000-01-01")
- Rails.logger.error "[Error] course endup_time error. ===> #{e}"
- ensure
- return end_time
- end
- end
-
- def get_time
- begin
- time = Date.new(self.time).to_time
- rescue Exception => e
- time = Time.parse("3000-01-01")
- Rails.logger.error "[Error] course time error. ===> #{e}"
- ensure
- return time
- end
- end
-
- def self.allowed_to_condition(user, permission, options={})
- perm = Redmine::AccessControl.permission(permission)
- base_statement = (perm && perm.read? ? "#{Course.table_name}.status <> #{Course::STATUS_ARCHIVED}" : "#{Course.table_name}.status = #{Course::STATUS_ACTIVE}")
- if perm && perm.course_module
- base_statement << " AND #{Course.table_name}.id IN (SELECT em.course_id FROM #{EnabledModule.table_name} em WHERE em.name='#{perm.course_module}')"
- end
-
- if options[:course]
- course_statement = "#{Course.table_name}.id = #{options[:course].id}"
- course_statement << " OR (#{Course.table_name}.lft > #{options[:course].lft} AND #{Course.table_name}.rgt < #{options[:course].rgt})" if options[:with_subcourses]
- base_statement = "(#{course_statement}) AND (#{base_statement})"
- end
-
- if user.admin?
- base_statement
- else
- statement_by_role = {}
- unless options[:member]
- role = user.logged? ? Role.non_member : Role.anonymous
- if role.allowed_to?(permission)
- statement_by_role[role] = "#{Course.table_name}.is_public = #{connection.quoted_true}"
- end
- end
- if user.logged?
- user.courses_by_role.each do |role, courses|
- if role.allowed_to?(permission) && courses.any?
- statement_by_role[role] = "#{Course.table_name}.id IN (#{courses.collect(&:id).join(',')})"
- end
- end
- end
- if statement_by_role.empty?
- "1=0"
- else
- if block_given?
- statement_by_role.each do |role, statement|
- if s = yield(role, user)
- statement_by_role[role] = "(#{statement} AND (#{s}))"
- end
- end
- end
- "((#{base_statement}) AND (#{statement_by_role.values.join(' OR ')}))"
- end
- end
- end
-
- #课程动态公共表记录
- def act_as_course_activity
- self.course_acts << CourseActivity.new(:user_id => self.tea_id,:course_id => self.id)
- end
-
- #创建课程后,给该用户发送消息
- def act_as_course_message
- self.course_messages << CourseMessage.new(:user_id => self.tea_id, :course_id => self.id, :viewed => false)
- end
-
-
- #项目与课程分离后,很多课程的名称等信息为空,这些数据信息存储在项目表中!!就是数据兼容的问题
- #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
- return if Rails.env.development?
- if self.is_public == 1 and self.is_delete == 0 #公开 和 没有被删除的课程才被索引
- self.__elasticsearch__.index_document
- end
- end
-
- def update_course_ealasticsearch_index
- return if Rails.env.development?
- if self.is_public == 1 and self.is_delete == 0 #如果是初次更新成为公开或者恢复被删除的情况,会报错,那么这条记录尚未被索引过。没有报错就是更新的其他属性
- 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
- return if Rails.env.development?
- begin
- self.__elasticsearch__.delete_document
- rescue => e
-
- end
- end
-
- # 延迟生成邀请码
- def invite_code
- return generate_invite_code
- end
-
- # 生成邀请码
- CODES = %W(2 3 4 5 6 7 8 9 A B C D E F G H J K L N M O P Q R S T U V W X Y Z)
- def generate_invite_code
- code = read_attribute(:invite_code)
- if !code || code.size <5
- code = CODES.sample(5).join
- return generate_invite_code if Course.where(invite_code: code).present?
- update_attribute(:invite_code, code)
- end
- code
- end
-
-
- def generate_qrcode
- ticket = self.qrcode
- if !ticket || ticket.size < 10 || (Time.now.to_i > self.qrcode_expiretime)
- response = Wechat.api.qrcode_create_scene(invite_code, 2592000)
- logger.debug "response = #{response}"
- self.qrcode = response['ticket']
- self.qrcode_expiretime = Time.now.to_i+response['expire_seconds']
- save! && reload
- ticket = qrcode
- end
- ticket
- end
-
- def log_infor
- Rails.logger.info "##########################################################course's syllabus_id is #{self.syllabus_id}."
- 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
-
-
+#coding=utf-8
+
+require 'elasticsearch/model'
+class Course < ActiveRecord::Base
+ include Redmine::SafeAttributes
+
+ include CoursesHelper
+
+ STATUS_ACTIVE = 1
+ 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, index:"not_analyzed",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, :is_delete, :syllabus_id, :end_time, :end_term, :choose_group_allow, :is_end
+ #belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier
+ belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id, :dependent => :destroy # 定义一个方法teacher,该方法通过tea_id来调用User表
+ belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school,该方法通过school_id来调用School表
+ belongs_to :syllabus
+ # has_many :bid
+ has_many :members, :include => [:principal, :roles], :conditions => "#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE}"
+ has_many :memberships, :class_name => 'Member'
+ has_many :member_principals, :class_name => 'Member',
+ :include => :principal,
+ :conditions => "#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE})"
+ has_many :principals, :through => :member_principals, :source => :principal
+ has_many :users, :through => :members
+ has_many :org_courses, :dependent => :destroy
+ has_many :organizations, :through => :org_courses
+ # has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy
+ has_many :journals_for_messages, :as => :jour, :dependent => :destroy
+ # has_many :homework_for_courses, :dependent => :destroy
+ has_many :student, :class_name => 'StudentsForCourse', :source => :user
+ has_many :course_infos, :class_name => 'CourseInfos',:dependent => :destroy
+ has_many :enabled_modules, :dependent => :delete_all
+ has_many :boards, :dependent => :destroy, :order => "position ASC"
+ #has_many :course_journals_for_messages, :class_name => 'CourseJournalsForMessage', :as => :jour, :dependent => :destroy
+ has_many :news, :dependent => :destroy, :include => :author
+ has_one :course_status, :class_name => "CourseStatus", :dependent => :destroy
+ has_many :student_work_projects, :dependent => :destroy
+
+ has_many :homework_commons, :dependent => :destroy
+ has_many :student_works, :through => :homework_commons, :dependent => :destroy
+
+ has_many :course_groups, :dependent => :destroy, :order => "name ASC"
+ has_many :course_homework_statisticss, :dependent => :destroy
+ # 课程动态
+ has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
+
+ has_many :course_activities
+ # 课程消息
+ has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
+ has_many :exercises, :dependent => :destroy
+ # 课程贡献榜
+ has_many :course_contributor_scores, :dependent => :destroy
+
+ #课程模块
+ has_many :course_modules, :dependent => :destroy
+ acts_as_taggable
+ acts_as_nested_set :order => 'name', :dependent => :destroy
+ acts_as_attachable :view_permission => :view_course_files,
+ :delete_permission => :manage_files
+
+ validates_presence_of :name
+ #validates_format_of :class_period, :with =>/^[1-9]\d*$/
+ #validates_format_of :time, :with => /^\d{4}$/
+ validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]*$/
+ validates_length_of :description, :maximum => 10000
+
+ before_save :self_validate
+ # 公开课程变成私有课程,所有资源都变成私有
+ 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
+ after_save :log_infor
+
+ safe_attributes 'extra',
+ 'time',
+ 'name',
+ 'extra',
+ 'code',
+ 'location',
+ 'tea_id',
+ 'password',
+ 'term',
+ 'is_public',
+ 'description',
+ 'class_period',
+ 'open_student',
+ 'is_delete',
+ 'syllabus_id',
+ 'end_time',
+ 'end_term',
+ 'os_allow',
+ 'choose_group_allow',
+ 'credit'
+
+ acts_as_customizable
+
+ scope :not_deleted, lambda{where(is_delete: 0)}
+ scope :not_deleted_not_end, lambda{where(is_delete: 0, is_end: 0)}
+ scope :not_deleted_but_is_end, lambda{where(is_end: 1, is_delete: 0)}
+ scope :all_course
+ scope :active, lambda { where(:status => STATUS_ACTIVE) }
+ scope :status, lambda {|arg| where(arg.blank? ? nil : {:status => arg.to_i}) }
+ scope :all_public, lambda { where(:is_public => true) }
+ scope :visible, lambda {|*args| where(Course.where("is_delete =?", 0).visible_condition(args.shift || User.current, *args)) }
+ scope :allowed_to, lambda {|*args|
+ user = User.current
+ permission = nil
+ if args.first.is_a?(Symbol)
+ permission = args.shift
+ else
+ user = args.shift
+ permission = args.shift
+ end
+ where(Course.allowed_to_condition(user, permission, *args))
+ }
+ scope :like, lambda {|arg|
+ if arg.blank?
+ where(nil)
+ else
+ pattern = "%#{arg.to_s.strip.downcase}%"
+ where(" LOWER(name) LIKE :p ", :p => pattern)
+ end
+ }
+ scope :indexable,lambda { where('is_public = 1 and is_delete = 0') }
+ 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: [''],
+ post_tags: [' '],
+ fields: {
+ name: {},
+ description: {}
+ }
+ }
+ }
+ )
+ end
+
+ def self.e_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"}
+
+ }
+ }
+ )
+ end
+
+ def delete!
+ update_attribute(:is_delete, true)
+ end
+
+ def visible?(user=User.current)
+ user.allowed_to?(:view_course, self)
+ end
+
+ def parent_id_changed?
+ false
+ end
+
+ # Returns the mail adresses of users that should be always notified on project events
+ def recipients
+ notified_users.collect {|user| user.mail}
+ end
+
+ # Returns the users that should be notified on project events
+ def notified_users
+ # TODO: User part should be extracted to User#notify_about?
+ members.select {|m| m.principal.present? && (m.mail_notification? || m.principal.mail_notification == 'all')}.collect {|m| m.principal}
+ end
+
+
+ # 课程的短描述信息
+ def short_description(length = 255)
+ description.gsub(/<\/?.*?>/,"").html_safe if description
+ #description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
+ end
+
+ # 课程的短名称信息
+ def short_name(length = 8)
+ name.gsub(/<\/?.*?>/,"").html_safe if name
+ end
+
+ def strip_html(html)
+ return html if html.empty? || !html.include?('<')
+ output = ""
+ tokenizer = HTML::Tokenizer.new(html)
+ while token = tokenizer.next
+ node = HTML::Node.parse(nil, 0, 0, token, false)
+ output += token unless (node.kind_of? HTML::Tag) or (token =~ /^ ["#{Attachmentstype.table_name}.typeId= ?",self.attachmenttype ])
+ end
+
+
+ # 获取资源后缀名列表
+ def contenttypes
+ attachmenttypes
+ if @attachmenttypes.length >0
+ @attachmenttypes.last().suffixArr
+ end
+ end
+
+ def active?
+ self.status == STATUS_ACTIVE
+ end
+
+ #课程权限判断
+ def allows_to?(action)
+ if archived?
+ # No action allowed on archived projects
+ return false
+ end
+ unless active? || Redmine::AccessControl.read_action?(action)
+ # No write action allowed on closed projects
+ return false
+ end
+ # No action allowed on disabled modules
+ if action.is_a? Hash
+ allowed_actions.include? "#{action[:controller]}/#{action[:action]}"
+ else
+ allowed_permissions.include? action
+ end
+ end
+
+ # 课程允许的权限集合
+ def allowed_permissions
+ @allowed_permissions ||= begin
+ module_names = enabled_modules.all(:select => :name).collect {|m| m.name}
+ Redmine::AccessControl.modules_permissions(module_names).collect {|p| p.name}
+ end
+ end
+
+ # 课程允许的动作集合
+ def allowed_actions
+ @actions_allowed ||= allowed_permissions.inject([]) { |actions, permission| actions += Redmine::AccessControl.allowed_actions(permission) }.flatten
+ end
+
+ # 返回用户组可以访问的课程
+ def users_by_role
+ members.includes(:user, :roles).all.inject({}) do |h, m|
+ m.roles.each do |r|
+ h[r] ||= []
+ h[r] << m.user
+ end
+ h
+ end
+ end
+
+ #自定义验证
+ def self_validate
+
+ end
+
+ def update_files_public
+ unless self.is_public?
+ self.attachments.each do |a|
+ a.update_attributes(:is_public => false)
+ end
+ end
+ end
+
+
+ def update_default_value
+ self.time = Time.now.year unless time
+ self.term = cur_course_term unless term
+ self.class_period = 10 unless class_period
+ end
+
+ # 创建课程讨论区
+ def create_board_sync
+ @board = self.boards.build
+ #self.name=" #{l(:label_borad_course) }"
+ @board.name = " #{l(:label_borad_course) }"#self.name
+ @board.description = self.name.to_s
+ @board.project_id = -1
+ if @board.save
+ logger.debug "[Course Model] ===> #{@board.to_json}"
+ else
+ logger.error "[Course Model] ===> Auto create board when course saved, because #{@board.full_messages}"
+ end
+ end
+
+ # 新增课程留言
+ # add by nwb
+ def self.add_new_jour(user, notes, id, options={})
+ course = Course.find(id)
+ if options.count == 0
+ pjfm = course.journals_for_messages.build(:user_id => user.id, :notes => notes, :reply_id => 0)
+ else
+ pjfm = course.journals_for_messages.build(options)
+ end
+ pjfm.save
+ pjfm
+ end
+
+ # 删除课程所有成员
+ def delete_all_members
+ if self.members && self.members.count > 0
+ me, mr = Member.table_name, MemberRole.table_name
+ connection.delete("DELETE FROM #{mr} WHERE #{mr}.member_id IN (SELECT #{me}.id FROM #{me} WHERE #{me}.course_id = #{id})")
+ Member.delete_all(['course_id = ?', id])
+ end
+ end
+
+ # 创建课程模块
+ def create_course_modules
+ mod = self.course_modules
+ if mod.blank?
+ type = ["news", "boards", "attachment", "homework", "poll", "exercises", "statistics"]
+ for i in 0..6
+ CourseModule.create(:course_id => self.id, :module_type => type[i], :position => i + 1, :hidden => 0 )
+ end
+ mod = self.course_modules
+ end
+ return mod
+ end
+
+ def get_endup_time
+ begin
+ end_time = Time.parse(self.endup_time)
+ rescue Exception => e
+ end_time = Time.parse("3000-01-01")
+ Rails.logger.error "[Error] course endup_time error. ===> #{e}"
+ ensure
+ return end_time
+ end
+ end
+
+ def get_time
+ begin
+ time = Date.new(self.time).to_time
+ rescue Exception => e
+ time = Time.parse("3000-01-01")
+ Rails.logger.error "[Error] course time error. ===> #{e}"
+ ensure
+ return time
+ end
+ end
+
+ def self.allowed_to_condition(user, permission, options={})
+ perm = Redmine::AccessControl.permission(permission)
+ base_statement = (perm && perm.read? ? "#{Course.table_name}.status <> #{Course::STATUS_ARCHIVED}" : "#{Course.table_name}.status = #{Course::STATUS_ACTIVE}")
+ if perm && perm.course_module
+ base_statement << " AND #{Course.table_name}.id IN (SELECT em.course_id FROM #{EnabledModule.table_name} em WHERE em.name='#{perm.course_module}')"
+ end
+
+ if options[:course]
+ course_statement = "#{Course.table_name}.id = #{options[:course].id}"
+ course_statement << " OR (#{Course.table_name}.lft > #{options[:course].lft} AND #{Course.table_name}.rgt < #{options[:course].rgt})" if options[:with_subcourses]
+ base_statement = "(#{course_statement}) AND (#{base_statement})"
+ end
+
+ if user.admin?
+ base_statement
+ else
+ statement_by_role = {}
+ unless options[:member]
+ role = user.logged? ? Role.non_member : Role.anonymous
+ if role.allowed_to?(permission)
+ statement_by_role[role] = "#{Course.table_name}.is_public = #{connection.quoted_true}"
+ end
+ end
+ if user.logged?
+ user.courses_by_role.each do |role, courses|
+ if role.allowed_to?(permission) && courses.any?
+ statement_by_role[role] = "#{Course.table_name}.id IN (#{courses.collect(&:id).join(',')})"
+ end
+ end
+ end
+ if statement_by_role.empty?
+ "1=0"
+ else
+ if block_given?
+ statement_by_role.each do |role, statement|
+ if s = yield(role, user)
+ statement_by_role[role] = "(#{statement} AND (#{s}))"
+ end
+ end
+ end
+ "((#{base_statement}) AND (#{statement_by_role.values.join(' OR ')}))"
+ end
+ end
+ end
+
+ #课程动态公共表记录
+ def act_as_course_activity
+ self.course_acts << CourseActivity.new(:user_id => self.tea_id,:course_id => self.id)
+ end
+
+ #创建课程后,给该用户发送消息
+ def act_as_course_message
+ self.course_messages << CourseMessage.new(:user_id => self.tea_id, :course_id => self.id, :viewed => false)
+ end
+
+
+ #项目与课程分离后,很多课程的名称等信息为空,这些数据信息存储在项目表中!!就是数据兼容的问题
+ #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
+ return if Rails.env.development?
+ if self.is_public == 1 and self.is_delete == 0 #公开 和 没有被删除的课程才被索引
+ self.__elasticsearch__.index_document
+ end
+ end
+
+ def update_course_ealasticsearch_index
+ return if Rails.env.development?
+ if self.is_public == 1 and self.is_delete == 0 #如果是初次更新成为公开或者恢复被删除的情况,会报错,那么这条记录尚未被索引过。没有报错就是更新的其他属性
+ 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
+ return if Rails.env.development?
+ begin
+ self.__elasticsearch__.delete_document
+ rescue => e
+
+ end
+ end
+
+ # 延迟生成邀请码
+ def invite_code
+ return generate_invite_code
+ end
+
+ # 生成邀请码
+ CODES = %W(2 3 4 5 6 7 8 9 A B C D E F G H J K L N M O P Q R S T U V W X Y Z)
+ def generate_invite_code
+ code = read_attribute(:invite_code)
+ if !code || code.size <5
+ code = CODES.sample(5).join
+ return generate_invite_code if Course.where(invite_code: code).present?
+ update_attribute(:invite_code, code)
+ end
+ code
+ end
+
+
+ def generate_qrcode
+ ticket = self.qrcode
+ if !ticket || ticket.size < 10 || (Time.now.to_i > self.qrcode_expiretime)
+ response = Wechat.api.qrcode_create_scene(invite_code, 2592000)
+ logger.debug "response = #{response}"
+ self.qrcode = response['ticket']
+ self.qrcode_expiretime = Time.now.to_i+response['expire_seconds']
+ save! && reload
+ ticket = qrcode
+ end
+ ticket
+ end
+
+ def log_infor
+ Rails.logger.info "##########################################################course's syllabus_id is #{self.syllabus_id}."
+ 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
+
+
diff --git a/app/views/layouts/base_management.html.erb b/app/views/layouts/base_management.html.erb
index 849d7aa30..886ffca0d 100644
--- a/app/views/layouts/base_management.html.erb
+++ b/app/views/layouts/base_management.html.erb
@@ -22,15 +22,41 @@
- 胡莎莎 > 班级列表
+ <%= link_to User.current.show_real_name, user_path(User.current) %> >
+
+ <% case @menu_type %>
+ <% when 2 %>
+ <%= @sub_type == 1 ? "课程列表" : "班级列表" %>
+ <% when 3 %>
+ <%= @sub_type == 1 ? "实训列表" :(@sub_type == 2? "已发布的实训":"已关闭的实训") %>
+ <% when 4 %>
+ <%= @sub_type == 1 ? "实训套件" : "已发布实训套件" %>
+ <% when 5 %>
+ 竞赛
+ <% when 6 %>
+ <%= @sub_type == 1 ? "单位列表" :"单位部门列表" %>
+ <% when 7 %>
+ <%= @sub_type == 1 ? "用户列表" :"适用授权列表" %>
+ <% when 8 %>
+ 消息
+ <% when 9 %>
+ 留言
+ <% when 10 %>
+ <%= @sub_type == 1 ? "身份认证":(@sub_type == 2? "适用授权":(@sub_type == 3?"部门审批":(@sub_type == 4?"单位审批":(@sub_type == 5?"项目实训发布":"课程实训发布"))))%>
+ <% when 11 %>
+ 工程认证+
+ <% when 12 %>
+ 其他
+ <% end %>
+
主页
- 课堂+
-
- <%= link_to "课程列表", classroom_managements_path %>
- <%= link_to "班级列表", classroom_classment_managements_path %>
-
+
<%= link_to "已关闭的实训", close_shixuns_managements_path %>
-
竞赛+
单位
-
- <%= link_to "单位列表", departments_part_managements_path, :class => "edu-admin-nav-a" %>
- <%= link_to "单位部门列表", departments_managements_path%>
-
+
+
+
+
-
消息
留言
-
\ No newline at end of file
diff --git a/app/views/managements/subject_authorization.js.erb b/app/views/managements/subject_authorization.js.erb
index 7d355cd92..92167b545 100644
--- a/app/views/managements/subject_authorization.js.erb
+++ b/app/views/managements/subject_authorization.js.erb
@@ -5,13 +5,13 @@ var nTabNav_2 = $("#edu-tab-nav-2");
var nAudit = $("#subject_all_authentication").parent();
<% if @type == 0 %>
-$("#authentication_list").html("<%= j( render :partial => "managements/shixun_authorization_list" ) %>");
+$("#subject_authentication_list").html("<%= j( render :partial => "managements/subject_authorization_list" ) %>");
nTabNav_1.addClass("edu-new-tab-hover");
nTabNav_2.removeClass("edu-new-tab-hover");
nTabIcon_1.show();
nTabIcon_2.hide();
<% else %>
-$("#shixun_authentication_list").html("<%= j( render :partial => "managements/shixun_authorization_passed_list" ) %>");
+$("#subject_authorization_list").html("<%= j( render :partial => "managements/subject_authorization_passed_list" ) %>");
nTabNav_1.removeClass("edu-new-tab-hover");
nTabNav_2.addClass("edu-new-tab-hover");
nTabIcon_1.hide();
diff --git a/app/views/managements/unit.html.erb b/app/views/managements/unit.html.erb
index 5e1cc4bd2..0320255a9 100644
--- a/app/views/managements/unit.html.erb
+++ b/app/views/managements/unit.html.erb
@@ -1,137 +1,11 @@
+<%= form_tag(url_for(unit_managements_path), :id => "unit", :method => "post", :remote => true ) do %>
+<% end%>
+
+ <%= render :partial => "managements/unit_list" %>
-
-
-
-
- 序号
- 单位名称
- 地区
- 详细地址
- 申请者
- 创建于
-
-
-
-
- <% @apply_status.each do |apply| %>
-
- <%= apply.id %>
- <%= apply.name %>
-
-
- <%= (apply.province.nil? ? "" : apply.province) + (apply.city.nil? ? "" : apply.city) %>
-
-
- 北京
- 上海
- 广东
- 江苏
- 浙江
- 重庆
- 安徽
- 福建
- 甘肃
- 广西
- 贵州
- 海南
- 河北
- 黑龙江
- 河南
- 湖北
- 湖南
- 江西
- 吉林
- 辽宁
- 内蒙古
- 宁夏
- 青海
- 山东
- 山西
- 陕西
- 四川
- 天津
- 新疆
- 西藏
- 云南
- 香港特别行政区
- 澳门特别行政区
- 台湾
- 海外
-
-
-
-
-
- <%= apply.address %>
-
-
-
- <% user = User.where("id=?", apply.user_id).first %>
- <% unless user.nil? %>
- <%=link_to user.show_name, user_path(user),:target => '_blank', :class => "application-default-link" %>
- <% end %>
-
-
- <%= format_date(apply.created_at) %>
-
-
- <%= link_to( l(:label_approve), { :controller => 'admin', :action => 'approve_applied_schools', :id => apply.id }, :class => "application-default-link" ) %>
- <%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id, :tip => 'unapplied' },:method => :delete, :confirm => l(:text_are_you_sure), :class => "application-default-link") %>
- <%=link_to '更改', admin_all_schools_path(:school_id =>apply.id), :remote => true, :class => "application-default-link" %>
-
-
-
- <% end %>
-
-
-
-
-
- <%= pagination_links_full @apply_status_pages, @apply_status_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true %>
-
-
-
-
-
\ No newline at end of file
diff --git a/app/views/managements/unit.js.erb b/app/views/managements/unit.js.erb
new file mode 100644
index 000000000..bf34606df
--- /dev/null
+++ b/app/views/managements/unit.js.erb
@@ -0,0 +1 @@
+$("#managements_unit_list").html("<%= j(render :partial => "managements/unit_list") %>");
\ No newline at end of file
diff --git a/app/views/managements/users.html.erb b/app/views/managements/users.html.erb
index 0062fa0d4..506df5b60 100644
--- a/app/views/managements/users.html.erb
+++ b/app/views/managements/users.html.erb
@@ -1,32 +1,32 @@
-
- <%= form_tag(url_for(users_managements_path), :id => "managements_users_search", :method => "post", :remote => true) do %>
-
-
全部状态
-
-
- 全部状态
- 活动的(<%= query_user_status_num 1 %>)
- 未激活(<%= query_user_status_num 2 %>)
- 已锁定(<%= query_user_status_num 3 %>)
-
-
-
-
真实姓名搜索
-
-
- 真实姓名搜索
- 邮箱地址搜索
- 手机号码搜索
-
-
-
-
- <% end %>
-
-
- <%= render :partial => "managements/user_list" %>
+
+ <%= form_tag(url_for(users_managements_path), :id => "managements_users_search", :method => "post", :remote => true) do %>
+
+
全部状态
+
+
+ 全部状态
+ 活动的(<%= query_user_status_num 1 %>)
+ 未激活(<%= query_user_status_num 2 %>)
+ 已锁定(<%= query_user_status_num 3 %>)
+
+
+
+
真实姓名搜索
+
+
+ 真实姓名搜索
+ 邮箱地址搜索
+ 手机号码搜索
+
+
+
+
+ <% end %>
+
+
+ <%= render :partial => "managements/user_list" %>
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 4dcd2a279..a1e1e43e9 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -154,7 +154,17 @@ RedmineApp::Application.routes.draw do
get 'approve'
get 'trial_authorization', :as => 'trial_authorization'
get 'shixun_authorization'
+ get 'subject_authorization'
+ match 'classroom', :via => [:get, :post]
+ match 'departments', :via => [:get, :post]
+ match 'departments_part', :via => [:get, :post]
+ match 'depart', :via => [:get, :post]
+ match 'unit', :via => [:get, :post]
+ match 'classroom_classment', :via => [:get, :post]
+ match 'class_shixuns', :via => [:get, :post]
+ match 'class_publish_shixuns', :via => [:get, :post]
get 'deal_shixun_authorization'
+ get 'deal_subject_authorization'
get 'batch_authorization', :as => 'batch_authorization'
match 'search_user', :via => [:get, :post]
match 'affirm_cancel_auth', :via => [:get, :post]
@@ -167,6 +177,7 @@ RedmineApp::Application.routes.draw do
match 'users_authorization_agree'
match 'users_authorization_cancel'
get 'update_webssh'
+ get 'delete_subject'
end
end
# Enable Grack support
diff --git a/public/javascripts/edu/base_edu.js b/public/javascripts/edu/base_edu.js
index a9ea17630..2ad86cdd2 100644
--- a/public/javascripts/edu/base_edu.js
+++ b/public/javascripts/edu/base_edu.js
@@ -7,6 +7,8 @@ $(function(){
success: function(data){
if (data.result == 1){
$("#discipline_category_id").html("
选择课程所属学科门类 ");
+ $("#first_level_discipline_id").html("
选择课程所属一级学科 ");
+ $("#major_id").html("
选择课程所属专业 ");
for(var i=0; i
" + data.options[i][0] + "");
}
@@ -27,6 +29,7 @@ $(function(){
success: function(data){
if (data.result == 1){
$("#first_level_discipline_id").html("选择课程所属一级学科 ");
+ $("#major_id").html("选择课程所属专业 ");
for(var i=0; i" + data.options[i][0] + "");
}
diff --git a/public/stylesheets/css/edu-public.css b/public/stylesheets/css/edu-public.css
index 8a495ed90..dc95eab46 100644
--- a/public/stylesheets/css/edu-public.css
+++ b/public/stylesheets/css/edu-public.css
@@ -29,7 +29,7 @@ select.header-search-select{ border:none; font-size:14px; padding:5px; backgroun
.task-user-dropdown-nav li:hover{ background:#eee;}
.task-line{ display: block; height: 1px!important; line-height: 1px!important; border-bottom:1px solid #eee; margin:0;}
.inner-nav-user:hover .task-user-dropdown{ display:block;}
-dropdown{display: inline-block; height:30px; line-height:1.9; font-size:12px; }
+dropdown { display: inline-block; height:30px; line-height:1.9; font-size:12px; }
dropdown label, dropdown ul li{ display: block; width:42px; padding:4px 10px; text-align: center;border-radius:3px; color:#666;}
dropdown ul li:hover{background: #eee; color:#666;cursor: pointer;}
dropdown label{color: #666;border-radius: 3px 0 0 3px; position: relative; z-index: 2; width:50px; text-align: center; height:22px;}
@@ -260,8 +260,8 @@ img.edu-nodata-img{ width:200px; margin:50px auto 20px; display: block;}
/* new tab */
.edu-tab{ width: 100%; background:#fff;}
-#edu-tab-nav{height:47px;background: #fff; border-bottom:2px solid #5faee3;}
-#edu-tab-nav li.new-tab-nav {float:left; width: 150px; text-align:center;height:48px;line-height:48px; }
+#edu-tab-nav,#edu-tab-nav-auth{height:47px;background: #fff; border-bottom:2px solid #5faee3;}
+#edu-tab-nav li.new-tab-nav,#edu-tab-nav-auth li.new-tab-nav {float:left; width: 150px; text-align:center;height:48px;line-height:48px; }
#edu-tab-nav li a{font-size:14px; }
#edu-user-tab-nav{height:47px;background: #f5f5f5; border-bottom:2px solid #FF6610;}
#edu-user-tab-nav li.new-tab-nav {float:left; width: 150px; text-align:center;height:48px;line-height:48px; }