Mercurial > hg > soundsoftware-site
comparison .svn/pristine/c0/c028c844ca73ac2cbbfd17a9e4485d06e5ba8f7e.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 require 'redmine/access_control' | |
2 require 'redmine/menu_manager' | |
3 require 'redmine/activity' | |
4 require 'redmine/search' | |
5 require 'redmine/custom_field_format' | |
6 require 'redmine/mime_type' | |
7 require 'redmine/core_ext' | |
8 require 'redmine/themes' | |
9 require 'redmine/hook' | |
10 require 'redmine/plugin' | |
11 require 'redmine/notifiable' | |
12 require 'redmine/wiki_formatting' | |
13 require 'redmine/scm/base' | |
14 | |
15 begin | |
16 require 'RMagick' unless Object.const_defined?(:Magick) | |
17 rescue LoadError | |
18 # RMagick is not available | |
19 end | |
20 | |
21 if RUBY_VERSION < '1.9' | |
22 require 'fastercsv' | |
23 else | |
24 require 'csv' | |
25 FCSV = CSV | |
26 end | |
27 | |
28 Redmine::Scm::Base.add "Subversion" | |
29 Redmine::Scm::Base.add "Darcs" | |
30 Redmine::Scm::Base.add "Mercurial" | |
31 Redmine::Scm::Base.add "Cvs" | |
32 Redmine::Scm::Base.add "Bazaar" | |
33 Redmine::Scm::Base.add "Git" | |
34 Redmine::Scm::Base.add "Filesystem" | |
35 | |
36 Redmine::CustomFieldFormat.map do |fields| | |
37 fields.register 'string' | |
38 fields.register 'text' | |
39 fields.register 'int', :label => :label_integer | |
40 fields.register 'float' | |
41 fields.register 'list' | |
42 fields.register 'date' | |
43 fields.register 'bool', :label => :label_boolean | |
44 fields.register 'user', :only => %w(Issue TimeEntry Version Project), :edit_as => 'list' | |
45 fields.register 'version', :only => %w(Issue TimeEntry Version Project), :edit_as => 'list' | |
46 end | |
47 | |
48 # Permissions | |
49 Redmine::AccessControl.map do |map| | |
50 map.permission :view_project, {:projects => [:show], :activities => [:index]}, :public => true, :read => true | |
51 map.permission :search_project, {:search => :index}, :public => true, :read => true | |
52 map.permission :add_project, {:projects => [:new, :create]}, :require => :loggedin | |
53 map.permission :edit_project, {:projects => [:settings, :edit, :update]}, :require => :member | |
54 map.permission :close_project, {:projects => [:close, :reopen]}, :require => :member, :read => true | |
55 map.permission :select_project_modules, {:projects => :modules}, :require => :member | |
56 map.permission :manage_members, {:projects => :settings, :members => [:index, :show, :create, :update, :destroy, :autocomplete]}, :require => :member | |
57 map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member | |
58 map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member | |
59 | |
60 map.project_module :issue_tracking do |map| | |
61 # Issue categories | |
62 map.permission :manage_categories, {:projects => :settings, :issue_categories => [:index, :show, :new, :create, :edit, :update, :destroy]}, :require => :member | |
63 # Issues | |
64 map.permission :view_issues, {:issues => [:index, :show], | |
65 :auto_complete => [:issues], | |
66 :context_menus => [:issues], | |
67 :versions => [:index, :show, :status_by], | |
68 :journals => [:index, :diff], | |
69 :queries => :index, | |
70 :reports => [:issue_report, :issue_report_details]}, | |
71 :read => true | |
72 map.permission :add_issues, {:issues => [:new, :create, :update_form], :attachments => :upload} | |
73 map.permission :edit_issues, {:issues => [:edit, :update, :bulk_edit, :bulk_update, :update_form], :journals => [:new], :attachments => :upload} | |
74 map.permission :manage_issue_relations, {:issue_relations => [:index, :show, :create, :destroy]} | |
75 map.permission :manage_subtasks, {} | |
76 map.permission :set_issues_private, {} | |
77 map.permission :set_own_issues_private, {}, :require => :loggedin | |
78 map.permission :add_issue_notes, {:issues => [:edit, :update], :journals => [:new], :attachments => :upload} | |
79 map.permission :edit_issue_notes, {:journals => :edit}, :require => :loggedin | |
80 map.permission :edit_own_issue_notes, {:journals => :edit}, :require => :loggedin | |
81 map.permission :view_private_notes, {}, :read => true, :require => :member | |
82 map.permission :set_notes_private, {}, :require => :member | |
83 map.permission :move_issues, {:issues => [:bulk_edit, :bulk_update]}, :require => :loggedin | |
84 map.permission :delete_issues, {:issues => :destroy}, :require => :member | |
85 # Queries | |
86 map.permission :manage_public_queries, {:queries => [:new, :create, :edit, :update, :destroy]}, :require => :member | |
87 map.permission :save_queries, {:queries => [:new, :create, :edit, :update, :destroy]}, :require => :loggedin | |
88 # Watchers | |
89 map.permission :view_issue_watchers, {}, :read => true | |
90 map.permission :add_issue_watchers, {:watchers => :new} | |
91 map.permission :delete_issue_watchers, {:watchers => :destroy} | |
92 end | |
93 | |
94 map.project_module :time_tracking do |map| | |
95 map.permission :log_time, {:timelog => [:new, :create]}, :require => :loggedin | |
96 map.permission :view_time_entries, {:timelog => [:index, :report, :show]}, :read => true | |
97 map.permission :edit_time_entries, {:timelog => [:edit, :update, :destroy, :bulk_edit, :bulk_update]}, :require => :member | |
98 map.permission :edit_own_time_entries, {:timelog => [:edit, :update, :destroy,:bulk_edit, :bulk_update]}, :require => :loggedin | |
99 map.permission :manage_project_activities, {:project_enumerations => [:update, :destroy]}, :require => :member | |
100 end | |
101 | |
102 map.project_module :news do |map| | |
103 map.permission :manage_news, {:news => [:new, :create, :edit, :update, :destroy], :comments => [:destroy]}, :require => :member | |
104 map.permission :view_news, {:news => [:index, :show]}, :public => true, :read => true | |
105 map.permission :comment_news, {:comments => :create} | |
106 end | |
107 | |
108 map.project_module :documents do |map| | |
109 map.permission :manage_documents, {:documents => [:new, :create, :edit, :update, :destroy, :add_attachment]}, :require => :loggedin | |
110 map.permission :view_documents, {:documents => [:index, :show, :download]}, :read => true | |
111 end | |
112 | |
113 map.project_module :files do |map| | |
114 map.permission :manage_files, {:files => [:new, :create]}, :require => :loggedin | |
115 map.permission :view_files, {:files => :index, :versions => :download}, :read => true | |
116 end | |
117 | |
118 map.project_module :wiki do |map| | |
119 map.permission :manage_wiki, {:wikis => [:edit, :destroy]}, :require => :member | |
120 map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member | |
121 map.permission :delete_wiki_pages, {:wiki => [:destroy, :destroy_version]}, :require => :member | |
122 map.permission :view_wiki_pages, {:wiki => [:index, :show, :special, :date_index]}, :read => true | |
123 map.permission :export_wiki_pages, {:wiki => [:export]}, :read => true | |
124 map.permission :view_wiki_edits, {:wiki => [:history, :diff, :annotate]}, :read => true | |
125 map.permission :edit_wiki_pages, :wiki => [:edit, :update, :preview, :add_attachment] | |
126 map.permission :delete_wiki_pages_attachments, {} | |
127 map.permission :protect_wiki_pages, {:wiki => :protect}, :require => :member | |
128 end | |
129 | |
130 map.project_module :repository do |map| | |
131 map.permission :manage_repository, {:repositories => [:new, :create, :edit, :update, :committers, :destroy]}, :require => :member | |
132 map.permission :browse_repository, {:repositories => [:show, :browse, :entry, :raw, :annotate, :changes, :diff, :stats, :graph]}, :read => true | |
133 map.permission :view_changesets, {:repositories => [:show, :revisions, :revision]}, :read => true | |
134 map.permission :commit_access, {} | |
135 map.permission :manage_related_issues, {:repositories => [:add_related_issue, :remove_related_issue]} | |
136 end | |
137 | |
138 map.project_module :boards do |map| | |
139 map.permission :manage_boards, {:boards => [:new, :create, :edit, :update, :destroy]}, :require => :member | |
140 map.permission :view_messages, {:boards => [:index, :show], :messages => [:show]}, :public => true, :read => true | |
141 map.permission :add_messages, {:messages => [:new, :reply, :quote]} | |
142 map.permission :edit_messages, {:messages => :edit}, :require => :member | |
143 map.permission :edit_own_messages, {:messages => :edit}, :require => :loggedin | |
144 map.permission :delete_messages, {:messages => :destroy}, :require => :member | |
145 map.permission :delete_own_messages, {:messages => :destroy}, :require => :loggedin | |
146 end | |
147 | |
148 map.project_module :calendar do |map| | |
149 map.permission :view_calendar, {:calendars => [:show, :update]}, :read => true | |
150 end | |
151 | |
152 map.project_module :gantt do |map| | |
153 map.permission :view_gantt, {:gantts => [:show, :update]}, :read => true | |
154 end | |
155 end | |
156 | |
157 Redmine::MenuManager.map :top_menu do |menu| | |
158 menu.push :home, :home_path | |
159 menu.push :my_page, { :controller => 'my', :action => 'page' }, :if => Proc.new { User.current.logged? } | |
160 menu.push :projects, { :controller => 'projects', :action => 'index' }, :caption => :label_project_plural | |
161 menu.push :administration, { :controller => 'admin', :action => 'index' }, :if => Proc.new { User.current.admin? }, :last => true | |
162 menu.push :help, Redmine::Info.help_url, :last => true | |
163 end | |
164 | |
165 Redmine::MenuManager.map :account_menu do |menu| | |
166 menu.push :login, :signin_path, :if => Proc.new { !User.current.logged? } | |
167 menu.push :register, :register_path, :if => Proc.new { !User.current.logged? && Setting.self_registration? } | |
168 menu.push :my_account, { :controller => 'my', :action => 'account' }, :if => Proc.new { User.current.logged? } | |
169 menu.push :logout, :signout_path, :if => Proc.new { User.current.logged? } | |
170 end | |
171 | |
172 Redmine::MenuManager.map :application_menu do |menu| | |
173 # Empty | |
174 end | |
175 | |
176 Redmine::MenuManager.map :admin_menu do |menu| | |
177 menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural | |
178 menu.push :users, {:controller => 'users'}, :caption => :label_user_plural | |
179 menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural | |
180 menu.push :roles, {:controller => 'roles'}, :caption => :label_role_and_permissions | |
181 menu.push :trackers, {:controller => 'trackers'}, :caption => :label_tracker_plural | |
182 menu.push :issue_statuses, {:controller => 'issue_statuses'}, :caption => :label_issue_status_plural, | |
183 :html => {:class => 'issue_statuses'} | |
184 menu.push :workflows, {:controller => 'workflows', :action => 'edit'}, :caption => :label_workflow | |
185 menu.push :custom_fields, {:controller => 'custom_fields'}, :caption => :label_custom_field_plural, | |
186 :html => {:class => 'custom_fields'} | |
187 menu.push :enumerations, {:controller => 'enumerations'} | |
188 menu.push :settings, {:controller => 'settings'} | |
189 menu.push :ldap_authentication, {:controller => 'auth_sources', :action => 'index'}, | |
190 :html => {:class => 'server_authentication'} | |
191 menu.push :plugins, {:controller => 'admin', :action => 'plugins'}, :last => true | |
192 menu.push :info, {:controller => 'admin', :action => 'info'}, :caption => :label_information_plural, :last => true | |
193 end | |
194 | |
195 Redmine::MenuManager.map :project_menu do |menu| | |
196 menu.push :overview, { :controller => 'projects', :action => 'show' } | |
197 menu.push :activity, { :controller => 'activities', :action => 'index' } | |
198 menu.push :roadmap, { :controller => 'versions', :action => 'index' }, :param => :project_id, | |
199 :if => Proc.new { |p| p.shared_versions.any? } | |
200 menu.push :issues, { :controller => 'issues', :action => 'index' }, :param => :project_id, :caption => :label_issue_plural | |
201 menu.push :new_issue, { :controller => 'issues', :action => 'new' }, :param => :project_id, :caption => :label_issue_new, | |
202 :html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) } | |
203 menu.push :gantt, { :controller => 'gantts', :action => 'show' }, :param => :project_id, :caption => :label_gantt | |
204 menu.push :calendar, { :controller => 'calendars', :action => 'show' }, :param => :project_id, :caption => :label_calendar | |
205 menu.push :news, { :controller => 'news', :action => 'index' }, :param => :project_id, :caption => :label_news_plural | |
206 menu.push :documents, { :controller => 'documents', :action => 'index' }, :param => :project_id, :caption => :label_document_plural | |
207 menu.push :wiki, { :controller => 'wiki', :action => 'show', :id => nil }, :param => :project_id, | |
208 :if => Proc.new { |p| p.wiki && !p.wiki.new_record? } | |
209 menu.push :boards, { :controller => 'boards', :action => 'index', :id => nil }, :param => :project_id, | |
210 :if => Proc.new { |p| p.boards.any? }, :caption => :label_board_plural | |
211 menu.push :files, { :controller => 'files', :action => 'index' }, :caption => :label_file_plural, :param => :project_id | |
212 menu.push :repository, { :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil }, | |
213 :if => Proc.new { |p| p.repository && !p.repository.new_record? } | |
214 menu.push :settings, { :controller => 'projects', :action => 'settings' }, :last => true | |
215 end | |
216 | |
217 Redmine::Activity.map do |activity| | |
218 activity.register :issues, :class_name => %w(Issue Journal) | |
219 activity.register :changesets | |
220 activity.register :news | |
221 activity.register :documents, :class_name => %w(Document Attachment) | |
222 activity.register :files, :class_name => 'Attachment' | |
223 activity.register :wiki_edits, :class_name => 'WikiContent::Version', :default => false | |
224 activity.register :messages, :default => false | |
225 activity.register :time_entries, :default => false | |
226 end | |
227 | |
228 Redmine::Search.map do |search| | |
229 search.register :issues | |
230 search.register :news | |
231 search.register :documents | |
232 search.register :changesets | |
233 search.register :wiki_pages | |
234 search.register :messages | |
235 search.register :projects | |
236 end | |
237 | |
238 Redmine::WikiFormatting.map do |format| | |
239 format.register :textile, Redmine::WikiFormatting::Textile::Formatter, Redmine::WikiFormatting::Textile::Helper | |
240 end | |
241 | |
242 ActionView::Template.register_template_handler :rsb, Redmine::Views::ApiTemplateHandler |