2011-10-29 16:19:11 +04:00
|
|
|
#-- encoding: UTF-8
|
2011-05-30 00:11:52 +04:00
|
|
|
#-- copyright
|
|
|
|
# ChiliProject is a project management system.
|
2011-05-30 22:52:25 +04:00
|
|
|
#
|
2012-01-03 23:36:40 +04:00
|
|
|
# Copyright (C) 2010-2012 the ChiliProject Team
|
2011-05-30 22:52:25 +04:00
|
|
|
#
|
2011-05-30 00:11:52 +04:00
|
|
|
# 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.
|
2011-05-30 22:52:25 +04:00
|
|
|
#
|
2011-05-30 00:11:52 +04:00
|
|
|
# See doc/COPYRIGHT.rdoc for more details.
|
|
|
|
#++
|
|
|
|
|
2007-08-29 20:52:35 +04:00
|
|
|
require 'redmine/access_control'
|
|
|
|
require 'redmine/menu_manager'
|
2008-07-27 21:54:09 +04:00
|
|
|
require 'redmine/activity'
|
2010-02-17 23:05:51 +03:00
|
|
|
require 'redmine/search'
|
2010-04-16 19:33:49 +04:00
|
|
|
require 'redmine/custom_field_format'
|
2007-05-08 19:49:20 +04:00
|
|
|
require 'redmine/mime_type'
|
2008-04-26 15:59:51 +04:00
|
|
|
require 'redmine/core_ext'
|
2007-10-10 21:17:37 +04:00
|
|
|
require 'redmine/themes'
|
2008-09-05 14:31:06 +04:00
|
|
|
require 'redmine/hook'
|
2007-09-23 21:19:27 +04:00
|
|
|
require 'redmine/plugin'
|
2010-09-29 00:19:55 +04:00
|
|
|
require 'redmine/notifiable'
|
2008-10-27 14:08:29 +03:00
|
|
|
require 'redmine/wiki_formatting'
|
2010-02-17 01:41:59 +03:00
|
|
|
require 'redmine/scm/base'
|
2007-06-13 00:12:05 +04:00
|
|
|
|
2007-08-26 11:55:57 +04:00
|
|
|
begin
|
2007-09-17 20:56:11 +04:00
|
|
|
require_library_or_gem 'RMagick' unless Object.const_defined?(:Magick)
|
2007-08-26 11:55:57 +04:00
|
|
|
rescue LoadError
|
|
|
|
# RMagick is not available
|
|
|
|
end
|
|
|
|
|
2009-11-04 16:22:26 +03:00
|
|
|
if RUBY_VERSION < '1.9'
|
|
|
|
require 'faster_csv'
|
|
|
|
else
|
|
|
|
require 'csv'
|
|
|
|
FCSV = CSV
|
|
|
|
end
|
|
|
|
|
2010-02-17 01:41:59 +03:00
|
|
|
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"
|
2007-08-29 20:52:35 +04:00
|
|
|
|
2010-04-16 19:33:49 +04:00
|
|
|
Redmine::CustomFieldFormat.map do |fields|
|
|
|
|
fields.register Redmine::CustomFieldFormat.new('string', :label => :label_string, :order => 1)
|
|
|
|
fields.register Redmine::CustomFieldFormat.new('text', :label => :label_text, :order => 2)
|
|
|
|
fields.register Redmine::CustomFieldFormat.new('int', :label => :label_integer, :order => 3)
|
|
|
|
fields.register Redmine::CustomFieldFormat.new('float', :label => :label_float, :order => 4)
|
|
|
|
fields.register Redmine::CustomFieldFormat.new('list', :label => :label_list, :order => 5)
|
|
|
|
fields.register Redmine::CustomFieldFormat.new('date', :label => :label_date, :order => 6)
|
|
|
|
fields.register Redmine::CustomFieldFormat.new('bool', :label => :label_boolean, :order => 7)
|
2011-04-01 17:44:58 +04:00
|
|
|
fields.register Redmine::CustomFieldFormat.new('user', :label => :label_user, :only => %w(Issue TimeEntry Version Project), :edit_as => 'list', :order => 8)
|
|
|
|
fields.register Redmine::CustomFieldFormat.new('version', :label => :label_version, :only => %w(Issue TimeEntry Version Project), :edit_as => 'list', :order => 9)
|
2010-04-16 19:33:49 +04:00
|
|
|
end
|
|
|
|
|
2007-08-29 20:52:35 +04:00
|
|
|
# Permissions
|
|
|
|
Redmine::AccessControl.map do |map|
|
2010-08-27 18:05:54 +04:00
|
|
|
map.permission :view_project, {:projects => [:show], :activities => [:index]}, :public => true
|
2007-08-29 20:52:35 +04:00
|
|
|
map.permission :search_project, {:search => :index}, :public => true
|
2010-09-07 19:00:27 +04:00
|
|
|
map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin
|
2010-09-08 20:01:51 +04:00
|
|
|
map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member
|
2007-09-14 15:34:08 +04:00
|
|
|
map.permission :select_project_modules, {:projects => :modules}, :require => :member
|
2009-09-12 12:36:46 +04:00
|
|
|
map.permission :manage_members, {:projects => :settings, :members => [:new, :edit, :destroy, :autocomplete_for_member]}, :require => :member
|
2010-09-16 22:27:33 +04:00
|
|
|
map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member
|
2010-09-07 19:00:27 +04:00
|
|
|
map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member
|
2011-05-30 22:52:25 +04:00
|
|
|
|
2007-09-14 15:34:08 +04:00
|
|
|
map.project_module :issue_tracking do |map|
|
|
|
|
# Issue categories
|
2010-03-06 21:43:00 +03:00
|
|
|
map.permission :manage_categories, {:projects => :settings, :issue_categories => [:new, :edit, :destroy]}, :require => :member
|
2007-09-14 15:34:08 +04:00
|
|
|
# Issues
|
2010-08-30 19:30:28 +04:00
|
|
|
map.permission :view_issues, {:issues => [:index, :show],
|
2010-08-17 19:03:58 +04:00
|
|
|
:auto_complete => [:issues],
|
2010-08-19 22:16:54 +04:00
|
|
|
:context_menus => [:issues],
|
2010-08-30 19:30:28 +04:00
|
|
|
:versions => [:index, :show, :status_by],
|
2011-02-27 16:34:41 +03:00
|
|
|
:journals => [:index, :diff],
|
2007-09-14 15:34:08 +04:00
|
|
|
:queries => :index,
|
2010-02-08 20:53:58 +03:00
|
|
|
:reports => [:issue_report, :issue_report_details]}
|
2010-04-22 19:43:57 +04:00
|
|
|
map.permission :add_issues, {:issues => [:new, :create, :update_form]}
|
2010-08-24 19:27:12 +04:00
|
|
|
map.permission :edit_issues, {:issues => [:edit, :update, :bulk_edit, :bulk_update, :update_form], :journals => [:new]}
|
2007-11-20 18:40:16 +03:00
|
|
|
map.permission :manage_issue_relations, {:issue_relations => [:new, :destroy]}
|
2010-03-13 17:56:49 +03:00
|
|
|
map.permission :manage_subtasks, {}
|
2010-08-16 20:25:04 +04:00
|
|
|
map.permission :add_issue_notes, {:issues => [:edit, :update], :journals => [:new]}
|
2008-02-16 16:19:33 +03:00
|
|
|
map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin
|
|
|
|
map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin
|
2010-08-11 18:42:10 +04:00
|
|
|
map.permission :move_issues, {:issue_moves => [:new, :create]}, :require => :loggedin
|
2007-09-14 15:34:08 +04:00
|
|
|
map.permission :delete_issues, {:issues => :destroy}, :require => :member
|
|
|
|
# Queries
|
2007-09-30 19:32:03 +04:00
|
|
|
map.permission :manage_public_queries, {:queries => [:new, :edit, :destroy]}, :require => :member
|
2007-09-14 15:34:08 +04:00
|
|
|
map.permission :save_queries, {:queries => [:new, :edit, :destroy]}, :require => :loggedin
|
2008-08-03 13:14:43 +04:00
|
|
|
# Watchers
|
|
|
|
map.permission :view_issue_watchers, {}
|
|
|
|
map.permission :add_issue_watchers, {:watchers => :new}
|
2009-10-25 15:11:53 +03:00
|
|
|
map.permission :delete_issue_watchers, {:watchers => :destroy}
|
2007-09-14 15:34:08 +04:00
|
|
|
end
|
2011-05-30 22:52:25 +04:00
|
|
|
|
2007-09-14 15:34:08 +04:00
|
|
|
map.project_module :time_tracking do |map|
|
2011-11-28 23:40:08 +04:00
|
|
|
map.permission :log_time, {:timelog => [:new, :create]}, :require => :loggedin
|
2010-12-04 13:13:15 +03:00
|
|
|
map.permission :view_time_entries, :timelog => [:index, :show], :time_entry_reports => [:report]
|
2011-11-28 23:44:05 +04:00
|
|
|
map.permission :edit_time_entries, {:timelog => [:edit, :update, :destroy]}, :require => :member
|
|
|
|
map.permission :edit_own_time_entries, {:timelog => [:edit, :update, :destroy]}, :require => :loggedin
|
2010-09-10 20:00:49 +04:00
|
|
|
map.permission :manage_project_activities, {:project_enumerations => [:update, :destroy]}, :require => :member
|
2007-09-14 15:34:08 +04:00
|
|
|
end
|
2011-05-30 22:52:25 +04:00
|
|
|
|
2007-09-14 15:34:08 +04:00
|
|
|
map.project_module :news do |map|
|
2010-09-23 19:20:19 +04:00
|
|
|
map.permission :manage_news, {:news => [:new, :create, :edit, :update, :destroy], :comments => [:destroy]}, :require => :member
|
2007-11-06 01:22:51 +03:00
|
|
|
map.permission :view_news, {:news => [:index, :show]}, :public => true
|
2010-09-22 20:25:09 +04:00
|
|
|
map.permission :comment_news, {:comments => :create}
|
2007-09-14 15:34:08 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
map.project_module :documents do |map|
|
2008-12-09 19:54:46 +03:00
|
|
|
map.permission :manage_documents, {:documents => [:new, :edit, :destroy, :add_attachment]}, :require => :loggedin
|
2007-12-18 21:50:41 +03:00
|
|
|
map.permission :view_documents, :documents => [:index, :show, :download]
|
2011-04-14 00:23:37 +04:00
|
|
|
map.permission :view_document_watchers, {}
|
|
|
|
map.permission :add_document_watchers, {:watchers => :new}
|
|
|
|
map.permission :delete_document_watchers, {:watchers => :destroy}
|
2007-09-14 15:34:08 +04:00
|
|
|
end
|
2011-05-30 22:52:25 +04:00
|
|
|
|
2007-09-14 15:34:08 +04:00
|
|
|
map.project_module :files do |map|
|
2010-09-14 00:35:03 +04:00
|
|
|
map.permission :manage_files, {:files => [:new, :create]}, :require => :loggedin
|
2010-08-31 19:12:58 +04:00
|
|
|
map.permission :view_files, :files => :index, :versions => :download
|
2007-09-14 15:34:08 +04:00
|
|
|
end
|
2011-05-30 22:52:25 +04:00
|
|
|
|
2007-09-14 15:34:08 +04:00
|
|
|
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}, :require => :member
|
2010-10-25 20:16:46 +04:00
|
|
|
map.permission :view_wiki_pages, :wiki => [:index, :show, :special, :date_index]
|
2010-10-13 21:13:50 +04:00
|
|
|
map.permission :export_wiki_pages, :wiki => [:export]
|
2008-09-13 20:45:01 +04:00
|
|
|
map.permission :view_wiki_edits, :wiki => [:history, :diff, :annotate]
|
2010-10-22 20:20:20 +04:00
|
|
|
map.permission :edit_wiki_pages, :wiki => [:edit, :update, :preview, :add_attachment]
|
2008-12-09 19:54:46 +03:00
|
|
|
map.permission :delete_wiki_pages_attachments, {}
|
2008-05-04 19:05:38 +04:00
|
|
|
map.permission :protect_wiki_pages, {:wiki => :protect}, :require => :member
|
2010-12-14 20:11:48 +03:00
|
|
|
map.permission :view_wiki_page_watchers, {}
|
|
|
|
map.permission :add_wiki_page_watchers, {:watchers => :new}
|
|
|
|
map.permission :delete_wiki_page_watchers, {:watchers => :destroy}
|
2007-09-14 15:34:08 +04:00
|
|
|
end
|
2011-05-30 22:52:25 +04:00
|
|
|
|
2007-09-14 15:34:08 +04:00
|
|
|
map.project_module :repository do |map|
|
2008-11-10 21:59:06 +03:00
|
|
|
map.permission :manage_repository, {:repositories => [:edit, :committers, :destroy]}, :require => :member
|
2007-12-02 23:58:02 +03:00
|
|
|
map.permission :browse_repository, :repositories => [:show, :browse, :entry, :annotate, :changes, :diff, :stats, :graph]
|
2007-09-14 15:34:08 +04:00
|
|
|
map.permission :view_changesets, :repositories => [:show, :revisions, :revision]
|
2008-09-13 20:31:11 +04:00
|
|
|
map.permission :commit_access, {}
|
2007-09-14 15:34:08 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
map.project_module :boards do |map|
|
|
|
|
map.permission :manage_boards, {:boards => [:new, :edit, :destroy]}, :require => :member
|
|
|
|
map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true
|
2008-08-28 22:56:47 +04:00
|
|
|
map.permission :add_messages, {:messages => [:new, :reply, :quote]}
|
2007-11-24 15:25:07 +03:00
|
|
|
map.permission :edit_messages, {:messages => :edit}, :require => :member
|
2008-11-11 18:07:55 +03:00
|
|
|
map.permission :edit_own_messages, {:messages => :edit}, :require => :loggedin
|
2007-11-24 15:25:07 +03:00
|
|
|
map.permission :delete_messages, {:messages => :destroy}, :require => :member
|
2008-11-11 18:07:55 +03:00
|
|
|
map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin
|
2010-12-14 22:45:43 +03:00
|
|
|
map.permission :view_board_watchers, {}
|
|
|
|
map.permission :add_board_watchers, {:watchers => :new}
|
|
|
|
map.permission :delete_board_watchers, {:watchers => :destroy}
|
|
|
|
|
|
|
|
map.permission :view_message_watchers, {}
|
|
|
|
map.permission :add_message_watchers, {:watchers => :new}
|
|
|
|
map.permission :delete_message_watchers, {:watchers => :destroy}
|
|
|
|
|
2007-09-14 15:34:08 +04:00
|
|
|
end
|
2010-08-22 22:42:00 +04:00
|
|
|
|
|
|
|
map.project_module :calendar do |map|
|
2010-08-26 20:36:59 +04:00
|
|
|
map.permission :view_calendar, :calendars => [:show, :update]
|
2010-08-22 22:42:00 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
map.project_module :gantt do |map|
|
2010-08-26 20:36:59 +04:00
|
|
|
map.permission :view_gantt, :gantts => [:show, :update]
|
2010-08-22 22:42:00 +04:00
|
|
|
end
|
2007-08-29 20:52:35 +04:00
|
|
|
end
|
|
|
|
|
2008-02-12 20:58:46 +03:00
|
|
|
Redmine::MenuManager.map :top_menu do |menu|
|
2008-11-27 21:04:48 +03:00
|
|
|
menu.push :home, :home_path
|
|
|
|
menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? }
|
|
|
|
menu.push :projects, { :controller => 'projects', :action => 'index' }, :caption => :label_project_plural
|
|
|
|
menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new { User.current.admin? }, :last => true
|
2011-09-29 13:16:00 +04:00
|
|
|
menu.push :help, Redmine::Info.help_url, :last => true, :caption => "?"
|
2008-02-12 20:58:46 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
Redmine::MenuManager.map :account_menu do |menu|
|
2008-11-27 21:04:48 +03:00
|
|
|
menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? }
|
|
|
|
menu.push :logout, :signout_path, :if => Proc.new { User.current.logged? }
|
2008-02-12 20:58:46 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
Redmine::MenuManager.map :application_menu do |menu|
|
|
|
|
# Empty
|
|
|
|
end
|
|
|
|
|
2008-11-11 21:10:21 +03:00
|
|
|
Redmine::MenuManager.map :admin_menu do |menu|
|
2010-08-04 04:38:22 +04:00
|
|
|
menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural
|
|
|
|
menu.push :users, {:controller => 'users'}, :caption => :label_user_plural
|
|
|
|
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 => 'ldap_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
|
2008-11-11 21:10:21 +03:00
|
|
|
end
|
|
|
|
|
2007-08-29 20:52:35 +04:00
|
|
|
Redmine::MenuManager.map :project_menu do |menu|
|
2012-02-17 22:16:04 +04:00
|
|
|
include ProjectsHelper
|
|
|
|
|
|
|
|
# TODO: refactor to a helper that is available before app/helpers along with the other procs.
|
|
|
|
issue_query_proc = Proc.new { |p|
|
|
|
|
##### Taken from IssuesHelper
|
|
|
|
# User can see public queries and his own queries
|
|
|
|
visible = ARCondition.new(["is_public = ? OR user_id = ?", true, (User.current.logged? ? User.current.id : 0)])
|
|
|
|
# Project specific queries and global queries
|
|
|
|
visible << (p.nil? ? ["project_id IS NULL"] : ["project_id IS NULL OR project_id = ?", p.id])
|
|
|
|
sidebar_queries = Query.find(:all,
|
|
|
|
:select => 'id, name',
|
|
|
|
:order => "name ASC",
|
|
|
|
:conditions => visible.conditions)
|
|
|
|
|
|
|
|
sidebar_queries.collect do |query|
|
|
|
|
Redmine::MenuManager::MenuItem.new("query-#{query.id}".to_sym, { :controller => 'issues', :action => 'index', :project_id => p, :query_id => query }, {
|
|
|
|
:caption => query.name,
|
|
|
|
:param => :project_id,
|
|
|
|
:parent => :issues
|
|
|
|
})
|
|
|
|
end
|
|
|
|
}
|
|
|
|
|
|
|
|
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? },
|
|
|
|
:children => Proc.new { |p|
|
|
|
|
versions = p.shared_versions.sort
|
|
|
|
versions.reject! {|version| version.closed? || version.completed? }
|
|
|
|
|
|
|
|
versions.collect do |version|
|
|
|
|
Redmine::MenuManager::MenuItem.new("version-#{version.id}".to_sym,
|
|
|
|
{ :controller => 'versions', :action => 'show', :id => version },
|
|
|
|
{
|
|
|
|
:caption => version.name,
|
|
|
|
:parent => :roadmap
|
|
|
|
})
|
|
|
|
end
|
|
|
|
}
|
|
|
|
})
|
|
|
|
menu.push(:issues, { :controller => 'issues', :action => 'index' }, {
|
|
|
|
:param => :project_id,
|
|
|
|
:caption => :label_issue_plural,
|
|
|
|
:children => issue_query_proc
|
|
|
|
})
|
|
|
|
menu.push(:new_issue, { :controller => 'issues', :action => 'new' }, {
|
|
|
|
:param => :project_id,
|
|
|
|
:caption => :label_issue_new,
|
|
|
|
:parent => :issues,
|
2008-01-20 16:07:19 +03:00
|
|
|
:html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) }
|
2012-02-17 22:16:04 +04:00
|
|
|
})
|
|
|
|
menu.push(:all_open_issues, { :controller => 'issues', :action => 'index', :set_filter => 1 }, {
|
|
|
|
:param => :project_id,
|
|
|
|
:caption => :field_issue_view_all_open,
|
|
|
|
:parent => :issues
|
|
|
|
})
|
|
|
|
menu.push(:new_query, { :controller => 'queries', :action => 'new'}, {
|
|
|
|
:param => :project_id,
|
|
|
|
:caption => :field_new_saved_query,
|
|
|
|
:parent => :issues
|
|
|
|
})
|
|
|
|
menu.push(:issue_summary, { :controller => 'reports', :action => 'issue_report' }, {
|
|
|
|
:caption => :field_issue_summary,
|
|
|
|
:parent => :issues
|
|
|
|
})
|
|
|
|
menu.push(:time_entries, { :controller => 'timelog', :action => 'index' }, {
|
|
|
|
:param => :project_id,
|
|
|
|
:if => Proc.new {|p| User.current.allowed_to?(:view_time_entries, p) }
|
|
|
|
});
|
|
|
|
menu.push(:new_time_entry, { :controller => 'timelog', :action => 'new' }, {
|
|
|
|
:param => :project_id,
|
|
|
|
:if => Proc.new {|p| User.current.allowed_to?(:log_time, p) },
|
|
|
|
:parent => :time_entries
|
|
|
|
})
|
|
|
|
menu.push(:time_entry_report, { :controller => 'time_entry_reports', :action => 'report' }, {
|
|
|
|
:param => :project_id,
|
|
|
|
:if => Proc.new {|p| User.current.allowed_to?(:view_time_entries, p) },
|
|
|
|
:parent => :time_entries
|
|
|
|
})
|
|
|
|
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(:new_news, {:controller => 'news', :action => 'new' }, {
|
|
|
|
:param => :project_id,
|
|
|
|
:caption => :label_news_new,
|
|
|
|
:parent => :news,
|
|
|
|
:if => Proc.new {|p| User.current.allowed_to?(:manage_news, p) }
|
|
|
|
})
|
|
|
|
menu.push(:documents, { :controller => 'documents', :action => 'index' }, {
|
|
|
|
:param => :project_id,
|
|
|
|
:caption => :label_document_plural
|
|
|
|
})
|
|
|
|
menu.push(:new_document, { :controller => 'documents', :action => 'new' }, {
|
|
|
|
:param => :project_id,
|
|
|
|
:caption => :label_document_new,
|
|
|
|
:parent => :documents,
|
|
|
|
:if => Proc.new {|p| User.current.allowed_to?(:manage_documents, p) }
|
|
|
|
})
|
|
|
|
menu.push(:wiki, { :controller => 'wiki', :action => 'show', :id => nil }, {
|
|
|
|
:param => :project_id,
|
|
|
|
:if => Proc.new { |p| p.wiki && !p.wiki.new_record? }
|
|
|
|
})
|
|
|
|
menu.push(:wiki_by_title, { :controller => 'wiki', :action => 'index' }, {
|
|
|
|
:caption => :label_index_by_title,
|
|
|
|
:parent => :wiki,
|
|
|
|
:param => :project_id,
|
|
|
|
:if => Proc.new { |p| p.wiki && !p.wiki.new_record? }
|
|
|
|
})
|
|
|
|
menu.push(:wiki_by_date, { :controller => 'wiki', :action => 'date_index'}, {
|
|
|
|
:caption => :label_index_by_date,
|
|
|
|
:parent => :wiki,
|
|
|
|
:param => :project_id,
|
2008-02-12 20:58:46 +03:00
|
|
|
:if => Proc.new { |p| p.wiki && !p.wiki.new_record? }
|
2012-02-17 22:16:04 +04:00
|
|
|
})
|
|
|
|
menu.push(:boards, { :controller => 'boards', :action => 'index', :id => nil }, {
|
|
|
|
:param => :project_id,
|
|
|
|
:caption => :label_board_plural,
|
|
|
|
:if => Proc.new { |p| p.boards.any? },
|
|
|
|
:children => Proc.new {|project|
|
|
|
|
project.boards.collect do |board|
|
|
|
|
Redmine::MenuManager::MenuItem.new(
|
|
|
|
"board-#{board.id}".to_sym,
|
|
|
|
{ :controller => 'boards', :action => 'show', :id => board },
|
|
|
|
{
|
|
|
|
:caption => board.name # is h() in menu_helper.rb
|
|
|
|
})
|
|
|
|
end
|
|
|
|
}
|
|
|
|
})
|
|
|
|
menu.push(:new_board, { :controller => 'boards', :action => 'new' }, {
|
|
|
|
:caption => :label_board_new,
|
|
|
|
:param => :project_id,
|
|
|
|
:parent => :boards,
|
|
|
|
:if => Proc.new {|p| User.current.allowed_to?(:manage_boards, p) }
|
|
|
|
})
|
|
|
|
menu.push(:files, { :controller => 'files', :action => 'index' }, {
|
|
|
|
:caption => :label_file_plural,
|
|
|
|
:param => :project_id
|
|
|
|
})
|
|
|
|
menu.push(:new_file, { :controller => 'files', :action => 'new' }, {
|
|
|
|
:caption => :label_attachment_new,
|
|
|
|
:param => :project_id,
|
|
|
|
:parent => :files,
|
|
|
|
:if => Proc.new {|p| User.current.allowed_to?(:manage_files, p) }
|
|
|
|
})
|
|
|
|
menu.push(:repository, { :controller => 'repositories', :action => 'show' }, {
|
2008-02-12 20:58:46 +03:00
|
|
|
:if => Proc.new { |p| p.repository && !p.repository.new_record? }
|
2012-02-17 22:16:04 +04:00
|
|
|
})
|
|
|
|
menu.push(:settings, { :controller => 'projects', :action => 'settings' }, {
|
|
|
|
:last => true,
|
|
|
|
:children => Proc.new { |p|
|
|
|
|
@project = p # @project used in the helper
|
|
|
|
project_settings_tabs.collect do |tab|
|
|
|
|
Redmine::MenuManager::MenuItem.new("settings-#{tab[:name]}".to_sym,
|
|
|
|
{ :controller => 'projects', :action => 'settings', :id => p, :tab => tab[:name] },
|
|
|
|
{
|
|
|
|
:caption => tab[:label]
|
|
|
|
})
|
|
|
|
end
|
|
|
|
}
|
|
|
|
})
|
2007-08-29 20:52:35 +04:00
|
|
|
end
|
2008-07-27 21:54:09 +04:00
|
|
|
|
|
|
|
Redmine::Activity.map do |activity|
|
2010-07-15 23:10:05 +04:00
|
|
|
activity.register :issues, :class_name => 'Issue'
|
2008-07-27 21:54:09 +04:00
|
|
|
activity.register :changesets
|
|
|
|
activity.register :news
|
|
|
|
activity.register :documents, :class_name => %w(Document Attachment)
|
|
|
|
activity.register :files, :class_name => 'Attachment'
|
2010-08-04 20:58:31 +04:00
|
|
|
activity.register :wiki_edits, :class_name => 'WikiContent', :default => false
|
2008-07-27 21:54:09 +04:00
|
|
|
activity.register :messages, :default => false
|
2009-09-12 14:37:49 +04:00
|
|
|
activity.register :time_entries, :default => false
|
2008-07-27 21:54:09 +04:00
|
|
|
end
|
2008-10-27 14:08:29 +03:00
|
|
|
|
2010-02-17 23:05:51 +03:00
|
|
|
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
|
|
|
|
|
2008-10-27 14:08:29 +03:00
|
|
|
Redmine::WikiFormatting.map do |format|
|
|
|
|
format.register :textile, Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting::Textile::Helper
|
|
|
|
end
|
2010-12-03 14:25:21 +03:00
|
|
|
|
2010-12-04 20:43:39 +03:00
|
|
|
ActionView::Template.register_template_handler :rsb, Redmine::Views::ApiTemplateHandler
|