dev_local
cxt 6 years ago
commit 1ddfe358eb

@ -76,48 +76,59 @@ class ApplicationController < ActionController::Base
# 包月+按license 9200109002
# 云启训练场EduCoder院校版 产品编码appId 9200109
def ecloud_auth subject_id
# euser = EcloudUser.where("userid =? and opttype not in(3, 5)", User.current.id).first
# if euser.present? # 开通过业务
# # 获取用户的套餐信息
# e_service = euser.ecloud_services.where("opttype != 1")
# # 如果用户开通过服务
# if e_service.present?
# if e_service.count >1 # 说明有重复开通过业务
# else
# code = e_service.first.try(:code)
#
# end
# end
# else
# false # 没开通过服务,或者服务被禁用则不允许访问
# end
#
#
#
#
# if e_service.count > 1 # 说明有重复订购过套餐
# else
# code = e_service.try(:code)
# end
# service_count = euser.ecloud_services.where("opttype != 1").try(:code)
#
# end
# 如果不是Ecloud过来的用户则不改变用户的使用状态及权限按现有模式即可
# 如果不是Ecloud过来的用户则不改变用户的使用状态及权限按现有模式即可
def ecloud_auth
euser = EcloudUser.where("userid =? and opttype not in(3, 5)", User.current.id).first
if euser.present? # 开通过业务
# 获取用户的套餐信息
e_services = euser.ecloud_services.where("opttype != 1").order("ecloud_services.code desc")
# 如果用户开通过服务
if e_services.present?
if e_services.count > 1 # 说明有重复开通过业务
# 开通多业务的话以最大的套餐排序如果最大套餐还可以用则直接返回true如果最大套餐不能用则轮询返回直到找到可用的套餐
e_services.each do |e_service|
# 使用期限内套餐才有效
ecloud_services_auth(e_service.code, e_service.begintime, e_service.endtime)
end
else
# 先看套餐,再看时间区间
e_service = e_services.first
ecloud_services_auth(e_service.code, e_service.begintime, e_service.endtime)
end
else
false # 没开通过服务,或者服务被禁用则不允许访问
end
end
end
# 根据业务确定权限
def ecloud_services_auth code, subject_id
subject = Subject.find(subject_id)
subject_level = subject.subject_level_system.try(:level)
# case code
# when "9200108001"
# subject_level.to_i == 1 ? true : false
# when "9200108002"
#
# end
# end
def ecloud_services_auth code, begintime, endtime
# 如果当前实训不在实训课堂等级体系中,则不允许访问
subject_id = @shixun.stage_shixuns.map(&:subject_id)
if subject_id.blank?
render_403
end
subject_level = Subject.find(subject_id).subject_level_system.try(:level)
# 当前时间转毫秒
current_time = DateTime.now.strftime('%Q').to_i
if current_time - begintime > 0 && endtime - current_time > 0
case code
when "9200108001"
subject_level.to_i == 1 ? true : false
when "9200108002"
subject_level.to_i == 2 ? true : false
when "9200108003"
subject_level.to_i == 3 ? true : false
when "9200109001" # 企业用户
subject_level.to_i < 3 ? true : false
when "9200109002" # 企业用户
subject_level.to_i <= 3 ? true : false
end
else
false
end
end

@ -13,7 +13,7 @@ class ChallengesController < ApplicationController
skip_before_filter :verify_authenticity_token, :only => [:create_choose_question, :update_choose_question]
#before_filter :find_shixun_language, :only => [:show, :new, :edit]
before_filter :base_index, :only => [:index, :index_down, :index_up, :destroy]
before_filter :view_allow, :only => [:index, :show]
before_filter :view_allow, :only => [:show]
include ApplicationHelper

@ -791,7 +791,14 @@ class ManagementsController < ApplicationController
def shixun_feedback_message
@menu_type = 8
@sub_type = 2
@discusses = Discuss.where(:dis_type => "Shixun").reorder("created_at desc")
@search = params[:search]
if @search.present?
shixun_ids = Shixun.where("name like ?", "%#{params[:search]}%").pluck(:id)
@discusses = Discuss.where(:dis_type => "Shixun", :dis_id => shixun_ids).reorder("created_at desc")
else
@discusses = Discuss.where(:dis_type => "Shixun").reorder("created_at desc")
end
@all_discusses = @discusses
@discusses_count = @discusses.count
@limit = 20
@is_remote = true
@ -802,6 +809,11 @@ class ManagementsController < ApplicationController
respond_to do |format|
format.js
format.html
format.xls{
shixun_ids = @all_discusses.pluck(:dis_id).uniq
filename = "#{Time.now.strftime("%Y%m%d")}-实训反馈.xls"
send_data(shixun_feedback_xls(shixun_ids), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
}
end
end
@ -4046,6 +4058,41 @@ end
return sheet.rows
end
def shixun_feedback_xls shixun_ids
xls_report = StringIO.new
book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet :name => "实训反馈"
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
sheet1.row(0).default_format = blue
count_row = 1
shixuns = Shixun.where(:id => shixun_ids).includes(discusses: [:user])
sheet1.row(0).concat(["序号", "实训ID", "实训名称", "实训作者", "作者单位", "评论数", "评论内容", "关卡", "评论者", "评论者职业",
"评论者单位", "评论时间", "社区导师是否已回复"])
shixuns.each_with_index do |shixun, i|
discusses = shixun.discusses.where("user_id != ?", 1)
sheet1[count_row, 0] = i + 1
sheet1[count_row, 1] = shixun.identifier
sheet1[count_row, 2] = shixun.name
sheet1[count_row, 3] = shixun.owner.show_real_name
sheet1[count_row, 4] = shixun.owner.school_name
sheet1[count_row, 5] = discusses.count
discusses.each_with_index do |discuss, j|
user = discuss.user
sheet1[count_row, 6] = discuss.content.gsub(/<img.*\/>/, "【图片评论】").gsub(/!\[\].+\)/, "【图片评论】")
sheet1[count_row, 7] = "#{discuss.position}"
sheet1[count_row, 8] = user.show_real_name
sheet1[count_row, 9] = user.identity
sheet1[count_row, 10] = user.school_name
sheet1[count_row, 11] = format_time discuss.created_at
sheet1[count_row, 12] = discuss.children.pluck(:user_id).include?(1) ? "" : ""
count_row += 1
end
#count_row += 1
end
book.write xls_report
xls_report.string
end
def competition_member_xls members, competition
xls_report = StringIO.new
book = Spreadsheet::Workbook.new

@ -2,13 +2,16 @@
# REDO: 创建版本库权限控制
class ShixunsController < ApplicationController
layout 'base_shixun'
before_filter :require_login, :except => [:ghook, :download_file]
before_filter :check_authentication, :except => [:ghook, :download_file]
before_filter :require_login, :except => [:ghook, :download_file, :show, :index]
before_filter :check_authentication, :except => [:ghook, :download_file, :show, :index]
before_filter :find_shixun, :except => [ :index, :new, :create, :index, :search, :shixun_courses, :new_disscuss, :shixun_migrate, :qrcode, :download_file, :departments, :get_mirror_script, :send_message_to_administrator]
skip_before_filter :verify_authenticity_token, :only => [:ghook, :download_file]
before_filter :view_allow, :only => [:show, :collaborators, :propaedeutics, :shixun_discuss, :ranking_list]
before_filter :view_allow, :only => [:collaborators, :propaedeutics, :shixun_discuss, :ranking_list]
before_filter :require_manager, :only => [ :settings, :add_script, :publish, :collaborators_delete, :shixun_members_added, :add_collaborators, :update, :destroy]
before_filter :validation_email, :only => [:new]
# 移动云ToC模式权限控制
# before_filter :ecloud_auth, :except => [:show, :index]
include ApplicationHelper
include ShixunsHelper

@ -1,8 +1,8 @@
# encoding: utf-8
class SubjectsController < ApplicationController
layout 'base_subject'
before_filter :require_login, :except => [:show]
before_filter :check_authentication, :except => [:show]
before_filter :require_login, :except => [:show, :index]
before_filter :check_authentication, :except => [:show, :index]
before_filter :find_subject, :except => [:index, :new, :create, :create_subject, :new_subject, :append_to_stage, :send_to_course]
include ApplicationHelper

@ -54,7 +54,7 @@ class UsersController < ApplicationController
accept_api_auth :index, :show, :create, :update, :destroy, :tag_save, :tag_saveEx
#william
before_filter :require_login, :only => [:tag_save, :tag_saveEx]
before_filter :require_login, :only => [:tag_save, :tag_saveEx, :search_user_course, :search_user_project]
#before_filter :refresh_changests, :only =>[:user_activities,:user_courses,:user_projects,:user_newfeedback]
#visitor

@ -340,15 +340,11 @@ module ApplicationHelper
# TPM查看权限
# result一般为页面权限
def shixun_view_allow shixun, result = nil
if params[:openi].to_i == 1
if User.current.manager_of_shixun?(shixun)
result ? false : true
else
if User.current.manager_of_shixun?(shixun)
result ? false : true
else
if shixun.status == 0 || (shixun.use_scope == 1 && !shixun.schools.map(&:name).include?(User.current.school_name))
result ? true : (render_403)
end
if shixun.status == 0 || (shixun.use_scope == 1 && !shixun.schools.map(&:name).include?(User.current.school_name))
result ? true : (render_403)
end
end
end
@ -619,7 +615,7 @@ module ApplicationHelper
redirect_to user_info_path()
Rails.logger.info("check_authentication end")
return
elsif User.current.certification != 1
elsif User.current.certification != 1 # 系统没有授权
day_cer = UserDayCertification.where(:user_id => User.current.id).last
unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400
redirect_to my_account_path()

@ -1,3 +1,4 @@
# ket值license表示人数对应企业版duration表示月数对应个人版
class EcloudServieceServicepara < ActiveRecord::Base
attr_accessible :key, :value, :ecloud_service_id
belongs_to :ecloud_service

@ -5,7 +5,7 @@
<li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实训课程", subjects_path %></li>
<li class="<%= course_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "翻转课堂", courses_path %></li>
<!-- 精选实训 -->
<li class="pr<%= shixuns_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "开发社区", shixuns_path %><img src="/images/educoder/hot-h.png" class="nav-img" /></li>
<li class="pr <%= shixuns_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "开发社区", shixuns_path %><img src="/images/educoder/hot-h.png" class="nav-img" /></li>
<% careers = Career.published.order("created_at asc") %>
<% if careers.present? %>

@ -3,16 +3,14 @@
<div class="head-nav pr">
<ul id="header-nav">
<li class="active" style="display: none"><%= link_to "首页", home_path %></li>
<li><%= link_to "实训课程", subjects_path %></li>
<li><%= link_to "翻转课堂", courses_path %></li>
<li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实训课程", subjects_path %></li>
<li class="<%= course_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "翻转课堂", courses_path %></li>
<li class="pr <%= shixuns_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "开发社区", shixuns_path %><img src="/images/educoder/hot-h.png" class="nav-img" /></li>
<li class="pr">
<%= link_to "开发社区", shixuns_path %>
<img src="/images/educoder/hot-h.png" class="nav-img" />
</li>
<% careers = Career.published.order("created_at asc") %>
<% if careers.present? %>
<li class="fl edu-menu-panel headIcon careershover" style="cursor: auto;">
<li class="fl edu-menu-panel headIcon careershover <%= params[:action] == "index" && params[:controller] == "careers" ? " active" : "" %>" style="cursor: auto;">
<p>职业路径</p>
<ul class="edu-menu-list edu-menu-listnew" style="top:60px">
<% careers.each do |career| %>
@ -21,8 +19,8 @@
</ul>
</li>
<% end %>
<li><%= link_to "竞赛", competitions_path %></li>
<li><%= link_to "问答", forums_path %></li>
<li class="<%= params[:controller] == "competitions" ? " active" : "" %>"><%= link_to "竞赛", competitions_path %></li>
<li class="<%= params[:controller] == "forums" ? " active" : "" %>"><%= link_to "问答", forums_path %></li>
<!--<li><%#= link_to "活动竞赛", competitions_path %></li>-->
</ul>
<div class="posi-search unlogin" id="posi-search" style="display: none" >
@ -89,21 +87,5 @@
window.onscroll=function(){
var sl=-Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);
document.getElementById('nHeader').style.left=sl+'px';
}
$(function () {
var $header = $("#header-nav").children("li");
<% if params[:controller] == "welcome" %>
$("#header-nav").children("li").eq(0).addClass("active");
<% elsif subjects_controller.include?(params[:controller]) %>
$("#header-nav").children("li").eq(1).addClass("active");
<% elsif course_controller.include?(params[:controller]) %>
$("#header-nav").children("li").eq(2).addClass("active");
<% elsif shixuns_controller.include?(params[:controller]) %>
$header.length == 7 ? $header.eq(2).addClass("active") : $header.eq(3).addClass("active");
<% elsif params[:controller] == "competitions" %>
$header.length == 7 ? $header.eq(5).addClass("active") : $header.eq(4).addClass("active");
<% elsif params[:controller] == "forums" %>
$header.length == 7 ? $header.eq(6).addClass("active") : $header.eq(5).addClass("active");
<% end %>
})
};
</script>

@ -1,14 +1,20 @@
<div class="edu-class-container">
<%#= form_tag(url_for(shixuns_managements_path), :id => "managements_shixuns_search", :method => "post", :remote => true ) do %>
<!--<div class="edu-con-top clearfix mb20">-->
<!--<input class="fl task-form-20 task-height-30 ml25" id="shixun_Look_name" name="search" maxlength="" placeholder="输入实训名称关键字进行搜索" type="text" style="height: 21px;">-->
<!--<li class="fl ml10">-->
<!--<a href="javascript:void(0)" class="task-btn task-btn-orange" onclick="$('#managements_shixuns_search').submit();">搜索</a>-->
<!--<a href="javascript:clearSearchCondition();" class="task-btn mr10">清除</a>-->
<!--</li>-->
<!--</div>-->
<%# end %>
<%= form_tag(url_for(shixun_feedback_message_managements_path), :id => "managements_shixuns_search", :method => "post", :remote => true ) do %>
<div class="edu-con-top clearfix mb20">
<input class="fl task-form-20 task-height-30 ml25" id="shixun_Look_name" name="search" maxlength="" placeholder="输入实训名称关键字进行搜索" type="text" style="height: 21px;">
<li class="fl ml10">
<a href="javascript:void(0)" class="task-btn task-btn-orange" onclick="$('#managements_shixuns_search').submit();">搜索</a>
<a href="javascript:clearSearchCondition();" class="task-btn mr10">清除</a>
</li>
<a href="<%= shixun_feedback_message_managements_path(:search => @search, :format => "xls") %>" id="shixun_search" class="task-btn mr10 task-btn-orange fr">导出</a>
</div>
<% end %>
<div class="ex_container" id="management_shixun_feedback_list">
<%= render :partial => "shixun_feedback_list" %>
</div>
</div>
</div>
<script>
function clearSearchCondition(){
$("#shixun_Look_name").val('')
}
</script>

@ -1 +1,2 @@
$("#management_shixun_feedback_list").html("<%= j(render :partial => 'shixun_feedback_list') %>");
$("#management_shixun_feedback_list").html("<%= j(render :partial => 'shixun_feedback_list') %>");
$("#shixun_search").attr("href", "<%= shixun_feedback_message_managements_path(:search => @search, :format => "xls") %>")

@ -5,167 +5,163 @@
SearchByName_poll();
}
}
$(function () {
});
</script>
<div class="edu-class-container edu-position">
<p class="mb10 font-14">
<%= link_to @course.name, course_path(@course),:class => "color-grey-9" %> &gt; <%= link_to "问卷列表", poll_index_path(:course_id => @course.id),:class => "color-grey-9" %> &gt;
#<%= get_poll_index(@poll, @course, @is_teacher) + 1 %>
</p>
<div class="edu-con-top user_bg_shadow bor-grey-e clearfix mb20">
<p class="ml15 fl color-grey3">
<% unless @poll.is_public %>
<i id="poll_public_icon_<%= @poll.id %>" class="fa fa-lock color-grey-c fl mt8 mr15 font-18"></i>
<% end %>
<span><%= @poll.polls_name %></span>
<p class="mb10 font-14">
<%= link_to @course.name, course_path(@course),:class => "color-grey-9" %> &gt; <%= link_to "问卷列表", poll_index_path(:course_id => @course.id),:class => "color-grey-9" %> &gt;
#<%= get_poll_index(@poll, @course, @is_teacher) + 1 %>
</p>
<%= link_to "返回", poll_index_path(:course_id => @course.id), :class => "fr font-12 mr15 mt3 color-grey" %>
</div>
<div class="edu-tab clearfix mb20">
<div class="edu-con-top user_bg_shadow bor-grey-e clearfix mb20">
<p class="ml15 fl color-grey3">
<% unless @poll.is_public %>
<i id="poll_public_icon_<%= @poll.id %>" class="fa fa-lock color-grey-c fl mt8 mr15 font-18"></i>
<% end %>
<span><%= @poll.polls_name %></span>
</p>
<%= link_to "返回", poll_index_path(:course_id => @course.id), :class => "fr font-12 mr15 mt3 color-grey" %>
</div>
<div class="clearfix mb20">
<ul id="edu-tab-nav" class="border-bottom-orange">
<li id="edu-tab-nav-1" class="new-tab-nav background-orange" onclick="HoverLi(1);">
<a href="javascript:void(0);" class="tab_type">答题列表</a>
</li>
<% if @is_teacher || (@poll.show_result == 1 && @poll.polls_status == 3) %>
<li id="edu-tab-nav-2" class="new-tab-nav" onclick="HoverLi(2);">
<a href="javascript:void(0);" class="tab_type">统计结果</a>
</li>
<li id="edu-tab-nav-2" class="new-tab-nav" onclick="HoverLi(2);">
<a href="javascript:void(0);" class="tab_type">统计结果</a>
</li>
<% end %>
<% if @is_teacher %>
<li id="edu-tab-nav-3" class="new-tab-nav" onclick="HoverLi(3);">
<a href="javascript:void(0);" class="tab_type">问卷内容</a>
</li>
<li id="edu-tab-nav-4" class="new-tab-nav" onclick="HoverLi(4);">
<a href="javascript:void(0);" class="tab_type">设置</a>
</li>
<% if @poll.polls_status > 1 %>
<%= link_to "导出统计", export_poll_poll_path(@poll, :course_id => @course.id, :format => 'xls'), :id => "export_poll_work", :class => "fr white-btn orange-btn mt10 ml15" %>
<% end %>
<% if @poll.polls_status < 3 %>
<%= link_to "编辑问卷", edit_poll_path(@poll, :course_id => @course.id), :class => "fr white-btn orange-btn mt10 ml15" %>
<% end %>
<% if @poll.polls_status == 1 || @poll.poll_group_settings.where("publish_time is null or publish_time > '#{Time.now}'").count > 0 %>
<%= link_to '立即发布', publish_notice_poll_path(@poll), :remote => true, :class => "white-btn orange-btn fr ml15 mt10" %>
<% end %>
<% if (@poll.polls_status == 2 && @poll.end_time > Time.now) || @poll.poll_group_settings.where("publish_time < '#{Time.now}' and end_time > '#{Time.now}'").count > 0 %>
<%= link_to '立即截止', end_notice_poll_path(@poll), :remote => true, :class => "white-btn orange-btn fr ml15 mt10" %>
<% end %>
<% if @poll.polls_status == 2 %>
<a href="javascript:void(0)" class="white-btn orange-btn fr ml15 mt10" onclick="cancel_publish('<%= cancel_publish_poll_path(@poll) %>')">撤销发布</a>
<% end %>
<li id="edu-tab-nav-3" class="new-tab-nav" onclick="HoverLi(3);">
<a href="javascript:void(0);" class="tab_type">问卷内容</a>
</li>
<li id="edu-tab-nav-4" class="new-tab-nav" onclick="HoverLi(4);">
<a href="javascript:void(0);" class="tab_type">设置</a>
</li>
<% if @poll.polls_status > 1 %>
<%= link_to "导出统计", export_poll_poll_path(@poll, :course_id => @course.id, :format => 'xls'), :id => "export_poll_work", :class => "fr white-btn orange-btn mt10 ml15" %>
<% end %>
<% if @poll.polls_status < 3 %>
<%= link_to "编辑问卷", edit_poll_path(@poll, :course_id => @course.id), :class => "fr white-btn orange-btn mt10 ml15" %>
<% end %>
<% if @poll.polls_status == 1 || @poll.poll_group_settings.where("publish_time is null or publish_time > '#{Time.now}'").count > 0 %>
<%= link_to '立即发布', publish_notice_poll_path(@poll), :remote => true, :class => "white-btn orange-btn fr ml15 mt10" %>
<% end %>
<% if (@poll.polls_status == 2 && @poll.end_time > Time.now) || @poll.poll_group_settings.where("publish_time < '#{Time.now}' and end_time > '#{Time.now}'").count > 0 %>
<%= link_to '立即截止', end_notice_poll_path(@poll), :remote => true, :class => "white-btn orange-btn fr ml15 mt10" %>
<% end %>
<% if @poll.polls_status == 2 %>
<a href="javascript:void(0)" class="white-btn orange-btn fr ml15 mt10" onclick="cancel_publish('<%= cancel_publish_poll_path(@poll) %>')">撤销发布</a>
<% end %>
<% else %>
<li id="edu-tab-nav-4" class="new-tab-nav" onclick="HoverLi(4);">
<a href="javascript:void(0);" class="tab_type">查看设置</a>
</li>
<% if User.current.member_of_course?(@poll.course) %>
<p class="fr">
<% poll_user = @poll.poll_users.where(:user_id => User.current).first %>
<% member = @poll.course.members.where(:user_id => User.current.id).first %>
<% setting_time = poll_group_setting @poll, member.try(:course_group) %>
<% if poll_user %>
<% if poll_user.commit_status > 0 %>
<%= link_to '查看答题', poll_path(@poll, :user_id => User.current.id), :class => "white-btn orange-btn fr mt10 mr15" %>
<% elsif setting_time.publish_time < Time.now && setting_time.end_time > Time.now %>
<%= link_to (poll_user.start_at.nil? ? "开始答题" : "继续答题"), poll_path(@poll, :user_id => User.current.id), :class => "white-btn orange-btn fr mt10 mr15" %>
<% end %>
<% elsif setting_time.publish_time < Time.now && setting_time.end_time > Time.now %>
<%= link_to "开始答题", poll_path(@poll, :user_id => User.current.id), :class => "white-btn orange-btn fr mt10 mr15" %>
<% end %>
</p>
<% end %>
<li id="edu-tab-nav-4" class="new-tab-nav" onclick="HoverLi(4);">
<a href="javascript:void(0);" class="tab_type">查看设置</a>
</li>
<% if User.current.member_of_course?(@poll.course) %>
<p class="fr">
<% poll_user = @poll.poll_users.where(:user_id => User.current).first %>
<% member = @poll.course.members.where(:user_id => User.current.id).first %>
<% setting_time = poll_group_setting @poll, member.try(:course_group) %>
<% if poll_user %>
<% if poll_user.commit_status > 0 %>
<%= link_to '查看答题', poll_path(@poll, :user_id => User.current.id), :class => "white-btn orange-btn fr mt10 mr15" %>
<% elsif setting_time.publish_time < Time.now && setting_time.end_time > Time.now %>
<%= link_to (poll_user.start_at.nil? ? "开始答题" : "继续答题"), poll_path(@poll, :user_id => User.current.id), :class => "white-btn orange-btn fr mt10 mr15" %>
<% end %>
<% elsif setting_time.publish_time < Time.now && setting_time.end_time > Time.now %>
<%= link_to "开始答题", poll_path(@poll, :user_id => User.current.id), :class => "white-btn orange-btn fr mt10 mr15" %>
<% end %>
</p>
<% end %>
<% end %>
</ul>
<div id="edu-tab-con-1">
<div id="edu-tab-con-1" class="edu-back-white">
<div id="list_count" class="user_bg_shadow bor-grey-e padding15">
<!--老师显示部分-->
<% if @is_teacher %>
<form id="poll_user_search_form">
<li class="clearfix mb5">
<!--样式edu-filter-btn-yellow等根据状态显示-->
<% poll_curr_status = poll_curr_time @poll %>
<% if poll_curr_status[:status] != "" %>
<span class="edu-filter-btn <%= homework_status_color poll_curr_status[:status] %> fl "><%= poll_curr_status[:status] %></span>
<% end %>
<% if @poll.try(:polls_status) == 1 && @poll.publish_time %>
<span class="color-grey fr font-12">将于&nbsp;<span class="color-orange font-12"><%= format_time(@poll.publish_time).to_s %></span>&nbsp;发布</span>
<% else %>
<span class="fr font-12 <%= @poll.try(:polls_status) == 3 ? 'color-grey' : 'color-orange' %>"><%= poll_curr_status[:time] %></span>
<% end %>
</li>
<input id="poll_id" type="hidden" value="<%= @poll.id %>">
<ul class="work_search_ul clearfix">
<form id="poll_user_search_form">
<li class="clearfix mb5">
<span class="fl mr10 color-grey">答题状态:</span>
<span class="fl mr25">
<a href="javascript:void(0);" id="poll_status_no_limit" class="<%= @status.blank? ? 'check_on' : '' %> pl5 pr5">不限</a>
</span>
<input id="work_status_1" class="magic-checkbox fl" type="checkbox" value="0" name="poll_status[]" <%= !@status.blank? && @status.include?('0') ? 'checked' : '' %>>
<label for="work_status_1" class="fl mr25">未提交(<%= un_commit_num @poll %>)</label>
<input id="work_status_2" class="magic-checkbox fl" type="checkbox" value="1" name="poll_status[]" <%= !@status.blank? && @status.include?('1') ? 'checked' : '' %>>
<label for="work_status_2" class="fl mr25">按时提交(<%= has_commit_num @poll %>)</label>
<!--样式edu-filter-btn-yellow等根据状态显示-->
<% poll_curr_status = poll_curr_time @poll %>
<% if poll_curr_status[:status] != "" %>
<span class="edu-filter-btn <%= homework_status_color poll_curr_status[:status] %> fl "><%= poll_curr_status[:status] %></span>
<% end %>
<% if @poll.try(:polls_status) == 1 && @poll.publish_time %>
<span class="color-grey fr font-12">将于&nbsp;<span class="color-orange font-12"><%= format_time(@poll.publish_time).to_s %></span>&nbsp;发布</span>
<% else %>
<span class="fr font-12 <%= @poll.try(:polls_status) == 3 ? 'color-grey' : 'color-orange' %>"><%= poll_curr_status[:time] %></span>
<% end %>
</li>
<li class="clearfix mb5">
<span class="fl mr10 color-grey">分班情况:</span>
<span class="fl mr25">
<a href="javascript:void(0);" id="poll_group_no_limit" class="<%= @group.blank? ? 'check_on' : '' %> pl5 pr5">不限</a>
</span>
<div class="fl mb5" style="max-width: 83%">
<% if @group_teacher %>
<% groups = @course.course_groups.where(:id => @member.teacher_course_groups.pluck(:course_group_id)) %>
<% else %>
<% groups = @course.course_groups %>
<% end %>
<% groups.each do |group| %>
<input id="group_<%= group.id %>" class="magic-checkbox fl" type="checkbox" value="<%= group.id %>" name="poll_group[]" <%= !@group.blank? && @group.include?(group.id) ? 'checked' : '' %>>
<label for="group_<%= group.id %>" class="fl mr25"><%= group.name %>(<%= group.members.count %>)</label>
<% end %>
<% if !@group_teacher %>
<input id="group_0" class="magic-checkbox fl" type="checkbox" value="0" name="poll_group[]">
<label for="group_0" class="fl mr25">未分班(<%= @no_group_count %>)</label>
<% end %>
<input id="poll_id" type="hidden" value="<%= @poll.id %>">
<ul class="work_search_ul clearfix">
<li class="clearfix mb5">
<span class="fl mr10 color-grey">答题状态:</span>
<span class="fl mr25">
<a href="javascript:void(0);" id="poll_status_no_limit" class="<%= @status.blank? ? 'check_on' : '' %> pl5 pr5">不限</a>
</span>
<input id="work_status_1" class="magic-checkbox fl" type="checkbox" value="0" name="poll_status[]" <%= !@status.blank? && @status.include?('0') ? 'checked' : '' %> />
<label for="work_status_1" class="fl mr25">未提交(<%= un_commit_num @poll %>)</label>
<input id="work_status_2" class="magic-checkbox fl" type="checkbox" value="1" name="poll_status[]" <%= !@status.blank? && @status.include?('1') ? 'checked' : '' %> />
<label for="work_status_2" class="fl mr25">按时提交(<%= has_commit_num @poll %>)</label>
</li>
<li class="clearfix mb5">
<span class="fl mr10 color-grey">分班情况:</span>
<span class="fl mr25">
<a href="javascript:void(0);" id="poll_group_no_limit" class="<%= @group.blank? ? 'check_on' : '' %> pl5 pr5">不限</a>
</span>
<div class="fl mb5" style="max-width: 83%">
<% if @group_teacher %>
<% groups = @course.course_groups.where(:id => @member.teacher_course_groups.pluck(:course_group_id)) %>
<% else %>
<% groups = @course.course_groups %>
<% end %>
<% groups.each do |group| %>
<input id="group_<%= group.id %>" class="magic-checkbox fl" type="checkbox" value="<%= group.id %>" name="poll_group[]" <%= !@group.blank? && @group.include?(group.id) ? 'checked' : '' %> />
<label for="group_<%= group.id %>" class="fl mr25"><%= group.name %>(<%= group.members.count %>)</label>
<% end %>
<% if !@group_teacher %>
<input id="group_0" class="magic-checkbox fl" type="checkbox" value="0" name="poll_group[]">
<label for="group_0" class="fl mr25">未分班(<%= @no_group_count %>)</label>
<% end %>
</div>
</li>
</ul>
<li class="clearfix mt5 mb10">
<div class="edu-find fr mr20 with20 pr">
<div class="edu-find-input">
<input type="text" class="with100 panel-box-sizing" maxlength="20" placeholder="姓名、学号关键字检索" value="<%= @name %>" id="student_user_name" />
<!--<i class="fa fa-close mr5 color-grey edu-close" onclick="colse_searchbox();"></i>-->
<span class="edu-close" onclick="clear_searchbox();" data-tip-down="关闭">×</span>
</div>
<a href="javascript:void(0);" onclick="SearchByName_poll();" class="edu-open font-16 color-grey"><i class="fa fa-search"></i></a>
</div>
</li>
</ul>
<li class="clearfix mt5 mb10">
<div class="edu-find fr mr20 with20 pr">
<div class="edu-find-input">
<input type="text" class="with100 panel-box-sizing" maxlength="20" placeholder="姓名、学号关键字检索" value="<%= @name %>" id="student_user_name">
<!--<i class="fa fa-close mr5 color-grey edu-close" onclick="colse_searchbox();"></i>-->
<span class="edu-close" onclick="clear_searchbox();" data-tip-down="关闭">×</span>
</div>
<a href="javascript:void(0);" onclick="SearchByName_poll();" class="edu-open font-16 color-grey"><i class="fa fa-search"></i></a>
</div>
</li>
</form>
</form>
<% elsif User.current.member_of_course?(@poll.course) %>
<!--学生显示部分-->
<div class="clearfix mb10">
<p class="fl">
<% poll_user = @poll.poll_users.where(:user_id => User.current).first %>
<% if poll_user %>
<% if poll_user.commit_status > 0 %>
<span class="edu-filter-btn edu-filter-btn-orange">你已提交</span>
<% else %>
<span class="edu-filter-btn edu-filter-btn-orange">你未提交</span>
<!--学生显示部分-->
<div class="clearfix mb10">
<p class="fl">
<% poll_user = @poll.poll_users.where(:user_id => User.current).first %>
<% if poll_user %>
<% if poll_user.commit_status > 0 %>
<span class="edu-filter-btn edu-filter-btn-orange">你已提交</span>
<% else %>
<span class="edu-filter-btn edu-filter-btn-orange">你未提交</span>
<% end %>
<% end %>
<% end %>
</p>
</p>
<p class="fr font-12 mt8">
<span class="fr color-grey ml10"><%= @has_commit_count %>人已交)</span>
<% if @poll.polls_status == 2 && @poll.end_time > Time.now %>
<% end_time = @poll.end_time.to_time.to_i %>
<span class="fr color-grey">答题剩余时间:<span class="color-orange03"><%= (end_time - Time.now.to_i) / (24 * 60 * 60) %></span>天<span class="color-orange03"><%= ((end_time - Time.now.to_i) % (24 * 60 * 60)) / (60 * 60) %></span>小时<span class="color-orange03"><%= (((end_time - Time.now.to_i) % (24 * 60 * 60)) % (60 * 60)) / 60 %></span>分</span>
<% elsif @poll.polls_status == 3 %>
<span class="color-orange ml30">提交已截止</span>
<% end %>
</p>
</div>
<p class="fr font-12 mt8">
<span class="fr color-grey ml10"><%= @has_commit_count %>人已交)</span>
<% if @poll.polls_status == 2 && @poll.end_time > Time.now %>
<% end_time = @poll.end_time.to_time.to_i %>
<span class="fr color-grey">答题剩余时间:<span class="color-orange03"><%= (end_time - Time.now.to_i) / (24 * 60 * 60) %></span>天<span class="color-orange03"><%= ((end_time - Time.now.to_i) % (24 * 60 * 60)) / (60 * 60) %></span>小时<span class="color-orange03"><%= (((end_time - Time.now.to_i) % (24 * 60 * 60)) % (60 * 60)) / 60 %></span>分</span>
<% elsif @poll.polls_status == 3 %>
<span class="color-orange ml30">提交已截止</span>
<% end %>
</p>
</div>
<% end %>
<div id="poll_student_work_list">
@ -196,71 +192,71 @@
<div class="clearfix">
<% @poll.poll_questions.includes(:poll_answers).each_with_index do |poll_question, i| %>
<div class="question_item_con font-14 user_bg_shadow bor-grey-e mb20 pt15">
<div class="clearfix pl15 pr15">
<p class="fl font-15" id="mao<%= poll_question.question_number %>">
<% if poll_question.try(:is_necessary) == 1 %>
<span class="color-orange03">*</span>
<% end %>
第<%= poll_question.question_number %>
题:<span class="color-orange03">[<%= poll_question.question_type_name %>]</span>
<% if poll_question.question_type == 2 && (poll_question.min_choices != 0 || poll_question.max_choices != 0) %>
<span class="ml10">可选 <%= poll_question.min_choices %> - <%= poll_question.max_choices %> 项</span>
<% end %>
</p>
</div>
<div class="pl15 pr15 justify upload_img table_maxWidth break_word"><%= poll_question.question_title.html_safe %></div>
<% case poll_question.question_type %>
<% when 1 %>
<div class="pl15 pr15 mb15">
<% poll_answers = poll_question.poll_answers %>
<% poll_answers.each_with_index do |poll_answer, index| %>
<li class="clearfix">
<% if poll_answer.answer_text != '' %>
<input class="magic-radio fl mt5 magic-checkbox_show" id="poll_<%= poll_answer.id %>_poll_answer_id" type="radio">
<label class="fl color-grey3" for="poll_<%= poll_answer.id %>_poll_answer_id"><%= poll_answer.answer_text %></label>
<% else %>
<span class="fl mr5">
<input class="ml-3 mr5 magic-radio" id="sx_<%= poll_answer.id %>" name="<%= poll_question %>" value="" type="radio">
<label for="sx_<%= poll_answer.id %>">其它</label>
</span>
<input type="text" readonly class="fl other_input with90 mt3"/>
<% end %>
</li>
<% end %>
<div class="question_item_con font-14 user_bg_shadow bor-grey-e mb20 pt15">
<div class="clearfix pl15 pr15">
<p class="fl font-15" id="mao<%= poll_question.question_number %>">
<% if poll_question.try(:is_necessary) == 1 %>
<span class="color-orange03">*</span>
<% end %>
第<%= poll_question.question_number %>
题:<span class="color-orange03">[<%= poll_question.question_type_name %>]</span>
<% if poll_question.question_type == 2 && (poll_question.min_choices != 0 || poll_question.max_choices != 0) %>
<span class="ml10">可选 <%= poll_question.min_choices %> - <%= poll_question.max_choices %> 项</span>
<% end %>
</p>
</div>
<% when 2 %>
<div class="pl15 pr15 mb15">
<% poll_answers = poll_question.poll_answers %>
<% poll_answers.each_with_index do |poll_answer, index| %>
<li class="clearfix">
<% if poll_answer.answer_text != '' %>
<input class="magic-checkbox fl mt5 magic-checkbox_show" id="poll_<%= poll_answer.id %>_poll_answer_id" type="checkbox">
<label class="fl color-grey3" for="poll_<%= poll_answer.id %>_poll_answer_id"><%= poll_answer.answer_text %></label>
<% else %>
<span class="fl mr5">
<input class="ml-3 mr5 magic-checkbox" id="sx_<%= poll_answer.id %>" name="<%= poll_question %>" value="" type="checkbox">
<label for="sx_<%= poll_answer.id %>">其它</label>
</span>
<input type="text" readonly class="fl other_input with90 mt3"/>
<div class="pl15 pr15 justify upload_img table_maxWidth break_word"><%= poll_question.question_title.html_safe %></div>
<% case poll_question.question_type %>
<% when 1 %>
<div class="pl15 pr15 mb15">
<% poll_answers = poll_question.poll_answers %>
<% poll_answers.each_with_index do |poll_answer, index| %>
<li class="clearfix">
<% if poll_answer.answer_text != '' %>
<input class="magic-radio fl mt5 magic-checkbox_show" id="poll_<%= poll_answer.id %>_poll_answer_id" type="radio">
<label class="fl color-grey3" for="poll_<%= poll_answer.id %>_poll_answer_id"><%= poll_answer.answer_text %></label>
<% else %>
<span class="fl mr5">
<input class="ml-3 mr5 magic-radio" id="sx_<%= poll_answer.id %>" name="<%= poll_question %>" value="" type="radio">
<label for="sx_<%= poll_answer.id %>">其它</label>
</span>
<input type="text" readonly class="fl other_input with90 mt3"/>
<% end %>
</li>
<% end %>
</li>
<% end %>
</div>
<% when 3 %>
<div class="pl15 pr15 mb15">
<textarea class="task-height-150 with100 pl15" style="box-sizing: border-box" placeholder="在此填入答案" disabled></textarea>
</div>
<% end %>
</div>
</div>
<% when 2 %>
<div class="pl15 pr15 mb15">
<% poll_answers = poll_question.poll_answers %>
<% poll_answers.each_with_index do |poll_answer, index| %>
<li class="clearfix">
<% if poll_answer.answer_text != '' %>
<input class="magic-checkbox fl mt5 magic-checkbox_show" id="poll_<%= poll_answer.id %>_poll_answer_id" type="checkbox"/>
<label class="fl color-grey3" for="poll_<%= poll_answer.id %>_poll_answer_id"><%= poll_answer.answer_text %></label>
<% else %>
<span class="fl mr5">
<input class="ml-3 mr5 magic-checkbox" id="sx_<%= poll_answer.id %>" name="<%= poll_question %>" value="" type="checkbox"/>
<label for="sx_<%= poll_answer.id %>">其它</label>
</span>
<input type="text" readonly class="fl other_input with90 mt3"/>
<% end %>
</li>
<% end %>
</div>
<% when 3 %>
<div class="pl15 pr15 mb15">
<textarea class="task-height-150 with100 pl15" style="box-sizing: border-box" placeholder="在此填入答案" disabled></textarea>
</div>
<% end %>
</div>
<% end %>
</div>
</div>
</div>
<div id="edu-tab-con-4" class="user_bg_shadow bor-grey-e undis">
<%= render :partial => "poll_setting" %>
<div id="edu-tab-con-4" class="user_bg_shadow bor-grey-e undis edu-back-white">
<%= render :partial => "poll_setting" %>
</div>
</div>
</div>
</div>
<script>
$(function () {

@ -101,7 +101,7 @@
<% end %>
<a href="javascript:void(0);" class="fr user_default_btn edu-greyback-btn mr15 font-18">已关闭</a>
<% end %>
<% if @shixun.can_copy %>
<% if @shixun.can_copy && User.current.logged? %>
<div href="javascript:void(0)" class="fr user_default_btn user_blue_btn mr20" style="display: flex;">
<% if User.current.mail.blank? %>
<a data-tip-down = "基于这个实训修改形成新的实训"

@ -86,6 +86,7 @@
<% end %>
</p>
<% if User.current.logged? %>
<div class="homepagePostSetting" style="right: 4px;top: 5px;display: block">
<ul>
<li class="edu-position edu-position-hidebox">
@ -105,6 +106,8 @@
</li>
</ul>
</div>
<% end %>
</div>
</div>
<% end %>

@ -600,7 +600,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
get 'create_departments'
post 'add_department'
get 'shixun_feedback'
get 'shixun_feedback_message'
match 'shixun_feedback_message', :via => [:get, :post]
get 'leave_message'
get 'messages_list'
get 'course_messages_list'

Loading…
Cancel
Save