2013-08-01 10:33:49 +08:00
|
|
|
# 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
|
|
|
|
map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member
|
|
|
|
map.permission :close_project, {:projects => [:close, :reopen]}, :require => :member, :read => true
|
|
|
|
map.permission :select_project_modules, {:projects => :modules}, :require => :member
|
|
|
|
map.permission :manage_members, {:projects => :settings, :members => [:index, :show, :create, :update, :destroy, :autocomplete]}, :require => :member
|
|
|
|
map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member
|
|
|
|
map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member
|
2014-03-19 17:32:32 +08:00
|
|
|
map.permission :view_journals_for_messages, {:gantts => [:show, :update]}, :read => true
|
2013-08-01 10:33:49 +08:00
|
|
|
|
2014-06-04 09:19:01 +08:00
|
|
|
#课程权限模块
|
2014-06-10 11:49:28 +08:00
|
|
|
#added by nwb
|
2014-06-06 13:56:48 +08:00
|
|
|
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
|
|
|
|
map.permission :edit_course, {:courses => [:settings, :edit, :update]}, :require => :member
|
|
|
|
map.permission :close_course, {:courses => [:close, :reopen]}, :require => :member, :read => true
|
|
|
|
map.permission :select_course_modules, {:courses => :modules}, :require => :member
|
2014-06-10 11:49:28 +08:00
|
|
|
map.permission :view_course_journals_for_messages, {:gantts => [:show, :update]}, :read => true
|
2014-06-06 13:56:48 +08:00
|
|
|
|
2014-06-10 15:44:37 +08:00
|
|
|
map.course_module :files do |map|
|
|
|
|
map.permission :manage_files, {:files => [:new, :create]}, :require => :loggedin
|
2014-06-11 11:04:38 +08:00
|
|
|
map.permission :view_course_files, {:files => :index, :versions => :download}, :read => true
|
2014-06-04 09:19:01 +08:00
|
|
|
end
|
2014-06-12 09:20:39 +08:00
|
|
|
map.course_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.project_module :bids do |map|
|
|
|
|
map.permission :view_homework_attaches, {:bids => [:show, :show_project, :revision]}, :read => true
|
|
|
|
end
|
|
|
|
|
2014-06-10 11:49:28 +08:00
|
|
|
#end
|
2014-06-04 09:19:01 +08:00
|
|
|
|
2013-08-01 10:33:49 +08:00
|
|
|
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.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
|
|
|
|
|
2014-05-21 14:44:53 +08:00
|
|
|
#作业模块权限
|
|
|
|
map.project_module :bids do |map|
|
|
|
|
map.permission :view_homework_attaches, {:bids => [:show, :show_project, :revision]}, :read => true
|
|
|
|
end
|
|
|
|
|
2013-08-01 10:33:49 +08:00
|
|
|
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
|
2014-03-19 17:32:32 +08:00
|
|
|
|
|
|
|
# map.project_module :journals do |map|
|
|
|
|
# map.permission :view_journals_for_messages, {:gantts => [:show, :update]}, :read => true
|
|
|
|
# end
|
|
|
|
|
2013-08-01 10:33:49 +08:00
|
|
|
end
|
|
|
|
#by young
|
|
|
|
Redmine::MenuManager.map :top_menu do |menu|
|
2014-03-21 20:25:41 +08:00
|
|
|
menu.push :home, {:host => Setting.user_domain}
|
2013-11-04 15:20:22 +08:00
|
|
|
menu.push :course_practice, {:controller => 'projects', :action => 'course', :project_type => 1}
|
2013-11-04 22:41:25 +08:00
|
|
|
menu.push :project_deposit, { :controller => 'projects', :action => 'index', :project_type => 0}, :caption => :label_project_deposit
|
2013-11-04 15:20:22 +08:00
|
|
|
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'}
|
2013-11-28 16:14:23 +08:00
|
|
|
menu.push :project_module_forums, :forums_path
|
2014-01-17 08:55:58 +08:00
|
|
|
menu.push :stores_index, :stores_path
|
2013-11-26 20:46:51 +08:00
|
|
|
|
2013-11-04 15:20:22 +08:00
|
|
|
|
2013-08-01 11:08:59 +08:00
|
|
|
# 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
|
2013-08-01 10:33:49 +08:00
|
|
|
end
|
|
|
|
#end
|
2013-09-29 19:46:59 +08:00
|
|
|
|
|
|
|
# by huang
|
2013-11-04 22:41:25 +08:00
|
|
|
# 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'}
|
2013-09-29 19:46:59 +08:00
|
|
|
# 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
|
2013-11-04 22:41:25 +08:00
|
|
|
# end
|
2013-09-29 19:46:59 +08:00
|
|
|
|
2013-11-04 22:41:25 +08:00
|
|
|
# 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
|
2013-09-29 19:46:59 +08:00
|
|
|
|
2013-11-04 22:41:25 +08:00
|
|
|
# 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 }
|
2013-09-29 19:46:59 +08:00
|
|
|
# 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
|
2013-11-04 22:41:25 +08:00
|
|
|
# end
|
2013-09-29 19:46:59 +08:00
|
|
|
# end
|
|
|
|
|
2013-08-01 10:33:49 +08:00
|
|
|
Redmine::MenuManager.map :account_menu do |menu|
|
2014-04-09 11:27:12 +08:00
|
|
|
menu.push :login, {:controller => 'account', :action => 'login'}, :if => Proc.new { !User.current.logged? }
|
2014-03-21 15:17:14 +08:00
|
|
|
menu.push :register, {:controller => 'account', :action => 'register'}, :if => Proc.new { !User.current.logged? && Setting.self_registration? }
|
2013-10-30 21:22:44 +08:00
|
|
|
# menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? }
|
2014-04-10 08:21:43 +08:00
|
|
|
menu.push :logout, {:controller => 'account', :action => 'logout'}, :html => {:method => 'post'}, :if => Proc.new { User.current.logged? }
|
2013-08-01 10:33:49 +08:00
|
|
|
end
|
|
|
|
########fq
|
|
|
|
Redmine::MenuManager.map :bid_menu do |menu|
|
|
|
|
menu.push :respond, { :controller => 'bids', :action => 'show' }, :caption => :label_user_response
|
2014-03-20 10:10:22 +08:00
|
|
|
menu.push :project, { :controller => 'bids', :action => 'show_project', :host => Setting.project_domain }, :caption => :label_bidding_project
|
2013-09-23 20:12:32 +08:00
|
|
|
# menu.push :result, { :controller => 'bids', :action => 'show_results' },
|
|
|
|
# :caption => :label_bidding_results,:if => Proc.new{ |p| User.current.id == p }
|
2013-08-01 10:33:49 +08:00
|
|
|
end
|
2014-04-03 17:26:56 +08:00
|
|
|
###new add by linchun
|
|
|
|
Redmine::MenuManager.map :contest_menu do |menu|
|
|
|
|
menu.push :respond, :show_contest_contest_path, :caption => :label_user_response
|
2014-05-10 08:30:35 +08:00
|
|
|
#menu.push :project, :show_project_contest_path, :caption => :label_contest_project
|
|
|
|
#menu.push :application, :show_softapplication_contest_path, :caption => :label_contest_application
|
2014-05-08 15:06:36 +08:00
|
|
|
menu.push :attendingcontest, {:controller => 'contests', :action => 'show_attendingcontest'}, :caption => :label_attending_contest
|
2014-05-30 09:28:13 +08:00
|
|
|
# menu.push :contestnotification, {:controller => 'contests', :action => 'show_notification'}, :caption => :label_contest_notification
|
2014-05-08 15:06:36 +08:00
|
|
|
# menu.push :attendingcontest, :show_attendingcontest_contest_path, :caption => :label_attendin,g_contest
|
2014-04-03 17:26:56 +08:00
|
|
|
# menu.push :result, { :controller => 'bids', :action => 'show_results' },
|
|
|
|
# :caption => :label_bidding_results,:if => Proc.new{ |p| User.current.id == p }
|
|
|
|
end
|
|
|
|
|
|
|
|
####
|
2013-08-01 10:33:49 +08:00
|
|
|
Redmine::MenuManager.map :application_menu do |menu|
|
|
|
|
# Empty
|
|
|
|
end
|
|
|
|
|
2013-09-13 10:11:36 +08:00
|
|
|
######
|
|
|
|
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
|
2013-08-01 10:33:49 +08:00
|
|
|
Redmine::MenuManager.map :admin_menu do |menu|
|
|
|
|
menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural
|
2014-05-23 11:50:36 +08:00
|
|
|
menu.push :users, {:controller => 'admin', :action => 'users'}, :caption => :label_user_plural
|
2013-08-01 10:33:49 +08:00
|
|
|
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
|
2013-12-17 11:26:11 +08:00
|
|
|
|
2013-08-01 10:33:49 +08:00
|
|
|
end
|
2013-08-30 09:34:21 +08:00
|
|
|
#Modified by young
|
2013-08-01 10:33:49 +08:00
|
|
|
Redmine::MenuManager.map :project_menu do |menu|
|
|
|
|
menu.push :overview, { :controller => 'projects', :action => 'show' }
|
|
|
|
# menu.push :activity, { :controller => 'activities', :action => 'index' }
|
2013-12-02 17:27:15 +08:00
|
|
|
#menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id
|
2013-08-01 10:33:49 +08:00
|
|
|
# :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? }
|
2013-11-21 08:59:58 +08:00
|
|
|
menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id,
|
|
|
|
:if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural
|
2013-12-02 17:27:15 +08:00
|
|
|
#menu.push :files, { :controller => 'files', :action => 'index' }, :param => :project_id, :caption => :label_file_new
|
2013-08-01 10:33:49 +08:00
|
|
|
menu.push :repository, { :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil },
|
2013-11-12 10:27:36 +08:00
|
|
|
:if => Proc.new { |p| p.repository && !p.repository.new_record? && !( !User.current.member_of?(p) && p.hidden_repo ) }
|
2013-08-01 10:33:49 +08:00
|
|
|
menu.push :settings, { :controller => 'projects', :action => 'settings' }, :last => true
|
2013-08-16 22:53:28 +08:00
|
|
|
|
2013-08-01 10:33:49 +08:00
|
|
|
end
|
2013-08-04 11:08:30 +08:00
|
|
|
#end
|
2013-08-30 09:34:21 +08:00
|
|
|
|
2013-08-01 10:33:49 +08:00
|
|
|
#added by young
|
2013-08-30 09:34:21 +08:00
|
|
|
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 }
|
2013-10-30 22:17:16 +08:00
|
|
|
# menu.push :settings, { :controller => 'projects', :action => 'settings', :course => 1 }, :last => true
|
2013-08-30 09:34:21 +08:00
|
|
|
|
|
|
|
end
|
2013-08-01 10:33:49 +08:00
|
|
|
Redmine::MenuManager.map :user_menu do |menu|
|
2014-03-21 20:25:41 +08:00
|
|
|
menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.user_domain }
|
2014-03-20 10:10:22 +08:00
|
|
|
menu.push :user_course, {:controller => 'users', :action => 'user_courses', :host => Setting.course_domain}
|
2013-10-31 15:18:42 +08:00
|
|
|
#menu.push :user_homework, {:controller => 'users', :action => 'user_homeworks'} by huang
|
2014-03-20 10:10:22 +08:00
|
|
|
menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.project_domain}
|
2013-10-31 15:18:42 +08:00
|
|
|
# menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids'} by huang
|
2014-03-21 20:25:41 +08:00
|
|
|
menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback', :host => Setting.user_domain}
|
2013-10-08 22:15:50 +08:00
|
|
|
|
|
|
|
end
|
|
|
|
Redmine::MenuManager.map :user_enterprise_menu do |menu|
|
2014-03-21 20:25:41 +08:00
|
|
|
menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.user_domain }
|
2013-10-08 22:15:50 +08:00
|
|
|
|
2014-03-20 10:10:22 +08:00
|
|
|
menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.project_domain}
|
2013-10-08 22:15:50 +08:00
|
|
|
|
2014-03-21 20:25:41 +08:00
|
|
|
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}
|
2013-08-10 20:34:32 +08:00
|
|
|
|
|
|
|
end
|
|
|
|
Redmine::MenuManager.map :user_menu_self do |menu|
|
2014-03-21 20:25:41 +08:00
|
|
|
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}
|
2013-08-06 22:26:52 +08:00
|
|
|
|
2013-08-01 10:33:49 +08:00
|
|
|
end
|
|
|
|
#end
|
|
|
|
|
|
|
|
Redmine::Activity.map do |activity|
|
|
|
|
activity.register :issues, :class_name => %w(Issue Journal)
|
|
|
|
activity.register :changesets
|
|
|
|
activity.register :news
|
|
|
|
activity.register :documents, :class_name => %w(Document Attachment)
|
|
|
|
activity.register :files, :class_name => 'Attachment'
|
2014-06-11 11:04:38 +08:00
|
|
|
activity.register :course_files, :class_name => 'Attachment'
|
2013-08-01 10:33:49 +08:00
|
|
|
activity.register :wiki_edits, :class_name => 'WikiContent::Version', :default => false
|
|
|
|
activity.register :messages, :default => false
|
|
|
|
activity.register :time_entries, :default => false
|
2013-08-05 22:47:01 +08:00
|
|
|
# added by fq
|
|
|
|
activity.register :bids, :class_name => 'Bid'
|
2013-12-04 15:31:18 +08:00
|
|
|
activity.register :memos, :class_name => 'Memo'
|
2014-03-13 22:06:49 +08:00
|
|
|
activity.register :journals_for_messages
|
2013-08-05 22:47:01 +08:00
|
|
|
# end
|
2014-06-10 11:49:28 +08:00
|
|
|
#added by nwb
|
2014-06-10 15:44:37 +08:00
|
|
|
#activity.register :course_journals_for_messages
|
2014-06-11 17:51:14 +08:00
|
|
|
activity.register :course_news, :class_name => 'News'
|
2013-08-01 10:33:49 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
Redmine::Search.map do |search|
|
|
|
|
search.register :issues
|
|
|
|
search.register :news
|
|
|
|
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
|