Mercurial > hg > soundsoftware-site
comparison .svn/pristine/2c/2cfeab9b9366f48fd720b77fb1dc5f6f878ef869.svn-base @ 1295:622f24f53b42 redmine-2.3
Update to Redmine SVN revision 11972 on 2.3-stable branch
author | Chris Cannam |
---|---|
date | Fri, 14 Jun 2013 09:02:21 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1294:3e4c3460b6ca | 1295:622f24f53b42 |
---|---|
1 # Redmine - project management software | |
2 # Copyright (C) 2006-2013 Jean-Philippe Lang | |
3 # | |
4 # This program is free software; you can redistribute it and/or | |
5 # modify it under the terms of the GNU General Public License | |
6 # as published by the Free Software Foundation; either version 2 | |
7 # of the License, or (at your option) any later version. | |
8 # | |
9 # This program is distributed in the hope that it will be useful, | |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 # GNU General Public License for more details. | |
13 # | |
14 # You should have received a copy of the GNU General Public License | |
15 # along with this program; if not, write to the Free Software | |
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 | |
18 require 'redmine/core_ext' | |
19 | |
20 begin | |
21 require 'RMagick' unless Object.const_defined?(:Magick) | |
22 rescue LoadError | |
23 # RMagick is not available | |
24 end | |
25 | |
26 require 'redmine/scm/base' | |
27 require 'redmine/access_control' | |
28 require 'redmine/access_keys' | |
29 require 'redmine/activity' | |
30 require 'redmine/activity/fetcher' | |
31 require 'redmine/ciphering' | |
32 require 'redmine/codeset_util' | |
33 require 'redmine/custom_field_format' | |
34 require 'redmine/i18n' | |
35 require 'redmine/menu_manager' | |
36 require 'redmine/notifiable' | |
37 require 'redmine/platform' | |
38 require 'redmine/mime_type' | |
39 require 'redmine/notifiable' | |
40 require 'redmine/search' | |
41 require 'redmine/syntax_highlighting' | |
42 require 'redmine/thumbnail' | |
43 require 'redmine/unified_diff' | |
44 require 'redmine/utils' | |
45 require 'redmine/version' | |
46 require 'redmine/wiki_formatting' | |
47 | |
48 require 'redmine/default_data/loader' | |
49 require 'redmine/helpers/calendar' | |
50 require 'redmine/helpers/diff' | |
51 require 'redmine/helpers/gantt' | |
52 require 'redmine/helpers/time_report' | |
53 require 'redmine/views/other_formats_builder' | |
54 require 'redmine/views/labelled_form_builder' | |
55 require 'redmine/views/builders' | |
56 | |
57 require 'redmine/themes' | |
58 require 'redmine/hook' | |
59 require 'redmine/plugin' | |
60 | |
61 if RUBY_VERSION < '1.9' | |
62 require 'fastercsv' | |
63 else | |
64 require 'csv' | |
65 FCSV = CSV | |
66 end | |
67 | |
68 Redmine::Scm::Base.add "Subversion" | |
69 Redmine::Scm::Base.add "Darcs" | |
70 Redmine::Scm::Base.add "Mercurial" | |
71 Redmine::Scm::Base.add "Cvs" | |
72 Redmine::Scm::Base.add "Bazaar" | |
73 Redmine::Scm::Base.add "Git" | |
74 Redmine::Scm::Base.add "Filesystem" | |
75 | |
76 Redmine::CustomFieldFormat.map do |fields| | |
77 fields.register 'string' | |
78 fields.register 'text' | |
79 fields.register 'int', :label => :label_integer | |
80 fields.register 'float' | |
81 fields.register 'list' | |
82 fields.register 'date' | |
83 fields.register 'bool', :label => :label_boolean | |
84 fields.register 'user', :only => %w(Issue TimeEntry Version Project), :edit_as => 'list' | |
85 fields.register 'version', :only => %w(Issue TimeEntry Version Project), :edit_as => 'list' | |
86 end | |
87 | |
88 # Permissions | |
89 Redmine::AccessControl.map do |map| | |
90 map.permission :view_project, {:projects => [:show], :activities => [:index]}, :public => true, :read => true | |
91 map.permission :search_project, {:search => :index}, :public => true, :read => true | |
92 map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin | |
93 map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member | |
94 map.permission :close_project, {:projects => [:close, :reopen]}, :require => :member, :read => true | |
95 map.permission :select_project_modules, {:projects => :modules}, :require => :member | |
96 map.permission :manage_members, {:projects => :settings, :members => [:index, :show, :create, :update, :destroy, :autocomplete]}, :require => :member | |
97 map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member | |
98 map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member | |
99 | |
100 map.project_module :issue_tracking do |map| | |
101 # Issue categories | |
102 map.permission :manage_categories, {:projects => :settings, :issue_categories => [:index, :show, :new, :create, :edit, :update, :destroy]}, :require => :member | |
103 # Issues | |
104 map.permission :view_issues, {:issues => [:index, :show], | |
105 :auto_complete => [:issues], | |
106 :context_menus => [:issues], | |
107 :versions => [:index, :show, :status_by], | |
108 :journals => [:index, :diff], | |
109 :queries => :index, | |
110 :reports => [:issue_report, :issue_report_details]}, | |
111 :read => true | |
112 map.permission :add_issues, {:issues => [:new, :create, :update_form], :attachments => :upload} | |
113 map.permission :edit_issues, {:issues => [:edit, :update, :bulk_edit, :bulk_update, :update_form], :journals => [:new], :attachments => :upload} | |
114 map.permission :manage_issue_relations, {:issue_relations => [:index, :show, :create, :destroy]} | |
115 map.permission :manage_subtasks, {} | |
116 map.permission :set_issues_private, {} | |
117 map.permission :set_own_issues_private, {}, :require => :loggedin | |
118 map.permission :add_issue_notes, {:issues => [:edit, :update, :update_form], :journals => [:new], :attachments => :upload} | |
119 map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin | |
120 map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin | |
121 map.permission :view_private_notes, {}, :read => true, :require => :member | |
122 map.permission :set_notes_private, {}, :require => :member | |
123 map.permission :move_issues, {:issues => [:bulk_edit, :bulk_update]}, :require => :loggedin | |
124 map.permission :delete_issues, {:issues => :destroy}, :require => :member | |
125 # Queries | |
126 map.permission :manage_public_queries, {:queries => [:new, :create, :edit, :update, :destroy]}, :require => :member | |
127 map.permission :save_queries, {:queries => [:new, :create, :edit, :update, :destroy]}, :require => :loggedin | |
128 # Watchers | |
129 map.permission :view_issue_watchers, {}, :read => true | |
130 map.permission :add_issue_watchers, {:watchers => [:new, :create, :append, :autocomplete_for_user]} | |
131 map.permission :delete_issue_watchers, {:watchers => :destroy} | |
132 end | |
133 | |
134 map.project_module :time_tracking do |map| | |
135 map.permission :log_time, {:timelog => [:new, :create]}, :require => :loggedin | |
136 map.permission :view_time_entries, {:timelog => [:index, :report, :show]}, :read => true | |
137 map.permission :edit_time_entries, {:timelog => [:edit, :update, :destroy, :bulk_edit, :bulk_update]}, :require => :member | |
138 map.permission :edit_own_time_entries, {:timelog => [:edit, :update, :destroy,:bulk_edit, :bulk_update]}, :require => :loggedin | |
139 map.permission :manage_project_activities, {:project_enumerations => [:update, :destroy]}, :require => :member | |
140 end | |
141 | |
142 map.project_module :news do |map| | |
143 map.permission :manage_news, {:news => [:new, :create, :edit, :update, :destroy], :comments => [:destroy]}, :require => :member | |
144 map.permission :view_news, {:news => [:index, :show]}, :public => true, :read => true | |
145 map.permission :comment_news, {:comments => :create} | |
146 end | |
147 | |
148 map.project_module :documents do |map| | |
149 map.permission :add_documents, {:documents => [:new, :create, :add_attachment]}, :require => :loggedin | |
150 map.permission :edit_documents, {:documents => [:edit, :update, :add_attachment]}, :require => :loggedin | |
151 map.permission :delete_documents, {:documents => [:destroy]}, :require => :loggedin | |
152 map.permission :view_documents, {:documents => [:index, :show, :download]}, :read => true | |
153 end | |
154 | |
155 map.project_module :files do |map| | |
156 map.permission :manage_files, {:files => [:new, :create]}, :require => :loggedin | |
157 map.permission :view_files, {:files => :index, :versions => :download}, :read => true | |
158 end | |
159 | |
160 map.project_module :wiki do |map| | |
161 map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member | |
162 map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member | |
163 map.permission :delete_wiki_pages, {:wiki => [:destroy, :destroy_version]}, :require => :member | |
164 map.permission :view_wiki_pages, {:wiki => [:index, :show, :special, :date_index]}, :read => true | |
165 map.permission :export_wiki_pages, {:wiki => [:export]}, :read => true | |
166 map.permission :view_wiki_edits, {:wiki => [:history, :diff, :annotate]}, :read => true | |
167 map.permission :edit_wiki_pages, :wiki => [:edit, :update, :preview, :add_attachment] | |
168 map.permission :delete_wiki_pages_attachments, {} | |
169 map.permission :protect_wiki_pages, {:wiki => :protect}, :require => :member | |
170 end | |
171 | |
172 map.project_module :repository do |map| | |
173 map.permission :manage_repository, {:repositories => [:new, :create, :edit, :update, :committers, :destroy]}, :require => :member | |
174 map.permission :browse_repository, {:repositories => [:show, :browse, :entry, :raw, :annotate, :changes, :diff, :stats, :graph]}, :read => true | |
175 map.permission :view_changesets, {:repositories => [:show, :revisions, :revision]}, :read => true | |
176 map.permission :commit_access, {} | |
177 map.permission :manage_related_issues, {:repositories => [:add_related_issue, :remove_related_issue]} | |
178 end | |
179 | |
180 map.project_module :boards do |map| | |
181 map.permission :manage_boards, {:boards => [:new, :create, :edit, :update, :destroy]}, :require => :member | |
182 map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true, :read => true | |
183 map.permission :add_messages, {:messages => [:new, :reply, :quote]} | |
184 map.permission :edit_messages, {:messages => :edit}, :require => :member | |
185 map.permission :edit_own_messages, {:messages => :edit}, :require => :loggedin | |
186 map.permission :delete_messages, {:messages => :destroy}, :require => :member | |
187 map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin | |
188 end | |
189 | |
190 map.project_module :calendar do |map| | |
191 map.permission :view_calendar, {:calendars => [:show, :update]}, :read => true | |
192 end | |
193 | |
194 map.project_module :gantt do |map| | |
195 map.permission :view_gantt, {:gantts => [:show, :update]}, :read => true | |
196 end | |
197 end | |
198 | |
199 Redmine::MenuManager.map :top_menu do |menu| | |
200 menu.push :home, :home_path | |
201 menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? } | |
202 menu.push :projects, { :controller => 'projects', :action => 'index' }, :caption => :label_project_plural | |
203 menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new { User.current.admin? }, :last => true | |
204 menu.push :help, Redmine::Info.help_url, :last => true | |
205 end | |
206 | |
207 Redmine::MenuManager.map :account_menu do |menu| | |
208 menu.push :login, :signin_path, :if => Proc.new { !User.current.logged? } | |
209 menu.push :register, :register_path, :if => Proc.new { !User.current.logged? && Setting.self_registration? } | |
210 menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? } | |
211 menu.push :logout, :signout_path, :html => {:method => 'post'}, :if => Proc.new { User.current.logged? } | |
212 end | |
213 | |
214 Redmine::MenuManager.map :application_menu do |menu| | |
215 # Empty | |
216 end | |
217 | |
218 Redmine::MenuManager.map :admin_menu do |menu| | |
219 menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural | |
220 menu.push :users, {:controller => 'users'}, :caption => :label_user_plural | |
221 menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural | |
222 menu.push :roles, {:controller => 'roles'}, :caption => :label_role_and_permissions | |
223 menu.push :trackers, {:controller => 'trackers'}, :caption => :label_tracker_plural | |
224 menu.push :issue_statuses, {:controller => 'issue_statuses'}, :caption => :label_issue_status_plural, | |
225 :html => {:class => 'issue_statuses'} | |
226 menu.push :workflows, {:controller => 'workflows', :action => 'edit'}, :caption => :label_workflow | |
227 menu.push :custom_fields, {:controller => 'custom_fields'}, :caption => :label_custom_field_plural, | |
228 :html => {:class => 'custom_fields'} | |
229 menu.push :enumerations, {:controller => 'enumerations'} | |
230 menu.push :settings, {:controller => 'settings'} | |
231 menu.push :ldap_authentication, {:controller => 'auth_sources', :action => 'index'}, | |
232 :html => {:class => 'server_authentication'} | |
233 menu.push :plugins, {:controller => 'admin', :action => 'plugins'}, :last => true | |
234 menu.push :info, {:controller => 'admin', :action => 'info'}, :caption => :label_information_plural, :last => true | |
235 end | |
236 | |
237 Redmine::MenuManager.map :project_menu do |menu| | |
238 menu.push :overview, { :controller => 'projects', :action => 'show' } | |
239 menu.push :activity, { :controller => 'activities', :action => 'index' } | |
240 menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id, | |
241 :if => Proc.new { |p| p.shared_versions.any? } | |
242 menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural | |
243 menu.push :new_issue, { :controller => 'issues', :action => 'new', :copy_from => nil }, :param => :project_id, :caption => :label_issue_new, | |
244 :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) } | |
245 menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :param => :project_id, :caption => :label_gantt | |
246 menu.push :calendar, { :controller => 'calendars', :action => 'show' }, :param => :project_id, :caption => :label_calendar | |
247 menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural | |
248 menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural | |
249 menu.push :wiki, { :controller => 'wiki', :action => 'show', :id => nil }, :param => :project_id, | |
250 :if => Proc.new { |p| p.wiki && !p.wiki.new_record? } | |
251 menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id, | |
252 :if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural | |
253 menu.push :files, { :controller => 'files', :action => 'index' }, :caption => :label_file_plural, :param => :project_id | |
254 menu.push :repository, { :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil }, | |
255 :if => Proc.new { |p| p.repository && !p.repository.new_record? } | |
256 menu.push :settings, { :controller => 'projects', :action => 'settings' }, :last => true | |
257 end | |
258 | |
259 Redmine::Activity.map do |activity| | |
260 activity.register :issues, :class_name => %w(Issue Journal) | |
261 activity.register :changesets | |
262 activity.register :news | |
263 activity.register :documents, :class_name => %w(Document Attachment) | |
264 activity.register :files, :class_name => 'Attachment' | |
265 activity.register :wiki_edits, :class_name => 'WikiContent::Version', :default => false | |
266 activity.register :messages, :default => false | |
267 activity.register :time_entries, :default => false | |
268 end | |
269 | |
270 Redmine::Search.map do |search| | |
271 search.register :issues | |
272 search.register :news | |
273 search.register :documents | |
274 search.register :changesets | |
275 search.register :wiki_pages | |
276 search.register :messages | |
277 search.register :projects | |
278 end | |
279 | |
280 Redmine::WikiFormatting.map do |format| | |
281 format.register :textile, Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting::Textile::Helper | |
282 end | |
283 | |
284 ActionView::Template.register_template_handler :rsb, Redmine::Views::ApiTemplateHandler |