Merge remote-tracking branch 'origin/szzh' into szzh
This commit is contained in:
commit
86adfaecce
|
@ -61,6 +61,7 @@ class AttachmentsController < ApplicationController
|
||||||
end
|
end
|
||||||
rescue => e
|
rescue => e
|
||||||
redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html"
|
redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html"
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
#更新资源文件类型
|
#更新资源文件类型
|
||||||
|
|
|
@ -99,16 +99,17 @@ class SchoolController < ApplicationController
|
||||||
|
|
||||||
def search_school
|
def search_school
|
||||||
q = "%#{params[:key_word].strip}%"
|
q = "%#{params[:key_word].strip}%"
|
||||||
if params[:province].nil? or params[:province] == "0"
|
|
||||||
@school = School.where("name LIKE ?", q);
|
@school = School.where("name LIKE ?", q)
|
||||||
else
|
@school = @school.where("province = ?", params[:province]) if (params[:province] != '0' )
|
||||||
@school = School.where("province = ? AND name LIKE ?", params[:province], q);
|
|
||||||
end
|
|
||||||
options = ""
|
options = ""
|
||||||
@school.each do |s|
|
@school.each do |s|
|
||||||
options << "<li style = 'width: 33%; float: left'> <a id=#{s.id} onclick='test(this.id)'>#{s.name}</a></li>"
|
options << "<li style = 'width: 33%; float: left'> <a id=#{s.id} onclick='test(this.id)'>#{s.name}</a></li>"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
options = "<div class='flash error' id='flash_error'>#{l(:label_school_not_fount)}</div>" if options.blank?
|
||||||
|
|
||||||
render :text => options
|
render :text => options
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -255,112 +255,63 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
#end
|
#end
|
||||||
def index
|
def index
|
||||||
|
@status = params[:status] || 1
|
||||||
@project_type = params[:project_type]
|
|
||||||
role = params[:role]
|
|
||||||
|
|
||||||
sort_init 'login', 'asc'
|
sort_init 'login', 'asc'
|
||||||
sort_update %w(login firstname lastname mail admin created_on last_login_on)
|
sort_update %w(login firstname lastname mail admin created_on last_login_on)
|
||||||
|
|
||||||
|
# Deprecation
|
||||||
|
@project_type = params[:project_type]
|
||||||
|
|
||||||
case params[:format]
|
case params[:format]
|
||||||
when 'xml', 'json'
|
when 'xml', 'json'
|
||||||
@offset, @limit = api_offset_and_limit({:limit => 15})
|
@offset, @limit = api_offset_and_limit({:limit => 15})
|
||||||
else
|
else
|
||||||
@limit = 15#per_page_option
|
@limit = 15
|
||||||
end
|
end
|
||||||
|
|
||||||
@status = params[:status] || 1
|
# retrieve all users
|
||||||
has = {
|
|
||||||
"show_changesets" => true
|
|
||||||
}
|
|
||||||
# @count = Redmine::Activity::Fetcher.new(User.current, :author => @user).scope_select {|t| !has["show_#{t}"].nil?}.events(nil, nil).count
|
|
||||||
|
|
||||||
scope = UserStatus.visible
|
scope = UserStatus.visible
|
||||||
case role
|
|
||||||
|
# if role has something, change scope.
|
||||||
|
case params[:role]
|
||||||
when 'teacher'
|
when 'teacher'
|
||||||
scope = UserStatus.teacher
|
scope = UserStatus.teacher
|
||||||
when 'student'
|
when 'student'
|
||||||
scope = UserStatus.student
|
scope = UserStatus.student
|
||||||
else
|
else
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# unknow
|
||||||
scope = scope.in_group(params[:group_id]) if params[:group_id].present?
|
scope = scope.in_group(params[:group_id]) if params[:group_id].present?
|
||||||
# scope.each do |user|
|
|
||||||
# UserStatus.create(:changesets_count => user.changesets.count, :watchers_count => user.watcher_users.count, :user_id => user.id)
|
# pagination
|
||||||
# end
|
|
||||||
@user_count = scope.count
|
@user_count = scope.count
|
||||||
@user_pages = Paginator.new @user_count, @limit, params['page']
|
@user_pages = Paginator.new @user_count, @limit, params['page']
|
||||||
#@offset ||= @user_pages.offset
|
|
||||||
#@users = scope.order(sort_clause).limit(@limit).offset(@offset).all
|
# users classify
|
||||||
@user_base_tag = params[:id] ? 'base_users':'base'
|
|
||||||
if params[:user_sort_type].present?
|
|
||||||
case params[:user_sort_type]
|
case params[:user_sort_type]
|
||||||
when '0'
|
when '0'
|
||||||
@offset ||= @user_pages.reverse_offset
|
|
||||||
unless @offset == 0
|
|
||||||
@users_statuses = scope.offset(@offset).limit(@limit).all.reverse
|
|
||||||
else
|
|
||||||
limit = @user_count % @limit
|
|
||||||
if limit == 0
|
|
||||||
limit = @limit
|
|
||||||
end
|
|
||||||
@users_statuses = scope.offset(@offset).limit(limit).all.reverse
|
|
||||||
end
|
|
||||||
@s_type = 0
|
@s_type = 0
|
||||||
# @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
|
@us_ordered = scope.
|
||||||
# @projects = @projects[@offset, @limit]
|
joins("LEFT JOIN users ON user_statuses.user_id = users.id").
|
||||||
|
reorder('users.created_on DESC')
|
||||||
when '1'
|
when '1'
|
||||||
@offset ||= @user_pages.reverse_offset
|
|
||||||
unless @offset == 0
|
|
||||||
@users_statuses = scope.reorder('grade').offset(@offset).limit(@limit).all.reverse
|
|
||||||
else
|
|
||||||
limit = @user_count % @limit
|
|
||||||
if limit == 0
|
|
||||||
limit = @limit
|
|
||||||
end
|
|
||||||
@users_statuses = scope.reorder('grade').offset(@offset).limit(limit).all.reverse
|
|
||||||
end
|
|
||||||
@s_type = 1
|
@s_type = 1
|
||||||
#sort {|x,y| y.user_status.changesets_count <=> x.user_status.changesets_count}
|
@us_ordered = scope.reorder('user_statuses.grade DESC')
|
||||||
#@users = @users[@offset, @limit]
|
|
||||||
when '2'
|
when '2'
|
||||||
@offset ||= @user_pages.reverse_offset
|
|
||||||
unless @offset == 0
|
|
||||||
@users_statuses = scope.reorder('watchers_count').offset(@offset).limit(@limit).all.reverse
|
|
||||||
else
|
|
||||||
limit = @user_count % @limit
|
|
||||||
if limit == 0
|
|
||||||
limit = @limit
|
|
||||||
end
|
|
||||||
@users_statuses = scope.reorder('watchers_count').offset(@offset).limit(limit).all.reverse
|
|
||||||
end
|
|
||||||
@s_type = 2
|
@s_type = 2
|
||||||
#@users = @users[@offset, @limit]
|
@us_ordered = scope.reorder('user_statuses.watchers_count DESC')
|
||||||
end
|
|
||||||
|
|
||||||
else
|
else
|
||||||
@offset ||= @user_pages.reverse_offset
|
|
||||||
unless @offset == 0
|
|
||||||
@users_statuses = scope.reorder('grade').offset(@offset).limit(@limit).all.reverse
|
|
||||||
else
|
|
||||||
limit = @user_count % @limit
|
|
||||||
if limit == 0
|
|
||||||
limit = @limit
|
|
||||||
end
|
|
||||||
@users_statuses = scope.reorder('grade').offset(@offset).limit(limit).all.reverse
|
|
||||||
end
|
|
||||||
@s_type = 1
|
@s_type = 1
|
||||||
# @projects = @projects.sort {|x,y| y.created_on <=> x.created_on }
|
@us_ordered = scope.reorder('user_statuses.grade DESC')
|
||||||
# @projects = @projects[@offset, @limit]
|
|
||||||
end
|
|
||||||
|
|
||||||
@users = []
|
|
||||||
@users_statuses.each do |obj|
|
|
||||||
@users << User.find_by_id("#{obj.user_id}")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# limit and offset
|
||||||
|
@users_statuses = @us_ordered.offset(@user_pages.offset).limit(@user_pages.per_page)
|
||||||
|
# get users ActiveRecord
|
||||||
|
@users = @users_statuses.includes(:user).map(&:user)
|
||||||
|
|
||||||
|
@user_base_tag = params[:id] ? 'base_users':'base'
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
@groups = Group.all.sort
|
@groups = Group.all.sort
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class UserStatus < ActiveRecord::Base
|
class UserStatus < ActiveRecord::Base
|
||||||
attr_accessible :changesets_count, :user_id, :watchers_count
|
attr_accessible :changesets_count, :user_id, :watchers_count
|
||||||
belongs_to :users
|
belongs_to :user
|
||||||
belongs_to :watchers
|
belongs_to :watchers
|
||||||
belongs_to :changesets
|
belongs_to :changesets
|
||||||
validates_presence_of :user_id
|
validates_presence_of :user_id
|
||||||
|
|
|
@ -1469,6 +1469,7 @@ en:
|
||||||
label_teacher: Teacher
|
label_teacher: Teacher
|
||||||
label_student: Student
|
label_student: Student
|
||||||
label_school_all: Schools
|
label_school_all: Schools
|
||||||
|
label_school_not_fount: Not found by your input query condition.
|
||||||
label_other: Other
|
label_other: Other
|
||||||
label_gender: Gender
|
label_gender: Gender
|
||||||
label_gender_male: male
|
label_gender_male: male
|
||||||
|
|
|
@ -1857,6 +1857,7 @@ zh:
|
||||||
|
|
||||||
#added by Wen
|
#added by Wen
|
||||||
label_school_all: 中国高校
|
label_school_all: 中国高校
|
||||||
|
label_school_not_fount: 没有符合的高校信息
|
||||||
|
|
||||||
|
|
||||||
label_project_grade: 项目得分
|
label_project_grade: 项目得分
|
||||||
|
|
|
@ -1,23 +1,40 @@
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
<!DOCTYPE HTML>
|
||||||
"http://www.w3.org/TR/html4/loose.dtd">
|
|
||||||
<html>
|
<html>
|
||||||
<title>File not found</title>
|
<head>
|
||||||
<style>
|
<title>File not found</title>
|
||||||
body{
|
<style>
|
||||||
font-family: Trebuchet MS,Georgia,"Times New Roman",serif;
|
body{
|
||||||
color:#303030;
|
font-family: Trebuchet MS,Georgia,"Times New Roman",serif;
|
||||||
margin:10px;
|
color:#303030;
|
||||||
}
|
}
|
||||||
h1{
|
div.container{
|
||||||
font-size:1.5em;
|
margin: 0 auto;
|
||||||
}
|
width: 80%;
|
||||||
p{
|
}
|
||||||
font-size:0.8em;
|
h1{
|
||||||
}
|
font-size:1.5em;
|
||||||
</style>
|
}
|
||||||
|
p{
|
||||||
|
font-size:0.8em;
|
||||||
|
}
|
||||||
|
.hidden{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div class="container" >
|
||||||
<h1>Sorry, this file can not be downloaded now. </h1>
|
<h1>Sorry, this file can not be downloaded now. </h1>
|
||||||
<p>Trustie Team.</p>
|
<h3> <a href="http://forge.trustie.net" style="">Goto Home page</a> </h3>
|
||||||
<p><a href="javascript:history.back()">Back</a></p>
|
|
||||||
|
<div class="container" style="">
|
||||||
|
<div style="position: relative; right:0;text-align: right;">
|
||||||
|
<h4>Trustie Team.</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p class="hidden" >
|
||||||
|
<a href="javascript:history.back()">Back</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue