Merge branch 'cxt_course' into develop

Conflicts:
	db/schema.rb
This commit is contained in:
cxt 2016-11-18 15:45:06 +08:00
commit 5510df165d
47 changed files with 856 additions and 303 deletions

View File

@ -23,7 +23,7 @@ class CoursesController < ApplicationController
before_filter :can_show_course, :except => []
before_filter :logged_user_by_apptoken,:only => [:show,:feedback]
before_filter :find_course, :except => [ :index, :search, :new,:join,:unjoin, :create, :new_join, :course,:join_private_courses, :join_course_multi_role]
before_filter :find_course, :except => [ :index, :search, :new, :join, :unjoin, :create, :new_join, :course, :join_private_courses, :join_course_multi_role]
before_filter :authorize_course, :only => [:show, :settings, :update, :course]
before_filter :authorize_course_global, :only => [:new,:create]
before_filter :toggleCourse, :only => [:finishcourse, :restartcourse]
@ -303,18 +303,21 @@ class CoursesController < ApplicationController
@member = Member.where(:course_id => @course.id, :user_id => params[:user_id]).first
@member.course_group_id = params[:course_group_id].to_i
@member.save
if params[:group_id] && params[:group_id] != "-1"
@group = CourseGroup.find params[:group_id]
results = student_homework_score(@group.id,0,0,"desc")
@limit = 50
@page = params[:page].nil? ? 1 : params['page'].to_i
@members_count = results.count
@mem_pages = Paginator.new @members_count, @limit, @page
@results = paginateHelper results, @limit
else
@course_groups = @course.course_groups
@no_group_count = @course.student.count - @course.members.where("course_group_id != 0").count
if params[:group_id] != "0"
if params[:group_id] == "-1"
@group = "-1"
else
@group = CourseGroup.find params[:group_id]
end
# results = student_homework_score(@group.id,0,0,"desc")
# @limit = 50
# @page = params[:page].nil? ? 1 : params['page'].to_i
# @members_count = results.count
# @mem_pages = Paginator.new @members_count, @limit, @page
# @results = paginateHelper results, @limit
end
@course_groups = @course.course_groups
@no_group_count = @course.student.count - @course.members.where("course_group_id != 0").count
@canShowCode = isCourseTeacher(User.current.id,@course)
respond_to do |format|
format.js
@ -831,11 +834,11 @@ class CoursesController < ApplicationController
end
if @course
#发送微信消息
# count = ShieldWechatMessage.where("container_type='User' and container_id=#{User.current.id} and shield_type='Course' and shield_id=#{@course.id}").count
# if count == 0
# ss = SyllabusesService.new
# ss.send_wechat_create_class_notice User.current,@course
# end
count = ShieldWechatMessage.where("container_type='User' and container_id=#{User.current.id} and shield_type='Course' and shield_id=#{@course.id}").count
if count == 0
ss = SyllabusesService.new
ss.send_wechat_create_class_notice User.current,@course
end
respond_to do |format|
flash[:notice] = l(:notice_successful_create)
format.html {redirect_to course_url(@course)}
@ -1305,6 +1308,21 @@ class CoursesController < ApplicationController
redirect_to user_url(User.current)
end
#归档班级
def archive_course
if params[:source] == "1"
@syllabus = @course.syllabus
end
if params[:type] == "0"
@course.delete!
else
@course.update_attribute(:is_delete, false)
end
respond_to do |format|
format.js
end
end
# 恢复已删除的课程
def renew
if User.current.admin?

View File

@ -374,12 +374,13 @@ class ExerciseController < ApplicationController
=end
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
@all_exercises = @course.exercises.where("exercise_status > 1").order("created_at desc")
@exercise_count = @exercise.exercise_users.where('score is not NULL').count
if @is_teacher || (!@exercise.exercise_users.where(:user_id => User.current.id).empty? && @exercise.end_time <= Time.now)
@exercise_users_list = @exercise.exercise_users.where('score is not NULL')
student_id = @course.student.blank? ? "(-1)" : "(" + @course.student.map{|student| student.student_id}.join(",") + ")"
@exercise_count = @exercise.exercise_users.where("score is not NULL and user_id in #{student_id}").count
if @is_teacher || (!@exercise.exercise_users.where("user_id = #{User.current.id} and user_id in #{student_id}").empty? && @exercise.end_time <= Time.now)
@exercise_users_list = @exercise.exercise_users.where("score is not NULL and user_id in #{student_id}")
@show_all = true;
elsif !@exercise.exercise_users.where(:user_id => User.current.id).empty? && @exercise.end_time > Time.now
@exercise_users_list = @exercise.exercise_users.where("user_id = ? and score is not NULL",User.current.id)
elsif !@exercise.exercise_users.where("user_id = #{User.current.id} and user_id in #{student_id}").empty? && @exercise.end_time > Time.now
@exercise_users_list = @exercise.exercise_users.where("user_id = ? and score is not NULL and user_id in #{student_id}",User.current.id)
else
@exercise_users_list = []
end
@ -537,7 +538,7 @@ class ExerciseController < ApplicationController
else
# 更新提交状态
cur_exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", User.current, @exercise.id).first
cur_exercise_user.update_attributes(:status => 1)
cur_exercise_user.update_attributes(:status => 1, :commit_status => 1)
# 答题过程中需要统计完成量
@uncomplete_question = get_uncomplete_question(@exercise, User.current)
# 获取改学生的考试得分
@ -618,6 +619,95 @@ class ExerciseController < ApplicationController
score = score1 + score2 + score3
end
#导入试卷的弹框
def other_exercise
# 查作者是我,或者作者是当前课程的老师,且不在当前课程内的试卷 进行导入
@order,@b_sort = params[:order] || "created_at",params[:sort] || "desc"
@r_sort = @b_sort == "desc" ? "asc" : "desc"
courses = User.current.courses.not_deleted.select { |course| User.current.allowed_to?(:as_teacher,course)}
course_ids = courses.empty? ? "(-1)" : "(" + courses.map { |course| course.id}.join(',') + ")"
#none_courses = User.current.courses.where("is_delete = 1 or #{Course.table_name}.id = #{params[:course_id].to_i}")
#none_course_ids = none_courses.empty? ? "(-1)" : "(" + none_courses.map { |course| course.id}.join(',') + ")"
@exercises = Exercise.where("(user_id = #{User.current.id} or course_id in #{course_ids}) and course_id != #{params[:course_id].to_i}").order("#{@order} #{@b_sort}")
@course_id = params[:course_id]
@is_remote = true
@ex_count = @exercises.count
@ex_pages = Paginator.new @ex_count, 10, params['page'] || 1
@offset ||= @ex_pages.offset
@exercises = paginateHelper @exercises,10
respond_to do |format|
format.js
end
end
#搜索导入页面的试卷
def search_exercises
@order,@b_sort = params[:order] || "created_at",params[:sort] || "desc"
@r_sort = @b_sort == "desc" ? "asc" : "desc"
search = params[:name].to_s.strip.downcase
courses = User.current.courses.not_deleted.select { |course| User.current.allowed_to?(:as_teacher,course)}
course_ids = courses.empty? ? "(-1)" : "(" + courses.map { |course| course.id}.join(',') + ")"
@exercises = Exercise.where("(user_id = #{User.current.id} or course_id in #{course_ids}) and course_id != #{params[:course_id].to_i} and exercise_name like '%#{search}%'").order("#{@order} #{@b_sort}")
@is_remote = true
@ex_count = @exercises.count
@ex_pages = Paginator.new @ex_count, 10, params['page'] || 1
@offset ||= @ex_pages.offset
@exercises = paginateHelper @exercises,10
@course_id = params[:course_id]
respond_to do |format|
format.js
end
end
#将选择的试卷导入到班级
def import_other_exercise
course_id = params[:course_id]
@course = Course.find(course_id)
params[:exercise_id].each_with_index do |ex,i|
exercise = Exercise.find(ex)
option = {
:exercise_name => exercise.exercise_name,
:exercise_status => 1,
:user_id => User.current.id,
:show_result => 1,
:course_id => @course.id,
:time => exercise.time,
:exercise_description => exercise.exercise_description
}
@exercise = Exercise.create option
exercise.exercise_questions.each do |q|
option = {
:question_title => q[:question_title],
:question_type => q[:question_type] || 1,
:question_number => q[:question_number],
:question_score => q[:question_score]
}
@exercise_question = @exercise.exercise_questions.new option
for i in 1..q.exercise_choices.count
choice_option = {
:choice_position => i,
:choice_text => q.exercise_choices[i-1][:choice_text]
}
@exercise_question.exercise_choices.new choice_option
end
for i in 1..q.exercise_standard_answers.count
standard_answer_option = {
:exercise_choice_id => q.exercise_standard_answers[i-1][:exercise_choice_id],
:answer_text => q.exercise_standard_answers[i-1][:answer_text]
}
@exercise_question.exercise_standard_answers.new standard_answer_option
end
end
@exercise.save
end
respond_to do |format|
format.js
end
end
private
#测验列表转换为excel
def exercise_to_xls items

View File

@ -96,8 +96,10 @@ class SyllabusesController < ApplicationController
end
end
#班级列表
#班级列表 list_type: 1 班级列表 2 归档班级列表
def syllabus_courselist
@list_type = params[:list_type].to_i || 0
@order, @c_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1
#确定 sort_type
@ -110,7 +112,7 @@ class SyllabusesController < ApplicationController
sort_name = "updated_on"
sort_type = @c_sort == 1 ? "asc" : "desc"
@courses = @syllabus.courses.where("is_delete = ?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS #{sort_name}").order("#{sort_name} #{sort_type}")
@courses = @syllabus.courses.where("is_delete = ?", @list_type).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS #{sort_name}").order("#{sort_name} #{sort_type}")
#根据 作业+资源数排序
if @order.to_i == 2

View File

@ -3724,6 +3724,9 @@ end
#作业类型
def homework_type_option
type = []
option0 = []
option0 << "请选择"
option0 << 0
option1 = []
option1 << "普通作业"
option1 << 1
@ -3733,6 +3736,7 @@ def homework_type_option
option3 = []
option3 << "分组作业"
option3 << 3
type << option0
type << option1
type << option2
type << option3

View File

@ -1,4 +1,5 @@
class ExerciseUser < ActiveRecord::Base
#commit_status 0:未交 1:已交
include Redmine::SafeAttributes
belongs_to :user

View File

@ -20,10 +20,6 @@
{
params.contentmsg.text("描述不能为空");
params.contentmsg.css('color','#ff0000');
}
else if(params.content.html().length >=20000){
params.contentmsg.text("描述最多20000个汉字(或40000个英文字符)");
params.contentmsg.css('color','#ff0000');
result=false;
}
else
@ -177,7 +173,7 @@
<span class="fr mr10 mt3">或</span>
<a href="javascript:void(0);" class="fr mr10 mt3" onclick="reset_topic();">取消</a>
<% else %>
<a href="javascript:void(0);" class="BlueCirBtnMini fr" id="new_message_submit_btn" onclick="submit_topic();">确定</a>
<a href="javascript:void(0);" class="BlueCirBtnMini fr" id="new_message_submit_btn">确定</a>
<span class="fr mr10 mt3">或</span>
<%= link_to "取消",board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "fr mr10 mt3"%>
<% end %>

View File

@ -12,13 +12,6 @@
.cl{ clear:both; overflow:hidden; }
a{ text-decoration:none !important; }
a:hover{ }
.error_content{ width:550px; height:200px; margin:0 auto; padding:10px 0;}
.error_left{color:#15bccf; font-size:100px; font-weight:bold; font-style:oblique; width:200px; height:120px; padding-right:30px; float:left;}
.error_right{ width:240px; height:120px; float:left;color:#15bccf; font-size: 17px; font-weight:bold; padding-left:30px; margin-top:40px; border-left:1px dashed #CCC; }
.error_link{ margin-top:8px;}
.error_link a{ display:block; width:80px; height:28px; font-size:14px; font-weight:bold; color:#fff; text-align:center; background:#15bccf; float:left; margin-right:10px;}
.error_link a:hover{ background:#ff8417;}
</style>
<script type="text/javascript">
$(function(){
@ -26,24 +19,51 @@
{
$("#history_back").css("background","#CCC");
}
$("#subject").keydown(function(){
var curLength=$("#subject").val().length;
if(curLength>50){
var num=$("#subject").val().substr(0,50);
$("#subject").val(num);
}
else{
$("#textCount").text(50-$("#subject").val().length)
}
}).keyup(function(){
var curLength=$("#subject").val().length;
if(curLength>50){
var num=$("#subject").val().substr(0,50);
$("#subject").val(num);
}
else{
$("#textCount").text(50-$("#subject").val().length)
}
});
});
</script>
</head>
<body>
<div class="error_content">
<div class="error_left">403</div>
<div class="error_right">
<p>ERROR FORBIDDEN<br />
没有访问权限!建议您</p>
<div class="error_link">
<!---<a href="http://forge.trustie.net/" target="_blank">返回首页</a>---->
<a href="javascript:history.back()" id="history_back">后退一步</a>
<a href="http://user.trustie.net/users/5/user_newfeedback">给我留言</a>
<div class="muban_conbox_max">
<div class="pages_new_404">
<img src="/images/404/pic_403.jpg" >
<p class="pages_new_404_txt mt40">
您没有访问权限,请先获取相应权限。
<a href="javascript:history.back()" id="history_back" class="linkBlue2 ml5 mr10">返回上页>></a>
<a href="javascript:void(0)" class="linkBlue2 ml5 mr10" onclick="$('#feedback_div').toggle();"> 给我留言>></a>
<a href="http://shang.qq.com/wpa/qunwpa?idkey=fb938b1f6f991fc100f3d32b6ef38b7888dd4097c71d0eb8b239eaa8749a6afd" target="_blank" class="linkBlue2">QQ反馈>></a>
</p>
<div style="display:none;" class="ml10 mt10" id="feedback_div">
<% get_memo %>
<%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %>
<%= f.text_area :subject, :id=>"subject", :class => "feedbackText mb5", :placeholder => "请在此输入平台的问题和建议您也可以通过QQ留言谢谢" %>
<%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
<span class="c_grey fl">还能输入<span id="textCount" class="c_orange">50</span>个字符</span>
<a href="javascript:void(0);" class="sy_btn_blue_mini f12 fr mr10" onclick="$('#new_memo').submit();">&nbsp;&nbsp;</a>
<a href="javascript:void(0);" class="sy_btn_grey_mini f12 fr mr10" onclick="$('#feedback_div').hide();">&nbsp;&nbsp;</a>
<div class="cl"></div>
<% end %>
</div>
</div>
</div>
</body>
</html>

View File

@ -12,30 +12,55 @@ ul,li{ list-style-type:none}
.cl{ clear:both; overflow:hidden; }
a{ text-decoration:none; }
a:hover{ }
.error_content{ width:550px; height:200px; margin:0 auto; padding:10px 0;}
.error_left{color:#15bccf; font-size:100px; font-weight:bold; font-style:oblique; width:200px; height:120px; padding-right:30px; float:left;}
.error_right{ width:240px; height:120px; float:left;color:#15bccf; font-size: 18px; font-weight:bold; padding-left:30px; margin-top:40px; border-left:1px dashed #CCC; }
.error_link{ margin-top:8px;}
.error_link a{ display:block; width:80px; height:28px; font-size:14px; font-weight:bold; color:#fff; text-align:center; background:#15bccf; float:left; margin-right:10px;}
.error_link a:hover{ background:#ff8417;}
</style>
<script type="text/javascript">
$(function(){
$("#subject").keydown(function(){
var curLength=$("#subject").val().length;
if(curLength>50){
var num=$("#subject").val().substr(0,50);
$("#subject").val(num);
}
else{
$("#textCount").text(50-$("#subject").val().length)
}
}).keyup(function(){
var curLength=$("#subject").val().length;
if(curLength>50){
var num=$("#subject").val().substr(0,50);
$("#subject").val(num);
}
else{
$("#textCount").text(50-$("#subject").val().length)
}
});
});
</script>
</head>
<body>
<div class="muban_conbox_max">
<div class="pages_new_404">
<img src="/images/404/pic_404.jpg" >
<p class="pages_new_404_txt mt40">
非常抱歉,您访问的页面不存在或已删除。
<a href="javascript:history.back()" class="linkBlue2 mr10">返回上页>></a>
<a href="javascript:void(0)" class="linkBlue2 mr10" onclick="$('#feedback_div').toggle();"> 给我留言>></a>
<a href="http://shang.qq.com/wpa/qunwpa?idkey=fb938b1f6f991fc100f3d32b6ef38b7888dd4097c71d0eb8b239eaa8749a6afd" target="_blank" class="linkBlue2">QQ反馈>></a>
</p>
<div class="error_content">
<div class="error_left">404</div>
<div class="error_right">
<p><span style="font-size:24px;">ERROR PAGE</span><br />
页面不见了!建议您</p>
<div class="error_link">
<!---<a href="http://forge.trustie.net/" target="_blank">返回首页</a>---->
<a href="javascript:history.back()">后退一步</a>
<a href="http://user.trustie.net/users/5/user_newfeedback">给我留言</a>
<div style="display:none;" class="mt10" id="feedback_div">
<% get_memo %>
<%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %>
<%= f.text_area :subject, :id=>"subject", :style => "width: 570px;", :class => "feedbackText mb5", :placeholder => "请在此输入平台的问题和建议您也可以通过QQ留言谢谢" %>
<%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
<span class="c_grey fl">还能输入<span id="textCount" class="c_orange">50</span>个字符</span>
<a href="javascript:void(0);" class="sy_btn_blue_mini f12 fr mr10" onclick="$('#new_memo').submit();">&nbsp;&nbsp;</a>
<a href="javascript:void(0);" class="sy_btn_grey_mini f12 fr mr10" onclick="$('#feedback_div').hide();">&nbsp;&nbsp;</a>
<div class="cl"></div>
<% end %>
</div>
</div>
</div>
</body>
</html>

View File

@ -120,7 +120,7 @@
<% if @course.course_groups.empty? %>
<%=member.course_group_id == 0 ? "暂无" : member.course_group.name %>
<% else %>
<%= form_tag({:controller => 'courses', :action => 'teacher_assign_group', :id => @course.id,:user_id => member.user_id, :group_id => @group && @group != -1 ? @group.id : -1},:remote=>'true', :method => 'post', :id=>"join_group_form_#{member.id}", :class => 'query_form') do %>
<%= form_tag({:controller => 'courses', :action => 'teacher_assign_group', :id => @course.id,:user_id => member.user_id, :group_id => @group && @group != -1 ? @group.id : (@group && @group == -1 ? -1 : 0)},:remote=>'true', :method => 'post', :id=>"join_group_form_#{member.id}", :class => 'query_form') do %>
<div class="select-class-option">
<span class="hidden" style="display:inline-block; vertical-align:middle; max-width:70px;"><%=member.course_group_id == 0 ? "暂无" : member.course_group.name %></span>
<a href="javascript:void(0)" class="sy_icons_edit pic_edit_icon fr mt9 options_show_or_hide" alt="编辑" style="background-position:0 5px;"></a>

View File

@ -0,0 +1,17 @@
<% if params[:type] == "0" %>
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>已归档</p>' +
'<a href="javascript:void(0);" class="btn btn-blue mt10" onclick="click_OK();">确定</a></div></div></div>';
<% else %>
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>已恢复</p>' +
'<a href="javascript:void(0);" class="btn btn-blue mt10" onclick="click_OK();">确定</a></div></div></div>';
<% end %>
pop_box_new(htmlvalue, 400, 132);
function click_OK(){
hideModal();
<% if params[:source] == "1" %>
window.location.href = "<%=syllabus_courselist_syllabus_path(@syllabus, :list_type => params[:type].to_i) %>";
<% end %>
}

View File

@ -9,7 +9,7 @@
<% if @syllabus.nil? %>
<%= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"new_syllabus_id", :class=>"syllabus_input w300 h28"} %>
<% else %>
<span><%=@syllabus.title %></span>
<span id="course_syllabus_title"><%=@syllabus.title %></span>
<input style="display: none;" name="syllabus_id" value="<%=@syllabus.id %>" />
<% end %>
<div class="cl"></div>

View File

@ -1,8 +1,9 @@
<% if @group %>
<% if params[:group_id] != "0" %>
$("#member_li_<%=@member.id %>").html("");
<% end %>
<% if @group && @group != "-1" %>
//$("#member_content").html("<%#= escape_javascript( render :partial => 'new_member_list', :locals => {:members => @results})%>");
$("#join_or_add").html("<%= escape_javascript( render :partial => 'join_or_add')%>");
<% else %>
$("#st_groups").html("<%=escape_javascript(render :partial => 'new_groups_name', :locals => {:course_groups => @course_groups}) %>");
<% end %>
$("#st_groups").html("<%=escape_javascript(render :partial => 'new_groups_name', :locals => {:course_groups => @course_groups}) %>");
$("#group_children_list").html("<%= escape_javascript( render :partial => 'layouts/group_children_list', :locals => {:course => @course})%>");

View File

@ -0,0 +1,30 @@
<table class="newupload_table" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th class="newupload_td01">&nbsp;</th>
<th class="pr">
<%= link_to "试卷标题", search_exercises_exercise_index_path(:course_id => course_id, :order => "exercise_name", :sort => @r_sort), :remote => true%>
<% if order == "exercise_name" %>
<%= link_to "", search_exercises_exercise_index_path(:course_id => course_id, :order => "exercise_name", :sort => @r_sort), :class => "#{@r_sort == 'desc' ? 'sortupbtn' : 'sortdownbtn'}", :style => "position: absolute; top: 8px; left: 172px;", :remote => true %>
<% end %>
</th>
<th class="newupload_td03" style="color: #7f7f7f;">来源</th>
<th class="newupload_td04 pr">
<%= link_to "创建时间", search_exercises_exercise_index_path(:course_id => course_id, :order => "created_at", :sort => @r_sort), :remote => true%>
<% if order == "created_at" %>
<%= link_to "", search_exercises_exercise_index_path(:course_id => course_id, :order => "created_at", :sort => @r_sort), :class => "#{@r_sort == 'desc' ? 'sortupbtn' : 'sortdownbtn'}", :style => "position: absolute; top: 8px; left: 75px;", :remote => true %>
<% end %>
</th>
</tr>
</thead>
<tbody>
<% exercises.each do |exercise| %>
<tr class="">
<td class="newupload_td01"><input type="checkbox" name="exercise_id[]" value="<%=exercise.id %>"/></td>
<td class="newupload_td02"><p><%=exercise.exercise_name %></p></td>
<td class="newupload_td02"><p><%=exercise.course.name %></p></td>
<td class="newupload_td04"><%=format_date(exercise.created_at) %></td>
</tr>
<% end %>
</tbody>
</table>

View File

@ -1,74 +1,101 @@
<%# has_commit = has_commit_poll?(poll.id ,User.current)%>
<% exercise_name = exercise.exercise_name.empty? ? l(:label_poll_new) : exercise.exercise_name%>
<% if @is_teacher%>
<li title="<%= exercise.exercise_name %>">
<div style="width: 310px;float: left;">
<%# if has_commit %>
<%#= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue"%>
<%# else %>
<%#= link_to poll_name, exercise_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %>
<%# end %>
<%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_w fl c_dblue" %>
<div>
<div title="<%= exercise.exercise_name %>">
<div style="width: 500px;float: left;">
<%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_w fl c_dblue mw450", :title => "#{exercise_name}" %>
<% if exercise.exercise_status == 1 %>
<span class="exercise_status_nop fl mt3"></span>
<% elsif exercise.exercise_status == 2 %>
<span class="exercise_status_pub fl mt3"></span>
<% else %>
<span class="exercise_status_end fl mt3"></span>
<% end%>
</div>
</div>
<% if exercise.exercise_status == 1 %>
<% end_time_status = exercise.end_time.nil? ? 1 : (exercise.end_time <= Time.now ? 2 : 3) %>
<div><a href="javascript:" class="pollsbtn btn_pu fr mr10 ml5" onclick="exercise_submit(<%=end_time_status %>,<%= exercise.id%>,<%= exercise.exercise_name.length %>,<%=index.to_i %>);">发布试卷</a></div>
<% elsif exercise.exercise_status == 2%>
<div><a href="javascript:" class="pollsbtn btn_de fr mr10 ml5" onclick="republish_exercise(<%= exercise.id%>,<%=index.to_i %>);">取消发布</a></div>
<% else%>
<div class="pollsbtn fr mr10 pollsbtn_grey ml5">发布试卷</div>
<% end%>
<% if exercise.exercise_status == 1%>
<div class="pollsbtn fr mr10 pollsbtn_grey">统计结果</div>
<% else %>
<div><%= link_to l(:label_statistical_results), student_exercise_list_exercise_path(exercise.id,:course_id => @course.id), :class => "pollsbtn fr mr10"%></div>
<% end%>
</div>
<div class="cl"></div>
<div class="mt10">
<span class="c_grey fl mr15">测试时长:<%= exercise.time.nil? || exercise.time == -1 ? '不限' : exercise.time.to_s + "分钟" %></span>
<span class="c_grey fl mr15">截止时间:<%= exercise.end_time.nil? ? '未设置' : format_time(exercise.end_time) %></span>
<span class="c_grey fl mr15">发布时间:<%= exercise.publish_time.nil? ? '未设置' : format_time(exercise.publish_time) %></span>
<% if @is_teacher && exercise.exercise_status > 1 %>
<span class="c_grey fl mr15">已提交:<span class="c_blue"><%= exercise.exercise_users.where("commit_status = 1").count %></span></span>
<span class="c_grey fl mr15">未提交:<span class="c_blue"><%= exercise.course.student.count - exercise.exercise_users.where("commit_status = 1").count %></span></span>
<% end %>
<div id="exercise_opr_<%=exercise.id %>" class="none fr">
<a href="javascript:void(0)" onClick="delete_exercise(<%=exercise.id %>);" title="删除试卷" class="ex_icon_de mt0"></a>
<% if exercise.exercise_status == 1 %>
<%= link_to '', edit_exercise_path(exercise.id), :title => "编辑试卷", :class => "ex_icon_edit mt0"%>
<% end%>
</div>
</li>
<%# if exercise.exercise_status == 2 %>
<!--<li><a class="polls_de fr ml5" onclick="" href="javascript:">关闭</a></li>-->
<%# else %>
<!--<li class="polls_de_grey fr ml5" title="发布的问卷才能进行关闭">关闭</li>-->
<%# end%>
<%# if exercise.exercise_status == 1%>
<!--<li class="polls_de_grey fr ml5">导出</li>-->
<%# elsif exercise.exercise_status == 2 || exercise.exercise_status == 3 %>
<!--<li><%#= link_to "导出", export_exercise_exercise_path(exercise.id,:format => "xls"), :class => "polls_de fr ml5"%></li>-->
<%# end%>
<% if exercise.exercise_status == 1 %>
<li><a href="javascript:" class="pollsbtn btn_pu fr mr10 ml5" onclick="exercise_submit(<%= exercise.id%>,<%= exercise.exercise_name.length %>,<%=index.to_i %>);">发布试卷</a></li>
<% elsif exercise.exercise_status == 2%>
<li><a href="javascript:" class="pollsbtn btn_de fr mr10 ml5" onclick="republish_exercise(<%= exercise.id%>,<%=index.to_i %>);">取消发布</a></li>
<% else%>
<li class="pollsbtn fr mr10 pollsbtn_grey ml5">发布试卷</li>
<% end%>
<% if exercise.exercise_status == 1%>
<li class="pollsbtn fr mr10 pollsbtn_grey">统计结果</li>
<% else %>
<li><%= link_to l(:label_statistical_results), student_exercise_list_exercise_path(exercise.id,:course_id => @course.id), :class => "pollsbtn fr mr10"%></li>
<% end%>
<%= link_to(l(:button_delete), exercise,:method => :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml5 mr10") %>
<% if exercise.exercise_status == 1 %>
<li><%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "polls_de fr ml10"%></li>
<li class="polls_date fr"><%=exercise.publish_time.nil? ? "未发布" : "将于"+format_time(exercise.publish_time.to_s)+"发布"%></li>
<% elsif exercise.exercise_status == 2 %>
<li class="polls_de_grey fr ml10" title="未发布的试卷才能进行编辑">编辑</li>
<li class="polls_date fr">已发布</li>
<% else %>
<li class="polls_de_grey fr ml10" title="未发布的试卷才能进行编辑">编辑</li>
<li class="polls_date fr">已截止</li>
<% end%>
<div class="clear"></div>
</div>
<% else%>
<% if exercise.exercise_status != 1%>
<%# if has_commit%>
<!--li><%#= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_st fl c_dblue" %></li>
<li class="pollsbtn_tip fl ml5">已答</li-->
<%#else%>
<%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_st fl c_dblue"%>
<% eu = ExerciseUser.where("exercise_id=? and user_id=? and status=?",exercise.id, User.current.id, true).first %>
<% if exercise.end_time <= Time.now && eu && exercise.end_time >= eu.created_at %>
<li class="pollsbtn_tip fl ml5">已答</li>
<% end %>
<%#end%>
<div>
<%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :title => "#{exercise_name}", :class => "polls_title polls_title_st fl c_dblue "%>
<% if exercise.exercise_status == 1 %>
<span class="exercise_status_nop fl"></span>
<% elsif exercise.exercise_status == 2 %>
<span class="exercise_status_pub fl"></span>
<% else %>
<span class="exercise_status_end fl"></span>
<% end%>
<% if eu && exercise.end_time >= eu.created_at %>
<span class="exercise_status_com fl ml5"></span>
<% else %>
<span class="exercise_status_nocom fl ml5"></span>
<% end %>
</div>
<div class="cl"></div>
<div class="mt10">
<span class="c_grey fl mr15">测试时长:<%= exercise.time.nil? || exercise.time == -1 ? '不限' : exercise.time.to_s + "分钟" %></span>
<span class="c_grey fl mr15">截止时间:<%= exercise.end_time.nil? ? '未设置' : format_time(exercise.end_time) %></span>
<span class="c_grey fl mr15">发布时间:<%= exercise.publish_time.nil? ? '未设置' : format_time(exercise.publish_time) %></span>
<% exercise_end = exercise.end_time > Time.now
if exercise.time == -1 || exercise.time.nil?
can_edit_excercise = exercise_end
else
can_edit_excercise = !has_commit_exercise?(exercise.id,User.current.id)&& exercise_end
end%>
<% if can_edit_excercise && eu %>
<a href="<%=exercise_path(exercise.id) %>" class="pollsbtn btn_pu fr mr10 ml5">继续答题</a>
<% elsif can_edit_excercise %>
<a href="<%=exercise_path(exercise.id) %>" class="pollsbtn btn_pu fr mr10 ml5">开始答题</a>
<% else %>
<a href="<%=exercise_path(exercise.id) %>" class="pollsbtn btn_pu fr mr10 ml5">查看答题</a>
<% end %>
<% if exercise.show_result == 1 %>
<% if exercise.end_time <= Time.now %>
<%= link_to l(:label_statistical_results), student_exercise_list_exercise_path(exercise.id,:course_id => @course.id), :class => "pollsbtn fr mr10"%>
<% else %>
<div class="pollsbtn fr mr10 pollsbtn_grey" title="截止时间还未到,暂不可查看统计结果">统计结果</div>
<%end%>
<% end %>
<div class="clear"></div>
</div>
<% end%>
<li class="polls_date fr mr10">截止时间:<%= format_time(exercise.end_time.to_s)%></li>
<% if exercise.show_result == 1 %>
<% if exercise.end_time <= Time.now %>
<li><%= link_to l(:label_statistical_results), student_exercise_list_exercise_path(exercise.id,:course_id => @course.id), :class => "pollsbtn fr mr10"%></li>
<% else %>
<li class="pollsbtn fr mr10 pollsbtn_grey" title="截止时间未到,暂不能查看统计结果">统计结果</li>
<%end%>
<% end %>
<% end%>

View File

@ -3,15 +3,15 @@
<span><%= @obj_count%></span>
</h2>
<% if @is_teacher%>
<%#= link_to "导入", other_poll_poll_index_path(:polls_group_id => @course.id), :remote=>true,:class => "newbtn"%>
<%= link_to "新建试卷 ", new_exercise_path(:course_id => @course.id), :class => "newbtn" %>
<%= link_to "导入试卷", other_exercise_exercise_index_path(:course_id => @course.id), :remote=>true,:class => "newbtn"%>
<% end%>
</div>
<div class="cl"></div>
<div id="polls_list" class="polls_list">
<% @exercises.each_with_index do |exercise,index|%>
<ul id="exercises_<%= exercise.id %>" class="polls_list_ul">
<ul id="exercises_<%= exercise.id %>" class="exercise_list_div" onmouseover="$('#exercise_opr_<%=exercise.id %>').show();" onmouseout="$('#exercise_opr_<%=exercise.id %>').hide();">
<%= render :partial => 'exercise', :locals => {:exercise => exercise,:index => index} %>
</ul>
<div class="cl"></div>

View File

@ -0,0 +1,81 @@
<div id="muban_popup_box" style="width:745px;">
<div class="muban_popup_top">
<h3 class="fl">选择试卷导入本班级</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
<div class="cl"></div>
</div>
<div class="muban_popup_con">
<div class="newupload_conbox">
<div class="newupload_search_box mb10">
<input class="newupload_search_input" placeholder="输入试卷标题的关键词进行搜索" name="search" type="text">
<a href="javascript:void(0);" class="newupload_btn_search"></a>
</div>
</div>
<%=form_tag import_other_exercise_exercise_index_path,
method: :post,
remote: true,
id: "import_other_exercise_form" do %>
<input type="hidden" name="course_id" value="<%= course_id%>" />
<div class="ml15">
<div id="all_import_exercises">
<%=render :partial => 'all_import_exercises', :locals => {:exercises => exercises, :course_id => course_id, :order => @order} %>
</div>
<div class="clear">
<p class="none c_red" id="choose_exercise_notice"></p>
<div class="clear fl mt10">
<a href="javascript:void(0)" class="btn btn-blue fr" onclick="submit_import_form();">确定</a>
<a href="javascript:void(0)" class="btn fr mr5" onclick="hideModal();">取消</a>
</div>
<div class="fr mr10">
<div class="pages" style="width:auto; display:inline-block;">
<ul id="exercise_ref_pages">
<%= pagination_links_full @ex_pages, @ex_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%>
</ul>
<div class="cl"></div>
</div>
</div>
</div>
</div>
<% end %>
</div>
</div>
</div>
<script>
function submit_import_form(){
var checkboxs = $("input[name='exercise_id[]']:checked");
if(checkboxs.length > 0) {
$("#choose_exercise_notice").html("");
$('#import_other_exercise_form').submit();
hideModal();
} else{
$("#choose_exercise_notice").html("请至少选择一个试卷");
$("#choose_exercise_notice").show();
}
}
var lastSearchCondition = '';
var count = 0;
function search_exs(e){
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
{
return;
}
lastSearchCondition = $(e.target).val().trim();
$.ajax({
url: '<%= url_for(:controller => 'exercise', :action => 'search_exercises') %>'+'?name='+ e.target.value+'&course_id=<%=course_id %>',
type:'get'
});
}
function throttle(method,context,e){
clearTimeout(method.tId);
method.tId=setTimeout(function(){
method.call(context,e);
},500);
}
//查询项目
$("input[name='search']").on('input', function (e) {
throttle(search_exs,window,e);
});
</script>

View File

@ -33,7 +33,7 @@
<td class="hworkList130 c_grey">
<% if exercise.created_at%>
<%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>&nbsp;
<% if @exercise.end_time <= exercise.created_at %>
<% if exercise.commit_status == 0 %>
<span class="c_red">[未答]</span>
<% end %>
<% end %>

View File

@ -1 +1,2 @@
hideModal();
$("#exercise").html("<%= escape_javascript(render :partial => 'exercises_list') %>");

View File

@ -0,0 +1,9 @@
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>试卷已导入<br/>但需要您设置发布时间和截止时间,以激活相应的试卷<br/></p>' +
'<a href="javascript:void(0);" class="btn btn-blue mt10" onclick="click_OK();">知道了</a></div></div></div>';
pop_box_new(htmlvalue, 400, 152);
function click_OK(){
hideModal();
window.location.href = "<%= exercise_index_path(:course_id => @course.id) %>";
}

View File

@ -5,31 +5,16 @@
});
function republish_exercise(exercise_id,index)
{
$('#ajax-modal').html("<div id='popbox02'>" +
"<div class='upload_con'>" +
"<div class='upload_box'>" +
"<p class='polls_box_p'>取消发布后学生答题将会被清空<br />是否确定取消发布该测验?</p>" +
"<div class='polls_btn_box'>" +
"<a href='/exercise/"+ exercise_id +"/republish_exercise?index="+index+"' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" +
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取&nbsp;&nbsp;消</a>" +
"</div>" +
"<div class='cl'></div>" +
"</div>" +
"</div>" +
"</div>");
showModal('ajax-modal', '310px');
$('#ajax-modal').css('height','120px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls");
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>取消发布后学生答题将会被清空<br />是否确定取消发布该试卷?</p>' +
'<a href="javascript:void(0);" class="btn btn-grey mt10 mr10" onclick="hideModal();">取&nbsp;&nbsp;消</a>' +
'<a href="/exercise/'+ exercise_id +'/republish_exercise?index='+ index +'" class="btn btn-blue mt10" onclick="hideModal();" data-remote="true">确&nbsp;&nbsp;定</a></div></div></div>';
pop_box_new(htmlvalue, 400, 152);
}
function clickCanel(){hideModal("#popbox02");}
function exercise_submit(exercise_id,exercise_name,index)
function exercise_submit(status, exercise_id,exercise_name,index)
{
if(exercise_name == 0)
{
@ -37,29 +22,31 @@
}
else
{
$('#ajax-modal').html("<div id='popbox02'>" +
"<div class='upload_con'>" +
"<div class='upload_box'>" +
"<p class='polls_box_p'>测验发布后将不能对测验进行修改,<br />是否确定发布该测验?</p>" +
"<div class='polls_btn_box'>" +
"<a href='/exercise/"+ exercise_id +"/publish_exercise?index="+index+"' class='upload_btn' onclick='clickCanel();' data-remote='true'>确&nbsp;&nbsp;定</a>" +
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取&nbsp;&nbsp;消</a>" +
"</div>" +
"<div class='cl'></div>" +
"</div>" +
"</div>" +
"</div>");
showModal('ajax-modal', '310px');
$('#ajax-modal').css('height','120px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("popbox_polls");
if (status == 1){
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>您还没有设置截止时间,请先设置截止时间再发布</p>' +
'<a href="javascript:void(0);" class="btn btn-blue mt10" onclick="hideModal();">知道了</a></div></div></div>';
pop_box_new(htmlvalue, 400, 152);
} else if(status == 2){
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>您设置的截止时间已过期,请重新设置</p>' +
'<a href="javascript:void(0);" class="btn btn-blue mt10" onclick="hideModal();">知道了</a></div></div></div>';
pop_box_new(htmlvalue, 400, 152);
} else{
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>发布后不能再对试卷进行修改<br/>是否确定发布</p>' +
'<a href="javascript:void(0);" class="btn btn-grey mt10 mr10" onclick="hideModal();">取&nbsp;&nbsp;消</a>' +
'<a href="/exercise/'+ exercise_id +'/publish_exercise?index='+ index +'" class="btn btn-blue mt10" onclick="hideModal();" data-remote="true">确&nbsp;&nbsp;定</a></div></div></div>';
pop_box_new(htmlvalue, 400, 152);
}
}
}
function delete_exercise(id){
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您是否确定删除</p><div class="cl"></div><a href="/exercise/'+ id +'" class="fr sy_btn_blue mr90 mt10" data-method="delete" data-remote="true">确定</a>'+
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取消</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
}
</script>
<div class="courseRSide fl" id="homework_page_right">
<div class="polls_content02" id="exercise" style="width: 730px;">

View File

@ -0,0 +1,8 @@
<% if @exercises.blank? %>
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您的其它班级下没有试卷可供导入</p><div class="cl"></div><a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 122px;" onclick="hideModal();">确定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
<% else %>
var html_value = '<%= escape_javascript(render :partial => 'other_exercises',:locals => {:exercises => @exercises, :course_id=>@course_id}) %>';
pop_box_new(html_value, 745, 600);
<% end %>

View File

@ -1,10 +1,5 @@
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index =>@index}) %>");
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>");
showModal('ajax-modal', '250px');
//$('#ajax-modal').css('height','111px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("poll_alert_form");
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>发布成功</p>' +
'<a href="javascript:void(0);" class="btn btn-blue mt10" onclick="hideModal();">知道了</a></div></div></div>';
pop_box_new(htmlvalue, 400, 152);

View File

@ -1,10 +1,5 @@
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index => @index}) %>");
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>");
showModal('ajax-modal', '250px');
//$('#ajax-modal').css('height','80px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().removeClass("alert_praise");
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
$('#ajax-modal').parent().addClass("poll_alert_form");
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>取消成功</p>' +
'<a href="javascript:void(0);" class="btn btn-blue mt10" onclick="hideModal();">知道了</a></div></div></div>';
pop_box_new(htmlvalue, 400, 152);

View File

@ -0,0 +1,3 @@
$("#all_import_exercises").html('<%= escape_javascript(render :partial => 'all_import_exercises', :locals => {:exercises => @exercises, :course_id => @course_id, :order => @order})%>');
$("#exercise_ref_pages").html('<%= pagination_links_full @ex_pages, @ex_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>');
$("#choose_exercise_notice").html("");

View File

@ -12,6 +12,8 @@
$("#homework_end_time_span").text("");
$("#homework_course_id_span").text("");
$("#homework_editor").toggle();
$("#select_type_nitice").show();
document.getElementById("homework_type_option").options[0].selected = true;
}
$(function(){

View File

@ -7,7 +7,7 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public','css/structure','css/courses','css/popup','prettify','syllabus','sy_public',:media => 'all'%>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public','css/structure','css/courses','css/popup','prettify','syllabus','sy_public','css/moduel',:media => 'all'%>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","course",'attachments','prettify','syllabus','cookie'%>

View File

@ -1,14 +1,8 @@
<% if @polls.empty? %>
alert('您的其它班级下没有问卷可供导入');
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">您的其它班级下没有问卷可供导入</p><div class="cl"></div><a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 122px;" onclick="hideModal();">确定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
<% else %>
var html_value = '<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>';
pop_box_new(html_value, 510, 550);
// $('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>');
//
//
// showModal('ajax-modal', '513px');
// $('#ajax-modal').siblings().remove();
// $('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
// $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
// $('#ajax-modal').parent().addClass("popbox_polls");
<% end %>

View File

@ -7,20 +7,17 @@
<% parents_rely = get_reply_parents_no_root parents_rely, comment %>
<% length = parents_rely.length %>
<div id="comment_reply_<%=comment.id %>">
<% if length <= 3 %>
<% if length <= 2 %>
<%=render :partial => 'projects/journal_comment_reply', :locals => {:comment => comment.parent} %>
<% else %>
<div class="orig_cont clearfix">
<div class="orig_cont clearfix">
<div>
<%=render :partial => 'projects/journal_comment_reply', :locals => {:comment => parents_rely[length - 1]} %>
</div>
<%=render :partial => 'projects/comment_reply_detail', :locals => {:comment => parents_rely[length - 2]} %>
<%=render :partial => 'projects/comment_reply_detail', :locals => {:comment => parents_rely[length - 1]} %>
</div>
<div class="orig_cont_hide clearfix">
<div class="orig_cont_hide_issue clearfix">
<span class="orig_icon" >&darr; </span>
<span class="orig_icon" style="display:none;" > &uarr;</span>
<%= link_to '点击展开隐藏楼层', show_all_replies_users_path(:comment => comment, :type => comment.class),:remote=>true %>
<span class="orig_icon" style="display:none;" > &uarr;</span><span class="">已经隐藏<%=(length - 2).to_s %>个楼层</span>
<%= link_to '[点击展开]', show_all_replies_users_path(:comment => comment, :type => comment.class), :remote=>true, :class => 'linkBlue2' %>
</div>
<%=render :partial => 'projects/comment_reply_detail', :locals => {:comment => parents_rely[0]} %>
</div>

View File

@ -1,16 +1,22 @@
<% if @courses.any? %>
<div class="sy_category">
<span class="sy_cgrey ">排序:</span>
<%= link_to "时间", {:controller => 'syllabuses', :action => 'syllabus_courselist', :id =>@syllabus, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sy_cgrey fl", :remote => true %>
<%= link_to "时间", {:controller => 'syllabuses', :action => 'syllabus_courselist', :id =>@syllabus, :type => @type, :sort => @c_sort, :order => 1, :list_type => @list_type}, :class => "sy_cgrey fl", :remote => true %>
<% if @type.to_i == 1 %>
<%= link_to "", {:controller => 'syllabuses', :action => 'syllabus_courselist', :id =>@syllabus, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} mt15 fl", :remote => true %>
<%= link_to "", {:controller => 'syllabuses', :action => 'syllabus_courselist', :id =>@syllabus, :type => @type, :sort => @c_sort, :order => 1, :list_type => @list_type}, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} mt15 fl", :remote => true %>
<% end %>
<%= link_to "人气", {:controller => 'syllabuses', :action => 'syllabus_courselist', :id =>@syllabus, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sy_cgrey fl #{@type == 1 ? '' : 'ml10'}", :remote => true %>
<%= link_to "人气", {:controller => 'syllabuses', :action => 'syllabus_courselist', :id =>@syllabus, :type => @type, :sort => @c_sort, :order => 2, :list_type => @list_type}, :class => "sy_cgrey fl #{@type == 1 ? '' : 'ml10'}", :remote => true %>
<% if @type.to_i == 2 %>
<%= link_to "", {:controller => 'syllabuses', :action => 'syllabus_courselist', :id =>@syllabus, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} mt15 fl", :remote => true %>
<%= link_to "", {:controller => 'syllabuses', :action => 'syllabus_courselist', :id =>@syllabus, :type => @type, :sort => @c_sort, :order => 2, :list_type => @list_type}, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} mt15 fl", :remote => true %>
<% end %>
<% if @syllabus.syllabus_members.map{|sm| sm.user_id}.include?(User.current.id) %>
<% archive_courses = @syllabus.courses.where("is_delete = ?", 1).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updated_time").order("updated_time desc") %>
<% if @list_type == 0 && @syllabus.syllabus_members.map{|sm| sm.user_id}.include?(User.current.id) %>
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "sy_btn_green fr mt10 mr15", :target => '_blank'%>
<% unless archive_courses.blank? %>
<%= link_to "归档管理", syllabus_courselist_syllabus_path(@syllabus, :list_type => 1), :class => "linkBlue2 fr mr20 f14"%>
<% end %>
<% elsif @list_type == 1 && @syllabus.syllabus_members.map{|sm| sm.user_id}.include?(User.current.id) %>
<%= link_to "返回", syllabus_courselist_syllabus_path(@syllabus), :class => "linkBlue2 fr mr15 f14"%>
<% end %>
<div class="cl"></div>
</div>
@ -18,12 +24,12 @@
<% @courses.each do |course| %>
<ul class="sy_classlist">
<div class="fl">
<% if course.is_public == 0 && !User.current.member_of_course?(course) && !User.current.admin? %>
<h3 class="sy_classlist_title fl">
<% if (course.is_public == 0 && !User.current.member_of_course?(course) && !User.current.admin?) || @list_type == 1 %>
<h3 class="sy_classlist_title fl" style="max-width: 530px;">
<%=course.name %><%=current_time_and_term_short(course) %>
</h3>
<% else %>
<h3 class="sy_classlist_title fl">
<h3 class="sy_classlist_title fl" style="max-width: 530px;">
<%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course),
:style => 'color:#000',:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开班级:":"私有班级:")+course.name+""+current_time_and_term(course)+""%>
</h3>
@ -38,14 +44,14 @@
<% homework_num = course.homework_commons.where("publish_time <= '#{Date.today}'").count %>
<% end %>
<span class=" mr15">作业:
<% if course.is_public == 0 && !User.current.member_of_course?(course) %>
<% if (course.is_public == 0 && !User.current.member_of_course?(course)) || @list_type == 1 %>
<%=homework_num %>
<% else %>
<%= link_to homework_num, homework_common_index_path(:course => course.id), :class => "sy_cblue",:target => '_blank'%>
<% end %>
</span>
<span class=" mr15">资源:
<% if course.is_public == 0 && !User.current.member_of_course?(course) %>
<% if (course.is_public == 0 && !User.current.member_of_course?(course)) || @list_type == 1 %>
<%=visable_attachemnts_incourse(course).count %>
<% else %>
<%= link_to visable_attachemnts_incourse(course).count, course_files_path(course), :class => "sy_cblue",:target => '_blank'%>
@ -55,10 +61,19 @@
<span class=" mr15">更新时间:<%= format_date(course.updated_on) %></span>
</p>
</div>
<% if User.current.member_of_course?(course) %>
<%=link_to '进入班级', course_path(course), :class => 'btn_orange_big fr mt5', :target => '_blank' %>
<% if @list_type == 0 %>
<% if User.current.member_of_course?(course) %>
<%=link_to '进入班级', course_path(course), :class => 'btn_orange_big fr mt5', :target => '_blank' %>
<% else %>
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true,:class => "hw_btn_green fr mt5",:method => "post"%>
<% end %>
<% if User.current.allowed_to?(:as_teacher, course) || User.current.admin? %>
<a href="javascript:void(0)" onclick="archive_course(<%=course.id %>, 0);" class="btn_grey_big fr mt5 mr5" style="width: 56px;">归档</a>
<% end %>
<% else %>
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true,:class => "hw_btn_green fr mt5",:method => "post"%>
<% if User.current.allowed_to?(:as_teacher, course) || User.current.admin? %>
<a href="javascript:void(0)" onclick="archive_course(<%=course.id %>, 1);" class="btn_grey_big fr mt5" style="width: 56px;">恢复</a>
<% end %>
<% end %>
<div class="cl"></div>
</ul>
@ -71,14 +86,31 @@
</div>
</div>
<% else %>
<div class="icons_tishi"><img src="/images/sy/icons_tan.png" width="110" height="110" alt="" ></div>
<% if User.current.member_of_syl?(@syllabus) %>
<p class="sy_tab_con_p">该课程还未创建班级,请
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "sy_corange", :target => '_blank'%>
,谢谢啦!<br/>只有创建班级后才可以开展在线教学哦~
</p>
<% else %>
<% if !User.current.member_of_syl?(@syllabus) %>
<div class="icons_tishi"><img src="/images/sy/icons_tan.png" width="110" height="110" alt="" ></div>
<p class="sy_tab_con_p">该课程还未创建班级,敬请期待!</p>
<% elsif @list_type == 0 %>
<% if @syllabus.courses.where("is_delete = ?", 1).count == 0 %>
<div class="icons_tishi"><img src="/images/sy/icons_tan.png" width="110" height="110" alt="" ></div>
<p class="sy_tab_con_p">该课程还未创建班级,请
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "sy_corange", :target => '_blank'%>
,谢谢啦!<br/>只有创建班级后才可以开展在线教学哦~
</p>
<% else %>
<div class="sy_category" style="border-bottom-color: #fff;">
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "sy_btn_green fr mt10 mr15", :target => '_blank'%>
<%= link_to "归档管理", syllabus_courselist_syllabus_path(@syllabus, :list_type => 1), :class => "linkBlue2 fr mr20 f14"%>
<div class="cl"></div>
</div>
<div class="icons_tishi"><img src="/images/sy/icons_tan.png" width="110" height="110" alt="" ></div>
<p class="sy_tab_con_p">该课程的班级已全部归档</p>
<% end %>
<% elsif @list_type == 1 %>
<div class="sy_category" style="border-bottom-color: #fff;">
<%= link_to "返回", syllabus_courselist_syllabus_path(@syllabus), :class => "linkBlue2 fr mr15 f14"%>
<div class="cl"></div>
</div><div class="icons_tishi"><img src="/images/sy/icons_tan.png" width="110" height="110" alt="" ></div>
<p class="sy_tab_con_p">该课程下无归档的班级</p>
<% end %>
<% end %>
@ -87,4 +119,19 @@
$(function() {
$(".sy_con_l").css("min-height",$(".sy_con_r").height());
});
function archive_course(id, type){
if(type == 0){
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>您是否确定归档此班级</p>' +
'<a href="javascript:void(0);" class="btn btn-grey mt10 mr10" onclick="hideModal();">取&nbsp;&nbsp;消</a>' +
'<a href="/courses/'+ id +'/archive_course?source=1&type=0" class="btn btn-blue mt10" onclick="hideModal();" data-remote="true">确&nbsp;&nbsp;定</a></div></div></div>';
pop_box_new(htmlvalue, 400, 132);
} else{
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>您和您的学生将可以重新在此班级中互动<br/>此班级的动态会在首页中显示<br/><br/>' +
'您是否确定恢复此班级</p><a href="javascript:void(0);" class="btn btn-grey mt10 mr10" onclick="hideModal();">取&nbsp;&nbsp;消</a>' +
'<a href="/courses/'+ id +'/archive_course?source=1&type=1" class="btn btn-blue mt10" onclick="hideModal();" data-remote="true">确&nbsp;&nbsp;定</a></div></div></div>';
pop_box_new(htmlvalue, 400, 200);
}
}
</script>

View File

@ -5,8 +5,9 @@
</li>
<li class="<%=(ma.status == 0 || ma.status.nil?) ? 'homepageHomeworkContent2' : 'homepageHomeworkContent' %> fl">
<a href="javascript:void(0);" class="newsGrey">
<%= link_to User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content && ma.content.include?('9') ? "教师" : "教辅"}", user_path(User.find(ma.course_message_id), :course_id => ma.course_id),
:class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
<% content = User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content && ma.content.include?('9') ? "教师" : "教辅"}" %>
<%= link_to content, user_path(User.find(ma.course_message_id), :course_id => ma.course_id),
:class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank', :title => "#{content}" %>
<!--:onmouseover => "message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a>

View File

@ -6,17 +6,23 @@
<script type="text/javascript">
var first_click = true;
$(function(){
$("#homework_type_option").on("change",function(){
$("#homework_type_option").on("change",function(){
$('#homework_editor').show();
var type = $(this).children('option:selected').val();
if(type == "1"){
$("#homeworkSetting").addClass("undis");
$("#homeworkSetting").html("");
}else if(type == "2"){
$("#homeworkSetting").removeClass("undis");
$("#homeworkSetting").html("<%=escape_javascript(render :partial => 'users/user_programing_attr', :locals => {:edit_mode => edit_mode, :homework=>homework, :not_allow_select => not_allow_select}) %>");
}else if(type == "3"){
$("#homeworkSetting").removeClass("undis");
$("#homeworkSetting").html("<%=escape_javascript(render :partial => 'users/user_group_attr', :locals => {:edit_mode => edit_mode, :homework=>homework, :not_allow_select => not_allow_select}) %>");
if(type == "0"){
$('#select_type_nitice').show();
}else{
$('#select_type_nitice').hide();
if(type == "1"){
$("#homeworkSetting").addClass("undis");
$("#homeworkSetting").html("");
}else if(type == "2"){
$("#homeworkSetting").removeClass("undis");
$("#homeworkSetting").html("<%=escape_javascript(render :partial => 'users/user_programing_attr', :locals => {:edit_mode => edit_mode, :homework=>homework, :not_allow_select => not_allow_select}) %>");
}else if(type == "3"){
$("#homeworkSetting").removeClass("undis");
$("#homeworkSetting").html("<%=escape_javascript(render :partial => 'users/user_group_attr', :locals => {:edit_mode => edit_mode, :homework=>homework, :not_allow_select => not_allow_select}) %>");
}
}
});
if($.trim($("#anonymous_comment").val()) == 1) {
@ -69,7 +75,10 @@
}
var is_checked = false;
checked_val();
if(!regex_homework_name()){
if($("#homework_type_option").children('option:selected').val() == '0'){
$("#select_type_nitice").show();
}
else if(!regex_homework_name()){
$("#homework_name").focus();
}
else if(!regex_homework_end_time()){
@ -176,51 +185,56 @@
<div class="HomeWorkCon">
<a id="submit_homework"></a>
<div>
<input type="text" name="homework_common[name]" id="homework_name" class="InputBox fl <%= edit_mode ? 'w701' : 'w603' %>" maxlength="255" onfocus="$('#homework_editor').show()" onkeyup="regex_homework_name();" placeholder="发布作业,请先输入作业标题" value="<%= homework.name%>" >
<%= link_to("从题库选用", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fr",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业") unless edit_mode%>
<% unless edit_mode %>
<input type="hidden" name="quotes" id="ref_homework_id" value=""/>
<% end %>
<div class="cl"></div>
<p id="homework_name_span" class="c_red mt5"></p>
</div>
<div class="cl"></div>
<div class="mt10">
<% group_pro = homework.homework_type == 3 && homework.student_work_projects.count != 0 %>
<select class="homework-type-option fl mr10" name="homework_type" <%=(not_allow_select || group_pro) ? 'disabled' : '' %> id="homework_type_option">
<%= options_for_select(homework_type_option,homework.homework_type) %>
<%= options_for_select(homework_type_option,edit_mode ? homework.homework_type : 0) %>
</select>
<% if not_allow_select || group_pro %>
<input type="text" style="display: none" name="homework_type" value="<%=homework.homework_type %>"/>
<% end %>
<label class="fl c_grey f14 mt5">截止日期:</label>
<div class="calendar_div fl mr10">
<input type="text" name="homework_common[end_time]" id="homework_end_time" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.end_time%>" >
<% if homework.homework_detail_manual.comment_status.to_i < 2 %>
<%= calendar_for('homework_end_time')%>
<% end %>
</div>
<label class="fl c_grey f14 mt5" style="margin-top: 4px;">发布日期(可选):</label>
<div class="calendar_div fl">
<% allow_edit = homework.student_works.has_committed.count == 0 && homework.student_work_projects.count ==0 %>
<input title="<%=allow_edit ? '' : '已有学生提交作品或关联项目,发布日期不可再编辑' %>" type="text" name="homework_common[publish_time]" id="homework_publish_time" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.publish_time%>" >
<% if allow_edit %>
<%= calendar_for('homework_publish_time')%>
<% end %>
</div>
<% if !edit_mode || edit_mode && homework.homework_detail_manual.comment_status < 2 %>
<div class="fr f14 ml10" style="margin-top: 4px;">
<input type="checkbox" name="homework_common[anonymous_comment]" value="<%=edit_mode ? homework.anonymous_comment : 1 %>" id="anonymous_comment"/>
<span class="f14 c_grey">启用匿评</span>
<!--<span id="anonymous_hint" style="display: none; font-size: 12px;" class="c_red">更改后评分比例将恢复默认值</span>-->
</div>
<% end %>
<span class="c_red fl ml10 mt5 <%= edit_mode ? 'none' : '' %>" id="select_type_nitice">发布作业,请先选择作业类型</span>
<%= link_to("从题库选用", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fr",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业") unless edit_mode%>
</div>
<div class="cl"></div>
<p id="homework_end_time_span" class="c_red mt5"></p>
<div class="cl"></div>
<div id="homework_editor" style="display: <%= edit_mode ? 'block':'none'%>">
<div id="homework_editor" class="mt10" style="display: <%= edit_mode ? 'block':'none'%>">
<div>
<input type="text" name="homework_common[name]" id="homework_name" class="InputBox fl w701" maxlength="255" onkeyup="regex_homework_name();" placeholder="发布作业,请先输入作业标题" value="<%= homework.name%>" >
<% unless edit_mode %>
<input type="hidden" name="quotes" id="ref_homework_id" value=""/>
<% end %>
<div class="cl"></div>
<p id="homework_name_span" class="c_red mt5"></p>
</div>
<div class="cl"></div>
<div class="mt10">
<label class="fl c_grey f14 mt5">截止日期:</label>
<div class="calendar_div fl mr70">
<input type="text" name="homework_common[end_time]" id="homework_end_time" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.end_time%>" >
<% if homework.homework_detail_manual.comment_status.to_i < 2 %>
<%= calendar_for('homework_end_time')%>
<% end %>
</div>
<label class="fl c_grey f14 mt5" style="margin-top: 4px;">发布日期(可选):</label>
<div class="calendar_div fl">
<% allow_edit = homework.student_works.has_committed.count == 0 && homework.student_work_projects.count ==0 %>
<input title="<%=allow_edit ? '' : '已有学生提交作品或关联项目,发布日期不可再编辑' %>" type="text" name="homework_common[publish_time]" id="homework_publish_time" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.publish_time%>" >
<% if allow_edit %>
<%= calendar_for('homework_publish_time')%>
<% end %>
</div>
<% if !edit_mode || edit_mode && homework.homework_detail_manual.comment_status < 2 %>
<div class="fr f14 ml10" style="margin-top: 4px;">
<input type="checkbox" name="homework_common[anonymous_comment]" value="<%=edit_mode ? homework.anonymous_comment : 1 %>" id="anonymous_comment"/>
<span class="f14 c_grey">启用匿评</span>
<!--<span id="anonymous_hint" style="display: none; font-size: 12px;" class="c_red">更改后评分比例将恢复默认值</span>-->
</div>
<% end %>
</div>
<div class="cl"></div>
<p id="homework_end_time_span" class="c_red mt5"></p>
<div class="cl"></div>
<div class="mt10">
<% if edit_mode %>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='homework_textarea' name="homework_common[description]"><%=homework.description %></textarea>
@ -257,7 +271,7 @@
<span class="fr mr10 mt3">或</span>
<%#= link_to "取消",user_homeworks_user_path(User.current.id),:class => "fr mr10 mt3"%>
<a href="javascript:void(0);" id="new_message_cancel_btn" class="fr mr10 mt3">取消</a>
<% else %>
<% else %>
<a href="javascript:void(0);" id="new_message_submit_btn" class="BlueCirBtnMini fr">发送</a>
<span class="fr mr10 mt3">或</span>
<a href="javascript:void(0);" id="new_message_cancel_btn" class="fr mr10 mt3">取消</a>

View File

@ -16,5 +16,6 @@ homework_description_editor.html("<%= escape_javascript(@homework.description.ht
$("#homeworkSetting").removeClass("undis");
$("#homeworkSetting").html("<%=escape_javascript(render :partial => 'users/user_group_attr', :locals => {:edit_mode => true, :homework=>@homework, :not_allow_select => false}) %>");
<% end %>
$("#homework_type_option option[value='<%=@homework.homework_type %>']").attr("selected",true);
document.getElementById("homework_type_option").options[<%=@homework.homework_type %>].selected = true;
$("#select_type_nitice").hide();
$("#homework_editor").show();

View File

@ -296,6 +296,9 @@ RedmineApp::Application.routes.draw do
collection do #生成路径为 /exercise/方法名
delete 'delete_exercise_question'
post 'update_exercise_question'
get 'other_exercise'
post 'import_other_exercise'
get 'search_exercises'
end
end
@ -1240,6 +1243,7 @@ RedmineApp::Application.routes.draw do
get 'search_not_group_member'
post 'add_members'
get 'delete_member'
get 'archive_course'
end
collection do
match 'join_private_courses', :via => [:get, :post]

View File

@ -0,0 +1,15 @@
class AddColumnToExerciseUsers < ActiveRecord::Migration
def change
add_column :exercise_users, :commit_status, :integer, :default => 0
count = ExerciseUser.all.count / 30 + 2
transaction do
for i in 1 ... count do i
ExerciseUser.page(i).per(30).each do |eu|
if eu.exercise && eu.exercise.end_time < Time.now && eu.exercise.end_time > eu.created_at
eu.update_column('commit_status', 1)
end
end
end
end
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20161117015856) do
ActiveRecord::Schema.define(:version => 20161117060138) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -806,10 +806,11 @@ ActiveRecord::Schema.define(:version => 20161117015856) do
t.integer "exercise_id"
t.integer "score"
t.datetime "start_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "end_at"
t.integer "status"
t.integer "commit_status", :default => 0
end
create_table "exercises", :force => true do |t|

View File

@ -24,8 +24,10 @@ namespace :exercise_publish do
course = exercise.course
exercise.update_column('exercise_status', 3)
course.student.each do |student|
if ExerciseUser.where("user_id = ? && exercise_id = ?",student.student_id,exercise.id).empty?
if ExerciseUser.where("user_id = ? && exercise_id = ?",student.student_id,exercise.id).blank?
ExerciseUser.create(:user_id => student.student_id, :exercise_id => exercise.id, :start_at => exercise.end_time, :status => true,:score=>0)
else
ExerciseUser.where("user_id = ? && exercise_id = ?",student.student_id,exercise.id).first.update_column('commit_status', 1)
end
=begin
s_score = calculate_student_score(exercise, student.student)

View File

@ -23,15 +23,55 @@
color: #ff0077;
}
</style>
<script type="text/javascript">
$(function(){
$("#subject").keydown(function(){
var curLength=$("#subject").val().length;
if(curLength>50){
var num=$("#subject").val().substr(0,50);
$("#subject").val(num);
}
else{
$("#textCount").text(50-$("#subject").val().length)
}
}).keyup(function(){
var curLength=$("#subject").val().length;
if(curLength>50){
var num=$("#subject").val().substr(0,50);
$("#subject").val(num);
}
else{
$("#textCount").text(50-$("#subject").val().length)
}
});
});
</script>
<body>
<!-- <h1>Internal error</h1>
<p>An error occurred on the page you were trying to access.<br />
If you continue to experience problems please contact your Trustie administrator for assistance.</p>
<p>If you are the Trustie administrator, check your log files for details about the error.</p> -->
<div class="h_content"><img src="/images/twurn.com_.png" >
<p class="font_h"><a href="javascript:history.back()" class="font_h">Back</a></p>
</div>
<div class="muban_conbox_max">
<div class="pages_new_404">
<img src="images/404/pic_500.jpg" >
<p class="pages_new_404_txt mt40">网站正在维护,请稍后重试。
<a href="javascript:history.back()" class="linkBlue2 mr10">返回上页>></a>
<a href="javascript:void(0)" class="linkBlue2 mr10" onclick="$('#feedback_div').toggle();"> 给我留言>></a>
<a href="http://shang.qq.com/wpa/qunwpa?idkey=fb938b1f6f991fc100f3d32b6ef38b7888dd4097c71d0eb8b239eaa8749a6afd" target="_blank" class="linkBlue2">QQ反馈>></a>
</p>
<div style="display:none;" class="mt10" id="feedback_div">
<% get_memo %>
<%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %>
<%= f.text_area :subject, :id=>"subject", :style => "width: 570px;", :class => "feedbackText mb5", :placeholder => "请在此输入平台的问题和建议您也可以通过QQ留言谢谢" %>
<%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
<span class="c_grey fl">还能输入<span id="textCount" class="c_orange">50</span>个字符</span>
<a href="javascript:void(0);" class="sy_btn_blue_mini f12 fr mr10" onclick="$('#new_memo').submit();">&nbsp;&nbsp;</a>
<a href="javascript:void(0);" class="sy_btn_grey_mini f12 fr mr10" onclick="$('#feedback_div').hide();">&nbsp;&nbsp;</a>
<div class="cl"></div>
<% end %>
</div>
</div>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@ -1631,7 +1631,7 @@ function pop_box_new(value, Width, Height){
new Drag("popupWrap");
$("#popupWrap input, #popupWrap textarea").mousedown(function(event){
$("#popupWrap input, #popupWrap textarea, #popupWrap ul").mousedown(function(event){
event.stopPropagation();
new Drag("popupWrap");
});

View File

@ -81,7 +81,11 @@ function regex_course_name(str)
if($("#new_syllabus_id").length > 0){
syl_title = $("#new_syllabus_id").find("option:selected").text();
} else{
syl_title = $("#edit_syllabus_id").html();
if(str == "edit"){
syl_title = $("#edit_syllabus_id").html();
} else{
syl_title = $("#course_syllabus_title").html();
}
}
if(name.length < 2)
{

View File

@ -182,6 +182,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.mw20{ margin: 0 20px;}
.mw380 {max-width: 380px !important;}
.mw400 {max-width: 400px !important;}
.mw450 {max-width: 450px !important;}
.mt-20 {margin-top:-20px;}
.mt-10 {margin-top:-10px;}
.mt-4 {margin-top:-4px;}
@ -549,6 +550,24 @@ a:hover.BlueCirBtnMini{ background:#3598db; color:#fff;}
a.BlueCirBtnMiddle{ display:block;width:50px; height:24px; background-color:#ffffff; line-height:24px; vertical-align:middle; text-align:center; border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
a:hover.BlueCirBtnMiddle{ background:#3598db; color:#fff;}
/* 按钮*/
a.btn_grey_big{
display: inline-block;
border: 1px solid #ccc;
color: #747474;
text-align: center;
font-size: 14px;
padding:0 10px;
height: 30px;
line-height: 30px;
-webkit-border-radius:3px;
-moz-border-radius:3px;
-o-border-radius:3px;
border-radius:3px;
}
a:hover.btn_grey_big{
background: #c3c3c3;
color: #fff;
}
a.btn_orange_big{
display:inline-block;
border: 1px solid #ee4a1f;
@ -615,6 +634,36 @@ a.sy_btn_blue{
border-radius:3px;
}
a:hover.sy_btn_blue{ background: #2788d0;}
a.sy_btn_blue_mini{
display:inline-block;
color: #fff;
background: #3b94d6;
text-align: center;
font-size: 12px;
padding:0 10px;
height: 26px;
line-height: 26px;
-webkit-border-radius:3px;
-moz-border-radius:3px;
-o-border-radius:3px;
border-radius:3px;
}
a:hover.sy_btn_blue_mini{ background: #2788d0;}
a.sy_btn_grey_mini{
display:inline-block;
color: #333;
background: #e1e1e1;
text-align: center;
font-size: 12px;
padding:0 10px;
height: 26px;
line-height: 26px;
-webkit-border-radius:3px;
-moz-border-radius:3px;
-o-border-radius:3px;
border-radius:3px;
}
a:hover.sy_btn_grey_mini{ background: #c3c3c3;}
a.sy_btn_green{
display:inline-block;
color: #fff;
@ -677,3 +726,7 @@ a:hover.hw_btn_blue,a:active.hw_btn_blue{ background: #3b94d6; color:#fff;}
/*禁用*/
.disabled {background-color:#f5f5f5;}
#popupWrap ul{cursor: default;}
.bg_checked{background-color: #64bdd9;}

View File

@ -586,3 +586,15 @@ a:hover.blueCir{ background:#3598db; color:#fff;}
.group_work_tip_box {width:200px; position:absolute; padding:5px 10px; white-space:nowrap; background-color:#fff; right:-255px; top:-90px; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5);}
.group_work_tip_box em {display:block; border-width:10px; position:absolute;top:26px; left:-20px; border-style:dashed solid dashed dashed; border-color:transparent #eaeaea transparent transparent; font-size:0; line-height:0;}
.group_work_tip_box span {display:block; border-width:10px; position:absolute;top:26px; left:-18px; border-style:dashed solid dashed dashed; border-color:transparent #fff transparent transparent; font-size:0; line-height:0;}
/*试卷*/
.exercise_list_div{ padding-left:10px; border-bottom:1px dashed #c9c9c9; height:62px; padding-top:8px;}
.exercise_status_nop{ display:block; width:33px; height:22px; background:url(/images/sy/icons_sy.png) 0 -636px no-repeat; color:#fff; font-size:12px; padding-left:10px; line-height: 22px;}
.exercise_status_pub{ display:block; width:33px; height:22px; background:url(/images/sy/icons_sy.png) 0 -613px no-repeat; color:#fff; font-size:12px; padding-left:10px; line-height: 22px;}
.exercise_status_end{ display:block; width:33px; height:22px; background:url(/images/sy/icons_sy.png) 0 -659px no-repeat; color:#fff; font-size:12px; padding-left:10px; line-height: 22px;}
.exercise_status_com{ display:block; width:33px; height:22px; background:url(/images/sy/icons_sy.png) 0 -681px no-repeat; color:#fff; font-size:12px; padding-left:10px; line-height: 22px;}
.exercise_status_nocom{ display:block; width:33px; height:22px; background:url(/images/sy/icons_sy.png) 0 -705px no-repeat; color:#fff; font-size:12px; padding-left:10px; line-height: 22px;}
a.ex_icon_de{ background:url(/images/course/icons.png) 0px -342px no-repeat; width:16px; height:27px; display:block;float:right;}
a:hover.ex_icon_de{ background:url(/images/course/icons.png) -20px -342px no-repeat;}
.ex_icon_edit{ background:url(/images/course/icons.png) 0px -276px no-repeat; width:16px; height:27px; display:block;float:right; margin-right:10px;}
a:hover.ex_icon_edit{ background:url(/images/course/icons.png) -21px -276px no-repeat;}

View File

@ -21,6 +21,8 @@ input.radio-width90{ width: 90px; }
/*模板buttons 20161013byLB*/
.btn{display: inline-block;border:none; padding:0 10px;color: #333;background: #e1e1e1; text-align:center;font-size: 12px; height: 30px;line-height: 30px;-webkit-border-radius: 3px;-moz-border-radius: 3px; -o-border-radius: 3px; border-radius: 3px; }
.btn:hover{background: #c3c3c3; color: #333;}
.btn-grey{background: #d9d9d9; color: #656565;}
.btn-grey:hover{background: #717171; color: #fff;}
.btn-green{background: #60b25e; color: #fff;}
.btn-green:hover{background: #51a74f; color: #fff;}
.btn-blue{background: #3b94d6; color: #fff;}
@ -63,10 +65,58 @@ a:hover.sub_btn{ background:#b5e2fa; color:#000; border:1px solid #3c7fb1;}
/*模板form 20161013byLB*/
textarea.muban_textarea{ width: 98.5%;border:1px solid #ddd; background:#fff; color:#666; padding:5px;}
/*模板图标20161020byLB*/
.muban-icons-clock{ background: url("../images/project/icons_issue.png") 0 -224px no-repeat; display: inline-block; width: 19px; height: 13px;}
.muban-icons-clock{ background: url("/images/project/icons_issue.png") 0 -224px no-repeat; display: inline-block; width: 19px; height: 13px;}
/*提示条20161020byLB*/
.alert{ padding:10px;border: 1px solid transparent; text-align: center;}
.alert-blue{ background-color: #d9edf7;border-color: #bce8f1; color: #3a87ad;}
.alert-orange{ background-color: #fff9e9;border-color: #f6d0b1; color:#ee4a20;}
.close{padding: 0;cursor: pointer; background: transparent; border: 0; -webkit-appearance: none; font-size: 21px; font-weight: bold;line-height: 1; color: #000000; text-shadow: 0 1px 0 #ffffff; opacity: 0.3;}
.close:hover{opacity: 0.5;}
/*新版上传资源弹框20161103byLB*/
.newuploadbox li{ line-height: 30px;}
.icons_new_file{display:block; width:16px; height:16px; background: url("/images/icons_newpublic.png") 0px 0px no-repeat; }
.icons_new_del{display:block; width:16px; height:17px; background: url("/images/icons_newpublic.png") 0px -26px no-repeat; }
.newupload_txt{ display: block; max-width:280px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
#muban_popup_box select.newupload_select{ width: 164px; height: 30px;}
.newupload_textarea{ width: 316px; padding:5px; border:1px solid #c8c8c8;}
#muban_popup_box label.newupload_innnerlabel{ width: auto; text-align: left;}
/*新版导入资源弹框20161107byLB*/
.newupload_conbox{ background: #fff; padding:15px; padding-bottom: 0;}
.newupload_navbox{border-bottom:1px solid #dbdbdb;}
.newupload_nav { height: 30px; line-height: 30px; background: #e7e7e7; }
.newupload_nav li {float:left; padding:0 15px; display: block; text-align:center; }
.newupload_nav li:last-child{ border-right: none;}
.newupload_nav li a{font-size:12px; color:#444;}
.newupload_nav_hover{ background: #3498db; }
.newupload_nav_nomal { }
.newupload_nav_hover a{color: #fff !important; }
.lightheight28{ line-height: 28px;}
/* 搜索 */
.newupload_search_box{ position:relative; }
#muban_popup_box input.newupload_search_input{ width:683px; height:38px; border:none; border:1px solid #d3d8e7; background:#fff; padding-left:5px; padding-right:25px;}
.newupload_search_box a.newupload_btn_search{display:block; width:20px; height:20px; background:url(/images/hw/icons_hw.png) 0 -57px no-repeat; position:absolute; right:5px; top:10px; cursor:pointer;}
.newupload_search_box a:hover.newupload_btn_search{background:url(/images/hw/icons_hw.png) -40px -57px no-repeat;}
/*表格*/
.newupload_table{ width:715px; background:#fff; border:1px solid #e5e5e5; border-bottom: none; text-align: center;}
.newupload_table thead tr,.sy_new_table tbody tr{ height:30px; line-height:30px; border-bottom:1px solid #e5e5e5;}
.newupload_table thead tr th{ border-bottom:1px solid #e5e5e5; font-weight: bold; background-image: linear-gradient(#fcfcfc, #eee);}
.newupload_table tbody tr:hover{ background:#f5f5f5;}
.newupload_table tbody tr td{ height:30px; border-bottom:1px solid #e5e5e5; color:#888;}
.newupload_table td{ padding:0 5px;}
.newupload_td01{ }
.newupload_td02{width:285px; text-align: left; }
.newupload_td02 p{ width:285px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis; display: inline-block;}
.newupload_td03{width:200px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
.newupload_td04{width:100px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
.icons_rslock{ width:13px; height:13px; background:url("/images/icons_newpublic.png") 0px -52px no-repeat; display: inline-block;}
.icons_uploadfiles{width:18px; height:15px; background:url("/images/icons_newpublic.png") 0px -75px no-repeat; display: inline-block;}
.upload_select_box{ width: 337px; height:240px; overflow-y:scroll; padding: 10px; background:#f7f9fd; color: #333; }
#muban_popup_box label.upload_select_label{ width:275px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis; text-align: left; display: inline-block; }
.newupload_tishi{ text-align: center; font-size: 14px;}
.newupload_label_name{ display: inline-block;max-width:130px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
.newupload_table_name{ display: inline-block;max-width:90px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
.newupload_table_name02{ display: inline-block;max-width:90px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
.newupload_td06{max-width:200px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}

View File

@ -1538,3 +1538,9 @@ a.syllabusbox_a_blue{
.icons_project_star{background: url(/images/syllabus/sy_icons_star.png) 0px -27px no-repeat; width:20px; height:20px; display:block; float:left;}
.new_projectlist_more{ text-align:center;}
.new_projectlist_more a:hover{ color:#3b94d6;}
/*403、404、500界面*/
.muban_conbox_max{width: 998px; background-color: #fff; color: #333; margin:0 auto;}
.pages_new_404{ margin:160px 209px 0px 209px; height: 580px;}
.pages_new_404_txt{ font-size: 16px; color: #888; text-align: center;}
.feedbackText{box-shadow:none; width:550px; height:80px; border-color: #DFDFDF; background:#fff; color:#999; padding:3px; font-size:12px;overflow:auto; background-attachment:fixed;border-style:solid;}