课程资源库和课程题库
This commit is contained in:
parent
5e82ef00ba
commit
6fe571cc99
|
|
@ -79,6 +79,51 @@ class AttachmentsController < ApplicationController
|
|||
:disposition => 'attachment' #inline can open in browser
|
||||
end
|
||||
|
||||
def direct_download_resource
|
||||
@resource = ResourceBank.find(params[:id])
|
||||
storage_path = Redmine::Configuration['attachments_storage_path'] || File.join(Rails.root, "files")
|
||||
file = File.join(storage_path, @resource.disk_directory.to_s, @resource.disk_filename.to_s)
|
||||
send_file file, :filename => filename_for_content_disposition(@resource.filename),
|
||||
:type => detect_content_type(@resource),
|
||||
:disposition => 'attachment' #inline can open in browser
|
||||
@resource.increment!(:downloads)
|
||||
end
|
||||
|
||||
def download_resource
|
||||
@resource = ResourceBank.find(params[:id])
|
||||
candown = resource_bank_candown @resource, params[:type]
|
||||
if candown
|
||||
if stale?(:etag => @resource.digest)
|
||||
if params[:preview] == 'true'
|
||||
storage_path = Redmine::Configuration['attachments_storage_path'] || File.join(Rails.root, "files")
|
||||
convered_file = File.join(storage_path, @resource.disk_directory.to_s, @resource.disk_filename.to_s)
|
||||
#如果本身不是pdf文件,则先寻找是不是已转换化,如果没有则转化
|
||||
unless pdf?(convered_file)
|
||||
convered_file = File.join(Rails.root, "files", "convered_office", @attachment.disk_filename + ".pdf")
|
||||
unless File.exist?(convered_file)
|
||||
office = Trustie::Utils::Office.new(File.join(storage_path, @resource.disk_directory.to_s, @resource.disk_filename.to_s))
|
||||
office.conver(convered_file)
|
||||
end
|
||||
end
|
||||
if File.exist?(convered_file) && pdf?(convered_file)
|
||||
send_file convered_file, :type => 'application/pdf; charset=utf-8', :disposition => 'inline'
|
||||
else
|
||||
direct_download_resource
|
||||
end
|
||||
else
|
||||
# 记录用户行为
|
||||
record_user_actions(params[:id])
|
||||
# 直接下载历史版本
|
||||
direct_download_resource
|
||||
end
|
||||
end
|
||||
else
|
||||
render_403 :message => :notice_not_authorized
|
||||
end
|
||||
rescue => e
|
||||
redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html"
|
||||
end
|
||||
|
||||
def direct_download_history
|
||||
@attachment_history = AttachmentHistory.find(params[:id])
|
||||
@attachment_history.increment_download
|
||||
|
|
@ -126,6 +171,8 @@ class AttachmentsController < ApplicationController
|
|||
UserActions.create(:action_id => id, :action_type => "AttachmentHistory", :user_id => User.current.id) unless id.nil?
|
||||
elsif params[:action] == "download"
|
||||
UserActions.create(:action_id => id, :action_type => "Attachment", :user_id => User.current.id) unless id.nil?
|
||||
elsif params[:action] == "download_resource"
|
||||
UserActions.create(:action_id => id, :action_type => "ResourceBank", :user_id => User.current.id) unless id.nil?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -598,6 +598,10 @@ class FilesController < ApplicationController
|
|||
end
|
||||
attachment.description = params[:description]
|
||||
attachment.save
|
||||
resource_bank = ResourceBank.create(:course_id => @course.id, :attachment_id => attachment.id, :filename => attachment.filename, :disk_filename => attachment.disk_filename, :filesize => attachment.filesize, :digest => attachment.digest, :downloads => 0,
|
||||
:user_id => attachment.author_id, :description => attachment.description, :disk_directory => attachment.disk_directory, :is_public => attachment.is_public, :copy_from => attachment.copy_from,
|
||||
:quotes => 1, :applicable_syllabus => @course.syllabus.title, :major_level => @course.syllabus.major_level, :discipline_category_id => @course.syllabus.discipline_category_id, :first_level_discipline_id => @course.syllabus.first_level_discipline_id, :content_type => attachment.content_type)
|
||||
attachment.update_column('resource_bank_id', resource_bank.id)
|
||||
end
|
||||
end
|
||||
if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# encoding: utf-8
|
||||
#encoding: utf-8
|
||||
class SyllabusesController < ApplicationController
|
||||
include ApplicationHelper
|
||||
helper :attachments
|
||||
|
|
@ -7,7 +7,8 @@ class SyllabusesController < ApplicationController
|
|||
|
||||
before_filter :is_logged, :only => [:index, :show, :edit, :new, :update, :destroy, :delete_syllabus, :syllabus_resources, :syllabus_homeworks]
|
||||
before_filter :find_syllabus, :only => [:show, :edit, :update, :destroy, :syllabus_courselist, :edit_syllabus_eng_name, :edit_syllabus_title, :update_base_info, :delete_syllabus,
|
||||
:delete_des, :members, :update_des, :edit_ref, :update_ref, :add_sy_member_alert, :search_not_sy_member, :syllabus_resources, :syllabus_homeworks]
|
||||
:delete_des, :members, :update_des, :edit_ref, :update_ref, :add_sy_member_alert, :search_not_sy_member, :syllabus_resources, :syllabus_homeworks,
|
||||
:send_homeworks_to_course, :choose_user_course, :send_resources_to_course]
|
||||
def index
|
||||
user = User.current
|
||||
@syllabuses = user.syllabuses
|
||||
|
|
@ -17,9 +18,8 @@ class SyllabusesController < ApplicationController
|
|||
@is_syllabus_member = User.current.admin? || @syllabus.syllabus_members.map{|sm| sm.user_id}.include?(User.current.id)
|
||||
@reference_materials = @syllabus.reference_materials
|
||||
@members = @syllabus.syllabus_members.includes(:user => {:user_extensions => []}).order("rank asc")
|
||||
datetime = (Time.now + 6*30*24*60*60).strftime('%Y-%m-%d %H:%M:%S')
|
||||
@courses = @syllabus.courses.where("is_delete = 0 and created_at >= '#{datetime}'").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS ca_update").order("ca_update desc")
|
||||
@end_courses = @syllabus.courses.where("is_delete = 0 and created_at < '#{datetime}'").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS ca_update").order("ca_update desc")
|
||||
@courses = @syllabus.courses.where("is_delete = 0 and is_end = 0").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS ca_update").order("ca_update desc")
|
||||
@end_courses = @syllabus.courses.where("is_delete = 0 and is_end = 1").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS ca_update").order("ca_update desc")
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html{render :layout => 'base_edu_syllabus'}
|
||||
|
|
@ -158,21 +158,135 @@ class SyllabusesController < ApplicationController
|
|||
end
|
||||
|
||||
def syllabus_resources
|
||||
courses = @syllabus.courses
|
||||
@resource_count == 0
|
||||
@public_resource_count = 0
|
||||
@private_resource_count = 0
|
||||
@resources = []
|
||||
@order, @r_sort = params[:order] || "created_at", params[:sort] || "asc"
|
||||
@sort = @r_sort == "desc" ? "asc" : "desc"
|
||||
courses = @syllabus.courses.not_deleted
|
||||
attachments = Attachment.where(:container_type => 'Course', :container_id => courses.map(&:id))
|
||||
@resources = ResourceBank.where(:id => attachments.map(&:resource_bank_id))
|
||||
if @order == "created_at"
|
||||
@resources = @resources.order("#{@order} #{@sort}")
|
||||
else
|
||||
@resources = @resources.select("resource_banks.*, (quotes+downloads) as heat").order("#{@order} #{@sort}, created_at desc")
|
||||
end
|
||||
@resource_count = @resources.count
|
||||
@public_resource_count = @resources.where(:is_public => 1).count
|
||||
@private_resource_count = @resources.where(:is_public => 0).count
|
||||
#分页
|
||||
@limit = 10
|
||||
@is_remote = true
|
||||
@resource_pages = Paginator.new @resource_count, @limit, params['page'] || 1
|
||||
@offset ||= @resource_pages.offset
|
||||
@resources = paginateHelper @resources,@limit
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def syllabus_homeworks
|
||||
@order, @r_sort = params[:order] || "created_at", params[:sort] || "asc"
|
||||
@sort = @r_sort == "desc" ? "asc" : "desc"
|
||||
courses = @syllabus.courses.not_deleted
|
||||
homeworks = HomeworkCommon.where(:course_id => courses.map(&:id))
|
||||
@homeworks = HomeworkBank.where(:id => homeworks.map(&:homework_bank_id)).order("#{@order} #{@sort}")
|
||||
@homework_count = @homeworks.count
|
||||
@public_homework_count = @homeworks.where(:is_public => 1).count
|
||||
@private_homework_count = @homeworks.where(:is_public => 0).count
|
||||
|
||||
@limit = 10
|
||||
@is_remote = true
|
||||
@homework_pages = Paginator.new @homework_count, @limit, params['page'] || 1
|
||||
@offset ||= @homework_pages.offset
|
||||
@homeworks = paginateHelper @homeworks, @limit
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def choose_user_course
|
||||
if !params[:search].nil?
|
||||
search = "%#{params[:search].to_s.strip.downcase}%"
|
||||
@courses = User.current.courses.where("is_delete = 0 and is_end = 0 and (#{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p)",:p=>search).select { |course| User.current.allowed_to?(:as_teacher,course)}
|
||||
else
|
||||
@courses = User.current.courses.where("is_delete = 0 and is_end = 0").select { |course| User.current.allowed_to?(:as_teacher,course)}
|
||||
end
|
||||
@resource_ids = params[:check_resource] if params[:check_resource]
|
||||
@homework_ids = params[:check_homework] if params[:check_homework]
|
||||
@search = params[:search]
|
||||
#这里仅仅是传递需要发送的资源id
|
||||
@type = params[:type]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def send_resources_to_course
|
||||
course = Course.find params[:course_id]
|
||||
if course
|
||||
params[:resource_id].each do |resource_id|
|
||||
resource = ResourceBank.find resource_id
|
||||
atta = Attachment.new(:filename => resource.filename, :disk_filename => resource.disk_filename, :filesize => resource.filesize, :digest => resource.digest, :downloads => 0,
|
||||
:author_id => User.current.id, :description => resource.description, :disk_directory => resource.disk_directory, :is_public => 0, :copy_from => resource.copy_from.nil? ? resource.id : resource.copy_from,
|
||||
:quotes => 0, :resource_bank_id => resource.id, :created_on => Time.now, :content_type =>resource.content_type)
|
||||
if course.attachments << atta
|
||||
# 更新引用次数
|
||||
quotes = resource.quotes.to_i + 1
|
||||
resource.update_attribute(:quotes, quotes)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def send_homeworks_to_course
|
||||
course = Course.find params[:course_id]
|
||||
if course
|
||||
params[:homework_id].each do |homework_id|
|
||||
homework = HomeworkBank.find homework_id
|
||||
new_homework = HomeworkCommon.new(:name => homework.name, :user_id => User.current.id, :description => homework.description, :homework_type => homework.homework_type, :late_penalty => 0,
|
||||
:course_id => course.id, :teacher_priority => 1, :anonymous_comment => 1, :quotes => 0, :is_open => 0,
|
||||
:homework_bank_id => homework.id, :score_open => 1, :anonymous_appeal => 0)
|
||||
|
||||
new_homework.homework_detail_manual = HomeworkDetailManual.new
|
||||
new_homework_detail_manual = new_homework.homework_detail_manual
|
||||
new_homework_detail_manual.te_proportion = 1.0
|
||||
new_homework_detail_manual.ta_proportion = 0
|
||||
new_homework_detail_manual.comment_status = 0
|
||||
new_homework_detail_manual.evaluation_num = 3
|
||||
new_homework_detail_manual.absence_penalty = 0
|
||||
|
||||
if new_homework.homework_type == 2
|
||||
new_homework.homework_detail_programing = HomeworkDetailPrograming.new
|
||||
new_homework.homework_detail_programing.ta_proportion = 0
|
||||
new_homework.homework_detail_programing.language = homework.language
|
||||
homework.homework_bank_tests.each_with_index do |homework_test|
|
||||
if homework_test.test_type
|
||||
new_homework.homework_tests << HomeworkTest.new(
|
||||
input: homework_test.input,
|
||||
output: homework_test.output
|
||||
)
|
||||
else
|
||||
new_homework.homework_samples << HomeworkSample.new(
|
||||
input: homework_test.input,
|
||||
output: homework_test.output
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if new_homework.homework_type == 3
|
||||
new_homework.homework_detail_group = HomeworkDetailGroup.new
|
||||
new_homework.homework_detail_group.min_num = homework.min_num
|
||||
new_homework.homework_detail_group.max_num = homework.max_num
|
||||
new_homework.homework_detail_group.base_on_project = homework.base_on_project
|
||||
end
|
||||
|
||||
if new_homework.save
|
||||
new_homework_detail_manual.save if new_homework_detail_manual
|
||||
new_homework.homework_detail_programing.save if new_homework.homework_detail_programing
|
||||
new_homework.homework_detail_group.save if new_homework.homework_detail_group
|
||||
homework.update_column(:quotes, homework.quotes+1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def delete_syllabus
|
||||
|
|
|
|||
|
|
@ -2694,6 +2694,15 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
|
||||
def resource_bank_candown resource,type
|
||||
candown = false
|
||||
if type == 'syllabus'
|
||||
syllabus = resource.course.syllabus
|
||||
candown = User.current.member_of_syl?(syllabus) || User.current.admin?
|
||||
end
|
||||
candown
|
||||
end
|
||||
|
||||
def attachment_candown attachment
|
||||
candown = false
|
||||
if attachment.container
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#encoding: utf-8
|
||||
class HomeworkBank < ActiveRecord::Base
|
||||
# attr_accessible :title, :body
|
||||
belongs_to :user
|
||||
|
|
@ -7,4 +8,18 @@ class HomeworkBank < ActiveRecord::Base
|
|||
def language_name
|
||||
%W(C C++ Python Java).at(self.language.to_i - 1)
|
||||
end
|
||||
|
||||
#作业类型
|
||||
def homework_type_ch
|
||||
type = self.homework_type
|
||||
case type
|
||||
when 1
|
||||
type = "普通"
|
||||
when 2
|
||||
type = "编程"
|
||||
when 3
|
||||
type = "分组"
|
||||
end
|
||||
type
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/edu-common','css/edu-public', 'css/font-awesome', 'css/edu-class', 'css/edu-popup' %>
|
||||
<%= javascript_include_tag "edu/application",'edu/syllabus' %>
|
||||
<%= javascript_include_tag "edu/application",'edu/base_edu' %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<%= yield :header_tags -%>
|
||||
</head>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
<% if @courses.count > 0 %>
|
||||
<% @courses.each do |course| %>
|
||||
<li class="clearfix">
|
||||
<label class="fl mt5 ml5 edu-class-pop-label edu-color-grey">
|
||||
<input type="radio" class="fl mt8 mr5" name="course_id" value="<%= course.id %>">
|
||||
<span class="edu-info-dark task-hide fl" title="<%= course.name %>"><%= course.name %></span>
|
||||
</label>
|
||||
</li>
|
||||
<% end %>
|
||||
<% else %>
|
||||
|
||||
<% end %>
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<div class="task-popup" style="width:450px;">
|
||||
<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="alert alert-orange mb15 font-12">
|
||||
<button data-dismiss="alert" class="task-close fr" type="button">×</button>
|
||||
选择的题将会发送到指定班级
|
||||
</div>
|
||||
<div class="mb10 edu-position">
|
||||
<input type="hidden" value="<%= @syllabus.id %>" id="syllabu_id">
|
||||
<input class="task-form-100 task-height-40 panel-box-sizing" value="<%= @search %>" id="sy_search_course_input" name="search" placeholder="输入班级名称的关键字进行搜索" type="text" >
|
||||
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt5"><i class="fa fa-search"></i></a>
|
||||
</div>
|
||||
<%= form_tag(send_homeworks_to_course_syllabus_path(@syllabus), :id => 'send_homework_to_course_form', :remote => true, :method => 'post') do %>
|
||||
<div class="clearfix mb15 edu-bg-light-blue edu-max-h200">
|
||||
<% @homework_ids.each do |id| %>
|
||||
<input type="hidden" name="homework_id[]" value="<%= id %>">
|
||||
<% end %>
|
||||
<ul class="" id="search_course_list">
|
||||
<%= render :partial => 'search_course_list' %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
<div>
|
||||
<span class="color-red undis fl" id="search_course_notice_h"></span>
|
||||
<a href="javascript:void(0);" class="task-btn task-btn-blue fr" onclick="submit_send_homework_to_course();">确定</a>
|
||||
<a href="javascript:void(0);" class="pop_close task-btn fr mr10">取消</a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<div class="task-popup" style="width:450px;">
|
||||
<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="alert alert-orange mb15 font-12">
|
||||
<button data-dismiss="alert" class="task-close fr" type="button">×</button>
|
||||
选择的资源将会发送到指定班级
|
||||
</div>
|
||||
<div class="mb10 edu-position">
|
||||
<input type="hidden" value="<%= @syllabus.id %>" id="syllabu_id">
|
||||
<input class="task-form-100 task-height-40 panel-box-sizing" value="<%= @search %>" id="sy_search_course_input" name="search" placeholder="输入班级名称的关键字进行搜索" type="text" >
|
||||
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt5"><i class="fa fa-search"></i></a>
|
||||
</div>
|
||||
<%= form_tag(send_resources_to_course_syllabus_path(@syllabus), :id => 'send_resource_to_course_form', :remote => true, :method => 'post') do %>
|
||||
<div class="clearfix mb15 edu-bg-light-blue edu-max-h200">
|
||||
<% @resource_ids.each do |id| %>
|
||||
<input type="hidden" name="resource_id[]" value="<%= id %>">
|
||||
<% end %>
|
||||
<ul class="" id="search_course_list">
|
||||
<%= render :partial => 'search_course_list' %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
<div>
|
||||
<span class="color-red undis fl" id="search_course_notice"></span>
|
||||
<a href="javascript:void(0);" class="task-btn task-btn-blue fr" onclick="submit_send_resource_to_course();">确定</a>
|
||||
<a href="javascript:void(0);" class="pop_close task-btn fr mr10">取消</a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,42 +1,55 @@
|
|||
<div class="edu-tab-con-box">
|
||||
<div class="panel-bg-grey clearfix color-grey">
|
||||
<p class="fl ml15">共有题:<span class="mr5">6</span>个</p>
|
||||
<p class="fl ml15">公共题:<span class="mr5">6</span>个</p>
|
||||
<p class="fl ml15">私有题:<span class="mr5">6</span>个</p>
|
||||
<a href="#" class=" fr mr15 ">热度排序 </a>
|
||||
<span class="mr5 ml5 fr">|</span>
|
||||
<a href="#" class="fr color-blue">时间排序</a>
|
||||
</div>
|
||||
<ul class="sy_classlist clearfix">
|
||||
<input class="magic-checkbox fl mt5" type="checkbox" name="layout" >
|
||||
<label for="c1" class="fl"></label>
|
||||
<div class="fl ml25">
|
||||
<h3 class="resource_classlist_title fl"><a href="javascript:void(0);">编写一个简单的加法计算器</a></h3><i class="fa fa-lock fl color-grey font-16 mt8 ml5" ></i>
|
||||
<div class="cl"></div>
|
||||
<p class="color-grey font-12">
|
||||
<a href="javascript:void(0);" class="link-name-dark fl">胡莎莎胡莎莎胡莎莎胡</a>
|
||||
<span class=" ml30">创建于</span>
|
||||
<span class=" ml5">2016-05-05 12:00</span>
|
||||
<span class=" ml30">类别: </span><span class="hw_cgrey">编程</span>
|
||||
<span class=" ml30">引用数:</span><span class="hw_cgrey">123</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<ul class="sy_classlist clearfix">
|
||||
<input class="magic-checkbox fl mt5" type="checkbox" name="layout"checked >
|
||||
<label for="c1" class="fl"></label>
|
||||
<div class="fl ml25">
|
||||
<h3 class="resource_classlist_title fl"><a href="javascript:void(0);">编写一个简单的加法计算器</a></h3><i class="fa fa-lock fl color-grey font-16 mt8 ml5" ></i>
|
||||
<div class="cl"></div>
|
||||
<p class="color-grey font-12">
|
||||
<a href="javascript:void(0);" class="link-name-dark fl">胡莎莎胡莎莎胡莎莎胡</a>
|
||||
<span class=" ml30">创建于</span>
|
||||
<span class=" ml5">2016-05-05 12:00</span>
|
||||
<span class=" ml30">类别: </span><span class="hw_cgrey">编程</span>
|
||||
<span class=" ml30">引用数:</span><span class="hw_cgrey">123</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% if @homework_count == 0 %>
|
||||
<img src="../images/bigdata/edu-class/edu-nodata.png" width="200" height="" class="edu-nodata-img">
|
||||
<p class="edu-nodata-p mb30">还没有添加课程题库 ~ </p>
|
||||
<% else %>
|
||||
<div class="panel-bg-grey clearfix color-grey">
|
||||
<p class="fl ml15">共有题:<span class="mr5"><%= @homework_count %></span>个</p>
|
||||
<p class="fl ml15">公共题:<span class="mr5"><%= @public_homework_count %></span>个</p>
|
||||
<p class="fl ml15">私有题:<span class="mr5"><%= @private_homework_count %></span>个</p>
|
||||
|
||||
<%= link_to '热度排序', syllabus_homeworks_syllabus_path(@syllabus,:order => "quotes", :sort => @sort), :class => "fr mr15 #{@order == 'quotes' ? 'color-blue' : ''}", :remote => true %>
|
||||
<span class="mr5 ml5 fr">|</span>
|
||||
<%= link_to '时间排序', syllabus_homeworks_syllabus_path(@syllabus,:order => "created_at", :sort => @sort), :class => "fr #{@order == 'created_at' ? 'color-blue' : ''}", :remote => true %>
|
||||
</div>
|
||||
|
||||
<%= form_tag(choose_user_course_syllabus_path(@syllabus), :id => 'sy_search_course_h_form', :remote => true, :method => 'post') do %>
|
||||
<input type="hidden" value="H" name="type">
|
||||
<% @homeworks.each do |homework| %>
|
||||
<ul class="sy_classlist clearfix">
|
||||
<input class="fl mt5" type="checkbox" value="<%= homework.id %>" name="check_homework[]">
|
||||
<label for="c1" class="fl"></label>
|
||||
<div class="fl ml25">
|
||||
<h3 class="resource_classlist_title fl">
|
||||
<a href="javascript:void(0);"><%= homework.name %></a>
|
||||
</h3>
|
||||
<i class="fa fa-lock fl color-grey font-16 mt8 ml5" ></i>
|
||||
<div class="cl"></div>
|
||||
<p class="color-grey font-12">
|
||||
<%= link_to homework.user.show_name, user_path(homework.user), :class => 'link-name-dark fl' %>
|
||||
<span class=" ml30">创建于</span>
|
||||
<span class=" ml5"><%= format_time homework.created_at %></span>
|
||||
<span class=" ml30">类别:</span><span class="hw_cgrey"><%= homework.homework_type_ch %></span>
|
||||
<span class=" ml30">引用数:</span><span class="hw_cgrey"><%= homework.quotes %></span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<ul class="sy_classlist clearfix">
|
||||
<!--<input class="magic-checkbox" type="checkbox" name="layout" class="fl " checked="">-->
|
||||
<!--<label for="c2" class="fl mr15">全选</label>-->
|
||||
<div class="fl resource_btns_bottom">
|
||||
<a href="javascript:void(0);" onclick="choose_course_to_send_h();" class="fl mr10">发送</a>
|
||||
<span id="choose_course_to_send_notice_h" class="fl color-red undis"></span>
|
||||
</div>
|
||||
<div class="fr pages_right_min">
|
||||
<ul>
|
||||
<%= pagination_links_full @homework_pages, @homework_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</ul>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
@ -8,18 +8,20 @@
|
|||
<p class="fl ml15">公共资源:<span class="mr5"><%= @public_resource_count %></span>个</p>
|
||||
<p class="fl ml15">私有资源:<span class="mr5"><%= @private_resource_count %></span>个</p>
|
||||
|
||||
<%= link_to '热度排序', syllabus_resources_syllabus_path(@syllabus,:order => "heat", :sort => @r_sort), :class => "fr mr15 #{@order == 'heat' ? 'color-blue' : ''}", :remote => true %>
|
||||
<%= link_to '热度排序', syllabus_resources_syllabus_path(@syllabus,:order => "heat", :sort => @sort), :class => "fr mr15 #{@order == 'heat' ? 'color-blue' : ''}", :remote => true %>
|
||||
<span class="mr5 ml5 fr">|</span>
|
||||
<%= link_to '时间排序', syllabus_resources_syllabus_path(@syllabus,:order => "created_at", :sort => @r_sort), :class => "fr #{@order == 'created_at' ? 'color-blue' : ''}", :remote => true %>
|
||||
<%= link_to '时间排序', syllabus_resources_syllabus_path(@syllabus,:order => "created_at", :sort => @sort), :class => "fr #{@order == 'created_at' ? 'color-blue' : ''}", :remote => true %>
|
||||
</div>
|
||||
|
||||
<%= form_tag(choose_user_course_syllabus_path(@syllabus), :id => 'sy_search_course_form', :remote => true, :method => 'post') do %>
|
||||
<input type="hidden" value="R" name="type">
|
||||
<% @resources.each do |resource| %>
|
||||
<ul class="sy_classlist clearfix">
|
||||
<input class="magic-checkbox fl mt5" type="checkbox" name="layout">
|
||||
<input class="fl mt5" type="checkbox" value="<%= resource.id %>" name="check_resource[]">
|
||||
<label for="c1" class="fl"></label>
|
||||
<div class="fl ml25">
|
||||
<h3 class="resource_classlist_title fl">
|
||||
<%= link_to resource.filename, download_named_attachment_path(resource.id, resource.filename), :title => resource.filename %>
|
||||
<%= link_to resource.filename, download_resource_attachment_path(resource.id, resource.filename, :type => 'syllabus'), :title => resource.filename %>
|
||||
</h3>
|
||||
<% unless resource.is_public %>
|
||||
<i class="fa fa-lock fl color-grey font-16 mt8 ml5" ></i>
|
||||
|
|
@ -28,7 +30,7 @@
|
|||
<p class="color-grey font-12">
|
||||
<%= link_to resource.user.show_name, user_path(resource.user), :class => 'link-name-dark fl' %>
|
||||
<span class="ml30">上传于</span>
|
||||
<span class="ml5"><%= format_date resource.created_at %>2016-05-05 12:00</span>
|
||||
<span class="ml5"><%= format_time resource.created_at %></span>
|
||||
<span class="ml30">大小:</span><span class="hw_cgrey"><%= (number_to_human_size(resource.filesize)).gsub("ytes", "") %></span>
|
||||
<span class="ml30">下载数:</span><span class="hw_cgrey"><%= resource.downloads %></span>
|
||||
<span class="ml30">引用数:</span><span class="hw_cgrey"><%= resource.quotes %></span>
|
||||
|
|
@ -37,12 +39,13 @@
|
|||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<ul class="sy_classlist clearfix">
|
||||
<!--<input class="magic-checkbox" type="checkbox" name="layout" class="fl " checked="">-->
|
||||
<!--<label for="c2" class="fl mr15">全选</label>-->
|
||||
<div class="fl resource_btns_bottom">
|
||||
<a href="javascript:void(0);" class="fl mr10">发送</a>
|
||||
<a href="javascript:void(0);" class="fl">下载</a>
|
||||
<a href="javascript:void(0);" onclick="choose_course_to_send();" class="fl mr10">发送</a>
|
||||
<span id="choose_course_to_send_notice" class="fl color-red undis"></span>
|
||||
</div>
|
||||
<div class="fr pages_right_min">
|
||||
<ul>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
<% if params[:is_observe].nil? %>
|
||||
<% if @type == 'R' %>
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'sy_send_resource') %>";
|
||||
<% else %>
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'sy_send_homework') %>";
|
||||
<% end %>
|
||||
pop_box_new(htmlvalue, 452, 463);
|
||||
<% else %>
|
||||
$("#search_course_list").html("<%= escape_javascript(render :partial => 'search_course_list') %>");
|
||||
<% end %>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
yes_notice_box("题目已经发送到指定班级");
|
||||
$.ajax({
|
||||
url: '<%= syllabus_homeworks_syllabus_path(@syllabus) %>',
|
||||
type: 'get',
|
||||
success: function(data){
|
||||
}
|
||||
});
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
yes_notice_box("资源已经发送到指定班级");
|
||||
$.ajax({
|
||||
url: '<%= syllabus_resources_syllabus_path(@syllabus) %>',
|
||||
type: 'get',
|
||||
success: function(data){
|
||||
}
|
||||
});
|
||||
|
|
@ -49,17 +49,16 @@
|
|||
<a href="javascript:void(0);" class="tab_type">授课大纲</a>
|
||||
<span class="edu-tab-fa"><i class="fa fa-caret-down" ></i></span>
|
||||
</li>
|
||||
<%# if @is_syllabus_member %>
|
||||
<!--<li id="edu-tab-nav-2" onclick="HoverLi(2);">-->
|
||||
<!--<%#= link_to '课程资源库', %>-->
|
||||
<!--<a href="javascript:void(0);" class="tab_type">课程资源库</a>-->
|
||||
<!--<span class="edu-tab-fa"><i class="fa fa-caret-down"></i></span>-->
|
||||
<!--</li>-->
|
||||
<!--<li id="edu-tab-nav-3" onclick="HoverLi(3);">-->
|
||||
<!--<a href="javascript:void(0);" class="tab_type">课程题库</a>-->
|
||||
<!--<span class="edu-tab-fa"><i class="fa fa-caret-down" ></i></span>-->
|
||||
<!--</li>-->
|
||||
<%# end %>
|
||||
<% if @is_syllabus_member %>
|
||||
<li id="edu-tab-nav-2">
|
||||
<%= link_to '课程资源库', syllabus_resources_syllabus_path(@syllabus), :remote => true, :class => 'tab_type' %>
|
||||
<span class="edu-tab-fa"><i class="fa fa-caret-down"></i></span>
|
||||
</li>
|
||||
<li id="edu-tab-nav-3">
|
||||
<%= link_to '课程题库', syllabus_homeworks_syllabus_path(@syllabus), :remote => true, :class => 'tab_type' %>
|
||||
<span class="edu-tab-fa"><i class="fa fa-caret-down" ></i></span>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<div id="edu-tab-con-1">
|
||||
|
|
@ -74,7 +73,6 @@
|
|||
</div>
|
||||
</div>
|
||||
<div id="edu-tab-con-2" class="undis">
|
||||
<%#= render :partial => 'syllabus_resources', :locals => {:resources => nil} %>
|
||||
</div>
|
||||
<div id="edu-tab-con-3" class="undis">
|
||||
<%#= render :partial => 'syllabus_homeworks', :locals => {:homeworks => nil} %>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
$("#edu-tab-con-3").html("<%= escape_javascript(render :partial => 'syllabus_homeworks') %>");
|
||||
document.getElementById('edu-tab-nav-1').className='edu-tab-nomal';
|
||||
document.getElementById('edu-tab-nav-2').className='edu-tab-nomal';
|
||||
document.getElementById('edu-tab-con-1').className='undis';
|
||||
document.getElementById('edu-tab-con-2').className='undis';
|
||||
document.getElementById('edu-tab-nav-3').className='edu-tab-hover';
|
||||
document.getElementById('edu-tab-con-3').className='dis';
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
$("#edu-tab-con-2").html("<%= escape_javascript(render :partial => 'syllabus_resources') %>");
|
||||
document.getElementById('edu-tab-nav-1').className='edu-tab-nomal';
|
||||
document.getElementById('edu-tab-nav-3').className='edu-tab-nomal';
|
||||
document.getElementById('edu-tab-con-1').className='undis';
|
||||
document.getElementById('edu-tab-con-3').className='undis';
|
||||
document.getElementById('edu-tab-nav-2').className='edu-tab-hover';
|
||||
document.getElementById('edu-tab-con-2').className='dis';
|
||||
|
|
@ -1322,6 +1322,7 @@ RedmineApp::Application.routes.draw do
|
|||
get 'attachments/attachment_history_download/:id',:to=>'attachments#attachment_history_download',:as=>'attachment_history_download'
|
||||
post 'attachments/upload_attachment_version',:to=>'attachments#upload_attachment_version',:as=>'upload_attachment_version'
|
||||
get 'attachments/download/:id/:filename', :to => 'attachments#download', :id => /\d+/, :filename => /.*/, :as => 'download_named_attachment'
|
||||
get 'attachments/download_resource/:id/:filename', :to => 'attachments#download_resource', :id => /\d+/, :filename => /.*/, :as => 'download_resource_attachment'
|
||||
get 'attachments/download_history/:id/:filename', :to => 'attachments#download_history', :id => /\d+/, :filename => /.*/, :as => 'download_history_attachment'
|
||||
get 'attachments/download/:id', :to => 'attachments#download', :id => /\d+/, :as => 'download_attachment'
|
||||
get 'attachments/thumbnail/:id(/:size)', :to => 'attachments#thumbnail', :id => /\d+/, :size => /\d+/, :as => 'thumbnail'
|
||||
|
|
@ -1467,6 +1468,9 @@ RedmineApp::Application.routes.draw do
|
|||
post 'search_not_sy_member'
|
||||
get 'syllabus_homeworks'
|
||||
get 'syllabus_resources'
|
||||
post 'choose_user_course'
|
||||
post 'send_resources_to_course'
|
||||
post 'send_homeworks_to_course'
|
||||
end
|
||||
|
||||
collection do
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
class UpdateBankCreatedAt < ActiveRecord::Migration
|
||||
def up
|
||||
add_column :resource_banks, :content_type, :string
|
||||
|
||||
count =ResourceBank.all.count / 30 + 2
|
||||
transaction do
|
||||
for i in 1 ... count do i
|
||||
ResourceBank.page(i).per(30).each do |resource|
|
||||
atta = Attachment.find resource.attachment_id
|
||||
resource.update_column('created_at', atta.created_on) if atta
|
||||
resource.update_attributes(:created_at => atta.created_on, :content_type => atta.content_type) if atta
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
class AddColumnsToCourse < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :courses, :credit, :integer
|
||||
add_column :courses, :is_end, :boolean, :default => false
|
||||
add_column :courses, :end_date, :date
|
||||
|
||||
count =Course.all.count / 30 + 2
|
||||
transaction do
|
||||
for i in 1 ... count do i
|
||||
Course.page(i).per(30).each do |course|
|
||||
course_act = course.course_activities.order("updated_at desc").first
|
||||
if course_act && course_act.updated_at > (Time.now - 6*30*24*60*60).strftime('%Y-%m-%d %H:%M:%S')
|
||||
course.update_column("end_date", "2017-12-30")
|
||||
else
|
||||
course.update_column("end_date", "2017-01-01")
|
||||
course.update_column("is_end", true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -194,6 +194,14 @@ function long_notice_box(str){
|
|||
pop_box_new(htmlvalue, 480, 140);
|
||||
}
|
||||
|
||||
// 长提示框:只有一个“知道啦”按钮,点击关闭弹框
|
||||
function yes_notice_box(str){
|
||||
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">' + str + '</p></div><div class="task-popup-sure clearfix">'+
|
||||
'<a href="javascript:void(0);" class="task-btn task-btn-blue" onclick="hideModal();">知道啦</a></div></div>';
|
||||
pop_box_new(htmlvalue, 575, 200);
|
||||
}
|
||||
|
||||
//提示框:只有一个确定按钮,点击跳转
|
||||
function notice_box_redirect(url, str){
|
||||
var htmlvalue = '<div class="task-popup" style="width:400px;"><div class="task-popup-title clearfix"><h3 class="fl color-grey">提示</h3><a href="'+ url +'" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a></div>'+
|
||||
|
|
|
|||
|
|
@ -0,0 +1,121 @@
|
|||
$(function(){
|
||||
$("#major_level").on("change", function(){
|
||||
$.ajax({
|
||||
url: '/syllabuses/get_discipline_categories',
|
||||
type: 'get',
|
||||
data: {major_level:$("#major_level").val()},
|
||||
success: function(data){
|
||||
if (data.result == 1){
|
||||
$("#discipline_category_id").html("<option value='0'>选择课程所属学科门类</option>");
|
||||
for(var i=0; i<data.options.length; i++){
|
||||
$("#discipline_category_id").append("<option value='" + data.options[i][1] + "'>" + data.options[i][0] + "</option>");
|
||||
}
|
||||
$("#major_level_notice").hide();
|
||||
}
|
||||
else{
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#discipline_category_id").on("change", function(){
|
||||
$.ajax({
|
||||
url: '/syllabuses/get_first_level_disciplines',
|
||||
type: 'get',
|
||||
data: {discipline_category_id:$("#discipline_category_id").val()},
|
||||
success: function(data){
|
||||
if (data.result == 1){
|
||||
$("#first_level_discipline_id").html("<option value='0'>选择课程所属一级学科</option>");
|
||||
for(var i=0; i<data.options.length; i++){
|
||||
$("#first_level_discipline_id").append("<option value='" + data.options[i][1] + "'>" + data.options[i][0] + "</option>");
|
||||
}
|
||||
$("#discipline_category_id_notice").hide();
|
||||
}
|
||||
else{
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#first_level_discipline_id").on("change", function(){
|
||||
if($("#first_level_discipline_id").val() != "0"){
|
||||
$("#first_level_discipline_id_notice").hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function regex_syllabus_name() {
|
||||
var name = $.trim($("#new_syllabus_name").val());
|
||||
if(name.length < 2)
|
||||
{
|
||||
$("#new_syllabus_name_notice").show();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#new_syllabus_name_notice").hide();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//新建课程
|
||||
function submit_new_syllabus()
|
||||
{
|
||||
if($("#major_level").val() == "0"){
|
||||
$("#major_level_notice").show();
|
||||
} else if($("#discipline_category_id").val() == "0"){
|
||||
$("#discipline_category_id_notice").show();
|
||||
} else if($("#first_level_discipline_id").val() == "0"){
|
||||
$("#first_level_discipline_id_notice").show();
|
||||
} else {
|
||||
if(regex_syllabus_name())
|
||||
{
|
||||
$.ajax({
|
||||
url: '/syllabuses/regex_syllabus_name',
|
||||
type: 'post',
|
||||
data: {name:$.trim($("#new_syllabus_name").val())},
|
||||
success: function(data){
|
||||
if (data.result == 0){
|
||||
$("#new_syllabus_name_repeat_notice").show();
|
||||
$("#new_syllabus_name_notice").hide();
|
||||
}
|
||||
else{
|
||||
$("#new_syllabus").submit();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//编辑课程
|
||||
function submit_edit_syllabus(id)
|
||||
{
|
||||
if($("#major_level").val() == "0"){
|
||||
$("#major_level_notice").show();
|
||||
} else if($("#discipline_category_id").val() == "0"){
|
||||
$("#discipline_category_id_notice").show();
|
||||
} else if($("#first_level_discipline_id").val() == "0"){
|
||||
$("#first_level_discipline_id_notice").show();
|
||||
} else {
|
||||
if(regex_syllabus_name())
|
||||
{
|
||||
$.ajax({
|
||||
url: '/syllabuses/regex_syllabus_name',
|
||||
type: 'post',
|
||||
data: {name:$.trim($("#new_syllabus_name").val()), syllabus_id:id},
|
||||
success: function(data){
|
||||
if (data.result == 0){
|
||||
$("#new_syllabus_name_repeat_notice").show();
|
||||
$("#new_syllabus_name_notice").hide();
|
||||
}
|
||||
else{
|
||||
$("#edit_syllabus").submit();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,127 +1,5 @@
|
|||
var syMemberLastSearchCondition = '';
|
||||
|
||||
$(function(){
|
||||
$("#major_level").on("change", function(){
|
||||
$.ajax({
|
||||
url: '/syllabuses/get_discipline_categories',
|
||||
type: 'get',
|
||||
data: {major_level:$("#major_level").val()},
|
||||
success: function(data){
|
||||
if (data.result == 1){
|
||||
$("#discipline_category_id").html("<option value='0'>选择课程所属学科门类</option>");
|
||||
for(var i=0; i<data.options.length; i++){
|
||||
$("#discipline_category_id").append("<option value='" + data.options[i][1] + "'>" + data.options[i][0] + "</option>");
|
||||
}
|
||||
$("#major_level_notice").hide();
|
||||
}
|
||||
else{
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#discipline_category_id").on("change", function(){
|
||||
$.ajax({
|
||||
url: '/syllabuses/get_first_level_disciplines',
|
||||
type: 'get',
|
||||
data: {discipline_category_id:$("#discipline_category_id").val()},
|
||||
success: function(data){
|
||||
if (data.result == 1){
|
||||
$("#first_level_discipline_id").html("<option value='0'>选择课程所属一级学科</option>");
|
||||
for(var i=0; i<data.options.length; i++){
|
||||
$("#first_level_discipline_id").append("<option value='" + data.options[i][1] + "'>" + data.options[i][0] + "</option>");
|
||||
}
|
||||
$("#discipline_category_id_notice").hide();
|
||||
}
|
||||
else{
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#first_level_discipline_id").on("change", function(){
|
||||
if($("#first_level_discipline_id").val() != "0"){
|
||||
$("#first_level_discipline_id_notice").hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function regex_syllabus_name() {
|
||||
var name = $.trim($("#new_syllabus_name").val());
|
||||
if(name.length < 2)
|
||||
{
|
||||
$("#new_syllabus_name_notice").show();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#new_syllabus_name_notice").hide();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//新建课程
|
||||
function submit_new_syllabus()
|
||||
{
|
||||
if($("#major_level").val() == "0"){
|
||||
$("#major_level_notice").show();
|
||||
} else if($("#discipline_category_id").val() == "0"){
|
||||
$("#discipline_category_id_notice").show();
|
||||
} else if($("#first_level_discipline_id").val() == "0"){
|
||||
$("#first_level_discipline_id_notice").show();
|
||||
} else {
|
||||
if(regex_syllabus_name())
|
||||
{
|
||||
$.ajax({
|
||||
url: '/syllabuses/regex_syllabus_name',
|
||||
type: 'post',
|
||||
data: {name:$.trim($("#new_syllabus_name").val())},
|
||||
success: function(data){
|
||||
if (data.result == 0){
|
||||
$("#new_syllabus_name_repeat_notice").show();
|
||||
$("#new_syllabus_name_notice").hide();
|
||||
}
|
||||
else{
|
||||
$("#new_syllabus").submit();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//编辑课程
|
||||
function submit_edit_syllabus(id)
|
||||
{
|
||||
if($("#major_level").val() == "0"){
|
||||
$("#major_level_notice").show();
|
||||
} else if($("#discipline_category_id").val() == "0"){
|
||||
$("#discipline_category_id_notice").show();
|
||||
} else if($("#first_level_discipline_id").val() == "0"){
|
||||
$("#first_level_discipline_id_notice").show();
|
||||
} else {
|
||||
if(regex_syllabus_name())
|
||||
{
|
||||
$.ajax({
|
||||
url: '/syllabuses/regex_syllabus_name',
|
||||
type: 'post',
|
||||
data: {name:$.trim($("#new_syllabus_name").val()), syllabus_id:id},
|
||||
success: function(data){
|
||||
if (data.result == 0){
|
||||
$("#new_syllabus_name_repeat_notice").show();
|
||||
$("#new_syllabus_name_notice").hide();
|
||||
}
|
||||
else{
|
||||
$("#edit_syllabus").submit();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function g(o){return document.getElementById(o);}
|
||||
function HoverLi(n){
|
||||
for(var i=1;i<=3;i++){
|
||||
|
|
@ -176,6 +54,10 @@ $(function(){
|
|||
$("#add_member_search_input").live('input', function(e){
|
||||
throttle(sy_member_add_search, window, e);
|
||||
});
|
||||
|
||||
$("#sy_search_course_input").live('input', function (e) {
|
||||
throttle(sy_search_courses,window,e);
|
||||
});
|
||||
});
|
||||
|
||||
function delete_sy_member(id) {
|
||||
|
|
@ -214,6 +96,59 @@ function sy_member_add_search(e){
|
|||
});
|
||||
}
|
||||
|
||||
function choose_course_to_send(){
|
||||
if($("input[name='check_resource[]']:checked").length >= 1){
|
||||
$("#choose_course_to_send_notice").html("").hide();
|
||||
$("#sy_search_course_form").submit();
|
||||
}else{
|
||||
$("#choose_course_to_send_notice").html("请先选择资源").show();
|
||||
}
|
||||
}
|
||||
|
||||
function choose_course_to_send_h(){
|
||||
if($("input[name='check_homework[]']:checked").length >= 1){
|
||||
$("#choose_course_to_send_notice_h").html("").hide();
|
||||
$("#sy_search_course_h_form").submit();
|
||||
}else{
|
||||
$("#choose_course_to_send_notice_h").html("请先选择作业").show();
|
||||
}
|
||||
}
|
||||
|
||||
var lastSearchCondition = '';
|
||||
function sy_search_courses(e){
|
||||
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
|
||||
{
|
||||
return;
|
||||
}
|
||||
lastSearchCondition = $(e.target).val().trim();
|
||||
$.ajax({
|
||||
url: '/syllabuses/' + $("#syllabu_id").val() + '/choose_user_course',
|
||||
type:'post',
|
||||
data: {is_observe:true, search:e.target.value},
|
||||
success: function(data){ }
|
||||
});
|
||||
}
|
||||
|
||||
function submit_send_resource_to_course(){
|
||||
if($("input[name='course_id']:checked").length >= 1){
|
||||
$("#search_course_notice").html("").hide();
|
||||
$("#send_resource_to_course_form").submit();
|
||||
hideModal();
|
||||
}else{
|
||||
$("#search_course_notice").html("请先选择一个班级").show();
|
||||
}
|
||||
}
|
||||
|
||||
function submit_send_homework_to_course(){
|
||||
if($("input[name='course_id']:checked").length >= 1){
|
||||
$("#search_course_notice_h").html("").hide();
|
||||
$("#send_homework_to_course_form").submit();
|
||||
hideModal();
|
||||
}else{
|
||||
$("#search_course_notice_h").html("请先选择一个班级").show();
|
||||
}
|
||||
}
|
||||
|
||||
$(function(){
|
||||
var bt = baidu.template;
|
||||
bt.LEFT_DELIMITER = '<!';
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ position:absolute;left:-420px;top:0;}
|
|||
.col-width-1{ max-width: 10%; background: #fff; border:1px solid #e8e8e8;}
|
||||
/*按钮*/
|
||||
a.task-btn{display: inline-block;border:none; padding:0 35px;color: #666;background: #e1e1e1; text-align:center;font-size: 12px; height: 35px;line-height: 35px; border-radius:3px;}
|
||||
a:hover.task-btn {background: #c3c3c3; }
|
||||
a:hover.task-btn {background: #c3c3c3; color: #666;}
|
||||
a.task-btn-green{background: #29bd8b; color: #fff!important;}
|
||||
a:hover.task-btn-green{background: #19b17e;}
|
||||
a.task-btn-orange{ background:#fc8675; color:#fff !important;}
|
||||
|
|
|
|||
|
|
@ -156,7 +156,8 @@ a.panel-table-title{display:block; max-width:240px;text-align:center;}
|
|||
/* 翻页*/
|
||||
.pages_right_min a{ display: inline-block;border:1px solid #d1d1d1; color:#888; float:left;text-align:center; padding:3px 10px; line-height:1.9; border-right: none;}
|
||||
.pages_right_min a.pages-border-right{border-right:1px solid #ccc; }
|
||||
.pages_right_min a:hover,.pages_right a.active{ background-color:#ccc; color:#fff;}
|
||||
.pages_right_min a:hover,.pages_right_min a.active{ background-color:#ccc; color:#fff;}
|
||||
.pages_right_min li{float: left;}
|
||||
/* 搜索*/
|
||||
.panel-search{ position: relative;}
|
||||
input.panel-search-input{ height: 30px; width:300px; color: #666;}
|
||||
|
|
|
|||
Loading…
Reference in New Issue