Merge remote-tracking branch 'origin/szzh' into szzh

This commit is contained in:
lizanle 2015-07-02 17:31:46 +08:00
commit 2fe18787a2
43 changed files with 455 additions and 163 deletions

View File

@ -34,13 +34,21 @@ class AdminController < ApplicationController
def projects
@status = params[:status] || 1
scope = Project.status(@status).order('lft')
scope = Project.status(@status).order('id asc')
scope = scope.like(params[:name]) if params[:name].present?
@projects = scope.where(project_type: Project::ProjectType_project).all
render :action => "projects", :layout => false if request.xhr?
end
def courses
@name = params[:name]
@courses = Course.like(@name)
respond_to do |format|
format.html
end
end
def users
sort_init 'login', 'asc'
sort_update %w(login firstname lastname mail admin created_on last_login_on)

View File

@ -443,26 +443,19 @@ class CoursesController < ApplicationController
def create
cs = CoursesService.new
@course = cs.create_course(params,User.current)[:course]
if @course.new_record?
if @course
respond_to do |format|
format.html { render :action => 'new', :layout => 'new_base' } #Added by young
format.api { render_validation_errors(@course) }
flash[:notice] = l(:notice_successful_create)
format.html {redirect_to settings_course_url(@course, :course_type => 1)}
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) }
end
else
respond_to do |format|
format.html {
# render :layout => 'base_courses'
flash[:notice] = l(:notice_successful_create)
if params[:continue]
redirect_to new_course_url(attrs, :course => '0')
elsif params[:course_continue]
redirect_to new_course_url(:course => '1')
else
redirect_to settings_course_url(@course, :course_type => 1)
end
}
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) }
end
flash[:notice] = l(:notice_create_failed)
# @course = Course.new
format.html { redirect_to new_course_path } #Added by young
format.api { render_validation_errors(@course) }
end
end
end
@ -532,7 +525,7 @@ class CoursesController < ApplicationController
@trackers = Tracker.sorted.all
@course = Course.new
@course.safe_attributes = params[:course]
month = Time.now.month
# month = Time.now.month
render :layout => 'new_base'
end

View File

@ -37,7 +37,7 @@ class FilesController < ApplicationController
obj.each do |container|
@attachments += container.attachments
end
@all_attachments = visable_attachemnts(@attachments)
@all_attachments = User.current.admin? ? @attachments : visable_attachemnts(@attachments)
@limit = 10
@feedback_count = @all_attachments.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']

View File

@ -92,7 +92,6 @@ class HomeworkCommonController < ApplicationController
@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
#匿评作业相关属性
@ -135,6 +134,7 @@ class HomeworkCommonController < ApplicationController
#statue 1:启动成功2启动失败作业总数大于等于2份时才能启动匿评3:已开启匿评,请务重复开启,4:没有开启匿评的权限
def start_anonymous_comment
@statue =4 and return unless User.current.admin? || User.current.allowed_to?(:as_teacher,@course)
@statue = 5 and return if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
if @homework_detail_manual.comment_status == 1
student_works = @homework.student_works
if student_works && student_works.size >=2

View File

@ -74,6 +74,7 @@ class JournalsController < ApplicationController
text = text.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]')
@content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> "
@content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
@content = "<blockquote style='word-break: break-all;word-wrap: break-word;'>" << @content
@id = user.id
rescue ActiveRecord::RecordNotFound
render_404

View File

@ -72,6 +72,22 @@ class StoresController < ApplicationController
l(:label_borad_project), #l(:label_contest_innovate),
l(:label_forum) ]
end
#缺失文件列表
def lost_file
attachments = []
Attachment.where("container_id is not null and container_type is not null and container_type <> 'Bid' and container_type <> 'HomeworkAttach'").each do |attachment|
unless File.exist?(attachment.diskfile)
attachments << attachment
end
end
respond_to do |format|
format.xls {
send_data(homework_to_xls(attachments), :type => "text/excel;charset=utf-8; header=present",
:filename => "#{l(:label_file_lost_list)}.xls")
}
end
end
private
@ -117,4 +133,27 @@ class StoresController < ApplicationController
else
end
end
#作品列表转换为excel
def homework_to_xls attachments
xls_report = StringIO.new
book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet :name => "homework"
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
sheet1.row(0).default_format = blue
sheet1.row(0).concat(["文件ID","文件名","硬盘路径","上传时间","是否公开","所属对象","所属对象Id"])
count_row = 1
attachments.each do |attachment|
sheet1[count_row,0] = attachment.id
sheet1[count_row,1] = attachment.filename
sheet1[count_row,2] = attachment.diskfile
sheet1[count_row,3] = format_time(attachment.created_on)
sheet1[count_row,4] = (attachment.is_public == 1 || attachment.is_public) ? "" :""
sheet1[count_row,5] = attachment.container_type
sheet1[count_row,6] = attachment.container_id
count_row += 1
end
book.write xls_report
xls_report.string
end
end

View File

@ -2,10 +2,11 @@ class StudentWorkController < ApplicationController
layout "base_courses"
include StudentWorkHelper
require 'bigdecimal'
before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty]
before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list]
before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work]
before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score, :praise_student_work]
before_filter :author_of_work, :only => [:edit, :update, :destroy]
before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list]
def index
@order,@b_sort,@name = params[:order] || "final_score",params[:sort] || "desc",params[:name] || ""
@ -241,9 +242,8 @@ class StudentWorkController < ApplicationController
end
end
#列表显示
#评列表显示
def student_work_absence_penalty
render_403 unless User.current.allowed_to?(:as_teacher,@course)
order = params[:order] || "desc"
if @homework.student_works.empty?
@stundet_works = []
@ -251,7 +251,7 @@ class StudentWorkController < ApplicationController
work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")"
@stundet_works = StudentWork.find_by_sql("SELECT *,(all_count - has_count) AS absence FROM(
SELECT * ,
(SELECT COUNT(*) FROM `student_works_evaluation_distributions` WHERE user_id = student_works.user_id AND student_work_id IN #{work_ids}) AS all_count,
(SELECT evaluation_num FROM homework_detail_manuals WHERE homework_detail_manuals.homework_common_id = #{@homework.id}) AS all_count,
(SELECT COUNT(*) FROM `student_works_scores` WHERE user_id = student_works.user_id AND student_work_id IN #{work_ids}) AS has_count
FROM `student_works`
WHERE homework_common_id = #{@homework.id}
@ -264,6 +264,39 @@ class StudentWorkController < ApplicationController
end
end
#导出缺评列表
def absence_penalty_list
if @homework.student_works.empty?
@stundet_works = []
else
work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")"
@stundet_works = StudentWork.find_by_sql("SELECT * FROM (SELECT *,(all_count - has_count) AS absence FROM(
SELECT * ,
(SELECT evaluation_num FROM homework_detail_manuals WHERE homework_detail_manuals.homework_common_id = #{@homework.id}) AS all_count,
(SELECT COUNT(*) FROM `student_works_scores` WHERE user_id = student_works.user_id AND student_work_id IN #{work_ids}) AS has_count
FROM `student_works`
WHERE homework_common_id = #{@homework.id}
) AS table_1) AS table_2
where absence > 0 order by absence")
end
respond_to do |format|
format.xls {
send_data(absence_penalty_list_xls(@stundet_works), :type => "text/excel;charset=utf-8; header=present",
:filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_absence_list)}.xls")
}
end
end
#导出匿评列表
def evaluation_list
respond_to do |format|
format.xls {
send_data(evaluation_list_xls(@homework.student_works), :type => "text/excel;charset=utf-8; header=present",
:filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_evaluation_list)}.xls")
}
end
end
private
#获取作业
def find_homework
@ -293,6 +326,10 @@ class StudentWorkController < ApplicationController
render_403 unless (User.current.id == @work.user_id || User.current.admin?) && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 )
end
def teacher_of_course
render_403 unless User.current.allowed_to?(:as_teacher,@course)
end
#根据条件过滤作业结果
def search_homework_member homeworks,name
name = name.downcase
@ -302,6 +339,7 @@ class StudentWorkController < ApplicationController
select_homework
end
#作品列表转换为excel
def homework_to_xls items
xls_report = StringIO.new
book = Spreadsheet::Workbook.new
@ -328,4 +366,55 @@ class StudentWorkController < ApplicationController
book.write xls_report
xls_report.string
end
#缺评列表转换为excel
def absence_penalty_list_xls items
xls_report = StringIO.new
book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet :name => "homework"
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
sheet1.row(0).default_format = blue
sheet1.row(0).concat([l(:excel_student_id),l(:excel_nickname),l(:excel_user_name),l(:lable_all_penalty),l(:lable_has_penalty),l(:lable_absence_penalty)])
count_row = 1
items.each do |homework|
sheet1[count_row,0] = homework.user.user_extensions.student_id
sheet1[count_row,1] = homework.user.login
sheet1[count_row,2] = homework.user.lastname.to_s + homework.user.firstname.to_s
sheet1[count_row,3] = homework.all_count
sheet1[count_row,4] = homework.has_count
sheet1[count_row,5] = homework.absence
count_row += 1
end
book.write xls_report
xls_report.string
end
#匿评列表转换为excel
def evaluation_list_xls items
xls_report = StringIO.new
book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet :name => "homework"
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
sheet1.row(0).default_format = blue
sheet1.row(0).concat([l(:label_work_name),l(:label_work_id),l(:label_work_autor),l(:label_evaluation_id),l(:label_evaluation_name),
l(:label_evaluation_score),l(:label_evaluation_common),l(:label_evaluation_time)])
count_row = 1
items.each do |homework|
homework.student_works_scores.where(:reviewer_role => 3).each do |score|
sheet1[count_row,0] = homework.name
sheet1[count_row,1] = homework.user.user_extensions.student_id
sheet1[count_row,2] = homework.user.show_name
sheet1[count_row,3] = score.user.user_extensions.student_id
sheet1[count_row,4] = score.user.show_name
sheet1[count_row,5] = score.score
sheet1[count_row,6] = score.comment
sheet1[count_row,7] = format_time(score.created_at)
count_row += 1
end
end
book.write xls_report
xls_report.string
end
end

View File

@ -2278,7 +2278,9 @@ module ApplicationHelper
#获取匿评相关连接代码
def homework_anonymous_comment homework
if homework.homework_type == 1 && homework.homework_detail_manual #匿评作业
if homework.student_works.count >= 2 #作业份数大于2
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'

View File

@ -186,7 +186,7 @@ class Mailer < ActionMailer::Base
@course_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT jfm.* from journals_for_messages jfm, members m, courses c
where m.user_id = '#{user.id}' and c.id = m.course_id and jfm.jour_id = c.id
and jfm.jour_type='Course' and (jfm.created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
@user_journal_messages = user.journals_for_messages.where("jour_type='Principal' and (created_on between '#{date_from}' and '#{date_to}')").order('created_on DESC')
# 查询user在项目中留言用户反馈

View File

@ -839,7 +839,7 @@ class Project < ActiveRecord::Base
# Yields the given block for each project with its level in the tree
def self.project_tree(projects, &block)
ancestors = []
projects.sort_by(&:lft).each do |project|
projects.sort_by(&:id).each do |project|
while (ancestors.any? && !project.is_descendant_of?(ancestors.last))
ancestors.pop
end

View File

@ -201,12 +201,14 @@ class CoursesService
@course.class_period = params[:class_period].to_i
params[:course][:is_public] ? @course.is_public = 1 : @course.is_public = 0
params[:course][:open_student] ? @course.open_student = 1 : @course.open_student = 0
else
end
@issue_custom_fields = IssueCustomField.sorted.all
@trackers = Tracker.sorted.all
if @course.save
if @course && @course.save
#unless User.current.admin?
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
m = Member.new(:user => current_user, :roles => [r])

View File

@ -0,0 +1,76 @@
<div class="contextual">
<%= link_to l(:label_course_new), {:controller => 'courses', :action => 'new'}, :class => 'icon icon-add' %>
</div>
<h3>
<%=l(:label_course_all)%>
</h3>
<%= form_tag({}, :method => :get) do %>
<fieldset>
<label for='name'>
课程:
</label>
<%= text_field_tag 'name', params[:name], :size => 30, :placeholder => '课程名称' %>
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
<a class="icon icon-reload" onclick="$('#name').val('')" style="cursor: pointer;text-decoration: none;">
<%= l(:button_clear)%>
</a>
</fieldset>
<% end %>
&nbsp;
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 30px;">
序号
</th>
<th style="width: 120px;">
课程
</th>
<th style="width: 50px;">
主讲老师
</th>
<th style="width: 30px;">
学时
</th>
<th style="width: 20px;">
<%=l(:field_is_public)%>
</th>
<th style="width: 70px;">
<%=l(:field_created_on)%>
</th>
</tr>
</thead>
<tbody>
<% @courses.each do |course| %>
<tr class="<%= cycle("odd", "even") %>">
<td style="text-align: center;">
<%= course.id %>
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=course.name%>'>
<span>
<%= link_to(course.name, course_path(course.id)) %>
</span>
</td>
<td align="center">
<%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %>
</td>
<td align="center">
<%= course.class_period %>
</td>
<td class="center">
<%= checked_image course.is_public? %>
</td>
<td class="center">
<%= format_date(course.created_at) %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% html_title(l(:label_course_all)) -%>

View File

@ -1,5 +1,5 @@
<div class="contextual">
<%= link_to l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add' %>
<%= link_to l(:label_project_new), {:controller => 'projects', :action => 'new'}, :class => 'icon icon-add' %>
</div>
<h3>
@ -7,62 +7,70 @@
</h3>
<%= form_tag({}, :method => :get) do %>
<fieldset>
<legend>
<fieldset>
<legend>
<%= l(:label_filter_plural) %>
</legend>
<label for='status'>
<%= l(:field_status) %> :
</label>
<%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
<label for='name'>
<%= l(:label_project) %>:
</label>
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'projects'}, :class => 'icon icon-reload' %>
</fieldset>
</legend>
<label for='status'>
<%= l(:field_status) %> :
</label>
<%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %>
<label for='name'>
<%= l(:label_project) %>:
</label>
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'projects'}, :class => 'icon icon-reload' %>
</fieldset>
<% end %>
&nbsp;
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead><tr>
<th>
<%=l(:label_project)%>
</th>
<th>
<%=l(:field_is_public)%>
</th>
<th>
<%=l(:field_created_on)%>
</th>
<th></th>
</tr></thead>
<tbody>
<% project_tree(@projects) do |project, level| %>
<tr class="<%= cycle("odd", "even") %> <%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=project.name%>'>
<span>
<%= link_to_project_settings(project, {}) %>
</span>
</td>
<td align="center">
<%= checked_image project.is_public? %>
</td>
<td align="center">
<%= format_date(project.created_on) %>
</td>
<td class="buttons">
<%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock') unless project.archived? %>
<%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project, :status => params[:status] }, :method => :post, :class => 'icon icon-unlock') if project.archived? && (project.parent.nil? || !project.parent.archived?) %>
<%= link_to(l(:button_copy), { :controller => 'projects', :action => 'copy', :id => project }, :class => 'icon icon-copy') %>
<%= link_to(l(:button_delete), project_path(project), :method => :delete, :class => 'icon icon-del') %>
</td>
</tr>
<% end %>
</tbody>
</table>
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 30px;">
序号
</th>
<th style="width: 120px;">
<%=l(:label_project)%>
</th>
<th style="width: 20px;">
<%=l(:field_is_public)%>
</th>
<th style="width: 30px;">
<%=l(:field_created_on)%>
</th>
<th style="width: 70px;"></th>
</tr>
</thead>
<tbody>
<% project_tree(@projects) do |project, level| %>
<tr class="<%= cycle("odd", "even") %> <%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
<td style="text-align: center;">
<%= project.id %>
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=project.name%>'>
<span>
<%= link_to_project_settings(project, {}) %>
</span>
</td>
<td align="center">
<%= checked_image project.is_public? %>
</td>
<td align="center">
<%= format_date(project.created_on) %>
</td>
<td class="buttons">
<%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock') unless project.archived? %>
<%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project, :status => params[:status] }, :method => :post, :class => 'icon icon-unlock') if project.archived? && (project.parent.nil? || !project.parent.archived?) %>
<%= link_to(l(:button_copy), { :controller => 'projects', :action => 'copy', :id => project }, :class => 'icon icon-copy') %>
<%= link_to(l(:button_delete), project_path(project), :method => :delete, :class => 'icon icon-del') %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% html_title(l(:label_project_plural)) -%>

View File

@ -9,7 +9,7 @@
<div class="ping_distop">
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
<span>
<%= link_to journal.user, user_path(journal.user),:class => 'c_blue fb fl mb10', :target => "_blank"%>
<%= link_to journal.user.show_name, user_path(journal.user),:class => 'c_blue fb fl mb10', :target => "_blank"%>
</span>
<span class="c_grey fr">
<%= format_time(journal.created_on) %>

View File

@ -22,7 +22,7 @@
<div class="for_img_thumbnails">
<% curse_attachments.each do |file| %>
<% if file.is_public? || User.current.member_of_course?(course) %>
<% if file.is_public? || User.current.member_of_course?(course) || User.current.admin? %>
<div class="re_con_box" id="container_files_<%= file.id %>">
<div class="">
<%= link_to truncate(file.filename,length: 35, omission: '...'),

View File

@ -4,36 +4,40 @@
<% if memos.any? %>
<% memos.each do |topic| %>
<table class="content-text-list">
<tr><td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) if topic.author%></td>
<td>
<table width="630px" border="0">
<tr>
<td valign="top" width="500px" class="<%= topic.sticky ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>"><%= link_to h(topic.subject), forum_memo_path(topic.forum, topic) %></td>
<td align="right" rowspan="3">
<table class="borad-count">
<tr>
<td align="center" class="borad-count-digit"><%= link_to (topic.replies_count), forum_memo_path(topic.forum, topic) %></td>
</tr>
<tr>
<td align="center">回答</td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" ><span class="font_description"> </span></td>
</tr>
<tr>
<td align="left" colspan="2" ><span class="font_lighter"><%= authoring topic.created_at, topic.author %>
<span class="font_description2">
<% author = topic.last_reply.try(:author)%>
<% if author%>
最后回复:<%=link_to_user author %>
<% end%>
</span>
<br />
</span></td>
</tr>
</table></td>
<tr>
<td colspan="2" valign="top" style="width: 50px;">
<%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) if topic.author%>
</td>
<td>
<table width="630px" border="0">
<tr>
<td valign="top" width="500px" class="<%= topic.sticky ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>"><%= link_to h(topic.subject), forum_memo_path(topic.forum, topic) %></td>
<td align="right" rowspan="3">
<table class="borad-count">
<tr>
<td align="center" class="borad-count-digit"><%= link_to (topic.replies_count), forum_memo_path(topic.forum, topic) %></td>
</tr>
<tr>
<td align="center">回答</td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" ><span class="font_description"> </span></td>
</tr>
<tr>
<td align="left" colspan="2" ><span class="font_lighter"><%= authoring topic.created_at, topic.author %>
<span class="font_description2">
<% author = topic.last_reply.try(:author)%>
<% if author%>
最后回复:<%=link_to_user author %>
<% end%>
</span>
<br />
</span></td>
</tr>
</table>
</td>
</tr>
</table>
<% end %>

View File

@ -41,12 +41,13 @@
<%= homework.description.html_safe %>
</div>
</div>
<div class="cl"></div>
<div class="news_foot currentDd" id="bid_show_more_des_button<%= homework.id%>" onclick="bid_show_more_des(<%= homework.id%>);" style="cursor:pointer;display: none;">
<div class="news_foot currentDd fr" id="bid_show_more_des_button<%= homework.id%>" onclick="bid_show_more_des(<%= homework.id%>);" style="cursor:pointer;display: none;">
[展开]
</div>
<div class="cl"></div>
<div class="mt5">
<% unless homework.attachments.empty?%>
<span class="tit_fb" style="width: auto;"> 附件:</span>

View File

@ -5,6 +5,8 @@ $("#<%= @homework.id %>_start_anonymous_comment").replaceWith('<%= escape_javasc
alert('启动失败\n作业总数大于等于2份时才能启动匿评');
<% elsif @statue == 3%>
alert("已开启匿评,请务重复开启");
<% elsif @statue == 3%>
<% elsif @statue == 4%>
alert("您没有权限开启匿评");
<% elsif @statue == 5%>
alert("作业提交截止之后才能启动匿评");
<% end %>

View File

@ -20,8 +20,10 @@
<%= render :partial => 'history', :locals => {:issue => @issue, :journals => @journals} %>
</div>
<% end %>
<div id="journal_issue_note" class="wiki"></div>
<input name="issue_quote_new" type="hidden" value="<%= %>" />
<fieldset><legend>回复</legend>
<%= f.text_area :notes, :style => "width:99%;", :rows => "5", :no_label => true %>
<%= f.text_area :notes, :style => "width:99%;", :rows => "5", :no_label => true %>
</fieldset>
<!--<%# if @issue.safe_attribute? 'private_notes' %>-->
<!--<label for="issue_private_notes"><%#= f.check_box :private_notes, :no_label => true %> <%#= l(:field_private_notes) %></label>-->

View File

@ -3,9 +3,9 @@
<!-- modified by bai -->
<div id="change-<%= journal.id %>" class="<%= journal.css_classes %>" style=" word-wrap: break-word; word-break: break-all">
<!-- end -->
<div class="ping_C mb10 ml10">
<div class="ping_C mb10">
<div class="ping_dispic"><a href="#" target="_blank"><%= image_tag(url_to_avatar(journal.user), :class => "ping_dispic",:width => 46,:height => 46) %></a></div>
<div class="ping_discon" style="width: 600px;">
<div class="ping_discon">
<div class="ping_distop">
<a href="#" target="_blank" class="c_blue fb fl mb10 "><%= journal.user %></a><span class="c_grey fr"><%= format_time journal.created_on %></span>
<div class="cl"></div>
@ -20,7 +20,9 @@
<!--编辑、引用、回复按钮-->
<div class="ping_disfoot"><%= render_links_easy(issue, journal, :reply_links => reply_links) unless journal.notes.blank? %></div>
<!--回复内容、引用内容-->
<p><%= render_notes_issue(issue, journal, :reply_links => reply_links) unless journal.notes.blank? %></p>
<p>
<%= render_notes_issue(issue, journal, :reply_links => reply_links) unless journal.notes.blank? %>
</p>
<div class="cl"></div>
</div>
<div class="cl"></div>

View File

@ -109,6 +109,9 @@
<%= render :partial => 'edit' %>
</div>
<p style="padding-top: 5px"></p>
<!--引用时不能修改,剥离出引用内容-->
<a remote="true" href="javascript:void(0)" class="blue_btn fr mr80" onclick="issue_desc_editor.sync();$('#issue-form').submit();">
<%= l(:button_submit) %>
</a>

View File

@ -1,11 +1,11 @@
$('#issue_notes').val("<%= raw escape_javascript(@content) %>");
$('#journal_issue_note').html("<%= raw escape_javascript(@content.html_safe) %>");
$("input[name='issue_quote_new']").val("<%= raw escape_javascript(@content.html_safe) %>");
<%
# when quoting a private journal, check the private checkbox
if @journal && @journal.private_notes?
if @journal && @journal.private_notes?
%>
$('#issue_private_notes').attr('checked', true);
<% end %>
showAndScrollTo("update", "notes");
$('#notes').scrollTop = $('#notes').scrollHeight - $('#notes').clientHeight;

View File

@ -17,15 +17,14 @@
visiable = hidden_non_project && hidden_non_project.value == "0"%>
<ul class="sub_menu">
<% if @show_course == 1 && !visiable %>
<% if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%>
<% hasCourse=false %>
<% User.current.courses.each do |course| %>
<% if !course_endTime_timeout?(course) %>
<% hasCourse=true %>
<% end %>
<% hasCourse=false %>
<% User.current.courses.each do |course| %>
<% if !course_endTime_timeout?(course) %>
<% hasCourse=true %>
<% break %>
<% end %>
<%= render :partial => 'layouts/user_courses_list', :locals => {:hasCourse => hasCourse} %>
<% end -%>
<% end %>
<%= render :partial => 'layouts/user_courses_list', :locals => {:hasCourse => hasCourse} %>
<% end %>
<%= render :partial => 'layouts/user_project_list', :locals => {:hasCourse => hasCourse} %>
<li style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">

View File

@ -20,7 +20,7 @@
<li id="current_user_li">
<%= link_to "#{User.current.login}<span class='pic_triangle'></span>".html_safe, {:controller=> 'users', :action => 'show', id: User.current.id, host: Setting.host_user}, target:"_blank", :class => "uses_name"%>
<ul id="user_sub_menu" style="right: 0px;display: none;">
<% if @show_course == 1 && User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) %>
<% if @show_course == 1 %>
<% user_course = get_user_course User.current%>
<% unless user_course.empty? %>
<li id="my_courses_li">

View File

@ -44,9 +44,11 @@
<%= news.description.html_safe %>
</div>
</div>
<div class="news_foot currentDd" style="cursor:pointer;display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>">
<div class="cl"></div>
<div class="news_foot currentDd fr" style="cursor:pointer;display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>">
[展开]
</div>
<div class="cl mb5"></div>
<span class="fl"><%= l(:label_create_time)%><%= format_time(news.created_on)%></span>
<%= link_to_attachments_course news %>
<div class="cl"></div>

View File

@ -1,8 +1,9 @@
<div style="width: 57%;margin: 10px auto;">
<div style="width: 67%;margin: 10px auto;">
<%= form_tag( search_stores_path, method: 'post') do %>
<%= text_field_tag 'name', params[:name], placeholder: l('welcome.search.information'), name: "name", :class => 'blueinputbar', :style => 'width:450px;'%>
&nbsp;&nbsp;
<%= submit_tag l(:label_search), :class => "enterprise"%>
<%= submit_tag l(:label_search), :class => "enterprise "%>
<% end %>
<%= link_to("导出缺失列表",lost_file_stores_path(:format => 'xls'),:style => "background-color: #15bccf;padding: 4px 5px;color: white;") if User.current.admin?%>
<div class='font_lighter' style="display: inline-block; margin-top:3px;"><%= l(:label_resources_search_all)%></div>
</div>

View File

@ -13,30 +13,31 @@
<li class=" hwork_time f14 fb c_dark">
<%= link_to "时间",@show_all ? student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
<% if @show_all && @order == "created_at"%>
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
<%= link_to "",student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
<% end%>
</li>
<li class="mr5 w40 ml15">
<%= link_to "教师",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
<% if @show_all && @order == "teacher_score"%>
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
<% end%>
</li>
<li class="mr5 w40 ml20">
<%= link_to "教辅",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
<% if @show_all && @order == "teaching_asistant_score"%>
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
<% end%>
</li>
<li class="mr5 ml10 w40">
<%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
<% if @show_all && @order == "student_score"%>
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
<% end%>
</li>
<li class="ml20">
<%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "final_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
<% if @show_all && @order == "final_score"%>
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "final_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%>
<% end%>
</li>

View File

@ -1,6 +1,7 @@
$("#add_score_reply_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'add_score_reply', :locals => {:score => @score}) %>");
<% if @status && @status == 1%>
$("#replay_histroy_<%= @score.id%>").prepend("<%= escape_javascript(render :partial => 'jour_replay', :locals => {:jour => @jour}) %>");
$("#add_score_reply_<%= @score.id%>").hide();
<% else%>
alert("回复内容不能为空");
<% end%>

View File

@ -50,7 +50,7 @@
<% if @show_all%>
<input type="text" value="<%= @name%>" placeholder="昵称、学号、姓名搜索" class="min_search ml10 fl" onkeypress="SearchByName($(this),'<%= student_work_index_path(:homework => @homework.id)%>',event);">
<a class="student_work_search fl" onclick="SearchByName_1($(this).prev(),'<%= student_work_index_path(:homework => @homework.id)%>');" href="javascript:void(0)">搜索</a>
<%= link_to "缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank" if @is_teacher && @homework.homework_type == 1 && @homework.homework_detail_manual.comment_status != 1 %>
<%= link_to("缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank") if((@is_teacher || User.current.admin?) && @homework.homework_type == 1) %>
<% end%>
<% if @is_teacher%>
<div class="fr">
@ -69,7 +69,8 @@
<span class="c_red">winrar</span>
工具进行解压
</div>
<%= link_to "匿评", evaluation_list_student_work_index_path(:homework => @homework.id, :format => 'xls'),:class=>'down_btn fr'%>
<%= link_to "缺评", absence_penalty_list_student_work_index_path(:homework => @homework.id, :format => 'xls'),:class=>'down_btn fr'%>
<%= link_to l(:label_list), student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :format => 'xls'),:class=>'down_btn fr'%>
<span class="mt3 fr " style="color:#136b3b;">导出全部:</span>
</div>

View File

@ -25,6 +25,11 @@
:homework => @homework.id
}) do |f|%>
<div class="N_con">
<% if @homework.homework_type == 1%>
<div class=" c_red mb10 ml90">
提示:匿评作业提交的作品,作品名称和描述中不能出现真实的姓名信息
</div>
<% end%>
<p>
<label class="fl"><span class="c_red">*</span>&nbsp;&nbsp;作品名称&nbsp;&nbsp;&nbsp;&nbsp;</label>
<%= f.text_field "name", :required => true, :size => 60, :class => "bo fl", :maxlength => 200, :placeholder => "作品名称", :onkeyup => "regexStudentWorkName();" %>

View File

@ -14,13 +14,13 @@
<a href="javascript:void(0)">姓名</a>
</li>
<li class="ml320">
<a href="javascript:void(0)">应评</a>
<a href="javascript:void(0)"><%= l(:lable_all_penalty)%></a>
</li>
<li class="ml30">
<a href="javascript:void(0)">实评</a>
<a href="javascript:void(0)"><%= l(:lable_has_penalty)%></a>
</li>
<li class="ml30">
<%= link_to "缺评",student_work_absence_penalty_student_work_index_path(:homework => @homework.id,:order => @order)%>
<%= link_to l(:lable_absence_penalty),student_work_absence_penalty_student_work_index_path(:homework => @homework.id,:order => @order)%>
<a href="javascript:void(0);" class="<%= @order == 'desc' ? 'st_up' : 'st_down'%>" ></a>
</li>
</ul>

View File

@ -6,17 +6,17 @@
<div class="recall" id='word_li_<%=reply.id.to_s%>' onmouseover="$('#<%= ids_r %>').show()" onmouseout="$('#<%= ids_r %>').hide()">
<div class="recall_head">
<% if show_name %>
<%= image_tag url_to_avatar(reply.user),:width => '30',:height => '30' %>
<%= image_tag url_to_avatar(reply.user.show_name),:width => '30',:height => '30' %>
<% else %>
<%= image_tag url_to_avatar(nil),:width => '30',:height => '30' %>
<% end %>
</div>
<div class="recall_con">
<% id = 'project_respond_form_'+ reply.id.to_s %>
<%= link_to reply.user.name, user_path(reply.user) %>
<%= link_to reply.user.show_name, user_path(reply.user) %>
<%= l(:label_reply_to)%>
<% if show_name %>
<%= link_to parent_jour.user.name, user_path(parent_jour.user) %>
<%= link_to parent_jour.user.show_name, user_path(parent_jour.user) %>
<% else %>
<%= l(:label_anonymous) %>
<% end %>

View File

@ -263,7 +263,7 @@ zh:
label_tags_numbers: "Tag统计"
label_issue_plural: 问题跟踪
label_project_plural: 项目列表
# label_project_plural: 项目列表
label_user_plural: 用户列表
label_tags_call: 需求
field_filename: 文件

View File

@ -12,6 +12,7 @@ zh:
notice_account_wrong_password: 密码错误
name_can_be_empty: 可以不填写真实姓名[保密所需]
notice_successful_create: 创建成功
notice_create_failed: 创建失败,请先完善个人信息
notice_failed_create: 创建失败
notice_successful_update: 更新成功
notice_successful_edit: 修改成功
@ -1820,6 +1821,8 @@ zh:
excel_member_with_out_class: "未加入班级的学生"
excel_member_list: 成员列表
excel_homework_list: 作品列表
excel_absence_list: 缺评列表
excel_evaluation_list: 匿评列表
excel_been_rated: 已评
excel_not_rated: 未评
label_export_excel: 导出列表
@ -2006,3 +2009,21 @@ zh:
error_upload_avatar_to_large: "超过大小限制 (%{max_size})"
not_valid_image_file: 不是有效的图片文件
lable_all_penalty: 应评
lable_has_penalty: 实评
lable_absence_penalty: 缺评
label_work_name: 作品名称
label_work_autor: 作品提交者
label_work_id: 提交者学号
label_evaluation_id: 匿评者学号
label_evaluation_name: 匿评者
label_evaluation_score: 匿评分数
label_evaluation_common: 匿评评语
label_evaluation_time: 匿评时间
label_file_lost_list: 缺失文件列表

View File

@ -98,6 +98,8 @@ RedmineApp::Application.routes.draw do
post 'add_score_reply'
get 'destroy_score_reply'
get 'student_work_absence_penalty'
get 'absence_penalty_list'
get 'evaluation_list'
end
end
@ -190,6 +192,7 @@ RedmineApp::Application.routes.draw do
resources :stores do
collection do
match 'search', :via => [:get, :post]
get 'lost_file'
end
end
@ -633,6 +636,7 @@ RedmineApp::Application.routes.draw do
match 'admin', :to => 'admin#index', :via => :get
match 'admin/projects', :via => :get
get 'admin/courses'
match 'admin/users', :via => :get
match 'admin/first_page_made', as: :first_page_made
match 'admin/course_page_made', as: :course_page_made

View File

@ -0,0 +1,13 @@
class DeleteSameScore < ActiveRecord::Migration
def up
student_work_scores = StudentWorksScore.find_by_sql("SELECT * FROM student_works_scores AS a
WHERE (a.student_work_id,a.user_id) IN (SELECT student_work_id,user_id FROM student_works_scores GROUP BY student_work_id,user_id HAVING COUNT(*) > 1)
AND id NOT IN (SELECT MIN(id) FROM student_works_scores GROUP BY student_work_id,user_id HAVING COUNT(*)>1)")
student_work_scores.each do |score|
score.destroy
end
end
def down
end
end

View File

@ -0,0 +1,9 @@
class AddLatePenaltyToStudnetWork < ActiveRecord::Migration
def up
add_column :student_works, :late_penalty, :integer, default: 0
end
def down
remove_column :student_works, :late_penalty
end
end

View File

@ -0,0 +1,9 @@
class AddAbsencePenaltyToStudnetWork < ActiveRecord::Migration
def up
add_column :student_works, :absence_penalty, :integer, default: 0
end
def down
remove_column :student_works, :absence_penalty
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150619060110) do
ActiveRecord::Schema.define(:version => 20150630031857) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -721,16 +721,6 @@ ActiveRecord::Schema.define(:version => 20150619060110) do
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
create_table "journal_details_copy", :force => true do |t|
t.integer "journal_id", :default => 0, :null => false
t.string "property", :limit => 30, :default => "", :null => false
t.string "prop_key", :limit => 30, :default => "", :null => false
t.text "old_value"
t.text "value"
end
add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id"
create_table "journal_replies", :id => false, :force => true do |t|
t.integer "journal_id"
t.integer "user_id"

View File

@ -367,6 +367,7 @@ end
Redmine::MenuManager.map :admin_menu do |menu|
menu.push :organization, {:controller => 'admin', :action => 'organization'}, :caption => :label_organization_list
menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural
menu.push :courses, {:controller => 'admin', :action => 'courses'}, :caption => :label_course_all
menu.push :users, {:controller => 'admin', :action => 'users'}, :caption => :label_user_plural
menu.push :first_page_made, {:controller => 'admin',:action => 'first_page_made'},:caption => :label_first_page_made
menu.push :mobile_version, {:controller => 'admin',:action => 'mobile_version'},:caption => :label_mobile_version

View File

@ -802,8 +802,8 @@ $(function(){
$(".zip_download_alert").bind("mouseover",function(e){
//alert($(this).html());
$(this).next("div").show();
$(this).next("div").css("top",e.pageY);
$(this).next("div").css("left",e.pageX);
//$(this).next("div").css("top",e.pageY);
//$(this).next("div").css("left",e.pageX);
});
$(".zip_download_alert").bind("mouseout",function(e){
//alert($(this).html());

View File

@ -654,7 +654,7 @@ a.down_btn{ border:1px solid #CCC; color:#999; padding:0px 5px; font-size:12px;
a:hover.down_btn{ background:#14ad5a; color:#fff; border:1px solid #14ad5a;}
.fr{ float:right;}
.li_min_search{ float:right; margin-right:-10px;}
.info_ni{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;}
.info_ni{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;margin-left: 110px;margin-top: 10px;}
/*返回顶部*/
.to_top{width: 19px;height: 74px;position: fixed;top: 50px;right: 1px;color: white;background: #15bccf; line-height: 1.2; padding-top: 10px;padding-left: 5px;font-size: 14px;cursor: pointer;}
.hwork_num_ab{ width:120px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;min-height: 1px;}
@ -681,7 +681,9 @@ input#score{ width:40px;}
a.about_me{text-align:center;font-size:16px; color:#64bdd9; margin:10px 0 0 10px;}
a:hover.about_me{ color:#0781b4;}
.mb5 li{width:200px;word-wrap: break-word;
word-break: normal;
}

View File

@ -1635,6 +1635,7 @@ img.avatar {
display: block;
width: 38px;
height: 38px;
max-width: none;
}