超级管理员相关页面

This commit is contained in:
XuCheng642 2017-08-11 11:27:04 +08:00
parent a24bd77cdc
commit d3a67b42b2
43 changed files with 2456 additions and 2274 deletions

View File

@ -9,48 +9,71 @@ class ManagementsController < ApplicationController
# 专业列表
def profession
@syllabus=Syllabus.where("0=0")
@menu_type=11
@sub_type=1
major_level_option=params[:major_level_option]
discipline_category_option=params[:discipline_category_option]
first_level_discipline_option=params[:first_level_discipline_option]
if major_level_option!='0'
@syllabus=@syllabus.where(:major_level=>major_level_option)
else
@syllabus=@syllabus
@menu_type = 12
@sub_type = 1
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
major_level_option = params[:major_level] if params[:major_level]
discipline_category_option = params[:discipline_category_id] if params[:discipline_category_id]
first_level_discipline_option = params[:first_level_discipline_id] if params[:first_level_discipline_id]
if major_level_option && major_level_option != '0'
@syllabus = @syllabus.where(:major_level=>major_level_option)
end
if discipline_category_option !=nil
if discipline_category_option && discipline_category_option != '0'
@syllabus=@syllabus.where(:discipline_category_id=>discipline_category_option)
end
if first_level_discipline_option!=nil
if first_level_discipline_option && first_level_discipline_option != '0'
@syllabus=@syllabus.where(:first_level_discipline_id=>first_level_discipline_option)
end
@syllabus = @syllabus.order("created_at #{@sx_order}")
@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.js
format.html
end
end
# 实训适用课程
def applicable_course
@courselist = CourseList.find_by_sql("SELECT id, name as name FROM `course_lists` where id in (SELECT id FROM `major_courses`);")
@menu_type = 12
@sub_type = 2
@courselist = CourseList.where("0=0")
search=params[:search]
if search.blank?
@courselist = @courselist
else
@courselist = @courselist.where("name like '%#{search}%'")
end
@courselist_count = @courselist.count
@limit = 4
@is_remote = true
@page = params['page'] ? params['page'].to_i : 1
@courselist_pages = Paginator.new @courselist_count, @limit, @page
@offset ||=@courselist_pages.offset
@courselist = paginateHelper @courselist, @limit
respond_to do |format|
format.js
format.html
end
end
# 增加课程
def add_course
@courselist= CourseList.create(:name => params[:course])
respond_to do |format|
format.js
end
end
# 单位部门列表
def departments
@menu_type = 6
@sub_type = 2
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
@department =Department.where("0=0")
search=params[:search]
if search.blank?
@ -58,6 +81,7 @@ class ManagementsController < ApplicationController
else
@department = @department.where("name like '%#{search}%'")
end
@department = @department.reorder("created_at #{@sx_order}")
@department_count =@department.count
limit = 20
@is_remote = true
@ -68,26 +92,27 @@ class ManagementsController < ApplicationController
format.js
format.html
end
end
# 单位列表
def departments_part
@menu_type = 6
@sub_type = 1
@schools = School.where("0=0")
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
search=params[:search]
if search.blank?
@schools = @schools
else
@schools = @schools.where("name like '%#{search}%'")
end
@schools = @schools.reorder("created_at #{@sx_order}")
@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
respond_to do |format|
format.js
format.html
@ -100,11 +125,13 @@ class ManagementsController < ApplicationController
@sub_type = 3
search = params[:search]
@apply_status = ApplyAddDepartment.where("0=0")
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
if search.blank?
@apply_status = @apply_status.where("0=0")
else
@apply_status= @apply_status.where("name like '%#{search}%'")
end
@apply_status = @apply_status.order("created_at #{@sx_order}")
@apply_status_count = @apply_status.count
limit = 20
@is_remote = true
@ -122,19 +149,20 @@ class ManagementsController < ApplicationController
@menu_type = 10
@sub_type = 4
search = params[:search]
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
@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 = @apply_status.order("created_at #{@sx_order}")
@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
@ -147,43 +175,35 @@ class ManagementsController < ApplicationController
@sub_type = 1
@syllabus = Syllabus.where("0=0")
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
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]
major_level_option = params[:major_level] if params[:major_level]
discipline_category_option = params[:discipline_category_id] if params[:discipline_category_id]
first_level_discipline_option = params[:first_level_discipline_id] if params[:first_level_discipline_id]
syllabus_major_option = params[:major_id] if params[:major_id]
keyword = params[:keyword]
search = params[:search]
if major_level_option!='0'
if major_level_option && major_level_option != '0'
@syllabus = @syllabus.where(:major_level=>major_level_option)
else
@syllabus = @syllabus
end
if discipline_category_option !=nil
if discipline_category_option && discipline_category_option != '0'
@syllabus=@syllabus.where(:discipline_category_id=>discipline_category_option)
end
if first_level_discipline_option!=nil
if first_level_discipline_option && first_level_discipline_option != '0'
@syllabus=@syllabus.where(:first_level_discipline_id=>first_level_discipline_option)
end
if syllabus_major_option!=nil
if syllabus_major_option && syllabus_major_option != '0'
@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")
if params[:school_id] && params[:school_id] != ''
@syllabus = @syllabus.includes(:user => {:user_extensions => []}).where("user_extensions.school_id = #{params[:school_id]}")
end
if search.blank?
@syllabus = @syllabus.where("0=0")
@syllabus = @syllabus
else
if "u_name" == keyword
user_id = User.where("concat(lastname, firstname) like '%#{search}%'")
@ -192,8 +212,9 @@ class ManagementsController < ApplicationController
@syllabus= @syllabus.where("title like '%#{search}%'")
end
end
@syllabus = @syllabus.order("created_at #{@sx_order}")
@syllabus_count = @syllabus.count
@syllabus = @syllabus.order("syllabuses.created_at #{@sx_order}")
@syllabus_count = @syllabus.count
limit = 20
@is_remote = true
@syllabus_pages = Paginator.new @syllabus_count, limit, params['page'] || 1
@ -211,36 +232,40 @@ class ManagementsController < ApplicationController
@sub_type = 2
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
@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")
@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] # 根据姓名/课程名搜索
@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]}").order("created_at #{@sx_order}")
else
@courses = Course.where("0=0").order("created_at #{@sx_order}")
@school_id = params[:school_id]
@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]}")
end
if params[:homepage_show]
@courses = @courses.where(:homepage_show => params[:homepage_show].to_i)
end
if params[:status] && params[:status]!=''
@courses =@courses.where(:is_end =>status).order("created_at #{@sx_order}")
@status = params[:status]
@courses =@courses.where(:is_end =>status)
end
if "u_name" == keyword
if search.blank?
@courses = @courses.order("created_at #{@sx_order}")
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}%'").order("created_at #{@sx_order}")
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}%'").order("created_at #{@sx_order}")
@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 = @courses.order("created_at #{@sx_order}")
@courses = @courses.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").reorder("updatetime #{@sx_order}")
@courses_count = @courses.count
limit = 20
@is_remote = true
@ -253,6 +278,14 @@ class ManagementsController < ApplicationController
end
end
# 班级首页显示
def course_homepage_show
if params[:course_id]
course = Course.find params[:course_id]
course.update_attributes(:homepage_show => !course.homepage_show)
end
end
# 课程实训
def class_shixuns
@menu_type = 4
@ -275,13 +308,12 @@ class ManagementsController < ApplicationController
@c_shixuns = @c_shixuns
else
if "u_name" == keyword
user_id = User.where("concat(lastname, firstname) like '%#{search}%'")
# 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
@c_shixuns = @c_shixuns.reorder("created_at desc")
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))
@ -304,20 +336,19 @@ class ManagementsController < ApplicationController
@c_shixuns = Subject.where(:status => 2)
end
if search.blank?
@c_shixuns = @c_shixuns
else
if "u_name" == keyword
elsif "u_name" == keyword
# 如果用户搜索为空不用遍历user表直接查找所有实训, 有搜索时才查找user
user_id = User.where("concat(lastname, firstname) like '%#{search}%'")
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
@c_shixuns = @c_shixuns.order("created_at desc")
respond_to do |format|
format.js
format.html
@ -412,6 +443,9 @@ class ManagementsController < ApplicationController
else
@shixuns = Shixun.where("name like '%#{search}%'").where(:status => 2).order("created_at #{@sx_order}")
end
if params[:homepage_show]
@shixuns = @shixuns.where(:homepage_show => params[:homepage_show].to_i)
end
@shixuns_count = @shixuns.count
limit = 20
@shixuns_pages = Paginator.new @shixuns_count, limit, params['page'] || 1
@ -422,6 +456,13 @@ class ManagementsController < ApplicationController
format.html
end
end
# 实训首页显示
def shixun_homepage_show
if params[:shixun_id]
shixun = Shixun.find params[:shixun_id]
shixun.update_attributes(:homepage_show => !shixun.homepage_show)
end
end
# 已关闭的实训
def close_shixuns
@ -682,7 +723,7 @@ class ManagementsController < ApplicationController
def shixun_authorization
@menu_type = 10
@sub_type == 5
@sub_type == 5
@type = trial_authorization_status params[:type]
@authorizations = ApplyAction.where(:container_type => "ApplyShixun", :status => @type).order("created_at desc")
search = params[:search]

View File

@ -402,7 +402,6 @@ class ShixunsController < ApplicationController
def new
@shixun = Shixun.new
respond_to do |format|
format.html{render :layout => 'base_edu'}
format.json

View File

@ -24,6 +24,10 @@ module ManagementsHelper
# params[:id]: course_list_id
def get_course_list_major id
ShixunMajorCourse.where(:course_list_id => id)
Major.where(:id => MajorCourse.where(:course_list_id => id).map(&:major_id))
end
def course_list_count id
Major.where(:id => id).first.try(:name)
end
end

View File

@ -24,7 +24,7 @@ class Course < ActiveRecord::Base
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
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, :homepage_show
#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表
@ -105,7 +105,8 @@ class Course < ActiveRecord::Base
'end_term',
'os_allow',
'choose_group_allow',
'credit'
'credit',
'homepage_show'
acts_as_customizable

View File

@ -9,7 +9,7 @@
#
class Shixun < ActiveRecord::Base
attr_accessible :description, :is_public, :name, :changeset_num, :status, :user_id, :gpid, :language, :identifier, :authentication,
:myshixun_count, :propaedeutics, :trainee, :major_id
:myshixun_count, :propaedeutics, :trainee, :major_id, :homepage_show
has_many :users, :through => :shixun_members
has_many :shixun_members, :dependent => :destroy

View File

@ -46,7 +46,7 @@
</li>
<li class="clearfix" id="sy_010">
<a href="<%=course_statistics_course_path(@course) %>" class="fl ml15 ">统计</a>
<a href="<%= course_statistics_course_path(@course) %>" class="fl ml15 ">统计</a>
</li>
</ul>

View File

@ -36,17 +36,17 @@
<% when 6 %>
<%= @sub_type == 1 ? "单位列表" :"单位部门列表" %>
<% when 7 %>
<%= @sub_type == 1 ? "用户列表" :"用授权列表" %>
<%= @sub_type == 1 ? "用户列表" :"用授权列表" %>
<% when 8 %>
消息
<% when 9 %>
留言
<% when 10 %>
<%= @sub_type == 1 ? "身份认证":(@sub_type == 2? "用授权":(@sub_type == 3?"部门审批":(@sub_type == 4?"单位审批":(@sub_type == 5?"项目实训发布":"课程实训发布"))))%>
<%= @sub_type == 1 ? "身份认证":(@sub_type == 2? "用授权":(@sub_type == 3?"部门审批":(@sub_type == 4?"单位审批":(@sub_type == 5?"项目实训发布":"课程实训发布"))))%>
<% when 11 %>
工程认证+
<% when 12 %>
其他
<%= @sub_type == 1 ?"专业列表" : "实训适用课程列表" %>
<% end %>
</span>
</p>
@ -97,7 +97,7 @@
</ul>
</li>
<li class="fl edu-admin-nav-li "><a href="javascript:void(0);" class="edu-admin-nav-a">工程认证+</a></li>
<li class="fl edu-admin-nav-li edu-position <%= 'active' if @menu_type == 11 %>" style="width: 120px"><a href="javascript:void(0);" class="edu-admin-nav-a" style="border-right:none;">其它</a>
<li class="fl edu-admin-nav-li edu-position <%= 'active' if @menu_type == 12 %>" style="width: 120px"><a href="javascript:void(0);" class="edu-admin-nav-a" style="border-right:none;">其它</a>
<ul class="edu-admin-nav-inner">
<li style="width: 120px"><%= link_to "专业列表",profession_managements_path %></li>
<li style="width: 120px"><%= link_to "实训适用课程列表", applicable_course_managements_path %></li>

View File

@ -4,33 +4,59 @@
<th width="9%">序号</th>
<th width="30%" class="edu-txt-left">课程名称</th>
<th width="30%" class="edu-txt-left">专业名称</th>
<th width="15%"class="eud-pointer">创建时间<i class="fa fa-long-arrow-down color-light-green ml5" title=""></i></th>
<th width="15%" class="eud-pointer">创建时间<i class="fa fa-long-arrow-down %> color-light-green ml5"></i></th>
<th>操作</th>
</tr>
</thead>
<tbody>
<% count = 0 %>
<% @courselist.each_with_index do |courselist,index|%>
<tr>
<td><%= index + 1 %></td>
<td>
<% count = ((@page - 1) * @limit) + index + 1 %>
<%= count %>
</td>
<td class="edu-txt-left">
<%= courselist.name %>
</td>
<td class="edu-txt-left">
<% get_course_list_major(courselist.id).each do |smc| %>
<%= course_list_major_time(smc.major_id) %>
<%= format_time smc.created_at %>
<% end %>
<td>
</td>
<td>
<%# get_course_list_major(courselist.id).each do |smc| %>
<%#= course_list_major_time(smc.major_id) %>
<%#= format_time smc.created_at %>
<%# end %>
<%= format_time courselist.created_at %>
</td>
<td><a href="javascript:void(0)" onclick="add_major">添加专业</a></td>
</tr>
<% get_course_list_major(courselist.id).each_with_index do |smc, j| %>
<tr>
<td>
</td>
<td class="edu-txt-left">
</td>
<td class="edu-txt-left">
<%= smc.name %>
</td>
<td>
<%= format_time courselist.created_at %>
</td>
<td>
</td>
</tr>
<% end %>
</tr>
<% end %>
</tbody>
</table>
<div style="text-align:center;" class="new_expand">
<div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @courselist_pages, @courselist_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
<script>
</script>

View File

@ -5,7 +5,7 @@
<th width="40%" class="edu-txt-left">实训套件名称</th>
<th width="20%" class="edu-txt-left">单位</th>
<th width="15%">创建者</th>
<th >发布时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5" title="功能完善中,敬请期待"></i></th>
<th class="eud-pointer">发布时间<i class="fa fa-long-arrow-down color-light-green ml5"></i></th>
</tr>
</thead>
<tbody>
@ -19,5 +19,4 @@
</tr>
<% end %>
</tbody>
</table>

View File

@ -8,7 +8,7 @@
<th width="8%">状态</th>
<th width="20%" class="edu-txt-left">单位</th>
<th width="8%">创建者</th>
<th width="11%">创建时间<i class="fa fa-long-arrow-down color-light-green ml5" title=""></i></th>
<th width="11%" class="eud-pointer">创建时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5"></i></th>
<th>操作</th>
</tr>
</thead>
@ -33,5 +33,16 @@
</tr>
<% end %>
</tbody>
</table>
</table>
<script>
$(".eud-pointer").on("click", function(ev){
var nArrow = $(this).find("i");
var sx_order = nArrow.hasClass("fa-long-arrow-down") ? "asc" : "desc";
$("input[name='sx_order']").val(sx_order);
$.ajax({
url:"<%= class_shixuns_managements_path %>",
data: $("#class_shixuns_search").serialize(),
dateType: "script"
});
});
</script>

View File

@ -1,44 +1,45 @@
<table class="edu-pop-table edu-txt-center" cellpadding="0" cellspacing="0" style="table-layout: fixed">
<thead>
<tr>
<th width="9%">ID</th>
<th width="20%" class="edu-txt-left">班级名称</th>
<th width="4%">成员</th>
<th width="4%">资源</th>
<th width="4%">作业</th>
<th width="4%">试卷</th>
<th width="4%">私有</th>
<th width="4%">模版</th>
<th width="8%">状态</th>
<th width="13%" class="edu-txt-left">创建者单位</th>
<th width="11%">创建者</th>
<th class="eud-pointer" width="11%">创建时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5" title="功能完善中,敬请期待"></i></th>
<th>首页显示</th>
</tr>
</thead>
<tbody>
<% @courses.each do |course| %>
<tr>
<td><%= course.id %></td>
<td class="edu-txt-left"><a href=""><%= link_to course.name, school_on_search_path(course.name) %></a></td>
<td><%= course.members.count %></td>
<td><%= course.attachments.count %></td>
<td><%= course.homework_commons.count%></td>
<td><%= course.exercises.count %></td>
<td><%= course.is_public.to_i == 1 ? '--' : '√' %></td>
<td></td>
<td><%= course.is_end ? "已结束" : "正在进行" %></td>
<td class="edu-txt-left"><%= course.teacher.try(:user_extensions).try(:school).try(:name).blank? ? "--" : course.teacher.try(:user_extensions).try(:school) %></td>
<td> <%= link_to course.teacher.show_name, user_path(course.teacher) %></td>
<td> <%= format_time(course.updatetime) %></td>
<td class="operate"><span class="fr shixun_webssh">
<input type="checkbox" value="0" class="ml-3 mr5 magic-checkbox" id="join_course_role_<%= course.id %>">
<label style="top:-14px;padding-left: 35px;" for="join_course_role_<%= course.id %>"></label></span>
</td>
</tr>
<% end %>
</tbody>
<thead>
<tr>
<th width="9%">ID</th>
<th width="20%" class="edu-txt-left">班级名称</th>
<th width="4%">成员</th>
<th width="4%">资源</th>
<th width="4%">作业</th>
<th width="4%">试卷</th>
<th width="4%">私有</th>
<th width="4%">模版</th>
<th width="8%">状态</th>
<th width="13%" class="edu-txt-left">创建者单位</th>
<th width="11%">创建者</th>
<th class="eud-pointer" width="11%">动态时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5" title="功能完善中,敬请期待"></i></th>
<th>首页显示</th>
</tr>
</thead>
<tbody>
<% @courses.each do |course| %>
<tr>
<td><%= course.id %></td>
<td class="edu-txt-left"><%= link_to course.name, course_path(course.id) %></a></td>
<td><%= course.members.count %></td>
<td><%= course.attachments.count %></td>
<td><%= course.homework_commons.count%></td>
<td><%= course.exercises.count %></td>
<td><%= course.is_public.to_i == 1 ? '--' : '√' %></td>
<td></td>
<td><%= course.is_end ? "已结束" : "正在进行" %></td>
<td class="edu-txt-left"><%= course.teacher.try(:user_extensions).try(:school).try(:name).blank? ? "--" : course.teacher.try(:user_extensions).try(:school) %></td>
<td> <%= link_to course.teacher.show_name, user_path(course.teacher) %></td>
<td> <%= format_time(course.updatetime) %></td>
<td>
<input type="checkbox" name="homepage_show" value="<%= course.id %>" <%= course.homepage_show ? "checked" : "" %> class="ml-3 mr5 magic-checkbox" id="join_course_role_<%= course.id %>">
<label style="top:-14px;padding-left: 35px;float:right;" for="join_course_role_<%= course.id %>"></label>
</td>
</tr>
<% end %>
</tbody>
</table>
<div class="cl"></div>
<div style="text-align:center;" class="new_expand">
<div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;">
<ul id="homework_pository_ref_pages">
@ -51,10 +52,20 @@
$(".eud-pointer").on("click", function(ev){
var nArrow = $(this).find("i");
var sx_order = nArrow.hasClass("fa-long-arrow-down") ? "asc" : "desc";
$("input[name='sx_order']").val(sx_order);
$.ajax({
url:"<%= classroom_classment_managements_path %>",
data: {sx_order:sx_order},
data: $("#class_publish_shixuns_search").serialize(),
dateType: "script"
});
});
$("input[name='homepage_show']").click(function(){
var homepage_show_val = $(this).val();
$.ajax({
url:"<%= course_homepage_show_managements_path %>",
data: {course_id: homepage_show_val},
type: 'post',
dateType: "script"
});
})
</script>

View File

@ -3,13 +3,12 @@
<tr>
<th width="9%">ID</th>
<th width="10%">层级</th>
<th width="12%" class="edu-txt-left">学科门类</th>
<th width="12%" class="edu-txt-left">学科门类</th>
<th width="12%">一级学科</th>
<th width="12%">专业名称</th>
<th width="15%" class="edu-txt-left">课程名称</th>
<th width="12%">创建者</th>
<th width="10%" class="edu-pointer">创建时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5"></i></th>
<th>课堂模版</th>
<th class="eud-pointer">创建时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5"></i></th>
</tr>
</thead>
<tbody>
@ -20,13 +19,11 @@
<td class="edu-txt-left"><%= syllabus.syllabus_discipline_category == '' ? "--" : syllabus.syllabus_discipline_category %></td>
<td><%= syllabus.syllabus_first_level_discipline == "" ? "--" : syllabus.syllabus_first_level_discipline %></td>
<td><%= syllabus.syllabus_major == "" ? "--" : syllabus.syllabus_major %></td>
<td class="edu-txt-left"> <%= render :partial => 'admin/rename_syllabus_title', :locals => {:syllabus => syllabus} %></td>
<td class="edu-txt-left"> <%#= render :partial => 'admin/rename_syllabus_title', :locals => {:syllabus => syllabus} %>
<%= link_to syllabus.title,syllabus_path(syllabus.id) %>
</td>
<td><%= link_to syllabus.user.show_name, user_path(syllabus.user) %></td>
<td><%= format_time syllabus.created_at %></td>
<td class="operate"><span class="fr shixun_webssh">
<input type="checkbox" value="0" class="ml-3 mr5 magic-checkbox" id="join_course_role_<%= index + 1 %>">
<label style="top:-14px;padding-left: 45px;" for="join_course_role_<%= index + 1 %>"></label>
</span></td>
</tr>
<% end %>
</tbody>
@ -39,4 +36,16 @@
<div class="cl"></div>
</div>
</div>
<script>
$(".eud-pointer").on("click", function(ev){
var nArrow = $(this).find("i");
var sx_order = nArrow.hasClass("fa-long-arrow-down") ? "asc" : "desc";
$("input[name='sx_order']").val(sx_order);
$.ajax({
url:"<%= classroom_managements_path %>",
data: $("#classroom").serialize(),
dateType: "script"
});
});
</script>

View File

@ -4,8 +4,8 @@
<th width="9%">序号</th>
<th width="25%" class="edu-txt-left">部门名称</th>
<th width="30%" class="edu-txt-left">单位名称</th>
<th width="15%"class="eud-pointer">创建于<i class="fa fa-long-arrow-down color-light-green ml5" title=""></i></th>
<th width=""></th>
<th width="15%" class="eud-pointer">创建于<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5"></i></th>
<th></th>
</tr>
</thead>
<tbody>
@ -14,7 +14,7 @@
<td><%= apply.id %></td>
<td class="edu-txt-left"> <%= apply.name %></td>
<td class="edu-txt-left"> <%= apply.school.name %></td>
<td > <%= format_date(apply.created_at) %></td>
<td><%= format_time apply.created_at %></td>
<td class="center">
<%= link_to( l(:label_approve), { :controller => 'admin', :action => 'approve_applied_departments', :id => apply.id }, :class => "application-default-link" ) %>
<%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_departments', :id => apply.id, :tip => 'unapplied' },:method => :delete, :confirm => l(:text_are_you_sure), :class => "application-default-link") %>
@ -33,12 +33,14 @@
</div>
</div>
<script>
// var find=$("#shixun_Look_name").val();
function myFunction(){
if($("#shixun_Look_name").val()==""){
$(".d-none").css("display","none");
}else{
$(".d-none").css("display","block");
}
}
$(".eud-pointer").on("click", function(ev){
var nArrow = $(this).find("i");
var sx_order = nArrow.hasClass("fa-long-arrow-down") ? "asc" : "desc";
$("input[name='sx_order']").val(sx_order);
$.ajax({
url:"<%= depart_managements_path %>",
data: $("#depart_search").serialize(),
dateType: "script"
});
});
</script>

View File

@ -5,7 +5,7 @@
<th width="30%" class="edu-txt-left">部门名称</th>
<th width="15%">用户数</th>
<th width="15%">已认证职业</th>
<th width="20%">创建于<i class="fa fa-long-arrow-down color-light-green ml5" title=""></i></th>
<th width="20%" class="eud-pointer">创建于<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5" title=""></i></th>
<th></th>
</tr>
</thead>
@ -39,4 +39,15 @@
$(".d-none").css("display","block");
}
}
$(".eud-pointer").on("click", function(ev){
var nArrow = $(this).find("i");
var sx_order = nArrow.hasClass("fa-long-arrow-down") ? "asc" : "desc";
$("input[name='sx_order']").val(sx_order);
$.ajax({
url:"<%= departments_managements_path %>",
data: $("#department_search").serialize(),
dateType: "script"
});
});
</script>

View File

@ -8,7 +8,7 @@
<th width="19%" class="edu-txt-left">详细地址</th>
<th style="width: 6%;" >用户数</th>
<th width="6%">部门数</th>
<th width="15%"class="eud-pointer">创建于<i class="fa fa-long-arrow-down color-light-green ml5" title=""></i></th>
<th width="15%" class="eud-pointer">创建于<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5"></i></th>
<th></th>
</tr>
</thead>
@ -18,7 +18,6 @@
<td><%= schools.id %></td>
<td>
<%= image_tag(schools.logo_link,width:40,height:40) %>
</td>
<td class="edu-txt-left">
<span>
@ -49,12 +48,14 @@
</div>
<script>
// var find=$("#shixun_Look_name").val();
function myFunction(){
if($("#shixun_Look_name").val()==""){
$(".d-none").css("display","none");
}else{
$(".d-none").css("display","block");
}
}
$(".eud-pointer").on("click", function(ev){
var nArrow = $(this).find("i");
var sx_order = nArrow.hasClass("fa-long-arrow-down") ? "asc" : "desc";
$("input[name='sx_order']").val(sx_order);
$.ajax({
url:"<%= departments_part_managements_path %>",
data: $("#department_part_search").serialize(),
dateType: "script"
});
});
</script>

View File

@ -6,7 +6,7 @@
<th width="12%" class="edu-txt-left">学科门类</th>
<th width="12%" class="edu-txt-left">一级学科</th>
<th width="28%" class="edu-txt-left">专业名称</th>
<th width="15%"class="eud-pointer">创建时间<i class="fa fa-long-arrow-down color-light-green ml5" title=""></i></th>
<th width="15%"class="eud-pointer">创建时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5" ></i></th>
<th>操作</th>
</tr>
</thead>
@ -21,7 +21,7 @@
<td> <%= format_time syllabus.created_at %></td>
<td class="operate edu-txt-left"><span class="fr shixun_webssh">
<input type="checkbox" value="0" class="magic-checkbox" id="join_course_role_<%= syllabus.id%>">
<label style="top:-3px;padding-left: 25px;" for="join_course_role_<%= syllabus.id%>">支撑实训</label>
<label style="top:-3px;padding-left: 25px;" for="join_course_role_<%= syllabus.id %>">支撑实训</label>
</span></td>
</tr>
<% end %>
@ -36,4 +36,15 @@
<div class="cl"></div>
</div>
</div>
<script>
$(".eud-pointer").on("click",function(ev){
var nArrow = $(this).find("i");
var sx_order = nArrow.hasClass("fa-long-arrow-down") ? "asc" : "desc";
$("input[name='sx_order']").val(sx_order);
$.ajax({
url:"<%= profession_managements_path %>",
data: $("#profession").serialize(),
dateType: "script"
});
})
</script>

View File

@ -1,14 +1,15 @@
<table class="edu-pop-table edu-txt-center" cellspacing="0" cellpadding="0" style="table-layout: fixed;">
<thead>
<th width="10%">ID</th>
<th class="table_Name_text" width="30%">实训名称</th>
<th width="9%">ID</th>
<th class="table_Name_text" >实训名称</th>
<th width="8%">顶</th>
<th width="8%">踩</th>
<th width="8%">已通关</th>
<th width="8%">已开启</th>
<th width="8%">创建者</th>
<th width="9%">已开启</th>
<th width="9%">创建者</th>
<th class="eud-pointer" width="11%">发布时间<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5" title="功能完善中,敬请期待"></i></th>
<th width="9%">操作</th>
<th>首页显示</th>
</thead>
<tbody>
<% @shixuns.each do |shixun| %>
@ -28,6 +29,10 @@
<td class="operate">
<%= link_to "关闭", publish_shixuns_managements_path(:close => shixun.id), :class => "", :remote => true %>
</td>
<td>
<input type="checkbox" name="homepage_show" value="<%= shixun.id %>" <%= shixun.homepage_show ? "checked" : "" %> class="ml-3 mr5 magic-checkbox" id="join_course_role_<%= shixun.id %>">
<label style="top:-14px;" class="ml75" for="join_course_role_<%= shixun.id %>"></label>
</td>
</tr>
<% end %>
</tbody>
@ -50,5 +55,14 @@
data: {sx_order:sx_order},
dateType: "script"
});
});
$("input[name='homepage_show']").click(function(){
var homepage_show_val = $(this).val();
$.ajax({
url:"<%= shixun_homepage_show_managements_path %>",
data: {shixun_id: homepage_show_val},
type: 'post',
dateType: "script"
});
})
</script>

View File

@ -6,7 +6,7 @@
<th width="15%">地区</th>
<th width="20%" class="edu-txt-left">详细地址</th>
<th width="10%">申请者</th>
<th width="10%">创建于<i class="fa fa-long-arrow-down color-light-green ml5" title=""></i></th>
<th width="10%" class="eud-pointer">创建于<i class="fa <%= @sx_order == "desc" ? "fa-long-arrow-down" : "fa-long-arrow-up" %> color-light-green ml5"></i></th>
<th width="10%"></th>
</tr>
</thead>
@ -70,7 +70,7 @@
<% end %>
</td>
<td>
<%= format_date(apply.created_at) %>
<%= format_time(apply.created_at) %>
</td>
<td>
<%= link_to( l(:label_approve), { :controller => 'admin', :action => 'approve_applied_schools', :id => apply.id }, :class => "application-default-link" ) %>
@ -91,13 +91,14 @@
</div>
</div>
<script>
// var find=$("#shixun_Look_name").val();
// function myFunction(){
// if($("#shixun_Look_name").val()==""){
// $(".d-none").css("display","none");
// }else{
// $(".d-none").css("display","block");
// }
// }
$(".eud-pointer").on("click", function(ev){
var nArrow = $(this).find("i");
var sx_order = nArrow.hasClass("fa-long-arrow-down") ? "asc" : "desc";
$("input[name='sx_order']").val(sx_order);
$.ajax({
url:"<%= unit_managements_path %>",
data: $("#unit").serialize(),
dateType: "script"
});
});
</script>

View File

@ -2,6 +2,7 @@
<thead>
<tr>
<th >&nbsp;</th>
<th>ID</th>
<th>真实姓名</th>
<th>职业</th>
<th><a href="javascript:void(0);">学号</a></th>
@ -13,13 +14,16 @@
</tr>
</thead>
<tbody>
<% @users.each do |user| %>
<% @users.each_with_index do |user,index| %>
<% authorization = ApplyAction.where(:user_id => user).first %>
<tr>
<td style="padding-left:15px;">
<input id="authorization_<%= user.id %>" type="checkbox" class="magic-checkbox" name="member_ids[]" value="<%= user.id %>">
<label for="authorization_<%= user.id %>">&nbsp;</label>
</td>
<td>
<%= user.id %>
</td>
<td>
<%= link_to user.try(:show_real_name), user_path(user), :class => "edu-txt-w100 task-hide2" %>
</td>

View File

@ -0,0 +1 @@
$("#classroom_list").html("<%= j(render :partial => "managements/applicable_course_list") %>");

View File

@ -3,7 +3,7 @@
<input class="fl task-form-20 task-height-30 ml35 " name="search" maxlength="" placeholder="输入关键字进行搜索" type="text" style="height: 21px;" id="Look_name">
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5 " onclick="$('#classroom').submit();">搜索</a>
<a href="javascript:clearSearchCondition()" class="fl task-btn ml5 " id="clear_contents">清除</a>
<a href="#" class="task-btn task-btn-green fr mr30" >新增实训适用课程</a>
<a href="javascript:void(0)" class="task-btn task-btn-green fr mr30" onclick="alert_new_major_type('<%= %>')">新增实训适用课程</a>
</div>
<% end %>
<div class="edu-con-bg01 mt15" id="classroom_list">
@ -12,6 +12,35 @@
<script>
function clearSearchCondition(){
$("#Look_name").val("");
$.get('<%= classroom_managements_path() %>');
$.get('<%= applicable_course_managements_path() %>');
}
function alert_new_major_type(){
var htmlvalue ='<%= form_tag(url_for(add_course_managements_path),:id=>"add_course",:method => "post",:remote=>true) do %>'+
'<div style="width:300px" class="task-popup">'+
'<div class="mt20 ml10 mb10">' +
'请输入课程名称:<input type="text" id="new_course_name" name="course" class="fr mr25" >' +
'</div>' +
'<span class="color-orange ml20 fl none" style="margin-left: 12%;" id="new_course_name_notice">'+
'<i class="fa fa-exclamation-circle mr5" ></i>'+
'请输入名称</span>'+
'<div class="cl"></div>' +
'<div class="task-popup-submit clearfix ml25">' +
'<a href="javascript:void(0);" class="task-btn fl pop_close mr10">取消</a>' +
'<a href="javascript:void(0);" onclick="submit_new_course();" class="task-btn task-btn-blue fr" >确定</a>' +
'</div>' +
'</div>'+
'<% end %>';
pop_box_new(htmlvalue, 300, 400);
}
function submit_new_course(){
var insert_data = $("#new_course_name").val()
if($("#new_course_name").val().trim() == ""){
$("#new_course_name_notice").show();
} else{
$("#new_course_name_notice").hide();
$("#add_course").submit();
}
}
</script>

View File

@ -0,0 +1 @@
$("#classroom_list").html("<%= j(render :partial => "managements/applicable_course_list") %>");

View File

@ -14,10 +14,10 @@
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5" onclick="$('#class_publish_shixuns_search').submit();">搜索</a>
<a href="javascript:clearSearchCondition();" class="fl task-btn ml5 mt2 ">清除</a>
</div>
<% end %>
<div class="edu-con-bg01 mt15" id="management_class_shixun_list">
<div class="edu-con-bg01 mt15" id="class_shixun_list">
<%= render :partial => "managements/class_publish_shixuns_list" %>
</div>
<% end %>
<script>
//清除查询条件
function clearSearchCondition(){

View File

@ -1 +1 @@
$("#management_class_shixun_list").html("<%= j(render :partial => "managements/class_publish_shixuns_list") %>");
$("#class_shixun_list").html("<%= j(render :partial => "managements/class_publish_shixuns_list") %>");

View File

@ -19,6 +19,7 @@
<input class="fl task-form-20 task-height-30" name="search" maxlength="" placeholder="输入关键字进行搜索" type="text" style="height: 21px;" id="cla_sx_Look_name" >
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5" onclick="$('#class_shixuns_search').submit();">搜索</a>
<a href="javascript:clearSearchCondition()" class="fl task-btn ml5 mt2 ">清除</a>
<input name="sx_order" type="hidden">
</div>
<div class="edu-con-bg01 mt15" id="managements_class_shixuns_list">
<%= render :partial => "managements/class_shixuns_list" %>

View File

@ -4,29 +4,27 @@
<%= select_tag :discipline_category_id,options_for_select(discipline_category_option, nil), {:id=>"discipline_category_id", :class=>"fl task-form-15 task-height-30", :style => "margin:0px 30px 0px 50px;"} %>
<%= select_tag :first_level_discipline_id,options_for_select(first_level_discipline_option, nil), {:id=>"first_level_discipline_id", :class=>"fl task-form-20 task-height-30", :style => "margin:0px 30px 0px 25px;"} %>
<%= select_tag :major_id,options_for_select(syllabus_major_option, nil), {:id=>"major_id", :class=>"fl task-form-20 task-height-30", :style => "margin:0px 30px 0px 25px;"} %>
<select class="fl task-form-30 task-height-30" style="margin:20px 30px 10px 25px;" name="school_id" id="part">
<option value="0" selected="selected">选择创建单位</option>
<%= @schools.each do |school|%>
<option value="<%= school.id %>"><%= school.name%></option>
<% end%>
</select>
<li class="clearfix mb10 ml35 mt15 fl" style="display: inline-block">
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="school" class="task-height-40 panel-box-sizing fl" type="text" placeholder="请选择学校" style="width: 330px" />
<input nhname="tag" nh_tag_5="true" class="fl" id="school_id" name="school_id" style="display:none;" type="text"/> <!-- 单位名称的test框选中下拉列表框的id -->
<div class="cl"></div>
</li>
<div id="search_school_result_list" style="width: 330px;line-height: 1.5;min-height:20px; max-height: 200px; height: auto !important;display:none;background: white;overflow: scroll;border: solid 1px #cccccc; overflow-x: hidden; overflow-y: auto;">
</div>
<!--</select>-->
<select class="fl task-form-15 task-height-30" style="margin:20px 0px 10px 25px;width: 11%" name="keyword" id="condition">
<option value="u_name">创建者姓名搜索</option>
<option value="cla_name">课程名称搜索</option>
</select>
<span class="fr shixun_webssh">
<input type="checkbox"class="mr5 magic-checkbox" id="join_course_role_0">
<label style="top:-30px;padding-left:23px;" for="join_course_role_0"><span class="only_view">只看模板</span></label>
</span>
<input class="fl task-form-20 task-height-30 mt20" name="search" maxlength="" placeholder="输入关键字进行搜索" type="text" style="height: 21px;" id="Look_name">
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5 mt20" onclick="$('#classroom').submit();">搜索</a>
<a href="javascript:clearSearchCondition()" class="fl task-btn ml5 mt2 mt20" id="clear_contents">清除</a>
<input name="sx_order" type="hidden">
</div>
<% end %>
<div class="edu-con-bg01 mt15" id="classroom_list">
<%= render :partial => "managements/classroom_list" %>
</div>
<script>
function clearSearchCondition(){
$("#part").val("");
@ -38,4 +36,55 @@
$("#first_level_discipline_id").val("");
$.get('<%= classroom_managements_path() %>');
}
</script>
$("input[name='school']").on('input', function (e) {
throttle(department_search_fn, window, e);
});
var d_lastSearchCondition = '';
var d_page = 1; //唯一控制页码 变量
var d_count = 0; //查询结果的总量
var d_maxPage = 0;//最大页面值
function department_search_fn(e) {
if($(e.target).val().trim() == ''){
$("#search_school_result_list").hide();
$("input[name='school_id']").val("");
return;
}
if ($(e.target).val().trim() == d_lastSearchCondition && $(e.target).val().trim() != '') {//如果输入框没有改变或者输入框为空就返回
return;
}
d_lastSearchCondition = $(e.target).val().trim();
page = 1; //有新的搜索页面重置为1
$.ajax({
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value + '&school_id=' + $("input[name='occupation']").val() + '&page=' + d_page,
type: 'post',
success: function (data) {
d_schoolsResult = data.schools;
count = data.count;
maxPage = Math.ceil(count / 100); //最大页码值
if (d_schoolsResult.length != undefined && d_schoolsResult.length != 0) {
var i = 0;
$("#search_school_result_list").html('');
for (; i < d_schoolsResult.length; i++) {
link = '<a onclick="window.changeSchoolValue(\'' + d_schoolsResult[i].school.name.replace(/\s/g, " ") + '\',\'' + d_schoolsResult[i].school.id + '\')" href="javascript:void(0)">' + d_schoolsResult[i].school.name + '</a><br/>';
$("#search_school_result_list").append(link);
}
$("#search_school_result_list").css('left', $(e.target).offset().left);
$("#search_school_result_list").css('top', $(e.target).offset().top + 40);
$("#search_school_result_list").css("position", "absolute");
$("#search_school_result_list").show();
} else {
$("#search_school_result_list").html('你的学校不在列表中?请确认后输入');
$("#search_school_result_list").show();
}
}
});
}
//修改部门
function changeSchoolValue(value, data) {
console.log(value+","+data)
$("input[name='school']").val(value);
$("input[name='school_id']").val(data);
$("#search_school_result_list").hide();
}
</script>

View File

@ -19,11 +19,12 @@
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5" onclick="$('#class_publish_shixuns_search').submit();">搜索</a>
<a href="javascript:clearSearchCondition();" class="fl task-btn ml5 mt2 " id="clear_contents">清除</a>
<span class="fr shixun_webssh">
<input type="checkbox"class="mr5 magic-checkbox" id="join_course_role_0">
<input type="checkbox" class="mr5 magic-checkbox" name="homepage_show" value="1" id="join_course_role_0">
<label style="top:2px;padding-left:23px;" for="join_course_role_0"><span class="only_view">只看首页显示</span></label>
</span>
</span>
<input name="sx_order" type="hidden">
</div>
<% end%>
<% end %>
<div class="edu-con-bg01 mt15" id="managements_classroom_classment">
<%= render :partial => "managements/classroom_classment_list" %>
</div>
@ -33,6 +34,11 @@
$("#part").val("");
$("#condition_status").val("uname")
$("#Look_name").val("");
$.get('<%=classroom_classment_managements_path() %>')
}
$.get('<%= classroom_classment_managements_path() %>')
};
$("#join_course_role_0").on('click', function(){
$('#class_publish_shixuns_search').submit();
});
</script>

View File

@ -3,11 +3,12 @@
<input class="fl task-form-20 task-height-30 ml35" id="shixun_Look_name" name="search" maxlength="" placeholder="输入关键字进行搜索" type="text" style="height: 21px;" >
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5 mt2" onclick="$('#depart_search').submit();">搜索</a>
<a href="javascript:clearSearchCondition();" class="fl task-btn ml5 mt2" id="clear_contents">清除</a>
<input name="sx_order" type="hidden" />
</div>
<% end%>
<div class="edu-con-bg01 mt15" id="managements_user_list">
<%= render :partial => "managements/depart_list" %>
</div>
<% end %>
<script>
function clearSearchCondition(){
$("#shixun_Look_name").val("");

View File

@ -4,6 +4,7 @@
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5 mt2" onclick="$('#department_search').submit();">搜索</a>
<a href="javascript:clearSearchCondition();" class="fl task-btn ml5 mt2" id="clear_contents">清除</a>
<a href="#" class="task-btn task-btn-green fr mt6 mr30" >创建</a>
<input name="sx_order" type="hidden"/>
</div>
<% end %>
<div class="edu-con-bg01 mt15" id="managements_departments_list">

View File

@ -4,6 +4,7 @@
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5 mt2" onclick="$('#department_part_search').submit();">搜索</a>
<a href="javascript:clearSearchCondition();" class="fl task-btn ml5 mt2" id="clear_contents">清除</a>
<a href="#" class="task-btn task-btn-green fr mt6 mr30" >新建单位</a>
<input name="sx_order" type="hidden">
</div>
<% end %>
<div class="edu-con-bg01 mt15" id="managements_department_part_list">

View File

@ -1,111 +1,55 @@
<div class="edu-class-container mb15">
<div class="edu-con-top clearfix">
<!--<p class="ml15 fl color-grey"><span><a href="">身份认证</a></span><span style="margin: 0 40px">|</span><span><a href="">职业认证</a></span></p>-->
<ul id="edu-tab-nav-auth">
<li class="edu-new-tab-hover new-tab-nav">
<%= link_to "身份认证", {:controller => "managements", :action => "", :type => 0}, :class => "tab_type", :remote => true %>
</li>
<li class="new-tab-nav">
<%= link_to "职业认证", {:controller => "managements", :action => "", :type => 0}, :class => "tab_type", :remote => true %>
</li>
</ul>
<p class="ml15 fl color-grey"><span><a href="">身份认证</a></span></p>
<div class="cl"></div>
</div>
<div>
<!--身份认证-->
<div class="edu-con-bg01 mt15 authentization">
<div class="edu-tab clearfix mb20">
<ul id="edu-tab-nav">
<li id="edu-tab-nav-1" class="edu-new-tab-hover new-tab-nav" onclick="HoverLi(1);">
<%= link_to "待审批", {:controller => "managements", :action => "identity_authentication", :type => 0}, :class => "tab_type", :remote => true %>
</li>
<li id="edu-tab-nav-2" onclick="HoverLi(2);">
<%= link_to "已审批", {:controller => "managements", :action => "identity_authentication", :type => [1,2]}, :class => "tab_type", :remote => true %>
</li>
</ul>
<div class="cl"></div>
<div id="edu-tab-con-1">
<div class="mt10">
<div class="edu-position fr task-form-30 mb10 mr15">
<input class="task-form-100 panel-box-sizing" placeholder="输入真实姓名进行检索" type="text" id="search_name">
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt10" id="search"><i class="fa fa-search"></i></a>
<div class="edu-con-bg01 mt15 authentization">
<div class="edu-tab clearfix mb20">
<ul id="edu-tab-nav">
<li id="edu-tab-nav-1" class="edu-new-tab-hover new-tab-nav" onclick="HoverLi(1);">
<%= link_to "待审批", {:controller => "managements", :action => "identity_authentication", :type => 0}, :class => "tab_type", :remote => true %>
</li>
<li id="edu-tab-nav-2" class="new-tab-nav" onclick="HoverLi(2);">
<%= link_to "已审批", {:controller => "managements", :action => "identity_authentication", :type => [1,2]}, :class => "tab_type", :remote => true %>
</li>
</ul>
<div class="cl"></div>
<div id="edu-tab-con-1">
<div class="mt10">
<div class="edu-position fr task-form-30 mb10 mr15">
<input class="task-form-100 panel-box-sizing" placeholder="输入真实姓名进行检索" type="text" id="search_name">
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt10" id="search"><i class="fa fa-search"></i></a>
</div>
<div class="cl"></div>
<div id="authentication_list">
<%= render :partial => "admin/authentication_list" %>
</div>
</div>
</div>
<div id="edu-tab-con-2" class="undis">
<div class="mt10">
<p class="fl task-form-60 mt8">
<a href="javascript:void(0);" class="edu-filter-cir-grey mr5 active wid60" id="audit_all_authentication">全部</a>
<a href="javascript:void(0);" class="edu-filter-cir-grey mr5 wid60" id="audit_agree_authentication">同意</a>
<a href="javascript:void(0);" class="edu-filter-cir-grey mr5 wid60" id="audit_reject_authentication" >拒绝</a>
</p>
<div class="edu-position fr task-form-30 mb10 fr mr15">
<input class="task-form-100 panel-box-sizing" placeholder="输入真实姓名进行检索" type="text" id="audit_search_name">
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt15" id="audit_search"><i class="fa fa-search"></i></a>
</div>
<div class="cl"></div>
<div id="audit_authentication_list">
</div>
</div>
</div>
<div class="cl"></div>
<div id="authentication_list">
<%= render :partial => "admin/authentication_list" %>
</div>
</div>
</div>
<div id="edu-tab-con-2" class="undis">
<div class="mt10">
<p class="fl task-form-60 mt8 ml15">
<a href="javascript:void(0);" class="edu-filter-cir-grey mr5 active" id="audit_all_authentication">全部</a>
<a href="javascript:void(0);" class="edu-filter-cir-grey mr5" id="audit_agree_authentication">同意</a>
<a href="javascript:void(0);" class="edu-filter-cir-grey mr5" id="audit_reject_authentication" >拒绝</a>
</p>
<div class="edu-position fr task-form-30 mb10 fr mr15">
<input class="task-form-100 panel-box-sizing" placeholder="输入真实姓名进行检索" type="text" id="audit_search_name">
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt15" id="audit_search"><i class="fa fa-search"></i></a>
</div>
<div class="cl"></div>
<div id="audit_authentication_list">
</div>
</div>
</div>
<div class="cl"></div>
</div>
</div>
<!--职业认证-->
<div class="edu-con-bg01 mt15 undis authentization">
<div class="edu-tab clearfix mb20">
<ul id="edu-tab-nav">
<li id="edu-tab-nav-1" class="edu-new-tab-hover new-tab-nav" onclick="HoverLi(1);">
<%= link_to "待审批" %>N
</li>
<li id="edu-tab-nav-2" onclick="HoverLi(2);">
<%= link_to "已审批" %>
</li>
</ul>
<div class="cl"></div>
<div id="edu-tab-con-1">
<div class="mt10">
<div class="edu-position fr task-form-30 mb10 mr15">
<input class="task-form-100 panel-box-sizing" placeholder="输入真实姓名进行检索" type="text">
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt10" id="search"><i class="fa fa-search"></i></a>
</div>
<div class="cl"></div>
<div id="authentication_list">
</div>
</div>
</div>
<div id="edu-tab-con-2" class="undis">
<div class="mt10">
<p class="fl task-form-60 mt8 ml15">
<a href="javascript:void(0);" class="edu-filter-cir-grey mr5 active">全部</a>
<a href="javascript:void(0);" class="edu-filter-cir-grey mr5">同意</a>
<a href="javascript:void(0);" class="edu-filter-cir-grey mr5">拒绝</a>
</p>
<div class="edu-position fr task-form-30 mb10 fr mr15">
<input class="task-form-100 panel-box-sizing" placeholder="输入真实姓名进行检索" type="text">
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt15"><i class="fa fa-search"></i></a>
</div>
<div class="cl"></div>
<!--<div id="audit_authentication_list">-->
<!--</div>-->
</div>
</div>
<div class="cl"></div>
</div>
</div>
</div>
</div>
<script>
/* -------------------------- 拒绝 ------------------------------------ */
function reject_authentication_reason(nThis){
@ -189,10 +133,5 @@
data: { name: iName, type: type}
});
});
// 身份认证和职业认证
$("#edu-tab-nav-auth li").click(function(){
var index=$(this).index();
$("#edu-tab-nav-auth li").eq(index).addClass("edu-new-tab-hover").siblings().removeClass("edu-new-tab-hover");
$(".authentization").eq(index).removeClass("undis").siblings().addClass("undis");
})
</script>

View File

@ -6,6 +6,7 @@
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5 " onclick="$('#profession').submit();">搜索</a>
<a href="javascript:clearSearchCondition()" class="fl task-btn ml5 mt2 " id="clear_contents">清除</a>
<a href="#" class="task-btn task-btn-green fr mr30" >新增</a>
<input type="hidden" name="sx_order"/>
</div>
<span class="shixun_webssh">
<input type="checkbox" class="mr5 magic-checkbox" id="join_course_role_0">

View File

@ -10,6 +10,10 @@
<a href="javascript:void(0)" class="task-btn task-btn-blue" onclick="$('#publish_shixuns_search').submit();">搜索</a>
<a href="javascript:clearSearchCondition();" class="task-btn mr10">清除</a>
</li>
<span class="fr shixun_webssh">
<input type="checkbox" class="mr5 magic-checkbox" name="homepage_show" value="1" id="join_course_role_0">
<label style="top:2px;padding-left:23px;" for="join_course_role_0"><span class="only_view">只看首页显示</span></label>
</span>
<% end %>
</div>
<div class="ex_container" id="management_shixun_list">
@ -41,5 +45,7 @@
$("#sx_condition_status").val("u_name");
$("#sx_status").val("");
}
$("#join_course_role_0").on("click",function(){
$('#publish_shixuns_search').submit();
})
</script>

View File

@ -5,12 +5,11 @@
<div class="edu-con-bg01 mt15">
<div class="edu-tab clearfix mb20">
<ul id="edu-tab-nav">
<li id="edu-tab-nav-1" class="edu-new-tab-hover" onclick="HoverLi(1);">
<li id="edu-tab-nav-1" class="edu-new-tab-hover new-tab-nav" onclick="HoverLi(1);">
<%= link_to "待审批", {:controller => "managements", :action => "shixun_authorization", :type => 0}, :class => "tab_type", :remote => true %>
</li>
<li id="edu-tab-nav-2" onclick="HoverLi(2);">
<li id="edu-tab-nav-2" onclick="HoverLi(2);" class="new-tab-nav">
<%= link_to "已审批", {:controller => "managements", :action => "shixun_authorization", :type => [1, 2]}, :class => "tab_type", :remote => true %>
<span class="edu-tab-fa"><i class="fa fa-caret-down"></i></span>
</li>
</ul>
<div class="cl"></div>

View File

@ -5,12 +5,11 @@
<div class="edu-con-bg01 mt15">
<div class="edu-tab clearfix mb20">
<ul id="edu-tab-nav">
<li id="edu-tab-nav-1" class="edu-new-tab-hover" onclick="HoverLi(1)">
<li id="edu-tab-nav-1" class="edu-new-tab-hover new-tab-nav" onclick="HoverLi(1)">
<%= link_to "待审批", {:controller => "managements", :action => "subject_authorization", :type => 0}, :class => "tab_type", :remote => true %>
</li>
<li id="edu-tab-nav-2" onclick="HoverLi(2)">
<li id="edu-tab-nav-2" class="new-tab-nav" onclick="HoverLi(2)">
<%= link_to "已审批", {:controller => "managements", :action => "subject_authorization", :type => [1, 2]}, :class => "tab_type", :remote => true %>
<span class="edu-tab-fa"><i class="fa fa-caret-down"></i></span>
</li>
</ul>
<div class="cl"></div>

View File

@ -3,6 +3,7 @@
<input class="fl task-form-20 task-height-30 ml35" id="shixun_Look_name" name="search" maxlength="" placeholder="输入关键字进行搜索" type="text" style="height: 21px;">
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5 mt-2" onclick="$('#unit').submit();">搜索</a>
<a href="javascript:clearSearchCondition();" class="fl task-btn ml5 mt2" id="clear_contents">清除</a>
<input type="hidden" name="sx_order"/>
</div>
<% end%>
<div class="edu-con-bg01 mt15" id="managements_unit_list">

View File

@ -180,6 +180,9 @@ RedmineApp::Application.routes.draw do
match 'users_authorization_agree'
match 'users_authorization_cancel'
get 'update_webssh'
post 'course_homepage_show'
post 'shixun_homepage_show'
post 'add_course'
end
end
# Enable Grack support

File diff suppressed because it is too large Load Diff

View File

@ -642,4 +642,4 @@ $(function(){
},1000);
}
});
});

View File

@ -1,351 +1,350 @@
$(function(){
var bt=baidu.template;
bt.LEFT_DELIMITER='<!';
bt.RIGHT_DELIMITER='!>';
var tested = false;
var valid_form = function() {
var src = $('#program-src').val();
if (!src) {
long_notice_box("请输入正确的代码!");
return false;
}
// if ($("textarea[name='late_reason']").length > 0 && $("textarea[name='late_reason']").val().trim() == "") {
// var htmlvalue = "</br><div style='width:550px;text-align:center'>请输入标题!</div></br><div style='width:67px; margin:0 auto; text-align:center'><a href='javascript:void(0);' class='Blue-btn' onclick='hideModal()'>确定</a></div>";
// long_notice_box("迟交原因不能为空");
// return false;
// }
return true;
};
var test_program = function(cb){
$('#test-program-btn').hide();
$('#commit-program-work-btn').hide();
var homework_id = $('#test-program-btn').attr('data-homework-id');
var student_work_id = $('#test-program-btn').attr('data-student-work-id');
var src = $('#program-src').val();
var is_test = $('input[name=is_test]').val();
if(!valid_form()){
$('#test-program-btn').show();
$('#commit-program-work-btn').show();
return;
}
//先测试一次并返回测试集个数及结果再判断是否需要继续进行测试
var test_post = function(i, testid){
$.post(
'/student_work/program_test_ex',
{homework: homework_id, student_work_id: student_work_id,
src: src, is_test: is_test,tIndex:i,
testid: testid},
function(data,status){
if (data.status==-4 || data.status==-5 ){
//弹框
var root_path = getRootPath();
var forums_1_path = root_path + "/forums/1";
long_notice_box("由于目前大量用户正在测试,系统繁忙,请稍后再试。<br/>我们将尽快提升平台的处理能力,谢谢您的支持!");
$('#test-program-btn').show();
$('#commit-program-work-btn').show();
return;
}
else if (data.status==-3){
long_notice_box("由于目前大量用户正在测试,系统繁忙,请稍后再试。<br/>我们将尽快提升平台的处理能力,谢谢您的支持!");
$('#test-program-btn').show();
$('#commit-program-work-btn').show();
return;
}
var tSeq = data.tseq;
var tCount = data.tcount;
console.log("tSeq="+tSeq);
console.log("tCount="+tCount);
tested = true;
console.log(data);
if(data.index <=0){
data.index = $('.ProResultList').length+1;
}
var html=bt('t:result-list',data);
$("#new_student_work_tests").show();
if(i==1){
$('.edu-tab-con-box').prepend('<div class="mb10 ProResultList"><span class="font-bd mb5">第'+($('.ProResultList').length+1)+'次</span><div class="edu-ces-box"></div></div>');
}
$('.ProResultList:first-child').find(".edu-ces-box").prepend(html);
if (data.status==0 && is_test != 'true') {
if (typeof cb == 'function') {cb(data);return;}
$('#test-program-btn').show();
$('#commit-program-work-btn').show();
return;
}
//2 超时 -2 编译错误 测试结束
if (data.status == 2 || data.status == -2 || tSeq >= tCount ){
if (typeof cb == 'function') {cb(data);$('#test-program-btn').show();$('#commit-program-work-btn').show(); return;}
$('#test-program-btn').show();
$('#commit-program-work-btn').show();
return;
}
test_post(i+1, data.testid);
}
).fail(function(xhr, status){
if(status == 'timeout'){
long_notice_box("您的答案超时了, 请检查代码是否存在死循环的错误!");
} else {
long_notice_box("由于目前大量用户正在测试,系统繁忙,请稍后再试。<br/>我们将尽快提升平台的处理能力,谢谢您的支持!");
}
$('#test-program-btn').show();
$('#commit-program-work-btn').show();
return;
});
};
test_post(1, 0);
};
$('#test-program-btn').on('click', test_program);
$('#commit-program-work-btn').on('click', function(){
if(!valid_form()){
return;
} else{
if ($("textarea[name='late_reason']").length > 0 && $("textarea[name='late_reason']").val().trim() == "") {
var htmlvalue = "</br><div style='width:550px;text-align:center'>请输入标题!</div></br><div style='width:67px; margin:0 auto; text-align:center'><a href='javascript:void(0);' class='Blue-btn' onclick='hideModal()'>确定</a></div>";
long_notice_box("迟交原因不能为空");
return false;
}
}
$('#commit-program-work-btn').hide();
if($('.edu-tab-con-box .ProResultList').length<=0){
var htmlvalue = '<div class="task-popup" style="width:575px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey">提示</h3><a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a></div>'+
'<div class="task-popup-content"><p class="task-popup-text-center font-16">测试后才能提交,是否立刻测试?</p></div><div class="task-popup-submit clearfix"><a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl">取消</a>'+
'<a href="javascript:void(0);" class="task-btn task-btn-blue fr" id="code-test-button">确定</a></div></div>';
pop_box_new(htmlvalue,575,140);
$("#code-test-button").on('click',function(){
test_program();
hideModal();
});
return;
}
console.log(tested);
if (!tested) {
test_program(function(data){
if (data.status!=0) {
tested = false;
console.log(tested);
var htmlvalue = '<div class="task-popup" style="width:575px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey">提示</h3><a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a></div>'+
'<div class="task-popup-content"><p class="task-popup-text-center font-16">测试不通过,是否强制提交?</p></div><div class="task-popup-submit clearfix"><a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl">取消</a>'+
'<a href="javascript:void(0);" class="task-btn task-btn-blue fr" onclick="submit_code();">确定</a></div></div><script>function submit_code(){$("#commit-program-work-btn").hide();$("#student_work_form").submit();hideModal();}</script>';
pop_box_new(htmlvalue,575,140);
$('#commit-program-work-btn').show();
return;
};
$('#commit-program-work-btn').hide();
$('#test-program-btn').hide();
$("#student_work_form").submit();
});
return;
}
$('#commit-program-work-btn').hide();
$('#test-program-btn').hide();
$("#student_work_form").submit();
});
//代码编辑器
if (typeof CodeMirror != "undefined") {
var program_name = "text/x-csrc";
var language = $('#data-language').attr('data-language');
if (language == 1) {
program_name = 'text/x-csrc';
} else if(language==2){
program_name = 'text/x-c++src';
}else if(language==3){
program_name = 'text/x-cython';
} else if(language==4){
program_name = 'text/x-java';
}
if ($('#program-src').val().length<=0) {
var src = '';
if(language==4){
src = '\
//注意\n\
//1:该程序每次运行的时间必须小于200毫秒否则会超时,程序超时将不会测试剩余的测试集\n\
//2:该程序每次运行使用的内存不能超过1M否则会返回错误\n\
//3:该程序每次运行输出的结果最多显示1000个字符(多余的不显示),每行末尾的所有空格用□表示\n\
import java.io.*;\n\
import java.util.*;\n\
\n\
//请一定不要修改类名\n\
class Main\n\
{\n\
public static void main (String args[])\n\
{\n\
//获取参数方式\n\
//Scanner in = new Scanner(System.in);\n\
//int a = in.nextInt();\n\
//int b = in.nextInt();\n\
\n\
//您的代码\n\
}\n\
}\n\
';
}
else if(language==1){
src = '\
//注意\n\
//1:该程序每次运行的时间必须小于200毫秒否则会超时,程序超时将不会测试剩余的测试集\n\
//2:该程序每次运行使用的内存不能超过1M否则会返回错误\n\
//3:该程序每次运行输出的结果最多显示1000个字符(多余的不显示),每行末尾的所有空格用□表示\n\
#include <stdio.h>\n\
int main()\n\
{\n\
//获取参数方式 scanf\n\
//int x =0;\n\
//int y = 0;\n\
//scanf("%d", &x);\n\
\n\
//结果输出使用prinf\n\
//printf("%d",x);\n\
\n\
return 0;\n\
}\n\
';
} else if(language==2){
src = '\
//注意\n\
//1:该程序每次运行的时间必须小于200毫秒否则会超时,程序超时将不会测试剩余的测试集\n\
//2:该程序每次运行使用的内存不能超过1M否则会返回错误\n\
//3:该程序每次运行输出的结果最多显示1000个字符(多余的不显示),每行末尾的所有空格用□表示\n\
#include <iostream>\n\
using namespace std;\n\
\n\
int main()\n\
{\n\
//获取参数方式 cin\n\
//int x =0;\n\
//cin >> x;\n\
\n\
//结果输出使用 cout\n\
//cout<<"1";\n\
\n\
return 0;\n\
}\n\
';
} else if(language==3){
src = '\
#-*-coding:utf-8-*-\n\
#注意\n\
#1:该程序每次运行的时间必须小于200毫秒否则会超时,程序超时将不会测试剩余的测试集\n\
#2:该程序每次运行使用的内存不能超过1M否则会返回错误\n\
#3:该程序每次运行输出的结果最多显示1000个字符(多余的不显示),空格用表示\n\
import sys \n\
\n\
#获取参数方式使用raw_input\n\
#input = raw_input()\n\
#a, b = input.split()\n\
\n\
#结果输出使用 print \n\
#print (str(int(a)+int(b)))\n\
';
}
$('#program-src').val(src);
};
var editor = CodeMirror.fromTextArea(document.getElementById("program-src"), {
mode: {name: program_name,
version: 2,
singleLineStringErrors: false},
lineNumbers: true,
indentUnit: 2,
matchBrackets: true
});
editor.on('change',function(cMirror){
// get value right from instance
$('#program-src').val(cMirror.getValue());
});
}
});
function alert_choose_homework_type(id){
var htmlvalue = '<div class="task-popup" style="width:300px;">' +
'<div class="task-popup-title clearfix task-popup-bggrey">' +
'<h3 class="fl">选择作业类别</h3>' +
'<a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>' +
'</div>' +
'<div class="task_popup_con">' +
'<div class="newupload_conbox">' +
'<div class="clearfix mb15">' +
'<span class="fl mt5">作业类别:</span>' +
'<ul class="fl">' +
'<li class="clearfix">' +
'<input type="radio" name="homework_type" value="1" id="homework_type_1" class="fl magic-radio">' +
'<label for="homework_type_1" class="fl ml5 edu-class-pop-label edu-color-grey">' +
'普通作业' +
'</label>' +
'</li>' +
'<li class="clearfix">' +
'<input type="radio" name="homework_type" value="3" id="homework_type_2" class="fl magic-radio">' +
'<label for="homework_type_2" class="fl ml5 edu-class-pop-label edu-color-grey">' +
'分组作业' +
'</label>' +
'</li>' +
'<li class="clearfix">' +
'<input type="radio" name="homework_type" value="2" id="homework_type_3" class="fl magic-radio edu-color-grey">' +
'<label for="homework_type_3" class="fl ml5 edu-class-pop-label">' +
'编程作业' +
'</label>' +
'</li>' +
'<li class="clearfix">' +
'<input type="radio" name="homework_type" value="4" id="homework_type_4" class="fl magic-radio edu-color-grey">' +
'<label for="homework_type_4" class="fl ml5 edu-class-pop-label">' +
'实训作业' +
'</label>' +
'</li>' +
'</ul>' +
'</div>' +
'<div class="cl"></div>' +
'<div id="homework_type_notice" class="clearfix color-red none mt-10 ml75">请先选择作业类型</div>' +
'<div class="task-popup-submit clearfix">' +
'<a href="javascript:void(0);" class="task-btn fl pop_close">取消</a>' +
'<a href="javascript:void(0);" onclick="new_homework_type('+id+');" class="task-btn task-btn-blue fr">确定</a>' +
'</div>' +
'</div>' +
'</div>' +
'</div>';
pop_box_new(htmlvalue, 300, 308);
}
function new_homework_type(id){
if($("input[name='homework_type']:checked").length == 0){
$("#homework_type_notice").show();
} else{
var type=$("input[name='homework_type']:checked").val();
console.log(type == 4);
if(type == 4){
$.ajax({
url: '/homework_common/shixuns?course='+id,
dataType: "script"
});
}else{
window.location.href = '/homework_common/new?course='+id+'&homework_type=' + $("input[name='homework_type']:checked").val();
}
}
}
function new_shixun_homework(id){
if($("input[name='shixun_homework']:checked").length == 0){
$("#homework_type_notice").show();
} else{
var type=$("input[name='shixun_homework']:checked").val();
console.log(type);
$("#shixun_homework_common_new").submit();
}
}
$(function(){
var bt=baidu.template;
bt.LEFT_DELIMITER='<!';
bt.RIGHT_DELIMITER='!>';
var tested = false;
var valid_form = function() {
var src = $('#program-src').val();
if (!src) {
long_notice_box("请输入正确的代码!");
return false;
}
// if ($("textarea[name='late_reason']").length > 0 && $("textarea[name='late_reason']").val().trim() == "") {
// var htmlvalue = "</br><div style='width:550px;text-align:center'>请输入标题!</div></br><div style='width:67px; margin:0 auto; text-align:center'><a href='javascript:void(0);' class='Blue-btn' onclick='hideModal()'>确定</a></div>";
// long_notice_box("迟交原因不能为空");
// return false;
// }
return true;
};
var test_program = function(cb){
$('#test-program-btn').hide();
$('#commit-program-work-btn').hide();
var homework_id = $('#test-program-btn').attr('data-homework-id');
var student_work_id = $('#test-program-btn').attr('data-student-work-id');
var src = $('#program-src').val();
var is_test = $('input[name=is_test]').val();
if(!valid_form()){
$('#test-program-btn').show();
$('#commit-program-work-btn').show();
return;
}
//先测试一次并返回测试集个数及结果再判断是否需要继续进行测试
var test_post = function(i, testid){
$.post(
'/student_work/program_test_ex',
{homework: homework_id, student_work_id: student_work_id,
src: src, is_test: is_test,tIndex:i,
testid: testid},
function(data,status){
if (data.status==-4 || data.status==-5 ){
//弹框
var root_path = getRootPath();
var forums_1_path = root_path + "/forums/1";
long_notice_box("由于目前大量用户正在测试,系统繁忙,请稍后再试。<br/>我们将尽快提升平台的处理能力,谢谢您的支持!");
$('#test-program-btn').show();
$('#commit-program-work-btn').show();
return;
}
else if (data.status==-3){
long_notice_box("由于目前大量用户正在测试,系统繁忙,请稍后再试。<br/>我们将尽快提升平台的处理能力,谢谢您的支持!");
$('#test-program-btn').show();
$('#commit-program-work-btn').show();
return;
}
var tSeq = data.tseq;
var tCount = data.tcount;
console.log("tSeq="+tSeq);
console.log("tCount="+tCount);
tested = true;
console.log(data);
if(data.index <=0){
data.index = $('.ProResultList').length+1;
}
var html=bt('t:result-list',data);
$("#new_student_work_tests").show();
if(i==1){
$('.edu-tab-con-box').prepend('<div class="mb10 ProResultList"><span class="font-bd mb5">第'+($('.ProResultList').length+1)+'次</span><div class="edu-ces-box"></div></div>');
}
$('.ProResultList:first-child').find(".edu-ces-box").prepend(html);
if (data.status==0 && is_test != 'true') {
if (typeof cb == 'function') {cb(data);return;}
$('#test-program-btn').show();
$('#commit-program-work-btn').show();
return;
}
//2 超时 -2 编译错误 测试结束
if (data.status == 2 || data.status == -2 || tSeq >= tCount ){
if (typeof cb == 'function') {cb(data);$('#test-program-btn').show();$('#commit-program-work-btn').show(); return;}
$('#test-program-btn').show();
$('#commit-program-work-btn').show();
return;
}
test_post(i+1, data.testid);
}
).fail(function(xhr, status){
if(status == 'timeout'){
long_notice_box("您的答案超时了, 请检查代码是否存在死循环的错误!");
} else {
long_notice_box("由于目前大量用户正在测试,系统繁忙,请稍后再试。<br/>我们将尽快提升平台的处理能力,谢谢您的支持!");
}
$('#test-program-btn').show();
$('#commit-program-work-btn').show();
return;
});
};
test_post(1, 0);
};
$('#test-program-btn').on('click', test_program);
$('#commit-program-work-btn').on('click', function(){
if(!valid_form()){
return;
} else{
if ($("textarea[name='late_reason']").length > 0 && $("textarea[name='late_reason']").val().trim() == "") {
var htmlvalue = "</br><div style='width:550px;text-align:center'>请输入标题!</div></br><div style='width:67px; margin:0 auto; text-align:center'><a href='javascript:void(0);' class='Blue-btn' onclick='hideModal()'>确定</a></div>";
long_notice_box("迟交原因不能为空");
return false;
}
}
$('#commit-program-work-btn').hide();
if($('.edu-tab-con-box .ProResultList').length<=0){
var htmlvalue = '<div class="task-popup" style="width:575px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey">提示</h3><a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a></div>'+
'<div class="task-popup-content"><p class="task-popup-text-center font-16">测试后才能提交,是否立刻测试?</p></div><div class="task-popup-submit clearfix"><a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl">取消</a>'+
'<a href="javascript:void(0);" class="task-btn task-btn-blue fr" id="code-test-button">确定</a></div></div>';
pop_box_new(htmlvalue,575,140);
$("#code-test-button").on('click',function(){
test_program();
hideModal();
});
return;
}
console.log(tested);
if (!tested) {
test_program(function(data){
if (data.status!=0) {
tested = false;
console.log(tested);
var htmlvalue = '<div class="task-popup" style="width:575px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey">提示</h3><a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a></div>'+
'<div class="task-popup-content"><p class="task-popup-text-center font-16">测试不通过,是否强制提交?</p></div><div class="task-popup-submit clearfix"><a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl">取消</a>'+
'<a href="javascript:void(0);" class="task-btn task-btn-blue fr" onclick="submit_code();">确定</a></div></div><script>function submit_code(){$("#commit-program-work-btn").hide();$("#student_work_form").submit();hideModal();}</script>';
pop_box_new(htmlvalue,575,140);
$('#commit-program-work-btn').show();
return;
};
$('#commit-program-work-btn').hide();
$('#test-program-btn').hide();
$("#student_work_form").submit();
});
return;
}
$('#commit-program-work-btn').hide();
$('#test-program-btn').hide();
$("#student_work_form").submit();
});
//代码编辑器
if (typeof CodeMirror != "undefined") {
var program_name = "text/x-csrc";
var language = $('#data-language').attr('data-language');
if (language == 1) {
program_name = 'text/x-csrc';
} else if(language==2){
program_name = 'text/x-c++src';
}else if(language==3){
program_name = 'text/x-cython';
} else if(language==4){
program_name = 'text/x-java';
}
if ($('#program-src').val().length<=0) {
var src = '';
if(language==4){
src = '\
//注意\n\
//1:该程序每次运行的时间必须小于200毫秒否则会超时,程序超时将不会测试剩余的测试集\n\
//2:该程序每次运行使用的内存不能超过1M否则会返回错误\n\
//3:该程序每次运行输出的结果最多显示1000个字符(多余的不显示),每行末尾的所有空格用□表示\n\
import java.io.*;\n\
import java.util.*;\n\
\n\
//请一定不要修改类名\n\
class Main\n\
{\n\
public static void main (String args[])\n\
{\n\
//获取参数方式\n\
//Scanner in = new Scanner(System.in);\n\
//int a = in.nextInt();\n\
//int b = in.nextInt();\n\
\n\
//您的代码\n\
}\n\
}\n\
';
}
else if(language==1){
src = '\
//注意\n\
//1:该程序每次运行的时间必须小于200毫秒否则会超时,程序超时将不会测试剩余的测试集\n\
//2:该程序每次运行使用的内存不能超过1M否则会返回错误\n\
//3:该程序每次运行输出的结果最多显示1000个字符(多余的不显示),每行末尾的所有空格用□表示\n\
#include <stdio.h>\n\
int main()\n\
{\n\
//获取参数方式 scanf\n\
//int x =0;\n\
//int y = 0;\n\
//scanf("%d", &x);\n\
\n\
//结果输出使用prinf\n\
//printf("%d",x);\n\
\n\
return 0;\n\
}\n\
';
} else if(language==2){
src = '\
//注意\n\
//1:该程序每次运行的时间必须小于200毫秒否则会超时,程序超时将不会测试剩余的测试集\n\
//2:该程序每次运行使用的内存不能超过1M否则会返回错误\n\
//3:该程序每次运行输出的结果最多显示1000个字符(多余的不显示),每行末尾的所有空格用□表示\n\
#include <iostream>\n\
using namespace std;\n\
\n\
int main()\n\
{\n\
//获取参数方式 cin\n\
//int x =0;\n\
//cin >> x;\n\
\n\
//结果输出使用 cout\n\
//cout<<"1";\n\
\n\
return 0;\n\
}\n\
';
} else if(language==3){
src = '\
#-*-coding:utf-8-*-\n\
#注意\n\
#1:该程序每次运行的时间必须小于200毫秒否则会超时,程序超时将不会测试剩余的测试集\n\
#2:该程序每次运行使用的内存不能超过1M否则会返回错误\n\
#3:该程序每次运行输出的结果最多显示1000个字符(多余的不显示),空格用表示\n\
import sys \n\
\n\
#获取参数方式使用raw_input\n\
#input = raw_input()\n\
#a, b = input.split()\n\
\n\
#结果输出使用 print \n\
#print (str(int(a)+int(b)))\n\
';
}
$('#program-src').val(src);
};
var editor = CodeMirror.fromTextArea(document.getElementById("program-src"), {
mode: {name: program_name,
version: 2,
singleLineStringErrors: false},
lineNumbers: true,
indentUnit: 2,
matchBrackets: true
});
editor.on('change',function(cMirror){
// get value right from instance
$('#program-src').val(cMirror.getValue());
});
}
});
function alert_choose_homework_type(id){
var htmlvalue = '<div class="task-popup" style="width:300px;">' +
'<div class="task-popup-title clearfix task-popup-bggrey">' +
'<h3 class="fl">选择作业类别</h3>' +
'<a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>' +
'</div>' +
'<div class="task_popup_con">' +
'<div class="newupload_conbox">' +
'<div class="clearfix mb15">' +
'<span class="fl mt5">作业类别:</span>' +
'<ul class="fl">' +
'<li class="clearfix">' +
'<input type="radio" name="homework_type" value="1" id="homework_type_1" class="fl magic-radio">' +
'<label for="homework_type_1" class="fl ml5 edu-class-pop-label edu-color-grey">' +
'普通作业' +
'</label>' +
'</li>' +
'<li class="clearfix">' +
'<input type="radio" name="homework_type" value="3" id="homework_type_2" class="fl magic-radio">' +
'<label for="homework_type_2" class="fl ml5 edu-class-pop-label edu-color-grey">' +
'分组作业' +
'</label>' +
'</li>' +
'<li class="clearfix">' +
'<input type="radio" name="homework_type" value="2" id="homework_type_3" class="fl magic-radio edu-color-grey">' +
'<label for="homework_type_3" class="fl ml5 edu-class-pop-label">' +
'编程作业' +
'</label>' +
'</li>' +
'<li class="clearfix">' +
'<input type="radio" name="homework_type" value="4" id="homework_type_4" class="fl magic-radio edu-color-grey">' +
'<label for="homework_type_4" class="fl ml5 edu-class-pop-label">' +
'实训作业' +
'</label>' +
'</li>' +
'</ul>' +
'</div>' +
'<div class="cl"></div>' +
'<div id="homework_type_notice" class="clearfix color-red none mt-10 ml75">请先选择作业类型</div>' +
'<div class="task-popup-submit clearfix">' +
'<a href="javascript:void(0);" class="task-btn fl pop_close">取消</a>' +
'<a href="javascript:void(0);" onclick="new_homework_type('+id+')" class="task-btn task-btn-blue fr">确定</a>' +
'</div>' +
'</div>' +
'</div>' +
'</div>';
pop_box_new(htmlvalue, 300, 308);
}
function new_homework_type(id){
if($("input[name='homework_type']:checked").length == 0){
$("#homework_type_notice").show();
} else{
var type=$("input[name='homework_type']:checked").val();
console.log(type == 4);
if(type == 4){
$.ajax({
url: '/homework_common/shixuns?course='+id,
dataType: "script"
});
}else{
window.location.href = '/homework_common/new?course='+id+'&homework_type=' + $("input[name='homework_type']:checked").val();
}
}
}
function new_shixun_homework(id){
if($("input[name='shixun_homework']:checked").length == 0){
$("#homework_type_notice").show();
} else{
var type=$("input[name='shixun_homework']:checked").val();
console.log(type);
$("#shixun_homework_common_new").submit();
}
}

View File

@ -2,7 +2,7 @@ var syMemberLastSearchCondition = '';
function g(o){return document.getElementById(o);}
function HoverLi(n){
for(var i=1;i<=3;i++){
for(var i=1;i<=5;i++){
g('edu-tab-nav-'+i).className='edu-tab-nomal';
g('edu-tab-con-'+i).className='undis';
}

View File

@ -262,8 +262,8 @@ img.edu-nodata-img{ width:200px; margin:50px auto 20px; display: block;}
/* new tab */
.edu-tab{ width: 100%; background:#fff;}
#edu-tab-nav,#edu-tab-nav-auth{height:47px;background: #fff;}
#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{height:47px;background: #fff;}
#edu-tab-nav 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:40px;background: #f5f5f5; border-bottom:2px solid #FC7033;}
#edu-user-tab-nav li.new-tab-nav {float:left; width: 120px; text-align:center;height:42px;line-height:42px; }