From bb8a6af13e35eeaa1ce73ff8a15b5e57bc425285 Mon Sep 17 00:00:00 2001 From: linchun Date: Fri, 4 Mar 2016 15:31:40 +0800 Subject: [PATCH 01/19] =?UTF-8?q?admin=E7=95=8C=E9=9D=A2=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=B2=BE=E5=93=81=E8=AF=BE=E7=A8=8B=E9=A1=B5=E9=9D=A2=EF=BC=8C?= =?UTF-8?q?=E7=9B=AE=E5=89=8D=E8=AF=A5=E9=A1=B5=E9=9D=A2=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E7=B2=BE=E5=93=81=E8=AF=BE=E7=A8=8B=E6=98=AF=E5=9B=BA=E5=AE=9A?= =?UTF-8?q?=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 7 ++ app/helpers/courses_helper.rb | 5 ++ app/views/admin/excellent_courses.html.erb | 75 ++++++++++++++++++++++ config/locales/en.yml | 1 + config/locales/zh.yml | 1 + config/routes.rb | 1 + db/schema.rb | 7 +- lib/redmine.rb | 1 + 8 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 app/views/admin/excellent_courses.html.erb diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 01703f679..1701e6b7c 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -49,6 +49,13 @@ class AdminController < ApplicationController end end + def excellent_courses + @courses = Course.where("is_excellent =? or excellent_option =?", 1, 1 ) + 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/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 2cdb277be..1875f920d 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -71,6 +71,11 @@ module CoursesHelper project.members.count end + # 统计课程中作品的数量 + def student_works_num course + StudentWork.find_by_sql("SELECT * FROM student_works WHERE homework_common_id IN (SELECT id FROM homework_commons WHERE course_id = '#{course.id}')").count + end + # 返回教师数量,即roles表中定义的Manager def teacherCount project project ? project.members.count - studentCount(project).to_i : 0 diff --git a/app/views/admin/excellent_courses.html.erb b/app/views/admin/excellent_courses.html.erb new file mode 100644 index 000000000..e21ba32aa --- /dev/null +++ b/app/views/admin/excellent_courses.html.erb @@ -0,0 +1,75 @@ +

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

+ +
+ + + + + + + + + + + + + + + + <% @courses.each do |course| %> + "> + + + + + + + + + + + <% end %> + +
+ 序号 + + 课程名 + + 主讲老师 + + 学生数 + + 作业数 + + 作品数 + + 资源数 + + 帖子数 + + 动态数 +
+ <%= course.id %> + + + <%= link_to(course.name, course_path(course.id)) %> + + + <%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %> + + <%= studentCount(course) %> + + <%= course.homework_commons.count%> + + <%= student_works_num(course) %> + + <%= visable_attachemnts_incourse(course).count%> + + <%= course.boards.first.topics.count + Message.where("board_id =? and parent_id is not ?", course.boards.first.id, nil).count %> + + + <%= course.course_activities.count%> +
+
\ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 2bed45103..ec4d69147 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1520,6 +1520,7 @@ en: label_submit_comments: Submit_comments label_course_empty_select: You have not selected course! label_enterprise_page_made: enterprise_page + label_excellent_courses_list: excellent_courses #api label_recently_updated_notification: Recently updated notification diff --git a/config/locales/zh.yml b/config/locales/zh.yml index e9d3ed813..98983ffa7 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -483,6 +483,7 @@ zh: label_requirement: 需求 label_new_course: 课程列表 label_course_all: 课程列表 + label_excellent_courses_list: 精品课程列表 label_teacher_all: 所有教师 label_requirement_enterprise_list: 众包列表 label_new_homework: 作业 diff --git a/config/routes.rb b/config/routes.rb index 7754365ad..445cecaf9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -933,6 +933,7 @@ RedmineApp::Application.routes.draw do match 'admin', :to => 'admin#index', :via => :get match 'admin/projects', :via => :get get 'admin/courses' + get 'admin/excellent_courses' match 'admin/users', :via => :get match 'admin/messages', :via => :get match 'admin/first_page_made', as: :first_page_made diff --git a/db/schema.rb b/db/schema.rb index 2593e09fd..2dad292f4 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 => 20160224074034) do +ActiveRecord::Schema.define(:version => 20160225031230) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -2013,6 +2013,11 @@ ActiveRecord::Schema.define(:version => 20160224074034) do add_index "wikis", ["project_id"], :name => "wikis_project_id" + create_table "wlcs", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "workflows", :force => true do |t| t.integer "tracker_id", :default => 0, :null => false t.integer "old_status_id", :default => 0, :null => false diff --git a/lib/redmine.rb b/lib/redmine.rb index 8ebdacfa6..7bb43f905 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -391,6 +391,7 @@ Redmine::MenuManager.map :admin_menu do |menu| menu.push :messages_list, {:controller => 'admin', :action => 'messages_list'}, :caption => :label_message_plural menu.push :notices, {:controller => 'admin', :action => 'notices'}, :caption => :label_notification_list menu.push :latest_login_users, {:controller => 'admin', :action => 'latest_login_users'}, :caption => :label_latest_login_user_list + menu.push :excellent_courses, {:controller => 'admin', :action => 'excellent_courses'}, :caption => :label_excellent_courses_list menu.push :homework, {:controller => 'admin', :action => 'homework'}, :caption => :label_user_homework end From b7f4b584f2c83d16456574a1c6bfc11caf0824c3 Mon Sep 17 00:00:00 2001 From: linchun Date: Mon, 7 Mar 2016 16:46:02 +0800 Subject: [PATCH 02/19] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E7=95=8C=E9=9D=A2=E8=AF=BE=E7=A8=8B=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 14 ++++ app/views/admin/course_resource_list.html.erb | 67 +++++++++++++++++++ .../_search_attachment_results.html.erb | 2 +- config/locales/en.yml | 1 + config/locales/zh.yml | 1 + config/routes.rb | 1 + lib/redmine.rb | 1 + 7 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 app/views/admin/course_resource_list.html.erb diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 1701e6b7c..4259aa333 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -49,6 +49,7 @@ class AdminController < ApplicationController end end + #管理员界面精品课程列表 def excellent_courses @courses = Course.where("is_excellent =? or excellent_option =?", 1, 1 ) respond_to do |format| @@ -56,6 +57,19 @@ class AdminController < ApplicationController end end + #管理员界面课程资源列表 + def course_resource_list + @resource = Attachment.find_all_by_container_id(12) + + @resource = paginateHelper @resource,30 + @page = (params['page'] || 1).to_i - 1 + + 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/views/admin/course_resource_list.html.erb b/app/views/admin/course_resource_list.html.erb new file mode 100644 index 000000000..7a2ac1af1 --- /dev/null +++ b/app/views/admin/course_resource_list.html.erb @@ -0,0 +1,67 @@ +

<%=l(:label_course_resource_list)%>

+ + +
+ + + + + + + + + + + + + + + <% @resource.each do |resource| %> + "> + + + + + + + + + <% end %> + + + + +
+ 资源名称 + + 资源大小 + + 资源类型 + + 上传时间 + + 下载次数 + + 上传者 + + 所属课程 +
+ <%= resource.filename %> + + <%= number_to_human_size(resource.filesize)%> + + 课程资源 + + <%= format_date(resource.created_on)%> + + <%= resource.downloads %> + + <%= link_to(User.find(resource.author_id).realname, user_path(User.find(resource.author_id)) ) %> + + <%=link_to Course.find(resource.container_id).name, course_path(Course.find(resource.container_id)), :class => "hidden fl w170" %> +
+
+ + \ No newline at end of file diff --git a/app/views/welcome/_search_attachment_results.html.erb b/app/views/welcome/_search_attachment_results.html.erb index 21ba68336..e51706085 100644 --- a/app/views/welcome/_search_attachment_results.html.erb +++ b/app/views/welcome/_search_attachment_results.html.erb @@ -21,6 +21,6 @@ <% end %>
- <%= paginate attachments,:params => {:controller => 'welcome', :action => 'search',:search_type=>'attachment'}%> + {:controller => 'welcome', :action => 'search',:search_type=>'attachment'}%>
<% end %> \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index ec4d69147..86a285342 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1521,6 +1521,7 @@ en: label_course_empty_select: You have not selected course! label_enterprise_page_made: enterprise_page label_excellent_courses_list: excellent_courses + label_course_resource_list: course_resource_list #api label_recently_updated_notification: Recently updated notification diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 98983ffa7..8884b0e67 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -484,6 +484,7 @@ zh: label_new_course: 课程列表 label_course_all: 课程列表 label_excellent_courses_list: 精品课程列表 + label_course_resource_list: 课程资源列表 label_teacher_all: 所有教师 label_requirement_enterprise_list: 众包列表 label_new_homework: 作业 diff --git a/config/routes.rb b/config/routes.rb index 445cecaf9..e92590895 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -934,6 +934,7 @@ RedmineApp::Application.routes.draw do match 'admin/projects', :via => :get get 'admin/courses' get 'admin/excellent_courses' + get 'admin/course_resource_list' match 'admin/users', :via => :get match 'admin/messages', :via => :get match 'admin/first_page_made', as: :first_page_made diff --git a/lib/redmine.rb b/lib/redmine.rb index 7bb43f905..21309b710 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -392,6 +392,7 @@ Redmine::MenuManager.map :admin_menu do |menu| menu.push :notices, {:controller => 'admin', :action => 'notices'}, :caption => :label_notification_list menu.push :latest_login_users, {:controller => 'admin', :action => 'latest_login_users'}, :caption => :label_latest_login_user_list menu.push :excellent_courses, {:controller => 'admin', :action => 'excellent_courses'}, :caption => :label_excellent_courses_list + menu.push :var, {:controller => 'admin', :action => 'course_resource_list'}, :caption => :label_course_resource_list menu.push :homework, {:controller => 'admin', :action => 'homework'}, :caption => :label_user_homework end From 3c66a297673f1f6ee3102a5c0049c984783307e0 Mon Sep 17 00:00:00 2001 From: linchun Date: Tue, 8 Mar 2016 11:01:08 +0800 Subject: [PATCH 03/19] =?UTF-8?q?=E5=AE=8C=E5=96=84=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=88=97=E8=A1=A8=EF=BC=8C=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=B5=84=E6=BA=90=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 16 ++++- app/views/admin/course_resource_list.html.erb | 21 +++--- .../admin/project_resource_list.html.erb | 64 +++++++++++++++++++ config/locales/en.yml | 1 + config/locales/zh.yml | 1 + config/routes.rb | 1 + lib/redmine.rb | 3 +- 7 files changed, 91 insertions(+), 16 deletions(-) create mode 100644 app/views/admin/project_resource_list.html.erb diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 4259aa333..7ff36c11d 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -59,17 +59,27 @@ class AdminController < ApplicationController #管理员界面课程资源列表 def course_resource_list - @resource = Attachment.find_all_by_container_id(12) - + @resource = Attachment.where(:container_type => 'Course') @resource = paginateHelper @resource,30 @page = (params['page'] || 1).to_i - 1 respond_to do |format| format.html end - end + #管理员界面項目资源列表 + def project_resource_list + @pro_resource = Attachment.where(:container_type => 'Project') + @pro_resource = paginateHelper @pro_resource,30 + @page = (params['page'] || 1).to_i - 1 + + 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/views/admin/course_resource_list.html.erb b/app/views/admin/course_resource_list.html.erb index 7a2ac1af1..4316555f7 100644 --- a/app/views/admin/course_resource_list.html.erb +++ b/app/views/admin/course_resource_list.html.erb @@ -6,25 +6,25 @@ - + 资源名称 - + 资源大小 - + 资源类型 - + 上传时间 - + 下载次数 上传者 - + 所属课程 @@ -33,10 +33,10 @@ <% @resource.each do |resource| %> "> - <%= resource.filename %> + <%= link_to truncate(resource.filename, :length => 18), download_named_attachment_path(resource.id, resource.filename ), :title => resource.filename,:class=>'resourcesBlack'%> - <%= number_to_human_size(resource.filesize)%> + <%= number_to_human_size(resource.filesize)%> 课程资源 @@ -51,13 +51,10 @@ <%= link_to(User.find(resource.author_id).realname, user_path(User.find(resource.author_id)) ) %> - <%=link_to Course.find(resource.container_id).name, course_path(Course.find(resource.container_id)), :class => "hidden fl w170" %> + <%=link_to truncate(Course.find(resource.container_id).name, :length => 10), course_path(Course.find(resource.container_id)), :title => Course.find(resource.container_id).name, :class => "hidden fl w170" %> <% end %> - - - diff --git a/app/views/admin/project_resource_list.html.erb b/app/views/admin/project_resource_list.html.erb new file mode 100644 index 000000000..c245f73b8 --- /dev/null +++ b/app/views/admin/project_resource_list.html.erb @@ -0,0 +1,64 @@ +

<%=l(:label_project_resource_list)%>

+ + +
+ + + + + + + + + + + + + + + <% @pro_resource.each do |pro_resource| %> + "> + + + + + + + + + <% end %> + +
+ 资源名称 + + 资源大小 + + 资源类型 + + 上传时间 + + 下载次数 + + 上传者 + + 所属项目 +
+ <%= link_to truncate(pro_resource.filename, :length => 18), download_named_attachment_path(pro_resource.id, pro_resource.filename ), :title => pro_resource.filename,:class=>'resourcesBlack'%> + + <%= number_to_human_size(pro_resource.filesize)%> + + 项目资源 + + <%= format_date(pro_resource.created_on)%> + + <%= pro_resource.downloads %> + + <%= link_to(User.find(pro_resource.author_id).realname, user_path(User.find(pro_resource.author_id)) ) %> + + <%=link_to truncate(Project.find(pro_resource.container_id).name, :length => 10), project_path(Project.find(pro_resource.container_id)), :title => Project.find(pro_resource.container_id).name, :class => "hidden fl w170" %> +
+
+ + \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 86a285342..3da533eb7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1522,6 +1522,7 @@ en: label_enterprise_page_made: enterprise_page label_excellent_courses_list: excellent_courses label_course_resource_list: course_resource_list + label_project_resource_list: project_resource_list #api label_recently_updated_notification: Recently updated notification diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 8884b0e67..b6bd6afa4 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -485,6 +485,7 @@ zh: label_course_all: 课程列表 label_excellent_courses_list: 精品课程列表 label_course_resource_list: 课程资源列表 + label_project_resource_list: 項目资源列表 label_teacher_all: 所有教师 label_requirement_enterprise_list: 众包列表 label_new_homework: 作业 diff --git a/config/routes.rb b/config/routes.rb index e92590895..de1d9d652 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -935,6 +935,7 @@ RedmineApp::Application.routes.draw do get 'admin/courses' get 'admin/excellent_courses' get 'admin/course_resource_list' + get 'admin/project_resource_list' match 'admin/users', :via => :get match 'admin/messages', :via => :get match 'admin/first_page_made', as: :first_page_made diff --git a/lib/redmine.rb b/lib/redmine.rb index 21309b710..47ee3d38f 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -392,7 +392,8 @@ Redmine::MenuManager.map :admin_menu do |menu| menu.push :notices, {:controller => 'admin', :action => 'notices'}, :caption => :label_notification_list menu.push :latest_login_users, {:controller => 'admin', :action => 'latest_login_users'}, :caption => :label_latest_login_user_list menu.push :excellent_courses, {:controller => 'admin', :action => 'excellent_courses'}, :caption => :label_excellent_courses_list - menu.push :var, {:controller => 'admin', :action => 'course_resource_list'}, :caption => :label_course_resource_list + menu.push :course_resource_list, {:controller => 'admin', :action => 'course_resource_list'}, :caption => :label_course_resource_list + menu.push :project_resource_list, {:controller => 'admin', :action => 'project_resource_list'}, :caption => :label_project_resource_list menu.push :homework, {:controller => 'admin', :action => 'homework'}, :caption => :label_user_homework end From c2553253006460c3533f7e00d3ca80b09df59671 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 10 Mar 2016 15:47:03 +0800 Subject: [PATCH 04/19] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=86=E7=8F=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_new_member_list.html.erb | 54 ++++++++++++++++++++- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/app/views/courses/_new_member_list.html.erb b/app/views/courses/_new_member_list.html.erb index fd33d5a19..65429b995 100644 --- a/app/views/courses/_new_member_list.html.erb +++ b/app/views/courses/_new_member_list.html.erb @@ -24,7 +24,8 @@
  • 姓名
  • 学号
  • -
  • +
  • 分班
  • +
  • <%= link_to '作业积分', member_score_sort_course_path(:sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? @group.id : 0),:search_name => (@search_name ? @search_name : nil)) ,:result => members,method: 'get', remote: true%> <% if @score_sort_by == 'desc' %> @@ -58,11 +59,26 @@
  • <%= link_to("#{l(:label_bidding_user_studentcode)}:#{member.user.user_extensions.student_id}".html_safe,user_path(member.user)) %>
  • <% end%>
+ <% if User.current.allowed_to?(:as_teacher, @course) || User.current.admin? %> +
+
+ + <% else %> +
+ +
+ <% end %> <%= link_to format("%0.2f",member.score.nil? ? 0 : member.score.to_s), { :action => 'show_member_score', :member_id => member.id, :remote => true}, - :class => 'ml258 c_red' %> + :class => 'ml25 c_red' %> <%= format_date(member.created_on)%> <%= call_hook(:view_projects_settings_members_table_row, { :course => @course, :member => member}) %> @@ -79,3 +95,37 @@

<% end%> + + From fa3fd56686962c2a317f9f44204844384c2029bf Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 10 Mar 2016 15:48:39 +0800 Subject: [PATCH 05/19] =?UTF-8?q?=E9=A2=98=E5=BA=93=E5=8F=91=E9=80=81?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=9A=84=E5=BC=B9=E6=A1=86=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ea984aa80..96fb8cfce 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -423,7 +423,7 @@ class UsersController < ApplicationController end def choose_user_course - homework = HomeworkCommon.find params[:homework].to_i + homework = HomeworkCommon.find params[:send_id].to_i if !params[:search].nil? search = "%#{params[:search].to_s.strip.downcase}%" @course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id} and #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p",:p=>search).select { |course| @user.allowed_to?(:as_teacher,course)} From 08cb7b642c9471640863deeedc75ea7fe48afc0f Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 10 Mar 2016 16:43:25 +0800 Subject: [PATCH 06/19] =?UTF-8?q?=E9=99=84=E4=BB=B6=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_upload_course_files.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/files/_upload_course_files.erb b/app/views/files/_upload_course_files.erb index 133b8b4d6..0a35c783c 100644 --- a/app/views/files/_upload_course_files.erb +++ b/app/views/files/_upload_course_files.erb @@ -25,7 +25,7 @@
- +
From 0d8052da28e9308c51c32bab42da3186af2643b8 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 10 Mar 2016 17:04:26 +0800 Subject: [PATCH 07/19] =?UTF-8?q?=E8=80=81=E5=B8=88=E6=8A=8A=E5=AD=A6?= =?UTF-8?q?=E7=94=9F=E5=8A=A0=E5=85=A5=E6=9F=90=E4=B8=80=E4=B8=AA=E5=88=86?= =?UTF-8?q?=E7=8F=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 7 ++++ app/helpers/courses_helper.rb | 18 ++++++++++ app/views/courses/_new_member_list.html.erb | 35 +++++++++++++------ app/views/courses/teacher_assign_group.js.erb | 0 config/routes.rb | 1 + 5 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 app/views/courses/teacher_assign_group.js.erb diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 708ac9a14..81c21eb3d 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -240,6 +240,13 @@ class CoursesController < ApplicationController # req[:message] = l(:modal_valid_passing) if req[:message].blank? render :json => req end + + def teacher_assign_group + member = Member.where(:course_id => @course.id, :user_id => User.current.id).first + member.course_group_id = params[:course_group_id].to_i + member.save + end + def join_group @subPage_title = l :label_student_list group = CourseGroup.find(params[:object_id]) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index cbc514df6..148b20d2e 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -601,6 +601,24 @@ module CoursesHelper Course.tagged_with(tag_name).order('updated_at desc') end + #分班下拉框 + def course_group_option course + type = [] + option1 = [] + option1 << "暂无" + option1 << 0 + type << option1 + unless course.course_groups.nil? + course.course_groups.each do |cg| + option = [] + option << cg.name + option << cg.id + type << option + end + end + type + end + #课程实践年份下拉框 def course_time_option year type = [] diff --git a/app/views/courses/_new_member_list.html.erb b/app/views/courses/_new_member_list.html.erb index 65429b995..12a5d9626 100644 --- a/app/views/courses/_new_member_list.html.erb +++ b/app/views/courses/_new_member_list.html.erb @@ -60,18 +60,30 @@ <% end%> <% if User.current.allowed_to?(:as_teacher, @course) || User.current.admin? %> -
-
- + <% if @course.course_groups.nil? %> +
+ +
+ <% else %> + <%= form_tag({:controller => 'courses', :action => 'teacher_assign_group', :id => @course.id},:remote=>'true', :method => 'post', :id=>"join_group_form_#{member.id}", :class => 'query_form') do %> +
+ +
+ <%= select( :name,:group_id, course_group_option(@course), + { :include_blank => false,:selected => member.course_group_id}, + {:onchange=>"join_group_function('#join_group_form_#{member.id}');", :id =>"course_group_id", :name => "course_group_id",:class=>"w125 undis class-edit fl", :style => "margin-left: 105px;"}) %> + + <% end %> + <% end %> <% else %>
- +
<% end %> <%= link_to format("%0.2f",member.score.nil? ? 0 : member.score.to_s), { @@ -127,5 +139,8 @@ stopPropagation(e); }); }); + function join_group_function(id){ + $(id).submit(); + } diff --git a/app/views/courses/teacher_assign_group.js.erb b/app/views/courses/teacher_assign_group.js.erb new file mode 100644 index 000000000..e69de29bb diff --git a/config/routes.rb b/config/routes.rb index dd02bf4af..2730fac3e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1005,6 +1005,7 @@ RedmineApp::Application.routes.draw do get 'course_outline' post 'search_course_outline' post 'set_course_outline' + post 'teacher_assign_group' get 'syllabus' get 'search_public_orgs_not_in_course' get "homework_search" From a7b9d8424a6440c595cceceb4e5b6d62f6035efe Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 10 Mar 2016 17:41:53 +0800 Subject: [PATCH 08/19] =?UTF-8?q?=E5=8F=AA=E6=9C=89=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=B8=AD=E7=9A=84=E5=AD=A6=E7=94=9F=E5=8F=AF?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=88=86=E7=8F=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 7 ++++++- app/views/courses/_new_member_list.html.erb | 6 +++--- app/views/courses/teacher_assign_group.js.erb | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 81c21eb3d..98e195e30 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -242,9 +242,14 @@ class CoursesController < ApplicationController end def teacher_assign_group - member = Member.where(:course_id => @course.id, :user_id => User.current.id).first + member = Member.where(:course_id => @course.id, :user_id => params[:user_id]).first member.course_group_id = params[:course_group_id].to_i member.save + @course_groups = @course.course_groups + @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' + respond_to do |format| + format.js + end end def join_group diff --git a/app/views/courses/_new_member_list.html.erb b/app/views/courses/_new_member_list.html.erb index 12a5d9626..b399c6035 100644 --- a/app/views/courses/_new_member_list.html.erb +++ b/app/views/courses/_new_member_list.html.erb @@ -60,12 +60,12 @@ <% end%> <% if User.current.allowed_to?(:as_teacher, @course) || User.current.admin? %> - <% if @course.course_groups.nil? %> + <% if @course.course_groups.nil? || @group %>
- +
<% else %> - <%= form_tag({:controller => 'courses', :action => 'teacher_assign_group', :id => @course.id},:remote=>'true', :method => 'post', :id=>"join_group_form_#{member.id}", :class => 'query_form') do %> + <%= form_tag({:controller => 'courses', :action => 'teacher_assign_group', :id => @course.id,:user_id => member.user_id},:remote=>'true', :method => 'post', :id=>"join_group_form_#{member.id}", :class => 'query_form') do %>
diff --git a/app/views/courses/teacher_assign_group.js.erb b/app/views/courses/teacher_assign_group.js.erb index e69de29bb..1429bb753 100644 --- a/app/views/courses/teacher_assign_group.js.erb +++ b/app/views/courses/teacher_assign_group.js.erb @@ -0,0 +1 @@ +$("#st_groups").html("<%=escape_javascript(render :partial => 'new_groups_name', :locals => {:course_groups => @course_groups}) %>"); \ No newline at end of file From 2812fcd2fba277da372c719651d41d6081a032db Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Mar 2016 10:45:29 +0800 Subject: [PATCH 09/19] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/_new_member_list.html.erb | 7 ------- 1 file changed, 7 deletions(-) diff --git a/app/views/courses/_new_member_list.html.erb b/app/views/courses/_new_member_list.html.erb index b399c6035..bf69c3a61 100644 --- a/app/views/courses/_new_member_list.html.erb +++ b/app/views/courses/_new_member_list.html.erb @@ -72,13 +72,6 @@ <%= select( :name,:group_id, course_group_option(@course), { :include_blank => false,:selected => member.course_group_id}, {:onchange=>"join_group_function('#join_group_form_#{member.id}');", :id =>"course_group_id", :name => "course_group_id",:class=>"w125 undis class-edit fl", :style => "margin-left: 105px;"}) %> - <% end %> <% end %> <% else %> From ef5625ccdf614a07bc86a85cb21503b18b136af6 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Mar 2016 11:17:44 +0800 Subject: [PATCH 10/19] =?UTF-8?q?=E5=BB=B6=E6=9C=9F=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E7=9A=84=E8=AF=BE=E7=A8=8B=E8=B5=84=E6=BA=90=E8=AE=BE=E4=B8=BA?= =?UTF-8?q?=E5=85=AC=E5=BC=80=E5=90=8E=E4=B8=8D=E5=BA=94=E5=AF=B9=E5=AD=A6?= =?UTF-8?q?=E7=94=9F=E5=8F=AF=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/courses_helper.rb | 2 +- app/helpers/files_helper.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 148b20d2e..3989ad724 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -780,7 +780,7 @@ module CoursesHelper return[] unless course result = [] course.attachments.each do |attachment| - if attachment.is_public? ||User.current == attachment.author ||User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id))|| (User.current.member_of_course?(course) && attachment.is_publish == 1) || User.current.admin? + if (attachment.is_public? && attachment.is_publish == 1) ||User.current == attachment.author ||User.current.allowed_to?(:as_teacher,course)|| (User.current.member_of_course?(course) && attachment.is_publish == 1) || User.current.admin? result << attachment end end diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index 238999a71..913c49310 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -121,7 +121,8 @@ module FilesHelper def visable_attachemnts attachments result = [] attachments.each do |attachment| - if attachment.is_public? || + if (attachment.is_public? && attachment.container_type != "Course") || + (attachment.is_public? && attachment.container_type == "Course" && attachment.is_publish == 1)|| (attachment.container_type == "Project" && User.current.member_of?(attachment.project)) || (attachment.container_type == "Course" && User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id)))|| (attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)) && attachment.is_publish == 1)|| From 94c1e380663a9a1cb454a298f1ed140fce2cae2c Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Mar 2016 11:23:16 +0800 Subject: [PATCH 11/19] =?UTF-8?q?=E5=88=86=E7=BB=84=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E4=B8=AD=E7=9A=84=E2=80=9C=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E2=80=9D=E6=9B=B4=E6=8D=A2=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_org_course_homework.html.erb | 2 +- app/views/users/_course_homework.html.erb | 2 +- app/views/users/_user_homework_detail.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 499ea6357..53e550c1d 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -47,7 +47,7 @@ <% end%>
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1%> - 系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合! + 系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"linkBlue",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合! <% elsif activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 0%> 系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合! <% end %> diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 9dd5eaa7a..09a3cf052 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -47,7 +47,7 @@ <% end%>
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1%> - 系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合! + 系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"linkBlue",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合! <% elsif activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 0%> 系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合! <% end %> diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 9f3847735..8503b564c 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -48,7 +48,7 @@ <% end%>
<% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1%> - 系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合! + 系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"linkBlue",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合! <% elsif homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 0%> 系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合! <% end %> From dcd13b9d6ba1d09a799f2eb8fe1b259c1d96c44d Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Mar 2016 11:34:16 +0800 Subject: [PATCH 12/19] =?UTF-8?q?=E7=82=B9=E5=87=BB=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=B8=BB=E9=A1=B5=E7=9A=84=E8=AF=BE=E7=A8=8B=E5=92=8C=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=9C=A8=E6=96=B0=E7=9A=84tab=E9=A1=B5=E4=B8=AD?= =?UTF-8?q?=E6=89=93=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_user_courses.html.erb | 2 +- app/views/layouts/_user_projects.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/_user_courses.html.erb b/app/views/layouts/_user_courses.html.erb index 7aa591aae..30a911d09 100644 --- a/app/views/layouts/_user_courses.html.erb +++ b/app/views/layouts/_user_courses.html.erb @@ -2,7 +2,7 @@
  • <% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %> <%= link_to course.name, course_path(course.id,:host=>Setting.host_course), :class => "coursesLineGrey hidden #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}", - :id => "show_course_#{course.id}",:title => (course.is_public? ? "公开课程:":"私有课程:")+course.name+"("+current_time_and_term(course)+")"%> + :id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开课程:":"私有课程:")+course.name+"("+current_time_and_term(course)+")"%> <% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count %>
    • diff --git a/app/views/layouts/_user_projects.html.erb b/app/views/layouts/_user_projects.html.erb index e249a0f37..a82ea4103 100644 --- a/app/views/layouts/_user_projects.html.erb +++ b/app/views/layouts/_user_projects.html.erb @@ -1,7 +1,7 @@ <% projects.each do |project|%>
    • <% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count %> - <%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :class => "coursesLineGrey hidden",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%> + <%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "coursesLineGrey hidden",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>
      • - <%=render :partial=>'homework_repository_search', :locals=>{:type => @type,:is_import => 0,:property => @property} %> + <%=render :partial=>'homework_repository_search', :locals=>{:type => @type,:is_import => 0,:property => @property} %>
        -
        -
        -
          - -
        • 来源
        • -
        • 类别
        • -
        • 贡献者
        • -
        • 引用数
        • -
        • 发布时间
        • -
        -
        - <%=render :partial => 'homework_repository', :locals => {:homeworks => @homeworks} %> +
        + <%=render :partial => 'homework_repository_list', :locals => {:homeworks => @homeworks,:type=>@type,:is_import => 0,:property => @property,:search=>''} %> +
        +
        + <%=render :partial => 'homework_repository_detail', :locals => {:homework => nil} %> +
        +
        +
        +
          + <%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true%> +
        +
        +
        + 发送至 +
        + +
        - -
        - <%=render :partial => 'homework_repository_detail', :locals => {:homework => nil} %> -
        -
        -
        -
          - <%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true%> -
        -
        -
        - 发送至 -
        - - - \ No newline at end of file diff --git a/app/views/users/user_homeworks.js.erb b/app/views/users/user_homeworks.js.erb index a24b3d018..ce1bb65e2 100644 --- a/app/views/users/user_homeworks.js.erb +++ b/app/views/users/user_homeworks.js.erb @@ -1,3 +1,4 @@ -$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>'); +/*$("#homework_repository").html('<%#= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');*/ +$("#homework_repository_list").html('<%= escape_javascript(render :partial => 'users/homework_repository_list', :locals => {:homeworks => @homeworks,:sort => @order,:b_sort => @b_sort,:type=>@type,:is_import => 0,:property => @property,:search=>''})%>'); $("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>'); $("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>"); diff --git a/app/views/users/user_search_homeworks.js.erb b/app/views/users/user_search_homeworks.js.erb index 34d73b823..29d490960 100644 --- a/app/views/users/user_search_homeworks.js.erb +++ b/app/views/users/user_search_homeworks.js.erb @@ -3,7 +3,7 @@ $("#homework_list_form_show").html('<%= escape_javascript(render :partial => 'us $("#homewrok_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>'); $("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>nil}) %>"); <% else %> -$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>'); +$("#homework_repository_list").html('<%= escape_javascript(render :partial => 'users/homework_repository_list', :locals => {:homeworks => @homeworks,:sort => @order,:b_sort => @b_sort,:type=>@type,:is_import => @is_import,:property => @property,:search=>@search})%>'); $("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>'); $("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>"); <% end %> \ No newline at end of file diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 693e417c1..355930728 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -1480,3 +1480,8 @@ a.choose-active {background-color:#269ac9; color:#ffffff;} .subject-list-type {width:50px; text-align:center;} .subject-list-count {width:60px; text-align:center;} .subject-list-from {width:105px; text-align:center;} + +a.st_up{ display: block; width:8px; float:left; height:13px; background:url(../images/pic_up.png) 0 0 no-repeat; margin-top:5px; margin-left:3px;} +a.st_down{ display: block; width:8px; float:left; height:13px; background:url(../images/pic_up.png) 0 -22px no-repeat; margin-top:5px; margin-left:3px;} +a.st_img { display:block;width:32px; height:32px; border:1px solid #CCC; padding:1px;} +a:hover.st_img { border:1px solid #1c9ec7; } From a845da5c17d3b6a0fe3218024e02004ee885d3ce Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Mar 2016 19:25:24 +0800 Subject: [PATCH 19/19] =?UTF-8?q?=E7=82=B9=E8=B5=9E=E6=9C=89=E5=BB=B6?= =?UTF-8?q?=E8=BF=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/praise_tread.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/praise_tread.rb b/app/models/praise_tread.rb index 3df5c72d9..b1b7e0908 100644 --- a/app/models/praise_tread.rb +++ b/app/models/praise_tread.rb @@ -2,8 +2,8 @@ class PraiseTread < ActiveRecord::Base attr_accessible :user_id,:praise_tread_object_id,:praise_tread_object_type,:praise_or_tread belongs_to :user belongs_to :praise_tread_object, polymorphic: true - after_create :be_user_score - after_destroy :down_user_score + #after_create :be_user_score + #after_destroy :down_user_score include UserScoreHelper def self.find_object_by_type_and_id(type,id) @obj = nil