huang 10 years ago
commit 3bb3cbe2bd

@ -298,7 +298,7 @@ class CoursesController < ApplicationController
if params[:group_id] && params[:group_id] != "0" if params[:group_id] && params[:group_id] != "0"
@group = CourseGroup.find(params[:group_id]) @group = CourseGroup.find(params[:group_id])
@results = student_homework_score(@group.id,0, 0,"desc") @results = student_homework_score(@group.id,0, 0,"desc")
@results = paginateHelper @results, 10 # @results = paginateHelper @results, 10
else else
page_from = params[:page].nil? ? 0 : (params[:page].to_i - 1) page_from = params[:page].nil? ? 0 : (params[:page].to_i - 1)
@results = student_homework_score(0,page_from, 10,"desc") @results = student_homework_score(0,page_from, 10,"desc")
@ -368,12 +368,12 @@ class CoursesController < ApplicationController
page = params[:page].nil? ? 0 : (params['page'].to_i - 1) page = params[:page].nil? ? 0 : (params['page'].to_i - 1)
@results = searchmember_by_name(student_homework_score(0,0,0,@score_sort_by), @search_name) @results = searchmember_by_name(student_homework_score(0,0,0,@score_sort_by), @search_name)
@result_count = @results.count @result_count = @results.count
@results = paginateHelper @results, 10 # @results = paginateHelper @results, 10
else else
@group = CourseGroup.find(group_id) @group = CourseGroup.find(group_id)
@results = searchmember_by_name(student_homework_score(group_id, 0, 0,@score_sort_by),@search_name) @results = searchmember_by_name(student_homework_score(group_id, 0, 0,@score_sort_by),@search_name)
@result_count = @results.count @result_count = @results.count
@results = paginateHelper @results, 10 # @results = paginateHelper @results, 10
end end
else else
if group_id == '0' if group_id == '0'

@ -365,7 +365,7 @@ class StudentWorkController < ApplicationController
sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score)
sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score)
sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score)
sheet1[count_row,9] = homework.final_score.nil? ? l(:label_without_score) : format("%.2f",homework.final_score) sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score)
sheet1[count_row,10] = format_time(homework.created_at) sheet1[count_row,10] = format_time(homework.created_at)
count_row += 1 count_row += 1
end end

@ -1,149 +1,149 @@
module HomeworkAttachHelper module HomeworkAttachHelper
#判断是否具有删除的权限 # #判断是否具有删除的权限
def attach_delete(project) # def attach_delete(project)
if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and project_id = ?', User.current.id, project.bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, project.bid.courses.first.id).first.roles&Role.where('id = ? or id = ?', 3, 7)).size >0) || project.user_id == User.current.id) # if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and project_id = ?', User.current.id, project.bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, project.bid.courses.first.id).first.roles&Role.where('id = ? or id = ?', 3, 7)).size >0) || project.user_id == User.current.id)
true # true
else
false
end
end
#作业添加、编辑界面的tab页
def homework_settings_tabs f
@f = f
tabs = [{:name => 'info', :partial => 'homework_attach/edit_homework', :label => :label_information_plural},
{:name => 'members', :partial => 'homework_attach/homework_member', :label => :label_member_plural}
]
end
#作业可选成员列表分页
def render_new_members_for_homework members
#scope = Principal.active.sorted.not_member_of(project).like(params[:q])
#scope = project.members
#principals = paginateHelper members,10
#principals = members
#principal_count = members.count
#limit = 10
#principal_pages = Redmine::Pagination::Paginator.new principal_count, limit, params['page'] #by young
#offset ||= principal_pages.offset
#principals = members[offset, limit]
users = members.map(&:user)
s = content_tag('div', member_check_box_tags_ex('membership[user_ids][]', users), :id => 'principals')
links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false) {|text, parameters, options|
link_to text, get_homework_member_list_homework_attach_index_path( parameters.merge(:q => params[:q], bid_id: params[:id]||@homework)), :remote => true }
return s + content_tag('div', content_tag('ul', links), :class => 'pagination_new')
end
#扩展的checkbox生成
def member_check_box_tags_ex(name, principals)
s = ''
principals.each do |member|
s << "<label>#{ check_box_tag name, member.id, false, :id => nil } #{h member.name }</label><br/>"
end
s.html_safe
end
def paginateHelper obj, pre_size=20
@obj_count = obj.count
@obj_pages = Redmine::Pagination::Paginator.new @obj_count, pre_size, params['page']
if obj.kind_of? ActiveRecord::Base or obj.kind_of? ActiveRecord::Relation
obj.limit(@obj_pages.per_page).offset(@obj_pages.offset)
elsif obj.kind_of? Array
obj[@obj_pages.offset, @obj_pages.per_page]
else
logger.error "[ApplicationController] Error : application_controller#paginateHelper ===> unknow category: #{obj.class}"
raise RuntimeError, 'unknow type, Please input you type into this helper.'
end
end
def user_projects_option
cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1"
memberships = User.current.memberships.all(:conditions => cond)
projects = memberships.map(&:project)
not_have_project = []
not_have_project << Setting.please_chose
not_have_project << 0
type = []
type << not_have_project
projects.each do |project|
if project != nil
option = []
option << project.name
option << project.id
type << option
end
end
type
end
#判断指定用户是不是已经赞过该作业
def is_praise_homework user_id, obj_id
PraiseTread.where("user_id = #{user_id} AND praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'HomeworkAttach'").empty?
end
#获取赞的总数
def praise_homework_count obj_id
PraiseTread.where("praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'HomeworkAttach'").count
end
#获取用户对作业的评分
def get_homework_score user, homework
temp = HomeworkAttach.find_by_sql("SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{homework.id} AND rater_id = #{user.id}").first
@m_score = temp.nil? ? 0:temp.stars.to_i
end
#获取评分对应的评论
def get_homework_review homework,is_teacher,user
homework.journals_for_messages.where("is_comprehensive_evaluation = #{is_teacher ? 1 : 2} and user_id = #{user.id}").order("created_on DESC").first
end
def convert_array array
ary = "("
if array.nil? || array.count == 0
return "()"
end
array.length.times do |i|
if i == array.length - 1
ary += array[i].id.to_s + ")"
else
if !(array[i].nil? || array[i].id.nil? || array[i].id.to_s == "")
ary += array[i].id.to_s + ","
end
end
end
#array.each do |member|
# if member == array.last
# ary += member.id.to_s + ")"
# else # else
# ary += member.id.to_s + "," # false
# end # end
# end # end
ary # #作业添加、编辑界面的tab页
end # def homework_settings_tabs f
# @f = f
def get_student_batch_homework_list bid,user # tabs = [{:name => 'info', :partial => 'homework_attach/edit_homework', :label => :label_information_plural},
student_batch_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*, # {:name => 'members', :partial => 'homework_attach/homework_member', :label => :label_member_plural}
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score, # ]
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score, # end
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{User.current.id} AND is_teacher_score = 0) AS m_score #
FROM homework_attaches # #作业可选成员列表分页
INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id # def render_new_members_for_homework members
WHERE homework_attaches.bid_id = #{bid.id} AND homework_evaluations.user_id = #{user.id} ORDER BY m_score DESC") # #scope = Principal.active.sorted.not_member_of(project).like(params[:q])
student_batch_homework_list # #scope = project.members
end # #principals = paginateHelper members,10
# #principals = members
######################################################### # #principal_count = members.count
#sw # #limit = 10
#获取学生未进行匿评的数量 # #principal_pages = Redmine::Pagination::Paginator.new principal_count, limit, params['page'] #by young
#param: bid => 作业 user => 用户 # #offset ||= principal_pages.offset
#return 指定用户未进行匿评的作业的数量 # #principals = members[offset, limit]
#user必须是学生用户 # users = members.map(&:user)
####################################################### # s = content_tag('div', member_check_box_tags_ex('membership[user_ids][]', users), :id => 'principals')
def get_student_not_batch_homework_list bid,user # links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false) {|text, parameters, options|
HomeworkAttach.find_by_sql("SELECT * FROM(SELECT homework_attaches.*, # link_to text, get_homework_member_list_homework_attach_index_path( parameters.merge(:q => params[:q], bid_id: params[:id]||@homework)), :remote => true }
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{user.id} AND is_teacher_score = 0) AS m_score # return s + content_tag('div', content_tag('ul', links), :class => 'pagination_new')
FROM homework_attaches # end
INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id #
WHERE homework_attaches.bid_id = #{bid.id} AND homework_evaluations.user_id = #{user.id}) AS table1 # #扩展的checkbox生成
WHERE table1.m_score IS NULL").count # def member_check_box_tags_ex(name, principals)
end # s = ''
# principals.each do |member|
# s << "<label>#{ check_box_tag name, member.id, false, :id => nil } #{h member.name }</label><br/>"
# end
# s.html_safe
# end
#
# def paginateHelper obj, pre_size=20
# @obj_count = obj.count
# @obj_pages = Redmine::Pagination::Paginator.new @obj_count, pre_size, params['page']
# if obj.kind_of? ActiveRecord::Base or obj.kind_of? ActiveRecord::Relation
# obj.limit(@obj_pages.per_page).offset(@obj_pages.offset)
# elsif obj.kind_of? Array
# obj[@obj_pages.offset, @obj_pages.per_page]
# else
# logger.error "[ApplicationController] Error : application_controller#paginateHelper ===> unknow category: #{obj.class}"
# raise RuntimeError, 'unknow type, Please input you type into this helper.'
# end
# end
#
# def user_projects_option
# cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1"
# memberships = User.current.memberships.all(:conditions => cond)
# projects = memberships.map(&:project)
# not_have_project = []
# not_have_project << Setting.please_chose
# not_have_project << 0
# type = []
# type << not_have_project
# projects.each do |project|
# if project != nil
# option = []
# option << project.name
# option << project.id
# type << option
# end
# end
# type
# end
#
# #判断指定用户是不是已经赞过该作业
# def is_praise_homework user_id, obj_id
# PraiseTread.where("user_id = #{user_id} AND praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'HomeworkAttach'").empty?
# end
#
# #获取赞的总数
# def praise_homework_count obj_id
# PraiseTread.where("praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'HomeworkAttach'").count
# end
#
# #获取用户对作业的评分
# def get_homework_score user, homework
# temp = HomeworkAttach.find_by_sql("SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{homework.id} AND rater_id = #{user.id}").first
# @m_score = temp.nil? ? 0:temp.stars.to_i
# end
#
# #获取评分对应的评论
# def get_homework_review homework,is_teacher,user
# homework.journals_for_messages.where("is_comprehensive_evaluation = #{is_teacher ? 1 : 2} and user_id = #{user.id}").order("created_on DESC").first
# end
#
# def convert_array array
# ary = "("
# if array.nil? || array.count == 0
# return "()"
# end
# array.length.times do |i|
# if i == array.length - 1
# ary += array[i].id.to_s + ")"
# else
# if !(array[i].nil? || array[i].id.nil? || array[i].id.to_s == "")
# ary += array[i].id.to_s + ","
# end
# end
# end
# #array.each do |member|
# # if member == array.last
# # ary += member.id.to_s + ")"
# # else
# # ary += member.id.to_s + ","
# # end
# #end
# ary
# end
#
# def get_student_batch_homework_list bid,user
# student_batch_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
# (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score,
# (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score,
# (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{User.current.id} AND is_teacher_score = 0) AS m_score
# FROM homework_attaches
# INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id
# WHERE homework_attaches.bid_id = #{bid.id} AND homework_evaluations.user_id = #{user.id} ORDER BY m_score DESC")
# student_batch_homework_list
# end
#
# #########################################################
# #sw
# #获取学生未进行匿评的数量
# #param: bid => 作业 user => 用户
# #return 指定用户未进行匿评的作业的数量
# #user必须是学生用户
# #######################################################
# def get_student_not_batch_homework_list bid,user
# HomeworkAttach.find_by_sql("SELECT * FROM(SELECT homework_attaches.*,
# (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{user.id} AND is_teacher_score = 0) AS m_score
# FROM homework_attaches
# INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id
# WHERE homework_attaches.bid_id = #{bid.id} AND homework_evaluations.user_id = #{user.id}) AS table1
# WHERE table1.m_score IS NULL").count
# end
end end

@ -50,9 +50,6 @@
} }
} }
</script> </script>
<div class="add_frame_header" >
<%= l(:bale_news_notice) %>
</div>
<div class="box tabular"> <div class="box tabular">
<p> <p>
<%= f.text_field :title, <%= f.text_field :title,

@ -66,7 +66,8 @@
<%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => 'regexName1();', :width => "125px", :style=>"float:left" %> <%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => 'regexName1();', :width => "125px", :style=>"float:left" %>
<%= hidden_field_tag 'project_type', params[:project_type] %> <%= hidden_field_tag 'project_type', params[:project_type] %>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %> <%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" > <!--<a href="#" onclick="submitSerch();" class="ButtonColor" style="float:left;padding-top: 3px; margin: 0px;padding-bottom:0px; padding-left:8px;" >-->
<a href="#" onclick="submitSerch();" class="enterprise" style="padding-top: 3px; margin: 0px;padding-bottom:0px; margin-top: 1px; margin-left: 3px; background:#15bccf repeat">
<%= l(:label_search)%> <%= l(:label_search)%>
</a> </a>
<br /> <br />

@ -9,7 +9,11 @@ $('#score_<%= @work.id%>').peSlider({range: 'min'});
$("#score_list_<%= @work.id%>").removeAttr("style"); $("#score_list_<%= @work.id%>").removeAttr("style");
<% if @is_teacher %> <% if @is_teacher %>
<% if @homework.homework_type == 1%>
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_student_work',:locals => {:student_work => @work}) %>");
<% else%>
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'student_work',:locals => {:student_work => @work}) %>"); $("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'student_work',:locals => {:student_work => @work}) %>");
<% end%>
<% else %> <% else %>
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_work',:locals => {:student_work => @work}) %>"); $("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_work',:locals => {:student_work => @work}) %>");
<% end%> <% end%>
@ -18,24 +22,16 @@ $("#score_list_<%= @work.id%>").removeAttr("style");
$(function(){ $(function(){
//匿评评分提示 //匿评评分提示
$(".student_score_info").bind("mouseover",function(e){ $(".student_score_info").bind("mouseover",function(e){
//alert($(this).html());
$(this).find("div").show(); $(this).find("div").show();
// $(this).find("div").css("top",e.pageY);
// $(this).find("div").css("left",e.pageX);
}); });
$(".student_score_info").bind("mouseout",function(e){ $(".student_score_info").bind("mouseout",function(e){
//alert($(this).html());
$(this).find("div").hide(); $(this).find("div").hide();
}); });
//最终成绩提示 //最终成绩提示
$(".student_final_scor_info").bind("mouseover",function(e){ $(".student_final_scor_info").bind("mouseover",function(e){
//alert($(this).html());
$(this).find("div").show(); $(this).find("div").show();
// $(this).find("div").css("top",e.pageY);
// $(this).find("div").css("left",e.pageX);
}); });
$(".student_final_scor_info").bind("mouseout",function(e){ $(".student_final_scor_info").bind("mouseout",function(e){
//alert($(this).html());
$(this).find("div").hide(); $(this).find("div").hide();
}); });
}); });

@ -60,7 +60,7 @@
<%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json), <%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json),
remote: true, class: "down_btn fr zip_download_alert", :id => "download_homework_attachments" %> remote: true, class: "down_btn fr zip_download_alert", :id => "download_homework_attachments" %>
<% end%> <% end%>
<div class="info_ni_download"> <div class="info_ni_download" style="<%= @homework.homework_type == 1 ? '' : 'margin-left: 130px;'%>">
使用 使用
<span class="c_red">winzip</span> <span class="c_red">winzip</span>
工具进行解压可能会导致 工具进行解压可能会导致

@ -387,7 +387,7 @@
<%= l(:label_i_new_activity) %> <%= l(:label_i_new_activity) %>
</span> </span>
&nbsp; &nbsp;
<%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %> <%= link_to format_activity_title(" #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %>
</td> </td>
<% else %> <% else %>
<td colspan="2" valign="top"> <td colspan="2" valign="top">

@ -28,7 +28,7 @@
<td colspan="2" valign="top" width="50" ><img src="/images/new/news.png" width="40" height="40"/></td> <td colspan="2" valign="top" width="50" ><img src="/images/new/news.png" width="40" height="40"/></td>
<td><table width="580" border="0"> <td><table width="580" border="0">
<tr> <tr>
<td colspan="2" valign="top"><strong> <%= content_tag('span', h(e.project), :class => 'project') %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <td colspan="2" valign="top"><strong> <%= content_tag('span', h(e.project), :class => 'project') %></strong>
<% if e.event_type.eql?("message") || e.event_type.eql?("reply") %> <% if e.event_type.eql?("message") || e.event_type.eql?("reply") %>
<%= link_to format_activity_title(e.event_title), e.board.project ? project_boards_path(e.board.project,:topic_id => e.id):course_boards_path(e.board.course,:topic_id => e.id) %> <%= link_to format_activity_title(e.event_title), e.board.project ? project_boards_path(e.board.project,:topic_id => e.id):course_boards_path(e.board.course,:topic_id => e.id) %>
<%else %> <%else %>

@ -1903,9 +1903,9 @@ zh:
lable_teacher_evaluation: 作业综评 lable_teacher_evaluation: 作业综评
lable_course_teacher: 主讲老师 lable_course_teacher: 主讲老师
lable_course_end: 课程学期已结束 lable_course_end: 课程学期已结束
label_no_contest_news_description: 竞赛描述不能为空 label_no_contest_news_description: 竞赛通知描述不能为空
label_contest_news_condition: 竞赛描述超过5000个汉字 label_contest_news_condition: 竞赛描述超过5000个汉字
label_no_contest_news_title: 竞赛标题不能为空 label_no_contest_news_title: 竞赛通知标题不能为空
label_contest_news_title_condition: 竞赛标题超过255个汉字 label_contest_news_title_condition: 竞赛标题超过255个汉字
label_course_organizers: 开设单位 label_course_organizers: 开设单位

@ -1698,6 +1698,23 @@ div.project-search {
} }
/*huang*/ /*huang*/
/*zhangshen*/
a.enterprise {
float:left;
text-align: center;
width: 40px;
height: 18px;
font-family: '微软雅黑',Arial,Helvetica,sans-serif;
font-size: 12px;
color:#fff;
padding: 0px;
border-radius:4px;
border: 1px solid rgb(148, 148, 148);
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.2), 0px 0px 2px rgb(255, 255, 255) inset;
text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.1), 0px 0px 0px rgb(255, 255, 255);
cursor: pointer;
}
input.enterprise[type="button"] { input.enterprise[type="button"] {
padding-bottom: 5px; padding-bottom: 5px;
width: 55px; width: 55px;

Loading…
Cancel
Save