Conflicts:
	db/schema.rb
This commit is contained in:
Tim 2015-09-11 15:11:11 +08:00
commit a8cef78ccc
45 changed files with 3877 additions and 2115 deletions

View File

@ -3,6 +3,8 @@ class HomeworkCommonController < ApplicationController
require 'json'
require "base64"
layout "base_courses"
include StudentWorkHelper
before_filter :find_course, :only => [:index,:new,:create,:next_step]
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy]
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment]
@ -18,265 +20,147 @@ class HomeworkCommonController < ApplicationController
end
end
#新建作业,在个人作业列表创建作业
def new
@homework_type = "1"
@homework = HomeworkCommon.new
@homework.safe_attributes = params[:homework_common]
@homework.late_penalty = 2
@homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
@homework.publish_time = Time.now.strftime('%Y-%m-%d')
if @homework_type == "1"
#匿评作业相关属性
@homework_detail_manual = HomeworkDetailManual.new
@homework_detail_manual.ta_proportion = 0.6
@homework_detail_manual.absence_penalty = 2
@homework_detail_manual.evaluation_num = 3
@homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
@homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
@homework.homework_detail_manual = @homework_detail_manual
elsif @homework_type == "2"
#编程作业相关属性
@homework_detail_programing = HomeworkDetailPrograming.new
@homework.homework_detail_programing = @homework_detail_programing
end
respond_to do |format|
format.html
end
end
#新建作业下一步
def next_step
@homework_type = params[:homework_common_type]
@homework = HomeworkCommon.new
@homework.safe_attributes = params[:homework_common]
@homework.late_penalty = 2
@homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
@homework.publish_time = Time.now.strftime('%Y-%m-%d')
if @homework_type == "1"
#匿评作业相关属性
@homework_detail_manual = HomeworkDetailManual.new
@homework_detail_manual.ta_proportion = 0.6
@homework_detail_manual.absence_penalty = 2
@homework_detail_manual.evaluation_num = 3
@homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
@homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
@homework.homework_detail_manual = @homework_detail_manual
elsif @homework_type == "2"
#编程作业相关属性
@homework_detail_programing = HomeworkDetailPrograming.new
@homework.homework_detail_programing = @homework_detail_programing
end
respond_to do |format|
format.html
end
render_404
# @homework_type = "1"
#
# @homework = HomeworkCommon.new
# @homework.safe_attributes = params[:homework_common]
# @homework.late_penalty = 2
# @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
# @homework.publish_time = Time.now.strftime('%Y-%m-%d')
#
# if @homework_type == "1"
# #匿评作业相关属性
# @homework_detail_manual = HomeworkDetailManual.new
# @homework_detail_manual.ta_proportion = 0.6
# @homework_detail_manual.absence_penalty = 2
# @homework_detail_manual.evaluation_num = 3
# @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
# @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
# @homework.homework_detail_manual = @homework_detail_manual
# elsif @homework_type == "2"
# #编程作业相关属性
# @homework_detail_programing = HomeworkDetailPrograming.new
# @homework.homework_detail_programing = @homework_detail_programing
# end
# respond_to do |format|
# format.html
# end
end
#新建作业,在个人作业列表创建作业
def create
if params[:homework_common]
homework = HomeworkCommon.new
homework.name = params[:homework_common][:name]
homework.description = params[:homework_common][:description]
homework.end_time = params[:homework_common][:end_time]
homework.publish_time = params[:homework_common][:publish_time]
homework.homework_type = params[:homework_common][:homework_type]
homework.late_penalty = params[:late_penalty]
homework.user_id = User.current.id
homework.course_id = @course.id
homework.save_attachments(params[:attachments])
render_attachment_warning_if_needed(homework)
if homework.homework_type == 2
homework_detail_programing = HomeworkDetailPrograming.new
homework_detail_programing.language = params[:language]
homework_detail_programing.standard_code = params[:standard_code]
homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6
question = {title:homework.name,content:homework.description}
question[:input] = []
question[:output] = []
if params[:input] && params[:output] && params[:result]
params[:input].each do |k,v|
if params[:output].include? k
homework_test = HomeworkTest.new
homework_test.input = v
homework_test.output = params[:output][k]
homework_test.result = params[:result][k]
homework_test.error_msg = params[:error_msg]
homework.homework_tests << homework_test
question[:input] << homework_test.input
question[:output] << homework_test.output
end
end
end
# uri = URI('http://192.168.80.21:8080/api/questions.json')
# body = question.to_json
# res = Net::HTTP.new(uri.host, uri.port).start do |client|
# request = Net::HTTP::Post.new(uri.path)
# request.body = body
# request["Content-Type"] = "application/json"
# client.request(request)
# end
# result = JSON.parse(res.body)
# homework_detail_programing.question_id = result["id"] if result["status"] && result["status"] == 0
homework.homework_detail_programing = homework_detail_programing
else
#匿评作业相关属性
homework_detail_manual = HomeworkDetailManual.new
homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
homework_detail_manual.comment_status = 1
homework_detail_manual.evaluation_start = params[:evaluation_start]
homework_detail_manual.evaluation_end = params[:evaluation_end]
homework_detail_manual.evaluation_num = params[:evaluation_num]
homework_detail_manual.absence_penalty = params[:absence_penalty]
homework.homework_detail_manual = homework_detail_manual
end
if homework.save
homework_detail_programing.save if homework_detail_programing
homework_detail_manual.save if homework_detail_manual
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_create)
redirect_to homework_common_index_path(:course => @course.id)
}
end
return
end
end
respond_to do |format|
format.html {
flash[:notice] = l(:notice_failed_create)
redirect_to new_homework_common_path(:course => @course.id)
}
end
redirect_to user_homeworks_user_path(User.current.id)
# if params[:homework_common]
# homework = HomeworkCommon.new
# homework.name = params[:homework_common][:name]
# homework.description = params[:homework_common][:description]
# homework.end_time = params[:homework_common][:end_time]
# homework.publish_time = params[:homework_common][:publish_time]
# homework.homework_type = params[:homework_common][:homework_type]
# homework.late_penalty = params[:late_penalty]
# homework.user_id = User.current.id
# homework.course_id = @course.id
#
# homework.save_attachments(params[:attachments])
# render_attachment_warning_if_needed(homework)
#
# if homework.homework_type == 2
# homework_detail_programing = HomeworkDetailPrograming.new
# homework_detail_programing.language = params[:language]
# homework_detail_programing.standard_code = params[:standard_code]
# homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6
# question = {title:homework.name,content:homework.description}
# question[:input] = []
# question[:output] = []
# if params[:input] && params[:output] && params[:result]
# params[:input].each do |k,v|
# if params[:output].include? k
# homework_test = HomeworkTest.new
# homework_test.input = v
# homework_test.output = params[:output][k]
# homework_test.result = params[:result][k]
# homework_test.error_msg = params[:error_msg]
# homework.homework_tests << homework_test
# question[:input] << homework_test.input
# question[:output] << homework_test.output
# end
# end
# end
#
# # uri = URI('http://192.168.80.21:8080/api/questions.json')
# # body = question.to_json
# # res = Net::HTTP.new(uri.host, uri.port).start do |client|
# # request = Net::HTTP::Post.new(uri.path)
# # request.body = body
# # request["Content-Type"] = "application/json"
# # client.request(request)
# # end
# # result = JSON.parse(res.body)
# # homework_detail_programing.question_id = result["id"] if result["status"] && result["status"] == 0
#
# homework.homework_detail_programing = homework_detail_programing
# else
# #匿评作业相关属性
# homework_detail_manual = HomeworkDetailManual.new
# homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
# homework_detail_manual.comment_status = 1
# homework_detail_manual.evaluation_start = params[:evaluation_start]
# homework_detail_manual.evaluation_end = params[:evaluation_end]
# homework_detail_manual.evaluation_num = params[:evaluation_num]
# homework_detail_manual.absence_penalty = params[:absence_penalty]
# homework.homework_detail_manual = homework_detail_manual
# end
#
# if homework.save
# homework_detail_programing.save if homework_detail_programing
# homework_detail_manual.save if homework_detail_manual
# respond_to do |format|
# format.html {
# flash[:notice] = l(:notice_successful_create)
# redirect_to homework_common_index_path(:course => @course.id)
# }
# end
# return
# end
# end
#
# respond_to do |format|
# format.html {
# flash[:notice] = l(:notice_failed_create)
# redirect_to new_homework_common_path(:course => @course.id)
# }
# end
end
def edit
@user = User.current
respond_to do |format|
format.html
format.html{render :layout => 'new_base_user'}
end
end
def update
@homework.name = params[:homework_common][:name]
@homework.description = params[:homework_common][:description]
@homework.end_time = params[:homework_common][:end_time]
@homework.publish_time = params[:homework_common][:publish_time]
@homework.homework_type = params[:homework_common][:homework_type] if params[:homework_common][:homework_type]
unless @homework.late_penalty == params[:late_penalty]
@homework.student_works.where("created_at > '#{@homework.end_time} 23:59:59'").each do |student_work|
student_work.late_penalty = params[:late_penalty]
student_work.save
end
@homework.late_penalty = params[:late_penalty]
end
# @homework.course_id = @course.id
if params[:homework_common]
@homework.name = params[:homework_common][:name]
@homework.description = params[:homework_common][:description]
@homework.end_time = params[:homework_common][:end_time] || Time.now
@homework.course_id = params[:course_id]
#匿评作业相关属性
if @homework.homework_type == 1 && @homework_detail_manual
@homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
@homework_detail_manual.evaluation_start = params[:evaluation_start]
@homework_detail_manual.evaluation_end = params[:evaluation_end]
@homework_detail_manual.evaluation_num = params[:evaluation_num]
unless @homework_detail_manual.absence_penalty == params[:absence_penalty]
if @homework_detail_manual.comment_status == 3 #当前作业处于匿评结束状态,修改缺评扣分才会修改每个作品应扣分的值
work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")"
@homework.student_works.each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
student_work.save
end
end
@homework_detail_manual.absence_penalty = params[:absence_penalty]
end
elsif @homework.homework_type == 0 #普通作业缺评扣分为0分每个作品的缺评扣分改为0分防止某些作业在结束匿评之后改为普通作业
@homework.student_works.where("absence_penalty != 0").each do |student_work|
student_work.late_penalty = 0
student_work.save
end
@homework_detail_manual.absence_penalty = 0 if @homework_detail_manual
end
@homework.save_attachments(params[:attachments])
render_attachment_warning_if_needed(@homework)
#编程作业相关属性
if @homework.homework_type == 2
if @homework.homework_type == 2 && @homework_detail_programing #编程作业
@homework_detail_programing.language = params[:language]
@homework_detail_programing.standard_code = params[:standard_code]
@homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6
homework_tests = @homework.homework_tests
#需要删除的测试
ids = homework_tests.map(&:id) - params[:input].keys.map(&:to_i)
ids.each do |id|
homework_test = HomeworkTest.find id
homework_test.destroy if homework_test
end
if params[:input] && params[:output] && params[:result]
params[:input].each do |k,v|
if params[:output].include? k
homework_test = HomeworkTest.find_by_id k
if homework_test #已存在的测试,修改
homework_test.input = v
homework_test.output = params[:output][k]
homework_test.result = params[:result][k]
homework_test.error_msg = params[:error_msg]
else #不存在的测试,增加
homework_test = HomeworkTest.new
homework_test.input = v
homework_test.output = params[:output][k]
homework_test.result = params[:result][k]
homework_test.error_msg = params[:error_msg]
homework_test.homework_common = @homework
end
homework_test.save
end
end
end
#发送修改作业的请求
question = {title:@homework.name,content:@homework.description}
question[:input] = []
question[:output] = []
@homework.homework_tests.each do |test|
question[:input] << test.input
question[:output] << test.output
end
# uri = URI("http://192.168.80.21:8080/api/questions/#{@homework_detail_programing.question_id}.json")
# body = question.to_json
# res = Net::HTTP.new(uri.host, uri.port).start do |client|
# request = Net::HTTP::Put.new(uri.path)
# request.body = body
# request["Content-Type"] = "application/json"
# client.request(request)
# end
# result = JSON.parse(res.body)
end
@homework.save_attachments(params[:attachments])
render_attachment_warning_if_needed(@homework)
if @homework.save
@homework_detail_manual.save if @homework_detail_manual
@homework_detail_programing.save if @homework_detail_programing
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_edit)
redirect_to homework_common_index_path(:course => @course.id)
}
end
return
else
respond_to do |format|
format.html {
flash[:notice] = l(:notice_failed_edit)
redirect_to edit_homework_common_path(@homework)
}
if @homework.save
@homework_detail_manual.save if @homework_detail_manual
@homework_detail_programing.save if @homework_detail_programing
redirect_to user_homeworks_user_path(User.current.id)
end
end
end
@ -284,7 +168,7 @@ class HomeworkCommonController < ApplicationController
def destroy
if @homework.destroy
respond_to do |format|
format.html {redirect_to homework_common_index_path(:course => @course.id)}
format.html {redirect_to user_homeworks_user_path(User.current.id)}
end
end
end

View File

@ -367,6 +367,19 @@ class UsersController < ApplicationController
end
end
#修改编程作业
def edit_user_commit_homework
if User.current.logged?
respond_to do |format|
format.js
format.html {render :layout => 'new_base_user'}
end
else
render_403
end
end
def user_commit_homework
homework = HomeworkCommon.find(params[:homework])
student_work = homework.student_works.where(user_id: User.current.id).first
@ -395,17 +408,17 @@ class UsersController < ApplicationController
homework.save_attachments(params[:attachments])
render_attachment_warning_if_needed(homework)
#匿评作业相关属性
if homework.homework_type == 1
homework_detail_manual = HomeworkDetailManual.new
homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
homework_detail_manual.comment_status = 1
homework_detail_manual.evaluation_start = Time.now
homework_detail_manual.evaluation_end = Time.now
homework_detail_manual.evaluation_num = params[:evaluation_num] || 3
homework_detail_manual.absence_penalty = 2
homework.homework_detail_manual = homework_detail_manual
else
homework_detail_manual = HomeworkDetailManual.new
homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
homework_detail_manual.comment_status = 1
homework_detail_manual.evaluation_start = Time.now
homework_detail_manual.evaluation_end = Time.now
homework_detail_manual.evaluation_num = params[:evaluation_num] || 3
homework_detail_manual.absence_penalty = 2
homework.homework_detail_manual = homework_detail_manual
#编程作业相关属性
if homework.homework_type == 2
homework_detail_programing = HomeworkDetailPrograming.new
homework.homework_detail_programing = homework_detail_programing
homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6

View File

@ -2297,25 +2297,27 @@ module ApplicationHelper
#获取匿评相关连接代码
def homework_anonymous_comment homework
if homework.homework_type == 1 && homework.homework_detail_manual #匿评作业
if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
link = "<span class='fr mr10 pr_join_span ' title='作业截止日期之前不可以启动匿评'>启动匿评</span>".html_safe
elsif homework.student_works.count >= 2 #作业份数大于2
case homework.homework_detail_manual.comment_status
when 1
link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'fr mr10 work_edit'
when 2
link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'fr mr10 work_edit'
when 3
link = "<span class='fr pr_join_span mr10' title='匿评结束'>匿评结束</span>".html_safe
end
else
link = "<span class='fr mr10 pr_join_span ' title='学生提交作业数大于2时才可以启动匿评'>启动匿评</span>".html_safe
# if homework.homework_type == 1 && homework.homework_detail_manual #匿评作业
#
# elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业作业
# link = "<span class='fr mr10 pr_join_span ' title='编程作业'>编程作业</span>".html_safe
# else
# link = "<span class='fr mr10 pr_join_span ' title='未开启匿评作业不可以启动匿评'>启动匿评</span>".html_safe
# end
if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
link = "<span class='fr mr10 pr_join_span ' title='作业截止日期之前不可以启动匿评'>启动匿评</span>".html_safe
elsif homework.student_works.count >= 2 #作业份数大于2
case homework.homework_detail_manual.comment_status
when 1
link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'fr mr10 work_edit'
when 2
link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'fr mr10 work_edit'
when 3
link = "<span class='fr pr_join_span mr10' title='匿评结束'>匿评结束</span>".html_safe
end
elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业作业
link = "<span class='fr mr10 pr_join_span ' title='编程作业'>编程作业</span>".html_safe
else
link = "<span class='fr mr10 pr_join_span ' title='未开启匿评作业不可以启动匿评'>启动匿评</span>".html_safe
link = "<span class='fr mr10 pr_join_span ' title='学生提交作业数大于2时才可以启动匿评'>启动匿评</span>".html_safe
end
link
end

View File

@ -1,4 +1,5 @@
# encoding: utf-8
include UsersHelper
module HomeworkCommonHelper
#迟交扣分下拉框
def late_penalty_option

View File

@ -1,4 +1,5 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'prettify','/assets/kindeditor/pasteimg' %>
<%= stylesheet_link_tag 'prettify'%>
<%= labelled_form_for @bid,:html => { :multipart => true } do |f| %>
<%= render :partial => 'new_homework_form', :locals => { :bid => @bid, :bid_id => "edit_bid_#{@bid.id}",:f=>f,:edit_mode => true} %>
<% end %>

View File

@ -1,24 +1,23 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<%= error_messages_for 'homework_common' %>
<div class="project_r_h">
<h2 class="project_h2">
<%= l(:label_course_homework_edit)%>
</h2>
<script type="text/javascript">
function reset_homework(){
$("#homework_name").val("");
$("#homework_end_time").val("");
$("#course_id").val($("#option_select").val());
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new })%>");
homework_description_editor.html("");
$("#homework_editor").toggle();
}
</script>
<div class="homepageRightBanner mb10">
<div class="NewsBannerName">编辑作业</div>
</div>
<div class="hwork_new">
<%if @homework.homework_type == 2%>
<%= form_for @homework do |f| %>
<%= render :partial => 'homework_common/homework_detail_programing_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('edit_homework_common_<%= @homework.id%>');" >提交</a>
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
<% end%>
<% else %>
<%= form_for @homework do |f| %>
<%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('edit_homework_common_<%= @homework.id%>');" >提交</a>
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
<% end%>
<% end%>
</div><!--hwork_new end-->
<div class="cl"></div>
<!-- 老师身份才可以发布作业 -->
<div class="HomeWork mb10">
<%= form_for @homework do |f| %>
<div id="HomeWorkCon">
<%= render :partial => 'users/user_homework_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
</div>
<% end%>
</div><!----HomeWork end-->

View File

@ -98,17 +98,17 @@
<div class="cl"></div>
<% end%>
<div class="mt5">
<!--div class="mt5">
<span class="tit_fb" style="width: auto;"> 扣分标准:</span>
<div class="fl mb5 c_red">
<% if homework.homework_type == 1%>
<%= scoring_rules homework.late_penalty,homework.id,@is_teacher,homework.homework_detail_manual.absence_penalty%>
<% else%>
<%= scoring_rules homework.late_penalty,homework.id,@is_teacher%>
<% end%>
<%# if homework.homework_type == 1%>
<%#= scoring_rules homework.late_penalty,homework.id,@is_teacher,homework.homework_detail_manual.absence_penalty%>
<%# else%>
<%#= scoring_rules homework.late_penalty,homework.id,@is_teacher%>
<%# end%>
</div>
</div>
<div class="cl"></div>
<div class="cl"></div-->
<span class="fl"><%= l(:label_end_time)%><%= homework.end_time%></span>
<% if betweentime(homework.end_time) < 0 %>

View File

@ -8,11 +8,11 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application','prettify', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "jquery.leanModal.min" %>
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
<%= javascript_include_tag 'seems_rateable/jRating','prettify', 'seems_rateable/rateable'%>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->

View File

@ -17,8 +17,8 @@
<%= javascript_heads %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= stylesheet_link_tag 'public', 'leftside', 'jquery/jquery-ui-1.9.2', 'courses','header'%>
<%= javascript_include_tag "course","header","attachments" %>
<%= stylesheet_link_tag 'public', 'leftside', 'jquery/jquery-ui-1.9.2','prettify', 'courses','header'%>
<%= javascript_include_tag "course","header","attachments",'prettify' %>
<!-- page specific tags -->
<%= yield :header_tags -%>
</head>

View File

@ -7,10 +7,10 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application','prettify', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' ,'prettify' %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>

View File

@ -7,12 +7,12 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application','prettify', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= javascript_include_tag "ckeditor/ckeditor.js" %>
<%= javascript_include_tag "ckeditor/ckeditor.js",'prettify' %>
<!-- page specific tags -->
<%= yield :header_tags -%>
<%= stylesheet_link_tag 'base','header', :media => 'all'%>

View File

@ -12,8 +12,8 @@
<%= favicon %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= stylesheet_link_tag 'public', 'pleft', 'project','jquery/jquery-ui-1.9.2','header' %>
<%= javascript_include_tag 'cookie','project', 'header','select_list_move' %>
<%= stylesheet_link_tag 'public', 'pleft', 'project','prettify','jquery/jquery-ui-1.9.2','header' %>
<%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move' %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>
@ -21,7 +21,7 @@
</head>
<!--add by huang-->
<body>
<body onload=" ">
<div class="navContainer mb10">
<% if User.current.logged? %>
<%= render :partial => 'layouts/logined_header' %>

View File

@ -12,8 +12,9 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application','prettify', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_include_tag 'prettify' %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>

View File

@ -13,10 +13,10 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application','prettify', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag 'prettify' %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->

View File

@ -14,10 +14,10 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'public_new', 'leftside_new','users', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'public_new', 'leftside_new',prettify,'users', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "avatars"%>
<%= javascript_include_tag "avatars",'prettify'%>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= yield :header_tags -%>

View File

@ -12,10 +12,10 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan','prettify', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "jquery.leanModal.min" %>
<%= javascript_include_tag "jquery.leanModal.min",'prettify' %>
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>

View File

@ -13,8 +13,8 @@
<%= javascript_heads %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= stylesheet_link_tag 'public', 'leftside', 'courses','header'%>
<%= javascript_include_tag "course","header" %>
<%= stylesheet_link_tag 'public', 'leftside', 'courses','header','prettify'%>
<%= javascript_include_tag "course","header",'prettify' %>
<!-- page specific tags -->
<%= yield :header_tags -%>
</head>

View File

@ -7,10 +7,10 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'new_user', 'user_leftside','users',:media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'new_user', 'user_leftside','prettify','users',:media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","new_user"%>
<%= javascript_include_tag "bootstrap","avatars","new_user",'prettify'%>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= yield :header_tags -%>
@ -27,6 +27,8 @@
</div>
<div class="homepageContentContainer">
<!--div class="homepageRightBannerImg"></div-->
<div class="cl"></div>
<div class="homepageContent">
<div class="homepageLeft" id="LSide">
<div class="homepagePortraitContainer">

View File

@ -7,10 +7,10 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan','prettify', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "jquery.leanModal.min" %>
<%= javascript_include_tag "jquery.leanModal.min",'prettify' %>
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>

View File

@ -7,10 +7,10 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan','prettify', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "jquery.leanModal.min" %>
<%= javascript_include_tag "jquery.leanModal.min" ,'prettify'%>
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>

View File

@ -185,18 +185,18 @@
</div>
<div class="cl"></div>
<div class="mt5">
<!--div class="mt5">
<span class="tit_fb" style="width: auto;"> 扣分标准:</span>
<div class="fl mb5 c_red">
<% if @homework.homework_type == 1%>
<%= scoring_rules @homework.late_penalty,@homework.id,@is_teacher,@homework.homework_detail_manual.absence_penalty%>
<% else%>
<%= scoring_rules @homework.late_penalty,@homework.id,@is_teacher%>
<% end%>
<%# if @homework.homework_type == 1%>
<%#= scoring_rules @homework.late_penalty,@homework.id,@is_teacher,@homework.homework_detail_manual.absence_penalty%>
<%# else%>
<%#= scoring_rules @homework.late_penalty,@homework.id,@is_teacher%>
<%# end%>
</div>
</div>
<div class="cl"></div>
<div class="cl"></div-->
<span class="fl">截止时间:<%= @homework.end_time%></span>
<div >
<% if betweentime(@homework.end_time) < 0 %>

View File

@ -1,17 +1,20 @@
<!-- 此界面只用来新建匿评作业作品 -->
<script type="text/javascript">
<%if @homework.homework_type == 1 && @homework.homework_detail_manual.comment_status != 1%>
<%if @homework.homework_detail_manual.comment_status != 1%>
$(function(){
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/new_student_work_alert') %>');
showModal('ajax-modal', '360px');
$('#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().css("top","").css("left","");
$('#ajax-modal').parent().css("top","30%").css("left","40%");
$('#ajax-modal').parent().addClass("anonymos_work");
// alert("当前作业已开启匿评,您提交作品后将不会收到任何匿评作品,您的作品也不会被其他用户匿评,如需获得最终成绩,请您联系主讲老师对您的作品单独进行评分");
});
<% end%>
//匿评弹框取消按钮
function clickCanel(){hideModal("#popbox02");}
</script>
<div class="homepageRightBanner mb10">

View File

@ -72,7 +72,7 @@
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
<input type="hidden" name="quote[quote]" value="">
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px;"></div>
<a id="new_message_cancel_btn_<%= user_activity_id%>" href="javascript:void(0)" class="grey_n_btn fr " style="margin-top:6px;">取消</a>

View File

@ -44,7 +44,7 @@
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" nhname='new_message_textarea_<%= user_activity_id%>' name="comment"></textarea>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="comment"></textarea>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px;"></div>
<a id="new_message_cancel_btn_<%= user_activity_id%>" href="javascript:void(0)" class="grey_n_btn fr " style="margin-top:6px;">取消</a>

View File

@ -82,7 +82,7 @@
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => add_journal_issue_path(activity.id),:method => "post", :remote => true) do |f|%>
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" nhname='new_message_textarea_<%= user_activity_id%>' name="notes"></textarea>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="notes"></textarea>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px;"></div>
<a id="new_message_cancel_btn_<%= user_activity_id%>" href="javascript:void(0)" class="grey_n_btn fr " style="margin-top:6px;">取消</a>

View File

@ -58,7 +58,7 @@
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
<input type="hidden" name="quote[quote]" value="">
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
<p nhname='contentmsg_<%= user_activity_id%>'></p>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px;"></div>
<a id="new_message_cancel_btn_<%= user_activity_id%>" href="javascript:void(0)" class="grey_n_btn fr " style="margin-top:6px;">取消</a>

View File

@ -11,7 +11,7 @@
</li>
<li class="resourcesListName fl">
<!--<a href="javascript:void(0);" class="resourcesBlack"><%#=truncate(attach.filename,:length=>18)%></a>-->
<%= link_to truncate(attach.filename,:length=>18), download_named_attachment_path(attach.id, attach.filename),
<%= link_to truncate(attach.filename,:length=>30), download_named_attachment_path(attach.id, attach.filename),
:title => attach.filename,:class=>'resourcesBlack'%>
</li>
<li class="resourcesListSize fl"><%= number_to_human_size(attach.filesize) %></li>

View File

@ -5,23 +5,22 @@
<div class="HomeWorkCon">
<div>
<input type="text" name="homework_common[name]" id="homework_name" class="InputBox w712" maxlength="255" onfocus="$('#homework_editor').show()" onkeyup="regex_homework_name();" placeholder="请输入作业标题" value="<%= homework.name%>" >
<input type="text" name="homework_common[name]" id="homework_name" class="InputBox w701" maxlength="255" onfocus="$('#homework_editor').show()" onkeyup="regex_homework_name();" placeholder="请输入作业标题" value="<%= homework.name%>" >
<p id="homework_name_span" class="c_red mt5"></p>
</div>
<div class="cl"></div>
<div class=" mt10">
<%= link_to "导入作业", user_import_homeworks_user_path(User.current.id),:class => "BlueCirBtn fl mr10",:remote => true%>
<%= link_to("导入作业", user_import_homeworks_user_path(User.current.id),:class => "BlueCirBtn fl mr10",:remote => true) unless edit_mode%>
<div class="calendar_div fl">
<input type="text" name="homework_common[end_time]" id="homework_end_time" placeholder="截止日期" class="InputBox fl W120 calendar_input" readonly="readonly" >
<input type="text" name="homework_common[end_time]" id="homework_end_time" placeholder="截止日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.end_time%>" >
<%= calendar_for('homework_end_time')%>
</div>
</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: none">
<div id="homework_editor" style="display: <%= edit_mode ? 'block':'none'%>">
<div class="mt10">
<% if edit_mode %>
<%= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px", :owner_id => homework.id, :owner_type => OwnerTypeHelper::HOMEWORKCOMMON %>
@ -34,20 +33,27 @@
<div class="mt10">
<%= select_tag :course_id, options_for_select(get_as_teacher_courses(User.current), homework.course_id), {:class => "InputBox w720",:value => "请选择发布作业的课程"} %>
<%= select_tag :course_id, options_for_select(get_as_teacher_courses(User.current), homework.course_id), {:class => "InputBox w709",:value => "请选择发布作业的课程"} %>
</div>
<p id="homework_course_id_span" class="c_red mt5"></p>
<div class="cl"></div>
<div id="homework_attachments">
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => homework, :has_program=>true} %>
<!-- 编辑作业 && 作业类型为匿评作业 时没有编程选项-->
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => homework, :has_program=>!(edit_mode && homework.homework_type == 1)} %>
</div>
<div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_homework('new_homework_common');">发送</a>
<span class="fr mr10 mt3">或</span>
<a href="javascript:void(0);" class=" fr mr10 mt3" onclick="reset_homework();">取消</a>
<% if edit_mode %>
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_homework('edit_homework_common_<%= homework.id%>');">确定</a>
<span class="fr mr10 mt3">或</span>
<%= link_to "取消",user_homeworks_user_path(User.current.id),:class => "fr mr10 mt3"%>
<% else %>
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_homework('new_homework_common');">发送</a>
<span class="fr mr10 mt3">或</span>
<a href="javascript:void(0);" class=" fr mr10 mt3" onclick="reset_homework();">取消</a>
<% end %>
<div class="cl"></div>
</div>

View File

@ -1,41 +1,41 @@
<input type="hidden" value="<%= @type%>" name="type" id="user_activities_type">
<div class="homepageRightBanner">
<div class="homepageRightBanner">
<div class="NewsBannerName">最新动态</div>
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="homepagePostType">
<li>
<ul class="homepagePostTypeHomework fl">
<li class="f14">课程动态</li>
<li><%= link_to "作业动态", {:controller => "users", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%>
<!--<a href="javascript:void(0);" class="homepagePostTypeAssignment postTypeGrey">作业动态</a>--></li>
<li><%= link_to "通知动态", {:controller => "users", :action => "show", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeNotice postTypeGrey">通知动态</a></li>-->
<li><%= link_to "论坛动态", {:controller => "users", :action => "show", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
<li><%= link_to "问卷动态", {:controller => "users", :action => "show", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuiz postTypeGrey">问卷动态</a></li>-->
</ul>
</li>
<li>
<ul class="homepagePostTypeProject fl">
<li class="f14">项目动态</li>
<li><%= link_to "问题动态", {:controller => "users", :action => "show", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%>
<li><%= link_to "论坛动态", {:controller => "users", :action => "show", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuestion postTypeGrey">问题动态</a></li>
<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
</ul>
</li>
<li>
<ul class="homepagePostTypeProject fl">
<li class="f14">更多</li>
<li class="mt-4"><%= link_to "我的动态", {:controller => "users", :action => "show", :type => "current_user"}, :class =>"homepagePostTypeAll postTypeGrey"%>
<li class="mt-4"><%= link_to "全部动态", {:controller => "users", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%>
</ul>
</li>
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="homepagePostType">
<li>
<ul class="homepagePostTypeHomework fl">
<li class="f14">课程动态</li>
<li><%= link_to "作业动态", {:controller => "users", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%>
<!--<a href="javascript:void(0);" class="homepagePostTypeAssignment postTypeGrey">作业动态</a>--></li>
<li><%= link_to "通知动态", {:controller => "users", :action => "show", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeNotice postTypeGrey">通知动态</a></li>-->
<li><%= link_to "论坛动态", {:controller => "users", :action => "show", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
<li><%= link_to "问卷动态", {:controller => "users", :action => "show", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuiz postTypeGrey">问卷动态</a></li>-->
</ul>
</li>
<li>
<ul class="homepagePostTypeProject fl">
<li class="f14">项目动态</li>
<li><%= link_to "问题动态", {:controller => "users", :action => "show", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%>
<li><%= link_to "论坛动态", {:controller => "users", :action => "show", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuestion postTypeGrey">问题动态</a></li>
<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>-->
</ul>
</li>
<li>
<ul class="homepagePostTypeProject fl">
<li class="f14">更多</li>
<li class="mt-4"><%= link_to "我的动态", {:controller => "users", :action => "show", :type => "current_user"}, :class =>"homepagePostTypeAll postTypeGrey"%>
<li class="mt-4"><%= link_to "全部动态", {:controller => "users", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%>
</ul>
</li>
</ul>
</div>
</li>
</ul>
</div>
<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities,:page => 0,:type => @type} %>

View File

@ -3,7 +3,7 @@
$("#homework_name").val("");
$("#homework_end_time").val("");
$("#course_id").val($("#option_select").val());
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new })%>");
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true })%>");
homework_description_editor.html("");
$("#homework_editor").toggle();
}

View File

@ -2,4 +2,6 @@
closeModal();
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
//这里不能将翻页的更新
$("#res_all_count").html(parseInt($("#res_all_count").html())+1);
$("#res_all_count").html(parseInt($("#res_all_count").html())+1);
$("#res_count").html(0);
$("#checkboxAll").attr('checked',false);

View File

@ -3,6 +3,6 @@ hideModal('#coursesChoosePopup');
$("#homework_name").val("<%= @homework.name%>");
$("#homework_end_time").val("<%= @homework.end_time%>");
$("#course_id").val("<%= @homework.course_id%>");
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => @homework })%>");
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => @homework,:has_program => true })%>");
homework_description_editor.html("<%= escape_javascript(@homework.description.html_safe)%>");
$("#homework_editor").show();

View File

@ -0,0 +1,25 @@
class AboutProgramingHomework < ActiveRecord::Migration
def up
HomeworkCommon.where(:homework_type => 2).each do |homework|
unless homework.homework_detail_manual
homework_detail_manual = HomeworkDetailManual.new
homework_detail_manual.ta_proportion = 0.6
homework_detail_manual.comment_status = 1
homework_detail_manual.evaluation_start = homework.created_at
homework_detail_manual.evaluation_end = homework.created_at
homework_detail_manual.evaluation_num = 3
homework_detail_manual.absence_penalty = 2
homework_detail_manual.homework_common_id = homework.id
homework_detail_manual.save
end
end
end
def down
HomeworkCommon.where(:homework_type => 2).each do |homework|
if homework.homework_detail_manual
homework.homework_detail_manual.destroy
end
end
end
end

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,8 @@ module RailsKindeditor
output << text_area_tag(name, content, input_html)
output << javascript_tag(js_replace(id, options.merge(window_onload: 'true',
:autoHeightMode=>true,
afterCreate: 'eval(function(){enablePasteImg(self);this.loadPlugin("autoheight")})')))
afterCreate: 'eval(function(){enablePasteImg(self);this.loadPlugin("autoheight")})'
)))
end
def kindeditor(name, method, options = {})
@ -20,7 +21,8 @@ module RailsKindeditor
output_buffer << build_text_area_tag(name, method, self, options, input_html)
output_buffer << javascript_tag(js_replace(input_html['id'],options.merge(window_onload: 'true',
:autoHeightMode=>true,
afterCreate: 'eval(function(){enablePasteImg(self);this.loadPlugin("autoheight")})')))
afterCreate: 'eval(function(){enablePasteImg(self);this.loadPlugin("autoheight")})'
)))
end
def kindeditor_upload_json_path(*args)

View File

@ -258,16 +258,16 @@ K.options = {
fullscreenShortcut : false,
bodyClass : 'ke-content',
indentChar : '\t',
cssPath : '',
cssPath : K.basePath +'plugins/code/previewcode.css',
cssData : '',
minWidth : 650,
minHeight : 100,
minChangeSize : 50,
zIndex : 811213,
items : [ 'emoticons',
'source','plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', '|',
'formatblock', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
'italic', 'underline', 'removeformat', '|','imagedirectupload','table', 'media',"more"
items : ['code', 'emoticons','fontname',
'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|',
'formatblock', 'fontsize', '|','indent', 'outdent',
'|','imagedirectupload','table', 'media', 'preview',"more"
],
noDisableItems : ['source', 'fullscreen'],
colorTable : [
@ -4986,17 +4986,17 @@ KEditor.prototype = {
htmlList.unshift('<div style="display:block" id="define"/>')
htmlList.push('</div>')
var htmlListFull = [];
var fullItems = [
'emoticons',
'source','plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', '|',
'formatblock', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
'italic', 'underline', 'removeformat', '|','imagedirectupload','table', 'media', "less",
var fullItems = ['code',
'emoticons','fontname',
'forecolor', 'hilitecolor', 'bold','|', 'justifyleft', 'justifycenter', 'insertorderedlist', 'insertunorderedlist', '|',
'formatblock', 'fontsize', '|', 'indent', 'outdent',
'|','imagedirectupload','table', 'media', 'preview', "less",
'/',
'undo', 'redo', '|', 'preview', 'print', 'template',
'justifyfull', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
'superscript', 'clearhtml', 'quickformat', /* 'selectall',*/ 'fontname',
'italic', 'underline', 'undo', 'redo', '|', 'removeformat',
'justifyright','justifyfull', 'source','plainpaste', 'wordpaste', 'subscript',
'superscript', 'clearhtml', 'quickformat', /* 'selectall',*/
'strikethrough', 'lineheight', 'hr', 'pagebreak',
'anchor' , 'link','unlink'
'link','unlink', 'print'
]
K.each(fullItems, function(i, name) {
if (name == '|') {
@ -5069,6 +5069,7 @@ KEditor.prototype = {
}
self.updateState();
self.addBookmark();
prettyPrint("",self.edit.doc.body);
if (self.options.afterChange) {
self.options.afterChange.call(self);
}
@ -5550,6 +5551,7 @@ _plugin('core', function(K) {
self.afterSetHtml(function() {
if (self.options.afterChange) {
self.options.afterChange.call(self);
}
});
self.afterCreate(function() {

View File

@ -27,7 +27,9 @@ KindEditor.plugin('autoheight', function(K) {
var edit = self.edit;
var body = edit.doc.body;
edit.iframe.height(minHeight);
self.resize(null, Math.max((K.IE ? body.scrollHeight : body.offsetHeight) + 76, minHeight));
self.resize(null, Math.max(
(K.IE ? body.scrollHeight : body.offsetHeight)
+ 76, minHeight));
}
function init() {
@ -35,7 +37,12 @@ KindEditor.plugin('autoheight', function(K) {
self.edit.afterChange(resetHeight);
hideScroll();
resetHeight();
var edit = self.edit;
var body = edit.doc.body;
edit.iframe.height(minHeight);
self.resize(null, Math.max(
((K.IE ? body.scrollHeight : body.offsetHeight) > 500 ? 500 : (K.IE ? body.scrollHeight : body.offsetHeight)) //限制初始化太高的情况
+ 76, minHeight));
}
if (self.isCreated) {

View File

@ -23,10 +23,9 @@ KindEditor.plugin('code', function(K) {
'<option value="php">PHP</option>',
'<option value="pl">Perl</option>',
'<option value="py">Python</option>',
'<option value="rb">Ruby</option>',
'<option value="java">Java</option>',
'<option value="vb">ASP/VB</option>',
'<option value="cpp">C/C++</option>',
'<option value="c">C/C++</option>',
'<option value="cs">C#</option>',
'<option value="xml">XML</option>',
'<option value="bsh">Shell</option>',
@ -46,7 +45,7 @@ KindEditor.plugin('code', function(K) {
var type = K('.ke-code-type', dialog.div).val(),
code = textarea.val(),
cls = type === '' ? '' : ' lang-' + type,
html = '<pre class="prettyprint' + cls + '">\n' + K.escape(code) + '</pre> ';
html = '<pre class="prettyprint linenums ' + cls + '">\n' + K.escape(code) + '</pre> ';
if (K.trim(code) === '') {
alert(lang.pleaseInput);
textarea[0].focus();

View File

@ -0,0 +1,76 @@
/* Pretty printing styles. Used with prettify.js. */
/* SPAN elements with the classes below are added by prettyprint. */
.pln { color: #000 } /* plain text */
@media screen {
.str { color: #080 } /* string content */
.kwd { color: #008 } /* a keyword */
.com { color: #800 } /* a comment */
.typ { color: #606 } /* a type name */
.lit { color: #066 } /* a literal value */
/* punctuation, lisp open bracket, lisp close bracket */
.pun, .opn, .clo { color: #660 }
.tag { color: #008 } /* a markup tag name */
.atn { color: #606 } /* a markup attribute name */
.atv { color: #080 } /* a markup attribute value */
.dec, .var { color: #606 } /* a declaration; a variable name */
.fun { color: red } /* a function name */
}
/* Use higher contrast and text-weight for printable form. */
@media print, projection {
.str { color: #060 }
.kwd { color: #006; font-weight: bold }
.com { color: #600; font-style: italic }
.typ { color: #404; font-weight: bold }
.lit { color: #044 }
.pun, .opn, .clo { color: #440 }
.tag { color: #006; font-weight: bold }
.atn { color: #404 }
.atv { color: #060 }
}
/* Put a border around prettyprinted code snippets. */
pre.prettyprint { padding: 2px;
border-left:1px solid #ccc;
border-bottom: 1px solid #ccc;
border-right: 1px solid #ccc,
border-top: 1px solid #ccc }
pre li,ul,ol {
list-style-type: none;
}
/* Specify class=linenums on a pre to get line numbering */
ol.linenums { margin-top: 0; margin-bottom: 0 } /* IE indents via margin-left */
li.L0,
li.L1,
li.L2,
li.L3,
li.L5,
li.L6,
li.L7,
li.L8 { list-style-type: none }
/* Alternate shading for lines */
li.L1,
li.L3,
li.L5,
li.L7,
li.L9 { background: #eee }
.prettyprint *{font-family:'courier new',monospace;}
/*.prettyprint .com { color: #93a1a1; }*/
/*.prettyprint .lit { color: #AE81FF; }*/
/*.prettyprint .pun,*/
/*.prettyprint .opn,*/
/*.prettyprint .clo { color: #F8F8F2; }*/
/*.prettyprint .fun { color: #dc322f; }*/
/*.prettyprint .str,*/
/*.prettyprint .atv { color: #E6DB74; }*/
/*.prettyprint .kwd,*/
/*.prettyprint .tag { color: #F92659; }*/
/*.prettyprint .typ,*/
/*.prettyprint .atn,*/
/*.prettyprint .dec,*/
/*.prettyprint .var { color: #A6E22E; }*/
/*.prettyprint .pln { color: #66D9EF; }*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -58,10 +58,10 @@ $(function(){
);
};
$('#test-program-btn').on('click', test_program);
$('#test-program-btn').live('click', test_program);
$('#commit-program-work-btn').on('click', function(){
$('#commit-program-work-btn').live('click', function(){
if(!valid_form()){
return;
}
@ -89,7 +89,7 @@ $(function(){
$(".HomeWorkCon form").submit();
});
$('form.edit_student_work').on('keydown', '#program-src', function(){
$('form.edit_student_work').live('keydown', '#program-src', function(){
tested = false;
});
@ -104,12 +104,12 @@ $(function(){
$('input.date-input').datepicker(datepickerOptions);
$('a.pic_date').on('click', function(){
$('a.pic_date').live('click', function(){
$(this).parent().prev().first().focus();
})
$('a.ProBtn').on('click', function(){
$('a.ProBtn').live('click', function(){
$("#BluePopupBox").dialog({
modal: true,
dialogClass: 'BluePopupBox',
@ -117,12 +117,12 @@ $(function(){
});
$(".ui-dialog-titlebar").hide();
$("a.CloseBtn").on('click', function(){
$("a.CloseBtn").live('click', function(){
$("#BluePopupBox" ).dialog("close");
});
$('#textarea_input_test').focus();
$("#BluePopupBox a.BlueCirBtn").on('click', function(){
$("#BluePopupBox a.BlueCirBtn").live('click', function(){
var test_numbers = 0;
var valid = true;
var input = null;
@ -162,12 +162,12 @@ $(function(){
});
});
$("#BluePopupBox").on('click', 'a.icon_add', function(){
$("#BluePopupBox").live('click', 'a.icon_add', function(){
var html = bt('t:test-answer-list', null);
$(this).parent('.mt10').after(html);
});
$("#BluePopupBox").on('click', 'a.icon_remove', function(){
$("#BluePopupBox").live('click', 'a.icon_remove', function(){
$(this).parent('.mt10').remove();
});
});

View File

@ -71,6 +71,7 @@ function submit_homework(id)
$("#course_id").focus();
}
else{
homework_description_editor.sync();
$("#"+id).submit();
}

File diff suppressed because it is too large Load Diff

View File

@ -313,10 +313,10 @@ a.uploadText {color:#ffffff; font-size:14px;}
/*.resourcesListType {width:150px; height:40px; line-height:40px; text-align:center;}*/
/*.resourcesListUploader {width:130px; height:40px; line-height:40px; text-align:center;}*/
/*.resourcesListTime {width:165px; height:40px; line-height:40px; text-align:center;}*/
.resourcesListName {width:180px; height:40px; line-height:40px; text-align:left;}
.resourcesListSize {width:105px; height:40px; line-height:40px; text-align:center;}
.resourcesListType {width:150px; height:40px; line-height:40px; text-align:center;}
.resourcesListUploader {width:160px; height:40px; line-height:40px; text-align:center;}
.resourcesListName {width:340px; height:40px; line-height:40px; text-align:left;}
.resourcesListSize {width:85px; height:40px; line-height:40px; text-align:center;}
.resourcesListType {width:85px; height:40px; line-height:40px; text-align:center;}
.resourcesListUploader {width:85px; height:40px; line-height:40px; text-align:center;}
.resourcesListTime {width:95px; height:40px; line-height:40px; text-align:center;}
/*.resourcesList {width:730px; height:39px; background-color:#ffffff; border-bottom:1px dashed #eaeaea; color:#9a9a9a; font-size:12px;}*/
a.resourcesBlack {font-size:12px; color:#4c4c4c;white-space: nowrap;text-align: left}
@ -465,8 +465,8 @@ a.homepageSearchIcon:hover {background:url(../images/nav_icon.png) -49px 3px no-
/*.navHomepageProfile ul li ul {display:none;}
.navHomepageProfile ul li:hover ul {display:block;}*/
.homepageLeft {width:240px; float:left; margin-right:10px; margin-bottom:10px;}
.homepageRight {width:750px; float:left; margin-top:15px; margin-bottom:10px;}
.homepagePortraitContainer {width:208px; border:1px solid #dddddd; background-color:#ffffff; margin-top:15px; padding:15px;}
.homepageRight {width:750px; float:left; margin-top:10px; margin-bottom:10px;}
.homepagePortraitContainer {width:208px; border:1px solid #dddddd; background-color:#ffffff; margin-top:10px; padding:15px;}
.homepagePortraitImage {width:78px; height:78px; position:relative; border:1px solid #cbcbcb; padding: 2px;}
.homepagePortraitImage:hover {border:1px solid #269ac9;}
.homepageFollow {background:url(../images/homepage_icon.png) -10px -8px no-repeat; width:20px; height:20px; position:absolute; right:9px; top:9px;}
@ -505,6 +505,7 @@ a.homepageMenuText {color:#484848; font-size:16px; margin-left:20px;}
.homepageLeftLabelContainer {width:238px; border:1px solid #dddddd; background-color:#ffffff; margin-top:10px;}
.homepageLabelText {color:#484848; font-size:16px; margin-left:10px; margin-bottom:12px; display:block;}
.homepageRightBanner {width:718px; margin:0px auto; float:right; background-color: #ffffff; padding:10px 15px; border:1px solid #dddddd;}
.homepageRightBannerImg{width:1000px; margin:0px auto; height: 60px; margin-top: 10px; background:url(../images/TeachersDay.jpg)}
.NewsBannerName {font-size:16px; color:#4b4b4b; display:block; width:150px; float:left;}
.newsType {width:60px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:5px 10px; left:-40px; font-size:12px; color:#888888; display:none; line-height:2; z-index:9999;}
.newsReadSetting {width:700px; background-color:#f6f6f6; border-bottom:1px solid #eeeeee; margin:10px auto; height:39px; line-height:39px; vertical-align:middle; font-size:14px; color:#7a7a7a; padding-left:10px;}
@ -575,6 +576,7 @@ a.postReplyCancel:hover {color:#ffffff;}
.homepagePostReplyInput2 {width:588px; height:45px; max-width:588px; max-height:45px; border:1px solid #d9d9d9; outline:none; margin:0px auto 10px auto;}
.homepagePostReplyContainer {border-bottom:1px solid #e3e3e3; width:680px; margin:0px auto; margin-top:15px; min-height:60px;}
.homepagePostSetting {position:absolute; width:20px; height:20px; right:0px; top:0px;}
.homepagePostSetting ul li:hover ul {display:block;}
.homepagePostSettingIcon {background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px;}
.homepagePostSettiongText {width:85px; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-68px; top:20px; padding:5px 0px; display:none;}
.homepagePostSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;}
@ -855,6 +857,8 @@ a:hover.BlueCirBtn{ background:#269ac9; color:#fff;}
.w708{width: 708px;}
.w712{width:712px;max-width:712px;min-width: 712px;}
.w720{width:721px;}
.w709{width: 709px;}
.w701{width: 701px;}
a.AnnexBtn{ background: url(../images/homepage_icon2.png) 0px -343px no-repeat; width:70px; height:20px; display:block; padding-left:20px; color:#888888;}
a:hover.AnnexBtn{background: url(../images/homepage_icon2.png) -90px -343px no-repeat; color:#269ac9;}
a.FilesBtn{ background: url(../images/homepage_icon2.png) 0px -373px no-repeat; width:70px; height:20px; display:block; padding-left:20px; color:#888888;}

View File

@ -0,0 +1,77 @@
/* Pretty printing styles. Used with prettify.js. */
/* SPAN elements with the classes below are added by prettyprint. */
.pln { color: #000 } /* plain text */
@media screen {
.str { color: #080 } /* string content */
.kwd { color: #008 } /* a keyword */
.com { color: #800 } /* a comment */
.typ { color: #606 } /* a type name */
.lit { color: #066 } /* a literal value */
/* punctuation, lisp open bracket, lisp close bracket */
.pun, .opn, .clo { color: #660 }
.tag { color: #008 } /* a markup tag name */
.atn { color: #606 } /* a markup attribute name */
.atv { color: #080 } /* a markup attribute value */
.dec, .var { color: #606 } /* a declaration; a variable name */
.fun { color: red } /* a function name */
}
/* Use higher contrast and text-weight for printable form. */
@media print, projection {
.str { color: #060 }
.kwd { color: #006; font-weight: bold }
.com { color: #600; font-style: italic }
.typ { color: #404; font-weight: bold }
.lit { color: #044 }
.pun, .opn, .clo { color: #440 }
.tag { color: #006; font-weight: bold }
.atn { color: #404 }
.atv { color: #060 }
}
/* Put a border around prettyprinted code snippets. */
pre.prettyprint { padding: 2px;
border-left:30px solid #ccc;
border-bottom: 1px solid #ccc;
border-right: 1px solid #ccc,
border-top: 1px solid #ccc }
pre li,ul,ol {
list-style-type: decimal;
}
/* Specify class=linenums on a pre to get line numbering */
ol.linenums { margin-top: 0; margin-bottom: 0;line-height: 3px } /* IE indents via margin-left */
li.L0,
li.L1,
li.L2,
li.L3,
li.L5,
li.L6,
li.L7,
li.L8 { list-style-type: decimal; }
/* Alternate shading for lines */
li.L1,
li.L3,
li.L5,
li.L7,
li.L9 { background: #eee }
.prettyprint *{font-family:'courier new',monospace;}
/*.prettyprint .com { color: #93a1a1; }*/
/*.prettyprint .lit { color: #AE81FF; }*/
/*.prettyprint .pun,*/
/*.prettyprint .opn,*/
/*.prettyprint .clo { color: #F8F8F2; }*/
/*.prettyprint .fun { color: #dc322f; }*/
/*.prettyprint .str,*/
/*.prettyprint .atv { color: #E6DB74; }*/
/*.prettyprint .kwd,*/
/*.prettyprint .tag { color: #F92659; }*/
/*.prettyprint .typ,*/
/*.prettyprint .atn,*/
/*.prettyprint .dec,*/
/*.prettyprint .var { color: #A6E22E; }*/
/*.prettyprint .pln { color: #66D9EF; }*/