parent
b35defe270
commit
43e940eb1d
File diff suppressed because it is too large
Load Diff
@ -1,257 +1,257 @@
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
module WatchersHelper
|
||||
|
||||
def watcher_tag(object, user, options={})
|
||||
ActiveSupport::Deprecation.warn "#watcher_tag is deprecated and will be removed in Redmine 3.0. Use #watcher_link instead."
|
||||
watcher_link(object, user)
|
||||
end
|
||||
|
||||
###################modified by liuping, nyan
|
||||
def watcher_link(objects, user, options=[])
|
||||
return '' unless user && user.logged?
|
||||
objects = Array.wrap(objects)
|
||||
|
||||
watched = objects.any? {|object| object.watched_by?(user)}
|
||||
@watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or objects.first.instance_of?(Contest) or (objects.first.instance_of?(Bid)))
|
||||
css = @watch_flag ? ([watcher_css(objects), watched ? 'icon ' : 'icon '].join(' ') << options[0].to_s) :
|
||||
([watcher_css(objects), watched ? 'icon icon-fav ' : 'icon icon-fav-off '].join(' ') << options[0].to_s)
|
||||
|
||||
text = @watch_flag ?
|
||||
(watched ? l(:button_unfollow) : l(:button_follow)) : (watched ? l(:button_unwatch) : l(:button_watch))
|
||||
|
||||
url = watch_path(
|
||||
:object_type => objects.first.class.to_s.underscore,
|
||||
:object_id => (objects.size == 1 ? objects.first.id : objects.map(&:id).sort)
|
||||
)
|
||||
method = watched ? 'delete' : 'post'
|
||||
|
||||
link_to text, url, :remote => true, :method => method, :class => css
|
||||
end
|
||||
|
||||
############## added by linchun
|
||||
def new_watcher_link(objects, user, options=[])
|
||||
return '' unless user && user.logged?
|
||||
objects = Array.wrap(objects)
|
||||
|
||||
watched = objects.any? {|object| object.watched_by?(user)}
|
||||
@watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or (objects.first.instance_of?(Contest)))
|
||||
css = @watch_flag ? ([watcher_css(objects), watched ? 'icon ' : 'icon '].join(' ') << options[0].to_s) :
|
||||
([watcher_css(objects), watched ? 'icon icon-fav ' : 'icon icon-fav-off '].join(' ') << options[0].to_s)
|
||||
|
||||
text = @watch_flag ?
|
||||
(watched ? l(:button_unfollow) : l(:button_follow)) : (watched ? l(:button_unwatch) : l(:button_watch))
|
||||
|
||||
url = watch_path(
|
||||
:object_type => objects.first.class.to_s.underscore,
|
||||
:object_id => (objects.size == 1 ? objects.first.id : objects.map(&:id).sort)
|
||||
)
|
||||
method = watched ? 'delete' : 'post'
|
||||
|
||||
link_to text, url, :remote => true, :method => method, :class => css
|
||||
end
|
||||
|
||||
# add by nwb
|
||||
# 关注课程
|
||||
def new_course_watcher_link(objects, user, options=[])
|
||||
return '' unless user && user.logged?
|
||||
objects = Array.wrap(objects)
|
||||
|
||||
watched = objects.any? {|object| object.watched_by?(user)}
|
||||
@watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or (objects.first.instance_of?(Contest)))
|
||||
css = @watch_flag ? ([watcher_css(objects), watched ? 'icon ' : 'icon '].join(' ') << options[0].to_s) :
|
||||
([watcher_css(objects), watched ? 'icon icon-fav ' : 'icon icon-fav-off '].join(' ') << options[0].to_s)
|
||||
|
||||
text = @watch_flag ?
|
||||
(watched ? l(:button_unfollow) : l(:button_follow)) : (watched ? l(:button_unwatch) : l(:button_watch))
|
||||
|
||||
url = watch_path(
|
||||
:object_type => objects.first.class.to_s.underscore,
|
||||
:object_id => (objects.size == 1 ? objects.first.id : objects.map(&:id).sort)
|
||||
)
|
||||
method = watched ? 'delete' : 'post'
|
||||
|
||||
link_to text, url, :remote => true, :method => method, :class => css
|
||||
end
|
||||
|
||||
# added by fq, modify nyan
|
||||
# Somebody may use option params
|
||||
def join_in_course(course, user, options=[])
|
||||
return '' unless user && user.logged?
|
||||
# modify by nwb
|
||||
# 主讲教师不允许退出课程
|
||||
return '' if user.id == course.tea_id
|
||||
joined = user.member_of_course?(course)
|
||||
text = joined ? l(:label_exit_course) : l(:label_join_course)
|
||||
url_t = join_path(:object_id => course.id)
|
||||
url_f = try_join_path(:object_id => course.id)
|
||||
method = joined ? 'delete' : 'post'
|
||||
if joined
|
||||
link_to text, url_t, :remote => true, :method => method, :id => "#{course.id}", :confirm => l(:text_are_you_sure_out), :class => []+options
|
||||
else
|
||||
link_to text, url_f, :remote => true, :method => method, :id => "#{course.id}", :class => []+options
|
||||
end
|
||||
end
|
||||
|
||||
# 用户是否允许加入课程判断
|
||||
# add by nwb
|
||||
def join_in_course_for_list(course, user, options=[])
|
||||
return '' unless user && user.logged?
|
||||
# modify by nwb
|
||||
# 主讲教师不允许退出课程
|
||||
return '' if user.id == course.tea_id
|
||||
joined = user.member_of_course?(course)
|
||||
text = joined ? l(:label_exit_course) : l(:label_join_course)
|
||||
url_t = join_path(:object_id => course.id)
|
||||
url_f = try_join_path(:object_id => course.id)
|
||||
method = joined ? 'delete' : 'post'
|
||||
if joined
|
||||
link_to text, url_t, :remote => true, :method => method, :id => "#{course.id}", :confirm => l(:text_are_you_sure_out), :class => []+options
|
||||
else
|
||||
link_to text, url_f, :remote => true, :method => method, :id => "#{course.id}", :class => []+options
|
||||
end
|
||||
end
|
||||
|
||||
#added by bai
|
||||
def join_in_contest(bid, user, options=[])
|
||||
if bid.reward_type == 2
|
||||
return '' unless user && user.logged?
|
||||
joined = user.join_in_contest?(bid)
|
||||
text = joined ? l(:label_exit_contest) : l(:label_join_contest)
|
||||
url_t = join_in_contest_path(:id => bid.id)
|
||||
url_f = try_join_in_contest_path(:id => bid.id)
|
||||
# url = join_in_contest_path(:id => bid.id)
|
||||
method = joined ? 'delete' : 'post'
|
||||
if joined
|
||||
link_to text, url_t, :remote => true, :method => method, :id => "#{bid.id}", :confirm => l(:text_are_you_sure_out), :class => []+options
|
||||
else
|
||||
link_to text, url_f, :remote => true, :method => method, :id => "#{bid.id}", :class => []+options
|
||||
end
|
||||
end
|
||||
end
|
||||
##new add by linchun
|
||||
def join_in_contest(contest, user, options=[])
|
||||
return '' unless user && user.logged?
|
||||
joined = user.join_in_contest?(contest)
|
||||
text = joined ? l(:label_exit_contest) : l(:label_join_contest)
|
||||
url_t = join_in_contest_path(:id => contest.id)
|
||||
url_f = try_join_in_contest_path(:id => contest.id)
|
||||
# url = join_in_contest_path(:id => contest.id)
|
||||
method = joined ? 'delete' : 'post'
|
||||
if joined
|
||||
link_to text, url_t, :remote => true, :method => method, :id => "#{contest.id}", :confirm => l(:text_are_you_sure_out), :class => []+options
|
||||
else
|
||||
link_to text, url_f, :remote => true, :method => method, :id => "#{contest.id}", :class => []+options
|
||||
end
|
||||
end
|
||||
|
||||
# liuwanwei 的需求, 新竞赛
|
||||
# 新路由命名为 competition
|
||||
def join_in_competition(competition, user)
|
||||
return '' unless user && user.logged?
|
||||
joined = JoinInCompetition.where('competition_id = ? AND user_id = ?', competition.id, user.id).count>0
|
||||
text = joined ? l(:label_exit_contest) : l(:label_join_contest)
|
||||
url_f = new_join_contests_path(:id => competition.id)
|
||||
url_t = unjoin_in_contest_contests_path(:id => competition.id)
|
||||
method = joined ? 'delete' : 'post'
|
||||
if joined
|
||||
# 退出竞赛用
|
||||
link_to text, url_t, :remote => true, :method => method, :id => "#{competition.id}", :confirm => l(:text_are_you_sure_out)
|
||||
else
|
||||
# 加入竞赛用
|
||||
link_to text, url_f, :remote => true, :method => method, :id => "#{competition.id}"
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the css class used to identify watch links for a given +object+
|
||||
def watcher_css(objects)
|
||||
objects = Array.wrap(objects)
|
||||
id = (objects.size == 1 ? objects.first.id : 'bulk')
|
||||
"#{objects.first.class.to_s.underscore}-#{id}-watcher"
|
||||
end
|
||||
|
||||
# Returns a comma separated list of users watching the given object
|
||||
def watchers_list(object)
|
||||
remove_allowed = User.current.allowed_to?("delete_#{object.class.name.underscore}_watchers".to_sym, object.project)
|
||||
content = ''.html_safe
|
||||
lis = object.watcher_users.collect do |user|
|
||||
s = ''.html_safe
|
||||
s << avatar(user, :size => "16").to_s
|
||||
s << link_to_user(user, :class => 'user')
|
||||
if remove_allowed
|
||||
url = {:controller => 'watchers',
|
||||
:action => 'destroy',
|
||||
:object_type => object.class.to_s.underscore,
|
||||
:object_id => object.id,
|
||||
:user_id => user}
|
||||
s << ' '
|
||||
s << link_to(image_tag('delete.png'), url,
|
||||
:remote => true, :method => 'delete', :class => "delete")
|
||||
end
|
||||
content << content_tag('li', s, :class => "user-#{user.id}")
|
||||
end
|
||||
content.present? ? content_tag('ul', content, :class => 'watchers') : content
|
||||
end
|
||||
|
||||
def watchers_checkboxes(object, users, checked=nil)
|
||||
if users.nil?
|
||||
|
||||
else
|
||||
users.map do |user|
|
||||
c = checked.nil? ? object.watched_by?(user) : checked
|
||||
tag = check_box_tag 'issue[watcher_user_ids][]', user.id, c, :id => nil
|
||||
content_tag 'label', "#{tag} #{h(user)}".html_safe,
|
||||
:id => "issue_watcher_user_ids_#{user.id}",
|
||||
:class => "floating"
|
||||
end.join.html_safe
|
||||
end
|
||||
end
|
||||
|
||||
def applied_css(project)
|
||||
id = project.id
|
||||
"#{project.class.to_s.underscore}-#{id}-applied"
|
||||
end
|
||||
|
||||
def applied_link(project, user, options=[])
|
||||
return '' unless user && user.logged?
|
||||
applied = project.applied_projects.find_by_user_id(user.id)
|
||||
text = applied ? l(:label_unapply_project) : l(:label_apply_project)
|
||||
|
||||
@applied_flag = project.instance_of?(Project)
|
||||
css = @applied_flag ? ([applied_css(project), applied ? 'icon ' : 'icon '].join(' ') << options[0].to_s) :
|
||||
([applied_css(project), applied ? 'icon icon-applied ' : 'icon icon-applied-off '].join(' ') << options[0].to_s)
|
||||
if applied
|
||||
appliedid = applied.id
|
||||
end
|
||||
url = appliedproject_path(
|
||||
:id=>appliedid,
|
||||
:user_id => user.id,
|
||||
:project_id => project.id
|
||||
)
|
||||
method = applied ? 'delete' : 'post'
|
||||
|
||||
link_to text, url, :remote => true, :method => method ,:class=>css
|
||||
end
|
||||
|
||||
def exit_project_link(project)
|
||||
link_to(l(:label_exit_project),exit_cur_project_path(project.id),
|
||||
:remote => true, :confirm => l(:lable_sure_exit_project) )
|
||||
end
|
||||
end
|
||||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
module WatchersHelper
|
||||
|
||||
def watcher_tag(object, user, options={})
|
||||
ActiveSupport::Deprecation.warn "#watcher_tag is deprecated and will be removed in Redmine 3.0. Use #watcher_link instead."
|
||||
watcher_link(object, user)
|
||||
end
|
||||
|
||||
###################modified by liuping, nyan
|
||||
def watcher_link(objects, user, options=[])
|
||||
return '' unless user && user.logged?
|
||||
objects = Array.wrap(objects)
|
||||
|
||||
watched = objects.any? {|object| object.watched_by?(user)}
|
||||
@watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or objects.first.instance_of?(Contest) or (objects.first.instance_of?(Bid)))
|
||||
css = @watch_flag ? ([watcher_css(objects), watched ? 'icon ' : 'icon '].join(' ') << options[0].to_s) :
|
||||
([watcher_css(objects), watched ? 'icon icon-fav ' : 'icon icon-fav-off '].join(' ') << options[0].to_s)
|
||||
|
||||
text = @watch_flag ?
|
||||
(watched ? l(:button_unfollow) : l(:button_follow)) : (watched ? l(:button_unwatch) : l(:button_watch))
|
||||
|
||||
url = watch_path(
|
||||
:object_type => objects.first.class.to_s.underscore,
|
||||
:object_id => (objects.size == 1 ? objects.first.id : objects.map(&:id).sort)
|
||||
)
|
||||
method = watched ? 'delete' : 'post'
|
||||
|
||||
link_to text, url, :remote => true, :method => method, :class => css
|
||||
end
|
||||
|
||||
############## added by linchun
|
||||
def new_watcher_link(objects, user, options=[])
|
||||
return '' unless user && user.logged?
|
||||
objects = Array.wrap(objects)
|
||||
|
||||
watched = objects.any? {|object| object.watched_by?(user)}
|
||||
@watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or (objects.first.instance_of?(Contest)))
|
||||
css = @watch_flag ? ([watcher_css(objects), watched ? 'icon ' : 'icon '].join(' ') << options[0].to_s) :
|
||||
([watcher_css(objects), watched ? 'icon icon-fav ' : 'icon icon-fav-off '].join(' ') << options[0].to_s)
|
||||
|
||||
text = @watch_flag ?
|
||||
(watched ? l(:button_unfollow) : l(:button_follow)) : (watched ? l(:button_unwatch) : l(:button_watch))
|
||||
|
||||
url = watch_path(
|
||||
:object_type => objects.first.class.to_s.underscore,
|
||||
:object_id => (objects.size == 1 ? objects.first.id : objects.map(&:id).sort)
|
||||
)
|
||||
method = watched ? 'delete' : 'post'
|
||||
|
||||
link_to text, url, :remote => true, :method => method, :class => css
|
||||
end
|
||||
|
||||
# add by nwb
|
||||
# 关注课程
|
||||
def new_course_watcher_link(objects, user, options=[])
|
||||
return '' unless user && user.logged?
|
||||
objects = Array.wrap(objects)
|
||||
|
||||
watched = objects.any? {|object| object.watched_by?(user)}
|
||||
@watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or (objects.first.instance_of?(Contest)))
|
||||
css = @watch_flag ? ([watcher_css(objects), watched ? 'icon ' : 'icon '].join(' ') << options[0].to_s) :
|
||||
([watcher_css(objects), watched ? 'icon icon-fav ' : 'icon icon-fav-off '].join(' ') << options[0].to_s)
|
||||
|
||||
text = @watch_flag ?
|
||||
(watched ? l(:button_unfollow) : l(:button_follow)) : (watched ? l(:button_unwatch) : l(:button_watch))
|
||||
|
||||
url = watch_path(
|
||||
:object_type => objects.first.class.to_s.underscore,
|
||||
:object_id => (objects.size == 1 ? objects.first.id : objects.map(&:id).sort)
|
||||
)
|
||||
method = watched ? 'delete' : 'post'
|
||||
|
||||
link_to text, url, :remote => true, :method => method, :class => css
|
||||
end
|
||||
|
||||
# added by fq, modify nyan
|
||||
# Somebody may use option params
|
||||
def join_in_course(course, user, options=[])
|
||||
return '' unless user && user.logged?
|
||||
# modify by nwb
|
||||
# 主讲教师不允许退出课程
|
||||
return '' if user.id == course.tea_id
|
||||
joined = user.member_of_course?(course)
|
||||
text = joined ? l(:label_exit_course) : l(:label_join_course)
|
||||
url_t = join_path(:object_id => course.id)
|
||||
url_f = try_join_path(:object_id => course.id)
|
||||
method = joined ? 'delete' : 'post'
|
||||
if joined
|
||||
link_to text, url_t, :remote => true, :method => method, :id => "#{course.id}", :confirm => l(:text_are_you_sure_out), :class => []+options
|
||||
else
|
||||
link_to text, url_f, :remote => true, :method => method, :id => "#{course.id}", :class => []+options
|
||||
end
|
||||
end
|
||||
|
||||
# 用户是否允许加入课程判断
|
||||
# add by nwb
|
||||
def join_in_course_for_list(course, user, options=[])
|
||||
return '' unless user && user.logged?
|
||||
# modify by nwb
|
||||
# 主讲教师不允许退出课程
|
||||
return '' if user.id == course.tea_id
|
||||
joined = user.member_of_course?(course)
|
||||
text = joined ? l(:label_exit_course) : l(:label_join_course)
|
||||
url_t = join_path(:object_id => course.id)
|
||||
url_f = try_join_path(:object_id => course.id)
|
||||
method = joined ? 'delete' : 'post'
|
||||
if joined
|
||||
link_to text, url_t, :remote => true, :method => method, :id => "#{course.id}", :confirm => l(:text_are_you_sure_out), :class => []+options
|
||||
else
|
||||
link_to text, url_f, :remote => true, :method => method, :id => "#{course.id}", :class => []+options
|
||||
end
|
||||
end
|
||||
|
||||
#added by bai
|
||||
def join_in_contest(bid, user, options=[])
|
||||
if bid.reward_type == 2
|
||||
return '' unless user && user.logged?
|
||||
joined = user.join_in_contest?(bid)
|
||||
text = joined ? l(:label_exit_contest) : l(:label_join_contest)
|
||||
url_t = join_in_contest_path(:id => bid.id)
|
||||
url_f = try_join_in_contest_path(:id => bid.id)
|
||||
# url = join_in_contest_path(:id => bid.id)
|
||||
method = joined ? 'delete' : 'post'
|
||||
if joined
|
||||
link_to text, url_t, :remote => true, :method => method, :id => "#{bid.id}", :confirm => l(:text_are_you_sure_out), :class => []+options
|
||||
else
|
||||
link_to text, url_f, :remote => true, :method => method, :id => "#{bid.id}", :class => []+options
|
||||
end
|
||||
end
|
||||
end
|
||||
##new add by linchun
|
||||
def join_in_contest(contest, user, options=[])
|
||||
return '' unless user && user.logged?
|
||||
joined = user.join_in_contest?(contest)
|
||||
text = joined ? l(:label_exit_contest) : l(:label_join_contest)
|
||||
url_t = join_in_contest_path(:id => contest.id)
|
||||
url_f = try_join_in_contest_path(:id => contest.id)
|
||||
# url = join_in_contest_path(:id => contest.id)
|
||||
method = joined ? 'delete' : 'post'
|
||||
if joined
|
||||
link_to text, url_t, :remote => true, :method => method, :id => "#{contest.id}", :confirm => l(:text_are_you_sure_out), :class => []+options
|
||||
else
|
||||
link_to text, url_f, :remote => true, :method => method, :id => "#{contest.id}", :class => []+options
|
||||
end
|
||||
end
|
||||
|
||||
# liuwanwei 的需求, 新竞赛
|
||||
# 新路由命名为 competition
|
||||
def join_in_competition(competition, user)
|
||||
return '' unless user && user.logged?
|
||||
joined = JoinInCompetition.where('competition_id = ? AND user_id = ?', competition.id, user.id).count>0
|
||||
text = joined ? l(:label_exit_contest) : l(:label_join_contest)
|
||||
url_f = new_join_contests_path(:id => competition.id)
|
||||
url_t = unjoin_in_contest_contests_path(:id => competition.id)
|
||||
method = joined ? 'delete' : 'post'
|
||||
if joined
|
||||
# 退出竞赛用
|
||||
link_to text, url_t, :remote => true, :method => method, :id => "#{competition.id}", :confirm => l(:text_are_you_sure_out)
|
||||
else
|
||||
# 加入竞赛用
|
||||
link_to text, url_f, :remote => true, :method => method, :id => "#{competition.id}"
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the css class used to identify watch links for a given +object+
|
||||
def watcher_css(objects)
|
||||
objects = Array.wrap(objects)
|
||||
id = (objects.size == 1 ? objects.first.id : 'bulk')
|
||||
"#{objects.first.class.to_s.underscore}-#{id}-watcher"
|
||||
end
|
||||
|
||||
# Returns a comma separated list of users watching the given object
|
||||
def watchers_list(object)
|
||||
remove_allowed = User.current.allowed_to?("delete_#{object.class.name.underscore}_watchers".to_sym, object.project)
|
||||
content = ''.html_safe
|
||||
lis = object.watcher_users.collect do |user|
|
||||
s = ''.html_safe
|
||||
s << avatar(user, :size => "16").to_s
|
||||
s << link_to_user(user, :class => 'user')
|
||||
if remove_allowed
|
||||
url = {:controller => 'watchers',
|
||||
:action => 'destroy',
|
||||
:object_type => object.class.to_s.underscore,
|
||||
:object_id => object.id,
|
||||
:user_id => user}
|
||||
s << ' '
|
||||
s << link_to(image_tag('delete.png'), url,
|
||||
:remote => true, :method => 'delete', :class => "delete")
|
||||
end
|
||||
content << content_tag('li', s, :class => "user-#{user.id}")
|
||||
end
|
||||
content.present? ? content_tag('ul', content, :class => 'watchers') : content
|
||||
end
|
||||
|
||||
def watchers_checkboxes(object, users, checked=nil)
|
||||
if users.nil?
|
||||
|
||||
else
|
||||
users.map do |user|
|
||||
c = checked.nil? ? object.watched_by?(user) : checked
|
||||
tag = check_box_tag 'issue[watcher_user_ids][]', user.id, c, :id => nil
|
||||
content_tag 'label', "#{tag} #{h(user)}".html_safe,
|
||||
:id => "issue_watcher_user_ids_#{user.id}",
|
||||
:class => "floating"
|
||||
end.join.html_safe
|
||||
end
|
||||
end
|
||||
|
||||
def applied_css(project)
|
||||
id = project.id
|
||||
"#{project.class.to_s.underscore}-#{id}-applied"
|
||||
end
|
||||
|
||||
def applied_link(project, user, options=[])
|
||||
return '' unless user && user.logged?
|
||||
applied = project.applied_projects.find_by_user_id(user.id)
|
||||
text = applied ? l(:label_unapply_project) : l(:label_apply_project)
|
||||
|
||||
@applied_flag = project.instance_of?(Project)
|
||||
css = @applied_flag ? ([applied_css(project), applied ? 'icon ' : 'icon '].join(' ') << options[0].to_s) :
|
||||
([applied_css(project), applied ? 'icon icon-applied ' : 'icon icon-applied-off '].join(' ') << options[0].to_s)
|
||||
if applied
|
||||
appliedid = applied.id
|
||||
end
|
||||
url = appliedproject_path(
|
||||
:id=>appliedid,
|
||||
:user_id => user.id,
|
||||
:project_id => project.id
|
||||
)
|
||||
method = applied ? 'delete' : 'post'
|
||||
|
||||
link_to text, url, :remote => true, :method => method ,:class=>css
|
||||
end
|
||||
|
||||
def exit_project_link(project)
|
||||
link_to(l(:label_exit_project),exit_cur_project_path(project.id),
|
||||
:remote => true, :confirm => l(:lable_sure_exit_project) )
|
||||
end
|
||||
end
|
||||
|
@ -1,489 +1,489 @@
|
||||
<% @nav_dispaly_home_path_label = 1
|
||||
@nav_dispaly_main_course_label = 1
|
||||
@nav_dispaly_main_project_label = 1
|
||||
@nav_dispaly_main_contest_label = 1 %>
|
||||
<% @nav_dispaly_forum_label = 1%>
|
||||
<!-- added by bai 增加地区-->
|
||||
<script type="text/javascript" language="javascript">
|
||||
function showcity(province, cityField) {
|
||||
switch (province) {
|
||||
case "北京" :
|
||||
var cityOptions = new Array(
|
||||
"东城", "西城", "朝阳", "丰台", "石景山", "海淀", "门头沟",
|
||||
"房山", "通州", "顺义", "昌平", "大兴", "平谷", "怀柔", "密云", "延庆");
|
||||
break;
|
||||
case "上海" :
|
||||
var cityOptions = new Array(
|
||||
"崇明", "黄浦", "卢湾", "徐汇", "长宁", "静安", "普陀", "闸北", "虹口", "杨浦", "闵行",
|
||||
"宝山", "嘉定", "浦东", "金山", "松江", "青浦", "南汇", "奉贤");
|
||||
break;
|
||||
case "广东" :
|
||||
var cityOptions = new Array(
|
||||
"广州", "深圳", "珠海", "东莞", "中山", "佛山", "惠州", "河源", "潮州", "江门", "揭阳", "茂名",
|
||||
"梅州", "清远", "汕头", "汕尾", "韶关", "顺德", "阳江", "云浮", "湛江", "肇庆");
|
||||
break;
|
||||
case "江苏" :
|
||||
var cityOptions = new Array(
|
||||
"南京", "常熟", "常州", "海门", "淮安", "江都", "江阴", "昆山", "连云港", "南通",
|
||||
"启东", "沭阳", "宿迁", "苏州", "太仓", "泰州", "同里", "无锡", "徐州", "盐城",
|
||||
"扬州", "宜兴", "仪征", "张家港", "镇江", "周庄");
|
||||
break;
|
||||
case "重庆" :
|
||||
var cityOptions = new Array(
|
||||
"万州", "涪陵", "渝中", "大渡口", "江北", "沙坪坝", "九龙坡", "南岸", "北碚", "万盛",
|
||||
"双挢", "渝北", "巴南", "黔江", "长寿", "綦江", "潼南", "铜梁", "大足", "荣昌", "壁山",
|
||||
"梁平", "城口", "丰都", "垫江", "武隆", "忠县", "开县", "云阳", "奉节", "巫山", "巫溪",
|
||||
"石柱", "秀山", "酉阳", "彭水", "江津", "合川", "永川", "南川");
|
||||
break;
|
||||
case "安徽" :
|
||||
var cityOptions = new Array(
|
||||
"合肥", "安庆", "蚌埠", "亳州", "巢湖", "滁州", "阜阳", "贵池", "淮北", "淮化", "淮南",
|
||||
"黄山", "九华山", "六安", "马鞍山", "宿州", "铜陵", "屯溪", "芜湖", "宣城");
|
||||
break;
|
||||
case "福建" :
|
||||
var cityOptions = new Array(
|
||||
"福州", "厦门", "泉州", "漳州", "龙岩", "南平", "宁德", "莆田", "三明");
|
||||
break;
|
||||
case "甘肃" :
|
||||
var cityOptions = new Array(
|
||||
"兰州", "白银", "定西", "敦煌", "甘南", "金昌", "酒泉", "临夏", "平凉", "天水",
|
||||
"武都", "武威", "西峰", "张掖");
|
||||
break;
|
||||
case "广西" :
|
||||
var cityOptions = new Array(
|
||||
"南宁", "百色", "北海", "桂林", "防城港", "贵港", "河池", "贺州", "柳州", "钦州", "梧州", "玉林");
|
||||
break;
|
||||
case "贵州" :
|
||||
var cityOptions = new Array(
|
||||
"贵阳", "安顺", "毕节", "都匀", "凯里", "六盘水", "铜仁", "兴义", "玉屏", "遵义");
|
||||
break;
|
||||
case "海南" :
|
||||
var cityOptions = new Array(
|
||||
"海口", "儋县", "陵水", "琼海", "三亚", "通什", "万宁");
|
||||
break;
|
||||
case "河北" :
|
||||
var cityOptions = new Array(
|
||||
"石家庄", "保定", "北戴河", "沧州", "承德", "丰润", "邯郸", "衡水", "廊坊", "南戴河", "秦皇岛",
|
||||
"唐山", "新城", "邢台", "张家口");
|
||||
break;
|
||||
case "黑龙江" :
|
||||
var cityOptions = new Array(
|
||||
"哈尔滨", "北安", "大庆", "大兴安岭", "鹤岗", "黑河", "佳木斯", "鸡西", "牡丹江", "齐齐哈尔",
|
||||
"七台河", "双鸭山", "绥化", "伊春");
|
||||
break;
|
||||
case "河南" :
|
||||
var cityOptions = new Array(
|
||||
"郑州", "安阳", "鹤壁", "潢川", "焦作", "济源", "开封", "漯河", "洛阳", "南阳", "平顶山",
|
||||
"濮阳", "三门峡", "商丘", "新乡", "信阳", "许昌", "周口", "驻马店");
|
||||
break;
|
||||
case "香港" :
|
||||
var cityOptions = new Array(
|
||||
"香港", "九龙", "新界");
|
||||
break;
|
||||
case "湖北" :
|
||||
var cityOptions = new Array(
|
||||
"武汉", "恩施", "鄂州", "黄冈", "黄石", "荆门", "荆州", "潜江", "十堰", "随州", "武穴",
|
||||
"仙桃", "咸宁", "襄阳", "襄樊", "孝感", "宜昌");
|
||||
break;
|
||||
case "湖南" :
|
||||
var cityOptions = new Array(
|
||||
"长沙", "常德", "郴州", "衡阳", "怀化", "吉首", "娄底", "邵阳", "湘潭", "益阳", "岳阳",
|
||||
"永州", "张家界", "株洲");
|
||||
break;
|
||||
case "江西" :
|
||||
var cityOptions = new Array(
|
||||
"南昌", "抚州", "赣州", "吉安", "景德镇", "井冈山", "九江", "庐山", "萍乡",
|
||||
"上饶", "新余", "宜春", "鹰潭");
|
||||
break;
|
||||
case "吉林" :
|
||||
var cityOptions = new Array(
|
||||
"长春", "吉林", "白城", "白山", "珲春", "辽源", "梅河", "四平", "松原", "通化", "延吉");
|
||||
break;
|
||||
case "辽宁" :
|
||||
var cityOptions = new Array(
|
||||
"沈阳", "鞍山", "本溪", "朝阳", "大连", "丹东", "抚顺", "阜新", "葫芦岛", "锦州",
|
||||
"辽阳", "盘锦", "铁岭", "营口");
|
||||
break;
|
||||
case "澳门" :
|
||||
var cityOptions = new Array("澳门");
|
||||
break;
|
||||
case "内蒙古" :
|
||||
var cityOptions = new Array(
|
||||
"呼和浩特", "阿拉善盟", "包头", "赤峰", "东胜", "海拉尔", "集宁", "临河", "通辽", "乌海",
|
||||
"乌兰浩特", "锡林浩特");
|
||||
break;
|
||||
case "宁夏" :
|
||||
var cityOptions = new Array(
|
||||
"银川", "固源", "石嘴山", "吴忠");
|
||||
break;
|
||||
case "青海" :
|
||||
var cityOptions = new Array(
|
||||
"西宁", "德令哈", "格尔木", "共和", "海东", "海晏", "玛沁", "同仁", "玉树");
|
||||
break;
|
||||
case "山东" :
|
||||
var cityOptions = new Array(
|
||||
"济南", "滨州", "兖州", "德州", "东营", "菏泽", "济宁", "莱芜", "聊城", "临沂",
|
||||
"蓬莱", "青岛", "曲阜", "日照", "泰安", "潍坊", "威海", "烟台", "枣庄", "淄博");
|
||||
break;
|
||||
case "山西" :
|
||||
var cityOptions = new Array(
|
||||
"太原", "长治", "大同", "候马", "晋城", "离石", "临汾", "宁武", "朔州", "忻州",
|
||||
"阳泉", "榆次", "运城");
|
||||
break;
|
||||
case "陕西" :
|
||||
var cityOptions = new Array(
|
||||
"西安", "安康", "宝鸡", "汉中", "渭南", "商州", "绥德", "铜川", "咸阳", "延安", "榆林");
|
||||
break;
|
||||
case "四川" :
|
||||
var cityOptions = new Array(
|
||||
"成都", "巴中", "达川", "德阳", "都江堰", "峨眉山", "涪陵", "广安", "广元", "九寨沟",
|
||||
"康定", "乐山", "泸州", "马尔康", "绵阳", "眉山", "南充", "内江", "攀枝花", "遂宁",
|
||||
"汶川", "西昌", "雅安", "宜宾", "自贡", "资阳");
|
||||
break;
|
||||
case "台湾" :
|
||||
var cityOptions = new Array(
|
||||
"台北", "基隆", "台南", "台中", "高雄", "屏东", "南投", "云林", "新竹", "彰化", "苗栗",
|
||||
"嘉义", "花莲", "桃园", "宜兰", "台东", "金门", "马祖", "澎湖");
|
||||
break;
|
||||
case "天津" :
|
||||
var cityOptions = new Array(
|
||||
"天津", "和平", "东丽", "河东", "西青", "河西", "津南", "南开", "北辰", "河北", "武清", "红挢",
|
||||
"塘沽", "汉沽", "大港", "宁河", "静海", "宝坻", "蓟县");
|
||||
break;
|
||||
case "新疆" :
|
||||
var cityOptions = new Array(
|
||||
"乌鲁木齐", "阿克苏", "阿勒泰", "阿图什", "博乐", "昌吉", "东山", "哈密", "和田", "喀什",
|
||||
"克拉玛依", "库车", "库尔勒", "奎屯", "石河子", "塔城", "吐鲁番", "伊宁");
|
||||
break;
|
||||
case "西藏" :
|
||||
var cityOptions = new Array(
|
||||
"拉萨", "阿里", "昌都", "林芝", "那曲", "日喀则", "山南");
|
||||
break;
|
||||
case "云南" :
|
||||
var cityOptions = new Array(
|
||||
"昆明", "大理", "保山", "楚雄", "大理", "东川", "个旧", "景洪", "开远", "临沧", "丽江",
|
||||
"六库", "潞西", "曲靖", "思茅", "文山", "西双版纳", "玉溪", "中甸", "昭通");
|
||||
break;
|
||||
case "浙江" :
|
||||
var cityOptions = new Array(
|
||||
"杭州", "安吉", "慈溪", "定海", "奉化", "海盐", "黄岩", "湖州", "嘉兴", "金华", "临安",
|
||||
"临海", "丽水", "宁波", "瓯海", "平湖", "千岛湖", "衢州", "江山", "瑞安", "绍兴", "嵊州",
|
||||
"台州", "温岭", "温州", "余姚", "舟山");
|
||||
break;
|
||||
case "海外" :
|
||||
var cityOptions = new Array(
|
||||
"美国", "日本", "英国", "法国", "德国", "其他");
|
||||
break;
|
||||
default:
|
||||
var cityOptions = new Array("");
|
||||
break;
|
||||
}
|
||||
|
||||
cityField.options.length = 0;
|
||||
for (var i = 0; i < cityOptions.length; i++) {
|
||||
cityField.options[i] = new Option(cityOptions[i], cityOptions[i]);
|
||||
/*
|
||||
if (cityField.options[i].value==city)
|
||||
{
|
||||
//alert("here put City ok!");
|
||||
document.oblogform["city"].selectedIndex = i;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
|
||||
window.onload = function(){
|
||||
var identity = "<%= @cache_identityy %>";
|
||||
var no = "<%= @cache_no %>";
|
||||
var technical_title = "<%= @cache_technical_title %>";
|
||||
var province = "<%= @cache_province %>";
|
||||
var city = "<%= @cache_city %>";
|
||||
var enterprise_name = "<%= @cache_enterprise_name %>";
|
||||
//还原身份
|
||||
if(identity!=null&&identity!=""){
|
||||
$('#userIdentity').children("option[value='"+identity+"']").attr("selected","selected");
|
||||
showtechnical_title(identity, document.getElementById('userTechnical_title'));
|
||||
if(identity=="0"){
|
||||
//还原教师职称
|
||||
$('#userTechnical_title').children("option[value='"+technical_title+"']").attr("selected","selected");
|
||||
}else if(identity=="1"){
|
||||
//还原学号
|
||||
$("input[id='no']").attr("value",no);
|
||||
}
|
||||
}
|
||||
//还原地区
|
||||
if(province!=null&&province!=""){
|
||||
$("#userProvince").children("option[value='"+province+"']").attr("selected","selected");
|
||||
showcity(province, document.getElementById('userCity'));
|
||||
$("select[id='userCity']").children("option[value='"+city+"']").attr("selected","selected");
|
||||
}
|
||||
//还原企业名
|
||||
if(enterprise_name!=null&&enterprise_name!=""){
|
||||
$("input[id='enterprise_name']").attr("value",enterprise_name);
|
||||
}
|
||||
}
|
||||
|
||||
function showtechnical_title(identity, technical_titleField) {
|
||||
var technical_titleOptions = null;
|
||||
switch (identity) {
|
||||
|
||||
case '0' :
|
||||
$('#technical_title').show()
|
||||
$('#no').hide()
|
||||
$('#name').show()
|
||||
$('#enterprise').hide()
|
||||
$('#gender').show()
|
||||
technical_titleOptions = new Array(
|
||||
"<%= l(:label_technicl_title_professor) %>", "<%= l(:label_technicl_title_associate_professor) %>", "<%= l(:label_technicl_title_lecturer) %>", "<%= l(:label_technicl_title_teaching_assistant) %>");
|
||||
break;
|
||||
|
||||
case '1' :
|
||||
$('#technical_title').hide()
|
||||
$('#no').show()
|
||||
$('#name').show()
|
||||
$('#enterprise').hide()
|
||||
$('#gender').show()
|
||||
var titleOptions = new Array("");
|
||||
break;
|
||||
|
||||
case '2' :
|
||||
$('#technical_title').hide()
|
||||
$('#no').hide()
|
||||
$('#name').hide()
|
||||
$('#enterprise').show()
|
||||
$('#gender').hide()
|
||||
var titleOptions = new Array("");
|
||||
break;
|
||||
default:
|
||||
$('#technical_title').hide()
|
||||
$('#no').hide()
|
||||
$('#name').show()
|
||||
$('#enterprise').hide()
|
||||
$('#gender').show()
|
||||
var titleOptions = new Array("");
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
technical_titleField.options.length = 0;
|
||||
if(technical_titleOptions == null){
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < technical_titleOptions.length; i++) {
|
||||
technical_titleField.options[i] = new Option(technical_titleOptions[i], technical_titleOptions[i]);
|
||||
/*
|
||||
if (cityField.options[i].value==city)
|
||||
{
|
||||
//alert("here put City ok!");
|
||||
document.oblogform["city"].selectedIndex = i;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- end -->
|
||||
|
||||
<h3><%= l(:label_register) %> <%= link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %></h3>
|
||||
|
||||
<%= labelled_form_for @user, :url => register_path do |f| %>
|
||||
<%= error_messages_for 'user' %>
|
||||
<div class="box tabular">
|
||||
<p>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info" align="right" style="width: 90px">
|
||||
<strong><%= l(:label_identity) %><span class="required"> *</span></strong></td>
|
||||
<td class="info" style="width: 10px">
|
||||
<select onchange="showtechnical_title(this.value, document.getElementById('userTechnical_title'));" name="identity" id="userIdentity" class="location">
|
||||
<option value="">--请选择身份--</option>
|
||||
<option value="0"><%= l(:label_teacher) %></option>
|
||||
<option value="1"><%= l(:label_student) %></option>
|
||||
<option value="2"><%= l(:label_enterprise) %></option>
|
||||
<option value="3"><%= l(:label_account_developer) %></option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<span id='technical_title' style='display:none'>
|
||||
<select name="technical_title" id="userTechnical_title"></select>
|
||||
</span>
|
||||
<span id='no' style='display:none'>
|
||||
<strong>
|
||||
<%= l(:label_bidding_user_studentcode) %>
|
||||
<span class="required"> *</span>
|
||||
</strong>
|
||||
<% unless User.current.user_extensions.nil? %>
|
||||
<%= text_field_tag :no, User.current.user_extensions.student_id, :placeholder => "请输入学号" %>
|
||||
<% else %>
|
||||
<%= text_field_tag :no, nil, :placeholder => "请输入学号" %>
|
||||
<% end %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
<% if @user.auth_source_id.nil? %>
|
||||
<p><%= f.text_field :login, :size => 25, :required => true %><span id="valid_user_login"></span>
|
||||
<em class="info"><%= l(:label_max_number) %></em>
|
||||
</p>
|
||||
<p><%= f.password_field :password, :size => 25, :required => true %>
|
||||
<em class="info"><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em>
|
||||
</p>
|
||||
<p><%= f.password_field :password_confirmation, :size => 25, :required => true %></p>
|
||||
<% end %>
|
||||
<span id='name' style='display:none'>
|
||||
<p><%= f.text_field :firstname, :required => true %></p>
|
||||
<p><%= f.text_field :lastname, :required => true %></p>
|
||||
</span>
|
||||
<span id='enterprise' style='display:none'>
|
||||
<p>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info" align="right" style="width: 90px">
|
||||
<strong>企业名
|
||||
<span class="required"> *</span>
|
||||
</strong>
|
||||
</td>
|
||||
<td class="info" style="width: 10px">
|
||||
<%= text_field_tag :enterprise_name %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
</span>
|
||||
<p>
|
||||
<%= f.text_field :mail, :required => true %>
|
||||
<span id="valid_user_mail"></span>
|
||||
</p>
|
||||
<p>
|
||||
<em class="info"><%= "#{l(:label_mail_attention)} " %></em>
|
||||
</p>
|
||||
<p><%= f.select :language, lang_options_for_select, :required => true %></p>
|
||||
<!-- added by bai 增加了身份、性别和地区-->
|
||||
|
||||
<span id='gender' style='display:none'>
|
||||
<p>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info" align="right" style="width: 90px">
|
||||
<strong><%= l(:label_gender) %><span class="required"> </span></strong></td>
|
||||
<td class="info" style="width: 10px">
|
||||
<%= select_tag 'gender', "<option value = '0'>#{l(:label_gender_male)}</option>
|
||||
<option value = '1'>#{l(:label_gender_female)}</option>".html_safe %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
</span>
|
||||
<p>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info" align="right" style="width: 90px">
|
||||
<strong><%= l(:label_location) %><span class="required"> *</span></strong>
|
||||
</td>
|
||||
<td class="info" style="width: 80px">
|
||||
<select onchange="showcity(this.value, document.getElementById('userCity'));" name="province" id="userProvince">
|
||||
<option value="">--请选择省份--</option>
|
||||
<option value="北京">北京</option>
|
||||
<option value="上海">上海</option>
|
||||
<option value="广东">广东</option>
|
||||
<option value="江苏">江苏</option>
|
||||
<option value="浙江">浙江</option>
|
||||
<option value="重庆">重庆</option>
|
||||
<option value="安徽">安徽</option>
|
||||
<option value="福建">福建</option>
|
||||
<option value="甘肃">甘肃</option>
|
||||
<option value="广西">广西</option>
|
||||
<option value="贵州">贵州</option>
|
||||
<option value="海南">海南</option>
|
||||
<option value="河北">河北</option>
|
||||
<option value="黑龙江">黑龙江</option>
|
||||
<option value="河南">河南</option>
|
||||
<option value="湖北">湖北</option>
|
||||
<option value="湖南">湖南</option>
|
||||
<option value="江西">江西</option>
|
||||
<option value="吉林">吉林</option>
|
||||
<option value="辽宁">辽宁</option>
|
||||
<option value="内蒙古">内蒙古</option>
|
||||
<option value="宁夏">宁夏</option>
|
||||
<option value="青海">青海</option>
|
||||
<option value="山东">山东</option>
|
||||
<option value="山西">山西</option>
|
||||
<option value="陕西">陕西</option>
|
||||
<option value="四川">四川</option>
|
||||
<option value="天津">天津</option>
|
||||
<option value="新疆">新疆</option>
|
||||
<option value="西藏">西藏</option>
|
||||
<option value="云南">云南</option>
|
||||
<option value="香港">香港特别行政区</option>
|
||||
<option value="澳门">澳门特别行政区</option>
|
||||
<option value="台湾">台湾</option>
|
||||
<option value="海外">海外</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="info" style="width: 100px">
|
||||
<select name="city" id="userCity"></select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
<!-- end -->
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<table>
|
||||
<tr>
|
||||
<td><%= submit_tag l(:button_submit) %></td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
<% end %>
|
||||
<% if Setting.openid? %>
|
||||
<p><%= f.text_field :identity_url %></p>
|
||||
<% end %>
|
||||
<% @user.custom_field_values.select { |v| v.editable? || v.required? }.each do |value| %>
|
||||
<p><%= custom_field_tag_with_label :user, value %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
var $login = $('#user_login')
|
||||
var $mail = $('#user_mail')
|
||||
|
||||
$login.blur(function (event) {
|
||||
if ($(this).is('#user_login')) {
|
||||
$.get(
|
||||
'<%=account_valid_ajax_path%>',
|
||||
{ valid: "login",
|
||||
value: this.value },
|
||||
function (data) {
|
||||
if (data.valid) {
|
||||
$('#valid_user_login').html('<span class="green">' + data.message + "</span>");
|
||||
} else {
|
||||
$('#valid_user_login').html('<span class="red">' + data.message + "</span>");
|
||||
}
|
||||
});
|
||||
}
|
||||
;
|
||||
});
|
||||
|
||||
$mail.blur(function (event) {
|
||||
if ($(this).is('#user_mail')) {
|
||||
$.get('<%=account_valid_ajax_path%>',
|
||||
{ valid: "mail",
|
||||
value: this.value },
|
||||
function (data) {
|
||||
if (data.valid) {
|
||||
$('#valid_user_mail').html('<span class="green">' + data.message + "</span>");
|
||||
} else {
|
||||
$('#valid_user_mail').html('<span class="red">' + data.message + "</span>");
|
||||
}
|
||||
});
|
||||
}
|
||||
;
|
||||
});
|
||||
});
|
||||
<% @nav_dispaly_home_path_label = 1
|
||||
@nav_dispaly_main_course_label = 1
|
||||
@nav_dispaly_main_project_label = 1
|
||||
@nav_dispaly_main_contest_label = 1 %>
|
||||
<% @nav_dispaly_forum_label = 1%>
|
||||
<!-- added by bai 增加地区-->
|
||||
<script type="text/javascript" language="javascript">
|
||||
function showcity(province, cityField) {
|
||||
switch (province) {
|
||||
case "北京" :
|
||||
var cityOptions = new Array(
|
||||
"东城", "西城", "朝阳", "丰台", "石景山", "海淀", "门头沟",
|
||||
"房山", "通州", "顺义", "昌平", "大兴", "平谷", "怀柔", "密云", "延庆");
|
||||
break;
|
||||
case "上海" :
|
||||
var cityOptions = new Array(
|
||||
"崇明", "黄浦", "卢湾", "徐汇", "长宁", "静安", "普陀", "闸北", "虹口", "杨浦", "闵行",
|
||||
"宝山", "嘉定", "浦东", "金山", "松江", "青浦", "南汇", "奉贤");
|
||||
break;
|
||||
case "广东" :
|
||||
var cityOptions = new Array(
|
||||
"广州", "深圳", "珠海", "东莞", "中山", "佛山", "惠州", "河源", "潮州", "江门", "揭阳", "茂名",
|
||||
"梅州", "清远", "汕头", "汕尾", "韶关", "顺德", "阳江", "云浮", "湛江", "肇庆");
|
||||
break;
|
||||
case "江苏" :
|
||||
var cityOptions = new Array(
|
||||
"南京", "常熟", "常州", "海门", "淮安", "江都", "江阴", "昆山", "连云港", "南通",
|
||||
"启东", "沭阳", "宿迁", "苏州", "太仓", "泰州", "同里", "无锡", "徐州", "盐城",
|
||||
"扬州", "宜兴", "仪征", "张家港", "镇江", "周庄");
|
||||
break;
|
||||
case "重庆" :
|
||||
var cityOptions = new Array(
|
||||
"万州", "涪陵", "渝中", "大渡口", "江北", "沙坪坝", "九龙坡", "南岸", "北碚", "万盛",
|
||||
"双挢", "渝北", "巴南", "黔江", "长寿", "綦江", "潼南", "铜梁", "大足", "荣昌", "壁山",
|
||||
"梁平", "城口", "丰都", "垫江", "武隆", "忠县", "开县", "云阳", "奉节", "巫山", "巫溪",
|
||||
"石柱", "秀山", "酉阳", "彭水", "江津", "合川", "永川", "南川");
|
||||
break;
|
||||
case "安徽" :
|
||||
var cityOptions = new Array(
|
||||
"合肥", "安庆", "蚌埠", "亳州", "巢湖", "滁州", "阜阳", "贵池", "淮北", "淮化", "淮南",
|
||||
"黄山", "九华山", "六安", "马鞍山", "宿州", "铜陵", "屯溪", "芜湖", "宣城");
|
||||
break;
|
||||
case "福建" :
|
||||
var cityOptions = new Array(
|
||||
"福州", "厦门", "泉州", "漳州", "龙岩", "南平", "宁德", "莆田", "三明");
|
||||
break;
|
||||
case "甘肃" :
|
||||
var cityOptions = new Array(
|
||||
"兰州", "白银", "定西", "敦煌", "甘南", "金昌", "酒泉", "临夏", "平凉", "天水",
|
||||
"武都", "武威", "西峰", "张掖");
|
||||
break;
|
||||
case "广西" :
|
||||
var cityOptions = new Array(
|
||||
"南宁", "百色", "北海", "桂林", "防城港", "贵港", "河池", "贺州", "柳州", "钦州", "梧州", "玉林");
|
||||
break;
|
||||
case "贵州" :
|
||||
var cityOptions = new Array(
|
||||
"贵阳", "安顺", "毕节", "都匀", "凯里", "六盘水", "铜仁", "兴义", "玉屏", "遵义");
|
||||
break;
|
||||
case "海南" :
|
||||
var cityOptions = new Array(
|
||||
"海口", "儋县", "陵水", "琼海", "三亚", "通什", "万宁");
|
||||
break;
|
||||
case "河北" :
|
||||
var cityOptions = new Array(
|
||||
"石家庄", "保定", "北戴河", "沧州", "承德", "丰润", "邯郸", "衡水", "廊坊", "南戴河", "秦皇岛",
|
||||
"唐山", "新城", "邢台", "张家口");
|
||||
break;
|
||||
case "黑龙江" :
|
||||
var cityOptions = new Array(
|
||||
"哈尔滨", "北安", "大庆", "大兴安岭", "鹤岗", "黑河", "佳木斯", "鸡西", "牡丹江", "齐齐哈尔",
|
||||
"七台河", "双鸭山", "绥化", "伊春");
|
||||
break;
|
||||
case "河南" :
|
||||
var cityOptions = new Array(
|
||||
"郑州", "安阳", "鹤壁", "潢川", "焦作", "济源", "开封", "漯河", "洛阳", "南阳", "平顶山",
|
||||
"濮阳", "三门峡", "商丘", "新乡", "信阳", "许昌", "周口", "驻马店");
|
||||
break;
|
||||
case "香港" :
|
||||
var cityOptions = new Array(
|
||||
"香港", "九龙", "新界");
|
||||
break;
|
||||
case "湖北" :
|
||||
var cityOptions = new Array(
|
||||
"武汉", "恩施", "鄂州", "黄冈", "黄石", "荆门", "荆州", "潜江", "十堰", "随州", "武穴",
|
||||
"仙桃", "咸宁", "襄阳", "襄樊", "孝感", "宜昌");
|
||||
break;
|
||||
case "湖南" :
|
||||
var cityOptions = new Array(
|
||||
"长沙", "常德", "郴州", "衡阳", "怀化", "吉首", "娄底", "邵阳", "湘潭", "益阳", "岳阳",
|
||||
"永州", "张家界", "株洲");
|
||||
break;
|
||||
case "江西" :
|
||||
var cityOptions = new Array(
|
||||
"南昌", "抚州", "赣州", "吉安", "景德镇", "井冈山", "九江", "庐山", "萍乡",
|
||||
"上饶", "新余", "宜春", "鹰潭");
|
||||
break;
|
||||
case "吉林" :
|
||||
var cityOptions = new Array(
|
||||
"长春", "吉林", "白城", "白山", "珲春", "辽源", "梅河", "四平", "松原", "通化", "延吉");
|
||||
break;
|
||||
case "辽宁" :
|
||||
var cityOptions = new Array(
|
||||
"沈阳", "鞍山", "本溪", "朝阳", "大连", "丹东", "抚顺", "阜新", "葫芦岛", "锦州",
|
||||
"辽阳", "盘锦", "铁岭", "营口");
|
||||
break;
|
||||
case "澳门" :
|
||||
var cityOptions = new Array("澳门");
|
||||
break;
|
||||
case "内蒙古" :
|
||||
var cityOptions = new Array(
|
||||
"呼和浩特", "阿拉善盟", "包头", "赤峰", "东胜", "海拉尔", "集宁", "临河", "通辽", "乌海",
|
||||
"乌兰浩特", "锡林浩特");
|
||||
break;
|
||||
case "宁夏" :
|
||||
var cityOptions = new Array(
|
||||
"银川", "固源", "石嘴山", "吴忠");
|
||||
break;
|
||||
case "青海" :
|
||||
var cityOptions = new Array(
|
||||
"西宁", "德令哈", "格尔木", "共和", "海东", "海晏", "玛沁", "同仁", "玉树");
|
||||
break;
|
||||
case "山东" :
|
||||
var cityOptions = new Array(
|
||||
"济南", "滨州", "兖州", "德州", "东营", "菏泽", "济宁", "莱芜", "聊城", "临沂",
|
||||
"蓬莱", "青岛", "曲阜", "日照", "泰安", "潍坊", "威海", "烟台", "枣庄", "淄博");
|
||||
break;
|
||||
case "山西" :
|
||||
var cityOptions = new Array(
|
||||
"太原", "长治", "大同", "候马", "晋城", "离石", "临汾", "宁武", "朔州", "忻州",
|
||||
"阳泉", "榆次", "运城");
|
||||
break;
|
||||
case "陕西" :
|
||||
var cityOptions = new Array(
|
||||
"西安", "安康", "宝鸡", "汉中", "渭南", "商州", "绥德", "铜川", "咸阳", "延安", "榆林");
|
||||
break;
|
||||
case "四川" :
|
||||
var cityOptions = new Array(
|
||||
"成都", "巴中", "达川", "德阳", "都江堰", "峨眉山", "涪陵", "广安", "广元", "九寨沟",
|
||||
"康定", "乐山", "泸州", "马尔康", "绵阳", "眉山", "南充", "内江", "攀枝花", "遂宁",
|
||||
"汶川", "西昌", "雅安", "宜宾", "自贡", "资阳");
|
||||
break;
|
||||
case "台湾" :
|
||||
var cityOptions = new Array(
|
||||
"台北", "基隆", "台南", "台中", "高雄", "屏东", "南投", "云林", "新竹", "彰化", "苗栗",
|
||||
"嘉义", "花莲", "桃园", "宜兰", "台东", "金门", "马祖", "澎湖");
|
||||
break;
|
||||
case "天津" :
|
||||
var cityOptions = new Array(
|
||||
"天津", "和平", "东丽", "河东", "西青", "河西", "津南", "南开", "北辰", "河北", "武清", "红挢",
|
||||
"塘沽", "汉沽", "大港", "宁河", "静海", "宝坻", "蓟县");
|
||||
break;
|
||||
case "新疆" :
|
||||
var cityOptions = new Array(
|
||||
"乌鲁木齐", "阿克苏", "阿勒泰", "阿图什", "博乐", "昌吉", "东山", "哈密", "和田", "喀什",
|
||||
"克拉玛依", "库车", "库尔勒", "奎屯", "石河子", "塔城", "吐鲁番", "伊宁");
|
||||
break;
|
||||
case "西藏" :
|
||||
var cityOptions = new Array(
|
||||
"拉萨", "阿里", "昌都", "林芝", "那曲", "日喀则", "山南");
|
||||
break;
|
||||
case "云南" :
|
||||
var cityOptions = new Array(
|
||||
"昆明", "大理", "保山", "楚雄", "大理", "东川", "个旧", "景洪", "开远", "临沧", "丽江",
|
||||
"六库", "潞西", "曲靖", "思茅", "文山", "西双版纳", "玉溪", "中甸", "昭通");
|
||||
break;
|
||||
case "浙江" :
|
||||
var cityOptions = new Array(
|
||||
"杭州", "安吉", "慈溪", "定海", "奉化", "海盐", "黄岩", "湖州", "嘉兴", "金华", "临安",
|
||||
"临海", "丽水", "宁波", "瓯海", "平湖", "千岛湖", "衢州", "江山", "瑞安", "绍兴", "嵊州",
|
||||
"台州", "温岭", "温州", "余姚", "舟山");
|
||||
break;
|
||||
case "海外" :
|
||||
var cityOptions = new Array(
|
||||
"美国", "日本", "英国", "法国", "德国", "其他");
|
||||
break;
|
||||
default:
|
||||
var cityOptions = new Array("");
|
||||
break;
|
||||
}
|
||||
|
||||
cityField.options.length = 0;
|
||||
for (var i = 0; i < cityOptions.length; i++) {
|
||||
cityField.options[i] = new Option(cityOptions[i], cityOptions[i]);
|
||||
/*
|
||||
if (cityField.options[i].value==city)
|
||||
{
|
||||
//alert("here put City ok!");
|
||||
document.oblogform["city"].selectedIndex = i;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" language="javascript">
|
||||
|
||||
window.onload = function(){
|
||||
var identity = "<%= @cache_identityy %>";
|
||||
var no = "<%= @cache_no %>";
|
||||
var technical_title = "<%= @cache_technical_title %>";
|
||||
var province = "<%= @cache_province %>";
|
||||
var city = "<%= @cache_city %>";
|
||||
var enterprise_name = "<%= @cache_enterprise_name %>";
|
||||
//还原身份
|
||||
if(identity!=null&&identity!=""){
|
||||
$('#userIdentity').children("option[value='"+identity+"']").attr("selected","selected");
|
||||
showtechnical_title(identity, document.getElementById('userTechnical_title'));
|
||||
if(identity=="0"){
|
||||
//还原教师职称
|
||||
$('#userTechnical_title').children("option[value='"+technical_title+"']").attr("selected","selected");
|
||||
}else if(identity=="1"){
|
||||
//还原学号
|
||||
$("input[id='no']").attr("value",no);
|
||||
}
|
||||
}
|
||||
//还原地区
|
||||
if(province!=null&&province!=""){
|
||||
$("#userProvince").children("option[value='"+province+"']").attr("selected","selected");
|
||||
showcity(province, document.getElementById('userCity'));
|
||||
$("select[id='userCity']").children("option[value='"+city+"']").attr("selected","selected");
|
||||
}
|
||||
//还原企业名
|
||||
if(enterprise_name!=null&&enterprise_name!=""){
|
||||
$("input[id='enterprise_name']").attr("value",enterprise_name);
|
||||
}
|
||||
}
|
||||
|
||||
function showtechnical_title(identity, technical_titleField) {
|
||||
var technical_titleOptions = null;
|
||||
switch (identity) {
|
||||
|
||||
case '0' :
|
||||
$('#technical_title').show()
|
||||
$('#no').hide()
|
||||
$('#name').show()
|
||||
$('#enterprise').hide()
|
||||
$('#gender').show()
|
||||
technical_titleOptions = new Array(
|
||||
"<%= l(:label_technicl_title_professor) %>", "<%= l(:label_technicl_title_associate_professor) %>", "<%= l(:label_technicl_title_lecturer) %>", "<%= l(:label_technicl_title_teaching_assistant) %>");
|
||||
break;
|
||||
|
||||
case '1' :
|
||||
$('#technical_title').hide()
|
||||
$('#no').show()
|
||||
$('#name').show()
|
||||
$('#enterprise').hide()
|
||||
$('#gender').show()
|
||||
var titleOptions = new Array("");
|
||||
break;
|
||||
|
||||
case '2' :
|
||||
$('#technical_title').hide()
|
||||
$('#no').hide()
|
||||
$('#name').hide()
|
||||
$('#enterprise').show()
|
||||
$('#gender').hide()
|
||||
var titleOptions = new Array("");
|
||||
break;
|
||||
default:
|
||||
$('#technical_title').hide()
|
||||
$('#no').hide()
|
||||
$('#name').show()
|
||||
$('#enterprise').hide()
|
||||
$('#gender').show()
|
||||
var titleOptions = new Array("");
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
technical_titleField.options.length = 0;
|
||||
if(technical_titleOptions == null){
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < technical_titleOptions.length; i++) {
|
||||
technical_titleField.options[i] = new Option(technical_titleOptions[i], technical_titleOptions[i]);
|
||||
/*
|
||||
if (cityField.options[i].value==city)
|
||||
{
|
||||
//alert("here put City ok!");
|
||||
document.oblogform["city"].selectedIndex = i;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- end -->
|
||||
|
||||
<h3><%= l(:label_register) %> <%= link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %></h3>
|
||||
|
||||
<%= labelled_form_for @user, :url => register_path do |f| %>
|
||||
<%= error_messages_for 'user' %>
|
||||
<div class="box tabular">
|
||||
<p>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info" align="right" style="width: 90px">
|
||||
<strong><%= l(:label_identity) %><span class="required"> *</span></strong></td>
|
||||
<td class="info" style="width: 10px">
|
||||
<select onchange="showtechnical_title(this.value, document.getElementById('userTechnical_title'));" name="identity" id="userIdentity" class="location">
|
||||
<option value="">--请选择身份--</option>
|
||||
<option value="0"><%= l(:label_teacher) %></option>
|
||||
<option value="1"><%= l(:label_student) %></option>
|
||||
<option value="2"><%= l(:label_enterprise) %></option>
|
||||
<option value="3"><%= l(:label_account_developer) %></option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<span id='technical_title' style='display:none'>
|
||||
<select name="technical_title" id="userTechnical_title"></select>
|
||||
</span>
|
||||
<span id='no' style='display:none'>
|
||||
<strong>
|
||||
<%= l(:label_bidding_user_studentcode) %>
|
||||
<span class="required"> *</span>
|
||||
</strong>
|
||||
<% unless User.current.user_extensions.nil? %>
|
||||
<%= text_field_tag :no, User.current.user_extensions.student_id, :placeholder => "请输入学号" %>
|
||||
<% else %>
|
||||
<%= text_field_tag :no, nil, :placeholder => "请输入学号" %>
|
||||
<% end %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
<% if @user.auth_source_id.nil? %>
|
||||
<p><%= f.text_field :login, :size => 25, :required => true %><span id="valid_user_login"></span>
|
||||
<em class="info"><%= l(:label_max_number) %></em>
|
||||
</p>
|
||||
<p><%= f.password_field :password, :size => 25, :required => true %>
|
||||
<em class="info"><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em>
|
||||
</p>
|
||||
<p><%= f.password_field :password_confirmation, :size => 25, :required => true %></p>
|
||||
<% end %>
|
||||
<span id='name' style='display:none'>
|
||||
<p><%= f.text_field :firstname, :required => true %></p>
|
||||
<p><%= f.text_field :lastname, :required => true %></p>
|
||||
</span>
|
||||
<span id='enterprise' style='display:none'>
|
||||
<p>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info" align="right" style="width: 90px">
|
||||
<strong>企业名
|
||||
<span class="required"> *</span>
|
||||
</strong>
|
||||
</td>
|
||||
<td class="info" style="width: 10px">
|
||||
<%= text_field_tag :enterprise_name %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
</span>
|
||||
<p>
|
||||
<%= f.text_field :mail, :required => true %>
|
||||
<span id="valid_user_mail"></span>
|
||||
</p>
|
||||
<p>
|
||||
<em class="info"><%= "#{l(:label_mail_attention)} " %></em>
|
||||
</p>
|
||||
<p><%= f.select :language, lang_options_for_select, :required => true %></p>
|
||||
<!-- added by bai 增加了身份、性别和地区-->
|
||||
|
||||
<span id='gender' style='display:none'>
|
||||
<p>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info" align="right" style="width: 90px">
|
||||
<strong><%= l(:label_gender) %><span class="required"> </span></strong></td>
|
||||
<td class="info" style="width: 10px">
|
||||
<%= select_tag 'gender', "<option value = '0'>#{l(:label_gender_male)}</option>
|
||||
<option value = '1'>#{l(:label_gender_female)}</option>".html_safe %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
</span>
|
||||
<p>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info" align="right" style="width: 90px">
|
||||
<strong><%= l(:label_location) %><span class="required"> *</span></strong>
|
||||
</td>
|
||||
<td class="info" style="width: 80px">
|
||||
<select onchange="showcity(this.value, document.getElementById('userCity'));" name="province" id="userProvince">
|
||||
<option value="">--请选择省份--</option>
|
||||
<option value="北京">北京</option>
|
||||
<option value="上海">上海</option>
|
||||
<option value="广东">广东</option>
|
||||
<option value="江苏">江苏</option>
|
||||
<option value="浙江">浙江</option>
|
||||
<option value="重庆">重庆</option>
|
||||
<option value="安徽">安徽</option>
|
||||
<option value="福建">福建</option>
|
||||
<option value="甘肃">甘肃</option>
|
||||
<option value="广西">广西</option>
|
||||
<option value="贵州">贵州</option>
|
||||
<option value="海南">海南</option>
|
||||
<option value="河北">河北</option>
|
||||
<option value="黑龙江">黑龙江</option>
|
||||
<option value="河南">河南</option>
|
||||
<option value="湖北">湖北</option>
|
||||
<option value="湖南">湖南</option>
|
||||
<option value="江西">江西</option>
|
||||
<option value="吉林">吉林</option>
|
||||
<option value="辽宁">辽宁</option>
|
||||
<option value="内蒙古">内蒙古</option>
|
||||
<option value="宁夏">宁夏</option>
|
||||
<option value="青海">青海</option>
|
||||
<option value="山东">山东</option>
|
||||
<option value="山西">山西</option>
|
||||
<option value="陕西">陕西</option>
|
||||
<option value="四川">四川</option>
|
||||
<option value="天津">天津</option>
|
||||
<option value="新疆">新疆</option>
|
||||
<option value="西藏">西藏</option>
|
||||
<option value="云南">云南</option>
|
||||
<option value="香港">香港特别行政区</option>
|
||||
<option value="澳门">澳门特别行政区</option>
|
||||
<option value="台湾">台湾</option>
|
||||
<option value="海外">海外</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="info" style="width: 100px">
|
||||
<select name="city" id="userCity"></select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
<!-- end -->
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<table>
|
||||
<tr>
|
||||
<td><%= submit_tag l(:button_submit) %></td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
<% end %>
|
||||
<% if Setting.openid? %>
|
||||
<p><%= f.text_field :identity_url %></p>
|
||||
<% end %>
|
||||
<% @user.custom_field_values.select { |v| v.editable? || v.required? }.each do |value| %>
|
||||
<p><%= custom_field_tag_with_label :user, value %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
var $login = $('#user_login')
|
||||
var $mail = $('#user_mail')
|
||||
|
||||
$login.blur(function (event) {
|
||||
if ($(this).is('#user_login')) {
|
||||
$.get(
|
||||
'<%=account_valid_ajax_path%>',
|
||||
{ valid: "login",
|
||||
value: this.value },
|
||||
function (data) {
|
||||
if (data.valid) {
|
||||
$('#valid_user_login').html('<span class="green">' + data.message + "</span>");
|
||||
} else {
|
||||
$('#valid_user_login').html('<span class="red">' + data.message + "</span>");
|
||||
}
|
||||
});
|
||||
}
|
||||
;
|
||||
});
|
||||
|
||||
$mail.blur(function (event) {
|
||||
if ($(this).is('#user_mail')) {
|
||||
$.get('<%=account_valid_ajax_path%>',
|
||||
{ valid: "mail",
|
||||
value: this.value },
|
||||
function (data) {
|
||||
if (data.valid) {
|
||||
$('#valid_user_mail').html('<span class="green">' + data.message + "</span>");
|
||||
} else {
|
||||
$('#valid_user_mail').html('<span class="red">' + data.message + "</span>");
|
||||
}
|
||||
});
|
||||
}
|
||||
;
|
||||
});
|
||||
});
|
||||
</script>
|
@ -1,122 +1,122 @@
|
||||
<script type="text/javascript">
|
||||
function get_options(value) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/school/get_options/' + encodeURIComponent(value),
|
||||
data: 'text',
|
||||
success: function (data) {
|
||||
$("#occupation").html(data);
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function check() {
|
||||
var regex = /^\d*$/;
|
||||
if (!regex.test($("#class_period").val())) {
|
||||
alert("学时只能为整数");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<% object = [] %>
|
||||
<% object << 'course' %>
|
||||
<%= error_messages_for object %>
|
||||
<% unless @course.new_record? %>
|
||||
<p><%= render :partial => "avatar/avatar_form", :locals => {source: @course} %></p>
|
||||
<% end %>
|
||||
<p>
|
||||
<label for="course_name" style="font-size: 13px;">
|
||||
<%= l(:label_tags_course_name) %>
|
||||
<span class="required">* </span>
|
||||
</label>
|
||||
<input id="course_name" type="text" value="<%= @course.name %>" style="width:490px;size:60;" name = "course[name]" maxlength="100">
|
||||
</p>
|
||||
|
||||
<%= f.fields_for @course do |m| %>
|
||||
<% unless @course.nil? %>
|
||||
<p>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<span class="info" align="right" style="width: 90px; font-weight: bold ;margin-left:22px"><%= l(:label_class_period) %>
|
||||
<span class="required"> * </span></span>
|
||||
<span class="info" style="width: 10px;"><%= text_field_tag :class_period, @course.class_period, :placeholder => "在此输入课时", :maxlength => 5 %></span>
|
||||
<span> <strong><%= l(:label_class_hour) %></strong></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
<% else %>
|
||||
<p>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<span class="info" align="right" style="width: 90px; font-weight: bold ;margin-left:22px"><%= l(:label_class_period) %>
|
||||
<span class="required"> * </span></span>
|
||||
<span class="info" style="width: 10px;"><%= text_field_tag :class_period, nil, :placeholder => "在此输入课时", :maxlength => 5 %></span><strong><%= l(:label_class_hour) %></strong>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
<% end %>
|
||||
<p>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<% if @course != nil %>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info" align="right" style="width: 86px">
|
||||
<strong><%= l(:label_term) %><span class="required"> * </span></strong>
|
||||
</td>
|
||||
<td class="info" style="width: 10px">
|
||||
<%= select_tag :time,options_for_select(course_time_option,@course.time), {} %>
|
||||
</td>
|
||||
<td class="info" style="width: 10px">
|
||||
<%= select_tag :term,options_for_select(course_term_option,@course.term),{} %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
<p style="margin-left:-10px;">
|
||||
<label for="course[course]_password" style="font-size: 13px;"><%= l(:label_new_course_password) %>
|
||||
<span class="required">*</span>
|
||||
</label>
|
||||
<input id="course_course_password" type="text" style="width:488px;margin-left: 10px;" value="<%= @course.password %>" size="60" name="course[password]"/>
|
||||
</p>
|
||||
<em class="info" style="margin-left:95px;"><%= l(:text_command) %></em>
|
||||
<% end %>
|
||||
<p style="padding-right: 20px;">
|
||||
<label for="course_description" style="font-size: 13px;">
|
||||
<%= l(:label_new_course_description) %>
|
||||
</label>
|
||||
<span class="jstEditor">
|
||||
<textarea id="course_description" class="wiki-edit" style="font-size:small;width:490px;margin-left:10px;" rows="8" name="course[description]" cols="40">
|
||||
<%= @course.description %>
|
||||
</textarea>
|
||||
</span>
|
||||
</p>
|
||||
<p style="margin-left:-10px;">
|
||||
<em style="color: #888888;display: block;font-size: 90%;font-style: normal;">
|
||||
<%= f.check_box :is_public, :style => "margin-left:10px;" %>
|
||||
<%= l(:label_course_public_info) %>
|
||||
</em>
|
||||
</p><!-- modified by bai -->
|
||||
<p style="display:none;"><%= f.text_field :course_type, :value => 1 %></p>
|
||||
<%= wikitoolbar_for 'course_description' %>
|
||||
<% @course.custom_field_values.each do |value| %>
|
||||
<p><%= custom_field_tag_with_label :course, value %></p>
|
||||
<% end %>
|
||||
<%= call_hook(:view_courses_form, :course => @course, :form => f) %>
|
||||
<!--[eoform:course]-->
|
||||
|
||||
<% unless @course.extra_frozen? %>
|
||||
<% content_for :header_tags do %>
|
||||
<%= javascript_include_tag 'course_identifier' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
function get_options(value) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/school/get_options/' + encodeURIComponent(value),
|
||||
data: 'text',
|
||||
success: function (data) {
|
||||
$("#occupation").html(data);
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function check() {
|
||||
var regex = /^\d*$/;
|
||||
if (!regex.test($("#class_period").val())) {
|
||||
alert("学时只能为整数");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<% object = [] %>
|
||||
<% object << 'course' %>
|
||||
<%= error_messages_for object %>
|
||||
<% unless @course.new_record? %>
|
||||
<p><%= render :partial => "avatar/avatar_form", :locals => {source: @course} %></p>
|
||||
<% end %>
|
||||
<p>
|
||||
<label for="course_name" style="font-size: 13px;">
|
||||
<%= l(:label_tags_course_name) %>
|
||||
<span class="required">* </span>
|
||||
</label>
|
||||
<input id="course_name" type="text" value="<%= @course.name %>" style="width:490px;size:60;" name = "course[name]" maxlength="100">
|
||||
</p>
|
||||
|
||||
<%= f.fields_for @course do |m| %>
|
||||
<% unless @course.nil? %>
|
||||
<p>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<span class="info" align="right" style="width: 90px; font-weight: bold ;margin-left:22px"><%= l(:label_class_period) %>
|
||||
<span class="required"> * </span></span>
|
||||
<span class="info" style="width: 10px;"><%= text_field_tag :class_period, @course.class_period, :placeholder => "在此输入课时", :maxlength => 5 %></span>
|
||||
<span> <strong><%= l(:label_class_hour) %></strong></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
<% else %>
|
||||
<p>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<span class="info" align="right" style="width: 90px; font-weight: bold ;margin-left:22px"><%= l(:label_class_period) %>
|
||||
<span class="required"> * </span></span>
|
||||
<span class="info" style="width: 10px;"><%= text_field_tag :class_period, nil, :placeholder => "在此输入课时", :maxlength => 5 %></span><strong><%= l(:label_class_hour) %></strong>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
<% end %>
|
||||
<p>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<% if @course != nil %>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info" align="right" style="width: 86px">
|
||||
<strong><%= l(:label_term) %><span class="required"> * </span></strong>
|
||||
</td>
|
||||
<td class="info" style="width: 10px">
|
||||
<%= select_tag :time,options_for_select(course_time_option,@course.time), {} %>
|
||||
</td>
|
||||
<td class="info" style="width: 10px">
|
||||
<%= select_tag :term,options_for_select(course_term_option,@course.term),{} %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
<p style="margin-left:-10px;">
|
||||
<label for="course[course]_password" style="font-size: 13px;"><%= l(:label_new_course_password) %>
|
||||
<span class="required">*</span>
|
||||
</label>
|
||||
<input id="course_course_password" type="text" style="width:488px;margin-left: 10px;" value="<%= @course.password %>" size="60" name="course[password]"/>
|
||||
</p>
|
||||
<em class="info" style="margin-left:95px;"><%= l(:text_command) %></em>
|
||||
<% end %>
|
||||
<p style="padding-right: 20px;">
|
||||
<label for="course_description" style="font-size: 13px;">
|
||||
<%= l(:label_new_course_description) %>
|
||||
</label>
|
||||
<span class="jstEditor">
|
||||
<textarea id="course_description" class="wiki-edit" style="font-size:small;width:490px;margin-left:10px;" rows="8" name="course[description]" cols="40">
|
||||
<%= @course.description %>
|
||||
</textarea>
|
||||
</span>
|
||||
</p>
|
||||
<p style="margin-left:-10px;">
|
||||
<em style="color: #888888;display: block;font-size: 90%;font-style: normal;">
|
||||
<%= f.check_box :is_public, :style => "margin-left:10px;" %>
|
||||
<%= l(:label_course_public_info) %>
|
||||
</em>
|
||||
</p><!-- modified by bai -->
|
||||
<p style="display:none;"><%= f.text_field :course_type, :value => 1 %></p>
|
||||
<%= wikitoolbar_for 'course_description' %>
|
||||
<% @course.custom_field_values.each do |value| %>
|
||||
<p><%= custom_field_tag_with_label :course, value %></p>
|
||||
<% end %>
|
||||
<%= call_hook(:view_courses_form, :course => @course, :form => f) %>
|
||||
<!--[eoform:course]-->
|
||||
|
||||
<% unless @course.extra_frozen? %>
|
||||
<% content_for :header_tags do %>
|
||||
<%= javascript_include_tag 'course_identifier' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
@ -1,105 +1,105 @@
|
||||
<%= error_messages_for 'member' %>
|
||||
<%
|
||||
roles = Role.givable.all
|
||||
roles = roles[3..5]
|
||||
members = @course.member_principals.includes(:roles, :principal).all.sort
|
||||
%>
|
||||
|
||||
<div class="splitcontentleft">
|
||||
<% if members.any? %>
|
||||
<table class="list members">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= l(:label_user) %></th>
|
||||
<th><%= l(:label_role_plural) %></th>
|
||||
<th style="width:15%"></th>
|
||||
<%= call_hook(:view_projects_settings_members_table_header, :course => @course) %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% members.each do |member| %>
|
||||
<% next if member.new_record? %>
|
||||
<tr id="member-<%= member.id %>" class="<%= cycle 'odd', 'even' %> member">
|
||||
<td class="<%= member.principal.class.name.downcase %>">
|
||||
<%= link_to_user member.principal %>
|
||||
</td>
|
||||
<td class="roles">
|
||||
<span id="member-<%= member.id %>-roles">
|
||||
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
|
||||
</span>
|
||||
<%= form_for(member, {:as => :membership, :remote => true,
|
||||
:url => course_memberships_path(member),:method => :put,
|
||||
:html => {:id => "member-#{member.id}-roles-form",
|
||||
:class => 'hol'}}
|
||||
) do |f| %>
|
||||
<p>
|
||||
<% roles.each do |role| %>
|
||||
<label>
|
||||
<%= radio_button_tag 'membership[role_ids][]', role.id, member.roles.include?(role),:disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %>
|
||||
<%= h role %>
|
||||
</label>
|
||||
<br/>
|
||||
<% end %>
|
||||
</p>
|
||||
<%= hidden_field_tag 'membership[role_ids][]', '' %>
|
||||
<p>
|
||||
<%= submit_tag l(:button_change), :class => "small" %>
|
||||
<%= link_to_function l(:button_cancel),
|
||||
"$('#member-#{member.id}-roles').show(); $('#member-#{member.id}-roles-form').hide(); return false;"
|
||||
%>
|
||||
</p>
|
||||
<% end %>
|
||||
</td>
|
||||
<!--modified by huang for: if the user'roles is Manager that he will can't modified himself-->
|
||||
<% if member.roles.first.to_s == "Manager" %>
|
||||
<td class="buttons"></td>
|
||||
<% else %>
|
||||
<td class="buttons">
|
||||
<%= link_to_function l(:button_edit),
|
||||
"$('#member-#{member.id}-roles').hide(); $('#member-#{member.id}-roles-form').show(); return false;",
|
||||
:class => 'icon icon-edit' %>
|
||||
<%= delete_link membership_path(member),
|
||||
:remote => true,
|
||||
:data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {}) if member.deletable? %>
|
||||
</td>
|
||||
<% end %>
|
||||
<!--end-->
|
||||
<%= call_hook(:view_projects_settings_members_table_header, {:course => @course, :member => member}) %>
|
||||
</tr>
|
||||
<% end; reset_cycle %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="splitcontentright">
|
||||
<% if roles.any? %>
|
||||
<%= form_for(@member, {:as => :membership, :url => course_memberships_path(@course), :remote => true, :method => :post}) do |f| %>
|
||||
<fieldset>
|
||||
<legend><%= l(:label_member_new) %></legend>
|
||||
<p>
|
||||
<%= label_tag "principal_search", l(:label_principal_search) %>
|
||||
<%= text_field_tag 'principal_search', nil %>
|
||||
</p>
|
||||
<%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_course_memberships_path(@course, :format => 'js') }')" %>
|
||||
|
||||
<div id="principals_for_new_member">
|
||||
<%= render_principals_for_new_course_members(@course) %>
|
||||
</div>
|
||||
<br/>
|
||||
<!--show the roles which will select-->
|
||||
<p style="padding-top: 5px"><%= l(:label_role_plural) %>:
|
||||
<% roles.each do |role| %>
|
||||
<label>
|
||||
<%= radio_button_tag 'membership[role_ids][]', role.id %>
|
||||
<%= h role %>
|
||||
</label>
|
||||
<% end %>
|
||||
</p>
|
||||
<p><%= submit_tag l(:button_add), :id => 'member-add-submit' %></p>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= error_messages_for 'member' %>
|
||||
<%
|
||||
roles = Role.givable.all
|
||||
roles = roles[3..5]
|
||||
members = @course.member_principals.includes(:roles, :principal).all.sort
|
||||
%>
|
||||
|
||||
<div class="splitcontentleft">
|
||||
<% if members.any? %>
|
||||
<table class="list members">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= l(:label_user) %></th>
|
||||
<th><%= l(:label_role_plural) %></th>
|
||||
<th style="width:15%"></th>
|
||||
<%= call_hook(:view_projects_settings_members_table_header, :course => @course) %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% members.each do |member| %>
|
||||
<% next if member.new_record? %>
|
||||
<tr id="member-<%= member.id %>" class="<%= cycle 'odd', 'even' %> member">
|
||||
<td class="<%= member.principal.class.name.downcase %>">
|
||||
<%= link_to_user member.principal %>
|
||||
</td>
|
||||
<td class="roles">
|
||||
<span id="member-<%= member.id %>-roles">
|
||||
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
|
||||
</span>
|
||||
<%= form_for(member, {:as => :membership, :remote => true,
|
||||
:url => course_memberships_path(member),:method => :put,
|
||||
:html => {:id => "member-#{member.id}-roles-form",
|
||||
:class => 'hol'}}
|
||||
) do |f| %>
|
||||
<p>
|
||||
<% roles.each do |role| %>
|
||||
<label>
|
||||
<%= radio_button_tag 'membership[role_ids][]', role.id, member.roles.include?(role),:disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %>
|
||||
<%= h role %>
|
||||
</label>
|
||||
<br/>
|
||||
<% end %>
|
||||
</p>
|
||||
<%= hidden_field_tag 'membership[role_ids][]', '' %>
|
||||
<p>
|
||||
<%= submit_tag l(:button_change), :class => "small" %>
|
||||
<%= link_to_function l(:button_cancel),
|
||||
"$('#member-#{member.id}-roles').show(); $('#member-#{member.id}-roles-form').hide(); return false;"
|
||||
%>
|
||||
</p>
|
||||
<% end %>
|
||||
</td>
|
||||
<!--modified by huang for: if the user'roles is Manager that he will can't modified himself-->
|
||||
<% if member.roles.first.to_s == "Manager" %>
|
||||
<td class="buttons"></td>
|
||||
<% else %>
|
||||
<td class="buttons">
|
||||
<%= link_to_function l(:button_edit),
|
||||
"$('#member-#{member.id}-roles').hide(); $('#member-#{member.id}-roles-form').show(); return false;",
|
||||
:class => 'icon icon-edit' %>
|
||||
<%= delete_link membership_path(member),
|
||||
:remote => true,
|
||||
:data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {}) if member.deletable? %>
|
||||
</td>
|
||||
<% end %>
|
||||
<!--end-->
|
||||
<%= call_hook(:view_projects_settings_members_table_header, {:course => @course, :member => member}) %>
|
||||
</tr>
|
||||
<% end; reset_cycle %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="splitcontentright">
|
||||
<% if roles.any? %>
|
||||
<%= form_for(@member, {:as => :membership, :url => course_memberships_path(@course), :remote => true, :method => :post}) do |f| %>
|
||||
<fieldset>
|
||||
<legend><%= l(:label_member_new) %></legend>
|
||||
<p>
|
||||
<%= label_tag "principal_search", l(:label_principal_search) %>
|
||||
<%= text_field_tag 'principal_search', nil %>
|
||||
</p>
|
||||
<%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_course_memberships_path(@course, :format => 'js') }')" %>
|
||||
|
||||
<div id="principals_for_new_member">
|
||||
<%= render_principals_for_new_course_members(@course) %>
|
||||
</div>
|
||||
<br/>
|
||||
<!--show the roles which will select-->
|
||||
<p style="padding-top: 5px"><%= l(:label_role_plural) %>:
|
||||
<% roles.each do |role| %>
|
||||
<label>
|
||||
<%= radio_button_tag 'membership[role_ids][]', role.id %>
|
||||
<%= h role %>
|
||||
</label>
|
||||
<% end %>
|
||||
</p>
|
||||
<p><%= submit_tag l(:button_add), :id => 'member-add-submit' %></p>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -1,22 +1,22 @@
|
||||
<div style="margin-left: 20px;">
|
||||
|
||||
<% if ( !(User.current.member_of? @project) && User.current.login?) %> <!--added by linchun-->
|
||||
<span class="icon-fav icon"></span><%= watcher_link(@project, User.current) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<!--添加项目申请-->
|
||||
<div style="margin-left: 20px;">
|
||||
<% if ( !(User.current.member_of? @project) && User.current.login?) %>
|
||||
<span class="icon-fav icon"></span>
|
||||
<%= applied_link(@project, User.current) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!--添加退出项目-->
|
||||
<div style="margin-left: 20px;">
|
||||
<% if ((User.current.member_of? @project) &&
|
||||
User.current.login? &&
|
||||
Member.where(:user_id => User.current.id, :project_id=>@project.id).first.roles.first.to_s != "Manager") %>
|
||||
<%= exit_project_link(@project) %>
|
||||
<% end %>
|
||||
<div style="margin-left: 20px;">
|
||||
|
||||
<% if ( !(User.current.member_of? @project) && User.current.login?) %> <!--added by linchun-->
|
||||
<span class="icon-fav icon"></span><%= watcher_link(@project, User.current) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<!--添加项目申请-->
|
||||
<div style="margin-left: 20px;">
|
||||
<% if ( !(User.current.member_of? @project) && User.current.login?) %>
|
||||
<span class="icon-fav icon"></span>
|
||||
<%= applied_link(@project, User.current) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!--添加退出项目-->
|
||||
<div style="margin-left: 20px;">
|
||||
<% if ((User.current.member_of? @project) &&
|
||||
User.current.login? &&
|
||||
Member.where(:user_id => User.current.id, :project_id=>@project.id).first.roles.first.to_s != "Manager") %>
|
||||
<%= exit_project_link(@project) %>
|
||||
<% end %>
|
||||
</div>
|
@ -1,69 +1,69 @@
|
||||
<%= error_messages_for 'role' %>
|
||||
|
||||
<% unless @role.anonymous? %>
|
||||
<div class="box tabular">
|
||||
<% unless @role.builtin? %>
|
||||
<p><%= f.text_field :name, :required => true %></p>
|
||||
<p><%= f.check_box :assignable %></p>
|
||||
<% end %>
|
||||
<p><%= f.select :issues_visibility, Role::ISSUES_VISIBILITY_OPTIONS.collect {|v| [l(v.last), v.first]} %></p>
|
||||
<% if @role.new_record? && @roles.any? %>
|
||||
<p><label for="copy_workflow_from"><%= l(:label_copy_workflow_from) %></label>
|
||||
<%= select_tag(:copy_workflow_from, content_tag("option") + options_from_collection_for_select(@roles, :id, :name, params[:copy_workflow_from] || @copy_from.try(:id))) %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<h3><%= l(:label_permissions) %></h3>
|
||||
<div class="box tabular" id="permissions">
|
||||
<% perms_by_module = @role.setable_permissions.group_by {|p| p.project_module.to_s} %>
|
||||
<% perms_by_module.keys.sort.each do |mod| %>
|
||||
<% if mod.blank? %>
|
||||
<fieldset>
|
||||
<legend><%= l(:label_project) %></legend>
|
||||
<% perms_by_module[mod].each do |permission| %>
|
||||
<% if permission.belong_to_project? %>
|
||||
<label class="floating">
|
||||
<%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %>
|
||||
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
||||
</label>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><%= l(:label_course) %></legend>
|
||||
<% perms_by_module[mod].each do |permission| %>
|
||||
<% if permission.belong_to_course? %>
|
||||
<label class="floating">
|
||||
<%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %>
|
||||
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
||||
</label>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><%= l(:label_contest) %></legend>
|
||||
<% perms_by_module[mod].each do |permission| %>
|
||||
<% if permission.belong_to_contest? %>
|
||||
<label class="floating">
|
||||
<%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %>
|
||||
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
||||
</label>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</fieldset>
|
||||
<% else %>
|
||||
<fieldset>
|
||||
<legend><%= l_or_humanize(mod, :prefix => 'project_module_') %></legend>
|
||||
<% perms_by_module[mod].each do |permission| %>
|
||||
<label class="floating">
|
||||
<%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %>
|
||||
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
||||
</label>
|
||||
<% end %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<br /><%= check_all_links 'permissions' %>
|
||||
<%= hidden_field_tag 'role[permissions][]', '' %>
|
||||
</div>
|
||||
<%= error_messages_for 'role' %>
|
||||
|
||||
<% unless @role.anonymous? %>
|
||||
<div class="box tabular">
|
||||
<% unless @role.builtin? %>
|
||||
<p><%= f.text_field :name, :required => true %></p>
|
||||
<p><%= f.check_box :assignable %></p>
|
||||
<% end %>
|
||||
<p><%= f.select :issues_visibility, Role::ISSUES_VISIBILITY_OPTIONS.collect {|v| [l(v.last), v.first]} %></p>
|
||||
<% if @role.new_record? && @roles.any? %>
|
||||
<p><label for="copy_workflow_from"><%= l(:label_copy_workflow_from) %></label>
|
||||
<%= select_tag(:copy_workflow_from, content_tag("option") + options_from_collection_for_select(@roles, :id, :name, params[:copy_workflow_from] || @copy_from.try(:id))) %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<h3><%= l(:label_permissions) %></h3>
|
||||
<div class="box tabular" id="permissions">
|
||||
<% perms_by_module = @role.setable_permissions.group_by {|p| p.project_module.to_s} %>
|
||||
<% perms_by_module.keys.sort.each do |mod| %>
|
||||
<% if mod.blank? %>
|
||||
<fieldset>
|
||||
<legend><%= l(:label_project) %></legend>
|
||||
<% perms_by_module[mod].each do |permission| %>
|
||||
<% if permission.belong_to_project? %>
|
||||
<label class="floating">
|
||||
<%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %>
|
||||
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
||||
</label>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><%= l(:label_course) %></legend>
|
||||
<% perms_by_module[mod].each do |permission| %>
|
||||
<% if permission.belong_to_course? %>
|
||||
<label class="floating">
|
||||
<%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %>
|
||||
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
||||
</label>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><%= l(:label_contest) %></legend>
|
||||
<% perms_by_module[mod].each do |permission| %>
|
||||
<% if permission.belong_to_contest? %>
|
||||
<label class="floating">
|
||||
<%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %>
|
||||
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
||||
</label>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</fieldset>
|
||||
<% else %>
|
||||
<fieldset>
|
||||
<legend><%= l_or_humanize(mod, :prefix => 'project_module_') %></legend>
|
||||
<% perms_by_module[mod].each do |permission| %>
|
||||
<label class="floating">
|
||||
<%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %>
|
||||
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
||||
</label>
|
||||
<% end %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<br /><%= check_all_links 'permissions' %>
|
||||
<%= hidden_field_tag 'role[permissions][]', '' %>
|
||||
</div>
|
||||
|
@ -1,149 +1,149 @@
|
||||
<h3><%= link_to l(:label_role_plural), roles_path %> » <%=l(:label_permissions_report)%></h3>
|
||||
|
||||
<%= form_tag(permissions_roles_path, :id => 'permissions_form') do %>
|
||||
<%= hidden_field_tag 'permissions[0]', '', :id => nil %>
|
||||
<div class="autoscroll">
|
||||
<table class="list permissions">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%=l(:label_permissions)%></th>
|
||||
<% @roles.each do |role| %>
|
||||
<th>
|
||||
<%= content_tag(role.builtin? ? 'em' : 'span', h(role.name)) %>
|
||||
<%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('input.role-#{role.id}')",
|
||||
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
|
||||
</th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% perms_by_module = @permissions.group_by {|p| p.project_module.to_s} %>
|
||||
<% perms_by_module.keys.sort.each do |mod| %>
|
||||
<% if mod.blank? %>
|
||||
<% perms_by_module[mod].select{ |p| !(p.belong_to_project?) && !(p.belong_to_course?) && !(p.belong_to_contest?) }.each do |permission| %>
|
||||
<tr class="<%= cycle('odd', 'even') %> permission-<%= permission.name %>">
|
||||
<td>
|
||||
<%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('.permission-#{permission.name} input')",
|
||||
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
|
||||
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
||||
</td>
|
||||
<% @roles.each do |role| %>
|
||||
<td align="center">
|
||||
<% if role.setable_permissions.include? permission %>
|
||||
<%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<tr class="group open">
|
||||
<td>
|
||||
<span class="expander" onclick="toggleRowGroup(this);"> </span>
|
||||
<%= l(:label_project) %>
|
||||
</td>
|
||||
<% @roles.each do |role| %>
|
||||
<td class="role"><%= h(role.name) %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% perms_by_module[mod].select{ |p| p.belong_to_project? }.each do |permission| %>
|
||||
<tr class="<%= cycle('odd', 'even') %> permission-<%= permission.name %>">
|
||||
<td>
|
||||
<%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('.permission-#{permission.name} input')",
|
||||
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
|
||||
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
||||
</td>
|
||||
<% @roles.each do |role| %>
|
||||
<td align="center">
|
||||
<% if role.setable_permissions.include? permission %>
|
||||
<%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr class="group open">
|
||||
<td>
|
||||
<span class="expander" onclick="toggleRowGroup(this);"> </span>
|
||||
<%= l(:label_course) %>
|
||||
</td>
|
||||
<% @roles.each do |role| %>
|
||||
<td class="role"><%= h(role.name) %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% perms_by_module[mod].select{ |p| p.belong_to_course? }.each do |permission| %>
|
||||
<tr class="<%= cycle('odd', 'even') %> permission-<%= permission.name %>">
|
||||
<td>
|
||||
<%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('.permission-#{permission.name} input')",
|
||||
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
|
||||
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
||||
</td>
|
||||
<% @roles.each do |role| %>
|
||||
<td align="center">
|
||||
<% if role.setable_permissions.include? permission %>
|
||||
<%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr class="group open">
|
||||
<td>
|
||||
<span class="expander" onclick="toggleRowGroup(this);"> </span>
|
||||
<%= l(:label_contest) %>
|
||||
</td>
|
||||
<% @roles.each do |role| %>
|
||||
<td class="role"><%= h(role.name) %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% perms_by_module[mod].select{ |p| p.belong_to_contest? }.each do |permission| %>
|
||||
<tr class="<%= cycle('odd', 'even') %> permission-<%= permission.name %>">
|
||||
<td>
|
||||
<%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('.permission-#{permission.name} input')",
|
||||
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
|
||||
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
||||
</td>
|
||||
<% @roles.each do |role| %>
|
||||
<td align="center">
|
||||
<% if role.setable_permissions.include? permission %>
|
||||
<%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<tr class="group open">
|
||||
<td>
|
||||
<span class="expander" onclick="toggleRowGroup(this);"> </span>
|
||||
<%= l_or_humanize(mod, :prefix => 'project_module_') %>
|
||||
</td>
|
||||
<% @roles.each do |role| %>
|
||||
<td class="role"><%= h(role.name) %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% perms_by_module[mod].each do |permission| %>
|
||||
<tr class="<%= cycle('odd', 'even') %> permission-<%= permission.name %>">
|
||||
<td>
|
||||
<%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('.permission-#{permission.name} input')",
|
||||
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
|
||||
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
||||
</td>
|
||||
<% @roles.each do |role| %>
|
||||
<td align="center">
|
||||
<% if role.setable_permissions.include? permission %>
|
||||
<%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p><%= check_all_links 'permissions_form' %></p>
|
||||
<p><%= submit_tag l(:button_save) %></p>
|
||||
<% end %>
|
||||
<h3><%= link_to l(:label_role_plural), roles_path %> » <%=l(:label_permissions_report)%></h3>
|
||||
|
||||
<%= form_tag(permissions_roles_path, :id => 'permissions_form') do %>
|
||||
<%= hidden_field_tag 'permissions[0]', '', :id => nil %>
|
||||
<div class="autoscroll">
|
||||
<table class="list permissions">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%=l(:label_permissions)%></th>
|
||||
<% @roles.each do |role| %>
|
||||
<th>
|
||||
<%= content_tag(role.builtin? ? 'em' : 'span', h(role.name)) %>
|
||||
<%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('input.role-#{role.id}')",
|
||||
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
|
||||
</th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% perms_by_module = @permissions.group_by {|p| p.project_module.to_s} %>
|
||||
<% perms_by_module.keys.sort.each do |mod| %>
|
||||
<% if mod.blank? %>
|
||||
<% perms_by_module[mod].select{ |p| !(p.belong_to_project?) && !(p.belong_to_course?) && !(p.belong_to_contest?) }.each do |permission| %>
|
||||
<tr class="<%= cycle('odd', 'even') %> permission-<%= permission.name %>">
|
||||
<td>
|
||||
<%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('.permission-#{permission.name} input')",
|
||||
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
|
||||
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
||||
</td>
|
||||
<% @roles.each do |role| %>
|
||||
<td align="center">
|
||||
<% if role.setable_permissions.include? permission %>
|
||||
<%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<tr class="group open">
|
||||
<td>
|
||||
<span class="expander" onclick="toggleRowGroup(this);"> </span>
|
||||
<%= l(:label_project) %>
|
||||
</td>
|
||||
<% @roles.each do |role| %>
|
||||
<td class="role"><%= h(role.name) %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% perms_by_module[mod].select{ |p| p.belong_to_project? }.each do |permission| %>
|
||||
<tr class="<%= cycle('odd', 'even') %> permission-<%= permission.name %>">
|
||||
<td>
|
||||
<%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('.permission-#{permission.name} input')",
|
||||
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
|
||||
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
||||
</td>
|
||||
<% @roles.each do |role| %>
|
||||
<td align="center">
|
||||
<% if role.setable_permissions.include? permission %>
|
||||
<%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr class="group open">
|
||||
<td>
|
||||
<span class="expander" onclick="toggleRowGroup(this);"> </span>
|
||||
<%= l(:label_course) %>
|
||||
</td>
|
||||
<% @roles.each do |role| %>
|
||||
<td class="role"><%= h(role.name) %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% perms_by_module[mod].select{ |p| p.belong_to_course? }.each do |permission| %>
|
||||
<tr class="<%= cycle('odd', 'even') %> permission-<%= permission.name %>">
|
||||
<td>
|
||||
<%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('.permission-#{permission.name} input')",
|
||||
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
|
||||
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
||||
</td>
|
||||
<% @roles.each do |role| %>
|
||||
<td align="center">
|
||||
<% if role.setable_permissions.include? permission %>
|
||||
<%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr class="group open">
|
||||
<td>
|
||||
<span class="expander" onclick="toggleRowGroup(this);"> </span>
|
||||
<%= l(:label_contest) %>
|
||||
</td>
|
||||
<% @roles.each do |role| %>
|
||||
<td class="role"><%= h(role.name) %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% perms_by_module[mod].select{ |p| p.belong_to_contest? }.each do |permission| %>
|
||||
<tr class="<%= cycle('odd', 'even') %> permission-<%= permission.name %>">
|
||||
<td>
|
||||
<%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('.permission-#{permission.name} input')",
|
||||
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
|
||||
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
||||
</td>
|
||||
<% @roles.each do |role| %>
|
||||
<td align="center">
|
||||
<% if role.setable_permissions.include? permission %>
|
||||
<%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<tr class="group open">
|
||||
<td>
|
||||
<span class="expander" onclick="toggleRowGroup(this);"> </span>
|
||||
<%= l_or_humanize(mod, :prefix => 'project_module_') %>
|
||||
</td>
|
||||
<% @roles.each do |role| %>
|
||||
<td class="role"><%= h(role.name) %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% perms_by_module[mod].each do |permission| %>
|
||||
<tr class="<%= cycle('odd', 'even') %> permission-<%= permission.name %>">
|
||||
<td>
|
||||
<%= link_to_function(image_tag('toggle_check.png'), "toggleCheckboxesBySelector('.permission-#{permission.name} input')",
|
||||
:title => "#{l(:button_check_all)}/#{l(:button_uncheck_all)}") %>
|
||||
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
||||
</td>
|
||||
<% @roles.each do |role| %>
|
||||
<td align="center">
|
||||
<% if role.setable_permissions.include? permission %>
|
||||
<%= check_box_tag "permissions[#{role.id}][]", permission.name, (role.permissions.include? permission.name), :id => nil, :class => "role-#{role.id}" %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<p><%= check_all_links 'permissions_form' %></p>
|
||||
<p><%= submit_tag l(:button_save) %></p>
|
||||
<% end %>
|
||||
|
@ -1,481 +1,481 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
require 'redmine/core_ext'
|
||||
|
||||
begin
|
||||
require 'RMagick' unless Object.const_defined?(:Magick)
|
||||
rescue LoadError
|
||||
# RMagick is not available
|
||||
end
|
||||
|
||||
require 'redmine/scm/base'
|
||||
require 'redmine/access_control'
|
||||
require 'redmine/access_keys'
|
||||
require 'redmine/activity'
|
||||
require 'redmine/activity/fetcher'
|
||||
require 'redmine/ciphering'
|
||||
require 'redmine/codeset_util'
|
||||
require 'redmine/custom_field_format'
|
||||
require 'redmine/i18n'
|
||||
require 'redmine/menu_manager'
|
||||
require 'redmine/notifiable'
|
||||
require 'redmine/platform'
|
||||
require 'redmine/mime_type'
|
||||
require 'redmine/notifiable'
|
||||
require 'redmine/search'
|
||||
require 'redmine/syntax_highlighting'
|
||||
require 'redmine/thumbnail'
|
||||
require 'redmine/unified_diff'
|
||||
require 'redmine/utils'
|
||||
require 'redmine/version'
|
||||
require 'redmine/wiki_formatting'
|
||||
|
||||
require 'redmine/default_data/loader'
|
||||
require 'redmine/helpers/calendar'
|
||||
require 'redmine/helpers/diff'
|
||||
require 'redmine/helpers/gantt'
|
||||
require 'redmine/helpers/time_report'
|
||||
require 'redmine/views/other_formats_builder'
|
||||
require 'redmine/views/labelled_form_builder'
|
||||
require 'redmine/views/builders'
|
||||
|
||||
require 'redmine/themes'
|
||||
require 'redmine/hook'
|
||||
require 'redmine/plugin'
|
||||
|
||||
if RUBY_VERSION < '1.9'
|
||||
require 'fastercsv'
|
||||
else
|
||||
require 'csv'
|
||||
FCSV = CSV
|
||||
end
|
||||
|
||||
Redmine::Scm::Base.add "Subversion"
|
||||
Redmine::Scm::Base.add "Darcs"
|
||||
Redmine::Scm::Base.add "Mercurial"
|
||||
Redmine::Scm::Base.add "Cvs"
|
||||
Redmine::Scm::Base.add "Bazaar"
|
||||
Redmine::Scm::Base.add "Git"
|
||||
Redmine::Scm::Base.add "Filesystem"
|
||||
|
||||
Redmine::CustomFieldFormat.map do |fields|
|
||||
fields.register 'string'
|
||||
fields.register 'text'
|
||||
fields.register 'int', :label => :label_integer
|
||||
fields.register 'float'
|
||||
fields.register 'list'
|
||||
fields.register 'date'
|
||||
fields.register 'bool', :label => :label_boolean
|
||||
fields.register 'user', :only => %w(Issue TimeEntry Version Project), :edit_as => 'list'
|
||||
fields.register 'version', :only => %w(Issue TimeEntry Version Project), :edit_as => 'list'
|
||||
end
|
||||
|
||||
# Permissions
|
||||
Redmine::AccessControl.map do |map|
|
||||
map.permission :view_project, {:projects => [:show], :activities => [:index]}, :public => true, :read => true
|
||||
map.permission :search_project, {:search => :index}, :public => true, :read => true
|
||||
map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin ,:belong_to_project => true
|
||||
map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member ,:belong_to_project => true
|
||||
map.permission :close_project, {:projects => [:close, :reopen]}, :require => :member, :read => true ,:belong_to_project => true
|
||||
map.permission :select_project_modules, {:projects => :modules}, :require => :member ,:belong_to_project => true
|
||||
map.permission :select_contest_modules, {:contests => :modules}, :require => :member ,:belong_to_contest => true
|
||||
map.permission :manage_members, {:projects => :settings, :members => [:index, :show, :create, :update, :destroy, :autocomplete]}, :require => :member ,:belong_to_project => true
|
||||
map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member ,:belong_to_project => true
|
||||
map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member ,:belong_to_project => true
|
||||
#错的权限,先注释掉
|
||||
#map.permission :view_journals_for_messages, {:gantts => [:show, :update]}, :read => true
|
||||
|
||||
map.permission :quote_project, {},:require => :member,:belong_to_contest => true
|
||||
map.permission :is_manager,{},:require => :member ,:belong_to_project => true
|
||||
map.permission :as_teacher,{},:require => :member ,:belong_to_course => true
|
||||
map.permission :as_student,{},:require => :member ,:belong_to_course => true
|
||||
|
||||
#课程权限模块
|
||||
map.permission :view_course, {:courses => [:show], :activities => [:index]}, :public => true, :read => true
|
||||
map.permission :search_course, {:search => :index}, :public => true, :read => true
|
||||
map.permission :add_course, {:courses => [:new, :create]}, :require => :loggedin ,:belong_to_course => true
|
||||
map.permission :edit_course, {:courses => [:settings, :edit, :update]}, :require => :member ,:belong_to_course => true
|
||||
map.permission :close_course, {:courses => [:close, :reopen]}, :require => :member, :read => true ,:belong_to_course => true
|
||||
map.permission :select_course_modules, {:courses => :modules}, :require => :member ,:belong_to_course => true
|
||||
map.permission :view_course_journals_for_messages, {:courses => :feedback}, :require => :member,:read => true ,:belong_to_course => true
|
||||
map.permission :memos_attachments_download,{:attachments => :download}
|
||||
map.permission :projects_attachments_download,{:attachments => :download},:belong_to_project => true
|
||||
map.permission :course_attachments_download,{:attachments => :download},:belong_to_course => true
|
||||
map.permission :contest_attachments_download,{:attachments => :download},:belong_to_contest => true
|
||||
#与项目一致,注释掉
|
||||
#map.course_module :files do |map|
|
||||
# map.permission :manage_files, {:files => [:new, :create]}, :require => :loggedin
|
||||
# map.permission :view_course_files, {:files => :index, :versions => :download}, :read => true
|
||||
#end
|
||||
#新闻权限与项目一致注释掉此处
|
||||
# map.course_module :news do |map|
|
||||
# map.permission :manage_news, {:news => [:new, :create, :edit, :update, :destroy], :comments => [:destroy]}, :require => :member
|
||||
# map.permission :view_course_news, {:news => [:index, :show]}, :public => true, :read => true
|
||||
# map.permission :comment_news, {:comments => :create}
|
||||
# end
|
||||
|
||||
map.course_module :bids do |map|
|
||||
map.permission :view_homework_attaches, {:bids => [:show, :show_project, :revision]}, :read => true,:belong_to_course => true
|
||||
map.permission :paret_in_homework,{},:require => :member ,:belong_to_course => true
|
||||
end
|
||||
|
||||
#讨论区权限与项目统一,注释掉此课程讨论区权限
|
||||
#map.course_module :boards do |map|
|
||||
# map.permission :manage_boards, {:boards => [:new, :create, :edit, :update, :destroy]}, :require => :member
|
||||
# map.permission :view_course_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true, :read => true
|
||||
# map.permission :add_messages, {:messages => [:new, :reply, :quote]}
|
||||
# map.permission :edit_messages, {:messages => :edit}, :require => :member
|
||||
# map.permission :edit_own_messages, {:messages => :edit}, :require => :loggedin
|
||||
# map.permission :delete_messages, {:messages => :destroy}, :require => :member
|
||||
# map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin
|
||||
#end
|
||||
|
||||
#end
|
||||
|
||||
map.project_module :issue_tracking do |map|
|
||||
# Issue categories
|
||||
map.permission :manage_categories, {:projects => :settings, :issue_categories => [:index, :show, :new, :create, :edit, :update, :destroy]}, :require => :member
|
||||
# Issues
|
||||
map.permission :view_issues, {:issues => [:index, :show],
|
||||
:auto_complete => [:issues],
|
||||
:context_menus => [:issues],
|
||||
:versions => [:index, :show, :status_by],
|
||||
:journals => [:index, :diff],
|
||||
:queries => :index,
|
||||
:reports => [:issue_report, :issue_report_details]},
|
||||
:read => true
|
||||
map.permission :add_issues, {:issues => [:new, :create, :update_form], :attachments => :upload}
|
||||
map.permission :edit_issues, {:issues => [:edit, :update, :bulk_edit, :bulk_update, :update_form], :journals => [:new], :attachments => :upload}
|
||||
map.permission :manage_issue_relations, {:issue_relations => [:index, :show, :create, :destroy]}
|
||||
map.permission :manage_subtasks, {}
|
||||
map.permission :set_issues_private, {}
|
||||
map.permission :set_own_issues_private, {}, :require => :loggedin
|
||||
map.permission :add_issue_notes, {:issues => [:edit, :update, :update_form], :journals => [:new], :attachments => :upload}
|
||||
map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin
|
||||
map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin
|
||||
map.permission :view_private_notes, {}, :read => true, :require => :member
|
||||
map.permission :set_notes_private, {}, :require => :member
|
||||
map.permission :move_issues, {:issues => [:bulk_edit, :bulk_update]}, :require => :loggedin
|
||||
map.permission :delete_issues, {:issues => :destroy}, :require => :member
|
||||
# Queries
|
||||
map.permission :manage_public_queries, {:queries => [:new, :create, :edit, :update, :destroy]}, :require => :member
|
||||
map.permission :save_queries, {:queries => [:new, :create, :edit, :update, :destroy]}, :require => :loggedin
|
||||
# Watchers
|
||||
map.permission :view_issue_watchers, {}, :read => true
|
||||
map.permission :add_issue_watchers, {:watchers => [:new, :create, :append, :autocomplete_for_user]}
|
||||
map.permission :delete_issue_watchers, {:watchers => :destroy}
|
||||
end
|
||||
|
||||
map.project_module :time_tracking do |map|
|
||||
map.permission :log_time, {:timelog => [:new, :create]}, :require => :loggedin
|
||||
map.permission :view_time_entries, {:timelog => [:index, :report, :show]}, :read => true
|
||||
map.permission :edit_time_entries, {:timelog => [:edit, :update, :destroy, :bulk_edit, :bulk_update]}, :require => :member
|
||||
map.permission :edit_own_time_entries, {:timelog => [:edit, :update, :destroy,:bulk_edit, :bulk_update]}, :require => :loggedin
|
||||
map.permission :manage_project_activities, {:project_enumerations => [:update, :destroy]}, :require => :member
|
||||
end
|
||||
|
||||
map.project_module :news do |map|
|
||||
map.permission :manage_news, {:news => [:new, :create, :edit, :update, :destroy], :comments => [:destroy]}, :require => :member
|
||||
map.permission :view_news, {:news => [:index, :show]}, :public => true, :read => true
|
||||
map.permission :comment_news, {:comments => :create}
|
||||
end
|
||||
|
||||
map.contest_module :contestnotifications do |map|
|
||||
map.permission :manage_contestnotifications, {:contestnotifications => [:new, :create, :edit, :update, :destroy], :notificationcomments => [:destroy]}, :require => :member,:belong_to_contest => true
|
||||
map.permission :view_contestnotifications, {:contestnotifications => [:index, :show]}, :public => true, :read => true
|
||||
map.permission :notificationcomment_contestnotifications, {:notificationcomments => :create},:belong_to_contest => true
|
||||
end
|
||||
|
||||
map.project_module :documents do |map|
|
||||
map.permission :add_documents, {:documents => [:new, :create, :add_attachment]}, :require => :loggedin
|
||||
map.permission :edit_documents, {:documents => [:edit, :update, :add_attachment]}, :require => :loggedin
|
||||
map.permission :delete_documents, {:documents => [:destroy]}, :require => :loggedin
|
||||
map.permission :view_documents, {:documents => [:index, :show, :download]}, :read => true
|
||||
end
|
||||
|
||||
map.project_module :files do |map|
|
||||
map.permission :manage_files, {:files => [:new, :create]}, :require => :loggedin
|
||||
map.permission :view_files, {:files => :index, :versions => :download}, :read => true
|
||||
end
|
||||
|
||||
map.project_module :wiki do |map|
|
||||
map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member
|
||||
map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member
|
||||
map.permission :delete_wiki_pages, {:wiki => [:destroy, :destroy_version]}, :require => :member
|
||||
map.permission :view_wiki_pages, {:wiki => [:index, :show, :special, :date_index]}, :read => true
|
||||
map.permission :export_wiki_pages, {:wiki => [:export]}, :read => true
|
||||
map.permission :view_wiki_edits, {:wiki => [:history, :diff, :annotate]}, :read => true
|
||||
map.permission :edit_wiki_pages, :wiki => [:edit, :update, :preview, :add_attachment]
|
||||
map.permission :delete_wiki_pages_attachments, {}
|
||||
map.permission :protect_wiki_pages, {:wiki => :protect}, :require => :member
|
||||
end
|
||||
|
||||
map.project_module :repository do |map|
|
||||
map.permission :manage_repository, {:repositories => [:new, :create, :edit, :update, :committers, :destroy]}, :require => :member
|
||||
map.permission :browse_repository, {:repositories => [:show, :browse, :entry, :raw, :annotate, :changes, :diff, :stats, :graph]}, :read => true
|
||||
map.permission :view_changesets, {:repositories => [:show, :revisions, :revision]}, :read => true
|
||||
map.permission :commit_access, {}
|
||||
map.permission :manage_related_issues, {:repositories => [:add_related_issue, :remove_related_issue]}
|
||||
end
|
||||
|
||||
map.project_module :boards do |map|
|
||||
map.permission :manage_boards, {:boards => [:new, :create, :edit, :update, :destroy]}, :require => :member
|
||||
map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true, :read => true
|
||||
map.permission :add_messages, {:messages => [:new, :reply, :quote]}
|
||||
map.permission :edit_messages, {:messages => :edit}, :require => :member
|
||||
map.permission :edit_own_messages, {:messages => :edit}, :require => :loggedin
|
||||
map.permission :delete_messages, {:messages => :destroy}, :require => :member
|
||||
map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin
|
||||
end
|
||||
|
||||
map.project_module :calendar do |map|
|
||||
map.permission :view_calendar, {:calendars => [:show, :update]}, :read => true
|
||||
end
|
||||
|
||||
map.project_module :gantt do |map|
|
||||
map.permission :view_gantt, {:gantts => [:show, :update]}, :read => true
|
||||
end
|
||||
|
||||
map.project_module :dts do |map|
|
||||
map.permission :do_dts, {:dts => :show}, :read => true
|
||||
end
|
||||
# map.project_module :journals do |map|
|
||||
# map.permission :view_journals_for_messages, {:gantts => [:show, :update]}, :read => true
|
||||
# end
|
||||
|
||||
end
|
||||
#by young
|
||||
Redmine::MenuManager.map :top_menu do |menu|
|
||||
menu.push :home, {:host => Setting.user_domain}
|
||||
menu.push :course_practice, {:controller => 'projects', :action => 'course', :project_type => 1}
|
||||
menu.push :project_deposit, { :controller => 'projects', :action => 'index', :project_type => 0}, :caption => :label_project_deposit
|
||||
menu.push :software_user, {:controller => 'users', :action => 'index'}
|
||||
menu.push :contest_innovate, {:controller => 'bids', :action => 'contest', :project_type => 1}
|
||||
menu.push :requirement_enterprise, {:controller => 'bids', :action => 'index'}
|
||||
menu.push :project_module_forums, :forums_path
|
||||
menu.push :stores_index, :stores_path
|
||||
|
||||
|
||||
# menu.push :investor, :home_path
|
||||
# menu.push :theme, :home_path
|
||||
# menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? }
|
||||
# menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new { User.current.admin? }, :last => true
|
||||
# menu.push :help, Redmine::Info.help_url, :last => true
|
||||
end
|
||||
#end
|
||||
|
||||
# by huang
|
||||
# Redmine::MenuManager.map :top_home_menu do |menu|
|
||||
# menu.push :home, :home_path
|
||||
# menu.push :projects, { :controller => 'projects', :action => 'index' }, :caption => :label_project_plural
|
||||
# menu.push :developer, {:controller => 'users', :action => 'index'}
|
||||
# menu.push :investor, :home_path
|
||||
# menu.push :theme, :home_path
|
||||
# menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? }
|
||||
# menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new { User.current.admin? }, :last => true
|
||||
# menu.push :help, Redmine::Info.help_url, :last => true
|
||||
# end
|
||||
|
||||
# Redmine::MenuManager.map :top_enterprise_menu do |menu|
|
||||
# menu.push :home, :home_path
|
||||
# menu.push :requirement, {:controller => 'bids', :action => 'index', :project_type => 0 }
|
||||
# menu.push :projects, { :controller => 'projects', :action => 'index', :project_type => 0 }, :caption => :label_project_plural
|
||||
#
|
||||
# menu.push :developer, {:controller => 'users', :action => 'index', :project_type => 0 }
|
||||
# menu.push :college_into, {:controller=>'projects', :action=>'course_enterprise', :project_type => 1 }
|
||||
# # menu.push :investor, :home_path
|
||||
# # menu.push :theme, :home_path
|
||||
# # menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? }
|
||||
# # menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new { User.current.admin? }, :last => true
|
||||
# # menu.push :help, Redmine::Info.help_url, :last => true
|
||||
# end
|
||||
|
||||
# Redmine::MenuManager.map :top_college_menu do |menu|
|
||||
# menu.push :home, :home_path
|
||||
# menu.push :new_course, {:controller => 'projects', :action => 'course', :project_type => 1}
|
||||
# menu.push :new_homework, {:controller => 'bids', :action => 'index', :project_type => 1 }
|
||||
# menu.push :new_contest, {:controller => 'bids', :action => 'contest', :project_type => 1}
|
||||
# menu.push :projects, { :controller => 'projects', :action => 'index', :project_type => 0 }, :caption => :label_project_plural
|
||||
# menu.push :developer, {:controller => 'users', :action => 'index', :project_type => 1 }
|
||||
# menu.push :enterprise_into, {:controller=>'projects', :action=>'enterprise_course', :project_type => 0 }
|
||||
# menu.push :investor, :home_path
|
||||
# menu.push :theme, :home_path
|
||||
# menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? }
|
||||
# menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new { User.current.admin? }, :last => true
|
||||
# menu.push :help, Redmine::Info.help_url, :last => true
|
||||
# end
|
||||
# end
|
||||
|
||||
Redmine::MenuManager.map :account_menu do |menu|
|
||||
menu.push :login, {:controller => 'account', :action => 'login'}, :if => Proc.new { !User.current.logged? }
|
||||
menu.push :register, {:controller => 'account', :action => 'register'}, :if => Proc.new { !User.current.logged? && Setting.self_registration? }
|
||||
# menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? }
|
||||
menu.push :logout, {:controller => 'account', :action => 'logout'}, :html => {:method => 'post'}, :if => Proc.new { User.current.logged? }
|
||||
end
|
||||
########fq
|
||||
Redmine::MenuManager.map :bid_menu do |menu|
|
||||
menu.push :respond, { :controller => 'bids', :action => 'show' }, :caption => :label_user_response
|
||||
menu.push :project, { :controller => 'bids', :action => 'show_project', :host => Setting.project_domain }, :caption => :label_bidding_project
|
||||
# menu.push :result, { :controller => 'bids', :action => 'show_results' },
|
||||
# :caption => :label_bidding_results,:if => Proc.new{ |p| User.current.id == p }
|
||||
end
|
||||
###new add by linchun
|
||||
Redmine::MenuManager.map :contest_menu do |menu|
|
||||
menu.push :respond, :show_contest_contest_path, :caption => :label_user_response
|
||||
#menu.push :project, :show_project_contest_path, :caption => :label_contest_project
|
||||
#menu.push :application, :show_softapplication_contest_path, :caption => :label_contest_application
|
||||
menu.push :attendingcontest, {:controller => 'contests', :action => 'show_attendingcontest'}, :caption => :label_attending_contest
|
||||
menu.push :contestnotifications, { :controller => 'contestnotifications', :action => 'index' }, :param => :contest_id, :caption => :label_contest_notification
|
||||
#menu.push :contestnotification, {:controller => 'contests', :action => 'show_notification'}, :caption => :label_contest_notification
|
||||
# menu.push :attendingcontest, :show_attendingcontest_contest_path, :caption => :label_attendin,g_contest
|
||||
# menu.push :result, { :controller => 'bids', :action => 'show_results' },
|
||||
# :caption => :label_bidding_results,:if => Proc.new{ |p| User.current.id == p }
|
||||
end
|
||||
|
||||
####
|
||||
Redmine::MenuManager.map :application_menu do |menu|
|
||||
# Empty
|
||||
end
|
||||
|
||||
######
|
||||
Redmine::MenuManager.map :homework_menu do |menu|
|
||||
menu.push :respond, { :controller => 'bids', :action => 'show' }, :caption => :label_homework_response
|
||||
menu.push :project, { :controller => 'bids', :action => 'show_project' }, :caption => :label_bidding_homework
|
||||
end
|
||||
########end
|
||||
Redmine::MenuManager.map :admin_menu do |menu|
|
||||
menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural
|
||||
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 :groups, {:controller => 'groups'}, :caption => :label_group_plural
|
||||
menu.push :roles, {:controller => 'roles'}, :caption => :label_role_and_permissions
|
||||
menu.push :trackers, {:controller => 'trackers'}, :caption => :label_tracker_plural
|
||||
menu.push :issue_statuses, {:controller => 'issue_statuses'}, :caption => :label_issue_status_plural,
|
||||
:html => {:class => 'issue_statuses'}
|
||||
menu.push :workflows, {:controller => 'workflows', :action => 'edit'}, :caption => :label_workflow
|
||||
menu.push :custom_fields, {:controller => 'custom_fields'}, :caption => :label_custom_field_plural,
|
||||
:html => {:class => 'custom_fields'}
|
||||
menu.push :enumerations, {:controller => 'enumerations'}
|
||||
menu.push :settings, {:controller => 'settings'}
|
||||
menu.push :ldap_authentication, {:controller => 'auth_sources', :action => 'index'},
|
||||
:html => {:class => 'server_authentication'}
|
||||
menu.push :plugins, {:controller => 'admin', :action => 'plugins'}, :last => true
|
||||
menu.push :info, {:controller => 'admin', :action => 'info'}, :caption => :label_information_plural, :last => true
|
||||
|
||||
end
|
||||
#Modified by young
|
||||
Redmine::MenuManager.map :project_menu do |menu|
|
||||
menu.push :overview, { :controller => 'projects', :action => 'show' }
|
||||
# menu.push :activity, { :controller => 'activities', :action => 'index' }
|
||||
#menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id
|
||||
# :if => Proc.new { |p| p.shared_versions.any? }
|
||||
menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural
|
||||
# menu.push :new_issue, { :controller => 'issues', :action => 'new', :copy_from => nil }, :param => :project_id, :caption => :label_issue_new,
|
||||
# :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) }
|
||||
# menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :param => :project_id, :caption => :label_gantt
|
||||
# menu.push :calendar, { :controller => 'calendars', :action => 'show' }, :param => :project_id, :caption => :label_calendar
|
||||
menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural
|
||||
# menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural
|
||||
# menu.push :wiki, { :controller => 'wiki', :action => 'show', :id => nil }, :param => :project_id,
|
||||
# :if => Proc.new { |p| p.wiki && !p.wiki.new_record? }
|
||||
menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id,
|
||||
:if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural
|
||||
#menu.push :files, { :controller => 'files', :action => 'index' }, :param => :project_id, :caption => :label_file_new
|
||||
menu.push :repository, { :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil },
|
||||
:if => Proc.new { |p| p.repository && !p.repository.new_record? && !( !User.current.member_of?(p) && p.hidden_repo ) }
|
||||
menu.push :settings, { :controller => 'projects', :action => 'settings' }, :last => true
|
||||
|
||||
end
|
||||
#end
|
||||
|
||||
#added by young
|
||||
Redmine::MenuManager.map :course_menu do |menu|
|
||||
menu.push :overview, { :controller => 'projects', :action => 'show'}
|
||||
menu.push :homework, { :controller => 'projects', :action => 'homework' }
|
||||
# menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural
|
||||
# menu.push :files, { :controller => 'files', :action => 'index' }, :caption => :label_file_new, :param => :project_id
|
||||
menu.push :repository, { :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil, :course => 1 }
|
||||
# menu.push :settings, { :controller => 'projects', :action => 'settings', :course => 1 }, :last => true
|
||||
|
||||
end
|
||||
Redmine::MenuManager.map :user_menu do |menu|
|
||||
menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.user_domain }
|
||||
menu.push :user_course, {:controller => 'users', :action => 'user_courses'}
|
||||
#menu.push :user_homework, {:controller => 'users', :action => 'user_homeworks'} by huang
|
||||
menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.project_domain}
|
||||
# menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids'} by huang
|
||||
menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback', :host => Setting.user_domain}
|
||||
|
||||
end
|
||||
Redmine::MenuManager.map :user_enterprise_menu do |menu|
|
||||
menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.user_domain }
|
||||
|
||||
menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.project_domain}
|
||||
|
||||
menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids', :host => Setting.user_domain}
|
||||
menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback', :host => Setting.user_domain}
|
||||
|
||||
end
|
||||
Redmine::MenuManager.map :user_menu_self do |menu|
|
||||
menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.project_domain }
|
||||
menu.push :user_information, {:controller => 'users', :action => 'info', :host => Setting.user_domain}
|
||||
menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.project_domain}
|
||||
menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids', :host => Setting.user_domain}
|
||||
menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback', :host => Setting.user_domain}
|
||||
|
||||
end
|
||||
#end
|
||||
|
||||
Redmine::Activity.map do |activity|
|
||||
activity.register :issues, :class_name => %w(Issue Journal)
|
||||
activity.register :changesets
|
||||
activity.register :news
|
||||
activity.register :contestnotification
|
||||
activity.register :documents, :class_name => %w(Document Attachment)
|
||||
activity.register :files, :class_name => 'Attachment'
|
||||
activity.register :course_files, :class_name => 'Attachment'
|
||||
activity.register :wiki_edits, :class_name => 'WikiContent::Version', :default => false
|
||||
activity.register :messages, :default => false
|
||||
activity.register :time_entries, :default => false
|
||||
# added by fq
|
||||
activity.register :bids, :class_name => 'Bid'
|
||||
activity.register :memos, :class_name => 'Memo'
|
||||
activity.register :journals_for_messages
|
||||
# end
|
||||
#added by nwb
|
||||
activity.register :course_journals_for_messages , :class_name => 'JournalsForMessage'
|
||||
activity.register :course_news, :class_name => 'News'
|
||||
activity.register :course_messages, :default => false, :class_name => 'Message'
|
||||
end
|
||||
|
||||
Redmine::Search.map do |search|
|
||||
search.register :issues
|
||||
search.register :news
|
||||
search.register :contestnotification
|
||||
search.register :documents
|
||||
search.register :changesets
|
||||
search.register :wiki_pages
|
||||
search.register :messages
|
||||
search.register :projects
|
||||
end
|
||||
|
||||
Redmine::WikiFormatting.map do |format|
|
||||
format.register :textile, Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting::Textile::Helper
|
||||
end
|
||||
|
||||
ActionView::Template.register_template_handler :rsb, Redmine::Views::ApiTemplateHandler
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
require 'redmine/core_ext'
|
||||
|
||||
begin
|
||||
require 'RMagick' unless Object.const_defined?(:Magick)
|
||||
rescue LoadError
|
||||
# RMagick is not available
|
||||
end
|
||||
|
||||
require 'redmine/scm/base'
|
||||
require 'redmine/access_control'
|
||||
require 'redmine/access_keys'
|
||||
require 'redmine/activity'
|
||||
require 'redmine/activity/fetcher'
|
||||
require 'redmine/ciphering'
|
||||
require 'redmine/codeset_util'
|
||||
require 'redmine/custom_field_format'
|
||||
require 'redmine/i18n'
|
||||
require 'redmine/menu_manager'
|
||||
require 'redmine/notifiable'
|
||||
require 'redmine/platform'
|
||||
require 'redmine/mime_type'
|
||||
require 'redmine/notifiable'
|
||||
require 'redmine/search'
|
||||
require 'redmine/syntax_highlighting'
|
||||
require 'redmine/thumbnail'
|
||||
require 'redmine/unified_diff'
|
||||
require 'redmine/utils'
|
||||
require 'redmine/version'
|
||||
require 'redmine/wiki_formatting'
|
||||
|
||||
require 'redmine/default_data/loader'
|
||||
require 'redmine/helpers/calendar'
|
||||
require 'redmine/helpers/diff'
|
||||
require 'redmine/helpers/gantt'
|
||||
require 'redmine/helpers/time_report'
|
||||
require 'redmine/views/other_formats_builder'
|
||||
require 'redmine/views/labelled_form_builder'
|
||||
require 'redmine/views/builders'
|
||||
|
||||
require 'redmine/themes'
|
||||
require 'redmine/hook'
|
||||
require 'redmine/plugin'
|
||||
|
||||
if RUBY_VERSION < '1.9'
|
||||
require 'fastercsv'
|
||||
else
|
||||
require 'csv'
|
||||
FCSV = CSV
|
||||
end
|
||||
|
||||
Redmine::Scm::Base.add "Subversion"
|
||||
Redmine::Scm::Base.add "Darcs"
|
||||
Redmine::Scm::Base.add "Mercurial"
|
||||
Redmine::Scm::Base.add "Cvs"
|
||||
Redmine::Scm::Base.add "Bazaar"
|
||||
Redmine::Scm::Base.add "Git"
|
||||
Redmine::Scm::Base.add "Filesystem"
|
||||
|
||||
Redmine::CustomFieldFormat.map do |fields|
|
||||
fields.register 'string'
|
||||
fields.register 'text'
|
||||
fields.register 'int', :label => :label_integer
|
||||
fields.register 'float'
|
||||
fields.register 'list'
|
||||
fields.register 'date'
|
||||
fields.register 'bool', :label => :label_boolean
|
||||
fields.register 'user', :only => %w(Issue TimeEntry Version Project), :edit_as => 'list'
|
||||
fields.register 'version', :only => %w(Issue TimeEntry Version Project), :edit_as => 'list'
|
||||
end
|
||||
|
||||
# Permissions
|
||||
Redmine::AccessControl.map do |map|
|
||||
map.permission :view_project, {:projects => [:show], :activities => [:index]}, :public => true, :read => true
|
||||
map.permission :search_project, {:search => :index}, :public => true, :read => true
|
||||
map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin ,:belong_to_project => true
|
||||
map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member ,:belong_to_project => true
|
||||
map.permission :close_project, {:projects => [:close, :reopen]}, :require => :member, :read => true ,:belong_to_project => true
|
||||
map.permission :select_project_modules, {:projects => :modules}, :require => :member ,:belong_to_project => true
|
||||
map.permission :select_contest_modules, {:contests => :modules}, :require => :member ,:belong_to_contest => true
|
||||
map.permission :manage_members, {:projects => :settings, :members => [:index, :show, :create, :update, :destroy, :autocomplete]}, :require => :member ,:belong_to_project => true
|
||||
map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member ,:belong_to_project => true
|
||||
map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member ,:belong_to_project => true
|
||||
#错的权限,先注释掉
|
||||
#map.permission :view_journals_for_messages, {:gantts => [:show, :update]}, :read => true
|
||||
|
||||
map.permission :quote_project, {},:require => :member,:belong_to_contest => true
|
||||
map.permission :is_manager,{},:require => :member ,:belong_to_project => true
|
||||
map.permission :as_teacher,{},:require => :member ,:belong_to_course => true
|
||||
map.permission :as_student,{},:require => :member ,:belong_to_course => true
|
||||
|
||||
#课程权限模块
|
||||
map.permission :view_course, {:courses => [:show], :activities => [:index]}, :public => true, :read => true
|
||||
map.permission :search_course, {:search => :index}, :public => true, :read => true
|
||||
map.permission :add_course, {:courses => [:new, :create]}, :require => :loggedin ,:belong_to_course => true
|
||||
map.permission :edit_course, {:courses => [:settings, :edit, :update]}, :require => :member ,:belong_to_course => true
|
||||
map.permission :close_course, {:courses => [:close, :reopen]}, :require => :member, :read => true ,:belong_to_course => true
|
||||
map.permission :select_course_modules, {:courses => :modules}, :require => :member ,:belong_to_course => true
|
||||
map.permission :view_course_journals_for_messages, {:courses => :feedback}, :require => :member,:read => true ,:belong_to_course => true
|
||||
map.permission :memos_attachments_download,{:attachments => :download}
|
||||
map.permission :projects_attachments_download,{:attachments => :download},:belong_to_project => true
|
||||
map.permission :course_attachments_download,{:attachments => :download},:belong_to_course => true
|
||||
map.permission :contest_attachments_download,{:attachments => :download},:belong_to_contest => true
|
||||
#与项目一致,注释掉
|
||||
#map.course_module :files do |map|
|
||||
# map.permission :manage_files, {:files => [:new, :create]}, :require => :loggedin
|
||||
# map.permission :view_course_files, {:files => :index, :versions => :download}, :read => true
|
||||
#end
|
||||
#新闻权限与项目一致注释掉此处
|
||||
# map.course_module :news do |map|
|
||||
# map.permission :manage_news, {:news => [:new, :create, :edit, :update, :destroy], :comments => [:destroy]}, :require => :member
|
||||
# map.permission :view_course_news, {:news => [:index, :show]}, :public => true, :read => true
|
||||
# map.permission :comment_news, {:comments => :create}
|
||||
# end
|
||||
|
||||
map.course_module :bids do |map|
|
||||
map.permission :view_homework_attaches, {:bids => [:show, :show_project, :revision]}, :read => true,:belong_to_course => true
|
||||
map.permission :paret_in_homework,{},:require => :member ,:belong_to_course => true
|
||||
end
|
||||
|
||||
#讨论区权限与项目统一,注释掉此课程讨论区权限
|
||||
#map.course_module :boards do |map|
|
||||
# map.permission :manage_boards, {:boards => [:new, :create, :edit, :update, :destroy]}, :require => :member
|
||||
# map.permission :view_course_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true, :read => true
|
||||
# map.permission :add_messages, {:messages => [:new, :reply, :quote]}
|
||||
# map.permission :edit_messages, {:messages => :edit}, :require => :member
|
||||
# map.permission :edit_own_messages, {:messages => :edit}, :require => :loggedin
|
||||
# map.permission :delete_messages, {:messages => :destroy}, :require => :member
|
||||
# map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin
|
||||
#end
|
||||
|
||||
#end
|
||||
|
||||
map.project_module :issue_tracking do |map|
|
||||
# Issue categories
|
||||
map.permission :manage_categories, {:projects => :settings, :issue_categories => [:index, :show, :new, :create, :edit, :update, :destroy]}, :require => :member
|
||||
# Issues
|
||||
map.permission :view_issues, {:issues => [:index, :show],
|
||||
:auto_complete => [:issues],
|
||||
:context_menus => [:issues],
|
||||
:versions => [:index, :show, :status_by],
|
||||
:journals => [:index, :diff],
|
||||
:queries => :index,
|
||||
:reports => [:issue_report, :issue_report_details]},
|
||||
:read => true
|
||||
map.permission :add_issues, {:issues => [:new, :create, :update_form], :attachments => :upload}
|
||||
map.permission :edit_issues, {:issues => [:edit, :update, :bulk_edit, :bulk_update, :update_form], :journals => [:new], :attachments => :upload}
|
||||
map.permission :manage_issue_relations, {:issue_relations => [:index, :show, :create, :destroy]}
|
||||
map.permission :manage_subtasks, {}
|
||||
map.permission :set_issues_private, {}
|
||||
map.permission :set_own_issues_private, {}, :require => :loggedin
|
||||
map.permission :add_issue_notes, {:issues => [:edit, :update, :update_form], :journals => [:new], :attachments => :upload}
|
||||
map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin
|
||||
map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin
|
||||
map.permission :view_private_notes, {}, :read => true, :require => :member
|
||||
map.permission :set_notes_private, {}, :require => :member
|
||||
map.permission :move_issues, {:issues => [:bulk_edit, :bulk_update]}, :require => :loggedin
|
||||
map.permission :delete_issues, {:issues => :destroy}, :require => :member
|
||||
# Queries
|
||||
map.permission :manage_public_queries, {:queries => [:new, :create, :edit, :update, :destroy]}, :require => :member
|
||||
map.permission :save_queries, {:queries => [:new, :create, :edit, :update, :destroy]}, :require => :loggedin
|
||||
# Watchers
|
||||
map.permission :view_issue_watchers, {}, :read => true
|
||||
map.permission :add_issue_watchers, {:watchers => [:new, :create, :append, :autocomplete_for_user]}
|
||||
map.permission :delete_issue_watchers, {:watchers => :destroy}
|
||||
end
|
||||
|
||||
map.project_module :time_tracking do |map|
|
||||
map.permission :log_time, {:timelog => [:new, :create]}, :require => :loggedin
|
||||
map.permission :view_time_entries, {:timelog => [:index, :report, :show]}, :read => true
|
||||
map.permission :edit_time_entries, {:timelog => [:edit, :update, :destroy, :bulk_edit, :bulk_update]}, :require => :member
|
||||
map.permission :edit_own_time_entries, {:timelog => [:edit, :update, :destroy,:bulk_edit, :bulk_update]}, :require => :loggedin
|
||||
map.permission :manage_project_activities, {:project_enumerations => [:update, :destroy]}, :require => :member
|
||||
end
|
||||
|
||||
map.project_module :news do |map|
|
||||
map.permission :manage_news, {:news => [:new, :create, :edit, :update, :destroy], :comments => [:destroy]}, :require => :member
|
||||
map.permission :view_news, {:news => [:index, :show]}, :public => true, :read => true
|
||||
map.permission :comment_news, {:comments => :create}
|
||||
end
|
||||
|
||||
map.contest_module :contestnotifications do |map|
|
||||
map.permission :manage_contestnotifications, {:contestnotifications => [:new, :create, :edit, :update, :destroy], :notificationcomments => [:destroy]}, :require => :member,:belong_to_contest => true
|
||||
map.permission :view_contestnotifications, {:contestnotifications => [:index, :show]}, :public => true, :read => true
|
||||
map.permission :notificationcomment_contestnotifications, {:notificationcomments => :create},:belong_to_contest => true
|
||||
end
|
||||
|
||||
map.project_module :documents do |map|
|
||||
map.permission :add_documents, {:documents => [:new, :create, :add_attachment]}, :require => :loggedin
|
||||
map.permission :edit_documents, {:documents => [:edit, :update, :add_attachment]}, :require => :loggedin
|
||||
map.permission :delete_documents, {:documents => [:destroy]}, :require => :loggedin
|
||||
map.permission :view_documents, {:documents => [:index, :show, :download]}, :read => true
|
||||
end
|
||||
|
||||
map.project_module :files do |map|
|
||||
map.permission :manage_files, {:files => [:new, :create]}, :require => :loggedin
|
||||
map.permission :view_files, {:files => :index, :versions => :download}, :read => true
|
||||
end
|
||||
|
||||
map.project_module :wiki do |map|
|
||||
map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member
|
||||
map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member
|
||||
map.permission :delete_wiki_pages, {:wiki => [:destroy, :destroy_version]}, :require => :member
|
||||
map.permission :view_wiki_pages, {:wiki => [:index, :show, :special, :date_index]}, :read => true
|
||||
map.permission :export_wiki_pages, {:wiki => [:export]}, :read => true
|
||||
map.permission :view_wiki_edits, {:wiki => [:history, :diff, :annotate]}, :read => true
|
||||
map.permission :edit_wiki_pages, :wiki => [:edit, :update, :preview, :add_attachment]
|
||||
map.permission :delete_wiki_pages_attachments, {}
|
||||
map.permission :protect_wiki_pages, {:wiki => :protect}, :require => :member
|
||||
end
|
||||
|
||||
map.project_module :repository do |map|
|
||||
map.permission :manage_repository, {:repositories => [:new, :create, :edit, :update, :committers, :destroy]}, :require => :member
|
||||
map.permission :browse_repository, {:repositories => [:show, :browse, :entry, :raw, :annotate, :changes, :diff, :stats, :graph]}, :read => true
|
||||
map.permission :view_changesets, {:repositories => [:show, :revisions, :revision]}, :read => true
|
||||
map.permission :commit_access, {}
|
||||
map.permission :manage_related_issues, {:repositories => [:add_related_issue, :remove_related_issue]}
|
||||
end
|
||||
|
||||
map.project_module :boards do |map|
|
||||
map.permission :manage_boards, {:boards => [:new, :create, :edit, :update, :destroy]}, :require => :member
|
||||
map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true, :read => true
|
||||
map.permission :add_messages, {:messages => [:new, :reply, :quote]}
|
||||
map.permission :edit_messages, {:messages => :edit}, :require => :member
|
||||
map.permission :edit_own_messages, {:messages => :edit}, :require => :loggedin
|
||||
map.permission :delete_messages, {:messages => :destroy}, :require => :member
|
||||
map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin
|
||||
end
|
||||
|
||||
map.project_module :calendar do |map|
|
||||
map.permission :view_calendar, {:calendars => [:show, :update]}, :read => true
|
||||
end
|
||||
|
||||
map.project_module :gantt do |map|
|
||||
map.permission :view_gantt, {:gantts => [:show, :update]}, :read => true
|
||||
end
|
||||
|
||||
map.project_module :dts do |map|
|
||||
map.permission :do_dts, {:dts => :show}, :read => true
|
||||
end
|
||||
# map.project_module :journals do |map|
|
||||
# map.permission :view_journals_for_messages, {:gantts => [:show, :update]}, :read => true
|
||||
# end
|
||||
|
||||
end
|
||||
#by young
|
||||
Redmine::MenuManager.map :top_menu do |menu|
|
||||
menu.push :home, {:host => Setting.user_domain}
|
||||
menu.push :course_practice, {:controller => 'projects', :action => 'course', :project_type => 1}
|
||||
menu.push :project_deposit, { :controller => 'projects', :action => 'index', :project_type => 0}, :caption => :label_project_deposit
|
||||
menu.push :software_user, {:controller => 'users', :action => 'index'}
|
||||
menu.push :contest_innovate, {:controller => 'bids', :action => 'contest', :project_type => 1}
|
||||
menu.push :requirement_enterprise, {:controller => 'bids', :action => 'index'}
|
||||
menu.push :project_module_forums, :forums_path
|
||||
menu.push :stores_index, :stores_path
|
||||
|
||||
|
||||
# menu.push :investor, :home_path
|
||||
# menu.push :theme, :home_path
|
||||
# menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? }
|
||||
# menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new { User.current.admin? }, :last => true
|
||||
# menu.push :help, Redmine::Info.help_url, :last => true
|
||||
end
|
||||
#end
|
||||
|
||||
# by huang
|
||||
# Redmine::MenuManager.map :top_home_menu do |menu|
|
||||
# menu.push :home, :home_path
|
||||
# menu.push :projects, { :controller => 'projects', :action => 'index' }, :caption => :label_project_plural
|
||||
# menu.push :developer, {:controller => 'users', :action => 'index'}
|
||||
# menu.push :investor, :home_path
|
||||
# menu.push :theme, :home_path
|
||||
# menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? }
|
||||
# menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new { User.current.admin? }, :last => true
|
||||
# menu.push :help, Redmine::Info.help_url, :last => true
|
||||
# end
|
||||
|
||||
# Redmine::MenuManager.map :top_enterprise_menu do |menu|
|
||||
# menu.push :home, :home_path
|
||||
# menu.push :requirement, {:controller => 'bids', :action => 'index', :project_type => 0 }
|
||||
# menu.push :projects, { :controller => 'projects', :action => 'index', :project_type => 0 }, :caption => :label_project_plural
|
||||
#
|
||||
# menu.push :developer, {:controller => 'users', :action => 'index', :project_type => 0 }
|
||||
# menu.push :college_into, {:controller=>'projects', :action=>'course_enterprise', :project_type => 1 }
|
||||
# # menu.push :investor, :home_path
|
||||
# # menu.push :theme, :home_path
|
||||
# # menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? }
|
||||
# # menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new { User.current.admin? }, :last => true
|
||||
# # menu.push :help, Redmine::Info.help_url, :last => true
|
||||
# end
|
||||
|
||||
# Redmine::MenuManager.map :top_college_menu do |menu|
|
||||
# menu.push :home, :home_path
|
||||
# menu.push :new_course, {:controller => 'projects', :action => 'course', :project_type => 1}
|
||||
# menu.push :new_homework, {:controller => 'bids', :action => 'index', :project_type => 1 }
|
||||
# menu.push :new_contest, {:controller => 'bids', :action => 'contest', :project_type => 1}
|
||||
# menu.push :projects, { :controller => 'projects', :action => 'index', :project_type => 0 }, :caption => :label_project_plural
|
||||
# menu.push :developer, {:controller => 'users', :action => 'index', :project_type => 1 }
|
||||
# menu.push :enterprise_into, {:controller=>'projects', :action=>'enterprise_course', :project_type => 0 }
|
||||
# menu.push :investor, :home_path
|
||||
# menu.push :theme, :home_path
|
||||
# menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? }
|
||||
# menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new { User.current.admin? }, :last => true
|
||||
# menu.push :help, Redmine::Info.help_url, :last => true
|
||||
# end
|
||||
# end
|
||||
|
||||
Redmine::MenuManager.map :account_menu do |menu|
|
||||
menu.push :login, {:controller => 'account', :action => 'login'}, :if => Proc.new { !User.current.logged? }
|
||||
menu.push :register, {:controller => 'account', :action => 'register'}, :if => Proc.new { !User.current.logged? && Setting.self_registration? }
|
||||
# menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? }
|
||||
menu.push :logout, {:controller => 'account', :action => 'logout'}, :html => {:method => 'post'}, :if => Proc.new { User.current.logged? }
|
||||
end
|
||||
########fq
|
||||
Redmine::MenuManager.map :bid_menu do |menu|
|
||||
menu.push :respond, { :controller => 'bids', :action => 'show' }, :caption => :label_user_response
|
||||
menu.push :project, { :controller => 'bids', :action => 'show_project', :host => Setting.project_domain }, :caption => :label_bidding_project
|
||||
# menu.push :result, { :controller => 'bids', :action => 'show_results' },
|
||||
# :caption => :label_bidding_results,:if => Proc.new{ |p| User.current.id == p }
|
||||
end
|
||||
###new add by linchun
|
||||
Redmine::MenuManager.map :contest_menu do |menu|
|
||||
menu.push :respond, :show_contest_contest_path, :caption => :label_user_response
|
||||
#menu.push :project, :show_project_contest_path, :caption => :label_contest_project
|
||||
#menu.push :application, :show_softapplication_contest_path, :caption => :label_contest_application
|
||||
menu.push :attendingcontest, {:controller => 'contests', :action => 'show_attendingcontest'}, :caption => :label_attending_contest
|
||||
menu.push :contestnotifications, { :controller => 'contestnotifications', :action => 'index' }, :param => :contest_id, :caption => :label_contest_notification
|
||||
#menu.push :contestnotification, {:controller => 'contests', :action => 'show_notification'}, :caption => :label_contest_notification
|
||||
# menu.push :attendingcontest, :show_attendingcontest_contest_path, :caption => :label_attendin,g_contest
|
||||
# menu.push :result, { :controller => 'bids', :action => 'show_results' },
|
||||
# :caption => :label_bidding_results,:if => Proc.new{ |p| User.current.id == p }
|
||||
end
|
||||
|
||||
####
|
||||
Redmine::MenuManager.map :application_menu do |menu|
|
||||
# Empty
|
||||
end
|
||||
|
||||
######
|
||||
Redmine::MenuManager.map :homework_menu do |menu|
|
||||
menu.push :respond, { :controller => 'bids', :action => 'show' }, :caption => :label_homework_response
|
||||
menu.push :project, { :controller => 'bids', :action => 'show_project' }, :caption => :label_bidding_homework
|
||||
end
|
||||
########end
|
||||
Redmine::MenuManager.map :admin_menu do |menu|
|
||||
menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural
|
||||
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 :groups, {:controller => 'groups'}, :caption => :label_group_plural
|
||||
menu.push :roles, {:controller => 'roles'}, :caption => :label_role_and_permissions
|
||||
menu.push :trackers, {:controller => 'trackers'}, :caption => :label_tracker_plural
|
||||
menu.push :issue_statuses, {:controller => 'issue_statuses'}, :caption => :label_issue_status_plural,
|
||||
:html => {:class => 'issue_statuses'}
|
||||
menu.push :workflows, {:controller => 'workflows', :action => 'edit'}, :caption => :label_workflow
|
||||
menu.push :custom_fields, {:controller => 'custom_fields'}, :caption => :label_custom_field_plural,
|
||||
:html => {:class => 'custom_fields'}
|
||||
menu.push :enumerations, {:controller => 'enumerations'}
|
||||
menu.push :settings, {:controller => 'settings'}
|
||||
menu.push :ldap_authentication, {:controller => 'auth_sources', :action => 'index'},
|
||||
:html => {:class => 'server_authentication'}
|
||||
menu.push :plugins, {:controller => 'admin', :action => 'plugins'}, :last => true
|
||||
menu.push :info, {:controller => 'admin', :action => 'info'}, :caption => :label_information_plural, :last => true
|
||||
|
||||
end
|
||||
#Modified by young
|
||||
Redmine::MenuManager.map :project_menu do |menu|
|
||||
menu.push :overview, { :controller => 'projects', :action => 'show' }
|
||||
# menu.push :activity, { :controller => 'activities', :action => 'index' }
|
||||
#menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id
|
||||
# :if => Proc.new { |p| p.shared_versions.any? }
|
||||
menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural
|
||||
# menu.push :new_issue, { :controller => 'issues', :action => 'new', :copy_from => nil }, :param => :project_id, :caption => :label_issue_new,
|
||||
# :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) }
|
||||
# menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :param => :project_id, :caption => :label_gantt
|
||||
# menu.push :calendar, { :controller => 'calendars', :action => 'show' }, :param => :project_id, :caption => :label_calendar
|
||||
menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural
|
||||
# menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural
|
||||
# menu.push :wiki, { :controller => 'wiki', :action => 'show', :id => nil }, :param => :project_id,
|
||||
# :if => Proc.new { |p| p.wiki && !p.wiki.new_record? }
|
||||
menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id,
|
||||
:if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural
|
||||
#menu.push :files, { :controller => 'files', :action => 'index' }, :param => :project_id, :caption => :label_file_new
|
||||
menu.push :repository, { :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil },
|
||||
:if => Proc.new { |p| p.repository && !p.repository.new_record? && !( !User.current.member_of?(p) && p.hidden_repo ) }
|
||||
menu.push :settings, { :controller => 'projects', :action => 'settings' }, :last => true
|
||||
|
||||
end
|
||||
#end
|
||||
|
||||
#added by young
|
||||
Redmine::MenuManager.map :course_menu do |menu|
|
||||
menu.push :overview, { :controller => 'projects', :action => 'show'}
|
||||
menu.push :homework, { :controller => 'projects', :action => 'homework' }
|
||||
# menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural
|
||||
# menu.push :files, { :controller => 'files', :action => 'index' }, :caption => :label_file_new, :param => :project_id
|
||||
menu.push :repository, { :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil, :course => 1 }
|
||||
# menu.push :settings, { :controller => 'projects', :action => 'settings', :course => 1 }, :last => true
|
||||
|
||||
end
|
||||
Redmine::MenuManager.map :user_menu do |menu|
|
||||
menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.user_domain }
|
||||
menu.push :user_course, {:controller => 'users', :action => 'user_courses'}
|
||||
#menu.push :user_homework, {:controller => 'users', :action => 'user_homeworks'} by huang
|
||||
menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.project_domain}
|
||||
# menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids'} by huang
|
||||
menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback', :host => Setting.user_domain}
|
||||
|
||||
end
|
||||
Redmine::MenuManager.map :user_enterprise_menu do |menu|
|
||||
menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.user_domain }
|
||||
|
||||
menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.project_domain}
|
||||
|
||||
menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids', :host => Setting.user_domain}
|
||||
menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback', :host => Setting.user_domain}
|
||||
|
||||
end
|
||||
Redmine::MenuManager.map :user_menu_self do |menu|
|
||||
menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.project_domain }
|
||||
menu.push :user_information, {:controller => 'users', :action => 'info', :host => Setting.user_domain}
|
||||
menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.project_domain}
|
||||
menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids', :host => Setting.user_domain}
|
||||
menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback', :host => Setting.user_domain}
|
||||
|
||||
end
|
||||
#end
|
||||
|
||||
Redmine::Activity.map do |activity|
|
||||
activity.register :issues, :class_name => %w(Issue Journal)
|
||||
activity.register :changesets
|
||||
activity.register :news
|
||||
activity.register :contestnotification
|
||||
activity.register :documents, :class_name => %w(Document Attachment)
|
||||
activity.register :files, :class_name => 'Attachment'
|
||||
activity.register :course_files, :class_name => 'Attachment'
|
||||
activity.register :wiki_edits, :class_name => 'WikiContent::Version', :default => false
|
||||
activity.register :messages, :default => false
|
||||
activity.register :time_entries, :default => false
|
||||
# added by fq
|
||||
activity.register :bids, :class_name => 'Bid'
|
||||
activity.register :memos, :class_name => 'Memo'
|
||||
activity.register :journals_for_messages
|
||||
# end
|
||||
#added by nwb
|
||||
activity.register :course_journals_for_messages , :class_name => 'JournalsForMessage'
|
||||
activity.register :course_news, :class_name => 'News'
|
||||
activity.register :course_messages, :default => false, :class_name => 'Message'
|
||||
end
|
||||
|
||||
Redmine::Search.map do |search|
|
||||
search.register :issues
|
||||
search.register :news
|
||||
search.register :contestnotification
|
||||
search.register :documents
|
||||
search.register :changesets
|
||||
search.register :wiki_pages
|
||||
search.register :messages
|
||||
search.register :projects
|
||||
end
|
||||
|
||||
Redmine::WikiFormatting.map do |format|
|
||||
format.register :textile, Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting::Textile::Helper
|
||||
end
|
||||
|
||||
ActionView::Template.register_template_handler :rsb, Redmine::Views::ApiTemplateHandler
|
||||
|
@ -1,172 +1,172 @@
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
module Redmine
|
||||
module AccessControl
|
||||
|
||||
class << self
|
||||
def map
|
||||
mapper = Mapper.new
|
||||
yield mapper
|
||||
@permissions ||= []
|
||||
@permissions += mapper.mapped_permissions
|
||||
end
|
||||
|
||||
def permissions
|
||||
@permissions
|
||||
end
|
||||
|
||||
# Returns the permission of given name or nil if it wasn't found
|
||||
# Argument should be a symbol
|
||||
def permission(name)
|
||||
permissions.detect {|p| p.name == name}
|
||||
end
|
||||
|
||||
# Returns the actions that are allowed by the permission of given name
|
||||
def allowed_actions(permission_name)
|
||||
perm = permission(permission_name)
|
||||
perm ? perm.actions : []
|
||||
end
|
||||
|
||||
def public_permissions
|
||||
@public_permissions ||= @permissions.select {|p| p.public?}
|
||||
end
|
||||
|
||||
def members_only_permissions
|
||||
@members_only_permissions ||= @permissions.select {|p| p.require_member?}
|
||||
end
|
||||
|
||||
def loggedin_only_permissions
|
||||
@loggedin_only_permissions ||= @permissions.select {|p| p.require_loggedin?}
|
||||
end
|
||||
|
||||
def read_action?(action)
|
||||
if action.is_a?(Symbol)
|
||||
perm = permission(action)
|
||||
!perm.nil? && perm.read?
|
||||
else
|
||||
s = "#{action[:controller]}/#{action[:action]}"
|
||||
permissions.detect {|p| p.actions.include?(s) && !p.read?}.nil?
|
||||
end
|
||||
end
|
||||
|
||||
def available_project_modules
|
||||
@available_project_modules ||= @permissions.collect(&:project_module).uniq.compact
|
||||
end
|
||||
|
||||
def available_contest_modules
|
||||
@available_contest_modules ||= @permissions.collect(&:contest_module).uniq.compact
|
||||
end
|
||||
|
||||
def modules_permissions(modules)
|
||||
@permissions.select {|p| p.project_module.nil? || modules.include?(p.project_module.to_s)}
|
||||
@permissions.select {|p| p.contest_module.nil? || modules.include?(p.contest_module.to_s)}
|
||||
end
|
||||
end
|
||||
|
||||
class Mapper
|
||||
def initialize
|
||||
@project_module = nil
|
||||
@course_module = nil
|
||||
@contest_module = nil
|
||||
end
|
||||
|
||||
def permission(name, hash, options={})
|
||||
@permissions ||= []
|
||||
options.merge!(:project_module => @project_module)
|
||||
options.merge!(:contest_module => @contest_module)
|
||||
@permissions << Permission.new(name, hash, options)
|
||||
end
|
||||
|
||||
def project_module(name, options={})
|
||||
@project_module = name
|
||||
yield self
|
||||
@project_module = nil
|
||||
end
|
||||
|
||||
def course_module(name, options={})
|
||||
@course_module = name
|
||||
yield self
|
||||
@course_module = nil
|
||||
end
|
||||
def contest_module(name, options={})
|
||||
@contest_module = name
|
||||
yield self
|
||||
@contest_module = nil
|
||||
end
|
||||
|
||||
def mapped_permissions
|
||||
@permissions
|
||||
end
|
||||
end
|
||||
|
||||
class Permission
|
||||
attr_reader :name, :actions, :project_module ,:course_module, :contest_module
|
||||
|
||||
def initialize(name, hash, options)
|
||||
@name = name
|
||||
@actions = []
|
||||
@public = options[:public] || false
|
||||
@require = options[:require]
|
||||
@read = options[:read] || false
|
||||
@course_module = options[:course_module]
|
||||
@project_module = options[:project_module]
|
||||
@contest_module = options[:contest_module]
|
||||
@belong_to_project = options[:belong_to_project] || false
|
||||
@belong_to_course = options[:belong_to_course] || false
|
||||
@belong_to_contest =options[:belong_to_contest] || false
|
||||
hash.each do |controller, actions|
|
||||
if actions.is_a? Array
|
||||
@actions << actions.collect {|action| "#{controller}/#{action}"}
|
||||
else
|
||||
@actions << "#{controller}/#{actions}"
|
||||
end
|
||||
end
|
||||
@actions.flatten!
|
||||
end
|
||||
|
||||
def public?
|
||||
@public
|
||||
end
|
||||
|
||||
def require_member?
|
||||
@require && @require == :member
|
||||
end
|
||||
|
||||
def require_loggedin?
|
||||
@require && (@require == :member || @require == :loggedin)
|
||||
end
|
||||
|
||||
def read?
|
||||
@read
|
||||
end
|
||||
|
||||
def belong_to_project?
|
||||
@belong_to_project
|
||||
end
|
||||
|
||||
def belong_to_course?
|
||||
@belong_to_course
|
||||
end
|
||||
|
||||
def belong_to_contest?
|
||||
@belong_to_contest
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
module Redmine
|
||||
module AccessControl
|
||||
|
||||
class << self
|
||||
def map
|
||||
mapper = Mapper.new
|
||||
yield mapper
|
||||
@permissions ||= []
|
||||
@permissions += mapper.mapped_permissions
|
||||
end
|
||||
|
||||
def permissions
|
||||
@permissions
|
||||
end
|
||||
|
||||
# Returns the permission of given name or nil if it wasn't found
|
||||
# Argument should be a symbol
|
||||
def permission(name)
|
||||
permissions.detect {|p| p.name == name}
|
||||
end
|
||||
|
||||
# Returns the actions that are allowed by the permission of given name
|
||||
def allowed_actions(permission_name)
|
||||
perm = permission(permission_name)
|
||||
perm ? perm.actions : []
|
||||
end
|
||||
|
||||
def public_permissions
|
||||
@public_permissions ||= @permissions.select {|p| p.public?}
|
||||
end
|
||||
|
||||
def members_only_permissions
|
||||
@members_only_permissions ||= @permissions.select {|p| p.require_member?}
|
||||
end
|
||||
|
||||
def loggedin_only_permissions
|
||||
@loggedin_only_permissions ||= @permissions.select {|p| p.require_loggedin?}
|
||||
end
|
||||
|
||||
def read_action?(action)
|
||||
if action.is_a?(Symbol)
|
||||
perm = permission(action)
|
||||
!perm.nil? && perm.read?
|
||||
else
|
||||
s = "#{action[:controller]}/#{action[:action]}"
|
||||
permissions.detect {|p| p.actions.include?(s) && !p.read?}.nil?
|
||||
end
|
||||
end
|
||||
|
||||
def available_project_modules
|
||||
@available_project_modules ||= @permissions.collect(&:project_module).uniq.compact
|
||||
end
|
||||
|
||||
def available_contest_modules
|
||||
@available_contest_modules ||= @permissions.collect(&:contest_module).uniq.compact
|
||||
end
|
||||
|
||||
def modules_permissions(modules)
|
||||
@permissions.select {|p| p.project_module.nil? || modules.include?(p.project_module.to_s)}
|
||||
@permissions.select {|p| p.contest_module.nil? || modules.include?(p.contest_module.to_s)}
|
||||
end
|
||||
end
|
||||
|
||||
class Mapper
|
||||
def initialize
|
||||
@project_module = nil
|
||||
@course_module = nil
|
||||
@contest_module = nil
|
||||
end
|
||||
|
||||
def permission(name, hash, options={})
|
||||
@permissions ||= []
|
||||
options.merge!(:project_module => @project_module)
|
||||
options.merge!(:contest_module => @contest_module)
|
||||
@permissions << Permission.new(name, hash, options)
|
||||
end
|
||||
|
||||
def project_module(name, options={})
|
||||
@project_module = name
|
||||
yield self
|
||||
@project_module = nil
|
||||
end
|
||||
|
||||
def course_module(name, options={})
|
||||
@course_module = name
|
||||
yield self
|
||||
@course_module = nil
|
||||
end
|
||||
def contest_module(name, options={})
|
||||
@contest_module = name
|
||||
yield self
|
||||
@contest_module = nil
|
||||
end
|
||||
|
||||
def mapped_permissions
|
||||
@permissions
|
||||
end
|
||||
end
|
||||
|
||||
class Permission
|
||||
attr_reader :name, :actions, :project_module ,:course_module, :contest_module
|
||||
|
||||
def initialize(name, hash, options)
|
||||
@name = name
|
||||
@actions = []
|
||||
@public = options[:public] || false
|
||||
@require = options[:require]
|
||||
@read = options[:read] || false
|
||||
@course_module = options[:course_module]
|
||||
@project_module = options[:project_module]
|
||||
@contest_module = options[:contest_module]
|
||||
@belong_to_project = options[:belong_to_project] || false
|
||||
@belong_to_course = options[:belong_to_course] || false
|
||||
@belong_to_contest =options[:belong_to_contest] || false
|
||||
hash.each do |controller, actions|
|
||||
if actions.is_a? Array
|
||||
@actions << actions.collect {|action| "#{controller}/#{action}"}
|
||||
else
|
||||
@actions << "#{controller}/#{actions}"
|
||||
end
|
||||
end
|
||||
@actions.flatten!
|
||||
end
|
||||
|
||||
def public?
|
||||
@public
|
||||
end
|
||||
|
||||
def require_member?
|
||||
@require && @require == :member
|
||||
end
|
||||
|
||||
def require_loggedin?
|
||||
@require && (@require == :member || @require == :loggedin)
|
||||
end
|
||||
|
||||
def read?
|
||||
@read
|
||||
end
|
||||
|
||||
def belong_to_project?
|
||||
@belong_to_project
|
||||
end
|
||||
|
||||
def belong_to_course?
|
||||
@belong_to_course
|
||||
end
|
||||
|
||||
def belong_to_contest?
|
||||
@belong_to_contest
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in new issue