course_group
moon 11 years ago
commit 600afdc6e0

@ -141,6 +141,23 @@ class AttachmentsController < ApplicationController
end
end
def update_file_dense
@attachment = Attachment.find(params[:attachmentid])
if @attachment != nil
filedense = params[:newtype].to_s
if filedense == "1"
@attachment.is_public = 1
else
@attachment.is_public = 0
end
@attachment.save
@newfiledense = filedense
end
respond_to do |format|
format.js
end
end
def thumbnail
if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size])
if stale?(:etag => thumbnail)
@ -326,6 +343,35 @@ class AttachmentsController < ApplicationController
end
end
def add_exist_file_to_courses
file = Attachment.find(params[:file_id])
courses = params[:courses][:course]
courses.each do |course|
c = Course.find(course);
attach_copied_obj = file.copy
attach_copied_obj.tag_list.add(file.tag_list) # tag关联
attach_copied_obj.container = c
attach_copied_obj.created_on = Time.now
attach_copied_obj.author_id = User.current.id
attach_copied_obj.copy_from = file.copy_from.nil? ? file.id : file.copy_from
if attach_copied_obj.attachtype == nil
attach_copied_obj.attachtype = 4
end
@obj = c
@save_flag = attach_copied_obj.save
@save_message = attach_copied_obj.errors.full_messages
end
respond_to do |format|
format.js
end
rescue NoMethodError
@save_flag = false
@save_message = [] << l(:error_attachment_empty)
respond_to do |format|
format.js
end
end
private
def find_project
@attachment = Attachment.find(params[:id])

@ -807,6 +807,7 @@ class BidsController < ApplicationController
@bid.is_evaluation = params[:bid][:is_evaluation]
@bid.proportion = params[:bid][:proportion]
@bid.evaluation_num = params[:bid][:evaluation_num]
@bid.open_anonymous_evaluation = params[:bid][:open_anonymous_evaluation]
@bid.reward_type = 3
# @bid.budget = params[:bid][:budget]
@bid.deadline = params[:bid][:deadline]
@ -863,6 +864,7 @@ class BidsController < ApplicationController
@bid.is_evaluation = params[:bid][:is_evaluation]
@bid.proportion = params[:bid][:proportion]
@bid.evaluation_num = params[:bid][:evaluation_num]
@bid.open_anonymous_evaluation = params[:bid][:open_anonymous_evaluation]
@bid.reward_type = 3
@bid.deadline = params[:bid][:deadline]
@bid.budget = 0

@ -512,6 +512,7 @@ class CoursesController < ApplicationController
def new_homework
@homework = Bid.new
@homework.safe_attributes = params[:bid]
@homework.open_anonymous_evaluation = 1
if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] ))
render :layout => 'base_courses'
else

@ -22,22 +22,55 @@ class FilesController < ApplicationController
menu_item :files
before_filter :find_project_by_project_id#, :except => [:getattachtype]
before_filter :authorize, :except => [:getattachtype]
before_filter :authorize, :except => [:getattachtype,:quote_resource_show,:search]
helper :sort
include SortHelper
helper :project_score
def show_attachments obj
all_attachments = []
@all_attachments = []
obj.each do |container|
all_attachments += container.attachments
@all_attachments += container.attachments
end
@limit = 10
@feedback_count = all_attachments.count
@feedback_count = @all_attachments.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
@curse_attachments = all_attachments[@offset, @limit]
@curse_attachments_all = @all_attachments[@offset, @limit]
@curse_attachments = paginateHelper @all_attachments,10
end
def search
begin
@is_remote = true
q = "%#{params[:name].strip}%"
#(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
if params[:insite]
@result = find_public_attache q
@searched_attach = paginateHelper @result,10
else
@result = find_course_attache q,@course
@searched_attach = paginateHelper @result,10
end
rescue Exception => e
#render 'stores'
redirect_to stores_url
end
end
def find_course_attache keywords,course
resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' AND filename LIKE :like ", like: "%#{keywords}%").
reorder("created_on DESC")
end
def find_public_attache keywords
# StoresController#search 将每条文件都查出来,再次进行判断过滤。---> resultSet.to_a.map
# 此时内容不多速度还可但文件增长每条判断多则进行3-4次表连接。
# 现在还木有思路 药丸
resultSet = Attachment.where("attachments.container_type IS NOT NULL AND (is_public = 1 OR author_id = #{User.current.id}) AND filename LIKE :like ", like: "%#{keywords}%").
reorder("created_on DESC")
end
def index
@ -48,7 +81,9 @@ class FilesController < ApplicationController
'size' => "#{Attachment.table_name}.filesize",
'downloads' => "#{Attachment.table_name}.downloads"
sort = ""
@sort = ""
@order = ""
@is_remote = false
if params[:project_id]
@isproject = true
@ -113,7 +148,8 @@ class FilesController < ApplicationController
when "created_on"
attribute = "created_on"
end
@sort = order_by[0]
@order = order_by[1]
if order_by.count == 1
sort += "#{Attachment.table_name}.#{attribute} asc "
elsif order_by.count == 2
@ -134,6 +170,10 @@ class FilesController < ApplicationController
end
def quote_resource_show
@file = Attachment.find(params[:id])
end
def new
@versions = @project.versions.sort
@course_tag = @project.project_type

@ -17,7 +17,6 @@
class IssuesController < ApplicationController
layout 'base_projects'#Added by young
menu_item :new_issue, :only => [:new, :create]
default_search_scope :issues
before_filter :find_issue, :only => [:show, :edit, :update]
@ -59,8 +58,8 @@ class IssuesController < ApplicationController
sort_init(@query.sort_criteria.empty? ? [['id', 'desc']] : @query.sort_criteria)
sort_update(@query.sortable_columns)
@query.sort_criteria = sort_criteria.to_a
@project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'#by young
@project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'
if @query.valid?
case params[:format]

@ -19,7 +19,7 @@ class MemosController < ApplicationController
@content = "#{ll(Setting.default_language, :text_user_wrote, @memo.author)} <br/> &nbsp; "
@content << @memo.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n") + "</blockquote>\n\n<br/>"
@content = "<blockquote>" << @content
@content = "<blockquote style='word-break: break-all;word-wrap: break-word;'>" << @content
#@content = "> #{ll(Setting.default_language, :text_user_wrote, @memo.author)}\n> "
#@content << @memo.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
#@content_html = textilizable(@content)

@ -14,12 +14,14 @@ class TagsController < ApplicationController
include AttachmentsHelper
include ContestsHelper
include ActsAsTaggableOn::TagsHelper
include TagsHelper
helper :projects
helper :courses
helper :tags
include OpenSourceProjectsHelper
before_filter :require_admin,:only => [:delete,:show_all]
before_filter :require_login,:only => [:tag_save]
# $selected_tags = Array.new
# $related_tags = Array.new
@ -187,6 +189,83 @@ class TagsController < ApplicationController
# end
end
end
# 只删除某个对象的该tag
def remove_tag_new
@obj = nil
@object_flag = nil
if request.get?
# 获取传过来的tag_id taggable_id 和 taggable_type,通过2者确定要删除tag的对象
@tag_name = params[:tag_name]
@tag_id = (ActsAsTaggableOn::Tag.find_by_name(@tag_name)).id
@taggable_id = params[:taggable_id] # 当做参数传时对象会变成字符串
@taggable_type = numbers_to_object_type(params[:taggable_type])
@obj = get_object(@taggable_id,params[:taggable_type])
@object_flag = params[:taggable_type]
# if can_remove_tag?(User.current,@taggable_id,@taggable_type)
@taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_id_and_taggable_type(@tag_id,@taggable_id,@taggable_type)
unless @taggings.nil?
@taggings.delete
end
# 是否还有其他记录 引用了 tag_id
@tagging = ActsAsTaggableOn::Tagging.find_by_tag_id(@tag_id)
# 如果taggings表中记录已经不存在 那么检查tags表 作删除动作
if @tagging.nil?
@tag = ActsAsTaggableOn::Tag.find_by_id(@tag_id)
@tag.delete unless @tag.nil?
end
# end
end
end
def tag_save
@tags = params[:tag_for_save][:name]
@obj_id = params[:tag_for_save][:object_id]
@obj_flag = params[:tag_for_save][:object_flag]
case @obj_flag
when '1' then
@obj = User.find_by_id(@obj_id)
when '2' then
@obj = Project.find_by_id(@obj_id)
when '3' then
@obj = Issue.find_by_id(@obj_id)
when '4' then
@obj = Bid.find_by_id(@obj_id)
when '5' then
@obj = Forum.find_by_id(@obj_id)
when '6'
@obj = Attachment.find_by_id(@obj_id)
when '7' then
@obj = Contest.find_by_id(@obj_id)
when '8'
@obj = OpenSourceProject.find_by_id(@obj_id)
when '9'
@obj = Course.find_by_id(@obj_id)
else
@obj = nil
end
unless @obj.nil?
@obj.tag_list.add(@tags.split(","))
else
return
end
if @obj.save
logger.debug "#{__FILE__}:#{__LINE__} ===> #{@obj.to_json}"
else
logger.error "#{__FILE__}:#{__LINE__} ===> #{@obj.errors.try(:full_messages)}"
end
respond_to do |format|
format.js
format.html
end
end
private
# 这里用来刷新搜索结果的区域
@ -307,5 +386,7 @@ class TagsController < ApplicationController
return
end
end
end

@ -177,6 +177,8 @@ module AttachmentsHelper
s.html_safe
end
# Modified by Longjun
# 有参数的方法要加()
def private_filter(resultSet)

@ -328,7 +328,7 @@ module CoursesHelper
#当前用户是不是指定课程的学生
def is_cur_course_student course
#course.members.joins(:member_roles).where("member_roles.role_id IN (:role_id) and members.user_id = #{User.current.id}", {:role_id => StudentRoles}).count != 0
!(User.current.allowed_to?(:as_teacher,course))
User.current.logged? && User.current.member_of_course?(course) && !(User.current.allowed_to?(:as_teacher,course))
#修改:能新建占位且不能新建任务的角色判定为学生
#is_student = false
#@membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current))

@ -44,6 +44,16 @@ module FilesHelper
File.new(zipfile_name,'w+')
end
def courses_check_box_tags(name,courses,current_course,attachment)
s = ''
courses.each do |course|
if !(attachment.container_type && attachment.container_id == course.id) && is_course_teacher(User.current,course)
s << "<label>#{ check_box_tag name, course.id, false, :id => nil } #{h course.name}</label><br/>"
end
end
s.html_safe
end
# 判断指定的资源时候符合类型
def isTypeOk(attachment, type, contentType)
result = false

@ -30,7 +30,7 @@ class Forum < ActiveRecord::Base
def destroyable_by? user
# user && user.logged? && Forum.find(self.forum_id).creator_id == user.id || user.admin?
user.admin?
self.creator == user || user.admin?
end
# Updates topic_count, memo_count and last_memo_id attributes for +board_id+

@ -88,11 +88,11 @@ class Memo < ActiveRecord::Base
def editable_by? user
# user && user.logged? || (self.author == usr && usr.allowed_to?(:edit_own_messages, project))
user.admin?
user.admin? || self.author == user
end
def destroyable_by? user
(user && user.logged? && (Forum.find(self.forum_id).creator_id == user.id) ) || user.admin?
(user && self.author == user) || user.admin?
#self.author == user || user.admin?
end

@ -11,7 +11,7 @@
<body>
<% email = @user.mail.split("@")[1] %>
<div style="border: 1px solid #c0c0c0 ; width:850px;" >
<div style="border: 1px solid #c0c0c0 ; width:850px; margin-top: 10px" >
<h3 style=" padding-bottom: 8px; margin-top:5px; border-bottom: 1px solid #c0c0c0;color:black; ">
<span id = "jihuo" style=" margin-left: 4%;"></span>邮箱激活</h3>
@ -19,9 +19,10 @@
<div style="margin-left:auto; margin-right:auto">
<center>
<div >
<h4 style="font-size: 18px;margin-top: 10px; margin-bottom: 10px;">请在24小时内点击邮件中的链接继续完成注册</h4>
<div class="to-email">
<span class="summary">邮件已发送到邮箱</span>
<h4 style="font-size: 18px;margin-top: 10px; padding-bottom: 10px;">请在24小时内点击邮件中的链接继续完成注册</h4>
<div class="to-email" style="padding-bottom: 8px; font-size: 14px">
<div class="to-email" style="padding-bottom: 8px; font-size: 14px">
<span >邮件已发送到邮箱</span>
<a href="#" class="f-blue"><%= @user.mail %></a>
</div>
<p>
@ -33,12 +34,7 @@
padding: 10px 16px;
line-height: 1.33;" target="_blank">立即查收邮件</a></p>
<span class="tracking-ad" >
<a href="javascript:void(0);" >没收到邮件?</a>
</span>
<div style = "margin-top: 10px; margin-bottom:10px;">
<span style="font-size: 16px">请先检查是否在垃圾邮件中</span>
</div>

@ -19,15 +19,15 @@
<p><%= f.text_field :login, :size => 25, :required => true %><span id="valid_user_login"></span>
<em class="info" style="color: #acaeb1"><%= l(:label_max_number) %></em>
</p>
<p><%= f.password_field :password, :size => 25, :required => true %>
<p><%= f.password_field :password, :size => 25, :required => true %><span id="valid_user_password"></span>
<em class="info" style="color: #acaeb1"><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em>
</p>
<p><%= f.password_field :password_confirmation, :size => 25, :required => true %><span id="valid_password"></span></p>
<p><%= f.password_field :password_confirmation, :size => 25, :required => true %><span id="valid_password" style="padding-left: 10px;"></span></p>
<% end %>
<p>
<%= f.text_field :mail,:size => 25, :required => true %>
<span id="valid_user_mail"></span>
<span id="valid_user_mail" ></span>
</p>
<p>
<em class="info" style="color: #acaeb1">
@ -56,10 +56,12 @@
<p><%= custom_field_tag_with_label :user, value %></p>
<% end %>
</div>
<% password_min_length = Setting.password_min_length %>
<script type="text/javascript">
jQuery(document).ready(function () {
var $login = $('#user_login')
var $mail = $('#user_mail')
var $password = $('#user_password')
var $password_confirmation = $('#user_password_confirmation')
$login.blur(function (event) {
if ($(this).is('#user_login')) {
@ -92,11 +94,26 @@
});
}
;
});
$password.blur(function () {
var pas1 = document.getElementById("user_password").value;
var password_min_length = <%= password_min_length %>
if (pas1.length >= password_min_length) {
$('#valid_user_password').html('<span class="green">'+ "</span>");
}
else {
$('#valid_user_password').html('<span class="red">' + "<%= l(:setting_password_min_length_limit, :count => password_min_length) %>" + "</span>");
}
});
$password_confirmation.blur(function () {
var password_min_length = <%= password_min_length %>
var pas1 = document.getElementById("user_password").value;
var pas2 = document.getElementById("user_password_confirmation").value;
if (pas1 == pas2) {
if (pas1.length >= password_min_length && pas1 == pas2 ) {
$('#valid_password').html('<span class="green">' + "<%= l(:setting_password_success) %>"+ "</span>");
}
else {

@ -54,7 +54,7 @@
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="created_on" align="center" title='<%=format_time(user.created_on)%>'><%= format_time(user.created_on) %></td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="last_login_on" align="center" title='<%= format_time(user.last_login_on)%>'><%= format_time(user.last_login_on) unless user.last_login_on.nil? %></td>
<td class="buttons"> <%= change_status_link(user) %>
<%= delete_link user_path(user, :back_url => admin_users_path(params)) unless User.current == user %> </td>
<%= delete_link user_path(user, :back_url => admin_search_path(params)) unless User.current == user %> </td>
</tr>
<% end -%>
</tbody>

@ -0,0 +1,5 @@
<% if !@save_flag%>
$("#error_show").html("<%= @save_message.join(', ') %>");
<% else %>
closeModal();
<% end %>

@ -0,0 +1,2 @@
$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)),
:remote=>true,:class=>"f_l re_open",:method => :post) %>");

@ -14,7 +14,7 @@
/* 匿名评分弹框 */
.anonymos{width:480px;height:180px;position:absolute;z-index:100;left:50%;top:50%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;}
.anonymos{width:480px;height:180px;position:fixed;z-index:100;left:50%;top:50%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;}
.ni_con { width:425px; margin:25px 30px;}
.ni_con h2{ display:block; height:40px; width:425px; text-align:center; color:#3a3a3a;}
.ni_con p{ color:#808181; }

@ -1,4 +1,38 @@
<!--modified by huang-->
<script type="text/javascript">
function ShowCountDown(year,month,day,divname)
{
var now = new Date();
var endDate = new Date(year, month-1, day);
var leftTime=endDate.getTime()-now.getTime();
var leftsecond = parseInt(leftTime/1000);
var day1=Math.floor(leftsecond/(60*60*24));
var hour=Math.floor((leftsecond-day1*24*60*60)/3600);
var minute=Math.floor((leftsecond-day1*24*60*60-hour*3600)/60);
var second=Math.floor(leftsecond-day1*24*60*60-hour*3600-minute*60);
$("#"+divname).html("<span style='color: #acaeb1;'>作业提交还剩&nbsp;:</span>&nbsp;<span style='color: red;'>"
+day1+"&nbsp;</span><span style='color: #acaeb1;'>天</span><span style='color: red;'>&nbsp;"
+hour+"&nbsp;</span><span style='color: #acaeb1;'>时</span><span style='color: red;'>&nbsp;"
+minute+"&nbsp;</span><span style='color: #acaeb1;'>分</span><span style='color: red;'>&nbsp;"
+second+"&nbsp;</span><span style='color: #acaeb1;'>秒</span>");
}
</script>
<style>
.span_wping{}
.span_wping a{
margin-top: 18px;
margin-bottom: 3px;
width: 43px;
height: 23px;
background: #15bccf;
color: #fff;
text-align: center;
padding-top: 3px;
padding-left: 3px;
}
.span_wping a:hover{ background-color:#03a1b3;}
</style>
<% if bids.blank? %>
<%#= l(:label_uncommit_homework) %>
暂无作业!
@ -26,7 +60,15 @@
<% if User.current.logged? && is_cur_course_student(@course) %>
<% cur_user_homework = cur_user_homework_for_bid(bid) %>
<% if cur_user_homework!= nil && cur_user_homework.empty? %>
<%= link_to l(:label_commit_homework),new_exercise_book_path(bid) %>
<% if bid.comment_status == 0 || bid.comment_status == 2%>
<span class="span_wping">
<%= link_to l(:label_commit_homework),new_exercise_book_path(bid) %>
</span>
<% else %>
<span title="匿评阶段不可提交作业!" class="span_wping">
<a style="width:80px; margin:20px 0 0 350px;background:#8e8e8e;">提交作业</a>
</span>
<% end %>
<% else %>
<span style="color: green; float: right">
<%= l(:lable_has_commit_homework)%>
@ -34,7 +76,8 @@
<% end %>
<% end %>
<% if (User.current.admin?||User.current.id==bid.author_id) %>
<span id="<%=bid.id %>_anonymous_comment">
<% if bid.open_anonymous_evaluation == 1%>
<span id="<%=bid.id %>_anonymous_comment" class="span_wping">
<% case bid.comment_status %>
<% when 0 %>
<%= link_to '启动匿评', alert_anonymous_comment_bid_path(bid), id: "#{bid.id}_start_anonymous_comment", remote: true, disable_with: '加载中...' %>
@ -44,11 +87,13 @@
匿评结束
<% end %>
</span>
<%= link_to(
<%end%>
<span class="span_wping">
<%= link_to(
l(:button_edit),
{:action => 'edit', :controller=>'bids', :course_id =>@course.id, :bid_id => bid.id},
:class => 'icon icon-edit'
{:action => 'edit', :controller=>'bids', :course_id =>@course.id, :bid_id => bid.id}
) %>
</span>
<%#= link_to(
l(:button_delete),
{:action => 'homework_destroy', :controller=>'bids', :course_id => bid.id},
@ -94,19 +139,6 @@
</strong>
)
</span>
<span style="float: right">
<% if betweentime(bid.deadline) < 0 %>
<span style="color: red; float: right">
<%= l(:label_commit_limit)%>
</span>
<% else %>
<% if betweentime(bid.deadline) < 3 %>
<span style="color: red">
<%= l(:label_commit_ar) %>
</span>
<% end %>
<% end %>
</span>
</td>
</tr>
<tr>
@ -146,10 +178,18 @@
<%=format_time bid.created_on %>
</span>
<span style="float: right">
<%= l(:field_deadline) %>
:&nbsp;
<%=bid.deadline %>
</span>
<% if betweentime(bid.deadline) < 0 %>
<span style="color: red; float: right">
<%= l(:label_commit_limit)%>
</span>
<% else %>
<script type="text/javascript">
window.setInterval(function(){ShowCountDown(<%= bid.deadline.year%>,<%= bid.deadline.month%>,<%= bid.deadline.day + 1%>,"show_deadtime_span_<%= bid.id%>");},1000)
</script>
<span id="show_deadtime_span_<%= bid.id%>" style="float: right">
</span>
<% end %>
</span>
</td>
<td></td>
</tr>

@ -43,9 +43,9 @@
<% end %>
<% unless @is_teacher%>
<% if @bid.comment_status == 0%>
<% if @bid.comment_status == 0 && @bid.open_anonymous_evaluation == 1%>
$("#my_homework").click();
<% elsif @bid.comment_status == 2%>
<% elsif @bid.comment_status == 2 || @bid.open_anonymous_evaluation == 0%>
$("#all_homeworks").click();
<% end %>
<% end %>

@ -44,6 +44,10 @@
<%= f.select :proportion, proportion_option %>
</p>
<p>
<%= f.check_box :open_anonymous_evaluation, :style => "margin-left:10px;" %>
<span>未开启匿评作业将直接进入众评点赞阶段</span>
</p>
<p id="evaluation_num_p">
<%= f.text_field :evaluation_num, :required => true, :size => 60, :style => "width:150px;", :onblur => "regexEvaluationNum();" , :maxlength => 4%>
<span id="bid_evaluation_num_span">匿评分配数量不宜太大,否则会影响开启匿评速度</span>
</p>

@ -28,14 +28,17 @@
</ul>
<% else %>
<ul>
<li id="tb_5" class="hovertab">
<%= link_to @bid.comment_status == 2 ? "已评作品" : "待评作品", get_student_batch_homework_homework_attach_index_path(:bid_id => @bid.id), {id: 'student_batch_homework',:remote => true}%>
</li>
<% if @bid.open_anonymous_evaluation == 1%>
<li id="tb_5" class="hovertab">
<!-- 开启了匿评才能看到匿评列表 -->
<%= link_to @bid.comment_status == 2 ? "已评作品" : "待评作品", get_student_batch_homework_homework_attach_index_path(:bid_id => @bid.id), {id: 'student_batch_homework',:remote => true}%>
</li>
<% end %>
<li id="tb_6" class="normaltab">
<%= link_to "我的作品", get_my_homework_homework_attach_index_path(:bid_id => @bid.id), {id: 'my_homework',:remote => true}%>
</li>
<% if @bid.comment_status == 2 %>
<!-- 匿评结束后才能看到全部作业列表 -->
<% if @bid.comment_status == 2 || @bid.open_anonymous_evaluation == 0%>
<!-- 匿评结束后或者未开启匿评才能看到全部作业列表 -->
<li id="tb_7" class="normaltab">
<%= link_to "所有作品", get_homeworks_homework_attach_index_path(:bid_id => @bid.id), {id: 'all_homeworks',:remote => true}%>
</li>

@ -43,35 +43,66 @@
{
var evaluation_num = $.trim($("#bid_evaluation_num").val());
var regex = /^\d+$/;
if(evaluation_num=="")
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
{
$("#bid_evaluation_num_span").text("匿评分配数量不能为空");
$("#bid_evaluation_num_span").css('color','#ff0000');
return false;
}
else if(regex.test(evaluation_num))
{
if(evaluation_num > 0)
if(evaluation_num=="")
{
$("#bid_evaluation_num_span").text("填写正确");
$("#bid_evaluation_num_span").css('color','#008000');
return true;
$("#bid_evaluation_num_span").text("匿评分配数量不能为空");
$("#bid_evaluation_num_span").css('color','#ff0000');
return false;
}
else if(regex.test(evaluation_num))
{
if(evaluation_num > 0)
{
$("#bid_evaluation_num_span").text("填写正确");
$("#bid_evaluation_num_span").css('color','#008000');
return true;
}
else
{
$("#bid_evaluation_num_span").text("匿评分配数量必须为大于0");
$("#bid_evaluation_num_span").css('color','#ff0000');
return false;
}
}
else
{
$("#bid_evaluation_num_span").text("匿评分配数量必须为大于0");
$("#bid_evaluation_num_span").text("匿评分配数量只能为数字");
$("#bid_evaluation_num_span").css('color','#ff0000');
return false;
}
}
else
{
$("#bid_evaluation_num_span").text("匿评分配数量只能为数字");
$("#bid_evaluation_num_span").css('color','#ff0000');
return false;
return true;
}
}
$(function(){
$("#bid_open_anonymous_evaluation").click(function(){
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
{
$("#evaluation_num_p").slideDown();
}
else
{
$("#evaluation_num_p").slideUp();
}
});
});
$(function(){
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
{
$("#evaluation_num_p").show();
}
else
{
$("#evaluation_num_p").hide();
}
});
function submitHomework(id)
{
if(regexDeadLine()&&regexName()&&regexEvaluationNum())

@ -19,8 +19,9 @@
<%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => false, :id => 'message-form'} do |f| %>
<%= render :partial => 'messages/form', :locals => {:f => f} %>
<p>
<input type="button" onclick="submitCoursesBoard();" class = "whiteButton m3p10 h30" value="<%= l(:button_submit)%>">
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-message").hide(); return false;' ,:class => 'whiteButton m3p10' %>
<!--<input type="button" onclick="submitCoursesBoard();" class = "ButtonColor m3p10 h30" value="<%= l(:button_submit)%>">-->
<a href="#" onclick="$('#message-form').submit();"class="ButtonColor m3p10"><%= l(:button_submit)%></a>
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-message").hide(); return false;' ,:class => 'ButtonColor m3p10' %>
</p>
<% end %>
<div id="preview" class="wiki"></div>

@ -33,12 +33,11 @@
var xstep=1; // 移动步长此参数越小移动越平滑最小值为1
var delay_time=60; // 每步的时间间隔,此参数越小,移动速度越快
var YY=0;
var screen_height = $(window).height(); //浏览器当前窗口文档的高度
var screen_width = $(window).width(); //浏览器当前窗口文档的宽度
window.setInterval(function(){move();},delay_time);
function move()
{
var screen_height = $(window).height(); //浏览器当前窗口文档的高度
var floatpoint_height = $("#floatpoint").height();
YY += xstep;
if(YY <= 0){xstep = 1; YY = 0;} //如果浮动层超出了上界,则设定移动方向为向下;并设定层的位置为正好在上界处
@ -47,9 +46,9 @@
xstep = -1;
YY=(screen_height-floatpoint_height);
}
$("#floatpoint").css("top",YY);
$("#floatpoint").css("margin-top",YY);
}
function change_size(){var body_width = $("#top-menu").width(); $("#floatpoint").css("left",screen_width/2+body_width/2+10);}
function change_size(){var screen_width = $(window).width();var body_width = $("#top-menu").width(); $("#floatpoint").css("left",screen_width/2+body_width/2+10).css("position", "fixed");}
$(document).ready(function(){change_size();});
$(window).resize(function(){screen_width = $(window).width();change_size();});
$(window).resize(function(){change_size();});
</script>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save