diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 8e23041c6..086ecfb7f 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -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) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 3b25438df..00d740ee7 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -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 diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 0003f7586..19c1214e2 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -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'] diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 5cd55e23b..6b2cd21ed 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -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 diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb index aa3a7e0ea..d8cd8eeec 100644 --- a/app/controllers/journals_controller.rb +++ b/app/controllers/journals_controller.rb @@ -74,6 +74,7 @@ class JournalsController < ApplicationController text = text.to_s.strip.gsub(%r{
((.|\s)*?)}m, '[...]') @content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> " @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" + @content = "
" << @content @id = user.id rescue ActiveRecord::RecordNotFound render_404 diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index e695a6fb0..deeefcd75 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -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 \ No newline at end of file diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5af4e2038..a31bd6189 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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 = "启动匿评".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' diff --git a/app/models/project.rb b/app/models/project.rb index 49ed2d0ee..f201e6e3c 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -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 diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index f5ff2670f..68177552c 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -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]) diff --git a/app/views/admin/courses.html.erb b/app/views/admin/courses.html.erb new file mode 100644 index 000000000..1615bccbc --- /dev/null +++ b/app/views/admin/courses.html.erb @@ -0,0 +1,76 @@ ++ <%= link_to l(:label_course_new), {:controller => 'courses', :action => 'new'}, :class => 'icon icon-add' %> ++ ++ <%=l(:label_course_all)%> +
+ +<%= form_tag({}, :method => :get) do %> + +<% end %> + + +++ +<% html_title(l(:label_course_all)) -%> diff --git a/app/views/admin/projects.html.erb b/app/views/admin/projects.html.erb index 4c9479a6d..f5b7955bf 100644 --- a/app/views/admin/projects.html.erb +++ b/app/views/admin/projects.html.erb @@ -1,5 +1,5 @@+ +
++ + + + <% @courses.each do |course| %> ++ 序号 + ++ 课程 + ++ 主讲老师 + ++ 学时 + ++ <%=l(:field_is_public)%> + ++ <%=l(:field_created_on)%> + +"> + + <% end %> + ++ <%= course.id %> + + ++ <%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %> + ++ <%= course.class_period %> + ++ <%= checked_image course.is_public? %> + ++ <%= format_date(course.created_at) %> + +-<%= 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' %>@@ -7,62 +7,70 @@
<%= form_tag({}, :method => :get) do %> - <% end %>-<% html_title(l(:label_project_plural)) -%> diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index 8536a3ef5..353d19dab 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -22,7 +22,7 @@-
+- - -<% project_tree(@projects) do |project, level| %> -- <%=l(:label_project)%> - -- <%=l(:field_is_public)%> - -- <%=l(:field_created_on)%> - -- <%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>"> - -<% end %> - - -- <%= checked_image project.is_public? %> - -- <%= format_date(project.created_on) %> - -- <%= 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') %> - -+ +
+ + + + <% project_tree(@projects) do |project, level| %> ++ 序号 + ++ <%=l(:label_project)%> + ++ <%=l(:field_is_public)%> + ++ <%=l(:field_created_on)%> + ++ <%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>"> + + <% end %> + ++ <%= project.id %> + + ++ <%= checked_image project.is_public? %> + ++ <%= format_date(project.created_on) %> + ++ <%= 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') %> + +<% 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? %>- diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index 1b82ac31b..b4162c4da 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -25,6 +25,11 @@ :homework => @homework.id }) do |f|%>+ - + + + <%= l(:button_submit) %> diff --git a/app/views/journals/new.js.erb b/app/views/journals/new.js.erb index ae2574595..d02568426 100644 --- a/app/views/journals/new.js.erb +++ b/app/views/journals/new.js.erb @@ -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; diff --git a/app/views/news/_course_news.html.erb b/app/views/news/_course_news.html.erb index 28eb5c805..6d4369c7b 100644 --- a/app/views/news/_course_news.html.erb +++ b/app/views/news/_course_news.html.erb @@ -44,9 +44,11 @@ <%= news.description.html_safe %><%= link_to truncate(file.filename,length: 35, omission: '...'), diff --git a/app/views/forums/_show_topics.html.erb b/app/views/forums/_show_topics.html.erb index 9af8538ed..f46600a6c 100644 --- a/app/views/forums/_show_topics.html.erb +++ b/app/views/forums/_show_topics.html.erb @@ -4,36 +4,40 @@ <% if memos.any? %> <% memos.each do |topic| %>-
<% end %> diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index 3208bb969..a1aa49c8c 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -41,12 +41,13 @@ <%= homework.description.html_safe %><%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) if topic.author%> -- +-
- -<%= link_to h(topic.subject), forum_memo_path(topic.forum, topic) %> -- --
- -<%= link_to (topic.replies_count), forum_memo_path(topic.forum, topic) %> -- -回答 -- -- - -<%= authoring topic.created_at, topic.author %> - - <% author = topic.last_reply.try(:author)%> - <% if author%> - 最后回复:<%=link_to_user author %> - <% end%> - - -
-+ + <%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) if topic.author%> + ++ +
++ +<%= link_to h(topic.subject), forum_memo_path(topic.forum, topic) %> ++ ++
+ +<%= link_to (topic.replies_count), forum_memo_path(topic.forum, topic) %> ++ +回答 ++ ++ + +<%= authoring topic.created_at, topic.author %> + + <% author = topic.last_reply.try(:author)%> + <% if author%> + 最后回复:<%=link_to_user author %> + <% end%> + + +
++ <% if @homework.homework_type == 1%> ++ 提示:匿评作业提交的作品,作品名称和描述中不能出现真实的姓名信息 ++ <% end%><%= f.text_field "name", :required => true, :size => 60, :class => "bo fl", :maxlength => 200, :placeholder => "作品名称", :onkeyup => "regexStudentWorkName();" %> diff --git a/app/views/student_work/student_work_absence_penalty.html.erb b/app/views/student_work/student_work_absence_penalty.html.erb index e9054561f..967480552 100644 --- a/app/views/student_work/student_work_absence_penalty.html.erb +++ b/app/views/student_work/student_work_absence_penalty.html.erb @@ -14,13 +14,13 @@ 姓名
- 应评 + <%= l(:lable_all_penalty)%> - 实评 + <%= l(:lable_has_penalty)%> - <%= 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)%> diff --git a/config/locales/commons/zh.yml b/config/locales/commons/zh.yml index f83d3810c..5dee0b505 100644 --- a/config/locales/commons/zh.yml +++ b/config/locales/commons/zh.yml @@ -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: 文件 diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 568690638..1aab2a22c 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -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,19 @@ 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: 匿评时间 + + + diff --git a/config/routes.rb b/config/routes.rb index b5a244345..dea176f54 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 @@ -633,6 +635,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 diff --git a/db/migrate/20150630031857_delete_same_score.rb b/db/migrate/20150630031857_delete_same_score.rb new file mode 100644 index 000000000..261a54552 --- /dev/null +++ b/db/migrate/20150630031857_delete_same_score.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index c57f435be..c0d1ce7fc 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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" diff --git a/lib/redmine.rb b/lib/redmine.rb index ba0fd0cee..3043cfe5d 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -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 diff --git a/public/javascripts/course.js b/public/javascripts/course.js index f73ab7bf6..172e630f0 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -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()); diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index f6cb6199b..0d956819b 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -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;} diff --git a/public/themes/redpenny-master/stylesheets/application.css b/public/themes/redpenny-master/stylesheets/application.css index 95092aa1d..02626f440 100644 --- a/public/themes/redpenny-master/stylesheets/application.css +++ b/public/themes/redpenny-master/stylesheets/application.css @@ -1635,6 +1635,7 @@ img.avatar { display: block; width: 38px; height: 38px; + max-width: none; }