annotate .svn/pristine/45/45df98f4dee1373d2f3b9bf2feb192802c45fbe5.svn-base @ 1524:82fac3dcf466 redmine-2.5-integration

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