From 90c4a38cfc7b85537c5a0c76f0eb9015de323d4f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 26 Jun 2015 17:00:33 +0800 Subject: [PATCH 01/26] =?UTF-8?q?=E5=85=AC=E5=85=B1=E8=B4=B4=E5=90=A7?= =?UTF-8?q?=E5=A4=B4=E5=83=8F=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/forums/_show_topics.html.erb | 64 ++++++++++--------- .../stylesheets/application.css | 1 + 2 files changed, 35 insertions(+), 30 deletions(-) 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| %> - - + + +
<%= 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%> + +
+
+
<% end %> 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; } From 7fa45a47bbe8da71923b15df36c0b9ea1758007b Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 29 Jun 2015 10:59:39 +0800 Subject: [PATCH 02/26] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=88=AA=E8=87=B3?= =?UTF-8?q?=E4=B9=8B=E5=89=8D=E5=90=AF=E5=8A=A8=E5=8C=BF=E8=AF=84=E7=BB=99?= =?UTF-8?q?=E5=87=BA=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 1 + app/views/homework_common/start_anonymous_comment.js.erb | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 5cd55e23b..659d0fa8e 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -135,6 +135,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/views/homework_common/start_anonymous_comment.js.erb b/app/views/homework_common/start_anonymous_comment.js.erb index cd4dafde8..5f27a5b82 100644 --- a/app/views/homework_common/start_anonymous_comment.js.erb +++ b/app/views/homework_common/start_anonymous_comment.js.erb @@ -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 %> \ No newline at end of file From 3e6ccf3e501a5edee690ea35fc0c2fed05d786d7 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 30 Jun 2015 09:47:54 +0800 Subject: [PATCH 03/26] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=88=AA=E8=87=B3?= =?UTF-8?q?=E4=B9=8B=E5=89=8D=E4=B8=8D=E8=83=BD=E5=90=AF=E5=8A=A8=E5=8C=BF?= =?UTF-8?q?=E8=AF=84=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 2 +- app/helpers/application_helper.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 659d0fa8e..18ee03d2e 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -135,7 +135,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") + @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/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' From 59f6ef81cda792d51cd3633c4507c538751495e0 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 30 Jun 2015 10:15:04 +0800 Subject: [PATCH 04/26] =?UTF-8?q?=E9=99=84=E4=BB=B6=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E6=A1=86=E5=9B=BA=E5=AE=9A=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/course.js | 4 ++-- public/stylesheets/courses.css | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 0bd28bea7..056a33752 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;} From af97f3bea88e6b692b718fa38cd4260bf79c77e1 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 30 Jun 2015 10:18:46 +0800 Subject: [PATCH 05/26] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E3=80=81=E9=80=9A=E7=9F=A5=E5=B1=95=E5=BC=80=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=B1=85=E5=8F=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_common/index.html.erb | 5 +++-- app/views/news/_course_news.html.erb | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) 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 %> +
- - <% end%> 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/zh.yml b/config/locales/zh.yml index 568690638..9209e0d51 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2006,3 +2006,8 @@ zh: error_upload_avatar_to_large: "超过大小限制 (%{max_size})" not_valid_image_file: 不是有效的图片文件 + + lable_all_penalty: 应评 + lable_has_penalty: 实评 + lable_absence_penalty: 缺评 + diff --git a/config/routes.rb b/config/routes.rb index b5a244345..8b8d4a401 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 From d7d87c6999923d7095a269cab44b43b31d6803ac Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 30 Jun 2015 15:32:10 +0800 Subject: [PATCH 09/26] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E4=BD=9C=E4=B8=9A=E5=88=9B=E5=BB=BA=E8=80=85?= =?UTF-8?q?=E4=BC=9A=E5=8F=98=E4=B8=BA=E5=BD=93=E5=89=8D=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 18ee03d2e..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 #匿评作业相关属性 From fa31fe421b4337abd445fe0e8ec47b7973949ab1 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 30 Jun 2015 16:36:37 +0800 Subject: [PATCH 10/26] =?UTF-8?q?=E5=8C=BF=E8=AF=84=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=AF=BC=E5=87=BAExcel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 49 ++++++++++++++++++---- app/views/student_work/index.html.erb | 2 +- config/locales/zh.yml | 13 ++++++ 3 files changed, 55 insertions(+), 9 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index f9f91f39c..deeefcd75 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -282,14 +282,19 @@ class StudentWorkController < ApplicationController 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_homework_list)}.xls") + :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 @@ -373,15 +378,43 @@ class StudentWorkController < ApplicationController 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 + 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/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index f6eabdab1..add2c5654 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -71,7 +71,7 @@ <%= 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'%> - <%= link_to "匿评", student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :format => 'xls'),:class=>'down_btn fr'%> + <%= 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'%> 导出全部: diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 9209e0d51..2a538138d 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1820,6 +1820,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: 导出列表 @@ -2011,3 +2013,14 @@ zh: 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: 匿评时间 + + + From 2965cfb5ce321406612d412d89a288ca2ea6b9c3 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 30 Jun 2015 16:39:54 +0800 Subject: [PATCH 11/26] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/index.html.erb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index add2c5654..167829ec3 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -69,10 +69,9 @@ winrar 工具进行解压 - - <%= 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'%> <%= 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'%> 导出全部: <% end%> From 78181e5e4330051d40b9d88f209b1d6a73017716 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 30 Jun 2015 16:55:04 +0800 Subject: [PATCH 12/26] =?UTF-8?q?=E6=8F=90=E7=A4=BA=EF=BC=9A=E4=BD=9C?= =?UTF-8?q?=E5=93=81=E5=90=8D=E7=A7=B0=E5=92=8C=E6=8F=8F=E8=BF=B0=E4=B8=AD?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E5=87=BA=E7=8E=B0=E5=AD=A6=E7=94=9F=E7=9A=84?= =?UTF-8?q?=E5=A7=93=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/new.html.erb | 5 +++++ 1 file changed, 5 insertions(+) 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|%>
    + <% if @homework.homework_type == 1%> +
    + 提示:匿评作业提交的作品,作品名称和描述中不能出现真实的姓名信息 +
    + <% end%>

    <%= f.text_field "name", :required => true, :size => 60, :class => "bo fl", :maxlength => 200, :placeholder => "作品名称", :onkeyup => "regexStudentWorkName();" %> From 7338f0d44ea253b322676102ecbe346c59eca7bb Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 1 Jul 2015 10:02:50 +0800 Subject: [PATCH 13/26] =?UTF-8?q?=E6=9C=AA=E5=AE=8C=E5=96=84=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E8=B5=84=E6=96=99=E7=9A=84=E7=94=A8=E6=88=B7=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E5=8F=AF=E4=BB=A5=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 27 ++++++++++----------------- app/services/courses_service.rb | 4 +++- config/locales/zh.yml | 1 + 3 files changed, 14 insertions(+), 18 deletions(-) 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/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/config/locales/zh.yml b/config/locales/zh.yml index 2a538138d..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: 修改成功 From fa1a03bef322d818ae5a5febb75cc45ac07325b0 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 1 Jul 2015 10:30:26 +0800 Subject: [PATCH 14/26] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E5=8F=AF=E6=9F=A5=E7=9C=8B=E4=B8=8B=E8=BD=BD=E7=A7=81?= =?UTF-8?q?=E6=9C=89=E8=AF=BE=E7=A8=8B=E7=9A=84=E7=A7=81=E6=9C=89=E8=B5=84?= =?UTF-8?q?=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 2 +- app/views/files/_course_list.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/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 @@

    <% 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? %>
    <%= link_to truncate(file.filename,length: 35, omission: '...'), From f9880a00fdd91dbcdf3bd292941abec28254415f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 1 Jul 2015 16:41:17 +0800 Subject: [PATCH 15/26] =?UTF-8?q?admin=E7=95=8C=E9=9D=A2=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8=E5=8F=8A=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 4 ++++ app/views/admin/courses.html.erb | 1 + config/routes.rb | 1 + lib/redmine.rb | 1 + 4 files changed, 7 insertions(+) create mode 100644 app/views/admin/courses.html.erb diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 8e23041c6..fbfdf24c2 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -41,6 +41,10 @@ class AdminController < ApplicationController render :action => "projects", :layout => false if request.xhr? end + def courses + + end + def users sort_init 'login', 'asc' sort_update %w(login firstname lastname mail admin created_on last_login_on) diff --git a/app/views/admin/courses.html.erb b/app/views/admin/courses.html.erb new file mode 100644 index 000000000..d1d06ad36 --- /dev/null +++ b/app/views/admin/courses.html.erb @@ -0,0 +1 @@ +1111 \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 8b8d4a401..dea176f54 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -635,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/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 From d48a7335025556540b355fe025a2ebff69737a02 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 1 Jul 2015 16:49:50 +0800 Subject: [PATCH 16/26] =?UTF-8?q?1=E3=80=81=E8=B0=83=E6=95=B4admin?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=A0=B7=E5=BC=8F=202=E3=80=81=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E5=BA=8F=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/admin/projects.html.erb | 112 ++++++++++++++++-------------- 1 file changed, 60 insertions(+), 52 deletions(-) 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 @@
    -<%= 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 %> -
    - +
    + <%= l(:label_filter_plural) %> - - - <%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %> - - <%= 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' %> -
    +
    + + <%= select_tag 'status', project_status_options_for_select(@status), :class => "small", :onchange => "this.form.submit(); return false;" %> + + <%= 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' %> +
    <% end %>  
    - - - - - - - - -<% project_tree(@projects) do |project, level| %> - <%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>"> - - - - - -<% end %> - -
    - <%=l(:label_project)%> - - <%=l(:field_is_public)%> - - <%=l(:field_created_on)%> -
    - - <%= link_to_project_settings(project, {}) %> - - - <%= 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| %> + <%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>"> + + + + + + + <% end %> + +
    + 序号 + + <%=l(:label_project)%> + + <%=l(:field_is_public)%> + + <%=l(:field_created_on)%> +
    + <%= project.id %> + + + <%= link_to_project_settings(project, {}) %> + + + <%= 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') %> +
    <% html_title(l(:label_project_plural)) -%> From 749b9c4429d6e4fa745ecd0c2db83919d6a43637 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 1 Jul 2015 17:02:30 +0800 Subject: [PATCH 17/26] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=A0=B9=E6=8D=AEID=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 2 +- app/models/project.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index fbfdf24c2..a01bba913 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -34,7 +34,7 @@ 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 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 From 07d95bdda9345c617224c7e268448555a784a638 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 1 Jul 2015 17:34:17 +0800 Subject: [PATCH 18/26] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 6 ++- app/views/admin/courses.html.erb | 77 ++++++++++++++++++++++++++++- config/locales/commons/zh.yml | 2 +- 3 files changed, 82 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index a01bba913..086ecfb7f 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -42,7 +42,11 @@ class AdminController < ApplicationController end def courses - + @name = params[:name] + @courses = Course.like(@name) + respond_to do |format| + format.html + end end def users diff --git a/app/views/admin/courses.html.erb b/app/views/admin/courses.html.erb index d1d06ad36..1615bccbc 100644 --- a/app/views/admin/courses.html.erb +++ b/app/views/admin/courses.html.erb @@ -1 +1,76 @@ -1111 \ No newline at end of file +
    + <%= link_to l(:label_course_new), {:controller => 'courses', :action => 'new'}, :class => 'icon icon-add' %> +
    + +

    + <%=l(:label_course_all)%> +

    + +<%= form_tag({}, :method => :get) do %> +
    + + <%= text_field_tag 'name', params[:name], :size => 30, :placeholder => '课程名称' %> + <%= submit_tag l(:button_apply), :class => "small", :name => nil %> + + <%= l(:button_clear)%> + +
    +<% end %> +  + +
    + + + + + + + + + + + + + <% @courses.each do |course| %> + "> + + + + + + + + <% end %> + +
    + 序号 + + 课程 + + 主讲老师 + + 学时 + + <%=l(:field_is_public)%> + + <%=l(:field_created_on)%> +
    + <%= course.id %> + + + <%= link_to(course.name, course_path(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) %> +
    +
    + +<% html_title(l(:label_course_all)) -%> 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: 文件 From af59cd9ba7757b4630a29a4bbfc7c94c93a0ca0a Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 2 Jul 2015 08:43:41 +0800 Subject: [PATCH 19/26] =?UTF-8?q?1=E3=80=81=E9=A1=B9=E7=9B=AEissue?= =?UTF-8?q?=E5=8C=BA=E5=88=86=E4=B8=BB=E8=B4=B4=E5=92=8C=E5=9B=9E=E5=B8=96?= =?UTF-8?q?=202=E3=80=81=E5=BC=95=E7=94=A8=E6=A8=A1=E5=BC=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/journals_controller.rb | 1 + app/models/mailer.rb | 2 +- app/views/issues/_edit.html.erb | 4 +++- app/views/issues/_history.html.erb | 8 +++++--- app/views/issues/show.html.erb | 3 +++ app/views/journals/new.js.erb | 6 +++--- 6 files changed, 16 insertions(+), 8 deletions(-) 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/models/mailer.rb b/app/models/mailer.rb index 340559828..0d0b82752 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -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在项目中留言(用户反馈) diff --git a/app/views/issues/_edit.html.erb b/app/views/issues/_edit.html.erb index f7594d000..444016db8 100644 --- a/app/views/issues/_edit.html.erb +++ b/app/views/issues/_edit.html.erb @@ -20,8 +20,10 @@ <%= render :partial => 'history', :locals => {:issue => @issue, :journals => @journals} %>
    <% end %> +
    +
    回复 - <%= f.text_area :notes, :style => "width:99%;", :rows => "5", :no_label => true %> + <%= f.text_area :notes, :style => "width:99%;", :rows => "5", :no_label => true %>
    diff --git a/app/views/issues/_history.html.erb b/app/views/issues/_history.html.erb index 04c46ed39..a5b1661eb 100644 --- a/app/views/issues/_history.html.erb +++ b/app/views/issues/_history.html.erb @@ -3,9 +3,9 @@
    -
    +
    -
    +
    <%= journal.user %><%= format_time journal.created_on %>
    @@ -20,7 +20,9 @@
    <%= render_links_easy(issue, journal, :reply_links => reply_links) unless journal.notes.blank? %>
    -

    <%= render_notes_issue(issue, journal, :reply_links => reply_links) unless journal.notes.blank? %>

    +

    + <%= render_notes_issue(issue, journal, :reply_links => reply_links) unless journal.notes.blank? %> +

    diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 1bd956074..c008e78f2 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -109,6 +109,9 @@ <%= render :partial => 'edit' %>

    + + + <%= 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; From d196b3930d6d31d6e90ffb8bc55d962653541d10 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 2 Jul 2015 09:42:35 +0800 Subject: [PATCH 20/26] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=95=99=E8=A8=80?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9C=9F=E5=AE=9E=E5=A7=93=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_history.html.erb | 2 +- app/views/words/_journal_reply_items.html.erb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/courses/_history.html.erb b/app/views/courses/_history.html.erb index df2737337..e9639f4f0 100644 --- a/app/views/courses/_history.html.erb +++ b/app/views/courses/_history.html.erb @@ -9,7 +9,7 @@
    - <%= 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"%> <%= format_time(journal.created_on) %> diff --git a/app/views/words/_journal_reply_items.html.erb b/app/views/words/_journal_reply_items.html.erb index d299c9123..f93254218 100644 --- a/app/views/words/_journal_reply_items.html.erb +++ b/app/views/words/_journal_reply_items.html.erb @@ -6,17 +6,17 @@
    <% 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 %>
    <% 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 %> From 2344e3d07f753e643e7dbdc363c24ccdc5203e20 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 2 Jul 2015 10:41:08 +0800 Subject: [PATCH 21/26] =?UTF-8?q?admin=E7=94=A8=E6=88=B7=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1=E6=96=87=E4=BB=B6=E5=88=97=E8=A1=A8=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/stores_controller.rb | 39 +++++++++++++++++++++++++++ app/views/stores/_search_bar.html.erb | 5 ++-- config/locales/zh.yml | 2 ++ config/routes.rb | 1 + 4 files changed, 45 insertions(+), 2 deletions(-) diff --git a/app/controllers/stores_controller.rb b/app/controllers/stores_controller.rb index b1705c826..85ea85241 100644 --- a/app/controllers/stores_controller.rb +++ b/app/controllers/stores_controller.rb @@ -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 diff --git a/app/views/stores/_search_bar.html.erb b/app/views/stores/_search_bar.html.erb index e4dea7a02..8a7481aa6 100644 --- a/app/views/stores/_search_bar.html.erb +++ b/app/views/stores/_search_bar.html.erb @@ -1,8 +1,9 @@ -
    +
    <%= 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;'%>    - <%= 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?%>
    <%= l(:label_resources_search_all)%>
    \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 1aab2a22c..4306b51c8 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2023,5 +2023,7 @@ zh: label_evaluation_common: 匿评评语 label_evaluation_time: 匿评时间 + label_file_lost_list: 缺失文件列表 + diff --git a/config/routes.rb b/config/routes.rb index dea176f54..0132b8fc6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -192,6 +192,7 @@ RedmineApp::Application.routes.draw do resources :stores do collection do match 'search', :via => [:get, :post] + get 'lost_file' end end From 5bacd5c7728d266e2c6aff297b2814dd48bd5823 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 2 Jul 2015 11:05:38 +0800 Subject: [PATCH 22/26] =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8?= =?UTF-8?q?=EF=BC=8C=E7=82=B9=E5=87=BB=E7=AE=AD=E5=A4=B4=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/_student_work_title.html.erb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/views/student_work/_student_work_title.html.erb b/app/views/student_work/_student_work_title.html.erb index 2a3a5e124..23e29b01b 100644 --- a/app/views/student_work/_student_work_title.html.erb +++ b/app/views/student_work/_student_work_title.html.erb @@ -13,30 +13,31 @@
  • <%= 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"%> - + <%= link_to "",student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> <% end%>
  • <%= 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"%> - + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> <% end%>
  • <%= 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"%> - + <%= 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%>
  • <%= 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"%> - + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> <% end%>
  • <%= 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"%> - + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "final_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> <% end%>
  • \ No newline at end of file From 05eeb27de84b8d4a21cbd0f125e266f9c04353e6 Mon Sep 17 00:00:00 2001 From: zhangshenjerry <1375181337@qq.com> Date: Thu, 2 Jul 2015 15:28:23 +0800 Subject: [PATCH 23/26] =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E7=9A=84=E6=94=B6?= =?UTF-8?q?=E7=BC=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/student_work/add_score_reply.js.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/student_work/add_score_reply.js.erb b/app/views/student_work/add_score_reply.js.erb index 2c6f1c9bf..28704630f 100644 --- a/app/views/student_work/add_score_reply.js.erb +++ b/app/views/student_work/add_score_reply.js.erb @@ -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%> \ No newline at end of file From 448cedc8427481e82a4469d79444dff247b81eef Mon Sep 17 00:00:00 2001 From: zhangshenjerry <1375181337@qq.com> Date: Thu, 2 Jul 2015 15:30:09 +0800 Subject: [PATCH 24/26] =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E7=9A=84=E6=94=B6?= =?UTF-8?q?=E7=BC=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/courses.css | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 0bd28bea7..f6cb6199b 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -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; +} From a6e80ed938898fed7737026061b10df93dda44fd Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 2 Jul 2015 15:30:30 +0800 Subject: [PATCH 25/26] =?UTF-8?q?=E9=83=A8=E5=88=86=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=8F=B3=E4=B8=8A=E8=A7=92=E4=B8=8B=E6=8B=89=E6=A1=86=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=88=91=E7=9A=84=E8=AF=BE=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_base_header.html.erb | 15 +++++++-------- app/views/layouts/_new_header.html.erb | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/views/layouts/_base_header.html.erb b/app/views/layouts/_base_header.html.erb index fa8787122..b800a1722 100644 --- a/app/views/layouts/_base_header.html.erb +++ b/app/views/layouts/_base_header.html.erb @@ -17,15 +17,14 @@ visiable = hidden_non_project && hidden_non_project.value == "0"%>