diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index ad6d568a5..6c95294d7 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -202,7 +202,16 @@ class AccountController < ApplicationController def email_valid end + def resendmail + user = User.find(params[:user]) if params[:user] + token = Token.new(:user => user, :action => "register") + if token.save + Mailer.register(token).deliver + else + yield if block_given? + end + end private def authenticate_user diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 63b8294e7..12852c63d 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -23,7 +23,7 @@ class CoursesController < ApplicationController before_filter :require_login, :only => [:join, :unjoin] #before_filter :allow_join, :only => [:join] - + @@result = nil def join if User.current.logged? course = Course.find_by_id params[:object_id] @@ -296,6 +296,7 @@ class CoursesController < ApplicationController else @results = searchStudent(@course) end + @@result = @results @members = searchStudent(@course) @membercount = @members.count @results = paginateHelper @results @@ -308,6 +309,7 @@ class CoursesController < ApplicationController @members = searchStudent(@course) @membercount = @members.count @results = searchStudent_by_group(group, @course) + @@result = @results @results = paginateHelper @results end def member @@ -326,13 +328,14 @@ class CoursesController < ApplicationController when '2' @subPage_title = l :label_student_list - @members = searchStudent(@course) - @membercount = @members.count + @members = searchStudent_sort(@course, 'desc') + @membercount = @members.count else @subPage_title = '' @members = @course.member_principals.includes(:roles, :principal).all.sort end + @@result = @members @members = paginateHelper @members render :layout => 'base_courses' else @@ -340,6 +343,21 @@ class CoursesController < ApplicationController end end + + def member_score_sort + @teachers= searchTeacherAndAssistant(@course) + @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' + @role = params[:role] + @course_groups = @course.course_groups if @course.course_groups + @show_serch = params[:role] == '2' + @subPage_title = l :label_student_list + @render_file = 'member_list' + unless @@result.nil? + @results = @@result.reverse + @@result = @results + end + @results = paginateHelper @results + end # 显示每个学生的作业评分详情 def show_member_score @member_score = Member.find(params[:member_id]) if params[:member_id] diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 6f0265132..ec3b9aad6 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -164,6 +164,18 @@ module CoursesHelper members end def searchStudent project + #searchPeopleByRoles(project, StudentRoles) + members = [] + + project.members.each do |m| + if m && m.user && m.user.allowed_to?(:as_student,project) + members << m + + end + end + members + end + def searchStudent_sort project, sort_by #searchPeopleByRoles(project, StudentRoles) members = [] @@ -173,20 +185,14 @@ module CoursesHelper end end - members - end - def search_student_and_score project - #searchPeopleByRoles(project, StudentRoles) - members = [] - scores = [] - project.members.each do |m| - if m && m.user && m.user.allowed_to?(:as_student,project) - members << m - - end + members.sort!{ |mem1, mem2| mem1.student_homework_score[1].to_f <=> mem2.student_homework_score[1].to_f} + if sort_by == "desc" + members.reverse! end members end + + def searchStudent_by_name project, name #searchPeopleByRoles(project, StudentRoles) members = [] diff --git a/app/views/account/email_valid.html.erb b/app/views/account/email_valid.html.erb index c77c0294e..e6bc2a2db 100644 --- a/app/views/account/email_valid.html.erb +++ b/app/views/account/email_valid.html.erb @@ -4,7 +4,7 @@ 注册帐号 @@ -32,7 +32,9 @@ border: none; padding: 10px 16px; - line-height: 1.33;" target="_blank">立即查收邮件

+ line-height: 1.33;" target="_blank">立即查收邮件 +     <%= link_to l(:label_mail_resend), { :controller => 'account', :action => 'resendmail',:user => @user}, :remote => true, :method => 'get' %> +

diff --git a/app/views/courses/_member_list.html.erb b/app/views/courses/_member_list.html.erb index 2800c78ea..2ee9e3aad 100644 --- a/app/views/courses/_member_list.html.erb +++ b/app/views/courses/_member_list.html.erb @@ -1,3 +1,13 @@ +
<% if User.current.logged? && User.current.member_of_course?(@course) && @group %> <% if !@canShowCode %> @@ -30,61 +40,64 @@
- <% members.each do |member| %> +
+ <% members.each do |member| %> -
-
- <% next if member.new_record? %> +
+
+ <% next if member.new_record? %> - <%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 40, :height => 40)) %> -
    - <% if @canShowCode %> -
  • - <%= l(:label_bidding_user_studentname) %> : - <%= link_to member.user.show_name, user_path(member.user) %> + <%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 40, :height => 40)) %> +
      + <% if @canShowCode %> +
    • + <%= l(:label_bidding_user_studentname) %> : + <%= link_to member.user.show_name, user_path(member.user) %> -

    • - <%#= content_tag "li", "#{l(:label_bidding_user_studentname)}#{' : '}"link_to(member.user.show_name, user_path(member.user)) %> - <% else %> - <%= content_tag "li", link_to(member.user.name, user_path(member.user)) %> - <% end %> - +
      + <%#= content_tag "li", "#{l(:label_bidding_user_studentname)}#{' : '}"link_to(member.user.show_name, user_path(member.user)) %> + <% else %> + <%= content_tag "li", link_to(member.user.name, user_path(member.user)) %> + <% end %> + - <% if @canShowCode %> -
    • - <%= l(:label_bidding_user_studentcode) %> : - <%= link_to member.user.user_extensions.student_id, user_path(member.user) %> -
    • - <%#= content_tag "li", "#{l(:label_bidding_user_studentcode)}#{' : '}#{member.user.user_extensions.student_id}", :style=> "color:#1c9ec7;" %> - <% end %> -
    - <% if @subPage_title == l(:label_student_list) %> - <%= link_to member.student_homework_score[1].to_s, { - :action => 'show_member_score', - :member_id => member.id, - :remote => true}, - :class => 'ml258 c_red', :style => "color:red;" %> + <% if @canShowCode %> +
  • + <%= l(:label_bidding_user_studentcode) %> : + <%= link_to member.user.user_extensions.student_id, user_path(member.user) %> +
  • + <%#= content_tag "li", "#{l(:label_bidding_user_studentcode)}#{' : '}#{member.user.user_extensions.student_id}", :style=> "color:#1c9ec7;" %> + <% end %> +
+ <% if @subPage_title == l(:label_student_list) %> + <%= link_to member.student_homework_score[1].to_s, { + :action => 'show_member_score', + :member_id => member.id, + :remote => true}, + :class => 'ml258 c_red', :style => "color:red;" %> - <% unless member.created_on.nil? %> - <%= content_tag "span", "#{format_date(member.created_on)}#{l(:label_member_since)}", :class => "ml65 c_grey" %> - <% end %> - <% else %> - <% unless member.created_on.nil? %> - <%= content_tag "span", "#{format_date(member.created_on)}#{l(:label_member_since)}", :class => "ml65 c_grey", :style=>"margin-left:195px" %> + <% unless member.created_on.nil? %> + <%= content_tag "span", "#{format_date(member.created_on)}#{l(:label_member_since)}", :class => "ml65 c_grey" %> + <% end %> + <% else %> + <% unless member.created_on.nil? %> + <%= content_tag "span", "#{format_date(member.created_on)}#{l(:label_member_since)}", :class => "ml65 c_grey", :style=>"margin-left:195px" %> + <% end %> <% end %> - <% end %> - - <%= call_hook(:view_projects_settings_members_table_row, { :course => @course, :member => member}) %> -
- <% end; reset_cycle %> + + <%= call_hook(:view_projects_settings_members_table_row, { :course => @course, :member => member}) %> +
+ <% end; reset_cycle %> +
<% else %> diff --git a/app/views/courses/_member_list_detail.html.erb b/app/views/courses/_member_list_detail.html.erb new file mode 100644 index 000000000..47407c01b --- /dev/null +++ b/app/views/courses/_member_list_detail.html.erb @@ -0,0 +1,48 @@ +<% members.each do |member| %> + +
+
+ <% next if member.new_record? %> + + <%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 40, :height => 40)) %> + + <% if @subPage_title == l(:label_student_list) %> + <%= link_to member.student_homework_score[1].to_s, { + :action => 'show_member_score', + :member_id => member.id, + :remote => true}, + :class => 'ml258 c_red', :style => "color:red;" %> + + <% unless member.created_on.nil? %> + <%= content_tag "span", "#{format_date(member.created_on)}#{l(:label_member_since)}", :class => "ml65 c_grey" %> + <% end %> + <% else %> + <% unless member.created_on.nil? %> + <%= content_tag "span", "#{format_date(member.created_on)}#{l(:label_member_since)}", :class => "ml65 c_grey", :style=>"margin-left:195px" %> + <% end %> + <% end %> + + + <%= call_hook(:view_projects_settings_members_table_row, { :course => @course, :member => member}) %> +
+<% end; reset_cycle %> \ No newline at end of file diff --git a/app/views/courses/member_score_sort.js.erb b/app/views/courses/member_score_sort.js.erb new file mode 100644 index 000000000..30965f835 --- /dev/null +++ b/app/views/courses/member_score_sort.js.erb @@ -0,0 +1,4 @@ +/** + * Created by Administrator on 2014/12/3. + */ +$("#list_detail").html("<%= escape_javascript( render :partial => 'member_list_detail', :locals => {:members => @results})%>"); \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 8f23d3025..38c5ae31f 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -1609,6 +1609,7 @@ zh: label_tags_user_mail: 用户邮箱: label_tags_user_name: 用户名: label_tags_numbers: Tag统计: + label_mail_resend: 重新发送激活邮件 label_max_number: 登录名是在网站中显示的您的公开标识,只能为英文和数字。 label_mail_attention: qq邮箱可能收不到此邮件,其他邮箱如果没有收到可能在垃圾邮件中, label_mail_attention1: 其中gmail与教育网邮箱的激活邮件有时比较慢,请耐心等待。 diff --git a/config/routes.rb b/config/routes.rb index f4fff69d4..d042a823e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -207,8 +207,8 @@ RedmineApp::Application.routes.draw do match 'account/lost_password', :via => [:get, :post], :as => 'lost_password' match 'account/activate', :via => :get match 'account/valid_ajax', :via => :get - get 'account/email_valid', :to => 'account#email_valid' - + match 'account/email_valid', :to => 'account#email_valid', :via => :get + match 'account/resendmail', :to => 'account#resendmail', :via=> :get match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post] @@ -646,6 +646,7 @@ RedmineApp::Application.routes.draw do post 'restartcourse' match "searchmembers", :controller => 'courses', :action => 'searchmembers', :via => [:post,:get] match "searchgroupmembers", :via => [:post, :get] + match 'member_score_sort', :via => [:get] match "updategroupname", :via => [:post, :get] match "addgroups", :via => [:post, :get] match 'deletegroup', :via => [:delete]