This commit is contained in:
sw 2014-12-19 11:23:50 +08:00
commit ff49fbe5c8
9 changed files with 163 additions and 61 deletions

View File

@ -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

View File

@ -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]

View File

@ -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 = []

View File

@ -4,7 +4,7 @@
<title>注册帐号</title>
<style type="text/css">
#jihuo {
background-image: url("./images/jingtanhao.JPG");
background-image: url("/images/jingtanhao.JPG");
}
</style>
</head>
@ -32,7 +32,9 @@
border: none;
padding: 10px 16px;
line-height: 1.33;" target="_blank">立即查收邮件</a></p>
line-height: 1.33;" target="_blank">立即查收邮件</a>
&nbsp; &nbsp; <%= link_to l(:label_mail_resend), { :controller => 'account', :action => 'resendmail',:user => @user}, :remote => true, :method => 'get' %>
</p>

View File

@ -1,3 +1,13 @@
<script type=" text/javascript" charset="utf-8">
function change_pic(id){
var classname = document.getElementById(id).className
if(classname == 'st_up') {
document.getElementById(id).className = 'st_down'
}
else
document.getElementById(id).className = 'st_up'
}
</script>
<div style="margin-left: 15px" xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
<% if User.current.logged? && User.current.member_of_course?(@course) && @group %>
<% if !@canShowCode %>
@ -30,61 +40,64 @@
<div class="st_box">
<ul class="st_box_top">
<% if @subPage_title == l(:label_student_list) %>
<li class="ml358"><a href="#" >作业积分</a><a href="#" class="st_down"></a></li>
<li class="ml358"><%= link_to '作业积分', member_score_sort_course_path ,method: 'get', remote: true, :onclick => "change_pic('pic')"%>
<a id="pic" href="#" class="st_down"></a></li>
<li class="ml50"><a href="#" >加入时间</a></li>
<% else %>
<li class="ml50" style="margin-left: 470px"><a href="#" >加入时间</a></li>
<li class="ml50" style="margin-left: 470px"><li class="ml50"><a href="#" >加入时间</a></li>
<% end %>
</ul>
<% members.each do |member| %>
<div id="list_detail">
<% members.each do |member| %>
<div class="cl"></div><!--st_box_top end-->
<div class="st_boxlist">
<% next if member.new_record? %>
<div class="cl"></div><!--st_box_top end-->
<div class="st_boxlist">
<% next if member.new_record? %>
<a href="#" class="st_img" style="float:left;"> <%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 40, :height => 40)) %></a>
<ul style="margin-left: 15px">
<% if @canShowCode %>
<li>
<%= l(:label_bidding_user_studentname) %> :
<%= link_to member.user.show_name, user_path(member.user) %>
<a href="#" class="st_img" style="float:left;"> <%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 40, :height => 40)) %></a>
<ul style="margin-left: 15px">
<% if @canShowCode %>
<li>
<%= l(:label_bidding_user_studentname) %> :
<%= link_to member.user.show_name, user_path(member.user) %>
</li> </br>
<%#= 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 %>
<!--teacher's code disapeared moified by huang-->
</li> </br>
<%#= 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 %>
<!--teacher's code disapeared moified by huang-->
<% if @canShowCode %>
<li>
<%= l(:label_bidding_user_studentcode) %> :
<%= link_to member.user.user_extensions.student_id, user_path(member.user) %>
</li>
<%#= content_tag "li", "#{l(:label_bidding_user_studentcode)}#{' : '}#{member.user.user_extensions.student_id}", :style=> "color:#1c9ec7;" %>
<% end %>
</ul>
<% 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 %>
<li>
<%= l(:label_bidding_user_studentcode) %> :
<%= link_to member.user.user_extensions.student_id, user_path(member.user) %>
</li>
<%#= content_tag "li", "#{l(:label_bidding_user_studentcode)}#{' : '}#{member.user.user_extensions.student_id}", :style=> "color:#1c9ec7;" %>
<% end %>
</ul>
<% 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}) %>
</div>
<% end; reset_cycle %>
<%= call_hook(:view_projects_settings_members_table_row, { :course => @course, :member => member}) %>
</div>
<% end; reset_cycle %>
</div>
</div>
<div class="pagination"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %></div>
<% else %>

View File

@ -0,0 +1,48 @@
<% members.each do |member| %>
<div class="cl"></div><!--st_box_top end-->
<div class="st_boxlist">
<% next if member.new_record? %>
<a href="#" class="st_img" style="float:left;"> <%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 40, :height => 40)) %></a>
<ul style="margin-left: 15px">
<% if @canShowCode %>
<li>
<%= l(:label_bidding_user_studentname) %> :
<%= link_to member.user.show_name, user_path(member.user) %>
</li> </br>
<%#= 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 %>
<!--teacher's code disapeared moified by huang-->
<% if @canShowCode %>
<li>
<%= l(:label_bidding_user_studentcode) %> :
<%= link_to member.user.user_extensions.student_id, user_path(member.user) %>
</li>
<%#= content_tag "li", "#{l(:label_bidding_user_studentcode)}#{' : '}#{member.user.user_extensions.student_id}", :style=> "color:#1c9ec7;" %>
<% end %>
</ul>
<% 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}) %>
</div>
<% end; reset_cycle %>

View File

@ -0,0 +1,4 @@
/**
* Created by Administrator on 2014/12/3.
*/
$("#list_detail").html("<%= escape_javascript( render :partial => 'member_list_detail', :locals => {:members => @results})%>");

View File

@ -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与教育网邮箱的激活邮件有时比较慢请耐心等待。

View File

@ -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]