Merge branch 'dev_xucheng' into develop

This commit is contained in:
cxt 2017-08-18 14:01:10 +08:00
commit 0d6746b5c2
16 changed files with 1759 additions and 1526 deletions

File diff suppressed because it is too large Load Diff

View File

@ -69,12 +69,13 @@ end
# 增加课程所属专业
def add_major
if prams[:major] && params[:major] != 0
major = MajorCourse.create(:course_list_id=> "15",:major_id => "#{params[:major]}")
data = {result: 0}
id = MajorCourse.where(:course_list_id => params[:course_list_id]).first
if (id.nil?) || (params[:major_id].to_i != '0' && params[:major_id].to_i != id.major_id)
MajorCourse.create(:course_list_id => params[:course_list_id],:major_id=>params[:major_id])
data[:result] = 1
end
redirect_to applicable_course_managements_path
render :json => data
end
# 单位部门列表
@ -132,7 +133,7 @@ end
@menu_type = 10
@sub_type = 3
search = params[:search]
@apply_status = ApplyAddDepartment.where("0=0")
@apply_status = ApplyAddDepartment.where(:status=>0)
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
if search.blank?
@apply_status = @apply_status.where("0=0")
@ -158,7 +159,7 @@ end
@sub_type = 4
search = params[:search]
@sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order]
@apply_status = ApplyAddSchools.where("0=0")
@apply_status = ApplyAddSchools.where(:status=>0)
if search.blank?
@apply_status = @apply_status.where("0=0")
else
@ -176,6 +177,69 @@ end
format.html
end
end
# 单位审批批准
def approve_applied_schools
applied_school = ApplyAddSchools.where(:id =>params[:id]).first
applied_message_id = applied_school.school_id
applied_message = AppliedMessage.where(:applied_id => applied_message_id, :applied_type => "ApplyAddSchools")
applied_message.update_all(:status => 1)
unless applied_school.nil?
applied_school.update_column('status', 1)
end
school = applied_school.school
school.update_attribute("province", applied_school.province)
AppliedMessage.create(:user_id => applied_school.user_id, :status => 1, :viewed => 0, :applied_id => applied_school.id, :applied_type => "ApplyAddSchools", :name => applied_school.name )
redirect_to unit_managements_path
end
# 单位审批修改
def all_schools
apply_schools = ApplyAddSchools.where("status = 0")
apply_school_ids = apply_schools.empty? ? "(-1)" : "(" + apply_schools.map{|sc| sc.school_id}.join(',') + ")"
if !params[:search].nil?
search = "%#{params[:search].to_s.strip.downcase}%"
@schools = School.where("id not in #{apply_school_ids} and #{School.table_name}.name like :p", :p => search)
#@schools = School.all
else
#@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id}").select { |course| @user.allowed_to?(:as_teacher,course)}
@schools = School.where("id not in #{apply_school_ids}")
end
@edit_id = params[:school_id]
@search = params[:search]
respond_to do |format|
format.js
end
# redirect_to unit_managements_path
end
# 修改
def edit_applied_schools
aas = ApplyAddSchools.find(params[:applied_id])
# aas.update_attribute(:name, params[:name])
#applied_add_school = ApplyAddSchools.where(:name => aas.name)
school = School.find params[:school_id]
begin
#更新消息表的status
applied_message_id = aas.school_id
applied_message = AppliedMessage.where(:applied_id => applied_message_id, :applied_type => "ApplyAddSchools")
applied_message.update_all(:status => 4)
aas.update_attribute(:status, 2)
AppliedMessage.create(:user_id => aas.user_id, :status => 2, :viewed => 0, :applied_id => aas.id, :applied_type => "ApplyAddSchools", :name => school[0].name )
users = UserExtensions.where("school_id = #{aas.school_id}")
users.update_all(:school_id => school.id)
if aas.school_id != school.id.to_i
aas.school.destroy
end
ApplyAddDepartment.where(:school_id => aas.school_id).update_all(:school_id => school.id)
Department.where(:school_id => aas.school_id).update_all(:school_id => school.id)
aas.update_attribute(:school_id, school.id)
rescue Exception => e
puts e
end
# applied_schools = ApplyAddSchools.find params[:applied_id]
# applied_schools.update_column('name', params[:name])
redirect_to unit_managements_path
end
# 部门修改
# 课堂列表
def classroom
@ -250,7 +314,7 @@ end
@keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/课程名搜索
status = params[:status].to_i
if params[:school_id] && params[:school_id] != '0'
if params[:school_id] && params[:school_id] != ''
@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

View File

@ -1,298 +1,298 @@
# Redmine - project management software
# Copyright (C) 2006-2013 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WelcomeController < ApplicationController
# layout "base_welcome"
include ApplicationHelper
include WelcomeHelper
helper :project_score
caches_action :robots, :course, :contest, expires_in: 2.hours, layout: false
#before_filter :find_first_page, :only => [:index]
# before_filter :fake, :only => [:index, :course]
before_filter :entry_select, :only => [:index]
skip_before_filter :check_authentication, :only => [:index]
def index
# @welcome是因为有的页面不需要导航
@welcome = true
@courses = Course.where(:is_excellent => 1).limit(6)
@shixuns = Shixun.where(:authentication => 1).limit(6)
render :layout => 'login_bigdata'
end
def robots
@projects = Project.all_public.active
render :layout => false, :content_type => 'text/plain'
end
def course
redirect_to signin_path
return
#
# @course_page = FirstPage.find_by_page_type('course')
# @school_id = params[:school_id] || User.current.user_extensions.school.try(:id) || 117
# @logoLink ||= logolink()
end
def logolink()
@course_page = FirstPage.find_by_page_type('course')
logo = get_avatar?(@course_page)
id = params[:school_id]
logo_link = ""
if id.nil? && (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?)
if logo
logo_link = url_to_avatar(@course_page)
else
logo_link = '/images/transparent.png'
end
else
if id == "0"
if logo
logo_link = url_to_avatar(@course_page)
else
logo_link = '/images/transparent.png'
end
else
if id.nil?
if School.find(User.current.user_extensions.school.id).logo_link.nil?
logo_link = '/images/transparent.png'
else
logo_link = School.find(User.current.user_extensions.school.id).logo_link
end
else
logo_link = School.find(id).logo_link
end
end
end
return logo_link
end
def contest
redirect_to signin_path
return
# @contest_page = FirstPage.find_by_page_type('contest')
# @contest_notifications = Contestnotification.order("created_at desc").limit(5)
end
def search
@name = params[:q]
@search_type = params[:search_type]
page = (params[:page] || 1).to_i
@users_count = User.search(@name).results.total
@syllabus_count = Syllabus.search(@name).results.total
@course_count = Course.search(@name).results.total
@attach_count = Attachment.search(@name).results.total
@project_count = Project.search(@name).results.total
@memo_count = Memo.search(@name).results.total
@total_count = Elasticsearch::Model.search({
query: {
multi_match: {
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','title','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
pre_tags: ['<span class="c_red">'],
post_tags: ['</span>'],
fields: {
login: {},
firstname: {},
lastname: {},
title:{},
name:{},
description:{},
filename:{},
subject:{},
content:{}
}
}
},[User,Syllabus,Course,Attachment,Project,Memo] ).results.total
case params[:search_type]
when 'all'
if (page-1)*20 >= @total_count
page = 1
params[:page] = "1"
end
@alls = Elasticsearch::Model.search({
query: {
multi_match: {
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','title','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
pre_tags: ['<span class="c_red">'],
post_tags: ['</span>'],
fields: {
login: {},
firstname: {},
lastname: {},
title:{},
name:{},
description:{},
filename:{},
subject:{},
content:{}
}
}
},[User,Syllabus,Course,Attachment,Project,Memo] ).page(page).per(20).results
when 'user'
if (page-1)*20 >= @users_count
page = 1
params[:page] = "1"
end
@users = User.search(@name).page(page).per(20)
when 'syllabus'
if (page-1)*20 >= @syllabus_count
page = 1
params[:page] = "1"
end
@syllabuses = Syllabus.search(@name).page(page).per(20).results
when 'project'
if (page-1)*20 >= @project_count
page = 1
end
@projects = Project.search(@name).page(page).per(20).results
when 'course'
if (page-1)*20 >= @course_count
page = 1
params[:page] = "1"
end
@courses = Course.search(@name).page(page).per(20).results
when 'attachment'
if (page-1)*20 >= @attach_count
page = 1
params[:page] = "1"
end
@attachments = Attachment.search(@name).page(page).per(20).results
when 'memo'
if (page-1)*20 >= @memo_count
page = 1
params[:page] = "1"
end
@memos = Memo.search(@name).page(page).per(20).results
else
if (page-1)*20 >= @total_count
page = 1
params[:page] = "1"
end
@alls = Elasticsearch::Model.search({
query: {
multi_match: {
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','title','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
pre_tags: ['<span class="c_red">'],
post_tags: ['</span>'],
fields: {
login: {},
firstname: {},
lastname: {},
title:{},
name:{},
description:{},
filename:{},
subject:{},
content:{}
}
}
},[User,Syllabus,Course,Attachment,Project,Memo] ).page(page).per(20).results
end
# search_type = params[:search_type].to_sym unless search_condition.blank?
# search_by = params[:search_by]
#
# if search_type.nil? && params[:contests_search] && params[:name] != ""
# search_type = :contests
# search_condition = params[:name]
# end
respond_to do |format|
format.js
format.html{ render :layout=>'users_base'}
end
end
private
# 判断网站的入口,是课程 course 则跳过index去渲染 course 方法
def entry_select
# url = request.original_url.gsub('/','')
# if url.include?(Setting.url_course.gsub('/',''))
# if @first_page.show_course == 1
# course
# render :course
# else
# render_404
# end
#
# return 0
# elsif url.include?(Setting.url_contest.gsub('/',''))
# if @first_page.show_contest == 1
# contest
# render :contest
# else
# render_404
# end
#
# return 0
# elsif url.include?(Setting.url_user.gsub('/',''))
# #redirect_to(:controller => "users", :action => "index")
# end
end
# def render(*args)
# _fake if @fake_filter
# super
# end
# private
# def fake
# @fake_filter = true
# end
# # 骗子方法
# def _fake
# instance_variables.map { |variable|
# if variable.to_s =~ /Count$/
# self.instance_variable_set(variable.to_sym,
# ("1" + (self.instance_variable_get(variable.to_sym).to_s)).to_i)
# end
# }
# end
end
# Redmine - project management software
# Copyright (C) 2006-2013 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WelcomeController < ApplicationController
# layout "base_welcome"
include ApplicationHelper
include WelcomeHelper
helper :project_score
caches_action :robots, :course, :contest, expires_in: 2.hours, layout: false
#before_filter :find_first_page, :only => [:index]
# before_filter :fake, :only => [:index, :course]
before_filter :entry_select, :only => [:index]
skip_before_filter :check_authentication, :only => [:index]
def index
# @welcome是因为有的页面不需要导航
@welcome = true
@courses = Course.where(:homepage_show => 1).limit(6)
@shixuns = Shixun.where(:homepage_show => 1).limit(6)
render :layout => 'login_bigdata'
end
def robots
@projects = Project.all_public.active
render :layout => false, :content_type => 'text/plain'
end
def course
redirect_to signin_path
return
#
# @course_page = FirstPage.find_by_page_type('course')
# @school_id = params[:school_id] || User.current.user_extensions.school.try(:id) || 117
# @logoLink ||= logolink()
end
def logolink()
@course_page = FirstPage.find_by_page_type('course')
logo = get_avatar?(@course_page)
id = params[:school_id]
logo_link = ""
if id.nil? && (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?)
if logo
logo_link = url_to_avatar(@course_page)
else
logo_link = '/images/transparent.png'
end
else
if id == "0"
if logo
logo_link = url_to_avatar(@course_page)
else
logo_link = '/images/transparent.png'
end
else
if id.nil?
if School.find(User.current.user_extensions.school.id).logo_link.nil?
logo_link = '/images/transparent.png'
else
logo_link = School.find(User.current.user_extensions.school.id).logo_link
end
else
logo_link = School.find(id).logo_link
end
end
end
return logo_link
end
def contest
redirect_to signin_path
return
# @contest_page = FirstPage.find_by_page_type('contest')
# @contest_notifications = Contestnotification.order("created_at desc").limit(5)
end
def search
@name = params[:q]
@search_type = params[:search_type]
page = (params[:page] || 1).to_i
@users_count = User.search(@name).results.total
@syllabus_count = Syllabus.search(@name).results.total
@course_count = Course.search(@name).results.total
@attach_count = Attachment.search(@name).results.total
@project_count = Project.search(@name).results.total
@memo_count = Memo.search(@name).results.total
@total_count = Elasticsearch::Model.search({
query: {
multi_match: {
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','title','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
pre_tags: ['<span class="c_red">'],
post_tags: ['</span>'],
fields: {
login: {},
firstname: {},
lastname: {},
title:{},
name:{},
description:{},
filename:{},
subject:{},
content:{}
}
}
},[User,Syllabus,Course,Attachment,Project,Memo] ).results.total
case params[:search_type]
when 'all'
if (page-1)*20 >= @total_count
page = 1
params[:page] = "1"
end
@alls = Elasticsearch::Model.search({
query: {
multi_match: {
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','title','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
pre_tags: ['<span class="c_red">'],
post_tags: ['</span>'],
fields: {
login: {},
firstname: {},
lastname: {},
title:{},
name:{},
description:{},
filename:{},
subject:{},
content:{}
}
}
},[User,Syllabus,Course,Attachment,Project,Memo] ).page(page).per(20).results
when 'user'
if (page-1)*20 >= @users_count
page = 1
params[:page] = "1"
end
@users = User.search(@name).page(page).per(20)
when 'syllabus'
if (page-1)*20 >= @syllabus_count
page = 1
params[:page] = "1"
end
@syllabuses = Syllabus.search(@name).page(page).per(20).results
when 'project'
if (page-1)*20 >= @project_count
page = 1
end
@projects = Project.search(@name).page(page).per(20).results
when 'course'
if (page-1)*20 >= @course_count
page = 1
params[:page] = "1"
end
@courses = Course.search(@name).page(page).per(20).results
when 'attachment'
if (page-1)*20 >= @attach_count
page = 1
params[:page] = "1"
end
@attachments = Attachment.search(@name).page(page).per(20).results
when 'memo'
if (page-1)*20 >= @memo_count
page = 1
params[:page] = "1"
end
@memos = Memo.search(@name).page(page).per(20).results
else
if (page-1)*20 >= @total_count
page = 1
params[:page] = "1"
end
@alls = Elasticsearch::Model.search({
query: {
multi_match: {
query: @name,
type:"most_fields",
operator: "or",
fields: ['login', 'firstname','lastname','title','name','description^0.5','filename','subject','content^0.5']
}
},
highlight: {
pre_tags: ['<span class="c_red">'],
post_tags: ['</span>'],
fields: {
login: {},
firstname: {},
lastname: {},
title:{},
name:{},
description:{},
filename:{},
subject:{},
content:{}
}
}
},[User,Syllabus,Course,Attachment,Project,Memo] ).page(page).per(20).results
end
# search_type = params[:search_type].to_sym unless search_condition.blank?
# search_by = params[:search_by]
#
# if search_type.nil? && params[:contests_search] && params[:name] != ""
# search_type = :contests
# search_condition = params[:name]
# end
respond_to do |format|
format.js
format.html{ render :layout=>'users_base'}
end
end
private
# 判断网站的入口,是课程 course 则跳过index去渲染 course 方法
def entry_select
# url = request.original_url.gsub('/','')
# if url.include?(Setting.url_course.gsub('/',''))
# if @first_page.show_course == 1
# course
# render :course
# else
# render_404
# end
#
# return 0
# elsif url.include?(Setting.url_contest.gsub('/',''))
# if @first_page.show_contest == 1
# contest
# render :contest
# else
# render_404
# end
#
# return 0
# elsif url.include?(Setting.url_user.gsub('/',''))
# #redirect_to(:controller => "users", :action => "index")
# end
end
# def render(*args)
# _fake if @fake_filter
# super
# end
# private
# def fake
# @fake_filter = true
# end
# # 骗子方法
# def _fake
# instance_variables.map { |variable|
# if variable.to_s =~ /Count$/
# self.instance_variable_set(variable.to_sym,
# ("1" + (self.instance_variable_get(variable.to_sym).to_s)).to_i)
# end
# }
# end
end

View File

@ -1,8 +1,8 @@
class ApplyAddSchools < ActiveRecord::Base
# status0 未审批 1 已批阅
attr_accessible :address, :city, :name, :province, :remarks, :school_id, :status
has_many :applied_messages, :class_name =>'AppliedMessage', :as => :applied
belongs_to :school
#after_create :send_massage
end
class ApplyAddSchools < ActiveRecord::Base
# status0 未审批 1 已批阅, :2 已拒绝
attr_accessible :address, :city, :name, :province, :remarks, :school_id, :status
has_many :applied_messages, :class_name =>'AppliedMessage', :as => :applied
belongs_to :school
#after_create :send_massage
end

View File

@ -0,0 +1,56 @@
<div style="width:400px" class="task-popup">
<div class="task-popup-title clearfix ">
<h3 class="fl color-grey mt10 ml5">更改为</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="mt10 ml10">
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入名称搜索" class="task-height-40 panel-box-sizing fl edu-txt-w320 ml30" style="padding: 2px 5px" />
</div>
<div class="cl"></div>
<div id="schools_list" class="mt10 mb20 ml40 mr40">
<%= render :partial => "managements/update_school_form", :locals => {:schools => schools, :edit_id => edit_id} %>
</div>
<span id="choose_courses_notice" class="c_red"></span>
<div class="task-popup-submit clearfix ml25">
<a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl pop_close mr10">取消</a>
<a href="javascript:void(0);" onfocus='this.blur();' onclick="school_submit();" class="task-btn task-btn-blue fr" >确定</a>
</div>
<div class="cl"></div>
</div>
<script type="text/javascript">
$(function(){
});
$("#search_course_input").on('input',function(e){
throttle(search_courses, window, e);
});
function school_submit() {
var checkboxs = $("input[name='school_id[]']:checked");
if(checkboxs.length == 0) {
$("#choose_courses_notice").text("请选择单位");
} else{
$("#choose_courses_notice").text("");
$("#schools_list_form").submit();
hideModal();
}
}
var lastSearchCondition = '';
var count = 0;
function search_courses(e){
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
{
return;
}
lastSearchCondition = $(e.target).val().trim();
$.ajax({
url: '<%= url_for(:controller => 'managements', :action => 'all_schools') %>'+'?search='+ e.target.value+'&school_id=<%= edit_id %>',
type:'get',
data: {is_observe:true},
success: function(data){ },
beforeSend: function(){ $(this).addClass('ajax-loading'); },
complete: function(){ $(this).removeClass('ajax-loading'); }
});
}
</script>

View File

@ -16,7 +16,7 @@
<% count = ((@page - 1) * @limit) + index + 1 %>
<%= count %>
</td>
<td class="edu-txt-left">
<td class="edu-txt-left create" id="<%= courselist.id %>">
<%= courselist.name %>
</td>
<td>
@ -24,7 +24,10 @@
<td>
<%= format_time courselist.created_at %>
</td>
<td><a href="javascript:void(0)">添加专业</a></td>
<td>
<a href="javascript:void(0)" onclick="add_major('<%= courselist.id %>')" >添加专业</a>
</td>
</tr>
<% get_course_list_major(courselist.id).each_with_index do |smc, j| %>
<tr>
@ -33,7 +36,7 @@
</td>
<td class="edu-txt-left">
</td>
<td class="edu-txt-left">
<td class="edu-txt-left" >
<%= smc.name %>
</td>
<td>
@ -56,13 +59,12 @@
</div>
</div>
<script>
function add_major(){
var htmlvalue ='<%= form_tag(url_for(add_major_managements_path),:id=>"add_major",:method => "post") do %>'+
'<div style="width:400px" class="task-popup"><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>'+
'<select class="mt20 ml75 mb20" id="major">' +
function add_major(courselist_id){
var htmlvalue ='<div style="width:400px" class="task-popup"><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>'+
'<select class="mt20 ml75 mb10" id="major" name="major_id">' +
'<option value="0" selected="selected">请选择支撑实训的专业名称</option>'+
'<% @major.each do |major| %>'+
'<option value="<% major.id %>"><%= major.name %></option>'+
'<option value="<%= major.id %>" ><%= major.name %></option>'+
'<% end %>'+
'</select>' +
'<span class="color-orange fl none" style="margin-left: 17%;" id="new_major_name_notice">'+
@ -71,18 +73,37 @@
'<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_major();" class="task-btn task-btn-blue fr" >确定</a>' +
'<a href="javascript:void(0);" onclick="submit_new_major('+ courselist_id +');" class="task-btn task-btn-blue fr" >确定</a>' +
'</div>' +
'</div>'+
'</div>'+
'<% end %>';
pop_box_new(htmlvalue, 400, 160)
'</div>';
pop_box_new(htmlvalue, 400, 160);
};
function submit_new_major(courselist_id) {
var major_id= $("select").find("option:selected").val();
if(major_id != 0){
$("#new_major_name_notice").html("请先选择要支撑实训的专业名称").hide();
$.ajax({
url: "/managements/add_major",
data:{course_list_id:courselist_id,major_id:major_id},
type: 'post',
success: function(data){
if(data.result == 0){
$("#new_major_name_notice").html("该课程已属于本专业,请重新选择").show();
} else{
window.location.href = "<%= applicable_course_managements_path %>";
hideModal();
}
}
});
}else{
$("#new_major_name_notice").show();
}
}
function submit_new_major() {
$("#add_major").submit();
}
</script>

View File

@ -19,7 +19,7 @@
<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 class="edu-txt-left">
<%= link_to syllabus.title,syllabus_path(syllabus.id) %>
</td>
<td><%= link_to syllabus.user.show_name, user_path(syllabus.user) %></td>

View File

@ -18,7 +18,7 @@
<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") %>
<%=link_to '更改', admin_all_schools_path(:school_id =>apply.id), :remote => true, :class => "application-default-link" %>
<%#= link_to '更改',all_schools_managements_path(:school_id =>apply.id), :remote => true, :class => "application-default-link" %>
</td>
</tr>
<% end %>

View File

@ -13,13 +13,13 @@
<tbody>
<% @apply_status.each do |apply| %>
<tr>
<td> <%= apply.id %></td>
<td><%= apply.id %></td>
<td class="edu-txt-left"><%= link_to apply.name,school_index_path(apply.id)%></td>
<td>
<span ondblclick = "show_edit_school_province('<%= apply.id %>');" id="apply_province_<%= apply.id %>">
<%= (apply.province.nil? ? "" : apply.province) + (apply.city.nil? ? "" : apply.city) %>
</span>
<select onchange="showcity(this.value, document.getElementById('schoolCity_<%=apply.id%>'));edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="province" id="school_province_edit_<%=apply.id%>" class="fl" style="width:55px; height:20px; display: none">
<select onchange="showcity(this.value, document.getElementById('schoolCity_<%= apply.id %>'));edit_school_province('<%= edit_apply_province_school_path(apply.id)%>','<%= apply.id %>');" name="province" id="school_province_edit_<%=apply.id%>" class="fl" style="width:55px; height:20px; display: none">
<option value="北京">北京</option>
<option value="上海">上海</option>
<option value="广东">广东</option>
@ -66,17 +66,16 @@
<td>
<% user = User.where("id=?", apply.user_id).first %>
<% unless user.nil? %>
<%=link_to user.show_name, user_path(user),:target => '_blank', :class => "application-default-link" %>
<%= link_to user.show_name, user_path(user),:target => '_blank', :class => "application-default-link" %>
<% end %>
</td>
<td>
<%= 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" ) %>
<%= link_to( l(:button_delete), { :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id, :tip => 'unapplied' },:method => :delete, :confirm => l(:text_are_you_sure), :class => "application-default-link") %>
<%=link_to '更改', admin_all_schools_path(:school_id =>apply.id), :remote => true, :class => "application-default-link" %>
<a href="javascript:void(0);" onclick="approve('<%= apply.id %>')">批准</a>
<%= link_to( l(:button_delete),{ :controller => 'admin', :action => 'delete_applied_schools', :id => apply.id, :tip => 'unapplied' },:method => :delete, :confirm => l(:text_are_you_sure), :class => "application-default-link") %>
<%= link_to '更改',all_schools_managements_path(:school_id =>apply.id), :remote => true, :class => "application-default-link" %>
</td>
</tr>
<% end %>
@ -101,4 +100,19 @@
dateType: "script"
});
});
function approve(apply_id) {
$.ajax({
url: "/managements/approve_applied_schools",
data: {id: apply_id},
type: 'post'
});
};
// function button_delete(apply_id){
// $.ajax({
// url: "/admin/delete_applied_schools",
// data: {id: apply_id},
// type: 'post'
// });
// }
</script>

View File

@ -0,0 +1,17 @@
<%= form_tag edit_applied_schools_managements_path(:applied_id =>edit_id), :id => 'schools_list_form' %>
<div>
<%#= hidden_field_tag(:send_id, edit_id) %>
<div class="courseReferContainer" style="max-height: 240px; overflow: auto;">
<% if !schools.empty? && !@search.nil? %>
<% schools.each do |school| %>
<ul class="courseSend">
<li class="" style="display:inline-block">
<input name="school_id[]" id="search_school_<%= school.id %>" type="radio" value="<%= school.id %>" class="courseSendCheckbox magic-radio"/>
<label for="search_school_<%= school.id %>"><%= truncate(school.name, :lendght => 25)%></label>
</li>
</ul>
<% end %>
<% end %>
</div>
</div>
<div class="cl"></div>

View File

@ -0,0 +1,6 @@
<% if params[:search].nil? %>
var htmlvalue = " <%= escape_javascript( render :partial => 'managements/all_schools', :locals => {:schools => @schools, :edit_id => @edit_id}) %>";
pop_box_new(htmlvalue, 400, 260);
<% else %>
$("#schools_list").html("<%= escape_javascript(render :partial => 'managements/update_school_form', :locals => {:schools => @schools, :edit_id => @edit_id}) %>");
<% end %>

View File

@ -5,12 +5,14 @@
<option value="0">正在进行(<%= @timing %>)</option>
<option value="1">已结束(<%= @end %>)</option>
</select>
<select class="fl task-height-30" style="margin:0px 30px 0px 25px;padding: 5px;width: 25%" 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="fl task-height-30 mb10 ml35" 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 class="fl task-form-15 task-height-30" style="margin:0px 0px 10px 25px;width: 11%" name="keyword" id="condition_status">
<option value="u_name">创建者姓名搜索</option>
<option value="cla_name">班级名称搜索</option>
@ -41,4 +43,54 @@
$('#class_publish_shixuns_search').submit();
});
$("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

@ -204,6 +204,9 @@ RedmineApp::Application.routes.draw do
post 'shixun_homepage_show'
post 'add_course'
match 'add_major',:via=>[:get,:post]
match 'approve_applied_schools',:via=>[:get,:post]
match 'all_schools',:via=>[:get,:post]
post 'edit_applied_schools'
end
end
# Enable Grack support

View File

@ -88,7 +88,7 @@ a:hover.link-color-grey03{color:#3498db!important;}
.mt-10{ margin-top:-10px;}.mt3{ margin-top:3px;}.mt5{ margin-top:5px;}.mt6{ margin-top:6px;}.mt7{ margin-top:7px;}.mt8{ margin-top:8px;}.mt10{ margin-top:10px;}.mt12{ margin-top:12px;}.mt15{ margin-top:15px;}.mt20{ margin-top:20px;}.mt25{ margin-top:25px;}.mt30{ margin-top:30px;}.mt50{ margin-top:50px;}
.mb5{ margin-bottom: 5px;}.mb10{ margin-bottom: 10px;}.mb15{ margin-bottom: 15px;}.mb20{ margin-bottom: 20px;}.mb25{ margin-bottom: 25px;}.mb30{ margin-bottom: 30px;}.mb50{ margin-bottom: 50px;}
.ml-3{ margin-left: -3px;}.ml5{ margin-left: 5px;}.ml6{ margin-left: 6px;}.ml10{ margin-left: 10px;}.ml15{ margin-left: 15px;}.ml20{ margin-left: 20px;}.ml25{ margin-left: 25px;}.ml30{ margin-left: 30px;}.ml33{ margin-left: 33px;}.ml35{ margin-left:35px;}.ml40{margin-left:40px;}.ml42{margin-left:42px;}.ml50{ margin-left: 50px;}.ml75{ margin-left: 75px;}.ml95{ margin-left: 95px;}.ml115{margin-left: 115px}.ml230{ margin-left: 230px;}
.mr3{margin-right: 3px}.mr5{ margin-right: 5px;}.mr10{ margin-right: 10px;}.mr15{ margin-right: 15px;}.mr18{ margin-right: 18px;}.mr20{ margin-right: 20px;}.mr25{ margin-right: 25px;}.mr30{ margin-right:30px;}.mr50{ margin-right: 50px;}.mr60{ margin-right:60px;}
.mr3{margin-right: 3px}.mr5{ margin-right: 5px;}.mr10{ margin-right: 10px;}.mr15{ margin-right: 15px;}.mr18{ margin-right: 18px;}.mr20{ margin-right: 20px;}.mr25{ margin-right: 25px;}.mr30{ margin-right:30px;}.mr40{margin-right:40px;}.mr50{ margin-right: 50px;}.mr60{ margin-right:60px;}
.pt5{ padding-top:5px;}.pt10{ padding-top:10px;}.pt15{ padding-top:15px;}.pt20{ padding-top:20px;}
.pb5{ padding-bottom:5px;}.pb10{ padding-bottom:10px;}.pb15{ padding-bottom:15px;}.pb20{ padding-bottom:20px;}
.pl5{ padding-left:5px;}.pl8{ padding-left:8px;}.pl10{ padding-left:10px;}.pl15{ padding-left:15px;}.pl20{ padding-left:20px;}

View File

@ -8,7 +8,7 @@
/*发送资源弹窗*/
/*.resourceShareContainer {width:100%; height:100%; background:#666; filter:alpha(opacity=50); opacity:0.5; -moz-opacity:0.5; position:absolute; left:0; top:0; z-index:-999;}*/
.resourceSharePopup {width:300px; height:auto; border:3px solid #3b94d6 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;}
.sendText {font-size:16px; color:#3b94d6; line-height:16px; padding-top:20px; width:110px; display:inline-block; font-weight: bold;}
.sendText {font-size:16px; color:#3b94d6; line-height:16px; padding-top:10px; width:110px; display:inline-block; font-weight: bold;}
.resourcesSendTo {float:left; height:20px; margin-top:15px;}
.boxContainer {height:auto; line-height:33px; position:relative}
.resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;}
@ -332,4 +332,6 @@ a.hw_sendpopup_close{width:20px; height:20px;display:block;background: url(/imag
.hw_sendpopup_searchli{ max-height: 300px; overflow: auto; width:400px;}
.hw_sendpopup_searchli li{ font-size:14px; margin-bottom:5px;color:#333; width:370px;}
.hw_sendpopup_searchli li label{ margin-left:5px;}
.hw_sendpopup_search_input{width:393px; height:28px; border:none; border:1px solid #d3d8e7; background:#fff; padding-left:5px}
.hw_sendpopup_search_input{width:393px; height:28px; border:none; border:1px solid #d3d8e7; background:#fff; padding-left:5px}
/*超级管理员界面*/
.sendCourseName1 {font-size:12px; color:#5f6060}

File diff suppressed because one or more lines are too long